Skip to content

Latest commit

 

History

History
212 lines (138 loc) · 4.67 KB

File metadata and controls

212 lines (138 loc) · 4.67 KB

UNIWA

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

Classification and Suggestions - GROUP BY, AND, HAVING, JOIN

Vasileios Evangelos Athanasiou
Student ID: 19390005

GitHub · LinkedIn


Supervision

Supervisor: Periklis Andritsos, Professor

UNIWA Profile · LinkedIn

Co-supervisor: Anastasios Tsolakidis, Assistant Professor

UNIWA Profile · LinkedIn


Athens, June 2023



INSTALL

Classification and Suggestions - GROUP BY, AND, HAVING, JOIN

This guide describes how to install, initialize, and verify the database environment required to execute the laboratory tasks.
You will need a Relational Database Management System (RDBMS) that supports SQL, such as MySQL or MariaDB.


1. Prerequisites

Before using this project, ensure you have the following installed:

1.1 Database Management System (DBMS)

  • MySQL (recommended)
  • Compatible alternatives:
    • MariaDB
    • PostgreSQL (minor syntax adjustments may be required)

1.2 SQL Client / Interface

Any SQL client capable of executing .sql scripts:

  • MySQL Workbench (recommended)
  • phpMyAdmin
  • DBeaver
  • Command-line MySQL client

Make sure your SQL client is properly connected to your database server.


2. Installation

2.1 Clone the Repository

Open a terminal/command prompt and run:

git clone https://github.com/Data-Bases-1/Join.git

2.2 Alternative (Without Git)

  • Open the repository URL in your browser
  • Click Code → Download ZIP
  • Extract the ZIP file to a local directory

2.3 Database Initialization

First, remove any existing version of the database to avoid conflicts. Then create and select the new database.

DROP DATABASE IF EXISTS new_personnel;
CREATE DATABASE IF NOT EXISTS new_personnel;
USE new_personnel;

2.4 Table Creation

Tables must be created in a specific order to satisfy Foreign Key constraints.

2.4.1 Creation Order

  1. DEPT
  2. EMP
  3. PROJ
  4. ASSIGN

2.4.2 Table Descriptions

  • DEPT

    Stores department information, including department number, name, and location.

  • EMP

    Stores employee details and references the DEPT table through the DEPTNO foreign key.

  • PROJ

    Contains project codes and project descriptions.

  • ASSIGN

    A junction table that links employees to projects and records the time spent on each project.


3. Data Population

Insert the sample data provided in the laboratory task to populate the database.

3.1 Sample Data Categories

  • Departments

    Add department records with locations such as ATHENS and LONDON.

  • Employees

    Insert employee records including staff such as CODD, ELMASRI, and NAVATHE.

  • Projects

    Define projects such as PAYROLL and PERSONNEL.

  • Assignments

    Link employees to projects with assigned time (e.g., Employee 10 assigned to Project 100 for 40 hours).


4. Verification

Use the following SQL commands to verify that the database schema and data have been created successfully:

SELECT * FROM DEPT;
SELECT * FROM EMP;
SELECT * FROM PROJ;
SELECT * FROM ASSIGN;

5. Open the Documentation

  1. Navigate to the docs/ directory
  2. Open the report corresponding to your preferred language:
    • English: Classification-Join-Tables.pdf
    • Greek: Ταξινόμηση-Join-Συνδέσεις.pdf