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

  2. SQL language. Integrity constraint FOREIGN KEY syntax and semantics. Example.

  3. By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: Output room numbers and their buildings where teachers of SE department have lectures

  4. 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

(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 27

  1. Relational algebra.Operations of Cartesian product and join. Examples

  2. SQL language. Purpose of ALTER TABLE command. Examples

  3. By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: Outputs room numbers where teachers of CS faculty have lectures

  4. Create the database with the following tables:

Database of the flight routs:

COMPANY – aircraft company

AIRPORT – airport of arrival/departure

FLIGHT – flight routs

Table name

Column name

Data type

Length

(precis.)

Scale

Column integrity constraint

COMPANY

CID

NUMBER

3

PRIMARY KEY

Name

varchar2

50

cannot be NULL

Country

varchar2

30

Cannot be NULL

NumOfPlanes

NUMBER

3

values are in the interval 1 - 200

Table integrity constraint

Triple of columns (Name, Country, NumOfPlanes) is unique

AIRPORT

APID

NUMBER

3

PRIMARY KEY

Name

varchar2

50

Cannot be NULL

COUNTRY

varchar2

30

Cannot be NULL

Zone

number

7

2

cannot be negative

Table integrity constraint

Pair of columns (NAME, COUNTRY) is unique - UNIQUE

FLIGHT

CompID

NUMBER

3

FOREIGN KEY, references to the column CID of the table COMPANY. If the company is deleted then all its flights are deleted too.

AirToID

NUMBER

3

FOREIGN KEY, references to the column APID of the table AIRPORT. If the airport is deleted then all foreign keys references to the deleted primary key are set to NULL.

AirFromID

NUMBER

3

FOREIGN KEY, references to the column APID of the table AIRPORT. If the airport is deleted then all foreign keys references to the deleted primary key are set to NULL.

FlightDate

Date

Cannot be less than 01.01.2000, cannot be NULL

Table integrity constraint

List of columns (CompID, AirToID, FlightDate) is a PRIMARY KEY

Card 28

  1. Relational algebra. Operations on Cartesian product and join. Examples

  2. SQL language. Purpose of ON DELETE SET NULL, ON DELETE CASCADE phrases of the CRERATE statement

By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: «By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query»

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