Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

chap 5

Total questions: 102

Worksheet time: 51mins

Name
Class
Date
1.

The ________ is the structure that contains descriptions of objects such as tables and views created by users.

a)

SQL

b)

schema

c)

catalog

d)

master view

2.

________ is a set of commands used to control a database, including security.

a)

DML

b)

DDL

c)

DCL

d)

DPL

3.

________ is a set of commands used to update and query a database.

a)

DML

b)

DDL

c)

DCL

d)

DPL

4.

DDL is typically used during which phase of the development process?

a)

Implementation

b)

Physical design

c)

Analysis

d)

Evaluation

5.

The main concept of relational databases was published in 1970 by:

a)

Itzak Ben-Gan

b)

Hoffer

c)

Mills

d)

E.F.Codd

6.

Relational databases are heavily based on the mathematical concept of:

a)

set theory

b)

bet theory

c)

get theory

d)

met theory

7.

The command for creating a database is:

a)

CREATE TABLE

b)

CREATE VIEW

c)

CREATE SCHEMA

d)

CREATE AUTHORIZATION

8.

The command for removing a table is:

a)

CREATE TABLE

b)

REMOVE TABLE

c)

DROP TABLE

d)

TRUNCATE TABLE

9.

Any create command may be reversed by using a(n) ________ command.

a)

undo

b)

drop

c)

delete

d)

unpack

10.

The first in a series of steps to follow when creating a table is to:

a)

identify columns that must be unique

b)

identify each attribute and its characteristics

c)

create an index

d)

identify columns that must be null

11.

The SQL command ________ adds one or more new columns to a table.

a)

CREATE TABLE

b)

ALTER TABLE

c)

CREATE VIEW

d)

CREATE RELATIONSHIP

12.

What does the following SQL statement do? ALTER TABLE Customer_T ADD (Type Varchar (2));

a)

Alters the Customer_T table to accept Type 2 Varchars

b)

Alters the Customer_T table to be a Type 2 Varchar

c)

Alters the Customer_T table by adding a field called "Type"

d)

Alters the Customer_T table by adding a 2-byte field called "Varchar"

13.

INSERT INTO is an example of ________ code.

a)

DDL

b)

DML

c)

DCL

d)

TIO

14.

What does the following SQL command do? INSERT INTO Customer_T values (001,'John Smith','231 West St','Boston','MA','02115');

a)

Adds a new record to the Customer_T table

b)

Creates the Customer_T table

c)

Deletes the Customer_T table

d)

Updates the Customer_T table

15.

Given a table named store with 5 fields: store_id, address, city, state, zipcode, why would the following insert command not work? INSERT INTO store values ('234 Park Street')

a)

It would work just fine.

b)

You must specify the fields to insert if you are only inserting some of the fields.

c)

There is no table keyword.

d)

INSERT INTO should be INSERT to.

16.

What does the following SQL statement do? DELETE FROM Customer_T WHERE state = 'HI';

a)

Deletes all records from Customer_t where the state is equal to HI

b)

Removes the Customer_T table from the database

c)

Deletes all records from the Customer_T table

d)

Doesn't delete anything because of a syntax error

17.

What does the following SQL statement do? UPDATE Product_T SET Unit_Price = 775 WHERE Product_ID = 7

a)

Changes the price of a unit called Product_T to 7

b)

Changes the unit price of Product 7 to 775

c)

Changes the length of the Unit_Price field to 775

d)

Updates the Product_T table to have a unit price of 775

18.

Which of the following is a technique for optimizing the internal performance of the relational data model?

a)

Avoiding indexes on secondary keys

b)

Clustering data

c)

Not reporting statistics to save machine resources

d)

Using random index organizations

19.

Indexes are created in most RDBMSs to:

a)

provide a quicker way to store data

b)

decrease the amount of disk space utilized

c)

provide rapid random and sequential access to base-table data

d)

