You are on page 1of 5

The following are components of a database except ________ .

A. user data
B. metadata
C. reports
D. indexes
Answer: Option C

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
View Answer
Answer: c
Explanation: As keyword is used to rename.
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
View Answer
Answer: c
Explanation: For any string operations single quoted(‘) must be used to enclose.

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) $
View Answer
Answer: a
Explanation: The % character matches any substring.
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
View Answer
Answer: d
Explanation: Specification of descending order is essential but it not for ascending.

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
View Answer
Answer: c

_____ operator is used for appending two strings.


a) &
b) %
c) ||
d) _
View Answer
Answer: c
Explanation: || is the concatenation operator.
SELECT ________ dept_name
FROM instructor;

a) All
b) From
c) Distinct
d) Name
View Answer
Answer: c
Explanation: Distinct keyword selects only the entries that are unique.
The ________ clause is used to list the attributes desired in the result of a query.
a) Where
b) Select
c) From
d) Distinct
View Answer
Answer: b
INSERT INTO employee _____ (1002,Joey,2000);

a) Table
b) Values
c) Relation
d) Field
View Answer
Answer: b
Explanation: Value keyword has to be used to insert the values into the table.

. The _____________ is essentially used to search for patterns in target string.


a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
View Answer
Answer: a
Explanation: Like predicate matches the string in the given pattern.

 _________ joins are SQL server default


a) Outer
b) Inner
c) Equi
d) None of the mentioned
View Answer
Answer: b
Explanation: It is optional to give the inner keyword with the join as it is default.

 _____ clause is an additional filter that is applied to the result.


a) Select
b) Group-by
c) Having
d) Order by
View Answer
Answer: c
Explanation: Having is used to provide additional aggregate filtration to the query.

9. _________ joins are SQL server default


The number of attributes in relation is called as its
a) Cardinality
b) Degree
c) Tuples
d) Entity
View Answer
Answer: b
Explanation: None.

The union operation automatically __________ unlike the select clause.


a) Adds tuples
b) Eliminates unique tuples
c) Adds common tuples
d) Eliminates duplicate
View Answer
Answer: d

In SQL, which command(s) is(are) used to change a table's


storage characteristics?
A. ALTER TABLE
B. MODIFY TABLE
C. CHANGE TABLE
D. All of the above
Answer: Option A

What operator tests column for the absence of data?


A. EXISTS operator
B. NOT operator
C. IS NULL operator
D. None of these
Answer: Option C
The FROM SQL clause is used to...
A. specify what table we are selecting or deleting data FROM
B. specify range for search condition
C. specify search condition
D. None of these
Answer: Option A
Which SQL keyword is used to retrieve a maximum value?
A. TOP
B. MOST
C. UPPER
D. MAX
Answer: Option D

Which of the following is a SQL aggregate function?


A. LEFT
B. AVG
C. JOIN
D. LEN
Answer: Option B
SQL has several arithmetic functions to do math on the numbers, such as summing up, taking
average, retrieved from the column. They are:
AVG():- Average of the column
COUNT():- Number of records
MAX():- maximum of the column
MIN():- minimum of the column
SUM():- Sum of the column

Which of the following group functions ignore NULL values?


A. MAX
B. COUNT
C. SUM
D. All of the above
Answer: Option D

You might also like