SQL INSERT INTO




The SQL INSERT INTO Statement is used to add new rows of data to a table in the database.

SYNTAX:

There are two basic syntaxes of INSERT INTO statement

INSERT INTO table_name( column1, column2....columnN)
VALUES ( value1, value2....valueN);
Here, column1, column2,...columnN are the names of the columns in the table into which we want to insert data.

INSERT INTO TABLE_NAME VALUES (value1,value2,value3,...valueN);

Not need to specify the column(s) name in the SQL query if we are adding values for all the columns of the table.
The order of the values is in the same order as the columns in the table.

EXAMPLE:

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (1, 'qqqq', 32, 'qqqqq', 2000.00 );

INSERT INTO CUSTOMERS VALUES ((2, 'WWWW', 23, 'EEEE', 3000.00 );
Inserts the values into the table CUSTOMERS.

No comments:

Post a Comment