Skip to main content

SQL for ordering by number - 1,2,3,4 etc instead of 1,10,11,12

SQL for ordering by number - 1,2,3,4 etc instead of 1,10,11,12



When we use
ORDER_BY registration_no ASC
get...
1
101
102
103
104
105
106
107
108
109
11
110
Etc
Using 'order by len(registration_no)' we will get
1
11
101
102
10
104
105
106
107
108
119
Etc...

This is particularly useful when the column might contain non-numeric values.
Note: in some databases, the function to get the length of a string might be called length() instead of len().

Comments

Popular posts from this blog

Php Interview Questions

1. What Is PHP ? 2. How can I disable the output of error messages inside the HTML page? 3. Can I return other file formats (like Word, Excel, etc) using PHP? 4. Is there any way to force PHP to do garbage collection before the end of the request? 5. Why does require($file_name) in a loop just include the first file repeatedly? 6. Can you include and call C libraries in PHP scripts? How? 7. What's the best way to start writing a PHP program? 8. Passing variables with REQUIRE function (part II) 9. I use a /cgi-bin/ad.pl for displaying rotating banners at the top of my html files. How can I insert the output of this cgi in an "included" file ? 10. please tell me how to let a html document read content from a .txt file, spit this out in a table, and how to update the specific file with a form 11. How can I add authentication to my site with PHP? I have authentication working only with one page. 12. Where can I get documentation for the Zend API? 13....

Laravel CRUD With MongoDB

Laravel is the most popular framework of php. laravel better than another PHP framework because it handles the command base. so let us see about laravel 8 MongoDB CRUD tutorial example. it was released on Sept 03, 2019. Now, we follow the below step for creating the laravel 8 MongoDB CRUD operation(Laravel 8 CRUD example). Overview Step 1: Install Laravel 8 Step 2: Configure MongoDB database Step 3: Install laravel-mongodb Package Step 4: Add Route Step 5: Create Model and Controller Step 6: Create Blade Files Step 1: Install Laravel 8 We are going to install laravel 8, so first open the command prompt or terminal and go to xampp htdocs folder directory using the command prompt. after then run the below command. 1 composer create-project --prefer-dist laravel/laravel laravel8_crud_mongodb Step 2: Configure MongoDB database After the complete installation of laravel. we have to database configuration. now we will open the .env file and add the MONGO_DB_HOST, MONGO_DB_PORT, MONGO_DB_DATA...

Intoduction to DotNetNuke

Intoduction to DotNetNuke                     DNN® ( formerly DotNetNuke® ) is the leading open source web content management platform (CMS) in the Microsoft ecosystem. The product is used to build professional looking and easy-to-use commercial websites, social intranets, community portals, or partner extranets. Containing dynamic content of all types, DNN sites are easy to deploy and update. The DNN Platform has been downloaded more than 8 million times and powers more than 750,000 websites globally. A community of more than 1 million members forms a powerful support network. Thousands of commercial extensions, apps and skins are available at the DNN Store that make extending a DNN site fast and affordable. Free open source extensions are also available from the DNN Extensions Forge . In addition to robust content management, the free, open source DN...