Jump to content

Recommended Posts

Posted

 Given following DAILY_SALES table definition, please find out all stores that had more than 1 million dollar sales in the year of 2014. Please write the full SQL for the analysis, assuming Oracle database.

DAILY_SALES table holds daily sales amount of each store and each customer; it has following 4 columns:

  • STORE_NBR,
  • CUSTOMER_NBR,
  • TRANSACTION_DATE,
  • SALES_AMOUNT

 

e question ki effective gaa simple query ela rayaliiiii

 

 

nenu idi anukuntunaaa

 

select count(*) as All_STORES from (

select STORE_NBR, count(*)

 from DAILY_SALES
where substr(TRANSACTION_DATE,1,4) = '2014'
group by 
STORE_NBR

having sum(SALES_AMOUNT) > 1000000 );

 

 

Posted

aa date col ea format lo undo thleyadu kaabatti instead of substring... convert tht to a date format and extract year frm it.

Posted

aa date col ea format lo undo thleyadu kaabatti instead of substring... convert tht to a date format and extract year frm it.

nek calling thread esa :(

Posted

aa date col ea format lo undo thleyadu kaabatti instead of substring... convert tht to a date format and extract year frm it.

 you mean.....

 

Select store_nbr, sum(sales_amount)

from daily_sales

where TRANSACTION_DATE>='01-JAN-14'

and TRANSACTION_DATE <='31-DEC-14'

group by store_nbr

having sum(sales_amount)>=1000000

Posted

 you mean.....

 

Select store_nbr, sum(sales_amount)

from daily_sales

where TRANSACTION_DATE>='01-JAN-14'

and TRANSACTION_DATE <='31-DEC-14'

group by store_nbr

having sum(sales_amount)>=1000000

where extract(year from transaction_date) =2014

Posted

where extract(year from transaction_date) =2014

Select store_nbr, sum(sales_amount)

from daily_sales

where extract(year from transaction_date)=2014

group by store_nbr

having sum(sales_amount)>=1000000

 

?????

Posted

Select store_nbr, sum(sales_amount)

from daily_sales

where extract(year from transaction_date)=2014

group by store_nbr

having sum(sales_amount)>=1000000

 

?????

yagallery_8818_6_385253.gif?1367349476

Posted

WHERE EXTRACT(YEAR FROM

TO_DATE(TRANSACTION_DATE, 'DD-MON-RR')) = 2014

Posted

WHERE EXTRACT(YEAR FROM

TO_DATE(TRANSACTION_DATE, 'DD-MON-RR')) = 2014

ok thanks baaaa

Posted

proj em aina vachindaa!!

 

ledhuu baa inkaa  vetukutunaaa

 

vendor gallu e questions adugutunaruu...

 

SQL rasi pampisthee....vallaki inka effective gaa unadli antaaa !!!

×
×
  • Create New...