You are on page 1of 2

We have three tables: employee, sales and city.

Instructions:
Please use the DDL to create schema in your local machine, if you do not have Mysql V5.7
installed, please use online editor such as DB-fiddle

Link : https://www.db-fiddle.com/

Once you have created the schema, you will have three tables mentioned above.
Write the queries for the given questions in your local machines/db-fiddle and paste the query
in this form.
Note: for example, if the question is - find all the rows of the city table.
Then your answer will be
Select * from city.
PASTE ONLY THE QUERY IN THE ANSWER SHEET.

ASSUMPTION: Each city has a manger, and employees are assigned in different city in
different months, sales will be assigned to employees who are working in that city, in a
particular month, for example, in month 1, emp A and B are present in pune, so sales on pune
will be assigned to A and B, say sales was 100, so sales of A is 100 and sales of B is 100. If
the pune has manager M, then the sales of manager will be sales of A and B combined, which
is 200.

sales, city and employee table linkage


sales.city_id = employee.city_id = city.id

You might also like