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

we3d gravatar 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

Amardeep gravatar image

Amardeep
1.3k 87 88 89

(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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

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:

x738
x375

asked: Nov 21, 2012 at 07:12 AM

Seen: 773 times

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