Sie sind auf Seite 1von 8

Which of the following is not true about multiple-row subqueries?

Multiple row subqueries return multiple rows from the outer SELECT statement.
Multiple row subqueries return multiple rows from the inner SELECT statement.
Multiple row subqueries use multiple-row comparison operators.
All of the above.

Consider the following schema −


STUDENTS(student_code, first_name, last_name, email,
phone_no, date_of_birth, honours_subject,
percentage_of_marks);
Which of the following query would display names of all the students whose honours subject is
English, or honours subject is Spanish and percentage of marks more than 80?

select first_name, last name from students where (honours_subject = “English” or


honours_subject = “Spanish” ) and percentage_of_marks > 80;
select first_name, last name from students where honours_subject = “English” or
honours_subject = “Spanish” and percentage_of_marks > 80;
select first_name, last name from students where honours_subject = “English” and
honours_subject = “Spanish” or percentage_of_marks > 80;
select first_name, last name from students where (honours_subject = “English”) and
honours_subject = “Spanish” and percentage_of_marks > 80;

Which of the following code would allocate the privileges of creating tables and view to
the role named student_admin?

grant create table, create view to student_admin;


grant to student_admin create table, create view;
grant role student_admin create table, create view;
None of the above.

Which of the following statements allows William to change his database user account
password to bill?

create user william identified by bill;


alter user william identified by bill
create user william password bill;
alter user william password bill;

Which of the following query will result in an error?

select dept_id, avg(salary) from employees group by dept_id;


select avg(salary) from employees group by dept_id;
select dept_id, job_id, avg(salary) from employees group by dept_id, job_id;
select dept_id, count(name) from employees;

Which of the following is not true about database synonyms?

Synonyms are used for shortening lengthy object names.


A synonym is just an alternative name.
Synonyms can be created for tables, views, sequences, procedures and other database
objects.
None of the above.

What is returned by INSTR(‘PMFTCI LMS’, ‘L’)?


8
7
PMFTCI
LMS

You want to calculate the sum of commissions earned by the employees of an


organisation. If an employee doesn’t receive any commission, it should be calculated as
zero. Which will be the right query to achieve this?

select sum(nvl(commission, 0)) from employees;


select sum(commission, 0) from employees;
select nvl(sum(commission), 0) from employees;
None of the above.
Which of the following is not true about a FOREIGN KEY constraint?

It is a referential integrity constraint.


It establishes a relationship between a primary key or a unique key in the same table or
a different table.
A foreign key value cannot be null.
A foreign key value must match an existing value in the parent table.

You want to calculate the tax payable by the employees of an organization. If the
employee gets a commission, then the tax would be calculated on commission plus
salary, if the employee does not get any commission, then the tax would be calculated
on salary only. Which function should you use for calculating tax?

NVL
NVL2
NULLIF
COALESCE

Which of the following code would create a role named student_admin?

CREATE student_admin;
GRANT student_admin;
CREATE ROLE student_admin;
ROLE student_admin;

Which of the following is not true about the MAX and MIN functions?

Both can be used for any data type.


MAX returns the maximum value.
MIN returns the minimum value.
All are true.

Consider the following schema −


HONOURS_SUBJECT(subject_code, subject_name, department_head);
LOCATIONS(subject_code, department_name, location_id, city);
Select the right query for retrieving records from the tables HONOURS_SUBJECT and
LOCATIONS with a left outer join

select h.subject_name, l.department_name, h.department_head, l.city from


honours_subject h left outer join location l on(h.subject_code = l.subject_code);
select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h
left outer join location l on(subject_code);
select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h
left join location l on(h.subject_code = l.subject_code);
None of the above.

Which of the following is not a developer’s privilege?

CREATE USER
CREATE TABLE
CREATE VIEW
CREATE SEQUENCE

Which of the following is not true about SQL statements?

SQL statements are not case sensitive.


SQL statements can be written on one or more lines.
Keywords cannot be split across lines.
Clauses must be written on separate lines.

