ASC and DESCIndicate ascending and descending, respectivelySELECT * FROM tablename ORDER BY id DESC: According to the ID field in descending order, from big to smallSELECT * FROM tablename ORDER by ID ASC: According to the ID field in ascending order, from small to largeClone tableThe methods for cloning tables in the DB2 database are as followsClone table:CREATE table clone table name like the table to be cloned;Inserting dataINSERT INTO Clone table select * from the table to be cloned;Oracle Database Cloning table:To clone the entire table:Create clone table name as SELECT * from the table to be cloned;---This includes all the data that was cloned.Clone only tables, do not clone data:Create clone table name as SELECT * FROM table to be cloned where 1=2;--is where it restricts the way you don't need data.If you need to add data later, you can use the following statement:INSERT INTO Clone table select * FROM table to be cloned; values are not allowed here---SQL query statement de-weight methodDB2 method of weight-down:CREATE TABLE clones a table (do re-use) like the original table;INSERT into clone table SELECT DISTINCT * from original table;SELECT * from clone table;Delete from the original table;INSERT into original table SELECT DISTINCT * from clone table;----------------------------DB2 de-weight method ----- Method One: ----using a copy table method can be achieved to go to the heavy mode, the main use of the SELECT statement has a method is distinct ----specifically implemented as follows: create Table clone tables like original table; ---------------insert a single data INSERT into clone table SELECT DISTINCT * from the original table; ---------delete meta data delete from the original table; -------Insert new data insert into original table select * from clone table; ---------------------complete-------------
Operations for tables (Oracle and DB2)