大象传媒

Relational databases

A uses tables to store data in the database. Each of these tables corresponds to an entity (anything about which we need to store data, like a person, place or thing).

Relationships are created between tables using key fields. Relationships can be classified as ONE to ONE, ONE to MANY, MANY to ONE and MANY to MANY.

Data types

A record structure allows for multiple different types of data to be stored. For example, a simple database may hold your name as text, your age as a number and your gender as a Boolean value (Male | Female).

Common data types utilised in databases are listed below:

Data typeDescriptionExample data
Number/integerThese are whole numbers onlyAge = 16
Real/floatThese are numbers that can have a decimal part0.1, 1.2, 3.4, 6.0
BooleanThis has two values only, true and falseTrue/False, 1/0, Y/N
CharacterThis is a single letter, number or symbolA, B, C, @, *
Text/stringThis is used for text, and can include any characterDigital Technology
Date/timeUsed for dates and times29/11/2016 20:55
CalculatedA formula to work something outAge: Current date minus date of birth
Data typeNumber/integer
DescriptionThese are whole numbers only
Example dataAge = 16
Data typeReal/float
DescriptionThese are numbers that can have a decimal part
Example data0.1, 1.2, 3.4, 6.0
Data typeBoolean
DescriptionThis has two values only, true and false
Example dataTrue/False, 1/0, Y/N
Data typeCharacter
DescriptionThis is a single letter, number or symbol
Example dataA, B, C, @, *
Data typeText/string
DescriptionThis is used for text, and can include any character
Example dataDigital Technology
Data typeDate/time
DescriptionUsed for dates and times
Example data29/11/2016 20:55
Data typeCalculated
DescriptionA formula to work something out
Example dataAge: Current date minus date of birth