Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: Yeeeee89 on Feb 13, 2019



Title: Explain the essential format of the CREATE TABLE statement. Include an example.
Post by: Yeeeee89 on Feb 13, 2019
Explain the essential format of the CREATE TABLE statement. Include an example.


Title: Explain the essential format of the CREATE TABLE statement. Include an example.
Post by: Omama on Feb 13, 2019
The essential format for the CREATE TABLE statement is:
CREATE TABLE tablename (
column-description,
column-description,
column-description,
. . .
optional table constraints
);
"Tablename" is the name that will be given to the newly created table. "Column-description" is a three-part description of each column to appear in the table. This description includes the name of the column, the column's data type, and an optional column constraint (either Primary Key, Null, or Not Null), in that order. The CONSTRAINT phrase can be used to set optional primary key, foreign key and referential integrity constraints for the table. All SQL statements must end with a semi-colon (;). Here is an example:
CREATE TABLE VEHICLE (
VIN CHAR(32),
Year INTEGER,
Make CHAR(25) NOT NULL,
CONSTRAINT VEHICLE_PK PRIMARY KEY (VIN)
);