In: Computer Science
1. What is one of the most powerful features of SQL?
Operators
Functions
Table Joins
2. A JOIN is a mechanism used to associate tables within a SELECT statement?
True
False
3. A JOIN can modify existing database tables
True
False
None of the above
4. The WHERE clause acts as a filter to only include rows that match the filter condition.
True
False
5. The more tables you JOIN the less resources the system uses.
True
False
6. The most commonly used JOIN is the INNER JOIN
True
False
7.Excluding the INNER JOIN, which of the following is not one of the three additional types of table JOINS
SELF JOIN
NATURAL JOIN
8. What OPERATOR is used to combine queries
FROM
UNION
EXCLUDE
9. When combining queries, how many ORDER BY clauses does the UNION operator use?
1
Can vary based on the number of queries being combined.
0
10. What two scenarios call for using combined queries. (Select two answers)
To return similarly structured data from different tables.
To perform multiple queries against a single table returning the data using one query.
To return data that creates new columns that don’t exist across the tables in the query.
To return data and find the intersection of the data across tables in the query.
Question 1: What is one of the most powerful features of SQL?
Answer: The most powerful feature of SQL is Joining of multiple tables. Using this feature, multiple tables can be related with each other to get requried result.
Correct choice: Table joins. [option 3]
Question 2: A JOIN is a mechanism used to associate tables within a SELECT statement?
Answer: JOIN clause is used to relate or associate two or more tables within a SELECT statement. So the given statement is TRUE.
Correct choice: True. [option 1]
Question 3: A JOIN can modify existing database tables
Answer: JOIN statement itself cannot modify existing database tables. Rather JOIN statement creates a new table (intermediate) containing the related data from multiple tables. It can also contain the cross product of the data of multiple tables. The existing tables are remained untouched.
Correct choice: False. [option 2]
Question 4: The WHERE clause acts as a filter to only include rows that match the filter condition.
Answer: The WHERE clause filters only rows that matches the condition. Column wise filter is not done by WHERE clause. So the statement is correct.
Correct choice: True. [option 1]
Question 5: The more tables you JOIN the less resources the system uses.
Answer: Joining of multiple tables means creating a new table with the existing tables based on some relation among them. It means more number of data will be present in the joined table. Thus the more tables are joined, the more resources the system uses.
Correct choice: False. [option 2]
Question 6: The most commonly used JOIN is the INNER JOIN
Answer: INNER JOIN is the most commonly used join that selects all the rows which is common (or matches) in the joined tables between the columns.
Correct choice: True. [option 1]
Question 7: Excluding the INNER JOIN, which of the following is not one of the three additional types of table JOINS
Answer: SELF JOIN is the type of join when a table is related to itself. NATURAL JOIN is the type of join that compares and selects all columns of two tables which have the same column-name and holds the corresponding same values.
If JOINS is one of the option in the question, which is not clear, then the answer to the question would be JOINS.
Correct choice: JOINS [option 1]
### NOTE: If JOINS is not an option in the question, then the correct choice would be SELF JOIN (option 1).
Question 8: What OPERATOR is used to combine queries?
Answer: UNION operator is used to combine two or more queries.
Correct choice: UNION [option 2]
Question 9: When combining queries, how many ORDER BY clauses does the UNION operator use?
Answer: When combining queries using UNION, ORDER BY clause is not required (in a normal query). Thus, 0 ORDER BY clause is required here.
Correct choice: 0. [option 3]
Question 10: What two scenarios call for using combined queries. (Select two answers)
Answer: Combined queries are called for scenarios like:
Option 2: To perform multiple queries against a single table returning the data using one query. Here different queries on a single table can be combined to get the final result.
Option 4: To return data and find the intersection of the data across tables in the query. Here, different queries can be applied on different tables and combination of them can give the required result.
Correct Answer: Option 2 and Option 4.