Dear all, I need to create over 100 tables each representing a country. Instead of repeating the commands could I create all tables in one single query?
The following are two examples of the tables I'd like to create: 1. for USA CREATE TABLE `US_table_new` SELECT var1, var2` , (case when (country='US') then 1 else 0 end) AS US_citizen FROM `USA_table_old` LEFT JOIN WORLD USING(YEAR);
2. for UK CREATE TABLE `UK_table_new` SELECT var1, var2` , (case when (country='UK') then 1 else 0 end) AS UK_citizen FROM `UK_table_old` LEFT JOIN WORLD USING(YEAR);
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?
Thanks, Joe.
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql
Apr 03
Hal?sz S?ndor Re: create multiple tables in a single query
Apr 03, 2012; 21:22
Hal?sz S?ndor
Re: create multiple tables in a single query
Apr 04
Johan De Meersman Re: create multiple tables in a single query
Apr 04, 2012; 12:16
Johan De Meersman
Re: create multiple tables in a single query
Apr 04
joe j Re: create multiple tables in a single query
Apr 04, 2012; 15:05
joe j
Re: create multiple tables in a single query
Apr 04
Rick James Re: create multiple tables in a single query
Apr 04, 2012; 09:18
Rick James
Re: create multiple tables in a single query
Apr 04
joe j Re: create multiple tables in a single query
Apr 04, 2012; 19:56
joe j
Re: create multiple tables in a single query
Apr 05
Johan De Meersman Re: create multiple tables in a single query
Apr 05, 2012; 10:38
Johan De Meersman
Re: create multiple tables in a single query
Apr 05
Johan De Meersman Re: create multiple tables in a single query
Apr 05, 2012; 10:50
Johan De Meersman
Re: create multiple tables in a single query
Apr 05
joe j Re: create multiple tables in a single query
Apr 05, 2012; 11:32
joe j
Re: create multiple tables in a single query
Apr 05
Jan Steinman Re: create multiple tables in a single query
Apr 05, 2012; 09:04
Jan Steinman
Re: create multiple tables in a single query
Apr 05
joe j Re: create multiple tables in a single query
Apr 05, 2012; 21:36
joe j
Re: create multiple tables in a single query
Apr 06
Johan De Meersman Re: create multiple tables in a single query
Apr 06, 2012; 16:02
Johan De Meersman
Re: create multiple tables in a single query
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!