Database Concepts

Transcription

DatabaseConceptsChapter7In this chapter»» Introduction»» File System“Inconsistency of your mind Can damageyour memory Remove the inconsistentdata And keep the original one !!!”— Nisarga Jain»» Database ManagementSystem»» Relational Data Model»» Keys in a RelationalDatabase7.1 IntroductionAfter learning about importance of data in theprevious chapter, we need to explore the methodsto store and manage data electronically. Let ustake an example of a school that maintains dataabout its students, along with their attendancerecord and guardian details.The class teacher marks daily attendance of thestudents in the attendance register. The teacherrecords ‘P’ for present or ‘A’ for absent againsteach student’s roll number on each working day.If class strength is 50 and total working days in2021-22Chap 7.indd 12319-Jul-19 3:45:07 PM

124Informatics Practices – Class XIa month are 26, the teacher needs to record 50 26records manually in the register every month. As thevolume of data increases, manual data entry becomestedious. Following are some of the limitations of manualrecord keeping in this example:Activity 7.1Visit a few shopswhere records aremaintained manuallyand identify a fewlimitations of manualrecord keeping facedby them.1) Entry of student details (Roll number and name)in the new attendance register when the student ispromoted to the next class.2) Writing student details on each month’s attendancepage where inconsistency may happen due toincorrectly written names, skipped studentrecords, etc.3) Loss of data in case attendance register is lost ordamaged.4) Erroneouscalculationwhileconsolidatingattendance record manually.The office staff also manually maintain Studentdetails viz. Roll Number, Name and Date of Birthwith respective guardian details viz. Guardian name,Contact Number and Address. This is required forcorrespondence with guardian regarding studentattendance and result.Finding information from a huge volume of papersor deleting/modifying an entry is a difficult task in penand paper based approach. To overcome the hasslesfaced in manual record keeping, it is desirable to storeattendance record and student details on separate datafiles on a computerized system, so that office staff andteachers can:1) Simply copy the student details to the newattendance file from the old attendance file whenstudents are promoted to next class.2) Find any data about student or guardian.3) Add more details to existing data whenever a newstudent joins the school.4) Modify stored data like details of student or guardianwhenever required.5) Remove/delete data whenever a student leaves theschool.7.2 File SystemA file can be understood as a container to store data ina computer. Files can be stored on the storage deviceof a computer system. Contents of a file can be texts,computer program code, comma separated values2021-22Chap 7.indd 12419-Jul-19 3:45:07 PM

Database Concepts125(CSV), etc. Likewise, pictures, audios/videos, web pagesare also files.Files stored on a computer can be accessed directlyand searched for desired data. But to access data of afile through software, for example, to display monthlyattendance report on school website, one has to writecomputer programs to access data from files.Continuing the example of attendance at school,we need to store data about students and attendancein two separate files. Table 7.1 shows the contents ofSTUDENT file which has six columns, as detailed below:RollNumber – Roll number of the studentSName– Name of the studentSDateofBirth – Date of birth of the studentGName– Name of the guardianGPhone– Phone number of the student guardianGAddress– Address of the guardian of the studentTable 7.1 STUDENT file maintained by office staffRollNumberSNameSDateofBirthGNameGPhone1Atharv Ahuja2003-05-15Amit Ahuja5711492685G-35,Delhi2Daizy Bhutia2002-02-28BaichungBhutia7110047139Flat no. 5, DarjeelingAppt., Shimla3Taleem Shah2002-02-28Himanshu Shah981818485526/77,WestPatelNagar, Ahmedabad4John Dsouza2003-08-18Danny Dsouza5Ali Shah2003-07-05Himanshu Shah981818485526/77,WestPatelNagar, Ahmedabad6Manika P.2002-03-10Sujata P.7802983674HNO-13, B- block, PreetVihar, MaduraiGAddressAshokVihar,S -13, Ashok Village,DamanTable 7.2 shows another file called ATTENDANCEwhich has four columns, as detailed below:AttendanceDate– Date for which attendance wasmarkedRollNumber– Roll number of the studentSName– Name of the studentAttendanceStatus – Marked as P (present) or A (absent)2021-22Chap 7.indd 12519-Jul-19 3:45:07 PM

