MySQL: search for specific column namesMySQL has powerful search features, but most users only utilize search for actual data records. A often useful feature is the ability to search amongst column names. For example, let's say you need to go through an entire application to find all sections that use a "sort order" column when displaying data through the interface. There is a new bit of interface logic you need to add to each of those sections. Without knowing every page that uses a "sort order" column when displaying data, you could query the database to find all tables that have a field containing the word "sort": SELECT table_name, column_name FROM information_schema.columns WHERE column_name LIKE '%sort%'; An example of the results I get when issuing this query on a particular database server:
As you can see, it quickly found all of the different tables that have a field containing the word "sort." This helps me pinpoint which interface sections need attention.
Here is an example view from phpMyAdmin:
Comments/Mentions
|
Editor Picks
Email NewsletterSubscribe to the digest newsletter to receive posts by email: Recent Comments
Advertisements
|

