0% found this document useful (0 votes)
23 views88 pages

Database Slides

Data base lecture for second year students
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views88 pages

Database Slides

Data base lecture for second year students
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

DATABASE

MANAGEMENT
An Introduction
Lecture objective:

•Define basic database terms


•Describe database before the use of
computers
•Identify the advantages of using a
database
•Identify the disadvantage of file
processing
Definition of terms:

•DATA
- raw facts, text, graphics,
images, sound, video segments
•DATABASE
• A collection of related data organized in a
way that facilitates data searches.
Definition of terms:

INFORMATION
-Processed data that is useful in
decision making.

METADATA
-Data that describes data
Summarized data :

Useful information that managers can use for


decision making and interpretation
Example of a Student Database

Types of Data Collected in a Typical Student Database


Metadata
Descriptions of the properties or characteristics of the data,
including data types, field sizes, allowable values, and
documentation.
Data in Context
Databases Before the Use of Computers

•Data was stored in:


•books
•ledgers
•card files
•folders
•file cabinets
•or simply in people’s heads!?
Computers make the
process of storing and
managing data easier
Disadvantages of File Processing

Program-Data Dependence
–All programs maintain metadata for each file they
use
Data Redundancy (Duplication of data)
–Different systems/programs have separate copies of
the same data
Limited Data Sharing
–No centralized control of data
Lengthy Development Times
–Programmers must design their own file formats
Excessive Program Maintenance
–80% of information systems budget
Three file processing systems at
Pine Valley Furniture
Duplicate Data
THE DATABASE APPROACH
Database Management System
•software application which allows you
to create, store, organize, and retrieve
data from a single database or many
databases.

Example: MS Access, MySQL, SQL


Server, Oracle, SyBase, DB2
THE DATABASE APPROACH

Application
#1

Application
#2

DBMS Database
containing
centralized
shared data

Application
#3 DBMS manages data
resources like an operating
system manages hardware
resources
ADVANTAGES OF DATABASE APPROACH
Program-Data Independence
•Metadata stored in DBMS, so applications don’t
need to worry about data formats
•Data queries/updates managed by DBMS so
programs don’t need to process data access
routines
•Results in: increased application development and
maintenance productivity

Minimal Data Redundancy


•Leads to increased data integrity/
consistency
ADVANTAGES OF DATABASE APPROACH

Improved Data Sharing


•Different users get different views of the data
Enforcement of Standards
•All data access is done in the same way
Improved Data Quality
•Constraints, data validation rules
Better Data Accessibility/ Responsiveness
•Use of standard data query language (SQL)
Security, Backup/Recovery, Concurrency
•Disaster recovery is easier
COST AND RISKS OF DATABASE APPROACH
Up-front costs:
–Installation Management Cost and
Complexity
–Conversion Costs
Ongoing Costs
–Requires New, Specialized Personnel
–Need for Explicit Backup and Recovery
Organizational Conflict
–Old habits die hard
BASIC COMPONENTS OF A DATABASE
•Tables
•how entities are represented in a database,
where each row is a record and each column
a field.

•Fields
•individual pieces of information

•Record
•collection of related fields within one entity
SAMPLE DATA TABLE

PersonalInfoTABLE
KEY DATABASE ISSUES AND ACTIVITIES

•Entering and Querying Data


•Creating Database Reports
•Data Structure
•Data Type
ENTERING DATA

•Data Entry
•process of adding information into a
database
•possible methods of data entry:
•Data Entry Professional, Electronic
Files, Historical Records, or Web Based
(Forms)
QUERYING DATA
•Querying:
•how we get information from a database

•Structured Query Language (SQL):


•most common language used to interface
with databases
•Example:
SELECT DISTINCTROW STUDENT_ID, GRADE
FROM GRADES
WHERE GRADE = “A”
ORDER BY STUDENT_ID;
Querying Data continued…

•Query By Example (QBE)


•enables you to fill out a grid, or
template, in order to construct a
description of the data you would like
to retrieve.
CREATING DATABASE REPORTS

