DDL Data Definition language
1 database objects:
A table's basic collection of data stores, consisting of rows and columns.
View extracts logically related data collections from a table,
The sequence provides a regular number.
Indexes improve the efficiency of queries.
Synonyms are aliases to objects.
2 querying which tables the user has established
Select *
From User_tables
3 viewing user-defined various database objects
Select distinct object_type
From User_objects;
4 viewing user-defined tables, views, synonyms, and sequences
Select *
From User_catalog
5 table naming rules
The table name and column name must begin with a letter and must be between 1-30 characters
must contain only uppercase and lowercase letters 0-9 _ $ #
Cannot duplicate a user-defined object
Must not be a reserved word for Oracle
6 Creating a table
Create table
(
Property 1 data type 1
Property 2 data type 2
Property 3 data type 3
Property 4 data type 4
)
The second method relies on other tables to create a table
Create table EMP2
As
Select employee_id id,last_name name,hire_date,salary
From employees;
7alter Table name
Change Table structure
Add ( property name data type)
Modify Modification can modify the data type of a column to an initial value (default value)
But remember, if you have data, you need to delete the data before you modify the column
Drop Column Property
Rename Column Property to new name (rename)
8 additions and deletions can be rolled back (DML can be rolled back)
DDL cannot be rolled back
9 Deleting a table
Drop Table name
Empty the table (not the same as delete)
Truncate table Name (table structure unchanged delete data only)
Change the table name one by one
Rename Old table name to new table name
Create and Manage tables