I. data definition language)
A document language is a language defined for the format and form of a document. It is the first thing that every database needs to create, the table relationships, column primary keys in the table, and the reference relationships between tables are all planned at the beginning.
1. Create a table:
Create table table_name (
Column1 datatype [not null] [not null primary key],
Column2 datatype [not null],
...);
Note:
Datatype -- is the data format. For details, see the table.
Nut null-do not allow empty data (no data is provided ).
Primary key -- is the primary key of the table.
2. Change the table
Alter table table_name
Add column column_name datatype
Note: Add a column (the syntax of a column is not deleted.
Alter table table_name
Add primary key (column_name)
Note: You can change the table definition to set a column as a primary key.
Alter table table_name
Drop primary key (column_name)
Delete the definition of the primary key.
3. Create an index
Create index index_name on table_name (column_name)
Note: index the column of a table to increase the query speed.
4. Delete
Drop table_name
Drop index_name
| [Content navigation] |
| Page 1: Data Definition |
Page 2nd: Data Operations |