MySQL DATE_FORMAT: Grouping Date & Time value fields into single days made easy

To conform a datetime field to just a date in your results and make it easy to group TIMESTAMP fields in the format "2015-12-25 12:23:23" so you can group any datetime value into actual days for daily reports, use "DATE_FORMAT" below: In other words, if you have values from a SELECT statement that are…

Planning to design or redesign an organization’s database? Get back to basics and refer to MySQL’s reserved keyword list

Oracle's MySQL is a staple in the open source web environment world.  Being familiar with the reserved words the database uses is just one way to make sure you don't have to refactor code or special-escape field names in queries later with the menacing back tick: ` Here is the link to MySQL's reserved keyword's…

Accessing your Virtualmin MySQL database from a local dev tool requires addition to “remote hosts” list

Keep your dev servers separate from your workstation Setting up a development server on your local network separate from the machine you write and crunch code is a great way to keep the machine you rely on to operate as fast as possible.  I never try to install any virtual machine on the same machine…

MySQL: Using sub-selects to filter results of one table that is not contained in another table

In MySQL, if you have two tables with a shared index and you would like to show the results of one table where the index is not within another table, you can use "NOT IN". Try Googling "MySQL NOT IN" and you get everything but this command, it's almost as if they need to…

MySQL: Exclude ‘group by’ group if field A in any row has value B with “Natural Join”

Querying databases get a little tricky when you have a stack of records associated with another table, perhaps a master table of accounts, and you're trying to filter out values that would exclude the results from another group of results. In this example below, we are getting a list of organization IDs for all countries…