0% found this document useful (0 votes)
37 views11 pages

Lab # 1 Exploring Ms SQL Express Edition, Retrieving Data From Database

This lab aims to familiarize students with MS SQL Express and retrieving data from databases using SELECT statements. The lab tasks students to: 1) Create tables to store employee, department, project, and work data 2) Insert sample data into these tables and the tables for a hotel database 3) Write SQL queries to retrieve specific data, such as listing employee details by gender or department, and room details by type and price.

Uploaded by

Nida Hassan
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)
37 views11 pages

Lab # 1 Exploring Ms SQL Express Edition, Retrieving Data From Database

This lab aims to familiarize students with MS SQL Express and retrieving data from databases using SELECT statements. The lab tasks students to: 1) Create tables to store employee, department, project, and work data 2) Insert sample data into these tables and the tables for a hotel database 3) Write SQL queries to retrieve specific data, such as listing employee details by gender or department, and room details by type and price.

Uploaded by

Nida Hassan
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/ 11

Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

LAB # 1

EXPLORING MS SQL EXPRESS


EDITION, RETRIEVING DATA FROM
DATABASE

OBJECTIVE
Overview of the features of ms sql server edition and retrieve data from your database using
select statement.

LAB TASK
1. Create below tables

Page | 1
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

2. Update the above schema with the following given details and insert 25 records
 Employee (empNo, fname, lname, address, DOB, gender, position, deptNo)

Page | 2
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

 Department (deptNo, deptName, mgrEmpNo)

 Project (projNo, projName, deptNo)

Page | 3
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

 WorksOn (empNo, projNo, dateWorked, hoursWorked)

Write SQL queries to


1. List all the details of employees who are female
Page | 4
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

2. List names and addresses of all employees who work for the IT department.

3. Create Hotel Database, insert 25 record for every field:


 Hotel (hotelNo, hotelName, city)
Page | 5
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

 Room (roomNo, hotelNo, type, price) o (Hint:Type can “S” for Single , “D” for double ,
“F” Family)

 Booking (HotelNo, guestNo, dateFrom, dateTo, roomNo)

Page | 6
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

 Guest (guestNo, guestName, guestAddress)

Page | 7
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

Write SQL queries


a) List all the columns/attributes of the tables.

b) List the name and addresses of top five guests living in the “Karachi” city .

Page | 8
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

c) List Room type with a price less than Rs.4000 per night.

d) List Room type with a price not equal to Rs.7000 per night

Page | 9
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

e) List the bookings for which no date to have been specified

.
f) List the top 60% of hotel which are booked after Jan 2020.

Page | 10
Lab # 1: Exploring MS SQL Express edition, retrieving data from database (SWE-209)

Page | 11

You might also like