Skip to content
Worked Examples · Example 9.2

Q.The following query retrieves the name and date of birth of the student with roll number 1 from the STUDENT table.

Yanam BieapTextbookSubjective· 2mImportance★★★★★
3% · 3/95 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The query is a selection (WHERE RollNumber = 1) followed by a projection (SELECT SName, SDateofBirth). Run against the STUDENT table of Table 9.7, it returns exactly one row: Atharv Ahuja, 2003-05-15.

Concept: Projection and Selection

Every SELECT statement combines two relational-algebra operations:

  1. Projection (SELECT clause) — chooses which columns appear in the result.
  2. Selection (WHERE clause) — chooses which rows appear in the result.

The query

SELECT SName, SDateofBirth
FROM STUDENT
WHERE RollNumber = 1;
  • FROM STUDENT — the table to query.
  • WHERE RollNumber = 1 — the selection: keep only the row(s) where RollNumber equals 1. In relational algebra: σ<sub>RollNumber=1</sub>(STUDENT).
  • SELECT SName, SDateofBirth — the projection: of the row(s) that survive the selection, keep only these two columns.

Running it against the real STUDENT table

This chapter populates the STUDENT table with the six rows of Table 9.7:

RollNumberSNameSDateofBirthGUID
1Atharv Ahuja2003-05-15444444444444
2Daizy Bhutia2002-02-28111111111111
3Taleem Shah2002-02-28NULL
4John Dsouza2003-08-18333333333333
5Ali Shah2003-07-05101010101010
6Manika P.2002-03-10466444444666

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.