You are here: Articles > Computers & Technology > sql

 See more articles about "sql "

Tutorial Addendum on SQL - Data Types and Literals



 31 December 18:00   

    



    



    

This affiliate describes:

    



        

  • Data types.

        



  •     

  • Data bifold representations.

        



  •     

  • Data literals.

        



  •     

  • Data accurate evaluation.

        



  •     



    



    

All addendum in affiliate are based on SQL-92 and MySQL server.

    



    

Data Types

    



    

Like all additional computer languages, SQL deals with data. So let s first attending at how

    

SQL defines data.

    



    

Data Type: A accumulation of data that shares some accepted characteristics and operations.

    



    

SQL defines the afterward data types:

    



        

  • Character Cord - A arrangement of characters from a predefined appearance set.

        



  •     

  • Bit Cord - A arrangement of bit values: 0 or 1.

        



  •     

  • Exact Amount - A numeric amount who s attention and calibration charge to be preserved.

        

    Precision and calibration can be counted at decimal akin or bifold level. The decimal

        

    precision of a after amount is the absolute amount of cogent digits in decimal

        

    form. The decimal calibration of a after amount is the amount of apportioned digits in

        

    decimal form. For example, the amount 123.45 has a attention of 5 and a calibration of 2.

        

    The amount 0.012345 has a attention of 6 and a calibration of 6.

        



  •     

  • Approximate Amount - A numeric amount who s attention needs to be preserved, and

        

    scale floated to its exponent. An almost amount is consistently bidding in scientific

        

    notation of "mantissa"E"exponent". Agenda that an almost amount has two precisions:

        

    mantissa attention and backer precision. For example, the amount 0.12345e1 has

        

    a mantissa attention of 5 and backer attention of 1.

        



  •     

  • Date and Time - A amount to represent an instance of time. A date and time amount

        

    can be disconnected into some portions and accompanying them to a predefined agenda system

        

    as year, month, day, hour, minute, second, additional fraction, and time zone. A date

        

    and time amount aswell has a precision, which controls the amount of digits of the

        

    second atom portion. For example: 1999-1-1 1:1:1.001 has attention of 3 on the

        

    second atom portion.

        



  •     



    



    



    

Data Bifold Representations

    



    

Now we understand what types of data SQL haveto plan with. The next move is to accept

    

how altered types of data are represented in bifold forms. Back computers can only

    

work with bifold digits, we accept to represent all data in computer anamnesis in bifold forms.

    



    

1. Appearance Cord - A appearance cord is usually represented in anamnesis as an arrangement of

    

characters. Anniversary appearance is represented in 8 $.25 (one byte) or 16 $.25 (two bytes)

    

based on the appearance set and the appearance encoding schema. For example, with ASCII

    

character set and its encoding schema, appearance "A" will be represented as "01000001".

    

Character "1" will be represented as "00110001". Appearance cord "ABC" will be represented

    

as "010000010100001001000011".

    



    

2. Bit Cord - The bifold representation of a bit cord should be easy.

    

A bit cord should be represented in anamnesis as it is. Bit cord "01000001" should

    

be represented as "01000001". There ability an affair with anamnesis allocation, because

    

computer allocates anamnesis in units of bytes (8 $.25 per byte). If the breadth of

    

a bit cord is not multiples of 8 bits, the endure allocated byte is not full. How to

    

handle the abandoned amplitude in the endure byte? I assumption altered SQL accomplishing will

    

have altered rules.

    



    

3. Exact Amount - Exact numbers can be disconnected into two groups: integers and non-integers.

    

An accumulation is an exact amount with calibration of 0. An accumulation is represented in either 4 bytes

    

or 8 bytes based on the active bifold amount system. For example, with 4 bytes, integer

    

"1" will be represented as "00000000000000000000000000000001". Accumulation "-1" will be

    

represented as "1111111111111111111111111111111".

    



    

As for exact non-integer numbers, I don t understand absolutely how they will be represented

    

in bifold forms.

    



    

4. Almost Amount - An almost amount is commonly represented in bifold anatomy

    

according to the IEEE 754 single-precision or double-precision standards in either

    

4 bytes or 8 bytes. The bifold representation is disconnected into 3 apparatus with

    

different amount of $.25 assigned to anniversary components:

    

 

    

Assurance Backer Atom Total

    

Single-Precision 1 8 23 32

    

Double-Precision 1 11 52 64

    



    



    



 


 precision, binary, character, represented, string, value, scale, types, bytes, approximate, exponent, example, memory, exact, integer, different, fraction, digits, decimal, based, literals, forms, notes, divided, mantissa, second, , bit string, approximate number, data types, character string, divided into, binary forms, exact number, character set, precision and, bit string should, sql data types,

Share Tutorial Addendum on SQL - Data Types and Literals:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

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 "

Tutorial Addendum on SQL - Data Types and Literals
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

Tutorial Addendum on SQL - Data Types and Literals
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

Tutorial Addendum on SQL - Locks And Deadlocks
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

Tutorial Addendum on SQL - Locks And Deadlocks
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;

Tutorial Addendum on SQL - Addition to MySQL
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

Tutorial Addendum on SQL - Addition to MySQL
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

Tutorial Addendum on SQL - Operations and Expressions
This affiliate describes:Expressions.Arithmetic operations.Predicate operations.Date and time operations.Operation examp

Tutorial Addendum on SQL - Operations and Expressions
Predicate OperationsPredicate operations are operations that can be evaluated to accord a action of true or false:1. "Comparison" Predicates: Compares

Tutorial Addendum on SQL - Operations and Expressions
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;