
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Card 19
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
- •Create the database with the following tables:
Card 1
-
Relational algebra: outer join operation.
-
SQL language. PRIMARY KEY integrity constraint. Syntax and semantics. Example.
-
By using database from labs write expression in Relational algebra and Tuple relational calculus that answer to the following query: “Output subject names that are taught by professors of the SE department on the 1st week”
-
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 |
|
UNIQUE, cannot be NULL |
|
COUNTRY |
varchar2 |
30 |
|
Cannot be NULL |
|
NumOfPlanes |
NUMBER |
3 |
|
values are in the interval 1 - 200 |
|
|
FoundDate |
Date |
|
|
Is in interval 1.12.1950 – 1.1.2010 |
|
RegDate |
Date |
|
|
Is more that 13.12.2011 |
Table integrity constraint |
Pair of columns (Name, Country) is unique The columns (NumOfPlanes, FounDate, RegDate ) are unigue RegDate is more than FoundDate |
||||
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 |
triple of columns (NAME, COUNTRY, Zone) is 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 2
-
Network data structure
-
SQL language. Purpose of the phrases ON DELETE SET NULL, ON DELETE CASCADE of the CRERATE statement
-
By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query: “Output subject names that are taught on Monday to the 1-st course students of the CS faculty”.
-
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 (précis.) |
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 10 - 30 |
|
Table integrity constraint |
Triple of columns (Name, City, Country) 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 |
|
|
Time of the match is in interval 18-21 |
|
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 3
-
Relational algebra: Cartesian project and join opearations
-
SQL language. FOREIGN KEY integrity constraint. Syntax and semantics. Example.
-
By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query “Output subject names that are taught the groups of the second course in room 307 of the 6 building on the 1st week.
-
Create the database with the following tables: database of reception of patients:
DOCTOR – doctors, PATIENT – patients, RECEPTION – reception of patients by doctors
Table name |
Column name |
Data type |
Length (precis.) |
Scale |
Column integrity constraint |
DOCTOR |
DID |
NUMBER |
2 |
|
PRIMARY KEY |
Name |
VARCHAR2 |
30 |
|
UNIQUE, cannot be NULL |
|
PAS_SER |
CHAR |
2 |
|
Cannot be NULL |
|
PAS_NO |
CHAR |
6 |
|
Cannot be NULL |
|
Table integrity constraint |
Pair of columns (PAS_SER, PAS_NO) is unique - UNIQUE |
||||
PATIENT |
PID |
NUMBER |
3 |
|
PRIMARY KEY |
Name |
varchar2 |
30 |
|
Cannot be NULL |
|
Address |
varchar2 |
50 |
|
Cannot be NULL |
|
BirthDate |
Date |
|
|
Is in interval 01.01.1900 – 01.01.2012 |
|
CardNo |
number |
7 |
|
UNIQUE, cannot be NULL is in interval 1-10000 |
|
Table integrity constraint |
Triple of columns (Name, Address, BirthDate) is unique – UNIQUE |
||||
RECEPTION |
DocID |
NUMBER |
2 |
|
FOREIGN KEY, references to the column DID of the table DOCTOR. If the doctor is deleted then all foreign keys references to the deleted primary key are set to NULL. |
PatID |
NUMBER |
2 |
|
FOREIGN KEY, references to the column PID of the table PATIENT. If the patient is deleted then all his receptions are deleted too. |
|
WeekDay |
char |
3 |
|
Takes values from the list (‘mon’, ‘tue’, ‘wed’, ‘thu’, ‘fri’) |
|
Table integrity constraint |
Pair of columns (DocID, PatID) is a primary key |
Card 4
-
Threelevel database architecture ANSI/SPARC.
-
SQL language. CHECK integrity constraint. Syntax and semantics. Example.
-
By using database from labs write expression in Relational algebra and Tuple relational calculus that answer to the following query “Output room numbers in the building 6 where discipline DBMS is taught to the students of the 3rd course..
-
Create the database with the following tables: Database of participation in projects:
EMPLOYEE – employee, PROJECT – project, WORKS – participarion employees in projects
Table name |
Column name |
Data type |
Length (precis.) |
Scale |
Column integrity constraint |
EMPLOYEE |
EID |
NUMBER |
3 |
|
PRIMARY KEY |
Name |
VARCHAR2 |
30 |
|
UNIQUE, cannot be NULL |
|
Address |
VARCHAR2 |
40 |
|
Cannot be NULL |
|
BirthDate |
Date |
|
|
Is in interval 01.07.1940 – 20.10.2010 |
|
BossID |
NUMBER |
3 |
|
FOREIGN KEY, it references to the primary key of the table EMPLOYEE |
|
Table integrity constraint |
Triple of columns (Name, BirthDate, Address) is unique – UNIQUE |
||||
PROJECT |
PID |
NUMBER |
3 |
|
PRIMARY KEY |
Name |
varchar2 |
30 |
|
Cannot be NULL |
|
Fund |
NUMBER |
7 |
2 |
Cannot be negative, is less than 200000 |
|
Profit |
NUMBER |
7 |
2 |
Cannot be negative, is less than 200000 |
|
Table integrity constraint |
Value of the column Profit must be less than 2/7 value of the column Fund |
||||
WORKS |
EID |
NUMBER |
3 |
|
FOREIGN KEY, references to the column EID of the table EMPLOYEE. If employee is deleted than all referenced rows in the WORKS tables are deleted too. |
PID |
NUMBER |
3 |
|
FOREIGN KEY, references to the column PID of the table PROJECT. If project is deleted then all itsreferences are set to NULL. |
|
Duration |
NUMBER |
3 |
|
Is in the interval 1 – 100 |
|
|
StartDate |
Date |
|
|
|
|
FinishDate |
Date |
|
|
|
Table integrity constraint |
Pair of columns (EID, PID) is a primary key (PRIMARY KEY) FinishDate is more than StartDate. Differense between FinishDate and StartDate cannot exceed 200 days |
Card 5
-
Relational algebra operations equi-join, natural join and semi-join
-
SQL language. Syntactical forms of integrity constraint definitions. Examples
-
By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query “Outputs room numbers in the building 4 with lectures of the teachers-professors of the CS faculty on the second week”
-
Create the database with the following tables: Database of orchestras:
MUSICIAN– musicians, INSTRUMENT – musical instruments, ORCHESTRA– orchestras
Table name |
Column name |
Data type |
Length (precis.) |
Scale |
Column integrity constraint |
MUSICIAN |
MNo |
NUMBER |
3 |
|
PRIMARY KEY |
Name |
VARCHAR2 |
30 |
|
UNIQUE, cannot be NULL |
|
PAS_SER |
CHAR |
2 |
|
Cannot be NULL |
|
PAS_NO |
CHAR |
6 |
|
Cannot be NULL |
|
BirthDate |
Date |
|
|
Is in inmterval 01.01.1900 – 20.12.2012 |
|
Table integrity constraint |
Pair of columns (Name, BirthDate) is unique – UNIQUE Pair of columns (PAS_SER, PAS_NO) is unique - UNIQUE |
||||
INSTRUMENT |
INo |
NUMBER |
3 |
|
PRIMARY KEY |
Name |
varchar2 |
30 |
|
Cannot be NULL |
|
LowCost |
NUMBER |
7 |
2 |
Cannot be negative |
|
|
UpCost |
NUMBER |
7 |
2 |
Is in interval 200-2000 |
Table integrity constraint |
Difference between UpCost and LowCost cannot exceed 1000 |
||||
ORCHESTRA |
MusNo |
NUMBER |
3 |
|
FOREIGN KEY, references to the column MNo of the table MUSICIAN.If musicians is deleted then all corresponding orchestras is deleted too. |
InsNo |
NUMBER |
3 |
|
FOREIGN KEY, references to the column INo of the table INSTRUMENT. It is not possible to delete instrument if it is used in any orchestra. |
|
QualiLevel |
NUMBER |
1 |
|
Available values – 1,2,3,4,5,6,7 |
|
BandMaster |
NUMBER |
3 |
|
Band-master of the orchestra. FOREIGN KEY, it references to the primary key of the table MUSICIAN. If musican-BandMaster is deleted then corresponding foreign keys are set to NULL. |
|
|
FoundDate |
Date |
|
|
Must be more than 12.12.1950 |
Table integrity constraint |
Triple of columns (MusNo, InsNo, QualiLevel) is a primary key (PRIMARY KEY) |
Card 6.
-
Purpose of the external and internal levels of the ANSI/SPARC database architecture
-
SQL language. Simple conditions.
-
By using database from labs write expression in Relational agebra and Tuple relational calculus that answer to the following query “Output room numbers with number of seats > 50, where students of the 3rd course of the CS faculty have lessons of the type ‘lecture’”
-
Create the database with the following tables: Database of goods catalogue:
SUPPLIER – suppliear, PART – goods, CATALOG – goods cataloque
Table name |
Column name |
Data type |
Length (precis.) |
Scale |
Column integrity constraint |
SUPPLIER |
SNo |
NUMBER |
3 |
|
PRIMARY KEY |
Name |
VARCHAR2 |
30 |
|
UNIQUE, cannot be NULL |
|
Address |
VARCHAR2 |
50 |
|
UNIQUE |
|
FUND |
NUMBER |
6 |
2 |
Values are in the interval 0 - 500000 |
|
Registration |
Date |
|
|
Is in interval 01.01.1950-12.12.2012 |
|
Table integrity constraint |
Pair of columns (Fund, Registration) is unique |
||||
PART |
PNo |
NUMBER |
3 |
|
PRIMARY KEY |
Name |
varchar2 |
30 |
|
UNIQUE, cannot be NULL |
|
Cost |
NUMBER |
7 |
2 |
Cannot be negative |
|
Discount |
NUMBER |
7 |
2 |
Cannot be negative |
|
Table integrity constraint |
Discount must be less than 47% от Cost |
||||
CATALOG |
SNo |
NUMBER |
3 |
|
FOREIGN KEY, references to the column SNo of the table SUPPLIER. If supplier is deleted then all references to it are set to NULLЕ. |
PNo |
NUMBER |
3 |
|
FOREIGN KEY, references to the column PNo of the table PART. If part is deleted then all references rows in CATALOG are deleted too. |
|
QualiLevel |
CHAR |
1 |
|
Available values – ‘1’, ’2’, ’3’, ’4’, ’5’, ’6’ |
|
|
Quantity |
NUMBER |
4 |
|
Values are in the interval 1000 - 2700 |
Table integrity constraint |
Pair of columns (SNo, PNo) is a primary key (PRIMARY KEY) |
Card 7