Database

Published on May 2016 | Categories: Documents | Downloads: 37 | Comments: 0 | Views: 409
of 99
Download PDF   Embed   Report

database basic

Comments

Content

Q. 1. What do you mean by database? Ans. A database is a collection of occurrence of multiple record types containing the relationship between records, data aggregate and data items. A database may be defined as A database is a collection of interrelated data store together without harmful and unnecessary redundancy (duplicate data) to serve multiple applications The data is stored so that they are independent of programs, which use the data. A common and control approach is used in adding the new data, modifying and retrieving existing data or deletion of data within the database A running database has function in a corporation, factory, government department and other organization. Database is used for searching the data to answer some queries. A database may be design for batch processing, real time processing or on line processing. DATABASE SYSTEM Database System is an integrated collection of related files along with the detail about their definition, interpretation, manipulation and maintenance. It is a system, which satisfied the data need for various applications in an

organization without unnecessary redundancy. A database system is based on the data. Also a database system can be run or executed by using software called DBMS (Database Management System). A database system controls the data from unauthorized access. Foundation Data Concept A hierarchy of several levels of data has been devised that differentiates between different groupings, or elements, of data. Data are logically organized into:


Character

It is the most basic logical data element. It consists of a single alphabetic, numeric, or other symbol.


Field

It consists of a grouping of characters. A data field represents an attribute (a characteristic or quality) of some entity (object, person, place, or event).


Record

The related fields of data are grouped to form a record. Thus, a record represents a collection of attributes that describe an entity. Fixed-length records contain, a fixed number of fixed-length data fields. Variable-length records contain a variable number of fields and field lengths.


File

A group of related records is known as a data file, or table. Files are frequently classified by the application for which they ar primarily used, such as a payroll file or an inventory file, or the type of data they contain, such as a document file or a graphical image file. Files are also classified by their permanence, for example, a master file versus a transaction file. A transaction file would contain records of all transactions occurring during a period, whereas a master file contains all the permanent records. A history file is an obsolete transaction or master file retained for backup purposes or for long-term historical storage called archival storage.


Database

It is an integrated collection of logically related records or objects. A database consolidates records previously stored in separate files into a common

pool of data records that provides data for many applications. The data stored in a database is independent of the application programs using it and o the „type of secondary storage devices on which it is stored.

Q. 2. What are the various characteristics of DBMS? Ans. The major characteristics of database approach are: • 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 Multi user Transaction Processing

Q. 3. What are the various characteristics of DBMS approach? Ans. 1. Self-contained nature DBMS system contains data plus a full description of the data (called “metadata”)

“metadata” is data about data - data formats, record structures, locations, how to access, indexes metadata is stored in a catalog and is used by DBMS software to know how to access the data. Contrast this with the file processing approach where application programs need to know the structure and format of records and data. 2. Program-data independence Data independence is immunity of application programs to changes in storage structures and access techniques. E.g. adding a new field, changing index structure, changing data format, In a DBMS environment these changes are reflected in the catalog. Applications aren‟t affected. Traditional file processing programs would all have to change, possibly substantially. 3. Data abstraction A DBMS provides users with a conceptual representation of data (for example, as objects with properties and inter-relationships). Storage details are hidden. Conceptual representation is provided in terms of a data model. 4. Support for multiple views DBMS may allow different users to see different “views” of the DB, according to the perspective each one requires. E.g. a subset of the

data - For example; the people using the payroll system need not/should not see data about students and class schedules. E.g. data presented in a different form from the way it is stored - For example someone interested in student transcripts might get a view which is formed by combining information from separate files or tables.

5. Centralized control of the data resource The DBMS provides centralized control of data in an organization. This brings a number of advantages:

(a) reduces redundancy (b) avoids inconsistencies (c) data can be shared (d) standards can be enforced (e) security restrictions can be applied (f) integrity can be maintained a, b. Redundancy and Inconsistencies Redundancy is unnecessary duplication of data. For example if accounts department and registration department both keep student name, number and address. Redundancy wastes space and duplicates effort in maintaining the data. Redundancy also leads to inconsistency. Inconsistent data is data which contradicts itself - e.g. two different addresses for a given student number. Inconsistency cannot occur if data is represented by a single entry (i.e. if there is no redundancy). Controlled redundancy: Some redundancy may be desirable (for efficiency). A DBMS should be aware of it, and take care of propagating updates to all copies of a data item. This is an objective, not yet currently supported. c. Sharing

• Need concurrency control • Multiple user views d. Standards E.g. data formats, record structures, naming, documentation International, standards e. Security - restricting unauthorized access DBMS should perform security checks on all accesses. f. Integrity Maintaining validity of data; e.g. employee numbers must be in some range e.g. every course must have an instructor e.g.. student number must be unique e.g. hours worked cannot be more than 150 These things are expressed as constraints. DBMS should perform integrity checks on all updates. Currently DBMSs provide limited integrity checks. organizational, departmental ...

Q. 3. What are the various types of databases?

Ans. Types of Databases Continuing developments in information technology and its business applications have resulted in the evolution of several major types of databases. Several major conceptual categories of databases that may be found in computer-using organizations include: Operational Databases The databases store detailed data needed to support the operations of the entire organization. They are also called subject area databases (SADB), transaction databases, and production databases: Examples are customer databases, personnel databases, inventory databases, and other databases containing data generated by business operations Distributed Databases Many organizations replicate and distribute copies or parts of databases to network sewers at a variety of sites. These distributed databases can reside on network servers on the World Wide Web, on corporate Intranets or extranets, or on other company networks. Distributed databases may be copies of operational or analytical. databases,

hypermedia or discussion databases, or any other type of database. Replication and distribution of databases is done to improve database performance and security. External Databases Access to external, privately owned online databases or data banks is available for a fee to end users and organizations from commercial online services, and with or without charge from many sources on the Internet, especially the Web. Hypermedia Databases It consists of hyperlinked pages of multimedia (text, graphics, and photographic images, video clips, audio segments, etc.). From a database management point of view, the set of interconnected multimedia pages at a website is a database of interrelated hypermedia page elements, rather than interrelated data records.

Q. 4. What do you mean by DBMS? Ans. A DBMS is best described as a collection of programs that manage the database structure and that control shared access to the data in the database. Current DBMSes also store the relationships between the database components;

they also take care of defining the required access paths to those components A database management system (DBMS) is the combination of data, hardware, software and users to help an enterprise manage its operational data. The main function of a DBMS is to provide efficient and reliable methods of data retrieval to many users. Efficient data retrieval is an essential function of database systems. DBMS must be able to deal with several users who try to simultaneously access several items and most frequently, the same data item A DBMS is a set of programs that is used to store and manipulation data that include the following: • Adding new data, for example adding details of new student. • Deleting unwanted data, for example deleting the details of students who have completed course. • Changing existing data, for example modifying the fee paid by the student. A database is the information to be stored whereas the database management system is the system used to manage the database. . This structure may be regarded in terms of its hardware implementation, called the physical structure, or this structure may be regarded independently of its

hardware implementation, called the logical structure. In either case, the data structure is regarded as static because a database cannot „process anything. The DBMS is regarded as dynamic because it is through the DBMS that all database processing takes place. How the DBMS presents data to the user is called the view structure. There are two general modes for data use: queries and transactions. Both forms use the DBMS for processing. The query is processed for presentation in views and none of these processes are written to the database. The transactional is processed for updating values in the database variables. These updates are written to the database. A DBMS provides various functions like data security, data integrity, data sharing, data concurrence, data independence, data recovery etc. However, all database management systems that are now available in the market like Sybase, Oracle, and MS-Access do not provide the same set of functions, though all are meant for data management.

Q. 5. What are the various components of DBMS?

Ans. Basic Components: A database system has four components. These four components are important for understanding and designing the database system. These are: 1. Data 2. Hardware 3. Software 4. Users 1. Data As we have discussed above, data is raw hand information collected by us. Data is made up of data item or data aggregate. A Data item is the smallest unit of named data: It may consist of bits or bytes. A Data item is often referred to as field or data element. A Data aggregate is the collection of data items within the record, which is given a name and referred as a whole. Data can be collected orally or written. A database can be integrated and shared. Data stored in a system is partition into one or two databases. So if by chance data lost or damaged at one place, then it can be accessed from the second place by using the sharing facility of data base system. So a shared data also cane be reused according to the user‟s requirement. Also data must be in the integrated form. Integration means data should be

