Computer Science Homework Solutions
Problem
#59535

corrections to code.

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

Solution
What is this?
By OTA - Overall OTA Rating
Nitu Singal, MBA - 4.8/5
Purchase Cost Now
$2.19 CAD (was ~$39.90)
Included in Download
  • Plain text response
  • Attached file(s):
    • SQL.zip
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Database Normalization - Consider a typical sales invoice that would include the following information. Design a single table to hold all of the information required to store an invoice including this information. Next, apply ...
  • Data Model - Draft a simple data model that outlines a database management system. This model needs to track people's participation in various fitness activities at a fitness center. List at least 3 entities and ...
  • Intro to Database - Please help with review questions ... 1. List the entities shown 2. What is the primary key for each entity? 3. Are there any multivalued attributes shown? If so, discuss how it/they should be ha ...
  • SQL problem in attach doc - MS SQL SERVER 2003 Problem 1 Write SQL queries 1. Write a SQL query that joins Customer and Store table in the Kudler database and uses BETWEEN to restrict record selection (use Store Name to res ...
  • DataBase design Using VB.NET and Ms Access - RENT-A-MOVIE DATABASE PROJECT I want to design a relational database to store information about my store (video rental store) customers and videotapes. I think the database will improve my abili ...
Browse