mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			75 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Table: <code>Employees</code></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
+-------------+---------+
 | 
						|
| Column Name | Type    |
 | 
						|
+-------------+---------+
 | 
						|
| employee_id | int     |
 | 
						|
| name        | varchar |
 | 
						|
+-------------+---------+
 | 
						|
employee_id is the primary key for this table.
 | 
						|
Each row of this table indicates the name of the employee whose ID is employee_id.
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
 | 
						|
<p>Table: <code>Salaries</code></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
+-------------+---------+
 | 
						|
| Column Name | Type    |
 | 
						|
+-------------+---------+
 | 
						|
| employee_id | int     |
 | 
						|
| salary      | int     |
 | 
						|
+-------------+---------+
 | 
						|
employee_id is the primary key for this table.
 | 
						|
Each row of this table indicates the salary of the employee whose ID is employee_id.
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
 | 
						|
<p>Write an SQL query to report the IDs of all the employees with <strong>missing information</strong>. The information of an employee is missing if:</p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li>The employee's <strong>name</strong> is missing, or</li>
 | 
						|
	<li>The employee's <strong>salary</strong> is missing.</li>
 | 
						|
</ul>
 | 
						|
 | 
						|
<p>Return the result table ordered by <code>employee_id</code> <strong>in ascending order</strong>.</p>
 | 
						|
 | 
						|
<p>The query result format is in the following example.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong>Example 1:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> 
 | 
						|
Employees table:
 | 
						|
+-------------+----------+
 | 
						|
| employee_id | name     |
 | 
						|
+-------------+----------+
 | 
						|
| 2           | Crew     |
 | 
						|
| 4           | Haven    |
 | 
						|
| 5           | Kristian |
 | 
						|
+-------------+----------+
 | 
						|
Salaries table:
 | 
						|
+-------------+--------+
 | 
						|
| employee_id | salary |
 | 
						|
+-------------+--------+
 | 
						|
| 5           | 76071  |
 | 
						|
| 1           | 22517  |
 | 
						|
| 4           | 63539  |
 | 
						|
+-------------+--------+
 | 
						|
<strong>Output:</strong> 
 | 
						|
+-------------+
 | 
						|
| employee_id |
 | 
						|
+-------------+
 | 
						|
| 1           |
 | 
						|
| 2           |
 | 
						|
+-------------+
 | 
						|
<strong>Explanation:</strong> 
 | 
						|
Employees 1, 2, 4, and 5 are working at this company.
 | 
						|
The name of employee 1 is missing.
 | 
						|
The salary of employee 2 is missing.
 | 
						|
</pre>
 |