To test if a query specified in English has been correctly written in SQL, the SQL query

Question:

To test if a query specified in English has been correctly written in SQL, the SQL query is typically executed on multiple test databases, and a human checks if the SQL query result on each test database matches the intention of the specification in English. 

a. We saw an example of an erroneous SQL query which was intended to find which courses had been taught by each instructor; the query computed the natural join of instructor, teaches, and course, and as a result, it unintentionally equated the dept. name attribute of instructor and course. Give an example of a dataset that would help catch this particular error.

b. When creating test databases, it is important to create tuples in referenced relations that do not have any matching tuple in the referencing relation for each foreign key. Explain why, using an example query on the university database.

c. When creating test databases, it is important to create tuples with null values for foreign-key attributes, provided the attribute is nullable. Explain why, using an example query on the university database.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Database System Concepts

ISBN: 9780078022159

7th Edition

Authors: Abraham Silberschatz, Henry F. Korth, S. Sudarshan

Question Posted: