banner



Which Of The Following Is True Concerning Animal Form And Function?

Using the Grouping Functions Questions


one. Which of the post-obit is NOT a Grouping BY office?

  1. MAX
  2. MIN
  3. NVL
  4. AVG

Answer: C. NVL is a general function used to provide alternate value to the Zip values. The functions MAX, MIN and AVG can be used every bit GROUP Past functions.

ii. Which of the following functions can be used without Group BY clause in SELECT query?

  1. COUNT
  2. MAX
  3. MIN
  4. AVG

Answer: A, B, C, D. All the listed grouping functions can be used in a query provided no other columns are selected in the SELECT query.

3. Which of the following SELECT query returns the department number with maximum bacon compensated to an employee? (Consider the table structure equally given)

SQL> DESC employees  Proper name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Non Nada NUMBER(vi)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 Non Zero VARCHAR2(25)  EMAIL			 Non Zippo VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 NOT NULL Date  JOB_ID 		 NOT Cipher VARCHAR2(10)  Bacon 			  NUMBER(8,ii)  COMMISSION_PCT 		  NUMBER(2,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)
  1. SELECT department_id , max(salary ) FROM employees ;
  2. SELECT department_id , max(salary ) FROM employees  GROUP BY department_id ;
  3. SELECT max(salary ) FROM employees  GROUP BY department_id ;
  4. SELECT max(bacon ) FROM employees ;

Answer: B. The MAX function can be used to return the maximum bacon in a department where each grouping is formed by a department.

4. Which of the following statements are true about the COUNT function?

  1. The COUNT function counts the number of rows
  2. The COUNT(*) function counts the number of rows with duplicates and NULL values
  3. The COUNT(DISTINCT) role counts the number of distinct rows
  4. COUNT(*) is equivalent to COUNT(ALL)

Answer: B. The COUNT(*) counts the number of rows including duplicates and NULLs. Utilize DISTINCT and ALL keyword to restrict duplicate and NULL values.

five. What are the appropriate data types accepted by GROUP BY functions?

  1. Nested Tables
  2. NUMBER
  3. CLOB
  4. DATE

Answer: B. The data types for the functions with an argument may be CHAR, VARCHAR2, NUMBER or DATE.

6. A table T_COUNT has 12 number values as 1, ii, 3, 32, 1, 1, nil, 24, 12, naught, 32, cipher. Predict the output of the beneath query.

SELECT COUNT (*) FROM t_count;
  1. 12
  2. six
  3. 9
  4. Throws exception because COUNT function doesn't works with Goose egg values

Reply: A. The COUNT(*) counts the number of rows including duplicates and NULLs. Apply Distinct and ALL keyword to restrict duplicate and NULL values.

7. A tabular array T_COUNT has 12 number values as 1, 2, three, 32, 1, one, cypher, 24, 12, null, 32, null. Predict the output of the beneath query.

SELECT COUNT (num) FROM t_count;
  1. 12
  2. 6
  3. 9
  4. Throws exception because COUNT function doesn't works with NULL values

Answer: C. COUNT (column) ignores the Naught values but counts the duplicates.

8. A table T_COUNT has 12 number values every bit 1, 2, 3, 32, ane, 1, zero, 24, 12, naught, 32, nix. Predict the output of the below query.

SELECT COUNT (ALL num) FROM t_count;
  1. 12
  2. half-dozen
  3. 9
  4. Throws exception because COUNT role doesn't works with NULL values

Answer: C. COUNT(ALL column) ignores the Goose egg values simply counts the duplicates.

9. A table T_COUNT has 12 number values as i, ii, 3, 32, 1, one, null, 24, 12, cypher, 32, null. Predict the output of the below query.

SELECT COUNT (DISTINCT num) FROM t_count;
  1. 12
  2. half dozen
  3. ix
  4. Throws exception because COUNT function doesn't works with NULL values

Respond: B. COUNT (Singled-out cavalcade) counts the distinct not nil values.

x. What happens when the below query is executed in SQL* Plus?

SELECT COUNT() FROM dual;
  1. Executes successfully and returns no output
  2. Executes successfully and returns output as 'ane'
  3. Throws exception "ORA-00909: invalid number of arguments"
  4. Throws exception "ORA-00904: "COUNT": invalid identifier" because COUNT function doesn't works with DUAL table

Answer: C. COUNT role requires minimum one statement which tin can exist either the column with [ALL | Singled-out] modifier or '*'.

11. Here are few statements about VARIANCE part in SQL.

i. The part accepts multiple numeric inputs and returns variance of all the values

ii. The function accepts a number column and returns variance of all column values including NULLs

iii. The function accepts a number column and returns variance of all column values excluding NULLs

Chose the correct combination from the below options.

  1. i and iii
  2. i and ii
  3. ii
  4. three

Answer: C. The VARIANCE function accepts unmarried numeric statement equally the column proper name and returns variance of all the column values considering NULLs.

12. Which of the following is NOT a Grouping BY extensions in SQL?

  1. GROUP Past
  2. Group SETS
  3. CUBE
  4. ROLLUP

Answer: A. GROUPING SETS operations can be used to perform multiple GROUP By aggregations with a unmarried query.

13. Select the correct statements nigh the below query. Consider the tabular array structure as given.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 NOT NULL NUMBER(6)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 Non NULL VARCHAR2(25)  Electronic mail			 NOT NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 Non NULL DATE  JOB_ID 		 NOT Cipher VARCHAR2(x)  SALARY 			  NUMBER(8,2)  COMMISSION_PCT 		  NUMBER(2,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)
SELECT department_id , SUM(salary ) FROM employees  GROUP BY department_id ;
  1. SUM is a group past function considering information technology processes group of employees working in a department
  2. SUM is an aggregate function because it produces one outcome per group of data
  3. SUM is a single row function because it returns single value for a group i.eastward. section
  4. SUM is a grouping by extension function because it uses GROUP BY clause to logically grouping the departments

Answer: A. SUM is a group function which calculates the sum of salaries of a group of employees working in a department.

14. Which clause is used to filter the query output based on aggregated results using a group past part?

  1. WHERE
  2. LIMIT
  3. GROUP WHERE
  4. HAVING

Reply: D. HAVING Clause is used for restricting group results. You employ the HAVING clause to specify the groups that are to be displayed, thus further restricting the groups on the ground of aggregate data. The HAVING clause can precede the Grouping By clause, but it is recommended that you place the Grouping Past clause first considering it is more than logical. Groups are formed and group functions are calculated before the HAVING clause is applied to the groups in the SELECT list.