increase the cost of implementation

20.

In an SQL statement, which of the following parts states the conditions for row selection?

a)

SELECT

b)

FROM

c)

WHERE

d)

GROUP BY

21.

The first part of an SQL query to be read is the ________ statement.

a)

SELECT

b)

FROM

c)

WHERE

d)

ORDER BY

22.

The last part of an SQL query to be read is the ________ statement.

a)

SELECT

b)

FROM

c)

WHERE

d)

ORDER BY

23.

What does the following SQL statement do? SELECT * From Customer WHERE Cust_Type = "Best"

a)

Selects all the fields from the Customer table for each row with a customer labeled "Best"

b)

Selects the "*" field from the Customer table for each row with a customer labeled "Best"

c)

Selects fields with a "*" in them from the Customer table

d)

Selects all the fields from the Customer table for each row with a customer labeled "*"

24.

What result will the following SQL statement produce? SELECT Avg(Standard_Price) as average from Product_V;

a)

The average of all products in Product_V

b)

The average Standard_Price of all products in Product_V

c)

The average price of all products

d)

The mode of all prices

25.

Which of the following questions is answered by the SQL statement? SELECT COUNT (Product_Description) FROM Product_T;

a)

How many products are in the table Product_T?

b)

How many products have product descriptions in the Product Table?

c)

How many characters are in the field name "Product_Description"?

d)

How many different columns named "Product_Description" are there in table Product_T?

26.

What results will be produced by the following SQL query? SELECT SUM(Standard_Price) as Total_Price from Product_V where Product_Type = 'WOOD';

a)

The total price of all products that are of type wood

b)

The total price of all products

c)

The Standard_Price of the first wood product in the table

d)

The Standard_Price of any wood product in the table

27.

Which of the following counts ONLY rows that contain a value?

a)

COUNT

b)

COUNT(*)

c)

TALLY(*)

d)

CHECKNUM

28.

Which of the following will produce the minimum of all standard prices?

a)

SELECT Standard_Price FROM Product_V WHERE Standard_Price = min;

b)

SELECT MIN(Standard_Price) FROM Product_V;

c)

SELECT Standard_Price FROM min(Product_V);

d)

SELECT MIN(Standard_Price) FROM Product_V WHERE Standard_Price = min(Standard_Price);

29.

What will result from the following SQL Select statement? SELECT MIN(Product_Description) FROM Product_V;

a)

The minimum value of Product_Description will be displayed.

b)

An error message will be generated.

c)

The first product description alphabetically in Product_V will be shown.

d)

SELECT @ will be displayed.

30.

Which of the following is the wildcard operator in SQL statements?

a)

<>

b)

*

c)

=

d)

&

31.

What result set will the following query return? SELECT Item_No FROM Order_V WHERE quantity > 10;

a)

The Item_No of all orders that had more than 10 items

b)

The Order_Id of all orders that had more than one item

c)

The Order_Id of all orders that had more than 10 items

d)

The Item_No of all orders that had 10 or more items

32.

What result set will the following query return? SELECT Item_No, description FROM item WHERE weight > 100 and weight < 200;

a)

The Item_No and description for all items weighing less than 100

b)

The Item_No for all items weighing between 101 and 199

c)

The Item_No and description for all items weighing between 101 and 199

d)

The Item_No for all items weighing more than 200

33.

To eliminate duplicate rows in a query, the ________ qualifier is used in the SQL Select command.

a)

ALTER

b)

DISTINCT

c)

CHECK

d)

SPECIFIC

34.

What result set is returned from the following query? SELECT Customer_Name, telephone FROM customers WHERE city in ('Boston','New York','Denver');

a)

The Customer_Name and telephone of all customers

b)

The Customer_Name and telephone of all customers living in either Boston, New York or Denver

c)

The Customer_Name and telephone of all customers living in Boston and New York and Denver

d)

The Customer_Name of all customers living in Boston, New York or Denver

