CIS407 Exam 2

5.0(1)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/47

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

48 Terms

1
New cards
Which statement do you use to delete an existing view?
DROP VIEW
2
New cards
A table that's used to create a view is called
a base table
3
New cards
The WITH ENCRYPTION clause of the CREATE VIEW statement
prevents users from seeing the code that defines the view
4
New cards
Each of the following is a benefit provided by using views except for one. Which one is it?
You can create a view that simplifies data insertion by hiding a complex INSERT statement within the view.
5
New cards
You can code views that
join tables, summarize data, and use subqueries and functions
6
New cards
Which of the following should you use to view the code that's generated for a view in the View Designer?
SQL Pane
7
New cards
Which statement do you use to modify an existing view?
ALTER VIEW
8
New cards
By default,
columns in a view are given the same names as the columns in the base tables
9
New cards
A view
is like a virtual table, consists only of the rows and columns specified in its CREATE VIEW statement, doesn't store any data itself
10
New cards
One way to examine the system objects that define a database is to use
catalog views
11
New cards
You use data definition language (DDL) to create, modify, and delete the \________________ of a database.
objects, sequences, table
12
New cards
Which of the following statements about the SPARSE attribute is true?
It optimizes the storage of null values for a column, It requires more overhead to retrieve non-null values, You should only use it when a column contains a high percentage of null values
13
New cards
What attribute can you use to optimize storage when coding the definition for a column that will contain a high percentage of null values?
SPARSE
14
New cards
A regular identifier
can contain a number sign (\#)
15
New cards
When you define a foreign key constraint, you can specify all but one of the following. Which one is it?
that the insertion of a row in a foreign key table that has a foreign key that isn't matched in the primary key table should be cascaded up to the primary key table
16
New cards
Each of the following column attributes is a column constraint, except
DEFAULT
17
New cards
When you use the CREATE TABLE statement to create a table, you can also define the attributes and \______________ for the columns.
constraints
18
New cards
What kind of constraint limits the values that can be stored in a column?
check constraint
19
New cards
When you code a table-level check constraint, the constraint can refer to data in more than one
column
20
New cards
Which statement is used to modify the structure of an existing table?
ALTER TABLE
21
New cards
If introduced as follows, the subquery can return which of the values listed below? SELECT (subquery)
a single value
22
New cards
If introduced as follows, the subquery can return which of the values listed below?WHERE VendorID NOT IN (subquery)
a column of one or more rows
23
New cards
A subquery is a/an \______________ statement that's coded within another SQL statement.
SELECT
24
New cards
You can't update
an identity column
25
New cards
If you code a column list in an INSERT statement that includes a column that has a default value, which keyword can you code in the VALUES clause to use the default value?
DEFAULT
26
New cards
To insert several rows selected from another table into a table, you can code an INSERT statement with a/an \______________ in place of the VALUES clause.
subquery
27
New cards
You use the UPDATE statement to modify one or more rows in the table named in the \________________ clause.
UPDATE
28
New cards
When you code a column list in an INSERT statement, you can omit identity columns, columns that have default values, and columns that allow \__________ values.
null
29
New cards
When you use the SELECT INTO statement, the result set that's defined by the SELECT statement is \________________ a new table.
copied into
30
New cards
The integer and decimal data types are considered \________________ because their precision is exact.
exact numeric data types
31
New cards
Write the code for an ORDER BY clause that sorts a table into numeric sequence by the data in the PartCode column if that column contains whole numbers that are stored with the varchar data type.
ORDER BY CAST (PartCode AS int)
32
New cards
Which data types are used to store whole numbers?
integer
33
New cards
The difference between the CAST function and the CONVERT function is that the \________________ function accepts an optional style argument that lets you specify a format for the result
CONVERT
34
New cards
Which function is typically used to insert control characters into a character string?
CHAR
35
New cards
If you omit both NULL and NOT NULL from the list of column attributes in a CREATE TABLE statement, which is the default setting?
NULL
36
New cards
A collation can affect all of the following except one. Which one?
how character data is concatenated
37
New cards
When you code a script for creating a database,
you need to create the referred to tables before you create the tables that refer to them
38
New cards
The CREATE TABLE statement
creates a new table in the current database
39
New cards
If introduced as follows, the subquery can return which of the values listed below?WHERE InvoiceTotal \> ALL (subquery)
a column of one or more rows
40
New cards
A subquery can be coded in a WHERE, FROM, SELECT, or \______________ clause.
HAVING
41
New cards
A common table expression (CTE) creates a temporary \_____________ that can be used by a query that follows.
table
42
New cards
If introduced as follows, the subquery can return which of the values listed below?SELECT (subquery)
a single value
43
New cards
Code example 6-1SELECT VendorName, COUNT(*) AS NumberOfInvoices,MAX(InvoiceTotal - PaymentTotal - CreditTotal) AS BalanceDueFROM Vendors JOIN Invoices ON Vendors.VendorID \= Invoices.VendorIDWHERE InvoiceTotal - PaymentTotal - CreditTotal \>(SELECT AVG(InvoiceTotal - PaymentTotal - CreditTotal)FROM Invoices)GROUP BY VendorNameORDER BY BalanceDue DESC;
(Please refer to code example 6-1.) When this query is executed, the NumberOfInvoices column for each row will show the number
of invoices for each vendor that have a larger balance due than the average balance due for all invoices
44
New cards
Write the code for a DELETE statement that deletes every row in the Vendors table
DELETE Vendors;
45
New cards
When you code an UPDATE statement for one or more rows, the SET clause specifies the new data for the specified columns and the \_________________ clause specifies which row or rows are to be updated.
WHERE
46
New cards
In an UPDATE statement, the WHERE clause will
specifiy the condition a row must meet to be updated
47
New cards
You specify the conditions that must be met for a row to be deleted in the which clause?
WHERE
48
New cards
In the INSERT statement that follows, assume that all of the table and column names are spelled correctly, that none of the columns are identity columns, and that none of them have default values or accept null values. What's wrong with the statement?INSERT INTO InvoiceCopy(VendorID, InvoiceNumber, InvoiceTotal, PaymentTotal, CreditTotal,TermsID, InvoiceDate, InvoiceDueDate)VALUES(97, '456789', 8344.50, 0, 0, 1, '2016-08-01');
The number of items in the column list doesn't match the number in the VALUES list.