•Report
•A compilation of data from the
database that is organized and
produced in a printed format.
•Typically produced on paper, but
also can be displayed on-screen.
Creating Database Reports
•Report:
•Example: Quarterly Sales Report
DATA STRUCTURE
•Database has two parts:
• Data
• Data Structure: how the data is organized.
•Data Model
• representation of entities and their relationships
to the real world
•Primary Key
• a unique identifier in the database
• one or more fields
Data Structure continued….

Primary Key is Student ID


DATA TYPE
•Data Type:
•each field in the database needs to be
of a certain type
•Examples: text, number, dates

•Data Dictionary:
•a document (often published online)
prepared by the database designers to
aid users in data entry.
Data Dictionary Example:

Students Table

Primary Key Field Name Field Type Field Length


yes Student ID Number 9
no Last Name Text 20
no First Name Text 15
Database Management
Introduction to
Microsoft ACCESS

30
MICROSOFT ACCESS

-is a relational database management


system for Microsoft Windows.

- you can store data in table, query,


form, macro, report, and module.

31
STARTING MICROSOFT ACCESS

1. Click the start button


2. Point to programs
3. Point to Microsoft office
4. Click Microsoft Access
5. Microsoft Access Dialog box appears
6. Click cancel

32
STARTING MICROSOFT
ACCESS
1. Search
2. Type ACCESS / or click

33
DATABASE WINDOW

34
CREATING DATABASE
1. Type Database Filename [StudentInfoDatabase]

Filename

2. Click CREATE Button


35
CREATING DATABASE
1. Click Design View to add Fields
Design
View

2. Type TABLE Name [StudentInfoTable]


36
CREATING TABLES

A table is a grouping of related data


organized in fields (columns) and
records (rows) on a datasheet. By using
a common field in two tables, the data
can be combined. Many tables can be
stored in a single database.

37
CREATING TABLES

38
CREATING DATABASE
3. Type the relevant Fields

Field Name

39
CREATING DATABASE
3. Type at least 5 records in the
Datasheet View
Datasheet
View

40
CREATING TABLES

A field is a column on a datasheet and


defines a data type for a set of values in a
table. For a mailing list table might include
fields for first name, last name, address,
city, state, zip code, and telephone
number.

A record in a row on a datasheet and is a


set of values defined by fields. In a mailing
list table, each record would contain the
data for one person as specified by the
intersecting fields.
41
TABLE DATASHEET VIEW

The Datasheet view allows you


to enter data or record into the
database.

42
TABLE DATASHEET VIEW

43
DATABASE WINDOW
The Database Window organizes all of the
objects in the database. The default tables
listing provides links for creating tables and
will list all of the tables in the database when
they have been added.

44
PARTS OF THE MS ACCESS
WINDOW
Database Window Menu bar – Located
directly under the title bar. Contains different
menu pads such as the file, edit, View, Insert,
Tools, Window, and Help where options appear.
These options are available at is customized and
on the type of mode is currently in.

45
PARTS OF THE MS ACCESS
WINDOW

Database / Standard toolbar – Located


below the menu bar. Enables you to quickly
and easily perform common task while
using the Access program. You can assign
custom buttons on a toolbar to do special
routines as well.

46
PARTS OF THE MS ACCESS
WINDOW

Database Window Title bar – Displays


the name of the open database

47
DIFFERENT DATABASE OBJECTS

OBJECT

48
DIFFERENT DATABASE OBJECTS
Table - storage of data about a
particular subject.

Query - display record as per design.


- manipulate / extract data
( getting the data we want )

49
DIFFERENT DATABASE OBJECTS

Form - a paper link display of


records ( individual )

Report - a printable output w/c


summarize the records.

50
DIFFERENT WAYS DESCRIPTION
TO CREATE TABLE

1. Datasheet View Enter directly into a blank


datasheet

2. Design View Use design view to specify all of


your table details from scratch

3. Table Template This Wizard creates new table to


store data.

51
Table Template

52
TABLE DESIGN VIEW
Design View customizes the
fields in the database so that
data can be entered.

