Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

subquery

Total questions: 26

Worksheet time: 1hrs 22mins

Name
Class
Date
1.

________ is a subquery.

a)

Sub part of a query

b)

Query within the query

c)

Clause

d)

None of the above

2.

Which is/are part of subquery?

a)

Inner query

b)

Outer query

c)

Both Inner query & Outer query

d)

None of the above

3.

Which of the following WHERE clauses statements is valid?

a)

WHERE A2 IN (SELECT B2 ...

b)

WHERE A2 EXISTS (SELECT B2 ...

c)

WHERE EXISTS (SELECT B2 ...

d)

WHERE A2 EXISTS IN (SELECT B2...

4.

True or False? Subqueries in the SELECT clause can be correlated

a)

True

b)

False

5.

Which is/are example of list operator in SQL?

a)

Relation

b)

IN

c)

NOT IN

d)

Both IN & NOT IN

6.

Which is/are part of subquery?

a)

Inner query

b)

Outer query

c)

Both Inner query & Outer query

d)

None of the above

7.

Which of the following keywords are equivalent?

a)

IN, NOT IN

b)

AND, OR

c)

NULL, NOT NULL

d)

ANY, SOME

8.

Which keyword is depends on the existence of the result of the query?

a)

EXISTS

b)

NOT EXISTS

c)

NOT NULL

d)

WHERE

9.

Subquery contains _________ number of query.

a)

One

b)

Two

c)

Zero

d)

Any Number

10.

In subquery, =ANY works as given keyword.

a)

IN

b)

NOT IN

c)

<>

d)

!=

11.

Which of the following operator are equivalent?

a)

<>ANY, <>SOME

b)

!=ANY, !=SOME

c)

=IN,=NOT IN

d)

Both <>ANY,<>SOME & !=ANY,!=SOME

12.

Which keyword is used to join multiple strings into a single string?

a)

Join

b)

Concate

c)

Concat

d)

Concatenate

13.

ANY and SOME are the modified version of _______ operator.

a)

Logical

b)

Comparison

c)

Decision

d)

Aggregate

14.

Berikut merupakan operator pembanding yang biasanya digunakan pada single row subquery, kecuali ...

a)

>

b)

>=

c)

=

d)

>any

15.

Berikut merupakan operator yang biasanya digunakan pada multiple row subquery ...

a)

>

b)

all

c)

>exist

d)

>=

16.

select salary FROM employee where salary < (select salary from employee where dept_id = '01');

Jika subquery menghasilkan lebih dari satu baris data, maka syntax perlu diperbaiki menjadi ...

a)

select salary FROM employee where salary <all (select salary from employee where dept_id = '01');

b)

select salary FROM employee where salary > (select salary from employee where dept_id = '01');

c)

select salary FROM employee where salary <exist (select salary from employee where dept_id = '01');

17.
Which three statements are true regarding subqueries? (Choose two.)      
A. Main query and subquery can get data from different tables
B. Main query and subquery must get data from the same tables
C. Subqueries can contain GROUP BY and ORDER BY clauses  
D. Subqueries can contain ORDER BY but not the GROUP BY clause
E. Only one column or expression can be compared between the main query and subqeury
F. Multiple columns or expressions can be compared between the main query and subquery
a)
A, F
b)
B, F
c)
A, C
d)
D, E
18.

Which three statements are true about multiple-row subqueries?

a)

They can contain a subquery within a subquery.

b)

They can return multiple columns as well as rows.

c)

They cannot contain a subquery within a subquery.

d)

They can return only one column but multiple rows.

e)

They can contain group functions and GROUP BY and HAVING clauses.

19.

Beberapa kegunaan subquery dalam memanipulasi data, kecuali.....

a)

Menerima data dari inline view

b)

Meng-copy data dari satu tabel k3 tabel lain

c)

Menghapus baris dari satu tabel berdasarkan baris dari tabel lain

d)

Menampilkan data secara menyeluruh

e)

Mengambil data dari tabel lain untuk kemudian di update ke tabel yang dituju

20.

Ada berapa tipe subquery? Jelaskan satu per satu!

4 lines
21.

Jelaskan fungsi ANY dan SOME dalam subquery!

4 lines
22.

Tuliskan query untuk menampilkan judul buku dengan pengarang hanya satu orang!

4 lines
23.

Buatlah query untuk menampilkan judul buku, hargabuku dengan pengarang andi setiawan dan hargabuku diatas harga rata-rata

4 lines
24.

Tuliskan Query untuk mendapatkan data buku yang memiliki harga lebih besar dari buku yang jumlah halaman-nya lebih dari 400

4 lines
25.

Tulislah query untuk mencari buku dengan kategori Basis Data dengan menggunakan subquery!

4 lines
26.

Tulilah query untuk mencari buku dengan tanggal terbit diantara tahun 2009 dan 2010 dan kode pengarang = erd:

4 lines