Suffering

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 order for SQL Clause. 

ORDER BY 

GROUP BY 

HAVING 

WHERE 

FROM 

SELECT

  1. SELECT

  2. FROM

  3. WHERE 

  4. GROUP BY

  5. HAVING 

  6. ORDER BY

2
New cards

What can be in SELECT clause

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

3
New cards

What cannot be in SELECT clause

Filters, conditions, aggregates without GROUP BY

4
New cards

What can be in WHERE clause

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

5
New cards

What cannot be in WHERE clause

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

6
New cards

What can be in GROUP BY clause

Columns used in SELECT or aggregate functions

7
New cards

What cannot be in GROUP BY clause

Aliases, expressions not in SELECT, DESC keyword

8
New cards

What can be in HAVING clause

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

9
New cards

What cannot be in HAVING clause

Non-aggregated filters (use WHERE instead)

10
New cards

What can be in ORDER BY clause

Column names, aliases, expressions, ASC/DESC

11
New cards

What cannot be in ORDER BY clause

Grouping logic or filters

12
New cards

Correct SQL clause order

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

13
New cards

GROUP BY vs ORDER BY – what are the key difference

GROUP BY groups rows; ORDER BY sorts rows or groups

14
New cards

GROUP BY vs ORDER BY – are they independence

They are independent; one does not require the other

15
New cards

Can you use ORDER BY without GROUP BY?

Yes – ORDER BY works on rows even without grouping

16
New cards

Can you use GROUP BY without ORDER BY?

Yes – GROUP BY groups data regardless of sort order

17
New cards

Sorting by multiple fields what do you use

Use: ORDER BY field1 ASC, field2 DESC

18
New cards

GROUP BY has nothing to do with ordering why?

It only groups rows for aggregation

19
New cards

ORDER BY has no impact on grouping why?

It only sorts rows or groups

20
New cards

Can GROUP BY and ORDER BY appear together?

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