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

12 Dbms

dbms notes

Uploaded by

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

12 Dbms

dbms notes

Uploaded by

Roshan Pandey
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 15
Database Management System (DBMS) Pier trate oben rel BOAR Sieh PS Diks Data A raw fact about anything which does not give any complete meaning is data. Data is a set of values of subjects with respect to qualitative or quantitative variables. Data and information or knowledge is often used interchangeably; however data becomes information when it is viewed in context or in post-analysis. When you post a status on Facebook, perform a banking transaction online or upload a selfie on Instagram, you are actually sending data to the site or to be precise their server. So, we can say any information transmitted or transferred is actually data. To derive meaning, data is always interpreted by a machine or human. So, it is meaningless. Data comprises of statements, characters and numbers in a raw form. Examples of Data; the number of visitors to a website by country, for the past 100 years, the history of temperature readings around the globe is the data. Information: The processed data which gives some or complete meaning is called 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. For the decision to be meaningful, the processed data must qualify for the following characteristics > Timely — Information should be available when required. > Accuracy — Information should be accurate. > Completeness — Information should be complete. Data Processing Cycle Data processing is the re-structuring or re-ordering of data by people or machine to increase their usefulness and add values for a particular purpose. Data processing consists of the following basic steps - input, processing, and output. These three steps constitute the data processing cycle. > Input — in this step, the input data is prepared in some convenient form for processing. The form will depend on the processing machine, For example, when electronic _— the input data can be used. ae agnetic dis uch as pot mem, sve a — in this step. the wks tain: De form, For example, pay-checks can be computers are ‘ be calculated from the esult of the proceeding processing sales for the month can is stage, the Te Output ~ at this slag of the output data depen particular form hocks for employees. data may be pay-cl Differernce between Data & Information: tapes, a input data is changed to produce data in calculated from the time cards, or 9 5 ds on the use of the data. For example + recone OM ANY ONE OF the gag ray nd so on. More ‘um “ay sales orders. StED iS collec, he x ae Information 1. | Quantitative or Qualitative variables that | Information is @ set off data that ean) are useful to generate ideas or | news and meaning. ' conclusions. | 2 | Data comes in the form of letters, | Information is in the form of ideas a) numbers, or a character sel. inferences. | 3. | Data has no particular purpose. Information carries the meaning assigned by the data interpretation. 4. | Information which is gathered. Information which is processed, 5._| Data nev 5 | Ba siden on owed Information depends on Data. . | Data is a low-level Knowledg formation i edge, Information is the second level of knowledge. 7. | Data contains unprocess fo processed raw Factors, = information’ | ; clots, The information is processed in 4 meaningtil 8. | Th Ne he dala depends on the sources to be | Informati dlls formation depends on the data. 9. Data alone di loes, e r not have any | Informati omic | significance, ‘Oration by itself is significant. 10. | Data is bs - 's based on the observations ang Tio servations | recor Sand | I ion i i records and is stored in computer and oe i moe eile com <4 [seen by an individual (© the data, It enables the researchet © | |The data whe ee c ean hich is gathered by a] Table — Basic unit of storage; composed rows and columns > View— Logically represents subsets of data from one or more tables > Sequence- Index - Improves the performance of some queries es primary key values > Synonym - Altemative name for an object What is a KEY? A KEY isa value used to identify a record in a table uniquely. A KEY could be a single columa or combination of multiple columns Note: Columns in a that are NOT used to identify a record uniquely are called non-key columns. Primary Key Fig, Primary Key A primary is @ single column value used to identify a database record uniquely. Tt has following attributes + A primary key cannot be NULL > Aprimary 'y value must be unique primary key values should rarely be changed > The primary key must be given Alternate Key ALTERNATE KEYS is a column or group of columns in a table that uniquely identi row in that table. A table can have multiple choices for a prim: the primary key. All the keys which are not primary key are @ value when a new record is inserted, every ry key but only one ean be set as lied an Alternate Key, Stud-ID | Roll No | First Name | Last Name | Emait I i | Ram | Nath be@ gmail.com 2B Hari arma zla@\gmail.com | | Shakya [email protected] 13 Radha tud-ID, Roll No, Email is qualitied to become the primary key, Roll No, Email becomes the Candidate Key «primary key. But since Stud-ID is alternative key. CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table. Candi is te Key a super key with no repeated attributes. The Primary key should be selected from the candidate keys. Every table must hav candidat ta single candidate key. A table can have multiple but only a single primary k Properties of Candidate key: > It must contain unique values > Candida may have multiple attributes > Must not contain null values * It should contain minimum fields to ensure uniqueness: > Uniquely identify each record in a table candidate keys which help us to Example: In the given table Stud [D, Roll No, and email uniquely identify the student record in the table Foreign Key In Table 2, Membership 1D is the Foreign Key [ Movies Rented Pirates of the Caribbean Clash of the | Forgetting Sarah Marshal 2 Daddy's Little Girls 3 Clash of the Titans Integrated Computer Approved by Curriculum Development Centor (CDC), Nepal Fig. Foreign key another Table! It helps connect your Table e from its primary key ‘ows in another .s the primary key of have a different nam have corresponding do not have to be unique. Most often they aren ry keys can not ' Foreign Key reference’ > A foreign key can > Itensures rows in one table > Unlike the Primary key, they’ be null even though prima! oe Foreign ‘Membership ID | Movies Rented Pirates of the Caribbean Clash of the Titans > Foreign keys can 1 2 Forgetting Sarah Marshal 2 Daddy's Little Girls 3 Clash of the Titans Foreign Key references Primary Key Foreign Key can only have values present in primary key It could have a name other than that of Primary Key a Primary Key [ Membership 1D] | Full Names Physical Address 1 Janet Jon Jones _ | First § 1 treet P! 3 {Robert Phil | 3" Street 34 3 Robert Phil_[ 5" Avenue ie Ir. Composite Key In our database, we have two people with the same name Robert Phil, but they live in different places. Composite Key Names are common. Hence you need name as well addres s to uniquely identify a record. Hence, we require both Full Name and Address to identify a record uniquely. That is a composite k databas. ‘Structure and controls acce: The DBMS serves as the intermediary between the user and the database. The database structure itself is stored as a collection of files, so, we can access the data in those files through the DBMS. management rem (DB, ‘10 the data stored in the database. 18) is a collection of programs that manages the database Objectives of Database: >» To provide huge storage or space for relevant data. > To allow easy access to the data for the user. > To provide quick response to user request for any information ot data. > To allow updating with the latest modification in the database, >» To remove duplicate data. > To allow many users to the database at one time. > Toallow th owth of database system, > To provide maximum protection to data from any physical damage and unauthorized access. Advantages: I. Improved data sharing ‘An advantage of the database management approach is, the DBMS helps to create an environment in which end users have better access to more and better-managed data, in their — Such access makes it possible for end users to respond quickly to changes environment. on Improved data security The more users access the data, the greater the ris! s of data security breaches. Corpora . lOng invest considerable amounts of time, effort, and money to ensure that corporate data 4 used properh \ DBMS provides a framework for better enforcement of data privacy ay security polici Better data integration Wider access to well-managed data promotes an integrated view of the organization's operations and a clearer view of the big picture, It becomes much easier to see how action in one segment of the company affect other segments. Minimized data inconsistency Data inconsistency exists when different versions of the same data appear in differen, places. For example, data incon: sales representative's fency exists when a company’s sales department stores a name as “Bill Brown" and the company’s personnel department stores that same person’s name as "William G, Brown," or when the company’s regional sales office shows the price of a product as $45.95 and its national sales office shows the same product’s price as $43.95. The probability of data inconsistency is greatly reduced in a properly designed database. Improved data access The DBMS makes it possible to produce quick answers to ad hoc queries. From a database perspective, a query is a specific request issued to the DBMS for data manipulation—for : example, fo read or update the data, Simply put, a query is a question, and an ad hoc query is a spur-of-the-moment question. The DBMS sends back an answer (called the query result set) to the application. For example, end users, when dealing with large amounts of sales data, might want quick answers to questions (ad hoc queries) such as: > What was the dollar volume of sales by product during the past six months? > What is the sales bonus figure for each of our salespeople during the past thre’ months? » How many of our customers have credit balances of 3,000 or more? Improved decision making i Better-managed data and improved data access make it possible to generate better-quslll information, on which better decisions are based. The quality of the information gene depends on the quality of the underlying data, Data quality is a comprehensive approwet® | promoting the accuracy, validity, and timeliness of the data, While the DBMS does guarantee data quality, it provides a framework to facilitate data quality initiatives. aie 7, Increased end-user productivity The availability of data, combined with the tools that wansform dom into usable information, empowers end users to make quick. informed decisions that can make the difference between success and failure in the global economy. Till now we have seen different benefits of database management systems. But it has certain limitations or disadvantages. Disadvantages: 1. Increased costs One of the disadvantages of DBMS is Database systems require sophisticated hardware and software and highly skilled personnel. The cost of maintaining the hardware, software, and personnel required to operate and manage a database system can be substantial. Training, licensing, and regulation compliance costs are of implemented. hen databa n overlooked 2. Management complexity sources and culture. The changes introduced by ¢ stem must be properly managed to ensure that they help ad fact that database systems hold cruci accessed from multiple sources, securit database object Given the Maintaining currency ‘To maximize the efficiency of the database system, you must keep your system current. Therefore, you must perform frequent updates and apply the latest patches and security measures to all components. Because database technology advances rapidly, personnel training costs tend to be significant. Vendor dependence. Given the heavy investment in technology and personnel training, companies might be reluctant to change database vendors. As a consequence, vendors are less likely to offer pricing point advantages to existing customers, and those customers might be limited in their choice of database system components. 4. Frequent upgrade/replacement cycles DBMS vendors frequently upgrade their products by adding new functionality. Such new features often come bundled in new upgrade versions of the software. Some of these versions require hardware upgrades. Not only do the upgrades themselves cost money. but it also costs money to train database users and administrators to properly use and manage the new features. 4.4 DDL (Data De Language) 4 ae DME (Dat, Giiied) PE erect) and (Data a know is the database language by the, Re of, ting database and also we can use this aa qerall Structured Query Language (SQL) as _ al . in operations on the exi . e can perform certain operations 01 databa Heo we ca : wi ps se. SOL uses certain commands like Create, Drop. Insert etc tocar create a database. SQL u: ag required tasks. a ‘These SQL commands are mainly categorized into four categories as: 1, DDL ~ Data Definition Language 2. DQL = Data Query Language 3. DML ~ Data Manipulation Language 4. DCL Data Control Language DDL (ata Definition Language) DDL or Data Definition Language actually consists of the SQL commands that can be Used yy define the database schema. It simply deals with descriptions of the database schema and iS us to create and modify the structure of database objects in the database. Examples of DDL commands: ~ CREATE- is used to create the database or its objects (like table. index, functi, views, store procedure and triggers). + DROP- is used to delete objects from the database ~ ALTER- is used to alter the structure of the database. » TRUNCATE-is used to remove all records from a table, for the records are removed, ~ COMMENT -is used to add comments to the data dictionary. > RENAME -is used to rename " including all spaces alloc! an object existing in the database. DML (Data Manipulation Language) gs The SQL comm: ands that deals with the manipulation of data present in the database belt? DML or Data Mi anipulation Langnage and this includes most of the SQL statements. Examples of DML: * INSERT- is used to insert data into a table, + UPDATE ~is used to update existing data within a table. >» DELETE- is used to delete records from a database table. ifferent between DDL and DML: SN | DDL Wata Definition Language) DML (Data Manipulation Lanyuage) 1 DDL stands for Data Definition | DML stands for Data Manipulation Language. Language. 2 DDL statements are used to create | DML statement is used to insert, update database, schema, constraints, users, | or delete the records. tables etc. 3 DDL has no further classification. DML is further classified into procedural DML and non-procedural DML. 4 CREATE, DROP, RENAME and INSERT, UPDATE and DELETE. ALTER. 5 Database Model { Database model defines the logical design and structure of a database and defines how data vill be stored, accessed and updated in a database management system. Database Model gives 1s an idea that how the final system will look like after its complete implementation. It defines he data elements and the relationships between the data elements. Data Models are used to show how data is stored, connected, accessed and updated in the database management system. |. Hierarchieal Model Hierarchical Model was the first DBMS model. This model organizes the data in the hierarchical tree structure. The hierarchy starts from the root which has root data and then it expands in the form of a tree adding child node to the parent node. This model easily represents some of the real-world relationships like food recipes, sitemap of a website etc. Example: We can represent the relationship of the college in the following way: ABC College Fig. Hierarchical Model —_ -eniead Motte! / afc ceatures of a Hierarchical © - aanized ina tree-like structure Features of a Hie mth ts bee onan in ee Mag seto-maany relations!” es. Also, ‘an be on} 1. One-to-many ein Yt oneto-many relationshiD from parent to any nodes Relationship: child node. hy child node has @ parent node but a parent Meg Eacl grents are not Multiple p2 2, Parent-Child allowed, have more than one child te c e child node is “ Deletion Problem: IU 8 parent node Is deleted then the eS automatic eletion Problem: It a pi } deleted, Advantages: > Tris very simple and fast to tra verse through a tree-like structure. automatically reflected in the child node so, 4, > Any change in the parent node is integrity of data is maintained. Disadvantag re not supported. > Complex relations! it does not support more than one parent of the child node so if we have som child node needs to have two parent node then that cat complex relationship whe! be represented using this model. > Ifa parent node is deleted, then the child node is automatically deleted. 2. Network Model This model is an extension of the hierarchical model. 1t was the most popular model before relational model. This model i the sa i ha This he same as the hierarchic: el, the i record can have more than one pi el model the only difference ag el replaces the hierarchical tree with a graph. in network model, data are represente . “are represented by a collection of records and relationships among are represented by links. A link is a s arbitrary graph Rete a link is an association between records, The records are recognized irk model is still popular on powerfil mainframes sare ainframes. 1491 tan oe Features of a Network Model Advantages: Ability to merge more Relationships: In this model, as there are more rel data is more related, This model has the ability to manage one-to-one relationships as well as many-to-many relationships. ‘Many paths: As there are more relationships so there can be more tha same record, This makes data access fast and simple. Circular Linked List: The operations on the network model are done with the help of in one path to the the circular linked list, The current position is maintained with the help of a program and this position navigates through the records according to the relationship. > This model is more flexible. > Itreduces redundancy. > Searching is fi Disadvantages: It is very complex type of database model. ~ > Itneeds long programs to handle the relationship. > > Pointers needed in the database model increases overhead of storage. s security in comparison to hierarchical model because it is open to all Relational Model ‘Relational Model is the mi ost widely used model. In this model, the data is maintained in the is stored in the form of row and columns. form of a two-dimensional table. All the information i | The basic structure of relational model. fa relational model is tables. So, the tables are also called relations in the Example of Relational Data Model: - |The database has 3 tables (relations): Employee, Department & Project. EMPLOYEE (E No, E Name, E Add, E Sal, Gen, DNO) ‘DEPARTMENT (D No, D Name, D Location) [PROJECT (P No, P Name, P Location, E No.) “The entity name is shown in UPPERCASE: ‘The primary key field is under!: ined; The attributes are shown in brackets, separated by commas. ner Science for Grade XT | 13 1 ae “Integrated Compu prpoetty: ‘Curriculum Development Center (CDC), Nepal PROJECT _ PNo | P Name [__P Location | rey 1 | English book | 10) | 4 2 | Com. Networking | 102 | pt i 3 a | 3 Billing System | 103 | 5 a 4 Grading | 104 | HI 5 Speaking | 105 | Bf wee and the foreign key for the thle” Note: - E No is the primary key for table Employ similarly: D No. is the primary key for the table o! we. The primary key and the foreign key are the fie} f Department and foreign key for thet Employ: ds that relate tables to each? Features of Relational Model hy row in the table is called tuple, A row contains all the informatio. any instance of the object. In the above example, each row has all the infor 4 any specific individual like the first row has information about Bhim. ¢ table or rs example > Attribute or field: Attributes are the property which defines the values of the attribute should be from the same domain. In the above different attributes of the employee like Salary, Gender, etc. Advantages: > The rules are common in each table and easy to link one table to another: 7m 114 | Integrated Computer Seience for Grade XII approved by Cariouton Dew Cott edb “ope > Nonmalization of database is possible, > Quick database processing is possible. > Ithas very less redundancy. It enables a computer system to accommodate a variety of file inquires in an efficient . manner. | ® Italso helps to add indexes for table. | Disadvantages: | > Iris complex than other models. > Itis confusing as many rules being applied and becomes non-user friendly. > The index portion of the file must be created and maintained along with the file records, » In some cases, the index portion of the file may be larger than the file with the file records. > The file index must be searched sequentially before the actual file records are obtained, resulting in wastage of time. GR eotea tts a Ce elieet tent ‘Normalization is 2 database design technique that reduces data redundancy and eliminates desirable characteristics like Insertion, Update and Deletion Anomalies. Normalization rules vide larger tables into smaller tables and links them using relationships. The purpose of ‘ormalization in SQL is to eliminate redundant (repetitive) data and ensure data is stored ically. 2 inventor of the relational model Edgar Codd proposed the theory of normalization of data ‘with the introduction of the First Normal Form, and he continued to extend theory with Second and Third Normal Form. Objectives of Normalization are a) It reduces redundancy. b) It improves faster storing and indexing. c) It simplifies the structure of database. > INF (First Normal Form) 7 2NF (Second Normal Form) > 3NF (Third Normal Form)

You might also like