SQL Code

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

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

SELECT

specifies the attributes to be returned by the query

2
New cards

FROM

specifies the table(s) from which the data will be retrieved

3
New cards

WHERE

filters the rows of data based on provided criteria

  • SELECT FROM WHERE

4
New cards

GROUP BY

groups the rows of data into collections based on sharing the same values in one or more attributes

  • SELECT FROM WHERE GROUP BY

5
New cards

HAVING

filters the groups formed in the GROUP BY clause based on provided criteria

  • SELECT FROM WHERE GROUP BY HAVING

6
New cards

ORDER BY

sorts final query result rows in ascending or descending order based on the values of one or more attributes

  • SELECT, FROM, ORDER BY

7
New cards

JOIN USING

returns only the rows with matching values in the column indicated in the USING clause—and that column must exist in both tables

  • SELECT FROM JOIN USING

8
New cards

JOIN ON

express a join when the tables have no common attribute names. query returns only the rows that meet the indicated join condition

  • SELECT FROM JOIN ON

9
New cards

special operators

BETWEEN, IN, LIKE, IS NULL, NOT

10
New cards

aggregate functions

count, min, max, sum, avg

11
New cards

subquery

  • query (SELECT statement inside another query)

  • can return one or more values

12
New cards

types of subqueries

  • WHERE: most common, uses an inner select on the right side of a WHERE comparison expression

  • IN

  • HAVING: used to restrict the output of a GROUPBY query by applying conditional criteria

  • multirow (ALL and ANY)

    • ALL: compares a single value with a list of values returned by first query using comparison operator

    • ANY: compares single value to list of values and select only rows greater than or less than value in list

  • FROM: specifies from which data will be drawn

13
New cards

Other functions

  • data and time

  • numeric

  • string

  • conversion

14
New cards

UNION

combines rows from two or more queries without including duplicate rows

15
New cards

UNION ALL

used to produce a relation that retains the duplicate rows and to unite more than just two queries

16
New cards

INTERSECT

can be used to combine rows from two queries, returning only the rows that appear in both sets

17
New cards
18
New cards
19
New cards