CREATE TABLE
From SQLZoo
The table games shows the year and the city hosting the Olympic Games.
| yr | city |
|---|---|
| 2004 | Athens |
| 2008 | Beijing |
| 2012 | London |
schema:scott
DROP TABLE games
The CREATE statement builds an empty table to hold rows. In this example the column yr is the PRIMARY KEY:
CREATE TABLE games
(yr INT NOT NULL PRIMARY KEY
,city VARCHAR(20)
);
INSERT INTO games(yr,city) VALUES (2004,'Athens');
INSERT INTO games(yr,city) VALUES (2008,'Beijing');
INSERT INTO games(yr,city) VALUES (2012,'London');
SELECT * FROM games;
See also