牛客刷题和经典题目

2023-08-20  本文已影响0人  飞猪的浪漫

https://blog.csdn.net/weixin_55865422/article/details/127475715

对女性,男性的分别统计

https://deepinout.com/sql/sql-questions/865_sql_count_male_female_and_total.html

SQL删除重复数据只保留一条

https://blog.csdn.net/wintershang/article/details/89205044?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-89205044-blog-80907036.235%5Ev38%5Epc_relevant_anti_t3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-89205044-blog-80907036.235%5Ev38%5Epc_relevant_anti_t3&utm_relevant_index=2

1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断

select * from people

where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)

https://www.sohu.com/a/429231087_165070

SELECT* fromstudent

wherenamein( selectname

fromstudent

wherenamelike"张%"groupbynamehavingavg(score) > 75);

https://blog.csdn.net/a639735331/article/details/81457628

查询高考总分在600以上的学生准考证号的SQL语句如下所示:

select num from score group by num having sum(score)>600;

有实操,需要注意join的用法。

https://blog.csdn.net/qq_36324958/article/details/128732645?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-1-128732645-blog-81457628.235%5Ev38%5Epc_relevant_anti_t3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-1-128732645-blog-81457628.235%5Ev38%5Epc_relevant_anti_t3&utm_relevant_index=2

SQL语句面试题整理-四年经验

上一篇下一篇

猜你喜欢

热点阅读