Skip to content
Exit presentation

Data Handling II: Databases & Structured Data

One record, one row

A register is a school's list of its students. Every student in it is one row. A section is a class group, such as 9-A. The due is the fee money a student still owes, in rupees. Positions count from 0, so rows[2] is the third row.

Five rows, one heading row above them.
Step 1 of 4
  1. Five rows, one heading row above them.
  2. In this register, position 0 is the admission number.
  3. In this register, position 3 is the due.
  4. rows[2][3] reads Chandni's due: 1450.

The rule

A record is one row of values that belong together. The heading row names the columns. One field takes two positions: first the row, then the column.

The full register has twelve rows, not five:

The office register of an invented school: one heading row, twelve records
admissionnamesectiondue
A-101Aarti Kulkarni9-A3200
A-102Bharat Iyer9-A0
A-103Chandni Shah9-B1450
A-104Dev Patil9-A800
A-105Esha Rao9-B3200
A-106Farid Khan9-A1450
A-107Gauri Menon9-B0
A-108Ananya Suresh9-A1450
A-109Hari Verma9-B2050
A-110Ananya Suresh9-A2050
A-111Ishita Bose9-B1450
A-112Rhea Mehta9-A900

Every record here is invented. If a name sounds familiar, that is a coincidence.

The lab asks for a position past a row's end, on purpose. A row has four values, positions 0 to 3. The runner is the tool that runs your code. In this course's runner, asking for position 4 stops the run. It says: You asked for position 4, but the list has 4 items.

To fetch a field is to read that one value. The walk is open below. Predict each fetched field, then reveal it.

Loading lab…

Every field a program reads takes two positions.

Jump to lesson

This track

  1. 0 Start here
  2. 1 One record, one row
  3. 2 The naming value
  4. 3 Naming the columns
  5. 4 Asking the register one question
  6. 5 Two conditions, both true
  7. 6 The answer, in order
  8. 7 Counting the groups in the answer
  9. 8 What a database adds
  10. 9 The big picture
  11. 10 Track quiz

Other tracks