String functions
There are a number of string functions that can be used to alter strings. A description of a few of these functions are shown below:
- The
LOWER(fieldName)function changes the case of all characters infieldNameto lower case. - The
INITCAP(fieldName)function changes the case of all characters infieldNameto proper case. - The
LEFT(fieldName,N)function returns the leftNcharacters of the stringfieldName. - The
SUBSTRING(fieldName from S for N)returnsNcharacters starting from positionSof the stringfieldName. Note that bothfrom Sandfor Nare optional.
Deze oefening maakt deel uit van de cursus
Reporting in SQL
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
-- Convert country to lower case
SELECT
country,
____ AS country_altered
FROM countries
GROUP BY country;