Deck 3: Creating Tables

Full screen (f)
exit full mode
Question
It is recommended that table names be limited to _____.

A) 12 characters
B) 14 characters
C) 24 characters
D) 30 characters
Use Space or
up arrow
down arrow
to flip the card.
Question
The DESCRIBE TABLE command defines a SQL table's structure by listing its columns, data types, and column lengths.
Question
You indicate the end of a SQL command by typing a ____.

A) column
B) comma
C) semicolon
D) period
Question
To change a value in a table, use the CHANGE command.
Question
To list all the columns in a table and their properties in MySQL, use the LIST COLUMNS command.
Question
When adding rows to character columns, make sure you enclose the values in single quotation marks.
Question
Pete would like to set up a database called BAKE_SALE_FUNDRAISER so that he can begin defining the objects within it. Which MySQL command should Pete use?

A) CREATE DATABASE: BAKE_SALE_FUNDRAISER
B) CREATE DATABASE BAKE_SALE_FUNDRAISER;
C) ACTIVATE DATABASE BAKE_SALE_FUNDRAISER;
D) ACTIVATE DATABASE: BAKE_SALE_FUNDRAISER
Question
Which data type should you use for columns that contain letters and special characters or numbers that will not be used in calculations?

A) CHAR
B) CHARACTER
C) TEXT
D) STRING
Question
To display all the rows and columns in a table, type the word SELECT, followed by a(n) _____, followed by the keyword FROM and then the name of the table containing the data you want to view.

A) single quote
B) asterisk
C) double quote
D) slash
Question
Which SQL command do you use to remove an entire row from a table?

A) REMOVE
B) DELETE
C) ERASE
D) DROP
Question
SQL was developed in the mid-____.

A) 1950s
B) 1970s
C) 1990s
D) 2000s
Question
What was the original name for SQL?

A) SEQUEL
B) MYSEQUEL
C) DBase
D) MySQL
Question
Which of the following is a valid name for a table?

A) TBL_1
B) 2_TBL
C) TBL 3
D) 4 tbl
Question
Which general guideline for naming identifiers should you follow when creating a database and adding objects to it?

A) Make identifiers at least 35 characters long.
B) Begin the identifier with a number.
C) Include letters, numbers, and/or underscores.
D) Use spaces to separate words.
Question
Which MySQL command do you use to define a table's structure by listing its columns, data types, and column lengths?

A) NEW TABLE
B) DEFINE TABLE
C) CREATE TABLE
D) ADD TABLE
Question
In SQL Server, you can execute the sp_columns command to list all the columns in a table.
Question
Which of the following SQL commands changes the value in the column LAST_NAME within the row containing a REP_ID of 007?

A) UPDATE SALES_REP SET LAST_NAME = 'Bond' WHERE REP_ID = '007';
B) CHANGE SALES_REP LAST_NAME = 'Bond' WHERE REP_ID = '007';
C) REPLACE SALES_REP LAST_NAME = 'Bond' WHERE REP_ID = '007';
D) INSERT SALES_REP SET LAST_NAME = 'Bond' WHERE REP_ID = '007';
Question
When a script file contains more than one command, each command must end with a(n) _____.

A) apostrophe
B) semicolon
C) period
D) colon
Question
A text file with a .sql extension that contains SQL commands is a _____.

A) command file
B) batch process
C) SQL plugin
D) script file
Question
A MySQL database includes a CUSTOMER table, which stores each customer's current balance in U.S. dollars and cents, among other information. The correct data type for the BALANCE column in the CUSTOMER table is _____.

A) CHAR
B) INT
C) SMALLINT
D) DECIMAL
Question
Jesse has written some commands in MySQL Workbench that he expects to run regularly, and he would like to save them for future use. What should he do next?

A) copy and paste the query into a .txt file
B) click on Query, then select Execute
C) click on File, then Save Script As
D) select a script from within his file system and click Open
Question
Which SQL command is used to view the data in a table?

A) VIEW
B) SELECT
C) SHOW
D) DISPLAY
Question
Why does the POSTAL_CODE column in the REP table of the KimTay database have a data type of CHAR, if a postal code is made up of numbers?
Question
Which statement about the command used to view all columns and rows in a database table is correct?

A) The same simple version of this command can be used in MySQL, Oracle, and SQL Server.
B) When using Oracle, the semicolon in the MySQL command must be replaced with a slash.
C) The command used in SQL Server is different from that used in MySQL and Oracle.
D) The command contains two symbols: an colon and a question mark.
Question
Which SQL command is used to add rows to a table once its structure has been defined?

A) ADD
B) SELECT
C) INSERT
D) CREATE
Question
What are a script file and a script repository?
Question
What special value is used in SQL to represent cases in which an actual value is unknown, unavailable, or not applicable?