126Informatics Practices – Class XITable 7.2 ATTENDANCE file maintained by class us2018-09-011Atharv AhujaP2018-09-012Daizy BhutiaP2018-09-013Taleem ShahA2018-09-014John DsouzaP2018-09-015Ali ShahA2018-09-016Manika P.P2018-09-021Atharv AhujaP2018-09-022Daizy BhutiaP2018-09-023Taleem ShahA2018-09-024John DsouzaA2018-09-025Ali ShahP2018-09-026Manika P.P7.2.1 Limitations of a File SystemFile system becomes difficult to handle when number offiles increases and volume of data also grows. Followingare some of the limitations of file system:(A) Difficulty in AccessFiles themselves do not provide any mechanism toretrieve data. Data maintained in a file system areaccessed through application programs. While writingsuch programs, the developer may not anticipate allthe possible ways in which data may be accessed. So,sometimes it is difficult to access data in the requiredformat and one has to write application program toaccess data.(B) Data RedundancyRedundancy means same data are duplicated indifferent places (files). In our example, student namesare maintained in both the files. Besides, in Table 7.1,students with roll numbers 3 and 5 have same guardianname and therefore same guardian name is maintainedtwice. Both these are examples of redundancy which isdifficult to avoid in a file system. Redundancy leads toexcess storage use and may cause data inconsistencyalso.(C) Data InconsistencyData inconsistency occurs when same data maintainedin different places do not match. If a student wants toget changed the spelling of her name, it needs to be2021-22Chap 7.indd 12619-Jul-19 3:45:07 PM

Database Conceptschanged in SName column in both the files. Likewise, ifa student leaves school, the details need to be deletedfrom both the files. As the files are being maintained bydifferent people, the changes may not happen in one ofthe files. In that case, the student name will be different(inconsistent) in both the files.127Notes(D) Data IsolationBoth the files presented at Table 7.1 (STUDENT) and atTable 7.2 (ATTENDANCE) are related to students. Butthere is no link or mapping between them. The schoolwill have to write separate programs to access these twofiles. This is because data mapping is not supported infile system. In a more complex system where data filesare generated by different person at different times, filesbeing created in isolation may be of different formats.In such case, it is difficult to write new applicationprograms to retrieve data from different files maintainedat multiple places, as one has to understand theunderlying structure of each file as well.(E) Data DependenceData are stored in a specific format or structure in afile. If the structure or format itself is changed, all theexisting application programs accessing that file alsoneed to be change. Otherwise, the programs may notwork correctly. This is data dependency. Hence, updatingthe structure of a data file requires modification in allthe application programs accessing that file.(F) Controlled Data SharingThere can be different category of users like teacher,office staff and parents. Ideally, not every user shouldbe able to access all the data. As an example, guardiansand office staff can only see the student attendance databut should not be able to modify/delete it. It meansthese users should be given limited access (read only)to the ATTENDANCE file. Only the teacher should beable to update the attendance data. It is very difficult toenforce this kind of access control in a file system whileaccessing files through application programs.7.3 Database Management SystemLimitations faced in file system can be overcome bystoring the data in a database where data are logicallyrelated. We can organise related data in a database sothat it can be managed in an efficient and easy way.2021-22Chap 7.indd 12719-Jul-19 3:45:07 PM

128Informatics Practices – Class XISome databasemanagement systemsinclude a graphicaluser interface for usersto create and managedatabases. Otherdatabase systems use acommand line interfacethat requires usersto use programmingcommands to createand manage databases.A database management system (DBMS) or databasesystem in short, is a software that can be used tocreate and manage databases. DBMS lets users tocreate a database, store, manage, update/modify andretrieve data from that database by users or applicationprograms. Some examples of open source andcommercial DBMS include MySQL, Oracle, PostgreSQL,SQL Server, Microsoft Access, MongoDB.A database system hides certain details abouthow data are actually stored and maintained. Thus,it provides users with an abstract view of the data. Adatabase system has a set of programs through whichusers or other programs can access, modify and retrievethe stored data.The DBMS serves as an interface between thedatabase and end users or application programs.Retrieving data from a database through special type ofcommands is called querying the database. In addition,users can modify the structure of the database itselfthrough a DBMS.Databases are widely used in various fields. Someapplications are given in Table 7.3.Table 7.3 Use of Database in Real-life ApplicationsApplicationDatabase to maintain data aboutBankingcustomer information, account details, loan details,transaction details, etc.Crop Loankisan credit card data, farmer’s personal data, landarea and cultivation data, loan history, repaymentdata, etc.InventoryManagementproduct details, customer information, order details,delivery data, etc.OrganisationResourceManagementemployee records, salary details,information, branch locations, etc.OnlineShoppingitems description, userpreferences details, etc.logindepartmentdetails,users7.3.1 File System to DBMSLet us revisit our school example where two data fileswere maintained (Table 7.1 by office and Table 7.2 byteacher). Let us now design a database to store data ofthose two files. We know that tables in a database arelinked or related through one or more common columnsor fields. In our example, the STUDENT (Table 7.1) fileand ATTENDANCE (Table 7.2) file have RollNumberand SName as common field names. In order to convert2021-22Chap 7.indd 12819-Jul-19 3:45:07 PM

