sql查询语句,用sql语句怎么查一个表的信息?
用sql语句怎么查一个表的信息?
1、 查询所有列。
sql语句:SELECT * FROM user。
2、查询指定列sql语句:SELECT nickname, mobile, sex FROM user3、将查询结果按字段的值进行排序sql语句:SELECT * FROM emp ORDER BY deptno, sal DESC; (按序号升序,并按价格降序)4、比较查询sql语句:select Sname as 姓名,Sage as 年龄 from student where Sage5、字符匹配(like % _ )。
查询所有包含“鸡”的菜品的名称和编号。
sql语句:select name as 菜品名,price as 价格 from food where name like '%鸡%'; 。
1、查询所有列。
sql语句:SELECT*FROM user。
2、查询指定列sql语句:SELECTnickname,mobile,sexFROMuser3、将查询结果按字段的值进行排序sql语句:SELECT*FROMempORDERBYdeptno,salDESC;(按序号升序,并按价格降序)4、比较查询sql语句:selectSnameas姓名,Sageas年龄fromstudentwhereSage<20;5、字符匹配(like%_)。
查询所有包含“鸡”的菜品的名称和编号。
sql语句:selectnameas菜品名,priceas价格fromfoodwherenamelike'%鸡%'; 。
sql语句查询语法?
1:select s#,sn from s,c,sc where s.s#=sc.s# and c.c#=sc.c# and c.cn='税收基础'2:select sn,sd from s,c,sc where s.s#=sc.s# and c.c#=sc.c# and c.c#='C2'3:select sn,sd from s,c,sc where s.s#=sc.s# and c.c#=sc.c# and c.c#!='C5'4:select * from (select sn,sd,count(s.*) as cc from s,c,sc where s.s#=sc.s# and c.c#=sc.c# and s.s# group by sn,sd) as tt where tt.cc=(select count(*) from c)5: select count(tt.*) from (select s#,sn from s,c,sc where s.s#=sc.s# and c.c#=sc.c# group by s#,sn) as tt6:select * from (select sn,sd,count(s.*) as cc from s,c,sc where s.s#=sc.s# and c.c#=sc.c# and s.s# group by sn,sd) as tt where tt.cc>=5) 刚写的,希望能帮到你。
爱资源吧版权声明:以上文中内容来自网络,如有侵权请联系删除,谢谢。