select 需要配合很多东西,才能体现出强大

单表查询

查询某个表中的若干列

查询指定列

create unique/cluster index 索引名 on 表名 (列名 asc\desc)
select id,sname from student
select 目标列们 from 表名
—— 各个目标列之间用 “,” 隔开 —— ——

查询全部列

select * from student
select *from 表名
—— 这个表的全部列 ——

查询到的值经过计算

select sname,'year of birth',2019-sage birth
FROM
student

SQL(二)——select子句

select 目标列表达式 from 表名
—— 各个目标列之间用 “,” 隔开 —— ——
sname ‘year of birth’ 2019-sage birth
目标列的正常写法 表达式可以是字符串 表达式可以是加减法,birth是别名,用空格隔开

选择表中的若干元组

查询结果中有重复的,消除重复的行

查询结果中有重复的元组

select sname
FROM
student

SQL(二)——select子句
消除重复

select distinct sname
FROM
student

distinct:adj. 明显的;独特的;清楚的;有区别的
SQL(二)——select子句

查询满足条件的元组

这是就要用到where了
SQL(二)——select子句

相关文章:

  • 2021-07-05
  • 2022-12-23
  • 2021-06-07
  • 2021-11-24
猜你喜欢
  • 2021-12-30
  • 2021-07-16
  • 2022-02-26
  • 2021-11-24
  • 2021-06-25
  • 2022-12-23
相关资源
相似解决方案