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

  2. SQL language. Purpose of the TO_DATE function. Examples.

  3. By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: Out[uts department names whose groups have lectures in Mathematics discipline.

  4. Create the database with the following tables:

Database 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 32

  1. Relational algebra. Set-theoretic operations. Example

  2. SQL language. Conditions IN and BETWEEN. Examples.

  3. By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query Output group numbers of the second course that have lectures of the type “lab” of the teachers CS faculty

Create the database with the following tables:: Database of the family tree:

PERSON – info about persons and their parents

Table name

Column name

Data type

Length

(prec)

Scale

Column integrity constraint

PERSON

Name

VARCHAR2

25

Cannot be NULL

TaxID

NUMBER

8

Уникальный, cannot be NULL, Default value- 0

Sex

CHAR

1

Область допустимых значений – (‘M’, ’F’)

BirthDate

Date

Must be more than 01.01.1930

Pas_Ser

CHAR

2

Default value‘ХХ’

Pas_Nom

CHAR

6

Default value‘000000’

M_Pas_Ser

CHAR

2

M_Pas_Nom

CHAR

6

F_Pas_Ser

CHAR

2

F_Pas_Nom

CHAR

6

Table integrity constraint

Pair of columns (Pas_Ser, Pas_Nom) is a PRIMARY KEY

Pair of columns (Name, BirthDate) is unique – UNIQUE

Pair of columns (M_Pas_Ser, M_Pas_Nom) is a FOREIGN KEY. It references to the pair of columns (Pas_Ser, Pas_Nom) of the same table (it references the the mother of the person).

Pair of columns (F_Pas_Ser, F_Pas_Nom) is a FOREIGN KEY. It references to the pair of columns (Pas_Ser, Pas_Nom) of the same table (it references the the father of the person).

When person is deleted then all references to it as a mother/father are set to NULL.

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