Purchase Solution

Error Identification and Correction In SQL Statements

Not what you're looking for?

Ask Custom Question

The other objective is to create a table called balance that includes the customer ID, last name, first name, and the customer's total balance (the sum of price for all orders). Study the tables below: customer and order

CUSTOMER
CUSTOMER_ID LAST FIRST STREET CITY STATE ZIP
----------- ------- ------- --------- ------- ----- ------
124 Martin Dan 418 Pine Grant MI 49219
1552 Adams Joan 3435 Elm Harper TN 39805
... ... ... ... ... ... ...
ORDER
ORDER_NUM CUSTOMER_ID ORDER_DATE PRICE
--------- ----------- ---------- -------
10024 5642 12/8/1999 501.89
10025 124 30/9/1999 215.95
10026 4542 11/1/2000 570.25
10027 124 12/2/2000 420.60
... ... ... ...

The result should be a table that looks like this:
BALANCE
CUSTOMER_ID LAST FIRST TOTAL_BALANCE
----------- ------- ------- -------------
1552 Adams Joan 845.56
5642 Collins Chip 760.01
4542 Ira Sally 570.25
... ... ... ...

Unfortunately, there are several mistakes. Tom wants your team to find the mistakes. Begin by examining the following text in the SQL*Plus window:
The following SQL commands have errors and are not yielding the correct result. Modify the following code to get the desired table above.

SQL>CREATE TABLE balance
2(customer_id NUMBER(7), last CHAR(10), first CHAR(10), total_balance CHAR(7));

SQL>INSERT INTO balance
2 SELECT customer.customer_id, customer.last, customer.first, sum(customer.price)
3 FROM customer, orders
4 WHERE customer.customer_id = order.customer_id

ALL I NEED HELP WITH IS THE CODE

Purchase this Solution

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.