SQL

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

When using mathematical functions in SQL, which of the following comes first in the order of operations? + - ( ) /

( )

What will be returned by the following query? SELECT MAX(season)FROM fcc_cc.passing (Note that you should not have to run this query to answer the question.) The query will run, but no records will be returned An error message 2018 2022

2022

6

6

Which of the following is NOT a relational operator used in SQL? > >= < ==

==

Which of the following statements is true about the WHERE and HAVING clauses? A SQL statement may have any number of WHERE clauses and any number of HAVING clauses A SQL statement may have a single WHERE clause and a single HAVING clause WHERE and HAVING are equivalent and interchangeable A SQL statement may have a WHERE clause or a HAVING clause, but not both

A SQL statement may have a single WHERE clause and a single HAVING clause

What does it mean if a primary key field within a record is null? There is no matching record in the foreign key table There is a syntax error in your query The column is ambiguously defined A primary key can never be null

A primary key can never be null

The _______ operator displays a record if all the conditions separated by ______ are TRUE. NOT, NOT OR, OR ALSO, ALSO AND, AND

AND, AND

What code should be added to the end of the SELECT statement to show "Total Inventory" as the column heading in the output of this query? SELECT SUM(unitsinstock)FROM northwinds.products 'Total Inventory' AS Total Inventory AS "Total Inventory" COLUMN Total Inventory

AS "Total Inventory"

Which SQL aggregate function returns the average of all non NULL values in a field? AVERAGE AVG COUNT SUM

AVG

A table in a FROM clause: Indicates a table that SELECTed fields can come from All of these answers May not be present between the JOIN and ON keywords Indicates a table that fields used in a WHERE clause can come from

All of these answers

The GROUP BY clause: indicates that we want our aggregate function to be calculated for each unique combination of values of the GROUP BY fields. should follow SELECT, FROM and WHERE (if present). All of these choices must contain any non-aggregate field(s) listed in the SELECT statement.

All of these choices

The ORDER BY clause: if present, should be the final clause in a SQL query. sorts in ascending order by default, but can be made to sort in descending order if desired. All of these choices can be used with numeric, character, and date data types

All of these choices

Which aggregate functions in SQL can be used with numeric fields? AVG All of these choices COUNT SUM

All of these choices

Which of the following functions can be used with text fields? SUM All of these choices COUNT AVG

COUNT

Which statement is true of the COUNT () aggregate function in SQL? COUNT can be used with text and numeric fields. COUNT will include null values. COUNT can be used only with numeric fields. COUNT will return the total sum of a numeric field.

COUNT can be used with text and numeric fields.

If a field is used in a WHERE clause, it must also be present in the SELECT field list. True False

False

The aggregate function included in the HAVING clause must also be in the SELECT clause. True False

False

You can have only one aggregate function in a SELECT. True False

False

Select the clause below that is missing from the following query: SELECT categoryname, categoryid, COUNT(productid) FROM northwinds.products JOIN northwinds.categories ON categories.categoryid = products.categoryid ... ORDER BY categoryid ASC GROUP BY categoryid GROUP BY categoryid, categoryname HAVING categoryid = 8 None of these

GROUP BY categoryid, categoryname

Which of the following clauses could be the missing clause from this query? SELECT COUNT(orderid), companyname FROM northwinds.orders JOIN northwinds.customers ON customers.customerid = orders.customerid GROUP BY companyname ...... WHERE companyname = 'Island Trading' HAVING shipperid = 3 HAVING SUM(freight) > 300 WHERE freight > 300

HAVING SUM(freight) > 300

Which of the following statements is true? If a column alias contains spaces, it must be in quotation marks. A column alias is always displayed in upper case. The only use of a column alias is to change the headings in the query output. A column alias must always be in quotation marks.

If a column alias contains spaces, it must be in quotation marks.

The ______ clause is used to combine rows from two or more tables, based on a related column between them. DISTINCT SELECT WHERE JOIN

JOIN

Reading Quiz 7: Computations with SQL

Reading Quiz 7: Computations with SQL

Reading Quiz 8: Grouping and Ordering

Reading Quiz 8: Grouping and Ordering

