Oracle - Insert
In Oracle, INSERT statement is used to add a single record or multiple records into the table.
INSERT INTO table (column1, column2, ... column_n ) VALUES (expression1, expression2, ... expression_n );
INSERT INTO table (column1, column2, ... column_n ) SELECT expression1, expression2, ... expression_n FROM source_table WHERE conditions;
It is the simplest way to insert elements to a database by using VALUE keyword.
Consider here the already created suppliers table. Add a new row where the value of supplier_id is 23 and supplier_name is Flipkart.
INSERT INTO suppliers (supplier_id, supplier_name) VALUES (50, 'Flipkart');
1 row(s) inserted. 0.02 seconds
This method is used for more complicated cases of insertion. In this method insertion is done by SELECT statement. This method is used to insert multiple elements.
In this method, we insert values to the "suppliers" table from "customers" table. Both tables are already created with their respective columns.
INSERT INTO suppliers (supplier_id, supplier_name) SELECT age, address FROM customers WHERE age > 20;
4 row(s) inserted. 0.00 seconds
You can even check the number of rows that you want to insert by following statement:
SELECT count(*) FROM customers WHERE age > 20;
What Is Oracle
posted on 2019-11-29 01:11:21 - ORACLE Tutorials
ORACLE - Trigger
posted on 2019-11-28 22:14:22 - ORACLE Tutorials
ORACLE - Cursor
posted on 2019-11-28 22:13:54 - ORACLE Tutorials
MySQL - Triggers
posted on 2019-11-29 21:44:07 - mysql Tutorials
MySQL - Grant_ Revoke Privilege
posted on 2019-11-26 23:15:04 - mysql Tutorials
MySQL Vs SQL
posted on 2019-11-25 05:02:26 - mysql Tutorials