DDL, DML, and DCL

Source: Internet
Author: User

Understanding of DL, DML, and DCL 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 as tables and views. 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. The table attribute www.2cto.com primary key attribute: The primary key is the primary key constraint, but the names are different. The primary key name tends to be virtual (that is, the description of this issue ), 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 .) 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. The 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.

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.