加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

Mysql学习mysql select查询中使用limit的例子

发布时间:2020-12-12 02:25:29 所属栏目:MySql教程 来源:网络整理
导读:《Mysql学习mysql select查询中使用limit的例子》要点: 本文介绍了Mysql学习mysql select查询中使用limit的例子,希望对您有用。如果有疑问,可以联系我们。 导读:本节内容:mysql select查询中limit的用法sql语句: /*mysql select * from Product;+-----

《Mysql学习mysql select查询中使用limit的例子》要点:
本文介绍了Mysql学习mysql select查询中使用limit的例子,希望对您有用。如果有疑问,可以联系我们。

导读:本节内容:mysql select查询中limit的用法sql语句: /*mysql> select * from Product;+-----------+------------+------------------...

本节内容:
mysql select查询中limit的用法MYSQL利用

sql语句:?
?MYSQL利用

/*
mysql> select * from Product;
+-----------+------------+----------------------+-------+
| ProductID | Name?????? | Description????????? | Price |
+-----------+------------+----------------------+-------+
|???????? 1 | Java?????? | Java Demo Code?????? |???? 6 |
|???????? 2 | Swing????? | Swing Demo Code????? |???? 7 |
|???????? 3 | C#???????? | C# Demo Code???????? |???? 4 |
|???????? 4 | JavaScript | JavaScript Demo Code |???? 3 |
|???????? 5 | SQL??????? | SQL Demo Code??????? |???? 8 |
|???????? 6 | Struts???? | Struts Demo Code???? |???? 9 |
+-----------+------------+----------------------+-------+
6 rows in set (0.00 sec)MYSQL利用

mysql> /* Browse Products */
mysql> SELECT ProductID,Name
??? -> FROM Product
??? -> ORDER BY ProductID
??? -> LIMIT 3,4;
+-----------+------------+
| ProductID | Name?????? |
+-----------+------------+
|???????? 4 | JavaScript |
|???????? 5 | SQL??????? |
|???????? 6 | Struts???? |
+-----------+------------+
3 rows in set (0.00 sec)MYSQL利用

*/
/* Create Database */?
Drop TABLE Product;MYSQL利用

CREATE TABLE Product (
??? ProductID INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
??? Name VARCHAR(50) NOT NULL,
??? Description VARCHAR(255) NOT NULL,
??? Price DECIMAL NULL
) Type=InnoDB;
?
?
/* Insert Data */
INSERT INTO Product (Name,Description,Price) VALUES ('Java',
?????????????????????????????????????????????????????? 'Java Demo Code',
?????????????????????????????????????????????????????? 5.99 );
INSERT INTO Product (Name,Price) VALUES ('Swing',
?????????????????????????????????????????????????????? 'Swing Demo Code',
?????????????????????????????????????????????????????? 6.99 );
INSERT INTO Product (Name,Price) VALUES ('C#',
?????????????????????????????????????????????????????? 'C# Demo Code',
?????????????????????????????????????????????????????? 3.99 );
INSERT INTO Product (Name,Price) VALUES ('JavaScript',
?????????????????????????????????????????????????????? 'JavaScript Demo Code',
?????????????????????????????????????????????????????? 2.99 );
INSERT INTO Product (Name,Price) VALUES ('SQL',
?????????????????????????????????????????????????????? 'SQL Demo Code',
?????????????????????????????????????????????????????? 7.99 );
INSERT INTO Product (Name,Price) VALUES ('Struts',
?????????????????????????????????????????????????????? 'Struts Demo Code',
?????????????????????????????????????????????????????? 8.99 );
?MYSQL利用

例子,使用limit查询:
?MYSQL利用

select * from Product;MYSQL利用

/* Browse Products */
SELECT ProductID,Name
FROM Product
ORDER BY ProductID
LIMIT 3,4;MYSQL利用

《Mysql学习mysql select查询中使用limit的例子》是否对您有启发,欢迎查看更多与《Mysql学习mysql select查询中使用limit的例子》相关教程,学精学透。编程之家PHP学院为您提供精彩教程。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读