First Lab DBMS
First Lab DBMS
Lab Task(s):
1
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
2
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
2. Import provided “hr.sql” database by using command line.
In the below cmd display hr data base is connected successfully.
3
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
3. Connect imported database from command line.
This is the hr data base imported in cmd.
4
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
Exercise 2 (SELECT Statement)
1. Write a query to display the names (first_name, last_name) using alias name “First Name", "Last Name".
This is the use of Aliases cmd showed first_name as First Name and last_name as Last Name for our readability.
5
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
2. Write a query to get unique department ID from employee table.
6
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
3. Write a query to get all employee details from the employee table order by first name, descending.
7
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
4. Write a query to get the employee ID, names (first_name, last_name), salary in ascending order of salary.
8
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
9
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
6. Write a query to get the maximum and minimum salary from employees table.
10
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
7. Write a query to get the average salary and number of employees in the employees table.
11
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
8. Write a query to get the number of jobs available in the employees table.
12
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
9. Write a query get all first name from employees table in upper case.
13
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
10. Write a query to select first 10 records from a table.
14
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
11. Write a query to select 3rd & 4th record of employees table.
15
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL
12. Write a query to select 2nd last record of employees table.
END
16
Department of Computer Science
CSC-252: Database Management System Lab 01: Foundation statements of SQL