Repaso
Español
Databases & SQLFoundationsDB-56

Why do applications store important data in a database instead of only in program variables?

Options

  1. Variables are slower to write to than a database is
  2. Variables live in RAM and vanish at exit; a DB persists (Correct option)
  3. Databases are required by law for any kind of application
  4. Variables cannot store text values, only plain numbers

Answer

Variables live in memory (RAM) and disappear when the program stops or restarts; a database saves data on disk so it survives

Why

Memory (RAM) is fast but temporary. If the app restarts or the computer shuts down, everything in variables is gone.

A database writes data to disk, so it persists. That is called persistence.

Many apps combine both: memory or a cache (like Redis) for speed, a database for safety.

Remember

Memory is temporary. Databases persist data.

Key terms

Practice this question in Repaso