Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Mysql 的新手,我需要帮助从 horse table 中找到 10 岁以上的马匹,其中仅包含“Born”和“Died”列,例如 Born (1986) Died (1998) )。
纯种马被认为是在其出生年份的 1 月 1 日出生的。所以你只需要简单的减法就可以得到正确的答案。
select horse_name from horses where born < (year(current_date) - 10) and died is null;
如果您真的想找到 10 岁或以上的马,请将运算符从“<”更改为“<=”。