SQL Flashcards

1
Q

SQL

A

SQL, a programming language used to manipulate and query data in relational databases

the language used in talking to relational databases

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

Relational database

A

A type of database in which the relationships between the data points matter, and that requires a programming language to pull desired data

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

Field

A

A column in a database table

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

Record

A

A row in a database table

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

CRUD Functionality

A

Create
Read
Update
Delete

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

SELECT

A

Requests a column of tabular data

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

FROM

A

Specifies the table to access. Specifies what fields you want information from

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

WHERE

A

Sets conditions for inclusion. Specifies what tables those fields are coming from

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

GROUPBY

A

Aggregates the resulting rows into groups. Specifies how to aggregate the results

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

HAVING

A

Specifies any criteria that the aggregate results should meet

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

ORDER BY

A

Determines how the data is ordered. Specifies how to sort the results. Sorts all selected fields based on the value of one or more fields. By defaults, sorts in ascending order

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

ORDER BY… DESC

A

Sorts data in descending order

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

LIMIT

A

Determines how the data is limited in count. Specify how many records/rows to return in results

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

KEY

A

The attribute that uniquely identifies each item in the list

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

SCHEMA

A

A representation of tables that only shows the columns, The structure of a database or table, indicating how the data is organized and connected

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

ONE-TO-MANY

A

When an item in one table can be found in multiple references in another table

17
Q

FOREIGN KEY

A

Points to a primary key from another table. It is not a unique identifier in it’s own table

18
Q

PRIMARY KEY

A

Is usually the unique identifier in its table

19
Q

ALIASING

A

Temporarily renaming a field with a name that exists only for the duration of the query

20
Q

IDENTIFIER

A

Identifies a database object, often a table or the name of a field

21
Q

OPERATOR

A

Take some action, such as adding fields or renaming or aliasing a field

22
Q

EXPRESSION

A

Find specific sets of data

23
Q

PARENT TABLE

A

The table that stores the primary key

24
Q

CHILD TABLE

A

A table that uses a foreign key to reference the parent table

25
Q

ONE TO ONE RELATIONSHIP

A

A relationship where a single record in one table is related to a single record in another table, and neither column has duplicate records

26
Q

ONE TO MANY RELATIONSHIP

A

A relationship where a single record in one table is related to multiple records in another table

27
Q

MANY TO MANY RELATIONSHIP

A

A relationship where multiple records in one table are related to multiple records in another table

28
Q

JOINS

A

Operations that use data from two different tables

29
Q

INNER JOIN

A

requires that the tables being joined share a key and produces the set of all matching records from the tables.
Returns records that have matching values in both tables

30
Q

LEFT OUTER JOIN

A

All records from the first table are returned, regardless of whether or not a match is found in the second table

31
Q

RIGHT OUTER JOIN

A

All records from the second table are returned, regardless of whether or not a match is found in the first table

32
Q

FULL OUTER JOIN

A

returns all records from both Table A and Table B, regardless of whether or not there’s a match in the other table.

33
Q

JOINS NOTES

A

Take note of the combiner table. If all records from the first table is more important to keep, use it as the combiner, and vice versa

LEFT JOIN for table A over table B, is the same as RIGHT JOIN for table B over table A

LEFT JOIN for table A over table B is the opposite of the LEFT JOIN for table B over table A, and similar rule applies to RIGHT JOINS

34
Q

CTE

A

Common Table Expression, a temporary table or other result set that you can define and reference within a single query

35
Q

SUBQUERY

A

A query nested inside of another query, often used for some calculation or conditional logic that provides data to be used in the main part of the query

36
Q

date_part(‘year’, date_field)

A

used to extract the part of a date that is equal to the year

37
Q

R-SQUARED

A

measures how well your model fits your data