Project description
A basic database is in place. Look at the business rules and test them with some SQL. Look at the previous business rules developed and design some SQL queries to test
them. Set up a test plan. List the rule, the SQL that was written, and the results. The business rules are: Tenants arrange maintenance requests online and tenants can
pay rent online. Attached is an example of what the results should look like.
USE [Master]
GO
CREATE DATABASE [LEASE] ON PRIMARY
(NAME = N’Lease’, FILENAME = N’FSASQLDBlease.mdf’,
SIZE = 4GB, MAXSIZE = 10GB, FILEGROWTH = 2GB)
LOG ON
(NAME = N’Lease_log’, FILENAME = N’FSASQLDBlease_log.ldf’,
SIZE = 2GB, MAXSIZE = 3GB, FILEGROWTH = 10%)
GO
CREATE TABLE dbo.Tenant Lease Agreement (
TenantLeaseKey CHAR(10), Primary Key,
LeaseStartDate DATE, Not Null,
LeaseEnIDate DATE, Not Null,
Deposit DECIMAL(15, 2),
RentAmount DECIMAL(15, 2),
LateFees DECIMAL(15, 2),
ApartmentKey CHAR(15), Foreign Key,
TenantKey CHAR(20), Foreign Key,
);
CREATE TABLE dbo. Building(
BuildingKey CHAR(10), Primary Key,
BuildingName CHAR(30), Not Null
BuldingAIDress CHAR(30), Not Null
);
CREATE TABLE dbo. Manager(
ManagerKey CHAR(10),Primary Key
ManagerLastName CHAR(50), Not Null
ManagerFirstName CHAR(50), Not Null
BuildingKey CHAR(10), Foreign Key
);
CREATE TABLE dbo.Tenant(
TenantKey CHAR(20), Primary Key
TenantLastName CHAR(50),
TenantFirstName CHAR(50),
TenantEmail_AIDress CHAR(30),
TenantPhoneNumber NUMERIC (20),
);
CREATE TABLE dbo.Rent Revenue(
RentRevenueKey CHAR10), Primary Key
RentAmount DECIMAL(15, 2),
RentDueDate DATE,
LateFeeAmount DECIMAL (15, 2),
TenantLeaseKey CHAR(30), Foreign Key
);
CREATE TABLE dbo. Apartment Maintenance(
ApartmentMaintenanceKey CHAR(10), Primary Key
RequestDate DATE,
MaintenanceType CHAR(30),
Resolution CHAR(30),
Resolution Date DATE,
ApartmentKey CHAR(30), Foreign Key
);
CREATE TABLE dbo. Expense Type(
ExpenseTypeKey CHAR(30), Primary Key
Repair CHAR(50),
Maintenance CHAR(50),
Utilities CHAR(50),
Apartment Cleaning CHAR(50),
Insurance CHAR(50),
);
CREATE TABLE dbo. Expenses(
ExpenseCostKey CHAR(30), Primary Key
CostAmount DECIMAL(15, 2),
ApartmentMaintenanceKey CHAR(30), Foreign Key
ExpenseTypeKey CHAR(30), Foreign Key
);
ITC 4150, Database Design and Implementation
Unit VII Westlake Research Hospital
Sample Answers to Scenario Questions
1. Two or three simple SELECTs with various WHERE criteria Rule to Test List all the patients of a given doctor List all the PatientKeys of patients whose depression
level is severe Means of Testing
SELECT * FROM Patient WHERE DoctorKey=’j303² SELECT PatientKey FROM PatientMedicalHistory WHERE DepressionLevel=’Severe’
Expected Result 4 records 3 records
Result 4 3
2. Two or three queries using aggregate functions Rule to Test Count the number of patients in each drug group Count the number of patients per doctor Means of Testing
SELECT DrugKey, COUNT(PatientKey) FROM PatientGroup GROUP BY DrugKey SELECT DoctorKey, COUNT(PatientKey) FROM Patient GROUP BY DoctorKey
Expected Result 7 in group 12, 6 in group 2 2 or 3 per doctor
Result Success
Success
3. At least two queries that use joins Rule to Test Get the names of all patients that have diabetes Means of Testing
SELECT PatientLastName, Diabetes FROM Patient p INNER JOIN PatientMedicalHistory pmh ON p.PatientKey=pmh.PatientKey WHERE Diabetes = 1 SELECT PatientLastName,
AppointmentDate, BloodPressure, Pulse, DepressionStatus FROM Patient p INNER JOIN Appointment a ON p.PatientKey=a.PatientKey INNER JOIN AppointmentDetail
Expected Result 2
Result 2
Get patient name, appointment date, blood pressure , pulse and depression status for a particular patient
Johnson, 10/12/2010,110/70,7 7,Same
Success
ad ON a.AppointmentKey=ad.Appointme ntKey WHERE p.PatientKey=’JL200²
4. Two or three INSERT statements Rule to Test AID a new appointment and appointment details Means of Testing
INSERT INTO Appointment(AppointmentKey, AppointmentDate, AppointmentTime,PatientKey, DoctorKey) VALUES(‘10101²,’10/23/2010²,’ 2:30 PM’, JL200²,’PD33²) INSERT INTO
AppointmentDetail(Appointment DetailKey, AppointmentKey, Bloodpressure, Pulse, PatientWeight, DepressionLevel, DoctorsNotes) VALUES(‘22020²,’10101²,’114/7
5²,77,187,’Moderate’,’the patient seems to be making some progess’)
Expected Result Two new records
Result success
5. One or two UPDATEs and/or a DELETE Rule to Test Change a patient’s doctor Change a patient’s phone number Means of Testing
UPDATE Patient SET DoctorKey=’jj01² WHERE PatientKey=’JL200² UPDATE Patient SET PatientPhone=’2065551245² WHERE PatientKey=’JL200²
Expected Result 1 record changed 1 record changed
Result 1 record changed 1 record changed
General Guidelines for this Assignment
The queries should be a part of a testing scenario. Each query should validate that the database fulfills a requirement or business rule. The testing, however, is not
expected to be complete or comprehensive in any way. The following rubric for this unit assignment should also guide you on the level of detail and the content
expected. Contact your instructor if you have questions.
Poor Incomplete or malformed SQL. Queries don’t aIDress requirements or business rules. No testing format
OK Uses testing format. Queries mostly correct. Queries mostly aIDress requirements and business rules
Good Uses testing format. All queries well-formed and directed at requirements and business rules
Why Work with Us
Top Quality and Well-Researched Papers
We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.
Professional and Experienced Academic Writers
We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.
Free Unlimited Revisions
If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.
Prompt Delivery and 100% Money-Back-Guarantee
All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.
Original & Confidential
We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.
24/7 Customer Support
Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
Our Services
No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.
Essays
No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.
Admissions
Admission Essays & Business Writing Help
An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.
Reviews
Editing Support
Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.
Reviews
Revision Support
If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.