Jump to content

Sql Queries


beechy34

Recommended Posts

hi im looking at some exam examples and i just want to know if im doing it right, here it is.1. Assume Sales is a relational table with schemaSales(year, month, city, category, customers, units)that contains aggregate data such as the number of customers and the units sold of a given product category at a particular month and year. Write SQL queries that make use of Oracle 10g analytical functions to answer the following questions:a) Rank the sales data (in descending order) per city according to units sold.]:) Rank the sales data (in ascending order) per year and month, according to the number of customers.for a i did this

select*from(select rank()over (order by units desc) rnk, year, month, city, category, customers, units  from salesgroup by city)

and for b i did this

select*from(select rank()over (order by customers asc) rnk, year, month, city, category, customers. units  from salesgroup by month, city)

i dont think they are right, can you tell me how to do them properly thankyou

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...