How can I describe all tables in the database through one statement?

前端 未结 8 1935
天命终不由人
天命终不由人 2021-01-31 08:01

Is there any statement that can describe all tables in a database?

Something like this:

describe * from myDB;
8条回答
  •  囚心锁ツ
    2021-01-31 08:20

    mysql -B -N -u root -pPASSWORD -h somehost \
    -e "SELECT DISTINCT CONCAT('describe ', table_name, ';') AS query FROM information_schema.tables WHERE table_schema='DATABASE_NAME_HERE' " | \
    mysql -B -N -u root -pPASSWORD -h somehost DATABASE_NAME_HERE
    

提交回复
热议问题