Chapter 7 Flashcards

1
Q

A database language enables the user to create database and table structures to perform basic data management chores.

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The ANSI prescribes a standard SQL–the current fully approved version is known as SQL-07.

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

SQL is considered difficult to learn; its command set has a vocabulary of more than 300 words.

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The SQL command that lets you insert rows into a table is ____.

A

INSERT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The SQL command that lets you select attributes from rows in one or more tables is ____.

A

SELECT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Only numeric data types can be added and subtracted in SQL.

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The CHECK constraint is used to define a condition for the values that the attribute domain cannot have.

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

You cannot insert a row containing a null attribute value using SQL.

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Any changes made to the contents of a table are not physically saved on disk until you use the SAVE command.

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If you have not yet used the COMMIT command to store the changes permanently in the database, you can restore the database to its previous condition with the ROLLBACK command.

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Although SQL commands can be grouped together on a single line, complex command sequences are best shown on separate lines, with space between the SQL command and the command’s components.

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

String comparisons are made from left to right.

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

SQL allows the use of logical restrictions on its inquiries such as OR, AND, and NOT.

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The conditional LIKE must be used in conjunction with wildcard characters.

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which query will output the table contents when the value of V_CODE is not equal to 21344?

A

-SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
FROM PRODUCT
WHERE V_CODE <> 21344;

SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
FROM PRODUCT
WHERE V_CODE <= 21344;

SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
FROM PRODUCT
WHERE V_CODE = 21344;

SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
FROM PRODUCT
WHERE V_CODE => 21344;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which query will output the table contents when the value of the character field P_CODE is alphabetically less than 1558-QW1?

A

-SELECT P_CODE, P_DESCRIPT, P_QOH, P_MIN, P_PRICE
FROM PRODUCT
WHERE P_CODE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which query will use the given columns and column aliases from the PRODUCT table to determine the total value of inventory held on hand?

A

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH/P_PRICE
FROM PRODUCT;

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH=P_PRICE
FROM PRODUCT;

-SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH*P_PRICE
FROM PRODUCT;

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH-P_PRICE
FROM PRODUCT;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Which query will use the given columns and column aliases from the PRODUCT table to determine the total value of inventory held on hand and display the results in a column labeled TOTVALUE?

A

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH*P_PRICE AS TOTVALUE
FROM PRODUCT;

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH=P_PRICE AS TOTVALUE
FROM PRODUCT;

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH/P_PRICE AS TOTVALUE
FROM PRODUCT;

-SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH-P_PRICE AS TOTVALUE
FROM PRODUCT;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The special operator used to check whether an attribute value is within a range of values is ____.

A

BETWEEN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The special operator used to check for similar character strings is ____.

A

LIKE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

The ____ command is used with the ALTER TABLE command to modify the table by deleting a column.

A

DROP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

UPDATE tablename
*****
[WHERE conditionlist];

The ____ command replaces the ***** in the syntax of the UPDATE command, shown above.

A

-SET columnname = expression

columnname = expression

expression = columnname

LET columnname = expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The ____ command is used to restore the table’s contents to their previous values.

A

COMMIT; RESTORE;

COMMIT; BACKUP;

COMMIT; ROLLBACK;

-ROLLBACK;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

To join tables, simply enumerate the tables in the FROM clause of the SELECT statement. The DBMS will create a Cartesian product of every table in the FROM clause. To get the correct results, you need to select the rows in which the common attribute values do not match.

A

FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

To delete a row from the PRODUCT table, use the ____ command.

A

DELETE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Which of the following is used to select partial table contents?

A

SELECT
FROM
BY ;

LIST
FROM
BY ;

-SELECT
FROM
WHERE ;

LIST
FROM
WHERE ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

A(n) ____ is a query that is embedded (or nested) inside another query.

A

subquery

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

The query used to list the P_CODE, P_DESCRIPT, P_INDATE, and P_PRICE fields from the PRODUCT table in ascending order by P_PRICE is ____.

A

SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
FROM PRODUCT
SEQUENCE BY P_PRICE;

SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
FROM PRODUCT
LIST BY P_PRICE;

-SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
FROM PRODUCT
ORDER BY P_PRICE;

SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
FROM PRODUCT
ASCENDING BY P_PRICE;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Which query is used to list a unique value for V_CODE, where the list will produce only a list of those values that are different from one another?