35.

To get all the customers from Hawaii sorted together, which of the following would be used?

a)

ORDER BY

b)

GROUP BY

c)

HAVING

d)

SORT

36.

A single value returned from an SQL query that includes an aggregate function is called a(n):

a)

agate

b)

scalar aggregate

c)

vector aggregate

d)

summation

37.

Multiple values returned from an SQL query that includes an aggregate function are called:

a)

vector aggregates

b)

scalar aggregates

c)

agates

d)

summations

38.

Which of the following can produce scalar and vector aggregates?

a)

ORDER BY

b)

GROUP BY

c)

HAVING

d)

SORT

39.

What will be returned when the following SQL statement is executed? SELECT driver_no, count(*) as num_deliveries FROM deliveries GROUP BY driver_no;

a)

A listing of all drivers, sorted by driver number

b)

A listing of each driver as well as the number of deliveries that he or she has made

c)

A count of all of the deliveries made by all drivers

d)

An error message

40.

What will be returned when the following SQL statement is executed? SELECT driver_no, count(*) as num_deliveries FROM deliveries WHERE state = 'MA' GROUP BY driver_no;

a)

A listing of all drivers who made deliveries to state = 'MA', sorted by driver number

b)

A listing of each driver who made deliveries to state = 'MA' as well as the number of deliveries that each driver has made to that state

c)

A count of all of the deliveries made to state = 'MA' by all drivers

d)

An error message will be generated

41.

Which of the following finds all groups meeting stated conditions?

a)

SELECT

b)

WHERE

c)

HAVING

d)

FIND

42.

What will be returned when the following SQL query is executed? SELECT driver_no, COUNT(*) as num_deliveries FROM deliveries GROUP BY driver_no HAVING COUNT(*) > 2;

a)

A listing of all drivers who made more than 2 deliveries as well as a count of the number of deliveries

b)

A listing of all drivers

c)

A listing of the number of deliveries greater than 2

d)

A listing of all drivers who made more than 2 deliveries

43.

Which of the following is true of the order in which SQL statements are evaluated?

a)

The SELECT clause is always processed first.

b)

The SELECT clause is always processed last.

c)

The SELECT clause is processed before the ORDER BY clause.

d)

The GROUP BY clause is processed before the WHERE clause.

44.

A view may not be updated directly if it contains:

a)

the SELECT clause.

b)

the HAVING clause.

c)

the FROM clause.

d)

the WHERE clause.

45.

Requiring a CustomerID to exist in a Primary table before it can exist in a foreign table is an example of:

a)

referential referring.

b)

referential integrity.

c)

ethical integrity.

d)

the Hoffer Principle.

46.

Which of the following is a purpose of the SQL standard?

a)

To specify syntax and semantics of SQL data definition and manipulation languages

b)

To specify maximum and incomplete standards

c)

To define every operation for every SQL database

d)

To permit no degrees of freedom for SQL DBMS

47.

The benefits of a standardized relational language include:

a)

application turnover.

b)

increased training costs.

c)

cross-system communication.

d)

confusing the SQL programmers.

48.

A catalog is the structure that contains object descriptions created by a user.

a)

True

b)

False

49.

DCL is used to update the database with new records.

a)

True

b)

False

50.

A database table is defined using the data definition language (DDL).

a)

True

b)

False

51.

A database is maintained and queried using the data mapping language (DML).

a)

True

b)

False

52.

The content of dynamic views is generated when they are referenced.

a)

True

b)

False

53.

The views are created by executing a CREATE VIEW SQL command.

a)

True

b)

False

54.

When the SELECT clause in the create view statement contains the keyword DISTINCT, the view can be used to update data.

a)

True

b)

False

55.

The CREATE SCHEMA DDL command is used to create a table.

a)

True

b)

False

56.

Select True or False: SQL is both an American and international standard for database access.

a)

True

b)

