0% found this document useful (0 votes)
52 views7 pages

Lab Task 1 Database Systems

Uploaded by

Muhammad Khan
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)
52 views7 pages

Lab Task 1 Database Systems

Uploaded by

Muhammad Khan
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

NAME : - Muhammad Khan

ROLL NO : - 2K20/swee/93

CLASS:- Software Engineering (Evening)

SUBJECT:-DB Administration & Management

TOPIC:- Database Systems


SENG – 514/515: Database Systems Lab # 1
Kamran Dahri, Assistant Professor
FET, University of Sindh

Lab Practice 1 – Database Systems

Practice Question 1
Show the structure of the DEPARTMENTS table AND Select all data from the table.

See output below

Answer:
select * from departments;
SENG – 514/515: Database Systems Lab # 1
Kamran Dahri, Assistant Professor
FET, University of Sindh

Practice Question 2

(A) Show the structure of the EMPLOYEES table.


(B) Create a query to display the last name, job code, hire date, and employee number for each
employee, with employee number appearing first. Provide an alias STARTDATE for the
HIRE_DATE column.

See output below

Answer: select * from employees;


Answer2:select LAST_NAME,JOB_ID,HIRE_DATE,PHONE_NUMBER
from employees;
SENG – 514/515: Database Systems Lab # 1
Kamran Dahri, Assistant Professor
FET, University of Sindh

Practice Question 3

Create a query to display unique job codes from the EMPLOYEES table.

See output below

Answer: select JOB_ID from employees;


SENG – 514/515: Database Systems Lab # 1
Kamran Dahri, Assistant Professor
FET, University of Sindh

Practice Question 4

Show all employees data and show data under Column heading as Emp #, Employee, Job, and Hire Date,
respectively.

See output below

Answer: select EMPLOYEE_ID AS "Emp #",FIRST_NAME AS "Employee", JOB_ID


AS "JOB",HIRE_DATE AS "HIRE DATE" from employees;
SENG – 514/515: Database Systems Lab # 1
Kamran Dahri, Assistant Professor
FET, University of Sindh

Practice Question 5

Display the last name concatenated with the job ID, separated by a comma and space, and name the
column Employee and Title.

See output below

Answer: select LAST_NAME || ','|| JOB_ID AS "Employee and Title"


from employees;
SENG – 514/515: Database Systems Lab # 1
Kamran Dahri, Assistant Professor
FET, University of Sindh

Practice Question 6

Create a query to display all the data from the EMPLOYEES table. Separate each column by a
comma. Name the column THE_OUTPUT.

See output below

Answers: select :
EMPLOYEE_ID||','||FIRST_NAME||','||LAST_NAME||','||EMAIL||','||PHONE_NUMBER||','||HIRE_D
ATE||','||JOB_ID||','||SALARY||','||COMMISSION_PCT||','||MANAGER_ID||','||DEPARTMENT_ID
AS "THE OUT PUT " from employees;

You might also like