I am using MySQL 8.0 Here's my table:
create table sampledata (
id int,
age int,
seeing int,
hearing int,
walking int,
PRIMARY KEY (id)
);
INSERT INTO `sampledata` VALUES (1,64,1,1,1),(2,63,2,2,1),(3,32,3,2,1),(4,39,4,2,1),(5,11,5,2,2),(6,3,NULL,NULL,NULL),(7,30,NULL,2,2),(8,7,2,2,2);
create table difficulty (
id int,
code int,
description varchar(50),
PRIMARY KEY (id)
);
INSERT INTO difficulty VALUES (1,1,'No, No Difficulty'),(2,2,'Yes, Some Difficulty'),(3,3,'Yes, A Lot of Difficulty'),(4,4,'Cannot do it at all');
Expected Output:
The description of each value from the seeing, hearing, walking column in sample data table will come from the difficulty table. However, there are some values that are not included in the difficulty table. "Out of Range" means that there is a value in sample data table but not in the difficulty table. "Valid Blank" means that difficulty table is NULL and age in sample data table is less than 5. "Invalid Blank" means that difficulty table is NULL and age in sample data table is 5 or more.
This is kinda tricky. I hope you can halp me with this.
