Batch 1 - Set A-Answer Key
Batch 1 - Set A-Answer Key
Number
2 CO3 H M L - - - - - - - - -
3 CO4 H M L - - - - - - - - -
Answer: B
2 ______ is the standard SQL order of execution
A. from, where, group by, select, order by
B. from, where, select, order by, group by
C. group by, order by. from, where, select 1 2 2 1 1.6.1
D. select, from, where, order by, group by
Answer: A
Answer: C
5 A ___ in a table represents a relationship among a set of values A. row
B. column
C. key D. entity 1 1 2 1 1.6.1
Answer: A
6 ________ returns the smallest integer value that is greater than or equal to a
number.
A.ceil() B. abs()
1 2 4 2 2.7.2
C.pos() D. floor()
Answer: A
7 Transaction Control Language (TCL) Commands are_____
A.Commit,Rollback,Savepoint B.grant,revoke C.Commit,revoke
D.revoke,rollback,savepoint 1 1 4 1 1.6.1
Answer : A
8 ______ Statement is used to remove a SAVEPOINT that you have created.
1 1 4 2 2.6.1
A.Remove Savepoint B.Delete Savepoint
C.Release Savepoint D.Drop Savepoint
Answer: C
9 _____ are automatically created by Oracle whenever an SQL statement is
executed
A.Stored Procedure B.VIEWS C.Implicit Cursors D.Explicit Cursors 1 2 4 2 2.6.1
Answer: C
10 _____ runs the query and display the required result.
A.Execution Engine B. Parser C.Optimizer D.Compiler
1 1 4 2 2.6.1
Answer: A
Register Batch 1 Set - A
Number
14 You are appointed as a Project head and in need of granting database 4 3 4 2 2.6.1
privileges to a user. Write the SQL queries to
I. Grant the user system privilege to log into the “project” database
to give all permissions. (2marks)
GRANT ALL
ON PROJECT
TO OTHER_USER;
cross join:
(OR)
16 b Convert the ER diagram into tabular form using the standard rules and brief them. 12 4 3 3 3.6.2
Rules specification-4 marks
Conversion into tables- 6 marks
III. Write a Query to Display the employees whose salary is more than the minimum
salary of the ‘IT’ department.
select * from employees where salary>(select min(salary) from employees
group by dept having(dept='IT'));
IV. Display employee details who are getting the Second highest Salary in the
Employee table?
SELECT name, MAX(salary) AS salary
FROM employee
WHERE salary IN
(SELECT salary FROM employee MINUS SELECT MAX(salary)
FROM employee);
Or
(OR)
17b I. Create a stored procedure in PL/SQL to display the old salary and new salary 12 4 4 3 3.6.2
when the salary gets updated in the Employee Table. (6 marks)
create or replace trigger salarychanges
before insert or update on employee
for each row
when (new.eno>0)
declare
sal_diff number;
begin
sal_diff:=:new.salary - :old.salary;
dbms_output.put_line(‘Old Salary = ‘|| :old.salary);
dbms_output.put_line(‘New Salary = ‘|| :new.salary);
dbms_output.put_line(‘Salary Difference = ‘|| sal_diff);
end;
/
II. Illustrate and explain the various steps in SQL query processing by Query
optimizer . (6 marks)