91 lines
1.9 KiB
Markdown
91 lines
1.9 KiB
Markdown
1. **hospital** Table
|
|
Attributes:
|
|
`HospitalID` (Primary Key)
|
|
`Name`
|
|
`City`
|
|
`Postcode` (Unique)
|
|
|
|
```SQL
|
|
INSERT INTO hospital
|
|
VALUES ('h01', 'Royal Infirmary', 'Manchester', 'M13 1AB'),
|
|
('h02', 'St James University Hospital', 'Leeds', 'LE6 6JX'),
|
|
('h03', 'Eye hospital', 'Manchester', 'M5 3AC'),
|
|
('h04', 'Wythenshawe Hospital', 'Manchester', 'M22 4XD');
|
|
```
|
|
|
|
1. **transplant_unit** Table
|
|
Attributes:
|
|
`unit_id` (Primary Key)
|
|
`hospital_id` (Foreign Key referencing Hospital)
|
|
`specialisation`
|
|
|
|
```SQL
|
|
INSERT INTO transplant_unit
|
|
VALUES ( 'u001', 'h01', 'Kidney (Renal)' ),
|
|
( 'u002', 'h02', 'Kidney (Renal)' ),
|
|
( 'u003', 'h01', 'Pancreas' ),
|
|
( 'u004', 'h02', 'Liver' ),
|
|
( 'u005', 'h04', 'Cardiothoracic' );
|
|
```
|
|
|
|
1. **organ** Table:
|
|
Attributes:
|
|
`organ_id` (Primary Key)
|
|
`organ_type`
|
|
|
|
```SQL
|
|
INSERT INTO organ
|
|
VALUES ( 'o1', 'kidney' ),
|
|
( 'o2', 'heart' ),
|
|
( 'o3', 'lung' ),
|
|
( 'o4', 'pancreas' ),
|
|
( 'o5', 'liver' );
|
|
```
|
|
|
|
1. **patient** Table:
|
|
Attributes:
|
|
`patient_id` (Primary Key)
|
|
`patient_name`
|
|
`age`
|
|
|
|
```SQL
|
|
INSERT INTO patient
|
|
VALUES ( 'p03', 'ben', 58 ),
|
|
( 'p04', 'jane', 27),
|
|
( 'p05', 'joan', 50);
|
|
```
|
|
|
|
1. **donor** Table:
|
|
Attributes:
|
|
`donor_id` (Primary Key)
|
|
`donor_name`
|
|
`age`
|
|
|
|
```SQL
|
|
INSERT INTO donor
|
|
VALUES ( 'd01', 'tom', 34 ),
|
|
( 'd02', 'dick', 45 ),
|
|
( 'd03', 'harry', 27 ),
|
|
( 'd04', 'sue', 60 ),
|
|
( 'd05', 'kate', 49 ),
|
|
( 'd06', 'rose', 34 );
|
|
```
|
|
|
|
1. **operation** Table
|
|
Attributes:
|
|
`operation_id` (Primary Key)
|
|
`unit_id` (Foreign Key referencing TransplantUnit)
|
|
`organ_id` (Foreign Key referencing Organ)
|
|
`patient_id` (Foreign Key referencing Patient)
|
|
`donor_id` (Foreign Key referencing Donor)
|
|
|
|
```SQL
|
|
INSERT INTO operation
|
|
VALUES ( 'op1', 'o1', 'u002', 'p03', 'd01' ),
|
|
( 'op2', 'o2', 'u005', 'p04', 'd02' ),
|
|
( 'op2', 'o3', 'u005', 'p04', 'd02' ),
|
|
( 'op3', 'o4', 'u003', 'p05', 'd03' ),
|
|
( 'op4', 'o5', 'u004', 'p05', 'd05' ),
|
|
( 'op5', 'o5', 'u002', 'p03', 'd01' );
|
|
```
|