[go: up one dir, main page]

100% found this document useful (25 votes)
577 views13 pages

Guide To SQL 9th Edition Pratt Test Bank Download

This document provides a summary of key concepts for updating data in SQL databases. It discusses how to update existing data using commands like UPDATE, how to verify changes using SELECT, and how to make changes permanent with COMMIT or rollback changes with ROLLBACK. It also covers adding, changing and deleting columns from tables using ALTER TABLE and dropping tables using DROP TABLE.

Uploaded by

John Felton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (25 votes)
577 views13 pages

Guide To SQL 9th Edition Pratt Test Bank Download

This document provides a summary of key concepts for updating data in SQL databases. It discusses how to update existing data using commands like UPDATE, how to verify changes using SELECT, and how to make changes permanent with COMMIT or rollback changes with ROLLBACK. It also covers adding, changing and deleting columns from tables using ALTER TABLE and dropping tables using DROP TABLE.

Uploaded by

John Felton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Chapter 6: Updating Data

Guide to SQL 9th Edition Pratt


Full download at link:
Test Bank: https://testbankpack.com/p/test-bank-for-guide-to-sql-9th-
edition-pratt-111152727x-9781111527273/

Solution Manual: https://testbankpack.com/p/solution-manual-for-


guide-to-sql-9th-edition-pratt-111152727x-9781111527273/
1. You can create a new table using data in an existing table.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 167

2. The command, CREATE TABLE AS LEVEL1_CUSTOMER USING CUSTOMER; creates a table called
LEVEL1_CUSTOMER that has the same structure as CUSTOMER.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 168

3. The data stored in tables changes only infrequently.


a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 169

4. It is a good idea to use a SELECT command to display the data you changed to verify that the correct update was made.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 170

5. When necessary, include a WHERE clause into the UPDATE command to indicate the column on which the change is
to take place.
a. True
b. False
ANSWER: False
POINTS: 1

Cengage Learning Testing, Powered by Cognero Page 1


Chapter 6: Updating Data

REFERENCES: 170

6. To verify that the correct change was made to data in a table, use the DISPLAY command.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 170

7. You cannot use a compound condition with an UPDATE command.


a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 171

8. You can use the existing value in a column and a calculation to update a value.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 170

9. You use the APPEND command to add additional rows to tables.


a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 171

10. By default, Oracle commits each action query as soon as the user executes the query.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 173

11. Access does not support the COMMIT or ROLLBACK commands.


a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 173

12. If the Autocommit mode is turned off, you can cancel updates at any time during your current work session.

Cengage Learning Testing, Powered by Cognero Page 2


Chapter 6: Updating Data

a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 173

13. Updates become permanent automatically when you exit from the DBMS.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 173

14. In a transaction, it is acceptable if some steps fail.


a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 174

15. You cannot commit and roll back data in SQL Server.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 173

16. You can use REMOVE ROW to remove a row from a table.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 175

17. If you specify NOT NULL for a column when you create a table, you are prohibited from changing a value in the
column to null.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 177

18. If you change the value of a column to NULL, you must enclose the NULL value in single quotation marks.
a. True
b. False

Cengage Learning Testing, Powered by Cognero Page 3


Chapter 6: Updating Data

ANSWER: False
POINTS: 1
REFERENCES: 178

19. One of the nicest features of a relational DBMS, such as Oracle, is the ease with which you can change table
structures.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 179

20. In SQL Server, the word NULL appears in the results when a column contains a null value.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 179

21. In Oracle 11 g, a null value is displayed as a hyphen.


a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 178

22. To add a new column, use the ADD NEW COLUMN clause of the ALTER TABLE command.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 179

23. When you add a new column to a table, the default for Oracle, SQL Server, and Access is to accept null values.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 180

24. You cannot change the characteristics of existing columns.


a. True
b. False
ANSWER: False
POINTS: 1

Cengage Learning Testing, Powered by Cognero Page 4


Chapter 6: Updating Data

REFERENCES: 183

25. In Access, use the Documenter tool to show the layout of a table.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 182

26. In SQL Server, execute the sp_columns command to list all the columns in a table.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 182

27. If you decrease the size of a column, it is possible to lose some data currently in the column.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 183

28. You can increase the length of column but you cannot decrease the length of a column.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 183

29. In some cases, you might need to change a table’s structure in ways that are beyond the capabilities of your DBMS.
When that happens, use the RESTRUCTURE command to redesign the table.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 185

30. There are table structure changes that are beyond the capabilities of SQL.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 185

Cengage Learning Testing, Powered by Cognero Page 5


Chapter 6: Updating Data
31. To permanently remove both a table and its data, you must issue both a DROP TABLE command and a DELETE
command.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 185/186

32. The DROP TABLE command creates an empty table.


a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 186

33. Access does not support the ____ data type.


