@@ -457,4 +457,49 @@ r.salary
457
457
FROM Department d
458
458
JOIN RankedSalaries rON r .departmentId = d .id
459
459
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 conditionsLIKE ' % DIAB1%'
475
+ OR conditionsLIKE ' 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 SalaryDESC
492
+ LIMIT 1 OFFSET1 )
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
+ ```