MYSQL: Delete and change

Source: Internet
Author: User

CREATE TABLE Table name
(
Whether the column name data type is empty (whether the primary key | is a unique | foreign key relationship),
Column name data type ... (The last column does not have a comma)
)

Create DATABASE name

Insert into database name. Table name values (data, comma separated by column order)

Update table Set column = new value where condition

Delete from table where condition

Select results show column from table where condition

Sum avg Max min count (number of) Order ASC DESC


CREATE TABLE Test1
(
UID varchar (primary) key (primary key),
PWD varchar (50),
Name varchar (50),
Netion varchar (50),
Foreign KEY (netion) references netion (code)
)
Attention:
1. Create a table after the last column do not write a comma
2. If more than one statement is executed together, be aware that semicolons are separated between statements
3. Write the code, all the symbols are half-width


Create several keywords for the table:
Primary key: Primary key
Non-empty: NOT NULL
Mysql:
Self-growing column: Auto_increment (must be cosmetic)
Foreign key relationship: FOREIGN key (column name) references table name (column name)

CRUD Operations:
Added: INSERT into info values (', ', ', ' ', ', ') require the value in the parentheses to be the same as the number of columns in the table
Insert into info (code,name) VALUES (",") adds the value of the specified column

Modified: Update info set name= ' Zhang San ' where code= ' p001 '

Delete: Delete from info where code= ' p001 '

MYSQL: Delete and change

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.