a. DECIMAL
b. CURRENCY
c. CHAR
d. INT
ANSWER: a
POINTS: 1
REFERENCES: 168

34. You can use the ____ command to create a new table using data in an existing table.
a. CREATE TABLE
b. NEW TABLE
c. UPDATE
d. ALTER TABLE
ANSWER: a
POINTS: 1
REFERENCES: 168

35. To change rows for which a specific condition is true, use the ____ command
a. CHANGE
b. MODIFY
c. UPDATE
d. ALTER
ANSWER: c
POINTS: 1
REFERENCES: 169

36. To add data from an existing table to a new table, use a SELECT command in a(n) ____ command.
a. SET
b. ADD
Cengage Learning Testing, Powered by Cognero Page 6
Chapter 6: Updating Data

c. INSERT
d. UPDATE
ANSWER: c
POINTS: 1
REFERENCES: 168

37. If you have verified that the update you made is correct, you can use the ____ command to make the update
permanent.
a. UPDATE
b. ROLL
c. COMMIT
d. SAVE
ANSWER: c
POINTS: 1
REFERENCES: 173

38. If you have not run the COMMIT command, executing the ____ command will reverse all updates made during the
current work session.
a. UPDATE
b. REVERSE
c. ROLLBACK
d. ROLL
ANSWER: c
POINTS: 1
REFERENCES: 173

39. In order to use the COMMIT command in Oracle, you need to clear the check mark from the ____ check box.
a. Transaction
b. Autocommit
c. Permanent
d. Temporary
ANSWER: b
POINTS: 1
REFERENCES: 173

40. ____ is the default transaction mode in Oracle and commits each action query as soon as the user executes the query.
a. Execute
b. Run
c. Autocommit
d. Enabled
ANSWER: c
POINTS: 1
REFERENCES: 173

41. Which of the following commands executes a rollback?


Cengage Learning Testing, Powered by Cognero Page 7
Chapter 6: Updating Data

a. ROLLBACK TABLE;
b. ROLLBACK;
c. ROLLBACK ALL;
d. ROLLBACK DB;
ANSWER: b
POINTS: 1
REFERENCES: 173

42. Which of the following is a valid SQL command?


a. COMMIT TABLE;
b. COMMIT CHANGES;
c. COMMIT DB;
d. COMMIT;
ANSWER: d
POINTS: 1
REFERENCES: 173

43. The ____ command is permanent.


a. SELECT
b. COMMIT
c. SAVE
d. UPDATE
ANSWER: b
POINTS: 1
REFERENCES: 173

44. A(n) ____ can be viewed as a sequence of steps that accomplishes a single task.
a. procedure
b. transaction
c. program
d. method
ANSWER: b
POINTS: 1
REFERENCES: 173

45. To delete rows from the database, use the ____ command.
a. ROLLBACK
b. COMMIT
c. DELETE
d. UPDATE
ANSWER: c
POINTS: 1
REFERENCES: 173

46. What happens if you run a DELETE command that does not contain a WHERE clause?
Cengage Learning Testing, Powered by Cognero Page 8
Chapter 6: Updating Data

a. The table will be deleted.


b. All rows will be deleted from the table.
c. All values would be replaced by nulls.
d. None of the above.
ANSWER: b
POINTS: 1
REFERENCES: 173

47. If you specified ____ for a column when you created a table, then changing a value in a column to null is prohibited.
a. NOT NULL
b. NULL
c. CHAR
d. NUMBER
ANSWER: a
POINTS: 1
REFERENCES: 173

48. In Oracle, use the ____ command to display the structure of a table.
a. SHOW TABLE
b. SHOW LAYOUT
c. DESCRIBE
d. DISPLAY LAYOUT
ANSWER: c
POINTS: 1
REFERENCES: 185

49. You can use the ____ clause of the ALTER TABLE command to change a column that currently rejects null values so
that it will accept null values.
a. ADD
b. MODIFY
c. UPDATE
d. NULL
ANSWER: b
POINTS: 1
REFERENCES: 185

50. In SQL, use the ____ data type for variable-length character columns.
a. TEXT
b. VARCHAR
c. VARIABLE
d. CHARLENGTH
ANSWER: b
POINTS: 1
REFERENCES: 185

Cengage Learning Testing, Powered by Cognero Page 9


Chapter 6: Updating Data
51. You can use the ____ command to delete an entire table and its data.
a. ROLLBACK
b. DELETE TABLE
c. DROP TABLE
d. DELETE
ANSWER: c
POINTS: 1
REFERENCES: 185

52. Which of the following is a valid SQL command?


a. DROP TABLE LEVEL1_CUSTOMER;
b. DROP LEVEL1_CUSTOMER;
c. DELETE LEVEL1_CUSTOMER;
d. All of the above
ANSWER: a
POINTS: 1
REFERENCES: 186

53. By placing a(n) ____________________ command in an INSERT command, you can add the query results to a table.
ANSWER: SELECT
POINTS: 1
REFERENCES: 168

