List of Experiments-1-2
List of Experiments-1-2
List of Experiments-1-2
1. Creation of a database and writing SQL queries to retrieve information from the database.
2. Implementation of DML, DCL and TCL
3. Queries to demonstrate implementation of Integrity Constraints
4. Practice of Inbuilt functions
5. Creation of Views, Synonyms, Sequence, Indexes, Save point.
6. Implementation of Nested Queries
7. Implementation of Join and Set operators
8. Creating an Employee Database to set various constraints.
9. Implementation of Virtual tables using Views
10. Study of PL/SQL block.
11. Write a PL/SQL block to satisfy some conditions by accepting input from the user.
12. Write a PL/SQL block that handles all types of exceptions.
13. Creation of Procedures and functions.
14. Creation of database triggers and cursors.
15. Application Development using Front End Tools and Database Connectivity.
EX.NO: 1 IMPLEMENTATION OF DDL COMMANDS
DATE:
AIM:
To create a DDL to perform the Creation of a database and writing SQL queries to retrieve
information from the database.
DDL COMMANDS
1. The Create Table Command - It defines each column of the table uniquely. Each column
has minimum of three attributes, a name, data type and size.
Syntax:
Syntax:
Syntax:
Syntax:
Syntax:
Syntax:
7. Destroying tables.
Syntax:
DESC
Name Null?
Type
EName VarChar(15)
RESULT:
Thus the DDL commands have been executed and verified successfully.
EX.NO: 2 IMPLEMENTATIONS OF DML AND DCL COMMANDS
DATE:
AIM:
To study the various DML commands and implement them on the database.
DML COMMANDS
DML commands are the most frequently used SQL commands and is used to query and
manipulate the existing database objects. Some of the commands are Insert, Select, Update,
Delete.
Insert Command - This is used to add one or more rows to a table. The values are separated by
commas and the data types char and date are enclosed in apostrophes. The values must be entered
in the same order as they are defined.
Select Commands - It is used to retrieve information from the table. It is generally referred to as
querying the table. We can either display all columns in a table or only specify column from the
table.
Update Command - It is used to alter the column values in a table. A single column may be
updated or more than one column could be updated.
Delete command - After inserting row in a table we can also delete them if required. The delete
command consists of a from clause followed by an optional where clause.
SQL> create table student(id number(6)primary key, name varchar(15), deptno number(2),
maths number(2), english number(2));
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
163044 krithica 12 70 85
163054 monisha 11 75 78
163019 dhanalakshmi 11 80 85
163023 dharshini 10 95 90
163128 nikitha 9 75 85
2 rows updated.
163044 krithica 12 70 85
163054 monisha 11 75 90
163019 dhanalakshmi 11 80 85
163023 dharshini 10 95 90
3 SELECT :
a) Select columns from the table
ID MATHS
163044 70
163054 75
163019 80
163023 95
163128 75
163019 dhanalakshmi 11 80 85
163023 dharshini 10 95 90
163044 krithica 12 70 85
163054 monisha 11 75 90
163019 dhanalakshmi 11 80 85
163023 dharshini 10 95 90
163128 nikitha 9 75 90
4. DELETE:
1 row deleted.
163054 monisha 11 75 90
163019 dhanalakshmi 11 80 85
163023 dharshini 10 95 90
163128 nikitha 9 75 90
163019 dhanalakshmi 11 80 85
163023 dharshini 10 95 90
163054 monisha 11 75 90
163128 nikitha 9 75 90
163128 nikitha 9 75 90
163054 monisha 11 75 90
163023 dharshini 10 95 90
163019 dhanalakshmi 11 80 85
DCL COMMANDS
The DCL language is used for controlling the access to the table and hence securing the
database. DCL is used to provide certain privileges to a particular user. Privileges are
rights to be allocated. The privilege commands are namely, Grant and Revoke. The
various privileges that can be granted or revoked are, Select Insert Delete Update
References Execute All.
GRANT COMMAND: It is used to create users and grant access to the database. It
requires database administrator (DBA) privilege, except that a user can change their
password. A user can grant access to their database objects to other users.
REVOKE COMMAND: Using this command, the DBA can revoke the granted
database privileges from the user.
1. G
R
A
N
T
:
2. REV
OKE
a) Revoke all privileges:
3. COMMIT : commits a
Transaction.
SQL>commit;
Commit completed
4. SET TRANSACTION:
Thus the DML, DCL and TCL commands have been executed and verified
successfully.