Professional Documents
Culture Documents
Database Management System Long
Database Management System Long
Database Management System Long
ASSIGNMENT-2
SUBMITTED TO: Ms. P. Sobha Rani
result-set.
SELECT * FROM table_name
1) Select <Column_name> from <table_name>;
2) Select <Column_name> from <table_name> where
<condition>;
3) Select <Column_name> from <table_name> where
<condition>
like <pattern>;
4) Select <Column_name> from <table_name> where
<condition> order by <expression>;
5) Select <Column_name> from <table_name> where
<condition> group by <expression>;
6) Select <Column_name> from <table_name> where
<condition> having <expression>;
7) Select <Column_name1> from <table_name1> Minus
Select <Column_name2> from <table_name2> ;
8) Select <Column_name1> from <table_name1> Intersect
Select <Column_name2> from <table_name2> ;
9) Select <Column_name1> from <table_name1> Union
Select <Column_name2> from <table_name2> ;
Standards
3) Commit
4) Rollback
5) Alter:- ALTER TABLE table_name
RENAME TO new_table_name
6) Update:- UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
7) Modify:- Alter TABLE "table_name"
ALTER COLUMN "column 1" "New Data Type
8) Union:- SELECT Date FROM Store_Information
UNION
SELECT Date FROM Internet_Sales
9) Union All:- SELECT Date FROM Store_Information
UNION ALL
SELECT Date FROM Internet_Sales
10)
Intersect:- SELECT Date FROM Store_Information
Intersect SELECT Date
FROM Internet_Sales
11) Minus:- SELECT Date FROM Store_Information
Minus
SELECT Date FROM Internet_Sales
12) Where
13) Like
nor the trigger action is executed, that is all changes made are
rollback on failure. For non-transactional tables, all changes made
prior to the point of error remains in effect.
Types of Triggers in Oracle
1. Before Trigger
2. After Trigger
3. Row level trigger
4. Schema Trigger
5. Instead of Trigger
6. Database Trigger
7. Statement level Trigger
Oracle allows multiple triggers with the same trigger timing and
trigger event to be defined on a table; however, these triggers are
not guaranteed to execute in any specific order. Triggers can be
defined as row triggers or statement triggers. Statement triggers
are fired once for each triggering statement regardless of the
number of rows in a table affected by the triggering statement.
For example if a DELETE statement deletes several rows from a
table, a statement trigger is only fired once.
The execution model for Oracle triggers is transactional. All
actions performed as a result of the triggering statement,
including the actions performed by fired triggers, must all
succeed; otherwise, they are rolled back.
Procedure heading: =
Procedure definition: =
Stored Procedures
Stored procedures provide a powerful way to code application
logic that can be stored on the server. MySQL and Oracle both use
stored procedures and functions. Stored functions are similar to
procedures, except that a function returns a value to the
environment in which it is called. In MySQL, stored procedures
and functions are collectively called routines.
The following sections compare stored procedures in MySQL and
Oracle:
REPLACE Statement
DO Statement
made to place the data into the table using the INSERT statement;
and if this fails, the data in the table is then updated using the
UPDATE statement.
DO Statement
As its name implies, the DO statement in MySQL does something
but does not return anything; specifically, it executes the commadelimited list of expressions specified as its parameters. The DO
statement is converted to a SELECT expr1 [, expr2,] INTO
FROM DUAL statement in Oracle.
Compound DECLARE Statement
MySQL uses the DECLARE statement to declare local variables in
stored procedures. PL/SQL does not allow multiple declarations;
each declaration must be made separately. To convert compound
DECLARE statements into functionally equivalent PL/SQL code,
each MySQL multiple declaration statement should be converted
into logically equivalent separate statements, one for each
declaration.
For example, consider the following MySQL simple declaration and
multiple declaration statements:
/* Simple declaration */
DECLARE a INT;
/* Compound declaration */
DECLARE a, b INT DEFAULT 5;
The PL/SQL functionally equivalent statements are:
/* Simple declaration */
a INT;
/* Multiple declarations */
a INT := 5;
b INT := 5;
Concurrency Control
Definition
Concurrency control is a database management systems (DBMS)
concept that is used to address conflicts with the simultaneous
accessing or altering of data that can occur with a multi-user
system. Concurrency control, when applied to a DBMS, is meant
to coordinate simultaneous transactions while preserving data
integrity. [1] The Concurrency is about to control the multiuser
access of Database
Illustrative Example
To illustrate the concept of concurrency control, consider two
travellers who go to electronic railway reservation counter at the
same time to purchase a train ticket to the same destination on
the same train. There's only one seat left in the coach, but
without concurrency control, it's possible that both travelers will
end up purchasing a ticket for that one seat. However, with
concurrency control, the database wouldn't allow this to happen.
Both travellers would still be able to access the train seating
database, but concurrency control would preserve data accuracy
and allow only one traveler to purchase the seat.
This example also illustrates the importance of addressing this
issue in a multi-user database. Obviously, one could quickly run
into problems with the inaccurate data that can result from
several transactions occurring simultaneously and writing over
each other. The following section provides strategies for
implementing concurrency control.
i)
Transaction processing
ii)
Optimization