SQL Databse Designing

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

Designing a comprehensive database structure for a dental clinic management system

involves considering various entities and their relationships.


Here's a more detailed SQL database structure for such a system:

Tables:
Patients Table:

PatientID (Primary Key)


FirstName
LastName
DateOfBirth
Gender
ContactNumber
Email
Address

Appointments Table:

AppointmentID (Primary Key)


PatientID (Foreign Key referencing Patients.PatientID)
DentistID (Foreign Key referencing Dentists.DentistID)
AppointmentDate
AppointmentTime
Purpose
Notes
Status (e.g., scheduled, completed, canceled)

Dentists Table:

DentistID (Primary Key)


FirstName
LastName
ContactNumber
Email
Specialization

Procedures Table:

ProcedureID (Primary Key)


ProcedureName
Description
Cost

PatientProcedures Table:

PatientProcedureID (Primary Key)


PatientID (Foreign Key referencing Patients.PatientID)
ProcedureID (Foreign Key referencing Procedures.ProcedureID)
DatePerformed
Notes

Payments Table:

PaymentID (Primary Key)


PatientID (Foreign Key referencing Patients.PatientID)
Amount
PaymentDate
PaymentMethod
SQL to Create Tables:

CREATE TABLE Patients (


PatientID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
DateOfBirth DATE,
Gender VARCHAR(10),
ContactNumber VARCHAR(15),
Email VARCHAR(100),
Address VARCHAR(255)
);

CREATE TABLE Appointments (


AppointmentID INT PRIMARY KEY,
PatientID INT,
DentistID INT,
FOREIGN KEY (PatientID) REFERENCES Patients(PatientID),
FOREIGN KEY (DentistID) REFERENCES Dentists(DentistID),
AppointmentDate DATE,
AppointmentTime TIME,
Purpose VARCHAR(255),
Notes TEXT,
Status VARCHAR(20)
);

CREATE TABLE Dentists (


DentistID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
ContactNumber VARCHAR(15),
Email VARCHAR(100),
Specialization VARCHAR(50)
);

CREATE TABLE Procedures (


ProcedureID INT PRIMARY KEY,
ProcedureName VARCHAR(50),
Description TEXT,
Cost DECIMAL(10, 2)
);

CREATE TABLE PatientProcedures (


PatientProcedureID INT PRIMARY KEY,
PatientID INT,
ProcedureID INT,
FOREIGN KEY (PatientID) REFERENCES Patients(PatientID),
FOREIGN KEY (ProcedureID) REFERENCES Procedures(ProcedureID),
DatePerformed DATE,
Notes TEXT
);

CREATE TABLE Payments (


PaymentID INT PRIMARY KEY,
PatientID INT,
Amount DECIMAL(10, 2),
PaymentDate DATE,
PaymentMethod VARCHAR(20),
FOREIGN KEY (PatientID) REFERENCES Patients(PatientID)
);

You might also like