当前位置:网站首页>LeetCode-1350. Invalid students
LeetCode-1350. Invalid students
2022-06-12 06:23:00 【Border wanderer】
List of colleges and departments : Departments
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| id | int |
| name | varchar |
+---------------+---------+
id Is the primary key of the table
This table contains... For each department of a university id Information
Student list : Students
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| id | int |
| name | varchar |
| department_id | int |
+---------------+---------+
id Is the primary key of the table
This table contains the of each student in a university id With him / Information about the Department she attended
Write a SQL Statement to query the information of students who do not exist in their department id And name
Results can be returned in any order
The following is an example of the return result format
Departments surface :
+------+--------------------------+
| id | name |
+------+--------------------------+
| 1 | Electrical Engineering |
| 7 | Computer Engineering |
| 13 | Bussiness Administration |
+------+--------------------------+
Students surface :
+------+----------+---------------+
| id | name | department_id |
+------+----------+---------------+
| 23 | Alice | 1 |
| 1 | Bob | 7 |
| 5 | Jennifer | 13 |
| 2 | John | 14 |
| 4 | Jasmine | 77 |
| 3 | Steve | 74 |
| 6 | Luis | 1 |
| 8 | Jonathan | 7 |
| 7 | Daiana | 33 |
| 11 | Madelynn | 1 |
+------+----------+---------------+
Result sheet :
+------+----------+
| id | name |
+------+----------+
| 2 | John |
| 7 | Daiana |
| 4 | Jasmine |
| 3 | Steve |
+------+----------+
John, Daiana, Steve and Jasmine The departments are 14, 33, 74 and 77, among 14, 33, 74 and 77 Does not exist in the Department table
# Write your MySQL query statement below
SELECT s.id , s.name FROM Students as s
WHERE NOT EXISTS (SELECT d.id FROM Departments as d WHERE s.department_id = d.id)
边栏推荐
- zip 和.items()区别
- AI operation ch8
- leetcode 300. Longest increasing subsequence
- Modifying theme styles in typora
- Bulk Rename Utility
- Information content security experiment of Harbin Institute of Technology
- Leetcode-1535. Find the winner of the array game
- leetcode 35. Search insert location
- 关于 Sensor flicker/banding现象的解释
- Multithreading mode (I) -- protective pause and join source code
猜你喜欢

Android studio mobile development creates a new database and obtains picture and text data from the database to display on the listview list

Bert use

Univariate linear regression model

RMB classification II

(UE4 4.27) customize globalshader

Leetcode-1706. Where does the club fall

Directx11 advanced tutorial cluster based deffered shading

Multithreading mode (I) -- protective pause and join source code

n次贝塞尔曲线

Modifying theme styles in typora
随机推荐
Modifying theme styles in typora
PHP 读写 COOKIE
JS pre parsing
leetcode 300. Longest increasing subsequence
Redis队列
(UE4 4.27) customize primitivecomponent
. Net core - pass Net core will Net to cross platform
Pytorch implementation of regression model
. Net core and Net framework comparison
Sqlite Cross - compile Dynamic Library
相机图像质量概述
LeetCode-1185. Day of the week
Cross compile libev
Unity implements smooth interpolation
SQL 注入-盲注
Multithreading (4) -- no lock (2) -- Atomic related atomic classes
Simulateur nightGod ADB View log
(UE4 4.27) customize globalshader
Bulk Rename Utility
Nocturnal simulator ADB view log