91-9990449935 0120-4256464 |
SQL INSERT STATEMENTSQL INSERT statement is a SQL query. It is used to insert a single or a multiple records in a table.
There are two ways to insert data in a table:
1) Inserting data directly into a tableYou can insert a row in the table by using SQL INSERT INTO command. But there are 2 ways to do this. You can specify or ignore the column names while using INSERT INTO statement. To insert partial column values, you must have to specify the column names. But if you want to insert all the column values, you can specify or ignore the column names. If you specify the column names, syntax of the insert into statement will be as follows: Here col1, col2, col3, .... colN are the columns of the table in which you want to insert data.
Note: At the time of inserting a row into table, if you add values for all columns then there is no need to specify the column name in SQL INSERT query. Moreover, you must be sure that you are entering the values in the same order as the columns exist.But, If you ignore the column names, syntax of the insert into statement will be as follows: 2) Inserting data through SELECT StatementSQL INSERT INTO SELECT Syntax Note: when you add a new row, you should make sure that data type of the value and the column should be matched. If any integrity constraints are defined for the table, you must follow them. Topics of SQL INSERT Statement
SQL INSERT INTO Values Example
How to insert values in table? SQL INSERT INTO SELECT ExampleHow to insert values in a table through select statement? SQL INSERT Multiple Rows ExampleHow to insert multiple rows in a table?
Next TopicSQL Insert INTO Values
|