DDL / DML / DCL difference

DDL

DDL Overview

DDL (Data Definition Language Data Definition Language) objects and object attributes for the operation of such an object database including itself, and database objects, such as: tables, views, etc., on the DDL these objects and properties and definitions of specific performance management Create, Drop and Alter on. Special Note: DDL operations concept of "object", "object" includes property of the object and the object, and the object than the minimum levels recorded large. Table For example: Create create a data table, Alter can change the field to the table, Drop can delete this table, we can see from here, DDL standing height, he would not operate on specific data.

DDL major statement (operation)

Create statement: can create databases and database objects.

Drop statement: You can delete tables, indexes, triggers, constraints, and permission condition data tables and so on.

Alter statement: modify data table definitions and properties.

DDL operation object (table)

The concept of table

Create a table that is used to store data, since we have nowhere to store the data, so we need to define some data types, in order to facilitate management.

Property sheet

Primary key attribute: primary key is the primary key constraint, but from the name is different, the primary key named biased to virtual (that description describes it), the primary key constraint named biased (embodiment is described the operation) the solid obtained, described are the same thing, the primary key constraint is a property table; in a table can have at most one primary key; a primary key can be defined in one or more fields; primary key to one or more of the value field must be unique and not empty , this can be recorded by a unique value of the field or representatives of the group field.

Unique properties: a table can have only one primary key attribute, to the user side table, the only constraint is proposed; the only constraints can be defined on one or more fields; the only constraint that the value of the field or group of fields only, may be empty, however, can not be repeated.

Foreign Key Properties: also known as foreign keys, also known as the foreign key constraint, the relationship with the primary key and the primary key constraint is the same; two tables for the foreign key constraint, if the table is the primary key A of table B field, this field is called the foreign key table B, called the primary table table a, table B is called from the table, it is to be noted that the computer must know the relationship you are.

Verification, Null and default attributes: verification of property known as verification constraints, also known as Null Null property constraints, default attribute called default constraint; these names describe one thing to describe a situation, this thing or this of course, we can artificially as specially made (note that the input data is on the line), but their intent is to automate, that is, let the computer do it.

(Do you know why the establishment of a primary key and unique constraints of time, it will automatically create an index? And is the only index, the index think mostly used in those fields, as well as the role of the index will know. Like primary key constraints, unique constraints , a non-null constraints, foreign key constraints, verification constraints and constraints of these operations are the default table has certain characteristics, so here I think they are the property of the table.)

DML

DML Overview

DML (Data Manipulation Language data manipulation language) for data manipulation database objects contained in a unit that is to say the operation is recorded.

The main DML statements (operation)

Insert statement: insert a record into the data table sheets.

Delete statement: delete the data in the table one or more records, you can delete all the data records in the table, but it is still the object of the operation is recorded.

Update statement: to modify the contents of records in the table already exists.

DML operation object - Record

note

When we Insert, Delete, and Update operations on the record, we must pay attention, be sure to clear some of the operations of its DDL.

DCL

DCL's Overview

DCL (Data Control Language Data control statements) operating permissions database objects, to determine these operations make the data more secure.

DCL major statement (operation)

Grant statement: Allows creator of an object to a user or a group, or all users (PUBLIC) certain rights.

Revoke statement: you can repeal a user or group of users or all access

DCL operation target (user)

At this time, the user refers to the user database.

Guess you like

Origin www.cnblogs.com/liu-ke/p/12049554.html