Only this week, get the SQL Complete Track of 9 courses in a special prize of $330 $89!
3. First, a quick review
So you think you can count?
Rounding functions and more
Review and practice


Before we continue, let's review what we already know about numbers. Integers are expressed in the following way: 1, 2, 43, -27, etc. Floating-point numbers are expressed with a dot (.): 12.45, -401.238, etc. Please note that in some languages, you use a comma instead of a dot, but not in T-SQL! For example, 12,45 is incorrect.

In SQL Server (and in most programming languages) there are three kinds of numbers:

  • integer (int): stores integers or "normal" numbers (e.g., -5, 0, 5, 42),
  • floating-point (float): stores floating-point numbers by approximating them in binary,
  • decimal: stores floating-point numbers without approximation, as their exact numerical representation.

We'll discuss some of the differences between SQL Server's numeric data types. Of course, you can use the four basic mathematical operations (add +, subtract -, multiply *, and divide /) with actual numbers in T-SQL. You can also use columns and constant numbers together. Take a look at the example below:

  HP / 4 AS QuarterHP
FROM Character;


For each character, display its name, level, and the sum of its HP and MP. Name the column HMP.

Stuck? Here's a hint!

You can add columns with a plus (+).