CIS 1200 Ch 7 – Flashcards

Unlock all answers in this set

Unlock answers
question
A database language enables the user to create database and table structures to perform basic data management chores.
answer
True
question
A database language enables the user to perform complex queries designed to transform the raw data into useful information.
answer
True
question
The ANSI prescribes a standard SQL-the current fully approved version is known as SQL07.
answer
False
question
The ANSI SQL standards are also accepted by the ISO.
answer
True
question
SQL is considered difficult to learn; its command set has a vocabulary of more than 300 words.
answer
False
question
Data type selection is usually dictated by the nature of the data and by the intended use.
answer
True
question
Only numeric data types can be added and subtracted in SQL.
answer
False
question
Entity integrity is enforced automatically when the primary key is specified in the CREATE TABLE command sequence.
answer
True
question
The CHECK constraint is used to define a condition for the values that the attribute domain cannot have.
answer
False
question
SQL requires the use of the ADD command to enter data into a table.
answer
False
question
You cannot insert a row containing a null attribute value using SQL.
answer
False
question
To list the contents of a table, you must use the DISPLAY command.
answer
False
question
Any changes made to the contents of a table are not physically saved on disk until you use the SAVE command.
answer
False
question
The COMMIT command does not permanently save all changes. In order to do that, you must use SAVE.
answer
False
question
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.
answer
True
question
All SQL commands must be issued on a single line.
answer
False
question
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.
answer
True
question
You can select partial table contents by naming the desired fields and by placing restrictions on the rows to be included in the output.
answer
True
question
Oracle users can use the Access QBE (query by example) query generator.
answer
False
question
Mathematical operators cannot be used to place restrictions on character-based attributes.
answer
False
question
String comparisons are made from left to right.
answer
True
question
Date procedures are often more software-specific than other SQL procedures.
answer
True
question
SQL allows the use of logical restrictions on its inquiries such as OR, AND, and NOT.
answer
True
question
ANSI-standard SQL allows the use of special operators in conjunction with the WHERE clause.
answer
True
question
The conditional LIKE must be used in conjunction with wildcard characters.
answer
True
question
Most SQL implementations yield case-insensitive searches.
answer
False
question
Some RDBMSs, such as Microsoft Access, automatically make the necessary conversions to eliminate case sensitivity.
answer
True
question
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.
answer
True
question
An alias cannot be used when a table is required to be joined to itself in a recursive query.
answer
False
question
When joining three or more tables, you need to specify a join condition for one pair of tables.
answer
False
question
The current fully approved version of standard SQL prescribed by the ANSI is __________. a. SQL-99 b. SQL-2003 c. SQL-4 d. SQL-07
answer
b. SQL-2003
question
The data format for SQL character is __________. a. CHAR and VARCHAR b. VARCHAR only c. alphanumeric d. CHAR only
answer
a. CHAR and VARCHAR
question
The SQL command that allows a user to insert rows into a table is __________. a. INSERT b. SELECT c. COMMIT d. UPDATE
answer
a. INSERT
question
The SQL command that allows a user to permanently save data changes is __________. a. INSERT b. SELECT c. COMMIT d. UPDATE
answer
c. COMMIT
question
The SQL command that allows a user to list the contents of a table is __________. a. INSERT b. SELECT c. COMMIT d. UPDATE
answer
b. SELECT
question
To list all the contents of the PRODUCT table, a user would use __________. a. LIST * FROM PRODUCT b. SELECT * FROM PRODUCT c. DISPLAY * FROM PRODUCT d. SELECT ALL FROM PRODUCT
answer
b. SELECT * FROM PRODUCT
question
In Oracle, the __________ command is used to change the display for a column, for example, to place a $ in front of a numeric value. a. DISPLAY b. FORMAT c. CHAR d. CONVERT
answer
b. FORMAT
question
The SQL command that modifies an attribute's values in one or more table's rows is _____. a. INSERT b. SELECT c. COMMIT d. UPDATE
answer
d. UPDATE
question
UPDATE tablename ***** [WHERE conditionlist]; The command replaces the ***** in the syntax of the UPDATE command, shown above. a. SET columnname = expression b. columnname = expression c. expression = columnname d. LET columnname = expression
answer
a. SET columnname = expression
question
An example of a command a user 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'; b. ROLLBACK PRODUCT SET P_INDATE = '18-JAN-2004' WHERE P_CODE = '13-Q2/P2'; c. EDIT PRODUCT SET P_INDATE = '18-JAN-2004' WHERE P_CODE = '13-Q2/P2'; d. UPDATE PRODUCT SET P_INDATE = '18-JAN-2004' WHERE P_CODE = '13-Q2/P2';
answer
d. UPDATE PRODUCT SET P_INDATE = '18-JAN-2004' WHERE P_CODE = '13-Q2/P2';
question
The __________ command is used to restore the database to its previous condition. a. COMMIT; RESTORE; b. COMMIT; BACKUP; c. COMMIT; ROLLBACK; d. ROLLBACK;
answer
d. ROLLBACK;
question
Some RDBMSs, such as Oracle, automatically __________ data changes when issuing data definition commands. a. COMMIT b. ROLLBACK c. UNSAVE d. UPDATE
answer
a. COMMIT
question
To remove a row from the PRODUCT table, one must use the __________ command. a. COMMIT b. DELETE c. ERASE d. KILL
answer
b. DELETE
question
When a user issues the DELETE FROM tablename command without specifying a WHERE condition, __________. a. no rows will be deleted b. the first row will be deleted c. the last row will be deleted d. all rows will be deleted
answer
d. all rows will be deleted
question
ANSWER: d Which of the following is used to select partial table contents? a. SELECT FROM
BY ; b. LIST FROM
BY ; c. SELECT FROM
WHERE ; d. LIST FROM
WHERE ;
answer
c. SELECT FROM
WHERE ;
question
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'; b. REMOVE FROM PRODUCT WHERE P_CODE = 'BRT-345'; c. ERASE FROM PRODUCT WHERE P_CODE = 'BRT-345'; d. ROLLBACK FROM PRODUCT WHERE P_CODE = 'BRT-345';
answer
a. DELETE FROM PRODUCT WHERE P_CODE = 'BRT-345';
question
A(n) __________ is a query that is embedded (or nested) inside another query. a. alias b. operator c. subquery d. view
answer
c. subquery
question
Which of the following queries will output the table contents when the value of V_CODE is equal to 21344? a. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE 21344; b. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE 21344;
answer
c. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344;
question
Which of the following queries 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; b. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE 21344;
answer
a. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE 21344;
question
Which of the following queries will output the table contents when the value of P_PRICE is less than or equal to 10? a. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE P_PRICE 10; b. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE P_PRICE 10; d. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE P_PRICE = 10;
answer
b. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE P_PRICE <= 10;
question
Which of the following queries 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 < '1558-QW1'; b. SELECT P_CODE, P_DESCRIPT, P_QOH, P_MIN, P_PRICE FROM PRODUCT WHERE P_CODE = [1558-QW1]; c. SELECT P_CODE, P_DESCRIPT, P_QOH, P_MIN, P_PRICE FROM PRODUCT WHERE P_CODE = (1558-QW1); d. SELECT P_CODE, P_DESCRIPT, P_QOH, P_MIN, P_PRICE FROM PRODUCT WHERE P_CODE = {1558-QW1};
answer
a. SELECT P_CODE, P_DESCRIPT, P_QOH, P_MIN, P_PRICE FROM PRODUCT WHERE P_CODE < '1558-QW1';
question
Which of the following queries will list all the rows in which the inventory stock dates occur on or after January 20, 2010? a. SELECT P_DESCRIPT, P_QOH, P_MIN, P_PRICE, P_INDATE FROM PRODUCT WHERE P_INDATE >= '20-JAN-2010'; b. SELECT P_DESCRIPT, P_QOH, P_MIN, P_PRICE, P_INDATE FROM PRODUCT WHERE P_INDATE >= $20-JAN-2010$; c. SELECT P_DESCRIPT, P_QOH, P_MIN, P_PRICE, P_INDATE FROM PRODUCT WHERE P_INDATE = {20-JAN-2010};
answer
a. SELECT P_DESCRIPT, P_QOH, P_MIN, P_PRICE, P_INDATE FROM PRODUCT WHERE P_INDATE >= '20-JAN-2010';
question
Which of the following queries 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; b. SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH=P_PRICE FROM PRODUCT; c. SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH*P_PRICE FROM PRODUCT; d. SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH-P_PRICE FROM PRODUCT;
answer
c. SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH*P_PRICE FROM PRODUCT;
question
A(n) __________ is an alternate name given to a column or table in any SQL statement. a. alias b. data type c. stored function d. trigger
answer
a. alias
question
Which of the following queries 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; b. SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH=P_PRICE AS TOTVALUE FROM PRODUCT; c. SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH/P_PRICE AS TOTVALUE FROM PRODUCT; d. SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH-P_PRICE AS TOTVALUE FROM PRODUCT;
answer
a. SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH*P_PRICE AS TOTVALUE FROM PRODUCT;
question
Which of the following queries uses the correct SQL syntax to list the table contents for either V_CODE = 21344 or V_CODE = 24288? a. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344 OR V_CODE 24288; c. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344 OR V_CODE > 24288; d. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344 OR V_CODE = 24288;
answer
d. SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = 21344 OR V_CODE = 24288;
question
The special operator used to check whether an attribute value is within a range of values is __________. a. BETWEEN b. NULL c. LIKE d. IN
answer
a. BETWEEN
question
The __________ special operator is used to check whether an attribute value is null. a. BETWEEN b. IS NULL c. LIKE d. NOT NULL
answer
b. IS NULL
question
The special operator used to check whether an attribute value matches a given string pattern is __________. a. BETWEEN b. IS NULL c. LIKE d. IN
answer
c. LIKE
question
The special operator used to check whether a subquery returns any rows is __________. a. BETWEEN b. EXISTS c. LIKE d. IN
answer
b. EXISTS
question
The __________ command is used with the ALTER TABLE command to modify the table by deleting a column. a. DROP b. REMOVE c. DELETE d. ERASE
answer
a. DROP
question
A table can be deleted from the database by using the __________ command. a. DROP TABLE b. DELETE TABLE c. MODIFY TABLE d. ERASE TABLE
answer
a. DROP TABLE
question
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; b. SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT LIST BY P_PRICE; c. SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT ORDER BY P_PRICE; d. SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT ASCENDING BY P_PRICE;
answer
c. SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE FROM PRODUCT ORDER BY P_PRICE;
question
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; b. SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE FROM EMPLOYEE ORDER BY EMP_LNAME, EMP_FNAME, EMP_INITIAL; c. SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE FROM EMPLOYEE DISPLAY BY EMP_LNAME, EMP_FNAME, EMP_INITIAL; d. SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE FROM EMPLOYEE SEQUENCE BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
answer
b. SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE FROM EMPLOYEE ORDER BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
question
Which of the following queries 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; b. SELECT UNIQUE V_CODE FROM PRODUCT; c. SELECT DIFFERENT V_CODE FROM PRODUCT; d. SELECT DISTINCT V_CODE FROM PRODUCT;
answer
d. SELECT DISTINCT V_CODE FROM PRODUCT;
question
The SQL aggregate function that gives the number of rows containing non-null values for a given column is __________. a. COUNT b. MIN c. MAX d. SUM
answer
a. COUNT
question
The SQL aggregate function that gives the total of all values for a selected attribute in a given column is __________. a. COUNT b. MIN c. MAX d. SUM
answer
d. SUM
question
The SQL aggregate function that gives the arithmetic mean for a specific column is __________. a. COUNT b. AVG c. MAX d. SUM
answer
b. AVG
question
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; b. SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE = VENDOR.V_CODE; c. SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE VENDOR.V_CODE;
answer
b. SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE = VENDOR.V_CODE;
question
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 PRODUCT.P_DESCRIPT, PRODUCT.P_PRICE, VENDOR.V_NAME, VENDOR.V_CONTACT, VENDOR.V_AREACODE, VENDOR.V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE VENDOR.V_CODE ORDER BY PRODUCT.P_PRICE; b. SELECT PRODUCT.P_DESCRIPT, PRODUCT.P_PRICE, VENDOR.V_NAME, VENDOR.V_CONTACT, VENDOR.V_AREACODE, VENDOR.V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE => VENDOR.V_CODE ORDER BY PRODUCT.P_PRICE; c. SELECT PRODUCT.P_DESCRIPT, PRODUCT.P_PRICE, VENDOR.V_NAME, VENDOR.V_CONTACT, VENDOR.V_AREACODE, VENDOR.V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE <= VENDOR.V_CODE ORDER BY PRODUCT.P_PRICE; d. SELECT PRODUCT.P_DESCRIPT, PRODUCT.P_PRICE, VENDOR.V_NAME, VENDOR.V_CONTACT, VENDOR.V_AREACODE, VENDOR.V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE = VENDOR.V_CODE ORDER BY PRODUCT.P_PRICE;
answer
d. SELECT PRODUCT.P_DESCRIPT, PRODUCT.P_PRICE, VENDOR.V_NAME, VENDOR.V_CONTACT, VENDOR.V_AREACODE, VENDOR.V_PHONE FROM PRODUCT, VENDOR WHERE PRODUCT.V_CODE = VENDOR.V_CODE ORDER BY PRODUCT.P_PRICE;
question
The SQL data manipulation command HAVING: a. restricts the selection of rows based on a conditional expression. b. restricts the selection of grouped rows based on a condition. c. modifies an attribute's values in one or more table's rows. d. groups the selected rows based on one or more attributes.
answer
b. restricts the selection of grouped rows based on a condition.
question
The __________ constraint assigns a value to an attribute when a new row is added to a table. a. CHECK b. UNIQUE c. NOT NULL d. DEFAULT
answer
d. DEFAULT
question
The syntax for creating an index is __________. a. CREATE [NOT NULL] INDEX indexname FROM viewname(column1 [, column2]); b. CREATE [UNIQUE] INDEX indexname ON tablename( column1 [, column2]); c. CREATE [UNIQUE] INDEX indexname FROM tablename(column1 [, column2]); d. CREATE [DEFAULT] INDEX indexname ON viewname(column1 [, column2]);
answer
b. CREATE [UNIQUE] INDEX indexname ON tablename( column1 [, column2]);
question
According to the rules of precedence, which of the following computations should be completed first? a. Performing additions and subtractions b. Performing multiplications and divisions c. Performing operations within parentheses d. Performing power operations
answer
c. Performing operations within parentheses
question
All changes in a table structure are made using the __________ command, followed by a keyword that produces the specific changes a user wants to make. a. ALTER TABLE b. UPDATE TABLE c. COMMIT TABLE d. ROLLBACK TABLE
answer
a. ALTER TABLE
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New