MySQL notes the most basic

Source: Internet
Author: User

Increase:

CREATE DATABASE database_name;

CREATE TABLE table_name (

ID int NOT NULL auto_increment

Zd1 char (5) NOT NULL

Zd2 Char (8) NOT NULL

Primary Key ID

);

ALTER TABLE table_name add field;

INSERT INTO table_name (field 1, Field 2 ....) ) VALUES (' xxx ', ' xxx ' ...);

By deleting:

Delete from table_name where between N1 and N2;

DROP TABLE table_name;

ALTER TABLE table_name DROP field;

Check:

show databases;

Show tables;

Show create table_name;

DESC table_name;

The Select field from the table_name where condition;

Select field, field from table_name ORDER BY id DESC limit n;

Change:

ALTER TABLE OLD_TABLE_NAME Rename table_name;

Updata table_name SET field = "xxx" where condition;

ALTER TABLE table_name rename old field new field;

ALTER TABLE table_name change old field new field character type;


Authorized:

Grant Select,insert,update,delete (or all privileges) on the database. Data table to User name @ "IP" identified by "password" (with GRANT option----can give it Authorized by his user);

FLUSH privileges;----save changes and take effect immediately

MySQL notes the most basic

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.