Suffering quizsql

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

20 Terms

1
New cards

What is the correct order for SQL clauses?

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

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

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

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

Answer: B

2
New cards

What can be in the SELECT clause?

A) Filters and conditions

B) Aggregates without GROUP BY

C) Column names, expressions, aliases, aggregates (if GROUP BY is used)

D) HAVING conditions

Answer: C

3
New cards

What cannot be in the SELECT clause?

A) Aliases

B) Filters, conditions, aggregates without GROUP BY

C) Column names

D) Expressions

Answer: B

4
New cards

What can be in the WHERE clause?

A) Aggregates like AVG()

B) Row-level filters, comparisons, logical operators (AND, OR, NOT)

C) HAVING conditions

D) GROUP BY keywords

Answer: B

5
New cards

What cannot be in the WHERE clause?

A) Logical operators

B) Aggregate functions like AVG(), COUNT(), SUM()

C) Column names

D) Expressions

Answer: B

6
New cards

What can be in the GROUP BY clause?

A) Aliases

B) Columns used in SELECT or aggregate functions

C) Expressions not in SELECT

D) DESC keyword

Answer: B

7
New cards

What cannot be in the GROUP BY clause?

A) Columns

B) DESC keyword

C) Expressions used in SELECT

D) Aggregates

Answer: B

8
New cards

What can be in the HAVING clause?

A) Row-level filters

B) Conditions on aggregated results (e.g., HAVING AVG(price) > 100)

C) Logical operators only

D) Non-aggregated filters

Answer: B

9
New cards

What cannot be in the HAVING clause?

A) Conditions on aggregates

B) Filters on grouped data

C) Non-aggregated filters (use WHERE instead)

D) AVG() and COUNT()

Answer: C

10
New cards

What can be in the ORDER BY clause?

A) Column names, aliases, expressions, ASC/DESC

B) GROUP BY expressions

C) HAVING conditions

D) Aggregates only

Answer: A

11
New cards

What cannot be in the ORDER BY clause?

A) Column names

B) Grouping logic or filters

C) Aliases

D) ASC/DESC

Answer: B

12
New cards

What is the correct SQL clause order?

A) SELECT → FROM → WHERE → GROUP BY → HAVING → ORDER BY

B) SELECT → FROM → GROUP BY → WHERE → HAVING → ORDER BY

C) SELECT → WHERE → FROM → GROUP BY → ORDER BY → HAVING

D) SELECT → FROM → HAVING → WHERE → GROUP BY → ORDER BY

Answer: A

13
New cards

GROUP BY vs ORDER BY – what is the key difference?

A) GROUP BY sorts rows; ORDER BY filters rows

B) GROUP BY filters rows; ORDER BY groups rows

C) GROUP BY groups rows; ORDER BY sorts rows or groups

D) GROUP BY and ORDER BY do the same thing

Answer: C

14
New cards

GROUP BY vs ORDER BY – are they independent?

A) No – they must be used together

B) Yes – they are independent; one does not require the other

C) No – ORDER BY depends on GROUP BY

D) Yes – but only if HAVING is used

Answer: B

15
New cards

Can you use ORDER BY without GROUP BY?

A) No

B) Only with HAVING

C) Yes – ORDER BY works on rows even without grouping

D) Only with aggregates

Answer: C

16
New cards

Can you use GROUP BY without ORDER BY?

A) No

B) Only with WHERE

C) Yes – GROUP BY groups data regardless of sort order

D) Only with sorting

Answer: C

17
New cards

How do you sort by multiple fields?

A) ORDER BY field1, field2

B) ORDER BY field1 ASC, field2 DESC

C) GROUP BY field1, field2

D) HAVING field1, field2

Answer: B

18
New cards

Why does GROUP BY have nothing to do with ordering?

A) It only sorts rows

B) It only filters rows

C) It only groups rows for aggregation

D) It only applies HAVING

Answer: C

19
New cards

Why does ORDER BY have no impact on grouping?

A) It only filters rows

B) It only sorts rows or groups

C) It only applies HAVING

D) It only groups rows

Answer: B

20
New cards

Can GROUP BY and ORDER BY appear together?

A) No – they are mutually exclusive

B) Yes – they are independent and can be used together or separately

C) Only with HAVING

D) Only with WHERE

Answer: B