Upload
cameron-carpenter
View
218
Download
0
Embed Size (px)
Citation preview
BASIC CONCEPTS OF DBMS
-ebru a.s. 2015
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
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
CONTİNUES....
Operation on Files:
Read Write
Types Of Access
Sequential Random (Direct)
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
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.
TYPİCAL DBMS USE İN APPLİCATİONSfr
om
in
tern
et
TYPİCAL TABLE CREATİON İN DBMS (EXAMPLE)
from
in
tern
et
SAMPLE TABLES
SAMPLE QUERY İN DBMS fr
om
in
tern
et
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
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;
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
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
Conceptual Layer
Physical Layer
Base Tables
Stored Tables ...
External LayerView View View
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
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
• 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
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
• 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.
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)
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!
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!
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
È FINITA