-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInsert statements
More file actions
31 lines (22 loc) · 1.04 KB
/
Insert statements
File metadata and controls
31 lines (22 loc) · 1.04 KB
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
27
28
29
30
31
The INSERT statement inserts a new row into a table.
We can use the INSERT statement when you want to add new records. The statement below enters a record for Justin Bieber into the celebs table.
INSERT INTO celebs (id, name, age)
VALUES (1, 'Justin Bieber', 29);
INSERT INTO is a clause that adds the specified row or rows.
celebs is the table the row is added to.
(id, name, age) is a parameter identifying the columns that data will be inserted into.
VALUES is a clause that indicates the data being inserted.
(1, 'Justin Bieber', 29) is a parameter identifying the values being inserted.
1: an integer that will be added to id column
'Justin Bieber': text that will be added to name column
29: an integer that will be added to age column
EXAMPLE:
INSERT INTO celebs (id, name, age)
VALUES (1, 'Justin Bieber', 29);
INSERT INTO celebs (id, name, age)
VALUES (2, 'Beyonce Knowles', 42);
INSERT INTO celebs (id, name, age)
VALUES (3, 'Jeremy Lin', 35);
INSERT INTO celebs (id, name, age)
VALUES (4, 'Taylor Swift', 33);
OUTPUT Tab;e -> Has 4 rows