Jump to content
GIGN Forum

Mysql


OneSKILL
 Share

Recommended Posts

Vai MySQL command line klientā vai jebkādā citā admin rīkā lietot sql, lai ģenerētu sql :) Piemēram, lai novāktu nost to "ibf_":

mysql> use test;
Database changed
mysql> create table ibf_blah (a integer);
Query OK, 0 rows affected (0.22 sec)

mysql> create table ibf_blahdabadah (a integer);
Query OK, 0 rows affected (0.03 sec)
mysql> select concat('rename table ',
    ->               table_name,
    ->               ' to ',
    ->               substr(table_name, 5),
    ->               ';') ren_table
    -> from information_schema.tables
    -> where lower(table_name) like 'ibf%'
    ->   and table_schema = 'test';
+----------------------------------------------+
| ren_table                                    |
+----------------------------------------------+
| rename table ibf_blah to blah;               |
| rename table ibf_blahdabadah to blahdabadah; |
+----------------------------------------------+

Tagad tikai atliek rezultātu iedabūt failā un failu palaist.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...