54. The format for the UPDATE command is the word UPDATE, followed by the name of the table to be updated. The
next portion of the command consists of the word ____________________, followed by the name of the column to be
updated, an equals sign, and the new value.
ANSWER: SET
POINTS: 1
REFERENCES: 170

55. During your current work session you can save your changes immediately by executing the ____________________
command.
ANSWER: COMMIT
POINTS: 1
REFERENCES: 173

56. If you decide that you do not want to save the changes you have made during your current work session, you can
reverse the changes by executing the ____________________ command.
ANSWER: ROLLBACK
POINTS: 1
REFERENCES: 173

57. The ROLLBACK command reverses changes made to the ____________________ only.
ANSWER: data
POINTS: 1
REFERENCES: 173
Cengage Learning Testing, Powered by Cognero Page 10
Chapter 6: Updating Data

58. To sort rows in a specific order, use the ____________________ clause with the desired sort key(s).
ANSWER: ORDER BY
POINTS: 1
REFERENCES: 172

59. You use the ____________________ command to remove rows from a table.
ANSWER: DELETE
POINTS: 1
REFERENCES: 174

60. A(n) ____________________ is a logical unit of work.


ANSWER: transaction
POINTS: 1
REFERENCES: 174

61. Before beginning the updates for a transaction, commit any previous updates by executing the
____________________ command.
ANSWER: COMMIT
POINTS: 1
REFERENCES: 174

62. In a transaction, if any update cannot be completed, execute the ____________________ command and discontinue
the updates for the current transaction.
ANSWER: ROLLBACK
POINTS: 1
REFERENCES: 174

63. In a transaction, if you can complete all updates successfully, execute the ____________________ command after
completing the final update.
ANSWER: COMMIT
POINTS: 1
REFERENCES: 174

64. If you specified ____________________ for the column when you created the table, then changing a value in a
column to null is prohibited.
ANSWER: NOT NULL
POINTS: 1
REFERENCES: 177

65. With SQL, you can change a table’s structure by using the ____________________ command.
ANSWER: ALTER TABLE
POINTS: 1
REFERENCES: 179

66. To add a new column, use the ____________________ clause of the ALTER TABLE command.
ANSWER: ADD
Cengage Learning Testing, Powered by Cognero Page 11
Chapter 6: Updating Data

POINTS: 1
REFERENCES: 179

67. The ADD clause consists of the word ADD followed by the name of the ____________________ to be added,
followed by the characteristics.
ANSWER: column
POINTS: 1
REFERENCES: 179

68. The format for the ALTER TABLE command is the words ALTER TABLE followed by the name of the
____________________ to be altered, followed by an appropriate clause.
ANSWER: table
POINTS: 1
REFERENCES: 179

69. In Oracle, use the ____________________ command to display the structure of a table.
ANSWER: DESCRIBE
POINTS: 1
REFERENCES: 182

70. You can change the characteristics of existing columns by using the ____________________ clause of the ALTER
TABLE command.
ANSWER: MODIFY
POINTS: 1
REFERENCES: 183

71. To change a column that currently rejects null values so that it accepts null vlaues, use the ____________________
clause in the ALTER TABLE command.
ANSWER: MODIFY
POINTS: 1
REFERENCES: 185

72. You can delete a table that is no longer needed by using the ____________________ TABLE command.
ANSWER: DROP
POINTS: 1
REFERENCES: 185

73. Describe the format for the UPDATE command.


ANSWER: The format for the UPDATE command is the word UPDATE, followed by the name of the table to be
updated. The next portion of the command consists of the word SET, followed by the name of the
column to be updated, an equals sign, and the new value. When necessary, include a WHERE clause to
indicate the row(s) on which the change is to take place.
POINTS: 1
REFERENCES: 170

74. How can you use the COMMIT and ROLLBACK commands to support transactions?
ANSWER: You can use the COMMIT and ROLLBACK commands to support transactions as follows:

Cengage Learning Testing, Powered by Cognero Page 12


Chapter 6: Updating Data

Before beginning the updates for a transaction, commit any previous updates by executing the
COMMIT command.
Complete the updates for the transaction. If any update cannot be completed, execute the ROLLBACK
command and discontinue the updates for the current transaction.
If you can complete all updates successfully, execute the COMMIT command after completing the final
update.
POINTS: 1
REFERENCES: 174

75. Describe the format of the ALTER TABLE command to add a new column.
ANSWER: To add a new column, use the ADD clause of the ALTER TABLE command. The format for the
command is the words ALTER TABLE followed by the name of the table to be altered, followed by an
appropriate clause. The ADD clause consists of the word ADD followed by the name of the column to
be added, followed by the characteristics of the column.
POINTS: 1
REFERENCES: 179

Cengage Learning Testing, Powered by Cognero Page 13

You might also like