-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreating statements
More file actions
26 lines (20 loc) · 848 Bytes
/
Creating statements
File metadata and controls
26 lines (20 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
CREATE statements allow us to create a new table in the database.
We can use the CREATE statement anytime you want to create a new table from scratch. The statement below creates a new table named celebs.
CREATE TABLE celebs (
id INTEGER,
name TEXT,
age INTEGER
);
1. CREATE TABLE is a clause that tells SQL you want to create a new table.
2. celebs is the name of the table.
3. (id INTEGER, name TEXT, age INTEGER) is a list of parameters defining each column, or attribute in the table and its data type:
id is the first column in the table. It stores values of data type INTEGER
name is the second column in the table. It stores values of data type TEXT
age is the third column in the table. It stores values of data type INTEGER
EXAMPLE:
SELECT * FROM celebs;
CREATE TABLE celebs (
id INTEGER,
name TEXT,
age INTEGER
);