x

help me wite query for these question

link text

alt text

can some one pls write queries to answer the following questions based my design, i have been working on it all day and i am tired i could use some help:

a. Find all those customers who have not purchased anything from Niles Video Inc. b. Get the total number of DVDs and video tapes sold per genre. c. Get the average number of DVDs per purchase.

table11.png (222.6 kB)
more ▼

asked Nov 21, 2012 at 07:12 AM in Default

avatar image

we3d
0 1 1 2

Is this a homework question?

Nov 21, 2012 at 11:50 AM Fatherjack ♦♦
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

a. Find all those customers who have not purchased anything from Niles Video Inc.

 SELECT CustomerID,Name FROM CustomerINfo CI
 where customerID not exists(
 select customerID from OrderQuery oq inner join Movies m on m.itemNumber=oq.itemnumber
 where Genre='Niles Video Inc')

b. Get the total number of DVDs and video tapes sold per genre.

 > select genre,sum(quantity) from
 > OrderQuery oq inner join Movies m on
 > m.itemnumber=oq.itemnumber group by
 > m.genre

c. Get the average number of DVDs per purchase.

 select Title,avg(sum(quantity)) from Movies m inner join OrderQuery oq on oq.itemnumber=m.itemnumber
 group by Title
more ▼

answered Nov 21, 2012 at 07:59 AM

avatar image

Sharma
1.3k 88 91 95

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x993
x426

asked: Nov 21, 2012 at 07:12 AM

Seen: 910 times

Last Updated: Nov 21, 2012 at 12:18 PM

Copyright 2016 Redgate Software. Privacy Policy