Database Conceptsthese two files into a database, we need to incorporatethe following changes:a) SName need not be maintained in ATTENDANCEfile as it is already there in STUDENT. Details for astudent can be retrieved through the common fieldRollNumber in both the files.b) If two siblings are in the same class, then sameguardian details (GName, GPhone and GAddress)are maintained for both the siblings. We know thisis a redundancy and by using a database we canavoid this. So let us split the STUDENT file into twofile (STUDENT file and GUARDIAN) file so that eachguardian data are maintained only once.c) One and more guardians can have the same name.So it will not be possible to identify which guardianis related to which student. In such case, we needto create an additional column, say GUID (GuardianID) that will take unique value for each record inthe GUARDIAN file. The column GUID will also bekept with STUDENT file for relating these two files.129High Cost is incurredwhile shifting from filesystem to DBMS: Purchasingsophisticatedhardware andsoftware. Training users forquerying. Recurrent cost totake regular backupand perform recoveryoperations.Note: We could distinguish guardians by their phone numbersalso. But, phone number can change, and therefore may nottruly distinguish guardian.Figure 7.1 shows the related data files for theSTUDENT, GUARDIAN and ATTENDANCE details. Notethat this is not the complete database schema since itdoes not show any relationship among RollNumberAttendanceStatusFigure 7.1: Record structure of three files inSTUDENTATTENDANCE DatabaseThe tables shown at Figure 7.1 are empty, which areto be populated with actual data as shown in Table 7.4,7.5 and 7.6.Table 7.4 Snapshot of STUDENT tableRollNumberSNameSDateofBirthGUID1Atharv Ahuja2003-05-154444444444442Daizy Bhutia2002-02-281111111111112021-22Chap 7.indd 12919-Jul-19 3:45:07 PM

Informatics Practices – Class XI1303Taleem Shah2002-02-284John Dsouza2003-08-183333333333335Ali Shah2003-07-051010101010106Manika P.2002-03-10466444444666Table 7.5 Snapshot of GUARDIAN tableGUIDGNameGPhoneGAddress444444444444Amit Ahuja5711492685G-35, Ashok Vihar, Delhi111111111111Baichung Bhutia7110047139Flat no. 5, Darjeeling Appt., Shimla101010101010Himanshu Shah981818485526/77, West Patel Nagar, Ahmedabad333333333333Danny Dsouza466444444666Sujata P.S -13, Ashok Village, Daman7802983674HNO-13, B- block, Preet Vihar, MaduraiTable 7.6 Snapshot of ATTENDANCE 09-025P2018-09-026PFigure 7.2 shows a simplified database calledSTUDENTATTENDANCE, which is used to maintaindata about the student, guardian and attendance. Asshown here, the DBMS maintains a single repositoryof data at a centralized location and can be used bymultiple users (office staff, teacher) at the same time.7.3.2 Key Concepts in DBMSIn order to efficiently manage data using a DBMS, let usunderstand certain key terms:(A) Database SchemaDatabase Schema is the design of a database. It is theskeleton of the database that represents the structure(table names and their fields/columns), the type of dataeach column can hold, constraints on the data to bestored (if any), and the relationships among the tables.2021-22Chap 7.indd 13019-Jul-19 3:45:07 PM

Database ConceptsQueDBMS Software processes QueryDBMS Software access database and its definitionQuery ResultryOffice StaffyerQuQuery ndanceFigure 7.3: StudentAttendance Database EnvironmentDatabase schema is also called the visual or logicalarchitecture as it tells us how the data are organised ina database.(B) Data ConstraintSometimes we put certain restrictions or limitations onthe type of data that can be inserted in one or morecolumns of a table. This is done by specifying one ormore constraints on that column(s) while creating thetables. For example, one can define the constraint thatthe column mobile number can only have non-negativeinteger values of exactly 10 digits. Since each studentshall have one unique roll number, we can put the NOTNULL and UNIQUE constraints on the RollNumbercolumn. Constraints are used to ensure accuracy andreliability of data in the database(C) Meta-data or Data DictionaryThe database schema along with various constraints on thedata is stored by DBMS in a database catalog or dictionary,called meta-data. A meta-data is data about the data.(D) Database InstanceWhen we define database structure or schema, stateof database is empty i.e. no data entry is there. After2021-22Chap 7.indd 13119-Jul-19 3:45:08 PM

