Posts

Get the nth Word from a text field in mysql

I had a requirement to get the nth word out of a string and sort or order by the same. This is used when the text is stored in a purticular format and you would want to order it according to that or group it or so on. So how is it done? We do it using a  …

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. One m …

Important MySQL DBA Interview Questions

Here are a few sets of interview questions expected for MySQL DBA position.These are compilation of the usual questions from various DBA texts: What is Log Switch? – The point at which ORACLE ends writing to one online redo log file and begins writing to …

Group by Date when Stored in Mysql DataBase as Date Time

I have a table called date_count with 2 columns one is a value and another is a date time, say called date_time in mysql. Date Time in mysql is stored as dd-mm-yy hh:mm:ss. The issue comes when I need to get the number of rows per day. As its stored as dat …

Check the port in which the Mysql is running on

Mysql can be configured to run other ports other than the default port (of 3306). So what will you do when you need to find the port on which a mysql server runs on. If you don’t have access to the server files and can access the server only using the mysq …

Check if a table exists in MySQL from PHP

Sometimes its necessary to execute a query or execute some code if a table exists or not. So a bit of searching got me to the conclusion that mysql doesn’t have a direct query or method for it from php. So there are two methods to do it. Use the mysql c …

Find Invisible Users In Gmail

Finding who is invisible is something that I always wanted to do.It’s always fun to ping a person who feels none can see him/her online. While studying XMPP protocol I found out that even when the person is offline the chat client knows that person is onli …

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  …

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:



SELECT @row := …

Web page Performance for a Blog – Part 1

I have always under the notion that page performance for big websites or websites that have a sole server and various resources like CDN and load balancers. So I wanted to know if this is true. I set out to try web page performance my blog. I just wanted t …