+ 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

17th Apr 2018, 9:24 PM
Devvrat Marwah
Devvrat Marwah - avatar
4 odpowiedzi
+ 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.)
17th Apr 2018, 9:36 PM
Ipang
+ 2
Show columns gives the informations about every columns of the table (name, type, nullable, etc...), not the stored data itself, as Select * does.
17th Apr 2018, 9:38 PM
Luigi
Luigi - avatar
+ 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.
17th Apr 2018, 9:44 PM
sneeze
sneeze - avatar
0
So I can say Show query works only for views but select is used for some process being performed over a table
17th Apr 2018, 9:39 PM
Devvrat Marwah
Devvrat Marwah - avatar