Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SQL Query HELP!!

Posted on 1998-12-02
4
529 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

860 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