This SQL tutorial explains how to use literals (strings, integers, decimals, and datetime values) in SQL with examples.
In SQL, a literal is the same as a constant. We'll cover several types of literals - string, integer, decimal, and datetime literals.
String literals are always surrounded by single quotes (').
'This is a literal'
These string literal examples contain of strings enclosed in single quotes.
Integer literals can be either positive numbers or negative numbers, but do not contain decimals. If you do not specify a sign, then a positive number is assumed. Here are some examples of valid integer literals:
Decimal literals can be either positive numbers or negative numbers and contain decimals. If you do not specify a sign, then a positive number is assumed. Here are some examples of valid decimal literals:
Datetime literals are character representations of datetime values that are enclosed in single quotes. Here are some examples of valid datetime literals:
'April 30, 2015'