2016/04/28 (Preliminary knowledge of the database)

Source: Internet
Author: User

mysql-uroot-p;//Opening a database
Admin Enter password
Show databases;//queries all of the libraries
Use student;//into the corresponding library or table
Create database database name;//Creating a library
drop database name;//Delete a library
Create database if not exists library name;//creates a new inject without creating an error prevention
Cerate database if not EXISTS library name default CharSet utf8;//create a new library and set its encoding format
The CREATE table if not EXISTS table name (attributes of the table);//Creating a table
Insert into table name values ();//Add Table Properties
SELECT * from table name;//query All information in table
Show columns from table name;//print all rows and columns in the table
DESC table name;//All row and column methods in the same printed table are simple
Insert into table name (attributes to be added) values ();//Add the specified attribute to the table
ALTER TABLE name add property name;//Add the appropriate attribute to the table
ALTER TABLE name change property name modified attribute;//property changed
ALTER TABLE name drop property;//delete one row in a table
Crate Table select * from old table;//Copy a new table The original table still exists
Ceate Table select * from old table where 1=0;//just copy a table structure inside the data is not copied
SELECT * from table name where property = property variable;//Find specified property
CREATE index Myindex on table name (attribute name);//Gazzo citation
ALTER TABLE table Name DROP INDEX myindex;//Delete an index

2016/04/28 (Preliminary knowledge of the database)

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.