Database - structured and persistent collection of data Relational databases - Field - A single type of data from a database table
- Relational database - more than one table linked
- Single table/flat file database together Record - A set of related fields on a single entity within a database
- makes processing more efficient - eliminate data table
- reduces storage requirements inconsistencies
- avoid redundancy - avoid data redundancy Table - A complete set of related record on the same topic/subject
Primary Key - A field that uniquely identifies a record in a table
Structure Query Language - Flat File Databases -
SELECT - list of fields to be displayed - only one table Foreign Key - Links tables together with a relationship. Becomes the
FROM - list of the table or tables - difficult to query primary key of a new table
where the data will come from - mainly used for small data sets
WHERE - list of search criteria - data is often duplicated (data redundancy)
ORDER BY ASC <field> - ascending - compromise data integrity (not consistent)
SYMBOL MEANING EXAMPLE
order - suffers from inconsistencies between records
ORDER BY DESC <field> - = Equal to Type = ‘dog’
descending order
Insert - > Greater than cost > 3000.00
- add new records, full, or partial, into a
database < Less than Distance < 2.5
INSERT INTO <table name> (<field1>,<field2>)
VALUES (<value1>,<value2>) <> Not equal to Type <> ‘dog’
>= Greater than or equal to DateOfBirth >=
#01/01/2019#
Update -
- update existing records <= Less than or equal to DateOfBirth <=
UPDATE <table name> #31/12/2018#
SET <field name> = <value>, <...> = <...>
WHERE <field name> = <condition> IN Equal to a value within a set of Type IN (‘dog’ , ‘cat’ ,
values ‘rabbit’)
Delete - BETWEEN . Within a range, including the two DateOfBirth BETWEEN
- delete records .. AND values which de ne the limits #01/01/2018# AND
DELETE FROM <table name> #31/12/2019#
WHERE <field name> = <condition>
IS NULL Field does not contain a value DateOfBirth IS NULL
Database Relationships -
AND Both expressions must be true for Type = ‘dog’ AND
the expression to be judged true gender = ‘M’
OR If either or both expressions are Type = ‘dog’ OR Type =
true, the expression is judged true ‘rabbit’
NOT Inverts truth Type NOT IN (‘dog’ ,
‘cat’)
fi