Machine-translated by Google. Questions are authored in English.
Top

Introduction to SQL Questions and Answers

91.

The keyword LIKE can be used in a WHERE clause to refer to a range of values.

Answer: B

Correct answer: False

LIKE matches text patterns using % and _; it has no notion of a range and cannot express "between these two values".

Ranges are BETWEEN's work, or the comparison operators >= and <=. The two constructs also behave differently against an index: an equality or range test can use one, while a LIKE pattern beginning with a wildcard cannot, since there is no prefix to seek on.

Please log in or register to report this question.

92.

The SQL statement: SELECT Name, COUNT(*) FROM NAME_TABLE; counts the number of name rows and displays this total in a table with a single row and a single column.

Answer: B

Correct answer: False

The statement mixes an ungrouped column with an aggregate. Name has one value per row while COUNT(*) has one value for the whole table, and there is no rule for pairing them.

Standard SQL rejects the query, and so do most engines in their default configuration. Either drop the column, giving SELECT COUNT(*) FROM NAME_TABLE and a single row, or add GROUP BY Name, giving one row per distinct name with its own count - but not the single row the statement describes.

Please log in or register to report this question.

93.

The SQL keyword GROUP BY instructs the DBMS to group together those rows that have the same value in a column.

Answer: A

Correct answer: True

GROUP BY collects rows sharing the same value in the named column or columns into a single group, and the aggregate functions in the SELECT list are then computed once per group.

Two rules follow. Every column in the SELECT list must either appear in the GROUP BY or be inside an aggregate, since anything else has no single value per group. And filtering on the aggregates belongs in HAVING, which runs after the grouping, rather than in WHERE, which runs before it.

Please log in or register to report this question.

94.

The wildcard asterisk (*) is the SQL-92 standard for indicating "any sequence of characters."

Answer: B

Correct answer: False

The SQL-92 wildcard for "any sequence of characters" is the percent sign %, used with LIKE, and the underscore _ matches exactly one character.

The asterisk does appear in SQL, but in the SELECT list, where SELECT * means all columns - a different construct entirely. It serves as a wildcard character in Microsoft Access, which departs from the standard, and a pattern written for Access silently returns nothing elsewhere because * is then matched literally.

Please log in or register to report this question.

95.

Microsoft Access has become ubiquitous, and being able to program in Access is a critical skill.

Answer: B

Correct answer: False

Access is one product among several, and by no means the dominant one. Server-class systems - Oracle, SQL Server, PostgreSQL, MySQL - carry the great majority of organisational data, and Access is a desktop tool suited to small single-user or workgroup databases.

What is genuinely critical is SQL itself, since it is standard and transfers between products. Access programming means VBA and its own object model, which are specific to it and do not carry over.

Please log in or register to report this question.

96.

In SQL, the WHERE clause filters rows before grouping while HAVING filters after grouping.

Answer: B

Correct answer: True

WHERE is applied to individual rows before GROUP BY forms the groups, so it cannot refer to an aggregate. HAVING is applied to the groups afterwards, which is why a condition such as COUNT(*) greater than 5 must go there.

Please log in or register to report this question.

97.

SQL provides five built-in functions: COUNT, SUM, AVG, MAX, MIN.

Answer: A

Correct answer: True

COUNT, SUM, AVG, MAX and MIN are the five aggregate functions defined by the standard, each reducing a set of rows to a single value.

They are typically used with GROUP BY, which computes one value per group, and filtered with HAVING. All five ignore nulls, with the exception of COUNT(*), which counts rows whatever they contain. Individual products add many more - standard deviation, string aggregation, statistical functions - but those five are the standard set.

Please log in or register to report this question.

98.

The keyword BETWEEN can be used in a WHERE clause to refer to a range of values.

Answer: A

Correct answer: True

BETWEEN tests membership of a range and is inclusive at both ends: WHERE age BETWEEN 18 AND 65 is equivalent to age >= 18 AND age <= 65.

The inclusivity is the detail most often overlooked, particularly with timestamps, where BETWEEN '2026-01-01' AND '2026-01-31' excludes anything recorded later on the final day. The lower bound must be written first; giving them in the wrong order returns no rows rather than an error.

Please log in or register to report this question.

99.

To establish a range of values, < and > can be used.

Answer: A

Correct answer: True

The comparison operators establish a range directly: WHERE salary > 30000 AND salary < 50000 bounds the values on both sides.

They differ from BETWEEN in one respect that matters. BETWEEN is inclusive of both endpoints, whereas < and > are strict, so the two forms are not interchangeable at the boundaries - >= AND <= is what matches BETWEEN. Using the operators explicitly is the clearer choice when one end should be included and the other not.

Please log in or register to report this question.

100.

If you are going to use a combination of three or more AND and OR conditions, it is often easier to use the IN and NOT IN operators.

Answer: A

Correct answer: True

A chain of OR conditions on one column collapses into a single IN: state = 'VA' OR state = 'MD' OR state = 'DC' becomes state IN ('VA','MD','DC'), and its negation becomes NOT IN.

The gain is not only brevity. Long AND and OR chains require careful parenthesising, since AND binds more tightly than OR and a missing bracket changes the meaning without any error. IN removes that hazard by expressing the whole set at once.

Please log in or register to report this question.

Loading…
Tags: Introduction to SQL Questions and Answers || Introduction to SQL MCQ Questions and Answers || Introduction to SQL GK Questions and Answers || Introduction to SQL GK MCQ Questions || Introduction to SQL Multiple Choice Questions and Answers || Introduction to SQL GK || GK on Introduction to SQL || Database Questions and Answers || Database MCQ Questions and Answers || Database GK Questions and Answers || GK on Database