June 2010
Intermediate to advanced
328 pages
7h 51m
English
Conceptually, an image is an attribute in a table. For example, the Accounts table may have a portrait_image column.
| Phantom-Files/anti/create-accounts.sql | |
| | CREATE TABLE Accounts ( |
| | account_id SERIAL PRIMARY KEY |
| | account_name VARCHAR(20), |
| | portrait_image BLOB |
| | ); |
Likewise, you can store multiple images of the same type in a dependent table. For example, a bug may have multiple screenshots that illustrate it.
| Phantom-Files/anti/create-screenshots.sql | |
| | CREATE TABLE Screenshots ( |
| | bug_id BIGINT UNSIGNED NOT NULL, |
| | image_id SERIAL NOT NULL, |
| | screenshot_image BLOB, |
| | caption VARCHAR(100), |
| | PRIMARY KEY (bug_id, image_id), |
| | FOREIGN KEY (bug_id) REFERENCES Bugs(bug_id) ... |
Read now
Unlock full access