daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --CREATE DATABASE Cardiceo
  2. --GO
  3.  
  4. USE Cardiceo
  5. GO
  6.  
  7.  CREATE TABLE Department(
  8.     name VARCHAR(20) PRIMARY KEY,
  9.     --president INTEGER FOREIGN KEY REFERENCES Personnel
  10. )
  11. GO
  12.  
  13. CREATE TABLE Personnel(
  14.     ID INTEGER PRIMARY KEY,
  15.     name VARCHAR(50) NOT NULL,
  16.     dept VARCHAR(20) FOREIGN KEY REFERENCES Department,
  17.     employed DATE NOT NULL,
  18.     salary FLOAT
  19. )
  20. GO
  21.  
  22. CREATE TABLE Specialist(
  23.     PersID INTEGER FOREIGN KEY REFERENCES Personnel,
  24.     rank VARCHAR(10) NOT NULL,  --Doctor/Assistant/Intern
  25.     PRIMARY KEY ("PersID")
  26. )
  27. GO
  28.  
  29.  CREATE TABLE Service(
  30.     ID INTEGER PRIMARY KEY,
  31.     name VARCHAR(20),
  32.     description text
  33. )
  34. GO
  35.  
  36. CREATE TABLE Offer(
  37.     Offer_ID INTEGER PRIMARY KEY,
  38.     Spec_ID INTEGER FOREIGN KEY REFERENCES Specialist,
  39.     Service_ID INTEGER FOREIGN KEY REFERENCES Service,
  40.     price FLOAT,
  41.     --PRIMARY KEY ("Spec_ID", "Service_ID")
  42. )
  43. GO
  44.  
  45. CREATE TABLE Patient(
  46.     PESEL VARCHAR(11) PRIMARY KEY,
  47.     name VARCHAR(50) NOT NULL,
  48.     address VARCHAR(50) NOT NULL,
  49.     phone_nr VARCHAR(10) NOT NULL
  50. )
  51. GO
  52.  
  53. CREATE TABLE Visit(
  54.     ID INTEGER PRIMARY KEY,
  55.     treatment INTEGER FOREIGN KEY REFERENCES Offer(Offer_ID),
  56.     Patient_ID VARCHAR(11) FOREIGN KEY REFERENCES Patient,
  57.     reg_date DATE NOT NULL,
  58.     visit_date DATE NOT NULL,
  59.     deposit_amt FLOAT NOT NULL,
  60.     deposit_form VARCHAR(9) NOT NULL,   --cash/transfer
  61.     STATUS VARCHAR(14) NOT NULL,        --completed/not completed/waiting,
  62.     grade INTEGER
  63. )
  64. GO
  65.  
  66. --drop table Visit
  67. --drop table Patient
  68. --drop table Service
  69. --drop table Offer
  70. --drop table Specialist
  71. --drop table Personnel
  72. --drop table Department
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top