A

SELECT ONLY V_CODE
FROM PRODUCT;

SELECT UNIQUE V_CODE
FROM PRODUCT;

SELECT DIFFERENT V_CODE
FROM PRODUCT;

-SELECT DISTINCT V_CODE
FROM PRODUCT;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

The SQL aggregate function that gives the total of all values for a selected attribute in a given column is ____.

A

SUM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

The query to join the P_DESCRIPT and P_PRICE fields from the PRODUCT table and the V_NAME, V_AREACODE, V_PHONE, and V_CONTACT fields from the VENDOR table where the values of V_CODE match is ____.

A

SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE <> VENDOR.V_CODE;

-SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE = VENDOR.V_CODE;

SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE <= VENDOR.V_CODE;

SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE => VENDOR.V_CODE;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Oracle users can use the Access QBE (query by example) query generator.

A

false

33
Q

Some RDBMSs, such as Microsoft Access, automatically make the necessary conversions to eliminate case sensitivity.

A

true

34
Q

The most recent fully approved version of standard SQL prescribed by the ANSI is ____.

A

SQL-2003

35
Q

A database language enables the user to create database and table structures to perform basic data management chores.

A

true

36
Q

A database language enables the user to perform complex queries designed to transform the raw data into useful information.

A

true

37
Q

The ANSI SQL standards are also accepted by the ISO.

A

true

38
Q

SQL is considered difficult to learn; its command set has a vocabulary of more than 300 words.

A

false

39
Q

Data type selection is usually dictated by the nature of the data and by the intended use.

A

true

40
Q

Entity integrity is enforced automatically when the primary key is specified in the CREATE TABLE command sequence.

A

true

41
Q

The CHECK constraint is used to define a condition for the values that the attribute domain cannot have.

A

false

42
Q

SQL requires the use of the ADD command to enter data into a table.

A

false

43
Q

To list the contents of a table, you must use the DISPLAY command.

A

false

44
Q

Any changes made to the contents of a table are not physically saved on disk until you use the SAVE command.

A

false

45
Q

The COMMIT command does not permanently save all changes. In order to do that, you must use SAVE.

A

false

46
Q

All SQL commands must be issued on a single line.

A

false

47
Q

Although SQL commands can be grouped together on a single line, complex command sequences are best shown on separate lines, with space between the SQL command and the command’s components.

A

true

48
Q

You can select partial table contents by naming the desired fields and by placing restrictions on the rows to be included in the output.

A

true

49
Q

Since computers identify all characters by their numeric codes, mathematical operators cannot be used to place restrictions on character-based attributes.

A

false

50
Q

String comparisons are made from left to right.

A

true

51
Q

Date procedures are often more software-specific than other SQL procedures.

A

true

52
Q

ANSI-standard SQL allows the use of special operators in conjunction with the WHERE clause.

A

true

53
Q

The conditional LIKE must be used in conjunction with wildcard characters.

A

true

54
Q

Most SQL implementations yield case-insensitive searches.

A

false

55
Q

The COUNT function is designed to tally the number of non-null “values” of an attribute, and is often used in conjunction with the DISTINCT clause.

A

true

56
Q

To join tables, simply enumerate the tables in the FROM clause of the SELECT statement. The DBMS will create a Cartesian product of every table in the FROM clause. To get the correct results, you need to select the rows in which the common attribute values do not match.

A

false

57
Q

When joining three or more tables, you need to specify a join condition for one pair of tables.

A

false

58
Q

The most recent fully approved version of standard SQL prescribed by the ANSI is ____.

A

SQL-2003

59
Q

The SQL character data format(s) is(are) ____.

A

CHAR and VARCHAR

60
Q

The SQL command that lets you permanently save data changes is ____.

A

COMMIT

61
Q

The SQL command that lets you select attributes from rows in one or more tables is ____.

A

SELECT

62
Q

o list all the contents of the PRODUCT table, you would use ____.

A

LIST * FROM PRODUCT;

-SELECT * FROM PRODUCT;

DISPLAY * FROM PRODUCT;

SELECT ALL FROM PRODUCT;

63
Q

The SQL command that modifies an attribute’s values in one or more table’s rows is ____.

A

INSERT

SELECT

COMMIT

-UPDATE

64
Q

An example of a command you would use when making changes to a PRODUCT table is ____.

