Presentation is loading. Please wait.

Presentation is loading. Please wait.

DBMS Module - 1 Introduction. Database A database is a collection of related data. A database is a collection of related, logically coherent data used.

Similar presentations


Presentation on theme: "DBMS Module - 1 Introduction. Database A database is a collection of related data. A database is a collection of related, logically coherent data used."— Presentation transcript:

1 DBMS Module - 1 Introduction

2 Database A database is a collection of related data. A database is a collection of related, logically coherent data used by the application programs in an organization Database management System A DBMS is a collection of interrelated data and a set of programs to access those data. DBMS is hence a general purpose software system that facilitates the process of defining, constructing, manipulating and sharing databases among various users and applications.

3 DBMS Functions Defining : a database involves specifying the data types, structures, and constraints for the data to be stored in the database. Constructing : the database the process of storing data itself on some storage medium that is controlled by the DBMS. Manipulating : a database includes querying, updating the database. Sharing : a database allows multiple users and programs to access the database concurrently.

4 Database Management System Database Management System (DBMS) provides…. … efficient, reliable, convenient, and safe multi-user storage of and access to massive amounts of persistent data.

5 Adjective of DBMS  Massive  Persistent  Safe  Multi-user  Convenient  Efficient  Reliable

6 Intro to Databases  Database applications may be programmed via “frameworks”  DBMS may run in conjunction with “middleware”  Data-intensive applications may not use DBMS at all

7 Intro to Databases Key concepts  Data model  Schema versus data  Data definition language (DDL)  Data manipulation or query language (DML)

8 Intro to Databases Key people  DBMS implementer  Database designer  Database application developer  Database administrator

9 Intro to Databases Whether you know it or not, you’re using a database every day

10 Database system Vs File System File System (like data in text file as in C programs ) Database System Data redundancy (lead to higher storage and access cost) Same information is duplicated in many places eg. Mobile and email id of student in cse_student_detail records and in Btech_student_detail records as well. Data redundancy can be deal by creating a separate table having student#, mob & email. Difficulty in Accessing data (Need to write a new program to carry out each new task) If user need all student having GPA>3.5 then we need to create such program or if this program exist then also file system can meet with changing needs as need student having GPA>3.5 and are from Delhi. Searching required data is easy by writing small queries system get adapted to changing needs

11 File System (like data in text file as in C programs ) Database System Data Isolation As data are scattered in different files and file may be of different formats as some in.doc or.txt or.xls need require coding for each of them. Uniformity in the way data is stored Integrity problems Data values must follow some consistency constraint such as no account should have less than $25. in File System we need to code it and if in future we want to change it we need to recode it! Integrity constraints (e.g. account balance > 0) become part of program code Hard to add new constraints or change existing ones New constraint can easily be add, modify & drop easily. Atomicity Problem Computer systems are prone to failures. Suppose a program transferring $50 from account A to B but in middle system crash then $50 was removed from but not credited to B. This lead to inconsistent state. It is difficult to ensure atomicity in File system. Transfer of funds from one account to another should either complete or not happen at all Atomicity can easily be maintained, these system have recovery and back up tools.

12 File System (like data in text file as in C programs ) Database System Concurrent - access anomalies Consider an account A holding $500, if two customer C1 & C2 withdraw $100 and $50 from A simultaneously then initially C1 & C2 see $500 now whichever write last it either show $400 or $450 while correct is $350. Hence File system have greater challenge as many application programs access same data simultaneously in multi-user system. Support multi-user system. Security problem Enforcing security constraint is difficult. As faculty can upload and see attendance of student, whereas only class advisor can modify already uploaded attendance and students can only see their own attendance. Database has internal procedures and commands for this.

13 Schema and Instance Similar to types and variables in programming languages Schema – the logical structure of the database the overall design of the database e.g., the database consists of information about a set of customers and accounts and the relationship between them) Analogous to type information of a variable in a program Physical schema: database design at the physical level Logical schema: database design at the logical level Instance – the actual content of the database at a particular point in time Analogous to the value of a variable

14 Three Schema Architecture External View END User CONCEPTUAL SCHEMA OR LOGICAL LEVEL INTERNAL SCHEMA OR PHYSICAL LEVEL How data actually stored? What data are stored? Forms, Login Pages, Command prompt

15 Physical level Has an internal schema Describes the physical storage structure of the database Data structure used to store data Access paths for database Conceptual level What data stored in database Relationship among those data DBA uses this level Hides details of physical storage structures External View or View level Application programs Describe part of the database that a particular user group is interested in Hides rest of database from that user group hide information (e.g., salary) for security purposes.

