Get your API key

Lesson 5 of 5

Read and write data, and catch the agent's risky queries

CRUD, SQL and REST side by side, safe practice queries in a test database, and the data-layer mistakes AI makes: UPDATE without WHERE, trusting the browser, missing RLS, loading whole tables.

9 min Log in to open
One step at a time, like flipping pages.

By the end of this lesson you will read the four kinds of database query, practise them on a throwaway database, and catch the data mistakes AI agents make most often before they reach real users.

You need: your coding agent, the tuition tables from lesson 4 · Time: 9 minutes

  1. Every app, from a UPI expense tracker to a college attendance app, does only four things with data. They have three sets of names, depending on who is talking:

    You want to… Short name (CRUD) Database (SQL) API (REST)
    add a new student Create INSERT POST
    see the list of students Read SELECT GET
    change a student's phone Update UPDATE PATCH
    remove a student Delete DELETE DELETE

    SQL is the language databases understand. Your app's screen sends a request (POST /students), your server turns it into SQL (INSERT INTO students …), and the database does it.

    Match them

    Match what the user does with the SQL that runs

    Tap an item on the left, then its meaning on the right.

    Why?

    You will not write SQL by hand. But the agent will show you SQL, and when something goes wrong it will talk in these words. Knowing which of the four a query is tells you at once how dangerous it is: SELECT only looks, the other three change data.

Log in free to read the rest of this lesson

Every lesson is free. A free account unlocks all of them and saves your progress.

Still to come in this lesson:

  1. Make a practice database you can break
  2. Read data: ask questions in plain English
  3. Change data: the WHERE that saves you
  4. Six mistakes to look for in AI data code
  5. Make the agent explain its data layer
  6. Recap