False

57.

Select True or False: SQL has been implemented only in the mainframe and midrange environments.

a)

True

b)

False

58.

Select True or False: SQL originated from a project called System-S.

a)

True

b)

False

59.

Select True or False: One of the original purposes of the SQL standard was to provide a vehicle for portability of database definition and application modules between conforming DBMSs.

a)

True

b)

False

60.

Select True or False: A major benefit of SQL as a standard is reduced training costs.

a)

True

b)

False

61.

Select True or False: Implementation of a standard can never stifle creativity and innovation.

a)

True

b)

False

62.

Select True or False: Applications can be moved from one machine to another when each machine uses SQL.

a)

True

b)

False

63.

Select True or False: Some DBMSs can handle graphic data types as well as text and numbers.

a)

True

b)

False

64.

Select True or False: When creating tables, it's important to decide which columns will allow null values before the table is created.

a)

True

b)

False

65.

Select True or False: In databases, null values are equivalent to zero.

a)

True

b)

False

66.

Select True or False: The DELETE TABLE DDL command is used to remove a table from the database.

a)

True

b)

False

67.

Select True or False: The ALTER TABLE command is used to change a table definition.

a)

True

b)

False

68.

Select True or False: The SQL command used to populate tables is the INSERT command.

a)

True

b)

False

69.

Select True or False: An INSERT command does not need to have the fields listed.

a)

True

b)

False

70.

Evaluate the statement: INSERT INTO budget values 121,222,111; Would this command work as written?

a)

Yes, it would work

b)

No, it would not work

71.

Select True or False: The DROP command deletes rows from a table individually or in groups.

a)

True

b)

False

72.

Select True or False: In order to update data in SQL, one must inform the DBMS which relation, columns, and rows are involved.

a)

True

b)

False

73.

Select True or False: Indexes generally slow down access speed in most RDMS.

a)

True

b)

False

74.

Select True or False: Expressions are mathematical manipulations of data in a table that may be included as part of the SELECT statement.

a)

True

b)

False

75.

Select True or False: COUNT(*) tallies only those rows that contain a value, while COUNT counts all rows.

a)

True

b)

False

76.

Select True or False: The asterisk (*) wildcard designator can be used to select all fields from a table as well as in WHERE clauses when an exact match is not possible.

a)

True

b)

False

77.

Select True or False: The comparison operators = and != are used to establish a range of values.

a)

True

b)

False

78.

Select True or False: If multiple Boolean operators are used in an SQL statement, NOT is evaluated first, then AND, then OR.

a)

True

b)

False

79.

Select True or False: The following two SQL statements will produce the same results: SELECT last_name, first_name FROM customer WHERE credit_limit > 99 AND credit_limit < 10001; and SELECT last_name, first_name FROM customer WHERE credit_limit BETWEEN 100 and 10000;

a)

True

b)

False

80.

Select True or False: Adding the DISTINCT keyword to a query eliminates duplicates.

a)

True

b)

False

81.

Select True or False: The following two SQL statements will produce different results: SELECT last_name, first_name FROM customer WHERE state = 'MA' OR state = 'NY' OR state = 'NJ' OR state = 'NH' OR state = 'CT'; and SELECT last_name, first_name FROM customer WHERE state in ('MA','NY','NJ','NH','CT');

a)

True

b)

False

82.

Select True or False: The ORDER BY clause sorts the final results rows in ascending or descending order.

a)

True

b)

False

83.

A single value returned from an SQL query that includes an aggregate function is called a vector aggregate.

a)

True

b)

False

84.

When a GROUP BY clause is included in an SQL statement, only columns with a single value for each group can be included.

a)

True

b)

False

85.

The HAVING clause and the WHERE clause perform the same operation.

a)

True

b)

False

86.

Consider the query: SELECT salesperson_id, sum(sales) FROM salesperson GROUP BY salesperson_id. The query totals sales for each salesperson.

