1. 12/4/2013
1
Database Basics
Good database design will get you through poor
programming better than good programming will get you
through poor database design….
Database Systems
• A database system consists
of
• Data (the database)
• Software
• Hardware
• Users
• We focus mainly on the
software
• Database systems allow
users to
• Store
• Update
• Retrieve
• Organise
• Protect
their data.
DATABASE MANAGEMENT SYSTEMS
• A database management system (DBMS) is
software that permits an organization to centralize
data, manage them efficiently, and provide access
to the stored data by application programs.
• The DBMS relieves the programmer or end user
from the task of understanding where and how
the data are actually stored by separating the
logical and physical views of the data
DBMS (Continued)
• The logical view presents data as they would be
perceived by end users or business specialists,
whereas the physical view shows how data are
actually organized and structured on physical
storage media.
• The database management software makes the
physical database available for different logical
views required by users
3. 12/4/2013
3
Database Tables
• Tables represent entities
• Tables are always named in the singular, such as:
Vehicle, Order, Grade, etc.
• Tables in database jargon are “flat files”, dBase or
Spreadsheet like..
Attributes
• Characteristics of an entity
• Examples:
• Vehicle (VIN, color, make, model, mileage)
• Student (SSN, Fname, Lname, Address)
• Fishing License (Type, Start_date, End_date)
Database Views
• A View is an individual’s picture of a database. It
can be composed of many tables, unbeknownst to
the user.
• It’s a simplification of a complex data model
• It provides a measure of database security
• Views are useful, primarily for READ‐only users and are
not always safe for CREATE, UPDATE, and DELETE.
5. 12/4/2013
5
Capabilities of database
management systems
• DBMS includes capabilities and tools for organizing,
managing, and accessing the data in the database.
• The most important are its
• data definition language,
• data dictionary, and
• data manipulation language.
Structured Query Language
• The most prominent data manipulation language
today is Structured Query Language SQL.
DDL,MDL,DCL
• Data Definition Language (DDL) statements are used to
define the database structure or schema. Some examples:
• CREATE ‐ to create objects in the database
• ALTER ‐ alters the structure of the database
• DROP ‐ delete objects from the database
• TRUNCATE ‐ remove all records from a table, including all spaces
allocated for the records are removed
• COMMENT ‐ add comments to the data dictionary
• RENAME ‐ rename an object
DDL,MDL,DCL
• Data Manipulation Language (DML) statements are used for
managing data within schema objects. Some examples:
• SELECT ‐ retrieve data from the a database
• INSERT ‐ insert data into a table
• UPDATE ‐ updates existing data within a table
• DELETE ‐ deletes all records from a table, the space for the records
remain
• CALL ‐ call a PL/SQL subprogram
• LOCK TABLE ‐ control concurrency
6. 12/4/2013
6
DDL,MDL,DCL
• Data Control Language (DCL) statements. Some examples:
• GRANT ‐ gives user's access privileges to database
• REVOKE ‐ withdraw access privileges given with the GRANT
command
CRUD !
• Refers to the most common Database Operations:
• Create
• Read
• Update
• Delete
• Operations occur at all levels: Tables, Records,
Columns
Types of Keys
PRIMARY KEY
Serves as the row level addressing mechanism in the relational
database model.
It can be formed through the combination of several items.
FOREIGN KEY
A column or set of columns within a table that are required to
match those of a primary key of a second table.
These keys are used to form a RELATIONAL JOIN ‐ thereby
connecting row to row across the individual tables.
Relational Database Management System
(RDBMS)
Name Address Parcel #
John Smith 18 Lawyers Dr. 756554
T. Brown 14 Summers Tr. 887419
Table A
Table B
Parcel # Assessed Value
887419 152,000
446397 100,000
8. 12/4/2013
8
Common Functions of DBA
• Database Planning
• Standards, procedures, enforcement
• Requirements Gathering and Conceptual Design
• Logical Design
• Physical Design and Implementation
• Testing and Debugging
• Operations and Maintenance
• Training and Support
DBA’s Responsibilities
DBA Activity DBA Service
Organizing Policies, Procedures,
Standards
Testing Data Security, Privacy, Integrity
Monitoring Data backup and Recovery
Data Security, Privacy and Integrity
• User Access Management
• Define each user to the database
• Operating System Level
• Database Level
• Assign Passwords
• Define User Groups
• Assign Access Privileges
• Read
• Write
• Delete
• Physical Access Control
• View Definitions
• Protect and Control the Scope of the Data that is accessible to a user
• DBMS utilities access control
• Limit the use of query and reporting tools
• DBMS usage Monitoring
• Audit Logs
(More difficult in distributed databases)
Data Backup and Recovery
• Disaster Management
• Periodic Data and Application Backups
• Full
• Incremental
• Concurrent
• Proper Backup Identification
• Convenient and safe backup storage
• Physical protection of hardware and software
• Personal Access Control to the software of a database
installation