简体   繁体   English

设计比赛/比赛数据库

[英]Designing tournament/matches database

I'm trying to design simple data base that will present some kind of tournament. 我正在尝试设计一些简单的数据库来呈现某种锦标赛。 So I have table that present 'Matches' (it contains two team's ID's), I've also created table 'Round' (one round contains few matches). 所以我有表格'匹配'(它包含两个团队的ID),我还创建了表'Round'(一轮包含几个匹配)。 And there's my question. 这是我的问题。 I want to create 'something' (table/view/procedure/function) that will make possible for me to show ranking of my tournament after given (via argument or using 'where' in select instruction) id of round. 我想创建'某事'(表/视图/程序/功能),这将使我能够在给定(通过参数或使用选择指令中的'where')id的圆形后显示我的锦标赛的排名。 For example, there are two teams, team A and team B. In first and second round team A won. 例如,有两支球队,A队和B队。在第一轮和第二轮A队获胜。 So after i pass via something number '1' I want to get output: 所以在我通过数字'1'之后我想得到输出:

Position | Team   | Points
:-----   | -----: | :----:
1        | Team A | 3
:-----   | -----: | :----:
2        | Team B | 0

What is the easiest way to achieve something like that ? 实现类似目标的最简单方法是什么?

I'm not fully sure I understand what the parameter you are passing in represents, but it sounds like you want to make a stored procedure. 我不完全确定我理解你传入的参数代表什么,但听起来你想要创建一个存储过程。 And yes you are correct you could use the parameter that is passed in, in your where clause. 是的,你是正确的,你可以在你的where子句中使用传入的参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM