Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # cek tabel berdasarkan tanggal pembuatan terakhir
- select table_name, create_time
- from information_schema.TABLES
- where table_schema = 'andomar'
- order by CREATE_TIME desc
- # cek table yg mempunyai field tertentu
- SELECT *
- FROM INFORMATION_SCHEMA.COLUMNS
- WHERE COLUMN_NAME = '<nama field>'
- # bulk alter
- # Forget looping. Just do this:
- select concat( 'alter table ', a.table_name, ' add index `fields` (`field`);' )
- from information_schema.tables a
- where a.table_name like 'table_prefix_%';
- # Then take the result set and run it as a SQL script.
- # BTW, you probably mean create index index_name on table_name( column_name)
Add Comment
Please, Sign In to add comment