DBMS Manual
DBMS Manual
com
Exp.No: 01 Data Definition Language
Date :
DESCRIPTION:
CREATE: To create a table, the basic structure to hold user data, specifying this information:
column definitions
integrity constraints
the table's tablespace
storage characteristics
an optional cluster
data from an arbitrary query
Syntax
CREATE TABLE tablename (columnname datatype [constraint [constraint name]],
[ columnname ......] [, constraints] );
Constraints:
NOT NULL every record must have a value for the column
UNIQUE value for each record must be distinct
CHECK checks to make sure the condition is satisfied
PRIMARY KEY defines the primary key of the table
FOREIGN KEY (columname) REFERENCES tablename (columnname) defines the
foreign key of the table
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
to explicitly allocate an extent
Syntax
ALTER TABLE tablename MODIFY (columnname [datatype] [constraint]);
ALTER TABLE tablename ADD (columnname datatype [constraint]);
TRUNCATE: Delete all the records in the table retaining its structure.
Syntax: Truncate table <table name>;
Example SQL> truncate table employee;
PROCEDURE
1.Create a table with the given fields
2.Display the structure of the table
3.Alter the size and datatype of the fields in the table
4.Rename the table names
5.Drop the tables
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
1. Write a query to create a table student with the following list of attributes Sno, Name,
Register number, Marks.
Table created.
Table altered.
Table altered.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Table Creation and adding Constraints
5. Write a query to create a table BankAccount and assign Primary key Constraint for the
attribute Accno and assign NOTNULL Constraint for the field CustomerName.
Table created.
To Verify: SQL> desc BankAccount;
6. Write a query to Add a Primary key for the attribute Regno of the table Student.
Table altered.
7. Write a query to Alter “Student” table to add “Gender” and “City” columns and verify it.
Table altered.
8. Write a query to Alter “student” table to modify the column “Name” as “Sname” and
add Unique Constraint on it and verify it.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SQL> alter table student modify(Name varchar2(20) constraint Sname unique);
Table altered.
9. Write a query to Alter “student” table to drop the “City” column and verify it.
Table altered.
10. Write a query to alter “student” table to set the “Gender” column as unused and verify it.
Table altered.
11. Write a query to view the constraint names and its types of the “student” table from the
User_Constraints table.
12. Write a query to view the column associated with the constraints names of the
BankAccount table from the user_cons_columns view.
13. Write a query to create a FOREIGN KEY constraint on the "Accno" column when the
"Loan” table which is already created.
(CHECK)
14. Write a query to create a table stud with attributes rno,name,sal and add check
constraint to attribute sal.
SQL> create table stud(rno number(5),name varchar2(10),sal number(10) constraint no_ck
check(sal between 10000 and 30000));
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Table created.
SQL> insert into stud values(&rno,'&name',&sal);
Enter value for rno: 567
Enter value for name: sachin
Enter value for sal: 29000
old 1: insert into stud values(&rno,'&name',&sal)
new 1: insert into stud values(567,'sachin',29000)
1 row created.
SQL> /
Enter value for rno: 565
Enter value for name: rohit
Enter value for sal: 35000
old 1: insert into stud values(&rno,'&name',&sal)
new 1: insert into stud values(565,'rohit',35000)
insert into stud values(565,'rohit',35000)
*
ERROR at line 1:
ORA-02290: check constraint (SCOTT.NO_CK) violated
( FOREIGN KEY )
15. Write a query to create a table adm with attributes stuid,sname,percentage(per) and add
primary key constraint to stuid. Create another table course with attributes stuid,branch
and sec and add foreign key constraint to stuid.
1 row created.
SQL> /
Enter value for stuid: 2
Enter value for sname: rohit
Enter value for per: 89
old 1: insert into adm values(&stuid,'&sname',&per)
new 1: insert into adm values(2,'rohit',89)
1 row created.
SQL> /
Enter value for stuid: 3
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Enter value for sname: sachin
Enter value for per: 99
old 1: insert into adm values(&stuid,'&sname',&per)
new 1: insert into adm values(3,'sachin',99)
1 row created.
SQL> /
Enter value for stuid: 4
Enter value for sname: naveen
Enter value for per: 70
old 1: insert into adm values(&stuid,'&sname',&per)
new 1: insert into adm values(4,'naveen',70)
1 row created.
SQL> select * from adm;
STUID SNAME PER
---------- --------------- ----------
1 abi 80
2 rohit 89
3 sachin 99
4 naveen 70
Table created.
1 row created.
SQL> /
Enter value for stuid: 5
Enter value for branch: cse
Enter value for sec: b
old 1: insert into course values(&stuid,'&branch','&sec')
new 1: insert into course values(5,'cse','b')
insert into course values(5,'cse','b')
*
ERROR at line 1:
ORA-02291: integrity constraint (SCOTT.SID_FK) violated - parent key not found
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SQL> delete from adm where stuid=1;
*
ERROR at line 1:
ORA-02292: integrity constraint (SCOTT.SID_FK) violated - child record found
1 row deleted.
1 row deleted.
Disabling a Constraint:
17. Write a query to disable the Unique key (Sname) Constraint on the student table without
Dropping it or Recreating it and verify it.
Table altered.
18. Write a query to enable or activate the Unique key Constraint(Sname) on “student” table
and verify it.
Table altered.
Dropping Constraints:
19. Write a query to remove the Unique key(Sname) Constraint from the student table and
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
verify it.
Table altered.
20. Write a query to remove the Primary key Constraint on the “BankAccount” table and
Drop the associated Foreign key Constraint on the Loan.Accno column and verify it.
Table altered.
21. Write a query to Rename the “student” table to “Student” and verify it.
Table truncated.
No rows selected
Table dropped.
ERROR:
ORA-04043: object student does not exist.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Exp.No: 2 DATA MANIPULATION LANGUAGE (DML)
Date :
1.INSERT:
Insert command insert one or more rows into a table.
Syntax:
INSERT INTO<table name> values (value1, value2, value3….);
Example: SQL>insert into emp1 values (7954,‘SMITH‘,‘CLERK‘, 7902,‘17-DEC-1980‘
,800,NULL,20); SQL> insert into emp1 values (&empno,‘&ename‘,‘&job‘,&mgr,‘&hiredate‘,&sal,
comm);
3.Update
The UPDATE command can be used to modify information contained within a table, either in bulk
or individually.
Syntax
1.UPDATE tablename SET fieldname=new value;
2. UPDATE table name SET fieldname=new value where condition;
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
To Insert the values into the Table:
1. Write a query to insert a new row containing values for each column into the “Student”
table and verify it.
1 row created.
SQL> /
Enter value for sno: 2
Enter value for name: vignesh kumar
Enter value for regno: 1017208
Enter value for contact_no: 9710352789
old 1: insert into student values(&sno,'&name',®no,&contact_no)
new 1: insert into student values(2,'vignesh kumar',1017208,9710352789)
1 row created.
SQL> /
Enter value for sno: 3
Enter value for name: uva
Enter value for regno: 1017207
Enter value for contact_no: 9952974163
old 1: insert into student values(&sno,'&name',®no,&contact_no)
new 1: insert into student values(3,'uva',1017207,9952974163)
1 row created.
SQL> /
Enter value for sno: 4
Enter value for name: vignesh
Enter value for regno: 1017209
Enter value for contact_no: 9444715807
old 1: insert into student values(&sno,'&name',®no,&contact_no)
new 1: insert into student values(4,'vignesh p',1017209,9444715807)
1 row created.
[ Note: Backslash(/) is used to get the values consecutively ]
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
2. Write a query to display the table content.
3. Write a query to display the name and contact_no Columns from “student” table.
NAME CONTACT_NO
--------------- ------------------
shiva 9941416491
vignesh kumar 9710352789
uva 9952974163
vignesh p 9444715807
4. Write a query to display the distinct values of “regno” from “student” table.
REGNO
-----------------
1017191
1017207
1017208
1017209
5. Write a query to insert new row containing values for each column into the “Student”
table and verify it.
1 row created
6. Create a table “Employee” with sno, name,empid and salary as its attributes.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Table created.
7. Write a query to insert values for each column into the “Employee” table and verify it.
SQL> insert into Employee values(&sno,'&name',&empid,&salary);
Enter value for sno: 1
Enter value for name: monica
Enter value for empid: 10232
Enter value for salary: 25000
old 1: insert into Employee values(&sno,'&name',&empid,&salary)
new 1: insert into Employee values(1,'monica',10232,25000)
1 row created.
SQL> /
Enter value for sno: 2
Enter value for name: vidhya
Enter value for empid: 10923
Enter value for salary: 29000
old 1: insert into Employee values(&sno,'&name',&empid,&salary)
new 1: insert into Employee values(2,'vidhya',10923,29000)
1 row created.
SQL> /
Enter value for sno: 3
Enter value for name: monisha
Enter value for empid: 10330
Enter value for salary: 50000
old 1: insert into Employee values(&sno,'&name',&empid,&salary)
new 1: insert into Employee values(3,'monisha',10330,50000)
1 row created.
SQL> /
Enter value for sno: 4
Enter value for name: cindhya
Enter value for empid: 10113
Enter value for salary: 45000
old 1: insert into Employee values(&sno,'&name',&empid,&salary)
new 1: insert into Employee values(4,'cindhya',10113,45000)
1 row created.
SQL> /
Enter value for sno: 5
Enter value for name: priya
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Enter value for empid: 14234
Enter value for salary: 60000
old 1: insert into Employee values(&sno,'&name',&empid,&salary)
new 1: insert into Employee values(5,'priya',14234,60000)
1 row created.
8. Write a query to insert new row containing values for each column into the Employee
table and verify it.
1 row created.
9. Write a query to update sno column to 6 whose empid is 12345 and verify it.
1 row updated.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SQL> select *from Employee;
6 rows selected.
10. Write a query to update the “salary” column to 20000 whose empid is 14234 and verify it.
11. Write a query to delete the record from the “Employee” table whose empid is “12345”
and verify it.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Exp.No: 3 DATA CONTROL LANGUAGE (DCL)
Date :
Aim: To write Data control language commands and verify the same
1. Write a query to end your current transaction and make permanent all changes
performed in the transaction.
SQL> commit;
Commit complete.
Table created.
1 row created.
SQL> /
Enter value for sno: 2
Enter value for itemcode: 1026
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Enter value for itemname: mouse
Enter value for cost: 250
old 1: insert into goods values(&sno,&itemcode,'&itemname',&cost)
new 1: insert into goods values(1026,1026,'mouse',250)
1 row created.
SQL> /
Enter value for sno: 3
Enter value for itemcode: 1027
Enter value for itemname: RAM
Enter value for cost: 1500
old 1: insert into goods values(&sno,&itemcode,'&itemname',&cost)
new 1: insert into goods values(3,1027,'RAM',1500)
1 row created.
SQL> /
Enter value for sno: 4
Enter value for itemcode: 1028
Enter value for itemname: webcam
Enter value for cost: 350
old 1: insert into goods values(&sno,&itemcode,'&itemname',&cost)
new 1: insert into goods values(4,1028,'webcam',350)
1 row created.
SQL> /
Enter value for sno: 5
Enter value for itemcode: 1029
Enter value for itemname: pendrive
Enter value for cost: 500
old 1: insert into goods values(&sno,&itemcode,'&itemname',&cost)
new 1: insert into goods values(5,1029,'pendrive',500)
1 row created.
SQL> select *from goods;
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SQL> commit;
Commit complete.
3. Write a query to add the record into the table “goods” and set the Savepoint S1, S2 and S3
and verify it.
Savepoint created.
1 row created.
Savepoint created.
1 row created.
1 row created.
Savepoint created.
Rollback complete.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
1 1025 moniter 5000
2 1026 mouse 250
3 1027 RAM 1500
4 1028 webcam 350
5 1029 pendrive 500
6 1030 keyboard 500
7 1031 DVD drive 2500
8 1032 UPS 3000
9 1033 CPU 5000
9 rows selected.
Rollback complete.
7 rows selected.
SQL> rollback;
Rollback complete.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Exp.No: 4 (a) DATA QUERY LANGUAGE (DQL)
Date :
Aim:
To write Data Query Language Commands and verify the same.
1.Write a query to create a table Employee with the following list of attributes Sno, EName,
EmpID, Salary and Designation.
Table created.
1 row created.
SQL> /
Enter value for sno: 2
Enter value for name: Guru
Enter value for empid: 102
Enter value for salary: 13000
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Enter value for desig: Asst
old 1: insert into empl values(&sno,'&name',&empid,&salary,'&desig')
new 1: insert into empl values(2,'vp',102,13000,'asst')
1 row created.
SQL> /
Enter value for sno: 3
Enter value for name: yuva
Enter value for empid: 103
Enter value for salary: 14000
Enter value for desig: sen asst
old 1: insert into empl values(&sno,'&name',&empid,&salary,'&desig')
new 1: insert into empl values(3,'yuva',103,14000,'sen asst')
1 row created.
SQL> /
Enter value for sno: 4
Enter value for name: siva
Enter value for empid: 105
Enter value for salary: asst manager
Enter value for desig: asst mngr
old 1: insert into empl values(&sno,'&name',&empid,&salary,'&desig')
new 1: insert into empl values(4,'siva',105,asst manager,'asst mngr')
insert into empl values(4,'siva',105,asst manager,'asst mngr')
*
ERROR at line 1:
ORA-00917: missing comma
SQL> /
Enter value for sno: 4
Enter value for name: siva
Enter value for empid: 105
Enter value for salary: 25000
Enter value for desig: ass mngr
old 1: insert into empl values(&sno,'&name',&empid,&salary,'&desig')
new 1: insert into empl values(4,'siva',105,25000,'ass mngr')
1 row created.
SQL> /
Enter value for sno: 5
Enter value for name: sriram
Enter value for empid: 106
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Enter value for salary: 23000
Enter value for desig: mngr
old 1: insert into empl values(&sno,'&name',&empid,&salary,'&desig')
new 1: insert into empl values(5,'sriram',106,23000,'mngr')
1 row created.
1 row created.
SQL> /
Enter value for sno: 2
Enter value for name: deepthi
Enter value for empid: 10254
Enter value for salary: 12000
old 1: insert into employee values(&sno,'&name',&empid,&salary)
new 1: insert into employee values(2,'deepthi',10254,12000)
1 row created.
SQL> /
Enter value for sno: 3
Enter value for name: monisha
Enter value for empid: 10265
Enter value for salary: 50000
old 1: insert into employee values(&sno,'&name',&empid,&salary)
new 1: insert into employee values(3,'monisha',10265,50000)
1 row created.
SQL> /
Enter value for sno: 4
Enter value for name: ileana
Enter value for empid: 10101
Enter value for salary: 29000
old 1: insert into employee values(&sno,'&name',&empid,&salary)
new 1: insert into employee values(4,'ileana',10101,29000)
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
1 row created.
SQL> /
Enter value for sno: 5
Enter value for name: ria
Enter value for empid: 10252
Enter value for salary: 33000
old 1: insert into employee values(&sno,'&name',&empid,&salary)
new 1: insert into employee values(5,'ria',10252,33000)
1 row created.
SQL> select *from Employee;
1. Write a query to display the entire Employee ID and Name of the Employee from Employee
table.
ENAME EMPID
- ------------------------ -----------
vidhya 10125
deepthi 10254
monisha 10265
ileana 10101
ria 10252
1. Write a query to calculate the salary increase of 1000 for all the employees and display a
new salary + 1000 column in the output.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
4 cindhya 46000 10113
5 priya 61000 14234
6 monisha 61000 12345
6 rows selected.
Selecting Rows with Where Clause:
2. Write a query to retrieve Name,Empid and Salary for all employees whose esignation is
“Manager”.
3.Write a query to retrieve the Name and Salary for all employees whose Salary is less than
or equal to 15000.
4.Write a query to retrieve Name and Salary of all employees whose salary is between
10000 and 150000.
SQL> select name,salary from employee where salary between 10000 and 150000;
NAME SALARY
-------------------- ----------
ragu 100000
ram 30000
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
5. Write a query to retrieve the Empid, Name, and salary of all employees whose empid is
a123 and a125.
6. Write a query to retrieve name of all employees whose name begins with “r”.
7. Write a query to retrieve name of all employees whose second letter of name is “a”.
NAME
--------------------
ragu
rama
ram
8.Write a query to retrieve name of all employees who have “a” and “u” letters in their
name.
SQL> select name from employee where name like '%a%u%';
NAME
--------------------
Ragu
9.Write a query to retrieve the Name and Empid , Salary and Designation of all employees
who have a Designation that contains the string “cha” and earns Rs.100000 or more.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SQL> select name,empid,salary,designation from employee where salary >=100000 and
designation like 'cha%';
10. Write a query to retrieve the Name and Empid , Salary and Designation of all employees
whose Designation is “NOT IN” “Chairman and VP”.
11. Write a query to retrieve the Name and Empid , Salary and Designation of all employees
whose salary is “NOT BETWEEN” “Rs.200000 and Rs.300000”.
SQL> select name,empid,salary,designation from employee where salary not between 200000
and 300000;
12.Write a query to retrieve Name,Empid, Salary and Designation of all employees whose
Name doesn’t contain “m”.
SQL> select name,empid,salary,designation from employee where name not like '%m%';
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
rama a124 200000 ceo
ram a125 30000 vp
Selecting Rows using “ORDER BY” Clause with “ASC” and “DESC” keyword:
14.Write a query to retrieve Name,Empid, Salary and Designation of all employees and sort
the result by “Name”.
15.Write a query to retrieve Name,Empid, Salary and Annual Salary of all employees and
sort the result by Annual Salary.
Table altered.
SQL> select * from employee;
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
17.Write a query to update the value for hiredate attribute of the employee table;
1 row updated.
1 row updated.
1 row updated.
1 row updated.
1 row updated.
6 rows selected.
SQL> select ename,designation,hiredate from employee where hiredate between '10-May-10' and
'12-Jun-12';
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
NAME DESIGNATION HIREDATE
-------------------- -------------------- ---------
ragu chairman 10-MAY-10
rama ceo 10-MAY-11
ram vp 10-JUN-11
sag manager 12-JUN-12
dinesh manager 14-JUN-10
19 .Write a query to retrieve the name and empid of all employees with empid a125, b128,
c128 in alphabetical order by name.
SQL> select name,empid from employee where empid in('a125','b128','c128') order by name asc;
NAME EMPID
-------------------- --------------------
dinesh c128
ram a125
sag b128
20. Write a query to retrieve the name and Hire date of every employee who was hired in
2010.
NAME HIREDATE
-------------------- ---------
ragu 10-MAY-10
rama 10-MAY-11
ram 10-JUN-11
dinesh 14-JUN-10
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Ex.No:4(b) DATA QUERY LANGUAGE(SINGLE ROW FUNCTIONS)
Date:
Aim:
To write DQL Commands for single row functions and verify the same.
1. Write a query to display the Name and Designation of all employees in the following
format.
EMPLOYEE DETAILS
DESIGNATION OF “KUMAR” IS MANAGER
SQL> select 'The designation for '||upper(name)||' is '||designation as "Employee Details" from
employee;
Employee Details
----------------------------------------------------------------
The designation for ABC is admin
The designation for RAGU is chairman
The designation for RAMA is ceo
The designation for RAM is vp
The designation for SAG is Manager
The designation for DINESH is manager
6 rows selected.
1. Write a query to display Name,Empid and Designation of all employees who have the
string “ager” contained in the designation starting at the 4th position of designation.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SQL> select name,empid,salary from employee where substr(designation,4)='ager';
2. Write a query to display the empid,name and the numeric position of the letter ‘a’ in the
name for all the employees whose last names end with an ‘h’.
3. Write a query to display the salary value as right justified for a length 10 of all
employees.
RPAD(SALARY)
----------
10000*****
20000*****
4. Write a query to display the salary value as left justified from a length 10 of all employees.
LPAD(SALARY)
----------
*****10000
*****20000
5.Write a query to trim and display the letter ‘H’ from the ‘Hello World’.
TRIM('H'FR
----------
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
ello world
1.Write a query to round the value 45.923 into 45.92,46 and 50.
MONTHS_BETWEEN,ADD_MONTHS,NEXT_DAY,LAST_DAY,ROUND,TRUNCATE
1. Write a query to display system date, label the column “System Date”.
system date
--------------
10-JAN-13
2.Write a query to display the name and number of weeks employed for all employees who
are managers. Label the column “Weeks”.
ID HIREDATE tenure
---------- --------- ----------
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
1 01-OCT-11 15.3108875
2 10-SEP-10 28
3 12-JUN-09 42.9560488
4 20-MAR-10 33.6979842
3.Write a query to display the employee id,hiredate and first Friday after hire date,of all
employees fewer than 20 months.
ID HIREDATE NEXT_DAY
---------- --------- ---------------
1 01-OCT-11 07-OCT-11
4. Write a query to display the employee id,hiredate and last day of the hire month for all
employees fewer than 36 months.
6 rows selected.
1.Write a query to display the system date and date in the following format:
‘DD/MON/YYYY’. Label the column DATE.
SYSDATE DATE
---------------- -----------
17-JAN-13 17/JAN/2013
2.Write a query to display the system date and year to be spelled out. Label the column Year.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SYSDATE YEAR
--------- ------------
17-JAN-13 twenty thirteen
3.Write a query to display the system date,full name of the month,three-letter abbreviation
of the day of week.Label the columns Month and Day.
4.Write a query to display the employee id,hiredate,and month on which the employee
started. Label the column month_hired of all employees whose name is ‘ram’.
5.Write a query to display the name,hiredate,and day of the week on which the employee
started. Label the column DAY. Order the results by the day of the week starting with
Monday.
6 rows selected.
6.Write a query to display the salary of all employees in the following format: Rs.6,000.00
SALARY
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
-------------
$1,00,000.00
$2,00,000.00
$30,000.00
$10,000.00
$10,000.00
$2,00,000.00
6 rows selected.
TO_DATE('
---------
01-JAN-08
NAME TO_CHAR(HIR
-------------------- ------------------
ragu 10-MAY-2010
dinesh 14-JUN-20106 rows
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Ex.No: 5 GROUP FUNCTIONS
Date:
Aim:
To write queries for group functions using ‘group by’ and ‘having’ clause and verify the
same.
2.Write a query to display the sum and average of salary for all employees and verify it.
Label the column as “Sum” and “Average”.
SUM(SALARY) AVG(SALARY)
----------- -----------
20000 10000
3. Write a query to display the sum and average of salary of all “managers” and verify it.
Label the column as “Sum” and “Average”.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SUM(SALARY) AVG(SALARY)
----------- -----------
20000 10000
4. Write a query to display highest and lowest salary for all managers and verify it.
MAX(SALARY) MIN(SALARY)
----------- -----------
50000 10000
5. Write a query to display the name of the employee in an alphabetized list of all employees
and verify it.
MIN(ENAME) MAX(ENAME)
-------------------- --------------------
A C
6. Write a query to display the number of employees in the department CSE and verify it.
COUNT(*)
----------
3
7. Write a query to display the department number and the average salary for each
department and verify it.
DEPTID AVG(SALARY)
------------------------------ -----------
CS001 30000
CS002 10000
8. Write a query to display the number of employees working for each department and verify
it.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
DEPTID COUNT(EID)
--------------------- ----------
CS001 2
CS002 1
9. Write a query to display deptid,designation,and sum of salary for all employees in each
department, designation and verify it.
10. Write a query to display the average salaries of those departments that have an average
salary greater than Rs.8000/- and verify it.
DEPTID AVG(SALARY)
------------------------------ -----------
CS001 30000
11. Write a query to display the designation and total monthy salary for each designation
with a total payroll exceeding Rs 10000. Sort the list by the total monthly salary and verify it.
Label the column as “Designation” and “Payroll”.
Designation payroll
-------------------- ----------
manager 73000
12. Write a query to display the department numbers and maximum salaries for those
departments whose maximum salary is greater than Rs.10000 and verify it.
DEPTID MAX(SALARY)
------------------------------ -----------
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
CS001 50000
CS002 60000
13. Write a query to display the designation and total monthly salary for each designation
with a total payroll exceeding Rs 13000. The result should exclude manufactures and sort the
list by the total monthly salary and verify it. Label the column as “Designation” and
“Payroll”.
Designation Payroll
-------------------- ----------
programmer 60000
manager 66000
14. Write a query to display the maximum average salary and verify it. Label the column as
“Maximum Average Salary” in each department.
SQL> select max(avg(salary)) as "Maximum Average Salary" from employee group by deptid;
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Ex.No: 6 NESTED QUERIES (SUB QUERIES)
Date :
Aim:
To write DQL Commands for nested queries and verify the same.
1. Write a query to display the name of all employees who earn more than C’s Salary and
verify it.
SQL> select ename from employee where salary>(select salary from employee where
ename='C');
ENAME
--------------------
D
2. Write a query to display the name and salary of all employees who are in the same
department as ‘C’ and verify it.
SQL> select ename,salary from employee where deptid=(select deptid from employee
where ename='C');
ENAME SALARY
-------------------- ----------
A 10000
C 50000
E 6000
3. Write a query to display the name and designation of all employees whose designation is
the same as that of employee 002
ENAME DESIGNATION
-------------------- --------------------
B manufacuter
4. Write a query to display the name and designation of all the employees whose designation
is the same as that of employee a124 and whose salary is greater than that of employee a125.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SQL> select name,designation from employee where designation=(select designation
from employee where empid='a124') and salary>(select salary from employee where
empid='a125');
NAME DESIGNATION
-------------------- --------------------
rama ceo
4. Write a query to display the name,empid,and salary of all employees whose salary is equal
to the minimum salary.
5. Write a query to display the name,empid,and salary of all employees who earns more than
average salary. Sort the result in ascending order of salary.
6. Write a query to display all the designation which have a lowest average salary and verify it.
DESIGNATION AVG(SALARY)
-------------------- -----------
manager 10000
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
7. Write a query to display the name,salary,empid of all the employees who earns the same
salary as the minimum salary for each designation and verify it.
SQL> select name,salary,empid from employee where salary IN(select MIN(salary) from
employee group by designation);
6 rows selected.
8. Write a query to display name,empid,salary of all employees who earns the same salary
as the average salary for each department and verify it.
SQL> select name,empid,salary from employee where salary IN(select avg(salary) from
employee group by depid);
9. Write a query to display the empid,name,designation and salary of all employees who are
not managers and whose salary is less than that of any manager’s maximum salary and
verify it. (use ‘any’ keyword).
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
salary from employee where designation='manager') and designation<>'manager';
10. Write a query to display the empid,name,designation and salary of all employees who are
not managers and whose salary is less than that of the manager’s maximum salary and
verify it. (use ‘all’ keyword).
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Ex.No: 7 JOIN QUERIES
Date :
Aim:
To write DQL Commands to join, Restrict and Retrieve information from one or more
tables execute it and verify the same.
6 rows selected.
2. Write a query to display the “dinesh” depid and deptname and verify it.
1. Write a query to display the name,salary and deptname of all employees whose
salary is greater than 10000 and verify it.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SQL> select e.name,e.salary,d.deptname from employee e,department d where e.salary>10000
and e.depid=d.depid;
Selecting Rows using Outer Joins:[ Left Outerjoin,Right Outerjoin using ”+” symbol ]
1. Write a query to display the name, depid and deptname of all employees.Make sure
that employees without department are included as well and verify it.
7 rows selected.
2. Write a query to display the name, salary,depid and deptname of all employees. Make
sure that departments without employees are included as well and verify.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
8 rows selected.
1. Write a query to find and display the name of each employee’s deptname and verify
it.
EmEmployee Details
Ram works in ELECT_ELCTRO Dept
Employee Details
--------------------------------------------------
ragu Works In COMPUTER_SCIENCE
rama Works In COMPUTER_SCIENCE
ram Works In ELECT_ELECTRO
sag Works In ELECT_ELECTRO
dinesh Works In ELECT_COMM
abc Works In ELECT_COMM
6 rows selected.
1. Write a query to display the name and department name of all employees and verify
it.[NOTE: Use CROSS JOIN]
NAME DEPTNAME
-------------------- --------------------
www COMPUTER_SCIENCE
ragu COMPUTER_SCIENCE
rama COMPUTER_SCIENCE
ram COMPUTER_SCIENCE
sag COMPUTER_SCIENCE
dinesh COMPUTER_SCIENCE
abc COMPUTER_SCIENCE
www ELECT_ELECTRO
ragu ELECT_ELECTRO
rama ELECT_ELECTRO
ram ELECT_ELECTRO
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
NAME DEPTNAME
-------------------- --------------------
sag ELECT_ELECTRO
dinesh ELECT_ELECTRO
abc ELECT_ELECTRO
www ELECT_COMM
ragu ELECT_COMM
rama ELECT_COMM
ram ELECT_COMM
sag ELECT_COMM
dinesh ELECT_COMM
abc ELECT_COMM
www CHEMICAL
NAME DEPTNAME
-------------------- --------------------
ragu CHEMICAL
rama CHEMICAL
ram CHEMICAL
sag CHEMICAL
dinesh CHEMICAL
abc CHEMICAL
www MECHANICAL
ragu MECHANICAL
rama MECHANICAL
ram MECHANICAL
sag MECHANICAL
NAME DEPTNAME
-------------------- --------------------
dinesh MECHANICAL
abc MECHANICAL
35 rows selected.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
-------------------- -------------------- --------------- --------------------
a123 ragu CS000 COMPUTER_SCIENCE
a124 rama CS000 COMPUTER_SCIENCE
a125 ram EE000 ELECT_ELECTRO
a128 sag EE000 ELECT_ELECTRO
c128 dinesh EC000 ELECT_COMM
d124 abc EC000 ELECT_COMM
6 rows selected.
1. Write a query to display the empid,name and location of all employees and verify it.
[NOTE: Use JOIN with USING clause]
6 rows selected.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Selecting Rows using Join with ON clause: [like self-join]
6 rows selected.
Selecting Rows using Outer Join with ON Clause: [LEFT OUTER JOIN, RIGHT
OUTER JOIN, FULL OUTER JOIN]
1. Write a query to display the name,depid and department name of all employees.
Make sure that employees without department are included as well and justify it.[NOTE:
Use LEFT OUTER JOIN with ON clause].
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
ragu CS000 COMPUTER_SCIENCE
sag EE000 ELECT_ELECTRO
ram EE000 ELECT_ELECTRO
abc EC000 ELECT_COMM
dinesh EC000 ELECT_COMM
www
7 rows selected.
2. Write a query to display the employee name,depid, deptname of all employees. Make
sure that departments without employees are included as well and verify it. [NOTE: Use
RIGHT OUTER JOIN with ON Clause]
8 rows selected.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Ex.No: 8 VIEWS
Date :
AIM:
To write a DDL command to create views to restrict data access from one or more tables,
execute it and verify the same.
Creating views:
OUTPUT:
View created.
ID NAME SALARY
---------- --------------- ----------
s203 vidhya 29000
2. Create a view vw_sal that contains employee id as “ID” , employee name as “NAME” and
annual salary as “ANNUAL_SAL” for each employee in the department 100.
View created.
ID NAME SALARY
---------- --------------- ----------
s203 vidhya 29000
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Selecting views with group functions:
View created
4. To create a view vw_emp12 that contains all the details of employees whose department no
is 102 and does not allow the department no for those employees to be changed through
views.
SYNTAX:
SQL> create or replace view vw_emp12 as select * from employee where deptid=102 with
check option constraint vw_emp12_ck;
View created.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
5. To create a view to set the salary Rs.15000/- to the employee id ‘a102’ in the
vw_dept_salary and verify the result in vw_emp12_sal and employees table.
1 row updated.
STNTAX:
OUTPUT:
View created.
ID NAME DEPTID
----- ---------- ----------
7782 CLARK 10
7839 KING 10
7934 MILLER 10
7. To display the top three carner names and salaries of employees. Label the rownum as
“RANK”.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
---------- ---------- --------
1 KING 5000
2 SCOTT 3000
3 FORD 3000
Ex.No: 9 (a) PL / SQL PROCEDURES
Date :
PROCEDURE:
declare
gsal number(6);
begin
select salary into gsal from employee where eid='cs06';
dbms_output.put_line(gsal);
dbms_output.put_line('The salary is assigned to gsal');
end;
/
OUTPUT:
SQL> /
2666
The salary is assigned to gsal
2. Write a PL/SQL block to calculate the monthly salary by getting the annual salary at
run time.
PROCEDURE:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
declare
annual_sal number(6);
monthly_sal number(6);
begin
monthly_sal:=&annual_sal/12;
dbms_output.put_line('The monthly salary is:'||monthly_sal);
end;
/
OUTPUT:
3. Write a PL/SQL block to update the salary for the employee “c201” and display it.
PROCEDURE:
declare
e_sal employee.salary%type:=500;
sal number(6);
begin
update employee set salary=salary+e_sal where eid='cs06';
select salary into sal from employee where eid='cs06';
dbms_output.put_line('the salary is updated and the updated value is'||sal);
end;
/
OUTPUT:
SQL> /
PL/SQL procedure successfully completed.
The salary is updated and the updated value is 3166
4. Write a PL/SQL block to retrieve the hired date and employee id for the employee
“cs06” and verify it.
PROCEDURE:
declare
e_start_date emp1.start_date%TYPE;
e_id emp1.emp_id%type;
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
begin
select start_date,emp_id into e_start_date,e_id from emp1 where
emp_id='cs06’;
dbms_output.put_line('the hire date is'||e_start_date);
dbms_output.put_line('the empid is'||e_id);
end;
/
5.Write a PL/SQL block to update the employee id of the employee whose name is ”aaa”
using control structure.
PROCEDURE:
declare
e_name employee.name%type;
begin
select name into e_name from employee where name='aaa';
if e_name='aaa' then
update employee set eid='c205' where name='aaa';
dbms_output.put_line(‘Record has been updated!!!');
end if;
end;
/
OUTPUT:
6. Write a PL/SQL block to update salary of all employees who are managers.
PROCEDURE:
declare
sal employee.salary%type :=1000;
begin
for i in 1..2
loop
update employee set salary=salary+sal where designation='manager';
end loop;
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
end;
/
OUTPUT:
SQL> /
7. Write a PL/SQL block to assign the value 100 to the variable “num” and increase the
“num” variable by 25 till num value gets 250.
PROCEDURE:
declare
num number:=100;
begin
while num<=200 loop
dbms_output.put_line('The value of variable num is');
dbms_output.put_line(TO_CHAR(num));
num:=num+25;
end loop;
end;
/
OUTPUT:
SQL>/
8. Write a PL/SQL block to delete the rows that belong to the designation “Manager”.
PROCEDURE:
begin
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
delete from employee where designation=’Manager’;
dbms_output.put_line('The row with the designation Manager is deleted’);
end;
/
OUTPUT:
SQL>/
9. Write a PL/SQL block to check if the name is “aaa” then set the employee id is “cs06”
and verify it.
PROCEDURE:
declare
v_name employee.name%type;
v_eid employee.eid%type:='cs06';
begin
select name into v_name from employee where name='aaa';
if v_name='aaa' then
goto updation;
end if;
<<updation>>
update employee set eid=v_eid where name=v_name;
OUTPUT:
SQL> /
The record has been updated!!!
PL/SQL procedure successfully completed.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
EID NAME SALARY DESIGNATIO
---- -------------------- ---------- -------------------
cs06 aaa 4433 clerk
cs02 bbb 4957 Technician
EXCEPTION HANDLING:
10. Write a PL/SQL block to check whether the employee whose employee id is
“cs01” is not present then display the error message “The Employee id cs01 is not
available” using predefined exception “NO_DATA_FOUND” and verify it.
PROCEDURE:
declare
v_eid employee.eid%type;
begin
select eid into v_eid from employee where eid='cs10';
exception
when NO_DATA_FOUND then
dbms_output.put_line('The employee id cs10 is not available');
end;
/
OUTPUT:
SQL> /
The employee id cs10 is not available
PL/SQL procedure successfully completed.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Ex.No: 9 (b) STORED PROCEDURES
Date :
1. Create a procedure to display empid, name and salary of all employees record and verify it.
PROCEDURE:
OUTPUT:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
2. Create a procedure update_salary to update the salary column with an increase of 1000
and verify it.
PROCEDURE:
OUTPUT:
SQL> /
Procedure created.
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Ex.No: 10 TRIGGERS
Date :
1. Write a PL/SQL block to create a trigger “T” when inserts,deletes and updates into the
employee table with reference the value of a column before and after the data change
by prefixing it with old or new qualifier.
SQL>
create or replace trigger T after update or delete on employee1 for each row
declare
e_eid varchar2(4);
e_name varchar2(20);
e_salary number(6);
e_designation varchar2(10);
op varchar2(8);
begin
if updating then
op:='update';
end if;
if deleting then
op:='delete';
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
end if;
e_eid:=:new.eid;
e_name:=:new.name;
e_salary:=:new.salary;
e_designation:=:new.designation;
insert into temp1 values(e_eid,e_name,e_salary,e_designation);
end;
/
Trigger created.
Update:
1 row updated.
After Updating:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Ex.No: 11 SIMPLE FORMS IN VISUAL BASIC
Date :
CODING:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
MsgBox "new record added"
rs.Save
End Sub
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
rs.MoveFirst
Wend
Text1.Text = rs.Fields(0).Value
Text2.Text = rs.Fields(1).Value
Text3.Text = rs.Fields(2).Value
Text4.Text = rs.Fields(3).Value
Text5.Text = rs.Fields(4).Value
Text6.Text = rs.Fields(5).Value
Text7.Text = rs.Fields(6).Value
Text8.Text = rs.Fields(7).Value
Text9.Text = rs.Fields(8).Value
Text10.Text = Val(rs.Fields(3).Value) + Val(rs.Fields(4).Value) +
Val(rs.Fields(5).Value) + Val(rs.Fields(6).Value) + Val(rs.Fields(7).Value) +
Val(rs.Fields(8).Value)
End Sub
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Private Sub Command7_Click()
Text1.Text = rs.Fields(0).Value
Text2.Text = rs.Fields(1).Value
Text3.Text = rs.Fields(2).Value
Text4.Text = rs.Fields(3).Value
Text5.Text = rs.Fields(4).Value
Text6.Text = rs.Fields(5).Value
Text7.Text = rs.Fields(6).Value
Text8.Text = rs.Fields(7).Value
Text9.Text = rs.Fields(8).Value
Text10.Text = Val(rs.Fields(3).Value) + Val(rs.Fields(4).Value) +
Val(rs.Fields(5).Value) + Val(rs.Fields(6).Value) + Val(rs.Fields(7).Value) +
Val(rs.Fields(8).Value)
rs.Delete
MsgBox "record deleted"
End Sub
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Text4.Text = rs.Fields(3).Value
Text5.Text = rs.Fields(4).Value
Text6.Text = rs.Fields(5).Value
Text7.Text = rs.Fields(6).Value
Text8.Text = rs.Fields(7).Value
Text9.Text = rs.Fields(8).Value
Text10.Text = rs.Fields(9).Value
End Sub
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
SCREENSHOT:
Last Record:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Previous:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Next:
Clear:
Delete:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Update:
AddNew:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Date :
CODING:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
MsgBox "First Record"
End Sub
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Text2.Text = rs.Fields(1).Value
Text3.Text = rs.Fields(2).Value
Text4.Text = rs.Fields(3).Value
Text5.Text = rs.Fields(4).Value
Text6.Text = rs.Fields(5).Value
Text7.Text = rs.Fields(6).Value
Text8.Text = rs.Fields(7).Value
Text9.Text = rs.Fields(8).Value
Text10.Text = Val(rs.Fields(3).Value) + Val(rs.Fields(4).Value) +
Val(rs.Fields(5).Value) + Val(rs.Fields(6).Value) + Val(rs.Fields(7).Value) +
Val(rs.Fields(8).Value)End Sub
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Text1.Text = rs.Fields(0).Value
Text2.Text = rs.Fields(1).Value
Text3.Text = rs.Fields(2).Value
Text4.Text = rs.Fields(3).Value
Text5.Text = rs.Fields(4).Value
Text6.Text = rs.Fields(5).Value
Text7.Text = rs.Fields(6).Value
Text8.Text = rs.Fields(7).Value
Text9.Text = rs.Fields(8).Value
Text10.Text = Val(rs.Fields(3).Value) + Val(rs.Fields(4).Value) +
Val(rs.Fields(5).Value) + Val(rs.Fields(6).Value) + Val(rs.Fields(7).Value) +
Val(rs.Fields(8).Value)
rs.Delete
MsgBox "record deleted"
End Sub
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Text3.Text = rs.Fields(2).Value
Text4.Text = rs.Fields(3).Value
Text5.Text = rs.Fields(4).Value
Text6.Text = rs.Fields(5).Value
Text7.Text = rs.Fields(6).Value
Text8.Text = rs.Fields(7).Value
Text9.Text = rs.Fields(8).Value
Text10.Text = Val(rs.Fields(3).Value) + Val(rs.Fields(4).Value) +
Val(rs.Fields(5).Value) + Val(rs.Fields(6).Value) + Val(rs.Fields(7).Value) +
Val(rs.Fields(8).Value)
End Sub
First Record:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Last Record:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Previous:
Next:
Clear:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Save:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
Delete:
Update:
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com
http://www.vidyarthiplus.com