1--sql insert quest example
2INSERT INTO table_name (column1, column2, column3, ...)
3VALUES (value1, value2, value3, ...);
1-- Note: This is specifically for SQL - Oracle
2-- ---------------------------------------------------------------
3-- OPTION 1: Insert specific values (other values will be null)
4
5-- syntax
6INSERT INTO <TABLE_NAME> (<column1>,<column2>,<column3>,...)
7VALUES (<value1>,<value2>,<value3>,...);
8
9-- example
10INSERT INTO SALES (SALE_ID,ITEM_ID,QUANTITY,AMOUNT)
11VALUES (631,13,4,59.99);
12-- ---------------------------------------------------------------
13-- OPTION 2: Insert a value for every field
14
15-- syntax
16INSERT INTO <TABLE_NAME> VALUES (<value1>,<value2>,...,<valueN>);
17
18-- example (SALES table only consists of 4 columns)
19INSERT INTO SALES VALUES (631,13,4,59.99);
20-- ---------------------------------------------------------------
1--format
2INSERT INTO Customers (CustomerName, City, Country)
3SELECT SupplierName, City, Country FROM Suppliers;
4
5--examples
6INSERT INTO Customers (CustomerName, City, Country)
7SELECT SupplierName, City, Country FROM Suppliers;
1INSERT INTO table1 (emp_id, fname)
2SELECT emp_id, fname
3FROM table2
4WHERE status = 'Active';
1/*No List parameters */
2INSERT INTO table_name
3
4VALUES (value1, value2, value3, ...);