MySQL notes--database basic additions and deletions change the table structure

Source: Internet
Author: User

Database basic additions and deletions to change

1. Increase - Add / Insert data,insert into

Insert which table, 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 in the order of the original column, you can also insert some columns, but the values and columns to correspond, not chaos!!!

inserting multiple rows of data at once :

i 1 2 " values ( 1 2) ( 1 2)

2. Change - updating data update

Update which table, which columns, which values

statement: update set column 1= 1 2= 2 3= 3 where

3. Check - Query data Select

query all columns of the table: S elect * from table name;

Query Section column : Select column 1, column 2 from table name where condition;

4. Delete - Deleting data Delete

D elete from table name where condition;


Modify table structure (alter Modify)

1. Modify Table name

R ENAME table name to new table name;

A lter table name rename to new table name;

2. Adding Columns

A lter table name The definition of the Add column list;

3. Modify the definition/properties of a column

A lter table name modify column name new definition;

4. Modify the order of columns

A lter table name modify column 1 definition 1 after column 2 ;

5. Modify column names

A lter table name change old column name new column name new definition;

6. Delete Column

A lter table name drop column name;


This article is from the "It Rookie Learning daily" blog, please be sure to keep this source http://huanrong.blog.51cto.com/12879628/1931825

MySQL Notes-database basic additions and deletions change table structure

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.