A database contains of many tables which has data stored in an order. To add up the rows, the user needs to use insert statement.
insert into table_name(column_list) values(values_list)
For better understanding, an example is given below.
A table named student must have values inserted into it. It has to be done as follows:
insert into student (varchar2 name(20), int rollnumber, varchar2 course(50)); values('Riya', 111, 'Computer Science');
1 row(s) inserted
To check whether the value is actually inserted, the query must be given as follows:
select * from student;
insert multiple rows :
A table can store upto 1000 rows in one insert statement. If a user want to insert multiple rows at a time, the following syntax has to written.
insert into table_name(column_list) values(value_list1) values(values_list2) . . . . values(values_listn)
If a user wants to insert more than 1000 rows, multiple insert statements, bulk insert or derived table must be used.
Consider a table student. If a user has to enter the data of 6 students at a time, the query must be given as follows-
insert into student(int rollnumber, varchar2(30) name, varchar2(20) course); values(111, 'Riya', 'CSE'); values(112, 'Apoorva', 'ECE'); values(113, 'Mina', 'Mech'); values(114, 'Rita', 'Biotechnology); values(115, 'Veena', 'Chemical'); values(116, 'Deepa', 'EEE');
6 row(s) inserted
To check whether the values are present in the table, the query must be given as follows:
select * from student;
The insert multiple rows statement was only available in the year 2008 and later on.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Insert Into Select statement in MS SQL Server
- SQL | INSERT INTO Statement
- SQL | INSERT IGNORE Statement
- Delete statement in MS SQL Server
- Select statement in MS SQL Server
- SQL | DESCRIBE Statement
- SELECT INTO statement in SQL
- Join statement in JCL
- SQL | MERGE Statement
- SQL | DELETE Statement
- SQL | UPDATE Statement
- SQL | Case Statement
- MERGE Statement in SQL Explained
- Batch statement in Cassandra
- MySQL | CREATE USER Statement
- Foreign key in MS SQL Server
- Where clause in MS SQL Server
- Difference between MS SQL Server and IBM DB2
- Introduction of MS SQL Server
- Order by in MS SQL Server
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : khushboogoyal499