Session Ready
Exercise

Concatenating data

Assembling a string from parts is done quite often in SQL Server. You may need to put together information from different columns and send the result as a whole to different applications. In this exercise, you will get familiar with the different options for concatenating data.

You will create a message similar to this one: "Chocolate with beans from Belize has a cocoa percentage of 0.6400".

The sentence is created by concatenating two string variables with data from the columns bean_origin and cocoa_percent, from the ratings table.

For restricting the number of results, the query will select only values for the company called "Ambrosia" and bean_type is not unknown.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Create a message similar to this one: "Chocolate with beans from Belize has a cocoa percentage of 0.6400" for each result of the query.
  • Use the + operator to concatenate data and the ' ' character as a separator.