Database design problem application scenario description:
The data table structure is as follows:
The minimum age of the name must be
Record 1, 3, 18, 19
Record 2 Li Si 19 15
Now, find that your age is greater than the minimum age set by the other party. In addition, the recipient's age is greater than the minimum age set by the user. How to write SQL statements? In this way, how can I design a data table to implement functions?
Reply to discussion (solution)
To add this question, Zhang San is 18 years old and wants to find people older than 19. Li Si is 19 years old and wants to find people older than 15.
There are many such records in the database. Records that match each other must be listed.
Oh, it's actually very easy. I got to the point. Suddenly I had an epiphany.
Select * from Table a, Table B where a. Your age> = B. the minimum age of the other party and a. the minimum age of the other party is required> = B. your age