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

Basic additions, deletions, changes, queries and table structure of the database

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

Share

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

Basic additions, deletions, modifications and queries of the database

1. Add-add / insert data insert into

Which table to insert, those columns, what values?

Statement: insert into table name (column 1, column 2, column 3) values (value 1, value 2, value 3)

Can not be inserted according to the order of the original column, you can also insert some columns, but the value and the column should be one-to-one corresponding, can not be confused!

Insert multiple rows of data at once:

Insert into table name (column 1, column 2) values (value 1, value 2), (value 1, value 2)

2. Change-update data update

Which table, which columns, which values to update

Statement: update table name set column 1 = value 1, column 2 = value 2, column 3 = value 3 where condition

3. Query-query data select

Query all columns of the table: Select * from table name

Query partial column: select column 1, column 2 from table name where condition

4. Delete-Delete data delete

Delete from table name where condition

Modify table structure (alter modify)

1. Modify the table name

Rename table original table name to new table name

Alter table original table name rename to new table name

2. Add columns

Definition of Alter table table name add column name column

3. Modify the definition / properties of the column

New definition of Alter table table name modify column name

4. Modify the order of the columns

Alter table table name modify column 1 definition 1 after column 2

5. Modify the column name

Alter table table name change old column name new column name new definition

6. Delete columns

Alter table table name drop column column name

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

Database

Wechat

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

12
Report