Geography Reference
In-Depth Information
This will open the SQL Editor pane.
Figure 48: SQL Editor
Type your SQL statements in the top pane, and press F5 or click the green arrow to run your
SQL. The results and messages will appear in the lower pane.
A side note on using SQL in Postgres
Using SQL in Postgres is likely to cause some users problems: Postgres is case sensitive by
default. If you create a table or other object with a name with specific casing, it will create
exactly that name. However, when trying to access the object, Postgres will look for the
object name using all lowercase letters unless the name is enclosed in quotation marks.
As an example, if I CREATE TABLE Shawty , then the table will be named Shawty with a
capital S. But if I then run SELECT * FROM Shawty , Postgres will fail to find the table.
Instead, I need to type SELECT * FROM "Shawty" to make Postgres pay attention to the
casing of the name.
This also extends to the Postgres data adapter for .NET. If you are unable to access a table
in the Postgres data adapter, try putting the table name in quotation marks and you'll most
likely find it resolves the issue.
Please note that regular strings are enclosed with single quotes, not double quotes. If you
enclose your literal string in double quotes, Postgres will interpret your text as an object
name and not as data.
The best practice for creating objects in Postgres is to give them all lowercase names. I've
done exactly this for the database I'll be using to demonstrate the SQL functions, and I've
changed all the names of tables and columns to lowercase after importing the data as shown
previously. I've also removed columns from the dataset that are unused either in the
examples, or in general.
If you receive errors while trying the samples, make sure that you're making the same
changes I am, using single and double quotes properly, and correctly casing names as
needed.
Search WWH ::




Custom Search