0% found this document useful (0 votes)
12 views6 pages

Q&a Oracle-Ch-6

This document discusses Oracle database functions. It defines functions as programs that take arguments and return a single value. It categorizes functions as single-row, aggregate, analytical, national language, object reference, and programmer defined. The main types are single-row and multiple-row functions. Single-row functions include character, date, conversion, general, and number functions. Aggregate functions return one result per group and include functions like AVG, COUNT, MAX, MIN, STDDEV, SUM, and VARIANCE. The document provides examples and explanations of various functions like character manipulation, case conversion, rounding, truncating, finding remainders, and date functions. It also discusses using DISTINCT with aggregate functions and restricting groups with the

Uploaded by

zakiabdulahi2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Q&a Oracle-Ch-6

This document discusses Oracle database functions. It defines functions as programs that take arguments and return a single value. It categorizes functions as single-row, aggregate, analytical, national language, object reference, and programmer defined. The main types are single-row and multiple-row functions. Single-row functions include character, date, conversion, general, and number functions. Aggregate functions return one result per group and include functions like AVG, COUNT, MAX, MIN, STDDEV, SUM, and VARIANCE. The document provides examples and explanations of various functions like character manipulation, case conversion, rounding, truncating, finding remainders, and date functions. It also discusses using DISTINCT with aggregate functions and restricting groups with the

Uploaded by

zakiabdulahi2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1

Questions And Answers of CH-6 Oracle (Functions) 12/26/2022


Part l
1: What are functions ?
• Functions are programs that take zero or more arguments and return a
single value.
• these functions can be called from SQL statements.

2.: What are the features of the functions that we can use in the SQL ?
• Perform calculations on data
• Modify individual data items
• Manipulate output for groups of rows
• Format dates and numbers for display
• Convert column data types
3:Classify all the types of the functions by grouping ?
• Single-row functions
• Aggregate functions (also known as group functions)
• Analytical functions and regular expression functions
• National-language functions
• Object-reference functions
• Programmer-defined functions
4:what are the two main types of Functions ?
There are two types of functions:
• Single-row functions
• Multiple-row functions
5:List types of single-row functions ?
• Character functions
• Date functions
• Conversion functions

PREPARED BY: ENG ADAN SALEBAN 1


2

• General functions
• Number
6:what are the types of General functions ?
• NVL
• NVL2
• NULLIF
• COALESCE
• CASE
• DECODE
7:Explain Character Functions ?
• Single-row character functions accept character data as input and can
return both character and numeric values.
8:List two types of Character functions ?
Character functions can be divided into the following:
• Case-conversion functions
• Character-manipulation functions
9:Explain case conversions ?
• LOWER: Converts mixed-case or uppercase character strings to lowercase
• UPPER: Converts mixed-case or lowercase character strings to uppercase
• INITCAP: Converts the first letter of each word to uppercase and the
remaining letters to lowercase.
10:what accepts Number Functions and list his types ?
• Number functions accept numeric input and return numeric values
Types;
• ROUND: Rounds value to a specified decimal
• TRUNC: Truncates value to a specified decimal
• MOD: Returns remainder of division
11:What is a Dual Table ?

PREPARED BY: ENG ADAN SALEBAN 2


3

• DUAL is a dummy table that you can use to view results from functions and
calculations and owned by the user SYS and can be accessed by all users.
12: What is a Trunk functions ?
• The TRUNC function truncates the column, expression, or value to n
decimal places.
• The TRUNC function works with arguments similar to those of the ROUND
function.
13:Explain MOD functions ?
• The MOD function finds the remainder of the first argument divided by
the second argument.
14:what is the default date display format ?
• The default date display format is DD-MON-YY.
15:List date manipulation Functions ?
• MONTHS_BETWEEN(date1, date2): Finds the number of months between
date1 and date2. The result can be positive or negative.
• ADD_MONTHS(date, n): Adds n number of calendar months to date. The
value of n must be an integer and can be negative.
• NEXT_DAY(date, 'char'): Finds the date of the next specified day of the
week ('char') following date.
• LAST_DAY(date): Finds the date of the last day of the month that contains
date.
16:What are the Group Functions ?
• Group functions, also called multiple-row functions, return one result per
group of rows processed.
17:What are the types of group functions ?
• AVG
• COUNT
• MAX

PREPARED BY: ENG ADAN SALEBAN 3


4

• MIN
• STDDEV
• SUM
• VARIANCE
18:Write the Guidelines for using the group functions ?
• DISTINCT makes the function consider only nonduplicate values.
• default is ALL and therefore does not need to be specified.
• The data types for the functions with an expr argument may be CHAR,
VARCHAR2, NUMBER, or DATE.
• All group functions ignore null values.
• To substitute a value for null values, use the NVL, NVL2, or COALESCE
functions.
19:what are the Aggregate Functions ?
• You can use AVG and SUM for numeric data but you can use MIN and MAX
for numeric, character, and date data types.
20: What is used count ?
• COUNT: returns the number of rows in a table:
• COUNT: returns the number of rows with non-null values for expr:
21:Using the DISTINCT Keyword ?
• COUNT(DISTINCT expr) returns the number of distinct non-null values of
expr.
• To display the number of distinct department values in the EMPLOYEES
table.
22: Define Sys-date ?
• SYSDATE is a date function that returns the current database server date
and time.
23:How Oracle server restrict the groups ?
• the Oracle server restricts groups as follows:

PREPARED BY: ENG ADAN SALEBAN 4


5

• Rows are grouped.


• The group function is applied.
• Groups matching the HAVING clause are displayed.
24:Show as diagram character functions ?

Part-ll True & False


1: Using a WHERE clause, you can exclude rows before dividing them into groups.
TRUE/FALSE ?
• True
2: If you include a group function in a SELECT clause, you cannot select individual
results as well, unless the individual column appears in the GROUP BY clause. T/F
?
• True
3: You can divide rows in a table into smaller groups by using the GROUP BY
clause.T/F ?
• True
4: All columns in the SELECT list that are not in group functions must be in the
GROUP BY clause.T/F ?
• True
5: You can’t use SYSDATE just as you would use any other column name T/F ?

PREPARED BY: ENG ADAN SALEBAN 5


6

• False
6: Group functions operate on sets of rows to give one result per group. T/F
• True
7: You can return summary results for groups and subgroups by listing more than
one GROUP BY column.T/F ?
• True
8: You cannot use the WHERE clause to restrict groups. You use the HAVING
clause to restrict groups.T/F ?
• True
9: You cannot use group functions in the WHERE clause.T/F ?
• True
10: You can use a column alias in the GROUP BY clause.T/F ?
• False

PREPARED BY: ENG ADAN SALEBAN 6

You might also like