lec04.365

lec04.365 - . . Fall 2007 . CPE/CSC 365: Introduction to...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
. . Fall 2007 CPE/CSC 365: Introduction to Database Systems Alexander Dekhtyar . . SQL Data Defnition and Data Manipulation Languages (DDL and DML) Data Defnition Language. Creating a Relation CREATE TABLE Name ( attribute-declarations constraint-declarations ) Attribute declarations: AttName AttType [ default expression ] [ ColConstraints ] Constraints Column constraints: [constraint <ConstName>] [NOT] NULL : Not null constraint. [constraint <ConstName>] PRIMARY KEY : Primary key constraint (when the primary key consists of exactly one attribute, otherwise, use con- straint declaration). [constraint <ConstName>] UNIQUE : Key constraint (when the key con- sists of exactly one attribute, otherwise, use constraint declaration). [constraint <ConstName>] REFERENCES <Table>[(<AttName>)] [ON DELETE CASCADE] : Foreign key constraint (when the foreign key consists of exactly one attribute, otherwise, use constraint declaration). ON DELETE CASCADE speci±es that all rows containing a no longer existing value for must be deleted. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
[constraint <ConstName>] CHECK (<condition>) : any additional constraint on the value of the element in the table. Constraint declarations:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/19/2008 for the course CSC 365 taught by Professor Dekhtyar during the Spring '08 term at Cal Poly.

Page1 / 5

lec04.365 - . . Fall 2007 . CPE/CSC 365: Introduction to...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online