Week 1 - SQL Query Language: Part 1 Flashcards

1
Q

What is a relation list

A

A table or many tables

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

What is the target list

A

The attributes (fields) that you want

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

What is the qualifications

A

WHERE statement ( comparisons)

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

What does this mean?

Computer the cross product of the ‘relation-list’

A

Select from relation list

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

What does this mean?

Discard resulting tuples if they fail ‘qualifications’

A

do not get results that are not in the where statement

Filter out

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

What does this mean?

Delete attributes that are not in the ‘target-list’

A

Only return the fields that are ask for select name from table

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

Why do we use distinct clause in SQL?

1) To show all occurrences of a value in a column in the table
2) To show unique values of a column in the table
3) To show how to group values in a column

A

2) To show unique values of a column in the table

Distinct in SQL shows all unique values of a column or group of columns.

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

SQL INTERSECT Define

A

he INTERSECT operation is really useful when you want to keep only those tuples that are present in both sets that are combined using INTERSECT:

The overlap of the two tables

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

Nested Queries is like

A

sub queries

WHERE IN (select id from table)

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

Which query is executed first in a nested subquery?

1) The main and nested queries run simultaneously and then a join is performed.
2) The nested query runs first, returning values to the main query.
3) The main query runs first, returning values to the nested query.

A

2) The nested query runs first, returning values to the main query.

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

Define Exists

A

The EXISTS operator is used to test for the existence of any record in a subquery. (returns true or false)

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

Define ANY

A

The ANY and ALL operators are used with a WHERE or HAVING clause.

The ANY operator returns true if any of the subquery values meet the condition.

The ALL operator returns true if all of the subquery values meet the condition.

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