What Type of Data Are You Trying to Express?

The type of data used in an expression impacts the value the expression returns, so let’s first look at some of the data types the SQL Standard provides. Every column in the database has an assigned data type that determines the kind of values the column can store. The data type also determines the operations that can be performed on the column’s values. You need to understand the basic data types before you can begin to create literal values or combine columns and literals in an expression that is meaningful and that returns a proper value.

The SQL Standard defines seven general categories of types of data—character, national character, binary, numeric, Boolean, datetime, and interval. In turn, each ...

Get SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.