databases Online Quiz - 101
|Description: databases Online Quiz - 101
|Number of Questions: 20
|Created by: Aliensbrain Bot
When the 'SELECT' clause of the SQL has the aggregate function, it is must to have this clause to prevent error
Statistics cannot be collected on this table
What best describes the relationship between indexes and SQL performance?
Which of the following is an important consideration when tuning an SQL statement?
To solve this question, the user needs to know the syntax of SQL SELECT statements, how to select all rows from a table, how to specify column names, and how to use the WHERE clause to filter rows based on a certain condition.
Now, let's go through each option and explain why it is right or wrong:
A. SELECT * FROM Contest WHERE ContestDate >= '05/25/2006': This option is correct. This statement selects all columns and rows from the Contest table where the ContestDate column has a value greater than or equal to May 25, 2006. The date is specified in the format MM/DD/YYYY, which is a valid format for SQL.
B. SELECT * FROM Contest GROUPBY ContestDate >= '05/25/2006': This option is incorrect because it contains a syntax error. The GROUP BY clause is used to group rows based on a certain criteria, not to filter them. Also, the condition is not valid in the GROUP BY clause.
C. SELECT * FROM Contest WHERE ContestDate < '05/25/2006': This option is incorrect because it selects all rows from the Contest table where the ContestDate column has a value less than May 25, 2006. The question asks for values greater than or equal to that date.
D. SELECT * FROM Contest HAVING ContestDate >= '05/25/2006': This option is incorrect because the HAVING clause is used to filter rows based on a condition that involves an aggregate function. It cannot be used to filter rows based on a simple comparison like the one specified in this question.
The Answer is: A
The INNER JOIN clause…
If you don't specify ASC or DESC after a SQL ORDER BY clause, the following is used by default:
What output will the follwing statement produce? Select NVL2(NULL,'NOT NULL', NULL) from dual;
What is the result if two NULL values are compared to each other?
Which three definitions are associated with implicit cursors?
To solve this question, the user needs to know what happens when a variable is declared in PL/SQL without an initial value.
The answer is:
If a variable is declared in PL/SQL without an initial value, its value will be NULL when it is first used in the executable section of the PL/SQL block. This means that the variable does not have a value assigned to it yet. If the variable is used in an expression or operation, it will result in a NULL value, which can cause unexpected behavior in your code.
Option A is incorrect because the variable will not have a value of 0 by default.
Option C is incorrect because declaring a variable without an initial value is legal and will not result in a compilation error.
Option D is incorrect because an exception will not be raised when a variable is declared without an initial value. It will simply have a value of NULL.