SQL

Question 1

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

a.

TOP InvoiceNumber, InvoiceTotal

b.

TOP 10 InvoiceTotal

c.

TOP 10 InvoiceNumber

d.

TOP 10 PERCENT WITH TIES InvoiceNumber

e.

TOP 10 PERCENT InvoiceNumber

10 points

Question 2

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

a.

NOT (PaymentDate IS NULL AND InvoiceTotal <=500)

b.

PaymentDate IS NOT NULL OR InvoiceTotal >=500

c.

PaymentDate IS NOT NULL AND InvoiceTotal >=500

d.

PaymentDate IS NULL AND InvoiceTotal >500

10 points

Question 3

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

a.

column name or expression

b.

column name or alias

c.

column name, alias, or expression

d.

column name, alias, expression, or column number

10 points

Question 4

The order of precedence for the logical operators in a WHEREclause is

a.

Not, Or, And

b.

And, Or, Not

c.

Not, And, Or

d.

Or, And, Not

10 points

Question 5

Which of the following is not a valid column aliasname?

a.

TotalSales

b.

Total

c.

“Total Sales”

d.

Total Sales

10 points

Question 6

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

a.

(InvoiceTotal – (PaymentTotal + CreditTotal)) *0.10

b.

((InvoiceTotal – PaymentTotal) – CreditTotal) /10

c.

(InvoiceTotal – PaymentTotal – CreditTotal) /10

d.

InvoiceTotal – CreditTotal – PaymentTotal /10

10 points

Question 7

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

a.

InvoiceTotal BETWEEN 0 AND 1000

b.

InvoiceTotal IN (0,1000)

c.

NOT (InvoiceTotal > 1000)

d.

InvoiceTotal <= 1000

10 points

Question 8

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

a.

ORDER BY InvoiceTotal DESC
    OFFSET 20 ROWS
    FETCH FIRST 10 ROWS

b.

ORDER BY InvoiceTotal DESC
    OFFSET 0 ROWS
    FETCH NEXT 10 ROWS

c.

ORDER BY InvoiceTotal DESC
    OFFSET 10 ROWS
    FETCH FIRST 20 ROWS

d.

ORDER BY InvoiceTotal DESC
    OFFSET 20 ROWS
    FETCH NEXT 10 ROWS

10 points

Question 9

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

a.

SELECT, FROM, WHERE, ORDER BY

b.

SELECT, WHERE, ORDER BY, FROM

c.

SELECT, FROM, ORDER BY, WHERE

d.

SELECT, ORDER BY, FROM, WHERE