(1)用SQL语句写出张姓且单名的学生的学号、姓名。(2)用SQL语句统计大于平均分的学生人数。

[复制链接]
查看11 | 回复4 | 2012-4-10 13:56:06 | 显示全部楼层 |阅读模式
tableid number name score1 102
张三992104
李四
33(1)select 学号,姓名 from table where name like '李%' and length(姓名)=4(2)select count(*) from table where score>avg(score)...
回复

使用道具 举报

千问 | 2012-4-10 13:56:06 | 显示全部楼层
上面的哥们写的不错,我再写另外的一种方式tableid number name score1 102
张三992104
李四
33(1)select 学号,姓名 from table where name like '张_'//“_”匹配1位(2)select count(1) from tabl...
回复

使用道具 举报

千问 | 2012-4-10 13:56:06 | 显示全部楼层
(1)Select No,Name from student where substring(name,1,1)='张' and len(name)=2(2)select * from Studentscore where score>((select sum(score) from Studentscore)/(select Count(*) ...
回复

使用道具 举报

千问 | 2012-4-10 13:56:06 | 显示全部楼层
select 学号,姓名 from where 姓名 like '张_';select count(*) from 分数>(select avg(分数) from 表 );...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行