Say I have a table called dogs that have the following columns:
id, fk_hospital, fk_owner, date, name
And I want to create another table that will have the following columns:
fk_hospital, fk_owner, fk_dogs, what_type
In this second table fk_dogs will be the id of the first table. And what_type by default will be NULL.
So basically, I want to dump from the first table to the second table. The create table of the second table looks like this:
CREATE TABLE dogs_info (
fk_hospital char(4) NOT NULL,
fk_owner char(11) NOT NUL,
fk_dogs int(11) unsigned NOT NULL,
what_type tinyint(1) unsigned DEFAULT NULL,
PRIMARY KEY(fk_hospital, fk_owner, fk_dogs)
)
How could I dump the content from the first to the second? Do I need any server language, like PHP? Or I can do it straight with mysql?
EDIT: I want to do this by chunks, so first do the dump for a particular fk_hospital and fk_owner, and then for next fk_owner. Can this be done with MySQL too?