{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Select statement in Oracle - order by is followed by the...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Select statement in Oracle SELECT columns you want to select FROM table or view name WHERE a criterion to restrict the number of selected rows GROUP BY HAVING ORDER BY sort the data SELECT and FROM are mandatory. The statement is invalid if those keywords are missing. GROP BY and HAVING are used for data aggregation, and we’ll cover this topic in another lecture. For this exercise, we will use the data in DBST651_students table that we created and populated earlier. Select all data from the table List the id, first name, and last name for each student.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
List all information about stuents who have an A. List student data ordered by the last name. By default, the last names are sorted in ascending order. List student data ordered by last name in descending order. The column name after the
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: order by is followed by the keyword desc. You can sort the query results by more than 1 column. Let’s list students sorted by grade and instructor id. Display how many rows are in the dbst651_students table. You can define the column alias names. Notice that count(*) heading is replaced with STUDENTCOUNT heading. Think about: 1. What if I want to select data from more than one table? How would I list student names and the corresponding instructor names in the same report? 2. What if I want to display how many students got each letter grade? 3. Is it possible to specify more than one criterion in the where clause? What if I want to list students who have an A and take a class taught by Yelena? These topics will be covered later in the course....
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern