คุณต้องเข้าร่วมinformation_schema.tablesและinformation_schema.columnsร่วมกันเพื่อรับรายการตารางและรายละเอียดคอลัมน์ของพวกเขา
information_schema.columnsไม่เพียงแสดงรายละเอียดเกี่ยวกับตาราง แต่ยังดู ไม่มีวิธีกรองเฉพาะรายละเอียดตารางจากมุมมองระบบนี้
ดังนั้นคุณต้องเข้าร่วม
แบบสอบถามตัวอย่าง:
select t.TABLE_SCHEMA, t.TABLE_NAME, c.COLUMN_NAME, c.COLUMN_TYPE, c.DATA_TYPE
from information_schema.tables t , information_schema.columns c where 2=2 
and t.table_schema=c.table_schema
and t.table_name=c.table_name
and t.table_type ='BASE TABLE' 
order by t.table_schema, t.table_name, c.column_name 
;
               
              
descคำสั่งด้านล่าง อยากรู้ว่ามันสั้นที่สุด แต่มีคะแนนน้อยที่สุด สำหรับฉันมันเป็นสิ่งที่ดีที่สุด