Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Numerical data types
Integer data types
6. Using SELECT with numeric data types
Floating point data types
Decimal data types
Summary

Instruction

See what's happened? You can't insert an out-of-range number for the same reason you can't insert a text value – it simply won't fit!

Now that we understand what will fit into a numeric-type column, let's see what we can do with the numbers. You can use mathematical operators (like + or *) and logical operators (like <=) in SQL statements with number columns. Take a look at the example below:

SELECT
  *
FROM premium_account
WHERE user_id = 5;

This will select all the information for the user with the ID of 5. Piece of cake!

Exercise

Premium accounts are starting to sell like hotcakes! Given that the user with user_id = 1 is Peter, select all information from table premium_account where the user_id is greater than 1. Let's see how many premium accounts have been purchased.

Stuck? Here's a hint!

Type:

SELECT
  *
FROM premium_account
WHERE user_id > 1;