Skip to content
简体中文
All chapters
CHAPTER 0510 min

Data

Keep information, then find it accurately

Lists, contacts, and orders all involve data. Describe its shape and operations before choosing a database name. That makes a request more precise and the result easier to verify.

By the end, you can
Distinguish files, browser storage, and databases
Describe features with fields, records, and CRUD
Understand the benefits and costs of an index
05.01

Files: TXT, CSV, and JSON

Text files store text. CSV represents rows and columns. JSON organizes values as objects, arrays, and other types and is common for data exchange. A format does not automatically provide a complete data-management system.

Browser local storage can retain information, but it normally belongs to the current browser and website origin. It does not automatically sync across devices and can be cleared.

In a familiar situation

An exported task JSON file can carry titles and completion states. It is useful for backup or transfer; simultaneous editing requires additional conflict handling.

Take this with you · When asking to save data, specify where, for how long, and who can access it.

FileCSVJSONlocalStorageData format
05.02

A system for organizing and querying

A database system organizes, queries, and updates data. In relational databases, a row is a record and a column is a field. Constraints can prevent certain invalid records from entering.

A database is not automatically faster, nor does it necessarily mean cloud storage. Files may suit a small project; growing query, concurrency, permission, and consistency needs can justify a dedicated system.

In a familiar situation

A task table might have id, title, done, and created_at. Update by stable ID so identical titles don't confuse two different records.

Take this with you · Sketch the fields and relationships before choosing a storage solution with AI.

DatabaseTableRowColumnID
05.03

Create, read, update, delete

CRUD names four common operations on data. Many interface features map to creating, reading, updating, or deleting records.

Completing a task usually updates done rather than deleting the task. Showing unfinished tasks usually filters a read rather than erasing completed records. Different operations have different consequences.

In a familiar situation

After you turn off an unfinished-only filter, completed tasks should reappear. If they were actually deleted, the implementation did the wrong thing.

Take this with you · Distinguish filtering, updating, and deleting in your requirements.

CRUDCreateReadUpdateDeleteFilter
Test the idea yourself

Your first little data table

Create, read, update, and delete rows. Turn on unfinished-only filtering to see why filtering is not deletion.

Try this · Add, filter, change completion, and delete. Each operation lights up a checkpoint.
CREATE READ UPDATE DELETE
idtitledoneAction
1Meet data
2Learn a concept

Stored: 2 · Visible: 2. Remove the filter to see retained records again.

This is an in-memory table for learning operations, not a connection to a database.

05.04

Tables and other ways to organize information

Relational databases emphasize tables, relationships, and constraints, commonly queried with SQL. NoSQL refers to a family of other models, including documents, key-value stores, and graphs, not just flexible documents.

Every model needs thoughtful data and query design. Flexibility doesn't remove rules, and a relational model doesn't mean putting everything into a single rigid table.

In a familiar situation

Users and tasks can be separate tables linked by user_id. One user can have many tasks, with ownership recorded explicitly.

Take this with you · Explain what data exists, how it relates, and how you usually query it before choosing a database.

SQLNoSQLRelationalDocument databaseKey-value
05.05

Indexes: faster lookup with a cost

An index maintains an auxiliary structure for certain lookups, like a book's index. It can reduce the records examined by some queries, but uses space and adds maintenance work during updates.

Indexing every field is not automatically best. Start with real queries, execution plans, and measurements. A simple scan may already be sufficient for a small dataset.

In a familiar situation

Frequent email lookups may benefit from an email index. For a ten-task list, correctness is more urgent than a distributed indexing system.

Take this with you · Measure performance rather than adding technology in response to a vague feeling of slowness.

IndexQueryExecution planPerformance
A new situation. What do you think?

You want completed tasks hidden now but available later. What should happen?

Choose an answer before reading the explanation.

Turn your knowledge into a useful brief

Describe your task fields, saving scope, and filtering behavior.

Think first, then uncover help as needed. Later chapters expect more complete descriptions and clearer checks.

1 A direction2 A framework3 An example prompt
Check your understanding against the project's real saving behavior.Use it in a project
Give your curiosity another turnGo further

Bring this chapter's context to your AI. Going deeper is optional; you can keep reading without it.

Explain tables, rows, fields, IDs, and CRUD using an address book.

One approach you can make your own
I'm learning computers and AI-assisted programming from scratch. In this chapter I learned:
Data:Distinguish files, browser storage, and databases;Describe features with fields, records, and CRUD;Understand the benefits and costs of an index

Explain tables, rows, fields, IDs, and CRUD using an address book.

Check my understanding first. Explain one small question at a time with a concrete example and the limits of any analogy. Ask a scenario question, then adapt to my answer. Distinguish facts, guesses, and uncertainty; suggest hands-on ways to check. Confirm the version before giving tool-specific advice, and don't invent features or references.

Complete this chapter

Mark the sections as read, finish the experiment, and pass the scenario check to record completion. You can visit the next chapter at any time.

0/5 sectionsTest a principleExplain a situation

Read the original references

This is an introduction. These official resources help you check details and explore further.

PostgreSQL · The SQL LanguageMDN · Web Storage API

One computer can handle many needs. What changes when the data and workload grow much larger?