You are on page 1of 3

Ma Vang

DBA-110

Chapter 4 Review Questions: (1-10)

1. A view is an individual users picture of the database. It is defined using a defining query.
The data in the view never actually exists in the form described in the view. Rather,
when a user accesses the view, his or her query is merged with the defining query of the
view to form a query that pertains to the whole database.

2. a.
CREATE VIEW TopLevelCust AS
SELECT CustomerNum, CustomerName, Street, City, State, Zip, Balance,
CreditLimit
FROM Customer
WHERE CreditLimit > = 10000
;
b.
SELECT CustomerNum, CustomerName, Balance
FROM TopLevelCust
WHERE CreditLimit > Balance
;
c.
SELECT CustomerNum, CustomerName
FROM Customer
WHERE Balance > CreditLimit
;

3. a.
CREATE VIEW PartOrder AS
SELECT Part.PartNum, Description, Price, OrderNum, OrderDate, NumOrdered,
QuotedPrice
FROM Part, OrderLine, Orders
WHERE Part.PartNum = OrderLine.PartNum
AND Orders.OrderNum = OrderLine.OrderNum
;
b.
SELECT PartNum, Description, OrderNum, QuotedPrice
FROM PartOrder
WHERE QuotedPrice > 100
;
c.
SELECT Part.PartNum, Description, OrderNum, QuotedPrice
FROM Part, OrderLine
WHERE Part.PartNum = OrderLine.PartNum
AND QuotedPrice > 100
;

4. An index is a file that relates key values to records that contain those key values. The
advantage of using an index makes certain types of retrieval more efficient. However,
the disadvantages of using an index is that, first, the index occupies space on disk,and
the other is that the DBMS must update the index whenever corresponding data in the
database is updated. You can create an index with SQL by using the CREATE INDEX
command.

5. The GRANT statement is used to assign privileges to users of a database. It relates to
security because a user who does not have the privilege of accessing a certain portion
of a database cannot access that portion of the database. The privileges that can be
assigned include the privilege of selecting rows from a table, inserting new rows, and
updating existing rows. The REVOKE command is used to revoke privileges.

6. a.
GRANT SELECT ON Part TO Stillwell
;
b.
GRANT INSERT ON Part TO Webb, Bradley
;

7. REVOKE SELECT ON Part FROM Stillwell
;

8. The system catalog is a feature of many relational DBMSs that stores information about
the structure of a database. It is where information about tables in the database is kept.
New tables added, changes in existing tables, and tables that are deleted, are the three
items information is maintained with the catalog.

9. a.
SELECT Name
FROM Systables
WHERE Creator = your name
;
b.
SELECT Colname, Coltype
FROM Syscolumns
WHERE Tbname = Customer
;
c.
SELECT Tbname
FROM Syscolumns
WHERE Colname = PartNum
;

10. 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.

You might also like