ExamVeda
Login
Home
11
The SQL keyword(s) ________ is used with wildcards.
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: LIKE only - The LIKE keyword in SQL is used with wildcards to search for a specified pattern in a column. This option correctly identifies the keyword used with wildcards.
Option B: IN only - The IN keyword is used to specify multiple values for a column, not with wildcards.
Option C: NOT IN only - The NOT IN keyword is used to exclude specified values from a column, not with wildcards.
Option D: IN and NOT IN - Both IN and NOT IN are used to specify values or exclude values from a column, not with wildcards.
Conclusion:
In SQL, the keyword LIKE is specifically used with wildcards to perform pattern matching in a column. Therefore, the correct answer is Option A: LIKE only.
12
Which of the following is the correct order of keywords for SQL SELECT statements?
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: SELECT, FROM, WHERE - This option presents the correct order of keywords for a SQL SELECT statement:
SELECT: Specifies the columns to retrieve data from.
FROM: Specifies the table from which to retrieve data.
WHERE: Optional clause that specifies conditions to filter rows.
Option B: FROM, WHERE, SELECT - Incorrect order. The SELECT keyword should come before FROM to specify the columns to select. Option C: WHERE, FROM, SELECT - Incorrect order. The SELECT keyword should come before FROM to specify the columns to select. Option D: SELECT,WHERE,FROM - Incorrect order. The FROM keyword should come after SELECT to specify the table from which to select data. Conclusion:
The correct order of keywords for a SQL SELECT statement is Option A: SELECT, FROM, WHERE.
13
A subquery in an SQL SELECT statement is enclosed in:
Discuss
Answer & Solution
Answer: Option C
Solution:
Option A: braces -- {...} - Braces are not used to enclose subqueries in SQL SELECT statements. This option is incorrect.
Option B: CAPITAL LETTERS - Capital letters are not used to enclose subqueries in SQL SELECT statements. This option is incorrect.
Option C: parenthesis -- (...) - This option is correct. Subqueries in SQL SELECT statements are enclosed in parentheses to distinguish them from the main query.
Option D: brackets -- [...] - Brackets are not used to enclose subqueries in SQL SELECT statements. This option is incorrect.
Conclusion:
In SQL, a subquery in a SELECT statement is enclosed in parentheses to separate it from the main query and to specify its scope. Therefore, the correct answer is Option C: parenthesis -- (...).
14
The result of a SQL SELECT statement is a(n) ________ .
Discuss
Answer & Solution
Answer: Option D
Solution:
Option A: report - While SQL SELECT statements can be used to generate data that might be used in reports, the direct result of a SELECT statement itself is not a report. This option is incorrect.
Option B: form - SQL SELECT statements retrieve data from tables or views based on specified criteria. They do not generate forms. This option is incorrect.
Option C: file - SQL SELECT statements do not produce files directly. They retrieve data from database tables or views. This option is incorrect.
Option D: table - This option is correct. The result of a SQL SELECT statement is a set of rows and columns, which resembles a table structure. It may not be a physical table but represents a structured set of data.
Conclusion:
In SQL, the result of a SELECT statement is a set of rows and columns, similar to a table structure. Therefore, the correct answer is Option D: table.
15
Which of the following are the five built-in functions provided by SQL?
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: COUNT, SUM, AVG, MAX, MIN - These are the five built-in aggregate functions provided by SQL:
COUNT: Returns the number of rows that match a specified criterion.
SUM: Returns the sum of values in a numeric column.
AVG: Returns the average of values in a numeric column.
MAX: Returns the maximum value in a column.
MIN: Returns the minimum value in a column.
Option B: SUM, AVG, MIN, MAX, MULT - "MULT" is not a standard SQL function. This option is incorrect. Option C: SUM, AVG, MULT, DIV, MIN - "MULT" and "DIV" are not standard SQL functions. This option is incorrect. Option D: SUM, AVG, MIN, MAX, NAME - "NAME" is not a standard SQL function. This option is incorrect. Conclusion:
The five built-in functions provided by SQL for performing aggregate calculations on data are Option A: COUNT, SUM, AVG, MAX, MIN.
16
In an SQL SELECT statement querying a single table, according to the SQL-92 standard the asterisk (*) means that:
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: all columns of the table are to be returned. - According to the SQL-92 standard, using the asterisk () in an SQL SELECT statement querying a single table means that all columns of the table are to be returned.
Option B: all records meeting the full criteria are to be returned. - This option is incorrect. The asterisk () refers to columns, not records.
Option C: all records with even partial criteria met are to be returned. - This option is incorrect. The asterisk () does not relate to criteria or records but to columns.
Option D: None of the above is correct. - This option is incorrect because Option A correctly describes the meaning of the asterisk () in SQL-92 standard.
Conclusion:
In SQL-92 standard, using the asterisk (*) in an SQL SELECT statement querying a single table means that all columns of the table are to be returned. Therefore, the correct answer is Option A: all columns of the table are to be returned.
17
The HAVING clause does which of the following?
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: Acts like a WHERE clause but is used for groups rather than rows. - This option is correct. The HAVING clause in SQL is used to filter group rows that are returned by a GROUP BY clause, similar to how the WHERE clause filters individual rows.
Option B: Acts like a WHERE clause but is used for rows rather than columns. - This option is incorrect. The WHERE clause is used to filter rows based on a condition, whereas the HAVING clause filters grouped rows based on a condition.
Option C: Acts like a WHERE clause but is used for columns rather than groups. - This option is incorrect. The WHERE clause filters rows, and it does not filter columns.
Option D: Acts EXACTLY like a WHERE clause. - This option is incorrect because the WHERE and HAVING clauses serve different purposes in SQL.
Conclusion:
In SQL, the HAVING clause is used to apply a filter to the groups of rows returned by a GROUP BY clause, similar to how the WHERE clause filters individual rows. Therefore, the correct answer is Option A: Acts like a WHERE clause but is used for groups rather than rows.
18
The SQL -92 wildcards are ____ and ____ .
Discuss
Answer & Solution
Answer: Option B
Solution:
Option A: asterisk (); percent sign (%) - This option is incorrect. While the percent sign (%) is a wildcard character in SQL-92 for matching zero or more characters, the asterisk () is not a wildcard character in SQL.
Option B: percent sign (%); underscore () - This option is correct. In SQL-92, the percent sign (%) is used as a wildcard for matching zero or more characters, and the underscore () is used as a wildcard for matching a single character.
Option C: underscore (); question mark (?) - The underscore () is a wildcard character in SQL-92, but the question mark (?) is not a wildcard character in SQL. This option is incorrect.
Option D: question mark (?); asterisk () - The question mark (?) is not a wildcard character in SQL-92, and the asterisk () is not a wildcard character in SQL. This option is incorrect.
Conclusion:
In SQL-92, the wildcards are Option B: percent sign (%) and underscore (_).
19
To remove duplicate rows from the results of an SQL SELECT statement, the ________ qualifier specified must be included.
Discuss
Answer & Solution
Answer: Option C
Solution:
Option A: ONLY - The keyword ONLY is not used to remove duplicate rows in SQL SELECT statements. This option is incorrect.
Option B: UNIQUE - The UNIQUE keyword is not used in SQL SELECT statements to remove duplicate rows from results. It is used in table definitions for column uniqueness constraints. This option is incorrect.
Option C: DISTINCT - This option is correct. The DISTINCT qualifier in SQL SELECT statements is used to eliminate duplicate rows from the result set, returning only unique rows based on the specified columns.
Option D: SINGLE - The keyword SINGLE is not used in SQL SELECT statements to remove duplicate rows. This option is incorrect.
Conclusion:
To remove duplicate rows from the results of an SQL SELECT statement, you use the Option C: DISTINCT qualifier. Therefore, the correct answer is DISTINCT
20
The benefits of a standard relational language include which of the following?
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: Reduced training costs - This is a potential benefit of a standard relational language like SQL. When developers and database administrators are familiar with SQL standards, training costs can be reduced.
Option B: Increased dependence on a single vendor - This is not a benefit of a standard relational language. In fact, using a standard language like SQL can reduce dependence on a single vendor because SQL is supported by many different database management systems.
Option C: Applications are not needed - This is not a benefit of a standard relational language. Applications are still needed to interact with databases through SQL.
Option D: All of the above - This option is incorrect because Options B and C are not benefits of a standard relational language like SQL.
Conclusion:
The benefits of a standard relational language like SQL typically include improved portability across different database systems, ease of learning and training, and consistent syntax and semantics. Therefore, the correct answer is Option A: Reduced training costs.