Physical database design and sql queries

Assignment Help Database Management System
Reference no: EM131662201

Database Design and SQL Queries

In assignment 1, you have already started the process of designing a database for the Beauty Salon mini-case (enclosed again below), mainly in the phase of conceptual database design, and a draft ER diagram has been created for this purpose. Here you will further refine your database design for the other design phases.

2425_figure.jpg

In this assignment, you will in particular complete the logical design through the normalisation process, have it physically implemented, perform a few important queries in SQL, and evaluate or verify the database integrity. Your design of relational model should be done in such a way that business rules and data integrity are ensured by the intrinsic design of the database as much as possible.

Table Normalisation and Outer Joins

Mr X is planning on creating a database for his own beauty salon. However, his salon is much simpler. It's on the same venue and offers only itemised services (i.e. no timed services). Each booking a client makes simply books a particular therapist for several therapy items on a timeslot. Mr X had a look at our design on the top right in ERD and believes that his solution is even simpler and should be sufficient for his core business anyway. His database has just 1 table with the following attributes

bookingId    an ID unique for each booking
clientId an ID unique for each client
clientName  client name corresponding to the clientId
staffId an ID unique for each therapist
staffName staff/therapist name corresponding to the staffId
item therapy item
price price charged for the corresponding therapy item 
start start time for the booked timeslot
finish all booked treatments finish by this time

and his first few records are like (the attributes are in the order of those listed in the above table)

B1

C1

Clair

S1

Sandra

nail polishing 10

10:00 1/9/2015 11:00 1/9/2015

B1

C1

Clair

S1

Sandra

facial

20

10:00 1/9/2015 11:00 1/9/2015

B2

C2

Cathy

S1

Sandra

manicure

30

13:30 2/9/2015 14:30 2/9/2015

B3

C3

Camelia

S2

Sarah

nail polishing 10

14:00 2/9/2015 14:30 2/9/2015

Mr X can of course easily calculate the total cost for each booking from this database. Hence Mr X normally just sits back comfortably with a cup of coffee, looking over the bustling people passing by his salon, thinking why on earth does anyone ever need a database designer.

Normalisation:

1. Is this table already in 2NF and why? If not, normalise it to 2NF. Don't jump all the way to 3NF.

2. If any table created from the above normalisation to 2NF is not in 3NF, then normalise it into 3NF.

3. We note that the dependencies are implied by the business rules set out by the mini-case and our explanations at the top of this question.

Outer joins:

4. Complete the Additional Exercises β(b) and β(c) for Practical 11. Provide the SQL, and the screenshots of the results.

Logical Database Design

5. For the ER diagram you created in assignment 1, the artefact of the conceptual database design, map the ER model into the relational model according to how it was designed in the ER diagram. You may however first refine your ER diagram if necessary, and you are allowed to make use of any part of our above displayed ER diagram skeleton to incorporate into your design in any way you like if you feel your original design is not in a state to be implemented later. The actual assessment of this part is in the point 6 below. While there can be a variety of acceptable designs, we here attach one simplistic rough sketch for the comparison purpose.

6. For all the relations that arise from this ("first-cut") ER diagram, list all those (in schemas) that are already in 3NF. If there are some relations that are not in 3NF yet, list them as well.

7. Draw the global relation diagram for your final, revised, and normalised database design, and keep all the relevant details there. It should be in a similar form to Figure 17.9 (page 554 or 516 for edition 5) of the textbook, but all the attributes should be kept there too. Include in the diagram all the primary keys, foreign keys, and the multiplicity constraints. Identify and discuss the potential data redundancies or anomalies that may still exist in your design, if any.

Physical Database Design and SQL Queries

For the physical implementation of the database, students are allowed to implement the following simplifications in their table and data design.

Availability for the beauty therapists don't have to be considered. That is, you don't have to worry about whether a therapist works only on Mondays, or if she is going away for a whole month, or anything like these. Hence the therapists can be assumed to be available all the time other than those time slots already booked by someone.

