Database CH 9
Database CH 9
Databases:
➜A database is a structured collection of data thatallows people to extract information
in a way that meets their needs.
➜Data can include text, images, numbers.
➜Single-table database contains only one table
➜
Data is stored in tables, which further consistsof records.
➜Records further consist of fields. Number of recordscan vary as data is entered or
deleted.
➜Number of fields is fixed
➜Records are rows
➜Fields are columns
TABLE
Column
➜
The table has a fixed name, such as TICKETS (thistable is for bus tickets)
➜Each record will be different with fields
➜Each field will have different data such as FirstName,LastName, TicketNo, BusNo,
and more. There will beno spacesin between
26
MOJZA
➜Example of a table:
TICKETS
TicketNo #1 FirstName #1 LastName #1 BusNo #1 Price#1 Destination #1
TicketNo #2 FirstName #2 LastName #2 BusNo #2 Price#2 Destination #2
TicketNo #3 FirstName #3 LastName #3 BusNo #3 Price#3 Destination #3
TicketNo #4 FirstName #4 LastName #4 BusNo #4 Price#4 Destination #4
TicketNo #5 FirstName #5 LastName #5 BusNo #5 Price#5 Destination #5
➜
Databases will also use validation checks when datais being entered
➜Validation checks of presence check, range check,type check, length check can be
done
➜
Each field will have a specific data type and willonly accept the data given in that
specific data type
➜There are 6 basic data types used in databases:
Data type Used for
➜
To identify a specific item, person or etc., a uniquefield is required
➜Unique here means no repetition of data
➜The field that is unique is called a Primary Key
➜In the database table, TICKETS, the primary keycan be the TicketNo field, as it has
no repetition of data and will be unique