Select Examples

This simple SELECT statement retrieves all the data from the Faculty table.


This statement retrieves the data from the person and the faculty table where the id column in the person table is the same as the id column in the faculty table.

SELECT, Faculty.salary FROM Person, Faculty WHERE =

The following example retrieves student_id and sum of the amount_paid where it is greater than or equal to 100 from the billing table. It then groups the records by student_id.

SELECT Student_ID, SUM(Amount_Paid) FROM Billing 
GROUP BY Student_ID HAVING SUM(Amount_Paid) >=100.00

If the expression is a positive integer literal, then that literal is interpreted as the number of the column in the result set and ordering is done on that column. No ordering is allowed on set functions or an expression that contains a set function.

Thursday, 18 April 2019 Posted in Example SQL Statements