Development of oracle database and queries

Assignment Help Database Management System
Reference no: EM131494490

Objectives
- To understand physical database design as a critical element in achieving overall database objectives.
- To have a sound understanding of the use of indexes and the trade-offs that must be considered in their use.
- To understand the concepts of database query optimization.
- To tune database queries using Oracle facilities such as hint and autotrace for better performance

The assignment will be assessed as two parts:

1. Development of Oracle Database and queries
- Implementation of the SQL scripts - part one
Do the database tables have appropriate data & data type?
- Queries Design and Structure
Do the SQL queries conform to the specifications?
Do the SQL queries answer the questions correctly and in a well-designed manner?
Do the queries get an optimized execution plan?
Note: You will demonstrate your program during your lab class in Week 11-12.

2. Database tuning analysis
- The executions of spool files
Provide the spool files including all queries and the execution plans to demonstrate your execution of queries.

- Documentation of Analysis & comparison

5. The Database Description

Chemist Warehouse Group

Chemist Warehouse is the Australia's largest pharmacy retailer. It has over 1000 retail stores nationally and been growing at a rapid rate. Chemist Warehouse Groupemploys over 20,000 staff members including certified pharmacists and front selling clerks. Each store sells over 65,000 productsof healthy related products coming from different suppliers. The products are managed by related departments such as Vitamins; Beauty; Fragrances; Baby Care; Dental; Household; Hair Care; Protein etc.The prescribed medicines must be prepared by registered pharmacists.

Chemist Warehouse Group has got a distributed database systems to manage the operational business within the company. The database records all products, inventory, stores, suppliers, employees and sales information. To help the organization drives sales, marketing, loyalty, and service effectiveness, they also award customers with a VIP program. To ensure high customer numbers, management needs to carefully consider its pricing and VIP discounts. The VIP can be classified into 5 levels: 1: 2% discount for blue member; 2: 4% discount for silver member; 3: 6% discount for gold member; 4: 8% discount for diamond member; 5: 10% discount for platinum member.

The following tables are the partial Database schemaof Chemist Warehouse group.

1521_Figure.jpg

6. The Assignment Description

Phase 2: Tuning queryfor efficient database queries

You answer the following queries. You are studying the impact of different queries. You need to write two or more queries for each question in order to find a better solution. You can use the following different techniques to tune your queries.
- Check the exaction plan to see the impact of different queries you have done. You may have used unnecessary distinct, unnecessary nested sub-queries and unnecessary join or set operators.
- Check if you should define appropriate indexes (bitmap, secondary indexes or a function based indexetc).
- When you are tuning queries, you mayuse Hints. The hints may be used after you have collected statistics on the relevant tables and evaluated the optimizer plan. Monitoring query performance enhancements to see whether any significant impact on queries by hints.
- You need to spool each query execution for the EXPLAIN PLAN of both original queries and optimized/modified queries (if there are any) to learn how the optimizer is executing a query.You understand the optimizer decisions and analyse the EXPLAINPLANand AUTOTRACE results by looking into the execution plans of one query question.
Notice: EXPLAIN PLAN is to get a planbefore the query execution.AUTOTRACEis for actual execution of query
Queries:
1. Find the total sold price for the most expensive Fragrance (category name,the highest unit price) between 01/03/2015 to 31/03/2017 at stores in suburb Bundoora. Write two different queries and find the best performance query.
(Notice: first part of the query is to get the max Product_UnitPriceof Category Fragrance; then write a subquery to get a list of the product_ids whose unit prices are the same as the max Product_UnitPrice at thestoreBundoora.
Hint: Use date function to tell your date format TO_DATE('31/03/2017', 'DD/MM/yyyy'. Using function upper(..) for string comparison)
2. Retrieve the names of Employees who have the same E_level values as Jorge Peres and also are living at the same suburb as Jorge Peres. Write two different queries with nested queries. (hint: you can get the "Jorge Peres-level table" in your FROM clause of SQL query.)
Eg.,
SELECT E.E_fname, E.E_lname
FROM Employ E
(SELCT J.E_level
FROM employ J
WHERE UPPER(J.E_lname) = 'PERES'
AND UPPER(J.E_fname) = 'JORGE') Jlevel, /Jlevel is a table/

WHERE E.E_level = Jlevel.E_level
AND UPPER(E.E_lname) != 'PERES'
AND UPPER(E.E_fname) != 'JORGE';
3. Find the list of stores in Melbourne where those stores' total salesare greater thanthose stores with the lowest total salesin the database. Write two different queries: one has a better performance. (Hint: get the lowest total sales for the store among all stores, then rest stores should be in the list for the answer. Few ways to do it)
An example for a nested subquery in FROM clause:
SELECT Store_IDMIN(ST.sum_column1)
FROM (SELECT store_ID, SUM(sale_price) AS sum_column1
FROM Sale_transct GROUP BY store_ID) ST
)
WHERE ...;
4. Find Melbourne VIP level 4customers' first name, last name who have bought the product named as"Vitamin D " at least 2 times in database. You writethreedifferent queries: one is using operator EXISTS and the other one is using operator IN. The third query with the main filter criteria in FROM clause of the main query. Find one with the better performance.
5. Display the names of products that bought by Female VIPs who are in level 3, level 4, and level 5 (not level 1 or 2) and a list of all products supplied by supplier's postcode 3083. Write two queries.


