2020-11-16QQ数据库
数据库查询
查询QQ号码为多少 的用户的所有好友信息
select * from 表名 where QQID=?? and 列名n=??
查询QQ号码为 多少 的用户的好友中每个省份的人数,并且总人数按由大到小排序
select * from Relation where QQID=286212 and RelationStatus=0
select Province as 省份,count(1) as 总人数 from Relation
inner join
BaseInfo
on
Relation.RelationQQID = BaseInfo.QQID
where
Relation.QQID = 286212
group by Province;
查询QQ号码为286224的好友中等级为10级以上的“月亮”级用户信息
select * from Relation where QQID=286224 and RelationStatus=0
select Relation.QQID from
Relation
inner join
QQUser
on
Relation.RelationQQid = QQUser.QQID
inner join
BaseInfo
on
Relation.RelationQQid = BaseInfo.QQID
where
QQUser.QQLevel >=10
and
Relation.QQID=286224
查询被当做黑名单人物次数排名前20的用户
select top 20 RelationQQID,count(1) as 次数 from Relation
where
RelationStatus = 1
group by RelationQQID
order by count(1) desc