Sie sind auf Seite 1von 10

Database Management System (DBMS): It is a collection of interrelated data and set of programs to access the data.

It contains information about a particular enterprise and also provides an environment that is both convenient and efficient to use. Database Applications: Banking: all transactions Airlines: reservations, schedules Universities: registration, grades Sales: customers, products, purchases Manufacturing: production, inventory, orders, supply chain uman resources: employee records, salaries, ta! deductions Purpose of Database Systems: In the early days, database applications "ere built on top of file systems. Separate files had to be maintained for different applications that could result in redundant data across the applications. #he traditional file system can be illustrated as follo"s:

Accounting

User s

Application &rogram

'inance

User s

Application &rogram

Sales Users

Application &rogram

Manufacturing Users

Application &rogram

'

Drawbacks of using file systems to store data are as follows: $. %ata redundancy and inconsistency Multiple file formats, duplication of information in different files $

*. %ifficulty in accessing data +eed to "rite a ne" program to carry out each ne" task ,. %ata isolation - multiple files and formats .. Integrity problems Integrity constraints /e.g. account balance 0 12 become part of program code ard to add ne" constraints or change e!isting ones 3. Atomicity of updates 'ailures may leave database in an inconsistent state "ith partial updates carried out ).g. transfer of funds from one account to another should either complete or not happen at all 4. (oncurrent access by multiple users (oncurrent access needed for performance Uncontrolled concurrent accesses can lead to inconsistencies ).g. t"o people reading a balance and updating it at the same time 5. Security problems %atabase systems offer solutions to many of the above problems. Database Approach: Integrated uman 6esource %atabase )mployees +ame Address &osition &ersonnel Application &rogram &ersonne l %epartm ent

&ayroll ours 7orked &ay rate 8ross &ay Benefits 9ife Insurance &ension plan ealth (are &lan

%atabase Management System

&ayroll Application program

&ayroll %epartme nt

Benefits Application program

Benefits %eparmen t

eatures of database approach:

: : : :

(reates and maintains databases )liminates re;uirement for data definition statements Acts as interface bet"een application programs and physical data files Separates logical and physical vie"s of data

Ad!antages of DBMS approach: : : : : : : : : : : : : : : (ontrol of data redundancy %ata consistency More information from the same amount of data Sharing of data Improved data integrity Improved security )nforcement of standards )conomy of scale Balance of confliction re;uirements Improved data accessibility and responsiveness Increased productivity Improved maintenance through data independence Increased concurrency Improved backup and recovery services