132Informatics Practices – Class XIloading data, the state or snapshot of the databaseat any given time is the database instance. We maythen retrieve data through queries or manipulate datathrough updation, modification or deletion. Thus, thestate of database can change, and thus a databaseschema can have many instances at different times.(E) QueryA query is a request to a database for obtaininginformation in a desired way. Query can be made to getdata from one table or from a combination of tables. Forexample, “find names of all those students present onAttendance Date 2000-01-02” is a query to the database.To retrieve or manipulate data, the user needs to writequery using a query language called, which is discussedin chapter 8.Limitations of DBMSIncreased Complexity:Use of DBMS increasesthe complexityof maintainingfunctionalities likesecurity, consistency,sharing and integrityIncreased datavulnerability:As data are storedcentrally, it increasesthe chances of lossof data due to anyfailure of hardware orsoftware. It can bringall operations to a haltfor all the users.(F) Data ManipulationModification of database consists of three operationsviz. Insertion, Deletion or Update. Suppose Rivaan joinsas a new student in the class then the student detailsneed to be added in STUDENT as well as in GUARDIANfiles of the Student Attendance database. This is calledInsertion operation on the database. In case a studentleaves the school, then his/her data as well as herguardian details need to be removed from STUDENT,GUARDIAN and ATTENDANCE files, respectively. Thisis called Deletion operation on the database. SupposeAtharv’s Guardian has changed his mobile number, hisGPhone should be updated in GUARDIAN file. This iscalled Update operation on the database.(G) Database EngineDatabase engine is the underlying component or set ofprograms used by a DBMS to create database and handlevarious queries for data retrieval and manipulation.7.4 Relational Data ModelDifferent types of DBMS are available and theirclassification is done based on the underlying data model.A data model describes the structure of the database,including how data are defined and represented,relationships among data, and the constraints. The mostcommonly used data model is Relational Data Model.Other types of data models include object-oriented datamodel, entity-relationship data model, document modeland hierarchical data model. This book discusses theDBMS based on relational data model.2021-22Chap 7.indd 13219-Jul-19 3:45:08 PM

Database Concepts133In relational model, tables are called relations thatstore data for different columns. Each table can havemultiple columns where each column name should beunique. For example, each row in the table represents arelated set of values. Each row of Table 7.5 represents aparticular guardian and has related values viz. guardian’sID with guardian name, address and phone number.Thus, a table consists of a collection of relationships.It is important to note here that relations in a databaseare not independent tables, but are associated with eachother. For example, relation ATTENDANCE has attributeRollNumber which links it with corresponding studentrecord in relation STUDENT. Similarly, attribute GUIDis placed with STUDENT table for extracting guardiandetails of a particular student. If linking attributes arenot there in appropriate relations, it will not be possibleto keep the database in correct state and retrieve validinformation from the database.Figure 7.3 shows the relational database StudentAttendance along with the three relations (tables)STUDENT, ATTENDANCE and GUARDIAN.Figure 7.4: Representing StudentAttendance Database using Relational Data ModelTable 7.7 Relation schemas along with its description of Student AttendancedatabaseRelation SchemeDescription of attributesSTUDENT(RollNumber,SName, SDateofBirth,GUID)RollNumber: unique id of the studentSName: name of the studentSDateofBirth: date of birth of the studentGUID: unique id of the guardian of the anceStatus)AttendanceDate: date on which attendance is takenRollNumber: roll number of the studentAttendanceStatus: whether present (P) or absent(A)Note that combination of AttendanceDate and RollNumber will be uniquein each record of the tableGUARDIAN(GUID,GName, GPhone,GAddress)GUID: unique id of the guardianGName: name of the guardianGPhone: contact number of the guardianGAddress: contact address of the guardian2021-22Chap 7.indd 13319-Jul-19 3:45:08 PM

