1. Trang chủ
  2. » Luận Văn - Báo Cáo

week 6 tutorial questions solutions

6 35 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 6
Dung lượng 359,21 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

How many Foreign Keys will exist in the Task relation?. How many Foreign Keys will exist in the Project relation?. Consider the Project Relation after conversion to a relational schema..

Trang 1

Week 6 Tutorial Questions Solutions

Database Analysis and Design (Swinburne University of Technology)

Week 6 Tutorial Questions Solutions

Database Analysis and Design (Swinburne University of Technology)

Trang 2

Tutorial 6 – Discussion Questions for Week 6

1 Consider the ERD above When converted to a Relational Schema:

a How many Foreign Keys will exist in the Task relation? One

b How many Foreign Keys will exist in the Project relation? One

2 Consider the Project Relation (after conversion to a relational schema)

a What is the name of the Foreign Key in this relation? LeaderId

b Would this foreign key be allowed to have Null values? Yes

3 Consider the Task Relation (after conversion to a relational schema)

a What is the name of the Foreign Key in this relation? ProjectId

b Would this foreign key be allowed to have Null values? No

4 Imagine that you now want to build the database based on the Relational Schema

a Which table would you have to create first? Leader, Project or Task? Leader

b Which table would you have to create second? Leader, Project or Task? Project

c Which table would you have to create last? Leader, Project or Task? Task

5 What is a Parent row in a relational database?

A parent row is a row that contains a primary key value that is referenced by foreign key values

6 What is a Child row in a relational database?

A child row is a row that contains a foreign key value that is references a primary key value

7 True or False

a Leader is a parent of Project True

b Task is a parent of Project False

c Leader is a parent of Task False

d Task is a parent of Leader False

8 When using Oracle in default mode, nominate if the following statements are True or False

a A parent row that has no child rows may be deleted without error True

b A child row that has a parent row may be deleted without error True

c A child row may not be orphaned True

L E A DER

LeaderID

Title

ProjectId

Le c Office

Supervises PRO J ECT

Name

Co s t

De s c ription

TaskId

TASK

has

Trang 3

INF10002 Tutorial 6

9 Consider the following data in the Person table How many rows are selected by the following Queries? a

(Rick's quantities are unknown)

b

(Rick's quantities are unknown)

c

(Rick's quantities are unknown)

d

e

SELECT Name FROM person

WHERE NOT (QtyA + QtyB) < 10 AND Gender = 'F' ;

Trang 4

f

g

h

i

j

Trang 5

INF10002 Tutorial 6

k

l

m

Trang 6

Assume that a relational schema and database has been built based on the ERD in Question 1

LEADER(LeaderId, Name)

PK (LeaderId)

TASK (TaskId, Description, Cost, ProjectId)

PK (TaskId)

FK (ProjectId) References Project PROJECT(ProjectId, Title, LeaderId)

PK (ProjectId)

FK (LeaderId) References Leader

10 Write a single SQL statement using INNER JOIN clauses and aliases that displays the project title

and leader name for each of the projects in the project table:

SELECT P.title, L.name

INNER JOIN Leader L

ON P.LeaderId =L.LeaderId

11 Write a single SQL statement using INNER JOIN clauses and aliases that displays the task

description and cost, project title and leader name for each of the tasks in the task table

SELECT T.description, T.cost, P.title, L.name

INNER JOIN Project P

ON T.ProjectId =P.ProjectId

INNER JOIN Leader L

ON P.LeaderId =L.LeaderId

Ngày đăng: 25/11/2021, 15:43

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w