in unique form i.e. data collected by using a welldefined manner with no redundancy, for example Roll number in a class is non-redundant form and so these have unique resistance, but names in class may be in the redundant form and can create lot of problems later on in using and accessing the data. 2. Hardware Hardware is also a major and primary part of the database. Without hardware nothing can be done. The definition of Hardware is “which we can touch and see”, i.e. it has physical existences. All physical quantity or items are in this category. For example, all the hardware input/output and storage devices like keyboard, mouse, scanner, monitor, storage devices (hard disk, floppy disk, magnetic disk, and magnetic drum) etc. are commonly used with a computer system. 3. Software Software is another major part of the database system. It is the other side of hardware. Hardware and software are two sides of a coin. They go side by side. Software is a system. Software are further subdivided into two categories, First type is system software (like all the operating systems, all the languages and system packages etc.) and second one is an application software (payroll, electricity billing, hospital management and hostel

administration etc.). We can define software as which we cannot touch and see. Software only can execute. By using software, data can be manipulated, organized and stored. 4. Users Without user all of the above said components (data, hardware & software) are meaning less. User can collect the data, operate and handle the hardware. Also operator feeds the data and arranges the data in order by executing the software. Other components 1. People - Database administrator; system developer; end user. 2. CASE tools: Computer-aided Software Engineering (CASE) tools. 3. User interface - Microsoft Access; PowerBuilder. 4. Application Programs - PowerBuilder script language; Visual Basic; C++; COBOL. 5. Repository - Store definitions of data called METADATA, screen and report formats, menu definitions, etc. 6. Database - Store actual occurrences data. 7. DBMS - Provide tools to manage all of this create data, maintain data, control security access to data and to the repository, etc.

Q. 6.What are the various functions of DBMS? Ans. These functions will include support for at least all of the following: • Data definition: The DBMS must be able to accept data definitions (external schemas, the conceptual schema, the internal schema, and all associated mappings) in source form and convert them to the appropriate object form. • Data manipu1ation: The DBMS must be able to handle requests from the users to retrieve, update, or delete existing data the database, or to add new data to the database. In other words, the DBMS must include a data manipulation language (DML) processor component. • Data security and integrity: The DBMS must monitor user requests and reject any attempt to violate the security and integrity rules defined by the DBA. • Data recovery and concurrency: The DBMS or else some other related software component, usually called the transaction manager - must enforce certain recovery and concurrency controls. • Data Dictionary: The DBMS must provide a data dictionary function. The data dictionary can

be regarded as a database in its own right (but a system database, rather than a user database). The dictionary contains “data about the data” (sometimes called metadata) - that is, definitions of other objects in the system - rather than just”raw data.” In particular, all the various schemas and mapping (external, conceptual, etc.) will physically be stored, in both source and object form, in the dictionary. A comprehensive dictionary will also include cross- reference information, showing, for instance, which programs use which pieces of the database, which users require which reports, which terminals are connected to the system, and so on. The dictionary might even - in fact, probably should — be integrated into the database it defines, and thus include its own definition. It should certainly be possible to query the dictionary just like any other database, so that, for example, it is possible to tell which programs and or users are likely to be affected by some proposed change to the system. Performance: It goes without saying that the DBMS should perform all of the functions identified above as efficiently as possible.

Q7. What are the advantages and disadvantages of a database approach?

Ans. ADVANTAGES OF DBMS One of the major advantages of using a database system is that the organization can be handled easily and have centralized management and control over the data by the DBA. Some more and main advantages of database management system are given below: The main advantages of DBMS are: 1. Controlling Redundancy In a DBMS there is no redundancy (duplicate data). If any type of duplicate data arises, then DBA can control and arrange data in nonredundant way. It stores the data on the basis of a primary key, which is always unique key and have non-redundant information. For example, Roll no is the primary key to store the student data. In traditional file processing, every user group maintains its own files. Each group independently keeps files on their db e.g., students. Therefore, much of the data is stored twice or more. Redundancy leads to several problems: • Duplication of effort

• Storage space wasted when the same data is stored repeatedly Files that represent the same data may become inconsistent (since the updates are applied independently by each users group).We can use controlled redundancy. 2. Restricting Unauthorized Access A DBMS should provide a security and authorization subsystem. • Some db users will not be authorized to access all information in the db (e.g., financial data). • Some users are allowed only to retrieve data. • Some users are allowed both to retrieve and to update database. 3. Providing Persistent Storage for Program Objects and Data Structures Data structure provided by DBMS must be compatible with the programming language‟s data structures. E.g., object oriented DBMS are compatible with programming languages such as C++, SMALL TALK, and the DBMS software automatically performs conversions between programming data structure and file formats. 4. Permitting Inferencing and Actions Using Deduction Rules

Deductive database systems provide capabilities for defining deduction rules for inferencing new information from the stored database facts. 5. Inconsistency can be reduced In a database system to some extent data is stored in, inconsistent way. Inconsistency is another form of delicacy. Suppose that an em1oyee “Japneet” work in department “Computer” is represented by two distinct entries in a database. So way inconsistent data is stored and DBA can remove this inconsistent data by using DBMS. 6. Data can be shared In a database system data can be easily shared by different users. For example, student data can be share by teacher department, administrative block, accounts branch arid laboratory etc. 7. Standard can be enforced or maintained By using database system, standard can be maintained in an organization. DBA is overall controller of database system. Database is manually computed, but when DBA uses a DBMS and enter the data in computer, then standard can be enforced or maintained by using the computerized system.

8. Security can be maintained Passwords can be applied in a database system or file can be secured by DBA. Also in a database system, there are different coding techniques to code the data i.e. safe the data from unauthorized access. Also it provides login facility to use for securing and saving the data either by accidental threat or by intentional threat. Same recovery procedure can be also maintained to access the data by using the DBMS facility. 9. Integrity can be maintained In a database system, data can be written or stored in integrated way. Integration means unification and sequencing of data. In other words it can be defined as “the data contained in the data base is both accurate and consistent”. „Data can be accessed if it is compiled in a unique form. We can take primary key ad some secondary key for integration of data. Centralized control can also ensure that adequate checks are incorporated in the DBMS to provide data integrity. 10. Confliction can be removed In a database system, data can be written or arranged in a well-defined manner by DBA. So there is no confliction between the databases. DBA select the best file structure and accessing strategy

to get better performance for the representation and use of the data. 11. Providing Multiple User Interfaces For example query languages, programming languages interfaces, forms, menu- driven interfaces, etc. 12. Representing Complex Relationships Among Data It is used to represent Complex Relationships Among Data 13. Providing Backup and Recovery The DBMS also provides back up and recovery features. DISADVANTAGES OF DBMS Database management system has many advantages, but due to some major problem arise in using the DBMS, it has some disadvantages. These are explained as: 1.Cost A significant disadvantage of DBMS is cost. In addition to the cost of purchasing or developing the software, the organization *111 also purchase or upgrade the hardware

and so it becomes a costly system. Also additional cost occurs due to migration of data from one environment of DBMS to another environment. 2. Problems associated with centralization Centralization also means that data is accessible from a single source. As we know the centralized data can be accessed by each user, so there is no security of data from unauthorized access and data can be damaged or lost. 3. Complexity of backup and recovery Backup and recovery are fairly complex in DBMS environment. As in a DBMS, if you take a backup of the data then it may affect the multiuser database system which is in operation. Damage database can be recovered from the backup floppy, but iterate duplicacy in loading to the concurrent multi-user database system. 4. Confidentiality, Privacy and Security When information is centralized and is made available to users from remote locations, the possibilities of abuse are often more than in a conventional system. To reduce the chances of unauthorized users accessing sensitive information, it is necessary to take technical, administrative and, possibly, legal measures. Most, databases store valuable information that must be

protected against deliberate trespass and destruction. 5. Data Quality Since the database is accessible to users remotely, adequate controls are needed to control users updating data and to control data quality. With increased number of users accessing data directly, there are enormous opportunities for users to damage the data. Unless there are suitable controls, the data quality may be compromised. 6. Data Integrity Since a large number of users could be using .a database concurrently, technical safeguards are necessary to ensure that the data remain correct during operation. The main threat to data integrity comes from several different users attempting to update the same data at the same time. The database therefore needs to be protected against inadvertent changes by the users. 7. Enterprise Vulnerability Centralizing all data of an enterprise in one database may mean that the database becomes an indispensable resource. The survival of the enterprise may depend on reliable information being available from its database. The enterprise therefore becomes vulnerable to the destruction of

