· 4 years ago · Dec 06, 2020, 12:04 PM
1CREATE TABLE IF NOT EXISTS `doctors`
2(
3/* CREATE THE COLUMNS AND DATATYPES FOR THE DATA */
4 `doctorID` int NOT NULL AUTO_INCREMENT, /* doctorID = to store the ID of the doctor using an INT datatype and auto increment the values with each new entry for a doctor table */
5 `firstName` varchar(25) NOT NULL, /* firstName = to store the doctor's first name using VARCHAR datatype */
6 `lastName` varchar(25) NOT NULL, /* lastName = to store the doctor's last name using VARCHAR datatype */
7 `gender` varchar(6) NOT NULL, /* gender = to store the doctor's gender using VARCHAR datatype */
8 `dob` date NOT NULL, /* dob = to store the doctor's date of birth using DATE to store the date of their birth datatype */
9 `salary` decimal(10,2) NOT NULL, /* salary = to store the doctor's salary using DECIMAL datatype */
10 `staffEmail` varchar(100) NOT NULL, /* staffEmail = to store the doctor's staff email address using DECIMAL datatype */
11 `tel` varchar(10) NOT NULL, /* tel = to store the telephone number of the doctor using an INT datatype */
12 `phone` varchar(10) NOT NULL, /* phone = to store the doctor's personal phone number using an INT datatype*/
13 `department` varchar(25) NOT NULL, /* department = to store the department of the doctor using a VARCHAR datatype */
14 `specialist` varchar(20) NOT NULL, /* specialist = to store what the doctor's specialty is using a VARCHAR datatype */
15 PRIMARY KEY (`doctorID`), /* Set PRIMARY KEY of the doctors table as, 'doctorID' */
16 UNIQUE KEY `doctorID_UNIQUE` (`doctorID`), /* Make the doctorID a UNIQUE KEY (UQ) so that the values have to be unique */
17 UNIQUE KEY `doctorFirstName_UNIQUE` (`firstName`)
18
19)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
20
21
22