15. Examine the given tabular array construction and predict the event of the following query.

SQL> DESC employees  Proper noun			 Nada?	  Blazon  ----------------------- -------- ----------------  EMPLOYEE_ID		 Non NULL NUMBER(half dozen)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 NOT Aught VARCHAR2(25)  EMAIL			 NOT Zip VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 NOT NULL Engagement  JOB_ID 		 Not NULL VARCHAR2(ten)  Salary 			  NUMBER(8,2)  COMMISSION_PCT 		  NUMBER(2,2)  MANAGER_ID			  NUMBER(half-dozen)  DEPARTMENT_ID			  NUMBER(4)
SELECT count(*) FROM employees  WHERE comm = NULL;
  1. The query returns the number of employees who have no commission
  2. The query throws error because equal sign cannot be used when searching for NULL value
  3. The query returns the number of employees in a department whose commission is NULL value
  4. The query throws mistake because GROUP BY clause is missing in the query

Answer: B. Excluding out NULLs using WHERE condition is a way to direct the query to ignore NULLs. But hither the usage of IS Nil operator is wrong. The status should be 'WHERE comm IS Nix'.

16. Which of the following statements is true well-nigh the group functions?

  1. The MIN role can be used merely with numeric data.
  2. The MAX function tin can be used merely with appointment values.
  3. The AVG function can exist used just with numeric data.
  4. The SUM function canít be role of a nested function.

Answer: C. The AVG function can be only used with numeric values. Other functions which have such restriction are SUM, STDDEV and VARIANCE.

17. Which of the following is a valid SELECT argument?

  1. SELECT AVG(retail-cost) FROM books GROUP BY category;
  2. SELECT category, AVG(retail-toll) FROM books;
  3. SELECT category, AVG(retail-cost) FROM books WHERE AVG(retail-price) > 8.56 GROUP BY category;
  4. SELECT category, AVG(retail-toll) Profit FROM books Group Past category HAVING profit > 8.56;

Answer: A. Column aliases cannot exist used in GROUP Past or HAVING clause.

18. Which of the following statements is right?

  1. The WHERE clause can contain a group function only if the office isnít also listed in the SELECT clause.
  2. Group functions canít be used in the SELECT, FROM, or WHERE clauses.
  3. The HAVING clause is ever candy before the WHERE clause.
  4. The GROUP Past clause is always candy before the HAVING clause.

Answer: D. Though Oracle doesn't raise fault if HAVING clause precedes the Group BY clause but information technology is processed only later on the GROUP BY clause is processed and group are ready to be filtered.