ActivityVenue for all the beauty therapists can be assumed to be limited to the same beauty parlour alone. Hence the activity venue essentially doesn't have to be considered.

Every customer is assumed to have a client profile created or set up with the beauty parlour before any bookings can be made or any services can be provided to the customer.

Each Booking books exactly 1 therapist for a timeslot during which the therapist may perform either a timed service or an itemised service, or both.

For the timed service, the hourly rate is allowed to be fixed to exactly the same as twice the half- hour rate. Hence one rate will suffice.

8. Create the database tables in SQL (runnable on the School's Microsoft SQL Server) for all the relations in your relation diagram, and enforce there all the relevant constraints including primary keys and foreign keys. Fill the tables with sufficient data - generally around 3 tuples or more per table, but should be sufficient to illustrate meaningfully the working of the general queries to be completed below. List the content of your tables with screenshots. Screenshots of active windows (under Microsoft Windows) can be obtained by pressing CTRL-ALT-PRTSC keys together, see the example on the right. Your screenshots must contain your username as in the above example, and you may list several tables on a single screenshot.

9. Write in SQL the commands to complete the following queries, and show your results in screenshots.

(a) Write a drop table statement so that its execution will delete all the tables you have created for this assignment. No partial mark will be given for this part, if the statement doesn't do the complete job.

WARNING: Before you test this, you must first make sure that you have saved all the statements for the table creation and the record insertion etc in a separate SQL file saved outside the SQL Server. This is to ensure that after the drop table statement deletes everything, you can re-create everything by running your saved SQL script. If you are not sure, don't to this part.

(b) List all the client names and their corresponding telephone numbers.

(c) For all the beauty therapists who hold one or more qualifications, list the therapist names and their corresponding qualifications.

(d) For a given day, say, 2015-11-11, list all the names of the therapists who have/had at least one booking/appointment on that day. Don't repeat the names in the list.

(e) List all the itemed services along with the therapists who can provide such services. The list should be sorted alphabetically in the service names.

(f) List the names of all the clients along with the corresponding total number of bookings.

(g) Find the name of the therapists whose hourly rate for the timed service is the cheapest, along with their actual hourly rate.

10. List all the bookingNo, the corresponding client, and the total cost of all the services associated with the booking. The total cost must be recalculated from all the relevant itemed and timed services.

11. For your final designed database, find a scenario in which data integrity can not be ensured by your current primary keys and foreign keys, nor by adding directly more of such keys. Write a SQL statement that will determine if such a problem exists or not for any given state of the database.

12. A single plain-text file containing SQL statements for creating all the tables and making all the queries. The script should be executable on the School's Microsoft SQL Server, otherwise the corresponding marks in the above listed items will be deducted accordingly. Marks will be deducted in the corresponding questions if this SQL script in plain-text file is not submitted.

13. Each student must state explicitly who he or she once teamed up with if that person is not currently the group member for the submission, unless no shared work is involved. Students are not permitted to have shared work for this assignment with more than one person (the team member) including potential former team member, unless approved by the unit coordinator in writing.

Attachment:- case.rar

Reference no: EM131662201

Questions Cloud

Function in a healthcare services organization : Is it better to organize by service line or by function in a healthcare services organization?
Write the routine with the declaration : Write the routine with the declaration public static void permute( String str ); that prints all the permutations of the characters in the string str.
Create a small budget for a hypothetical state program : Create a small budget for a hypothetical state program based on priority health concerns from Healthy People 2020.
Revenue from donations-government grants : Obtaining sufficient funds to run programs can be a challenge for NPOs because revenue from donations, government grants, and foundation grants can vary.
Physical database design and sql queries : Draw the global relation diagram for your final, revised, and normalised database design - For the physical implementation of the database
Describe the process your research : Write a 3-4 page report (double-spaced) that describes your search process and compares and contrasts the three articles you identified.
Provide an example of a business or specific person : Provide an example of a business or specific person(s) that effectively use social media. What tools does the business or person use?
Issues in global leadership development : Some possible suggestions are identifying high potential employees, mobility, and supporting global coordination.
Describe a personal strategy for you to accomplish each goal : Excelsior College's Associate Degree in Nursing program, you will be required to transition from your current role to the Registered Nurse role

Reviews

inf1662201

12/29/2017 5:34:07 AM

Can you tell me exactly what part of the book you need and where it says you need the textbook. Here is the data and tables required for prac 11. Much obliged to you to the whole group of Expertsmind.Com. At whatever point I passed my necessities to the mentors, they have outperformed my desires in addition to they generally convey the last item route ahead of time of the due date.

inf1662201

10/13/2017 6:32:15 AM

Here is the reference. 25278753_1GRD-example-pg5541.jpg Can you tell me exactly what part of the book you need and where it says you need the textbook Practical 11 beta b and c Here is practical 11 25278761_1PRACTICAL 11.docx Here is the data and tables required for prac 11. 25278711_1prac8table.txt Data 25278793_1prac8Data.txt Data 25278785_1additionalRecords.txt

inf1662201

10/13/2017 5:57:50 AM

CREATE TABLE PrivateOwner ( ownerNo varchar(10) PRIMARY KEY, fName nvarchar(20), lName nvarchar(20), Address varchar(40), telNo varchar(15) ); CREATE TABLE PropertyForRent ( propertyNo varchar(10) PRIMARY KEY, street varchar(20), city varchar(20), postcode varchar(10), type varchar(10) not null, rooms numeric(2) default 4, rent numeric(5,2) default 0, ownerNo varchar(10) FOREIGN KEY REFERENCES PrivateOwner, staffNo varchar(10) FOREIGN KEY REFERENCES Staff, branchNo varchar(10) FOREIGN KEY REFERENCES Branch ); CREATE TABLE Client ( clientNo varchar(10) PRIMARY KEY, fName nvarchar(20), lName nvarchar(20), telNo varchar(15), prefType varchar(10), maxRent numeric(6,2), eMail varchar(40) ); CREATE TABLE Viewing ( clientNo varchar(10) constraint clientNo_fk FOREIGN KEY(clientNo) REFERENCES Client, propertyNo varchar(10) FOREIGN KEY REFERENCES PropertyForRent, viewDate datetime, comment varchar(100), constraint viewing_pk PRIMARY KEY(clientNo,propertyNo) );

inf1662201

10/13/2017 5:57:25 AM

What time on the 29th can you finish it by? Here is the previous assignment that Assignment 2 references. 25278792_1Database Assignment One.docx Here is the Assignment 1 questions for reference 5278757_1assignment1 1.pdf /* drop table viewing, propertyforrent, privateowner; drop table client, staff, branch; */ /* DreamHome tables: see schemas at page 197 or 189 for edition 5 */ /* page 189 (edition 5): different ways of creating tables are used for a variety */ CREATE TABLE Branch ( branchNo varchar(10) PRIMARY KEY, street varchar(20), city varchar(20), postcode varchar(10) ); CREATE TABLE Staff ( staffNo varchar(10) PRIMARY KEY, fName nvarchar(20), lName nvarchar(20), position varchar(15), sex char(1), DOB datetime, salary numeric(8,2), branchNo varchar(10) FOREIGN KEY REFERENCES Branch );

len1662201

9/28/2017 3:55:58 AM

Please note that if your SQL source code gets rejected by the SQL Server at the School, you automatically lose 50% of the marks allocated to that coding part. Each group must submit exactly one copy of their assignment solution electronically by one of the team members. If the other group member really wants to submit it as well due to whatever reasons, then the name of the submitted files must start with "please_ignore_" (such files will not be treated as regular submissions and will be ignored during the marking). Otherwise 1 mark may be deducted for the duplicated electronic submission. Each submission must be accompanied by a declaration of the ownership of the submitted work as described in the unit outline and learning guide. No signature is however required for the electronic submissions. Please note that an examiner or lecturer/tutor has the right not to mark this assignment if a pertinent declaration is not present in your submission.

len1662201

9/28/2017 3:55:50 AM

This assignment must be submitted electronically via vUWS before the due date. No email submissions will be accepted. It is the students' responsibility to retrieve and keep all their submission receipts. If in doubt, consult your tutors well before the submission due date. Submitted files may be zipped together as a single zip file (but not as a zipx or rar file), if a student wishes to do so. However, no other file compression or file archiving formats will be accepted for the submission. The electronic submission should contain the paper work in Microsoft Word, and the pertinent SQL source code (say, named BS.sql) should be in a separate file and should be in the plain text format. Otherwise 1 mark may be deducted for the missing separate SQL source file even if the code is already contained in the main Word document.

len1662201

9/28/2017 3:55:32 AM

By default, each student is working in a group containing a single member of himself. Students may however make use of the student communication board to advertise their availability in seeking an assignment partnership. In the rare case of one group member becoming seriously ill or uncontactable or not responding, the other member should consider forming a different group or working on his or her own for the assignment. As in real life, everyone should have a contingency plan, or Plan B. Students enrolled in 300941 - Database Design and Development (Advanced) must also complete the advanced part by the same due date.

len1662201

9/28/2017 3:55:21 AM

would like to know when is the earliest this can be done - This assignment needs to be completed in a group of no more than 2 student members. If such a group is formed, both members must come from the same campus, and also within the tutorial classes of the same tutor whenever possible. While lecturers and tutors will help as much as they can, it is essentially each student's own motivation and responsibility to form a group for this assignment

Write a Review

Database Management System Questions & Answers

  Define security threats as it relate to the operating system

Discuss security threats as it relate to the Operating Systems and Memory Management. Consider a fixed partitioning scheme with equal-size partitions of 2 16 bytes and a total main memory size of 2^24 bytes. A process table is maintained that inc..

  Create a pl-sql procedure to print out the reservation

Write a PL/SQL function that given a reservation ID, returns the name of guest who made that reservation. If there is no such reservation in the database, return null. Please call this function with input reservation ID 1, and print out the return..

  Write a one page report on how you could improve the product

Use the attached database and associated sheets to review and to make sure the forms are working. Review your project; make sure that all the forms are working. Write a one page report on how you could improve the product.

  Discuss optimization techniques specific to data warehousing

Demonstrate the basic mechanisms for accessing relational databases from various types of application development environments.

  Create a new database and name it orders

Purpose of this hands-on computer exercise is to have you learn how to use Microsoft Access to: create a database table, enter data into the table, create a report based on the data, and print the table and the report.

  Compare two non-sequential file structure models

Compare the two non-sequential file structure models. What advantages does the first one have over the second and what advantages does the second have over the first?

  Grouping of clients for reporting purposes

Sectors are the broad categories that allow grouping of clients for reporting purposes. Examples include retail, construction, financial services, hospitality and manufacturing.

  Installing and configuring integration services

Steps you through the process of installing SQL Server Analysis Services in a named instance. The instance will be named ASvc and will include Integration Services and management components, including BIDS.

  Different ways of implementing one-to-one relationships

Describe the different ways of implementing one-to-one relationships. Assume you are maintaining information on offices and faculty.

  What functionality does their proposed clause provide

In the Zhang & Huang (2007) article, the authors propose introducing a CLUSTER BY clause into SQL. What functionality does their proposed clause provide

  Ensure the security of organizations distributed database

How can you make your database more hacker proof? How do you ensure the security of an organizations distributed database?

  To find the balance in account number x

The Account table has information about the balance and the account holder and where he is having a account(which branch).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd