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

SQL for Database Construction Questions and Answers

21.

The SQL statement used to create a view is CREATE VIEW.

Answer: A

Correct answer: True

CREATE VIEW gives the view a name and the SELECT that defines it, and nothing but that definition is stored. The rows are produced when the view is queried, which is what keeps it current and what makes it a virtual table rather than a copy.

Please log in or register to report this question.

22.

The SQL MAKE TABLE command is used to construct tables, define columns, define column constraints and create relationships.

Answer: B

Correct answer: False

There is no MAKE TABLE statement in SQL. The verb is CREATE TABLE, and it does everything the statement describes - defines columns and their constraints and, through foreign key declarations, the relationships between tables.

Please log in or register to report this question.

23.

SQL has a JOIN ON syntax that can be used to create inner joins and outer joins.

Answer: A

Correct answer: True

The JOIN ... ON syntax expresses the join condition explicitly and supports INNER, LEFT, RIGHT and FULL OUTER forms. It is preferred to putting the condition in the WHERE clause because the join and the filtering are then visibly separate, and because an outer join cannot be written the older way at all.

Please log in or register to report this question.

24.

Standard SQL-92 views are constructed from SQL SELECT statements that do not contain the GROUP BY clause.

Answer: B

Correct answer: False

SQL-92 views may contain GROUP BY; a view that aggregates is perfectly legal, though it will not generally be updatable. What SQL-92 forbids in a view definition is ORDER BY, since a view is a relation and a relation has no order.

Please log in or register to report this question.

25.

The SQL CHECK constraint is fully defined by the SQL-92 standard, and is consistently implemented by all DBMS vendors.

Answer: B

Correct answer: False

CHECK is defined by the standard but implemented with real differences between products - in what expressions are permitted, whether subqueries may appear, and when the condition is evaluated. Portable code must therefore keep CHECK constraints simple, and complex rules are often placed in triggers instead.

Please log in or register to report this question.

26.

A updatable view has its own data.

Answer: B

Correct answer: False

No view has data of its own, updatable or not. A view stores only its defining SELECT, and an update through it is translated into an update on the underlying tables. That is precisely why updatability is restricted: the DBMS must be able to identify the row of the base table to which the change applies.

Please log in or register to report this question.

27.

The SQL DELETE statement is used to delete both the table structure and table data.

Answer: B

Correct answer: False

DELETE removes rows and leaves the table, its definition, its indexes and its constraints in place; an empty table remains. Removing the structure as well is DROP TABLE. The distinction is worth being certain of, since the two mistakes are not equally recoverable.

Please log in or register to report this question.

28.

Common types of SQL CHECK constraints include range checks and limiting columns values.

Answer: A

Correct answer: True

Range checks and lists of permitted values are two of the three common forms, the third being a comparison between two columns of the same row. All three are conditions the DBMS evaluates on every insert and update, so the rule holds however the data arrives - through an application, a script or a manual statement.

Please log in or register to report this question.

29.

If any required (NOT NULL) columns are missing from the view, the view cannot be used for inserting new data.

Answer: A

Correct answer: True

An insert through a view supplies values only for the columns the view exposes, so a required column omitted from the view would be left null in the base table and the insert would fail. The view can therefore be used for reading and for updating existing rows, but not for inserting new ones.

Please log in or register to report this question.

30.

When a foreign key column is created without a corresponding foreign key constraint, we have created a "casual relationship" between the two tables.

Answer: A

Correct answer: True

A casual relationship is one implied by the data but not declared to the DBMS: the foreign key column is present and the application relies on it, but no constraint enforces the reference. Nothing then prevents an orphaned value, and the integrity depends entirely on every program getting it right.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: SQL for Database Construction Questions and Answers || SQL for Database Construction MCQ Questions and Answers || SQL for Database Construction GK Questions and Answers || SQL for Database Construction GK MCQ Questions || SQL for Database Construction Multiple Choice Questions and Answers || SQL for Database Construction GK || GK on SQL for Database Construction || Database Questions and Answers || Database MCQ Questions and Answers || Database GK Questions and Answers || GK on Database