RSS Feed

Multiple Choice Questions - SQL Expressions

Multiple Choice Questions - SQL Expressions

1. Simple expression can be a …….
A) Constant
B) Column name
C) Variable
D) Scalar function

2. There is no native regular expression support in SQL Server.
A) True
B) False

3. When two expressions are combined by using comparison or logical operators, the resulting data type is Boolean and the value is one of the following: ………
A) True, False
B) True, False, NULL
C) True, False, UNKNOWN
D) None of above

4. If you are combining expressions by an operator, the CAST or CONVERT functions cannot be used explicitly as of SQL SERVER 2012.
A) True
B) False

5. You can not only use a common table expression (CTE) in a CREATE VIEW statement, as part of the view’s SELECT query but you can also add a CTE to the new MERGE statement in SQL SERVER 2008.
A) True
B) False

6. In SQL Server an Expression can be used in ......
A) Where Clause
B) Select Clause
C) Having Clause
D) All of Above

7. Below Query using Case Expression is:
UPDATE Customer 
SET State_Code = CASE State_Code
 WHEN 'CDG' THEN 'CHANDIGARH' 
 WHEN 'NDG' THEN 'NEW DELHI' 
 WHEN 'RJS' THEN 'RAJASTHAN' 
 ELSE NULL 
 END 
A) Valid
B) Invalid

8. A Common Table Expression (CTE)
A) can be used to reference the resulting table multiple times in the same statement
B) can be used to enable grouping by a column that is derived from a scalar sub-select
C) can be used to create a recursive query
D) Both A & C
E) All of Above

9. Which of the following do not come in the definition of an expression:
1) Column name
2) Function
3) USING variable
4) Combination of column names, constants, and functions connected by operators

A) 1
B) 2
C) 3
D) 4
E) All come under the definition of an expression

10. Which of the following is not an expression category?
A) CASE expressions
B) Statutory expression
C) Interval expression
D) Numeric expression
E) Period expression

11. Match the expression examples with their description:
A) 'SQL Test'1. Numeric constant
B) 9598 2. CASE conditional expression
C) Employee.FirstName3. Character string constant
D) CASE var
WHEN 1
THEN 200
ELSE 300
END
4. Column name


Answers