1. DDL
1-1. DDL overview DDL (Data Definition Language) is used to operate on attributes of objects and objects. Such objects include the database itself and database objects, such: tables, views, and so on. DDL manages and defines these objects and attributes in create, drop, and alter. Note: The definition of "object" in DDL operations. "object" includes attributes of objects and objects, and the minimum value of an object is greater than that of a record. For example, create a data table. Alter can change the field of the table. Drop can delete the table. Here we can see the height of the DDL site, it does not operate on specific data. 1-2. DDL Statement (operation) Create statement: you can create some objects in the database and database. Drop statement: You can delete data tables, indexes, triggers, condition constraints, and permissions of data tables. Alter statement: Modify the definition and attributes of a data table. 1-3. DDL operation object (table) 1-3-1. Create a table concept table to store data. Because the data we store is not available, therefore, we need to define some data types to facilitate management. 1-3-2. attribute primary key attribute of the table: the primary key is the primary key constraint, but the names of the tables are different. The primary key names tend to be virtual (that is, the description of the table ), the name of the primary key constraint tends to be real (that is, the implementation of the description operation). It describes the same thing. The primary key constraint is an attribute in the table. A table can have at most one primary key; A primary key can be defined in one or more fields. A primary key makes the values of one or more fields unique and not empty, in this way, you can use this field or the value in this field to uniquely represent a record. Unique attribute: A table can have only one primary key attribute. A unique constraint is proposed for the users of a square table. A unique constraint can be defined on one or more fields; the unique constraint makes this field or the value in this group of fields unique. It can be blank, but it cannot be repeated. Foreign key attribute: it is also called a foreign key constraint. It has the same relationship with the primary key and primary key constraints. The foreign key constraint applies to two tables, if the primary keyword of Table A is a field in Table B, this field is called the foreign key of Table B. Table A is called the primary table and table B is called the slave table. Note that, the computer must know this relationship. Check, null, and default attributes: Check attributes are also called verification constraints. null attributes are also called null constraints, and default attributes are also called default constraints. These names are a description, describe a situation. We can do this or this situation as intended (only pay attention to the input data), but their intention is to achieve automation, that is, let the computer do this. (Do you know why indexes are automatically created when primary keys and unique constraints are created? It is also a unique index. Think about the fields used by the index and the function of the index. Operations such as primary key constraint, unique constraint, non-empty constraint, foreign key constraint, verification constraint, and default constraint make the table have some features, so here I think they are all table attributes .) Related Links: DDL, DML, and DCL (1-1. DDL: data definition)
2. DML 2-1. DML overview DML (data manipulation language data control language) is used to operate data contained in database objects, that is, the operation unit is record. 2-2. DML main statement (operation) insert statement: Insert a record into a data table sheet. Delete statement: delete one or more records in a data table. You can also delete all records in a data table. However, its operation object is still a record. Update statement: used to modify the content of records in an existing table. 2-3. DML operation object-record 2-3-1. Note that when we perform insert, delete, and update operations on the record, we must pay attention to it, you must be aware of some DDL operations. Related Links: DDL, DML, and DCL (1-2, DML: Data Operations)
3. DCL 3-1. DCL overview DCL (Data Control Language Data Control statement) operations are the permissions of database objects. The determination of these operations makes data more secure. 3-2. Primary DCL Statement (operation) grant statement: allows the Object Creator to grant certain permissions to a user or a group or all users (public. Revoke statement: You can revoke the access permissions of a user or a group or all users. 3-3. DCL operation object (User). At this time, the user refers to the database user. This article will be detailed later.