㈠ sql 新手。 求几个简单的查询语句。
1.select * from A where A.year >2007 or (a.year = 2007 and a.month > 02) or (a.year = 2007 and
a.month = 02 and a.day > 12)
2.select * from B where not Exists (select UserID from A where A.UserID = B.UserID)
3.select * from B where Exists (select UserID from A where A.UserID = B.UserID)
4.select top 10 * from B where B.Sex = 'Male' order by B.Age desc
union all
select top 10 * from B where B.Sex = 'Female' order by B.Age desc
个人理解,仅供参考
㈡ 最简单的SQL语句
select c_name, c_stu from class where c_stu>50 or c_stu<20
楼上这个可不对了。。c_stu between 50 and 20的意思是c_stu>=20 and c_stu<=50,正好和原意相反!
㈢ 关于sql查询语句(简单)
select top 1 * from RoomType 是返回一行 包括所有字段
TypeID not in (select top 1 * from RoomType) 一个字段是不可能和一整行比较的。
正确写法如下:
select top 3 * from RoomType where TypeID not in (select top 1 typeid from RoomType)
㈣ 求一句简单的SQL查询语句
如果确保B中的B_ID无重复,可以用子查询
select A_ID,A_B_ID,A_Name,(select B_Name from B where B_ID=A_B_ID) from A
如果B_ID可能会重复,又要查询出所有A表的数据,那就用联合查询,左外连接
SELECT A_ID, A_B_ID, A_Name, B_Name
FROM A LEFT OUTER JOIN
B ON A_B_ID = B_ID
㈤ SQL简单的查询语句.
select *
from dbo.CeshiTable
where DateTime=2005 and Address like '%株%'
不要用等号,等号表示完全匹配,like表示模糊查询
㈥ 一个简单的sql查询语句帮忙一下
你可以这样
...select count(*) as cot from gs...
rs("cot")就是count(*)的值
㈦ SQL查询语句,写几个简单查询语句
你说明白点,(1)select * from 员工表 where 员工车间号=(select 员工车间号 from 工厂表 where 工厂表车间号='3') and 性别=‘男’(2)select count(*) from 员工表 where 员工车间号=(select 员工车间号 from 工厂表 where 工厂表车间号='2') and 性别=‘女’(3)select * from 零件表 where 零件号=‘002’(4)select 车间主任姓名 from 车间 where 车间号=(select 车间号 from 产品 wehre 产品号=‘005’(5) select * from 零件表 where 零件价格<20
㈧ sql简单查询语句
1、首先打开数据库,建立好表。
㈨ 求简单的SQL查询语句
两个表里面有相同字段uid , select * 能用吗?
你先的把问题拆开来看看
1.select * from Gqinfo where uid = session("uid")
2.select * from user where uid = session ("uid")
如果在2里面有,1没有,就可以 用 left join
select u.field1,u.field2,...g.field1... from user u left join gqinfo g on u.uid = g.uid
where u.uid = session("uid")
㈩ sql语句实现一个简单的查询
假设表的名字为t1:
select * from t1 where b in (select b from t1 group by b having count(b)>1)