Skip to content

Commit 35d0350

Browse files
committed
Update important.md
1 parent 2f8791b commit 35d0350

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

important.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ A correlated subquery is evaluated once for each row processed by the parent sta
1212

1313
```sql
1414
--- Correlated Subquery
15-
select e.EmpFirstName, e.Salary, e.DeptId from Employee e where e.Salary = (select max(Salary) from Employee ee where ee.DeptId = e.DeptId)
15+
SELECT e.EmpFirstName, e.Salary, e.DeptId
16+
FROM Employee e
17+
WHERE e.Salary = (SELECT max(Salary) FROM Employee ee WHERE ee.DeptId = e.DeptId)
1618
```
1719

1820
```sql
1921
--- Nested Subquery
20-
select EmpFirstName, Salary, DeptId from Employee where (DeptId, Salary) in (select DeptId, max(Salary) from Employee group by DeptId)
22+
SELECT EmpFirstName, Salary, DeptId
23+
FROM Employee
24+
WHERE (DeptId, Salary) IN (SELECT DeptId, max(Salary) FROM Employee group by DeptId)
2125
```
2226

2327
<div align="right">

0 commit comments

Comments
 (0)