sql server admin final studying

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/196

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.

197 Terms

1
New cards

If you want to use the Management Studio to modify the data for a table, you can right-click on the table and select the

Edit Top 200 Rows command

2
New cards

The Query Editor of the Management Studio lets you enter and execute all types of

SQL statements

3
New cards

When you use Windows authentication to connect to a database, SQL Server

uses the login name and password that you use for your PC to authorize your connection

4
New cards

You can create a database diagram for

any combination of the tables in a database

5
New cards

When you set the compatibility level of SQL Server 2012, you make sure it is compatible with a specific version of

SQL Server

6
New cards

SQL Server comes with complete documentation and reference information called ____________________________________.

Books Online

7
New cards

A database __________________ is a schematic drawing that shows you the relationships between the tables you're working with.

diagram

8
New cards

Which of the following isn't a common error when entering and executing SQL statements?

Forgetting to attach the required database

9
New cards

Before you can use the Management Studio to work with the objects in a database, you must ___________ the database files to an instance of SQL Server.

attach

10
New cards

Within the Management Studio, you can build a SQL statement without having to write your own code by using the ____________________________________.

Query Designer

11
New cards

The ________________________________________ is a graphical user interface for working with the objects in a SQL Server database.

Management Studio

12
New cards

One limitation of the Query Designer is that you can't use it for

certain types of complex queries

13
New cards

Which of the following types of statements isn't an action query?

Select

14
New cards

Which of the following types of SQL statements isn't a DML statement?

CreateTable

15
New cards

The SQL dialect that Microsoft SQL Server uses is called _______________.

Transact SQL

16
New cards

If you define a column as an identity column,

a number is generated for that column whenever a row is added to the table

17
New cards

To run a SELECT statement from an application program, you store the statement in the ____________ object for the database connection.

command

18
New cards

Insert, Update, and Delete statements can be referred to as ______________ queries.

action

19
New cards

SQL statements that define the tables in a database are referred to as _______________ statements.

DDL OR Data Definition Langauge

20
New cards

The three main hardware components of a client/server system are the clients, the server, and the __________________________________.

network

21
New cards

To retrieve or update the data in a database, the client sends a/an ________________ to the database.

query

22
New cards

Which of the following recommendations won't improve the readability of your SQL statements?

Use comments to describe what each statement does.

23
New cards

A/An __________________ uniquely identifies each row in a table.

primary key

24
New cards

Although the American National Standards Institute publishes the specifications for a standard SQL language, each DBMS vendor has its own _______________ of SQL.

dialect OR variant

25
New cards

To work with the data in a SQL Server database from a .NET application, you can use ADO.NET objects like

commands, connections, and data readers

26
New cards

A view is a SELECT statement that is stored with the ______________.

database

27
New cards

The processing that's done by the DBMS is typically referred to as

back-end processing

28
New cards

The most common type of relationship between two tables is a/an ___________________ relationship.

one to many

29
New cards

The intersection of a row and a column is commonly called a/an _______________.

cell

30
New cards

The interface between an application program and the DBMS is usually provided by the

data access API

31
New cards

When a column in a table is defined, it is given a data _________ that determines what kind of data it can store.

type

32
New cards

If you define a column with a default value, that value is used whenever a row

that doesn't include a value for that column is added to the table

33
New cards

A relational database consists of one or more ___________.

tables

34
New cards

To relate one table to another, a/an __________________ in one table is used to point to the primary key in another table.

foreign key

35
New cards

To sort the records that are retrieved by a SELECT statement in descending sequence by InvoiceTotal, you code _________ after ORDER BY InvoiceTotal.

DESC

36
New cards

Which ORDER BY clause will cause 10 rows to be retrieved from the result set, starting with the 20th row?

ORDER BY InvoiceTotal DESC
OFFSET 20 ROWS
FETCH NEXT 10 ROWS

37
New cards

To retrieve rows in which an expression matches a string pattern called a mask, you can use the ______________ keyword followed by the mask.

LIKE

38
New cards

If you want to filter the result set that's returned by a SELECT statement, you must include a/an ___________________ clause.

WHERE

39
New cards

The order of precedence for the logical operators in a WHERE clause is

Not, And, Or

40
New cards

To concatenate character strings, you use the _____________ operator in a string expression.

*

41
New cards

