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

Database syntax

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Modify the table name:

1. Alter table table name rename to new name

2. Rename table table name to new name

Change the table name, and you can also cross databases.

Example: alter table aa rename to foo.xx

Move the aa table in test to foo and rename it to xx

It is better to move the table in the database than to rename it!

Add columns to the table.

Alter table table name add column name type

Delete the column:

Alter table table name drop column name

Note that you cannot delete all columns of a table, leaving at least one column.

Modify the column definition (you can only change the type of the column, not the name of the column)

Alter table table name

Modify old column name new type

Modify column name and type at the same time

Alter table table name change old column name new column name new type

Modify the character set of the table:

Alter table table name the name of the character set character set

Chuangyue (Shenzhen) Investment Management Co., Ltd.

Cheer for growth

Wechat: CreajoyYOJOY

Weibo: http://weibo.com/CreajoyYOJOY

Official website: http://www.creajoyvc.com/

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

Wechat

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

12
Report