SQL Insert Query – SQL TUTORIAL | Software Testing Material

SQL Insert Query:

The SQL INSERT INTO statement is used to insert new records in a table.

Syntax:

1
INSERT INTO table_name (column_name_1,column_name_2,column_name_3,... column_name_n) VALUES (value_1,value_2,value_3,...value_n);

Here, column_name_1, column_name_2,…column_name_N are the names of the columns in the table into which you want to insert data.

Example:

Following statements would create three records in SCOREBOARD table:

1
2
3
INSERT INTO SCOREBOARD(Playername, Runs, Balls, Sixers, Fours) VALUES (‘Sachin’, 100, 100, 6, 10);
INSERT INTO SCOREBOARD(Playername, Runs, Balls, Sixers, Fours) VALUES (‘Sehwag’, 90, 70, 8, 4);
INSERT INTO SCOREBOARD(Playername, Runs, Balls, Sixers, Fours) VALUES (‘Dravid’, 20, 30, 0, 4);

Example To Insert Data only in a specified column using SQL Insert Query:

1
INSERT INTO SCOREBOARD (Playername, Runs) VALUES (‘Ganguly’, 80);

In the next tutorial, we will see How To UPDATE Data in a Table in SQL

Check out the complete SQL Tutorial by clicking on below link:

SQL Tutorial – Complete