0% found this document useful (0 votes)
12 views10 pages

DBMS 2 Re

Uploaded by

sarvajeetpatil09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views10 pages

DBMS 2 Re

Uploaded by

sarvajeetpatil09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Q.Unique Key: - In case of unique constraint, no Q.

PL/SQL Block Structure: - PL/SQL is a block-


two tuples can have equal value for same attributes. structured language. A PL/SQL block is defined by
This constraint says that attributes form candidates the keywords DECLARE, BEGIN, EXCEPTION,
key, which allows one Null value which is unique by and END, which break up the block into three
itself. This UNIQUE constraint can be applicable to sections: Declarative: Statements that declare
user defined domain declaration also. variables, constants, and other code elements, which
Q.Primary Key: - A table in a relational database can then be used within that block.
has one column or combination of some columns
whose values uniquely identifies a single row in the
table. This column or combination of columns is
called the primary key of the table.
Q.Foreign key: - A value appearing in one relation
(table) for a given set of attributes also appears for
another set of attributes in another relation (table).
This is called referential integrity. The referential
integrity constraint is specified between two tables
to maintain the consistency among tuples in the two
tables. The tuple in one relation refers only to an
existing tuple in another relation.
Unit 4 Q. Recoverable and Non-Recoverable Schedules
Q. Transection Management: 1. Active: According to ACID properties the schedule which
This is the first state of transection, For Ex: keeps database in consistent state after execution of
whole schedule is acceptable. If transaction T_{1}
Insertion, Deletion or Updation of record is fails, then to maintain atomicity of T_{1} , the
done here. But data is not saved to database. system has to undo all the effects made by transaction
2. Partially Committed: when a transaction T_{1} are well as other transaction referencing
executes its final operation, it is said to be in values updated by T_{1} For this reason T_{1} and
a partially committed state. other transactions depend on T_{1} should be
3) Failed: A transaction is said to be in a aborted. Following types of schedules are acceptable
from viewpoint of recovery from transaction failure.
failed state if any of the checks made by the Recoverable Schedules:- If a transaction T_{2}
database recovery system fails. A failed reads a data items previously written by a transaction
transaction can no longer proceed further. T_{L} the commit operation of T_{1} appears before
4) Aborted: If a transaction is failed to the commit operation of T_{2} then the schedule of
execute, then the database recovery system this type is Recoverable schedule.
will make sure that the database is in its Non recoverable:-
T1 T2
previous consistent state. If not, it brings the
Read (p)
database to consistent state by aborting or Write (p)
rolling back the transaction. Read (p)
5) Committed: If a transaction executes all Read (p)
its operations successfully, it is said to be In the above schedule be committed before T_{1} as
committed. This is the last step of a it finishes execution before T_{1} In this case if
transaction, if it executes without fail. T_{1} fails because of certain reason then it needs to
be roll back and even T_{2} But T_{2} is already
committed so cannot be rolled back and hence
database will be in inconsistent state. To make it
recoverable it is necessary to commit Tzafter T_{1}
is committed.
Q. Ex Transaction States :- A transaction must Q.ACID Properties: - To understand transaction
be in one of the following status (a) Active:- properties we consider a transaction of transferring
This is initial state of transaction execution. As 100 rupees from account A to account B as Follows.
soon as transaction execution starts it is in active Let T, be a transaction that transfers 100 rupees from
state. Transaction remains in this state till account A to account B. This transaction can be
defined as, 1. Atomicity: - Transaction must be
transaction finishes. (b) Partially committed:-
treated as a single unit of operation. That means when
As soon as last operation in transaction is a sequence of operations is performed in a single
executed transaction goes to partially committed transaction, they are treated as a single large
state. At this condition the transaction has operation. 2. Consistency: - Consistent state is a
completed its execution and ready to commit on database state in which all valid data will be written
database server. (c) Falled:- A transaction enters to the database. If a transaction violates some
the failed state after the system determines that consistency rules, the whole transaction will be
the transaction can no longer proceed with its rolled back state with those rules. DBMS should
normal execution. Example: In case of handle an inconsistency and also ensure that the
Hardware or logical errors occurs while database is clean at the end of each transaction.
execution. (d) Aborted:- Failed transaction 3. Isolation: - Isolation property ensures that each
must be rolled back. Then it enters the aborted transaction must remain unaware of other
concurrently executing transactions. from each other
state. Transaction has been roiled back restoring
until they are completed. Operations occurring in a
into prior state. (e) Committed:- When last data transaction (example, insert or update statements) are
item is written out, the transaction enters into the invisible to other transactions until the transaction
committed state. This state occurs after commits (on transaction success) or rolls back (on
successful completion of transaction. A transaction fails). 4. Durability: - The results of a
transaction is said to have terminated if has transaction that has been successfully committed to
either committed or aborted the database will remain unchanged even after
Q. Define of Transaction:- A transaction can be database fails. Changes made during a transaction are
defined as a group of tasks. A single task is the permanent once the transaction commits. Even if the
minimum processing unit which cannot be database server is fails in between transaction, it will
divided further. return to a consistent state when It is restarted.
Q. Define of 1. Concurrency:- Database Q. Transaction management architecture
concurrency is a unique characteristic enabling two Transactions management: The transaction
or more users to retrieve information from the manager is responsible for co-ordinating the
database at the same time without affecting data execution of all the transactions being executed by
integrity 2. Timestamp:- is a unique identifier the DBMS. Scheduler: The scheduler is responsible
created by the DBMS to identify the relative starting for selecting the best method of executing each
time of a transaction. Typically, timestamp values transaction and ensuring that a transaction does not
are assigned in the order in which the transactions interfere with the execution of other transactions.
are submitted to the system. So, a timestamp can be Recovery manager: When a transaction fails and is
thought of as the transaction start time. rolled back, it is the recovery manager's
3. Timestamp Ordering:- Timestamp ordering responsibility to return the database to the state it was
protocols prevent deadlock by aborting any in before the transaction was executed.
transaction that tries to access a data item that has Buffer manager: The buffer manager manages the
been modified by a later transaction. 4. Schedule:- disc space and main memory that is required to
A schedule is defined as an execution sequence of process the transactions.A transaction is started by
transactions. A schedule maintains the order of the issuing a BEGIN TRANSACTION command. Once
operation in each individual transaction. A schedule this command is executed the DBMS starts
is the arrangement of transaction operations. A monitoring the transaction.
schedule may contain a set of transactions. We
already know that a transaction is a set of operations.
Unit 5 Q. Two tier architecture: - The two tier architecture
Q. Client server architecture:- Client-server separates data and business logic. The two tier
architecture is a computing model in which the architecture is generally data driven; with the
server hosts, delivers, and manages most of the application existing entirely on local machine and
resources and services requested by the client. It is database is deployed at a specific and secure location
also known as the networking computing model or in the organization. The basic web architecture is two
client-server network as all requests and services are tiered and characterized by a web client that displays
delivered over a network. Before we explain client information content and web server that transfer
server architecture and you start reading words such information to client. i.e. two tier architecture is
as servers, service, network, data, and files, and start client-server architecture. In this architecture the
feeling overwhelmed with jargon, let us first terminal being the client (where user interfaces is
understand about this architecture in layperson’s located) and powerful computer. hosting application
terms. The notion of client-server architecture can be files, database, transaction management feature and
understood by the analogy of ordering a pizza for overall logic is server.
delivery. 1.Mail servers: Email servers are used for This two tier architecture has certain limitation:
sending and receiving emails. There are different (i) When number of user increases, performance
software that allows email handling. begins to deteriorate. (ii) Implementation of two tier
2. File servers: act as a centralized location for architecture provides limited flexibility in moving
files. One of the daily life examples to understand program functionality from one server to another
this is the files that we store in Google Docs. without manually regenerating procedural code.
3. Web servers: Web servers are high-performance Request
computers that host different websites. The server Client Response HTTP Server
site data is requested by the client through high- 1st Tier 2nd Tier
speed internet.
Q. Single Tier Architecture: - An application Q. Three Tier Architecture: - (a) Three-tier
running on single computer and perform all the architecture is any system which enforces a general
required tasks. The application running on such a separation between the following three parts:
desktop computer is known as single tier application. (1) Client tier or user interface or Presentation tier.
Single tier architecture consists of the presentation (ii) Middle tier or business logic or Business tier.
business rules and the data access layers in a single (b) Applied to web applications, the three logical tiers
computing layer. Data is stored at single location and usually correspond to the physical separation
hence applications created on single tier architecture between three types of devices or host (1) Browser
are relatively easy to manage and implement data or GUI Application (ii) Web server or Application
consistency. Single tier applications cannot be scaled Server (iii) Database server (RDBMS)
up to handle multiple user and they do not provide -The client tier/ user: interface Contains all things
an easy means of sharing data across an enterprise. that are visible to the user, such as screen layout and
User interface logic, Business rules, File/database access
navigation.
-The middle tier/business tier: Consists of the
application logic. The middle tier is also called the
application server.
-Data storage tier: This layer in made up of DBMS
and data storage. This database layer manages the
storage and retrieval of data as well as security, data
Three tier Advantage integrity of application.
Java programmer for the business logic and a - Advantages of three-tier architecture: The three-
Database Designer for Database tier. It offers tier architecture allows any of the tiers to be upgraded
high degree of flexibility in deployment of as requirements or technology change without
systems. Low cost deployment and affecting other layer.
For each layer a specialist can contribute some
maintenance.
expertise, a GUI designer for the user interface, a
Q. Types of Parallel database (Architecture): - Q. Inter Query Parallelism: - In this case multiple
Parallelism in databases represents one of the most queries are running simultaneously on multiple
successful instances of parallel computing system. processors to reduce the time taken for total query
Types of Parallel Databases 1. Shared Memory evaluation. If there are 10 queries in which each
System 2. Shared Disk System 3. Shared Nothing query takes 2 seconds, then it would require 20
System seconds to execute all queries. But if we use Inter
1. Shared Memory System :- (a)Architecture query parallelism these queries will take only 2
details:- Multiple CPUs attached to a common seconds to execute, thereby saving time. We can
global shared memory via interconnection network improve throughput for large Number of transactions
or communication bus. Shared memory architectures by inter query parallelism. It is difficult to achieve
so that referencing of the shared memory is avoided Inter query parallelism because it is difficult to
whenever possible. (b)Advantages:- Efficient identify in advance which query should run
communication between processors. Data can be concurrently.
accessed by any processor without being moved Q. Intra Query Parallelism
from one place to other. (c) Disadvantages:- In this case a query is divided in sub queries which
Bandwidth problem. Not scalable beyond 32 or 64 will run simultaneously on multiple processors. So as
processors, since the bus or interconnection network to reduce the time taken for query execution.
will get into a bottleneck. 2.Shared Disk System (a)
Architecture details:- Multiple processors can access Q. Virtualization in Multicore Processors
all disk directly via inter communication network. 1. Introduction:- The processing power of a
But, every processor has local memory. (b) computing can be improved by adding more CPUs.
Advantages:- Each CPU or processor has its own Such method can be called as virtualization.
local memory, so the memory bus will not face 2. Working:- Today, multi-core processor or hyper-
bottleneck. (c) Disadvantages:- Some memory load threaded architecture is a part of almost every
is added to each processor. Limited scalability: Not computer system that is being manufactured. Thus,
scalable beyond certain point. The shared-disk multiple virtual processors are presented with the
architecture faces this problem because large systems. Processing power with more number of
amounts of data are shipped through the processors is better almost every time, but the way
interconnection network So now 3. Shared Nothing multi-core processors are used is as important in
Disk System:- (a) Architecture details:- Each increasing the processing capability as increasing
processor has its own local memory and local disk. their number.
A processor at one node may communicate with General Guidelines, :- One processor should be
another processor using high speed communication always free, Configuring CPU allocation settings
network. properly, It is designed for Heavy load processing
Unit 5 Q. Advantages of Distributed Database System:-
Q. Advantages and disadvantages of distributed Distributed database management has been
database introduced for various reasons ranging like
organizational decentralization or data processing at
Advantages Disadvantages lower cost.
1.Modular 1. Costly software 1. Management of distributed data with different
development 2. Large overhead levels of transparency: A DBMS should hide the
2. Reliability 3. Data integrity detail of where each data item (like tables or
3.Lower 4. Improper data relations) is physically stored within the system.
communication costs distribution 2. Increase reliability: Reliability is defined as the
4. Better response probability that a system is running (working) at any
point of time.
4. Improved performance:- A distributed DBMS 3. Increase availability: Availability is defined as the
fragments the database and try to keep data closer to probability that the system is continuously available
the site where it is needed most of the time for (accessible) during a certain time interval for any
operations. database operations.
Q. Types of Distributed Databases Q. Types of Data Fragmentation: -
1). Homogeneous Distributed Database System (a) Horizontal data fragmentation
If all data servers to which data is distributed are Horizontal fragmentation divides a relation
having same DBMS software, then this system is horizontally into group of rows (tuple) to create
called as a homogeneous distributed database subsets of tuples specified by a condition on one or
system. These systems are easy to handle good more attributes of relation. The tuples that belong to
performance and good data access speed. the horizontal fragment is specified by some
2). Heterogeneous Distributed Database System condition on one or more attributes of the relation
If different database servers are running under the (b) Vertical data fragmentation
control of different type of DBMS systems and are Vertical fragmentation divides a relation vertically
connected to enable access to data from different into group of columns. When each site does not need
sites, such system is called as a heterogeneous all the attributes of a relation, vertical fragmentation
distributed database system, also referred to as a is used to fragment the relation vertically by
multi database system. For constructing columns. It is necessary to include primary key or
heterogeneous systems we have to use all standards some common candidate key in every vertical
for gateway protocols. A gateway protocol is an API fragment to reconstruct the original relation from the
that used when we expose DBMS functionality to all fragments.
other external applications. Examples: Connections (c) Mixed data fragmentation
using ODBC and JDBC are accessing database We can mix two types of fragmentation ie. horizontal
servers through gateway protocols. System comes at and vertical fragmentations yielding a mixed
economic cost in terms of performance, software fragmentation. This fragmentation is generally used
complexity and administration difficulty. in many applications.
Q. Failure Modes in Distributed Databases Q. Two Phase Commit Protocol
1. Dealing with multiple copies of data Items 1. Introduction: In database transaction processing
Maintaining consistency among multiple copies of two phase commit protocol (2PC) is a type of an
distributed data is responsibility of this method. The atomic commit protocol. This is a distributed
recovery method is makes a copy consistent with algorithm that coordinates in all the distributed
other copies if the site on which it is stored fails. transaction whether to commit or rollback the
2. Failure of individual sites transaction.
When a site recovers from crash or failure their 2. Purpose of using two phase protocol: Ensures
databases is out dated as compared to other sites. commit or rollback. The two-phase commit protocol
After site is up local database must be brought up to ensures that all participating database servers receive
date with the rest of the sites. and implement the same action (commit or to roll
3. Failure of communication site back a transaction), despite of local or network
The system must be able to manage temporary failure. Automatic recovery mechanism
failure of network that connects the multiple sites in 3. Sites used in two phase protocol: Coordinator
distributed databases. This breaks up the one site into site. The transaction manger at the site where the
number of partitions. In this case sites within one transaction originated is called a coordinator site.
partition can communicate only with another site in Subordinator site (or cohorts)
same partition and not with sites in other partitions. 4. Two phases of working: The two phases of the
4. Distributed commit protocol are the commit- request phase and commit
Committing a transaction that is accessing databases phase. Commit request phase
stored on multiple sites if some sites fail during the 5. Example: When user decides that he needs to
commit process then that type of problem is called commit the transaction, the commit command is sent
as distributed commit. If some sites fail during the to the coordinator and this will initiates two phase
commit process then two phase commit protocol can protocol. The coordinator site will sends a prepare
be used. 5. Distributed deadlock:- Distributed message to all subordinates Upon receiving prepare
occur among several sites, due to (1) Concurrency message, the subordinate decides whether to abort or
Problem (ii) Recovery problems. commit its sub transaction.
Q. Three Phase Commit Protocol: Adjacent state Q. Architecture of Distributed Databases
means that this state can go other state with a single The distributed database architecture of a database
state transition. The Three Phase Commit Protocol system defines structure of distributed data.
(3PC) is designed for avoiding blocking state in Architecture first identifies the components of the
distributed recovery algorithm which is possible database system, the function of each component and
with above two phase commit protocol. there relationship is defined. There are three
1. Three phase commit concept: Transaction is in alternative approaches to separating functionality
non blocking state if its state "transition diagram across different DBMS-related processes. Their are
contains none of the following, Graph does not have some parameters are considered for architecture
any state that is adjacent to both a commit and an implementation alternatives.
abort state. No non-committable state (adjacent to a a) Distribution: It refers to the physical distribution
commit state) of data among multiple sites. There are a multiple
2. READY state is a non committable state, due to ways by which data can be distributed.
this state does not means that all the processes have Mainly there are two alternatives models:
voted "Yes" to commit the transaction.It is obvious 1. Client/server data distribution: Server
that the WAIT state in the coordinator. and the Responsibility: Data management
READY state in the participant 2PC protocol violate 2. Peer-to-Peer data distribution: No separation of
the non-blocking conditions we have stated above. client and servers. Each machine has complete
3. Sites used in two phase protocol: Coordinator DBMS and it can communicate with other clients to
site. The transaction manger at the site where the execute queries and transactions.
transaction originated is called a coordinator site. (b) Autonomy: Distributed database autonomy
Subordinator site (or cohorts) The transaction refers to the distribution of database control among
managers at sites where sub transactions execute are multiple sites. It measures degree to which DBMS
called subordinates. can operate independently.
4. Three phases of working: The three phases of the (c) Heterogeneity: Heterogeneity can be for
protocol are the Pre commit request phase, commit- hardware, data model and query language or with
request phase and commit phase. networking protocols.
Q.Concurrency Control in Distributed Q. Client-Server Systems
Databases: Distributed Two Phase Locking A Client-Server system has number of clients and
In distributed databases, transaction may starts some servers, a client process can send a query
transaction in system at Site 1, but requests a to any one of server process and server will
lock from Site 3. the system at Site 2 and request manage to solve that query and replies with some
a lock from Site, conflict may not be detected, result.
which results in inconsistency. Clients responsibility: user interface issues
a. Centralized 2PL: In this approach we select Servers responsibility: execute transactions.
one site as lock manager (CLM). All other sites Advantages: It is relatively simple to implement
know where the by centralized lock manager.If due to centralized server system. Expensive
the data item not available due to one or more Server machines are utilized by avoiding dull
conflicting transactions, the lock is not granted user interactions, which are now relegated to
"LOCK Reject" is sent to respective site. inexpensive client machines. Users can run
b. Primary copy 2PL: In primary copy 2PL simple a graphical user interface that they can
multiple sites are selected as control centers. understand, rather than the user interface on the
Each site takes responsibility of managing a server which is complex. In Client-Server
number of locks. applications, it is important to remember the
c. Distributed 2PL: Distributed 2PL requires boundary between the client and the server and
Local lock manager (LM) to manage the data to keep the communication simple.
items stored at its own site. Lock manager
depends on data distribution and/or replication.
Unit 3 Q. Set Operations: The results of two queries
Q. SQL commands Syntax: can be combined using the set operations union,
1. Create Table: To create database object intersection and difference.In order to calculate
like table, database, view etc. we use Data the union, intersection or difference of two
Definition Language (DDL). queries, the two queries must be "union
compatible", which means that they both return
Syntax: CREATE TABLE <Table_Name>
the same number of columns, and that the
(Column 1 datatype, Column_2 datatype,
corresponding columns have compatible data
Column_n datatype); types.
2. Alter Table: Once table is created in 1. Union Operation: Union effectively appends
database, we may require to change structure the result of Query_2 to the result of Query_1.
of database object. This can be done with Furthermore, it eliminates all duplicate rows, in
help of ALTER command. the sense of DISTINCT, unless ALL is specified.
Syntax: ALTER TABLE <Table_Name> Syntax: SELECT FROM stud;
ADD Column 1 datatype; 2. Intersect Operation: Returns all rows that are
3. Drop Table: This command can be used both in the result of Query_1 and in the result of
to remove database objects from our DBMS. Query_2. Duplicate rows are eliminated unless
Syntax: DROP TABLE <Table_Name> ALL is specified.
4. Delete Table: Delete statement is used to Syntax: SELECT FROM stud INTERSECT
SELECT FROM stud_extern;
delete some or all records from the existing
3. Nesting SET Operations: It is possible to use
table.
one Set operations within other set operation
Syntax: DELETE FROM WHERE <Table called as nesting operation. It is possible to nest
Name> Condition; and chained like below
5. Update Table: Insert statement used to Syntax: Query1 UNION query2 UNION query
modify the records present in existing table.
Syntax: UPDATE <Table_Name> SET
column1=value WHERE condition; Q. Stored Function: is a named block or
6. Insert Table: Insert statement used to add subprogram in PL/SQL.In PL/SQL, a function
records to the existing table. takes one or more parameter and returns one
Syntax: INSERT INTO<Table_Name>[(Column value.
1,..., ColumnN) VALUES (column1..., columnN); • The syntax for a function in PL/SQL is as
8. Rename Table: We can rename any table follows:
object at any point of time. CREATE [Or REPLACE] Function
Syntax: RENAME TABLE <Table Name> Function_Name
To <New Table_Name>; [(Parameter,..)]
Return Datatype
[IS | AS]
[Declaration Section]
BEGIN
[Executable Section) END Function Name;
Q.Unique Key: - In case of unique Q.PL/SQL Block Structure: - PL/SQL is a
constraint, no two tuples can have equal block-structured language. A PL/SQL block is
value for same attributes. This constraint defined by the keywords DECLARE, BEGIN,
says that attributes form candidates key, EXCEPTION, and END, which break up the
which allows one Null value which is unique block into three sections: Declarative:
Statements that declare variables, constants, and
by itself. This UNIQUE constraint can be
other code elements, which can then be used
applicable to user defined domain
within that block.
declaration also.
Q.Primary Key: - A table in a relational
database has one column or combination of
some columns whose values uniquely
identifies a single row in the table. This
column or combination of columns is called
the primary key of the table.
Q.Foreign key: - A value appearing in one
relation (table) for a given set of attributes
also appears for another set of attributes in Q. Aggregate Function:
another relation (table). This is called 1) COUNT ( ): this function is used to calculate
referential integrity. The referential integrity COUNT of values in table.
Syntax: SELECT Count (Sid) FROM Marks
constraint is specified between two tables to
2) SUM, 3) AVG(Average), 4) MIN(Minimum),
maintain the consistency among tuples in the 5) MAX(Maximum)
two tables. The tuple in one relation refers
only to an existing tuple in another relation.
Q. Transection control: The COMMIT, Q. Built-in Function
ROLLBACK, and SAVEPOINT are collectively
Function Value Returned
considered as Transaction Commands
1) COMMIT: The COMMIT command is used INTCAP (S) First letter of word in
to save permanently any transaction to database. uppercase and all other letter in
When we perform, Read or Write operations to lower case
the database then those changes can be undone LOWER (s) All letter are to lowercase
by rollback operations. To make these changes UPPER (s) All letter are to uppercase
permanent, we should make use of commit CONCATE s1 and s2. Equivalent to the
2) ROLLBACK: The ROLLBACK command (s1, s2) s1|| s2
is used to undo transactions that have not already LTRIM Returns s with removed up to
saved to database. For example. Following (s[,set]) the first character not in set;
command will delete the record from the defaults to space
database, but if we immediately performs LENGTH (s) Returns the number of
ROLLBACK, then this deletion is undone characters in s
3) SAVEPOINT: A SAVEPOINT is a point in a
transaction when you can roll the transaction
back to a certain point without rolling back the
entire transaction. The SAVEPOINT can be
created as
Q. SQL Join and its Types: Full Join
1) Inner Join: The most important and Sid Cid S_name Cid City
frequently used of the joins is the INNER JOIN. 1 101 Ram 101 Pune
They are also known as an EQUIJOIN. creates a 2 101 Jay 101 Pune
new result table by combining column values of 3 102 Seeta 102 Mumbi
two tables (Tablel and Table2) 4 NULL Geeta NULL NULL
Syntax: SELECT Table1.column1,
NULL NULL NULL 103 Nashik
Table2.column2. FROM Table1 INNER JOIN
Q. Stored Procedure: Following example show
Table2. on
the procedure for addition of two numbers. The
Table1.common_field=Table2.common_field;
result is stored in third variable which is an
Ex: SELECT * FROM Student Inner Join City
output variable.
on Student.cid=City.cid
Step 1: We will create a procedure and store it in
Sid Cid S_name Cid City
an sql file as follows
1 101 Ram 101 Pune CREATE OR REPLACE PROCEDURE
2 101 Jay 101 Pune AddProc(x IN NUMBER, Y IN NUMBER, z
3 102 Seeta 102 Mumbi OUT NUMBER) IS
2). OUTER JOIN: outer join is based on both BEGIN
mached and unmached data outer subdivide z=x+y
further in to consider two table Stud-data 1 and END,
stud-data 2. Step 2: The call to the procedure can be made
a). LEFT Join: from another file. The code for calling the
Syntax: SELECT Table1.column1, procedure for execution is as follows -
Table2.column2.FROM Table1 LEFT JOIN SET SERVEROUTPUT ON
Table2 ON Table1.common_field = DECLARE
Table2.common_field; a NUMBER, b NUMBER; c NUMBER;
Ex: SELECT * FROM Student Left Join City on BEGIN
Student.cid =City.cid a= 10;
Sid Cid S_name Cid City b: 20;
1 101 Ram 101 Pune AddProc(a,b,c); dbms_output.put_line('Addition
2 101 Jay 101 Pune of two numbers:'| |[c), END;
3 102 Seeta 102 Mumbi Q. Database Trigger: Trigger is something that
4 NULL Geeta NULL NULL is invoked automatically when some event
b). RIGHT Join: occurs.
Syntax: SELECT Table1.column1, • PL/SQL triggers are block structures or pre-
Table2.column2.FROM Table1 RIGHT JOIN defined programs, which may be in-built or even
Table2 ON Table1.common_field = explicitly developed by the programmers for a
Table2.common_field; particular task. Trigger is stored into database
Sid Cid S_name Cid City and invoked repeatedly, when specific condition
1 101 Ram 101 Pune match. Triggers are stored programs, which are
2 101 Jay 101 Pune automatically executed or fired when some event
3 102 Seeta 102 Mumbi occurs.
NULL NULL NULL 103 Nashik Syntax: CREATE OR REPLACE TRIGGER
c). FULL Join: Syntax: SELECT Trigger_Name BEFORE or AFTER or
Table1.column1, Table2.column2. FROM INSTEAD OF INSERT or UPDATE or DELETE
Table1 FULL JOIN Table2 ON
Table1.common_field = Table2.common_field,

You might also like