8000 Update README.md · chandangar/sql-50-leetcode@049a89d · GitHub
[go: up one dir, main page]

Skip to content

Commit 049a89d

Browse files
committed
Update README.md
1 parent ab8f703 commit 049a89d

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,4 +457,49 @@ r.salary
457457
FROM Department d
458458
JOIN RankedSalaries r ON r.departmentId = d.id
459459
WHERE r.salary_rank <=3;
460-
```
460+
```
461+
462+
463+
[1667. Fix Names in a Table](https://leetcode.com/problems/fix-names-in-a-table)
464+
```sql
465+
SELECT user_id, CONCAT(UPPER(LEFT(name, 1)), LOWER(RIGHT(name, LENGTH(name)-1))) AS name
466+
FROM Users
467+
ORDER BY user_id
468+
```
469+
470+
[1527. Patients With a Condition](https://leetcode.com/problems/patients-with-a-condition)
471+
```sql
472+
SELECT patient_id, patient_name, conditions
473+
FROM patients
474+
WHERE conditions LIKE '% DIAB1%'
475+
OR conditions LIKE 'DIAB1%'
476+
```
477+
478+
[196. Delete Duplicate Emails](https://leetcode.com/problems/delete-duplicate-emails)
479+
```sql
480+
DELETE p
481+
FROM Person p, Person q
482+
WHERE p.id > q.id
483+
AND q.Email = p.Email
484+
```
485+
486+
[176. Second Highest Salary](https://leetcode.com/problems/second-highest-salary)
487+
```sql
488+
SELECT
489+
(SELECT DISTINCT Salary
490+
FROM Employee
491+
ORDER BY Salary DESC
492+
LIMIT 1 OFFSET 1)
493+
AS SecondHighestSalary
494+
495+
-- HINT: subquery is used to return null if there is no SecondHighestSalary
496+
```
497+
498+
499+
500+
[1517. Find Users With Valid E-Mails](https://leetcode.com/problems/find-users-with-valid-e-mails)
501+
```sql
502+
SELECT *
503+
FROM Users
504+
WHERE mail REGEXP '^[A-Za-z][A-Za-z0-9_\.\-]*@leetcode\\.com$'
505+
```

0 commit comments

Comments
 (0)
0