Home >Database >Mysql Tutorial >MySQLSELECT语句_MySQL

MySQLSELECT语句_MySQL

WBOY
WBOYOriginal
2016-05-31 08:46:201026browse

SELECT语句:

products表如下:

/

a 从一个表中选出一列 :mysql> SELECT prod_name FROM products;

/

b 从表中检索多个列:mysql>SELECT prod_id, prod_name FROM products;

/

c 检索所有列:mysql> SELECT * FROM products;//见第一幅图

d 检索不同行:mysql>SELECT DISTINCT prod_id FROM products;//当有多行产品id相同时,使用该语句时,多个相同的产品名称行,只显示一行。

/

e 限制结果 :mysql> SELECT prod_name FROM products LIMIT 5; // 显示前5行

/

f 使用完全限制名称:mysql> SELECT products.prod_id FROM lab.products;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn