GOOGLE Search

Sunday, July 19, 2009

DATA BASE

Q. Define relational database schema, domain, relation, tuple, Cartesian product, query language, procedural language, and non – procedural language.
Ans: Relational database schema: A relational database schema is a listing showing relation names, attribute names, key attributes and foreign keys.
Attribute: The column header of the table is known as attribute.
Domain: For each attribute, there is a set of permitted values called the domain of that attribute.
Relation: A relation is a two dimensional table containing rows and columns of data.
Tuple: The row of a table is known as tuple of that table.
Query language: A query language is a language in which a user requests information from the database. These languages are usually on a level higher than that of a standard programming language. Query languages can be categorized as either procedural or nonprocedural.
Procedural language: In a procedural language, the user instructs the system, to perform a sequence of operations on the database to compute the desired result.
Non – procedural language: In a nonprocedural language, the user describes the desired information without giving a specific procedure for obtaining that procedure.
Q. What are the fundamental in the relational algebra?
Ans: The fundamental of relational algebra operations are –
The Select operation: The select operation selects tuples that satisfy a given predicate. The lower case Greek letter sigma (σ) to denote selection. The predicate appears as a subscript to σ. The argument relation is in parentheses after the σ. To select tuples of the loan relation where the branch is “Perryridge” we write,
σ_(branch_name=""Perryridge\"" ) (loan)
For comparisons, =, ≠, <, ≤, >, ≥ operators are used in the selection predicate. Furthermore, and (Λ), or (V), and not (¬) operators are used to combine several predicates into a larger predicate. Thus, to find those tuples pertaining to loans or more than $1200 made by the Perryridge branch, we write –
σ_(branch_name =""Perryridge\" " ∧ amount >1200) (loan)
The Project operation: The project operation is a unary operation that returns its argument relation, with certain attributes left out. Projection is denoted by uppercase Greek letter pi (Π). Those attribute that are appear in the result as a subscript to Π. The argument relation follows in parentheses. The query to list all loan numbers and the amount of the loan as –
Π_(loan_number ,amount ) (loan)
The Union operation: The union operation is used to combine two queries from where same type of output will come out. Union is denoted by ∪. As for example, the query will be for the statement all customer_name who have an account and loan in the bank –
Π_(customer_name) (borrower)∪Π_(customer_name) (depositor)
The Set – Difference operation: The set difference operation, denoted by –, allows to find tuples that are in one relation but are not in another. The expression r – s produces a relation containing those tuples in r but not in s. for example, all customers of the bank who have an account but not a loan by writing –
Π_(customer_name) (depositor)-Π_(customer_name) (borrower)
The Cartesian – Product operation: The Cartesian – product operation, denoted by a cross (×), allows to combine information from any two relations. The Cartesian product of relations r_1 and r_2 as r_1 ×〖 r〗_2. For example, the relation schema for r=borrower×loan is
(█(borrower.customer_name,borrower.loan_number,loan.loan_number,loan.branch_name,@ loan.amount))
The Rename operation: The rename operator, denoted by the lowercase Greek letter rho (ρ). Given a relation algebra expression E, the expression –
ρ_x (E)
returns the result of expression E under the name x.
A second form of the rename operation is as follows. Assume that a relational algebra expression E has arity n. Then, the expression –
ρ_x(A_1,A_2,……,A_n ) (E)
For the example, the query to find the largest account balance in the bank can be written as:
Π_balance (account)-Π_(account.balance(σ_(account.balance < d.balance) (account×ρ_d (account) ) ) )

Tuesday, July 14, 2009

Q. What do you mean by data model? Give the classification of data model with short explanation.


Ans: Data model: A data model is the collection of conceptual tools for describing data, data relationships, data semantics and consistency constrains. A data model provides a way to describe the design of a database at the physical, logical and view level.

There are a number of different data models. The data models can be classified in four different categories:

  • Relational model: The relational model uses a collection of tables to represent both data and the relationships among those data. Each table has multiple columns and each column has a unique name. The relational model is an example of a record based model and so named because the database is structured in fixed format records of several types. Each table contains records of a particular type and defines a fixed number of fields or attributes. The columns of the table correspond to the attributes of the record type.

  • The entity relationship model: The entity relationship data model is based on a perception of a real world that consists of a collection of basic objects, called entities and of relationships among these objects. An entity is a “thing” or “object” in the real world that is distinguishable from other objects.
  • Object base data model: The object oriented data model is another data model that has seen increasing attention. The object oriented model can be seen as extending to E-R model with notations of encapsulation, methods and object identity. The object relational data model combines features of the object oriented data model and relational data model.

  • Semi structured data model: The semi structured data model permits the specification of data where individual data items of the same type may have different sets of attributes. This is in contrast to the data models mentioned earlier where every data item of a particular type must have the same set of attributes. The extensible markup language is widely used to represent semi structured data.

Q. What do you mean by database language? Give the classification of database language with explanation.

Ans: Database language: A database system provides a data definition language to specify the database schema and a data manipulation language to express database queries and updates. In practice data definition and the data manipulation language are not two separate languages, instead they simply form parts of a single database language, such as the widely used SQL language.

