Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Table - Products has number of products as below
Productid ProductName
1
iPhone
2
iPad
3
BlackBerry

Table - SalesPersonProduct has the
below records
Salespersonid
productid
S1
1
S1
2
S1
3
S2
1
S3
2

Write a SQL query that returns the number of sales for each
product

Answers were Sorted based on User's Feedback



Table - Products has number of products as below Productid ..

Answer / subbareddy.l

Hi,

This query will give us number of sales product wise


select SPP.Productid,COUNT(SPP.Productid)CC from
SalesPersonProduct SPP inner join products P
ON SPP.Productid=P.Productid
group by SPP.Productid

Thanks,
subbareddy.l

Is This Answer Correct ?    5 Yes 0 No

Table - Products has number of products as below Productid ..

Answer / madhu sudhan g

Hiii

try this query you will get the answer

select count(1) as SalesCount,P.Product from Products P
INNER JOIN SalesPersonProduct S ON S.Id=p.Id group by P.Product

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is the new security features added in sql server 2016? : sql server security

0 Answers  


last function used in MS Access to convert sql what function will use in sql

0 Answers   Cap Gemini,


Can the “if update (colname)” statement be used in a delete trigger?

0 Answers  


I create a separate index on each column of a table. What are the advantages and disadvantages of this approach? : Sql server database administration

0 Answers  


In what three ways is the return statement used in a stored procedure?

0 Answers  


What is tempdb in sql server?

0 Answers  


How to modify the underlying query of an existing view?

0 Answers  


How to disable a login name in ms sql server?

0 Answers  


what is a transaction and what are acid properties? : Sql server database administration

0 Answers  


Explain database normalization?

0 Answers  


What are the different types of replication you can set up in sql server?

0 Answers  


Write SQL queries on Self Join and Inner Join.

0 Answers   Aspiring Minds,


Categories