Reading Quiz 9: Column

Reading Quiz 9: Column

The DISTINCT keyword immediately follows which keyword? SELECT ORDER BY WHERE FROM

SELECT

Choose the correct order of SQL clauses below: SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY SELECT, FROM, JOIN, WHERE, HAVING, GROUP BY, ORDER BY SELECT, JOIN, FROM, WHERE, GROUP BY, HAVING, ORDER BY SELECT, FROM, JOIN, WHERE, ORDER BY, GROUP BY, HAVING

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

Which of the following are true regarding case-sensitivity (i.e., whether or not capitalization matters) in SQL? SQL keywords are not case-sensitive, but string comparisons are case-sensitive Neither SQL keywords nor string comparisons are case-sensitive. SQL keywords are case-sensitive, but string comparisons are not case-sensitive Both SQL keywords and string comparisons are case-sensitive

SQL keywords are not case-sensitive, but string comparisons are case-sensitive

Which of the following aggregate functions could you use to get a the total of all the values in a field? SUM AVG COUNT All of these choices

SUM

What will be returned by the following query? SELECT MIN(shippeddate) FROM northwinds.orders The earliest ship date for all orders null An error, because MIN() cannot be used on a date field The latest ship date for all orders

The earliest ship date for all orders

In a weighted average, the denominator is: The number of items averaged times the sum of the weights The scaling factor The number of items averaged The sum of the weights

The sum of the weights

What is the maximum number of JOIN clauses that can be present in a SQL query? 2 There is no practical limit 5 1

There is no practical limit

A column alias may be used in the ORDER BY clause. True False

True

An ORDER BY clause may include fields, aggregate functions, and mathematical expressions involving fields and aggregate functions. True False

True

In SQL, you can do mathematical operations in the SELECT, WHERE, HAVING, and ORDER BY clauses. True False

True

The following query is intended to calculate the number of null values in the field cmp_perc. What should the condition in the WHERE clause be? SELECT COUNT(*)FROM fcc_cc.passingWHERE ??? cmp_perc IS NULL COUNT(cmp_perc) = 0 cmp_perc = NULL() cmp_perc = NULL

cmp_perc IS NULL

The HAVING clause... cannot include any of the fields used in the ORDER BY clause. Two (but not all three) of these choices is constructed the same way as the JOIN clause except that it uses aggregate functions rather than fields. is constructed the same way as the WHERE clause except that it uses aggregate functions rather than fields.

is constructed the same way as the WHERE clause except that it uses aggregate functions rather than fields.

A scaling factor is used to adjust the ____________ of all values of a statistic. magnitude precision mantissa weighted average

magnitude

A quantifiable indicator used to measure the success of a business process is called a: business process milestone weighted average metric

metric

To explicitly specify the order in which comparisons should be performed, we would use ________________. single quotations ' ' parentheses ( ) asterisk * * square brackets [ ]

parentheses ( )

What is the appropriate JOIN condition in the following query? SELECT progressive, xgFROM fcc_cc.passingJOIN fcc_cc.standard_stats ON ??? passing.player_id = standard_stats.player_id passing.id = standard_stats.id passing.id = standard_stats.player_id passing.player_id = standard_stats.id

passing.id = standard_stats.id

Each record in the standard_stats table of the FCC_CC database contains standard statistics for a: player squad and season player and season player, season, and squad

player, season, and squad

The WHERE clause is used to limit the number of _______________ returned by a query. rows columns fields tables

rows

What would the following query display? SELECT COUNT(*)FROM northwinds.ordersWHERE shipcountry = 'USA' the total value of orders shipped to USA an error message nothing, you cannot use COUNT(*) the number of orders shipped to USA

the number of orders shipped to USA


Set pelajaran terkait

Chapter 9- Combining forms Heart

View Set

Chapter 53: Assessment of Kidney and Urinary Function

View Set

Advanced Multiplication Table (50 x 50)

View Set

Ch.4 quiz: Social structure & social integration

View Set

CHAPTER 5 Cybersecurity and Risk Management Technology

View Set

Unit 1: Human Ingenuity vocabulary

View Set

1968: A Tumultuous Year Guided Reading

View Set