In phase two, you should have the following files in your submission:
- SQL query scripts file - can be in one YourName-SQL.sql file
- Spool files for executions of queries with their execution plans from SQL*Plus - you can concatenate all spool files into one file for submission.
- The table of your comparisons on database query execution plans and your analysis with your conclusions.

Verified Expert

The solution file is prepared in oracle which is created for chemist dataware house. All queries has been created as per requirements given. Here i have attached .sql file and note pad for your references.

Reference no: EM131494490

Questions Cloud

Is jarvis correct : Hynes rented a house from Jarvis under a two-year lease. The lease stated that it could be assigned only with the consent of the landlord.
Write an overview of what the article was about : Write an overview of what the article was about, what did you like about it, what didn't you like, what did you find interesting, etc.
Will bowen succeed if she sues the landlord for her injuries : Corwin rented an apartment on a monthto-month basis commencing March 1. On July 1, Corwin's landlord sent a letter to Corwin stating that the lease.
Can sam get out of his lease because of his parking spaces : Faber and Smith signed a three-year lease for an apartment. The lease was silent as to the amount of the rent but stated "rent to be determined by mutual.
Development of oracle database and queries : CSE3DMS Assignment 2017 - To understand physical database design as a critical element in achieving overall database objectives.
Differentiate between a tenant for years and periodic tenant : Describe the important covenants that should be included in every lease.
How economy coordinates societys independent economic actors : How the economy coordinates society's independent economic actors. A country's gross domestic product (GDP) and how it is defined and calculated.
Standard development organizations : Select one of the organization's websites and identify at least 3-4 facts about this organization and explain what it does.
Review the case study of ferguson : Ferguson rented an apartment from Bill. A few months later, the city government, because of a water shortage, ordered that water be provided to homes.

Reviews

inf1494490

6/6/2017 5:58:33 AM

I'm writing to inform you about the details of the assignment, it's required to have comments on every query, explaining how it actually works, the marking criteria is specified in the paper. for the Phase 2 of my assignment which is supposed to be done. please contact me as soon as possible. Sorry I have gone through all mails ... second phase of the queries also in .sql file . I was making some mistake to import .sql file into the system. Sorry everything is clear now. great job guys... thanks a lot.

Write a Review

Database Management System Questions & Answers

  Create a bar chart to illustrate annual visitors at memorial

In particular, you are interested in Washington DC, Philadelphia, and Boston. You will format a list of memorials in DC, add Sparklines to compare the number of visitors over a 15-year period, and create a bar chart to illustrate annual visitors a..

  Explain how the data breach could have been prevented

Analyze how the data breach could have been prevented with better adherence to and compliance with regulatory requirements and guidelines, including management controls; include an explanation of the regulatory requirement.

  What is a data model and what is it purpose

What is a data model and what is it purpose and what is a prototype and what is its purpose - What is a use case, and what is its purpose?

  Develop preliminary database tables for huffman trucking log

Use Microsoft Access to develop preliminary (no keys and no relationships) database tables for Huffman Trucking Driver Log.

  Access values through queries to databases

However, the only way you can access values is through queries to the databases. In single query, you can specify value k to one of two databases.

  Differences between data integrity and data consistency

Compare and contrast the differences between data integrity and data consistency and provide example for each one.

  Advantages and disadvantages of a database system

Describe the major advantages and disadvantages of a database system approach to managing data

  Write a query that displays the order id and order date

Write a query that displays the order id and order date for any orders placed during the month of May, 2014. Do this using the BETWEEN clause. Format the date field as mm/dd/yy and use a heading of "Ordered".

  Diagram and determine the possible iterative steps

Determine the steps in the development of an effective Entity Relationship Model (ERM) Diagram and determine the possible iterative steps / factors that one must consider in this process with consideration of the HR core functions and responsibili..

  Case study- database development

1. Recommend at least three (3) specific tasks that could be performed to improve the quality of datasets, using the Software Development Life Cycle (SDLC) methodology. Include a thorough description of each activity per each phase

  What are functional dependencies

Multi-level index is guaranteed to have the search cost proportional to the number of levels inmulti-level index.

  Design a relational database so that it is at least in 3nf

Explain the fundamentals of how data is physically stored and accessed.Compose conceptual data modeling techniques that capture information requirements.

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