Skip to main content

Posts

Showing posts with the label order by

Question 6: ORDER BY with NULL

You are sorting data in a table in you SELECT statement in descending order. The column you are sorting on contains NULL records, where will the NULL record appears? A.At the beginning of the list. B.At the end of the list. C.In the middle of the list. D.At the same location they are listed in the unordered table. Answer: A Explanation: When sorting a column with null values in ascending order then the oracle places the Null values at the end of the list if the sorting is in descending order the oracle places the null values at the start of the list.

Order By clause

The STUDENT_GRADES table has these columns: STUDENT_ID NUMBER(12) SEMESTER_END DATE GPA NUMBER(4,3) The registrar has requested a report listing the students grade point averages (GPA), sorted from highest grade point average to lowest within each semester, starting from the earliest date. Which statement accomplishes this? A.SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end DESC, gpa DESC; B.SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end ASC, gpa ASC; C. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end, gpa DESC; D. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY gpa DESC, semester_end DESC; Answer :C Explanation: This answer shows correct syntax and semantics to receive desired result. Incorrect Answers A: Semesters will be sorted started from the oldest date, not the earliest. B: GPA data will be sorted in ascending order, what is opposite to our task. D: Semester...