Tutorial Addendum on SQL - Data Types and Literals
| |
With the bifold attention standard, the mantissa attention can go up to 52 bifold
digits, about 15 decimal digits.
For added details, see area "Binary Representation of float and bifold Values"
of my additional book " s Addendum on C#".
5. Data and Time - A date and time amount is usually stored in anamnesis as an exact
integer amount with 8 bytes apery an instance by barometer the time period
between this instance and a advertence time point in millisecond precision,
second atom attention of 3. How MySQL is abundance date and time values? We will
try to acquisition out later.
Data Literals
Now we understand the types of data, and how they are stored in memory. Next we charge know
how data can get in to the computer. One way is to access it through the program
source cipher as a data literal.
Data Literal: An program antecedent aspect that represents a data value.
Data literals can be disconnected into assorted groups depending the blazon of the data
it is apery and how it is representing.
1. Appearance Cord Literals are acclimated to assemble appearance strings, exact
numbers, almost numbers and data and time values. The syntax rules
of appearance cord literals are appealing simple:
- A appearance cord accurate is a arrangement of characters amid by adduce characters.
- The adduce appearance is the individual adduce appearance " ".
- If " " is allotment of the sequence, it needs to be angled it as " ".
Examples of appearance cord literals:
Accost world!
Loews L Enfant Capital
123
0.123e-1
1999-01-01
2. Hex Cord Literals are acclimated to assemble appearance strings and exact numbers.
The syntax rules for hex cord literals are aswell actual simple:
- A hex cord accurate is a arrangement of hex digits amid by adduce characters and
prefixed with "x".
- The adduce appearance is the individual adduce appearance " ".
Examples of hex cord literals:
x 41424344
x 31323334
x 31323334
x 01
x 0001
x ff
x ffffffff
x ffffffffffffffff
3. Numeric Literals are acclimated to assemble exact numbers and almost numbers.
Syntax rules of numeric literals are:
- A numeric accurate can be accounting in active accumulation form, active absolute numbers
without exponents, or absolute numbers with exponents.
Examples of numeric literals:
1
-22
33.3
-44.44
55.555e5
-666.666e-6
4. Date and Time Literals are acclimated to assemble date and time values.
The syntax of date and time literals are:
- A date accurate is accounting in the anatomy of "DATE yyyy-mm-dd ".
- A time accurate is accounting in the anatomy of "TIMESTAMP yyyy-mm-dd hh:mm:ss ".
Examples of data and time literals:
DATE 1999-01-01
TIMESTAMP 1999-01-01 01:02:03
|
literals, character, string, literal, numbers, quote, numeric, syntax, examples, precision, construct, values, digits, written, representing, characters, types, sequence, notes, , literals are, string literals, date and, hex string, character string, quote character, data and, time literals, numeric literals, time values, hex string literals, character string literals, single quote character, construct character strings, sql data types, |
Also see ...
5. Time Breach Literals are acclimated to assemble time intervals with differenttime units.A time breach accurate is accounting in the anatomy of "INTERVAL n unit", whereunit can be YEAR, MONT
Example 2 HexStringLiterals.sql: HexStringLiterals.sql Absorb (c) 1999 by Dr. Yang SELECT x 41424344 AS LINE_1;SELECT x 31323334 AS LINE_2;SELECT x 31323334 + 0 AS LIN
This affiliate describes:What are the types and levels of locks?How table akin locks plan in MySQL?How row akin locks plan in MySQL?br
We all understand that assorted locks in assorted sessions could couldcause deadlocks. Let s see if we can make a deadlock in MySQL amid two sessions: mysql Alert ;DROP TABLE IF EXISTS User;
This affiliate describes:What s in MySQL?How to use the SQL applicant apparatus mysql.How to dump data into files.How to amount data from fil
To assassinate the statements in hello.sql, you can use the "source" commandinside mysql: mysqlinmysql host localhost test......mysql antecedent hello.sqlQuery OK, 0 rows affli
This affiliate describes:Expressions.Arithmetic operations.Predicate operations.Date and time operations.Operation examp
Predicate OperationsPredicate operations are operations that can be evaluated to accord a action of true or false:1. "Comparison" Predicates: Compares
Operation ExamplesExample 1 NumericOps.sql NumericOps.sql Absorb (c) 1999 by Dr. Yang SELECT 1 + 2 AS LINE_1;SELECT 2 / 3 AS LINE_2;
This affiliate describes:What is a stored procedure?How to make a stored procedure.How to canyon data through parameters.