A) varchar
B) empty
C) not null
D) null
Question
In MySQL, Philip can use the command SELECT* FROM VACATION_PACKAGES; to _____.

A) select only certain rows to modify from the VACATION_PACKAGES table
B) display a list of tables in the VACATION_PACKAGES database
C) add a new row of data to the table VACATION_PACKAGES
D) display all rows and columns in the table VACATION_PACKAGES
Question
Should a user be allowed to enter null values for the primary key?
Question
How can you correct errors in data?
Question
Laura is adding a new product to the CANDY table, which has columns for the product ID, name, description, and price. Price is a dollars and cents value; the others are strings of characters. Which SQL command should Laura use to add the row for the new product?

A) INSERT CANDY ROW (534, Cordial fudge, Dark chocolate fudge squares topped with a cherry swirl, 5.85);
B) INSERT VALUES ('534', 'Cordial fudge', 'Dark chocolate fudge squares topped with a cherry swirl', 5.85) INTO CANDY;
C) INSERT INTO CANDY VALUES (534, Cordial fudge, Dark chocolate fudge squares topped with a cherry swirl, 5.85);
D) INSERT INTO CANDY VALUES ('534', 'Cordial fudge', 'Dark chocolate fudge squares topped with a cherry swirl', 5.85);
Question
When you add a row for which you have incomplete information to a SQL table, _____.

A) you must change the table structure so that all rows are marked as NOT NULL
B) you use the INSERT command and name the columns for which you are entering data
C) you use the INSERT command and enter a value of null for the columns without data
D) the DBMS will always reject the new row the first time you execute the command
Question
Which statement about changing the default database is FALSE?

A) There are two steps to choosing a database to use: changing the default and activation.
B) The MySQL command USE SPIDERS; makes SPIDERS the default database.
C) Tables created in MySQL are added to the default database.
D) To activate a database, you execute the USE command followed by the database's name.
Question
Janice wants to examine the structure of the COFFEE table, which was created by a colleague, including the column names, data types, and acceptance/nonacceptance of null values. Which command should Janice execute?

A) CREATE TABLE COFFEE;
B) SELECT COFFEE;
C) SHOW COFFEE;
D) DESCRIBE COFFEE;
Question
When creating a SQL table, _____.

A) add the NOT NULL clause for the columns that cannot contain null values
B) you must add PRIMARY KEY NOT NULL for the primary key column(s)
C) remember that the default behavior for table columns is to reject null values
D) include only those columns for which data will always be known and available
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/35
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 3: Creating Tables
1
It is recommended that table names be limited to _____.

A) 12 characters
B) 14 characters
C) 24 characters
D) 30 characters
D
2
The DESCRIBE TABLE command defines a SQL table's structure by listing its columns, data types, and column lengths.
False
3
You indicate the end of a SQL command by typing a ____.

A) column
B) comma
C) semicolon
D) period
C
4
To change a value in a table, use the CHANGE command.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
5
To list all the columns in a table and their properties in MySQL, use the LIST COLUMNS command.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
6
When adding rows to character columns, make sure you enclose the values in single quotation marks.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
7
Pete would like to set up a database called BAKE_SALE_FUNDRAISER so that he can begin defining the objects within it. Which MySQL command should Pete use?

A) CREATE DATABASE: BAKE_SALE_FUNDRAISER
B) CREATE DATABASE BAKE_SALE_FUNDRAISER;
C) ACTIVATE DATABASE BAKE_SALE_FUNDRAISER;
D) ACTIVATE DATABASE: BAKE_SALE_FUNDRAISER
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
8
Which data type should you use for columns that contain letters and special characters or numbers that will not be used in calculations?

A) CHAR
B) CHARACTER
C) TEXT
D) STRING
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
9
To display all the rows and columns in a table, type the word SELECT, followed by a(n) _____, followed by the keyword FROM and then the name of the table containing the data you want to view.

A) single quote
B) asterisk
C) double quote
D) slash
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
10
Which SQL command do you use to remove an entire row from a table?

A) REMOVE
B) DELETE
C) ERASE
D) DROP
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
11
SQL was developed in the mid-____.

A) 1950s
B) 1970s
C) 1990s
D) 2000s
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
12
What was the original name for SQL?

A) SEQUEL
B) MYSEQUEL
C) DBase
D) MySQL
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following is a valid name for a table?

A) TBL_1
B) 2_TBL
C) TBL 3
D) 4 tbl
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
14
Which general guideline for naming identifiers should you follow when creating a database and adding objects to it?

A) Make identifiers at least 35 characters long.
B) Begin the identifier with a number.
C) Include letters, numbers, and/or underscores.
D) Use spaces to separate words.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
15
Which MySQL command do you use to define a table's structure by listing its columns, data types, and column lengths?

