https://github.com/cbarrick/normalization
Database normalization in Prolog
https://github.com/cbarrick/normalization
Last synced: 3 months ago
JSON representation
Database normalization in Prolog
- Host: GitHub
- URL: https://github.com/cbarrick/normalization
- Owner: cbarrick
- License: mit
- Created: 2015-07-28T05:50:48.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-31T23:00:17.000Z (almost 10 years ago)
- Last Synced: 2025-01-11T04:14:02.272Z (5 months ago)
- Language: Prolog
- Size: 148 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Normalization
Database normalization in PrologThis script implements the two most common algorithms for database normalization, BCNF decomposition and 3NF synthesis. It was written as an exercise while studying for an exam in a databases class.
The `norm_example` predicate normalizes an example database given in the textbook _Database Systems_ by Kifer, Bernstein, and Lewis.
Example output:
$ ./norm.pl
# BCNF Decomposition
- Schema: `[[a,d,e],[a,f,h],[b,c,f,g]]`
- Dependencies: `[ ([a]->[d,e]), ([b,h]->[c,f,g]), ([f]->[a,h])]`
- Decomposition:
```
[a,b,c,d,e,f,g,h]
├── violation: [a]->[d,e]
├── [a,d,e]
└── [a,b,c,f,g,h]
├── violation: [f]->[a,h]
├── [a,f,h]
└── [b,c,f,g]
```# 3NF Synthesis
- Schema: `[[a,d,e],[b,c,f,g,h],[a,f,h]]`
- Dependencies: `[ ([a]->[d,e]), ([b,h]->[c,f,g]), ([f]->[a,h])]`
- Global Key: `[b,c,f,g,h]`