Data – Manipulation Language (DML): A data – manipulation language is a language that enables users to access or manipulate data as organized by the appropriate data model. The types of access are:

  • Retrieval of information stored in the database.

  • Insertion of new information into the database.

  • Deletion of information from the database.

  • Modification of information stored in the database.

There are basically two types ---

  • Procedural DMLs require a ser to specify what data are needed and how to get those data.

  • Declarative DMLs require a user to specify what data are needed without specifying how to get those data.

Data – Definition Language (DDL): A data definition language is a language for specifying the database schema and as well as other properties of the data.

The storage structure and access methods used by the database system by a set of statements in a special type of DDL called a data storage and definition language. The data values stored in the database must satisfy certain consistency constraints. Database systems concentrate on integrity constraints that can be tested with minimal overhead:

  • Domain constraints: A domain of possible values must be associated with every attribute. Domain constrains are the most elementary form of integrity constraint. They are tested easily by the system whenever a new data item is entered into the database.

  • Referential integrity: Database modifications can cause violations of referential integrity. When a referential integrity constraint is violated, the normal procedure is to reject the action that caused the violation.

  • Assertions: An assertion is any condition that the database must always satisfy. Domain constraints and referential integrity constraints are special forms of assertions. When an assertion is created, the system tests it for validity. If the assertion is valid then the future modification to the database is allowed only if it does not cause that assertion to be violated.

  • Authorizations: We may want to differentiate among the users as far as the type of access they are permitted on various data values in the database. These differentiations are expressed in terms of authorization, the most common being:


    • Read authorization, which allows reading, but not modification of data.

    • Insert authorization, which allows insertion of new data, but not modification of existing data.

    • Update authorization, which allows modification, but not deletion of data.

    • Delete authorization, which allows deletion of data.

Q. Define Query.

Ans: Query: A query is a statement requesting the retrieval of information. The portion of a DML that involves information retrieval is called a query language. Although technically incorrect, it is common practice to use the terms query language and data manipulation language synonymously.

There are a number of database query languages in use, either commercially or experimentally. SQL is the example query language.

Monday, July 13, 2009

levles

Q. Describe file system versus database management system / disadvantage of file system / purpose of data base management system.

Ans: Keeping organizational information in a file processing system has a number of major disadvantages:


  • Data redundancy and inconsistency: Different programmers create the files and application programs over a long period, the various files are likely to have different structures and the programs may be written in several programming languages. The same information may be duplicated in several files. This redundancy leads to higher storage and access cost. It leads to data inconsistency.

  • Difficulty of accessing data: Conventional file –processing environment do not allow needed data to be retrieved in a convenient and efficient way. More responsive data – retrieval systems are required for general use.

  • Data isolation: Data are scattered in various files and files may be in different formats, writing new application programs to retrieve the appropriate data is difficult.
  • Integrity problems: The data values stored in the database must satisfy certain types of consistency constrains. When new constrains are added, it is difficult to change the programs to enforce them. The problem is compounded when constraints involve several data items from different files.

  • Atomicity problems: A computer system, like any other mechanical or electrical device, is subject to failure. In many applications, it is crucial that, if a failure occurs, the data be restores to the consistent state that existed prior to failure. Consider a program of fund transfer, it is essential to database consistency that either both the credit and debit occur or that neither occur. The fund transfer must be atomic – it must happen in its entirety or not at all. It is difficult to ensure atomicity in a conventional file – processing system.

  • Concurrent access anomalies: The overall performance of the system and faster response many system allow multiple users to update the data simultaneously. In such an environment, interaction of concurrent updates is possible and may result in inconsistent data.

  • Security problems: Not every user of the database system should be able to access all the data. As a result the data are secured in this system. But in the file – processing system security constraints is difficult.


Q. What do you mean by data abstraction? Describe the different levels of data abstraction.

Ans: Data abstraction: A major purpose of a database system is to provide users with an abstract view of the data. That is, the system hides certain details of how the data stored and maintained. There are three levels in data abstraction.


  • Physical level: The lowest level of abstraction describes how the data are actually stored. The physical level describes complex low-level data structures in detail.


    • Logical level: The next higher level of abstraction describes what data are stored in the database and what relationships exist among those data. The logical level thus describes the entire database in terms of a small number of relatively simple structures. The logical level of abstraction is used by database administrators, who must decide what information is to be kept in the database.

    • View level: The highest level of abstraction describes only part of the entire database. Despite the use of simpler structures at the logical level, some complexity remains, because of the large size of the database. All users of the database system do not need all this information. They need to access only a part of the database. The view level of abstraction exists to simplify their interaction with the system. The system may provide many views for the same database.

Saturday, July 11, 2009

TEH 2ND POST

Q. Describe file system versus database management system / disadvantage of file system / purpose of data base management system.
Ans: Keeping organizational information in a file processing system has a number of major disadvantages:

Data redundancy and inconsistency: Different programmers create the files and application programs over a long period, the various files are likely to have different structures and the programs may be written in several programming languages. The same information may be duplicated in several files. This redundancy leads to higher storage and access cost. It leads to data inconsistency.

