Question: Go to Try it yourself section of w3schools link. Create two tables in that database - Employee and Department. You can keep required basic columns
Go to "Try it yourself" section of w3schools link.
Create two tables in that database - Employee and Department.
You can keep required basic columns in both tables. Relationship between Department to Employee is one-to-many. So make PK on column Dept_no in Department table and add that column Dept_no as FK in Employee table. Make sure you don't add any other column of Department (for e.g. Dept_name etc) in Employee table. Relationship between Employee and Department should be only through Dept_no column.
Then insert some data in both tables using Insert statements we discussed.
Now -
1. Write a query to find Employees with their name, address, department number and department name whose salary is greater than 5000. 2. Write a query to find out departments (department number and department name) where number of employees are greater than 5. 3. Write a query to find out employees whose last name has character 'S' anywhere in the name. 4. Write a query to find out employee who is having maximum salary within organization. 5. Write a query to find out count of unique departments within organization from Employee table.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
