# Creating a MySQL Database with phpMyAdmin

A database organises persistent information in related tables. This practice creates a small fictional database without prescribing an assessed design.

## Create the database

1. Start Apache and MySQL.
2. Open `http://localhost/phpmyadmin/`.
3. Select **Databases**.
4. Create `campready_db` with a Unicode collation such as `utf8mb4_unicode_ci`.

Use lowercase names and underscores. Avoid spaces and personal names.

## Create a practice table

Create `activities` with these columns:

| Column | Type | Settings | Purpose |
| --- | --- | --- | --- |
| `activity_id` | INT | PRIMARY KEY, AUTO_INCREMENT | Unique identifier |
| `activity_name` | VARCHAR(100) | NOT NULL | Activity label |
| `location` | VARCHAR(100) | NOT NULL | Fictional location |
| `capacity` | INT | NOT NULL | Maximum participants |

> This is practice only. Design assessment tables from the actual data, relationships and user needs.

## Add fictional rows

| activity_name | location | capacity |
| --- | --- | ---: |
| Navigation challenge | North field | 24 |
| Shelter setup | Camp zone A | 30 |
| Team cooking | Kitchen shelter | 20 |

Leave the identifier blank because AUTO_INCREMENT creates it.

The equivalent SQL is:

~~~sql
CREATE TABLE activities (
    activity_id INT AUTO_INCREMENT PRIMARY KEY,
    activity_name VARCHAR(100) NOT NULL,
    location VARCHAR(100) NOT NULL,
    capacity INT NOT NULL
);
~~~

## Design principles

- Give every table a primary key.
- Match data types to values.
- Use `NOT NULL` for essential values.
- Do not store several separate values in one field.
- Separate entities into related tables.
- Use fabricated classroom data only.

## Verification checklist

- [ ] The database and table exist.
- [ ] The table has an auto-incrementing primary key.
- [ ] Fields use suitable types.
- [ ] Three fictional rows appear in **Browse**.
- [ ] You can explain why each field exists.