|
Posted by Rik on 01/16/07 21:17
Andy wrote:
> "Rik" <luiheidsgoeroe@hotmail.com> wrote in message
> news:581e0$45ad2fed$8259c69c$26539@news1.tudelft.nl...
>> Andy wrote:
>>> Please tell me how to merge two sql databases.
>>
>> Huh? Sql databases? What kind?
>>
>>> Do you know any tutorial about it?
>>> What I want, is to insert data from sql I bought into sql which came
>>> with a website's script. Sql I bought has only one table containing
>>> 4 fields: id, name, ingredients, procedure.
>>> Thank you in advance.
>>
>>
>> Hoepfully you have a user with permission on both databases. If so,
>> choose to work on the 'extra' database and:
>>
>> ALTER TABLE table_name RENAME normal_database_name.table_name
>>
>>
> It is MySql database.
> Do you mean that I supposed to install a database I bought than work
> on that?
Would seem the most logical thing to do. In what format did they deliver
this 'new' database to you? I assumed the database was already up and
running.
> I thought that I can merge sqls in a special program.
I have no doubt. I've never needed that though, so I'm not aware of them,
and moving just 1 table is so simple it wouldn't justify a download of any
program whatsoever.
> If so please tell me where I supposed to write the code you posted?
> (ALTER TABLE table_name RENAME normal_database_name.table_name)
> I am new to sql database so I am not sure what to do?
Well, you have 2 databases here, I assume they are on the same server? As
long as you've got a user for that database, that can connect to both
databases (i.e. select & alter etc.), you can use the rename syntax:
http://dev.mysql.com/doc/refman/5.0/en/rename-table.html
In php, that would be:
<?php
mysql_connect('server','user','password');
mysql_query('ALTER TABLE bought_database_name.table_name RENAME
normal_database_name.table_name');
?>
If they are not on the same server, it get's somewhat trickier. You could
use the infile / outfile possibilities:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
But let't not get into that just yet if you're just starting...
--
Rik Wasmus
Navigation:
[Reply to this message]
|