Skip to main content

Posts

Showing posts with the label alter sql

CREATE and ALTER Statement

Create Statement The CREATE statement is used to create a new table with no record. Let's create the table office . The records in the office table will contain a technical id, the name of the office, a description, the number of available places, the availability and the date for the next office security control: Query : CREATE TABLE office ( id_office INTEGER PRIMARY KEY NOT NULL , name VARCHAR ( 20 ) NOT NULL , description VARCHAR ( 255 ) , place_number INTEGER NOT NULL , available SMALLINT NOT NULL DEFAULT 1 , next_inspection DATE NOT NULL ) ; The table after the statement : office id_office INTEGER name VARCHAR(20) description VARCHAR(255) place_number INTEGER available SMALLINT next_inspection DATE  ALTER statement  The ALTER statement is used to modify a table. It can be used on a table with records in it.