# Reading and Changing Rows

Reading and Changing Rows: Reading Rows: SELECT, WHERE and ORDER BY, Changing Rows: UPDATE and DELETE, Placeholders, and Why SQL Is Never Built from Strings.

Updated: November 19, 2026

1. [Reading Rows: SELECT, WHERE and ORDER BY](https://www.ask-codey.com/lessons/fastapi-sql-select) (Apprentice): SELECT asks a table for the columns you name, WHERE keeps only the rows that pass its test (with AND, OR and LIKE), ORDER BY sorts them and LIMIT caps how many come back, and in Python fetchone and fetchall read the answer, with sqlite3.Row giving rows you read by column name.
2. [Changing Rows: UPDATE and DELETE](https://www.ask-codey.com/lessons/fastapi-sql-update-and-delete) (Apprentice): UPDATE changes the columns SET names and DELETE removes rows, each only in the rows its WHERE picks, rowcount says how many rows that was so an API can tell a change from a missing row, and a with block commits changes that belong together or rolls them all back.
3. [Placeholders, and Why SQL Is Never Built from Strings](https://www.ask-codey.com/lessons/fastapi-sql-placeholders-and-injection) (Journeyman): SQL built with an f-string lets whatever a person types become part of the query, so a name such as x' OR '1'='1 turns one search into "every row", which is SQL injection, and ? or :name placeholders stop it by sending each value separately from the SQL.

Source: https://www.ask-codey.com/courses/python-web-apis/topics/fastapi-reading-and-changing-rows
