Week 1 - SQL Query Language: Part 1 Flashcards
What is a relation list
A table or many tables
What is the target list
The attributes (fields) that you want
What is the qualifications
WHERE statement ( comparisons)
What does this mean?
Computer the cross product of the ‘relation-list’
Select from relation list
What does this mean?
Discard resulting tuples if they fail ‘qualifications’
do not get results that are not in the where statement
Filter out
What does this mean?
Delete attributes that are not in the ‘target-list’
Only return the fields that are ask for select name from table
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
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.
SQL INTERSECT Define
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
Nested Queries is like
sub queries
WHERE IN (select id from table)
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.
2) The nested query runs first, returning values to the main query.
Define Exists
The EXISTS operator is used to test for the existence of any record in a subquery. (returns true or false)
Define ANY
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.