sql11.What is the default ordering of data using the ORDER BY clause? How could it be changed?
The default sorting order is ascending. It can be changed using the DESC keyword, after the column name in the ORDER BY clause.

12.What are the specific uses of SQL functions?
SQL functions have the following uses −

Performing calculations on data

Modifying individual data items

Manipulating the output

Formatting dates and numbers

Converting data types

13.What are the case manipulation functions of SQL?

14.Which function returns the remainder in a division operation?
The MOD function returns the remainder in a division operation.

15.What is the purpose of the NVL function?
The NVL function converts a NULL value to an actual value.

16.What is the difference between the NVL and the NVL2 functions?
The NVL(exp1, exp2) function converts the source expression (or value) exp1 to the target expression (or value) exp2, if exp1 contains NULL. The return value has the same data type as that of exp1.

The NVL2(exp1, exp2, exp3) function checks the first expression exp1, if it is not null then, the second expression exp2 is returned. If the first expression exp1 is null, then the third expression exp3 is returned.

17.What is the use of the NULLIF function?
The NULLIF function compares two expressions. If they are equal, the function returns null. If they are not equal, the first expression is returned.

18.Discuss the syntax and use of the COALESCE function?
The COALESCE function has the expression COALESCE(exp1, exp2, …. expn)

It returns the first non-null expression given in the parameter list.

19.Which expressions or functions allow you to implement conditional processing in a SQL statement?
There are two ways to implement conditional processing or IF-THEN-ELSE logic in a SQL statement.

Using CASE expression

Using the DECODE function

20.You want to display a result query from joining two tables with 20 and 10 rows respectively. Erroneously you forget to write the WHERE clause. What would be the result?

The result would be the Cartesian product of two tables with 20 x 10 = 200 rows.

Written by 

Leave a Reply

Your email address will not be published. Required fields are marked *