SQL Flashcards

1
Q

INNER JOIN

A

Select all records from Table A and Table B, where the join condition is met. Intersection.

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

RIGHT JOIN

A

Select all records from Table B, along with records from Table A for which the join condition is met (if at all).

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

FULL JOIN

A

Select all records from Table A and Table B, regardless of whether the join condition is met or not.

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

Left outer join

A

A left outer join will give all rows in A, plus any common rows in B

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

Right outer join

A

A right outer join will give all rows in B, plus any common rows in A.

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

Full outer join

A

A full outer join will give you the union of A and B, i.e. all the rows in A and all the rows in B. If something in A doesn’t have a corresponding datum in B, then the B portion is null, and vice versa.

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

core aggregate functions

A

AVG, COUNT, MIN, MAX, SUM

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

normalization

A

To free the collection of relations from undesirable insertion, update and deletion dependencies;

To reduce the need for restructuring the collection of relations, as new types of data are introduced, and thus increase the life span of application programs;

To make the relational model more informative to users;

To make the collection of relations neutral to the query statistics, where these statistics are liable to change as time goes by.

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

stored procedure

A

is a subroutine available to applications that access a RDBMS

Uses

  • data-validation (integrated into the database)
  • access-control mechanisms.
  • consolidate and centralize logic that was in applications. - execution of several SQL statements

One can use nested stored procedures by executing one stored procedure from within another.

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

SUBSTRING

A

SUBSTRING(‘hello’, 3, 1)

index 1 based!!

one letter is substring(‘hello’, 2, 2)

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

CASE

A
CASE
         WHEN blah THEN blah
         WHEN blah THEN blah
         ELSE blah
END
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

group by and getting id

A

joining back with subselect inside join to join columns that match and get id

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