Posts
Display row number in Mysql Select Query
How many times did want to have the row number or the position of the row in the selected query? I had many cases where I needed this feature. I needed the feature for printing the rank of a person where each row is the mark of the person. So lets see how …
Automatic Command Archive
The default command storing size of ubuntu is 500 commands. It stores the commands in home folder in the file “.bash_history” . The problem is 500 commands is too short of a size. One method is to increase the command size to a large value by changing th …
BSNL Dataone Auto Downloader
Bsnl(India) provides an account that has 2am to 8am unlimited download. It was not easy to wake up at 2am and switch on the computer and sleep again. So I tried to find a method to switch on the computer automatically at 2am and download and shutdown at 8a …
Create a table like another table or from a select query
There are some cases where we need to create a table similar or exactly same as another table. The easiest and best way is use create table along with additional parameters. We can create a table similar to another table without data and with data. C …
Simplest way to remove trailing zeros of decimal numbers
This is a simple method I found to remove or strip trailing zeros of a decimal number. The function accepts the decimal number and return the trimmed value back. It removes all the redundant zeros in the number after the decimal point and if no number othe …
Customizing Mysql Prompt For multiple Servers
If you are using mysql regularly on multiple servers its really useful to have the promt in mysql to show something more than mysql>. It would be useful if it showed the username,hostname, current database and things like that. So how to do this. …
Generate Date from a range in Mysql and pad the results where no date is present
If you want to generate dates, MYSQL doesn’t have a range function, so I wrote a work around for the same. So how it works is I have reused a code to generate numbers from my previous post. So I added date function to that query and reduce the generated …
Generate 1 to 1000 in mysql
Sometimes its necessary to have thousand rows to join or generate new values, we need to get the thousand rows first. For this I used union of numbers 0-9. I have joined four of these to get to four digit values. So here is the code: [sql]SELECT @ro …
Recent Comments