Implement the query find total number of orders submitted

Assignment Help Database Management System
Reference no: EM13886080

Task

Indexing

A user CSCI315 used the following CREATE TABLE statements to create a sample database.

CREATE TABLE ORDERS(
O_ID NUMERIC(10) NOT NULL, /* Unique ID of order */
O_C_ID NUMERIC(10) NOT NULL, /* Customer ID */
O_DATE TIMESTAMP NOT NULL, /* Order date an time */
O_TOTAL NUMERIC(15,2) NOT NULL, /* Total for this order */
CONSTRAINT ORDERS_PKEY PRIMARY KEY (O_ID) );

CREATE TABLE ORDER_LINE(
OL_O_ID NUMERIC(10) NOT NULL, /* Order ID */
OL_ITEM NUMERIC(10) NOT NULL, /* Item name */
OL_QTY NUMERIC(3) NOT NULL, /* Quantity of item */
CONSTRAINT ORDER_LINE_PKEY PRIMARY KEY (OL_O_ID, OL_ITEM),
CONSTRAINT ORDER_LINE_FKEY2 FOREIGN KEY (OL_O_ID)
REFERENCES ORDERS(O_ID) );

(1) Write SELECT statements that implement the following queries.

(i) Find the total number of orders submitted in 2015.

(ii) List all distinct customer IDs (O_C_ID) who submitted the largest number of orders in 2014.

(iii) Find the total number if orders submitted by each customer.

(iv) Find the distinct names of items (OL_ITEM) included in at least one order.

(v) Find the total number of values in a column OL_ITEM.

(vi) Find a name of item ordered with the largest quantity.

(vii) Find the total number of rows in a relational table ORDERS.

(viii) Find the total (O_TOTAL) of all orders in each year.

(2) Write smallest number of CREATE INDEX statement such that each one of the queries listed above is processed through "index-only" computations. It means the indexes must be created in such a way such that there is no need to access the relational tables listed above to find the results of queries and the indexes must be "shared" by the possibly largest number of queries.

Reference no: EM13886080

Questions Cloud

Details of balances or analytical procedures : The following are common tests of details of balances or analytical procedures for the audit of accounts receivable:
Define quality in terms of what it means for a product : Define quality in terms of what it means for a product to have high quality.
Analyze the three internal governance mechanisms : Analyze the three internal governance mechanisms (ownership concentration, boards of directors, and executive compensation) and recommend a possible fourth mechanism that would help align the interests of managerial agents with those of the firm's ow..
Estimate the drag on the tree : A blue spruce pine tree has the shape of a triangle which is 15 cm off the ground. The triangle has a maximum diameter of 6 m and is 10 m tall. Estimate the drag on the tree if it is exposed to a 25 m=s wind. Use CD ¼ 0.4 in your calculations.
Implement the query find total number of orders submitted : Find the total number of orders submitted in 2015. List all distinct customer IDs (O_C_ID) who submitted the largest number of orders in 2014. Find the total number if orders submitted by each customer.
How a company looks at a failed goal is critical as well : Miscommunication between different departments, management and employees can make it difficult to reach. How a company looks at a failed goal is critical as well. So the question is, what happens if the goal is not met
How fast will the rider travel : A bike rider expends a certain amount of energy to travel 12 m=s while in the upright position. How fast will the rider travel with the same amount of energy expenditure if the bent over position is elected? Assume the rider's projected area is re..
How is pluralism different from relativism? : How is Pluralism Different from Relativism?
Tim is currently planning tests of details : 1.Tim Flynn is the engagement manager for the audit of ODonnell Enterprises.

Reviews

Write a Review

Database Management System Questions & Answers

  Brief description of the server environment

A brief description of the organization. A brief description of the server environment (how many servers, disk sizes, networks, OS types). A description of the current database software being utilized by the organization

  Discuss three different ways to create an oracle database

Discuss three different ways to create an Oracle Database. What are the advantages/disadvantages of each method. What is the difference between control files and redo logs. What is a datafile. What is a tablespace

  Explain the purpose database design process

Explain why functional dependency is important in relational design. Database Design: Why go through the database design process? What are important issues during the design phase that impact the success of the database?

  Convert excel files into an access database

The Morris Arboretum tracks donors to their organization in Microsoft Excel. Access for future Arboretum records. In the following project, you convert Excel files into an Access database for Morris Arboretum

  Explain multidimensional analysis

Give at least three reasons why ETL functions are most challenging in a data warehouse environment.

  Entity-relationship modelling techniques

Give you practical experience in using Entity-Relationship and Relational Database modelling techniques.

  What is required to define a well-posed learning problem

Write an algorithm called \Find-G" to nd a maximally-general consistent hypothesis. You can assume the data will be noise-free and that the target concept is in the hypothesis space.

  Determine airports with late flights to toronto-database

Determine airports with late flights to Toronto on a big plane. "Late" means departing after 9:00pm; "big" means with capacity 150 passengers or more

  How much overhead cost would be assigned to product

How much overhead cost would be assigned to Product S96U using the company's activity-based costing system?

  Executing well-planned strategy-manage technology solution

You have a company, specializing in managing technology solutions. you have ben just hired by big firm to execute a well-planned strategy.

  Design and develop a database using professional principles

Your database project must meet the following assessment requirements: Design and develop a database using professional principles and standards.

  Explain planning proactive concurrency control methods

Evaluate which method would be efficient for planning proactive concurrency control methods and lock granularities. Assess how your selected method can be used to minimize the database security risks that may occur within a multiuser environment.

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