Re: create multiple tables in a single query

2012-04-06 Thread Johan De Meersman
- Original Message - > From: "joe j" > > Good suggestion. But I am a perl/unix illiterate. However I may learn > in them future-you never know! You're never too old to learn :-) http://tldp.org/LDP/abs/html/ -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwe

Re: create multiple tables in a single query

2012-04-05 Thread joe j
>Jan Steinman wrote >If not, how 'bout the best of both worlds: create a UNIX (or perl) script that >loops >through the country names and creates an SQL script? That would be fast >entering AND fast >performing! Good suggestion. But I am a perl/unix illiterate. However I may learn in them future

Re: create multiple tables in a single query

2012-04-05 Thread Jan Steinman
> From: joe j > > Thanks. I was looking for a loop--not to gain speed but to reduce the > length of my script file:) I'll try and hopefully it will work! Is there any reason (besides human keystrokes) that you want a short script? If not, how 'bout the best of both worlds: create a UNIX (or per

Re: create multiple tables in a single query

2012-04-05 Thread joe j
Thanks, Johan. I run the script in Unix indeed-don't know why I said Dos:) The problem is caused (at least that is the sense I get, so far) when I use some conditional statements inside "case when" as: (case when (country='${x}' AND var2<>"") then 1 else 0 end) The problem lies with the "<>" pa

Re: create multiple tables in a single query

2012-04-05 Thread Johan De Meersman
- Original Message - > From: "joe j" > > > /*STEP 2. from the dos prompt?*/ > > for x in UK ZA IN CN; > do mysql -ujoe -p -e "INSERT INTO `table_new` > SELECT var1, var2`, (case when (country='${x}') then 1 else 0 end) AS > citizen > ,'${x}' AS ctry > FROM `'${x}'_table` > LEFT JOIN >

Re: create multiple tables in a single query

2012-04-05 Thread Johan De Meersman
- Original Message - > From: "Rick James" > > That sounds like the wrong way to design the schema. Why not have > `country` as a column in a single table? Given that he got all the data for the new tables from existing ones, I was assuming he needed separate tables for some specific pu

Re: create multiple tables in a single query

2012-04-04 Thread joe j
Thanks to Rick I would go for a single table. I tried the following, but hasn't been successful yet. First I created one 'master' table for one country, with a country column (ctry) as Rick suggested, then I tried to use the loop suggested by Johan to insert the records for each of the remaining co

Re: create multiple tables in a single query

2012-04-04 Thread Rick James
That sounds like the wrong way to design the schema. Why not have `country` as a column in a single table? On 4/3/12 6:22 PM, Hal?sz S?ndor wrote: 2012/04/03 22:27 +0200, joe j So what I am trying to get is a script that runs through a list of country names (US, UK, NL, etc) and create ta

Re: create multiple tables in a single query

2012-04-04 Thread joe j
Thanks. I was looking for a loop--not to gain speed but to reduce the length of my script file:) I'll try and hopefully it will work! J On Wed, Apr 4, 2012 at 12:16 PM, Johan De Meersman wrote: > - Original Message - >> From: "joe j" >> >> So what I am trying to get is a script that runs

Re: create multiple tables in a single query

2012-04-04 Thread Johan De Meersman
- Original Message - > From: "joe j" > > So what I am trying to get is a script that runs through a list of > country names (US, UK, NL, etc) and create tables for each one of > them as above. Is this feasible in MySql? You can't create multiple tables with one statement; but you *can* p

Re: create multiple tables in a single query

2012-04-04 Thread Hal�sz S�ndor
2012/04/03 22:27 +0200, joe j So what I am trying to get is a script that runs through a list of country names (US, UK, NL, etc) and create tables for each one of them as above. Is this feasible in MySql? There are PROCEDUREs, and there is PREPARE. Look them up. -- MySQL Gener

RE: Create MULTIPLE TABLES ?

2001-05-15 Thread Shankar Unni
mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 7:46 AM To: Peter Pentchev; RAZAKA Cc: [EMAIL PROTECTED] Subject: RE: Create MULTIPLE TABLES ? Foreign Keys are nice but they are costly items to use, best enforce the reference in your business logic of your application. You can still join

RE: Create MULTIPLE TABLES ?

2001-05-15 Thread Brandon Lewis
they choose not to implement this. Good Luck -Original Message- From: Peter Pentchev [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 5:09 AM To: RAZAKA Cc: [EMAIL PROTECTED] Subject: Re: Create MULTIPLE TABLES ? On Tue, May 15, 2001 at 12:43:02PM +0200, RAZAKA wrote: > I would l

Re: Create MULTIPLE TABLES ?

2001-05-15 Thread Peter Pentchev
On Tue, May 15, 2001 at 12:43:02PM +0200, RAZAKA wrote: > I would like to create multiple tables in a database. > HowTo Use REFERENTIAL INTEGRITY with MySQL ? > May I use "FOREIGN KEY" or "REFERENCES"? > Note: MySQL Release = 3.23.36 > > Thanks for help :) In short, you can't.. >From the MySQL