Skip to content

Commit 4508e37

Browse files
authored
Update Readme.md
1 parent fc544a7 commit 4508e37

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

Chapter 9/Readme.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,6 @@ FROM employee;
145145

146146
A correlated subquery in MySQL is a subquery that depends on the outer query. It uses the data from the outer query or contains a reference to a parent query that also appears in the outer query. MySQL evaluates it once from each row in the outer query.
147147

148-
**Example 6:** Using the above employee table, find the first_name, last_name, department_id and salary of all the employees whose salary is greater than the average salary of company.
149-
150-
Click [here](https://www.db-fiddle.com/f/jd9fQokX2RcnLwJeGvYoQQ/1) to go to db-fiddle to access this dataset.
151-
152-
```sql
153-
SELECT
154-
first_name,
155-
last_name,
156-
department_id,
157-
salary
158-
FROM employee e
159-
WHERE salary >= (SELECT AVG(salary)
160-
FROM employee
161-
WHERE department_id = e.department_id);
162-
```
163148

164149
<br>
165150
<br>
@@ -187,7 +172,7 @@ FROM expression_name;
187172

188173
Let's write a query for the same question in Example 4 using CTE.
189174

190-
**Example 7:** Using the student table in dpu_college db, find the maximum average marks of departments and Maximum marks of all the students.
175+
**Example 6:** Using the student table in dpu_college db, find the maximum average marks of departments and Maximum marks of all the students.
191176

192177
```sql
193178
WITH STDNT AS(
@@ -251,7 +236,7 @@ CREATE TEMPORARY TABLE temp_table_name as (
251236

252237
Let's use the question in example 7 and rewrite the query using Temporary table instead of CTE
253238

254-
**Example 7:** Using the student table in dpu_college db, write a query to find the name and marks of highest scorer from each department.
239+
**Example 8:** Using the student table in dpu_college db, write a query to find the name and marks of highest scorer from each department.
255240

256241
```sql
257242
CREATE TEMPORARY TABLE dept_marks AS(

0 commit comments

Comments
 (0)