BUILD YOUR DATABASE THEN CONNECT IT

The names below are website roles, not compulsory SQL names. Use meaningful
names for your business and map them in settings.php. Use letters, numbers
and underscores in identifiers; start with a letter or underscore.

MAIN TABLE (website role: items)
id            Positive INT primary key, AUTO_INCREMENT.
title         VARCHAR(100), NOT NULL. Display name of the record.
description   TEXT, NOT NULL. The supplied form allows up to 2000 characters.
amount        DECIMAL(10,2), NULL permitted, zero or positive.
              Can mean price, fee, hire rate or another suitable number.
available     TINYINT, NOT NULL, use 1 or 0. Set a default if useful.
category_id   Positive INT, NOT NULL, foreign key to the first lookup table.
location_id   Positive INT, NOT NULL, foreign key to the second lookup table.

LOOKUP TABLE 1 (website role: categories)
id            Positive INT primary key, AUTO_INCREMENT.
name          VARCHAR(80), NOT NULL, UNIQUE recommended.

LOOKUP TABLE 2 (website role: locations)
id            Positive INT primary key, AUTO_INCREMENT.
name          VARCHAR(80), NOT NULL, UNIQUE recommended.

Use InnoDB and matching types for each primary/foreign-key pair. Match signed
or unsigned INT types consistently. Use utf8mb4 for text. Add the appropriate
constraints for your business. The supplied demo illustrates these choices.

INSERT ORDER
Create and populate the two lookup tables first, then the main table.
Use valid lookup IDs in the main table. The website joins those IDs to the
lookup tables and displays their readable names.

CONNECTION AND MAPPING
Change the connection in settings.php section C.
Change table and column names on the RIGHT side in section D.
Keep the keys on the LEFT unchanged. They link the engine to your schema.
For example, 'title' => 'book_title' means the website's title comes from your
book_title column. It does not rename the SQL column.
Change the words visitors see in section B separately.

LIMITS TO UNDERSTAND
The website manages records in the main table. Edit lookup records through
phpMyAdmin in these three lectures. Admin pages for lookup tables are an
extension, not included functionality.
Additional required columns without defaults cannot be saved by the supplied
form until the form and save logic are extended. Many-to-many relationships
and workflows involving extra tables need extra queries and forms.
An ID alone does not make a design normalised. Explain your business rules
and functional dependencies when designing the database.

MINIMUM CHECKPOINT
Two main records can share one category or location. Change that lookup name
once in phpMyAdmin and refresh the website. Both records should show the new
name. Explain why this is useful and which foreign key links the records.
