LabManual - Gopala Krishna
LabManual - Gopala Krishna
Prepared by:
Prof. Gopala Krishna P
Assistant Professor
Department of Cyber Security
CIT-NC
[ DEPARTMENT OF CYBER] 1
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
Experiments
1. Create a table called Employee & execute the following.
Employee(EMPNO,ENAME,JOB, MANAGER_NO, SAL,
COMMISSION)
a) Create a user and grant all permissions to the user.
b) Insert any three records in the employee table containing
attributes EMPNO,ENAME JOB, MANAGER_NO, SAL,
COMMISSION and use rollback. Check the result.
c) Add primary key constraint and not null constraint to the
employee table.
d) Insert null values to the employee table and verify the
result.
2. Create a table called Employee that contain attributes
EMPNO,ENAME,JOB, MGR,SAL &
execute the following.
a) Add a column commission with domain to the
Employeetable.
b) Insert any five records into the table.
c) Update the column details of job
d) Rename the column of Employ table using alter command.
e) Delete the employee whose Empno is 105.
3. Queries using aggregate functions
(COUNT,AVG,MIN,MAX,SUM),Group by, Order by.
Employee(E_id, E_name, Age, Salary)
a) Create Employee table containing all Records E_id,
E_name, Age, Salary.
b) Count number of employee names from employeetable
c) Find the Maximum age from employee table.
d) Find the Minimum age from employeetable.
e) Find salaries of employee in Ascending Order.
f) Find grouped salaries of employees.
4. Create a row level trigger for the customers table that would fire
for INSERT or UPDATE or DELETE operations performed on
the CUSTOMERS table. This trigger will display the salary
difference between the old & new Salary.
CUSTOMERS(ID,NAME,AGE,ADDRESS,SALARY)
[ DEPARTMENT OF CYBER] 2
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
5. Create cursor for Employee table & extract the values from the
table. Declare the variables, Open the cursor & extract the values
from the cursor. Close the cursor. Employee(E_id, E_name,
Age, Salary)
6. Write a PL/SQL block of code using parameterized Cursor, that
will merge the data available in the newly created table
N_RollCall with the data available in the table O_RollCall. If the
data in the first table already exist in the second table then that
data should be skipped.
7. Install an Open Source NoSQL Database MangoDB & perform
basic CRUD (Create, Read, Update & Delete) operations.
Execute MangoDB basic Queries using CRUD operations.
[ DEPARTMENT OF CYBER] 3
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
-- Step 2: Connect as the new user and create the Employee table
CONNECT employee_user/password123;
CREATE TABLE Employee (
EMPNO NUMBER,
ENAME VARCHAR2(50),
JOB VARCHAR2(50),
MANAGER_NO NUMBER,
SAL NUMBER,
COMMISSION NUMBER
);
[ DEPARTMENT OF CYBER] 4
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 5
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
OUTPUT:
[ DEPARTMENT OF CYBER] 6
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 7
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 8
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 9
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
OUTPUT:
[ DEPARTMENT OF CYBER] 10
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 11
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 12
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 13
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
OUTPUT:
[ DEPARTMENT OF CYBER] 14
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 15
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 16
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 17
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
COMMIT;
[ DEPARTMENT OF CYBER] 18
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 19
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 20
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 21
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 22
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 23
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
END;
END LOOP;
[ DEPARTMENT OF CYBER] 24
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CYBER] 25
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CSE ] 27
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
[ DEPARTMENT OF CSE ] 28
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
OUTPUT:
Basic commands
Create/Insert commands
[ DEPARTMENT OF CSE ] 29
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
Read Commands:
Update commands:
[ DEPARTMENT OF CSE ] 30
Cambridge Institute of Technology Lab Manual Database Management System
North Campus [BCS403]
Delete commands:
[ DEPARTMENT OF CSE ] 31