Вы находитесь на странице: 1из 5

PL/SQL Test For (Technical consultants)

Duration: 30 mins

1) is an alternate name for a table, view, sequence, procedure,


stored function, package, snapshot or another synonym

a) Synonym
b) Data Block
c) View
d) None of the above

2) Which is the subset of SQL commands used to manipulate Oracle Database


structures including tables

a) Data Manipulation Language (DML)


b) Data Definition Language (DDL)
c) Data Constraint Language (DCL)
d) None of the above

3) When designing a database table, how do you avoid missing column values for
non-primary key columns

a) Use unique constraints


b) Use primary key constraints
c) Use DEFAULT and NOT NULL constraints
d) Use foreign key constraints

4) Examine the structure of the employee table:


Employee_id number primary key
First_name varchar2(25)
Last_name varchar2(25)
Which three statements insert a row into the table (Choose three from the below
given options)
a) Insert into employee values (NULL, John, Smith)
b) Insert into employee (first_name, last_name ) values ( John, Smith)
c) Insert into employee values (1000, John, NULL)
d) Insert into employee (first_name, last_name, employee_id ) values (1000,
John, Smith)
e) Insert into employee (employee_id) values (1000)
f) Insert into employee (employee_id , first_name, last_name) values (1000,
John, )

5) Which of the followings represents the correct syntax for creating a database
table?
a) Create table t_temp_table
(t_num number,
t_name varchar2(25))
b) Create table t_temp_table
(t_num number,
t_name varchar2)
c) Create table t_temp_table
(t_num number,
t_name varchar)
d) Create t_temp_table
(t_num number,
t_name varchar2(25))

6) Which of the followings is not a valid DML command?


a) select * from <table_name> where <table_column> = <value>;
b) select * from <table_name>;
c) select <table_column> from <table_name>;
d) alter <table_name> add <table_column> varchar2(25);

7) What does TRUNCATE statement do:


a) removes the table
b) removes all rows from a table
c) shortens the table to 10 rows
d) removes all columns from the table

8) Which of the followings indicate a valid PL/SQL program block:


a) DECLARE
Variable declaration
BEGIN
Program Execution
EXCEPTION
Exception handling
END;
b) DECLARE
Variable declaration
Program Execution
EXCEPTION
Exception handling
END;
c) DECLARE
Variable declaration
BEGIN
Program Execution
EXCEPTION
Exception handling
;
d)
BEGIN
Program Execution
EXCEPTION
Exception handling
END;

9) The "Persons" table:


P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger

Now we want to select only the distinct values from the column named "City" from
the table above. Which of the followings indicate the correct syntax:

a) select distinct City from Persons;


b) select city from Persons;
c) Select * from persons;
d) Select City from Persons where rownum < 3;

10) Use the table shown in the above question.

Which of the following SQLs indicates the correct syntax for getting the firstname of
the persons who live in City Sandnes

a) select FirstName from Persons and City = Sandnes;


b) select FirstName from Persons City = Sandnes;
c) select FirstName from Persons where City = Sandnes;
d) select * from Persons and City = Sandnes;

11) We have the following "Orders" table:

O_Id OrderDate OrderPrice Customer


1 2008/11/12 1000 Hansen
2 2008/10/23 1600 Nilsen
3 2008/09/02 700 Hansen
4 2008/09/02 300 Hansen
5 2008/08/30 2000 Jensen
6 2008/09/02 100 Nilsen

Now we want to find the largest value of the "OrderPrice" column. Which of the
followings show the correct syntax:

a) SELECT MAX(OrderPrice) AS LargestOrderPrice FROM Orders;


b) SELECT top(OrderPrice) AS LargestOrderPrice FROM Orders;
c) SELECT greatnest(OrderPrice) AS LargestOrderPrice FROM Orders;
d) SELECT largest(OrderPrice) AS LargestOrderPrice FROM Orders;

12) Use the table in Question#11.

Which of the followings indicate the correct syntax for getting to total orderprice for
all the customer orders:
a) select count(OrderPrice) from Orders;
b) select sum(OrderPrice) from Orders;
c) Select total(OrderPrice) from Orders;
d) Select sum(OrderPrice), orderDate from Orders group by OrderDate;

13) Use the table in Question#11.

Which of the following indicate the correct syntax for getting the total OrderPrice for
customer Hansen.

a) select sum(OrderPrice) from Orders where customer = Hansen;


b) select sum(OrderPrice) from Orders where customer = Hansen;
c) select sum(OrderPrice) from Orders and customer = Hansen;
d) select total(OrderPrice) from Orders where customer = Hansen;

14) Use the table in Question#11.

Which of the following indicate the correct syntax for getting the total OrderPrice
date wise:

a) Select sum(OrderPrice), orderDate from Orders group by OrderDate;


b) Select sum(OrderPrice), orderDate from Orders group OrderDate;
c) Select sum(OrderPrice), orderDate from Orders sum by OrderDate;
d) Select sum(OrderPrice), orderDate from Orders order by OrderDate;

15) Use the table in Question#11.

Which of the following indicate the correct syntax for updating the OrderDate to
todays date for all the customer whose OrderPrice is more than 1000:

a) update Orders set OrderDate = Todays date where OrderPrice is greater than
1000;
b) Update OrderDate = systemdate where orderPrice > 1000;
c) Update Orders set OrderDate = sysdate where OrderPrice > 1000;
d) Update Orders set OrderDate = sysdate for OrderPrice > 1000;

16) Write the syntax for creating a database table which has 3 columns, one for
Admission Date, one for Candidates name and one for their annual fee. You may
choose the name of the table as per your wish.
17) Write the syntax for creating a non-unique index on the table created in above
question on Admission date column.

Вам также может понравиться