Which of the following code will remove all the rows from the table LOCATIONS?

DROP TABLE locations;


DELETE TABLE locations;
TRUNCATE TABLE locations;
None of the above.

Which of the following is not true about a sequence?


They are used for generating sequential numbers.
Sequences are created by the CREATE SEQUENCE statement.
You cannot modify a sequence.
None of the above.

Which of the following is true about SQL joins?

The join condition is not separated from other search conditions in a query.
The ON clause makes code difficult to understand.
The join condition for natural join is basically an equijoin of all columns with same name.
None of the above.

Which of the following is true about a role?

A role is a named group of related privileges.


It can be it can be created and assigned to a user.
It can be revoked from a user.
All of the above.

Which of the following is not true about constraints?

A NOT NULL constraint specifies that the column cannot have a null value.
A UNIQUE constraint specifies that a column or a combination of column must have unique
values for all rows.
A PRIMARY KEY is same as UNIQUE.
A FOREIGN KEY enforces a foreign key relationship between a column and a referenced
table.

Consider the following schema −


STUDENTS(student_code, first_name, last_name, email,
phone_no, date_of_birth, honours_subject,
percentage_of_marks);
Which of the following query would display the full name of a student, with a column
heading "Name"
select first_name, last_name as “Name” from students;
select Name from students;
select first_name || last_name as “Name” from students;
select first_name, last_name from students;

Consider the following schema −


STUDENTS(student_code, first_name, last_name, email,
phone_no, date_of_birth, honours_subject,
percentage_of_marks);
Which of the following query would display names and percentage of marks of all
students sorted by honours subject, and then order by percentage of marks?

select first_name, last name, honours_subject, percentage_of_marks from students


order by honours_subject, percentage_of_marks;
select first_name, last name, honours_subject, percentage_of_marks order by
percentage_of_marks desc from students;
select first_name, last name, percentage_of_marks from students order by
percentage_of_marks desc;
select first_name, last name, percentage_of_marks from students order by
percentage_of_marks, honours_subject;

Which of the following is not true about Natural Joins?

Natural join is based on all columns in two tables having same name
It selects rows from the two tables having different values in the matched columns.
If columns having same names have different data types, it returns error.
None of the above.

Which of the following functions can be used on both numeric as well as non-numeric
data?

COUNT
AVG
STDDEV
VARIANCE
Which of the following is true about subqueries?

Subqueries could be used for Top-N analysis.


Subqueries can be of two types – single-row subquery and multiple-row subquery.
The outer and inner queries can get data from different tables.
All of the above.

Which of the following is not true about multiple-row subqueries?

Multiple row subqueries return multiple rows from the outer SELECT statement.
Multiple row subqueries return multiple rows from the inner SELECT statement.
Multiple row subqueries use multiple-row comparison operators.
All of the above.

Consider the following schema −


LOCATIONS(subject_code, department_name, location_id, city);
Which code snippet will alter the table LOCATIONS and change the datatype of the
column CITY to varchar2(30)?

ALTER TABLE locations MODIFY COLUMN (city varchar2(30));


MODIFY TABLE locations ADD (city varchar2(30));
ALTER TABLE locations MODIFY (city varchar2(30));
None of the above.

Which of the following is not true about simple views?

They derive data from one table.


They contain no functions or grouping.
You cannot perform DML operations through a simple view.
All of the above are true.
Which of the following code will create an index named stu_marks_ind on the columns
student_code and percentage_of_marks of the STUDENTS table?

It’s not possible to create an index on two columns.


create index stu_marks_ind from students(student_code, percentage_of_marks);
create index stu_marks_ind on students(student_code, percentage_of_marks);
create index stu_marks_ind (student_code, percentage_of_marks) on students;

Which of the following is true about a role?

A role is a named group of related privileges.


It can be it can be created and assigned to a user.
It can be revoked from a user.
All of the above.

Das könnte Ihnen auch gefallen