{"id":79255,"date":"2021-12-03T01:16:35","date_gmt":"2021-12-03T01:16:35","guid":{"rendered":"https:\/\/papersspot.com\/blog\/2021\/12\/03\/database-system-for-a-cancer-registry-consider-a-database-system-for-a\/"},"modified":"2021-12-03T01:16:35","modified_gmt":"2021-12-03T01:16:35","slug":"database-system-for-a-cancer-registry-consider-a-database-system-for-a","status":"publish","type":"post","link":"https:\/\/papersspot.com\/blog\/2021\/12\/03\/database-system-for-a-cancer-registry-consider-a-database-system-for-a\/","title":{"rendered":"Database System for a cancer registry Consider a database system for a"},"content":{"rendered":"<p>Database System for a cancer registry<\/p>\n<p> Consider a database system for a Cancer Registry. The data requirements are summarized as follows:<\/p>\n<p> 1. Patients:<\/p>\n<p> Patients are tracked by a unique patient ID.<\/p>\n<p> Personal information includes first name, last name, phone number, Date of Birth, and sex.<\/p>\n<p> The combination of the Patient\u2019s first and last name must be unique.<\/p>\n<p> Patient\u2019s sex is a mandatory field.<\/p>\n<p> Patient can be registered at any clinic.<\/p>\n<p> 2. Cancer:<\/p>\n<p> Type of cancer is tracked by a unique ID.<\/p>\n<p> Cancer is categorized as either Oral, Lung, Breast, Liver, Blood, Bone, Pancreatic, Cervical, or Prostrate.<\/p>\n<p> Stage of cancer can be Stage I, Stage II, or Stage III<\/p>\n<p> Stage of cancer detection.<\/p>\n<p> Treatment given: Chemotherapy only, Surgery with chemotherapy, Surgery only or Radiation therapy.<\/p>\n<p> Patient_id is an FK which references the ID of the Patient.<\/p>\n<p> Clinic_id is an FK which references the ID of the Clinic that patient register.<\/p>\n<p> Patient information must be stored at one clinic.<\/p>\n<p> Patient Date of detection of Cancer.<\/p>\n<p> 3. Clinic:<\/p>\n<p> Clinics are tracked by unique clinic ID.<\/p>\n<p> Each clinic has a name and location.<\/p>\n<p> The combination of the clinic\u2019s name and location must be unique.<\/p>\n<p> 4. Employees:<\/p>\n<p> Employees are tracked by unique Employee ID.<\/p>\n<p> Clinic_id is a FK which references the Clinic ID which they work at.<\/p>\n<p> Employees must work at a single Clinic.<\/p>\n<p> Personal information includes Fname, Lname and sex.<\/p>\n<p> The combination of an employee\u2019s first and last name must be unique.<\/p>\n<p> Queries:<\/p>\n<p> List the first and last name of all patients who had blood cancer.<\/p>\n<p> List names and location of clinics reported cases of lung cancer.<\/p>\n<p> Find the names of patients whose age is above 50 years and had oral cancer since 10\/10\/2010.<\/p>\n<p> List the names of employees who are working in clinics, which do not have breast cancer case.<\/p>\n<p> ER Diagram <\/p>\n<p> 1.5 Marks<\/p>\n<p> 1.5 Marks Tables before the Normalization <\/p>\n<p> All schemas before normalization:<\/p>\n<p> Patient(patientID,FirstName,LastName,PhoneNumber,dateOfBirth)<\/p>\n<p> Clinic(ClinicID,name,location)<\/p>\n<p> Cancer(CancerTypeID,Category,Stage,Treatment,patientID (fk),clinicID (fk),cancerDate)<\/p>\n<p> Employee(EmployeeID,clinicID (fk),fname,lname,sex)<\/p>\n<p> Tables after the normalization (At least in 3NF) <\/p>\n<p> Create the Normalized Tables and Populate them with at least 5 Rows <\/p>\n<p> Create Tables SQL<\/p>\n<p> CREATE TABLE [Cancer](<\/p>\n<p> [CancerTypeID] [int] IDENTITY(1,1) NOT NULL,<\/p>\n<p> [PatientID] [int] NOT NULL,<\/p>\n<p> [ClinicID] [int] NOT NULL,<\/p>\n<p> [Category] [nvarchar](70) NULL,<\/p>\n<p> [Stage] [nvarchar](30) NULL,<\/p>\n<p> [Treatment] [nvarchar](30) NULL,<\/p>\n<p> [CancerDate] [nchar](10) NULL,<\/p>\n<p> CONSTRAINT [PK_Cancer] PRIMARY KEY CLUSTERED <\/p>\n<p> (<\/p>\n<p> [CancerTypeID] ASC,<\/p>\n<p> [PatientID] ASC,<\/p>\n<p> [ClinicID] ASC<\/p>\n<p> )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<\/p>\n<p> ) ON [PRIMARY]<\/p>\n<p> CREATE TABLE [Clinic](<\/p>\n<p> [ClinicID] [int] IDENTITY(1,1) NOT NULL,<\/p>\n<p> [Name] [nvarchar](50) NULL,<\/p>\n<p> [Location] [nvarchar](50) NULL,<\/p>\n<p> CONSTRAINT [PK_Clinic] PRIMARY KEY CLUSTERED <\/p>\n<p> (<\/p>\n<p> [ClinicID] ASC<\/p>\n<p> )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<\/p>\n<p> ) ON [PRIMARY]<\/p>\n<p> CREATE TABLE [Employee](<\/p>\n<p> [EmployeeID] [int] IDENTITY(100,10) NOT NULL,<\/p>\n<p> [ClinicID] [int] NULL,<\/p>\n<p> [Fname] [nvarchar](15) NULL,<\/p>\n<p> [Lname] [nvarchar](15) NULL,<\/p>\n<p> [sex] [nchar](10) NULL,<\/p>\n<p> CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED <\/p>\n<p> (<\/p>\n<p> [EmployeeID] ASC<\/p>\n<p> )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<\/p>\n<p> ) ON [PRIMARY]<\/p>\n<p> CREATE TABLE [Patient](<\/p>\n<p> [PatientID] [int] IDENTITY(1,1) NOT NULL,<\/p>\n<p> [FirstName] [nvarchar](15) NULL,<\/p>\n<p> [lastName] [nvarchar](15) NULL,<\/p>\n<p> [PhoneNumber] [nchar](10) NULL,<\/p>\n<p> [dateOfBirth] [date] NULL,<\/p>\n<p> [Sex] [nchar](10) NULL,<\/p>\n<p> CONSTRAINT [PK_Patient] PRIMARY KEY CLUSTERED <\/p>\n<p> (<\/p>\n<p> [PatientID] ASC<\/p>\n<p> )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<\/p>\n<p> ) ON [PRIMARY]<\/p>\n<p> CREATE UNIQUE INDEX uq_patient<\/p>\n<p> ON patient(firstname, lastname);<\/p>\n<p> CREATE UNIQUE INDEX uq_clinic<\/p>\n<p> ON clinic(name, location);<\/p>\n<p> CREATE UNIQUE INDEX uq_employee<\/p>\n<p> ON employee(fname, lname);<\/p>\n<p> Insert Tables SQL<\/p>\n<p> INSERT [Cancer] ([CancerTypeID], [PatientID], [ClinicID], [Category], [Stage], [Treatment], [CancerDate]) VALUES (1, 1, 1, N&#8217;Lung&#8217;, N&#8217;Stage I&#8217;, N&#8217;Chemotherapy &#8216;, N&#8217;1\/1\/2010 &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Cancer] ([CancerTypeID], [PatientID], [ClinicID], [Category], [Stage], [Treatment], [CancerDate]) VALUES (2, 2, 1, N&#8217;Blood&#8217;, N&#8217;Stage II&#8217;, N&#8217;Surgery &#8216;, N&#8217;1\/1\/2011 &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Cancer] ([CancerTypeID], [PatientID], [ClinicID], [Category], [Stage], [Treatment], [CancerDate]) VALUES (3, 3, 2, N&#8217;Blood&#8217;, N&#8217;Stage III&#8217;, N&#8217;Radiation therapy&#8217;, N&#8217;1\/1\/2013 &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Cancer] ([CancerTypeID], [PatientID], [ClinicID], [Category], [Stage], [Treatment], [CancerDate]) VALUES (4, 4, 1, N&#8217;oral &#8216;, N&#8217;Stage II&#8217;, N&#8217;Surgery &#8216;, N&#8217;10\/10\/2010&#8217;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Cancer] ([CancerTypeID], [PatientID], [ClinicID], [Category], [Stage], [Treatment], [CancerDate]) VALUES (5, 5, 4, N&#8217;Breast&#8217;, N&#8217;Stage II&#8217;, N&#8217;Radiation therapy&#8217;, N&#8217;1\/1\/2015 &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Clinic] ([ClinicID], [Name], [Location]) VALUES (1, N&#8217;Clinic 1&#8242;, N&#8217;Jeddah&#8217;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Clinic] ([ClinicID], [Name], [Location]) VALUES (2, N&#8217;Clinic 2&#8242;, N&#8217;Alkhobar&#8217;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Clinic] ([ClinicID], [Name], [Location]) VALUES (3, N&#8217;Clinic 3&#8242;, N&#8217;Alkhobar&#8217;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Clinic] ([ClinicID], [Name], [Location]) VALUES (4, N&#8217;Clinic 4&#8242;, N&#8217;Jeddah&#8217;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Clinic] ([ClinicID], [Name], [Location]) VALUES (5, N&#8217;Clinic 5&#8242;, N&#8217;Alkhobar&#8217;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Employee] ([EmployeeID], [ClinicID], [Fname], [Lname], [sex]) VALUES (110, 1, N&#8217;Mohamed&#8217;, N&#8217;Ali&#8217;, N&#8217;male &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Employee] ([EmployeeID], [ClinicID], [Fname], [Lname], [sex]) VALUES (120, 2, N&#8217;Hassan&#8217;, N&#8217;Ahmad&#8217;, N&#8217;male &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Employee] ([EmployeeID], [ClinicID], [Fname], [Lname], [sex]) VALUES (130, 1, N&#8217;Fawzi&#8217;, N&#8217;Moaaz&#8217;, N&#8217;male &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Employee] ([EmployeeID], [ClinicID], [Fname], [Lname], [sex]) VALUES (140, 4, N&#8217;Hoda&#8217;, N&#8217;Hassan&#8217;, N&#8217;Female &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Employee] ([EmployeeID], [ClinicID], [Fname], [Lname], [sex]) VALUES (150, NULL, N&#8217;Adel&#8217;, N&#8217;Mostafa&#8217;, N&#8217;male &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Patient] ([PatientID], [FirstName], [lastName], [PhoneNumber], [dateOfBirth], [Sex]) VALUES (1, N&#8217;ALi&#8217;, N&#8217;Ahmad&#8217;, N&#8217;0556497668&#8242;, CAST(N&#8217;1970-01-01&#8242; AS Date), N&#8217;male &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Patient] ([PatientID], [FirstName], [lastName], [PhoneNumber], [dateOfBirth], [Sex]) VALUES (2, N&#8217;Hend&#8217;, N&#8217;Ali&#8217;, N&#8217;0538974562&#8242;, CAST(N&#8217;1985-01-01&#8242; AS Date), N&#8217;female &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Patient] ([PatientID], [FirstName], [lastName], [PhoneNumber], [dateOfBirth], [Sex]) VALUES (3, N&#8217;Kinda&#8217;, N&#8217;Mamdouh&#8217;, N&#8217;0556478995&#8242;, CAST(N&#8217;1990-01-01&#8242; AS Date), N&#8217;female &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Patient] ([PatientID], [FirstName], [lastName], [PhoneNumber], [dateOfBirth], [Sex]) VALUES (4, N&#8217;Youssef&#8217;, N&#8217;Mamdouh&#8217;, N&#8217;0553216547&#8242;, CAST(N&#8217;1968-01-10&#8242; AS Date), N&#8217;male &#8216;)<\/p>\n<p> GO<\/p>\n<p> INSERT [Patient] ([PatientID], [FirstName], [lastName], [PhoneNumber], [dateOfBirth], [Sex]) VALUES (5, N&#8217;Mostafa&#8217;, N&#8217;ALI&#8217;, N&#8217;0555899632&#8242;, CAST(N&#8217;1999-01-01&#8242; AS Date), N&#8217;MALE &#8216;)<\/p>\n<p> GO<\/p>\n<p> Write the sample requested Queries &amp; Execute them. <\/p>\n<p> List the first and last name of all patients who had blood cancer.<\/p>\n<p> select firstname,lastname from patient where patientid in(select patientid from cancer where category=&#8217;blood&#8217;)<\/p>\n<p> List names and location of clinics reported cases of lung cancer.<\/p>\n<p> select name, location from clinic where clinicid in (select clinicid from cancer where category=&#8217;Lung&#8217;)<\/p>\n<p> Find the names of patients whose age is above 50 years and had oral cancer since 10\/10\/2010.<\/p>\n<p> select firstname,lastname from patient where DATEDIFF(hour,dateOfBirth,GETDATE())\/8766 &gt; 50 and patientid in (select patientid from cancer where category=&#8217;oral&#8217; and cancerdate&gt;=&#8217;10\/10\/2010&#8242;)<\/p>\n<p> List the names of employees who are working in clinics, which do not have breast cancer case.<\/p>\n<p> select employee.fname,employee.lname from employee inner join clinic on employee.ClinicID=clinic.clinicid where Clinic.clinicid in (select clinicid from cancer where category=&#8217;Breast&#8217;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Database System for a cancer registry Consider a database system for a Cancer Registry. The data requirements are summarized as follows: 1. Patients: Patients are tracked by a unique patient ID. Personal information includes first name, last name, phone number, Date of Birth, and sex. The combination of the Patient\u2019s first and last name must [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10],"class_list":["post-79255","post","type-post","status-publish","format-standard","hentry","category-research-paper-writing","tag-writing"],"_links":{"self":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts\/79255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/comments?post=79255"}],"version-history":[{"count":0,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts\/79255\/revisions"}],"wp:attachment":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/media?parent=79255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/categories?post=79255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/tags?post=79255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}