21. A pizza shop manages its customer orders in a database with three tables called Customers,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
21. A pizza shop manages its customer orders in a database with three tables called Customers, Customer Order and Suburbs which have the following schemas: Customers (id INT, name VARCHAR (32)) Suburbs (code CHAR(4), name VARCHAR(32)) Customer Order (cid INT, pickup_code CHAR(4), cost double, order date DATETIME NOT NULL DEFAULT (GETDATE()) The field Customers. id represents a customer number, the field Suburbs.code represents a suburb's area code (such as 6009 for Nedlands), and these two fields are keys for their tables respectively. The fields cid and pickup_code in Customer Order are foreign keys to Customers. id and Suburbs.code. Assume every suburb only has one such pizza store and the table Suburbs has the full data, i.e., all records like (6009, Nedlands) existed in the tables. (a) Consider a new customer named John Smith ordered a few pizza with $30 and wanted to pick up from a suburb 6009. Write two SQL statements with the correct sequence that will add the customer and his order into the database, giving him the customer number 1000. [3 marks] (b) Write a SQL statement that will list each suburb's name and the total amount of sales the pizza shop did on the suburb. The list should be sorted in descending order using DESC 21. A pizza shop manages its customer orders in a database with three tables called Customers, Customer Order and Suburbs which have the following schemas: Customers (id INT, name VARCHAR (32)) Suburbs (code CHAR(4), name VARCHAR(32)) Customer Order (cid INT, pickup_code CHAR(4), cost double, order date DATETIME NOT NULL DEFAULT (GETDATE()) The field Customers. id represents a customer number, the field Suburbs.code represents a suburb's area code (such as 6009 for Nedlands), and these two fields are keys for their tables respectively. The fields cid and pickup_code in Customer Order are foreign keys to Customers. id and Suburbs.code. Assume every suburb only has one such pizza store and the table Suburbs has the full data, i.e., all records like (6009, Nedlands) existed in the tables. (a) Consider a new customer named John Smith ordered a few pizza with $30 and wanted to pick up from a suburb 6009. Write two SQL statements with the correct sequence that will add the customer and his order into the database, giving him the customer number 1000. [3 marks] (b) Write a SQL statement that will list each suburb's name and the total amount of sales the pizza shop did on the suburb. The list should be sorted in descending order using DESC
Expert Answer:
Related Book For
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
You are the manager of an organization in America that distributes blood to hospitals in all 50 states and the District of Columbia. Arecent report indicates that nearly 50 Americans contract HIV...
-
The December 31, 2013, balance sheet of Schism, Inc., showed long-term debt of $1,280,000, and the December 31, 2014, balance sheet showed long-term debt of $1,410,000. The 2014 income statement...
-
The article "Effects of Bottle Closure Type on Consumer Perception of Wine Quality" (Amer. J. of Enology and Viticulture, 2007: 182-191) reported that in a sample of 106 wine consumers, 22 (20.8%)...
-
Give two examples of each of the following, with appropriate justification of products or services that tend to utilise: (a) a straight commission remuneration system; (b) a straight salary...
-
Prepare a written report to the CEO of Mt. Sinai Hospital in Problem 8-18 on the expansion of the hospital. Round off your answers to the nearest integer. The format of presentation of results is...
-
Refer to the information below for CakePops Inc. a. Calculate the profit or loss for 2023. b. What caused common shares to change during 2023? Show your calculations. c. What caused the change in...
-
The Shop at Home Network sells various household goods during live television broadcasts. The company owns several warehouses to hold many of the goods it sells, but also leases extra warehouse space...
-
Identify what ethics looks like in the context of your personal leadership as a Walden student, specifically as it relates to the five guiding principles. Provide a detailed response to each of the...
-
What can I say back to reply to my peer to add to the conversation? I think in terms of a financial services department, a patient services revenues would be a better cost driver. This is because the...
-
Q.8 Following are the summarized statements of financial position of Aluminium Limited (AL) and Silver Limited (SL) as at 31 December 2022: AL SL Rs. in million Property, plant and equipment 1,160...
-
31-Dic Fee Earned Revenue 835,000.00 Income Summary 835,000.00 clsificar enLedger Assets Liabilities Equity Revenues Expenses 31-Dic Income Summary 693,000.00 Salaries Expense 620,000.00 Rent Expense...
-
what can I say back to reply to my peer to add to the conversation? Fixed cost refers to the cost of using fixed inputs, which remains constant regardless of the quantity of output produced.(Reiter...
-
The journal entry to record a business asset that was sold in QuickBooks 1. Land 1 million dollars 2. Building 200,000.00 3. Accumulated Depreciation 42,000 4. Selling Expenses 92,000 5. Gain on sale...
-
A digitized voice channel is made by digitizing a 4-kHz bandwidth analog voice signal. We need to sample the signal at twice the highest frequency (two samples per hertz). We assume that each sample...
-
You have just begun your summer internship at Omni Instruments. The company supplies sterilized surgical instruments for physicians. To expand sales, Omni is considering paying a commission to its...
-
How do you save the results of an SQL query as a table?
-
Describe the purpose of the PROJECT command in relational algebra.
-
What is an un-normalized relation? Is it a relation according to the definition of the word relation?
-
The upper curve in the boiling point diagram is called (a) The saturated vapour curve (b) The dew point curve (c) The saturated liquid curve (d) Both (a) and (b).
-
A vertical cylinder containing helium gas is filled with a piston of \(50 \mathrm{~kg}\) mass and crosssectional area of \(0.025 \mathrm{~m}^{2}\). If the atmospheric pressure outside the cylinder is...
-
The Joule-Thomson coefficient for any gas at inversion point is (a) 1 (b) 0 (c) 2 (d) 3
Study smarter with the SolutionInn App