Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
10Activity
0 of .
Results for:
No results containing your search query
P. 1
bt0060

bt0060

Ratings: (0)|Views: 528 |Likes:
Published by Aditya Anand

More info:

Published by: Aditya Anand on Mar 23, 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

10/12/2011

pdf

text

original

 
1. Compare SQL and PL/SQL.Ans:
SQL that is abbreviated from Structured Query Languages is a data oriented languagefor selecting and operating sets of data. SQL is commonly used by relational databasetechnologies such as Oracle, Microsoft Access, and Sybase etc. The term, PL/SQL is a proceduralextension of SQL. It is the Oracle native programming language that provides an edge to designdatabase-centric application. Both SQL and PL/SQL languages are designed with a commonpurpose, to access data within Oracle databases, but PL/SQL is designed to address thelimitation of SQL because it cannot be used to manipulate procedural programming withconditional, iterative and sequential statements. To work with PL/SQL, the users normallyinteract with an application that uses SQL to access a relational database on the back-end.SQL is widely popular as data oriented language for selecting and executing the sets of data. Itis differentiated from the PL/SQL in relation to its capability to create applications that may bethe source of data for your screens, web pages and reports while PL/SQL, known as aprocedural language, might be used to create format and display those screens, web page andreports that are designed with the help of SQL. It also acts as an application language like Javaor PHP can.The commands and instructions used in SQL arent actually a part of the SQL standard but aresupported by the tools of SQL and are usually executed to assist format output like BREAK,BTITLE, COLUMN, PRINT or they are meant to create or store data/scripts. It also supports thecommands that directly interact with the database to perform the SHUTDOWN, CONNECT orCOPY actions. PL/SQL is also known as fourth-generation programming language because of itsability to support the data encapsulation, overloading, collection types, exceptions, andinformation hiding functions. PL/SQL also offers rapid prototyping and use variables and theirdeclarations, conditional controls like IF and CASE used in other programming languages like C,C++, Java, etc. It also uses looping structure such as LOOP, FOR LOOP and WHILE LOOP.Another advantage of using PL/SQL is its fast execution speed because it passes a block of statements to be executed to the server, whereas in SQL, only one statement is transferred tothe server at a time which is a time consuming process.Summary:SQL is a structured query language used for data manipulation, whereas PL/SQL is a procedurallanguage to design applications.PL/SQL is an application language usually used to build, format and display the user screens,web pages and reports, while SQL provides data for these applications.The user can embed SQL in a PL/SQL program or statement. But the vice versa is not possible.SQL is slower because it executes one statement at a time, while PL/SQL executes as a block of code.The core use of SQL is to code queries, data manipulation and development statements, butPL/SQL is broadly used to code program blocks, triggers, functions, etc.
 
2
. Write a database trigger to implement the following check condition:
j
 
G
iven the following table:Empno Empname JoiningDateEvery time the user enters the employee number in the above table, it should checkthat it is always >1 and <
200
.Ans:
CREATE TABLE employee( empno numeric(4),Empname varchar2(20),Joining_date date,CONSTRAINT check_empnoCHECK (empno BETWEEN 1 and 200));
3
. Discuss the following types of Data Fragmentation Mechanisms:
y
 
H
orizontal Data Fragmentation
y
 
Derived
H
orizontal Fragmentation
y
 
V
ertical Fragmentation
y
 
Mixed FragmentationAns
: The types of following Data Fragmentation Mechanisms are as follows:
y
 
H
orizontal Fragmentation
 Horizontal Fragmentation consists of partitioning the tuples of a global relation into subsets;this is clearly useful in distributed databases, where each subset can contain data that havecommon geographical properties. It can be defined by expressing each fragment as a selectionoperation on the global relation.
Example:
let a global relation be
SUPPLIER (SNUM, NAME, CITY)
 Then the horizontal fragmentation can be defined in the following way:
SUPPLIER
1
=
SL
CITY =Manipal 
SUPPLIER
 
SUPPLIER
2
 
=
SL
CITY =Udupi 
SUPPLIER
 
 
Now let us verify whether this fragmentation fulfills the conditions stated earlier.
T
he completeness condition:
If Manipal and Udupi are the only possible values of the
CITY 
attribute, then it satisfies this condition.
T
he reconstruction condition:
can be verified easily, because it is always possible to reconstructthe
SUPPLIER
global relation through the following operation.
SUPPLIER =
SUPPLIER
1
UN
SUPPLIER
2
 The
disjoint ness condition
is clearly verified.
Qualification
: The predicate, which is used in the selection operation and defines a fragment, iscalled as
 
Qualification. For instance, in the above example the qualificationsq
1
:
CITY 
= Manipalq
2
 
:
CITY 
= UdupiWe can generalize from the above example that in order to satisfy the completeness condition,the set of qualifications of all fragments must be complete, at least with respect to the set oallowed values. The reconstruction condition is always satisfied through the union operation,and the disjoint ness condition requires that qualifications be mutually exclusive.
y
 
Derived
H
orizontal Fragmentation
 This is a type of fragmentation, which is derived from the horizontal fragmentation of anotherrelation.
Example
: Consider a global relation
SUPPLY (SNUM, PNUM, DEPTNUM, QUAN)
 where
SNUM
is a supplier number. If it is required that a fragment has to contain the tuples forsuppliers, which are in a given city, and then we have to go for derived fragmentation. A semi- join operation with the fragments SUPLIER1 and SUPLIER
2
is needed in order to determine thetuples of 
SUPPLY,
which correspond to the suppliers in a given city. The derived fragmentationof 
SUPPLY 
can be therefore defined as follows:
SUPPLY 
1
=
SUPPLY 
SJ
SNUM=SNUM
SUPPLIER
1
 
SUPPLY 
2
 
=
SUPPLY 
SJ
SNUM=SNUM
SUPPLIER
2
 

Activity (10)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Sakhanii Khonah added this note
Thnk u so much......
Mithilesh Kumar liked this
Mithilesh Kumar liked this
vk5208 liked this
Kanika Kohli liked this
Mithilesh Kumar liked this
Mithilesh Kumar liked this

You're Reading a Free Preview

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