Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use DDL to realize the operation of SQL data table

Shulou Source: shulou.com Published: 2022-05-31 23:10:46 10月04日 Update

This article mainly shows you "how to use DDL to achieve SQL data table level operation", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "how to use DDL to achieve SQL data table level operation" this article.

DDL (Data Definition Language data definition language) is used to operate on databases and datasheets, because there are two operational objects (database and datasheets), so we have to indicate the objects we operate on after each command (create, drop, alter, show followed by database or table). This article focuses on the manipulation of data tables (table).

Increase

Create table table name (field settings)

Delete

Drop table table name

Change

Raname table table name to new table name

Alter table table name [table options]

Alter table Table name add Field Properties

Alter table table name drop field

Alter table Table name modify Field Properties

Alter table table name change old field new field property

Alter table table name add constraint foreign key constraint name foreign key (field) references table name (primary key field name) [cascading operation]

Alter table table name drop foreign key (foreign key name)

Check

Show tables [like pattern]

Show create table table name

Describe table name

[table options] add:

Character set gbk

[cascade operation] add:

Master table update: On update

Master table deletion: On delete

The act of cascading.

Cascade associated operation, depending on the operation of the master table

Set null is set to null, and the child table does not point to the records of any primary table

Restrict rejects operations related to the main table

The above is all the contents of the article "how to use DDL to operate at the SQL data table level". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Data fields datasheets articles levels content properties objects databases learning help two actions commands pointing easy to understand more organization knowledge editing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Docker Shulou Tech Info Linux OPPO Reno