<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Case study - 運動會報名表單, 多對多關聯</title>
<link>http://blog.roodo.com/rocksaying/archives/2606029.html/</link>
<description><![CDATA[
欲建立一個運動會報名表單，一位選手可報名參加一個以上的項目 (如100公尺、200公尺等) ，資料庫表格應如何設定？


我們通常不會在一個選手表格中建立多個比賽項目的關聯欄位，像 game1, game2, game3 這種欄位設置就不太適當。第一、如果多數選手只參與一個項目，則剩下的 game2, game3, etc. 欄位就閒置了，佔用磁碟空間。第二、限定了可參加比賽項目數的上限，如果我只定義到 game3 ，則一位選手最多只能參加 3 個比賽項目。第三、只能用複雜且僵化的查詢語句，例如 SELECT * FROM "Players"
INNER JOIN "Games" ON "Games".id = "Players".game1 OR "Games".id = "Players".game2 OR "Games".id = "Players".game3; ，欄位愈多則 OR 條件 串的愈長。當然，如果程式需求限定每位選手至少參加一個項目，最多參加 2 個，那麼用這種方法倒也無妨。
]]>
	</description>
<language>zh-tw</language>
<generator>Roodo Blog System</generator>
<copyright>All Rights Reserved</copyright>
<atom:link href="http://blog.roodo.com/rocksaying/archives/2606029-comment.xml" rel="self" type="application/rss+xml" />
<item>
	<title>回應：Case study - 運動會報名表單, 多對多關聯</title>
	<description><![CDATA[你好
上一次請教後，仍有不解，其中最後一段程式對照表 (array or map)，
1.是不是還有一些對資料庫的存取沒有列出?2.$playerOfGames;$gameWithPlayers代表什麼呢?
3.還有$row = $stmt->fetch()是用在那一種資料庫的語法呢?
最後謝謝你上一次的回答。]]>
	</description>
	<link>http://blog.roodo.com/rocksaying/archives/2606029.html</link>
	<guid>http://blog.roodo.com/rocksaying/archives/2606029.html#comment-17588581</guid>
	<author>t37@mail.jrjh.ptc.edu.tw(teacher)</author>	<category>文章回應</category>
	<pubDate>Sat, 04 Oct 2008 17:21:39 +0800</pubDate>
</item>
<item>
	<title>回應：Case study - 運動會報名表單, 多對多關聯</title>
	<description><![CDATA[1.除非特別說明，否則我只用 SQL 標準語法。(ANSI SQL Standard)。也就是說，各種SQL資料庫皆適用。但 MySQL 除外，它是SQL方言，我不保證能用。

2.如果 MySQL 對 SQL 標準的支援程度夠高，那就能用。你說書上沒介紹。我猜你指的是那些 PHP+MySQL 的書籍。那些書都不是 SQL 專門書籍，自然不會提到進階的SQL語法。

ps.我對 MySQL 有些偏見，我把它當成 "SQL方言" 看待。所以我在回答 SQL 相關事項時，通常會加上 "但不包括MySQL" 的但書。]]>
	</description>
	<link>http://blog.roodo.com/rocksaying/archives/2606029.html</link>
	<guid>http://blog.roodo.com/rocksaying/archives/2606029.html#comment-16312167</guid>
		<category>文章回應</category>
	<pubDate>Mon, 28 Apr 2008 16:45:51 +0800</pubDate>
</item>
<item>
	<title>回應：Case study - 運動會報名表單, 多對多關聯</title>
	<description><![CDATA[你好
一直想為學校用個運動會報名網路，但能力有限，看了你的文章覺得有點起頭，但有些不懂，
1.請問大大用的sql語法是用在什麼資料庫上的 ?
2.mysql可以加入關聯表格嗎?好像沒有什麼書介紹，
因為我只會用一點的MYSQL語法。
謝謝]]>
	</description>
	<link>http://blog.roodo.com/rocksaying/archives/2606029.html</link>
	<guid>http://blog.roodo.com/rocksaying/archives/2606029.html#comment-16294421</guid>
	<author>t37@mail.jrjh.ptc.edu.tw(teacher)</author>	<category>文章回應</category>
	<pubDate>Fri, 25 Apr 2008 18:21:16 +0800</pubDate>
</item>
</channel>
</rss>