the database or to unauthorized modification of the database. 8. The Cost of using a DBMS Conventional data processing systems are typically designed to run a number of well-defined, preplanned processes. Such systems are often “tuned” to run efficiently for the processes that they were designed for. Although the conventional systems are usually fairly inflexible in that new applications may be difficult to implement and/or expensive to run, they are usually very efficient for the applications they are designed for. The database approach on the other hand provides a flexible alternative where new applications can be developed relatively inexpensively. The flexible approach is not without its costs and one of these costs is the additional cost of running applications that the conventional system was designed for. Using standardized software is almost always less machine efficient than specialized software.

Q. 8. List five significant differences between a file-processing system and a DBMS.

Ans. Before differentiating between file and database systems, there be need to understand the DBMS and its component. Let us consider an organization have a huge amount (collection) of data on its different departments, its employees, its products, sale and purchase order etc. As we know such type of data is accessed simultaneously by different and several employees. Now some users apply number of queries and want answers quickly. If data is stored in the files, then it will create a problem of slow processing. As we try to deal with this type of data management problem by storing the data in a collection of operating system files. Such type of techniques creates number of problems or drawbacks, which are discussed as below: 1. As we have not 1000GB main memory (primary memory) to store the data, so we store the data in some permanent storage device (secondary memory) like magnetic disk or magnetic tape etc. So file-oriented system fails in primary memory cases and we apply data base management system to store the data files permanently. 2. Suppose if we have such a large amount of primary memory on a 16 bit or 32 bit computer system, then there be a problem occur in file based system to use the data by direct or random addressing. Also we cannot call more then 2GB or

4Gb of data direct to the primary memory at a time. So there be need a database program to identify the data. 3. Some programs are too lengthy and complex which cannot store large amount of data in the files related to the operating systems. But a database system made it simple and fast. 4. We cannot change and access file-oriented data simultaneously, so we have requirement a type of system which can be used to access the large amount of data concurrently. 5. Also we cannot recall or recover the file-oriented data, but centralized database management solve such type of problem. 6. File oriented operating system provide only a password mechanism for security, but this is not successful in case of number of users are accessing the same data by using the same login. At end we can sat that a DBMS is a piece of software that is designed to make the processing faster and easier.

Q 9 Describe major advantages of a database system over file system Or Discuss the DBMS and File processing system Also give the limitations of file processing system

Ans. TRADITIONAL FILE PROCESSING Data are organized, stored, and processed in independent files of data records. In the traditional file processing approach, each business application was designed to use one or more specialized data files containing only specific types of data records TRADITIONAL FILE SYSTEM OR FILE ORIENTED APPROACH The business computers of 1980 were used in processing of business records and produce information using file oriented approach or file processing environment At that time that system was reliable and faster than the manual system of record keeping and processing In this system the data is organized in the form of different files. Since that system was the collection of files - so we can say it was a file-oriented system. Following terms was commonly used in this approach or the features of File oriented system. 1. Master file The file that is created only once i.e. at the starting of computerization or a file which rarely changes. For example: In a bank master file the account no, name and balance are entered only once and less frequently changes. 2. File activity ratio

The number of records processed one run divided by total number of records. For example: if we changes 100 records from a bank file containing 200 records then file activity ratio is 100/200 0.5. It should be noted that this ratio of master file is less. 3. Transaction file A file that is created repeatedly after regular interval of time. For example: the payroll file of employee is updated at the end of every month. 4. File volatility ratio It is the number of records updated in a transaction file divided by total number of records. The file volatility ratio of transaction file is very high. 5. Work file A temporary file that helps in sorting and merging of records from one file to other. 6. File organization It means the arrangement of records in a particular order. There were three types of file organizations
1. 2. 3.

Sequential Direct Indexed sequential

7. Data island

In this system each dept has its own files designed for local applications. Each department has its own data processing staff, set of policies, working rules and report formats. It means programs were depending on the file structure or format of file. If the structure of file changes, the program has also to be changed. These days the file oriented approach is still used but has following limitations: LIMITATIONS OF FILE ORIENTED APPROACH • Duplicate data Since all the files are independent of each other. So some of the fields or files are stored more than once. Hence duplicacy is more in case of file approach but dbms has controlled duplicacy. • Separated and isolated data To make a decision, a user might need data from two separate files. First, analysts and programmers to determine the specific data required from each file and the relationships between the data evaluated the files. Then applications could be written in a third generation language to process and extract the needed data. Imagine the work involved if data from several files was needed! • Inconsistency

In this system, data is not consistent. If a data item is changed the all the files containing that data item need to be changed and updated properly. If all the files are not updated properly there may be high risk of inconsistency. DBMS have data consistency. • Poor data integrity A collection of data has integrity. A file is said to be have data integrity - it means a item is not be stored in duplicate manner. It has been seen that file oriented system have poor data integrity control. Data integrity has been achieved in DBMS. • Every operation is programmable The processing tasks like searching, editing, deletion etc should have separate programs. It means there were no functions available for these operations. DBMS have ready-made commands for such operations. • Data inflexibility Program-data interdependency and data isolation limited the flexibility of file processing systems in providing users with ad hoc information requests. Because designing applications was so programming-intensive, MIS department staff usually restricted information requests Therefore, users often resorted to manual methods to obtain needed information.

• Concurrency problem It means using a same record at same time. This problem was common in file approach but can be controlled in DBMS. • Application programs are dependent on the file format: In file processing system the physical formats of the files are entered in the programs. The change in file means change in program and vice versa. No such problem in DBMS. • Poor data security All the files are stored in the flat form or text files. These files can be easily located and trapped because file approach, has no data security. • Difficult to represent the complex objects: Some the objects may be of variable length records can be computerized using this approach. DBMS has capability to handle fixed-length records as well as variable-length records. • Can not support heavy databases: The databases on the Internet can be handled by the files system - but DBMS like oracle is used for heavy data base applications. On the other hand the DBMS have following advantages. • Difficulty in representing data from the user‟s view

To create useful applications for the user, often data from various files must be combined. In file processing it was difficult to determine relationships between isolated data in order to meet user requirements. PROBLEMS OF FILE PROCESSING The file processing approach finally became too cumbersome, costly, and inflexible to supply the information needed to manage modem businesses. It was replaced by the database management approach. File processing systems had the following major problems:

• Data Redundancy Independent data files included a lot of duplicated data; the same data was recorded and stored in several files. This data redundancy caused problems when data had to be updated, since separate file maintenance programs had to be developed and coordinated to ensure that each file was properly updated. Unfortunately, a lot of

inconsistencies occurred among data stored in separate files. • Lack of Data Integration Having independent files made it difficult to provide end users with information for ad hoc requests that required accessing data stored in several different files. Special computer programs had to be written to retrieve data from each independent file. This was so difficult, time-consuming, and costly for some organizations that it was impossible to provide end users or management with such information. • Data Dependence In file processing systems, major components of the system - the organization of files, their physical locations of storage hardware, and the application software used to access those files — depended on one another in significant ways. Changes in the format and structure of data and records in a file required that changes be made to all of the programs that used that file. This program maintenance effort was a major burden of file processing systems.

• Other Problems It was easy for data elements to be defined differently by different end users and applications. Integrity of the data was suspect because there was no control over their use and maintenance by authorized end users.

Q.10. What are the various types of database uses? Ans. Without user all o the above said components (data, hardware & software) are meaning less. User can collect the data, operate and handle the hardware. Also operator feeds the data and arranges the data in order by executing the software. Users are of mainly of four types. These are: (a) Naïve user Naïve user has no knowledge of database system and its any supporting software. These are used at the end form. These are like a layman, which have little bit knowledge or computer system. These users are mainly used for collecting the data on the notebooks or on the pre-deigned forms. An automated teller machine (ATMs) user are in these categories. Naïve user can work on

any simple GUI base menu driven system. Internet using non-computer based person are in this form. (b) End User or Data Entry Operators Data entry operators are preliminary computer based users. The function of data entry operators are only to operate the computer (start! stop the computer) and feed or type the collected information (data) in menu driven application program and to execute it according to the analyst‟ requirement. These user are also called On line users. These user communicate the database directly via an on line terminal or indirectly via a user interface. These users require certain amount of expertise in the computer programming language, but require complete knowledge of computer operations. (c) Application programmer He is also called simple programmer. The working of application programmer is to develop a new project i.e. program for a particular application or modify an existing program. Application programmer works according to some instructions given by database administrator (DBA). Application programmer can handle all the programming language like Fortran, Cobol, dbase etc. (d) DBA (Data Base Administrator)

