Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Returning all data from a table
Select some columns
Filtering rows
Logic
Text patterns
15. Unicode text
To be or NULL to be
A bit of mathematics
Let's practice

Instruction

Great! You know how to use text in your queries. However, what happens if you want to use non‐standard characters like ? These are called Unicode characters, and you can't use them like you did in the previous exercise. Look at the code below:

SELECT
  *
FROM User
WHERE Zodiac = N'♍';

The N before the string indicates that the string is in Unicode fomat. The Unicode standard provides lots of symbols that aren't available in regular text in T-SQL, such as the ∫ (integral), ♈ (the Aries zodiac sign), ☿ (the astrological sign for Mercury), and many others.

It's a good idea to use Unicode if you work with international data. That way, the strings you type will support characters from different alphabets. When using Unicode, it is common practice to place the N before all string literals. We're going to follow that practice throughout this course.

Exercise

Run the template query, which selects all cars whose current owner isn't the first owner.

Stuck? Here's a hint!

Click the Run and check code button.