[go: up one dir, main page]

0% found this document useful (0 votes)
136 views10 pages

Data Base and Management System Lab

This document is a lab journal for a database management systems course. It contains 18 tasks involving writing SQL queries to retrieve and manipulate data from database tables. The tasks include displaying employee data with formatted dates, filtering records by columns entered at runtime, sorting results by user-specified columns, and converting a value like salary to text.

Uploaded by

Arsalan Ishtiaq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views10 pages

Data Base and Management System Lab

This document is a lab journal for a database management systems course. It contains 18 tasks involving writing SQL queries to retrieve and manipulate data from database tables. The tasks include displaying employee data with formatted dates, filtering records by columns entered at runtime, sorting results by user-specified columns, and converting a value like salary to text.

Uploaded by

Arsalan Ishtiaq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Data Base and Management System Lab

CSL-220
 

Lab journal 3
 

Student’s Name: Arsalan Ishtiaq


Enrolment number(s): 01-134182-013
Class: BSCS-4B
 
 
 
 
 

Department of Computer Sciences


BAHRIA UNIVERSITY, ISLAMABAD
Lab Tasks

1. For each employee, display the enames, hiredate, salary and calculate the number of months
between today and hiredate. Round the number of months up to the closest whole number.

2. Display the empno, ename and hiredate of all employees. The hiredate should be displayed in the given
format. (i.e. 12 DEC 2014).
3. Extend the previous question to display the hiredate as 12*Dec%2014.

4. Now display the employee’s first three characters of name and hiredate as 12 December, 2014.

5. Show all fields in EMP table of those employees whose length of ename is less than 5. The hiredate
should be displayed as 12th December 2014.
6. Display the empno, ename of all employees alongwiththe hiredate but hiredate should be displayed in
three different columns i.e. day, month and year in three different columns.

7. List the records of those employees whose hiring month has 31 days.
8. Display the ename, salary, hiredate and the date when “Friday” comes after the hiredate for all
employees.
9. Display the week difference in first column and hours difference in second column between any two
dates.

10. Display the records of Employee table based on Employee No. The system should prompt for
the Employee No. at run time. (Execute this query for at least 5 times, provide different empno
for each run and observe the output)
11. Show all records of Employee table filtered by EmpName. The Employee name is entered by
user on run time. Run this query for at least 4 times, provide different values and observe the
output.

12. Show the empno, name and designation of those employees whose hiredate falls between
two dates entered by user at run time. (Execute this for at least 3 times with different dates)
13. Display the employee’s record who were hired on a specific date. The hiredate is entered by
user run time in 12th December 2014 format.

14. Now display the record of all employees sorted by any column. The column_name is entered
by user on run time. (Also hide the message of old value and new value which is usually shown
after entering the value of any substitution variable)
15. Display the record of any table (entered by the user) and sort the records by using any column
(entered by user). The table name entered should be in such a way that it is reused in the next
execution of query i.e. the system should prompt once for the table name in a session but the
ordering column must be entered all the times whenever the query is going to execute.

16. Display the current date and time of database server machine. The output should look like 28th
September 2014, 15:26:09

17. Show the system time in three different columns with different formats and aliases as shown
below:
12hrsPM 24hrs 12hrspm
03:26:09 PM 15.26.09 03-26-09 pm
18. Display the salary in words of all employees. i.e. if salary is 8547, the output should be eight
thousand four hundred and forty seven.

Submit the lab journal in next class.

You might also like