Difficulty of accessing data: Conventional file –processing environment do not allow needed data to be retrieved in a convenient and efficient way. More responsive data – retrieval systems are required for general use.

Data isolation: Data are scattered in various files and files may be in different formats, writing new application programs to retrieve the appropriate data is difficult.

Integrity problems: The data values stored in the database must satisfy certain types of consistency constrains. When new constrains are added, it is difficult to change the programs to enforce them. The problem is compounded when constraints involve several data items from different files.

Atomicity problems: A computer system, like any other mechanical or electrical device, is subject to failure. In many applications, it is crucial that, if a failure occurs, the data be restores to the consistent state that existed prior to failure. Consider a program of fund transfer, it is essential to database consistency that either both the credit and debit occur or that neither occur. The fund transfer must be atomic – it must happen in its entirety or not at all. It is difficult to ensure atomicity in a conventional file – processing system.

Concurrent access anomalies: The overall performance of the system and faster response many system allow multiple users to update the data simultaneously. In such an environment, interaction of concurrent updates is possible and may result in inconsistent data.

Security problems: Not every user of the database system should be able to access all the data. As a result the data are secured in this system. But in the file – processing system security constraints is difficult.


Q. What do you mean by data abstraction? Describe the different levels of data abstraction.
Ans: Data abstraction: A major purpose of a database system is to provide users with an abstract view of the data. That is, the system hides certain details of how the data stored and maintained. There are three levels in data abstraction.

Physical level: The lowest level of abstraction describes how the data are actually stored. The physical level describes complex low-level data structures in detail.

Logical level: The next higher level of abstraction describes what data are stored in the database and what relationships exist among those data. The logical level thus describes the entire database in terms of a small number of relatively simple structures. The logical level of abstraction is used by database administrators, who must decide what information is to be kept in the database.

View level: The highest level of abstraction describes only part of the entire database. Despite the use of simpler structures at the logical level, some complexity remains, because of the large size of the database. All users of the database system do not need all this information. They need to access only a part of the database. The view level of abstraction exists to simplify their interaction with the system. The system may provide many views for the same database.



Q. Define instances and schema. Write the difference between instances and schema.
Ans: Instances: Databases change overtime as information is inserted and deleted. The collection of information stored in the database at a particular moment is called the instance of the database. The values of the variables in a program at a point in time correspond to an instance of a database schema.
Schema: The overall design of the database is called the database schema. Schema are changed infrequently, if at all. A database schema corresponds to the variable declarations in a program. Each variable has a particular value at a given instant. Database systems have several schema, partitioned according to the level of abstraction.

The physical schema describes the database design at the physical level.

The logical schema describes the database design at the logical level.

A database has several schema at the view level, called sub schema that describe the different views of the database.



The differences between instances and schema are given below:


Instance

Schema



1. The collection of information stored in the database at a particular moment is called an instance of the database.



1. The overall design of the database is called the database schema.



2. An instance of a database schema corresponds to the value of a variable in the programming languages.



2. A database schema corresponds to the programming language type definition.



3. Instances are not partitioned according to the levels of abstraction.



3. Schema is partitioned according to levels of abstraction, such as: lowest level is the physical schema, intermediate level is the logical schema and highest level is a subschema.

Friday, July 10, 2009

DEFINATION AND APPLICATIONS OF DATABASE MANAGEMENT SYSTEM

Q. What do you mean by database management system? What is the primary goal of database management system?

Ans: Database management system: A database management system (DBMS) consists of a collection of interrelated data and a set of programs to access that data. The collection of data referred database and the data describe one particular enterprise.

Primary goal: The primary goal of a DBMS is to provide an environment that is both convenient and efficient for people to use in retrieving and storing information.

Database systems are designed to manage large bodies of information. The management of data involves both the definition of structures for the storage of information and the provision of mechanisms for the manipulation of information. The database system must provide for the safety of the information stored, despite system crashes or attempts at unauthorized access.

Q. Describe the application area of database management system.

Ans: Databases are widely used. Here are some representative applications:

  • Banking: For customer information, accounts, loans and banking transaction.

  • Airlines: For reservation and schedule information.

  • Universities: For student information, course registrations and grades.

  • Credit card transaction: For purchases on credit cards and generation of monthly statement.

  • Telecommunication: For keeping records of calls made, generating monthly bills, maintaining balances on prepaid calling cards and storing information about the communication network.

  • Finance: For storing information about holdings, sales and purchases of financial instruments such as stocks and bonds.

  • Sales: For customer, products and purchase information.

  • On-line retailers: For sales data noted above plus on-line order tracking, generation of recommendation lists and maintenance of on-line product evaluations.

  • Manufacturing: For management of the supply chain and for tracking production of items in factories, inventories of items in warehouses and stores and orders for items.

  • Human resources: For information about employees, salaries, payroll taxes, benefits and for generation of paychecks.

As the list illustrates, databases form an essential part of almost all enterprises today.

DATA BASE BLOG FOR STUDENTS

wait for a while