250+ TOP MCQs on Basic SQL Operations and Answers

Database Multiple Choice Questions on “Basic SQL Operations”.

1.

SELECT name ____ instructor name, course id
FROM instructor, teaches
WHERE instructor.ID= teaches.ID;

Which keyword must be used here to rename the field name?
a) From
b) Rename
c) As
d) Join

Answer: c
Clarification: As keyword is used to rename.

2.

SELECT * FROM employee WHERE dept_name="Comp Sci";

In the SQL given above there is an error . Identify the error.
a) Dept_name
b) Employee
c) “Comp Sci”
d) From

Answer: c
Clarification: For any string operations single quoted(‘) must be used to enclose.

3.

SELECT emp_name
FROM department
WHERE dept_name LIKE ’ _____ Computer Science’;

Which one of the following has to be added into the blank to select the dept_name which has Computer Science as its ending string?
a) %
b) _
c) ||
d) $

Answer: a
Clarification: The % character matches any substring.

4. ’_ _ _ ’ matches any string of ______ three characters. ’_ _ _ %’ matches any string of at ______ three characters.
a) Atleast, Exactly
b) Exactly, Atleast
c) Atleast, All
d) All, Exactly

Answer: b
Clarification: None.

5.

SELECT name
FROM instructor
WHERE dept name = ’Physics’
ORDER BY name;

By default, the order by clause lists items in ______ order.
a) Descending
b) Any
c) Same
d) Ascending

Answer: d
Clarification: Specification of descending order is essential but it not for ascending.

6.

SELECT *
FROM instructor
ORDER BY salary ____, name ___;

To display the salary from greater to smaller and name in ascending order which of the following options should be used?
a) Ascending, Descending
b) Asc, Desc
c) Desc, Asc
d) Descending, Ascending

  250+ TOP MCQs on Triggers and Answers

Answer: c
Clarification: None.

7.

SELECT name
FROM instructor
WHERE salary <= 100000 AND salary >= 90000;

This query can be replaced by which of the following ?
a)

SELECT name
FROM instructor
WHERE salary BETWEEN 90000 AND 100000;

b)

SELECT name
FROM employee
WHERE salary <= 90000 AND salary>=100000;

c)

SELECT name
FROM employee
WHERE salary BETWEEN 90000 AND 100000;

d)

SELECT name
FROM instructor
WHERE salary BETWEEN 100000 AND 90000;

Answer: a
Clarification: SQL includes a between comparison operator to simplify where clauses that specify that a value be less than or equal to some value and greater than or equal to some other value.

8.

SELECT instructor.*
FROM instructor, teaches
WHERE instructor.ID= teaches.ID;

This query does which of the following operation?
a) All attributes of instructor and teaches are selected
b) All attributes of instructor are selected on the given condition
c) All attributes of teaches are selected on given condition
d) Only the some attributes from instructed and teaches are selected

Answer: b
Clarification: The asterisk symbol “ * ” can be usedin the select clause to denote “all attributes.”

9. In SQL the spaces at the end of the string are removed by _______ function.
a) Upper
b) String
c) Trim
d) Lower

Answer: c
Clarification: The syntax of trim is Trim(s); where s-string.

10. _____ operator is used for appending two strings.
a) &
b) %
c) ||
d) _

Answer: c
Clarification: || is the concatenation operator.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top