Tutorial 3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Tutorial 3

Readings:

1. Chapter 3 in the SAD textbook.

2. Chapters 2.3, 4, 6.1-6.3.2, 7.1-7.2 and 12 in the DB textbook.

3. Related items on Wikipedia, such as data model, entity relationship diagram,


relational database, business requirements, business rules, interview, and so on.

4. Related topics on w3schools, such as literals, select, insert, delete and update
table.

Resources:

You might find some of the following resources useful:

1. Wikipedia http://www.wikipedia.org/

2. W3C school – SQL tutorials http://www.w3schools.com/sql/

Page 1
Part A – SAD Questions (1 mark):

1. What are business requirements and business rules?

2. List at least 4 techniques for eliciting business requirements and give examples
of each.

3. What are candidate key and primary key? Give an example to illustrate the
differences between them.

4. Compare the entity relationship model and relational data model in detail.

You should type your answers to these questions.

Part B – Project Practices (1 mark):

SAD – requirement analysis. Conduct the following activities in order to analyse


business requirements and business rules in the final project

I. Understand the predefined queries (available on the learning


guide) for the final project.

II. Interview (with your group partner) for finding more business rules
and business requirements for the final project.

III. Organise a JAD session for finding more business rules and
business requirements for the final project.

IV. Design a questionnaire list for finding more business rules and
business requirements for the final project? Answer them by
yourself.

V. Observe more business rules and business requirements for the final
project.

You should type your answers to the above questions. Also, you need to keep the
records as these will be included in the system proposal.

Page 2
Part C – SQL Questions (1 mark):

I. SQL – connect to Microsoft SQL Server Management Studio.

II. SQL – Select, Insert, Delete, Update.

a. Create a room table with the attributes (roomNo, hotelNo, type, price,
guestNo), where roomNo and hotelNo together form the primary key.

b. Insert some values into the room table so that the table record is as follows:

roomNo hotelNo type price guestNo


101 321 Standard 255 NULL
101 362 Single 150 12345
333 300 Master 550 54321
333 345 president 1000 12345

c. Try to insert the following record into the room table. What will happen?
Why?

INSERT INTO Room


VALUES (101,321,’Double’,200,20000);

d. Try to insert the following record into the room table. What will happen?
Why?

INSERT INTO Room


VALUES (101, Null,'Double',200,20000);

e. Insert the following record into the room table. See what will happen.

INSERT INTO Room


VALUES (202,'Hilton','Double',200,20000);

f. Delete the records of rooms with the number 303. See what will happen.

g. Delete the records of rooms whose roomNo is 333 and whose hotelNo is
321. See what happens. Re-insert the records deleted.

h. Delete the records of rooms whose roomNo is 333 or whose hotelNo is


300. See what happens. Re-insert the records deleted.

i. Change the price of the room 333 with hotelNo 345 to $5500.

j. Increase the price of all rooms by 15%. See what happens. Why?

Page 3
k. Select all rooms in the roomNo 101.

l. Select only the roomNo and the price of all rooms booked by guestNo 12345.

m. Give two SQL statements using insert into and update.

n. Write an SQL statement to decrease the price of all rooms with roomNo 333
by 20%.

o. Write an SQL statement to select all rooms with the price greater than $500.

Note: for comparison purposes, you’d better keep all records of your SQL
statements (simply save them in a separate .txt file). You must take screenshots
of your queries and the results too.

You should type your answers to these questions.

Page 4

You might also like