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

Computer Science - V: Disadvantages of Database System Are

This document contains answers to questions about database systems. It defines transactions and their ACID properties. It lists advantages and disadvantages of database systems such as reduced redundancy, increased consistency and reduced costs versus complex design and start-up costs. It also defines keys, normalization, data types, security and differences between searching and filtering in views.

Uploaded by

Jugal Patel
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views

Computer Science - V: Disadvantages of Database System Are

This document contains answers to questions about database systems. It defines transactions and their ACID properties. It lists advantages and disadvantages of database systems such as reduced redundancy, increased consistency and reduced costs versus complex design and start-up costs. It also defines keys, normalization, data types, security and differences between searching and filtering in views.

Uploaded by

Jugal Patel
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

1

Computer Science -V
Short answers Q.1. What is transaction? What guarantee does a DBMS offer with respect to transactions? A transaction is a "sequence of operations performed as a single logical unit of work". A transaction has four key properties that are abbreviated ACID. ACID is an acronym for for Atomic Consistent Isolated Durability. Atomic means that all the work in the transaction is treated as a single unit. Either it is all performed or none of it is. Consistent means that a completed transaction leaves the dat abase in a consistent internal state. Isolations means that the transaction sees the database in a consistent state. This transaction operates on a consistent view of the data. If two transactions try to update the same table, one will go first and then the other will follow. Durability means that the results of the transaction are permanently stored in the system. Q.2. What are the disadvantages of a database system?

Disadvantages of database system are:


Database systems are complex, difficult, and time-consuming to design. Substantial hardware and software start-up costs. Damage to database affects virtually all applications programs. Extensive conversion costs in moving form a file-based system to a database system. Initial training required for all programmers and users.

Q.3. What are the advantages of a database system?

Advantages of a database system are:


Reduced data redundancy Reduced updating errors and increased consistency Greater data integrity and independence from applications programs Improved data access to users through use of host and query languages Improved data security Reduced data entry, storage, and retrieval costs Facilitated development of new applications program

Q.4. Why are tuples I a relation not ordered? A relation is defined as a set of tuples. Mathematically, elements of a set have no order among them; hence, tuples in a relation do not have any particular order. In other words, a relation is not sensitive to the ordering of tuples. Tuple ordering is not part of a relation definition because a relation attempts to represent facts at a logical or abstract level. Many logical orders can be specified on a relation but there is no preference for one logical ordering over another.

Computer Science -V
Q.5. State the difference between key and super key. Superkey is any subset of attributes that uniquely identifies the tuples of a relation. This subset need not be minimal, that is, one can remove some attributes from it and it is still uniquely identifying. If all redundant attributes are removed you get a subset what is called primary key. A key (better: primary key) is the minimal subset of attributes that uniquely identifies the tuples of a relation, that is, you can't remove further attributes from this subset without losing the property of unique Identification. Therefore, the super superkey (like superman) is always the set of all attributes of a relation. Q.6. What do you mean by logical data independence? Logical data independence: The ability to change the logical (conceptual) schema without changing the External schema (User View) is called logical data independence. For example, the addition or removal of new entities, attributes, or relationships to the conceptual schema should be possible without having to change existing external schemas or having to rewrite existing application programs.

Q.7. What do you mean by physical data independence?


Physical data independence: The ability to change the physical schema without changing the logical schema is called physical data independence. For example, a change to the internal schema, such as using different file organization or storage structures, storage devices, or indexing strategy, should be possible without having to change the conceptual or external schemas.

Q.8. List data types that are allowed for SQL attributes.

Data Type
integer smallint numeric Integer Smallint

Syntax

Explanation

numeric(p,s)

Where p is a precision value; s is a scale value. For example, numeric(6,2) is a number that has 4 digits before the decimal and 2 digits after the decimal. Where p is a precision value; s is a scale value. Single-precision floating point number Double-precision floating point number Where p is a precision value. Where x is the number of characters to store. This data type is space padded to fill the number of characters specified.

decimal real double precision float character

decimal(p,s) Real double precision float(p) char(x)

Computer Science -V
character varying varchar2(x) Where x is the number of characters to store. This data type does NOT space pad. Where x is the number of bits to store. Where x is the number of bits to store. The length can vary up to x. Stores year, month, and day values. Stores the hour, minute, and second values. Stores year, month, day, hour, minute, and second values. Exactly the same as time, but also stores an offset from UTC of the time specified.

bit bit varying

bit(x) bit varying(x)

date time timestamp

Date Time Timestamp

time with time zone

time with time zone

timestamp with time zone timestamp with time zone Exactly the same as timestamp, but also stores an offset from UTC of the time specified. year-month interval day-time interval Contains a year value, a month value, or both. Contains a day value, an hour value, a minute value, and/or a second value.

Q.9. Write the use of primary key and foreign key?


