Question: A database table has the form {CountryCode, Year, CarbonEmissions}. I am interested in comparing how countries have compared with the UK in their emissions over
A database table has the form \{CountryCode, Year, CarbonEmissions\}. I am interested in comparing how countries have compared with the UK in their emissions over the years. My first attempt at an SQL query to look at this is below: SELECT * FROM Emissions JOIN Emissions on (Countrycode-Countrycode) WHERE CountryCode="UK"; Unsurprisingly this doesn't work. Select ALL applicable reasons and suggestions a. Since Year is not used in the join, this will compare all values with all values b. INNER JOIN would be a more effective join type c. NATURAL JOIN would be a more effective join type d. SELECT DISTINCT would remove the duplicate entries that this query creates e. The WHERE constraint will remove all non-UK entries. Presumably, the intention was to apply it to one of the two countryCode columns (setting each country next to the UK) f. A SUBSELECT would make this clearer 9. The table is being joined twice, and so the same column names recur. At least one table needs an alias. h. Using " in the SELECT will not work because of the JOIN clause
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
