0% found this document useful (0 votes)
0 views28 pages

FDBMS Question Bank Answer

The document outlines the structure and components of a database management system (DBMS) based on the relational model, detailing the roles of various managers such as the storage manager, query processor, and transaction manager. It explains key operations like selection, projection, and joins, as well as the importance of database administrators (DBAs) and the concept of data integrity. Additionally, it describes different types of keys in database design, including primary, foreign, and composite keys.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
0 views28 pages

FDBMS Question Bank Answer

The document outlines the structure and components of a database management system (DBMS) based on the relational model, detailing the roles of various managers such as the storage manager, query processor, and transaction manager. It explains key operations like selection, projection, and joins, as well as the importance of database administrators (DBAs) and the concept of data integrity. Additionally, it describes different types of keys in database design, including primary, foreign, and composite keys.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 28
Figure below show the structure of dbms based on relation model : ative users (tellers, agents, web isers) administratos compiler and B 1 ' a" ee = DML queries [pot interpreter : application T : program DML compiler ‘ abject code and organizer : query evaluation ‘ engine ‘ query processor | buffer manager |[ file manager ‘authorization transat and intergrity manager manager storage manager disk storage indices data dictionary 4 statistical data rages + Manager . a peastorese ¥ a am’s storage manager serves as the interface between the application An database sfte7" Fete the system and the low-level data stored in the database DE en ML statements are converted into low-level file system commands by the e numerous storage manager. ‘As a result, the storage manager is in charge of putting data into the database, getting it out, and updating, it. The storage Manager components include : Authorization and integrity manager. Transaction manager. File manager. Bulfer manager. Data files. Data dictionary. Indices. ; Authorization and integrity manager : It evaluates the fulfilment of integrity requirements and verifies the legitimacy of users’ data access rights. Transaction manager : It makes sure that parallel transm: sion executions continue without colliding and that the database maintains consistency despite ystem faults. © File manager: It oversees the distribution of disc storage space as well as the data structures used to represent the information kept on disc. © Buffer manager : It chooses the data to cache in main memory and fetches it from disc storage into that memory. Since it enables the database to manage data quantities that are significantly bigger than the amount of main memory, it is an essential component of the database system. Several data structures are implemented by the storage manager as part of the physical system implementation. @ Data files: The database itself is stored in it. @ Indices ; It can provide fast access to data items. @ Data Dictionary : It stores metadata about the database structure. 1.6.2 Query Processor The query processor components include : DDL interpreter. DML compiler. Query evaluation engine. DDL interpreter ; DDL statements are interpreted, and definitions are added to the data dictionary. DML compiler : It converts DML statements made in a query language into an evaluation plan made up of simple commands that the query evaluation engine can follow. Additionally, it optimises queries, selecting the assessment plan with the lowest cost from a list of available options. @ Query evaluation engine : The DML compiler's low level instructions are evaluated by it, j ELECT OPERATION (0) {i SELECT OPERATION (0) rom a elation — Using some criteria, it selects a subset of tuples from @ relation. The select operation to choose tuples that nly affects one relation because it is a unary action. Its purpose is meet 2 specified condition. the Greek letter sigma (o ), written in lowercase, iS used to si ity choosing, a redicate is presented to as a subscript. After the o, the argument relation is provided in parentheses. (6.1 THE ROLE OF INFORMATION SYSTEMS IN. ORGANIZATIONS Many businesses employ a DBA to supervise and manage database lifecyde operations. There is also an Information Resource Manager (IRM) in the big organisations of today. DBAs are necessary because of the following reason : e Data is a crucial resource that needs to be adequately managed and regulated. e Since organisations are digitised, it is necessary to maintain data about their most recent status. @ As data and the interactions between them get increasingly complicated, we mus! retain and model these intricate connections. © Many groups have pooled their informational resources. Database systems also have additional qualities that make them appealing : @ Data independence: The application is shielded from modifications to the underlying logical structure, the physical access path, and the storage architecture. @ External schemas: identical data, different views of the data in other applications. Q) wha are ty, Pava _aecie as DOL Creates Ae Pra me WOTk, A ton Langer aeahate atetrase by speetrytng Schema, whitch TS the le Repéesenes oe ses trctude Aine escacten sabes, Wis a nqueq® wt 40 tepame oe avep ME Tks Comarna And arenaken oF AV So ailows datakasc o¢ its oant ex Totti ceeakes A NEW eATEEeKeNK: doralnase tang wns ge (ODL) oF noe Mac dakalease seruct uve ARE zation Sf— data: COMPOMENES - database ae obyeck 9 isach as a Aces Change the SLEUCUNE cttar gable sinker Dep: Detekes Ae ahe ISS Re names Rename _ ex Cc Aab\e oe COMM: ras oF dakaloate o« ext set nay obec change Abe Name ot Jaca ast 6¢ [Dara manipuia ter langue gee + COML) = DML peout sO operation Aha handle see coq ues voprering & way ts access and ' | mant palace Mc dake Maat as[ecs Srove Fuckin a darabase. | cs Comme whhyta taciading tases etn wepaact dakalaase - Co and eecter ving Taaka @esm ANS wars 40 the exiset “ galore [nse Aads Abc new 7 La > Qpaares change Lee Pe Mere cece ls ry > I H seke ces, eee cd pete Ankh ac Updo Ack de eX rows Geom ANE oom awe Ale c= tn ahe tabite cobic ee The CARTE! SIAN Ast operation, also known as the cross product or cross join, builds a relation with all of the characteristics of A and B, enabling all conceivable combinations of tuples from A and B in the outcome. The CARTERSIAN PRODUCT A and Bis rey presented by x as in A x B. SYNTAX : (Query) x (Query2) Example, R R CROSS S All A LA 1 F 47a B|2 A 1 c 2 F 4{cj2 D | 3 A I D 3 F 4 [pd ]3 F[4 A LE 4 F 4}eta E [5 B 2 [A 1 E staf Ss B 2 [Cc 2 E 5 [c [2 ATT B 2 |D 3 E 5[D|3 C12 B 2[E 4 E s|E|4 D1 3 D 3_[A 1 E14 D 3 [Cc 2 D 3 [dD 3 D 3 [E 4 Fig. 4.4 [4.8 JOIN OPERATOR If and only if as distinct relations. It i: Pecific join condition is met, a join operation pairs two tuples from 7 's denoted by va (bow-tie symbol). Consider the two ri with attributes srmo,cou a) Natural Join (a) It is a specific example of equijoin where all attributes with the same name in relations R and $ satisfy the equality criterion (relations on which join operation is applied). No explicit equality requirement needs to be written when using a natural join on two relations. Since their values will be identical in the resultant relation, Natural Join will also only return similar characteristics once. elations Student with attributes srno,sname,age and SAcademics tse, grade to understand the various join operators. Example, select students whose rolino is equal to rollno of Sacademics Student v4 SAcademics b) Conditional Join(r) Conditional Join is used when two relations are joined based on some conditions. Example : Select students whose ro is equal to rollno of Sacademics. Student >< c student.rollno=sacademisc.rollno c) Outer Join In an outer join, it forcefully fetches the non-matching records from the joining relations. i) Left Outer Join (R 4 S) : Left outer joins fetches all non-matching tuples from the left hand side table i.e. in relation R and S, all non—matching tuples from relation R will be displayed along with matching tuples from . Right Outer Join ( R O€ S) : Right outer joins fetches all non-matching tuples from the right hand side table i.e. in relation R and S, all non—matching tuples from relation S will be displayed along with matching tuples from R. iii) Full Outer Join (R € $) ; Full outer joins fetches all non-matching tuples from both the tables ie. in relation R and $, all non—matching tuples from both relation R and $ will be displayed along with matching tuples. iil 24 ge." Fundamentals of DBMS ~(F.Y.B.Se-LT. ~ Sem. “t Syntax Scondition(relation) Where, conditionis a boolean expression in which rows are selected for which thy condition is true. For example, display the details of employees working as "Analyst", we write ojob = "Analyst" (émp) 4.3 PROJECT OPERATION(o) Projection is denoted by the Greek letter pi (r). It selects the specific attributes from the relation. Syntax: Tlattribute(s) (relation) For example, a) List all employee numbers with their names from employee table. Tempno, ename(emp) Display the employee names earing salary less than 2000. Tename(Osal< 2000 (emp)) b 4.4 RENAME OPERATION(p) The output relation is renamed using the rename operation. Rename is denoted by the Greek letter rho (p). : Syntax: P(relation) For example, a) Rename emp to employee Pemployeelemp) b) Find the salary of an employee whose name is Allen from the relation emp_details. Tsal(Cename= “Allen” (Pemp_details(emp))) [ee ee Results from two or more SELECT operations can be cc operators, All involved SELECTS must: get the same amount of c the appropriate columns in each involved SELECT must be compatible. SQL set operators aggregate rows from several queries with these stringent preconditions (either the same or with Possibility implicitly convert to the data types of the first SELECT statement). Set operators are — UNION, INTERSECT, DIFFERENCE OR MINUS. Union Operator The union operation yields the results that appear in either or both of two relations. It is a Results Relati Sy) KOVOERE ROWIEyEs Lae oe = paca Qury language COG Lg Quevy__lanquagyte [Ree often Known %s OQt oc Data [Guety language hat AEE wsech Ao mole vasioug queties to Ineormatton system and clatahasrds. The Seeuckused —Quesy Janquagc (S@t) Ps A wen Enea | trample. NGL Srakemenk ave used 40 Queey the chats tgatcained Rn SCHEMA abjeces. The pamaty goal oF ahe_OGL Command fs to secutn a schema eeation atpen ating on are Guy Supplied do Ve. The DAL Skaemene ca) Me Used IW GALE AO Quen Ane cdhaka and ineotmatien contained rn Shuma objts~ yy Data contre, Vanguage (CESS DCL centras accest ae the Atk Atal lustes sexe wtarta a aaeabsse: . E ssemeialty . this tang ung e cones ey THe ARLE ond premtssions oF the atacasoase sagseey [Ne anows —usees to geant GF sevolte peisdeges [xo KL GF atabare. oy | Grant: Gus a user access je The database a | Revekcs Pemoves A aice's access 46 aatabase Models goo 19 Unique Key A group of one or more fields or columns from a table that together uniquely identify cord ina database table is known as a unique key. There can be more than one unique ina relation. A unique key accepts multiple Null values. Ina given relation, Phone is a unique key. — er _ OOO table’s structure. Bj si action in the ; p essential fu lables truce By ationship between tables, ET eer ane or a combination of fieldy DATABASE In a relational database, keys play at ermining the 1 shi Hy identifiable accessed logically using a key. enforcing integrity and det no, Frame, Lname, DOB, Phone, Address), record within a database can be unig within the table, A table's records can Consider a relation Student (Gr_ne, Rell and Result (Gr_no, Sub_code, Marks} a table that uniquely identifies each > Super Key / 'A Super key’ is any combination of fields within record within that table. cacti xtion! nos In above relation Student, Gr_ne and Roll_no forms a super key as each a unique Gr_no. of keys that collectively and > Can ; y is a single key or a collection cory d fina datnbase. A Candidate key isa subset of Super keys and is for tuple identification. For all spe y iy Jol free of any extraneous characteristics that are not necessary F ; j 1 je must tuples. the Candidate key value is distinct and non-null. Additic mally, each table mus contain at least one Candidate key. There may, however, be more than one Candidate Key. , In above relation Student, Gr_no and Roll_no are the candidate keys as they uniquely identifies the records. > Primary Key A primary key is a potential key that is most suitable to serve as the table's principal reference key. It serves as the main key of reference for the table, as its name imp ies, and is employed across the database to build connections with other databases. The primary key, like every candidate key, must have distinct values, never be null, and uniquely identity each entry in the database. There can be only one primary key in a relation A primary key is a mandatory key whose value is unique ie, non repeative and compulsory. No value can be missing value in primary key field. Primary Key = Unique + NOT NULL In above relation Student, Gr_no will be the most appropriate choice of primary key > Foreign Key A forvign key is a reference to a primary key field of a referenced table, A table with a Primary Key is known as Parent table and a table with foreign key is known as Cl table. A child can exist only when a parent exists, so therefore, a record in child table must have a reference record in a parent table. In other words, if we had a table A with a primary key X that linked to a table B where X was a field in B, then X would be a foreign key in B. In above relations Student and Result, Gr_no is a primary key in student relation and foreign key in Result relation, & Secondary Key or Alternative Key A candidate key other than primary key is known as alternate key. In above relation Student, if Gr_no is a primary key, than Roll_no is an alternate key. > Composite Key A composite key uses multiple fields to specifically identify a record. In contrast to a compound key, this one has one or more qualities that are not simple keys on their own. Ina given relation Result, Gr_no and Sub_code is a composite key. Relational Algebra binary operation denoted by the symbol U. SYNTAX : (Query1) U (Query2) Intersect Operator The set intersection operation is denoted by the symbolN. The SQL INTERSECT clause/operator is used to combine two SELECT statements, but returns rows only from the first SELECT statement that are identical to a row in the second SELECT statement. This means INTERSECT returns only common rows returned by the two SELECT statements. SYNTAX: (Ouerv1) M(Query2) Resultant Relation | fast unsuitable for handling today 1.4.1 Disadvantages of File Processing System wie same data. The fil ai ow information and d Nement neh OloRy is lata management needs. The conventional file processing system suffers from the follo s oa Data Redundancy. ing shortcomings : Data Inconsistency. Difficult in Accessing Data. Data Isolation. Integrity Problems. Atomicity Problem. Concurrent Access anomalies. Security Problems. Data Redundancy : Redundant data is information that appears in multiple file: at the same time. Data redundancy results from this. : Data Inconsistency : Different versions of the same data that are inconsistent de not match. That implies that the same essential information exists in many versions. Update activities that don’t update the same data stored in many locations result in this. Example: A consumer's address information is recorded in many files in different ways. Difficulty in Accessing Data : Information cannot be easily retrieved using 2 traditional file processing system. Using a traditional file processing system makes it nearly hard to retrieve information quickly and effectively. nos the characteristic of an entity. They can be defined as follows ute defi e and composite attributes. ‘alued and multivalued attributes. Required and optional attributes. Derived attributes. Null attribute Key attribute. ple and composite attributes ‘A simple attribute is one which cannot be further divided into subparts. E.g. gender, ‘An attrib simpl ingle v DUbvpe e etc. a a8e ON mposite attribute can be divided into subparts, E.g. An attribute name can be divided int 2, Single val 9 fname, Iname, mname. lued and multivalued attributes A single valued attribute can have a single value for a particular entity. E,g. Student id attribute for a student entity refers to only one student id value at a time. ‘4 multivalued attribute can have several or multiple values for a particular entity. E.g. Phone no attribute for a student entity can have zero, one, two etc. values at a ime. 3 Required and optional attributes A required attribute is mandatory or compulsory to have a value. E.g. Student id attribute enforces to have unique and mandatory value for an entity. An optional attribute can or cannot have a value. E.g. email id, phone no. 4, Derived attributes The value for this type of attribute can be derived from the values of other attributes. Eg. age can be derived from date of birth (DOB) attribute. 5. NULLattribute This attribute takes NULL value when entity does not have a value for it or value is .e. it is unknown value for an entity. missing for the field, 6. Key attribute An entity type usually has an attribute whose values are distinct for each individual entity in the collection. Such an attribute is called a key attribute and its values can be used to identify each entity uniquely. ling and Database Design conertual Modelling ig eee » 3. Participation The association between entity set is referred to as participation. The Participation of an entity in a relationship is said to be total if every entity Participates in a relationship ‘vith at least one relation. If only some entities are participated in a telationship then it is said to be partial participation of an entity. ‘Anentity set may participate in a relation either totally or partially. - Total participation : Every entity in the set is involved in some association (or tuple) of the relationship. - Partial participation : Not all entities in the set are involved in association (or tuples) of the relationship. Notation partial El E2 total Fig. 5.6 eistiatio" / / see pene xing down a higher level entity set into ts “Hivel entity sets. A series ‘of sub classes of an entity type, oMponent parts to @ HOWE GE the specialisations are defined in this procedure relerted 10 as the sting the foundation for defining cabitage 5 Subclasses, aits of the super class § operat the tr thes a Fy specialisation involves adding additional traits to an ithe jects an existing ¢ es of objects. Using, addition cash of ities, one or more new ¢ ting with a higher-lev a -level object. Th Py |. The traits of the own to the lower-level entities. focess in order to entities tity are likew n with attributes, generate re created by star passed d a name, and a city in an entity se od nt or an employee. Each of Hee pease A person may be Fs eributes that combines their unide Mitributes with all the Gescribed by a While employee entities 0 tbe characterised with em she propertin of the yin the attribute customer id. The specialization and salary, ° of a person customer respectively. jevel vel en a perso! jas either a cliet erson. rr entities can com om sistinguishes has employee or PERSON EMPLOYEE HYMN OCAAT, Gey wee -mtity sets FULL TIME-EMPLOYEE and PART TIME ; or example, The Sat, the entity set MPLOY E. The entity set FULL are both generalised INO TT cherited by FACULTY and STAFF, and this entity EMPLOYEE'S ato ick of EMPLOYEE. The new attribute Salary distinguishes : E et EMPLOYEE. Similarly, the inclusi \ EE ma orits the PFOPe! the en tum inhents t ey specialty, of th : TM EN oye distinguishes the specialization PART TIME EMPLOY wpe ttribute = Conte. flire) the a (eran) (Name Date of Hire L—{ Employee _| | SPECIALIZATION } + GENERALIZATION} ae __ Pum PART_TIME_ 8 employee EMPLOYEE __, — ISA ISA ISA Is_A) feeuty ] (sar teaching] [casual ] cS) Caer) Cassifcation) (“Stipend ) Cow Rave) ei Fig. 5.14 ® sett DEPARTMENTS PROJECTS Fig. 5.9 Binary relationship When two entities are in association with each other, it results into a bi inary relationship. E.g.: Many employees are assigned to a project. ——— PROJECT Assign EMPLOYEES Fig. 5.8 2 3. Ternary relationship When three entities are in association with relationship, it forms a ternary relationship. mployee is assigned to a department to work on a project. 1 Mapping 2 Participation 4 Fag cardi alities L Merrie aeeinalities ‘or cardinality’ ration, e% re lationship 5 he follow Tbe associated ¥ ee cane be one oft press the number of e n ntities ‘or a binary relationship pe which and B the mappin: a) Onet b) OneteM 2) Many-teOne d) Many-to-Many an entity in A is fany associated with exactly one enti entity in A. *° ‘Hy In B and ong 3) One-to-On sociated with exactly one entity in Bisa [Tenis F b) One-to-Many : An entity in A i Oneto : y in A is associated wi gntity in B can be associated with at most sania number of entities in B, s ‘ity in A. + An Fig. 5.2 1 relationship M Entity Entity Fig.5.3 ©) Many-to-One : An entity in A i y : An entity in A is associa! i kas 7 It Mee cckiviveyaacemena ies in A. a relationship Entity Entity @) Many-to-Many : An enti Fig. 5.4 and an entity in Bis ascot ncd ite i 5 it associated wil ty in Bis associated with any ciated with any number of entities in B, ies in A. relationship Entity Fig. 5.5 7 DATA MODELLING } a Be f developing a data model for the data that will be kept in a database is The process of ‘ as data modelling. This data model is a conceptual representation of the nown al c veesonships between various data objects, the rules, and the data objects themselves. Data modelling facilitates the visual representation of data and ensures that it complies with legal requirements, business regulations, and governmental directives Data models guarantee data quality while guaranteeing uniformity in naming standards, default values, semantics, and security. 52 DATA MODEL | The definition of a data model is an abstract model that groups data semantics, consistency requirements, and data description. Instead of focusing on the operations that will be carried out on the data, the data model stresses what data is required and how it should be organised. Similar to a building plan for an architect, a data model establishes relationships between data objects and aids in the creation of conceptual models. 12 wee © Many-to-many othe Fundamentals of DBMS ~ (F.¥.B.Sc. a. P= Sem, (M : M) relationship : Many entities are associated with Man, F entities. E.g., Many employees are enrolled for many courses. Fig22 MANAGER 7 DEPARTMENT DEPARTMENT has M} EMPLOYEE - M EMPLOVEE joins COURSE There are G BLOCKS OF DATA MODEL 7 four building blocks of data model, which are listed as + Entity Rel Constraints | Entity : An ent defined as an object that exists in real world such as_person, ing or event about which the data are to be collected and stored. An he fundamental item in any data model as it is distinguishable i.e. each gntity occurrence is unique and distinct, eg CUSTOMER, STUDENT ete. ‘Attribute : The characteristic describing, an entity is called attribute. Eg attributes of CUSTOMER entity are cname, cphone, caddress, cgender. Each attribute represents a domain with set of specific values. Relationship: An association between entities is described by a relationship. Eg, there exist a relationship between the entities publisher and book as many books are published by a publisher. place, thit PUBLISHER 2 publish M BOOK Fig.21 Data models use three types of relationship cardinality : One-to-one (1: 1) relationship : There can only be one other entity that one entity is connected to. E.g., one manager manages only one department. One-to-Many (1: M) relationship : Any number of additional entities are connected to one. E.g., One publisher published many books. F.Y.BSc. 1.1 Fundamentals Database Management System (Sem. 1) 7. Sem.) Fundamentals of DBMS ~ (F.Y.B.Sc.- west level of data abstraction which describes “ how! he definition of the stored record, the way the data| | : and the access aids are all expressed at 6 ee a) Physical level : This is the lo the data is actually stored.” TI r fields are represented, the internal view, the physical level, or internal schema. Logical level : This level defines ” what data are actually stored in the database] b) and what relationships exist among those data”. The conceptual schema in relational DBMS explains each relationship that is kept in the database. View level : This is the highest level of abstraction as seen by a user. This level of abstraction describes “ only the part of entire database which exists to simplify the interaction with the system”. External level View View View va - Mapping supplied by DBMS —"5 wat im Mapping supplied by DBMS?0S “mE 7 Fig. 1.2 ) Instancac ana c« *tlonship among the three levete né 21-1 qd) ) Data Abstraction Data abstraction is a technique used to conceal some of the specifics of how data is kept and maintained in the system. je three levels of abstraction are as : a) Physical level b) Logical level. ©) View level. pat gystem — Concept and Architecture ‘ “ rere lation : Writi ew icati 5 Data Is riling a new application programme to retrieve data is tough a is tough since data are dispersed among multiple files and the files A he files may be in different Integr Problem : Some integrity requirements may need to bi 0 i ¢ met by the riues, For instance, the value in the balance field must be Kishor dane S000 use of programme code in file processing systems, we must handle Through the the integrity restrictions can be declared with the definition itself this. However, ina database. Atomicity Problem : In a file processing system, atomicity is difficult to guarantee. Suppose $100 were transferred from account A to account B. If there is. a problem With the execution, it can happen that $100 is taken out of account A but not credited to account B. Concurrent Access anomalies : Multiple users simultaneously modifying the same data will lead to inconsistent data state. It is quite challenging to handle this utilising programme code in a file processing system. Anomalies in concurrent access are the outcome. Security Problems : Due to the ad hoc addition of application applications to the ° file processing system, it is exceedingly challenging to enforce security constraints. 142 Difference between File Processing System and DBMS File Processing System DBMS 1._| Itcoordinates only with physical Tt coordinates with both physical and access. logical data. 2. | Data written by one program may Reduces amount of data duplication not be readable by another 3. | Itallows predetermined access to Allow flexible access to data data. + | Data is not secured Data is secured. 5 lit allows one or more program to Allows multiple users to concurrently access different data files at the same | access the data files. ___| time only if files are readable. ne

You might also like