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 laboratory exercise involves the creation of three primary tables and performing SQL operations to manage and analyze employee data.
| Section | Folder / File | Description |
|---|---|---|
| 1 | assign/ |
Laboratory / Assignment material |
| 1.1 | assign/laboratory_1.pdf |
Laboratory instructions (English) |
| 1.2 | assign/εργαστήριο_1.pdf |
Laboratory instructions (Greek) |
| 2 | docs/ |
Theoretical documentation |
| 2.1 | docs/Create-Database.pdf |
Database creation theory (English) |
| 2.2 | docs/Δημιουργία-ΒΔ.pdf |
Database creation theory (Greek) |
| 3 | queries/ |
Visual query examples |
| 3.1 | queries/insertDept*.png |
Insert Department queries |
| 3.2 | queries/insertEmp*.png |
Insert Employee queries |
| 3.3 | queries/insertJob*.png |
Insert Job queries |
| 3.4 | queries/query*.png |
Select / complex queries |
| 3.5 | queries/select*.png |
Select specific tables |
| 3.6 | queries/Step1.png |
Step-by-step illustration |
| 4 | src/ |
SQL scripts and related images |
| 4.1 | src/personnel.sql |
SQL script for personnel database |
| 4.2 | src/personnel.png |
ER diagram / model image |
| 5 | README.md |
Project documentation |
| 6 | INSTALL.md |
Usage instructions |
Stores information about the organization's departments.
- Primary Key:
DEPTNO - Fields:
DEPTNO(int)DNAME(varchar)LOC(varchar)
Defines job descriptions and associated base salaries.
- Primary Key:
JOBCODE - Fields:
JOBCODE(int)JOB_DESCR(varchar)SAL(int)
Stores detailed employee records and links employees to departments and job roles.
- Primary Key:
EMPNO - Foreign Keys:
DEPTNOreferencesDEPTJOBNOreferencesJOB
- Fields:
EMPNO(int)NAME(varchar)JOBNO(int)DEPTNO(int)COMM(int)
The lab guides students through the following operations:
-
System Connection
Connecting to the MySQL monitor via the command prompt. -
Database Creation
Checking for and creating the personnel database if it does not exist. -
Table Initialization
UsingCREATE TABLEstatements with proper primary key, foreign key, and other constraints. -
Data Entry
Populating tables usingINSERT INTOwith sample data for departments such as Sales, Account, and Payroll. -
Data Analysis (Queries)
- Filtering employees by job title (e.g., Salesmen or Analysts).
- Using aggregate functions: total employees, minimum/average salaries, and commission counts.
- Sorting data by department and salary levels.
- Calculating departmental statistics, such as average salary per department.

