UNIVERSITY OF WEST ATTICA
SCHOOL OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING AND INFORMATICS
University of West Attica · Department of Computer Engineering and Informatics
Databases II
Vasileios Evangelos Athanasiou
Student ID: 19390005
Supervision
Supervisor: Periklis Andritsos, Associate Professor
Co-supervisor: Rania Garofalaki, Laboratory Teaching Staff
Athens, February 2024
The exercise focuses on SQL and PL/SQL functionalities, including the use of variables, functions, and stored procedures to manipulate data across multiple databases.
| Section | Folder / File | Description |
|---|---|---|
| 1 | assign/ |
Laboratory / Assignment material |
| 1.1 | assign/laboratory_5.pdf |
Laboratory instructions (English) |
| 1.2 | assign/εργαστήριο_5.pdf |
Laboratory instructions (Greek) |
| 2 | docs/ |
Theoretical documentation |
| 2.1 | docs/Vars-Functions-Procedures.pdf |
Theory on variables, functions, and procedures (English) |
| 2.2 | docs/Μεταβλητές-Συναρτήσεις-Διαδικασίες.pdf |
Theory on variables, functions, and procedures (Greek) |
| 3 | dbs/ |
ER diagrams or database images |
| 3.1 | dbs/Accounts.png |
Accounts database ER diagram |
| 3.2 | dbs/Personnel.png |
Personnel database ER diagram |
| 4 | res/ |
Visual query results / screenshots |
| 4.1 | res/q1-q15*.png |
Screenshots of queries 1–15, multi-part images included |
| 5 | src/ |
SQL scripts |
| 5.1 | src/par1–par6.sql |
Example scripts for variables, functions, and procedures |
| 5.2 | src/q2–q15.sql |
Query scripts for exercises and labs |
| 6 | README.md |
Project documentation |
| 7 | INSTALL.md |
Usage instructions |
The exercise utilizes two primary database structures:
A management database consisting of three core tables:
- DEPT: Department details including number, name, and location (e.g., Sales in Athens).
- JOB: Job roles, descriptions, and salary scales.
- EMP: Employee records linking to jobs and departments, including commission data.
A financial database designed for transaction testing:
- Accounts: Stores account IDs (
acctID) and balances. - Customers: Stores customer identification and names.
The laboratory work covers the following SQL and PL/SQL functionalities:
- Creating, selecting, and dropping databases and tables.
- Inserting records and updating balances or foreign key relationships.
- Implementing a factorial function to calculate
n!. - Defining local variables within procedures for complex calculations.
- Creating a procedure named
my_procedure_Local_Variables. - Developing a
BankTransferprocedure to handle money transfers between accounts.
- Demonstrating the use of
COMMITandROLLBACKfor data integrity. - Analyzing unreliable transactions that lack sufficiency checks (e.g., checking for adequate funds before transfer).
- The exercise is performed using MySQL Workbench.
- Screenshots and results throughout the report illustrate the execution of queries, procedures, and transactions.

