0% found this document useful (0 votes)
13 views16 pages

First Lab DBMS

The document outlines a lab task for Majid Ali Shah related to MySQL installation and SQL commands. It includes steps for installing MySQL, importing a database, and writing various SQL queries to manipulate and retrieve data from the employee table. The tasks cover using aliases, selecting unique department IDs, ordering results, and calculating salaries among other SQL operations.

Uploaded by

zainab.umair
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)
13 views16 pages

First Lab DBMS

The document outlines a lab task for Majid Ali Shah related to MySQL installation and SQL commands. It includes steps for installing MySQL, importing a database, and writing various SQL queries to manipulate and retrieve data from the employee table. The tasks cover using aliases, selecting unique department IDs, ordering results, and calculating salaries among other SQL operations.

Uploaded by

zainab.umair
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/ 16

Name: Majid Ali Shah

CMS ID: 023-22-0101


Date: February 29, 2024
Mail address: [email protected]
Cell: 03053940500

Lab Task(s):

Exercise 1 (MYSQL Installation & Use of Command Line)

1. Download and install MYSQL in your computer.


This is the screenshot on my installed software in my PC.

This is the workable screenshot of MySQL Workbench Software.

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.

5. Write a query to get the total salaries payable to employees.

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

You might also like