Skip to content
Getting Digital

Programming and Software Development

Databases and SQL

Almost every application keeps its state in a database, and many of the hardest bugs a developer meets trace back to how that data was modelled. This topic treats databases as a builder uses them: the relational model, SQL, schema design, indexes and transactions, and the document and key-value stores chosen when tables fit badly. Querying data for analysis is its neighbour in the data field.

Why this topic exists: The relational model, SQL, schema design and the document and key-value stores next to it: the layer every application and every analyst stands on (SFIA Database design; DP-900 relational concepts).

For a developer, the database is where an application's truth lives. Code can be redeployed in minutes; data written under a careless schema stays wrong until someone migrates it, often while the system is running. Database work in this sense means deciding how records are shaped and related, writing the queries that read and change them, keeping those queries fast as volumes grow, and making sure that operations which belong together either all happen or none do.

Three shapes of store

ModelData looks likeFits wellStrains when
Relational (PostgreSQL, MySQL, SQL Server)Tables of typed columns linked by keysRecords with relationships and rules that must always holdSchemas change on very large tables, or writes must spread across many machines
Document (MongoDB)Self-contained JSON-like documentsRecords read and written whole, with shapes that varyQueries cut across documents, and integrity rules move into application code
Key-valueOne value stored under each keySessions, counters and caching in front of a slower storeYou need to search by anything other than the key

Habits the schema remembers

  • Model the entities and the rules first, and let the database enforce them with keys, constraints and types rather than trusting every caller.
  • Normalise to remove duplicated facts, then denormalise only where a measured query needs it.
  • Add indexes for the queries you actually run, knowing that each one makes writes slightly dearer.
  • Wrap operations that must succeed together in a transaction.
  • Pass user input as query parameters, never by pasting it into the SQL string.
  • Keep schema changes as versioned migrations alongside the code.
  • Store files in object storage and keep only their references in the database.

SFIA separates two strands of this work. Database design is about specifying and maintaining the mechanisms that store and retrieve data; data modelling and design is about capturing what the data means and communicating it. Developers do both, often without naming them. Microsoft's DP-900 frames the ground from the data side: it asks candidates to describe normalisation, recognise common SQL statements and database objects, contrast relational with non-relational stores, and distinguish transactional workloads from analytical ones. Application developers live mostly on the transactional side. freeCodeCamp's Relational Databases certificate is a practical, free way to put SQL to work in a real terminal.

The mistake that shows up in almost every first project is the query inside a loop: fetch a list, then fetch the details for each item one at a time. An object-relational mapper makes this easy to write and hard to see, and it works perfectly until the list holds ten thousand rows. Learn to read the query plan and to ask for what you need in one round trip. The neighbouring topics are back-end development and APIs, SQL for analysis on the analyst's side, and cloud storage and databases for the managed versions.

Next to this topic

Concepts to know

Glossary entries with the reason each one matters here.

  • SQL

    The topic's language.

  • Caching

    What sits in front of a database under load.

  • Object Storage

    Where files live when they do not belong in a database.

Certifications that test it

Vendor exams and free certificates; facts, cost and the preparation path are on each page, and the certifications hub has them all.

Tools of the trade

  • SQL

    The relational query language.

  • PostgreSQL

    The open-source relational database of record.

  • MySQL

    The web's default database.

  • MongoDB

    The document database most developers meet first.

  • Microsoft SQL Server

    Microsoft's relational database.

Frequently asked

Should I learn SQL or a NoSQL database first?
SQL. The relational model teaches the ideas every other store is reacting to, from keys and constraints to transactions, and most applications and data teams still depend on it. Document and key-value stores make more sense once you know what they trade away.
PostgreSQL or MySQL?
Both are mature open-source relational databases and either is a sound place to learn. The SQL you write is largely portable between them; pick the one your stack or hosting already uses and learn its specific features later.
Do I still need SQL if I use an ORM?
Yes. The mapper writes queries for you, but when something is slow or wrong you have to read what it generated, and some queries are clearer written by hand. Developers who understand the SQL underneath use mappers far more safely.

Courses in the directory

1,053 courses are filed here; the top 6 by our ranking, details and the provider link on each course page.

Browse the directory shelf

Last reviewed 26 September 2026 · Getting Digital