-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatients.sql
33 lines (27 loc) · 1.19 KB
/
patients.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#------------------------------------------------------------
# Script MySQL.
#------------------------------------------------------------
CREATE DATABASE IF NOT EXISTS `hospitalE2N` CHARACTER SET 'utf8';
USE `hospitalE2N`;
#------------------------------------------------------------
# Table: patients
#------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `patients`(
`id` INT (11) AUTO_INCREMENT NOT NULL ,
`lastname` VARCHAR (25) NOT NULL ,
`firstname` VARCHAR (25) NOT NULL ,
`birthdate` DATE NOT NULL ,
`phone` VARCHAR (25) ,
`mail` VARCHAR (100) NOT NULL ,
PRIMARY KEY (`id`)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: appointments
#------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `appointments`(
`id` INT (11) AUTO_INCREMENT NOT NULL ,
`dateHour` DATETIME NOT NULL ,
`idPatients` INT (11) NOT NULL ,
PRIMARY KEY (`id`)
)ENGINE=InnoDB;
ALTER TABLE `appointments` ADD CONSTRAINT FK_appointments_id_patients FOREIGN KEY (`idPatients`) REFERENCES `patients`(`id`);