SQL面试题1

Posted wuxiping2019

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL面试题1相关的知识,希望对你有一定的参考价值。

1.用一条SQL 语句 查询出每门课都大于80 分的学生姓名

mysql> select * from students;
+----------+---------+--------+
| name     | kecheng | fenshu |
+----------+---------+--------+
| zhangsan | yuwen   |     81 |
| zhangsan | shuxue  |     75 |
| lisi     | yuwen   |     76 |
| lisi     | shuxue  |     76 |
| wangwu   | yuwen   |     81 |
| wangwu   | shuxue  |    100 |
| wangwu   | yingyu  |     90 |
+----------+---------+--------+

mysql> select distinct name from students where name not in (select distinct name from students where fenshu<=80);
+--------+
| name |
+--------+
| wangwu |

 

mysql> select name from students group by name having min(fenshu)>80;
+--------+
| name |
+--------+
| wangwu |
+--------+

 

2.

以上是关于SQL面试题1的主要内容,如果未能解决你的问题,请参考以下文章

面试常用的代码片段

Mybatis面试题

Java工程师面试题,二级java刷题软件

Java进阶之光!2021必看-Java高级面试题总结

sql面试题1

经验总结:Java高级工程师面试题-字节跳动,成功跳槽阿里!