19. Which of the following is not a valid SQL argument?

  1. SELECT MIN(pubdate) FROM books GROUP BY category HAVING pubid = iv;
  2. SELECT MIN(pubdate) FROM books WHERE category = 'COOKING';
  3. SELECT COUNT(*) FROM orders WHERE client# = 1005;
  4. SELECT MAX(COUNT(customer#)) FROM orders Grouping Past customer#;

Reply: A.

twenty. Which of the following statements is correct?

  1. The COUNT function can exist used to determine how many rows comprise a Cypher value.
  2. Only distinct values are included in grouping functions, unless the ALL keyword is included in the SELECT clause.
  3. The WHERE clause restricts which rows are candy.
  4. The HAVING clause determines which groups are displayed in the query results.

Answer: C, D. The WHERE clause restricts the rows before they are grouped and processed while HAVING clause restricts the groups.

21. Which of the following is a valid SQL argument?

  1. SELECT customer#, order#, MAX(shipdate-orderdate) FROM orders Grouping BY customer# WHERE customer# = 1001;
  2. SELECT customer#, COUNT(order#) FROM orders Grouping By customer#;
  3. SELECT customer#, COUNT(guild#) FROM orders GROUP BY COUNT(order#);
  4. SELECT client#, COUNT(order#) FROM orders Grouping By gild#;

Reply: B. The Group BY clause must comprise all the columns except the one which is used inside the group function.

22. Which of the following SELECT statements lists just the volume with the largest profit?

  1. SELECT title, MAX(retail-cost) FROM books Grouping BY title;
  2. SELECT title, MAX(retail-cost) FROM books GROUP BY title HAVING MAX(retail-price);
  3. SELECT title, MAX(retail-price) FROM books;
  4. None of the above

Reply: A.

23. Which of the post-obit statement(s) is/are correct?

i. A grouping function can be nested inside a group function.

2. A group function can be nested inside a unmarried-row office.

3. A single-row part tin be nested inside a grouping office.

  1. 1
  2. two
  3. 3
  4. one and iii

Answer: A, B, C. Grouping functions can be nested only to a depth of 2. Group functions can be nested inside unmarried-row functions (AVG embedded in a TO_CHAR function). In addition, unmarried-row functions can be nested inside group functions.

24. Which of the following functions is used to summate the full value stored in a specified column?

  1. COUNT
  2. ADD
  3. TOTAL
  4. SUM

Reply: D. SUM function is used to get the addition of numeric values.

25. Which of the following SELECT statements lists the highest retail price of all books in the Family category?

  1. SELECT MAX(retail) FROM books WHERE category = 'Family';
  2. SELECT MAX(retail) FROM books HAVING category = 'FAMILY';
  3. SELECT retail FROM books WHERE category = 'Family unit' HAVING MAX(retail);
  4. None of the above

Answer: A. Since the category FAMILY has to be restricted earlier group, table rows must be filtered using WHERE clause and non HAVING clause.

26. Which of the post-obit functions can be used to include Cypher values in calculations?

  1. SUM
  2. NVL
  3. MAX
  4. MIN

Respond: B.NVL is a general function to provide alternate values to the NULL values. It can really make a deviation in arithmetic calculations using AVG, STDDEV and VARIANCE group functions.

27. Which of the following is non a valid argument?

  1. You must enter the ALL keyword in a group function to include all duplicate values.
  2. The AVG role can be used to find the average calculated difference betwixt two dates.
  3. The MIN and MAX functions tin can be used on VARCHAR2 columns.
  4. All of the in a higher place

Answer: A. The ALL keyword counts duplicates but ignores NULLs. Duplicates are also included with '*' and column name specification.

28. Which of the following SQL statements determines how many total customers were referred by other customers?

  1. SELECT customer#, SUM(referred) FROM customers GROUP Past customer#;
  2. SELECT COUNT(referred) FROM customers;
  3. SELECT COUNT(*) FROM customers;
  4. SELECT COUNT(*) FROM customers WHERE referred IS NULL;

Answer: B. Considering all customers as one group, COUNT(referred) volition count merely those who are referred by someone. COUNT(referred) volition ignore Zip values of the cavalcade.

29. Determine the correct society of execution of following clauses in a SELECT argument.

1.SELECT

2.FROM

3.WHERE

4.Grouping Past

v.HAVING

6.ORDER By

  1. 2-3-4-5-1-half dozen
  2. 1-2-iii-4-5-6
  3. 6-5-four-3-2-1
  4. 5-4-ii-3-1-vi

Answer: A. Processing society starts from FROM clause to get the table names, then restricting rows using WHERE clause, grouping them using Grouping BY clause, restricting groups using HAVING clause. Lodge By clause is the last i to be processed to sort the final data set.

30. Which of the beneath clauses is used to group a prepare of rows based on a cavalcade or prepare of columns?

  1. HAVING
  2. WHERE
  3. GROUP BY
  4. GROUPING

Answer: C. GROUP Past clause forms the groups of the data based on the column list specified.

31. Which of the following group functions can be used for population variance and population standard difference problems?

  1. VAR_POP
  2. STDDEV_POP
  3. VARIANCE
  4. STDDEV_SASMP

Respond: A, B.

32. Select the positions in a SELECT query where a grouping function tin appear.

  1. SELECT statement
  2. WHERE clause
  3. ORDER BY clause
  4. GROUP By clause

Reply: A, C, D. Group functions tin appear in SELECT, ORDER BY and HAVING clause. Oracle raises exception if group functions are used in WHERE or Group BY clauses.

33. Examine the structure of the EMPLOYEES tabular array as given. Which query volition return the minimum salary in each section?

SQL> DESC employees  Proper noun			 Zippo?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Not NULL NUMBER(six)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 Not Naught VARCHAR2(25)  Email			 Not Naught VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 Not Cypher Appointment  JOB_ID 		 Non Cypher VARCHAR2(10)  Bacon 			  NUMBER(8,two)  COMMISSION_PCT 		  NUMBER(ii,2)  MANAGER_ID			  NUMBER(half-dozen)  DEPARTMENT_ID			  NUMBER(4)
  1. SELECT department_id , MIN (salary ) from EMPLOYEES ;
  2. SELECT department_id , MIN (salary ) from EMPLOYEES  Group Past department_id ;
  3. SELECT department_id , MIN (salary ) from EMPLOYEES  Grouping By bacon ;
  4. SELECT department_id , MIN (salary ) from EMPLOYEES  Group BY employee_id ;

Answer: B. MIN role returns the minimum salary in a group formed by section.

34. Examine the structure for the tabular array EMPLOYEES and Translate the output of the beneath query

SQL> DESC employees  Name			 Zero?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Non Nada NUMBER(6)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 NOT Zero VARCHAR2(25)  EMAIL			 Non Goose egg VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(twenty)  HIRE_DATE		 Not NULL DATE  JOB_ID 		 Not NULL VARCHAR2(10)  Bacon 			  NUMBER(8,2)  COMMISSION_PCT 		  NUMBER(ii,two)  MANAGER_ID			  NUMBER(half dozen)  DEPARTMENT_ID			  NUMBER(4)
SELECT COUNT(*), COUNT(all comm) FROM employees ;
  1. It throws fault because but one aggregate function can be used in a query.
  2. Information technology throws error because GROUP By clause is missing.
  3. It executes successfully and returns aforementioned values for both.
  4. Information technology executes successfully where COUNT(*) including NULLs and COUNT(all comm) excluding NULLs.

Respond: D.

35. Which of the following are true almost group functions?

  1. You tin use group functions in any clause of a SELECT statement.
  2. Yous can employ group functions but in the cavalcade listing of the select clause and in the WHERE clause of a SELECT statement.
  3. You tin mix single row columns with group functions in the column list of a SELECT statement past group on the single row columns.
  4. You tin laissez passer column names, expressions, constants, or functions as parameter to an grouping office.

Respond: C. Group functions can be nested just to a depth of two. Group functions can be nested inside single-row functions (AVG embedded in a TO_CHAR function). In add-on, unmarried-row functions can be nested inside grouping functions.

36. Examine the structure of the table EMPLOYEES as given. You want to create a "emp_dept_sales" view past executing the following SQL statements.

SQL> DESC employees  Proper name			 Null?	  Blazon  ----------------------- -------- ----------------  EMPLOYEE_ID		 Non Goose egg NUMBER(half-dozen)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 NOT Naught VARCHAR2(25)  EMAIL			 NOT Cipher VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 Non NULL DATE  JOB_ID 		 Not NULL VARCHAR2(ten)  SALARY 			  NUMBER(8,two)  COMMISSION_PCT 		  NUMBER(two,2)  MANAGER_ID			  NUMBER(half dozen)  DEPARTMENT_ID			  NUMBER(4)
CREATE VIEW emp_dept_sales AS SELECT d.department_name , sum(e.salary ) FROM employees  east, departments  d where e.department_id =d.department_id  Grouping past d.department_name ;

Which statement is truthful regarding the execution of the above argument?

  1. The view will exist created and you tin perform DLM operations on the view
  2. The view volition not exist created because the join statements are not allowed for creating a view
  3. The view will not be created because the Grouping By clause is not allowed for creating a view
  4. The view will be created but no DML operations will be allowed on the view

Respond: D. Rules for Performing DML Operations on a View. You cannot add data through a view if the view includes group functions or a Grouping BY clause or Singled-out keyword. The pseudo column ROWNUM keyword Columns defined past expressions Not Nothing columns in the base of operations tables that are not selected by the view.

37. Which of the following statements are truthful regarding views?

  1. A sub query that defines a view cannot include the Grouping BY clause
  2. A view is created with the sub query having the Singled-out keyword tin can exist updated
  3. A Data Manipulation Linguistic communication (DML) operation can be performed on a view that is created with the sub query having all the NOT Nothing columns of a table
  4. A view that is created with the sub query having the pseudo column ROWNUM keyword cannot exist updated

Answer: C, D. Rules for Performing DML Operations on a View. You lot cannot add together data through a view if the view includes grouping functions or a Group BY clause or Singled-out keyword. The pseudo column ROWNUM keyword Columns defined by expressions NOT Zippo columns in the base tables that are not selected by the view.

38. Examine the table construction equally given.

SQL> DESC departments  Proper noun			 Goose egg?	  Blazon  ----------------------- -------- ----------------  DEPARTMENT_ID		 NOT NULL NUMBER(four)  DEPARTMENT_NAME	 Not NULL VARCHAR2(thirty)  MANAGER_ID			  NUMBER(half dozen)  LOCATION_ID			  NUMBER(four)

Which clause in the beneath SQL query generates error?

SELECT department_id , avg(salary ) FROM departments  WHERE upper(chore) in ('SALES','CLERK') Grouping BY job ORDER BY department_id ;
  1. WHERE
  2. SELECT
  3. ORDER BY
  4. GROUP Past

Answer: D. GROUP Past clause must comprise all the columns appearing in the SELECT statement. It raises error because Chore is not a selected column. It should take used DEPARTMENT_ID in placed of JOB.

39. Examine the table structure equally given.

SQL> DESC employees  Name			 Zilch?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Non Aught NUMBER(6)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 Not NULL VARCHAR2(25)  EMAIL			 NOT NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 NOT Goose egg Date  JOB_ID 		 Non NULL VARCHAR2(x)  SALARY 			  NUMBER(8,2)  COMMISSION_PCT 		  NUMBER(2,ii)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

Which of the below SELECT query will display the maximum and minimum salary earned by each job category?

  1. SELECT job, MAX(salary ), MIN (bacon ) FROM employees  Group By department_id ;
  2. SELECT job, MAX(bacon ), MIN (bacon ) FROM employees  Group BY chore;
  3. SELECT job, MAX(salary ), MIN (salary ) FROM employees ;
  4. Ii amass functions cannot be used together in SELECT statement.

Answer: B. More 1 grouping office can announced in the SELECT statement.

twoscore. Consider the table structure as given.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Not Zero NUMBER(half dozen)  FIRST_NAME			  VARCHAR2(xx)  LAST_NAME		 NOT Aught VARCHAR2(25)  Electronic mail			 NOT Zilch VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(twenty)  HIRE_DATE		 Not Cipher Appointment  JOB_ID 		 Not Nothing VARCHAR2(10)  Salary 			  NUMBER(viii,2)  COMMISSION_PCT 		  NUMBER(2,ii)  MANAGER_ID			  NUMBER(half-dozen)  DEPARTMENT_ID			  NUMBER(4)

Examine the mistake in the below query.

SELECT department_id  FROM employees  WHERE hiredate > '01-Jan-1985' AND COUNT(*) > 2 Group by department_id  HAVING SUM (salary ) > 1000;
  1. Information technology executes successfully and generates the required result.
  2. It produces an error because COUNT(*) should be specified in the SELECT clause also.
  3. It executes successfully simply produces no result because COUNT(prod_id) should be used instead of COUNT(*).
  4. Information technology produces an error because COUNT(*) should be merely in the HAVING clause and not in the WHERE clause.

Answer: D. Group functions cannot be used in WHERE clause. The tin appear in SELECT, HAVING and ORDER BY clause.

41. Examine the tabular array structure every bit given.

SQL> DESC employees  Proper name			 Cipher?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Not NULL NUMBER(6)  FIRST_NAME			  VARCHAR2(twenty)  LAST_NAME		 NOT NULL VARCHAR2(25)  Electronic mail			 Non NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 Non NULL DATE  JOB_ID 		 NOT NULL VARCHAR2(10)  SALARY 			  NUMBER(viii,2)  COMMISSION_PCT 		  NUMBER(two,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

Predict the outcome of the below query

SELECT chore, COUNT(employee_id ),sum(salary ) FROM employees  Grouping BY job HAVING SUM (salary ) > 5000;
  1. It executes successfully and lists the count of employees under each job category but ignores the HAVING clause since "bacon " is non in Grouping By clause.
  2. It throws mistake considering HAVING clause is invalid.
  3. It throws mistake because "salary " is non included in the GROUP BY clause.
  4. It executes successfully and lists the count of employees under each category having sum of salary greater than 5000.

Answer: D. The HAVING clause restricts the grouping results. COUNT role is used for counting while SUM is used for adding the numeric values.

42. What is true of using group functions on columns that contain Naught values?

  1. Group functions on columns ignore NULL values.
  2. Group functions on columns returning dates include NULL values.
  3. Grouping functions on columns returning numbers include NULL values.
  4. Group functions on columns cannot be accurately used on columns that comprise NULL values.

Answer: A. Except COUNT office, all the group functions ignore NULL values.

43. Which of the following statetments are true about the usage of GROUP Past columns in a subquery?

  1. Subqueries can contain Grouping BY and Order BY clauses.
  2. Subqueries cannot incorporate GROUP Past and Lodge BY clauses.
  3. Subqueries can contain ORDER Past only non the GROUP By clause.
  4. Subqueries cannot contain Guild By just tin can accept Grouping By clause.

Reply: A. Like the chief query, a subquery can comprise a GROUP BY as well every bit Social club BY clause.

Examine the table construction as given and respond the questions 44 to 49 that follow.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Not NULL NUMBER(6)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 Not Null VARCHAR2(25)  Electronic mail			 NOT Nothing VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(twenty)  HIRE_DATE		 NOT Zippo Date  JOB_ID 		 Non Nil VARCHAR2(10)  Salary 			  NUMBER(8,2)  COMMISSION_PCT 		  NUMBER(2,ii)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

44. Predict the consequence of the below query

SELECT avg(max(salary )) FROM employees  GROUP By department_id  HAVING avg(max(salary ))>100;
  1. Information technology executes successfully.
  2. It gives an error because the HAVING clause is not valid.
  3. It gives an error because the Group BY expression is not valid.
  4. It gives an error because aggregate functions cannot exist nested in SELECT statement.

Answer: B. The HAVING clause doesn't allows nesting of aggregate functions.

45. Predict the output of the beneath query

SELECT avg(salary ), department_id  FROM employees  Group BY department_id ;
  1. Information technology gives error because an aggregate role cannot appear just subsequently SELECT clause.
  2. It gives mistake because Group Past clause is invalid.
  3. It executes without errors just produces no output.
  4. Information technology executes successfully and gives average bacon in each department.

Answer: D. Group functions tin can be used in whatsoever sequence (before or afterward the grouping by columns) in a SELECT query.

46. Predict the output of the below query

SELECT lower(task),avg(bacon ) FROM employees  Grouping Past upper(job);
  1. Information technology executes successfully and displays "task" in lower example.
  2. It executes successfully but display "chore" in original example.
  3. Information technology throws error considering singe row and aggregate functions cannot be used together.
  4. It throws error because example conversion in the SELECT listing mismatches with the case conversion GROUP Past clause.

Respond: D. The role LOWER, being a single row role must be specified in the Group By clause to base of operations the grouping of EMPLOYEES data.

47. Which of the below query executes successfully?

  1. SELECT employee_id , COUNT(hiredate-sysdate) FROM employees ;
  2. SELECT AVG(salary ), MAX(bacon ) FROM employees ;
  3. SELECT AVG(bacon ), MAX(salary ) FROM employees  GROUP Past department_id ;
  4. SELECT AVG(hiredate) FROM employees ;

Respond: B, C. The showtime query operates of the whole EMPLOYEES data while the second one processes the data in groups of section.

48. Identify the mistake in the beneath SELECT statement.

SELECT department_id , AVG (bacon ) FROM employees  GROUP BY department_id  HAVING department_id  > 10;
  1. Information technology executes successfully and displays average salary of departments higher than ten.
  2. It throws error because non aggregated cavalcade cannot exist used in HAVING clause.
  3. It executes successfully merely displays incorrect result for the departments.
  4. It throws error considering HAVING clause must be placed before GROUP BY clause.

Answer: A. Group By expressions can be used in HAVING clause to filter out the groups from the final data set.

49. Predict the output of the below query

SELECT department_id , AVG (salary ) FROM employees  Grouping Past department_id  HAVING (department_id >10 and AVG(salary )>2000);
  1. It throws error because multiple weather cannot exist given in HAVING clause.
  2. It throws fault because a non aggregate cavalcade cannot be used in HAVING clause.
  3. It executes successfully and displays average salary of department higher than ten and greater than 2000.
  4. It executes successfully but no upshot is displayed.

Reply: C. The HAVING clause can impose multiple weather joined using AND or OR operator filter the groups.

50. Which of the following group functions tin be used with DATE values?

  1. AVG
  2. MIN
  3. SUM
  4. COUNT

Reply: B, D. The group function AVG and SUM can be used with numeric data simply.

51. Which of the post-obit statements are true?

  1. AVG and SUM can be used only with numeric information types.
  2. STDDEV and VARIANCE tin can be used only with numeric information types.
  3. MAX can be used with LONG information type.
  4. MAX and MIN cannot be used with LOB or LONG data types.

Respond: A, B, D. The group functions AVG,SUM, VARIANCE and STDDEV can be used with numeric data only. None of the group functions tin be used with LONG data type.

52. Examine the tabular array structure as given.

SQL> DESC employees  Proper name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Not NULL NUMBER(6)  FIRST_NAME			  VARCHAR2(twenty)  LAST_NAME		 NOT NULL VARCHAR2(25)  EMAIL			 Not NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 Non Null Engagement  JOB_ID 		 NOT NULL VARCHAR2(ten)  Bacon 			  NUMBER(8,2)  COMMISSION_PCT 		  NUMBER(ii,two)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

Identify the fault in the below query.

SELECT department_id , avg(salary ), count(hiredate) FROM employees  GROUP BY department_id ;
  1. Multiple aggregate functions cannot exist used in a single SELECT query
  2. GROUP BY clause is invalid
  3. COUNT function cannot exist used with Engagement values
  4. No errors and it executes successfully

Answer: D.

53. Which of the following group role tin be used with LOB data types?

  1. MAX
  2. MIN
  3. COUNT
  4. None of these

Answer: D. No aggregate part can be used with LOB data types.

54. Examine the table structure as given.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 NOT Zippo NUMBER(6)  FIRST_NAME			  VARCHAR2(xx)  LAST_NAME		 NOT Aught VARCHAR2(25)  EMAIL			 NOT Nix VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(xx)  HIRE_DATE		 NOT Cipher Appointment  JOB_ID 		 Non Nix VARCHAR2(10)  SALARY 			  NUMBER(8,ii)  COMMISSION_PCT 		  NUMBER(2,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

Predict the output of the below two queries

Query - one

SELECT avg(comm) FROM employees ;

Query - 2

SELECT avg(nvl(comm,0)) FROM employees ;
  1. Both the queries produce same result
  2. Query - ane and Query - 2 produce different results considering Query-1 considers Zero values of COMM and Query-2 substitutes NULL values of COMM with zero
  3. Query - 1 produces error considering COMM has NULL values
  4. Query - 2 produces error considering NVL cannot be nested with amass function.

Answer: B. The AVG function ignores NULL values while computing the average of numeric information. AVG(cavalcade) volition summate average for only non zippo values. However, if NVL is used to substitute NULLs with a zero, all the values will be considered.

55. Choose the correct statements well-nigh the GROUP BY clause.

  1. Cavalcade alias tin be used in the Grouping BY clause.
  2. GROUP Past cavalcade must be in the SELECT clause.
  3. Group Past clause must appear together with HAVING clause a SELECT query.
  4. GROUP Past clause must announced subsequently WHERE clause in a SELECT query.

Answer: D. As per the processing sequence, the GROUP By clause must announced later the WHERE clause in a SELECT query.

56. Examine the table structure as given.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Non Zippo NUMBER(six)  FIRST_NAME			  VARCHAR2(twenty)  LAST_NAME		 Non NULL VARCHAR2(25)  EMAIL			 Non NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(xx)  HIRE_DATE		 NOT NULL DATE  JOB_ID 		 NOT Cypher VARCHAR2(10)  SALARY 			  NUMBER(viii,two)  COMMISSION_PCT 		  NUMBER(2,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(four)

Predict the outcome of the beneath query

SELECT department_id ,avg(salary ) FROM employees  Group Past department_id , task Social club By department_id ;
  1. It throws error because GROUP Past column list doesn't matches with SELECT column list.
  2. Information technology executes successfully and produces average salary of a job category in each section.
  3. Information technology executes successfully and produces average salary for a department in each job category.
  4. Information technology throws error because Grouping BY and ORDER BY clause have different list of columns.

Answer: B. Though Group By clause implicitly sorts the groups, the Group BY and Lodge BY clauses tin can be used together in a query.

57. Which clause should you lot use to exclude grouping results in a query using group functions?

  1. WHERE
  2. HAVING
  3. GROUP By
  4. ORDER Past

Answer: B. HAVING clause is used to restrict the groups.

Examine the tabular array structure as given and answer the questions 58 and 59 that follow.

SQL> DESC employees  Name			 Zero?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 NOT Nada NUMBER(6)  FIRST_NAME			  VARCHAR2(xx)  LAST_NAME		 NOT NULL VARCHAR2(25)  EMAIL			 Not NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(xx)  HIRE_DATE		 NOT NULL DATE  JOB_ID 		 NOT NULL VARCHAR2(10)  Salary 			  NUMBER(8,two)  COMMISSION_PCT 		  NUMBER(two,two)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

58. Predict the upshot of the beneath query

SELECT department_id ,avg(salary ) FROM employees  HAVING avg(salary )>2000 Group BY department_id  Society BY department_id        
  1. It executes successfully.
  2. Information technology throws error because HAVING clause precedes the Group Past clause.
  3. It throws mistake because HAVING clause uses the aggregate function.
  4. Information technology executes but no results are displayed because HAVING clause precedes the Grouping By clause.

Reply: A. HAVING clause can precede the GROUP BY clause but it is candy only later on the group results are calculated.

59. Predict the result of the below query

SELECT department_id , COUNT(first_name ) FROM employees  WHERE job IN ('SALESMAN','CLERK','MANAGER','Analyst') Grouping BY department_id  HAVING AVG(salary ) BETWEEN 2000 AND 3000;
  1. Information technology returns an error considering the BETWEEN operator cannot be used in the HAVING clause.
  2. Information technology returns an error because WHERE and HAVING clauses cannot exist used in the aforementioned SELECT statement.
  3. It returns an error because WHERE and HAVING clauses cannot be used to apply atmospheric condition on the same cavalcade.
  4. Information technology executes successfully.

Answer: D. The WHERE clause restricts the number of rows participating in group clause processing.

60. Which statements are true regarding the WHERE and HAVING clauses in a SELECT statement?

  1. The HAVING clause can be used with group functions in subqueries.
  2. The WHERE clause can exist used to exclude rows after dividing them into groups.
  3. The WHERE clause can be used to exclude rows earlier dividing them into groups.
  4. The WHERE and HAVING clauses tin can be used in the same statement only if they are practical to different columns in the tabular array.

Answer: A, C. WHERE and HAVING clause tin be used together in a query. WHERE excludes the rows before grouping processing while HAVING restricts the groups.

Examine the tabular array structure every bit given and respond the questions 61 and 62 that follow.

SQL> DESC employees  Name			 Zilch?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 NOT NULL NUMBER(half-dozen)  FIRST_NAME			  VARCHAR2(xx)  LAST_NAME		 NOT NULL VARCHAR2(25)  EMAIL			 Not NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 NOT Cypher DATE  JOB_ID 		 NOT Cypher VARCHAR2(10)  SALARY 			  NUMBER(8,2)  COMMISSION_PCT 		  NUMBER(two,ii)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

61. Predict the outcome of the below query.

SELECT department_id , avg(salary ) FROM employees  HAVING avg(salary ) > min(salary ) Grouping BY department_id ;
  1. It throws an fault considering the amass functions used in HAVING clause must be in SELECT list.
  2. It throws an error because the HAVING clause appears before Group Past clause.
  3. It displays the departments whose boilerplate bacon is greater than the minimum salary of the department.
  4. Information technology displays the departments whose average bacon is greater than the minimum salary of the organization.

Respond: C. Group functions tin can exist used by HAVING clause to filter the groups.

62. Interpret the output of the below query.

SELECT SUM(AVG(LENGTH(first_name ))) FROM employees   Grouping By department_id ;
  1. It calculates the sum of averages of length of employee's name in each section.
  2. It calculates the average length of employee'southward name in each department.
  3. It throws error because unmarried row function cannot be used with group functions.
  4. Information technology throws error because group column DEPARTMENT_ID is not used in the SELECT listing.

Respond: A. Group functions tin can be used with single row or general functions in the SELECT query.

63. Up to how many levels, the grouping functions can be nested?

  1. 1
  2. two
  3. three
  4. No limits

Answer: B. Group functions can be nested maximum upwards to 2 levels. Nevertheless, unmarried row functions can exist nested up to any number of levels.

64. What is the limit of number of groups within the groups created by Group BY clause?

  1. 1
  2. two
  3. 3
  4. No Limit

Answer: D. There is no limit to the number of groups and subgroups that can be formed.

65. Choose the correct statements near the HAVING clause.

  1. The HAVING clause is an optional clause in SELECT statement.
  2. The HAVING clause is a mandatory clause if SELECT argument uses a GROUP BY clause.
  3. The HAVING clause can appear in a SELECT statement only if information technology uses a Group BY clause.
  4. The HAVING clause is a mandatory clause if SELECT statement uses a Grouping By clause.

Answer: A, C. HAVING clause can merely appear in a query if Grouping BY clause is present, only vice versa is non truthful.

66. What is the output of the beneath query.

SELECT count(*) FROM dual GROUP Past dummy;
  1. i
  2. 0
  3. NULL
  4. Throws error because group functions cannot be applied on DUAL tabular array.

Answer: A. The DUAL table contains single column DUMMY of type CHAR(1) whose value is 'X'.

Based on the below scenario, answer the question from 67 to 74.

An organization has 14 employees who work on stock-still salary of thou. The company recruits 5 new employees whose bacon is non yet fixed by the payroll department. Even so, during the calendar month end processing, the Hr payroll section generates several reports to reconcile the financial information of the system. Examine the table structure equally given.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 NOT Zero NUMBER(6)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 NOT NULL VARCHAR2(25)  EMAIL			 Not NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 Not Zip DATE  JOB_ID 		 NOT Aught VARCHAR2(x)  Bacon 			  NUMBER(viii,2)  COMMISSION_PCT 		  NUMBER(2,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(iv)

67. What is the output of the below query?

SELECT SUM (salary ) FROM employees ;
  1. Cipher
  2. 14000
  3. 19000
  4. 0

Answer: B. The SUM function adds the salaries of the employees.

68. What is the output of the below query?

SELECT AVG (salary ) FROM employees ;
  1. m
  2. 736.84
  3. NULL
  4. 0

Reply: A. The AVG (salary ) role calculates the average of salaries and ignoring the Goose egg values. In this instance, AVG(salary)=(fourteen*1000)/14=1000.

69. What is the output of the below query?

SELECT AVG (nvl(salary ,0)) FROM employees ;
  1. 1000
  2. Nothing
  3. 736.84
  4. 0

Respond: C. The AVG(NVL(bacon ,0)) gives an alternate value to the NULLs and enables them to participate in average adding. In this case, (14*thousand)/19 = 736.84.

70. What is the output of the below query?

SELECT VARIANCE (salary ) FROM employees ;
  1. 1000
  2. 0
  3. Goose egg
  4. 204678.36

Answer: B. The VARIANCE (salary ) calculates the variance of salary column values ignoring NULLs.

71. What is the output of the below query?

SELECT VARIANCE (nvl(bacon ,0)) FROM employees ;
  1. yard
  2. 0
  3. NULL
  4. 204678.36

Respond: D. The VARIANCE (NL(salary ,0)) calculates the variance of salary cavalcade values including NULLs.

72. What is the output of the beneath query?

SELECT STDDEV (salary ) FROM employees ;
  1. i
  2. yard
  3. 0
  4. NULL

Answer: C. The STDDEV (bacon ) calculates the standard divergence of bacon column values ignoring NULLs.

73. What is the output of the below query?

SELECT STDDEV (nvl(salary ,0)) FROM employees ;
  1. 0
  2. 452.41
  3. g
  4. Null

Answer: B. The STDDEV (nvl(salary ,0)) calculates the standard difference of salary cavalcade values including NULLs.

74. What is the output of the below query?

select count(*),count(salary ) from employees ;

  1. 19,xix
  2. 14,19
  3. 19,14
  4. xiv,14

Answer: C. COUNT(*) includes NULLs while COUNT(salary ) ignores Nothing values.

75. Examine the table structure equally given.

SQL> DESC employees  Proper noun			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 NOT Null NUMBER(6)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 Not NULL VARCHAR2(25)  EMAIL			 NOT Nada VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 Not Nix Appointment  JOB_ID 		 Non NULL VARCHAR2(10)  Bacon 			  NUMBER(viii,two)  COMMISSION_PCT 		  NUMBER(2,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

Which of the below query will give the department who have more than 5 employees working in it?

  1. SELECT department_id  FROM employees  WHERE COUNT(*) > 5 GROUP BY department_id ;
  2. SELECT department_id  FROM employees  HAVING COUNT(*) > 5;
  3. SELECT department_id  FROM employees  GROUP BY employee_id  HAVING COUNT(*) > 5;
  4. SELECT department_id  FROM employees  GROUP Past department_id  HAVING COUNT(*) > 5;

Answer: D.

76. Which of the following are true most the CUBE extension of GROUP BY?

  1. Enables performing multiple Group BY clauses with a single query.
  2. Performs aggregations for all possible combinations of columns included.
  3. Performs increasing levels of cumulative subtotals, based on the provided column list.
  4. None of the above

Answer: B. CUBE, ROLLUP are the Grouping BY extensions used for OLAP processing. CUBE aggregates the results whenever a new permutation of column is formed.

Use the following SELECT statement to respond below questions 77 to 82:

1 SELECT client#, COUNT(*) 2 FROM customers Bring together orders USING (customer#) 3 WHERE orderdate > '02-April-09' four Grouping BY customer# v HAVING COUNT(*) > ii;

77. Which line of the SELECT statement is used to restrict the number of records the query processes?

  1. 1
  2. three
  3. 4
  4. 5

Reply: B. WHERE clause is used to restrict the rows before the groups are formed.

78. Which line of the SELECT argument is used to restrict groups displayed in the query results?

  1. ane
  2. three
  3. four
  4. 5

Respond: D. HAVING is used to restrict the group results subsequently the group processing is over.

79. Which line of the SELECT statement is used to group information stored in the database?

  1. one
  2. three
  3. 4
  4. 5

Reply: C. Grouping BY clause uses the group by columns to group the data in the table.

eighty. Which clause must be included for the query to execute successfully?

  1. ane
  2. iii
  3. 4
  4. 5

Answer: C. Because the SELECT clause contains the CUSTOMER# cavalcade, it is mandatory to have GROUP Past clause with the Customer# cavalcade.

81. What is the purpose of using COUNT(*) in the SELECT query?

  1. The number of records in the specified tables
  2. The number of orders placed past each client
  3. The number of NULL values in the specified tables
  4. The number of customers who take placed an order

Answer: B. It counts the number of rows processing under a grouping. In this instance, group is formed by the client and COUNT(*) counts the orders placed by each client.

82. Which of the post-obit functions can be used to determine the earliest send engagement for all orders recently candy by JustLee Books?

  1. COUNT function
  2. MAX function
  3. MIN function
  4. STDDEV function

Reply: C. MIN function is used to retrieve the least value of the cavalcade. When used with date columns, it fetches the minimum date from the column.

83. Which of the following is not a valid SELECT statement?

  1. SELECT STDDEV(retail) FROM books;
  2. SELECT AVG(SUM(retail)) FROM orders NATURAL Join orderitems NATURAL JOIN books Group BY customer#;
  3. SELECT lodge#, TO_CHAR(SUM(retail),'999.99') FROM orderitems JOIN books USING (isbn) GROUP BY order#;
  4. SELECT title, VARIANCE(retail-cost) FROM books GROUP Past pubid;

Answer: D. The GROUP Past clause must specify a column or set of columns contained in the SELECT clause. Here PUBID is not contained in the SELECT clause, hence the query is non valid.

84. Which of the below statements are true about the nesting of group functions?

  1. The inner most office is resolved first.
  2. Oracle allows nesting of grouping function up to 3 levels.
  3. Single row functions can exist nested with group functions.
  4. Oracle allows nesting of group function up to 2 levels.

Respond: A, C, D. In an expression containing nested functions, the innermost function is executed showtime whose result is fed into the side by side function moving in outwards direction. Single row functions tin can be well used with group functions which can be maximum nested up to ii levels.

85. What are the statistical group functions in Oracle?

  1. AVG
  2. STDDEV
  3. VARIANCE
  4. STATS

Reply: B, C. VARIANCE and STATS are the statistical group functions bachelor in Oracle SQL.

86. If the SELECT list contains a cavalcade and a group functions, which of the post-obit clause must be mandatorily included?

  1. ORDER By
  2. HAVING
  3. Group By
  4. None of these

Answer: C. GROUP By clause should necessarily contain the cavalcade or set of columns independent in the SELECT clause.

87. Examine the table structure as given.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 NOT NULL NUMBER(half-dozen)  FIRST_NAME			  VARCHAR2(xx)  LAST_NAME		 Not Naught VARCHAR2(25)  EMAIL			 NOT NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 NOT Aught Engagement  JOB_ID 		 NOT Aught VARCHAR2(10)  SALARY 			  NUMBER(8,2)  COMMISSION_PCT 		  NUMBER(2,two)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

What is the best explanation as to why this SQL statement volition Non execute?

SELECT department_id "Department", AVG (salary)"Boilerplate" FROM employees Grouping By Department;
  1. Salaries cannot be averaged every bit not all the numbers will divide evenly.
  2. You cannot use a column alias in the Group By clause.
  3. The GROUP Past clause must accept something to GROUP.
  4. The department id is not listed in the departments tabular array.

Answer: B. Neither Grouping BY clause nor HAVING clause works with column alias.

88. Which of the post-obit information types are compatible with AVG, SUM, VARIANCE, and STDDEV functions?

  1. But numeric data types
  2. Integers only
  3. Any data type
  4. All except numeric

Respond: A. The functions AVG, SUM, VARIANCE and STDDEV mandatorily work with numeric data type just.

Examine the table structure as given beneath and answer the questions 89 and 90 that follow.

SQL> DESC employees  Name			 Goose egg?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Not Cypher NUMBER(vi)  FIRST_NAME			  VARCHAR2(twenty)  LAST_NAME		 NOT NULL VARCHAR2(25)  Electronic mail			 Not Cipher VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 NOT NULL DATE  JOB_ID 		 Non NULL VARCHAR2(10)  SALARY 			  NUMBER(8,two)  COMMISSION_PCT 		  NUMBER(two,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(4)

89. Which of the below query will display the number of singled-out job categories working in each department?

  1. SELECT department_id , COUNT(DISTINCT job) FROM employees  GROUP BY job;
  2. SELECT department_id , COUNT(chore) FROM employees  Group BY employee_id ;
  3. SELECT department_id , COUNT(job) FROM employees  GROUP By department_id ;
  4. SELECT department_id , COUNT(Distinct job) FROM employees  GROUP Past department_id ;

Respond: D. Apply DISTINCT modifier to filter out the duplicates.

90. Evaluate this SQL statement:

SELECT employee_id , first_name , department_id , SUM(bacon ) FROM employees  WHERE salary  > 1000 GROUP Past department_id , employee_id , first_name  Gild By hiredate;

Why will this statement cause an error?

  1. The HAVING clause is missing.
  2. The WHERE clause contains a syntax error.
  3. The SALARY column is Not included in the GROUP BY clause.
  4. The HIRE_DATE column is Not included in the GROUP Past clause.

Reply: D. All the columns actualization in SELECT and Social club BY clause must be included in the Group BY clause.

91. Which of the post-obit statements is true about the GROUP By clause?

  1. To exclude rows before dividing them into groups using the GROUP By clause, you use should a WHERE clause.
  2. You lot must utilise the HAVING clause with the GROUP By clause.
  3. Cavalcade alias can exist used in a GROUP BY clause.
  4. By default, rows are non sorted when a Group BY clause is used.

Answer: A. Using a WHERE clause, you tin exclude rows earlier dividing them into groups.

92. Examine the table structure as given.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 Non Zilch NUMBER(six)  FIRST_NAME			  VARCHAR2(20)  LAST_NAME		 Not Nada VARCHAR2(25)  E-mail			 NOT NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(20)  HIRE_DATE		 Non Zero Appointment  JOB_ID 		 NOT Zilch VARCHAR2(10)  SALARY 			  NUMBER(eight,2)  COMMISSION_PCT 		  NUMBER(ii,2)  MANAGER_ID			  NUMBER(6)  DEPARTMENT_ID			  NUMBER(iv)

Interpret the outcome of the below query.

SELECT department_id , MIN (hiredate) FROM employees  GROUP by department_id ;
  1. The primeval hire appointment in the organization.
  2. The latest rent appointment in the organization.
  3. The earliest hire date in a department.
  4. The latest hire date in a department.

Answer: C. The query returns the earliest hired employee in each section.

93. Which statement nigh group functions is true?

  1. Group functions except COUNT(*), ignore aught values.
  2. A query that includes a grouping function in the SELECT list must include a GROUP By clause.
  3. Group functions can exist used in a WHERE clause.
  4. Group functions tin only be used in a SELECT list.

Answer: A. All the grouping functions except COUNT(*), ignore Naught values. It is because they process the values direct contained in a specific cavalcade.

94. Which of the post-obit clauses represent valid uses of grouping functions?

  1. Group BY MAX(bacon)
  2. ORDER BY AVG(salary)
  3. HAVING MAX(salary) > 10000
  4. SELECT AVG(NVL(salary, 0))

Reply: B, C, D. Group functions can announced in SELECT, HAVING and Gild Past clauses just.

95. Which of the following statements are true nigh the GROUP Past clause?

  1. The last column listed in the GROUP Past clause is the well-nigh major grouping.
  2. The commencement column listed in the Group By clause is the near major grouping.
  3. A GROUP Past clause cannot be used without an Lodge BY clause.
  4. The GROUP BY clause do not ensure the sorting of output.

Answer: B. The grouping of data is based on the sequence of columns appearing in the Group Past clause.

96. What is divergence between WHERE clause and HAVING clause?

  1. WHERE clause restrict rows before group while HAVING clause restricts groups.
  2. WHERE clause cannot contain a group function merely HAVING clause can take.
  3. WHERE clause can join multiple conditions using AND or OR operators but HAVING clause cannot.
  4. WHERE clause can appear in SELECT query without Group Past clause just HAVING clause cannot.

Answer: A, B, D. WHERE clause restricts the rows earlier grouping but HAVING restricts the groups.

97. Examine the table structure as given.

SQL> DESC employees  Name			 Null?	  Type  ----------------------- -------- ----------------  EMPLOYEE_ID		 NOT Zippo NUMBER(6)  FIRST_NAME			  VARCHAR2(xx)  LAST_NAME		 NOT NULL VARCHAR2(25)  Email			 NOT NULL VARCHAR2(25)  PHONE_NUMBER			  VARCHAR2(xx)  HIRE_DATE		 NOT Goose egg Engagement  JOB_ID 		 NOT Aught VARCHAR2(10)  SALARY 			  NUMBER(viii,2)  COMMISSION_PCT 		  NUMBER(two,2)  MANAGER_ID			  NUMBER(half dozen)  DEPARTMENT_ID			  NUMBER(4)

Predict the consequence of the below query.

SELECT department_id ,job,count(*) FROM employees  GROUP BY department_id ,chore ORDER BY department_id ,count(*);
  1. It executes successfully.
  2. It throws error because ORDER By clause is invalid.
  3. It throws error because Grouping Past clause is invalid.
  4. Information technology throws error because GROUP BY and Social club BY clause cannot be used together.

Reply: A. ORDER Past clause tin employ the group functions for sorting.

Useful Video Courses


Oracle SQL Online Training

Video

Oracle PL/SQL Online Training

Video

T-SQL Online Training

Video

SQL Masterclass: SQL for Data Analytics

Video

Learn SQL : The Best Way to Learn SQL (From IT Experts)

Video

Learn Database Design with MySQL

Video

Source: https://www.tutorialspoint.com/sql_certificate/using_the_group_functions_questions.htm

Posted by: mclachlanlaze1999.blogspot.com

0 Response to "Which Of The Following Is True Concerning Animal Form And Function?"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel