<-- Chapter 17: SQL ORDER BY
Chapter 18
SQL INSERT
INSERT INTO is the SQL Statement used to insert data in database table in the form of rows and columns.
Lets see an example from the below table "employees" :-
employee_id |
name |
code |
designation |
salary |
101 |
ABC |
E-101 |
Engineer |
12000 |
102 |
DEF |
E-102 |
Doctor |
8000 |
103 |
GHI |
E-103 |
Software Developer |
8000 |
104 |
JKL |
E-104 |
CEO |
12000 |
105 |
MNO |
E-105 |
Software Developer |
100000 |
INSERT INTO SQL Statement Syntax :- INSERT INTO statement can be written in two ways :-
1.
INSERT INTO tablename
VALUES (value1, value2, value3,...);
2.
INSERT INTO tablename (column1, column2, column3,...)
VALUES (value1, value2, value3,...);
INSERT INTO statement example :-
INSERT INTO `employees` (employee_id, name, code, designation, salary)
VALUES (106,'PQR','E-106','Photographer',30000);
Now Run this Query, we will see the output below :-
employee_id |
name |
code |
designation |
salary |
101 |
ABC |
E-101 |
Engineer |
12000 |
102 |
DEF |
E-102 |
Doctor |
8000 |
103 |
GHI |
E-103 |
Software Developer |
8000 |
104 |
JKL |
E-104 |
CEO |
12000 |
105 |
MNO |
E-105 |
Software Developer |
100000 |
106 |
PQR |
E-106 |
Photographer |
30000 |
We can see here, One new record is inserted in employee table.
Chapter 19: SQL UPDATE -->
0 Comment(s)