Web Development · Advanced level

Advanced level · Module 1 of 6 · 22 guided hours

Databases for Web Applications

Model data relationally, query it from Node.js safely, manage schema changes with migrations and protect data integrity.

Learning objectives

  • Design a relational schema for a web application
  • Query a database from Node.js with parameterised queries
  • Manage schema changes with migrations and keep data consistent

Topics

  • tables, keys and relationships
  • SQL for CRUD and reporting
  • PostgreSQL or SQLite from Node.js
  • parameterised queries
  • migrations
  • transactions and constraints

Lessons

  1. Lesson 1 Modelling Data for the Web

    Design tables, keys and relationships for a web application's data.

    entityone-to-many and many-to-manyprimary and foreign keysconstraints

  2. Lesson 2 Querying from Node.js Safely

    Connect to a database from Express and run parameterised queries for create, read, update and delete.

    database driverconnection poolparameterised querySQL injection

  3. Lesson 3 Migrations and Schema Changes

    Change the database schema safely over time with versioned migration scripts.

    migrationschema versionrollbackseed data

  4. Lesson 4 Transactions and Data Integrity

    Keep related changes consistent with transactions and handle concurrent bookings correctly.

    transactioncommit and rollbackunique constraintrace condition

Practical activity

Replace the training centre API's JSON file with a relational database: design the schema, write migrations and update every endpoint.

Expected outcomes

  • Persistent, consistent application data
  • Safe database access from the API

Assessment

Practical: implement a schema with migrations and three endpoints for a provided specification; marked by tests and an injection-safety review.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.