mysql數(shù)據(jù)庫(kù)sql語(yǔ)句的正確用法
以下的文章介紹了mysql數(shù)據(jù)庫(kù)sql語(yǔ)句,取表中的n-m條數(shù)據(jù)的實(shí)際步驟介紹,同時(shí)也包括了一些其他常用的數(shù)據(jù)庫(kù)sql語(yǔ)句取相關(guān)表中的n-m條數(shù)據(jù)的實(shí)際操作,我們首先是以命題的方式來(lái)寫(xiě)出我們所要表達(dá)的內(nèi)容。
命題:寫(xiě)出一條Sql語(yǔ)句: 取出表A中第31到第40記錄(自動(dòng)增長(zhǎng)的ID作為主鍵, 注意:ID可能不是連續(xù)的。)
oracle數(shù)據(jù)庫(kù)中:
- select * from A where rownum<=40 minus select * from A where rownum<=30
sqlserver數(shù)據(jù)庫(kù)中:
- select top 10 * from A where id not in (select top 30 id from A )
- select top 10 * from A where id>(select max(id) from (select top 30 id A) as A)
mysql數(shù)據(jù)庫(kù)中:
- SELECT * FROM A LIMIT 30,40
以上的相關(guān)內(nèi)容就是對(duì)mysql數(shù)據(jù)庫(kù)的sql語(yǔ)句介紹,望你能有所收獲。
【編輯推薦】