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

Introduction to SQL Questions and Answers

61.

The basic data type char(n) is a _____ length character string and varchar(n) is _____ length character.

Answer: C

Correct answer: Fixed, variable

char(n) always occupies \( n \) characters: a shorter value is padded with trailing spaces to fill the width. varchar(n) stores only the characters actually supplied, up to a maximum of \( n \).

The trade is space against predictability. char wastes space on short values but has a fixed offset, which can make row access marginally faster; varchar stores just what is needed at the cost of a length prefix. The practical rule is char for genuinely fixed-width codes and varchar for anything that varies.

Please log in or register to report this question.

Answer: A

Correct answer: for ranges.

BETWEEN tests whether a value falls within a range, and the range is inclusive at both ends: WHERE age BETWEEN 18 AND 65 is the same as age >= 18 AND age <= 65.

That inclusivity is the point most often got wrong, particularly with dates, where BETWEEN '2026-01-01' AND '2026-01-31' excludes anything timestamped later on the last day. It filters rows, so it does not limit columns, and it takes exact values rather than patterns, so it is not a wildcard construct.

Please log in or register to report this question.

63.

The SELECT command, with its various clauses, allows users to query the data contained in the tables and ask many different questions or ad hoc queries.

Answer: A

Correct answer: True

This is what distinguishes a relational database from the file-based systems it replaced. SELECT, with its clauses for filtering, grouping, ordering and joining, lets a user pose a question the database designer never anticipated.

That is what "ad hoc" means here: the query is composed when the question arises, not built into the application in advance. Earlier models required navigating predefined access paths, so a new question often meant new code. Declaring what is wanted rather than how to fetch it is the whole point.

Please log in or register to report this question.

Answer: C

Correct answer: DELETE FROM CUSTOMER WHERE .

DELETE FROM removes rows, and the WHERE clause decides which. Omitting the clause is legal and empties the whole table, which is why writing the WHERE first is a habit worth having.

DROP destroys the table itself, structure and all, so it belongs to the data definition language rather than to row manipulation. UPDATE changes values in rows that remain. REMOVE is not SQL. Note that DELETE leaves the empty table in place, ready for new rows.

Please log in or register to report this question.

65.

The HAVING clause acts like a WHERE clause, but it identifies groups that meet a criterion, rather than rows.

Answer: A

Correct answer: True

HAVING is the group-level counterpart of WHERE. It runs after GROUP BY has formed the groups and after the aggregates have been computed, so it can test them: HAVING COUNT(*) > 5 keeps only groups with more than five rows.

WHERE runs earlier, deciding which rows enter the groups, and cannot refer to an aggregate because at that point no group exists. Filtering on a plain column therefore belongs in WHERE, where it reduces the rows to be grouped, not in HAVING.

Please log in or register to report this question.

66.

The SQL statement that queries or reads data from a table is ________ .

Answer: A

Correct answer: SELECT

SELECT is the query statement, and the only one that reads data. It is also by far the most elaborate, carrying FROM, WHERE, GROUP BY, HAVING and ORDER BY, and able to nest inside itself.

READ and QUERY are not SQL keywords. The choice of word is a historical accident worth noting: SELECT suggests choosing rows, but in relational terms the statement performs projection as well as selection, and after GROUP BY it aggregates too.

Please log in or register to report this question.

Answer: D

Correct answer: SELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');

IN tests membership of a list, and a list with one element is equivalent to an equality test, so STATE IN ('VA') means the same as STATE = 'VA'.

The other three options fail on syntax rather than on logic: they write IN CUSTOMER where the source table must follow FROM. That is the real test here - the clause naming the table is FROM, and IN is a predicate belonging inside WHERE.

Please log in or register to report this question.

Answer: B

Correct answer: DROP TABLE CUSTOMER;

DROP TABLE removes the table itself - its rows, its definition, its indexes and its constraints - leaving no object of that name in the database.

The contrast with DELETE is the point of the question. DELETE FROM CUSTOMER removes rows but keeps the table, ready for new ones. DROP is data definition, DELETE is data manipulation. TRUNCATE TABLE sits between them, emptying the table quickly while keeping its structure. REMOVE TABLE and DELETE TABLE are not SQL.

Please log in or register to report this question.

69.

Which one of the following provides the ability to query information from the database and to insert tuples into, delete tuples from, and modify tuples in the database ?

Answer: A

Correct answer: DML(Data Manipulation Langauge)

Querying, inserting, deleting and modifying tuples are exactly the operations of the Data Manipulation Language: SELECT, INSERT, DELETE and UPDATE.

DDL by contrast defines the structures those tuples live in. Note that the query language is a part of DML rather than a separate thing, which is why "Query" as an option is too narrow - it names one of the four capabilities the question lists. A relational schema is a description, not a language.

Please log in or register to report this question.

70.

The result of a SQL SELECT statement is a(n) ________ .

Answer: D

Correct answer: table

Every SELECT returns a relation - rows and columns - and that is a table, even though it is not stored. This is the closure property of the relational model: an operation on tables yields a table.

Closure is what makes SQL composable. A query's result can be the input of another query, which is exactly what a subquery, a derived table in the FROM clause, and a view all rely on. Reports, forms and files are how a result may be presented, but they are not what the statement returns.

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