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, December 2023
The exercise demonstrates the creation, configuration, and management of a personnel database, including table definitions, data types, constraints, and basic data manipulation.
| Section | Folder / File | Description |
|---|---|---|
| 1 | assign/ |
Laboratory / Assignment material |
| 1.1 | assign/laboratory_2.pdf |
Laboratory instructions (English) |
| 1.2 | assign/εργαστήριο_2.pdf |
Laboratory instructions (Greek) |
| 2 | docs/ |
Theoretical documentation |
| 2.1 | docs/Constraints.pdf |
Constraints theory (English) |
| 2.2 | docs/Περιορισμοί.pdf |
Constraints theory (Greek) |
| 3 | queries/ |
Visual query examples |
| 3.1 | queries/query*.png |
Various SELECT, INSERT, UPDATE queries demonstrating constraints |
| 3.2 | queries/query5_*.png |
Queries specific to Department, Employee, Job constraints |
| 3.3 | queries/query6_*.png |
Queries specific to Department, Employee, Job constraints |
| 3.4 | queries/query14_*.png |
Complex queries on Dept / Emp / Job tables |
| 3.5 | queries/query16_*.png |
Multi-step queries / transactions |
| 3.6 | queries/query18_*.png |
Query examples with constraint validation |
| 3.7 | queries/query20_*.png |
Advanced constraint queries |
| 4 | src/ |
SQL scripts and related images |
| 4.1 | src/personnel.sql |
SQL script for personnel database with constraints |
| 4.2 | src/personnel.png |
ER diagram / model image |
| 5 | README.md |
Project documentation |
| 6 | INSTALL.md |
Usage instructions |
The database consists of three primary tables with the following initial configurations:
| Table | Columns | Data Type |
|---|---|---|
| DEPT | DEPTNO, DNAME, LOC | numeric(2), varchar(24), char(23) |
| JOB | JOBCODE, JOB_DESCR, SAL | numeric(3), varchar(24), numeric(10,2) |
| EMP | EMPNO, NAME, JOBNO, DEPTNO, COMM | numeric(4), varchar(255), numeric(3), numeric(2), numeric(10,2) |
The exercise covers a comprehensive set of SQL operations:
- Connecting to MySQL via CLI.
- Checking for existing databases.
- Creating the personnel database.
- Creating tables:
DEPT,JOB,EMP. - Populating tables with initial sample data.
- Adding new columns (e.g.,
HIREDATE) and updating existing records. - Modifying data types and renaming columns (e.g.,
DNAME→DEPT_NAME).
- Adding and removing Primary Keys and Foreign Keys.
- Setting DEFAULT values.
- Implementing AUTO_INCREMENT on a new
PROJECTtable.
- Displaying the list of limitations and constraints applied to the database.
- Server: MySQL Community Server 8.0.35
- Connection Method: Command Line Interface (CLI) using the
rootuser
