SQL server is the most popular database of microsoft company which was develop in 1989. SQL stands for Structure Query Language. It is RDBMs so in this case record is store in tabular format. It is platform dependent because it runs only on windows operating system.
SQL Insert INTO Value Statement
The SQL INSERT INTO Value Statement is use to add new rows of data to a table in the database is knows as INSERT INTO Value Query
Syntax
INSERT INTO table_name (column1, column2, column3, .... ) VALUES (values1, values1, values1, .... )
Example of SQL Insert INTO Value Statement
Part 1
INSERT INTO school2 (id, name, birth_date, phone, gender) values (1,"raj", "1990-10-10", 784561236, "m");
Output of SQL Insert INTO Value Statement
Example of SQL Insert INTO Value Statement
Part 2
INSERT INTO school2 (id, name, birth_date, phone, gender) values (2, "rohit", "1990-11-10", 784561236, "m");
Output of SQL Insert INTO Value Statement
SQL INSERT INTO SELECT Statement
This statement copy data from one table and inserts it into another table is knows as SQL INSERT INTO SELECT Query.
Syntax
The Copy all columns from one table to another table.
INSERT INTO table2 SELECT * FROM table1 WHERE condition;
The Copy only some columns from one table into another table.
INSERT INTO table2 (column1, column2, column3, column3 ...) SELECT column1, column2, column3, column3 ... FROM table1 WHERE condition;
SQL INSERT INTO Multiple Statement
Syntax
Insert Into table_name (column1, column1, column1, ,,,, ) VALUES (value1, value2, value3, ....), (value1, value2, value3, ....), (value1, value2, value3, ....);
Example of SQL Insert Multiple Value statement
INSERT INTO person2 (id, name, birth_date, phone, gender) values (6, "rajan", "1998-09-11", 784561236, "m"), (7, "anu", "1993-11-11", 784561236, "m"), (8, "mohit", "1995-07-11", 784561236, "m"), (9, "shayam", "1997-04-21", 784561236, "m"), (10, "manmohan", "1999-11-12", 784561236, "m");
Output of SQL Insert Multiple Value statement
If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.
To know more about SQL please Wikipedia click here .
Stay Connected Stay Safe, Thank you
0 Comments