Mysql syntax structure and mysql syntax

Source: Internet
Author: User

Mysql syntax structure and mysql syntax

Environment: win7 64-bit, mysql

Suitable for readers: have a certain understanding of the basic SQL syntax

<Table creation Statement>: create table <table Name> (<column Name> <type> <column-level constraints> [, <column Name> <type> <column-level constraints>]... [, <Table-level constraints>]); <type>: int | char | date | .... <column-level constraint>: [not] null | default <default value> | primary key | auto_increment | comment 'comment content' | unique | check (<Boolean expression>) | enum ('string ',...) |... <Table-level constraints>: primary key (<column Name> [, <column Name>]...), foreign key (<column Name> [, <column Name>]...) references <Table Name> (<column Name> [, <column Name>]...), with check option <create view statement>: create view as <view Name> <query statement>; creat E view (<column Name> [, <column Name>]...) as <query statement>; <compound query statement>: <query statement> [union | intersect | except T] [all] <query statement>; <nested query statement>: <query statement> (<query statement>); <query statement>: select * | <column name> {, <>}from <>{< table name >}[ where <Condition Statement>] [Group by <column Name> [having <grouping Condition Statement>] [Order By <column name 2> [asc | desc]; [statement]: NULL | statement {statement}: NULL | statement [, statement] · <name>: <Database name> | <Table name> | <column name> <[distinct] name [alias]>: You can remove duplicate names or specify aliases. <Condition Statement>: <column Name> | <function> <predicate> <condition> <predicate>: Comparison =, >,<, >=, <= ,! =, <>,!>,! <Not + the comparison operator (such as not =) determines the range between and, not between and determines the set in, not in character matches like, not like null is null, is not null multiple conditions and, or other not exists, exists, any, all <drop Statement>: drop table | index | view <table Name >|< index name >|< view Name>


<Grant Statement>: grant <permission> [, <permission>]… On <object type> <Object Name> to <user> [, <user>…] [With grant option];
<Permission>: SELECT, INSERT, UPDATE (<column Name> [, <column Name>]...), DELETE, all privieges, ALTER, INDEX, CREATETAB, CONNECT
<User>: username @ login host identified by "password" | public



<Revoke Statement>: revoke <permission> [, <permission>]… On <object type> <Object Name> from <user> [, <user>…]


 

 

 

 

 

Reference: Teaching Courseware

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.