Você está na página 1de 34

Data & Information

Data is the name given to basic facts and entities such as names and numbers. Good examples of data are date, weights, price, costs employee names , tax codes, addresses etc. Data consists of a series of facts or statements that may have been collected, stored , processed and or manipulated but have not been organised or placed into context. When data is organised, its becomes Information.


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. Knowledge is of two types: a) Facts based or information based: Knowledge gained from fundamentals and through experiments. The knowledge like the information contained in fundamental sciences which has been derived from experiments, rules, regulations that are commonly agreed by experts. b) Heuristic Knowledge : It is knowledge of good practice experience and good judgment like hypothesis.
3/18/12 22

Other Concepts
Entity Entity Set Attribute Record / Tuple File Schema Instance Data Dictionary






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. For example, a dictionary, a telephone directory, student record register etc . They all store data in some particular arranged form i.e in some order



Features of Database

Shared Security Consistency Non-Redundancy Independence

p p p p



The Traditional File Approach to Data Management

Data Files Applicatio n Program Reports

p The Traditional File Approach n Separate files are created and stored for each application
program. n Very common from the 50s through the 80s.



The Traditional File Approach

Example: Student Data in a University. Student address may be needed for registering, library management, financial office, grade reporting, etc. Each application separately maintains its data files and programs to manipulate those files. Possibly different formats for the same data (Eg: Length of name) Redundant updates (E.g.: to change an address).



Purpose of Database Systems


In the early days, database applications were built directly on top of file systems Drawbacks of using file systems to store data:
n n n n n n n

Data redundancy and inconsistency Poor Data manipulation capabilities Data Isolation Integrity problem Security problems Concurrent Access to data Program-Data dependence
3/18/12 99

Database systems offer solutions to all the above problems

The Database Approach


The Database Management System Approach n A pool of related data is shared by multiple application programs. Rather than having separate data files, each application uses a collection of data that is either joined or related in the database.

Rep orts Rep orts Rep orts

Chec king Progr Savin ams gs Progr Loan ams Progr

Databa se Manag ement System

3/18/12 DBMS

All Data


Database Management System


DBMS is a collection of programs that enables you to store , modify and extract information from a database. There are many different types of DBMS , ranging from small systems that run on personal computers to huge systems that run on mainframes. The following are examples of database applications: - Computerised Library Systems - Flight Reservation Systems

A DBMS is a software package for defining and managing a database



Features & Abilities of DBMS

Query Ability Backup & Replication Security Computation Change & Access Logging Rule Enforcement



Advantages of DBMS
p p p p p p p

Reduced data redundancy Improved data integrity Conflicting requirements can be balance Inconsistency can be avoided. Monitoring database performance. Centralisation for multi-users Security



Disadvantages to the DBMS

Greater impact of failure More difficult recovery Increased cost of specialized staff. Substantial hardware and software start-up costs . Extensive conversion costs in moving form a filebased system to a database system



Components of DBMS
Structure Storage Manager - File Manager - Buffer Manager Disk Manager Query Processor Data Dictionary Facilities Data Definition Users End Users - Nave Users - Stand Alone Language - Sophisticated (DDL) - Casual Data Database Manipulation Administrators Language Database (DML) Designers Data Control


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.



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. 3/18/12


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) Query: Find the balances of all accounts of which Sally is the 3/18/12


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

Transaction Manager interacts with: Query Manager, Because it may need to delay certain query operations to avoid conflicts.



Disk Manager
p p

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 query.

Disk Manager

Components of DBMS
DBMS Facilities Data Definition Language (DDL) Data Manipulation Language (DML) Data Control Language (DCL)



Classification of DBMS Users

n n n

Database administrators Database Designers End Users : Casual Nave or Parametric Sophisticated Stand-alone



Data Warehouse, defines the term as an Integrated, subject oriented, time-variant, nonvolatile collection of data that provides support for decision making .



It has been described as "the non-trivial extraction of implicit, previously unknown or hidden, and potentially useful information from data. Data Mining is the principle of sorting through large amounts of data and picking out relevant information. It is usually used by business intelligence organizations, and financial analysts, but it is increasingly used in the sciences to extract information from the enormous data sets generated by modern experimental and observational methods.
3/18/12 24


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.


p p p p p p

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

p p p p p


Few Basic Operations of DBMS

The create table statement is used to create a new table. Here is the format of a simple create table statement: Syntax: create table "tablename" ("column1" "data type", "column2" "data type", "column3" "data type");


create table employee (first char(15), last char(20), age number(3), address char(30), city char(20), state char(20)); 3/18/12


Inserting into a Table

The insert statement is used to insert or add a row of data into the table. Syntax: p insert into "tablename" (first_column,...last_column) values (first_value,...last_value);
p p

Example: insert into employee (first, last, age, address, city, state) values ('Luke', 'Duke', 45, '2130 Boars Nest', 'Hazard Co', 'Georgia');
3/18/12 28

Updating Records

The update statement is used to update or change records that match a specified criteria.

Syntax : update "tablename" set "columnname" = "newvalue" [,"nextcolumn" = "newvalue2"...] where "columnname" OPERATOR "value" [and|or "column" OPERATOR "value"]; [] = optional



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';



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

Examples: delete from employee where lastname = 'May'; delete from employee where firstname = 'Mike' or firstname = 'Eric';



Drop a Table
The drop table command is used to delete a table and all rows in the table. Syntax: drop table "tablename"

Example: p drop table myemployees_ts0211;



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

To delete a column in a table ALTER TABLE table_name DROP COLUMN column_name To change the data type of a column in a table ALTER TABLE table_name ALTER COLUMN column_name datatype
3/18/12 33

Alter Table
Syntax: To change the data type of an existing column ALTER TABLE table_name CHANGE COLUMN LAST TO CHAR(20)