MySQL basic Operation command "reprint"

Source: Internet
Author: User

Original link: http://www.cnblogs.com/rookie-c/p/6425039.html

Create a database

CREATE DATABASE name;

Show all databases

SHOW DATABASES;

Deleting a database

DROP DATABASE name;

Select Database

Use DATABASENAME;

Displays the tables that exist in the current database

SHOW TABLES;

View table Structure

DESCRIBE DATABASENAME;

Delete a data table

Drop TABLE NAME (delete content and definition, free space)

Delete TABLE NAME (delete content does not delete definition, does not free space)

Querying all the data in a table

SELECT * from DATABASENAME;

Conditional query (field number equals 10)

SELECT * from DATABASENAME WHERE number=10;

Multi-Criteria query (field number equals 10, field class equals 2)

SELECT * from DATABASENAME WHERE number=10 and class= "2";

Query result sort (descending by id)

SELECT * from DATABASENAME WHERE number=10 ORDER by ID DESC

Note: Sorting uses the order by default in ascending order, and Desc is used for descending

Linked table Query

To find out which fields in the tables you want to query are intersected, complete the query through the fields of the intersection.

Select*from Table A, table B where table a.xxx= table b.xxx

Paging Query

SELECT * FROM table limit m,n (data from article M to nth data)

MySQL basic Operation command "reprint"

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.