If we have 10 depart,ments and each department has 100 emploess and we have to find max salry of each depatment write sql querry
Answers
Answered by
0
SQL-QUERY:
select max(employee) from employees where dept=(select department from departments);
Explanation:
- for my sql query to get executed successfully we have to have 2 tables
- 1 tables is for departments and other one is for all the 1000 employees
- if we are storing 1000 employees int one table we should have to give another column "dept" for employees to point out which department they belong to
- what my query do is first i will give max of employee in employees table where,here the nested query comes i selected every dept name from department table so i t will give 10 departments then the first query loops for 10 times printing employees max salary for each department
- if you have any further doubts please feel free to post a comment to my answer
please find the attachment below to know about the two tables
---Hope this will help you get what you want mark brainliest if you liked it :)
Attachments:
Similar questions
Biology,
6 months ago
Math,
6 months ago
Computer Science,
11 months ago
Physics,
1 year ago
Physics,
1 year ago