荷乐网下载手机App | 客服热线:0031(0)104133904
今天遇到一道题目   满是汗水   
求助强人!
要求是写SQL,
题目:Creat an over view of the name of the president, the name of his spouse, the age of his spouse at the time of their wedding and the number of children from that marriage, for those marriage in which on average one child was born no more than once every five years, counting from the wedding year until the year in which the spouse was 45.
万分感谢!

精彩评论7

FuckMaocui  初上贼船  2007-3-1 17:47:50 | 显示全部楼层 来自: 荷兰

回复: SQL强手进

麻烦死了 不会有人帮你都写出来的
Pierhere  中级海盗  2007-3-1 20:13:01 | 显示全部楼层 来自: 荷兰

回复: SQL强手进

那给点提示也好啊!
真的潜水员  中级海盗  2007-3-2 05:41:08 | 显示全部楼层 来自: 荷兰

回复: SQL强手进

Post by Pierhere;2036188
那给点提示也好啊!

不知道楼主解决了没.我先来凑凑热闹吧.很久没写SQL了,估计有很多错误,就勉强当是提示吧。

SELECT President.name as p_name, President.spouse_name as s_name, DATEDIFF(y, President.spouse_dob, President.marriage_year) as age_wedding, COUNT(Children.father_name)

FROM President, Children

WHERE Children.father_name = p_name AND (SELECT COUNT(Children.father_name) FROM Children) <= ROUND((45-President.marriage_year)/5)
Pierhere  中级海盗  2007-3-2 10:00:38 | 显示全部楼层 来自: 荷兰

回复: SQL强手进

Post by 真的潜水员;2036906
不知道楼主解决了没.我先来凑凑热闹吧.很久没写SQL了,估计有很多错误,就勉强当是提示吧。

SELECT President.name as p_name, President.spouse_name as s_name, DATEDIFF(y, President.spouse_dob, President.marriage_year) as age_wedding, COUNT(Children.father_name)

FROM President, Children

WHERE Children.father_name = p_name AND (SELECT COUNT(Children.father_name) FROM Children) <= ROUND((45-President.marriage_year)/5)

你太有才了!
舞皇  四海霸王  2007-3-3 21:51:03 | 显示全部楼层 来自: 荷兰

回复: SQL强手进

什么是SQL啊??
刺客  高级海盗  2007-3-5 09:15:30 | 显示全部楼层 来自: 荷兰

回复: SQL强手进

Structured Query Language
Pierhere  中级海盗  2007-3-5 11:11:36 | 显示全部楼层 来自: 荷兰

回复: SQL强手进

Post by 刺客;2042632
Structured Query Language
感谢你的回答!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表

关于此网站上的Cookie

我们使用 Cookie 来个性化和改善您在我们网站上的使用体验,了解您如何使用本网站和为您提供量身定制的广告或咨询。 如果您继续使用我们的网站,即代表您同意我们使用 Cookie政策。 请访问我们Cookie条款隐私条款,了解最新内容。

接受