wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Challenge Yourself

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
 In SQL Server an Expression can be used in ......
a)
A) Where Clause
b)
B) Select Clause
c)
C) Having Clause
d)
D) All of Above
2.
Which of the following are TCL commands?
a)
UPDATE and TRUNCATE
b)
SELECT and INSERT
c)
GRANT and REVOKE
d)
ROLLBACK and SAVEPOINT
3.

Return the name and genre of each movie with an imdb rating greater than 5 and year greater than 2012.

a)

SELECT name,genre FROM movies WHERE imdb_rating < 5

AND year < 2012

b)

SELECT FROM movies

WHERE Imdb_rating > 5 AND year > 2012;

c)

SELECT name,genre FROM movies

WHERE Imdb_rating > 5 AND year > 2012;

d)

SELECT name, year FROM movies

WHERE Imdb_rating > 5 year > 2012;

4.

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 all the students whose first name starts with the character ‘A’?

a)

select first_name from students where first_name like ‘A%’;

b)

select first_name from students where first_name like ‘%A’;

c)

select first_name from students where first_name like ‘%A%’;

d)

select first_name from students where first_name like ‘%A%’;

5.

write the query to get the output as shown in the image.

a)

SELECT * FROM movies FROM imdb_rating>=7 LIMIT 8;

b)

SELECT * FROM movies WHERE genre='horror' AND imdb_rating >=7 LIMIT 8;

c)

SELECT * FROM movies WHERE genre='horror' AND imdb_rating >=7;

d)

SELECT * FROM movies WHERE genre='horror' AND imdb_rating >= 7 LIMIT 8; ORDER BY ASC LIMIT 8;

6.

Write a query to get the output as shown

a)

SELECT genre. year

FROM movies

WHERE genre= action ORDER BY

year DESC LIMIT 11;

b)

none of these

c)

SELECT genre, year

FROM movies

WHERE genre ='action'

ORDER BY year DESC LIMIT 11;

d)

SELECT genre, year

FROM movies

WHERE genre="action'

ORDER BY year ASC LIMIT 11:

7.
Which one is correct syntax for Insert Statement?
a)
Insert Columns(Col1, Col2,Col3);
b)
Insert into (Col1, Col2,Col3) VALUES (Val1,Val2,Val3);
c)
Insert Columns(Col1, Col2,Col3) VALUE (Val1, Val2,Val3) Into ;
d)
None of the above.
8.
Duplicate records are fetched from table by using query
a)
SELECT stdid,course,count(*) FROM student GROUP BY stdid,course WHERE count(*)>1;
b)
SELECT stdid,course,count(*) FROM student GROUP BY stdid,course HAVING count(*)<1;
c)
SELECT stdid,course,count(*) FROM student GROUP BY stdid,course;
d)
SELECT stdid,course,count(*) FROM student GROUP BY stdid,course HAVING count(*)>1;
9.

If you are only retrieving one column's values, what keyword can you add before the column name to only return unique values?

a)

UNIQUE

b)

DISTINCT

c)

TOP

d)

NOT NULL

10.
What is the meaning of LIKE '%o%o%' ?
a)
Feature has more than two o's
b)
Feature begins with two o's
c)
Feature has two o's in it ,at any position
d)
Feature ends with two o's
11.

According to ORACLE DBMS 'AND OPERATION' and 'OR OPERATION' precedence issue SELECT 'IS TRUE' AS CONDITION FROM DUAL WHERE (1=1 OR 1=0) AND 0=1 GIVES

a)

IS TRUE

b)

NO ROWS SELECTED

c)

IS FALSE

d)

IS NULL

12.

NULL values are treted as which of the following while sorting

a)

Always as first values(regardless of the sorting order)

b)

Always as last values(regardless of the sorting order)

c)

As high values (higher than any existing value)

d)

All the above

13.

an SQL query to fetch “FIRST_NAME” from emp table in upper case.

a)

select upper FIRST_NAME from emp;

b)

select upper( FIRST_NAME) from emp;

c)

select upper_case (FIRST_NAME) from emp;

d)

select * upper(FIRST_NAME) from emp;

14.

An SQL query to print the FIRST_NAME and LAST_NAME from Worker table into a single column COMPLETE_NAME. A hyphen char should separate them.

a)

Select ( FIRST_NAME||'-'|| LAST_NAME) AS COMPLETE_NAME from Worker;

b)

Select (FIRST_NAME '-' LAST_NAME) AS complete_name from Worker;

c)

Select (FIRST_NAME||'-'|| LAST_NAME) AS complete_name from Worker;

d)

Select (FIRST_NAME|'-'| LAST_NAME) AS COMPLETE_NAME from Worker;

15.

An SQL query to show the second highest salary from a table.

a)

Select max(Salary) from Worker where Salary not in (Select max(Salary) from Worker);

b)

Select max(Salary) from Worker where Salary not in (max(Salary));

c)

Select max(Salary) from Worker ;

d)

Select max(Salary) from Worker where Salary not in =Select max(Salary) from Worker)

16.

An SQL query to fetch departments along with the total salaries paid for each of them.

a)

SELECT department, sum(salary) from worker group by Salary;

b)

SELECT (salary) from worker group by DEPARTMENT

c)

SELECT department, (salary) from worker group by DEPARTMENT

d)

SELECT department, sum(Salary) from worker ;

17.

Which operator is used to match text while search?

a)

INTO

b)

IN

c)

SEARCH

d)

LIKE

18.

In Oracle to fetch a TOP N number or X percent records from a table we use

a)

TOP

b)

LIMIT Clause

c)

ROWNUM Clause

d)

None of these

19.

What is a field?

a)

A collection of information

b)

A single item of information

c)

A list of information

d)

A group of records

20.

Using which word allows you to specify that more than one condition must be met in a query?

a)

Also

b)

And

c)

Or

d)

Where