Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4991

Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4993
Question 24: How do you move table test from database tt to database tt2? – MySQL Question of the Day

Skip to content

By urs in mysql questions

 
(Find all correct answers)
 
Both databases are inside the same mysql instance.
 

a) create table tt2.test like tt.test;
   insert into tt2.test select * from tt.test;
   drop table tt.test;
 
b) alter table tt.test rename to tt2.test;
 
c) alter table tt.test move to tt2;

 
[ Tables and Indexes (15%) - Altering Tables ]
 

Tags: , ,

Comment Feed

One Response


  1.  
    Answers:
     
    a b
     
    Both a and b will work. b is fast, as no copying takes place.
    The move option does not exist for ALTER TABLE.
     

You must be logged in to post a comment.