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

Introduction to SQL Questions and Answers

41.

The condition in a WHERE clause can refer to only one value.

Answer: B

Correct answer: False

A WHERE condition can refer to as many values as needed. IN takes a list, BETWEEN takes two bounds, and AND and OR combine any number of conditions across any number of columns.

A condition may also refer to values it does not name, through a subquery: WHERE id IN (SELECT id FROM other) tests against a whole set computed at run time. The single-value comparison is merely the simplest case, not the limit of the clause.

Please log in or register to report this question.

42.

You can add a row using SQL in a database with which of the following?

Answer: C

Correct answer: INSERT

INSERT is the SQL statement that adds rows to a table, in the form INSERT INTO table (col1, col2) VALUES (v1, v2), or with a SELECT in place of VALUES to add many rows from a query.

The distractors trade on the difference between data and structure. CREATE belongs to the data definition language and makes the table itself, not a row in it; ADD appears only as part of ALTER TABLE ... ADD COLUMN, which again changes structure; and MAKE is not SQL at all.

Please log in or register to report this question.

43.

To remove a relation from an SQL database, we use the ______ command.

Answer: D

Correct answer: Drop table

DROP TABLE removes the relation entirely - its rows, its definition, its indexes and its constraints - leaving no object of that name.

DELETE is the near-miss and the distinction is important: it removes rows but keeps the table, so an empty relation remains ready for new data. DROP is a DDL statement and DELETE a DML one. Purge and Remove are not standard SQL for this purpose.

Please log in or register to report this question.

Answer: D

Correct answer: question mark (?); asterisk (*)

Microsoft Access departs from the SQL standard here. It uses * for any sequence of characters and ? for exactly one - the same characters MS-DOS used for file matching.

Standard SQL uses % and _ for those two roles. The difference is a practical trap: a query written in Access and moved to another engine does not fail with an error but simply returns nothing, because * is then matched as a literal asterisk. Access in ANSI-92 mode accepts the standard characters instead.

Please log in or register to report this question.

45.

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.

46.

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.

47.

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.

48.

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.

49.

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.

50.

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.

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