ORACLE
ORACLE QUERIES
SELECT
INSERT
INSERT
INSERT ALL
UPDATE
DELETE
TRUNCATE TABLE
ORACLE TUTORIAL
Oracle Introduction
What Is Oracle
Create Tables
What Is Oracle
ORACLE TABLES
Create Tables
Create Table As
Alter Table
Drop Table
Global Temorary Tables
Local Temorary Tables
ORACLE VIEWS
Create View
ORACLE CLAUSES
DISTINCT
FROM
ORDER BY
GROUP BY
HAVING
ORACLE OPERATORS
UNION
UNION ALL
INTERSECT
MINUS
ORACLE JOINS
INNER JOIN
OUTER JOIN
EQUI JOIN
SELF JOIN
CROSS JOIN
ANTI JOIN
SEMI JOIN
ORACLE ADVANCE
PROCEDURES
FUNCTION
CURSOR
TRIGGER

INSERT



Oracle - Insert


In Oracle, INSERT statement is used to add a single record or multiple records into the table.


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

 INSERT INTO table  
(column1, column2, ... column_n )  
VALUES  
(expression1, expression2, ... expression_n );   

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

INSERT INTO table  
(column1, column2, ... column_n )  
SELECT expression1, expression2, ... expression_n  
FROM source_table  
WHERE conditions;   

Parameters:


  • table : The table to insert the records into.

  • column1, column2, ... column_n : The columns in the table to insert values.

  • expression1, expression2, ... expression_n : The values to assign to the columns in the table. So column1 would be assigned the value of expression1, column2 would be assigned the value of expression2, and so on.

  • source_table : The source table when inserting data from another table.

  • conditions : The conditions that must be met for the records to be inserted.


    Oracle Insert Example: By VALUE keyword


    It is the simplest way to insert elements to a database by using VALUE keyword.


    See this example:

    Consider here the already created suppliers table. Add a new row where the value of supplier_id is 23 and supplier_name is Flipkart.


    See this example:
    INSERT INTO suppliers  
    (supplier_id, supplier_name)  
    VALUES  
    (50, 'Flipkart');  
    

    Output :
    1 row(s) inserted.
    0.02 seconds
    

    Oracle Insert Example: By SELECT statement


    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.


    See this example:

    In this method, we insert values to the "suppliers" table from "customers" table. Both tables are already created with their respective columns.

    Execute this query:
    INSERT INTO suppliers  
    (supplier_id, supplier_name)  
    SELECT age, address  
    FROM customers  
    WHERE age > 20;  
    

    Output:
    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;  
    

    Output :
     Count(*)
         4
    


    What Is Oracle

    What Is Oracle

    posted on 2019-11-29 01:11:21 - ORACLE Tutorials


    TRIGGER

    ORACLE - Trigger

    posted on 2019-11-28 22:14:22 - ORACLE Tutorials


    CURSOR

    ORACLE - Cursor

    posted on 2019-11-28 22:13:54 - ORACLE Tutorials


    Prompt Examples

    ChatGPT Prompt Examples

    posted on 2023-06-21 22:37:19 - ChatGPT Tutorials


    Use Cases

    Chat GPT Key Use Cases

    posted on 2023-06-21 21:03:17 - ChatGPT Tutorials


    Prompt Frameworks

    Prompt Frameworks

    posted on 2023-06-21 19:33:06 - ChatGPT Tutorials