DDL (Data Definition definitions ages) and ddldefinition

Source: Internet
Author: User

DDL (Data Definition definitions ages) and ddldefinition

I haven't written any SQL statement for a long time. Let's review it.

DDL defines different data segments, databases, tables, columns, indexes, and other database objects. Common DDL statements include create, drop, and alter.

Logon data: mysql-uroot-p

SQL commands generally end with a semicolon or \ g. Note that \ is not /.

1. Check the database show databases. Pay attention to the s following this.

2. create database wangking. Note that there is no s here.

3. Select the database use siyecao; list the tables in the database show tables;

4. Delete the database drop database wangking;

5. create a table user in the selected data, create table user (username varchar (50) default 'siyecao ', sex int (4) default 1, age int (4) default 22) engine = myisam default charset = utf8;

Delete A table named drop table siyecao.

6. View table information in detail. show create table user \ g; \ g is a vertical bar, which is easy to read.

7. Add a table field. Add the field password after username in the table user. Alter table user add password vachar (100) default 666666 after age;

8. modify the table type (field attribute) modify. Alter table user modify username varchar (255) after sex;

9. change the field name. Alter ttable user change password pwd varchar (50) default 888888 after username;

10. Delete table fields. Alter table user drop age;

11. Modify the field arrangement order. First/after field.









There are four types of SQL languages? What does each include?

Sqlserver (T_ SQL ):
DDL-Data Definition Language (CREATE, ALTER, DROP, DECLARE)

DML-data manipulation language (SELECT, DELETE, UPDATE, INSERT)

DCL-Data Control Language (GRANT, REVOKE, COMMIT, ROLLBACK)

Oracle SQL (P_ SQL) statements can be divided into the following types:
1. Data operation language statement [Data manipulation language, DML]
2. Data definition language statement [Data definition language, DDL]
3. transaction control statement [transaction control statement]
4. session control statement [session control statement]

The definition of database integrity is generally implemented by the SQL () Statement DDL or DML.

The answer to this question is DDL.
Data Definition Language (DDL) is a Language used to describe the real-world entities to be stored in a database. A database mode contains the description definitions of all entities in the database. These definitions include schema definitions and Operation Method definitions.

DML = Data Manipulation Language, Data Manipulation Language, and commands enable users to query databases and computer languages that operate on Data in existing databases. Specifically, UPDATE, INSERT, and DELETE.

DML (Data Manipulation Language) is a Data Manipulation Language, one of the types of SQL, in addition to the Data Definition Language (DDL) Data Definition Language and Data Control Language (DCL) Data Control Language. DML includes INSERT, UPDATE, and DELETE. Note that the select statement belongs to DQL (Data Query Language ). 1

Related Article

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.