Posts

Generate Date from a range in Mysql and pad the results where no date is present

…  you want to generate dates, MYSQL doesn’t have a range function, so I wrote a work around for the same. So …

Display row number in Mysql Select Query

…  mark of the person. So lets see how to implement this in mysql. There is no straight forward function or query parameter to do it (At …

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 := …

Important MySQL DBA Interview Questions

…  are a few sets of interview questions expected for MySQL DBA position.These are compilation of the usual questions from various …

Get the nth Word from a text field in mysql

…  functions available in MYSQL So here is the query for it:



 select Name, …

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. Creat …

Group by Date when Stored in Mysql DataBase as Date Time

…  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 …

Check if a table exists in MySQL from PHP

…  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 command show tables . Which will give me the list of tables and then …

Batch Insert/Update for Mysql in Java

…  prepared statements and more over sends batch of query to mysql and there by making it incredibly fast. How fast? One by one query insert …  db = "testDB"; String url = "jdbc:mysql://localhost:3306/"; String driver = "com.mysql.jdbc.Driver"; try{ Class.forName(driver); con = …

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 …