Use of PostgreSQL

Source: Internet
Author: User
Tags lowercase parse error postgresql

First, connect the database

PG installed after the database can be connected with pgadmin, port number, the default PostgreSQL port number is 5432

Second, the data table display

The pgadmin result set Display interface header has two rows, one row is the field name, and one row is the data type of the field.
  

Third, Postgre query syntax

In the query statement of PostgreSQL, case is not sensitive. and has the following special place:

1, does not support "Top X", it is written as "Limit X". Such as

Select Top 5 * from PERSOM//Error

SELECT * FROM person limit 5//correct query

2. identifiers enclosed by delimited identifiers or quotation marks.

It is formed by enclosing any sequence of characters in double quotation marks ("). Delimited identifiers are always an identifier, not a keyword. Therefore, you can use "select" to indicate a field or table name,

A select without quotation marks is treated as part of a command, so if you use it as a table name or as a field name, a parse error occurs.

Identifiers enclosed in quotation marks can contain any character encoded not equal to zero (to include a double quotation mark, you can write two consecutive double quotes). This allows us to construct table names or field names that would otherwise be disallowed, such as those that contain blanks or numbers (&). But the length limit is still the same.

Enclose an identifier in quotation marks while also making it case-sensitive, and the name without the enclosed quotation marks is always converted to lowercase. For example, we think that the identifier foo, foo, "foo" is an equivalent PostgreSQL name, but "foo" and "foo" is different from the above three and between them.

PostgreSQL always converts unquoted names to lowercase, which is incompatible with the SQL standard, and the SQL standard requires names that are not enclosed in quotation marks to always be capitalized. Therefore, according to the standard,foo equals "foo " but not equal to "foo" .

If you want to write portable programs, we recommend that you either always enclose a name in quotation marks, or never

Use of PostgreSQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.