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