Solved

SQL Query HELP!!

Posted on 1998-12-02
4
524 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
Comment Utility
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
Comment Utility
RSellis;

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

mapper
0
 

Expert Comment

by:rsellis
Comment Utility
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
Comment Utility
Rick,

Thanks - I appreciate it...

mapper
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views 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 Access…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now