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

Pl/sql query(cIA5)

1. Create a PL/SQL block that selects the maximum department number in the DEPARTMENTS table and stores it in a variable. Print the results to the screen. Solution, declare V_max department.deptno%type; begin select max(deptno) into V_max from department; dbms_Output.put_line(V_max); end; / 3. Write a PL/SQL block which accepts employee name, basic and should displayEmployee name, […]

Categories
Uncategorized

PL/SQL Query

1. Create Pl/Sql block to delete the department created. print to the scree the number of rows affected.   set serveroutput on; declare V_count number(3); begin select count(*) into v_count from employee where deptno=(select max(deptno) from department); delete from employee where deptno=(select max(deptno) from department); dbms_output.put_line(‘no of rows deleted:’||V_count); end; / 2.  Write a PL/SQL […]

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. […]