Vous êtes sur la page 1sur 2

Henry Wittenauer

DB201
June 24, 2014
Chapter 4 Review Questions
1. What is a view? How do you define a view? Does the data described in a view definition ever exist
in that form? What happens when a user accesses a database through a view? A view is an application
programs or an individual users picture of the database. It is less involved than the full database. When
a user accesses a database through a view they can only view the data and cannot make any changes to
the structure. (Page 119 and 120)
4. What is an index? What are the advantages and disadvantages of using indexes? How do you use
SQL to create an index? The index is a mechanism for increasing the efficiency with which data is
retrieved from the database. (Page 126) It is faster overall, and to add items to it you would have to
create it completely over again. You use the SQL CREATE INDEX command to create an index. (Page 128)
EX. CREATE INDEX CustomerName
ON Customer (CustomerName)
;
5. Describe the GRANT statement and explain how it relates to security. What types of privileges may
be granted? How are thy revoked? That different types of privileges can be granted to users and, if
necessary, later revoked. Select, insert, update, and delete table data. (Page 130)
6. Write the SQL commands to grant the following privileges:
a. User Stillwell must be able to retrieve data from the Part table.
GRANT SELECT ON Part TO Stillwell
;
b. Users Webb and Bradley must be able to add new orders and order lines.
GRANT INSERT ON Part TO Webb, Bradley
;
7. Write the SQL command to revoke user Stillwells privilege.
REVOKE SELECT ON Part FROM Stillwell
;
8. What is the system catalog? Name three items about which the catalog maintains information. It is
where information about tables in the database is kept. New tables added, changes in existing tables,
and tables that are deleted. (Page 140)
9. Write the SQL commands to obtain the following information from the system catalog:
a. List every table that you created.
SHOW TABLES
Henry Wittenauer
DB201
June 24, 2014
b. List every field in the Customer table and its associated data type.
SHOW COLUMNS FROM CUSTOMER
c. List every table that contains a field name PartNum.

10. Why is it a good idea for the DBMS to update the catalog automatically when a change is made in
the database structure? Could users cause problems by updating the catalog themselves? Explain. It
would be a good idea so that other customers can view the changes also. If it is not updated then only
the person that made the changes would only be able to see them until the update is manually
configured.
11. What are nulls? Which field cannot accept null values? Why? A special value that can be used for
certain fields; they are used when a value is missing, unknown, or inapplicable. The Primary Key cannot
accept null values. Because the primary key is supposed to uniquely identify a given row, which would
not happen if nulls were allowed. (Page 131)
12. State the three integrity rules. Indicate the reasons for enforcing each rule. Entity integrity-is the
rule that no field that is part of the primary key may accept null values. (Page 131) Referential integrity-
it is the rule that if table A contains a foreign key that matches the primary key of table B, the values of
this foreign key must match the value of the primary key for some row in table B or be null. (Page 133)
Legal-values integrity-it is the property that states that no record can exist in the database with a value
in the field other than one of the legal values. (Page 135)
13. The Orders table contains a foreign key, CustomerNum that must match the primary key of the
Customer table. What type of update to the Orders table would violate referential integrity? If deletes
do not cascade, what would happen when a customer was deleted? Adding an order to the Orders
table on which the customer number does not match a customer number in the Customer table would
violate referential integrity. Changing the customer number on a record in the Orders table to a number
that does not match a customer number in the Customer table would also violate referential integrity. If
deletes do not cascade, deleting a customer that has orders would violate referential integrity. If deletes
cascade, that customer can be deleted, in which case all orders for that customer will automatically be
deleted.
14. How would you use SQL to change a tables structure? What general types of changes are
possible? Which commands are used to implement these changes? You would use the ALTER TABLE
command. Adding and removing tables and fields, by changing the characteristics of existing fields, or by
creating and dropping indexes. ALTER TABLE Customer; ADD CustType CHAR (1) ; (Page 137)
15. What are stored procedures? What purpose do they serve? It is used to improve overall
performance by saving the query in a special file, which is called stored procedures. Then the DBMS
compiles the stored procedure, which translates it into machine code and then it creates an execution
plan, which is the most efficient way of obtaining the results. From that point on, users execute the
compiled, optimized code in the stored procedure. (Page 142)
16. What are triggers? What purpose do they serve? How do you gain the functionality of a trigger
using Access 2010? Triggers are an action that occurs automatically in response to an associated
database operation such as an INSERT, UPDATE, or DELETE command. You use it in a data macro in
Access 2010. (Page 143)

Vous aimerez peut-être aussi