Advertisement
ferrynurr

CEK SEMUA STRUKTURE YANG ADA DI DATABASE

Jan 8th, 2025 (edited)
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.68 KB | Source Code | 0 0
  1. SELECT 'TABEL' AS structure_name, count(*) as total
  2. FROM information_schema.tables
  3. WHERE table_type='BASE TABLE' and table_schema = '[GANTI_DENGAN_NAMA_DB]'
  4.  
  5. UNION ALL
  6. SELECT  'VIEW' AS structure_name, count(*) as total
  7. FROM information_schema.tables
  8. WHERE table_type='VIEW' and table_schema = '[GANTI_DENGAN_NAMA_DB]'
  9.  
  10. UNION ALL
  11. SELECT 'TRIGGER' AS structure_name, count(*) as total
  12. FROM information_schema.triggers WHERE TRIGGER_SCHEMA = '[GANTI_DENGAN_NAMA_DB]'
  13.          
  14. UNION ALL        
  15. SELECT 'FUNCTION_PROCEDURE' as structure_name, count(*) as total
  16. FROM INFORMATION_SCHEMA.ROUTINES
  17. WHERE ROUTINE_TYPE IN ('FUNCTION', 'PROCEDURE')
  18. AND ROUTINE_SCHEMA ='[GANTI_DENGAN_NAMA_DB]'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement