Consider the following statement: SELECT emp_no, name FROM employee _________desig Which of the following option will be used to display the employee number and names of similar designations together?
(A) FIELD()
(B) GROUP BY
(C) ORDER BY
(D) Both (b) and (c)
Answer:
Checking the options
- (A) FIELD() - It is not an aggregate function is SQL
- (B) GROUP BY - It is used to arrange identical data into groups
- (C) ORDER BY - It is used to sort the data in ascending or descending order, based on one or more columns
- (D) Both (b) and (c)
So, to display the employee number and names of similar designations together we have to use the GROUP BY clause.
So, the correct answer is (B)