53
TABLE DESIGN VIEW PARTS

Field Name
- variables that represents data up to 255
characters including spaces.

Data Type
- kinds of data to be stored in a field
Ex. Text, Number, Date/Time

Field Description
- a remarks that will help to describe the
field name.

54
Field Properties
- use to customized how a field’s
data is stored, handled, or displayed.

For ex., you can control the maximum


number of characters that can be entered into
a field by setting its field size properties.

55
DATA TYPES
Text
- can store numbers, letters, symbols,
and special characters.
- a text field can contain up to 255 char.

Example:
 names
 address
 course
 position

56
DATA TYPES

Memo
- contains the same type of
information as text fields, but can be as
many as 32, 000 character long.

Example:
 Reminder
 Notes
 Job Description

57
DATA TYPES

Number
- numeric data
- perform calculation (computation )

Example:
 Employee Number
 Transaction Number
 Invoice number
 Item Code
58
DATA TYPES

Date/Time
- can contains any valid date or
time for the year 100 through
9999.

Example:
 Birthdate
 Date Hired
 Delivery Date
59
DATA TYPES
Currency
- contains number only. Number
are automatically preceded by a
currency symbol (₱).
Currency fields are similar to number fields but
provide greater accuracy for performing
calculations.

EXAMPLES:
Salary
Total Amount Due
Rental Rate 60
DATA TYPES

AUTONUMBER
- contains numbers, which
automatically increase when a new
record is added to a table.

Example:
 Transaction Number

61
DATA TYPES
Yes/No
- contains only yes/no,
true/false, or on/off values.

Example:
 Regular
 Graduating

62
DATA TYPES

OLE Objects
- contains object linking and
embedding objects, such as graphics,
created in other windows applications.

Example:
 Employee Picture
 Product Image

63
RENAMING COLUMN
To rename them with more descriptive titles
that reflect the content of the fields, select
Format|Rename Column from the menu bar
or highlight the column, right-click on it with the
mouse, and select Rename Column from the
shortcut menu.

SAVING TABLE
Enter data into the cells and click the Save
button. You will be prompted to add a
primary key field.
64
RESIZING COLUMN and ROW

The height of rows on a datasheet can be


changed by dragging the gray sizing line
between row labels up and down with the
mouse. By changing the height on one
row, the height of all rows in the
datasheet will be changed to the new
value.

65
FREEZING COLUMNS
Similar to freezing panes in Excel, columns on
an Access table can be frozen. This is helpful if
the datasheet has many columns and relevant
data would otherwise not appear on the screen
at the same time. Freeze a column by placing
the cursor in any record in the column and
select Format|Freeze Columns from the
menu bar. Select the same option to unfreeze a
single column or select Format|Unfreeze All
Columns.

66
ADD NEW RECORDS

Add new records to the table in datasheet


view by typing in the record beside the
asterisk (*) that marks the new record.
You can also click the new record
button at the bottom of the datasheet to
skip to the last empty record.

67
VIEW RECORDS

View existing records to the table in


datasheet view by clicking the arrow
buttons at the bottom of the datasheet
to move to either previous, next, first
and last record.

First record Next record Last record


previous record
68
EDIT RECORDS
1. To edit records, simply place the cursor in
the record that is to be edited and make
the necessary changes.
2. Use the arrow keys to move through the
record grid.
3. The previous, next, first, and last record
buttons at the bottom of the datasheet are
helpful in maneuvering through the
datasheet.

69
DELETE RECORDS

Delete a record on a datasheet by


placing the cursor in any field of the
record row and select Edit|Delete
Record from the menu bar or click the
Delete Record button on the
datasheet toolbar.

70
Database Management

FIELD PROPERTIES AND


VALIDATION
RULE/TEXT

71
FIELD PROPERTIES

Field Properties are settings that


determine how data in tables, and reports is
stored, handled, and displayed.

72
FIELD PROPERTIES

Field Size – defines the length of a text


