Skip to content

Guess Who?

Paste the text below in the sqllite_schema window in (hint: tap on the Toggle view button).
DROP TABLE IF EXISTS characters;
CREATE TABLE characters (
char_id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
top_colour TEXT,
bottom_colour TEXT,
wearing_jacket BOOLEAN,
wearing_hat BOOLEAN,
wearing_glasses BOOLEAN,
wearing_earrings BOOLEAN,
smiling BOOLEAN,
eyebrows_raised BOOLEAN,
hair_length TEXT,
hair_style TEXT
);
INSERT INTO characters VALUES
(1, 'Alex', 'blue', 'black', 1, 0, 1, 0, 1, 0, 'short', 'straight'),
(2, 'Blair', 'green', 'brown', 0, 1, 0, 1, 0, 1, 'long', 'curly'),
(3, 'Casey', 'yellow', 'black', 1, 0, 0, 0, 1, 1, 'medium', 'tied'),
(4, 'Devon', 'yellow', 'brown', 0, 0, 1, 0, 0, 0, 'short', 'curly'),
(5, 'Emery', 'green', 'grey', 1, 1, 0, 0, 1, 0, 'long', 'straight');

Tap on Toggle view again to entre the queries.

QUERIES

Are they wearing glasses? (replace ___ with 1 or 0)
Hint
1 is yes and 0 is no
SELECT * FROM characters
WHERE wearing_glasses = ___;
Are they smiling? (replace ___ with 1 or 0)
SELECT * FROM characters
WHERE smiling = ___;
Is their hair short? (replace ___ with curly, tied or straight)
SELECT * FROM characters
WHERE hair_style = ___;
Choose your own character with AND!
top_colour: replace ___ with blue, green or yellow wearing_jacket: replace ___ with 1 or 0 smiling: replace ___ with 1 or 0 hair_style: replace ___ with curly, tied or straight
SELECT * FROM characters
WHERE top_colour = '___'
AND wearing_jacket = ___
AND smiling = ___
AND hair_style = '___';
Choose your own character with OR!
wearing_jacket: replace ___ with 1 or 0 hair_length: replace ___ with long, medium or short
SELECT * FROM characters
WHERE wearing_jacket = ___
OR hair_length = '___';
Choose your own character with OR and AND!
wearing_hat: replace ___ with 1 or 0 wearing_glasses: replace ___ with 1 or 0 smiling: replace ___ with 1 or 0
SELECT * FROM characters
WHERE (wearing_hat = ___ OR wearing_glasses = ___)
AND smiling = ___;
Choose your own character!
Characteristics and features
top_colour = blue, green or yellow bottom_colour = black, brown or grey wearing_jacket = 0 or 1 wearing_hat = 0 or 1 wearing_glasses = 0 or 1 wearing_earrings = 0 or 1 smiling = 0 or 1 eyebrows_raised = 0 or 1 hair_length = long, medium or short hair_style = curly, straight or tied
SELECT * FROM characters
WHERE ___ = ___
OR ___ = '___';
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.