A

CHANGE PRODUCT
SET P_INDATE = ‘18-JAN-2004’
WHERE P_CODE = ‘13-Q2/P2’;

ROLLBACK PRODUCT
SET P_INDATE = ‘18-JAN-2004’
WHERE P_CODE = ‘13-Q2/P2’;

EDIT PRODUCT
SET P_INDATE = ‘18-JAN-2004’
WHERE P_CODE = ‘13-Q2/P2’;

-UPDATE PRODUCT
SET P_INDATE = ‘18-JAN-2004’
WHERE P_CODE = ‘13-Q2/P2’;

65
Q

Some RDBMSs, such as Oracle, automatically ____ data changes when issuing data definition commands.

A

-COMMIT

ROLLBACK

UNSAVE

UPDATE

66
Q

When you issue the DELETE FROM tablename command without specifying a WHERE condition, ____.

A

no rows will be deleted

the first row will be deleted

the last row will be deleted

-all rows will be deleted

67
Q

The ____ command would be used to delete the table row where the P_CODE is ‘BRT-345’.

A

-DELETE FROM PRODUCT
WHERE P_CODE = ‘BRT-345’;

REMOVE FROM PRODUCT
WHERE P_CODE = ‘BRT-345’;

ERASE FROM PRODUCT
WHERE P_CODE = ‘BRT-345’;

ROLLBACK FROM PRODUCT
WHERE P_CODE = ‘BRT-345’;

68
Q

A(n) ____ is an alternate name given to a column or table in any SQL statement.

A

-alias

data type

stored function

trigger

69
Q

Which query will use the given columns and column aliases from the PRODUCT table to determine the total value of inventory held on hand and display the results in a column labeled TOTVALUE?

A

-SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH*P_PRICE AS TOTVALUE
FROM PRODUCT;

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH=P_PRICE AS TOTVALUE
FROM PRODUCT;

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH/P_PRICE AS TOTVALUE
FROM PRODUCT;

SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH-P_PRICE AS TOTVALUE
FROM PRODUCT;

70
Q

The ____ special operator is used to check whether an attribute value is null.

A

BETWEEN

-IS NULL

LIKE

IN

71
Q

The special operator used to check for similar character strings is ____.

A

BETWEEN

IS NULL

-LIKE

IN

72
Q

The special operator used to check whether a subquery returns any rows is ____.

A

BETWEEN

-EXISTS

LIKE

IN

73
Q

A table can be deleted from the database by using the ____ command.

A

-DROP TABLE

DELETE TABLE

MODIFY TABLE

ERASE TABLE

74
Q

The query used to list the P_CODE, P_DESCRIPT, P_INDATE, and P_PRICE fields from the PRODUCT table in ascending order by P_PRICE is ____.

A

SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
FROM PRODUCT
SEQUENCE BY P_PRICE;

SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
FROM PRODUCT
LIST BY P_PRICE;

-SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
FROM PRODUCT
ORDER BY P_PRICE;

SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
FROM PRODUCT
ASCENDING BY P_PRICE;

75
Q

The SQL query to output the contents of the EMPLOYEE table sorted by last name, first name, and initial is ____.

A

SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE
FROM EMPLOYEE
LIST BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;

-SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE
FROM EMPLOYEE
ORDER BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;

SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE
FROM EMPLOYEE
DISPLAY BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;

SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE
FROM EMPLOYEE
SEQUENCE BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;

76
Q

The SQL aggregate function that gives the number of rows containing non-null values for the given column is ____.

A

COUNT

77
Q

The SQL aggregate function that gives the total of all values for a selected attribute in a given column is ____.

A

SUM

78
Q

The SQL aggregate function that gives the average for the specific column is ____.

A

AVG

79
Q

The query to join the P_DESCRIPT and P_PRICE fields from the PRODUCT table and the V_NAME, V_AREACODE, V_PHONE and V_CONTACT fields from the VENDOR table, where the values of V_CODE match and the output is ordered by the price is ____.

A

SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE <> VENDOR.V_CODE;
ORDER BY P_PRICE;

SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE => VENDOR.V_CODE;
ORDER BY P_PRICE;

SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE <= VENDOR.V_CODE;
ORDER BY P_PRICE;

-SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE = VENDOR.V_CODE;
ORDER BY P_PRICE;