field.
Format – governs the display of dates and
numbers. Choose a format from the drop
down list.
Input Mask – provides a visual mask to
guide input. Use an Input Mask Wizard for
certain standard formats.
73
FIELD PROPERTIES
Caption – appears instead of the field name in
column headings, labels on forms, headings in
reports, etc.
Default Value – is automatically inserted into
the field when the record is created. The user
can type in another value, which replaces the
default.
Validation Rule – an expression, which
governs the way in which data has to input.
74
FIELD PROPERTIES
Validation Text – the text that is displayed
if the validation rule is broken.
Required – data must be entered in this
field.
Allow Zero Length – applies to text and
memo fields. It allows a value of space.
This is different to a null value, which a field
has if nothing has been entered.
75
FIELD PROPERTIES
Indexed – this speeds up searching. If you believed
you will make frequent searches on this field, you
should index it. The values are No (the default), Yes
(duplicates OK), and Yes (No Duplicates). Primary
fields are automatically assigned as indexed (No
Duplicates).
Unicode Compression – this option is available
for text, memo,and hyperlink data type. When
enabled it reduces the amount of storage space
required by these data types. In the majority of
cases this option should be enabled.
76
FIELD PROPERTIES
Text Format
Datasheet
Symbol Format Display Explanation
Entry
@ indicates a
@@@-
@ 1234567 123-4567 required
@@@@
character or space
& indicates an
@@@-
& 123456 123-456 optional
@@@&
character or space

< converts characters


< < HELLO hello
to lowercase

> converts characters


> > hello HELLO
to uppercase

\ adds characters to
@\! Hello Hello!
the end
@;"No Data
Hello Hello
Entered"
@;"No Data
(blank) No Data Entered
Entered"
77
FIELD PROPERTIES

78
FIELD PROPERTIES

NUMBER FIELD SIZE

Byte
0 to 255 ( no fraction )

Integer
-32,768 to 32,767 ( no fraction )

Long Integer
-2,147,483,648 to 2,147,483,647 ( no fraction )

79
FIELD PROPERTIES

NUMBER FIELD SIZE

Single
store number with six digits of precision
-3.402823E38 to 3.402823E38

Double
store number with ten digits of precision
-1.79769313486232E308 to
1.79769313486232E308

80
FIELD PROPERTIES

By default, data in Yes/No fields displays


No. You can also specify that data in
Yes/No fields display as True/false or
On/Off.

81
VALIDATION RULE AND TEXT
Validation rules specify requirements for
field data entry and prevent the entry of
invalid data.

This rule is applied when you enter data


into the field. You cannot tab to the next
field until you enter something that satisfies
the rule, or undo your entry.

82
VALIDATION RULE AND TEXT
You can use the ValidationRule property to
specify requirements for data entered into a
record, field, or control.

Note The Validation Rule and Validation


Text properties don't apply to check box,
option button, or toggle button controls
when they are in an option group. They
apply only to the option group itself.
. 83
VALIDATION RULE AND TEXT
Setting

Enter an expression for the ValidationRule


property setting and text for the ValidationText
property setting. The maximum length for the
ValidationRule property setting is 2048
characters. The maximum length for the
ValidationText property setting is 255 characters.

84
VALIDATION RULE AND TEXT
You can set the ValidationRule and
ValidationText properties by using:

nThe Field Properties section of table Design


view (for a field validation rule).
nThe property sheet for a table by clicking
Properties on the View menu in table Design
view (for a record validation rule).
nThe property sheet for a control on a form.
nA macro or Visual Basic. In Visual Basic, use a
string expression to set these properties.
85
VALIDATION RULE AND TEXT

Will display this message box

86
VALIDATION RULE AND TEXT

87
VALIDATION RULE AND TEXT
ValidationRule property ValidationText property

<> 0 Entry must be a nonzero value.

> 1000 Or Is Null Entry must be blank or greater


than 1000.

Like "A????" Entry must be 5 characters


and begin with the letter "A".

>= #1/1/96# And <#1/1/97# Entry must be a date in 1996.

Like “*[0-9]*” Entry must be digits only

88

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy