Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report