Rullst AcademyRullst Academy/Lesson
Databases and SQL I · Lesson 10 / 12

Inputs are data

Use parameters and distinguish validation, queries and authorization.

Learning paths16 min

Let's discover together

  1. 1

    Do not build SQL by concatenating typed text. The kit uses execute with WHERE label = ? and a tuple. The driver binds values as data, including apostrophes, without making them statement structure.

  2. 2

    Run python lab.py lookup Orbit: two records return because names may repeat. Inspect execute’s second argument in lab.py’s parameter_lookup. The lesson SQL is a fixed literal query for output comparison.

  3. 3

    The test uses quotes and SQL words as fictional data and expects zero matches, without external services. Parameters bind values; table names and sort direction need application-controlled choices.

  4. 4

    Parameters do not decide who may read a record or whether stock makes sense. Authorization, domain validation and data minimization remain necessary. Store only what the purpose needs.

Your data workbench

Our model: kits.id ← loans.kit_id. One material can have many loans; names may repeat. We use fictional data only.

Predict before opening the reference. It shows verified output from the original example, not execution of your text. Run your changes with the kit on your computer.

-- Inputs are data
SELECT id, label FROM kits WHERE label='Orbit' ORDER BY id;
Compare with reference output
[
  {
    "columns": [
      "id",
      "label"
    ],
    "rows": [
      [
        1,
        "Orbit"
      ],
      [
        3,
        "Orbit"
      ]
    ]
  }
]

Run the command in the extracted folder’s terminal. Use python3 on macOS/Ubuntu or py if that is your Windows launcher. Every run starts in memory; read README.md for saving files and recovery practice.

python lab.py run lesson.sql
My files and GitHub

The editor saves your .sql draft in this browser. Download it and replace lesson.sql in the kit; for the final project, availability.sql. The ZIP remains the original template. GitHub publishing sends only the confirmed file, without executing SQL or sending a database.

Official links and next step

✦
YOUR MISSION

Use parameters and distinguish validation, queries and authorization.

Now it's your turn

Discovery workshop

Read, predict and check

Use parameters and distinguish validation, queries and authorization.
Build your answers and check when you are ready.
A moment to understand

How should typed input reach a query?

I need a hint

Run python lab.py lookup Orbit: two records return because names may repeat. Inspect execute’s second argument in lab.py’s parameter_lookup. The lesson SQL is a fixed literal query for output comparison.

Loading your journey…

Take it with you

Run lookup with an existing and missing name. Explain the difference and an access rule the example lacks.

At your own pace

My files and GitHub

Every lesson can become your own record: code, notes or a practice plan. Saving a file to GitHub is optional and does not change your XP.

Student guide

The editor and downloads open when this lesson is available to your account. Check access below or return to the track map.

Checking your access to this lesson…

Rullstpetbot

AI can make mistakes. Check the lesson material.