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

SQL for Database Construction Questions and Answers

31.

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.

32.

SQL statements can be embedded in triggers, stored procedures, and program code.

Answer: A

Correct answer: True

The same SQL serves in all three settings, which is what makes the language useful across the whole application. Embedded in program code it is executed through an API such as JDBC or ODBC; inside a trigger it runs automatically on an event; inside a stored procedure it runs when the procedure is called.

Please log in or register to report this question.

Answer: D

Correct answer: rows can either be inserted into a table one at a time or in groups.

INSERT takes either a VALUES clause for a single row or a SELECT in place of it, in which case every row the query returns is inserted. The second form is how a table is populated in bulk from another, and it is why loading data does not require a row-by-row loop.

Please log in or register to report this question.

34.

Three types of triggers are: BEFORE, AFTER and EXCEPTION.

Answer: B

Correct answer: False

The three types are BEFORE, AFTER and INSTEAD OF. There is no EXCEPTION trigger; exception handling is a feature of the procedural language a trigger is written in rather than a kind of trigger. Oracle supports all three types, while SQL Server has only AFTER and INSTEAD OF.

Please log in or register to report this question.

35.

A ________ is a stored program that is attached to a table or a view.

Answer: C

Correct answer: trigger

A trigger is a stored program attached to a particular table or view and fired automatically when a specified event occurs on it - an insert, update or delete. The attachment is what distinguishes it from a stored procedure, which belongs to the database as a whole and must be called explicitly.

Please log in or register to report this question.

36.

The SQL statement to create a view is:

Answer: A

Correct answer: CREATE VIEW.

CREATE VIEW names the view and gives the SELECT that defines it. Nothing is stored but the definition: the view holds no data of its own and is evaluated when it is queried, which is what makes it a virtual table and what keeps it automatically current.

Please log in or register to report this question.

37.

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.

Answer: B

Correct answer: deletes the table structure along with the table data.

DROP TABLE removes the table entirely: definition, data, indexes and constraints together. It is quite different from DELETE, which removes rows and leaves the table in place. It also fails if a foreign key elsewhere still references the table, since dropping it would break referential integrity.

Please log in or register to report this question.

Answer: C

Correct answer: a particular row in a particular underlying table.

To apply an update the DBMS must know which row of which base table the change belongs to, and that is possible only if the view carries the key and the column maps to a single stored column. Where a view aggregates, joins ambiguously or computes a column, no such row exists and the update cannot be performed.

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