Oracle常用sql语句初体验select成功=努力+方法。

20,select name,age*10 十倍年龄  from student order by 十倍年龄;

//十倍年龄

使用统计函数

21select count(*) from student;

//查询所有学生个数

22select count(*) from student where age>25;

//查询学生年龄大于25的学生个数

23,select count(address) from student where age>25;

24,select count(DISTINCT address) from student where age>25;

//去重

25select max(age) as 最大年龄,min(age) as 最小年龄 from student;

//最大年龄和最小年龄

26,select name,age,sex from student where age=(select max(age) from student);

//查询年龄最大的学生

27select count(*) as 学生总数,sum(age) as 学生年龄之和 from student;

//学生总数以及学生年龄之和

Group by 子句

28select address, count(*) as 人数 from student group by address;

//按照学生的住址信息进行分组

29select address, count(*) as 个数, represent from student group by address, represent;

//每个地址对应的个数,以及地址对应的代表事物。

30select address, COUNT(*) as 人数,represent from student group by rollup (address,represent);

31,select address, COUNT(*) as 人数,represent from student group by cube (address,represent);

having子句:

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值