26
BASIC CONCEPTS OF DBMS -ebru a.s. 2015

-ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

Embed Size (px)

Citation preview

Page 1: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

BASIC CONCEPTS OF DBMS

-ebru a.s. 2015

Page 2: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

SOME TERMSATTRIBUTE: Description of entities

For employee entity number, name, deptno, age, adr, salary..etc are attributes.

RECORD : Stores whole information of an entity

Fixed /variable length records

Fixed/variable type records

FILE : Organization of whole data’s of one entity set

Employee file keeps all employee’s recordKEY : One or more field to used for retrieve or sort file

Primary Key: One or more field which van take unique value for an entity

External Key: Key which is composed aspects of physical storage of record

Page 3: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

ENTİTY: STUDENT

Students( sid: string, name: string, login: string,

age: integer, gpa: real )

sid name login agegpa

53666 Jones jones@cs 18 3.4

53688 Smith smith@ee 18 3.2

53650 Smith smith@math 19 3.8

Attribute

Record

FILE

Data about entity

Page 4: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

CONTİNUES....

Operation on Files:

Read Write

Types Of Access

Sequential Random (Direct)

Page 5: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

WHAT IS A DBMS?

A very large, integrated collection of data.

Models real-world enterprise. Entities (e.g., students, courses) Relationships (e.g., Tarkan is taking CENG302)

A Database Management System (DBMS) is a software package designed to store and manage databases.

Well known commercial DBMS products: Oracle, DB2, Sybase etc.

Data about entity

Page 6: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

WHAT IS A DBMS?

A Database Management System (DBMS) is a software package designed to store and manage databases.

With DBMS Supports large volumes Data independence and efficient access. Reduced application development time. Data integrity and security. Concurrent access, recovery from crashes.

Page 7: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

TYPİCAL DBMS USE İN APPLİCATİONSfr

om

in

tern

et

Page 8: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

TYPİCAL TABLE CREATİON İN DBMS (EXAMPLE)

from

in

tern

et

Page 9: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

SAMPLE TABLES

Page 10: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

SAMPLE QUERY İN DBMS fr

om

in

tern

et

Page 11: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

FAKULTE, BOLUM, OGRELM && references

CREATE TABLE FAKULTE(FNO NUMBER(2) PRIMARY KEY,FADI CHAR(30) NOT NULL,DEK-SNO CHAR(6) NULL REFERENCE OGRELM(SNO));

CREATE TABLE BOLUM(BNO NUMBER(3) PRIMARY KEY,BADI CHAR(30) NOT NULL,FNO NUMBER(2) NOT NULL REFERENCE FAKULTE(FNO),BB-SNO CHAR(6) NULL REFERENCE OGRELM(SNO));

FNO FADI DEK-SNO

FAKULTE OGRELM

SNOreference

BNO BADI FNO BB-SNO

refe

renc

ereferenceBOLUM

Enca

psu

latio

n o

f ph

ysica

l deta

ils from

au

thor

Page 12: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

SAMPLE SQL QUERİES

CREATE VIEW KMALZEME AS SELECT MKODU, ADI FROM MALZEME WHERE MKODU NOT IN (SELECT MKODU FROM TUKETİM);

INSERT INTO BOLUM VALUES (356,’Bilgisayar Müh.’, ‘1234’);

SELECT SNO, ADI FROM PERSONEL WHERE UCRETİ>1000;

Page 13: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

STRUCTURE OF A DBMS

A typical DBMS has a layered architecture.

The figure does not show the concurrency control and recovery components.

This is one of several possible architectures; each system has its own variations.

Query Optimizationand Execution

Relational Operators

Files and Access Methods

Buffer Management

Disk Space Management

DB

These layersmust considerconcurrencycontrol andrecovery

Page 14: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

External (Sub) Schema– defines the external view of data

as seen by a user or program

Conceptual Schema– defines the logical view of data

as seen by all users and programs

Physical (Internal) Schema– defines the physical view of data

as seen by a DBMS

Schema for the DBMS levels

Page 15: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole
Page 16: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

Conceptual Layer

Physical Layer

Base Tables

Stored Tables ...

External LayerView View View

Page 17: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

Physical View

database

• The DBMS must know– exact physical location– precise physical structure

Name (20 characters) Address (40 characters)

NID (10 char) Designation (15 char)

A.B.C. De Silva |222, Galle Road, Colombo |

650370690V|Senior Lecturer

Employee record

Page 18: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

database

Logical View

• The user/application must know– existence– logical reference Employee

Address 222, Galle Road, Colombo

Name A.B.C. De Silva

Designation Senior Lecturer

NID 650370690V

Page 19: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

• The conceptual model is a logical representation of the entire contents of the database.

• The conceptual model is made up of base tables.

• Base tables are “real” in that they contain physical records.

Table

Table

Conceptual Layer

Page 20: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

database

External View

• The user/application see– authorised data– own format

Lecturer

Department Dept. of Computer Science

Name A.B.C. De Silva

Designation Senior Lecturer Age 35

Page 21: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

• External Views Allows to– hide unauthorised data

e.g. salary, dob– provide user view

e.g. view employee name, designation, department data taken from employee and department files

– derive new attributese.g. age derived from dob or nid

External View cont.

Page 22: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

EXP: UNIVERSITY DATABASE

Conceptual schema: Students(sid: string, name: string, login: string,

age: integer, gpa:real) Courses(cid: string, cname:string,

credits:integer) Enrolled(sid:string, cid:string, grade:string)

Physical schema: Relations stored as unordered files. Index on first column of Students.

External Schema (View): Course_info(cid:string,grade:integer)

Page 23: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

DATA INDEPENDENCE

Applications insulated from how data is structured and stored.

Logical data independence: Protection from changes in logical structure of data.

Physical data independence: Protection from changes in physical structure of data. One of the most important benefits of using a DBMS!

Page 24: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

PEOPLE WHO DEAL WİTH DATABASES

Database implementors End users and DBMS vendors DB application programmers

E.g. smart webmasters Database administrator (DBA)

Designs logical /physical schemas Handles security and authorization Data availability, crash recovery Database tuning as needs evolveMust understand how a DBMS works!

Page 25: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

IMPORTANT REASON FOR LOOKİNG ‘İNSİDE’ DB

DBA’s must know underlying technology to make decision

(System installing, parameter setting) Decide best configuration of an

application Data security and integrity Data processing

Page 26: -ebru a.s. 2015. ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole

È FINITA