Disad!antages of DBMS approach: : : : : : : : (omple!ity Si<e (ost of %BMS Additional hard"are costs (ost of conversion &erformance igher impact of a failure

"e!els of Abstraction: $. &hysical level describes ho" a record /e.g., customer2 is stored. *. 9ogical level: describes data stored in database, and the relationships among the data. type customer = record name : string> street : string> city : integer> end> ,. ?ie" level: application programs hide details of data types. ?ie"s can also hide information /e.g., salary2 for security purposes.

#iew of Data:

Schemas and $nstances: #hese are similar to types and variables in programming languages. Schema @ the logical structure of the database o e.g., the database consists of information about a set of customers and accounts and the relationship bet"een them2 o Analogous to type information of a variable in a program o Physical schema: database design at the physical level o "ogical schema: database design at the logical level $nstance @ the actual content of the database at a particular point in time o Analogous to the value of a variable Physical Data $ndependence @ the ability to modify the physical schema "ithout changing the logical schema o Applications depend on the logical schema o In general, the interfaces bet"een the various levels and components should be "ell defined so that changes in some parts do not seriously influence others. %omponents of DBMS: : %ata definition language: Specifies content and structure of database and defines each data element Specification notation for defining the database schema : ).g. create table account / account-number char/$12, balance integer2 %%9 compiler generates a set of tables stored in a data dictionary : %ata manipulation language: Manipulates data in a database .

It is a language for accessing and manipulating the data organi<ed by the appropriate data model. %M9 also kno"n as ;uery language. SA9 is the most "idely used ;uery language. %ata dictionary: Stores definitions of data elements, and data characteristics

Data Models: It is a collection of tools for describing data, data relationships, data semantics and data constraints. %ifferent types of data models are: ierarchical model +et"ork Model 6elational Model &ierarchical Model: : : : Brgani<es data in a treeClike structure Supports oneCtoCmany parentCchild relationships &revalent in large legacy systems

)mployee

(ompnesation

Dob Assignments

Benefits

&erformance

istory

&ension

Insurance

ealth

'etwork Model: : %epicts data logically as manyCtoCmany relationships

Disad!antages of &ierarchical and 'etwork Model: : Butdated : 9ess fle!ible compared to 6%BMS : 9ack support for adChoc and )nglish languageClike ;ueries

(elational Model: : A relational database is one in "hich the data consists of a Ecollection of tables related to each other through common valuesE : #he t"o most prominent characteristics of a relational database are $2 data stored in tables and *2 relationships bet"een tables : A table /relation2 is a collection of ro"s and columns : 6elates data across tables based on common data element : A row /record or tuple2 represents a collection of information about a separate item /e.g., a customer2 : A column /field or attribute2 represents the characteristics of an item /e.g., the customerEs name or phone number2 : A relationship is a logical link bet"een t"o tables> : A relational database management system /6%BMS2 uses matching values in multiple tables to relate the information in one table "ith the information in the other table : #he presentation of data as tables is a logical construct> it is independent of the "ay the data is physically stored on disk : )!amples: %B*, Bracle, MS SA9 Server )rder: Brder +umber $1$ $1* $1, Part: &art +umber ,. .3 34 Supplier: Supplier +umber $*$ $** $,. $34

Brder %ate $F*F1, $F*F1, *F*F1,

%elivery %ate $1F*F1, $1F*F1, $*F*F1,

&art +umber ,. .3 34 Unit &rice *3.11 **.11 51.11

Auantity , $ *

Brder #otal 53.11 **.11 $.1.11

&art %escription %oor andle %oor 9atch (ompressor

Supplier +umber $** $*$ $,.

Supplier +ame Gy< Inc. Abc H (o. In< (o. &;r Inc

(ity 9ondon &aris 9ondon (alifornia

*ntity (elational Model: )C6 model is a model of real "orld that is "idely used for database design. %atabase design in )C6 model usually converted to design in the relational model "hich is used for storage and processing. It contains the follo"ing components: *ntities: Any obIect for "hich some information can be recorded is called an entity: ).g. customers, accounts, bank branch. #hese entities have attributes like customer number, name etc. )ntity denoted by: Attribute denoted by: (elationships: #he relationship bet"een entities. ).g. Account AC$1$ is held by customer Dohnson, 6elationship set depositor associates customers "ith accounts. %enoted by:

*+ample:

Degree of a relationship: #he degree of a relationship is the number of entities associated "ith the relationship. #he nC ary relationship is the general form for degree n. Special cases are the binary, and ternary ,"here the degree is *, and ,, respectively. Binary relationships, the association bet"een t"o entities is the most common type in the real "orld. A recursive binary relationship occurs "hen an entity is related to itself. An e!ample might be Jsome employees are married to other employeesJ. %onnecti!ity and %ardinality

#he connectivity of a relationship describes the mapping of associated entity instances in the relationship. #he values of connectivity are JoneJ or JmanyJ. #he cardinality of a relationship is the actual number of related occurences for each of the t"o entities. #he basic types of connectivity for relations are: oneCtoCone, oneCtoCmany, and manyCtoCmany. A one-to-one /$:$2 relationship is "hen at most one instance of a entity A is associated "ith one instance of entity B. )!ample: Bnly one employee "ill be the head of a department. And a department "ill have one and only one head of the department. )mployee % %epartment

A one-to-many /$:+2 relationships is "hen for one instance of entity A, there are <ero, one, or many instances of entity B, but for one instance of entity B, there is only one instance of entity A. )!ample: Many employees can "ork in a single department.

)mployee

7or ks in

%epartment

A many-to-many /M:+2 relationship, sometimes called nonCspecific, is "hen for one instance of entity A, there are <ero, one, or many instances of entity B and for one instance of entity B there are <ero, one, or many instances of entity A. )!ample: Many (ustomers can buy a product. And many products can be bought by a single customer. #his analogy can be redefined as a many to many relationship bet"een the customers and products as many customers can buy many products

(ustomers

Buy

&roducts

)6 diagram can be dra"n sho"ing all the entities and their relationships bet"een the entities. )!ample: An )6 diagram representing the entities of a schoolFcollege.

+ame (onduc ts SubIect )!ams )!am %ate #eache s #eacher

%esignatio n specialisation +ame )!tra (urricular activities

Sno Student

"rites +ame

&articipat e

(lass

$ntegrity %onstraints and ,eys: Integrity constraint refers to the term for consistency, accuracy, and correctness of data stored in a database. #here are various types of integrity constraints, they are: $. *ntity integrity: It ensures that each ro" in the table is uni;uely identified *. Domain integrity: It re;uires that a set of data values fall "ithin a specific range /domain2 in order to be valid ,. (eferential integrity: It is concerned "ith keeping the relationships bet"een tables synchroni<ed .. -ser.defined integrity: It refers to specific business rules not covered by the other integrity categories ,eys: Integrity constraints are achieved by defining keys in the database. #he different types of keys are: $. -ni/ue ,ey: An attribute that contains uni;ue values in all the ro"s is called as Uni;ue key *. 'ot 'ull: If an attribute is defined to be not null then that attribute "ill not have null as a value. ,. Primary key: An attribute that uni;uely identifies a ro" is called the primary key. #he key should uni;ue as "ell as not null. .. %omposite Primary key: Multiple attributes constituting a primary key is called as composite primary key.

3.

oreign ,ey: A referential integrity constraint that refer to the primary key of a relation is called a foreign key constraint

$1

Das könnte Ihnen auch gefallen