SQL Fundamentals Flashcards

1
Q

What are the 5 database models?

A

1) Relational (Postgres)
2) Document (MongoDb)
3) Key/Value (Redis)
4) Graph (Neo4j)
5) Wide Columnar (Apache Cassandra)

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

What is Cardinality?

A

The number of distinct values in a table column relative to the number of rows in the table. For example, if a column has 100 rows and only 10 unique values, the cardinality of that column is 10.

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

What is a primary key?

A

It is a unique identifier for each row in a table

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

What is a foreign key?

A

It is a key that references the primary key in another table

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

What is OLTP?

A

Online transaction processes.

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

What is OLAP?

A

Online Analytical Processing

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

What are the 2 DCL (Data Control Language) commands?

A

1) Grant
2) Revoke

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

What are the 6 DDL (Data Definition Language) commands?

A

1) Create
2) Alter
3) Drop
4) Rename
5) Truncate
6) Comment

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

What is the 1 DQL (Data Q Language) command?

A

Select

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

What are the 7 DML (Data Modification Language) commands?

A

1) Insert
2) Update
3) Delete
4) Merge
5) Call
6) Explain Plain
7) Lock Table

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

How do you rename a column in SQL?

A

SELECT column as <new_name></new_name>

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

What is the diff between single & double quotes in SQL?

A

Single: Refers to characters/text
Double: Refers to column name

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

How do you combine 2 columns in a query?

A

SELECT CONCAT(col1, ‘ ‘, col2) AS <new> from tableName</new>

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

What is an Aggregate function in SQL?

A

It is a function that aggregates data. Example is SUM, that returns the sum of all items.

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

What is a Scalar function in SQL?

A

It is a function that runs for each row in the dataset. Example is CONCAT

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

What is the order of Precedence in a SQL query?

A

1) Parenthesis
2) Multiplication/Division
3) Subtraction/Addition
4) NOT
5) AND
6) OR

17
Q
A