Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
13Activity
0 of .
Results for:
No results containing your search query
P. 1
MC0067 SMU MCA SEM2 2011

MC0067 SMU MCA SEM2 2011

Ratings: (0)|Views: 2,474|Likes:
Published by Nitin Sivach
MC0067 SMU MCA SEM2 2011
MC0067 SMU MCA SEM2 2011

More info:

Published by: Nitin Sivach on May 30, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

01/25/2013

pdf

text

original

 
MC0067 ± Database Management System(DBMS and Oracle 9i)-
Book ID: B0716 & B0717
Set-1
1. What are the advantages of Indexes in a Database? Explain with the example.
A
ns:1Indexes in a Database:
A
database index
is a data structure that improves the speed of dataretrieval operations on a database table at the cost of slower writes and increased storagespace. Indexes can be created using one or more columns of a database table, providing thebasis for both rapid random lookups and efficient access of ordered records. Advantages of Indexes:The classical example for the need of an index is if there is a table similar to this:CREATE TABLE test1 (id integer,content varchar );and the application requires a lot of queries of the formSELECT content FROM test1 WHERE id =
constant 
;Ordinarily, the system would have to scan the entire test1 table row by row to find all matchingentries. If there are a lot of rows in test1 and only a few rows (possibly zero or one) returned bythe query, then this is clearly an inefficient method. If the system were instructed to maintain anindex on the id column, then it could use a more efficient method for locating matching rows. For instance, it might only have to walk a few levels deep into a search tree. A similar approach is used in most books of non-fiction: Terms and concepts that are frequentlylooked up by readers are collected in an alphabetic index at the end of the book. The interestedreader can scan the index relatively quickly and flip to the appropriate page, and would not haveto read the entire book to find the interesting location. As it is the task of the author to anticipatethe items that the readers are most likely to look up, it is the task of the database programmer toforesee which indexes would be of advantage.The following command would be used to create the index on the id column, as discussed:CREATE INDEX test1_id_index ON test1 (id);The name test1_id_index can be chosen freely, but you should pick something that enables youto remember later what the index was for.To remove an index, use the DROP INDEX command. Indexes can be added to and removedfrom tables at any time.
 
MC0067 ± Database Management System(DBMS and Oracle 9i)-
Book ID: B0716 & B0717
2
.
Write about:
y
 
In
tegrity Rules
y
 
Relatio
n
al Operators with examples for each
y
 
L
i
n
ear Search
y
 
C
ollisio
n
 
C
hai
n
 
A
ns:
2
 
2
.1 Integrity Rules:
These are the rules which a relational database follows in order to stay accurate and accessible.These rules govern which operations can be performed on the data and on the structure of thedatabase. There are three integrity rules defined for a relational databse,which are:-
y
 
Distinct Rows in a Table
- this rule says that all the rows of a table should be distinct toavoid in ambiguity while accessing the rows of that table. Most of the modern databasemanagement systems can be configured to avoid duplicate rows.
y
 
Entity Integrity (
A
Primary Key or part of it cannot be null)
- this rule says that 'null'is special value in a relational database and it doesn't mean blank or zero. It means theunavailability of data and hence a 'null' primary key would not be a complete identifier.This integrity rule is also termed as entity integirty.
y
 
Referential Integrity
- this rule says that if a foreign key is defined on a table then avalue matching that foreign key value must exist as th e primary key of a row in someother table.
y
 
The following are the integrity rules to be satisfied by any relation.
y
 
‡
No Component of the Primary Key can be null.
y
 
‡
The Database must not contain any unmatched Foreign Key values. This is called thereferential integrity rule.
y
 
U
nlike the case of Primary Keys, there is no integrity rule saying that no component of the foreign key can be null. This can be logically explained with the help of the followingexample:
y
 
Consider the relations Employee and Account as given below.
y
 
E
mployee
 
E
mp#
 
E
mpName
 
E
mp
C
ity
 
E
mpAcc#
 X101 Shekhar Bombay 120001X102 Raj Pune 120002X103 Sharma Nagpur NullX104 Vani Bhopal 120003
 
MC0067 ± Database Management System(DBMS and Oracle 9i)-
Book ID: B0716 & B0717
y
 
Accou
n
t
 
A
CC
#
 
Ope
nD
ate
 
BalAmt
 120001 30-Aug-1998 5000120002 29-Oct-1998 1200120003 01-Jan-1999 3000120004 04-Mar-1999 500
y
 
EmpAcc# in Employee relation is a foreign key creating reference from Employee toAccount. Here, a Null value in EmpAcc# attribute is logically possible if an Employeedoes not have a bank account. If the business rules allow an employee to exist in thesystem without opening an account, a Null value can be allowed for EmpAcc# inEmployee relation.
y
 
In the case example given, Cust# in Ord_Aug cannot accept Null if the business ruleinsists that the Customer No. needs to be stored for every order placed.
2
.
2
Relational Operators:
In the relational model, the database objects seen so far have specific names:Name MeaningRelation TableTuple Record(Row) Attribute Field(Column)Cardinality Number of Records(Rows)Degree(or Arity) Number of Fields(Columns)View Query/Answer tableOn these objects, a set of operators (relational operators) is provided to manipulatethem:1. Restrict2. Project3. Union4. Difference5. Product

Activity (13)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
pawanmdp liked this
Jeevan Bora added this note
what is the procedure to download this file.........
Mukesh Saini liked this
Nikunj Gupta liked this
sunny0003129i liked this
Tarun Sahu liked this
manunera1986 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->