Skip to content

Latest commit

 

History

History
218 lines (150 loc) · 4.18 KB

File metadata and controls

218 lines (150 loc) · 4.18 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

Subqueries in SQL Language

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

Subqueries in SQL Language

This repository contains a relational database creation and SQL query project developed for the Databases I (Database Management) course at the University of West Attica (UNIWA).
It demonstrates database creation, schema definition, data insertion, and advanced SQL querying.


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/SQL-Queries.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

3. Database Setup

3.1 Locate the SQL Script

Navigate to:

src/new_personnel.sql

This file contains:

  • Database creation statements
  • Table definitions (DEPT, EMP, PROJ, ASSIGN)
  • Primary and foreign key constraints
  • Sample data insertion
  • Example SQL queries

3.2 Execute the SQL Script

3.2.1 Option A: Using MySQL Workbench / GUI Client

  1. Open your SQL client
  2. Create a new SQL tab
  3. Open or paste the contents of new_personnel.sql
  4. Execute the script (Run)

3.2.2 Option B: Using MySQL Command Line

mysql -u your_username -p

Then:

SOURCE path/to/new_personnel.sql;

4. Verification

After successful execution, verify the setup:

4.1 Check Database

SHOW DATABASES;
USE new_personnel;

4.2 Check Tables

SHOW TABLES;

Expected tables:

  • DEPT
  • EMP
  • PROJ
  • ASSIGN

5. Inspect Table Structure

DESCRIBE DEPT;
DESCRIBE EMP;
DESCRIBE PROJ;
DESCRIBE ASSIGN;

6. Validate Sample Data

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

7. Open the Documentation

  1. Navigate to the docs/ directory
  2. Open the report corresponding to your preferred language:
    • English: SQL-Queries.pdf
    • Greek: SQL-Ερωτήματα.pdf