0% found this document useful (0 votes)
7 views1 page

MYSQL Exercises: Sub-Queries and Grouping

The document contains MySQL exercises involving subqueries, grouping, joins, procedures, and functions. The exercises utilize a school database and involve finding instructors by salary, departments by number of courses, instructors by specific salaries, and more.

Uploaded by

dinaras bekele
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

MYSQL Exercises: Sub-Queries and Grouping

The document contains MySQL exercises involving subqueries, grouping, joins, procedures, and functions. The exercises utilize a school database and involve finding instructors by salary, departments by number of courses, instructors by specific salaries, and more.

Uploaded by

dinaras bekele
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

MYSQL exercises

Sub-queries and grouping


Use the school database for the following questions
1. Find instructors whose salary is greater than average salary. Show instructor name and salary on
your result. Order the result by salary from highest to lowest (using sub-queries)
2. Select department name of all departments whose number of courses are greater than 2. Order
by the number of courses in descending order
3. Find instructors (instructor name) whose salary are either 30,000 or 15,000 without using logical
operators
4. Find instructors (name and salary) whose salary is greater than the minimum salary

Join operations
5. Show all instructors (instructor name) and year who have taught courses in 2016
6. Find all instructors (instructor name, department name and semester) who have taught in first
semester and are from electrical department
7. Find all courses (course name, department name, semester) that are given in SECE in second
semester
8. Select the instructor ID and the number of courses thought by each instructor

Procedures and functions


9. Create a function that computes the bonus of each instructor, the bonus is 30% of the salary
10. Write a stored procedure that is used to insert information on course table

You might also like