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

SQL for Database Construction Questions and Answers

31.

Views can be used to show the results of computed columns.

Answer: A

Correct answer: True

A view is defined by a SELECT, and a SELECT may compute columns, so a view can present totals, margins or converted units as though they were stored. The advantage is consistency: the expression is written once and everyone who uses the view gets the same definition.

Please log in or register to report this question.

32.

A benefit of using a stored procedure is that it can be distributed to client computers.

Answer: B

Correct answer: False

A stored procedure is by definition stored and executed in the database; distributing it to clients would defeat both of its advantages, the reduction in network traffic and the single point of maintenance. What can be distributed is a call to it, which is all the client needs to know.

Please log in or register to report this question.

33.

A trigger is a stored program that is attached to a database.

Answer: B

Correct answer: False

A trigger is attached to a particular table or view, not to the database as a whole, and it fires on an event affecting that object. A program belonging to the database and called explicitly is a stored procedure, and keeping the two apart matters because they are invoked in quite different ways.

Please log in or register to report this question.

34.

A stored procedure is a program that performs some common action on database data and is stored in the database.

Answer: A

Correct answer: True

That is the definition, and the two halves are both essential: the procedure performs an action on the data, and it lives in the database rather than in the application. From that follow its advantages - one copy to maintain, a compiled plan to reuse, permissions granted on the procedure, and little traffic across the network.

Please log in or register to report this question.

35.

A SQL view is a virtual table that is constructed from other tables or views.

Answer: A

Correct answer: True

A view is virtual because nothing is stored but its defining query; the rows are produced each time it is read. It may be built from tables or from other views, which allows layers of abstraction, and it behaves like a table in a query while carrying none of a table’s storage.

Please log in or register to report this question.

36.

There are three SQL data modification operations: insert, modify and delete.

Answer: A

Correct answer: True

INSERT, UPDATE and DELETE are the three data manipulation operations that change stored data, and every modification a program makes is one of them. They are distinct from the data definition statements, which change structure rather than content.

Please log in or register to report this question.

37.

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.

38.

A view that contains a computed column can be easily updated.

Answer: B

Correct answer: False

A computed column has no counterpart in any base table, so there is no stored value for an update to change and the DBMS cannot work backwards from the result to the inputs. Such a view is read-only in that column, which is one of the standard restrictions on view updatability.

Please log in or register to report this question.

39.

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.

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