x
login about faq Site discussion (meta-askssc)

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 '12 at 07:12 AM in Default

we3d gravatar image

we3d
0 1 2

Is this a homework question?

Nov 21 '12 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 '12 at 07:59 AM

Amardeep gravatar image

Amardeep
1.3k 71 82 86

(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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x598
x321

asked: Nov 21 '12 at 07:12 AM

Seen: 362 times

Last Updated: Nov 21 '12 at 12:18 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.