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

  2. SQL language. The purpose of TO_DATE function. Example

  3. By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: Output department names whose groups have lectures in the room 202 of the building 4 on Monday of the first week.

  4. Create the database with the following tables:

Database of family tree:

PERSON – info about persons and their parents

Table name

Column name

Data type

Length

(precis.)

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 ‘XX’

Pas_Nom

CHAR

6

Default value ‘XXXXXX’

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.

Card 22

  1. Tuple oriented relational calculus

  2. SQL language. Compound conditions

  3. By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: Outputs department names whose groups have lectures of Ivanov teacher

  4. Create the database with the following tables:

Database of the football matches:

TEAM – football team

STADIUM – stadium

MATCH – football matches

Table name

Column name

Data type

Length

(prec)

Scale

Column integrity constraint

TEAM

City

varchar2

50

Name

varchar2

50

Country

varchar2

30

Cannot be NULL

NumOfPlayers

NUMBER

3

values are in the interval 1 - 100

Table integrity constraint

Pair of columns (Name, City) is a PRIMARY KEY

STADIUM

COUNTRY

varchar2

30

Name

varchar2

50

Quantity

NUMBER

6

values are in the interval 1 - 200000

TimeZone

number

2

cannot be negative

Table integrity constraint

Pair of columns (NAME, COUNTRY) is a PRIMARY KEY

MATCH

Name1

varchar2

50

City1

varchar2

50

Name2

varchar2

50

City2

varchar2

50

SNAME

varchar2

30

SCOUNTRY

varchar2

50

DateTime

date

Table integrity constraint

(Name1, City1) FOREIGN KEY, it references to the PRIMARY KEY of the table TEAM – it the first tean.

(Name2, City2) FOREIGN KEY, it references to the PRIMARY KEY of the table TEAM – it is the second team.

(SNAME, SCOUNTRY) FOREIGN KEY, it references to the PRIMARY KEY of the table STADIUM – place of the match

List of columns (Name1, City1, Name2, City2, DateTime) is a PRIMARY

Card 23

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