When you code an ORDER BY clause, you can specify a

column name, alias, expression, or column number

42
New cards

To override the order of precedence in an arithmetic expression, you can use __________________.

parentheses

43
New cards

When coded in a WHERE clause, which search condition will return invoices when PaymentDate is not null and InvoiceTotal is greater than or equal to $500?

PaymentDate IS NOT NULL AND InvoiceTotal >= 500

44
New cards

When coded within a SELECT clause, which TOP clause will return a result set consisting of the ten largest InvoiceNumbers?

TOP 10 InvoiceNumber

45
New cards

Unless you assign a/an _____________________________, the column name in the result set is the same as the column name in the base table.

column alias

46
New cards

To prevent duplicate rows from being returned by a SELECT statement, you can code the __________________ keyword in the SELECT clause.

DISTINCT

47
New cards

The ________________ clause of the SELECT statement names the table that contains the data to be retrieved.

FROM

48
New cards

To return all of the columns from the base table, you can code the ___________ operator in the SELECT clause.

*

49
New cards

When you code a SELECT statement, you must code the four main clauses in the following order

SELECT, FROM, WHERE, ORDER BY

50
New cards

Which of the following expressions will not compute 10% of the balance due if balance due is the invoice total minus the credit total minus the payment total?

InvoiceTotal - CreditTotal - PaymentTotal / 10

51
New cards

Which of the following is not a valid column alias name?

Total Sales

52
New cards

When coded in a WHERE clause, which of the following search conditions will not return a result set that includes all invoices with an InvoiceTotal value of $1000 or less?

InvoiceTotal IN (0,1000)

53
New cards

If you want to join all of the rows in the first table of a SELECT statement with just the matched rows in a second table, you use a/an _______________ join.

left outer

54
New cards

When you use the implicit syntax for coding inner joins, the join conditions are coded in the ____________ clause.

WHERE

55
New cards

Code example 4-1
SELECT VendorName AS Vendor, InvoiceDate AS DateFROM Vendors AS V JOIN Invoices AS ION V.VendorID = I.VendorID;
(Refer to code example 4-1.) The column name for the second column in the result set will be __________________________.

Date

56
New cards

A union combines the rows from two or more _______________________.

SELECT statements

57
New cards

You don't ever need to code a right outer join because

right outer joins can be converted to left outer joins

58
New cards

When you code a union that combines two result sets, which of the following is not true?

The result sets must be derived from different tables.

59
New cards

Code example 4-1
SELECT VendorName AS Vendor, InvoiceDate AS DateFROM Vendors AS V JOIN Invoices AS ION V.VendorID = I.VendorID;
(Refer to code example 4-1.) The name "V" is known as a/an ____________________________________.

table alias

60
New cards

Code example 4-1
SELECT VendorName AS Vendor, InvoiceDate AS DateFROM Vendors AS V JOIN Invoices AS ION V.VendorID = I.VendorID;
(Refer to code example 4-1.) This type of join is called a/an __________________ join.

inner

61
New cards

When you need to code multiple conditions in a join, its best to

code only join conditions in the ON clause

62
New cards

Code example 4-2
SELECT VendorName, InvoiceNumberFROM Invoices LEFT JOIN VendorsON Invoices.VendorID = Vendors.VendorID;
(Refer to code example 4-2.) If the LEFT keyword is replaced with the FULL keyword, the total number of rows that are returned must equal

none of the above

63
New cards

A full outer join includes rows that satisfy the join condition, plus

rows in both tables that don't satisfy the join condition

64
New cards

When you code a union with the INTERSECT keyword to combine two result sets, the union

includes only rows that occur in both result sets

65
New cards

Code example 4-2
SELECT VendorName, InvoiceNumberFROM Invoices LEFT JOIN VendorsON Invoices.VendorID = Vendors.VendorID;
(Refer to code example 4-2.) The total number of rows returned by this query must equal

the number of rows in the Invoices table

66
New cards

Code example 4-2
SELECT VendorName, InvoiceNumberFROM Invoices LEFT JOIN VendorsON Invoices.VendorID = Vendors.VendorID;

the number of rows in the Vendors table

67
New cards

If you want to join all of the rows in two tables whether or not they are matched, you use a/an _______________ join.

full outer

68
New cards

Which of the following is not a reason for using the explicit syntax instead of the implicit syntax for inner joins? The explicit syntax

