Single-table operation!
(The code can be replaced by hand, written down for memory)
1. Create a table
CREATE TABLE Hkb_table_modify
(
NAME VARCHAR2 (6),
Age VARCHAR2 (3),
SEX VARCHAR2 (2)
)
2. Modify the table
Add field: Alter TABLE hkb_table_modify add ADDRESS nvarchar2 (3);
Delete field: ALTER TABLE hkb_table_modify drop column SEX;
Modify field properties: Alter TABLE hkb_table_modify MODIFY age number (2);
Field rename: Alter TABLE hkb_table_modify rename column age to AGE2;
3. Delete a table
drop table hkb_table_modify;
4. Enquiry Form
Query with a SELECT statement plus certain criteria.
Multi-table Operation!
1.union and UNION ALL (note: The fields of the two table query operations for Union must be the same)
Table (No Duplicates) addition of records
Select Name,age from Hkb_test1
Union
Select Name,age from Hkb_test2;
Add records in a table
Select Name,age from Hkb_test1
UNION ALL
Select Name,age from Hkb_test2;
2.join operation (detailed study when using)
Cross join: Is the product of the flute Descartes, in which the number of rows of a table is multiplied by the number of rows in a table without any constraints.
Left join: Returns all rows of table name 1, and for table name 2, records that do not meet the on condition are replaced with null values.
Rigth join: Returns all rows of table name 2, and for table name 1, records that do not meet the on condition are replaced with null values.
Full join: Returns all records in both tables, substituting null for records that do not meet on one end of the on condition.
Inner Jon: Returns only records in both tables that meet the on condition.
Overview of Oracle Table operations