Select statement in Oracle

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

Info iconThis 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.
Background image of page 1

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

View Full DocumentRight 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
Background image of page 2
Background 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. Lets 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

This note was uploaded on 12/22/2009 for the course DBST DBST 651 taught by Professor Yelena - ta during the Spring '09 term at MD University College.

Page1 / 3

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online