From http://www.catswhocode.com
Although there’s lots of things that you can do in WordPress, sometimes you may need a quick fix for a specific problem. In those cases, working directly on the database can be a real life-saver. In this article, I’m going to show you 10+ extremely useful SQL queries for WordPress.How to execute SQL queries
For those who don’t know yet, SQL queries have to be executed within the MySQL command line interpreter or a web interface such as the popular PhpMyAdmin. Since we’re going to work on WordPress, you should note that the SQL Executionner plugin provides an easy-to-use interface that allows you to run SQL queries directly on your WordPress blog dashboard.
Although all the queries from this article have been tested, don’t forget that you shouldn’t test any of those on a production blog. Also, make sure that you always have a working database backup.
The rest of the article HERE