Upload
abhishek-gupta
View
226
Download
0
Embed Size (px)
Citation preview
7/28/2019 42484900 Database Basics
1/26
Database Management Systems
7/28/2019 42484900 Database Basics
2/26
DBMS
A database management system (DBMS) is aset of computer-based application programsthatsupportthe processes ofstoring,
manipulating, retrieving and presenting thedata within thedatabase.
Acts as an interfacebetween applicationprograms & physical data files
Thedata within thedatabase are organizedinto tables, records, andfields.
7/28/2019 42484900 Database Basics
3/26
Table
A table is the primary unit of physical
storage for data in a database.1
Usually a database contains more than
one table.
7/28/2019 42484900 Database Basics
4/26
Table
7/28/2019 42484900 Database Basics
5/26
A Database with Multiple Tables
Publishers Books Customers
Authors Inventory Orders
[1]
7/28/2019 42484900 Database Basics
6/26
Table
Customers
7/28/2019 42484900 Database Basics
7/26
Field (Column)
a field
Customers
7/28/2019 42484900 Database Basics
8/26
Record (Row)
a record
Customers
7/28/2019 42484900 Database Basics
9/26
Primary Key
primarykey field
Customers
Primary key is a uniqueidentifierofrecordsin a table.
Primarykeyvaluesmaybe generatedmanuallyorautomatically.
7/28/2019 42484900 Database Basics
10/26
Primary Key
primarykey fields
Roles (Performances)
Aprimarykeycanconsistofmorethanone field.
7/28/2019 42484900 Database Basics
11/26
Foreign Key
foreignkey field
primarykey fieldparenttable
Directors
Movieschildtablerelationship
7/28/2019 42484900 Database Basics
12/26
Relationship Types
One-to-one
One-to-many
Many-to-many
7/28/2019 42484900 Database Basics
13/26
Data Types
Alphanumeric (Text, Memo)
Numeric (Number, Currency, etc.)
Date/Time Boolean (Yes/No)
7/28/2019 42484900 Database Basics
14/26
Database Environments
Mainframe
Client/Server
Internet-based
7/28/2019 42484900 Database Basics
15/26
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
P
rimary 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.
EmployeeID TaxpayerID LastName FirstName HomePhone Address12512 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
Employee
Properties
Rows/Objects
Class: EmployeePrimarykey
7/28/2019 42484900 Database Basics
16/26
Characteristics of DBMS
Approach Self-contained nature Program-data independence
Dataabstraction
Support formultiple views
Centralised control of the dataresource reduces redundancy
avoids inconsistencies
datacan be shared
standards can be enforced
security restrictions can be applied integrity can be maintained
Sharing of data
Multiusertransaction processing
7/28/2019 42484900 Database Basics
17/26
Advantages of DB
ControllingR
edundancy 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
7/28/2019 42484900 Database Basics
18/26
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
7/28/2019 42484900 Database Basics
19/26
Actors on the DBMS Scene
Data administrator (DA)
Database administrator (DBA)
Database designers
Users
Casual end users
Application programmers
7/28/2019 42484900 Database Basics
20/26
Contents ofa Database
A Database contains:
User Data
Metadata
Indexes
Applications
7/28/2019 42484900 Database Basics
21/26
UserData
End-users work directly with the DBMS by entering, updating andviewing the data. Typically they would use a query language (SQL)
In a relational DB, data will be generally stored in tables with somerelationships between tables.
Each table has one or more columns (attributes). For example, below is a bank account table.
ustomer I cct umber cct T pe ate pene alance
heckin / / .
a in s / / .
a in s / / .
heckin / / .
a in s / / .
a in s / / .
heckin / / .
7/28/2019 42484900 Database Basics
22/26
Metadata
Data about data.
Data that describes how users 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:
7/28/2019 42484900 Database Basics
23/26
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.
ustomer I Acct umber Acct pe ate Opened alance
100 hecking 11/1 /1 00.00100 2 avings /22/1 00.00
1001 hecking 10/12/1 000.00
1001 0 avings 10/12/1 2000.00
1002 11 avings 1/ /1 10000.00
100 22 hecking 10/1/2000 000.00
100 2 avings 12/11/2000 000.00
7/28/2019 42484900 Database Basics
24/26
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 reportfrom 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 languagesto access and manipulate the data. Each application is
designed for a specific aspect of a given functional area, e.g.,
payroll application, accounting, etc.
7/28/2019 42484900 Database Basics
25/26
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.
7/28/2019 42484900 Database Basics
26/26
Design - example
Design tables forthe following scenario:-
Stock management ofacompany
500 items
Three types (A/B/C)
Items receipt and issues on a daily basis
Generate reports