sqlnanalyzes a relation defined by its attributes and functional dependencies (FDs),
then automatically decomposes it into normalized relations (tables).
git clone https://github.com/jkeresman01/sqln.git
cd sqln
go build -o sqln .sqln --attrs="<attributes>" --fds="<functional dependencies>" --to=<3NF|BCNF>Example:
sqln \
--attrs="PatientID,Name,DOB,ExamID,ExamType,Result,Description,MedicationID,Manufacturer,PrescriptionID,Dosage,Frequency" \
--fds="PatientID->Name|DOB;ExamID->PatientID|ExamType|Result;ExamType->Description;MedicationID->Name|Manufacturer;PrescriptionID->PatientID|MedicationID|Dosage|Frequency" \
--to=3NF 3NF Decomposition
═══════════════════════════════════════════════════════════════════════════
║ Relation │ Attributes ║
╠═══════════╪═════════════════════════════════════════════════════════════╣
║ R_1 │ ExamType, Description ║
║ R_2 │ MedicationID, Name, Manufacturer ║
║ R_3 │ PrescriptionID, PatientID, MedicationID, Dosage, Frequency ║
║ R_4 │ PatientID, Name, DOB ║
║ R_5 │ ExamID, PatientID, ExamType, Result ║
╚═══════════╧═════════════════════════════════════════════════════════════╝sqln/
├── cmd/
│ └── root.go # CLI setup and argument parsing
├── internal/
│ ├── algo/ # Normalization algorithms (closure, keys, decomposition)
│ ├── model/ # Data structures: Relation, FD, AttributeSet
│ └── util/ # Table printer, helpers
└── go.mod
MIT License © 2025 — Josip Keresman