My Profile Photo

Personal Webpage of David Duggins


Well, I was born on a normal day in July, 1981 and have been creating chaos ever since. Born in North Carolina, but raised in the aftermath of the Soviet Union, Kazakhstan, I have been messing around with computers nearly my entire life. I wrote my first program in assembly when I was 11. In my early teens I ran a BBS connected to Fidonet and started building a website for my band. In 1999 I was introduced to Linux, and it was love at first compile. I started my career in IT in the early 2000's doing IT for a Car Dealership in Charlotte NC. I wrote my first major web app in Cold Fusion (an ecom app) at that time. In 2006 I left Charlotte and moved down to Columbia where starting working as a developer, freelancer and consultant. Currently I am working as a freelance developer and DevOps consultant!!


Two pro tricks in MySQL

Chances are you use some form of gui when you interact with MySQL. Imaright? I don’t. I prefer to use the command line tools for pretty much everything that I do. MySQL is no exceptions. That being said, these two tricks are very helpful, even if you normally use a gui…in fact, the second trick will work in the gui’s as well, ‘cause it is really just some really cool sql.\n The first thing that we are looking at is how we end a sql statement. Typically, you use the ‘;’ to end your statements like this:

SELECT * FROM table WHERE type="device";

A pro trick is to use “\G” like this:

DESCRIBE table\G

So what is the difference? Well, “\G” gives a much easier to read print out of the data then the traditional tabular form.

mysql> select * from cms_phone_features where entry_id=4766\G 
*************************** 1. row *************************** 
entry_id: 4766
  row_id: 18973
  row_order: 0
  style: Touch Screen
  keyboard: Virtual
  camera_front: 1.3-megapixel
  camera_rear: 3.2-megapixel
1 row in set (0.00 sec)

The second trick that we are going to show today is some cool sql. So here is the scenario: You are dealing with a very large database with a massive amount of tables. Now, all you really want to deal with are a subset of these tables. They all happen to be prefixed ‘ds_’. So how can we list just these tables?

show tables like 'ds%'\G

The ‘like’ term will list tables like whatever string you follow with. The string must be in ‘’ and the % is a wildcard that matches anything.

Not so bad huh? As I am trying to strengthen my dba chops, you will be seeing database specific entries mixed in with my programming entries.

© 2024 David Duggins. All rights reserved.