SQL Flashcards

1
Q

What is the Having and Group By clauses for?

A

To perform aggregate calculation and filter results on specific conditions.

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

What is the difference between an inner and outer join?

A

Inner only returns matching rows of the two tables in a join, outer join return all the unmatched rows from either the left, right or both tables in the join.

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

What two sql functions handle null datasets?

A

Coalesce() and NVL()

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

What does the coalesce function do?

A

Takes two or more expressions and returns the first expression that is not-null from the list of expressions.

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

What is the difference between BETWEEN and IN operators in SQL?

A

Between is for a range of values, IN specifies multiple possible values

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

What is a correlated subquery?

A

A subquery that uses data from the containing query.

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

What are the database Constraints?

A
  1. DEFAULT
  2. UNIQUE
  3. NOT NULL
  4. PRIMARY KEY
  5. FOREIGN KEY
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a foreign key?

A

A database enforced link between tables.

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

What is the difference between INTERSECT and UNION?

A

INTERSECT return rows that are common to both queries, UNION returns all distinct rows

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

What are some aggregate functions?

A
  1. MIN()
  2. COUNT()
  3. FIRST()
  4. LAST()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are some scalar functions?

A
  1. UCASE()
  2. ROUND()
  3. NOW()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between UNION and UNION ALL

A

UNION is distinct rows, UNION ALL allows duplicates

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

What is the difference between a clustered and non-clustered index?

A

Database keeps the data in the same order as the keys in the clustered index.

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

What are the 4 relationships in SQL?

A
  1. One-to-One
  2. One-to-Many
  3. Many-to-Many
  4. Self-reference
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly