snippetsqlMinor
How to show the column names of a table?
Viewed 0 times
showthecolumnnameshowtable
Problem
The case is simple: You have a MySQL database where you have only an SQL query interface and you want to know the database structure with queries. You can list tables with
(
show tables; command, but how do you see the individual column names?(
SELECT statement shows Empty set if no data is present and can NOT be thus used.)Solution
The best solution that I found out by myself was the
desc table_name command. More information is on List MySQL Tables. This command gives the description of one database table, which is exactly what I was trying to find out.Context
StackExchange Database Administrators Q#6310, answer score: 7
Revisions (0)
No revisions yet.