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

  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

  Explain relational database design and implementation

ISYS 224 Database Systems - Relational Database Design & Implementation

  Exhibiting all the primary keys and foreign keys

Draw the corresponding GRD, exhibiting all the primary keys and foreign keys. For simplicity, no other attributes nor multiplicity constraints are required.

  Database and programming design

Database and Programming Design

  Advantages of a database management to file processing

How will wireless information appliances and services affect the business use of the Internet and the Web? Explain.

  What do you understand by data analytics

Watch the 36-minute video on ‘Data Analytics at Facebook' at www.youtube.com/watch?v=D19.JiG-Ow9g or http://bit.ly/1Vk0r3K or tinyurl.com/facebook-data-analytics, What do you understand by data analytics

  Design and implement the best deal business database

Design and implement the Best Deal business database that you have modelled in the assignment-1 and a series of SQL queries to reflect the business logic of the Best Deal.

  Design considerations and calculation

Consider a database with objects X and Y and assume that there are two transactions T1 and T 2. Transaction T 1 reads objects X and Y and then writes object X. Transaction T 2 reads objects X and Y and then writes objects X and Y.

  Create the physical data model

Using anyRDBMS preferably (MySQL), create the physical data model for the logical data model provided in the attachment. This should include all of the data definition language SQL.This should be based upon the previous ERD created (see figure bel..

  Define database systems and data warehouses

Describe how that firms likely use or should use Management Information Systems, Information Systems and Information Technology as it relates to the various topics covered in the class.

  Define basic entity relationship diagram colleges

E-R diagram - Basic Entity Relationship Diagram Colleges and universities must draw a clear connection between the requirements of the field for which the student is being prepared and the things required of the student as part of that preparation pr..

  Describe two database features new to oracle database

This writing assignment calls for you to provide a substantive response 1400 words on the subject of managing databases. Describe two database features new to Oracle Database 12c that you've encountered so far in the class

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