Skip to content

Commit 8c6c7aa

Browse files
committed
Added README.md file for Replace Employee ID With The Unique Identifier
1 parent ea49708 commit 8c6c7aa

File tree

1 file changed

+75
-0
lines changed
  • 1509-replace-employee-id-with-the-unique-identifier

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<h2><a href="https://leetcode.com/problems/replace-employee-id-with-the-unique-identifier">Replace Employee ID With The Unique Identifier</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>Table: <code>Employees</code></p>
2+
3+
<pre>
4+
+---------------+---------+
5+
| Column Name | Type |
6+
+---------------+---------+
7+
| id | int |
8+
| name | varchar |
9+
+---------------+---------+
10+
id is the primary key (column with unique values) for this table.
11+
Each row of this table contains the id and the name of an employee in a company.
12+
</pre>
13+
14+
<p>&nbsp;</p>
15+
16+
<p>Table: <code>EmployeeUNI</code></p>
17+
18+
<pre>
19+
+---------------+---------+
20+
| Column Name | Type |
21+
+---------------+---------+
22+
| id | int |
23+
| unique_id | int |
24+
+---------------+---------+
25+
(id, unique_id) is the primary key (combination of columns with unique values) for this table.
26+
Each row of this table contains the id and the corresponding unique id of an employee in the company.
27+
</pre>
28+
29+
<p>&nbsp;</p>
30+
31+
<p>Write a solution to show the <strong>unique ID </strong>of each user, If a user does not have a unique ID replace just show <code>null</code>.</p>
32+
33+
<p>Return the result table in <strong>any</strong> order.</p>
34+
35+
<p>The result format is in the following example.</p>
36+
37+
<p>&nbsp;</p>
38+
<p><strong class="example">Example 1:</strong></p>
39+
40+
<pre>
41+
<strong>Input:</strong>
42+
Employees table:
43+
+----+----------+
44+
| id | name |
45+
+----+----------+
46+
| 1 | Alice |
47+
| 7 | Bob |
48+
| 11 | Meir |
49+
| 90 | Winston |
50+
| 3 | Jonathan |
51+
+----+----------+
52+
EmployeeUNI table:
53+
+----+-----------+
54+
| id | unique_id |
55+
+----+-----------+
56+
| 3 | 1 |
57+
| 11 | 2 |
58+
| 90 | 3 |
59+
+----+-----------+
60+
<strong>Output:</strong>
61+
+-----------+----------+
62+
| unique_id | name |
63+
+-----------+----------+
64+
| null | Alice |
65+
| null | Bob |
66+
| 2 | Meir |
67+
| 3 | Winston |
68+
| 1 | Jonathan |
69+
+-----------+----------+
70+
<strong>Explanation:</strong>
71+
Alice and Bob do not have a unique ID, We will show null instead.
72+
The unique ID of Meir is 2.
73+
The unique ID of Winston is 3.
74+
The unique ID of Jonathan is 1.
75+
</pre>

0 commit comments

Comments
 (0)