How to find minimum and maximum length name in a table with there respective size using sql | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find minimum and maximum length name in a table with there respective size using sql

You can write two queries separately

7th Oct 2019, 1:19 PM
Sanjay Tiwari
Sanjay Tiwari - avatar
13 Answers
+ 2
Yes got it. Check this once. With Minimum length :- Select * from ( Select top 1 Name, LEN(Name) Name_Length from Table_Name where Name IS NOT NULL AND LEN(Name) > 0 Order By Name_Length ASC, Name ASC) TblMin With Maximum length :- Select * from ( Select top 1 Name, LEN(Name) Name_Length from Table_Name Order By Name_Length DESC, Name DESC) TblMax
9th Oct 2019, 8:25 AM
A͢J
A͢J - avatar
+ 1
Top work in SQL, limit work in Oracle. I checked and verify in SQL Edited:- Top work in SQL, ROWNUM works in Oracle. I have checked and verify in SQL Management Studio.
10th Oct 2019, 5:32 AM
A͢J
A͢J - avatar
+ 1
What happened with this way?
10th Oct 2019, 4:49 PM
A͢J
A͢J - avatar
0
Your question is not clear.
8th Oct 2019, 9:23 PM
A͢J
A͢J - avatar
0
How to find a name in any table with maximum length (means maximum character ) and also retrieve that name from the table Now you got it?
9th Oct 2019, 3:42 AM
Sanjay Tiwari
Sanjay Tiwari - avatar
0
I think top keyword doesn't work in oracle
10th Oct 2019, 2:45 AM
Sanjay Tiwari
Sanjay Tiwari - avatar
0
By the way thank you i will inform you after checking it on my pc
10th Oct 2019, 2:46 AM
Sanjay Tiwari
Sanjay Tiwari - avatar
0
Is there any other way to find it
10th Oct 2019, 3:43 PM
Sanjay Tiwari
Sanjay Tiwari - avatar
0
It is not working in my laptop This query is throwing an error "windows specification is missing for this function"
11th Oct 2019, 3:29 AM
Sanjay Tiwari
Sanjay Tiwari - avatar
0
And limit keyword doesn't work in oracle it works in mysql. I have tried it
11th Oct 2019, 3:39 AM
Sanjay Tiwari
Sanjay Tiwari - avatar
0
Sanjay Tiwari But in this query there is no function. Which DBMS you are using? It's working on SQL management studio. ROWNUM works in Oracle TOP works in SQL LIMIT works in MySql
11th Oct 2019, 5:53 AM
A͢J
A͢J - avatar
0
I am using oracle 11g express edition
11th Oct 2019, 6:30 AM
Sanjay Tiwari
Sanjay Tiwari - avatar
0
Can you please write it according to oracle's syntax
11th Oct 2019, 6:32 AM
Sanjay Tiwari
Sanjay Tiwari - avatar