Hi everybody,
Just started to learn the SQL and have a question about Exercise 5.
Have started the study drills section: Write a query to find all people younger than you. Do one that’s older.
I tried the following SELECT (with a little help from google):
SELECT * FROM person WHERE age > (SELECT age FROM person WHERE id = 0);
This works fine as the id is unique.
Problem is when i try this:
SELECT * FROM person WHERE age > (SELECT age FROM person WHERE last_name = “Example”);
Here is my database:
SELECT * From person;
0 Adam Example 33
1 Eva Example 33
2 Beta Example 3
3 Cyril Example 1
4 Damian Example 40
5 Adam Example 70
Not sure if that is a correct SELECT as more values can be matched.
It looks like the 1st match is used, but I want to be sure.
Thanks a lot.
Regards,
Jan