How to get all columns' names for all the tables in MySQL?

前端 未结 10 2326
你的背包
你的背包 2020-11-28 01:13

Is there a fast way of getting all column names from all tables in MySQL, without having to list all the tables?

10条回答
  •  暖寄归人
    2020-11-28 01:41

    SELECT * FROM information_schema.columns
    WHERE table_schema = DATABASE()
    ORDER BY table_name, ordinal_position
    

    Since I don't have enough rep to comment, here's a minor improvement (in my view) over nick rulez's excellent answer: replacing WHERE table_schema = 'your_db' with WHERE table_schema = DATABASE().

提交回复
热议问题