Skip to content

SalDev40/DB-Validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  • DESCRIPTION:

    A program that generates SQL statements (SELECT + temp tables) to check referential integrity and normalization (simplified).The input is a database consisting of a set of SQL tables (relations) and a primary key (PK) for eachtable, as well as foreign keys. We assume all keys are simple keys (one column). The schema of the tables will be specified as a text file, and the actual tables will be already stored in the database. While your program must generate the output as text files, all the processing will be done with SQL queries.The output is a single text file showing if each table has referential integrity and if it is normalized or not. More details below.

  • ASSUMPTIONS:

  1. Referential integrity: For each table the program must state if referential integrity is correct: Y/N. Since the key is simpleand we assume PKs are clean you can check only 3NF.

  2. Normalization: For each table the program must state if it is normalized Y/N. Since the key is simple and we assumePKs are clean you can check only 3NF with simple keys.

  3. If input file has errors in table (No primary key, invalid Foreign Key):

    • skip checking rest of table
  • HOW TO RUN:

    1. Enter username password, and database for postgress in user.txt
    2. Enter postgres database name in hw2all.sh or hw2one.sh
    3. hw2one.sh run each shell script one at a time to see results individually
    4. hw2all.sh runs all test cases and displays output in ./allResults folder
    5. output filenames = reinformant.txt and checkdb.sql
  • EXAMPLE:

    dbxyz.txt


    • T1(K(pk),K2(fk:T2.K2),A,B)
    • T2(K2(pk),C)
    • T3(K3(pk),D,E)
    • T4(K4(pk),K3(fk:T3.K3),F)

    Sample output file: refintnorm.txt

    • referential integrity normalized
    • T1 Y Y
    • T2 N Y
    • T3 N Y
    • T4 Y Y
    • DB referential integrity: N
    • DB normalized: Y

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published