Primary key - Primary key means main key def:- A primary key is one which uniquely identifies a row of a table, so that an individual record can be located without confusion. This key does not allow null values and also does not allow duplicate values. for ex, empno empname salary 1 Asha 35000 2 Vinod 34000 3 Babita 40000 it will not allow the values 1 Asha 35000 1 Vinod 34000 Babita 35000 Foreign key- A foreign key is a key used to link two tables together. A foreign key is one which will refer to a primary key of another table

Computer Science -V
for ex, emp_table empno empname salary deptno

dept_table deptno deptname

In the above relation, deptno is there in emp_table which is a primary key of dept_table. that means, deptno is refering the dept_table.

Q.10. What do you mean by data redundancy?


Data Redundancy is a condition that exists when a data environment contains unnecessarily duplicated data. Unnecessary data can occur when an organization stores several copies of similar information about the same data in multiple departments within an organization (ie; Sales, Support, and Marketing) maintaining their "own" customer databases (ie; SALES_CUST, SUPPORT_CUST, and

MARKETING_CUST). It can also occur if repeatable data types are contained within repeating fields, and not segregated into their own tables and related by a unique ID key (ie; ID_CUST, or CUST_ID).

Q.11. Define DCL with example.


DCL DCL is abbreviation of Data Control Language. A Data Control Language (DCL) is a syntax similar to a computer programming language used to control access to data stored in a database. Examples of DCL commands include: GRANT to allow specified users to perform specified tasks. REVOKE to cancel previously granted or denied permissions.

Q.12. State difference between primary key and candidate key.


A primary key is a column which uniquely identifies the records in a table. In a broad sense, a primary key is the mixture of a unique key and an index: A collumn with a primary key is indexed to deliver a faster query, and doesn't allow duplicate values to ensure specific data. A candidate key would be any key which could be used as the primary key, which means that the combination of the columns, or just the single column would create a unique key. You would then need to determine which of these candidate keys would work best as your primary key.

Q.13. What is the meaning of normalization?


Normalization is a series of tests on a relation to determine whether it satisfies or violates the requirements of a given normal form. Four most commonly used normal forms are first (1NF), second (2NF), third (3NF) and BoyceCodd (BCNF) normal forms.

Computer Science -V
Based on functional dependencies among the attributes of a relation, a relation can be normalized to a specific form to prevent the possible occurrence of update anomalies.

Q.14. Define concurrent access. Q.15. Differentiate between CHAR and VARCHAR.
CHAR is used for fixed length memory storage whereas VARCHAR is used for variable lenght memory storage. For Example if we have char(10) then we can store 10 bit value in it but if we store only 6 bit value in it then rest of the 4 bit space goes wasted. This limitation is overcome by VARCHAR. In VARCHAR if we use less space than defined space the rest of the space is not wasted.

Q.16. What is Data security?


Data Security means protecting a database from destructive forces and the unwanted actions of unauthorised users. Data security is the process of making sure data is kept safe from corruption and that access is controlled. This ensures privacy of personal data on your computer.

Q.17. What's the difference between filtering and searching?


A view's filter defines what records are displayed in the view. Because a filter is part of the view's design, the view displays only the records that match the filter every time anyone opens the view. In other words, the filter is always on. The filter can be changed only by a database manager who edits the view definition. Any user can search in a view to retrieve a set of records that match the criteria they type into the Search box. The search is performed only on records that match the view's filter, so the search results are the records that match both the filter and the search criteria. There is no way for a user to save a search string for future use; they must type it in each time.

Long answers
Q.1. Explain R.F code.
Codd's rules are proposed by Edgar F. Codd, a pioneer of the relational model for databases, designed to define what is required from a database management system in order for it to be considered relational, i.e., a relational database management system (RDBMS) Rule (0): The system must qualify as relational, as a database, and as a management system. For a system to qualify as a relational database management system (RDBMS), that system must use its relational facilities to manage the database. Rule 1: The information rule: All information in the database is to be represented in only one way, namely by values in column positions within rows of tables. Rule 2: The guaranteed access rule:

