Oracle query for insert data in table


To insert new data in a table INSERT INTO statement is used.

Oracle INSERT INTO Syntax

There is two type of statement for insert data in a table .

In first statement the column names does not specify where the data will be inserted, only their values are specify.

Syntax: (Inserting a single record using the Values keyword):

INSERT INTO table
(column1, column2, ... column_n )
VALUES
(value1, value2, ... value_n );

In the second statement both the column names and the values are specifies for insert data or record.

Syntax: (Inserting multiple records using a SELECT statement):

INSERT INTO table
(column1, column2, ... column_n )
SELECT value1, value2, ... value_n
FROM source_table
WHERE conditions;

Here column1,column2,column3,... are the column name and value1,value2,value3,... are the values.

Example:

INSERT INTO students
(student_id, student_name)
VALUES
(40, 'DAV');

output:
1 row(s) inserted.
0.02 seconds








Connection failed: SQLSTATE[28000] [1045] Access denied for user 'studentdb'@'localhost' (using password: YES)

Subscribe