Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.29 KB | None | 0 0
  1. CREATE DATABASE Clinic
  2. GO
  3.  
  4. USE Clinic
  5. GO
  6.  
  7. CREATE TABLE Diseases (
  8.     DiseaseID int IDENTITY(1,1) PRIMARY KEY,
  9.     DiseaseName varchar(100),
  10.     DiseaseType varchar(100),
  11.     Orders varchar(200)
  12. );
  13.  
  14. CREATE TABLE Doctor (
  15.     DoctorPesel varchar(11) PRIMARY KEY,
  16.     FirstName varchar(50) NOT NULL,
  17.     LastName varchar(50) NOT NULL,
  18.     Age int
  19. );
  20.  
  21. CREATE TABLE DoctorLogin (
  22.     LoginID int IDENTITY(1,1) PRIMARY KEY,
  23.     Username varchar(100) NOT NULL,
  24.     Pass char(64) NOT NULL,
  25.     Email varchar(320) NOT NULL,
  26.     DoctorPesel varchar(11) FOREIGN KEY REFERENCES Doctor(DoctorPesel)
  27. );
  28.  
  29. CREATE TABLE Patient (
  30.     PatientPesel varchar(11) PRIMARY KEY,
  31.     FirstName varchar(50) NOT NULL,
  32.     LastName varchar(50) NOT NULL,
  33.     Age int
  34. );
  35.  
  36. CREATE TABLE PatientLogin (
  37.     LoginID int IDENTITY(1,1) PRIMARY KEY,
  38.     Username varchar(100) NOT NULL,
  39.     Pass char(64) NOT NULL,
  40.     Email varchar(320) NOT NULL,
  41.     PatientPesel varchar(11) FOREIGN KEY REFERENCES Patient(PatientPesel)
  42. );   
  43.  
  44. CREATE TABLE Appointment (
  45.     AppointmentID int IDENTITY(1,1) PRIMARY KEY,
  46.     DoctorPesel varchar(11) FOREIGN KEY REFERENCES Doctor(DoctorPesel),
  47.     PatientPesel varchar(11) FOREIGN KEY REFERENCES Patient(PatientPesel),
  48.     DiseaseID int FOREIGN KEY REFERENCES Diseases(DiseaseID),
  49.     AppointmentDate DATETIME NOT NULL,
  50.     AppointmentCompleted BIT DEFAULT 0
  51. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement