Deck 6: Updating Data
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/34
Play
Full screen (f)
Deck 6: Updating Data
1
To permanently remove both a table and its data, you must execute both a DROP TABLE command and a DELETE command.
False
2
How do you use data from certain columns of an existing table to populate a new table with a matching structure?
A) Place a SELECT command within an INSERT command.
B) Execute a CREATE TABLE command with an INSERT clause.
C) Copy the existing table and delete the unwanted columns.
D) Add an INSERT clause after the WHERE clause in a SELECT command.
A) Place a SELECT command within an INSERT command.
B) Execute a CREATE TABLE command with an INSERT clause.
C) Copy the existing table and delete the unwanted columns.
D) Add an INSERT clause after the WHERE clause in a SELECT command.
A
3
You can use the existing value in a column and a calculation to update a value.
True
4
You can use the APPEND command to add additional rows to tables.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
5
Which command(s) can you use to delete an entire table and its data?
A) ROLLBACK
B) SELECT and DELETE TABLE
C) DROP TABLE
D) DELETE and ALTER TABLE
A) ROLLBACK
B) SELECT and DELETE TABLE
C) DROP TABLE
D) DELETE and ALTER TABLE
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
6
To add data from an existing table to a new table, use a SELECT command in a(n) _____.
A) SET command
B) ADD command
C) INSERT command
D) UPDATE command
A) SET command
B) ADD command
C) INSERT command
D) UPDATE command
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
7
Changing a value in a table column to null is prohibited if, when you created the table, you specified _____.
A) NOT NULL for the column
B) NULL for the column
C) a CHAR data type for the column
D) a NUMBER data type for the column
A) NOT NULL for the column
B) NULL for the column
C) a CHAR data type for the column
D) a NUMBER data type for the column
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
8
Which command can you use to change rows for which a specific condition is true?
A) CHANGE
B) MODIFY
C) UPDATE
D) ALTER
A) CHANGE
B) MODIFY
C) UPDATE
D) ALTER
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
9
The DROP TABLE command creates an empty table.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
10
Which command is used to display the structure of a table in MySQL?
A) SHOW TABLE
B) SHOW LAYOUT
C) DESCRIBE
D) DISPLAY LAYOUT
A) SHOW TABLE
B) SHOW LAYOUT
C) DESCRIBE
D) DISPLAY LAYOUT
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
11
What command is used to delete rows from the database?
A) ROLLBACK
B) COMMIT
C) DELETE
D) UPDATE
A) ROLLBACK
B) COMMIT
C) DELETE
D) UPDATE
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
12
Using SQL, you can increase the length of an existing table column but you cannot decrease the length of a column.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
13
If you have not run the COMMIT command, you can reverse all updates made during the current work session by executing the _____.
A) UPDATE command
B) REVERSE command
C) ROLLBACK command
D) ROLL command
A) UPDATE command
B) REVERSE command
C) ROLLBACK command
D) ROLL command
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
14
What happens if you run a DELETE command that does not contain a WHERE clause?
A) The table will be deleted.
B) All rows will be deleted from the table.
C) All values would be replaced by nulls.
D) Nothing; this will cause an error.
A) The table will be deleted.
B) All rows will be deleted from the table.
C) All values would be replaced by nulls.
D) Nothing; this will cause an error.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
15
Which command can you use to create a new table using data in an existing table?
A) CREATE TABLE
B) NEW TABLE
C) UPDATE
D) ALTER TABLE
A) CREATE TABLE
B) NEW TABLE
C) UPDATE
D) ALTER TABLE
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
16
A logical unit of work, often conceptualized as a sequence of steps that accomplish a single task, is called a _____.
A) procedure
B) transaction
C) program
D) method
A) procedure
B) transaction
C) program
D) method
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following commands executes a rollback?
A) ROLLBACK TABLE;
B) ROLLBACK;
C) ROLLBACK ALL;
D) ROLLBACK UPDATE;
A) ROLLBACK TABLE;
B) ROLLBACK;
C) ROLLBACK ALL;
D) ROLLBACK UPDATE;
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
18
Once you have verified that the update you made is correct, you can make the update permanent by using the _____.
A) UPDATE command
B) ROLL command
C) COMMIT command
D) SAVE command
A) UPDATE command
B) ROLL command
C) COMMIT command
D) SAVE command
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
19
Which clause can you use with 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
A) ADD
B) MODIFY
C) UPDATE
D) NULL
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
20
The default transaction mode in Oracle, which commits each action query as soon as the user executes the query, is _____.
A) Execute
B) Run
C) Autocommit
D) Enabled
A) Execute
B) Run
C) Autocommit
D) Enabled
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
21
Which is the correct sequence of elements in a command to remove rows from a MySQL table?
A) SELECT*, FROM, table name, WHERE clause with a condition, DELETE
B) DELETE FROM, table name, WHERE clause with a condition
C) DELETE, WHERE clause with a condition, FROM, table name
D) FROM, table name, WHERE clause with a condition, DELETE
A) SELECT*, FROM, table name, WHERE clause with a condition, DELETE
B) DELETE FROM, table name, WHERE clause with a condition
C) DELETE, WHERE clause with a condition, FROM, table name
D) FROM, table name, WHERE clause with a condition, DELETE
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
22
Describe the format of the command used to add a new column to an existing MySQL table.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
23
How does the procedure for adding rows to an existing MySQL table compare to that for populating a new table that has just been created?
A) They are identical.
B) They are similar, except you use the UPDATE command for adding rows to an existing table.
C) They are similar, except you use the ALTER command for adding rows to an existent table.
D) They require both different commands and different clauses.
A) They are identical.
B) They are similar, except you use the UPDATE command for adding rows to an existing table.
C) They are similar, except you use the ALTER command for adding rows to an existent table.
D) They require both different commands and different clauses.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
24
A MySQL command to change a value within a table to null _____.
A) requires that the value NULL be enclosed in double quotation marks
B) is formatted differently from other commands to change table data
C) incorporates the UPDATE and SET commands and a WHERE clause
D) will execute only if the column selected was specified as NOT NULL
A) requires that the value NULL be enclosed in double quotation marks
B) is formatted differently from other commands to change table data
C) incorporates the UPDATE and SET commands and a WHERE clause
D) will execute only if the column selected was specified as NOT NULL
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
25
What do you need to know to complete the FIRST step in the process of creating a new table using data from an existing table, called CANDY, in MySQL?
A) the number of rows and columns in the existing table
B) the primary key value for each row in the table of existing data
C) the columns from CANDY that you want to include and their characteristics
D) the rows from CANDY that you want to include in the new table
A) the number of rows and columns in the existing table
B) the primary key value for each row in the table of existing data
C) the columns from CANDY that you want to include and their characteristics
D) the rows from CANDY that you want to include in the new table
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
26
James has created a new MySQL table called FAVORITES and would like to populate it with data from the existing CANDY table. Which command can he use to add data for rows with a rating of seven or more?
A) SELECT ID, NAME, PRICE, RATING FROM CANDY WHERE (RATING > 7));
B) INSERT INTO FAVORITES (SELECT ID, NAME, PRICE, RATING FROM CANDY WHERE (RATING > 7));
C) SELECT ID, NAME, PRICE, RATING FROM CANDY WHERE (RATING > 7)) INSERT INTO FAVORITES;
D) INSERT INTO FAVORITES (FROM CANDY IF RATING > 7);
A) SELECT ID, NAME, PRICE, RATING FROM CANDY WHERE (RATING > 7));
B) INSERT INTO FAVORITES (SELECT ID, NAME, PRICE, RATING FROM CANDY WHERE (RATING > 7));
C) SELECT ID, NAME, PRICE, RATING FROM CANDY WHERE (RATING > 7)) INSERT INTO FAVORITES;
D) INSERT INTO FAVORITES (FROM CANDY IF RATING > 7);
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
27
Which command should Josephine use if she would like to add a new row to the BMI table in MySQL?
A) INSERT INTO BMI VALUES ('Emily', 'Cross', 66, 115);
B) UPDATE BMI SET ('Emily', 'Cross', 66, 115);
C) SELECT* FROM BMI INSERT ('Emily', 'Cross', 66, 115);
D) UPDATE BMI VALUES ('Emily', 'Cross', 66, 115);
A) INSERT INTO BMI VALUES ('Emily', 'Cross', 66, 115);
B) UPDATE BMI SET ('Emily', 'Cross', 66, 115);
C) SELECT* FROM BMI INSERT ('Emily', 'Cross', 66, 115);
D) UPDATE BMI VALUES ('Emily', 'Cross', 66, 115);
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
28
Patty begins entering an order into her DBMS using SQL, but soon discovers she cannot complete the order entry process owing to missing data. What should she do to follow best practices related to transactions?
A) turn on the Autocommit feature
B) execute the ROLLBACK command
C) leave the order in a partially entered state
D) execute the COMMIT command
A) turn on the Autocommit feature
B) execute the ROLLBACK command
C) leave the order in a partially entered state
D) execute the COMMIT command
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
29
Barney learns that the phone number for his friend Lacey in his ADDRESS_BOOK table has been disconnected; thus, her number is now unknown to him. Which SQL statement should Barney use to update the table so as to reflect this unknown value?
A) SELECT PHONE_NO FROM ADDRESS_BOOK WHERE (NAME = 'Lacey') SET NULL;
B) ALTER ADDRESS_BOOK SET PHONE_NO = NULL WHERE (NAME = 'Lacey');
C) UPDATE ADDRESS_BOOK SET PHONE_NO = 'NULL' WHERE (NAME = 'Lacey');
D) UPDATE ADDRESS_BOOK SET PHONE_NO = NULL WHERE (NAME = 'Lacey');
A) SELECT PHONE_NO FROM ADDRESS_BOOK WHERE (NAME = 'Lacey') SET NULL;
B) ALTER ADDRESS_BOOK SET PHONE_NO = NULL WHERE (NAME = 'Lacey');
C) UPDATE ADDRESS_BOOK SET PHONE_NO = 'NULL' WHERE (NAME = 'Lacey');
D) UPDATE ADDRESS_BOOK SET PHONE_NO = NULL WHERE (NAME = 'Lacey');
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
30
Which is the correct sequence of elements for a SQL command that will change a value in an existing table row?
A) UPDATE, table name, SELECT, column name, SET, new value
B) SELECT, table name, UPDATE, column name, equal sign, new value
C) IN, table name dot column name, SET, equal sign, new value
D) UPDATE, table name, SET, column name, equal sign, new value
A) UPDATE, table name, SELECT, column name, SET, new value
B) SELECT, table name, UPDATE, column name, equal sign, new value
C) IN, table name dot column name, SET, equal sign, new value
D) UPDATE, table name, SET, column name, equal sign, new value
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following is a valid SQL command?
A) DROP TABLE LEVEL1_CUSTOMER;
B) DROP LEVEL1_CUSTOMER;
C) DELETE LEVEL1_CUSTOMER;
D) SELECT* LEVEL1_CUSTOMER DROP TABLE;
A) DROP TABLE LEVEL1_CUSTOMER;
B) DROP LEVEL1_CUSTOMER;
C) DELETE LEVEL1_CUSTOMER;
D) SELECT* LEVEL1_CUSTOMER DROP TABLE;
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
32
How do you change a value in a column to null?
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
33
Describe the format for the UPDATE command.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
34
How can you use the COMMIT and ROLLBACK commands to support transactions?
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck