DDL (Data Definition Language, Data Definition Language)
DDL contains the following three instructions: (1) CREATE (2) DROP (3) ALTER
Taking the PostgreSQL standard as an example, DDL has the following basic statements:
CREATE DATABASE <database name>;
CREATE TABLE <表名>
(<column name 1> <data type> <constraint of the column>,
<column name 2> <data type> <constraint of the column>,
<column name 3> <data type> <constraint of the column>,
...... ,
<Constraint 1 of the table>, <Constraint 2 of the table>, ... );
//Create a new database, new table.
DROP DATABASE <database name>;
DROP TABLE <表名>;
//Delete database and table. DROP operation is difficult to recover, so be careful when using it.
ALTER TABLE <table name> ADD COLUMN <column definition 1>, <column definition 2>, <column definition 3>, ...;
ALTER TABLE <table name> DROP COLUMN <column name 1>, <column name 2>, <column name 3>, ...;
ALTER TABLE <table name> RENAME TO <new table name>;
//Add columns, delete columns, change the name of the table.