can be used for more than two tables

69
New cards

If you assign a correlation name to one table in a join,

you have to use that name for the table

70
New cards

In a join, column names need to be qualified only

when the same names are used in both tables

71
New cards

Code example 4-1
SELECT VendorName AS Vendor, InvoiceDate AS DateFROM Vendors AS V JOIN Invoices AS ION V.VendorID = I.VendorID;
(Refer to code example 4-1.) This join is coded using the _____________________________ syntax.

explicit

72
New cards

In most cases, the join condition of an inner join uses the _______________ operator to compare two keys.

equal

73
New cards

___________________ names can be used when you want to assign a temporary name to a table.

Correlation

74
New cards

Code example 4-2SELECT VendorName, InvoiceNumberFROM Invoices LEFT JOIN VendorsON Invoices.VendorID = Vendors.VendorID;

(Refer to code example 4-2.) If the LEFT keyword is replaced with the RIGHT keyword, the total number of rows that are returned must equal

the number of rows in the Vendors table

75
New cards

In most cases, the join condition of an inner join compares the primary key of one table to the ____________________ key of another table.

foreign

76
New cards

In a cross join, all of the rows in the first table are joined with all of the

rows in the second table

77
New cards

Expressions coded in the WHERE clause

can use non-aggregate search conditions but can't use aggregate search conditions

78
New cards

Write an aggregate expression for the number of unique values in the VendorID column:

COUNT(DISTINCT VendorID)

79
New cards

By default, all duplicate values are included in the aggregate calculation, unless you specify the ___________________________ keyword.

DISTINCT

80
New cards

Which of the statements below best describes the result set returned by this SELECT statement?SELECT VendorID,SUM(InvoiceTotal - PaymentTotal - CreditTotal) AS Column2FROM InvoicesWHERE InvoiceTotal - PaymentTotal - CreditTotal > 0GROUP BY VendorID;

The total unpaid balance due for each VendorID

81
New cards

(Please refer to code example 5-1.) Although this query runs as coded, it contains this logical error:

The column name for the fifth column in the result set doesn't match the data.

82
New cards

You can use the OVER clause with an aggregate function to

include the rows used to calculate the summary in the result set

83
New cards

Expressions coded in the HAVING clause

can use either aggregate search conditions or non-aggregate search conditions

84
New cards

The GROUPING SETS operator works like the ROLLUP and CUBE operators, but it

All of the above. (Only increases summary rows, only adds summary rows for specified groups, allows you to use additional sets of parentheses to create composite groups)

85
New cards

All of the aggregate functions ignore null values, except for the ______________________________ function.

COUNT(*)

86
New cards

Which of the statements below best describes the result set returned by this SELECT statement?SELECT VendorState, COUNT() AS Column2FROM VendorsGROUP BY VendorStateHAVING COUNT() > 1;

The number of vendors in each state having more than one vendor

87
New cards

(Please refer to code example 5-1.) When this summary query is executed, the result set will contain one summary row for

each vendor with invoice totals over $500

88
New cards

Write an aggregate expression to find the VendorName column that's last in alphabetical order:

MAX(VendorName)

89
New cards

Write an aggregate expression to calculate the average value of the InvoiceTotal column, excluding null values:

AVG(InvoiceTotal)

90
New cards

Write an aggregate expression for the number of entries in the VendorName column, including null values:

COUNT(*)

91
New cards

A SELECT statement that includes aggregate functions is often called a/an _____________________________ query.

summary

92
New cards

The six clauses of the SELECT statement must be coded in the following order:

SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY

93
New cards

When coding a query with two columns in the GROUP BY clause, you can insert a summary row for each major group by coding the ___________________________ operator.

ROLLUP

94
New cards

A subquery is a/an ______________ statement that's coded within another SQL statement.

SELECT

95
New cards

(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

96
New cards

A subquery can be coded in a WHERE, FROM, SELECT, or ______________ clause.

HAVING

97
New cards

(Please refer to code example 6-2.) In this query, the table named Top10 is coded as a/an ________________________.

CTE

98
New cards

(Please refer to code example 6-2.) When this query is executed, the result table will contain one row for

each vendor in the Top10 table

99
New cards

(Please refer to code example 6-2.) In this query, the table named Top10 is used as part of a ________________________.

join

100
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