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

Introduction to SQL Questions and Answers

41.

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.

42.

SQL is a data sublanguage.

Answer: A

Correct answer: True

SQL is called a data sublanguage because it handles only the data part of an application. It has no loops, no branching, no input or output beyond the result set, and no way to build an interface.

Those come from a host language - C, Java, Python - in which SQL statements are embedded. It is also declarative: a query states what is wanted and leaves the optimiser to decide how to obtain it. Procedural dialects such as PL/SQL add control flow, but they are extensions built on SQL rather than SQL itself.

Please log in or register to report this question.

43.

A dynamic view is one whose contents materialize when referenced.

Answer: A

Correct answer: True

A dynamic view stores only its defining query. Its contents are computed each time it is referenced, so it always reflects the current state of the underlying tables - which is what "materialize when referenced" describes.

The contrast is with a materialized view, which stores the result physically and must be refreshed to stay current. The trade is the familiar one: the dynamic view is always accurate but pays the query cost on every access, while the materialized view is fast to read and may be stale.

Please log in or register to report this question.

44.

A SELECT statement within another SELECT statement and enclosed in square brackets ([...]) is called a subquery.

Answer: B

Correct answer: False

A subquery is enclosed in ordinary parentheses, not square brackets: WHERE id IN (SELECT id FROM other).

The rest of the sentence is right - a subquery is indeed a SELECT nested inside another statement - so the single wrong detail is the delimiter. Square brackets do appear in SQL Server and Access, but to quote identifiers containing spaces or reserved words, as in [Order Details], which is an unrelated use.

Please log in or register to report this question.

45.

Which of the following do you need to consider when you make a table in SQL?

Answer: D

Correct answer: All of the above.

All three are part of defining a table, and each answers a different question.

Data types fix what may be stored in a column and how much space it takes. Primary keys identify each row uniquely and are what foreign keys elsewhere refer to. Default values decide what a column holds when an INSERT does not mention it, which is how a column can be NOT NULL without every statement supplying it. Constraints and indexes belong to the same design decision.

Please log in or register to report this question.

46.

To remove duplicate rows from the results of an SQL SELECT statement, the ________ qualifier specified must be included.

Answer: C

Correct answer: DISTINCT

SELECT DISTINCT removes duplicate rows from the result, comparing the whole selected row rather than any one column.

Note the cost: the engine must sort or hash the result to identify duplicates, so DISTINCT is not free on a large result set. It is also often a symptom rather than a fix - duplicates in a join usually mean the join condition is incomplete, and correcting that is better than filtering the result. UNIQUE is a constraint on a table, not a query qualifier.

Please log in or register to report this question.

47.

ORDER BY can be combined with the SELECT statements.

Answer: A

Correct answer: True

ORDER BY is a clause of the SELECT statement and comes last, after WHERE, GROUP BY and HAVING - sorting is the final operation applied to what those have produced.

It is worth combining deliberately rather than by habit: without it the result has no defined order at all, because a relation is a set. Any order observed without it is incidental to how the engine happened to read the data, and it can change when the table grows or an index is added.

Please log in or register to report this question.

48.

Data manipulation language (DML) commands are used to define a database, including creating, altering, and dropping tables and establishing constraints.

Answer: B

Correct answer: False

The sentence describes DDL, the Data Definition Language, not DML. Creating, altering and dropping tables and establishing constraints are all structural operations.

DML works with the data inside those structures: SELECT, INSERT, UPDATE and DELETE. The distinction has a practical edge beyond terminology - in most engines DDL statements commit implicitly and cannot be rolled back, while DML statements participate in a transaction.

Please log in or register to report this question.

Answer: B

Correct answer: An exact match is not possible in a SELECT statement.

Wildcards exist for the case where the exact value is unknown or where a pattern rather than a value is wanted - every surname beginning with "Mc", every product code with a particular third character.

Where the value is known exactly, = is both simpler and faster, since an equality test can use an index while a pattern beginning with a wildcard generally cannot. Wildcards belong to LIKE in a WHERE clause, so they have no place in a CREATE statement, which defines structure rather than selecting data.

Please log in or register to report this question.

Answer: D

Correct answer: All of the above.

SQL was designed as a complete language for relational databases, so it covers all three.

The data definition half defines structures - CREATE, ALTER, DROP. The manipulation half queries and changes data - SELECT, INSERT, UPDATE, DELETE. Defining the data structures is what the first half achieves. That combination is what made SQL displace the separate languages the earlier database models required, and it is why one standard covers both syntax and semantics.

Please log in or register to report this question.

Loading…

Other Subjects

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