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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CREATE TABLE supplier_item (<br />

supp_no INTEGER NOT NULL PRIMARY KEY,<br />

item_no INTEGER NOT NULL REFERENCES john.item (itemno),<br />

qty INTEGER<br />

) ;<br />

The table will be created in the current owner schema.<br />

The following CREATE TABLE statement explicitly specifies a table owner, gus:<br />

CREATE TABLE account (<br />

account integer,<br />

balance numeric (12,2),<br />

info char (84)<br />

) ;<br />

CREATE TABLE<br />

The following example shows the AS query_expression form of CREATE TABLE to create and<br />

load a table with a subset of the data in the customer table:<br />

CREATE TABLE dealer (name, street, city, state)<br />

AS<br />

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

FROM customer<br />

WHERE state IN ('CA','NY', 'TX') ;<br />

The following example includes a NOT NULL column constraint and DEFAULT clauses for column<br />

definitions:<br />

CREATE TABLE emp (<br />

empno integer NOT NULL,<br />

deptno integer DEFAULT 10,<br />

join_date date DEFAULT NULL<br />

) ;<br />

The following example shows how to create a table with two columns, both of which have ABL<br />

descriptions and column labels specified:<br />

CREATE TABLE emp (<br />

empno INTEGER NOT NULL UNIQUE<br />

PRO_DESCRIPTION ’A unique number for each employee’<br />

PRO_COL_LABEL ’Employee No.’<br />

deptno INTEGER DEFAULT 21 NOT NULL<br />

PRO_DESCRIPTION ’The department number of the employee’<br />

PRO_COL_LABEL ’Dept. No.’<br />

)<br />

PRO_HIDDEN ’Y’ PRO_DESCRIPTION ’All Employees’;<br />

The table itself has a description specified, and will be created as hidden.<br />

Note Table columns defined in OpenEdge <strong>SQL</strong> have default format values identical to those created<br />

by the <strong>Data</strong> Dictionary. Thus, columns created by <strong>SQL</strong> will have the same default format as<br />

columns created by ABL tools.<br />

23

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

Saved successfully!

Ooh no, something went wrong!