0% found this document useful (0 votes)
8 views

Tutorial 4

The document discusses questions for a tutorial on systems analysis and design (SAD) and SQL. For SAD, it asks about use cases, preconditions, and a relational algebra statement. For SQL, it asks about various queries using WHERE, ORDER BY, SELECT, ALTER including adding/dropping columns and changing data types.

Uploaded by

vancong.iuetv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Tutorial 4

The document discusses questions for a tutorial on systems analysis and design (SAD) and SQL. For SAD, it asks about use cases, preconditions, and a relational algebra statement. For SQL, it asks about various queries using WHERE, ORDER BY, SELECT, ALTER including adding/dropping columns and changing data types.

Uploaded by

vancong.iuetv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Tutorial 4

Readings:

1. Chapter 4 in the SAD textbook.

2. Chapters 5 and 6.1-6.3.2 in the DB textbook.

3. Related items on Wikipedia, such as use case analysis, relational algebra, join,
and so on.

4. Related topics on w3schools, such as where, order by, alter 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 the relationships and differences between events and use cases?

2. What are preconditions and postconditions of a use case? Give an


example to illustrate them.

3. Write a statement in relational algebra to select the type of all rooms in hotelNo
321 with the price less than $150

You should type your answers to these questions.

Part B – Project Practices (1 mark):

SAD – use case analysis. Conduct use case analysis for the final project.
Consider the following 3 different categories.

a) Staff

b) Customer

c) Timetable

You need to analyse at least one use case for each category listed above. You
should type your answers to the above questions.

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

SQL – where condition, order by, select, alter.

a) Write an SQL statement to select all rooms in the hotelNo 345 with the price
less than $150, and order the results first by roomNo and second by types.

b) Write an SQL statement to add columns view and floor to the Room table.

c) Select the distinct value of hotelNo in the Room relation.

d) Select the rooms not in hotelNo 300 and whose roomNo is not 101.

e) Select the rooms not in hotelNo 445 or whose roomNo is not 101.

f) Select the rooms in hotelNo 362 and order the results in a descendent order.

g) Select the rooms with a price greater than $110, and order the results firstly by
price in an ascendant order, and secondly by type in a descendent order.

h) Update view of roomNo 101 in hotelNo 300 to oceanView.

i) List all information of roomNo 101.

j) Drop field view.

k) Drop the column hotelNo in the room table. What happened? Why?

l) Change the data type of the column price into some numerical data type with
decimals.

m) Construct a new relation Guest with the columns (guestNo, guestname,


address) without setting guestNo as the primary key.

n) Drop the column guestNo and re-add it.

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 3

You might also like