Changing to lowercase and uppercase
Most of the time, you can't make changes directly to the data from the database to make it look more user-friendly. However, when you query the data, you can control the aspect of the results, and you can make them easier to read.
Working with functions that manipulate string values is easy and gives great results.
In this exercise, you will see how easy it is to work with the functions that transform the characters from a string to lowercase or uppercase.
The purpose is to create a message mentioning the types of cocoa beans used by each company and their country of origin:
The company BONNAT uses beans of type "Criollo", originating from VENEZUELA .
Cet exercice fait partie du cours
Functions for Manipulating Data in SQL Server
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
SELECT
company,
bean_type,
broad_bean_origin,
'The company ' + company + ' uses beans of type "' + bean_type + '", originating from ' + broad_bean_origin + '.'
FROM ratings
WHERE
-- The 'broad_bean_origin' should not be unknown
___ NOT LIKE '%unknown%';