+ 1
How is Show Columns from table and select * from table different?
It might show some extra values in Show, but how it's useful
4 Réponses
+ 2
Quoted from MySQL manual page:
"SHOW COLUMNS displays information about the columns in a given table. It also works for views. SHOW COLUMNS displays information only for those columns for which you have some privilege."
https://dev.mysql.com/doc/refman/5.7/en/show-columns.html
SELECT * FROM table is used to select records from a table, SHOW COLUMNS is used to display table columns (fields) information (type, size etc.)
+ 2
Show columns gives the informations about every columns of the table (name, type, nullable, etc...), not the stored data itself, as Select * does.
+ 1
http://www.mysqltutorial.org/mysql-show-columns/
The more flexible way to get a list of columns in a table is to use the MySQL SHOW COLUMNS command.
Show columns is only a list of columns no data included
Select * from table shows the data in the table, not a list of columns.
0
So I can say Show query works only for views but select is used for some process being performed over a table