DBA is a major user. DBA either a single person or a group of persons. DBA is only the custodian of the business firm or organization but not the owner of the organization. As bank manager is the DBA of a bank, who takes care about the bank money and not use it. Only DBA can handle the information collected by end user and give the instructions to the application programmer for developing a new program or modifying an existing program. DBA is also called an overall controller of the organization. In computer department of a firm either system analysts or an EDP (Electronic Data Processing) Manager works as DBA. In other words DBA is the overall controller of complete hardware and software. RESPONSIBILITIES OF DBA As we know DBA is the overall commander of a computer system, so it has number of duties, but some of his/her major responsibilities are as follows:
1.

2.

DBA can control the data, hardware, and software and gives the instructions to the application programmer, end user and naive user. DBA decides the information contents of the database. He decides the suitable database file

3.

4.

5.

6.

structure for arrangement of data. He/She uses the proper DDL techniques. DBA compiles the whole data in a particular order and sequence. DBA decides where data can be stored i.e. take decision about the storage structure. DBA decides which access strategy and technique should be used for accessing the data. DBA communicates with the user by appropriate meeting, DBA co-operates with user.

1.

2.

3.

4.

5. 6.

DBA also define and, apply authorized checks and validation procedures. DBA also takes backup of the data on a backup storage device so that if data can be lost then it can be again recovered and compiled. DBA also recovers the damaged data. DBA also changes the environment according to user or industry requirement and monitor the performance. DBA should be good decision-maker. The decision taken by DBA should be correct, accurate & efficient. DBA should have leadership quality. DBA liaise with the user in the business to take confidence of the customer about availability of data.

Q11. Discuss the architecture of database management system. Ans. DBMS ARCHITECTURE There are many different framework have been suggested for the DBMS over the last several year. The generalized architecture of a database system is called ANSI/SPARC (American National Standards Institute/Standards Planning and Requirements Committee) model. In 1972, a final report about database is submitted by ANSI (American National Standard Institute) and SPARC (Standard Planning And Requirement Committee). According to this approach, three levels of a database system was suggested and they are: • External view (Individual user view) • Conceptual View (Global or community user view) • Internal level (physical or storage view). For the system to be usable, it must retrieve data efficiently. This concern has led to the design of complex data structures for the representation of data in the database. Since many database systems users are not computer trained,

developers hide the complexity from users through several levels of abstraction, to simplify users‟ interactions with the system. These three views or levels of the architecture are as shown in the diagram as follows:

OBJECTIVES OF THREE LEVEL ARCHITECTURE The database views were suggested because of following reasons or objectives of levels of a database: 1. Make the changes easy in database when some changes needed by environment. 2. The external view or user views do not depend upon any change made ii other view. For

example changes in hardware, operating system or internal view should not change the external view. 3. The users of database should not worry about the physical implementation and internal working of database system. 4. The data should reside at same place and all the users can access it as per their requirements. 5. DBA can change the internal structure without effecting the user‟s view. 6. The database should be simple and changes can be easily made. 7. It is independent of all hardware and software. All the three levels are shown below

External/View level The highest level of abstraction where only those parts of the entire database are included

which are of concern to a user. Despite the use of simpler structures at the logical level, some complexity remains, because of the large size of the database. Many users of the database system will not be concerned with all this information. Instead, such users need to access only a part of the database. So that their interaction with the system is simplified, the view level of abstraction is defined. The system may provide many views for the same database. 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. Database systems have several schemas, partitioned according to the levels of abstraction that we discussed. At the lowest level is the physical schema; at the intermediate level is the logical schema and at the highest level is a subschema. The features of this view are • The external or user view is at the highest level of database architecture. • Here only one portion of database will be given to user.

• One portion may have many views. • Many users and program can use the interested part of data base. • By creating separate view of database, we can maintain security. • Only limited access (read only, write only etc) can be provided in this view. For example: The head of account department is interested only in accounts but in library information, the library department is only interested in books, staff and students etc. But all such data like student, books, accounts, staff etc is present at one place and every department can use it as per need. Conceptual/Logical level Database administrators, who must decide what information is to be kept in the database, use this level of abstraction. One conceptual view represents the entire database. There is only one conceptual view per database. The description of data at this level is in a format independent of its physical representation. It also includes features that specify the checks to retain data consistence and integrity. The features are: • The conceptual or logical view describes the structure of many users.

• Only DBA can be defined it. • It is the global view seen by many users. • It is represented at middle level out of three level architecture. • It is defined by defining the name, types, length of each data item. The create table commands of Oracle creates this view. • It is independent of all hardware and software. Internal/Physical level The lowest level of abstraction describes how the data are stored in the database, and what relationships exist among those data. The entire database is thus described in terms of a small number of relatively simple structures, although implementation of the simple structures at the logical level may involve complex physical-level structures, the user of the logical level does not need to be aware of this complexity. The features are : • It describes the actual or physical storage of data. • It stores the data on hardware so that can be stored in optimal time and accessed in optimal time. • It is the third level in three level architecture.

