Re: Merging two sql databases



Andy wrote:
"Rik" <luiheidsgoeroe@xxxxxxxxxxx> wrote in message
news:581e0$45ad2fed$8259c69c$26539@xxxxxxxxxxxxxxxxxxx
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


.



Relevant Pages

  • Re: Techniques for Vulneability discovery
    ... in mind) so i searched the net for some free database driven software and came ... the first thing i did was grab some info about PHP programming and some MySQL ... I did some more reasearch on different types of web based "input validation" ... PHP and SQL docs, etc.. ...
    (Vuln-Dev)
  • Re: Techniques for Vulneability discovery
    ... in mind) so i searched the net for some free database driven software and came ... the first thing i did was grab some info about PHP programming and some MySQL ... I did some more reasearch on different types of web based "input validation" ... PHP and SQL docs, etc.. ...
    (Security-Basics)
  • Help! PHP/SQL Brain freeze
    ... This is my first venture into PHP and SQL so i'm pretty much throwing ... this database and displayed in the browser window. ... I've set up apache http server and PHP ... stopped working completely. ...
    (comp.lang.php)
  • Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
    ... I even had one tell me "SQL injection? ... The big Daddy database spends lots of CPU cycles on the big Momma ... And PHP can't be used for foreign language sites, ...
    (php.general)
  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... But SQL does not have a pointer data type or the ... > being told to design a database. ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)