Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

Experiment No.

1
Implement DDL Command
DDL : It is used to create database or its objects(like- Table, Index, Function, View, Store,
Procedure and Triggers).

DDL commands are –

1. Create Command -  is used to create the database or its objects

2. Alter Command – is used to alter the structure of the database.

Name : Surya Prakash Giri


Roll No. : 0173CS171035
3. Truncate Command – is used to remove all records from a table, including all spaces allocated for
the records are removed.

4. Drop Command - is used to delete objects from the database.

Experiment No.2

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Create a database and specify Primary key and Foreign key
1. Primary Key –

2. Foreign Key –

Experiment No.3
Implement DML Command

Name : Surya Prakash Giri


Roll No. : 0173CS171035
DDL : The SQL commands that deal with the manipulation of data present in database belong
to DML and this includes most of the SQL commands.

DDL commands are –

1. Insert – is used to insert data into a table.

2. Update – is used to update existing data within a table.

3. Delete – is used to delete records from a database table.

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.4
Implement DQL Command

Name : Surya Prakash Giri


Roll No. : 0173CS171035
DQL : DML statements are used for performing queries on the data within schema objects. The purpose of
DQL Command is to get some schema relation based on the query passed to it.

SELECT – is used to retrieve data from the a database

Experiment No.5
Implement Agreegate Functions
Agreegate Functions are -

Name : Surya Prakash Giri


Roll No. : 0173CS171035
1. Sum -

2. Max -

3. Min –

Name : Surya Prakash Giri


Roll No. : 0173CS171035
4. Average –

5. Count –

Experiment No.6

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Implement Order By,Between,Like,Group By and Having
1. Order By –

2. LIKE –

3. Group By –

Name : Surya Prakash Giri


Roll No. : 0173CS171035
4. Having –

Experiment No.7
Write a query to display Alternate Rows(Odd & Even)

Name : Surya Prakash Giri


Roll No. : 0173CS171035
1. Odd -

2. Even –

Experiment No.8
Write a query to update multiple records using one update statement

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.9
Write a query to select 3rd highest and 3rd lowest assets
1. 3rd Highest Assets –

Name : Surya Prakash Giri


Roll No. : 0173CS171035
2. 3rd Lowest Assets –

Experiment No.10
Write a query to display the name which start with alphabate 'G'

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.11
Write a PL/SQL Query To Display All Employees
Who Were Hired In Last Month (i.e. DEC)

Name : Surya Prakash Giri


Roll No. : 0173CS171035
PL/SQL Introduction :
PL/SQL is a block structured language that enables developers to combine the power
of SQL with procedural statements.All the statements of a block are passed to oracle
engine all at once which increases processing speed and decreases the traffic.

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.12
Write A PL/SQL Query To Delete Duplicate Records From A Table

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.13
Write A Query To Display The Repeated Tuples From A Schema

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.14
Write PL/SQL Query To Demonstrate SELECT Command
SELECT INTO statement in PL/SQL is generally used for bulk copy purposes. We
could copy the whole data from one table into another table using a single
command.

SYNTAX : SELECT column1, column2..... INTO TARGET_TABLE from SOURCE_TABLE

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.15
Write PL/SQL Query To Demonstrate INSERT Command
Data Insertion
In PL/SQL, we can insert the data into any table using the SQL command INSERT INTO. This
command will take the table name, table column and column values as the input and insert the
value in the base table.

The INSERT command can also take the values directly from another table using 'SELECT'
statement rather than giving the values for each column. Through 'SELECT' statement, we can
insert as many rows as the base table contains.

Syntax:

BEGIN
INSERT INTO <table_name>(<column1 >,<column2>,...<column_n>)
VALUES(<valuel><value2>,...:<value_n>);
END;

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.16
Write PL/SQL Query To Demonstrate UPDATE Command
Data Update
Data update simply means an update of the value of any column in the table. This can be done
using 'UPDATE' statement. This statement takes the table name, column name and value as
the input and updates the data.

Syntax:

BEGIN
UPDATE <table_name>
SET <columnl>=<VALUE1>,<column2>=<Yalue2>,<column_n>=<value_n>
WHERE <condition that uniquely identifies the record that needs to be update>;
END;

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.17
Write PL/SQL Query To Demonstrate DELETE Command
Data Deletion
Data deletion means to delete one full record from the database table. The 'DELETE' command
is used for this purpose.

Syntax:

BEGIN
DELETE
FROM
<table_name>
WHERE <condition that uniquely identifies the record that needs to be update>;
END;

Name : Surya Prakash Giri


Roll No. : 0173CS171035
Experiment No.18
Write PL/SQL Query To Display TOP - 5 Employees
Who have Highest Salary (Using Cursor)
Cursor in SQL :

To execute SQL statements, a work area is used by the Oracle engine for its internal
processing and storing the information. This work area is private to SQL’s operations. The
‘Cursor’ is the PL/SQL construct that allows the user to name the work area and access the
stored information in it.
 Declare Cursor: A cursor is declared by defining the SQL statement that returns a result set.
 Open: A Cursor is opened and populated by executing the SQL statement defined by the cursor.
 Fetch: When the cursor is opened, rows can be fetched from the cursor one by one or in a block to perform
data manipulation.
 Close: After data manipulation, close the cursor explicitly.
 Deallocate: Finally, delete the cursor definition and release all the system resources associated with the
cursor.

Name : Surya Prakash Giri


Roll No. : 0173CS171035

You might also like