sql中select 使用_SQL,如何使用SELECT

sql中select 使用

You can get data out of tables using the SELECT command.

您可以使用SELECT命令从表中获取数据。

Get all rows and columns:

获取所有行和列:

SELECT * FROM people;
age |  name  
-----+--------
  37 | Flavio
   8 | Roger

Get only the name column:

仅获取name列:

SELECT name FROM people;
name  
--------
 Flavio
 Roger

Count the items in the table:

计算表中的项目:

SELECT COUNT(*) from people;
count 
-------
     2

You can filter rows in a table adding the WHERE clause:

您可以在添加WHERE子句的表中过滤行:

SELECT age FROM people WHERE name='Flavio';
age 
-----
  37

The results of a query can be ordered by column value, ascending (the default) or descending, using ORDER BY:

查询结果可以使用ORDER BY按列值升序(默认)或降序排列:

SELECT * FROM people ORDER BY name;
SELECT * FROM people ORDER BY name DESC;

翻译自: https://flaviocopes.com/sql-select/

sql中select 使用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值