top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

A table named fruit has the attributes "ID", "Fruit name" and "Basket No":

+1 vote
28 views

|ID | Fruit Name | Basket No|
|1 |Apple |1 |
|2 |Banana |2 |
|3 |Orange |1 |
|1 |Apple |2 |
|2 |Banana |3 |
|3 |Orange |2 |
|4 |Mango |2 |
|5 |Grapes |1 |
|1 |Apple |3 |​

question 1: Find the basket number which have more than 2 fruits.
question 2: Find the basket number which contain orange.
question 3: Find the fruits which are present in more than one basket.

posted Jun 15, 2015 by Shivaranjini

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote

question 1:find the basket number which have more than 2 fruits.

SELECT   basket_no
FROM     baskets
GROUP BY basket_no
HAVING   COUNT(*) > 2

question 2:find the basket number which contain orange.

SELECT DISTINCT basket_no
FROM   baskets
WHERE  fruit_name = 'Orange'

question 3:Find the fruits which are present in more than one basket.

SELECT   fruit_name
FROM     baskets
GROUP BY fruit_name
HAVING   COUNT(*) > 1
answer Jun 15, 2015 by Manikandan J
Similar Questions
+2 votes

what is the Difference between id and name attributes in HTML?

+3 votes

This is the Sales_Import table, where the account number field needs to be updated:
LeadID AccountNumber

147 5807811235 
150 5807811326 
185 7006100100007267039

And this is the RetrieveAccountNumber table, where I need to update from:
LeadID AccountNumber

147 7006100100007266957 
150 7006100100007267039 
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...