Tezt 2 Flashcards

1
Q

By default, all duplicate values are included in an aggregate calculation unless you specify which keyword?

A

DISTINCT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What do MIN and MAX correlate to in reference to non numeric data?

A

MIN is alphabetical order a-z
MAX is alphabetical order z-a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Expressions coded in the HAVING clause__________________

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

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

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

can refer to any column in the base table

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A search condition in the ________________ clause is applied before the rows are grouped while a search condition in the _________________ clause isn’t applied until after the grouping.

A

WHERE
HAVING

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do WHERE clause expressions react to aggregate and non-aggregate search conditions

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

These six clauses of a SELECT statement must be coded in which order?

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

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A correlated subquery is one that _______________

A

is executed once for each row in the outer query

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

ORDER BY

SELECT

FROM

WHERE

A

select

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. A subquery can sometimes be restated as _______________
A

A join

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which operator can you use to test whether any rows are returned by a subquery?

A

EXISTS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Subqueries can be ________________ within other subqueries.

anchored

grandfathered

joined

nested

A

nested

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following statements deletes every row in the Vendors table?

DELETE Vendors WHERE ALL;

DELETE * Vendors;

DELETE ALL Vendors

DELETE Vendors;

A

DELETE Vendors;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If you omit the WHERE clause from a DELETE statement __________

Show answer choices

all columns in the table will be deleted

all rows in the table will be deleted

only rows with null values will be deleted

the table definition will be deleted

A

all rows in the table will be deleted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

MERGE

HAVING

ORDER B

A

WHERE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In an UPDATE statement, you can use a ________________ in the FROM clause if you need to specify column values or search conditions that depend on data from a table other than the one named in the UPDATE clause.

join

table

column

subquery

A

join

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When you use the SELECT INTO statement, the result set that’s defined by the SELECT statement is ________________ a new table.

copied into

deleted from

moved into

updated in

A

copied into

17
Q

If you use ________________ in the select list of a SELECT INTO statement, you must name the column since that name is used in the definition of the new table.

null values

calculated values

foreign keys

indexes

A

calculated values

18
Q

Write a SELECT statement that returns the LastName and JobTitle of each employee with a jobtitle other than ‘Engineer’ that has a SalaryWage greater than 65% of what the lowest paid employee with a jobTitle of engineer is paid.

A

SELECT LastName, JobTitle
FROM Employee
where SalaryWage > .65 *
(select min(salaryWage)
from Employee
where JobTitle = ‘Engineer’)

19
Q

Write a SELECT statement that returns the LastName and JobTitle of each employee that has a
SalaryWage greater than that of the highest paid employee with a jobTitle of “Programmer Analyst”.

A

SELECT LastName, JobTitle,
FROM Employee
WHERE SalaryWage >
(SELECT TOP 1 SalaryWage
FROM Employee
WHERE JobTitle like ‘Programmer Analyst’

20
Q

What is the command for deleting a table?

A

DROP TABLE (table)

21
Q

Difference between nchar and vchar?

A

Different charcater is an nchar(10) will always take up the same space. And supports unicode.

vchar(10) and then go, good, goo

All take up different amounts of space.

22
Q

syntax for insert into

A

INSERT INTO (new table)

SELECT (rows_needed)

FROM(table_taken

VALUES()

Make sure same amount for each

23
Q

Syntax for UPDATE

A

UPDATE talbe_name
SET Column

SET TermsID = 1

24
Q

Inner and Outer query?

A

Inner query is the stuff inside a subquery
Outer query is the otehr things