SQL Insert Into Command

INSERT INTO Command In SQL

In SQL INSERT INTO Command add the new record (row) in a table. You can insert the data with the help of INSERT INTO command in two ways.

First way is inserting the data in all Column. In this way it is not necessary to specify the column name, just give the value.

Syntax is :

INSERT INTO table-name

Values(value1, value2...........) ;

Second way is inserting the data in specified Columns. In this way you must specify the column name and then give the value to that column.

Syntax is :

INSERT INTO table-name (Column1 , Cooumn2........)

Values(value1, value2...........) ;

For example:

if you have table Name "student " with the following column:

Rno (integre)

Name (VARCHAR (20))

Address ( (VARCHAR (20))

Then you can insert the record in this table with following statement:

INSERT INTO Student

VALUES(101, 'Qasim', 'DIKHAN')

If you want to Insert the value in specified column for example only in Rno column, and Name column:

INSERT INTO Student (Rno , Name)

VALUES(101, 'Qasim')

Remember all the string value must enclose in single quotation marks.