Computer Science -V
All data must be accessible. This rule is essentially a restatement of the fundamental requirement for primary keys. It says that every individual scalar value in the database must be logically addressable by specifying the name of the containing table, the name of the containing column and the primary key value of the containing row. Rule 3: Systematic treatment of null values: The DBMS must allow each field to remain null (or empty). Specifically, it must support a representation of "missing information and inapplicable information" that is systematic, distinct from all regular values (for example, "distinct from zero or any other number", in the case of numeric values), and independent of data type. It is also implied that such representations must be manipulated by the DBMS in a systematic way. Rule 4: Active online catalog based on the relational model: The system must support an online, inline, relational catalog that is accessible to authorized users by means of their regular query language. That is, users must be able to access the database's structure (catalog) using the same query language that they use to access the database's data. Rule 5: The comprehensive data sublanguage rule: The system must support at least one relational language that 1. Has a linear syntax 2. Can be used both interactively and within application programs, 3. Supports data definition operations (including view definitions), data manipulation operations (update as well as retrieval), security and integrity constraints, and transactionmanagement operations (begin, commit, and rollback). Rule 6: The view updating rule: All views that are theoretically updatable must be updatable by the system. Rule 7: High-level insert, update, and delete: The system must support set-at-a-time insert, update, and delete operators. This means that data can be retrieved from a relational database in sets constructed of data from multiple rows and/or multiple tables. This rule states that insert, update, and delete operations should be supported for any retrievable set rather than just for a single row in a single table. Rule 8: Physical data independence:

Computer Science -V
Changes to the physical level (how the data is stored, whether in arrays or linked lists etc.) must not require a change to an application based on the structure. Rule 9: Logical data independence: Changes to the logical level (tables, columns, rows, and so on) must not require a change to an application based on the structure. Logical data independence is more difficult to achieve than physical data independence. Rule 10: Integrity independence: Integrity constraints must be specified separately from application programs and stored in the catalog. It must be possible to change such constraints as and when appropriate without unnecessarily affecting existing applications. Rule 11: Distribution independence: The distribution of portions of the database to various locations should be invisible to users of the database. Existing applications should continue to operate successfully : 1. when a distributed version of the DBMS is first introduced; and 2. when existing distributed data are redistributed around the system. Rule 12: The nonsubversion rule: If the system provides a low-level (record-at-a-time) interface, then that interface cannot be used to subvert the system, for example, bypassing a relational security or integrity constraint.

Q.2. Why do we designate one of the candidate keys of a relation to be the primary key? Q.3. Explain the term: a) Logical schema b) Physical schema.
Logical schema: A logical schema is an alias that allows a unique name to be given to all the physical schemas containing the same datastore structures. The aim of the logical schema is to ensure the portability of the procedures and models on the different physical schemas. In this way, all developments in Designer are carried out exclusively on logical schemas. A logical schema can have one or more physical implementations on separate physical schemas, but they must be based on data servers of the same technology. A logical schema is always directly linked to a technology. To be usable, a logical schema must be declared in a context. Declaring a logical schema in a context consists of indicating which physical schema corresponds to the alias - logical schema - for this context.

Computer Science -V
Physical Schema: Physical schema is a term used in data management to describe how data is to be represented and stored (files, indices, et. al) in secondary storage using a particular database management system.

Q.4. How is the log used in transaction rollback and crash recovery?
The SQL Server transaction log operates logically as if the transaction log is a string of log records. Each log record is identified by a log sequence number(LSN). Log records are stored in a serial sequence as they are created. Each log record contains the ID of the transaction that it belongs to. For each transaction, all log records associated with the transaction are individually linked in a chain using backward pointers that speed the rollback of the transaction. Rollback operations are also logged. Each transaction reserves space on the transaction log to make sure that enough log space exists to support a rollback that is caused by either an explicit rollback statement or if an error is encountered. The amount of space reserved depends on the operations performed in the transaction, but generally is equal to the amount of space used to log each operation. This reserved space is freed when the transaction is completed.

Crash recovery:
A database can be damaged in a number of ways such as by a power failure or an operator error in bringing down the server. When an event like this happens, SQLBase tries to restore the database to a consistent state by performing crash recovery automatically when a user attempts to connect. Crash recovery consists of using the transaction logs to redo any committed transactions which had not yet been written to the database and to undo any uncommitted transactions which were active when the server crashed. There are situations where SQLBase will not be able to return a database to a consistent state, such as when the transaction logs have been damaged during a media failure, or if transaction logging has been disabled by the operator. Use the fail.sql file to review information. This file contains information regarding failure and error situations that occur, generated by SQLBase, and should be reviewed any time an unusual event occurs with the database.

Q.5. Explain packages and its types by taking example. A package is a schema object that groups logically related PL/SQL types, items, and subprograms. Packages usually have two parts, a specification and a body, although sometimes the body is unnecessary. The specification (spec for short) is the interface to your applications; it declares the types, variables, constants, exceptions, cursors, and subprograms available for use. The body fully defines cursors and subprograms, and so implements the spec.

Q.6.Explain the advantages of using a query language instead of custom programs to process data.

