The question says:
Retrieve all unique countries of all publishers.
The column from where I'm supposed to retrieve the countries is the following:
Table: Publisher
Column: Address
Rows:
- Hoboken, New Jersey, United States
- London, United Kingdom
- New York, New York, United States
- New York, New York, United States
- New York, New York, United States
Now, I understand that the answer is asking me is to display: Unites States, United Kingdom. However, the countries are in a string with city, state and country in the case of USA and city and country in the case of UK.
I don't know how to separate the column address into columns, so then I can retrieve the unique values for the countries.
I tried using SUBSTR() and SUBSTRING(), but I have to write the string inside, and I don't know how to write it all into one function.
', '. To find the last occurrence of something, reverse the string first and search that reversed string. If you have difficulties with some specific code, by all means ask that question, but for now I recommend reading tutorials or manuals on REVERSE, LOCATE, CHAR_LENGTH and SUBSTRING. Here's a starter: stackoverflow.com/questions/12775352/…