I want to write a query which runs on a particular time.
For example when a set time comes the query automatically get executed.
Like if a user register in a website and doesn’t verify his/her email in 2 days then the data entry for that user should deleted by a delete query.
Seems like you need a scheduled event reference http://dev.mysql.com/doc/refman/5.1/en/create-event.html, that can run one a day let say.
Assumed that if the user verify the mail (like click on a link) will generate an entry in your db, then you can check if (current_day – register_day) > 2 days then record status ‘expired’ and all records having ‘expired’ status are eligible for delete.
Related questions :
Can't schedule a stored procedure in MySQL
and
How to schedule a stored procedure in MySQL
Hope this helps