• It stores the concepts like: • B-tree and Hashing techniques for storage of data. • Primary keys, secondary keys, pointers, sequences for data search. • Data compression techniques. • It is represented as FILE EMP [ INDEX ON EMPNO FIELD = { (EMPNO: BYTE (4), ENAME BYTE(25))] Mapping between views • The conceptual/internal mapping: o defines conceptual and internal view correspondence • specifies mapping from conceptual records to their stored counterparts o An external/conceptual mapping: • defines a particular external and conceptual view correspondence • A change to the storage structure definition means that the conceptual/internal

mapping must be changed accordingly, so that the conceptual schema may remain invariant, achieving physical data independence. • A change to the conceptual definition means that the conceptual/external mapping must be changed accordingly, so that the external schema may remain invariant, achieving logical data independence.

Q. 12. Write a note on Database Language And Interfaces. Ans. Some main types of languages and facilities are provided by DBMS. 1. Programming Language 2. Data Manipulation Language 3. Data Definition Language 4. Schema Description Language 5. Sub-Schema Description Language 6. SQL (Structured Query Language) 1. Programming Language All the programming language like Cobol, Fortran, C, C++, Pascal etc. has syntax and

semantics. These all have structured and logical structure, so these all commonly used to solve general and scientific problems. All the businessoriented problems can be solved by the three GL and Fourth Gt. 2. DML Some language that gives instructions to the programming language and other languages is called data manipulation language (DML). This language creates interface (linkage) between user and application program. This is extension of the program of the language used to manipulate data in the database. DML involves‟ retrieval of data from the database, insertion of new data into the database and deletion or modification of the existing data. Some data manipulation operations are also called QUERY‟ or• QUERY OPERATIONS. A Query is a statement in DML that request the retrieval of data from the database i.e. to search the data according to the user requirement. The subset of the DML used to operate the query is known as Query Language. DML provides commands to select & retrieve data from the database. Commands used in the DML are to insert, to update & to delete the records. The commands have different syntax for different programming language. For example, Fortran, Cobol, C etc. provide such type of facility with the help of database management system. The data

manipulation function provided by DBMS can be invoked in a application program directly by procedural calls or by processors statement. This procedure can be done by the compiler. The DML can become procedural language according to the user requirement. If the DML is non-procedural than user will indicate only what is to be retrieved. In both the cases the DBMS optimize the exact answer by using DML. 3. DDL Database management system provides a facility known as Data Definition Language or data description language (DDL). DDL can be used to define conceptual schema (Global) and also give some details about how to implement this schema in the physical devices used to store the data. The definition includes all the entity sets and their associated attributes as well as the relationship among the entities set. The definitions also have some constraints which are used in DML. DDL also have some meta-data (it is data about the data in database). Meta-data have data dictionary, directory, system catalog to describe data about data. The dictionary contains the information about the data stored in the database and it is consulted by DBMS before any data manipulation operations. The DBMS maintain the information on the file

structure and also used some access method to access the data efficiently. DDL is used for the help of DML. We can say that there is another language Data Sub Language (DSL) which is the combination of both DML and DDL. DSL = DML + DDL 4. Schema Description Language (SDL) or Schema It is necessary to describe the organization of the data in a formal manner. The logical and physical database descriptions are used by DBMS software. The complete and overall description of data is referred to as schema. The schema and subschema words are brought into DBMS by CODASYL (Conference on data system language committee) and also by the CODASYL‟s database task group. Schema is also referred to as conceptual model or global view (community view) of data. Suppose a complete description of collected data having all classes and student data, all employees (teaching & non-teaching) data and other concept of data related to the college is called Schema of the college. We can say that we relate whole college data logically, which is called schema.

5 Sub Schema Description language The term schema is used to mean an overall chart of the data items, types and record type stored in a database. The term sub-schema refers to an application programmer‟s view of data he uses. Sub-schema is the part of schema. Many different sub-schemas can be derived from one schema. An application programmer does not use whole data i.e. full schema, e.g. As in an organization, purchase-order for the maintenance department is the sub-schema of the whole schema description of the purchase department in the hole industry. Two or more than two application- programmers use the different subschemas. One person named A uses the subschema purchase-order whereas programmer B uses the sub-schema supplier. Their operations and views are different according to their own sub-schema but both combined these two sub-schemas on the basis of a common key. 6. Structured Query Language (SQL): SQL organized with the system R. System R means it is relational language. SQL is also called Structure Query Language. This language was developed in 1974 at IBM‟s San Jose Research Center. The purpose of this language is to provide

such non-procedural commands which are used for validation of the data and for searching the data. By using this language we can do any query about the data. SQL is sometimes named by SQUARE language. This language was helpful for both DDL and DML for the system R. Some SQL are also called Relational languages and used in a commercial RDBMS. Some commonly used SQL are ORACLE, INGRES, SYBASE etc. SQL resembles relational algebra and relational calculus in a relational system approach. DBMS INTERFACES Types of interfaces provided by the DBMS include: Menu-Based interfaces for Web Clients or Browsing • Present users with list of options (menus) • Lead user through formulation of request • Query is composed of selection options from menu displayed by system. Forms-Based Interfaces • Displays a form to each user • User can fill out form to insert new data or fill out only certain entries. • Designed and programmed for naïve users as interfaces to canned transactions. Graphical User Interfaces

• Displays a schema to the user in diagram form. The user can specify a query by manipulating the diagram. GUIs use both forms and menus. Natural Language Interfaces • Accept requests in written English or other languages and attempt to understand them. • Interface has its own schema, and a dictionary of important words. Uses the schema and dictionary to interpret a natural language request. Interfaces for Parametric Users • Parametric users have small set of operations they perform. • Analysts and programmers design and implement a special interface for each class of naïve users. • Often a small set of commands included to minimize the number of keystrokes required. (I.e. function keys) Interfaces for the DBA • Systems contain privileged commands only for DBA staff. • Include commands for creating accounts, setting parameters, authorizing accounts,

changing the schema, reorganizing the storage structures etc.

Q.13. Describe the Classification of Database Management Systems. Ans. Categories of DBMS DBMS (Database Management System) It is software to manage many databases. A DBMS is a software component or logical tool to handle the databases. All the queries from user about the data stored in the database will be handled by DBMS. There are many DBMSs available in market like dBase, FoxBASE, FoxPro, Oracle, Unify, Access etc. RDBMS (Relational Data Base Management System) Each database system uses a approach to store and maintain the data. For this purpose three data models were developed like Hierarchical model, Network Model and Relational Model. In the hierarchical model the data were arranged in the form of trees, in network model the data was arranged in the form of pointers and network and in relational model the data was arranged in the form of tables. The data stored in the form tables

is easy to stored, maintain and understand. Many DBMS has been developed using approach of hierarchical and network models. Any DBMS that uses the relational data model for data storage and modeling Is called RDBMS. In RDBMS we can create relations among tables and can access the information from tables - while tables store stored in separately file and may or may not have identical structures. The RDBMS is based upon the rules given by Dr. Codd known as Dr. Codd‟s Rules. HDBMS (Heterogeneous DBMS) In RDBMS we store the information related to the same kind of data like student data, teacher data, employee data etc. In HDBMS we store the data in the database which is entirely different. DDBMS (Distributed DBMS) During 1950s & 1960s there was trend to use independent or decentralized system. There was a duplication of hardware and facilities. In a centralized database system, the DBMS & data reside at a single place and all the control & location is limited to a single location, but the PCs are distributed geographically. Distributed system is parallel computing using multiple independent computers communicating over a network to accomplish a common objective or task. The type of hardware, programming languages, operating

systems and other resources may vary drastically. It is similar to computer clustering with the main difference being a wide geographic dispersion of the resources For example an organization may have an office in a building and have many sub- buildings that are connected using LAN. The current trend is towards distributed systems. This is a centralized system connected to intelligent remote sites. Each remote site have own storage and processing capabilities - but in a centralized or network there is a single storage. OODBMS (Object Oriented DBMS) Object-Oriented Database Management Systems (OODBMSs) have been developed to support new kinds of applications for which semantic and content are represented more efficiently with the object model. Therefore, the OODBMSs present the two main problems: • Impedance mismatch: It is basically due to two reasons. Firstly, the no suitable abstractions of the operating systems, so when a client object has to invoke a method that is offered by a server object, and both objects are not into the same address space, it is necessary to use the mechanisms that are offered by the operating system, and these mechanisms do not became proper to the object oriented paradigm since they

are oriented to communicate processes. In order to solve this problem intermediate software is included (e.g. COM or CORBA).In the second place, an impedance mismatch is also caused every time that the object-oriented applications need to use the operating system services. • Interoperability problem between object models: Although different system elements use the object-oriented paradigm, an interoperability problem can exist between them. So, an application implemented using the C++ language, with the C++ object model, can easily interact with its objects, but when it wants to use objects that have been created with another programming language or another object-oriented database an interoperability problem appears. The programming LANGUAGES like C, FORTRAN, PASCAL & FORTRAN use the POP (Procedure Oriented Approach) to develop applications, but the current trend is towards OOP (Object Oriented Programming). The languages like C++, Java, Oracle, C# (C Sharp). Visual Basic 6 use this approach. Many databases have been developed that follows this approach (OI approach) like Oracle. So the DBMS which follow OOP approach is called OODBMS.

Q. 14. Explain the difference between physical and logical data independence. Ans. One of the biggest advantages of database is data independence. It means we can change the conceptual schema at one level without affecting the data at other level. It means we can change the structure of a database without affecting the data required by users and program. This feature was not available in file oriented approach. There are two types of data independence and they are: 1. Physical data independence 2. Logical data independence Data Independence The ability to modify schema definition in on level without affecting schema definition in the next higher level is called data independence. There are two levels of data independence: 1. Physical data independence is the ability to modify the physical schema without causing application programs to be rewritten. Modifications at the physical level are occasionally necessary to improve performance. It means we change the physical storage/level without affecting the conceptual or external view of the data. The new changes are absorbed by mapping techniques.

2. Logical data independence in the ability to modify the logical schema without causing application program to be rewritten. Modifications at the logical level are necessary whenever the logical structure of the database is altered (for example, when money-market accounts are added to banking system). Logical Data independence means if we add some new columns or remove some columns from table then the user view and programs should not changes. It is called the logical independence. For example: consider two users A & B. Both are selecting the empno and ename. If user B add a new column salary in his view/table then it will not effect the external view user; user A, but internal view of database has been changed for both users A & B. Now user A can also print the salary. User A‟s External View

(View before adding a new column) User B‟s external view

(View after adding a new column salary) It means if we change in view then program which use this view need not to be changed. Logical data independence is more difficult to achieve than is physical data independence, since application programs are heavily dependent on the logical structure of the data that they access. Logical data independence means we change the physical storage/level without effecting the conceptual or external view of the data. Mapping techniques absorbs the new changes.

Q. 15. What is physical data independence? Ans. Physical data independence is the ability to modify the physical schema without causing application programs to be rewritten. Modifications at the physical level are occasionally necessary to improve performance. It means we change the physical storage/level without affecting the

conceptual or external view of the data. The new changes are absorbed by mapping techniques.

Q. 16. What do you mean by data redundancy? Ans. Redundancy is unnecessary duplication of data. For example if accounts department and registration department both keep student name, number and address. Redundancy wastes space and duplicates effort in maintaining the data. Redundancy also leads to inconsistency. Inconsistent data is data which contradicts itself - e.g. two different addresses for a given student number. Inconsistency cannot occur if data is represented by a single entry (i.e. if there is no redundancy). Controlled redundancy Some redundancy may be desirable (for efficiency). A DBMS should be aware of it, and take care of propagating updates to all copies of a data item. This is an objective, not yet currently supported.

Q. 17. What do you man by database schema? Ans. It is necessary to describe the organization, of the data in a formal manner. The logical and physical database descriptions are used by DBMS software. The complete and overall description of data is referred to as schema, The schema and subschema words are brought into DBMS by CODASYL (Conference on data system language1 committee) and also by the CODASYL‟s database task group. Schema is also referred to as conceptual model or global view (community view) of data. Suppose a complete description of collected data having all classes and student data4 all employees (teaching & non-teaching) data and other concept of data related to the college is called Schema of the college. We can say that we relate whole college data logically, which is called schema.

Q. 18. Explain the distinctions among the terms primary key, candidate key and superkey. Or

What is the significance of foreign key? Or What are the various keys? Ans. Keys: As there are number of keys can be defined, but some commonly and mainly used keys are explained as below: 1. Primary Key A key is a single attribute or combination of two or more, attributes of an entity that is used to identify one or more instances of the set. The attribute Roll # uniquely identifies an instance of the entity set STUDENT. It tells about student Amrita having address 101, Kashmir Avenue and phone no. 112746 and have paid fees 1500 on basis of Roll No. 15. The 15 is unique value and it gives unique identification of students So here Roll No is unique attribute and such a unique entity identifies called Primary Key. Primary key cannot be duplicate. From the definition of candidate key, it should be clear that each relation must have at least one candidate key even if it is the combination of all the attributes in the relation since all tuples in a relation are distinct. Some relations may have more t one candidate keys. As discussed earlier, the primary key of a relation is an arbitrarily but permanently selected

candidate key. The primary key is important since it is the sole identifier for the tuples in a relation. Any tuple in a database may be identified by specifying relation name, primary key and its value. Also for a tuple to exist in a relation, it must be identifiable and therefore it must have a primary key. The relational data model therefore imposes the following two integrity constraints: (a) No component of a primary key value can be null; (b) Attempts to change the value of a primary key must be carefully controlled. The first constraint is necessary because if we want to store information about some entity, then we must be able to identify it, otherwise difficulties are likely to arise. For example, if a relation CLASS (STUNO, LECTURER, CNO) has (STUNO, LECTURER) as the primary key then allowing tuples like 3123 CP302 NULL CP302 NULL SMITH

is going to lead to ambiguity since the two tuples above may or may not be identical and the integrity of the database may be compromised. Unfortunately most commercial database systems

do not support the concept of primary key and it would be possible to have a database state when integrity of the database is violated. The second constraint above deals with changing of primary key values. Since the primary key is the tuple identifier, changing it needs very careful controls. Codd has suggested three possible approaches: Method 1 Only a select group of users be authorised to change primary key values. Method 2 Updates on primary key values be banned. If it was necessary to change a primary key, the tuple would first be deleted and then a new tuple with new primary key value but same other values would be inserted. Of course, this does require that the old values of attributes be remembered and be reinserted in the database. Method 3 A different command for updating primary keys be made available. Making a distinction in altering the primary key and another attribute of a relation would remind users that care needs to be taken in updating primary keys. 2. Secondary Key

The ke1 which is not giving the unique identification and have duplicate infonna6o is called secondary key, e g in a STUDENT entity if Roll Number is the primary key, then Name of the student, address of the student, Phone number of the student and the fees paid by the student all are secondary keys. A secondary key is an attribute or combination of attributes that not be primary key and have duplicate data. In otherworlds secondary key is used after the identification of the primary key. Also we can identify the data from the combination of the secondary keys. 3. Super Key If we add additional attributes to a primary key, the resulting combination would still uniquely identify an instance of the entity set Such keys are called super keys A primary key is therefore a minimum super key For example, if DOB (date of birth field or attribute) is the primary key, then by adding some additional information about the day of the month key in the DOB field, this field or attribute becomes more powerful and useful Such type of key is called super key Super key are less used in a small database file. Now these days it has less importance, but due to its feature, this key gives the complete description of the database. 4. Candidate Key

There may be two or more attributes or combination of attributes that uniquely identify an instance of an entity set These attributes or combination of attributes are called candidate keys. Candidate key also gives unique identification. Candidate key comes with primary key. A candidate is a combination of two or more attributes e.g. if Roll No. and student name are two different attributes then we combine these two attribute and form a single attribute Roll No. & Name, then this combination is the candidate key and it is unique and gives unique identification about a particular roll no. and about particular name. 5. Alternative Key A candidate key which is not the primary key is called alternative key, e.g. if Roll No. and Name combination is the candidate key, then if Roll No, is the primary key, other key in the candidate key is Name. Name attribute work as the alternative key. 6 Foreign Key Suppose there are some relations as: SP (S#, P#, QTY), relation S (S#, S Name, status, city) and relation P (P#, PName, Color, Weight, City). We know entity SP is defined as the relationship of the relation S and the relation P. These two relations has sand P# as the Primary Keys in

relation S and P respectively, but in the relation SP we can take either # as the primary key or P# as the primary key. Suppose if we take P# as the primary key, then other primary key S# which is actually the primary key, but do not work as primary key in the relation SF is called the Foreign Key. If S# is the primary key then P# is the Foreign Key. Similarly in the relation ASSIGNMENT, attribute Emp #, Prod #, Job # are given and if S# and P# are the primary keys, then the Job # key is the Foreign Keys.

Q. 19. What are the major functions of a database administrator? Ans. RESPONSIBILITIES OF DBA As we know DBA is the overall commander of a computer system, so it has number of duties, but some of his/her major responsibilities are as follows: 1. DBA can control the data, hardware, and software and gives the instructions to the application programmer, end user and naive user. 2. DBA decides the information contents of the database. He decides the suitable database file structure for arrangement of data. He/She uses the proper DDL techniques.

3. DBA compiles the whole data in a particular order and sequence. 4. DBA decides where data can be stored i.e. take decision about the storage structure. 5. DBA decides which access strategy and technique should be used for accessing the data. 6. DBA communicates with the user by appropriate meeting. DBA co-operates with user. 7. DBA also define and apply authorized checks and validation procedures. 8. DBA also takes backup of the data on a backup storage device so that if data can then lost then it can be again recovered and compiled. DBA also recovers the damaged data. 9. DBA also changes the environment according to user or industry requirement and monitor the performance. 10. DBA should be good decision-maker. The decision taken by DBA should be correct, accurate & efficient. 11. DBA should have leadership quality. 12. DBA liaise with the user in the business to take confidence of the customer about the availability of data.

Q. 20. What do you mean by relationships? Explain different types of relationships. Ans. Relationships: One table (relation) may be linked with another in what is known as a relationship. Relationships may be built into the database structure to facilitate the operation of relational joins at runtime.
1.

2.

A relationship is between two tables in what is known as a one-to-many or parentchild or master-detail relationship where an occurrence on the „one‟ or „parent‟ or „master‟ table may have any number of associated occurrences on the „many‟ or „child‟ or „detail‟ table. To achieve this, the child table must contain fields which link back the primary key on the parent table. These fields on the child table are known as a foreign key, and the parent table is referred to as the foreign table (from the viewpoint of the child). It is possible for a record on the parent table to exist without corresponding records on the child table, but it should not be possible for an entry on the child table to exist without a corresponding entry on the parent table.

3.

4.

5.

A child record without a corresponding parent record is known as an orphan. It is possible for a table to be related to itself. For this to be possible it needs a foreign key which points back to the primary key. Note that these two keys cannot be comprised of exactly the same fields otherwise the record could only ever point to itself. A table may be the subject of any number of relationships, and it may be the parent in some and the child in others.

1.

2.

Some database engines allow a parent table to be linked via a candidate key, but if this were changed it could result in the link to the child table being broken. Some database engines allow relationships to be managed by rules known as referential integrity or foreign key restraints. These will prevent entries onchild tables from being created if the foreign key does not exist on the parent table, or will deal with entries on child tables when the entry on the parent table is updated or deleted.

Relational Joins

The join operator is used to combine data from two or more relations (tables) in order to satisfy a particular query. Two relations may be joined when they share at least one common attribute. The join is implemented by considering each row in an instance of each relation. A row in relation R1 is joined to a row in relation R2 when the value of the common attribute(s) is equal in the two relations. The join of two relations is often called a binary join. The join of two relations creates a new relation. The notation „R1 x R2‟ indicates the join of relations R1 and R2. For example, consider the following:

Note that the instances of relation RI and R2 contain the same data values for attribute B. Data normalisation is concerned with decomposing a relation (e.g. R(A,B,C,D,E) into smaller relations (e.g. R1 and R2). The data values for attribute B in this context will be identical in R1 and R2. The instances of R1 and R2 are projections of

the instances of R(A,B,C,D,E) onto the attributes (A,B,C) and (B,D,E) respectively. A projection will not eliminate data values duplicate rows are removed, but this will not remove a data value from any attribute. The join of relations RI and R2 is possible because B is a common attribute. The result of the join is:

The row (2 4 5 7 4) was formed by joining the row (2 4 5) from relation R1 to the row (4 7 4) from relation R2. The two rows were joined since each contained the same value for the common

attribute B. The row (2 4 5) was not joined to the row (6 2 3) since the values of the common attribute (4 and 6) are not the same. The relations joined in‟ the preceding example shared exactly one common attribute. However, relations may share multiple common attributes. All of these common attributes must be used in creating a join. For example, the instances of relations R1 and R2 in the following example are joined using the common attributes B and C: Before the join:

After the join:

The row (6 1 4 9) was formed by joining the row (6 1 4) from relation R1 to the row (1 4 9) from relation R2. The join was created since the common set of attributes (B and C) contained identical values (1 and 4). The row (6 1 4) from R1 was not joined to the row (1 2 1) from R2 since the common attributes did not share identical values - (1 4) in R1 and (1 2) in R2. The join operation provides a method for reconstructing a relation that was decomposed into two relations during the normalisation process. The join of two rows, however, can create a new row that was not a member of the original relation. Thus invalid information can be created during the join process.

Now suppose that a list of courses with their corresponding room numbers is required. Relations R1 and R4 contain the necessary information and can be joined using the attribute HOUR. The result of this join is:

This join creates the following invalid information (denoted by the coloured rows):

• Smith, Jones, and Brown take the same class at the same time from two different instructors in two different rooms. • Jenkins (the Maths teacher) teaches English. • Goldman (the English teacher) teaches Maths. • Both instructors teach different courses at the same time. Another possibility for a join is R3 and R4 (joined on INSTRUCTOR). The result would be:

This join creates the following invalid information: • Jenkins teaches Math I and Algebra simultaneously at both 8:00 and 9:00. A correct sequence is to join R1 and R3 (using COURSE) and then join the resulting relation with R4 (using both INSTRUCTOR and HOUR). The result would be:

Extracting the COURSE and ROOM attributes (and eliminating the duplicate row produced for the English course) would yield the desired result:

The correct result is obtained since the sequence (R1 x r3) x R4 satisfies the lossless (gainless?) join property A relational database is in 4th normal form when the lossless join property can be used to answer unanticipated queries. However, the choice of joins must be evaluated carefully. Many different sequences of joins will recreate an instance of a

relation. Some sequences are more desirable since they result in the creation of less invalid data during the join operation. Suppose that a relation is decomposed using functional dependencies and multi- valued dependencies. Then at least one sequence of joins on the resulting relations exists that recreates the original instance with no invalid data created during any of the join operations. For example, suppose that a list of grades by room number is desired. This question, which was probably not anticipated during database design, can be answered without creating invalid data by either of the following two join sequences:

The required information is contained with relations R2 and R4, but these relations cannot be joined directly. In this case the solution requires joining all 4 relations. The database may require a „lossless join‟ relation, which is constructed to assure that any ad hoc inquiry‟ can be answered with relational

operators. This relation may contain attributes that are not logically related to each other. This occurs because the relation must serve as a bridge between the other relations in the database. For example, the lossless join relation will contain all attributes that appear only on the left side of a functional dependency. Other attributes may also be required, however, in developing the lossless join relation. Consider relational schema R (A, B, C, D), A B and C D. Relations and are in 4th normal form. A third relation however, is required to satisfy the lossless join property. This relation can be used to join attributes B and D. This is accomplished by joining relations R1 and R3 and then joining the result to relation R2. No invalid data is created during these joins. The relation is the lossless join relation for this database design. A relation is usually developed by combining attributes about a particular subject or entity. The lossless join relation, however, is developed to represent a relationship among various relations. The lossless join relation may be difficult to populate initially and difficult to maintain - a result of including attributes that are not logically associated with each other.

The attributes within a lossless join relation often contain multi-valued dependencies. Consideration of 4th normal form is important in this situation. The lossless join relation can sometimes be decomposed into smaller relations by eliminating the multi-valued dependencies. These smaller relations are easier to populate and maintain.

Q. 21. What is an ER-diagram? Construct an ER diagram for a hospital with a set of patients and a set of doctors. Associate with each patient a log o1 the various tests and examinations conducted. Or Discuss in detail the ER diagram. Or What is one to many relationship? Give examples. Or Draw an ER diagram for a library management system, make suitable assumptions. Describe various symbols used in ER. diagram. Or

Construct an ER diagram for a university registrar’s office. The office maintains data about each class, including the instructor, the enrollment and the time and place of the class meetings. For each student class pair, a grade is recorded also design a relational database for the said I.R. diagram. Ans. E-R model grew out of the exercise of using commercially available DBMS to model application database. Earlier DBMS were based on hierarchical and network approach. E-R is a generalization of these models. Although it has some means of describing the physical database model, it is basically useful in the design of logical database model. This analysis is then used to organize data as a relation, normalizing relations and finally obtaining a relational database model. The entity-relationship model for data uses three features to describe data. These are: 1. Entities, which specify distinct real-world items in an application. 2. Relationships, which connect entities and represent meaningful dependencies between them. 3. Attributes, which specify properties of entities and relationships.

We illustrate these terms with an example. A vendor supplying items to a company, for example, is an entity. The item he supplies is another entity. A vendor supplying items are related in the sense that a vendor supplies an item. The act of supplying• defines a relationship between a vendor and an item. An entity set is a collection of similar entities. We can thus define a vendor set and an item set. Each member of an entity set is described by some attributes. For example, a vendor may be described by the attributes: (vendor code, vendor name, address) An item may be described by the attributes: (item code, item name) Relationship also can be characterized by a number of attributes. We can think of the relationship as supply between vendor and item entities: The relationship supply can be described by the attributes: (order no. date of supply)

Relationship between Entity Sets The relationship between entity sets may be many-to-many (M: N), one-to-many (1: M), manyto-one (M: 1) or one-to-one (1:1). The 1:1 relationship between entity sets E1 and E2 indicates that for each entity in either set there is at most one entity in the second set that is associated with it. The 1: M relationship from entity set E1 to E2 indicates that for an occurrence of the entity from the set E1, there could be zero,

one or more entities from the entity set E2 associated with it. Each entity in E2 is associated with at most one entity in the entity set E1. In the M: N relationship between entity sets E1 and E2, there is no restriction to the number of entities in one set associated with an entity in the other set. The database structure, employing the E-R model is usually shown pictorially using entityrelationship (E-R) diagram. To illustrate these different types of relationships consider the following entity sets: DEPARTMENT, MANAGER, EMPLOYEE, and PROJECT The relationship between a DEPARTMENT and a MANAGER is usually one-to- one; there is only one manager per department and a manager manages only one department. This relationship between entities is shown in Figure. Each entity is represented by a rectangle and the relationship between them is indicated by a direct line. The relationship for MANAGER to DEPARTMENT and from DEPARTMENT to MANAGER is both 1:1. Note that a one-to-one relationship between two entity sets does not imply that for an occurrence of an entity from one set at any time there must be an occurrence of an entity in the other set. In the case of an organization, there could be times when a department is without a manager or when an employee who is classified as a manager may be

without a department to manage. Figure shows some instances of one-to-one relationships between the entities DEPARTMENT and MANAGER.

A one-to-many relationship exists from the entity MANAGER to the entity EMPLOYEE because there are several employees reporting to the manager. As we just pointed out, there could be an occurrence of the entity type MANAGER having zero occurrences of the entity type EMPLOYEE reporting to him or her. A reverse relationship, from EMPLOYEE to MANAGER, would be many to one, since many employees may be supervised by a single manager. However, given an instance of the entity set EMPLOYEE, there could be only one instance of the entity set MANAGER to whom that employee reports (assuming that no employee reports to more than one manager). The relationship between entities is illustrated in Figures shows some instances of this relationship.

Figure: 1:M Relationship

Figure: Instances of 1: M Relationship The relationship between the entity EMPLOYEE and the entity PROJECT can be derived as follows: Each employee could be involved in a number of different projects, and a number of employees could be working on a given project. This relationship between EMPLOYEE and PROJECT is many-to-many. It is illustrated in Figures shows some instances of such a relationship. Figure: M : N Relationship

Figure: Instances of M:N Relationship

In the entity-relationship (E-R) diagram, entities are represented by rectangles, relationships by a diamond-shaped box and attributes by ellipses or ovals. The following E-R diagram for vendor, item and their relationship is illustrated in Figure (a).

Figure (a): E-R diagram for vendor; item and their Relationship Representation of Entity Sets in the form of Relations The entity relationship diagrams are useful in representing the relationship among entities they show the logical model of the database. E-R diagrams allow us to have an overview of the important entities for developing an information

system and other relationship. Having obtained ER diagrams, the next step is to replace each entity set and relationship set by a table or a relation. Each table has a name. The name used is the entity name. Each table has a number of rows and columns. Each row contains a number of the entity set. Each column corresponds to an attribute. Thus in the E-R diagram, the vendor entity is replaced by table below. Table: Table For the Entity Vendor

The above table is also known as a relation. Vendor is the relation name. Each row of a relation is called a tuple. The titles used for the columns of a relation are known as relation attributes. Each tuple in the above example describes one vendor. Each element of a tuple gives specific property of that vendor. Each property is identified by the title used for an Attribute column. In a relation the rows may be in any order. The columns may also be depicted in any order. No two rows can be identical. Since it is inconvenient to show the whole table corresponding to a relation, a more concise

notation is used to depict a relation. It consists of the relation name and its attributes. The identifier of the relation is shown in bold face. A specified value of a relation identifier uniquely identifies the row of a relation. If a relationship is M: N, then the identifier of the relationship entity is a composite identifier, which includes the identifiers of the entity sets, which are related. On the other hand, if the relationship is 1:N, then the identifier of the relationship entity is the identifier of one of the entity sets in the relationship.. For example, the relations and identifiers corresponding to the E-R diagram of Figure are as shown:

Figure: E-R Diagram for Teacher, Student and their relationship

Teacher (Teacher-id, name, department, address) Teaches (Teacher-id, Student-id) Student (Student-id, name, department, address) One may ask why an entity set is being represented as a relation. The main reasons are case of storing relations as flat files in a computer and, more importantly, the existence of a sound theory on relations, which ensures good database design. The raw relations obtained as a first step in the above examples are transformed into normal relations. The rules for transformations called normalization are based on sound theoretical principles and ensure that the final normalized relations obtained reduce duplication of data, ensure that no mistake occur when data are added or, deleted and simplify retrieval of required data.

Q. 22. Discuss relational approach of database management system? Explain with the help of suitable relational operations to demonstrate insert, delete and update functions. Or What is relational model compare and contrast it with network and hierarchical model.

Ans. Database models are collection of conceptual tools for describing data semantics and data constraints. DBMS has number of ways to represent the data, But some important and commonly used model are of four types, among which three are mainly used. These are: I. Relational Model or Relational Approach II. Hierarchical Model or Hierarchical Approach III. Network Model or Network Approach I. Relational Data Model Relational Data Model has been developed from the research in deep and by testing and by trying through many stages. This model has advantages that it is simple to implement and easy to understand. We can express queries by using query language in this model. In this model relation is only constructed by setting the association among the attributes of an entity as well the relationship among different entities. One of the main reasons for introducing this model was to increase the productivity of the application programmers by eliminating the need to change application programmer, when a change is mode to the database. In this user need not know the exact physical structure. Data structure used in the

data model represented by both entities and relationship between them. We can explain relation view of data on relational approach on the basis of following example. Suppose there are three tables in which data is organized. These tables are Supplier tables or S table or S relation, Part table or P table or P relation, Shipment table of SP table or SP relation. The S table further has some fields or attributes. These are supplier number (S#), supplier name, status of the supplier and the city in which the supplier resides. Similarly P table has field part number (P#), part name, part color, weight of the part and location where the part is stored. Also SP table contains field supplier number (S#), part number (P#) and the quantity which supplier can ship. Each supplier s unique supplier number S# and similarly each part has unique part umber P#. These three tables are called relational table. S table is also called S-relation because it gives the relationship between different attributes. These attributes are field name and in the form of column. Rows of such table are called tuples. Pool of values in a particular w and attributes called domain. In other words domain is a pool of values from which actual value appearing in a given column are drawn. For example, in S table - S#, Sname, S-status are the attributes and s1, s2, s3

are domains. A relational table or relationship can be defined as: Definition: A relation represented by table having n column, defined on domain Dl, D2, .... Dn is a subset of cartesian product DI x D2 x……x Dn. Another definition is : It is collection of Dl, D2, D3,…….Dn then R is relation on these n sets if these n sets are ordered in n tuples such that each value of attribute belong to Dl, D2,…….Dn. These three relations are represented by diagram: S table (Entity) or S Relation:

P table (Entity) or P Relation:

As in the .S table insertion, deletion and modifications can be done easily. II. Hierarchical Model

It is a tree structure. It has one root and many branches, we call it parent child relationship. In this a single file has relation with many files and similarly we can say that it is the arrangement of individual data with group data. In an organization chart manager is the parent root and employees working under the manager are their children The representation of this model is expressed by linking different tables. Such type of representation is better for a linkage have many relationships with one. Some times it will create ambiguity in designing and defining the association and relationship between SP table (Entity) or SP Relation:

In hierarchical approach, insertion can be done if a child has a parent and insertion on the child side is easy. Deletion and insertion is easy, but you

can‟t delete a parent: parent has one or more child. In the parent child relationship updation in parent and child both are difficult. III. Network Approach It is a complex approach of DBMS. In this we link all the records by using a chain or pointer. It has many to many relationships. Network approach is created when there are more than one relations in the database system. Network approach starts from on point and after connecting similar type of data it returns back to the same record. Network approach is more symmetric than the hierarchical structure. In network model insertion at any point is very complex. We can insert only by creating a new record having linkage with other record. Similarly deletion is also complex if we delete any record than chain disconnect and whole structure vanish. Updation is also complex because we cannot change name or any data record because it connected with each other. Difference between Relational, Hierarchical and Network Approaches: (A) Relational Approach: Relational Approach (RA) has relationship between different entities and attribute in a particular entity. RA is in tabular form. RA

has one to one relationships. R-A has table in asymmetric form. Insertion, deletion, updation in R table is very easy. Languages used in RA are SQL, Ingress, Oracle, Sybase. RA is simple in nature. Relational approach creates relationship between different entities and different attributes in the same entity. It is the best approach to represent the data than the other models. (B) Hierarchical Approach: Hierarchical Approach (HA) creates a linkage between two or more entities. HA has parent child relationship. HA has one to many relationships. HA relationship is in symmetric form by defining parent and their child. Insertion, deletion, updation is little difficult than the RA. HA has IMS language, which is theoretical. It is Complex in nature. (C) Network Approach: Network Approach (NA) has chain among many entities. NA has chaining technique or pointer technique. NA has many to many relationships. NA relationship is full or completely symmetric form because it has one chain symmetry. Insertion, deletion, updation is very difficult. NA has DBTG (Database Task Group) set hiving different classes & members. More complex than RA & HA.

Q. 23. What is the usage of unified modelling language (UML)? Ans. UML is a graphical language for visualizing, specifying, constructing and documenting an object oriented softwareintensive system‟s artifacts.

Q. 24. What are graphical user interfaces? Ans. A graphical user interface (GUI) is sometime pronounced “gooey” is a method of interacting with a computer through a metaphor of direct manipulation of graphical images and widgets in addition to text. GUI display visual elements such as icon, Windows and other gadgets

Q. 25. Define the term dangling pointer. Ans. The pointers that points to nothing is called dangling pointer.

Q. 26. Write a short note on Mapping. Ans. Mappings • The conceptual/internal mapping: defines conceptual and internal view correspondence specifies mapping from conceptual records to their stored counterparts • An external/conceptual mapping: defines a particular external and conceptual view correspondence • A change to the storage structure definition means that the conceptual/internal mapping must be changed accordingly, so that the conceptual schema may remain invariant, achieving physical data independence. • A change to the conceptual definition means that the conceptual/external mapping must be changed accordingly, so that the external schema may remain invariant, achieving logical data independence. Q. 27. Distinguish between RDBMS and DBMS. Ans.



Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close