MySQL Common statements

Source: Internet
Author: User

MySQL Statement Specification:

  1. keyword and function name all uppercase

2. Database name, table name, field name all lowercase

3. The SQL statement must end with a semicolon

4. Comment Statement with "#"

First, the operation of the database

* SHOW {DATABASE | SCHEMA} ;

  View a list of data tables under the current server

* Use db_name;

Open Database

* SELECT DATABASE ();

View the currently selected database

* Creat {DATABASE | SCHEMA} [IF not EXIST] db_name;

Create database, inside parentheses to prevent errors

* ALTER {DATABASE | SCHEMA} [db_name];

Modify Database

* DROP {DATABASE | SCHEMA} [IF EXISTS] db_name;

Delete the database, the contents in parentheses to prevent error

Second, Operation data sheet

* creat TABLE [IF not EXISTS] table_name ( column_name data_type , ... ) ;

Create a data table

* SHOW TABLES [from db_name];

View a list of data tables

* SHOW COLUMNS from table_name;

View the data table structure

* SELECT expr ... from table_name;

View selected table

* INSERT [INFO] table_name [( col_name , ... )] VALUES ( val , ... ) ;

Insert record ( column name if omitted, you need to copy all fields )

MySQL Common statements

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.