This document discusses the SQL statements used to create 8 tables for a medical database: Specialty, Doctor, Patient, Allergy, PatientAllergy, Appointment, Medicine, and PatientMedicine. It explains that constraints can be defined directly in a Create Table statement or by altering an existing table. It also notes that some databases use separate date and time data types while others allow them to be used together.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
26 views
Programming Assignment Unit 5 Solution v2
This document discusses the SQL statements used to create 8 tables for a medical database: Specialty, Doctor, Patient, Allergy, PatientAllergy, Appointment, Medicine, and PatientMedicine. It explains that constraints can be defined directly in a Create Table statement or by altering an existing table. It also notes that some databases use separate date and time data types while others allow them to be used together.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
Programming
Assignment Unit 5 – Solution
The following SQL statements are used to create the Specialty, Doctor, Patient, Allergy, PatientAllergy, Appointment, Medicine, and PatientMedicine tables.
As you can see Not Null constraints are added using the “Not Null” clause. We can define constraints in two ways: 1) A constraint can directly be defined in Create Table statement. 2) A constraint can be defined by altering an existing table with a constraint as in altering Doctor Table.
Using dates and times could be confusing in SQL. IBM DB2 and OpenOffice BASE use “date” and “time” data types separately. However, date and time could be used together with Oracle and Microsoft SQL Server.