上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页
摘要: select max(sal),min(sal),count() from emp; --ok select max(sal) "最高工资",min(sal)"最低工资",count() "员工人数" from emp; --ok select max(sal), lower(ename) from 阅读全文
posted @ 2026-04-24 10:28 菜鸟的奋斗军 阅读(4) 评论(0) 推荐(0)
摘要: select count(*) from emp; --返回emp表所有记录的个数 select count(deptno) from emp; --返回值是14 这说明deptno重复的记录也被纳入统计个数 select count(distinct deptno) from emp; --返回值 阅读全文
posted @ 2026-04-24 00:15 菜鸟的奋斗军 阅读(6) 评论(0) 推荐(0)
摘要: --单行函数 每一行返回一个值 --每一行返回一个值 --多行函数 多行返回一个值 聚合函数是多行函数 select lower(ename) from emp; --最终返回的是14行Lower() 是单行函数 --返回小写 select max(sal) from emp; --返回1行max( 阅读全文
posted @ 2026-04-23 23:55 菜鸟的奋斗军 阅读(9) 评论(0) 推荐(0)
摘要: select * from emp where ename like '%A%' select * from emp where ename like 'A%' --ename只要首字母是A的就输出 select * from emp where ename like '%A' --ename只要尾 阅读全文
posted @ 2026-04-23 22:31 菜鸟的奋斗军 阅读(7) 评论(0) 推荐(0)
摘要: select * from emp order by sal; --默认是按照升序排列 select * from emp order by deptno, sal;--先按照deptno升序排序 如果deptno相同,再按照sal升序排序 select * from emp order by de 阅读全文
posted @ 2026-04-23 18:04 菜鸟的奋斗军 阅读(7) 评论(0) 推荐(0)
摘要: --把工资在1500到3000之间工资最高前四个人信息 select top 4 * from emp where sal between 1500 and 3000 order by sal desc --desc降序 不写则默认是升序 --输出奖金非空的员工信息 select * from em 阅读全文
posted @ 2026-04-23 16:56 菜鸟的奋斗军 阅读(7) 评论(0) 推荐(0)
摘要: select * from emp; select top 2 * from emp; select top 15 percent * from emp; ———————————————————————————————————————————————————————————————————————— 阅读全文
posted @ 2026-04-22 23:37 菜鸟的奋斗军 阅读(12) 评论(0) 推荐(0)
摘要: select * from emp where sal in (1500,3000,5000) 等价于 select * from emp where sal =1500 or sal=3000 or sal=5000 select * from emp where sal not in (1500 阅读全文
posted @ 2026-04-22 23:02 菜鸟的奋斗军 阅读(8) 评论(0) 推荐(0)
摘要: select * from emp where sal >= 1500 and sal <=3000 等价于 select * from emp where sal between 1500 and 3000 --查找工资小于1500或大于3000之间所有员工信息 select * from emp 阅读全文
posted @ 2026-04-22 22:51 菜鸟的奋斗军 阅读(15) 评论(0) 推荐(0)
摘要: select deptno from emp; select distinct deptno from emp; --会过滤掉重复的值 --也可以过滤掉重复的null 或者说如果有多个null 只输出一个null select distinct comm, deptno from emp; --把c 阅读全文
posted @ 2026-04-22 21:34 菜鸟的奋斗军 阅读(11) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页