The Basic Elements of Database:
DATABASE - is a collection of information that is organized so that it can easily be
accessed, managed, and updated.
Sample of Database name: "PSBA Database"
This database name contains school information like students, teachers,
books, department, etc.
1. TABLE - every database consist of one or more tables, which stores
databases data/ information. Each table has its own unique name and
consists of columns and rows.
C
R
L
U
M
N
Ex.: Table name: "student table"
This table contains information about students and books.
2. FIELD The database table columns (called also table fields) have their own
unique names and pre-defined data types.
Example: Column or fields for the table name students are given below.
Student ID,
Student ID
First name,
First Name
Last Name,
Address,
STUDENT TABLE
Last Name
Address
City
City
3. RECORDS The table records contain the actual data for the colmuns
Ex.:
Student ID
001
002
001, Marlon, Angelo,
First Name
Marlon
#125 St. Manila
Last Name
Angelo
Address
#125 St.
City
Manila
003
4. DATA TYPES determine the type of data that can be stored in a database
column.
THREE (3) COMMONLY USED DATA TYPES:
Alpha numeric used to store characters, numbers, special
characters or nearly any combination.
Numeric used to store only numeric data/ values.
Data type used to store date and time value.
5. KEYS is a column value in a table that is used to either uniquely identify a
row of data in a table, or establish a re;ationship with one another table.
TWO (2) TYPES OF KEYS
Primary key are typically used to join related tables.
Foreign key used as a reference of a primary key in another table.
Illustration:
AUTHORS TABLE
Authors
ID
Book ID
Title
Name
Email
BOOKLIST TABLE
Authors
Cost
ID
Biograph
y
Category
Descripti
on
6. RELATIONSHIPS are established through the use of primary and foreign
keys.
Three types of table relationships that can be derived are as follows:
One-to-one one record in a table is related to only one record in
another table.
One-to-many one record in a table can be related to many
records in another table.
Many-to-many one record in a table can be related to one or
more records in another table, and one or more records in the
second table can be related to one or more records in the first
table.
ONE-TO-ONE
Table 1
Table 2
ID
1
2
Value
A
B
ID
1
2
Value
A
B
ID
1
2
Value
A
B
ONE-TO-MANY
Table 1
ID
1
2
Table 2
Value
A
B
MANY-TO-MANY
Table 1
ID
1
2
Table 2
Value
A
B
ID
1
2
Value
A
B