Database: SELECT Rows - Introduction

The SELECT command can be used with one table to select rows that meet some criterion for the resulting table. This uses the Student table. The FROM clause specified the table(s) and the WHERE clause specifies conditions that a row must satisfy to be included in the result.

Selecting rows with arithmetic comparison

To get all students with a GPA greater than or equal to 3.0.
SELECT *
    FROM Student
    WHERE student_gpa >= 3.0;
Result:
student_idstudent_fnamestudent_lnamestudent_gpa
4MinnieMouse3.8
3PeterRabbit3.6


There may even be no results. For example,
SELECT *
    FROM Student
    WHERE student_gpa >= 4.0;
Result:
student_idstudent_fnamestudent_lnamestudent_gpa
Nothing is selected.

Selecting columns and rows

Column selections and comparisons can both be done. The result doesn't have to display columns that were compared.
SELECT student_lname, student_fname
    FROM Student
    WHERE student_gpa >= 3.0;
Result:
student_lnamestudent_fname
Mouse Minnie
RabbitPeter