a)

True

b)

False

87.

Consider the query: SELECT salesperson_id, sum(sales) FROM salesperson GROUP BY salesperson_id HAVING state = 'MA'; The query totals sales in state 'MA' for each salesperson.

a)

True

b)

False

88.

The ORDER BY clause is the first statement processed in an SQL command.

a)

True

b)

False

89.

The WHERE clause is always processed before the GROUP BY clause when both occur in a SELECT statement.

a)

True

b)

False

90.

The FROM clause is the first statement processed in an SQL command.

a)

True

b)

False

91.

When creating a table, it is not important to consider foreign key–primary key mates.

a)

True

b)

False

92.

A referential integrity constraint specifies that the existence of an attribute in one table depends on the existence of a foreign key in the same or another table.

a)

True

b)

False

93.

Select all the classes of SQL commands used to build, maintain, and secure a database.

a)

Data definition language (DDL)

b)

Data manipulation language (DML)

c)

Data control language (DCL)

d)

Transaction control language (TCL)

e)

Markup definition language (MDL)

94.

Select all true statements about dynamic views.

a)

They provide a way to access part of a table or a combination of columns from multiple tables.

b)

They can improve programmer productivity by allowing queries to be reused via views.

c)

They use little or no storage space but consume processing time when the view is recreated for reference.

d)

They are always recreatable regardless of database changes.

e)

They can increase security because users see only what the view presents.

95.

Which option best describes a materialized view and its typical use?

a)

It keeps a copy of the actual data and is useful for relatively static data when many queries are run against the view, improving performance.

b)

It executes the view's SQL on the server only when the view is referenced and stores no results.

c)

It is a temporary, session-only view that disappears at disconnect.

d)

It is an index-organized synonym that replaces base tables.

96.

Select all original purposes of SQL.

a)

To specify the syntax and semantics of SQL data definition and manipulation languages.

b)

To define data structures and basic operations for designing, accessing, maintaining, controlling, and protecting an SQL database.

c)

To provide portability of database definition and application modules between conforming DBMSs.

d)

To specify both minimal (Level 1) and complete (Level 2) standards allowing different degrees of adoption in products.

e)

To prohibit national character sets to enforce uniformity across vendors.

97.

Select all recommended steps when preparing to create a table.

a)

Identify the appropriate data type and length for each attribute.

b)

Identify the columns that should accept null values.

c)

Identify columns that need to be unique.

d)

Identify all primary–foreign key mates.

e)

Drop all default values to avoid ambiguity.

98.

Which three clauses are contained in most SQL retrieval statements?

a)

SELECT, FROM, WHERE

b)

SELECT, GROUP BY, HAVING

c)

FROM, WHERE, ORDER BY

d)

SELECT, JOIN, ORDER BY

99.

Select all categories of standard SQL functions that can be used in the SELECT clause.

a)

Mathematical

b)

String

c)

Date

d)

Analytical

e)

Network

100.

When is the GROUP BY clause useful?

a)

When you need to calculate aggregates such as totals for each distinct value in a column (e.g., total sales per salesperson).

b)

When you need to filter individual rows before aggregation.

c)

When you need to sort the result set by one or more columns.

d)

When you need to join two tables on a foreign key.

101.

Which statement correctly contrasts the HAVING clause with the WHERE clause?

a)

WHERE filters individual rows before grouping, while HAVING filters groups based on aggregate conditions.

b)

HAVING filters individual rows before grouping, while WHERE filters groups after aggregation.

c)

WHERE and HAVING perform the same operation at the same stage of query processing.

d)

HAVING can be used only with ORDER BY, while WHERE can be used only with GROUP BY.

102.

Select all statements that correctly describe advantages or disadvantages of an SQL standard.

a)

Reduced training costs

b)

Increased productivity

c)

Stifling creativity

d)

Greater dependence on a single vendor

e)

Cross-system communication