Skip to content

Data-Bases-2/Vars-Functions-Procedures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 II

Variables, Functions, Procedures

Vasileios Evangelos Athanasiou
Student ID: 19390005

GitHub · LinkedIn


Supervision

Supervisor: Periklis Andritsos, Associate Professor

UNIWA Profile · LinkedIn

Co-supervisor: Rania Garofalaki, Laboratory Teaching Staff

UNIWA Profile · LinkedIn


Athens, February 2024



README

Variables, Functions, Procedures

The exercise focuses on SQL and PL/SQL functionalities, including the use of variables, functions, and stored procedures to manipulate data across multiple databases.


Table of Contents

Section Folder / File Description
1 assign/ Laboratory / Assignment material
1.1 assign/laboratory_5.pdf Laboratory instructions (English)
1.2 assign/εργαστήριο_5.pdf Laboratory instructions (Greek)
2 docs/ Theoretical documentation
2.1 docs/Vars-Functions-Procedures.pdf Theory on variables, functions, and procedures (English)
2.2 docs/Μεταβλητές-Συναρτήσεις-Διαδικασίες.pdf Theory on variables, functions, and procedures (Greek)
3 dbs/ ER diagrams or database images
3.1 dbs/Accounts.png Accounts database ER diagram
3.2 dbs/Personnel.png Personnel database ER diagram
4 res/ Visual query results / screenshots
4.1 res/q1-q15*.png Screenshots of queries 1–15, multi-part images included
5 src/ SQL scripts
5.1 src/par1–par6.sql Example scripts for variables, functions, and procedures
5.2 src/q2–q15.sql Query scripts for exercises and labs
6 README.md Project documentation
7 INSTALL.md Usage instructions

1. Database Schemas

The exercise utilizes two primary database structures:

1.1 Personnel Database (personnel)

A management database consisting of three core tables:

  • DEPT: Department details including number, name, and location (e.g., Sales in Athens).
  • JOB: Job roles, descriptions, and salary scales.
  • EMP: Employee records linking to jobs and departments, including commission data.

1.2 Accounts Database (my_accounts)

A financial database designed for transaction testing:

  • Accounts: Stores account IDs (acctID) and balances.
  • Customers: Stores customer identification and names.

2. Key Activities & Learning Objectives

The laboratory work covers the following SQL and PL/SQL functionalities:

2.1 Database Management

  • Creating, selecting, and dropping databases and tables.

2.2 Data Manipulation

  • Inserting records and updating balances or foreign key relationships.

2.3 Variables and Functions

  • Implementing a factorial function to calculate n!.
  • Defining local variables within procedures for complex calculations.

2.4 Stored Procedures

  • Creating a procedure named my_procedure_Local_Variables.
  • Developing a BankTransfer procedure to handle money transfers between accounts.

2.5 Transactions

  • Demonstrating the use of COMMIT and ROLLBACK for data integrity.
  • Analyzing unreliable transactions that lack sufficiency checks (e.g., checking for adequate funds before transfer).

3. Technical Environment

  • The exercise is performed using MySQL Workbench.
  • Screenshots and results throughout the report illustrate the execution of queries, procedures, and transactions.

About

SQL and PL/SQL laboratory project for demonstrating the use of variables, functions, stored procedures, and transaction management across personnel and accounts databases (Databases II, UNIWA).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors