MySQL management, tutorials, scripts, coding, programming and tips for database administrators
Rolling your own search is especially advantageous for WordPress sites that include a lot of custom post types. Rob Gravelle shows you how to build a query that searches by post_title and taxonomy metadata.
Whether you’re fetching a single row or an entire result set, WordPress offers plenty of array types to work with. Read on to learn how to employ WordPress’ $wpdb’s get_row() and get_results() methods.
You can easily work with WordPress without ever seeing the database, but should your site grow to a certain level of complexity, you will almost certainly have to get in there. In fact, if you’re especially knowledgeable about MySQL and SQL, you can gain some noticeable performance benefits from crafting SQL statements yourself. To that end, today’s article will give a brief overview of the WordPress database schema and how to execute queries against it.
A cross tabulation query is used to display the result of an aggregation on two or more fields. The trick to this type of query is the transformation of rows of data to columns. Follow along with Rob Gravelle as he creates a crosstab query for the Sakila sample database that counts the number of movie rentals for each customer aggregated by month.
Rob Gravelle delves into the full syntax of the MySQL GROUP_CONCAT function and provides some guidance on how to use the GROUP_CONCAT function to chain together data from multiple columns in a way that’s both easy to read and parse with a script or application.
Learn about MySQL’s GROUP_CONCAT function and, more importantly, how it just might change how you work with query result sets forever - especially if your database feeds an application.
Without question, one of the most common tasks performed by Database Administrators (DBAs) is identifying and weeding out duplicate values in tables. Despite the inordinate number of queries written by other DBAs to locate duplicate values in their database tables, the real challenge is in locating a useable SQL statement to go by. Rob Gravelle presents a few solutions that will save you some time down the road.
To err is human, or so the saying goes. Unfortunately, in the world of IT, innocuous mistakes made early on can lead to really daunting problems down the road. In today’s article, we’ll go over a few of the most common DBA mistakes to avoid. Some of these relate specifically to MySQL, while others may be applicable to any RDBMS.
A common business requirement is to fetch the top N rows of each group, for example, largest cities for each country. Unfortunately many solutions utilize non-MySQL vendor-specific functions. Rob Gravelle covers a couple of approaches that will work with MySQL.
It’s been said that one of the drawbacks to normalization to the third form (3NF) is more cumbersome data extraction due to the greater number of tables. These require careful linking via JOIN clauses. Improper table joining can easily result in erroneous results or even in the dreaded Cartesian Product. In today’s article, we’ll explore how table joins are achieved in MySQL.
While there is no silver bullet to keeping your MySQL database running briskly, there are a few performance tweaks that you can do to keep things chugging along when the data starts to pile up. In today’s article, we’ll take a look at a few of these.
If you’ve ever tried to calculate how much disk space your MySQL data entities – databases, tables, and columns – are taking up, you may have been left scratching your head for an answer. You’ll be happy to know that it can be done. Rob Gravelle shows you a few sure fire ways to get at the information you’re looking for.