Sunteți pe pagina 1din 15

Database Basic

Table
Customers
Record (Row)
Customers

a record
Field (Column)
Customers

a field
Table

 “A table is the primary unit of physical storage for


data in a database.”
 A collection of records that describe similar data.
 Usually a database contains more than one table.
Primary Key
Customers

primary key field

Primary key is a unique identifier of records in a table.

Primary key values may be generated manually or automatically.


Primary Key
Roles (Performances)

primary key fields

A primary key can consist of more than one field.


Primary key

 A primary key organizes your data by uniquely identifying


each record.
 A primary key prevents duplicate records from being entered
into a table.
 Tables by default are sorted by primary key.
 Your database could freak out if you don’t have a primary
key.
 Without a primary key, finding the requested records can be
difficult for Access.
 The key can be the first field, the last field, or buried in the
middle.
Table Indexing

 A database index is a data structure that improves the


speed of data retrieval operations on a database table.
 Indexes are “built” on a column(s).
 Tables by default are sorted by primary key.
 Indexes occupy disk space; occasionally a lot.
 Indexes aren’t technically necessary for operation and
must be maintained by the database administrator.
Why are index useful ?
Example Health Insurance Card

Power of two
primary key field Foreign Key parent table

Directors

relationship child table


Movies

The key field’s data identifies matching


records from different tables.
foreign key field
A Database with Multiple Tables

Publishers Books Customers

Authors Inventory Orders


Relationship Types
 One-to-many
One-to-many relationships connect one record in the first
table to many records in the second table. This is the default
— and by far the most common — relationship type.
 One-to-one
One-to-one relationships link one record in the first table to
exactly one record in the second table. Tables that have a
one-to-one relationship can be combined into one table,
which usually happens.
 Many-to-many
Many-to-many relationships link many records in one table to
many records in another table. To implement such
relationships physically via a third table.
Data Types

 Alphanumeric (Text, Memo)


 Numeric (Number, Currency, etc.)
 Date/Time
 Boolean (Yes/No)
Database Types

 Flat-file
 Hierarchical
 Network
 Relational
 Object-oriented
 Object-relational

S-ar putea să vă placă și