Part A: SQL Queries (40 marks)
Use the Prime_Minister_2013 database (prime_minister_2013.sql) from the ITC114 Interact Resources site. Answer the following queries from that database.
You are required to submit:
1. The appropriate SQL statements for each query, which should be copied from your SQL code in MySQL and pasted into your submission file; and
2. Screenshots of the resultant tables which are to be pasted into your submission file immediately after the SQL code for that query. Typing or manually drawing the results is NOT acceptable.
NOTE: Your SQL code should be correct for any data, not just any sample data that you create.
Write SQL SELECT statements to retrieve the following information from the Prime_Minister_2013 database:
1. Find the Governors General of Australia who were Barons at the time of their appointment. List them by Title, Name and the date that they were appointed to the position. The date is to be formatted as day of the week, day of the month, month and year; eg. Monday, 01 January, 1901. Order the list by ascending date of appointment. (5 marks)
2. Who were the Leaders of the Opposition who were not members of a Labor party and who gained their position after 01/01/1980. List their name, date of election in the format month, day of week and year, eg: January 1st, 1980, spouse’s name and their year of marriage. Order the list by ascending date of appointment, then date of marriage (5 marks)
3. List the Title, Name and date of appointment for Governors General of Australia who were appointed between 01 January 1930 and 01 January 1960, together with the Prime Ministers who appointed them and all Leaders of the Opposition who served during their appointment. The date is to be formatted in dd/mm/yyyy format. Order by ascending date of appointment. (5 marks)
4. Who are the Opposition Leaders who subsequently became Prime Minister after 1930? List their name, the date they were elected Opposition Leader and the date they were elected Prime Minister and their Deputy Prime Minister’s name and the party that they led. The dates must be formatted as day of the week, day of the month, month in digits and year in four digits; eg. Monday, 01/01/1901. Order the list by ascending date of appointment as Opposition Leader. (10 marks)
5. Who are the Prime Ministers who led a non-ALP party before 1930? List the Prime Ministers name, the year they commenced as Prime Minister, their party, their Deputy Prime Minister, the number of times that they were elected as Prime Minister and the title and name of the Governor General at the time they commenced office. (15 marks)