Informatics Practices – Class XI134Each tuple (row) in a relation (table) correspondsto data of a real world entity (for example, Student,Guardian, and Attendance). In the GUARDIAN relation(Table 7.5), each row represents the facts about theguardian and each column name in the GUARDIAN tableis used to interpret the meaning of data stored under thatcolumn. A database that is modeled on relational datamodel concept is called Relational Database. Figure 7.4shows relation GUARDIAN with some populated data.Let us now understand the commonly usedterminologies in relational data model using Figure 7.4.Relation GUARDIANwith 4 attribute/columnsGUIDGNameGPhoneGAddressAmit Ahuja5711492685G-35, Ashok Vihar, Delhi111111111111Baichung Bhutia7110047139Flat no. 5, Darjeeling Appt., Shimla101010101010Himanshu Shah981818485526/77, West Patel Nagar, Ahmedabad333333333333Danny Dsouza466444444666Sujata P.S -13, Ashok Village, Daman7802983674RelationState444444444444HNO-13, B- block, Preet Vihar, MaduraiFacts about RELATION GUARDIAN:Record/tuple/row1. Degree (Number of attributes) 42. Cardinality (Number of rows/tuples/records) 53. Relation is a flat file i.e, each column has a single value and each recordhas same number of columnsFigure 7.5: Relation GUARDIAN with its Attributes and Tuplesi) ATTRIBUTE: Characteristic or parameters forwhich data are to be stored in a relation. Simplystated, the columns of a relation are the attributeswhich are also referred as fields. For example, GUID,GName, GPhone and GAddress are attributes ofrelation GUARDIAN.ii) TUPLE: Each row of data in a relation (table) iscalled a tuple. In a table with n columns, a tuple isa relationship between the n related values.iii) DOMAIN: It is a set of values from which anattribute can take a value in each row. Usually, adata type is used to specify domain for an attribute.For example, in STUDENT relation, the attributeRollNumber takes integer values and hence itsdomain is a set of integer values. Similarly, the setof character strings constitutes the domain of theattribute SName.2021-22Chap 7.indd 13419-Jul-19 3:45:08 PM

Database Conceptsiv) DEGREE: The number of attributes in a relationis called the Degree of the relation. For example,relation GUARDIAN with four attributes is a relationof degree 4.135Notesv) CARDINALITY: The number of tuples in a relationis called the Cardinality of the relation. For example,the cardinality of relation GUARDIAN is 5 as thereare 5 tuples in the table.7.4.1 Three Important Properties of a RelationIn relational data model, following three propertiesare observed with respect to a relation which makes arelation different from a data file or a simple table.Property 1: imposes following rules on an attribute ofthe relation. Each attribute in a relation has a unique name. Sequence of attributes in a relation is immaterial.Property 2: governs following rules on a tuple of arelation. Each tuple in a relation is distinct. For example, datavalues in no two tuples of relation ATTENDANCEcan be identical for all the attributes. Thus, eachtuple of a relation must be uniquely identified byits contents. Sequence of tuples in a relation is immaterial.The tuples are not considered to be ordered, eventhough they appear to be in tabular form.Property 3: imposes following rules on the state of arelation. All data values in an attribute must be from thesame domain (same data type). Each data value associated with an attributemust be atomic (cannot be further divisible intomeaningful subparts). For example, GPhone ofrelation GUARDIAN has ten digit numbers whichis indivisible. No attribute can have many data values in onetuple. For example, Guardian cannot specifymultiple contact numbers under GPhone attribute. A special value “NULL” is used to representvalues that are unknown or non-applicable tocertain attributes. For example, if a guardian doesnot share his or her contact number with theschool authorities, then GPhone is set to NULL(data unknown).2021-22Chap 7.indd 13519-Jul-19 3:45:08 PM