Computer Science -V
Query language more-so (SQL) is a way of looking for information on a given criteria whereas custom programs tend to have hard coded search processes. Addition to this, SQL, Oracle etc languages are tailored to the programmer not the user so during the development stages, adaptations can be made for the program and at this point it can be developed to be as efficient as the programmer can make it. A query language can be used by thousands or even millions of people, whereas a custom program can be used by a limited few. Query languages are in fact high-level programming languages, dedicated database languages that considerably simplify writing database application programs. Database languages also simplify the database organization as well as retrieving and presenting information from it. Queries allow the user to describe desired data, leaving the database management system (DBMS) responsible for planning, optimizing, and performing the physical operations necessary to produce that result as it chooses. Custom software may not follow standard protocols and be unable to interact with other programs effectively. The help files may be lacking and support would be more difficult to come by, considering the uniqueness of the program. If the programmer of a custom program leaves the company the software will no longer be update-able. Cost effects on upgrades and maintenance are high.

Q.7. List the various cases where use of null value would be appropriate. Q.8. Discuss the main characteristics of the database approach.
Main Characteristics of the database approach Self-describing nature of a database system:
A fundamental characteristic of the database approach is that the database system contains not only the database structure and constrains. this definition is stored in the system catalog. A DBMS catalog stores the description of a particular database (e.g. data structures, types, and constraints) The description is called meta-data.This allows the DBMS software to work with different database application.

Insulation between programs and data:


In traditional file processing, the structures of data files is embedded in the access programs, so many change to the structure of a file may require changing all programs that access this file. By constraint, DBMS access programs do not require such changes in most cases. the structure of data files is stored in the DBMS catalog separately from the access programs.We call this property programdata independence. Program-data independence allows changing data structures and storage organization without having to change the DBMS access programs.

Data abstraction:
The characteristic that allows program-data independence and program-operation independence is called data abstraction. A data model is a type of data abstraction that is used to hide storage details and present the users with a conceptual view of the database.

Support of multiple views of the data:


Each user may see a different view of the database, which describes only the data of interest to that user. a view may be a subset of the database or it may contain virtual data that is derived from the database files but is not explicitly stored.

10

Computer Science -V
Sharing of data and multi-user transaction processing:
Allowing a set of concurrent users to retrieve from and to update the database. Concurrency control within the DBMS guarantees that each transaction is correctly executed or aborted. Recovery subsystem ensures each completed transaction has its effect permanently recorded in the database. OLTP (online Transaction Processing) is a major part of database applications.This allows hundreds of concurrent transactions to execute per second.

Q.9. Define Boyce-Codd normal form. How is it different from 3NF?


Definition: A relation is in Boyce-Codd Normal Form (BCNF) if every determinant is a candidate key. Boyce-Codd Normal Form (BCNF) When a relation has more than one candidate key, anomalies may result even though the relation is in 3NF. 3NF does not deal satisfactorily with the case of a relation with overlapping candidate keysi.e. composite candidate keys with at least one attribute in common. BCNF is stronger than 3NF, relations that are in 3NF are not necessarily in BCNF BCNF is based on the concept of a determinant. A determinant is any attribute (simple or composite) on which some other attribute is fully functionally dependent. A relation is in BCNF is, and only if, every determinant is a candidate key.

Consider the following relation and determinants. R(a,b,c,d) a,c -> b,d a,d -> b Here, the first determinant suggests that the primary key of R could be changed from a,b to a,c. If this change was done all of the non-key attributes present in R could still be determined, and therefore this change is legal. However, the second determinant indicates that a,d determines b, but a,d could not be the key of R as a,d does not determine all of the non key attributes of R (it does not determine c). We would say that the first determinate is a candidate key, but the second determinant is not a candidate key, rd and thus this relation is not in BCNF (but is in 3 normal form). Example: Conisder a database table that stores employee information and has the attributes employee_id, first_name, last_name, title. In this table, the field employee_id determines first_name and last_name. Similarly, the tuple (first_name, last_name) determines employee_id.

Q.9. What is view? Explain different types of views by taking suitable examples.
A view may be thought of as a virtual table, that is, a table that does not really exist in its own right but is instead derived from one or more underlying base table. In other words, there is no stored file that directly represents the view instead a definition of view is stored in data dictionary. Growth and restructuring of base tables is not reflected in views. Thus the view can insulate users from the effects of restructuring and growth in the database. Hence accounts for logical data independence.

11

Computer Science -V
A database view displays one or more database records on the same page. A view can display some or all of the database fields. Views have filters to determine which records they show. Views can be sorted to control the record order and grouped to display records in related sets. Views have other options such as totals and subtotals. Most users interact with the database using the database views. A key to creating a useful database is a well-chosen set of views. Luckily, while views are powerful, they are also easy to create. There are two types of views: 1. simple view 2. complex view

Q . 1 0 . W RI TE E R DI AG R AM FO R HO S P I T AL M AN AG E ME NT S YS TE M.

E-R Diagram for Hospital Management System

12

Computer Science -V

Q.11. Write an ER diagram for library automation.

13

Computer Science -V

Q.12. How are the Outer Join Operations different than the Inner Join operations? How is the Outer Join operation different from Union?

You might also like