Match赛程表: MatchID 赛程id 主键
hostTeamId 主队ID
guestTeamId 客队ID
MatchResult 比赛结果 (值为2:0)
MatchTime 比赛时间
Team
TeamID 参赛队的id 主键
TeamName 参赛队的名字 (队名分别是:拜伦 、不来梅)
-------------------------------------------
Match表中的hostTeamId和guestTeamId与Team表中TeamID是有关联的 用sql语句查询2008-6-1 到2008-7-31的结果是
拜伦 2:0 不来梅 2008-6-23
hostTeamId 主队ID
guestTeamId 客队ID
MatchResult 比赛结果 (值为2:0)
MatchTime 比赛时间
Team
TeamID 参赛队的id 主键
TeamName 参赛队的名字 (队名分别是:拜伦 、不来梅)
-------------------------------------------
Match表中的hostTeamId和guestTeamId与Team表中TeamID是有关联的 用sql语句查询2008-6-1 到2008-7-31的结果是
拜伦 2:0 不来梅 2008-6-23
解决方案 »
- sqldeveloper运行时总提示 enter the full pathname for java.exe
- LINUX,ORACLE NLS_LANG 环境变量设置的疑问
- 请问 txt := N' < ' 是什么意思?
- Oracle数据库,如何完成定时发送短信,发送邮件?
- 逗号分隔字段取前三项
- oracle10g安装好后.做jdbc的驱动包怎么在本机上找到?
- 个hibernate查询ORCALE数据库的问题??
- 请教oracle中prompt关键字是什么意思?
- vb+oracle开发时必须在客户端装ORACLE吗?
- 询问一句SQL Server中的sql语句,如何转成Oracle能用
- 怎么把几个表的 colum 合成 到另一个表
- sqlldr when 语句中运算符的问题
from match m,team t1,team t2
where t1.teamid=m.teamid and t2.teamid=m.teamid
from match m,team t1,team t2
where t1.teamid=m.teamid and t2.teamid=m.teamid
and t1.matchtime between '2008-6-1' and '2008-6-23'
from match m,team t1,team t2
where t1.teamid=m.teamid and t2.teamid=m.teamid
and to_cahr(t1.matchtime,'yyyy-mm-dd')>'2008-6-1' and to_cahr(t1.matchtime,'yyyy-mm-dd')<'2008-6-23'
select t1.Teamname,m.MstchResult,t2.Teamname,Matchtime from match m,team t1,team t2
where t1.Teamname=m.hostTeamId
and t2.Teamname=m.guestTeamId
and MatchTime>'1-jun-09'
and MatchTime>'31-jul-09' ;
海量数据检索时不要用to_char等格式转换
where t1.Teamname=m.hostTeamId
and t2.Teamname=m.guestTeamId
and MatchTime>'01-jun-09'
and MatchTime<'31-jul-09' ;
select t1.teamname,matchresult,t2.teamname,matchtime
from match m,team t1,team t2
where t1.teamid=m.teamid and t2.teamid=m.teamid
and t1.matchtime between '2008-6-1' and '2008-7-31'
可以t1.matchtime between to_date('2008-6-1', 'yyyy-mm-dd') and to_date('2008-7-31', 'yyyy-mm-dd')
==================================================================
Inthirties关注Oracle数据库 维护 优化,安全,备份,恢复,迁移,故障处理 如果你需要帮助或想和我一起学习的请联系
联系方式QQ:370140387
QQ群: 85837884(注明:数据库)
电子邮件:[email protected]
网站: http://www.inthirties.com
select t1.teamname,matchresult,t2.teamname,matchtime
from match m,team t1,team t2
where t1.teamid=m.teamid and t2.teamid=m.teamid
and t1.matchtime between '2008-6-1' and '2008-6-23'