Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> MySQL

แสดงชื่อตารางเฉพาะด้วย MySQL LIKE Operator


ในการแสดงชื่อตารางเฉพาะด้วยตัวดำเนินการ LIKE ไวยากรณ์จะเป็นดังนี้ −

เลือก table_name เป็น `anyAliasName` จาก information_schema.tables โดยที่ table_name เช่น 'yourValue%';

ให้เราใช้ไวยากรณ์ข้างต้นเพื่อแสดงชื่อตารางเฉพาะด้วยตัวดำเนินการ LIKE -

mysql> เลือก table_name เป็น `DemoTable1600` -> จาก information_schema.tables -> โดยที่ table_name เช่น 'DemoTable160_%';

สิ่งนี้จะสร้างผลลัพธ์ต่อไปนี้

<ก่อนหน้า>+--------------+| DemoTable1600 |+--------------+| demotable1600 || demotable1601 || demotable1602 || demotable1603 || demotable1604 || demotable1605 || demotable1606 || demotable1607 |+--------------+8 แถวในชุด (0.01 วินาที)