:



DML CREATE TABLE




 

CREATE TABLE <table name>

( { <column name> <data type> I<size>]

[<colcnstrnt> ...]} .,.. );

[<tabconstrnt>] .,.. );

 

 

<table name> .

<column name> .

<data type> .

:

INTEGER ( ),

CHARACTER (),

DECIMAL (),

NUMERIC (),

SMALLINT ()

FLOAT ( )

REAL (),

DOUBLE PRECISION (

),

LONG * ( *),

VARCHAR * ( ) *,

DATE ( *),

TIME ()

( * - SQL )

<size> . <data type>.

<colconstrnt> :

NOT NULL ( ),

UNIQUE (),

PRIMARY KEY ( ),

CHECK(<predicate>) ( ),

DEFAULT = ( =

<value expression> )

REFERENCES <table name> (

[(<column name> .,.. )] [( ) ] )

<tabconstrnt> :

UNIQUE (),

PRIMARY KEY ( ),

CHECK ( )

FOREIGN KEY(<column name>) ( )

REFERENCES <table name> (

[(<column name> .,.. )] [( ) ].

+-------------------------------------------------------------------+

 

Create Table Customer

(ID integer Primary Key NOT NULL,

NAME char(20),

CITY char(20),

CREDIT decimal,

BIRTHDAY date

)

Create Table Employee

(ID integer Primary Key NOT NULL,

NAME char(20),

CITY char(20),

COMM decimal,

BIRTHDAY date

)

 

Create Table Orders

(ID integer NOT NULL,

Cust_Ref integer NOT NULL References Customers,

Emp_Ref integer NOT NULL References Employee,

START date,

FINISH date

Check Start<Finish

)

 

Create Table Item

(Order_Ref integer NOT NULL References Orders,

Product_Ref integer NOT NULL References Product,

Amount integer

Update of Orders Cascades,

Delete of Orders Cascades

Delete of Product Restricted

)

 

Create Table Product

(Id integer Primary Key,

Name char(30),

Price decimal,

Type char(10)

)

 

, SQL . , , ( ) . ANSI SQL.

 

" ", - , . , ; , (, - ) SQL *.

 


:

: 2015-01-29; : 96; !;





lektsii.com - . - 2014-2023 . (0.006 .)