Академический Документы
Профессиональный Документы
Культура Документы
1
Amity School of Business
What is Knowledge
Knowledge is defined variously as Expertise, and skills acquired by
a person through experience or education; the theoretical or practical
understanding of a subject.
Other Concepts
•Entity
•Entity Set
•Attribute
•Record / Tuple
•File
• Schema
• Instance
•Data Dictionary
4
Amity School of Business
5
Amity School of Business
Database
• It is defines as the collection of logically interrelated data and a
description of this data, designed to meet the information needs
of an organization.
6
Amity School of Business
Features of Database
• Shared
• Security
• Consistency
• Non-Redundancy
• Independence
7
Amity School of Business
8
Amity School of Business
9
Amity School of Business
10
Amity School of Business
Reports Checking
Programs
Database
Management
Reports Savings
System
Programs All Data
DBMS
Loan
Reports
Programs 11
Amity School of Business
12
Amity School of Business
13
Amity School of Business
Advantages of DBMS
• Reduced data redundancy
• Improved data integrity
• Conflicting requirements can be balance
• Inconsistency can be avoided.
• Monitoring database performance.
• Centralisation for multi-users
• Security
14
Amity School of Business
15
Amity School of Business
Components of DBMS
Structure Facilities Users
• Storage Manager •Data Definition • End Users
- File Manager - Naïve Users
- Buffer Manager Language - Stand Alone
• Disk Manager (DDL)
- Sophisticated
• Query Processor •Data
Manipulation - Casual
• Data Dictionary Language • Database
• Access Aids (DML) Administrators
- Indexes •Data Control • Database Designers
Language 16
Amity School of Business
Structure of a DBMS
• The “cylindrical” component contains not
only data, but also metadata, i.e. info
about the structure of data.
• If DBMS is relational, metadata includes:
– names of relations,
– names of attributes of those
relations, and
– data types for those attributes (e.g.,
integer or character string).
• A database also maintains indexes for the
data.
– Indexes are part of the stored data.
– Description of which attributes have
indexes is part of the metadata. 17
Amity School of Business
Storage Manager
• The job of the Storage Manager is to
– obtain data from the data storage, and
– modify the data to the data storage when
requested.
• Storage Manager has two components:
– File Manager handles files.
Keeps track of the location of files
Obtains block(s) of a file on request
from the buffer manager.
– Buffer Manager handles main memory.
Obtains and returns blocks of data
from/to the file manager
Stores blocks temporarily in main
memory pages.
18
Amity School of Business
Query Processor
• Query Processor handles: queries and
modifications to the data.
– Finds the best way to carry out a
requested operation and
– Issues commands to the storage
manager which will carry them out.
• E.g. A bank has a DB with two relat.:
Customers (name, SIN, address),
Accounts (accountNo, balance, SIN)
Transaction Manager
• Transaction Manager is responsible for
the integrity of the system. It must assure
that:
– several queries running
simultaneously do not interfere with
each other and that,
– the system will not lose data even if
there is a power failure.
• Transaction Manager interacts with:
• Query Manager,
– Because it may need to delay
certain query operations to avoid
conflicts.
• Storage Manager
– Because schemes for protecting
data involve storing a log of 20
changes to the data.
Amity School of Business
Disk Manager
• Data files, which store the
database itself.
• Data Dictionary, which
stores metadata about the
structure of the database.
• Statistical data, which store
statistical information about
the data in the database.
This information is used by
the query processor to select
efficient ways to execute a Disk Manager
query.
21
Amity School of Business
Components of DBMS
DBMS Facilities
Data Definition Language (DDL)
Data Manipulation Language (DML)
Data Control Language (DCL)
22
Amity School of Business
23
Amity School of Business
DATA WAREHOUSE
Data Warehouse, defines the term as “an Integrated, subject oriented,
time-variant, nonvolatile collection of data that provides support for
decision making .
24
Amity School of Business
DATA MINING
It has been described as "the non-trivial extraction of implicit,
previously unknown or hidden, and potentially useful information
from data“.
SQL
• SQL stands for Structured Query Language. SQL is used to communicate
with a database.
• According to ANSI (American National Standards Institute), it is the
standard language for relational database management systems.
• SQL statements are used to perform tasks such as update data on a
database, or retrieve data from a database.
• Some common relational database management systems that use SQL are:
Oracle, Sybase, Microsoft SQL Server, Access, etc.
• However, the standard SQL commands such as "Select", "Insert",
"Update", "Delete", "Create", and "Drop" can be used to accomplish
almost everything that one needs to do with a database.
26
Amity School of Business
SQL
• SQL can be divided into two parts: The Data Manipulation Language (DML) and the Data
Definition Language (DDL).
• The query and update commands form the DML part of SQL:
• SELECT - extracts data from a database
• UPDATE - updates data in a database
• DELETE - deletes data from a database
• INSERT INTO - inserts new data into a database
• The DDL part of SQL permits database tables to be created or deleted. The most important
DDL statements in SQL are:
• CREATE DATABASE - creates a new database
• ALTER DATABASE - modifies a database
• CREATE TABLE - creates a new table
• ALTER TABLE - modifies a table
• DROP TABLE - deletes a table
27
Amity School of Business
28
Amity School of Business
29
Amity School of Business
Updating Records
• The update statement is used to update or change records that
match a specified criteria.
30
Amity School of Business
Updating Records
Examples: update phone_book
set area_code = 623
where prefix = 979;
update phone_book
set last_name = 'Smith',
prefix=555, suffix=9292
where last_name = 'Jones';
31
Amity School of Business
Deleting Records
• The delete statement is used to delete records or rows from the table.
Syntax: delete from "tablename"
where "columnname" OPERATOR "value"
[and|or "column" OPERATOR "value"]; [ ] = optional
32
Amity School of Business
Drop a Table
• The drop table command is used to delete a table and all rows
in the table.
Syntax: drop table "tablename"
Example:
• drop table myemployees_ts0211;
33
Amity School of Business
Alter Table
• The ALTER TABLE statement is used to add, delete, or modify
columns in an existing table.
Syntax: To add a column in a table
ALTER TABLE table_name
ADD column_name datatype
Alter Table
Syntax: To change the data type of an existing column
ALTER TABLE table_name
CHANGE COLUMN LAST TO CHAR(20)
35