16 Data Independence Physical Data Independence – the ability to modify the physical schema without changing the logical schema Applications depend on the logical schema In general, the interfaces between the various levels and components should be well defined so that changes in some parts do not seriously influence others. Numeric(7) to numeric(10) Logical Data Independence- the ability to modify the logical schema without having to change external schema or application programs. S#SnameGrade S#SnameBranchGrade Convert

17 Data Models A collection of conceptual tools for describing data, data relationships, data semantics, and consistency constraint. A data model provides a way to describe the design at physical, logical & view level. Various data models are: 1.The entity- relationship model 2.The object oriented model 3.Relational model 4.Network model and 5.Hierarchical model

18 14.18 Hierarchical database model In the hierarchical model, data is organized as an inverted tree. Each entity has only one parent but can have several children. At the top of the hierarchy, there is one entity, which is called the root. An example of the hierarchical model representing a university

19 14.19 Network database model In the network model, the entities are organized in a graph, in which some entities can be accessed through several paths (Figure). Figure An example of the network model representing a university

20 14.20 Relational database model In the relational model, data is organized in two-dimensional tables called relations. The tables or relations are, however, related to each other. Figure 14.5 An example of the relational model representing a university

21 The Entity-Relationship Model Entity is real world object or thing that is distinguishable from others The entities for which information needs to be stored and the relationship among these entities. E- R diagrams uses several geometric shapes, but we use only a few of them here:

22 Object Oriented Model This is extended ER model Having notion of encapsulation, methods (functions) & object identity.

23 Database languages

24 Data definition language(DDL) Use to define database structure & schema CREATE : to create object in DB ALTER: alters the structure of DB DROP: delete object from DB TRUNCATE: remove all record from table COMMENT: add comment to data dictionary RENAME: rename an object

25 Data Manipulation Languages (DML) To modify data Two types Procedural DMLs: require a user to specify what data are needed and how to get those data. Declarative DMLs: (non-procedural DMLs) require a user to specify what data are needed without specifying how to get those data.eg SQL SELECT: to retrieve data from DB INSERT: insert data to table UPDATE: update existing data within a table

26 DELETE: delete all records from a table CALL: call a PL/SQL or java program. DATA CONTROL LANGUAGE GRANT: gives users access privileges to DB REVOKE: withdraw access privileges given with the GRANT command TRANSACTION CONTROL LANGUAGE Use to manage changes by DMLs COMMIT: save work done ROLLBACK: restore DB to original state since last commit. SAVEPOINT: identify a point in transaction to which you can later rollback.

27 Database Architecture Overall database mgmt. structure

28 Authorization and Integrity manager Use Write Use Buffer manager File manager Transaction Manager DATA Indices Data dictionary Statistical data Query Processor Storage Manager Disk Storage

29 Database Users Users are differentiated by the way they expect to interact with the system Application programmers – interact with system through DML calls, writes application programs Sophisticated users – form requests in a database query language eg analysts Specialized users – write specialized database applications that do not fit into the traditional data processing framework Naïve users – invoke one of the permanent application programs that have been written previously E.g. people accessing database over the web, bank tellers, clerical staff

30 Database Administrator (DBA) Coordinates all the activities of the database system; the database administrator has a good understanding of the enterprise’s information resources and needs. Database administrator's duties include: Schema definition- by executing statements in DDL Storage structure and access method definition Schema and physical organization modification Granting user authority to access the database Specifying integrity constraints eg. Primary key Back up data Ensure enough disk space for smooth performing of DB Monitors jobs running on DB

31 Storage Manager Provide interface between low level data in database and application program. Components: Authorization & integrity Manager: define role and responsibility for users, and provide Integrity checks. Transaction manager: ensure DB consistency in concurrent access File Manager: manage allocation of disk space and Data structure used for storing data Buffer Manager: decide what data to cache

32 Disk Storage Data Files: which stores database itself Data Dictionary: stores metadata about the structure of the database Indices: provide fast access to data items

33 Query Processor DDL interpreter: which interprets DDL statements and records the definitions in the data dictionary DML Compiler: translate DML statements to evaluation plan. Also perform query optimization. (pick the lowest cost evaluation plan from among the alternatives) Query Evaluation Engine: executes low level instructions generated by DML compiler.

34 Application Architectures

35 Two – tier Architecture Application is partitioned into two components: Server: runs query language statements Clients: provide user interface and local processing JDBC & ODBC are used for interaction between the client and the server. client Server

36 Three tier Architecture Client: merely a user interface (form interface) but no direct DB calls, Application Server: communicates with database system to access data. Had coding for what action to carried out under what conditions. Database Server: handle data access for query receive by Application Server client Database Server Application Server


Download ppt "DBMS Module - 1 Introduction. Database A database is a collection of related data. A database is a collection of related, logically coherent data used."

Similar presentations


Ads by Google