Overview of Oracle Table operations

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.