UNIVERSITY OF WEST ATTICA
SCHOOL OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING AND INFORMATICS
University of West Attica · Department of Computer Engineering and Informatics
Databases I
Vasileios Evangelos Athanasiou
Student ID: 19390005
Supervision
Supervisor: Periklis Andritsos, Professor
Co-supervisor: Anastasios Tsolakidis, Assistant Professor
Athens, June 2023
The objective of this task is to strengthen practical skills in SQL querying, focusing on data classification, aggregation, and relational joins using a structured personnel database.
| Section | Folder / File | Description |
|---|---|---|
| 1 | assign/ |
Assignment material |
| 1.1 | assign/assignment_03.pdf |
Assignment description (English) |
| 1.2 | assign/εργασία_03.pdf |
Assignment description (Greek) |
| 2 | docs/ |
Theoretical documentation |
| 2.1 | docs/Classification-Join-Tables.pdf |
Table classification and JOIN operations (English) |
| 2.2 | docs/Ταξινόμηση-Join-Συνδέσεις.pdf |
Table classification and JOIN operations (Greek) |
| 3 | README.md |
Project documentation |
| 4 | INSTALL.md |
Usage instructions |
The project utilizes a database named new_personnel, which consists of four primary tables:
-
DEPT
Stores department information, including department number, name, and location. -
EMP
Contains employee records such as job titles, hire dates, salaries, commissions, and manager IDs. -
PROJ
Holds project codes and project descriptions. -
ASSIGN
A junction table linking employees to projects, including the time spent on each project.
The assignment covers a wide range of essential SQL functionalities:
- Use of
ORDER BYto organize employee lists based on:- Commission
- Job position
- Salary
- Application of
GROUP BYandHAVINGto:- Calculate average salaries per department
- Filter results based on employee count conditions
- Calculation of employee service years using:
DATEDIFFFORMAT
- Reference date used: 2020-04-15
-
Equi-Joins
Linking employees to their respective departments and projects. -
Self-Joins
Joining theEMPtable to itself to identify employee–manager relationships. -
Multiple Joins
ConnectingEMP,ASSIGN, andPROJtables to identify employees working more than 50 hours on specific projects.
As an example, the self-join operation that maps employees to their managers produces the following structure:
| Department | Manager | Employee |
|---|---|---|
| ACCOUNTING | ELMASRI | CODD |
| ACCOUNTING | ELMASRI | DATE |
| ACCOUNTING | ELMASRI | ELMASRI |
| SALES | NAVATHE | NAVATHE |
