You are on page 1of 26

Database Management Systems

DBMS
 A database management system (DBMS) is a
set of computer-based application programs
that support the processes of storing,
manipulating, retrieving and presenting the data
within the database.
• Acts as an interface between application
programs & physical data files

 The data within the database are organized into


tables, records, and fields.
Table
• “A table is the primary unit of physical
storage for data in a database.”1

• Usually a database contains more than


one table.
Table
A Database with Multiple Tables

[1]
Publishers Books Customers

Authors Inventory Orders


Table
Customers
Field (Column)
Customers

a field
Record (Row)
Customers

a record
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 field Foreign Key parent table

Directors

relationship child table


Movies

foreign key field


Relationship Types
• One-to-one

• One-to-many

• Many-to-many
Data Types
• Alphanumeric (Text, Memo)
• Numeric (Number, Currency, etc.)
• Date/Time
• Boolean (Yes/No)
Database Environments
• Mainframe

• Client/Server

• Internet-based
Definitions
• Relational database: A collection of tables.
• Table: A collection of columns (attributes) describing an entity. Individual
objects are stored as rows of data in the table.
• Property (attribute): a characteristic or descriptor of a class or entity.
• Every table has a primary key.
– The smallest set of columns that uniquely identifies any row
– Primary keys can span more than one column (concatenated keys)
– We often create a primary key to insure uniqueness (e.g., CustomerID,
Product#, . . .) called a surrogate key.

Primary key Properties


Class: Employee
Rows/Objects Employee
EmployeeID TaxpayerID LastName FirstName HomePhone Address
12512 888-22-5552 Cartom Abdul (603) 323-9893 252 South Street
15293 222-55-3737 Venetiaan Roland (804) 888-6667 937 Paramaribo Lane
22343 293-87-4343 Johnson John (703) 222-9384 234 Main Street
29387 837-36-2933 Stenheim Susan (410) 330-9837 8934 W. Maple
Characteristics of DBMS
Approach
• Self-contained nature
• Program-data independence
• Data abstraction
• Support for multiple views
• Centralised control of the data resource
• reduces redundancy
• avoids inconsistencies
• data can be shared
• standards can be enforced
• security restrictions can be applied
• integrity can be maintained
• Sharing of data
• Multiuser transaction processing
Advantages of DB
• Controlling Redundancy
• Restricting Unauthorized Access
• Providing persistent storage for program objects
• Proving storage structures for efficient query
processing
• Providing backup and recovery
• Providing multi-user interfaces
• Representing complex relationships among data
• Enforcing integrity constraints
• Permitting inferencing and actions using rules
• Additional implications of using the DB approach
Classification of DBMS
• Based on Data Model
– Relational, object, object-relational, hierarchical,
network
• Based on number of users
– Single-user and Multi-user
• Number of sites
– Centralized, Distributed, Homogeneous
• Cost
• Types of Access path
• General purpose or special purpose
Actors on the DBMS Scene
– Data administrator (DA)
– Database administrator (DBA)
– Database designers
– Users
– Casual end users
– Application programmers
Contents of a Database
• A Database contains:
– User Data
– Metadata
– Indexes
– Applications
User Data
• End-users work directly with the DBMS by entering, updating and
viewing the data. Typically they would use a query language (SQL)
• In a relational DB, data will be generally stored in tables with some
relationships between tables.
• Each table has one or more columns (attributes).
• For example, below is a bank account table.

Customer ID Acct Number Acct Type Date Opened Balance


1001 9987 Checking 10/12/1998 4000.00
1001 9980 Savings 10/12/1998 2000.00
1002 8811 Savings 1/5/1999 10000.00
1003 4422 Checking 10/1/2000 6000.00
1003 4432 Savings 12/11/2000 9000.00
1004 3294 Savings 8/22/1997 500.00
1004 5445 Checking 11/13/1996 800.00
Metadata
• Data about data.
• Data that describes how user’s data are stored in terms
of table name, column name, data type, length, primary
keys, etc.
• Metadata are typically stored in System tables and are
typically only directly accessible by the DBMS or by the
system administrator.
• For example, the metadata for the bank account table,
could be:
Indexes
• Allow users to access a specific record without having to search
through the entire table
– For example, indexes would be used to find all customers who
opened the account before 01/01/2000. In this case the bank account
table is indexed on date opened attribute (see below)
• Indexes provide efficient data access on one hand, but are
expensive to maintain: Updating data requires an extra step:
Index(s) must also be updated.

Customer ID Acct Number Acct Type Date Opened Balance


1004 5445 Checking 11/13/1996 800.00
1004 3294 Savings 8/22/1997 500.00
1001 9987 Checking 10/12/1998 4000.00
1001 9980 Savings 10/12/1998 2000.00
1002 8811 Savings 1/5/1999 10000.00
1003 4422 Checking 10/1/2000 6000.00
1003 4432 Savings 12/11/2000 9000.00
Forms/Report
Generators/Application Programs
• Many DBMS have the capability to handle forms (for users to
enter/access/update data), reports, and other application
components.
– Report is an organized representation, designed to be printed, of
the information in your tables or queries. You can create a report
from a single table or from a query of two or more tables
– Query allows you to ask questions of your information. Database
management system, such as Microsoft Access would use your
questions to generate a subset of he data in your database.
– Form is a convenient way to enter or find information in tables.
• Applications are various programs written in various languages
to access and manipulate the data. Each application is
designed for a specific aspect of a given functional area, e.g.,
payroll application, accounting, etc.
Data Modeling and Database
Design
• Database Schema: The structure of a database that:
– Represents data elements, data types, relationships among data
elements, and constraints on data
– Is independent of any application program
– Typically, changes infrequently
• Data Model:
– A set of primitives for defining the structure of a database.
– A set of operations for specifying retrieval, and updates on a database.
Design - example
• Design tables for the following scenario:-

• Stock management of a company


• 500 items
• Three types (A/B/C)
• Items receipt and issues on a daily basis
• Generate reports

You might also like