the basic elements of database

3

Click here to load reader

Upload: venice-dato

Post on 14-Jul-2016

222 views

Category:

Documents


4 download

DESCRIPTION

Database

TRANSCRIPT

Page 1: The Basic Elements of Database

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 O W

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, First name, Last Name, Address, City

STUDENT TABLEStudent ID First Name Last Name Address City

3. RECORDS – The table records contain the actual data for the colmuns

Ex.: 001, Marlon, Angelo, #125 St. Manila

Student ID First Name Last Name Address City001 Marlon Angelo #125 St. Manila002

Page 2: The Basic Elements of Database

0034. 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:

AUTHOR’S TABLEAuthor’s ID Name Email Biography

BOOKLIST TABLEBook ID Title Authors ID Cost Category Description

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 2ID Value ID Value1 A 1 A2 B 2 B

Page 3: The Basic Elements of Database

ONE-TO-MANY

Table 1 Table 2ID Value ID Value1 A 1 A2 B 2 B

MANY-TO-MANY

Table 1 Table 2ID Value ID Value1 A 1 A2 B 2 B