这个SQL语句怎么写?
1,表class中的字段c_id与stu表中的s_cid为关联字段
2,返回字段 c_name,s_no,s_name
3,查询条件:c_stu字段值大于20,并且s_no第二到四位是“006”这三个字符
4,查询结果按s_no倒排序
表中字段名不重复,字段名前不用加表名
这样写怎么错了?
select c_name,s_no,s_name from class,stu where c_id = s_cid and c_stu>20
select c_name,s_no,s_name from class,stu where c_id = s_cid and c_stu>20 and s_no like '?006*' order by s_no desc
错哪里了?
select c_name,s_no,s_name from class,stu where c_id=s_cid and c_stu>20 and s_no like '?006*' order by s_no desc
select [class].c_name,stu.s_no,stu.s_name from [class],stu where[class].c_id = stu.s_cid and stu.c_stu>20
select [class].c_name,[stu].s_no,[stu].s_name from [class],[stu] where [class].c_id=[stu].s_cid and [class].c_stu>20 and [sut].s_no like '_006%' order by [stu].s_no desc
相关问答:
大家帮忙看看这2个sql语句哪个查询的速度更快点。谢谢帮忙。比较着急。在做性能测试。
select * from
表A LEFT OUTER JOIN 表B ON (表A.id || ' ' =表B.id) ,表C , 表D, 表E
Where其他条件
select * ......
环境:1.win2003server+oracle9i
2.oracle9i字符集为AMERICAN_AMERICA.WE8ISO8859P1
3.oracle sql developer版本 1.5.5
现象描述: 1.在sql developer 中查询oracle中的某个表,中文全部显示为乱码。
......
表A
Sup_code st_sup_code buy_code buy_code1
1001 400 &nbs ......
请问各位,如何将SQl中,某字段中的值横向展开呢,
CASE WHEN
具体问题具体分析,看你要怎么展开
姓名 科目 成绩
张三 英语 90
李四 英语&nb ......
table1
名称 入库数
CT机 3
CT机 5
X光机 4 ......