136Informatics Practices – Class XINotes7.5 Keysin aRelational DatabaseThe tuples within a relation must be distinct. It means no twotuples in a table should have same value for all attributes.That is, there should be at least one attribute in whichdata are distinct (unique) and not NULL. That way, we canuniquely distinguish each tuple of a relation. So, relationaldata model imposes some restrictions or constraints on thevalues of the attributes and how the contents of one relationbe referred through another relation. These restrictionsare specified at the time of defining the database throughdifferent types of keys as given below:7.5.1 Candidate KeyA relation can have one or more attributes that takesdistinct values. Any of these attributes can be used touniquely identify the tuples in the relation. Such attributesare called candidate keys as each of them are candidatesfor the primary key.As shown in Figure 7.4, the relation GUARDIAN hasfour attributes out of which GUID and GPhone always takeunique values. No two guardians will have same phonenumber or same GUID. Hence, these two attributes are thecandidate keys as they both are candidates for primary key.7.5.2 Primary KeyOut of one or more candidate keys, the attribute chosenby the database designer to uniquely identify the tuplesin a relation is called the primary key of that relation. Theremaining attributes in the list of candidate keys are calledthe alternate keys.In the relation GUARDIAN, suppose GUID is chosen asprimary key, then GPhone will be called the alternate key.7.5.3 Composite Primary KeyIf no single attribute in a relation is able to uniquelydistinguish the tuples, then more than one attribute aretaken together as primary key. Such primary key consistingof more than one attribute is called Composite Primary key.In relation ATTENDANCE, Roll Number cannot be usedas primary key as roll number of same student will appearin another row for a different date. Similarly, in relationAttendance, AttendanceDate cannot be used as primarykey because same date is repeated for each roll number.However combination of these two attributes RollNumber andAttendanceDate together would always have unique value inATTENDANCE table as on any working day, of a studentwould be marked attendance only once. Hence {RollNumber,2021-22Chap 7.indd 13619-Jul-19 3:45:08 PM

Database Concepts137AttendanceDate} will make the of ATTENDANCE relationcomposite primary key.7.5.4 Foreign KeyA foreign key is used to represent the relationship betweentwo relations. A foreign key is an attribute whose valueis derived from the primary key of another relation. Thismeans that any attribute of a relation (referencing),which is used to refer contents from another (referenced)relation, becomes foreign key if it refers to the primary keyof referenced relation. The referencing relation is calledForeign Relation. In some cases, foreign key can take NULLvalue if it is not the part of primary key of the foreign table.The relation in which the referenced primary key is definedis called primary relation or master relation.In Figure 7.5, two foreign keys in Student Attendancedatabase are shown using schema diagram where the foreignkey is displayed as a directed arc (arrow) originating from itand ending at the corresponding attribute of the primarykey of the referenced table. The underlined attributes makethe primary key of that table.STUDENT RollNumberGUARDIAN GPhoneRollNumberGUIDGAddressAttendanceStatusFigure 7.2: StudentAttendance Database with the Primary and Foreign keysSummary A file in a file system is a container to store data in acomputer.File system suffers from Data Redundancy, DataInconsistency, Data Isolation, Data Dependence andControlled Data sharing.Database Management System (DBMS) is a softwareto create and manage databases. A database is acollection of tables.Database schema is the design of a databaseA database constraint is a restriction on the type ofdata that that can be inserted into the table.Database schema and database constraints are storedin database Catalog.2021-22Chap 7.indd 13719-Jul-19 3:45:08 PM

138Informatics Practices – Class XI Whereas the snapshot of the database at any giventime is the database instance.A query is a request to a database for informationretrieval and data manipulation (insertion, deletion orupdate). It is written in Structured Query Language(SQL).Relational DBMS (RDBMS) is used to store data inrelated tables. Rows and columns of a table are calledtuples and attributed respectively. A table is referredto as a relation.Destructions on data stored in a RDBMS is appliedby use of keys such as Candidate Key, Primary Key,Composite Primary Key, Foreign Key.Primary key in a relation is used for unique identificationof tuples.Foreign key is used to relate two tables or relations.Each column in a table represents a feature (attribute)of a record. Table stores the information for an entitywhereas a row represents a record.Each row in a table represents a record. A tuple isa collection of attribute values that makes a recordunique.A tuple is a unique entity whereas attribute values canbe duplicate in the table.SQL is the standard language for RDBMS systems likeMySQL.Exercise1. Give the terms for each of the following:a) Collection of logically related records.b) DBMS creates a file that contains description about thedata stored in the database.c) Attribute that can uniquely identify the tuples in arelation.d) Special value that is stored when actual data value isunknown for an attribute.e) An attribute which can uniquely identify tuples of thetable but is not defined as primary key of the table.f) Software that is used to create, manipulate and maintaina relational database.2. Why foreign keys are allowed to have NULL values? Explainwith an exam

» Database Management System » Relational Data Model » Keys in a Relational Database . Database Concepts. Chapter. 7 . Chap 7.indd 123 19-Jul-19 3:45:07 PM. 22122. 124. I. NFORMAT ICS. P. RACT CES – C. LASS. I. a month are 26, the teacher needs to record 50