Database Administration lab 3 (1)
Database Administration lab 3 (1)
Database Administration lab 3 (1)
Tasks
Muhammad Abdullah
F2022105208
Lab Task:
Scenario: Imagine you’re working with a company database that stores information about
employees and their departments. Based on this scenario, perform the following queries
to retrieve
and analyze data: [CLO1, CLO2, CLO3] (10)
2. Write a SQL query to create a table named Departments with the following columns:
• Department_ID (integer, primary key)
• Dep_Name (string, up to 50 characters)
3. Write a SQL query to create a table named Employees with the following columns:
• Employee_ID (integer, primary key)
• Name (string, up to 50 characters)
• Department_ID(integer, foreign key)
5. Write a SQL query to Select all employee names and their respective department
names.
6. Write a SQL query to display a list of all employees, including those without a
department.
7. Write a SQL query to list all departments and the employees assigned.
8. Write a SQL query to list all employees and all departments, even if they don’t match.
9. Find employees who are not assigned to any department.
13. Write an SQL query to list all employees and their department names, ordered by the
department name.