• Tidak ada hasil yang ditemukan

Database Introduction

N/A
N/A
Protected

Academic year: 2023

Membagikan "Database Introduction"

Copied!
10
0
0

Teks penuh

(1)

Subqueries in DBMS

Presented By

Md. Zahid Hasan

[email protected]

(2)

এই Lesson এ কক কশখব ?

Subquery in DBMS (Part-1)

(3)

SQL Subqueries (Example)

 Write a query to display highest salary department wise and name of the employee who is taking that salary.

Emp_id Emp_name Dept Salary

1 Rajib HR 10000

2 Zahid Marketing 20000

3 Hasan HR 30000

4 Shanta Marketing 40000

5 Zuhana IT 50000

EMP

(4)

SQL Subqueries (Example)

Write a query to display highest salary department wise and name of the

employee who is taking that salary.

Emp_id Emp_name Dept Salary

1 Rajib HR 10000

2 Zahid Marketing 20000

3 Hasan HR 30000

4 Shanta Marketing 40000

5 Zuhana IT 50000

EMP

HR 30000

Marketing 40000

IT 50000

select max(salary) from EMP group by dept

(5)

SQL Subqueries (Example)

Write a query to display the employee names who is working in a department where No. of employees are less than 2.

Emp_id Emp_name Dept Salary

1 Rajib HR 10000

2 Zahid Marketing 20000

3 Hasan HR 30000

4 Shanta Marketing 40000

5 Zuhana IT 50000

EMP

(select max(salary) from EMP group by dept) select Emp_name from EMP where salary in

False 30000

40000 50000

Inner Query

in

Salary 10000

(6)

SQL Subqueries (Example)

Write a query to display the employee names who is working in a department where No. of employees are less than 2.

Emp_id Emp_name Dept Salary

1 Rajib HR 10000

2 Zahid Marketing 20000

3 Hasan HR 30000

4 Shanta Marketing 40000

5 Zuhana IT 50000

EMP

(select max(salary) from EMP group by dept) select Emp_name from EMP where salary in

False 30000

40000 50000

Inner Query

in

Salary 20000

(7)

SQL Subqueries (Example)

Write a query to display the employee names who is working in a department where No. of employees are less than 2.

Emp_id Emp_name Dept Salary

1 Rajib HR 10000

2 Zahid Marketing 20000

3 Hasan HR 30000

4 Shanta Marketing 40000

5 Zuhana IT 50000

EMP

(select max(salary) from EMP group by dept) select Emp_name from EMP where salary in

Hasan 30000

40000 50000

Inner Query

in

Salary 30000

(8)

SQL Subqueries (Example)

Write a query to display the employee names who is working in a department where No. of employees are less than 2.

Emp_id Emp_name Dept Salary

1 Rajib HR 10000

2 Zahid Marketing 20000

3 Hasan HR 30000

4 Shanta Marketing 40000

5 Zuhana IT 50000

EMP

(select max(salary) from EMP group by dept) select Emp_name from EMP where salary in

Hasan, Shanta 30000

40000 50000

Inner Query

in

Salary 40000

(9)

SQL Subqueries (Example)

Write a query to display the employee names who is working in a department where No. of employees are less than 2.

Emp_id Emp_name Dept Salary

1 Rajib HR 10000

2 Zahid Marketing 20000

3 Hasan HR 30000

4 Shanta Marketing 40000

5 Zuhana IT 50000

EMP

(select max(salary) from EMP group by dept) select Emp_name from EMP where salary in

Hasan, Shanta, Zuhana 30000

40000 50000

Inner Query

in

Salary 50000

(10)

“Opportunities don’t happen, you create them.”

– – Chris Grosser

Referensi

Dokumen terkait

This is can be seen from the based on the result of the need analysis is 89% where the students necessity in learning English reading, 82% where the student lack

between the University Grants Commission of Bangladesh, hereinafter called the UGC, acting by and through its duly authorized representative hereinafter referred to as the FIRST PARTY