23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

OpenEdge <strong>SQL</strong> identifiers<br />

190<br />

Conventional identifiers<br />

Conventional <strong>SQL</strong> identifiers must:<br />

• Begin with an uppercase or lowercase letter<br />

• Contain only letters (A–Z), digits (0–9), or the underscore character ( _ )<br />

• Not be reserved words, such as CREATE or DROP<br />

• Use ASCII characters only<br />

<strong>SQL</strong> does not distinguish between uppercase and lowercase letters in <strong>SQL</strong> identifiers. It<br />

converts all names specified as conventional identifiers to uppercase, but statements can refer<br />

to the names in mixed case.<br />

Example The following example illustrates the use of identifiers in a simple query statement where<br />

CustNum, Order, and OrderDate are the user-specified names of columns:<br />

SELECT CustNum, COUNT(*)<br />

FROM Order<br />

WHERE OrderDate < TO_DATE ('3/31/2004')<br />

GROUP BY CustNum<br />

HAVING COUNT (*) > 10 ;<br />

Delimited identifiers<br />

Delimited identifiers are strings of no more than 32 ASCII characters enclosed in quotation<br />

marks ( " " ). Delimited identifiers allow you to create identifiers that are identical to keywords<br />

or that use special characters (such as #, &, or *) or a space.<br />

Enclosing a name in quotation marks preserves the case of the name and allows it to be a<br />

reserved word or to contain special characters. Special characters are any characters other than<br />

letters, digits, or the underscore character. Subsequent references to a delimited identifier must<br />

also use quotation marks. To include a quotation mark character in a delimited identifier,<br />

precede it with another quotation mark.<br />

The following code example uses a delimited identifier to create a table named "Dealer<br />

Table", where the space character is part of the name:<br />

CREATE TABLE "Dealer Table" (name, address, city, state)<br />

AS<br />

SELECT name, address, city, state<br />

FROM customer<br />

WHERE state IN ('CA','NY', 'TX') ;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!