So I have a table with many columns. Suppose that each column contains similar keywords, differing only by a few. I want to select these columns based on their similar keywords.
At first, this was my try:
SELECT * REGEXP 'pages_title$' FROM 'pages';
That is, any column that ends with pages_title
should be selected. So the REGEXP should apply to the column's name, not any entries. Is this possible? All of the examples I have found online pertain to using REGEXP to isolate certain values within the table, which isn't what I want.
information_schema
tables and constructing dynamic SQL. But I wouldn't recommend doing that. Fix your database design. – Evacuee