Categories
Uncategorized

Trigger (cIA 8)

Write an after statement-level trigger. Whenever an insert, update, or delete operation occurs on the EMP table, a row is added to the employee audit table recording the date, user, and action. create or replace trigger audit1_trigger after insert or delete or update on emp declare v_action varchar2(18); begin if inserting then v_action:=’added emp’; elsif […]

Categories
Uncategorized

Cursor(cIA 6)

1. Using Cursors Write a program that gives all employees in department MCA and 15% pay increase. Display a message displaying how many Employees were awarded the increase. declare v_name employee.name%type; vdname department.dname%type; vsal employee.salary%type; vdno employee.deptno%type; count number; cursor empcursor2 is select name,dname,salary,e.deptno from employee e,department where e.deptno=department.deptno and dname=’Research’; begin open empcursor2; loop […]

Categories
Uncategorized

DBMS Query

Ex: 5.2 Ramakrishna, gehrke Consider the following schema: Suppliers(sid: integer, sname: string, address: string) Parts(pid: integer, pname: string, color: string) Catalog(sid: integer, pid: integer, cost: real) The Catalog relation lists the prices charged for parts by Suppliers. Write the following queries in SQL: Find the pnames of parts for which there is some supplier.              […]

Categories
Uncategorized

Query

Ex 5.1 ( Ramakrishnan and Gehrke) Consider the following relations: Student(snum: integer, sname: string, major: string, level: string, age: integer) Class(name: string, meets at: string, room: string, fid: integer) Enrolled(snum: integer, cname: string) Faculty(fid: integer, fname: string, deptid: integer) Write the following queries in SQL. No duplicates should be printed in any of the answers. […]

Categories
Uncategorized

Query

Ex 5.1 ( Ramakrishnan and Gehrke) Consider the following relations: Student(snum: integer, sname: string, major: string, level: string, age: integer) Class(name: string, meets at: string, room: string, fid: integer) Enrolled(snum: integer, cname: string) Faculty(fid: integer, fname: string, deptid: integer) Write the following queries in SQL. No duplicates should be printed in any of the answers. […]