Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Price Age Name
3000 30 Ram
2000 20 Ram
1000 10 Ram
5000 40 Sham
6000 50 Sita

Write a Sql query and display output as

Price Age Name
1000 30 Ram
5000 40 Sham
6000 50 Sita


What I have tried:

Please write sql query code for above program
Posted
Updated 10-Sep-17 0:34am
Comments
kmoorevs 9-Sep-17 16:48pm    
This one's about grouping and aggregates. hint: min and max
an0ther1 13-Sep-17 0:37am    
Run the following query;
SELECT
CHAR(68) + CHAR(111) + CHAR(32)
+ CHAR(121) + CHAR(111) + CHAR(117)
+ CHAR(114) + CHAR(32) + CHAR(79)
+ CHAR(87) + CHAR(78) + CHAR(32)
+ CHAR(104) + CHAR(111) + CHAR(109)
+ CHAR(101) + CHAR(119) + CHAR(111)
+ CHAR(114) + CHAR(107)

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think! This isn't difficult: all you need to do is think, and use GROUP BY and MAX/MIN

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
Before anything else, you need to find the rule that allow you to transform this data:
Price Age Name
3000 30 Ram
2000 20 Ram
1000 10 Ram

to this result:
Price Age Name
1000 30 Ram

This site will help you to learn SQL: SQL Tutorial[^]
Quote:
Write a Sql query and display output

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
 
Share this answer
 
Comments
[no name] 10-Sep-17 7:23am    
It Looks like somebody hunt you :doh: some corrections
Patrice T 10-Sep-17 7:36am    
Yes 3 downvotes in a row :)
Thank you very much, once again.
I tried using min/max and group by clause but couldnt get the desired output. So if you know Please provide the exact sql query.
Thanks in advance
 
Share this answer
 
Comments
[no name] 10-Sep-17 7:56am    
1. This is not an answer. Better remove it to prevent from downvotes
2. "I tried using min/max and group by clause but couldnt get the desired Output"
Show your SQL in the question
3. "Please provide the exact sql query"
That makes no sense. If you get the solution on the silver tablet you will not learn anything

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900