Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
BD / Exams / English / Module Control Work 1 Cards.doc
Скачиваний:
22
Добавлен:
20.02.2016
Размер:
887 Кб
Скачать
☆
  1. Keys in relational data model. Examples

  2. SQL language. Purpose and possibilities of the CREATE TABLE table.

  3. By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: “Output week, day and lesson when teacher Smith of the CS faculty has lectures in group 307 of the 3rd course”

  4. Create the database with the following tables:

Database of the bidirectional relationship of suppliers and customers:

SUPPLIER – suppliers, CUSTOMER – customers

Table name

Column name

Data type

Length

(prec)

Scale

Column integrity constraint

SUPPLIER

SPK

NUMBER

3

PRIMARY KEY

Name

VARCHAR2

25

Cannot be NULL

Type

NUMBER

2

Values are in the interval 1-50

Promotion

DATE

1

Values are in the interval 01.01.1930-31.12.2009

CFK

NUMBER

3

FOREIGN KEY, it references to the primary key of the table CONSUMER. If customer is deleted then all references to it are set to NULL

Table integrity constraint

Pair of columns (Name, Type) is unique - UNIQUE

CONSUMER

CPK

NUMBER

3

PRIMARY KEY

Name

VARCHAR2

30

Cannot be NULL

Num

NUMBER

2

Values are in the interval 2-95

Promotion

DATE

1

Must be more than 01.01.1955

SFK

NUMBER

3

FOREIGN KEY, it references to the primary key of the table SUPPLIER. If supplier is deleted then all references to it are set to NULL

Table integrity constraint

Pair of columns (CPK, SFK) is unique

Card 15

  1. Relational algebra operations projection and selection. Examples

  2. SQL language. NUMBER data type

  3. By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: “Output type of lectures that have Andrew teacher of the CS faculty in room 307 of the 6 building on Monday of the 1st week.

  4. Create the database with the following tables:

Database of order of goods in e-shop

E-SHOP – electronic shop, GOODS- goods, AVAILABILITY – goods availability in e-shop, ORDER – order of the goods

Table name

Column name

Data type

Length

(précis.)

Scale­

Column integrity constraint

E-SHOP

SPK

NUMBER

3

PRIMARY KEY

Name

VARCHAR2

25

Cannot be NULL

Type

VARCHAR2

25

Take values from the list: manufactured goods, foodstuffs

URL

VARCHAR2

75

Cannot be NULL

Table integrity constraint

Pair of columns (Name, Type) is unique - UNIQUE

GOODS

GPK

NUMBER

3

PRIMARY KEY

Name

VARCHAR2

30

Cannot be NULL

Index

NUMBER

2

Values are in the interval 0-77

Unit

VARCHAR2

10

Take values from the list: pcs, kgs, m2, m3

Table integrity constraint

Pair of columns (CPK, SFK) is unique

AVAILABILITY

SFK

NUMBER

3

FOREIGN KEY, it references to the primary key of the table E-SHOP. If shop is deleted then all references to is are set to NULL

GFK

NUMBER

3

FOREIGN KEY, it references to the primary key of the table GOODS. If goods is deleted then all references rows in AVAILABILITY table are deleted too

Quantity

NUMBER

2

Take values in the interval 0-80

Table integrity constraint

Pair of columns (SFK, GFK) is a primary key

ORDER

SFK

NUMBER

3

FOREIGN KEY, it references to the primary key of the table E-SHOP. If shop is deleted then all references oders are deleted too

GFK

NUMBER

3

FOREIGN KEY, it references to the primary key of the table GOODS. It is not possible to delete shop if it has at least one order

Quantity

NUMBER

2

Takes values in the interval 0-80

OrderDate

Date

Takes values in the interval 10.05.2000-05.07.2009

Table integrity constraint

Pair of columns (SFK, GFK) is a primary key

Card 16

Соседние файлы в папке English