Solved

SQL Query HELP!!

Posted on 1998-12-02
4
527 Views
Last Modified: 2008-03-06
Based off of the following:

CUSTOMER (CUST_ID(PRI-KEY), CUST_NAME,ANNUAL_REVENUE, CUST_TYPE)
SHIPMENT (SHIPMENT_#(PRI-KEY), CUST_ID(PRI-KEY),WEIGHT, TRUCK_#, DESTINATION, SHIP_DATE)
TRUCK (TRUCK_#(PRI-KEY), DRIVER_NAME)
CITY (CITY_NAME(PRI-KEY), POPULATION)

What would the SQL Queries be - based on the following questions??

What is the name of customer 433?

What is the destination city of shipment #3244?

NOT EXISTS:
List customers who have had shipments delivered by every truck.

Built-in Functions:
What is the average weight of a shipment?

What is the average weight of a shipment going to Atlanta?

GROUP BY and HAVING:
For each customer, what is the average weight of a package
(shipment) sent by that customer?

0
Comment
Question by:mapper
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
rsellis earned 200 total points
ID: 1969959
I believe the following will work for you:
Select Cust_Name from Customer where Cust_ID = 433;
Select Destination from Shipment where Shipment_# = 3244;
Select CustID where Count(Distinct(Truck_#)) in
      (Select Count(Truck_#) from Truck)
Group by CustID;
Select Shipment_#, Avg(Weight) from Shipment;
Select Shipment_#, Avg(Weight) from Shipment Where Destination = 'Atlanta';
Select C.Cust_ID, avg(S.Weight) from Customer C, Shipment S
     Where C.Cust_ID = S.Cust_ID;

0
 

Author Comment

by:mapper
ID: 1969960
RSellis;

That's it?  No inner joins or anything like that?

mapper
0
 

Expert Comment

by:rsellis
ID: 1969961
The last query is an inner join and the one about the truck is a sub-select but the rest seem pretty simple
Rick
0
 

Author Comment

by:mapper
ID: 1969962
Rick,

Thanks - I appreciate it...

mapper
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question