MySQL syntax structure

Source: Internet
Author: User

Environment: Win7 64-bit, MySQL

For readers: Have some idea of SQL basic syntax

<Build a Table statement>:Create Table <Table name>(<Column Name> <Type> <Column-level constraints>[,< column names > < types > < column-level constraints >]... ..[,< Table-level constraints >]);<Type>:int | Char |Date|....<Column-level constraints>:[ not]NULL | default <Default value> | Primary Key |Auto_increment|Comment'Comment Content' | Unique | Check <Boolean expression> | ...<Table-level constraints>:Primary Key(<Column Name>[,< Column name >]...)| Foreign Key(<Column Name>[,< Column name >]... )References <Table name>(<Column Name>[,< Column name >]...)<Create a View statement>:Create View  as <View Name><Query statements>; Create View(<Column Name>[,< Column name >]...) as <Query statements>;<Compound Query Statements>:<Query statements>[union|intersect|except][ All]<Query statements>;<Nested query statements>:<Query statements>(<Query statements>);<Query statements>:Select *|<Column Name>{,<Holders>} from <Show>{<Table name>}[where < conditional statements >]    [GROUP by < column name > [having < grouping conditional statements >]][Order by < column name 2>[ASC | DESC]]; [Statement]: Empty|statement {statement}: Empty|Statement[, the statement] • •<Name>:<Database name>|<Table name>|<Column Name><[distinct]Name[aliases]>: You can give name a weight or specify an alias<Conditional statements>:<Column Name>|<Function> <Predicate><Conditions><Predicate>: Compare=,>,<,>=,<=,!=,<>,!>,!<  not +The above comparison operators (for example, not=) determine the scopebetween  and, not between  andDetermining the collectioninch, not inchCharacter Matching like, not  likeNull value is NULL, is  not NULLMultiple conditions and,orother not exists,exists, any, All <Drop statement>:Drop Table|Index|View <Table name>|<Index name>|<View Name>


<grant statement;:Grant < permissions >[,< permissions; [on < object type > < object name;] To < user >[,< user > ...] [with GRANT option];
< permissions >:select, INSERT, UPDATE (< column name >[,< column name;] ...), DELETE, all privieges, Alter,index, Createtab, CONNECT
< user >:username|public



<revoke statement >:revoke < permissions >[,< permissions; [on < object type > < object name;] From < user >[,< user > ...]


Reference: Teaching Courseware

MySQL syntax structure

Related Article

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.