Date Archives October 2018

Say No to Phones

A few days ago at the close of work about five of us were standing by the lift waiting. I suddenly noticed every single person was looking in their phones. It happened again this morning by the lift. WhatsApp it appeared in this case. It occurred to me that the implications of how our social lives have been altered by technology. It is easier to communicate with someone far away whom we cannot see than to notice someone standing right next to us in a public place.

Are we hiding something behind our mobile phone screens? Have we lost the capacity to look another person in the eye? How will our children fit in socially once they are raised with this everyone-to-his-phone culture? In the first occurrence I described, I was so taken aback by the realization that I put my phone in my pocket immediately. It is like a disease that has caught everyone: Phonephilia! It is spreading fast.

I think it would be a healthy habit to deliberately ignore our mobile phones for hours during the day and do more rewarding things like talking with a colleague face to face, focusing on a book or article and even concentrating on our work. There are so many aspects of life that phones and Social Media generally may be taking away from us and we have to fight back for ourselves and for our children. Say “NO” to Phonephilia.

Extract DDL in MySQL

Working with Oracle and SQL Server I have become used to not-so-simple statements or procedures for extracting the structure of database objects. In order to extract the DDL for a database object, one would typically use a third party tool such as SQL Navigator or Toad. An alternative for more advanced DBAs would be to use DBMS_METADATA.GET_DDL. In SQL Server either you script the object from SQL Server Management Studio or you use sp_helptext for procedures for example.

Fig. 1 DBMS_METADATA.GET_DDL in Oracle
Fig. 2 sp_helptext in MS SQL Server

There is actually a very interesting way this is done in MySQL. It is a very simple SHOW command that is quite easy to remember and extend:

SHOW CREATE TABLE <TABLENAME>

I found this particularly interesting because once you know the basic syntax, it become almost intuitive. Other commands exist such as the following to display on indexes on a table :

SHOW INDEX FROM <TABLE_NAME>

I am sure you may already be familiar with SHOW DATABASE, SHOW TABLES, SHOW PROCESSLIST, SHOW PRIVILEGES etc. A full list of MySQL’s SHOW commands can be found here.