表结构
名称 时间 单价 数量 金额 客户
苹果 10.1 5 5 & ......
表如下:
分数 班级 姓名
60 1班 张三
40 1班 李四
60 1班 王五
50 2班 刘一
20 2班 吴涛
43 2班 将二
30 3班 李力
79 ......
表ykt_userinfo:职工表
ID userID username
1 01 王二
2 02 李四
3 03 张三
4 04 小王
5 05 小李
6&nb ......
表有两列 area_id area_name
1 长沙
2 岳阳
4 北京
6&nbs ......
今天面试遇到一道sql问题,有三小题,前两题答出,第三题不会,特请教诸位
有表Student(StudentID,StudentName,classID,sex),其中,sex为1是男生,0是女生,表Class(classid,classname)其中classID与classid相关联,问,取出只有一个男生的班级名称
SQL code:
select m.classname from Class m , Student n where m.classid = ......
ORACLE中用到如下语句:
select A,B,C from tableName where
TO_CHAR(A,'yyyy-MM-dd') like '2009-11-09' and B = '600' and A = (select max(A) from tableName where B = '600')
or TO_CHAR(A,'yyyy-MM-dd') like '2009-11-09' and B = '603' and A ......