ImplementationSELECT...FROM...WHERE...clause

Structured Query Language is used to allow database developers to generate queries and interrogate the data held in a database. SELECT, FROM, WHERE, AND and OR are key areas of SQL.

Part ofComputing ScienceDatabase design and development

SELECT...FROM...WHERE...clause

To go a step further, the WHERE clause can be used. The WHERE clause will only return records that meet a specific condition.

SELECT PupilID, Surname, Class
FROM Pupil
WHERE Class = ‘1T1’;

This would return

PupilID SurnameClass
001Singh1T1
004McNamee1T1
007McNamee1T1
008Matazinadze1T1
PupilID001
SurnameSingh
Class1T1
PupilID004
SurnameMcNamee
Class1T1
PupilID007
SurnameMcNamee
Class1T1
PupilID008
SurnameMatazinadze
Class1T1

The WHERE clause has been used to ensure that the only records returned are those that have the value ‘1T1’ in the 'Class' column/field.