A) NEW TABLE
B) DEFINE TABLE
C) CREATE TABLE
D) ADD TABLE
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
16
In SQL Server, you can execute the sp_columns command to list all the columns in a table.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following SQL commands changes the value in the column LAST_NAME within the row containing a REP_ID of 007?

A) UPDATE SALES_REP SET LAST_NAME = 'Bond' WHERE REP_ID = '007';
B) CHANGE SALES_REP LAST_NAME = 'Bond' WHERE REP_ID = '007';
C) REPLACE SALES_REP LAST_NAME = 'Bond' WHERE REP_ID = '007';
D) INSERT SALES_REP SET LAST_NAME = 'Bond' WHERE REP_ID = '007';
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
18
When a script file contains more than one command, each command must end with a(n) _____.

A) apostrophe
B) semicolon
C) period
D) colon
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
19
A text file with a .sql extension that contains SQL commands is a _____.

A) command file
B) batch process
C) SQL plugin
D) script file
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
20
A MySQL database includes a CUSTOMER table, which stores each customer's current balance in U.S. dollars and cents, among other information. The correct data type for the BALANCE column in the CUSTOMER table is _____.

A) CHAR
B) INT
C) SMALLINT
D) DECIMAL
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
21
Jesse has written some commands in MySQL Workbench that he expects to run regularly, and he would like to save them for future use. What should he do next?

A) copy and paste the query into a .txt file
B) click on Query, then select Execute
C) click on File, then Save Script As
D) select a script from within his file system and click Open
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
22
Which SQL command is used to view the data in a table?

A) VIEW
B) SELECT
C) SHOW
D) DISPLAY
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
23
Why does the POSTAL_CODE column in the REP table of the KimTay database have a data type of CHAR, if a postal code is made up of numbers?
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
24
Which statement about the command used to view all columns and rows in a database table is correct?

A) The same simple version of this command can be used in MySQL, Oracle, and SQL Server.
B) When using Oracle, the semicolon in the MySQL command must be replaced with a slash.
C) The command used in SQL Server is different from that used in MySQL and Oracle.
D) The command contains two symbols: an colon and a question mark.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
25
Which SQL command is used to add rows to a table once its structure has been defined?

A) ADD
B) SELECT
C) INSERT
D) CREATE
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
26
What are a script file and a script repository?
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
27
What special value is used in SQL to represent cases in which an actual value is unknown, unavailable, or not applicable?

A) varchar
B) empty
C) not null
D) null
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
28
In MySQL, Philip can use the command SELECT* FROM VACATION_PACKAGES; to _____.

A) select only certain rows to modify from the VACATION_PACKAGES table
B) display a list of tables in the VACATION_PACKAGES database
C) add a new row of data to the table VACATION_PACKAGES
D) display all rows and columns in the table VACATION_PACKAGES
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
29
Should a user be allowed to enter null values for the primary key?
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
30
How can you correct errors in data?
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
31
Laura is adding a new product to the CANDY table, which has columns for the product ID, name, description, and price. Price is a dollars and cents value; the others are strings of characters. Which SQL command should Laura use to add the row for the new product?

A) INSERT CANDY ROW (534, Cordial fudge, Dark chocolate fudge squares topped with a cherry swirl, 5.85);
B) INSERT VALUES ('534', 'Cordial fudge', 'Dark chocolate fudge squares topped with a cherry swirl', 5.85) INTO CANDY;
C) INSERT INTO CANDY VALUES (534, Cordial fudge, Dark chocolate fudge squares topped with a cherry swirl, 5.85);
D) INSERT INTO CANDY VALUES ('534', 'Cordial fudge', 'Dark chocolate fudge squares topped with a cherry swirl', 5.85);
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
32
When you add a row for which you have incomplete information to a SQL table, _____.

A) you must change the table structure so that all rows are marked as NOT NULL
B) you use the INSERT command and name the columns for which you are entering data
C) you use the INSERT command and enter a value of null for the columns without data
D) the DBMS will always reject the new row the first time you execute the command
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
33
Which statement about changing the default database is FALSE?

A) There are two steps to choosing a database to use: changing the default and activation.
B) The MySQL command USE SPIDERS; makes SPIDERS the default database.
C) Tables created in MySQL are added to the default database.
D) To activate a database, you execute the USE command followed by the database's name.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
34
Janice wants to examine the structure of the COFFEE table, which was created by a colleague, including the column names, data types, and acceptance/nonacceptance of null values. Which command should Janice execute?

A) CREATE TABLE COFFEE;
B) SELECT COFFEE;
C) SHOW COFFEE;
D) DESCRIBE COFFEE;
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
35
When creating a SQL table, _____.

A) add the NOT NULL clause for the columns that cannot contain null values
B) you must add PRIMARY KEY NOT NULL for the primary key column(s)
C) remember that the default behavior for table columns is to reject null values
D) include only those columns for which data will always be known and available
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 35 flashcards in this deck.