Database design problems

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.