Changing column order : INSERT Column Name « Insert Delete Update « Oracle PL / SQL






Changing column order

 
SQL>
SQL> CREATE TABLE purchase (
  2       product_name  VARCHAR2(25) NOT NULL,
  3       product_price NUMBER(4,2)  NOT NULL,
  4       purchase_date DATE
  5       );

Table created.

SQL>
SQL>
SQL> INSERT INTO purchase (product_name, product_price) VALUES ('Product Name 2', 2.5);

1 row created.

SQL> INSERT INTO purchase (product_name, product_price) VALUES ('Product Name 3', 50.75);

1 row created.

SQL> INSERT INTO purchase (product_price, product_name) VALUES (99.99, 'Product Name 4');

1 row created.

SQL>
SQL>
SQL>
SQL> SELECT purchase_date, product_price, product_name FROM   purchase;

PURCHASE_ PRODUCT_PRICE PRODUCT_NAME
--------- ------------- -------------------------
                    2.5 Product Name 2
                  50.75 Product Name 3
                  99.99 Product Name 4

3 rows selected.

SQL>
SQL> drop table purchase;

Table dropped.

SQL>
SQL>

 








Related examples in the same category

1.Using the column list in INSERT command, include a column list after the table name.
2.The order of values in the VALUES clause matches the order in which the columns are specified in the column list
3.Specifying a Null Value for a Column
4.Including Double Quotes in a Column Value
5.INSERTING DATA CONTAINING APOSTROPHES
6.SELECT SPECIFIC COLUMNS
7.Use quotation in insert statement in PL/SQL