mysql文法結構

來源:互聯網
上載者:User

標籤:

環境:win7 64位、mysql

適合閱讀者:對sql基本文法有一定瞭解

<建表語句>:  create table <表名>(    <列名> <類型> <資料行層級條件約束>[,<列名> <類型> <資料行層級條件約束>]...    [,<表級約束>]  );<類型>:int | char | date |....<資料行層級條件約束>:[not ]null | default <預設值> | primary key | auto_increment | comment ‘注釋內容‘ | unique | check <布林運算式> | ...<表級約束>:primary key(<列名>[,<列名>]...) | foreign key(<列名>[,<列名>]... ) references <表名> (<列名>[,<列名>]...)<建立視圖語句>:  create view as <視圖名><查詢語句>;  create view(<列名>[,<列名>]...) as <查詢語句>;<複合查詢語句>:<查詢語句>[union|intersect|except][ all]<查詢語句>;<巢狀查詢語句>:<查詢語句>(<查詢語句>);<查詢語句>:  select *|<列名>{,<列明>}  from <表明>{<表名>}  [where <條件陳述式>]  [Group by <列名> [having <分組條件陳述式>]]  [Order By <列名2>[ asc | desc ]]; [語句]:  空|語句{語句}:   空|語句[,語句]··· <name>:  <資料庫名>|<表名>|<列名><[distinct ]name[ 別名]>:可以給name消重或指定別名<條件陳述式>:<列名>|<函數> <謂詞><條件><謂詞>:  比較   =, >, <, >=, <=, !=, <>, !>, !< not + 上述比較子(例如not=)  確定範圍 between and, not between and  確定集合 in, not in  字元匹配 like, not like  空值   is null, is not null  多重條件 and, or  其它   not exists, exists, any, all <drop語句>:drop table|index|view <表名>|<索引名>|<視圖名>


<grant語句>:grant <許可權>[,<許可權>]… [on <物件類型> <對象名>] to <使用者>[,<使用者> …] [with grant option];
<許可權>:SELECT, INSERT, UPDATE(<列名>[,<列名>]...), DELETE, ALL PRIVIEGES, ALTER,INDEX, CREATETAB, CONNECT 
<使用者>:userName|public



<revoke語句>:revoke <許可權>[,<許可權>]… [on <物件類型> <對象名>] from <使用者>[,<使用者> …]


 

 

 

 

 

參考:教學課件

mysql文法結構

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.