{ "data": { "question": { "questionId": "2110", "questionFrontendId": "1965", "categoryTitle": "Database", "boundTopicId": 923630, "title": "Employees With Missing Information", "titleSlug": "employees-with-missing-information", "content": "

Table: Employees

\n\n
\n+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| employee_id | int     |\n| name        | varchar |\n+-------------+---------+\nemployee_id is the primary key for this table.\nEach row of this table indicates the name of the employee whose ID is employee_id.\n
\n\n

 

\n\n

Table: Salaries

\n\n
\n+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| employee_id | int     |\n| salary      | int     |\n+-------------+---------+\nemployee_id is the primary key for this table.\nEach row of this table indicates the salary of the employee whose ID is employee_id.\n
\n\n

 

\n\n

Write an SQL query to report the IDs of all the employees with missing information. The information of an employee is missing if:

\n\n\n\n

Return the result table ordered by employee_id in ascending order.

\n\n

The query result format is in the following example.

\n\n

 

\n

Example 1:

\n\n
\nInput: \nEmployees table:\n+-------------+----------+\n| employee_id | name     |\n+-------------+----------+\n| 2           | Crew     |\n| 4           | Haven    |\n| 5           | Kristian |\n+-------------+----------+\nSalaries table:\n+-------------+--------+\n| employee_id | salary |\n+-------------+--------+\n| 5           | 76071  |\n| 1           | 22517  |\n| 4           | 63539  |\n+-------------+--------+\nOutput: \n+-------------+\n| employee_id |\n+-------------+\n| 1           |\n| 2           |\n+-------------+\nExplanation: \nEmployees 1, 2, 4, and 5 are working at this company.\nThe name of employee 1 is missing.\nThe salary of employee 2 is missing.\n
\n", "translatedTitle": "丢失信息的雇员", "translatedContent": "

表: Employees

\n\n
\n+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| employee_id | int     |\n| name        | varchar |\n+-------------+---------+\nemployee_id 是这个表的主键。\n每一行表示雇员的id 和他的姓名。\n
\n\n

表: Salaries

\n\n
\n+-------------+---------+\n| Column Name | Type    |\n+-------------+---------+\n| employee_id | int     |\n| salary      | int     |\n+-------------+---------+\nemployee_id is 这个表的主键。\n每一行表示雇员的id 和他的薪水。\n
\n\n

 

\n\n

写出一个查询语句,找到所有 丢失信息 的雇员id。当满足下面一个条件时,就被认为是雇员的信息丢失:

\n\n\n\n

返回这些雇员的id  employee_id , 从小到大排序 

\n\n

查询结果格式如下面的例子所示。

\n\n

 

\n\n

示例 1:

\n\n
\n输入:\nEmployees table:\n+-------------+----------+\n| employee_id | name     |\n+-------------+----------+\n| 2           | Crew     |\n| 4           | Haven    |\n| 5           | Kristian |\n+-------------+----------+\nSalaries table:\n+-------------+--------+\n| employee_id | salary |\n+-------------+--------+\n| 5           | 76071  |\n| 1           | 22517  |\n| 4           | 63539  |\n+-------------+--------+\n输出:\n+-------------+\n| employee_id |\n+-------------+\n| 1           |\n| 2           |\n+-------------+\n解释:\n雇员1,2,4,5 都工作在这个公司。\n1号雇员的姓名丢失了。\n2号雇员的薪水信息丢失了。
\n", "isPaidOnly": false, "difficulty": "Easy", "likes": 10, "dislikes": 0, "isLiked": null, "similarQuestions": "[]", "contributors": [], "langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"ruby\": false, \"bash\": false, \"swift\": false, \"golang\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"kotlin\": false, \"rust\": false, \"php\": false, \"typescript\": false, \"racket\": false, \"erlang\": false, \"elixir\": false}", "topicTags": [ { "name": "Database", "slug": "database", "translatedName": "数据库", "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": [ { "lang": "MySQL", "langSlug": "mysql", "code": "# Write your MySQL query statement below", "__typename": "CodeSnippetNode" }, { "lang": "MS SQL Server", "langSlug": "mssql", "code": "/* Write your T-SQL query statement below */", "__typename": "CodeSnippetNode" }, { "lang": "Oracle", "langSlug": "oraclesql", "code": "/* Write your PL/SQL query statement below */", "__typename": "CodeSnippetNode" } ], "stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"7.1K\", \"totalAcceptedRaw\": 5331, \"totalSubmissionRaw\": 7077, \"acRate\": \"75.3%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"Employees\":[\"employee_id\",\"name\"],\"Salaries\":[\"employee_id\",\"salary\"]},\"rows\":{\"Employees\":[[2,\"Crew\"],[4,\"Haven\"],[5,\"Kristian\"]],\"Salaries\":[[5,76071],[1,22517],[4,63539]]}}", "metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Employees (employee_id int, name varchar(30))\",\n \"Create table If Not Exists Salaries (employee_id int, salary int)\"\n ],\n \"mssql\": [\n \"Create table Employees (employee_id int, name varchar(30))\",\n \"Create table Salaries (employee_id int, salary int)\"\n ],\n \"oraclesql\": [\n \"Create table Employees (employee_id int, name varchar(30))\",\n \"Create table Salaries (employee_id int, salary int)\"\n ],\n \"database\": true\n}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Employees (employee_id int, name varchar(30))", "Create table If Not Exists Salaries (employee_id int, salary int)", "Truncate table Employees", "insert into Employees (employee_id, name) values ('2', 'Crew')", "insert into Employees (employee_id, name) values ('4', 'Haven')", "insert into Employees (employee_id, name) values ('5', 'Kristian')", "Truncate table Salaries", "insert into Salaries (employee_id, salary) values ('5', '76071')", "insert into Salaries (employee_id, salary) values ('1', '22517')", "insert into Salaries (employee_id, salary) values ('4', '63539')" ], "enableRunCode": true, "envInfo": "{\"mysql\":[\"MySQL\",\"

\\u7248\\u672c\\uff1aMySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"

mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"

Oracle Sql 11.2.<\\/p>\"]}", "book": null, "isSubscribed": false, "isDailyQuestion": false, "dailyRecordStatus": null, "editorType": "CKEDITOR", "ugcQuestionId": null, "style": "LEETCODE", "exampleTestcases": "{\"headers\":{\"Employees\":[\"employee_id\",\"name\"],\"Salaries\":[\"employee_id\",\"salary\"]},\"rows\":{\"Employees\":[[2,\"Crew\"],[4,\"Haven\"],[5,\"Kristian\"]],\"Salaries\":[[5,76071],[1,22517],[4,63539]]}}", "__typename": "QuestionNode" } } }