成都网站建设设计

将想法与焦点和您一起共享

mysql数据库sql语句的正确用法

以下的文章介绍了mysql数据库sql语句,取表中的n-m条数据的实际步骤介绍,同时也包括了一些其他常用的数据库sql语句取相关表中的n-m条数据的实际操作,我们首先是以命题的方式来写出我们所要表达的内容。

命题:写出一条Sql语句: 取出表A中第31到第40记录(自动增长的ID作为主键, 注意:ID可能不是连续的。)

oracle数据库中:

 
 
 
 
  1. select * from A where rownum<=40 minus select * from A where rownum<=30

sqlserver数据库中:

 
 
 
 
  1. select top 10 * from A where id not in (select top 30 id from A )
  2. select top 10 * from A where id>(select max(id) from (select top 30 id A) as A)

mysql数据库中:

 
 
 
 
  1. SELECT * FROM A LIMIT 30,40

以上的相关内容就是对mysql数据库的sql语句介绍,望你能有所收获。


网页题目:mysql数据库sql语句的正确用法
网页网址:https://chengdu.cdxwcx.cn/article/djepdgp.html