《Mysql学习mysql select查询中使用limit的例子》要点:
本文介绍了Mysql学习mysql select查询中使用limit的例子,希望对您有用。如果有疑问,可以联系我们。
本节内容:
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, Description, Price) VALUES ('Swing',
'Swing Demo Code',
6.99 );
INSERT INTO Product (Name, Description, Price) VALUES ('C#',
'C# Demo Code',
3.99 );
INSERT INTO Product (Name, Description, Price) VALUES ('JavaScript',
'JavaScript Demo Code',
2.99 );
INSERT INTO Product (Name, Description, Price) VALUES ('SQL',
'SQL Demo Code',
7.99 );
INSERT INTO Product (Name, Description, 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学院为您提供精彩教程。