Home » SQL & PL/SQL » SQL & PL/SQL » SQL query
SQL query [message #673016] Thu, 01 November 2018 20:39 Go to next message
james94539
Messages: 4
Registered: November 2018
Junior Member
Hi,

Can anyone help to write SQL queries?

Thanks

James

Given 2 tables, Table1 with Customer_ID, Product_ID, Date, Country & Revenue & Table2 with Product_ID & Product_Name ,write a SQL query to get the Total Revenue by Product_Name and Country?

Re: SQL query [message #673017 is a reply to message #673016] Thu, 01 November 2018 20:47 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Re: SQL query [message #673019 is a reply to message #673016] Fri, 02 November 2018 01:21 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Hi James. This looks a LOT like a homework assignment, which implies that you are studying SQL as part of a course.
Have you had a crack at writing the query? If you have, post what you tried and folk here will happily help to guide you. If you haven't, read your notes and give it a try, then post what you tried and folk here will happily help to guide you.
GL
Re: SQL query [message #673022 is a reply to message #673016] Fri, 02 November 2018 02:35 Go to previous message
Michel Cadot
Messages: 68637
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Hint in 2 steps:
1/ first find the total by product_id and country using only table1 (see Aggregate Functions)
2/ then join the result of this (sub)query with table2 to get product_name from product_id

Previous Topic: DBMS_LOB.SUBSTR
Next Topic: Ranking data by a set of data maybe using analytical function
Goto Forum:
  


Current Time: Tue Apr 16 14:27:26 CDT 2024