Solution Development: Databases and Web Design
From the Computer Application Technology curriculum
TL;DR
You'll learn how databases store information efficiently and how web design uses this information to create interactive websites. We'll cover the basics of database structure and how web pages display data pulled from these databases. Understanding both helps you build powerful and dynamic online solutions.
1. The Mental Model
Think of a database as a super-organised digital filing cabinet where you store structured information. Web design is like building the front desk and display cases for that cabinet, letting people easily look up and interact with the information stored inside.
2. The Core Material
When you're developing solutions, databases and web design often go hand-in-hand. A database stores your project's data, and web design provides the interface for users to interact with that data.
Understanding Databases

Photo by Muhammed Ensar on Pexels
A database is an organised collection of data, stored and accessed electronically. For CAT, you'll likely work with relational databases, which store data in tables.
- Tables: Imagine a spreadsheet. Each table holds data about a specific entity (e.g., "Products," "Customers").
- Fields (Columns): These are the specific categories of information within a table (e.g., for a "Products" table:
ProductID,ProductName,Price). - Records (Rows): Each row in a table represents a single item or instance (e.g., one specific product with its ID, name, and price).
- Primary Key: A unique identifier for each record in a table (e.g.,
ProductIDensures each product has its own unique number). - Foreign Key: A field in one table that refers to the primary key in another table. This links tables together (e.g., a
CustomerIDin an "Orders" table links an order to a specific customer).
The most common language for interacting with relational databases is SQL (Structured Query Language). You use SQL to create, read, update, and delete data (often called CRUD operations).
Understanding Web Design

Photo by Tranmautritam on Pexels
Web design is about creating the visual and interactive parts of websites. It involves two main areas:
- Front-end Development: This is what users see and interact with in their browser. It uses:
- HTML (HyperText Markup Language): The structure and content of a web page (headings, paragraphs, images).
- CSS (Cascading Style Sheets): Controls the visual presentation (colors, fonts, layout).
- JavaScript: Adds interactivity (animations, form validation, dynamic content updates).
- Back-end Development: This is the server-side logic that handles requests from the front-end, interacts with the database, and sends data back. Languages like Python, PHP, or C# are common here. This is where your web application connects to the database.
Here’s a simplified flow of how a web application interacts with a database:
graph LR
A["User's Browser (Front-end)"] --> B["Web Server (Back-end)"];
B --> C["Database"];
C --> B;
B --> A;
subgraph Front-end
A;
end
subgraph Back-end
B;
end
subgraph Data Storage
C;
end
- User Request: You click a button on a web page (front-end).
- Server Processing: The request goes to the web server (back-end), which runs code to understand what you want.
- Database Query: If data is needed, the back-end sends a SQL query to the database.
- Data Retrieval: The database processes the query and sends the results back to the back-end.
- Response to User: The back-end formats the data (often into HTML) and sends it back to your browser, which displays it on the web page.
Connecting Web Pages to Databases

Photo by Brett Sayles on Pexels
This connection is crucial for dynamic websites. Imagine an online store:
- When you view a product page, the web server queries the database for that product's details (name, price, description, image URL).
- The server then generates an HTML page with this data and sends it to your browser.
- When you add an item to your cart, the server updates your cart details in the database.
3. Worked Example
Let's imagine you're building a simple web page to display a list of students from a database.
Database Setup (conceptual SQL):
-- Create a table for Students
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Grade INT
);
-- Insert some sample data
INSERT INTO Students (StudentID, FirstName, LastName, Grade) VALUES
(1, 'Alice', 'Smith', 10),
(2, 'Bob', 'Johnson', 11),
(3, 'Charlie', 'Brown', 10);
Web Design (simplified PHP for back-end, HTML for front-end):
Imagine a file named students.php on your web server.
```php
connect_error) { die("Connection failed: " . $conn->connect_error); } // 2. SQL Query to get all students $sql = "SELECT StudentID, FirstName, LastName, Grade FROM Students"; $result = $conn->query($sql); ?>Our Students
| ID | First Name | Last Name | Grade |
|---|---|---|---|
| " . $row["StudentID"] . " | "; echo "" . $row["FirstName"] . " | "; echo "" . $row["LastName"] . " | "; echo "" . $row["Grade"] . " | "; echo "
| No students found. | |||