A Learning Portal from Recruitment India
______ clause creates temporary relation for the query on which it is defined.
SELECT
WITH
WHERE
FROM
Answer with explanation
Answer: Option BExplanation
The WITH clause in SQL allows us to provide a sub-query block, a name that can be referenced in several places within the main query. It is used for defining a temporary relation whose definition is available by the query in which the WITH clause is associated.
Workspace
Which operator is used to compare a value to a specified list of values?
IN
ALL
BETWEEN
ANY
Answer with explanation
Answer: Option AExplanation
The correct answer is IN
The IN operator easily tests the expression if it matches any value in a specified list of values. It reduces the use of multiple OR conditions.
The WHERE or HAVING clause uses the ANY and ALL operators. ANY gives the result when any subquery value matches the specified condition. The ALL give the result when all subquery values match the specified condition.
The BETWEEN operator selects values only in the given range.
Workspace
SQL Views are also known as?
Actual Tables
Complex tables
Virtual tables
Simple tables
Answer with explanation
Answer: Option CExplanation
A view is also known as a virtual table because it contains rows and columns similar to a real table. It shows the table interface but cannot be stored in a database.
Workspace
Which of the following are TCL commands?
GRANT and REVOKE
SELECT and INSERT
UPDATE and TRUNCATE
COMMIT and ROLLBACK
Answer with explanation
Answer: Option DExplanation
The correct answer is COMMIT and ROLLBACK
TCL stands for Transaction Control Commands used for managing the changes made by DML commands like INSERT, DELETE, and UPDATE. The TCL commands are automatically committed in the database; that’s why we cannot use them directly while creating tables or dropping them.
Workspace
Which of the following is not a valid SQL type?
CHARACTER
DECIMAL
NUMERIC
FLOAT
Answer with explanation
Answer: Option BExplanation
The correct answer is DECIMAL
DECIMAL is not a valid SQL type because it is nothing but numeric only in SQL.
NUMERIC has fixed precision, and scale numbers range from -10^38+1 to 10^38-1.
FLOAT has floating precision number ranges from -1.79E + 308 to 1.79E + 308.
CHARACTER is a fixed-width character string data type that can be up to 8000 characters.
Workspace