0% found this document useful (0 votes)
9 views

Dbms Unit 1 Notes

this is the notes of dbms

Uploaded by

shivani123409
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
9 views

Dbms Unit 1 Notes

this is the notes of dbms

Uploaded by

shivani123409
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 21
©) studocu UNIT 1 - DBMS - Unit 1 notes UNIT-1 Data: - Data is raw, unorganized facts that need to be processed. Data we mean known facts or figures that can be recorded. Data can be represented in alphabets, digits and special characters. Information: - Information is organized or classified data, which has some meaningful values for the receiver. Information is the processed data on which decisions and actions are based. Database:-The collection of data, usually referred to as the database, contains information relevant to an enterprise. A database is an organized collection of data, generally stored and accessed electronically from a computer system. A database is a collection of related data. By data, we mean known facts that can be recorded and that have implicit meaning. For example: The college Database organizes the data about the admin, staff, students and faculty etc > A database management system (DBMS) is a collection of programs that enables users to create and maintain a database. Users/ Programmers Database System ee [Application Proprame/Gueres DBMS. v Sata ‘Software to Process (Queries/Programs ft ‘Software to Accass ‘Stored Data Stored Database Datinition (Meta-Data) Database System Environment This documents abe raw of charge on © studocu Downloaded by Shivani Kumar ([email protected]) > The DBMS is a general-purpose software system that facilitates the processes of defining, constructing, manipulating, and sharing databases among various users and applications. > A database is a collection of interrelated data and a set of programs to access those data. > The primary goal of a DBMS is to provide a way to store and retrieve database information that is both convenient and efficient. Database systems are designed to manage large bodies of information Management of data involves both defining structures for storage of information and providing mechanisms for the manipulation of information. In addition, the database system must ensure the safety of the information stored, despite system crashes or attempts at unauthorized access. For example : MY SQL, Oracle, Microsoft SQL Server, PostgreSQL, MongoDB, dBase,IBM Db2,SQL Lite,MariaDB,FoxPro,Sybase v v v File Management System versus Database System. File-based approaches which came into being with the first commercial applications of computers suffered from the following significant disadvantages: 1. Data Redundancy: Data Redundancy means same information is duplicated in several files. This makes data redundancy. 2. Data consistency: Data consistency refers to whether the same data kept at different places do or do not match. 3. Difficulty in Accessing Data: It is not easy to retrieve information using a conventional file processing system. Convenient and efficient information retrieval is almost impossible using conventional file processing system. 4, Data Isolation: Data are scattered in various files, and the files may be in different format, writing new application program to retrieve data is difficult. 5. Integrity Problems: The data values may need to satisfy some integrity constraints. For example, the balance field value must be greater than 5000. We have to handle this through program code in file processing systems. But in database we can declare the integrity constraints along with definition itself. 6. Atomicity Problem: It is difficult to ensure atomicity in file processing system. For example, transferring 100 Rs. From account A to account B. If a failure occurs during execution there could be situation like 100 Rs. is deducted from account A and not credited in account B. Downloaded by Shivani Kumar ([email protected]) 7. Concurrent Access anomalies: If multiple users are updating the same data simultaneously it will result in inconsistent data state. In file processing system, it is very difficult to handle this using program code. This results in concurrent access anomalies. 8. Security Problems: Enforcing security constraints in file processing system is very difficult as the application programs are added to the system in an adhoc manner. Difference between File Proce: sing System VS DBMS. File Processing System DBMS File system is a software that manages and organizes the files in a storage medium within a computer. DBMS is a software for managing the database. Redundant data can be present in a file system. In DBMS there is no redundant data. It doesn’t provide backup and recovery of data if it is lost. It provides backup and recovery of data even if it is lost. There is no efficient query processing in file system, Efficient query processing is there in DBMS There is less data consistency in the file system. There is more data consistency because of the process of normalization. It is less complex as compared to DBMS. It has more complexity in handling as compared to the file system. File systems provide less comparison to DBMS security in DBMS has more security mechanisms as compared to file systems Tris less expensive than DBMS. Tt has a comparatively higher cost than a file system, There is no data independence In DBMS data independence exists. The file system docsnt have a crash mechanism, DBMS provides a crash recovery mechanism For Example- Cobol, C++ For Example- Oracle, SQL Server Database-System Appl Databases are widely used. Here are some representative applications: Enterprise Information Sales: For customer, product, and purchase information. Accounting: For payments, receipts, account balances, assets and otheraccounting information. This documents abe raw of charge on © studocu Downloaded by Shivani Kumar ([email protected]) + Human resources: For information about employees, salaries, payroll taxes,and benefits, and for generation of paychecks. eManufacturing: For management of the supply chain and for tracking productionof items in factories, inventories of items in warehouses and stores,and orders for items. Online retailers: For sales data noted above plus online order tracking, generation of recommendation lists, and maintenance of online productevaluations, Banking and Finance Banking: For customer information, accounts, loans, and banking transactions. ° Credit card transactions: For purchases on credit cards and generation ofmonthly Jatements. ¢ Finance: For storing information about holdings, sales, and purchases offinancial instruments such as stocks and bonds; also for storing real-timemarket data to enable online trading by customers and automated tradingby the firm. Universities: For student information, course registrations, and grades (inaddition to standard enterprise information such as human resources andaccounting). Airlines: For reservations and schedule information. Airlines were among thefirst to use databases in a geographically distributed manner. Telecommunication: For keeping records of calls made, generating monthlybills, maintaining balances on prepaid calling cards, and storing informationabout the communication networks. Characte 's of database approacl A number of characteristics distinguish the database approach from the much older approach of programming with files.The main characteristics of the database approach versus the file-processing approach are the following © Self-describing nature of a database system © Insulation between programs and data, and data abstraction © Support of multiple views of the data © Sharing of data and multiuser transaction processing 1, Self-describing nature of a database system: A fundamental characteristic of the database approach is that the database system contains not only the database itself but also a complete definition or description of the database structure and constraints. This definition is stored in the DBMS catalog, which contains information such as the structure of each file, the type and storage format of each data item, and various constraints on the data. The information stored in the catalog is called meta-data, and it describes the structure of the primary database. Downloaded by Shivani Kumar ([email protected]) 2. Insulation between programs and data, and data abstraction: In traditional file processing, the structure of data files is embedded in the application programs, so any changes to the structure of a file may require changing all programs that access that file. By contrast, DBMS access programs do not require such changes in most cases. The structure of data files is stored in the DBMS catalog separately from the access programs. This property is called program-data independence. 3. Support of multiple views of the data: A database typically has many users, each of whom may require a different perspective or view of the database. A view may be a subset of the database or it may contain virtual data that is derived from the database files but is not explicitly stored. Some users may not need to be aware of whether the data they refer to is stored or derived. A multiuser DBMS whose users have a variety of distinct applications must provide facilities for defining multiple views. 4. Sharing of data and multiuser transaction processing: A multiuser DBMS, as its name implies, must allow multiple users to access the database at the same time. ‘This is essential if data for multiple applications is to be integrated and maintained in a single database. The DBMS must include concurrency control software to ensure that several users trying to update the same data do so in a controlled manner so that the result of the updates is correct. Advantages of DBMS: 1. Controlling Data Redundancy, In file systems each application program has its own private files. In this case, the duplicated copies of the same data are created in many places. In DBMS, all data of an organization is integrated into a single database file. The data is recorded in only one place in the database and it is not duplicated, 2, Sharing of Data In DBMS, data can be shared by authorized users of the organization. The database administrator manages the data and gives rights to users to access the data. Many users can be authorized to access the same piece of information simultaneously. The remote users can also share same data. Similarly, the data of same database can be shared between different application programs. This documents abe raw of charge on © studocu Downloaded by Shivani Kumar ([email protected]) 3. Data consistency By controlling the data redundancy, the data consistency is obtained. If a data item appears only once, any update to its value has to be performed only once and the updated value is immediately available to all users. If the DBMS has controlled redundancy, the database system enforces consistency. 4. Proper data integration In Database management system, data in database is stored in tables. A single database contains multiple tables and relationships can be created between tables (or associated data entities). This makes easy to retrieve and update dat 5. Enforcing Integrity Constraints Integrity constraints or consistency rules can be applied to database so that the correct data can be entered into database. The constraints may be applied to data item within a single record or may be applied to relationships between records. 6.Data Security DBMS makes it easier to enforce security restriction since the data is stored centrally. DBMS provides security tools as username and password. 7. Restricting Unauthorized Access When multiple users share a large database, it is likely that most users will not beauthorized to access all information in the database 8. Providing Storage Structures and Search Techniques for Efficient Query Processing Database systems must provide capabilities for efficiently executing queries and updates. Because the database is typically stored on disk, the DBMS must provide specialized data structures and search techniques to speed up disk search for the desired records 9. Providing Multiple User Interfaces Because many types of users with varying levels of technical knowledge use a database, a DBMS should provide a variety of user interfaces. These include apps formobile users, query languages for casual users, programming language interfaces Downloaded by Shivani Kumar ([email protected]) Disadvantages of DBMS ‘There are some following disadvantages of the database management system, 1. High Cost The high cost of software and hardware is the main disadvantage of the database management system. Database users require a high-speed processor and huge memory size to use the database on the DBMS. 2. Huge Size The size of the database is not big at the initial state, but when the user stores a large amount of data, then it creates many problems. Due to the huge data, database systems do not provide good results and do not run efficiently. That's why the size is another limitation of the database systems. 3. Database Failure In the database systems, all the data or information of an organization is stored in one centralized database. If the database of that organization fails, then the data is lost, and the organization will collapse. So, database failure is a big problem with the database management system. 4. Complexity Database management system (DBMS) is so complex for non-technical users. So, it isn’t easy to manage and maintain database systems, Therefore, training for the designers, users, and administrators is necessary to efficiently run the database systems. Schemas in DBMS Databases change over time as information is inserted and deleted. The collection of information stored in the database at_a particular moment is called an instance of the database. ‘The overall design of the database is called the database schema. Schemas are changed infrequently, if at all. The concept of database schemas and instances can be understood by analogy to a program written in a programming language. A database schema corresponds to the variable declarations (along with associated type definitions) in a program Each variable has a particular value at a given instant. The values of the variables in a program at a point in time correspond to an instance of a database schema. Database systems have several schemas, partitioned according to the levels of abstraction. This documents abe raw of charge on © studocu Downloaded by Shivani Kumar ([email protected]) ‘Types of Schemas 1) Physical schema :- The physical schema describes the database design at the physical level, 2) Logical schema: - the logical schema describes the database design at the logical level. 3) Internal schema:-A database may also have several schemas at the view levelthat describe different views of the database. ‘The goal of the three-schema architecture is to separate the user applications from the physical database.In this architecture, schemas can be defined at the following three levels: 1. Internal level or physical level-The internal level has an internal schema, which describes the physical storage structure of the database. The internal schema uses a physical data model and describes the complete details of data storage and access paths for the database Downloaded by Shivani Kumar [email protected]) a End Users - External Level ea cee ed View View Exteral/Conceptual Mapping Conceptual Level Conceptual Schema Conceptual/intemal ‘ Mapping pring t Intemal Level Internal Schema Stored Database 2. Conceptual level -The conceptual level has a conceptual schema, which describes the structure of the whole database for a community of users. The conceptual schema hides the details of physical storage structures and concentrates on describing entities, data types, relationships, user operations, and constraints. Usually, a representational data model is used to describe the conceptual schema when a database system is implemented. This implementation conceptual schema is often based on a conceptual schema design in a high-level data model. 3. External level or View level -The external or view level includes a number of external schemas or user views. Each external schema describes the part of the database that a particular user group is interested in and hides the rest of the database from that user group. As in the previous level, each external schema is typically implemented using a representational data model, possibly based on an external schema design in a high-level data model. This documents abe raw of charge on © studocu Downloaded by Shivani Kumar ([email protected]) Data independence Data independence can be defined as the capacity to change the schema at one level of a database system without having to change the schema at the next higher level. We can define two types of data independence: 1. Logical data independence - Logical data independence is the capacity to change the conceptual schema without having to change external schemas or application programs. We may change the conceptual schema to expand the database (by adding a record type or data item), to change constraints, or to reduce the database(by removing a record type or data item).In the last case, external schemas that refer only to the remaining data should not be affected. Only the view definition and the mappings need to be changed in a DBMS that supports logical data independence. 2. Physical _data_independence - Physical data independence is the capacity to change the internal schema without having to change the conceptual schema. Hence, the external schemas need not be changed as well. Changes to the internal schema may be needed because some physical files were reorganized—for example, by creating additional access structures—to improve the performance of retrieval or update. If the same data as before remains in the database, we should not have to change the conceptual schema. External level Logical Data Independence Logical level Physical Date Independence Physical level Stored Database Downloaded by Shivani Kumar ([email protected]) Difference between Logical and physical data Independence Logical Data Independence Physical Data Independence Logical Data Independence is mainly concerned with the structure or changing the data definition. Mainly concerned with the storage of the data. It is difficult as the retrieving of data is mainly dependent on the logical structure of data It is easy to retrieve. it is difficult to achieve logical data]it is easy to achieve physical data independence. independence You need to make changes in the | A change in the physical level usually does Application program if new fields are added or deleted from the database. not need change at the Application program level. Concerned with conceptual schema Concerned with internal schema Example: new attribute Add/Modify/Delete a Example: techniques, devices, etc change in compression hashing algorithms, storage Database Adi The DBA is responsible for authorizing acces jistrators to the database, coordinating and monitoring its use, and acquiring software and hardware resources as needed. The DBA is accountable for problems such as security breaches and poor system response time. DBA has the central control over the system. The function role of the DBA include: * Schema Definition: The DBA creates the original database schema by a set of data definition statements in the DDL. * Storage structure and access-method d nm: DBA decides what structure to be used to store the data and what method to be used to access that. * Schema and physical-organization modification: According to the need of the organization the DBA carries out changes to the schema and physical organization to improve the performance. * Granting of authorization for data access: The DBA administrator decides which user will access which part of the database This documents abe raw of charge on © studocu Downloaded by Shivani Kumar ([email protected]) + Routine maintenance: DBA does some of the routine maintenance like periodically backing up the database, ensure that enough free disk space available for normal operations, monitors jobs running on the database etc. Database Languages A database system provides a data definition language, which specifies the database schema, and a data manipulation language, which expresses database queries and updates. 1. Data-Definition Language (DDL): DDL is used to define the conceptual schema of the database. It is a set of SQL command used to create, modify and delete database structures but not data. These commands are normally not used by a general user, who should be accessing the database via an application. They are generally used by the DBA A data dictionary contains metadata i.e. data about data. The schema of table is an example of metadata. A database system consults the data dictionary before reading or modifying actual data. 2. Data-Manipulation Language (DML): Data manipulation includes retrieval of data stored in database, insertion of new data into the database, deletion of data from the database and modification of data stored in the database. Data manipulation language enables users to access or manipulate data as organized by different data model DMLs are of two types: Y Procedural DML: It requires a user to specify what data are needed and how to get those data. ¥ Nonprocedural DML: It requires a user to specify what data are needed without specifying how to get those data. Database Users Depending on different type of uses, there are different types of users and for each type of user different types of interfaces have been designed. * Naive users / Parametric users: There are unsophisticated users who interact with the system by invoking one of the application programs that have been written previously. They also read reports from the database, Example: bank teller, a person checking his balance through internet © Application Programmers: These are computer professionals who write application programs to develop user interfaces. Using Rapid application Downloaded by Shivani Kumar [email protected]) development (RAD) tool application programmers construct forms and reports rapidly without writing programs. Sophisticated Users: These users interact with the system without writing programs. They from their requests in a database query language and submit it to the query processor. Examples: engineers, scientists, business analytical processing (OLAP), Data mining that views them the summarized data in different ways. Casual End Users: These users occasionally access the database, but they may need different information each time. They use a sophisticated database query language to specify their requests and are typically middle or high-level managers or other occasional browsers. Database designers arc responsible for identifying the data to be stored in the database and for choosing appropriate structures to represent and store this data. System Analyst: System Analyst is a user who analyzes the requirements of parametric end users. They check whether all the requirements of end users are satisfied. Specialized users are sophisticated users who write specialized database applications that do not fit into the traditional data-processing framework Among these applications are computer-aided design systems, knowledge- base and expert systems This documents abe raw of charge on © studocu Downloaded by Shivani Kumar ([email protected]) Overall Database Structure A DBMS is a complex software system. =z =a ectensamen,| [ septenton | [Puce "| ( csupee ‘web-users) Lenie gies (analysts) ‘Spplication C application query Sdminiswaion interfaces ‘programs, tools tools _—_ ra | eae] |ooomeenes| ee Se ee a as —— object code and organizer query evaluation engine Tae authorization = ‘and integrity manager manager iierinekd bascracwicssiec storage manager disk storage data dictionary al data data Lf Some common components of DBMS are as below: 1. Storage manager: A Storage manager is a program module, which provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system. It is responsible for interfacing with file system. Downloaded by Shivani Kumar ([email protected]) y The storage manager components include: Authorization and integrity manager, which tests for the satisfaction of integrity constraints and checks the authority of users to access data. Transaction manager, which ensures that the database remains in a consistent (correct) state despite system failures, and that concurrent transaction executions proceed without conflicting. File manager, which manages the allocation of space on disk storage and the data structures used to represent information stored on disk. Buffer manager, which is responsible for fetching data from disk storage into main memory, and deciding what data to cache in main memory. Query Processor: Query processor translates statements in a query language into low-level instructions the database manager understands. The query processor components include DDL interpreter, which interprets DDL statements and records the definitions in the data dictionary. DML compiler, which translates DML statements in a query language into an evaluation plan consisting of low-level instructions that the query evaluation engine understands Data Files: Store the database itself. Data dictionary: Stores information about the structure of the database. It is used heavily. Great emphasis should be placed on developing a good design and efficient implementation of the dictionary. This documents abe raw of charge on © studocu Downloaded by Shivani Kumar ([email protected]) DATA MODEL 1. Hierarchical Data Model:The hierarchical database is the oldest form of database, This data model organizes the data in a tree like structure, The data are stored as records which are connected to one another through links. The hierarchical database model mandates that cach child record has only one parent, whereas each parent record can have one or more child records. In this data model uses parent child relationship with one-to-many ( 1:M) relationship. © Tivall Tera cut ha ys, Oo0o i] [Lead] [a] [Leal chs | Lowe | [owe | oud Desartment| Infrastnacture a = | = ——— = aa] Advantages of Hierarchical data Model + Promotes data sharing. + Conceptual Simplicity. + Data security + Data independence. + Efficiency with one-to-many relationship. Disadvantages of Hierarchical data Model + Requires knowledge of physical storage + Difficult to manage and lack of standards + Complex implementation Downloaded by Shivani Kumar ([email protected]) lodel:A network databases are mainly used on a large digital computer. It more connections can be made between different types of data. The network data model expands the hierarchical data model by providing multiple paths among segments. The difference between each child or member can have more than one parent. In this model allows one-to-one(1:1) ,one-to-many(1:M) and many-to-many (M:M) relationship. - SSS Wiathematies }< Com puter Department Sse Department | aa oS sb } Library Computer Lab Figure 2 6 Network date model forthe ‘Unieersity' system ‘Advantages: The major advantages of network model are — 1. Conceptual simplicity-Just like the hierarchical model,the network model is also conceptually simple and easy to design 2. Handles more relationship types-The network model can handle the one to many and many to many relationships which is real help in modeling the real-life situations. 3. Ease of data access-The data access is easier and flexible than the hierarchical model. ‘his documents avaiable roe charge on © studocu Downloaded by Shivani Kumar ([email protected]) 4. Data integrity- The network model does not allow a member to exist without an owner. 5. Data Independence Disadvantages: The disadvantages of network model are — 1. System complexity- All the records are maintained using pointers and hence the whole database structure becomes very complex. 2. very difficult. Lack of structural independence- Structural changes to the database is 3. Relational Model The relational model uses a collection of tables to represent both data and the relationships among those data. Each table has multiple columns, and each column has a unique name. Tables are also known as relations. The relational model is an example of a record-based model. Record-based models are so named because the database is structured in fixed-format records of several types. Each table contains records of a particular type. Each record type defines a fixed number of fields, or attributes. The columns of the table correspond to the attributes of the record type. The relational data model is the most widely used data model, Tobte datgibutes Coins) C wame Gass [siarks Age e Anoop 10 30 2 Ee = | Anweg | G0 |a2| | 2 f 2 Ganesh 10 aa Fa * column Advantages of Relational data model + Structured independence + Tabular view improves simplicity. + Support large amounts of data. + Improved Conceptual Simplicity tL setucteyrci Downloaded by Shivani Kumar [email protected]) + Powerful database management system Disadvantages of Relational data model + Hardware and system software overhead + People need training if they want to use the system effectively and efficiently. + Poor design and implementation 4. Object-Oriented Data ModelIn Object Oriented Data Model, data and their relationships are contained in a single structure which is referred as object in this data model. In this, real world problems are represented as objects with different attributes.It is extension of E-R model with additional features of encapsulation, object, methods and polymorphism. The object-relational data model combines features of the object-oriented data model and relational data model. Advantages of Object Oriented data Model 1. Semantic content is added 2. Visual presentation includes semantic content 3. Modularity 4. Reusability 5. Inheritance promotes data sharing Disadvantages of Object Oriented data Model ‘This document is avaiable fre of charge on Downloaded by Shivani Kumari ([email protected]) 1. Slow of development of standards 2. Complex navigational data access 3. High system overhead slows transactions 5, Entity-Relationship Model The entity-relationship (E-R) data model uses a collection of basic objects, called entities, and relationships among these objects. An entity is a “thing” or “object” in the real world that is distinguishable from other objects. The entity-relationship model is widely used in database design Advantages of ER model in DBMS. 1. Conceptual simplicity 2. Visual representation 3. Effective communication tool 4. Integrated with the relational database model Disadvantages of ER Model in DBMS 1. Limited constraint representation 2. Limited relationship representation 3. No data manipulation language 4. Loss of information content Downloaded by Shivani Kumar ([email protected])

You might also like