InfyTQ Subquery Quiz 2

Question 1

Time: 00:00:00
All aggregate functions except _____ ignore null values in their input collection.

Count(attribute)

Count(attribute)

Count(*)

Count(*)

Avg

Avg

 Sum

 Sum

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
 A Boolean data type that can take values true, false, and________

1  

1  

Null

Null

Unknown

Unknown

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
The ____ connective tests for set membership, where the set is a collection of values produced by a select clause. The ____ connective tests for the absence of set membership.

or,in

or,in

Not in,in

Not in,in

in,Not in

in,Not in

in,or

in,or

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Which of the following should be used to find all the courses taught in the Fall 2009 semester but not in the Spring 2010 semester .

SELECT DISTINCT course id FROM SECTION WHERE semester = ’Fall’ AND YEAR= 2009 AND course id NOT IN (SELECT course id FROM SECTION WHERE semester = ’Spring’ AND YEAR= 2010);

SELECT DISTINCT course id FROM SECTION WHERE semester = ’Fall’ AND YEAR= 2009 AND course id NOT IN (SELECT course id FROM SECTION WHERE semester = ’Spring’ AND YEAR= 2010);

SELECT DISTINCT course_id FROM instructor WHERE name NOT IN (’Fall’, ’Spring’);

SELECT DISTINCT course_id FROM instructor WHERE name NOT IN (’Fall’, ’Spring’);

(SELECT course id FROM SECTION WHERE semester = ’Spring’ AND YEAR= 2010)

(SELECT course id FROM SECTION WHERE semester = ’Spring’ AND YEAR= 2010)

SELECT COUNT (DISTINCT ID) FROM takes WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id, semester, YEAR FROM teaches WHERE teaches.ID= 10101

SELECT COUNT (DISTINCT ID) FROM takes WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id, semester, YEAR FROM teaches WHERE teaches.ID= 10101

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
The phrase “greater than at least one” is represented in SQL by _____

< all

< all

< some

< some

> all

> all

> some

> some

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
 Which of the following is used to find all courses taught in both the Fall 2009 semester and in the Spring 2010 semester .

( SELECT course id FROM SECTION AS S WHERE semester = ’Fall’ AND YEAR= 2009 AND EXISTS (SELECT * FROM SECTION AS T WHERE semester = ’Spring’ AND YEAR= 2010 AND S.course id= T.course id);

( SELECT course id FROM SECTION AS S WHERE semester = ’Fall’ AND YEAR= 2009 AND EXISTS (SELECT * FROM SECTION AS T WHERE semester = ’Spring’ AND YEAR= 2010 AND S.course id= T.course id);

( SELECT name FROM instructor WHERE salary > SOME (SELECT salary FROM instructor WHERE dept name = ’Biology’);

( SELECT name FROM instructor WHERE salary > SOME (SELECT salary FROM instructor WHERE dept name = ’Biology’);

( SELECT COUNT (DISTINCT ID) FROM takes WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id, semester, YEAR FROM teaches WHERE teaches.ID= 10101);

( SELECT COUNT (DISTINCT ID) FROM takes WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id, semester, YEAR FROM teaches WHERE teaches.ID= 10101);

(SELECT course id FROM SECTION WHERE semester = ’Spring’ AND YEAR= 2010)

(SELECT course id FROM SECTION WHERE semester = ’Spring’ AND YEAR= 2010)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
We can test for the nonexistence of tuples in a subquery by using the _____ construct.

Not exist

Not exist

Not exists

Not exists

Exist

Exist

Exsits

Exsits

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Consider a Patient table with attributes patientid (primary key), patientname, city, dateofbirth and phone. Except patientid no columns are unique. The table has three indexes as follows:

IDX1 - patientid

IDX2 - patientname, dateofbirth

IDX3 - dateofbirth, phone

Which of the following queries will result in INDEX UNIQUE SCAN ?

WHERE city <> ‘Mumbai’ AND dateofbirth > ‘30-Mar-1995'

WHERE city <> ‘Mumbai’ AND dateofbirth > ‘30-Mar-1995'

WHERE patientid = ‘P1007’ AND dateofbirth = ‘30-Mar-1995’

WHERE patientid = ‘P1007’ AND dateofbirth = ‘30-Mar-1995’

WHERE patientname = ‘Sam’ AND dateofbirtrh = ‘30-Mar-1995’

WHERE patientname = ‘Sam’ AND dateofbirtrh = ‘30-Mar-1995’

  1. WHERE patientname LIKE ‘R%’

  1. WHERE patientname LIKE ‘R%’

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Which one of the following given statements possibly contains the error?

select * from emp where empid = 10003;

select * from emp where empid = 10003;

select empid from emp where empid = 10006;

select empid from emp where empid = 10006;

select empid from emp;

select empid from emp;

  1. select empid where empid = 1009 and Lastname = 'GELLER';

  1. select empid where empid = 1009 and Lastname = 'GELLER';

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
SELECT dept_name, ID, avg (salary)

FROM instructor

GROUP BY dept_name;

This statement IS erroneous because

Avg(salary) should not be selected

Avg(salary) should not be selected

Dept_id should not be used in group by clause

Dept_id should not be used in group by clause

Misplaced group by clause

Misplaced group by clause

Group by clause is not valid in this query

Group by clause is not valid in this query

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%