Export School Specific Delegation Lists for MUN using SQLSeptember 19, 2012
Some creative thinking lead to the process described below, which creates tables containing only the specific countries/delegations and committees for a school using a “master” Excel document containing all delegations from all schools for a Model United Nations conference. Another idea was to use Excel VBA code to only export rows that meet certain conditions to a Word document. I was more comfortable with SQL, so I came up with this method.
- Create a delegation list in Excel with countries as rows and commmitees as columns.
- Export delegation list from Excel into CSV format.
- Create SQL database:
CREATE TABLE `delegations` ( `Delegation` varchar(255) DEFAULT NULL, `GA1` varchar(255) DEFAULT NULL, `ECOSOC` varchar(255) DEFAULT NULL, `GA3` varchar(255) DEFAULT NULL, `GA4` varchar(255) DEFAULT NULL, `SC` varchar(255) DEFAULT NULL, `AP` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- Import the CSV file into the SQL database, set the first line as the table columns if prompted.
- Use SQL queries to create specific sets of delegations to send to schools:
SELECT * FROM delegations WHERE GA1='CISS' OR ECOSOC='CISS' OR GA3='CISS' OR GA4='CISS' OR GA4='CISS' OR SC='CISS' OR AP='CISS'
- Export sets into CSV, convert to XLS or Word or PDF to send to schools.