Chapter 20: ADO.NET and Relational Databases
Quiz Solutions
Solution to Question 20-1. In a relational database, the data is organized into tables, and the queries are defined by the relationships among the tables.
Solution to Question 20-2. A primary key is a column that contains values that are unique to the table in which it resides, which allows you to uniquely identify each row.
Solution to Question 20-3. A foreign key is a column in a table that is also the primary key in a different table. This allows you to identify the relationship among the tables.
Solution to Question 20-4. To retrieve the contents of the Title
column in the Books
table the appropriate query would be:
Select Title from Books
Solution to Question 20-5. To retrieve the contents of the Author
column where the value in the Publisher
column is “OReilly”, the appropriate query would be:
Select Author from Books where Publisher = 'OReilly'
Solution to Question 20-6. You would want to use a join when you want to filter the information retrieved from one table based on the contents of a different table.
Solution to Question 20-7. The DataSet
object represents a subset of retrieved data, and can be used to view or manipulate the data.
Solution to Question 20-8. One good way to view the rows in a DataTable
object is to iterate over the Rows
collection with a foreach
loop.
Solution to Question 20-9. The DataAdapter
class provides the bridge between your application and the database. The DataAdapter
can take a connection string ...
Get Learning C# 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.