<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2928978240024428405</id><updated>2024-09-13T15:18:42.817+08:00</updated><category term="C#"/><category term="zerojudge"/><category term=".NET"/><category term="c"/><category term="SQL"/><category term="Javascript"/><category term="Android"/><category term="正則運算式"/><category term="程式設計"/><category term="雜七雜八"/><category term="C++"/><category term="XML"/><category term="jQuery"/><category term="影像處理"/><category term="資訊安全"/><category term="Eclipse"/><category term="HTML5"/><category term="IE"/><category term="OOP"/><category term="RS232"/><category term="Sivlerlight"/><category term="window form"/><category term="相容性"/><title type='text'>Ryan&#39;s Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>116</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-4317788556972032579</id><published>2015-03-06T17:22:00.001+08:00</published><updated>2015-03-06T17:22:24.573+08:00</updated><title type='text'>Sublime Text 2 遠端資料夾設定與中文化教學</title><content type='html'>&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
官方載點：&lt;a href=&quot;http://www.sublimetext.com/2&quot;&gt;點我前往&lt;/a&gt;。&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
中文化載點：&lt;a href=&quot;https://docs.google.com/file/d/0B6aGCLNl-aVIejEwTE8xV1Q5dEk/edit?usp=sharing&quot;&gt;點我下載&lt;/a&gt;。&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
【中文化】：&lt;br /&gt;&lt;br /&gt;把 &quot;Sublime Text 2.0.2_cht.zip&quot; 解壓縮覆蓋 [...\Packages\Default] 裡即可。&lt;br /&gt;&lt;br /&gt;C:\Users\使用者名稱\AppData\Roaming\Sublime Text 2\Packages\Default&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;【安裝FTP/SFTP 遠端檔案同步】&lt;br /&gt;&lt;br /&gt;(1).匯入&lt;a href=&quot;https://sublime.wbond.net/installation#st2&quot;&gt;Package Control&lt;/a&gt;&lt;div&gt;
*ctrl + ` 輸入網址裡文字&lt;div&gt;
&lt;br /&gt;(2).利用 &lt;a href=&quot;https://sublime.wbond.net/installation#st2&quot;&gt;Package Control&lt;/a&gt; 安裝 &lt;a href=&quot;https://sublime.wbond.net/packages/SFTP&quot;&gt;SFTP&lt;/a&gt; 套件包&lt;/div&gt;
&lt;div&gt;
*ctrl+ Shift + P, 輸入SFTP&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;(3) 設定FTP/SFTP&lt;br /&gt;對專案/folder按下右鍵，選擇 SFTP/FTP 底下的 Map to Remote，此專案資料夾下會自動加入sftp-config.json 檔案&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;(4) 設定 sftp-config.json&lt;br /&gt;&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
done,隨機應變嘍.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/4317788556972032579/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2015/03/sublime-text-2.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/4317788556972032579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/4317788556972032579'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2015/03/sublime-text-2.html' title='Sublime Text 2 遠端資料夾設定與中文化教學'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-5616672511353855721</id><published>2015-03-06T15:04:00.002+08:00</published><updated>2015-03-06T17:07:24.680+08:00</updated><title type='text'>[VirtualBox]  OS Copy 及重建</title><content type='html'>&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
當 VDI 檔的 UUID 因重覆而不能在 VirtualBox 註冊使用時，&lt;br /&gt;
&lt;br /&gt;
需更改 VDI 檔的 UUID；可搭配 VirtualBox 管理工具使用以下指令達成。&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 12.6999998092651px; line-height: 19.0499992370605px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;code&gt;VBoxManage internalcommands setvdiuuid &lt;file_name&gt;.vdi &lt;/file_name&gt;&lt;/code&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/5616672511353855721/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2015/03/virtualbox-os-copy.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/5616672511353855721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/5616672511353855721'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2015/03/virtualbox-os-copy.html' title='[VirtualBox]  OS Copy 及重建'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-8309050678227861156</id><published>2012-09-19T15:47:00.000+08:00</published><updated>2012-09-20T21:37:25.714+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><title type='text'>[android] 固定螢幕方向</title><content type='html'>&lt;br /&gt;
再android手機裡要固定螢幕方向,可以在AndroidManifest.xml設定&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&lt;code&gt;&amp;lt;activity android:label=&quot;@string/app_name&quot;&amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;android:name=&quot;.MinesweeperGame&quot;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;android:screenorientation=&quot;portrait&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;lt;/activity&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;
&lt;/span&gt;&lt;/code&gt; &lt;br /&gt;
其中&lt;a href=&quot;http://developer.android.com/guide/topics/manifest/activity-element.html#screen&quot; style=&quot;background-color: white; color: #006699; font-family: &#39;Trebuchet MS&#39;, Trebuchet, Verdana, sans-serif; font-size: 13px;&quot;&gt;android:screenOrientation&lt;/a&gt;所代表的意義是&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&quot;unspecified&quot;&lt;br /&gt;
- 默認值. 由系統選擇顯示方向. 在不同的設備可能會有所不同.&lt;br /&gt;
&lt;br /&gt;
&quot;landscape&quot;&lt;br /&gt;
- 橫向&lt;br /&gt;
&lt;br /&gt;
&quot;portrait&quot;&lt;br /&gt;
- 縱向&lt;br /&gt;
&lt;br /&gt;
&quot;user&quot;&lt;br /&gt;
- 用戶當前的首選方向&lt;br /&gt;
&lt;br /&gt;
&quot;behind&quot;&lt;br /&gt;
- 與在活動堆棧下的活動相同方向&lt;br /&gt;
&lt;br /&gt;
&quot;sensor&quot;&lt;br /&gt;
- 根據物理方向傳感器確定方向. 取決於用戶手持的方向, 當用戶轉動設備, 它跟隨改變.&lt;br /&gt;
&lt;br /&gt;
&quot;nosensor&quot;&lt;br /&gt;
- 不經物理方向傳感器確定方向. 該傳感器被忽略, 所以當用戶轉動設備, 顯示不會跟隨改變. 除了這個區別，系統選擇使用相同的政策取向對於“未指定”設置. 系統根據“未指定”(&quot;unspecified&quot;)設定選擇相同顯示方向.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/8309050678227861156/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/09/android.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/8309050678227861156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/8309050678227861156'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/09/android.html' title='[android] 固定螢幕方向'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-4959575455962715370</id><published>2012-07-15T01:00:00.003+08:00</published><updated>2012-07-15T01:33:49.064+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><title type='text'>[Android] Android SDK 手機應用程式開發教學</title><content type='html'>剛翻以前收錄的文章找到,內容寫的滿詳細的,&lt;br /&gt;
寫過點android程式再回頭讀也滿適合的,&lt;br /&gt;
每天睡前看一講應該會比較好睡齁~!!&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
作者: VVll (信) 看板: GameDesign&lt;br /&gt;
標題: [程式] Android SDK 手機應用程式開發教學&lt;br /&gt;
時間: Tue May  1 10:53:01 2012&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
本篇僅提供有心學習但不了解資源在哪的人方便&lt;br /&gt;
對此內容有任何疑問 建議直接跟原作者聯繫 謝謝&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
轉載至 Android 教學 | 孫傳雄談科技&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/&quot;&gt;http://blog.chinatimes.com/tomsun/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Android SDK 手機應用程式開發教學網路講義懶人包&lt;br /&gt;
( 適用 Android 4.0 SDK , Android 3.2 SDK , Android 3.1 SDK ,&lt;br /&gt;
Android 3.0 SDK , Android 2.3 SDK , Android 2.2 SDK , Android 2.1 SDK )&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2007/11/03/213763.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2007/11/03/213763.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
以下列示 [ 孫傳雄研究室 ] 目前已經在網路上發表的 Android&lt;br /&gt;
課程講義集各章節網址連結。以茲大家方便連結閱讀。&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 1 ：  什麼是 Android 智慧型手機 ？&lt;br /&gt;
(此篇課程講義於2010年08月30日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/08/30/533364.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/08/30/533364.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 2 ：  Andoird 的系統架構說明&lt;br /&gt;
(此篇課程講義於2010年08月31日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/08/31/533666.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/08/31/533666.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 3 ：  Android 的商業模式&lt;br /&gt;
(此篇課程講義於2010年09月02日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/09/02/534485.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/09/02/534485.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 4 ：  Android SDK 下載安裝教學&lt;br /&gt;
(此篇課程講義於2010年09月07日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/09/07/536320.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/09/07/536320.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 5 ：  Android 專案建置 &amp;amp; Android 模擬器安裝&lt;br /&gt;
(此篇課程講義於2010年09月16日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/09/16/539502.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/09/16/539502.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 6 ：  Android UI 介面設計基礎篇&lt;br /&gt;
(此篇課程講義於2010年10月05日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/10/05/545355.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/10/05/545355.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 7 -1：Android 程式設計基礎上篇&lt;br /&gt;
(此篇課程講義於2010年10月30日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/10/30/555014.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/10/30/555014.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 7 -2：Android 程式設計基礎下篇&lt;br /&gt;
(此篇課程講義於2010年11月09日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/11/09/560824.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/11/09/560824.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 補充教材 1：Android 2.3 SDK 升級教學&lt;br /&gt;
(此篇課程講義於2010年12月14日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/12/14/580311.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/12/14/580311.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 補充教材 2：Android 2.3 介面設計教學&lt;br /&gt;
(此篇課程講義於2010年12月24日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2010/12/24/585281.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2010/12/24/585281.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 補充資訊 1：Android 3.0平板電腦完整功能搶先看&lt;br /&gt;
(此篇補充資訊於2011年1月6日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/01/06/593107.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/01/06/593107.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 3 平板電腦課程教學 1 ：Android 3.0 Preview SDK 下載安裝升級教學&lt;br /&gt;
(此篇平板電腦講義於2011年2月2日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/02/02/604869.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/02/02/604869.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 補充資訊 2 ：Android 3.0 SDK 正式版，開放下載安裝！&lt;br /&gt;
(此篇補充資訊於2011年2月23日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/02/23/612995.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/02/23/612995.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 補充資訊 3 ：Android 嵌入式系統最新開發應用 - SAAB IQon 車用電腦&lt;br /&gt;
(此篇補充資訊於2011年3月2日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/03/02/617501.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/03/02/617501.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 補充教材 3 ：如何解決 main.xml 介面檔案的 LinearLayout 根節點無法刪除的問題 ？&lt;br /&gt;
(此篇課程講義於2011年3月4日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/03/04/619241.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/03/04/619241.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 3 平板電腦課程教學 2 ：Android 相容性套件下載安裝教學&lt;br /&gt;
(此篇平板電腦講義於2011年3月8日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/03/08/621087.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/03/08/621087.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 8 - 1：Application Components 與 Intent 上篇&lt;br /&gt;
(此篇課程講義於2011年3月22日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/03/22/630351.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/03/22/630351.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 8 - 2 - 1：Application Components 與 Intent 中篇之一&lt;br /&gt;
(此篇課程講義於2011年4月28日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/04/28/665149.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/04/28/665149.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 3 平板電腦課程教學 3 ： Android ADK 開發板簡介&lt;br /&gt;
(此篇課程講義於2011年5月26日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/05/26/694673.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/05/26/694673.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 課程教學 補充資訊 4：Android 4.0 SDK 開發功能介紹與下載網址&lt;br /&gt;
(此篇補充資訊於2011年10月19日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/10/19/1005653.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/10/19/1005653.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 4 課程教學 1：Android 4.0 SDK 下載安裝中文教學課程講義（新！）&lt;br /&gt;
(此篇課程講義於2011年11月08日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/11/08/1029787.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/11/08/1029787.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 4 課程教學 2：Android 4.0 模擬器安裝設定教學課程講義（新！）&lt;br /&gt;
(此篇課程講義於2011年11月24日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2011/11/24/1054452.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2011/11/24/1054452.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Android 4 課程教學 3：Holo 佈景主題 ( Theme )（新！）&lt;br /&gt;
(此篇課程講義於2012年4月5日網路發表)&lt;br /&gt;
&lt;a href=&quot;http://blog.chinatimes.com/tomsun/archive/2012/04/05/2121346.html&quot;&gt;http://blog.chinatimes.com/tomsun/archive/2012/04/05/2121346.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
※ 發信站: 批踢踢實業坊(ptt.cc)</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/4959575455962715370/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/07/android-android-sdk.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/4959575455962715370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/4959575455962715370'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/07/android-android-sdk.html' title='[Android] Android SDK 手機應用程式開發教學'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-2230948024850405272</id><published>2012-07-14T01:00:00.001+08:00</published><updated>2012-07-14T03:51:01.744+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><title type='text'>[Eclipse] 開啟現有專案</title><content type='html'>剛下載一個別人的專案來研究,才想到我們上次很無腦的用開新專案的方式來建立新的現有專案....&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
我們回到 Eclipse 環境來。在螢幕上方的選單列上，選擇「File &gt; New &gt; Project...」，會彈出精靈選擇視窗（Select a Wizard），在精靈選擇視窗中可以選擇要開啟新專案還是開啟現有專案。&lt;br /&gt;
&lt;br /&gt;
在精靈選擇視窗（Select a Wizard）中，從中選擇「Android Project from Existing Code」（透過現成程式碼建立Android專案），會彈出「 Import Projects」視窗。&lt;br /&gt;
&lt;br /&gt;
在「Import Projects」對話視窗中，點選「Browse...」按鈕以選擇要開啟的專案。我們在此選擇位於「android_sdk/samples/android-x/」目錄中的 「ApiDemos」應用程式專案 (android_sdk/samples/android-x/ ApiDemos)。 「x」代表目標版本號。&lt;br /&gt;
&lt;br /&gt;
當我們選擇了現存的範例程式專案時，對話視窗中會自動找到對應的專案內容。這時我們就可以按下 「Finish」按鈕，完成從現存專案新增專案進「Eclipse」開發環境的動作。</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/2230948024850405272/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/07/eclipse.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2230948024850405272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2230948024850405272'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/07/eclipse.html' title='[Eclipse] 開啟現有專案'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-2957782051537680342</id><published>2012-03-29T16:41:00.000+08:00</published><updated>2012-03-29T16:43:16.193+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><title type='text'>[.NET]西元轉民國</title><content type='html'>&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;本來想偷懶的找網路有沒有現成的函式可以用&lt;/span&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;可是頂多只有&lt;/span&gt; &lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;改變格式而已&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;如&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;: 2012/11/23 &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Wingdings;&quot;&gt;à&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt; 12/11/23&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Tahoma, sans-serif; font-size: 9pt; letter-spacing: 0.85pt;&quot;&gt;Format(Ａ,&quot;yy/MM/dd&quot;)&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; letter-spacing: 0.85pt;&quot;&gt;傳回&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Tahoma, sans-serif; font-size: 9pt; letter-spacing: 0.85pt;&quot;&gt;&amp;nbsp; 12/11/23&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Tahoma, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12px; letter-spacing: 1px;&quot;&gt;Ａ=&quot;2012/11/23 上午10:00&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Tahoma, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12px; letter-spacing: 1px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;不知道大家有沒有發現我月份部分是用大寫&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;原因是他變數以及大小寫在函式內部就已經定義好了&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;小寫的&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;mm &lt;/span&gt;&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;代表的是秒 ，所以一開始我傳回來的值一直都是 12/00/23&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;….&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;我也花了一點時間才發現這個錯誤&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
---------------------------------------------------&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
再來有在MSDN上找到有個新類別叫&lt;/div&gt;
&lt;h1 class=&quot;title&quot;&gt;

Calendar&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
命名空間 的System.Globalization 中，有 TaiwanCalendar 類別&lt;br /&gt;
可惜他是.NET FrameWork 4 才有的新方法&lt;br /&gt;
我的程式不支援&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
所以只好自己來設計了 (殘念)&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
---------------------------------------------------
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;&#39;&#39;&#39; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;&#39;&#39; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: 新細明體, serif; font-size: 9.5pt;&quot;&gt;西&lt;/span&gt;&lt;span style=&quot;color: green; font-family: 新細明體, serif; font-size: 9.5pt;&quot;&gt;元&lt;/span&gt;&lt;span style=&quot;color: green; font-family: 新細明體, serif; font-size: 9.5pt;&quot;&gt;年&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: green; font-family: MingLiU; font-size: 9.5pt;&quot;&gt;~&lt;/span&gt;&lt;span style=&quot;color: green; font-family: 新細明體, serif; font-size: 9.5pt;&quot;&gt;轉&lt;/span&gt;&lt;span style=&quot;color: green; font-family: 新細明體, serif; font-size: 9.5pt;&quot;&gt;成&lt;/span&gt;&lt;span style=&quot;color: green; font-family: 新細明體, serif; font-size: 9.5pt;&quot;&gt;民&lt;/span&gt;&lt;span style=&quot;color: green; font-family: 新細明體, serif; font-size: 9.5pt;&quot;&gt;國&lt;/span&gt;&lt;span style=&quot;color: green; font-family: 新細明體, serif; font-size: 9.5pt;&quot;&gt;年&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;color: green; font-family: MingLiU; font-size: 9.5pt;&quot;&gt;~(ex:2010/01/01--&amp;gt;99/01/01)&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;&#39;&#39; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;&#39;&#39; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;param
name=&quot;p_strYear&quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;&#39;&#39; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;&#39;&#39; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt;
YearTransfer(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; p_strYear &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt;) &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; strTemplist() &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt; = Split(p_strYear, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;/&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; strResult &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Try&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;strResult = Val(strTemplist(0)) - 1911 &amp;amp; &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;/&quot;&lt;/span&gt;
&amp;amp; strTemplist(1) &amp;amp; &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;/&quot;&lt;/span&gt;
&amp;amp; strTemplist(2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Catch&lt;/span&gt; ex &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Exception&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
strResult = ex.Message&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Try&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Return&lt;/span&gt; strResult&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: MingLiU; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
---------------------------------------------------
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
基本上就如上圖程式碼所示，我也不贅述了&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;參考網址：&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;http://zhidao.baidu.com/question/135388675.html?push=related&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: 新細明體, serif;&quot;&gt;參考網址：&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;http://msdn.microsoft.com/zh-tw/library/system.globalization.calendar.aspx&lt;/span&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot;&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/2957782051537680342/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/03/net.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2957782051537680342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2957782051537680342'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/03/net.html' title='[.NET]西元轉民國'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-7903052356955904801</id><published>2012-03-13T17:30:00.001+08:00</published><updated>2012-03-13T23:11:04.770+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>[JS] javascript 常用function整理 (一) 使用window.open發出POST</title><content type='html'>&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
function openWindowWithPost(url, name, keys, values) {&lt;br /&gt;
var newWindow = window.open(url, name);&lt;br /&gt;
if (!newWindow) return false;&lt;br /&gt;
var html = &quot;&quot;;&lt;br /&gt;
html += &quot;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;form id=&#39;formid&#39; method=&#39;post&#39; action=&#39;&quot; + url + &quot;&#39;&amp;gt;&lt;br /&gt;
&quot;;&lt;br /&gt;
if (keys &amp;amp;&amp;amp; values &amp;amp;&amp;amp; (keys.length == values.length))&lt;br /&gt;
for (var i = 0; i &amp;lt; keys.length; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; html += &quot;&amp;lt;input type=&#39;hidden&#39; name=&#39;&quot; + keys[i] + &quot;&#39; value=&#39;&quot; + values[i] + &quot;&#39;/&amp;gt;&quot;;&lt;br /&gt;
html += &quot;&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#39;text/javascript&#39;&amp;gt;document.getElementById(\&quot;formid\&quot;).submit()&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot;;&lt;br /&gt;
newWindow.document.write(html);&lt;br /&gt;
return newWindow;&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/7903052356955904801/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/03/js-javascript-function-windowopenpost.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/7903052356955904801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/7903052356955904801'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/03/js-javascript-function-windowopenpost.html' title='[JS] javascript 常用function整理 (一) 使用window.open發出POST'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-1443124846876677898</id><published>2012-03-06T13:00:00.001+08:00</published><updated>2012-03-07T14:09:53.512+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Sivlerlight"/><title type='text'>[silverlight] vs2010 設計器加載失敗</title><content type='html'>System.NullReferenceException&lt;br /&gt;
並未將物件參考設定為物件的執行個體。&lt;br /&gt;
&lt;br /&gt;
原本vs2010都可以正常開啟silverlight專案,&lt;br /&gt;
但在一不小心安裝了一個莫名版本的silverlight後...竟然出現了這個問題!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
經過silverlight重灌了好幾次和Google大神的幫忙,終於解決了這個問題!!&lt;br /&gt;
&lt;br /&gt;
原來主要的原因是Vs版本的錯亂&lt;br /&gt;
&lt;br /&gt;
請先移除&lt;br /&gt;
&lt;br /&gt;
1.Sivlerlight&lt;br /&gt;
&lt;br /&gt;
2.Sivlerlight SDK&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
然後再安裝&lt;br /&gt;
&lt;br /&gt;
Microsoft® Silverlight™ X Tools&lt;br /&gt;
&lt;br /&gt;
即可!!</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/1443124846876677898/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/03/silverlight-systemnullreferenceexceptio.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/1443124846876677898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/1443124846876677898'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/03/silverlight-systemnullreferenceexceptio.html' title='[silverlight] vs2010 設計器加載失敗'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-2307003777427552968</id><published>2012-03-01T16:19:00.003+08:00</published><updated>2012-03-29T16:44:30.437+08:00</updated><title type='text'>最後一哩</title><content type='html'>&lt;br /&gt;
簡單解釋一下這個名詞&lt;br /&gt;
在電信業內是用來形容網路接到客戶前的最後一站&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
可以引伸為架設的成本問題&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
因為最近公司遇到要重新架設網路，在查詢資訊之後發現市面上主要分成兩種&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.對稱式寬頻&lt;br /&gt;
企業很多都使用這種方式，其優點在於保證頻寬&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.光纖及ADSL式寬頻&lt;br /&gt;
由於最後一里(成本)的問題&lt;br /&gt;
主要是採在某一地點設置機房，附近區域的用戶全部連接至此機房&lt;br /&gt;
頻寬是共享的，所以才會常常在熱門的時間覺得網路速度變慢的情況發生&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
底下附上我的參考網址&lt;br /&gt;
http://zh.wikipedia.org/wiki/%E6%9C%80%E5%BE%8C%E4%B8%80%E5%93%A9&lt;br /&gt;
－－－－－－－－－－－－－</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/2307003777427552968/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/03/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2307003777427552968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2307003777427552968'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/03/blog-post.html' title='最後一哩'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-3097354099213056613</id><published>2012-02-23T18:09:00.000+08:00</published><updated>2012-02-23T18:09:18.604+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>[SQL] 搜尋萬用字元</title><content type='html'>&lt;br /&gt;
萬用字元&lt;br /&gt;
&lt;br /&gt;
解法一&lt;br /&gt;
SELECT * FROM table&lt;br /&gt;
WHERE (prod LIKE &#39;&#39;%!_%&#39;&#39; ESCAPE &#39;&#39;!&#39;&#39;)&lt;br /&gt;
&lt;br /&gt;
！這符號可以隨便你訂&lt;br /&gt;
ESCAPE 子句所指定字元（即！）後的那一個字元（此處為底線_）會被視為是常數字元，而非萬用字元&lt;br /&gt;
&lt;br /&gt;
解法二&lt;br /&gt;
SELECT * FROM table&lt;br /&gt;
WHERE&amp;nbsp;prod like &#39;%[_]%&#39;&lt;br /&gt;
&lt;br /&gt;
用中括弧把你要的東西括進去，就可以把它當字串來比對了&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
以上</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/3097354099213056613/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql_23.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/3097354099213056613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/3097354099213056613'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql_23.html' title='[SQL] 搜尋萬用字元'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-7181389286808798274</id><published>2012-02-20T21:23:00.000+08:00</published><updated>2012-02-20T21:23:16.954+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>[SQL] 找出資料庫內的PK欄位</title><content type='html'>&lt;br /&gt;
&lt;b&gt;Step1&lt;/b&gt;.首先可以先找出此資料庫內所有的table名稱&lt;br /&gt;
&lt;br /&gt;
Select&amp;nbsp; TABLE &amp;nbsp;from 
INFORMATION_SCHEMA.TABLES &amp;nbsp;order by&amp;nbsp; TABLE&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step2.&lt;/b&gt;接著可選擇顯示特定table的詳細欄位&lt;br /&gt;
&lt;br /&gt;
Select &amp;nbsp;* &amp;nbsp;&amp;nbsp;from&amp;nbsp;INFORMATION_SCHEMA.COLUMNS where TABLE = &#39;Tabletest&#39;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step3.重點在於紅色的部分&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Select&amp;nbsp;&amp;nbsp;COLUMN_NAME&amp;nbsp;&amp;nbsp;from&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;INFORMATION_SCHEMA.KEY_COLUMN_USAGE&lt;/span&gt;&lt;/b&gt; where&amp;nbsp;&lt;br /&gt;
TABLE&amp;nbsp;&amp;nbsp;= &#39;
Tabletest&amp;nbsp;&#39;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
當然順序部分可以再調整,這篇主要是在說呼叫PK欄位的mysql語法&lt;br /&gt;
改天有空我會再試試看T-SQL之類的SQL語法,相信應該是大同小異的 XD&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/7181389286808798274/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-pk.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/7181389286808798274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/7181389286808798274'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-pk.html' title='[SQL] 找出資料庫內的PK欄位'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-6975782150938196919</id><published>2012-02-17T13:27:00.000+08:00</published><updated>2012-02-17T13:27:29.367+08:00</updated><title type='text'>[小工具]語法轉換</title><content type='html'>推薦大家一個網站&lt;br /&gt;
想當初我看到的時候可是驚為天人呢!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://codeconverter.sharpdevelop.net/SnippetConverter.aspx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
這個轉換程式的網頁還沒有寫的非常聰明&lt;br /&gt;
但是大致上是沒有錯的&lt;br /&gt;
只要轉換完之後再順一下看看小地方有沒有錯就可以囉^^&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/6975782150938196919/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/6975782150938196919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/6975782150938196919'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/blog-post.html' title='[小工具]語法轉換'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-1633864171301880908</id><published>2012-02-14T22:23:00.000+08:00</published><updated>2012-02-14T22:34:20.059+08:00</updated><title type='text'>[SQL] SQL指令</title><content type='html'>&lt;br /&gt;
大家在下SQL的時候是不是常常忘記語法呢&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
以下這個網站是我常去的,例子都寫的蠻清楚的,希望會對大家有幫助囉&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.java2s.com/Code/SQLServer/CatalogSQLServer.htm</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/1633864171301880908/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-sql.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/1633864171301880908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/1633864171301880908'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-sql.html' title='[SQL] SQL指令'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-8638580137243594092</id><published>2012-02-11T11:08:00.000+08:00</published><updated>2012-02-11T11:09:44.264+08:00</updated><title type='text'>[小工具] 搜尋字串 search &amp; replace</title><content type='html'>在寫程式的時候，常常會遇到需要搜尋關鍵字的狀況&lt;br /&gt;
尤其是維護舊程式時！！&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
而有的時候內建的 ctrl+F 只能在同專案或同方案底下搜尋&lt;br /&gt;
要整個資料夾搜尋檔案的內容做不太到&lt;br /&gt;
&lt;br /&gt;
我在這邊要推薦一個搜尋軟體 search&amp;amp; replace !&lt;br /&gt;
&lt;a href=&quot;http://por.tw/f2blog/rewrite.php/read-592.html&quot;&gt;http://por.tw/f2blog/rewrite.php/read-592.html&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
只要你指定好要搜尋的資料夾，他可以連檔案內容都幫你掃描&lt;br /&gt;
讓你知道這個關鍵字在哪個檔案內有出現&lt;br /&gt;
這樣在debug或理解別人的程式到底在幹麻有很大的幫助&lt;br /&gt;
&lt;br /&gt;
P.S. 有加密的檔案沒辦法搜尋到內容，這是可惜的地方</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/8638580137243594092/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/search-replace.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/8638580137243594092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/8638580137243594092'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/search-replace.html' title='[小工具] 搜尋字串 search &amp; replace'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-2888774229037203450</id><published>2012-02-08T01:00:00.000+08:00</published><updated>2012-02-08T01:00:10.412+08:00</updated><title type='text'>[網路基礎知識] Hub Bridge Switch Router</title><content type='html'>最近常常被問到什麼是Hub Bridge Switch Router,他們之間有什麼差別...&lt;br /&gt;
每次當下都解釋的不是很清楚,所以就趁現在把它個別寫出來~希望下次就可以記住了 XD&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #382a11; font-family: tahoma, verdana, &#39;&amp;amp;#32048; font-size: 12px; margin-bottom: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;1.Hub(集線器)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #382a11; font-family: tahoma, verdana, &#39;&amp;amp;#32048; font-size: 12px; margin-bottom: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;在星狀拓樸網路(star topology)中，扮演連接或重新建立訊號的角色，可擴大類比或者是數位訊號。在區域網路(LAN)中，電腦與電腦利用網路連接時，如果用Hub 連接，即使有任何一段線路出問題，只會有一台電腦無法運作，不會影響網路中其他電腦的作業。&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;在接收封包(Packet)進來之後，會將這個封包送到其它所有的電腦(即廣播，每一台電腦都會收到該封包)，不管誰才是應該收到該封包的電腦。&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;2.Bridge(橋接器)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;Bridge是一個用來連接不同的網路區段(segment)的設備，例如﹐可以用一個 bridge 來連接兩個 Ethernet&amp;nbsp;segment、或連接一個 Token Ring segment 到一個 Ethernet segment。其主要功能在於決定是否讓資料訊框(Frame)通過Bridge 到另一端網路上，當Bridge 接收到訊框後，會將訊框目的地的MAC 位址與Bridge 的table 做比對，如果table 中能找到符合的位址，則進一步確認封包與目的地電腦是否為同一區段網路，若是的話，目的地電腦不需透過Bridge 就能收到資料(發揮filter功能)；如果不是的話，Bridge 就會把訊框傳至目的地的電腦所在區段網路(發揮forward功能)。&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;P.S：&lt;span style=&quot;color: blue;&quot;&gt;雖然Bridge被用來分割網路，但是它們並不會隔離廣播或多點傳播的封包。&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;3.Switch(交換器)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;Switch 的作用是在區域網路中，將網路作連接的動作。Switch 有一個table，記錄著每一台電腦的MAC 位址，當封包進來之後，Switch 會去檢查該封包的目的地的是哪一個MAC 位址的電腦，只將這個封包送給該台電腦，其他電腦則不會收到封包。&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;Switch的傳輸方式&lt;br /&gt;
(1). Cut Through：接收到目的地址後即轉發出去。延時小，但壞的資料一樣轉發。&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;(2). Store-and-Forward：接收到完整的資料包後，校驗好壞，好的轉發，壞的丟棄重發。傳輸可靠，但延時較長。&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;(3). Fragment free：接收到資料包後，大於64bytes的轉發，小於64bytes的丟棄。好壞介於上述兩種方式之間。&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;4.Router(路由器)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;路由器是用來將網路的資訊, 使用在電腦之間傳送的基本設備, 路由器的工作在於 OSI 模式第三層(網路層),用來決定資料傳遞路徑的設備. 我們使用的IP協定就是藉由路由器將不同的IP位址連接在一起. 網路上的資料分成一段一段的封包packet, 而這些封包要指向何處便是由路由器來決定的, 路由器會根據資料的目的地, 指示正確的方向, 計算評估最便捷有效率的路徑來傳輸資料, 也就是說路由器要為封包做最佳化的工作, 找出最適當的路徑. 路由器通常最少會有兩個介面, 而這兩個介面分別區隔不同的IP網段. 例如IP分享器有WAN和LAN兩種介面, 區隔WAN的實際IP與LAN的虛擬IP網段.&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;Router 與Bridge 的另一個不同點在於：&lt;/div&gt;&lt;div style=&quot;color: #382a11;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Bridge 只是單純做為一個決定是否讓封包通過的橋樑，Router 則會執行選徑功能(OSPF,EIGRP,...etc.)。&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/2888774229037203450/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/hub-bridge-switch-router.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2888774229037203450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2888774229037203450'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/hub-bridge-switch-router.html' title='[網路基礎知識] Hub Bridge Switch Router'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-2225082056276332782</id><published>2012-02-07T16:25:00.000+08:00</published><updated>2012-02-07T17:14:13.236+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>[SQL] 備份資料庫</title><content type='html'>在這邊提供一個我常用的SCRIPT&lt;br /&gt;
&lt;div&gt;
只要執行這個SQL就可以自動整個資料庫備份至指定資料夾&lt;/div&gt;
&lt;div&gt;
而不用使用SQL Management 來設定&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
以下為程式碼&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
DECLARE @backupTime VARCHAR(20) &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
DECLARE @sqlCommand NVARCHAR(1000) &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
--設定檔名的執行時間.例如以下的@backupTime將會是201202071156(yyyyMMddHHmm) &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
--此值可以視需求進行調整,如果是每小時備份,就只要2012020711(yyyyMMddHH) &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
--SELECT @backupTime=(CONVERT(VARCHAR(8), GETDATE(), 112)+REPLACE(CONVERT(VARCHAR(5), GETDATE(), 114), &#39;:&#39;, &#39;&#39;)) &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
SELECT @backupTime=(CONVERT(VARCHAR(8), GETDATE(), 112)) &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
--設定LYTDB資料庫的備份命令 &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
--可視需要修改備份檔存放的位置 &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
SET @sqlCommand = &#39;BACKUP DATABASE YOYO123 TO DISK=&#39;&#39;C:\Data20120207_2Back\YOYO123&#39;+@backupTime+&#39;.bak&#39;&#39;&#39; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
EXECUTE sp_executesql @sqlCommand&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
--------------------------------------------------------------------------------------------------&lt;br /&gt;
而當你要使用剛剛備份的檔案還原時&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMx5XiMw1U2RTkZ5DGC8wpuLN5nDq67apVJUw35tLyia33SBoYhG2KTmeVWapVpdgf6Qa9HNBzFW3rBsVbUvLWDKM7oy6NpZ7XNkmCqETTzJPDqI5uspGRAIAbHAtF2AMbpa-Y_B93ZgmB/s1600/snap048.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;218&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMx5XiMw1U2RTkZ5DGC8wpuLN5nDq67apVJUw35tLyia33SBoYhG2KTmeVWapVpdgf6Qa9HNBzFW3rBsVbUvLWDKM7oy6NpZ7XNkmCqETTzJPDqI5uspGRAIAbHAtF2AMbpa-Y_B93ZgmB/s320/snap048.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwcU8PXZMUybHox4JOBmxh0lytQou4YNeIcR7WPps6o0aBPRpO3N7u6QC1d1J01qlnoUAZBR2k1-_pF3GrCTM61Lx3p7a-ZC-6nH9soUkGRw4YO4NbwgsupUVJBHUO3S9lXBR_hNvNENB0/s1600/snap049.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwcU8PXZMUybHox4JOBmxh0lytQou4YNeIcR7WPps6o0aBPRpO3N7u6QC1d1J01qlnoUAZBR2k1-_pF3GrCTM61Lx3p7a-ZC-6nH9soUkGRw4YO4NbwgsupUVJBHUO3S9lXBR_hNvNENB0/s320/snap049.jpg&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
依照上圖的路徑選擇即可&lt;br /&gt;
&lt;br /&gt;
P.S 當你選擇好路徑之後，最後請記得在左邊　&quot;選項&quot; -&amp;gt; &quot;覆寫原本資料庫&quot;&lt;br /&gt;
&lt;br /&gt;
這樣就完成囉~^^&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
以上&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/2225082056276332782/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql_07.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2225082056276332782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/2225082056276332782'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql_07.html' title='[SQL] 備份資料庫'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMx5XiMw1U2RTkZ5DGC8wpuLN5nDq67apVJUw35tLyia33SBoYhG2KTmeVWapVpdgf6Qa9HNBzFW3rBsVbUvLWDKM7oy6NpZ7XNkmCqETTzJPDqI5uspGRAIAbHAtF2AMbpa-Y_B93ZgmB/s72-c/snap048.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-5151030547282993218</id><published>2012-02-06T16:00:00.002+08:00</published><updated>2012-02-06T16:00:06.243+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>[SQL] 第三正規化 (3NF)</title><content type='html'>第三正規化（3NF，中國大陸譯作第三范式，台灣譯作第三正规化）是資料庫正規化中所使用的一種正規形式，用來檢驗是否所有非鍵屬性都只和候選鍵有相關性，也就是說所有非鍵屬性互相之間應該是無關的。&lt;br /&gt;
第三正規化和第二正規化不同的地方在於，在第三正規化裡，所有的非鍵屬性都必須和每個候選鍵有直接相關。如果再對第三正規化做進一步加強就成了BC正規化，它所強調的重點就在於 &quot;資料間的關係是奠基在鍵上、以整個鍵為考量、而且除了鍵之外不考慮其他因素&quot;。&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;以下面這個定義機械元件的關係為例：&lt;/div&gt;&lt;table align=&quot;center&quot; border=&quot;0&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px;&quot;&gt;&lt;caption&gt;機械元件&lt;/caption&gt;&lt;tbody&gt;
&lt;tr style=&quot;background-color: silver; text-align: left; vertical-align: top;&quot;&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;元件編號&lt;br /&gt;
(主鍵)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;製造商名稱&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;製造商位址&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1000&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Toyota&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Park Avenue&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1001&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Mitsubishi&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Lincoln Street&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1002&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Toyota&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Park Avenue&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;本例中製造商位址很明顯地不該被列在這個關係裡面，因為和元件本身比起來，製造商位址應該和製造商比較有關係；正確的做法應該是把獨立成為一個新的資料表：&lt;/div&gt;&lt;table align=&quot;center&quot; border=&quot;0&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px;&quot;&gt;&lt;caption&gt;製造商&lt;/caption&gt;&lt;tbody&gt;
&lt;tr style=&quot;background-color: silver; text-align: left; vertical-align: top;&quot;&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;製造商名稱&lt;br /&gt;
(主鍵)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;製造商位址&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Toyota&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Park Avenue&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Mitsubishi&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Lincoln Street&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;然後把原本的資料表改成這樣：&lt;/div&gt;&lt;table align=&quot;center&quot; border=&quot;0&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; style=&quot; border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px;&quot;&gt;&lt;caption&gt;機械元件&lt;/caption&gt;&lt;tbody&gt;
&lt;tr style=&quot;background-color: silver; text-align: left; vertical-align: top;&quot;&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;元件編號&lt;br /&gt;
(主鍵)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;製造商名稱&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1000&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Toyota&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1001&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Mitsubishi&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1002&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Toyota&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;先前那個資料表的問題在於每提到一次製造商名稱就要多存一次它的位址，而這就不符合第三正規化的原則。&lt;/div&gt;&lt;div style=&quot; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;下面提供了另一個例子：&lt;/div&gt;&lt;table align=&quot;center&quot; border=&quot;0&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px;&quot;&gt;&lt;caption&gt;訂單 (Order)&lt;/caption&gt;&lt;tbody&gt;
&lt;tr style=&quot;background-color: silver; text-align: left; vertical-align: top;&quot;&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;訂單編號 (Order Number)&lt;br /&gt;
(主鍵)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;客戶名稱 (Customer Name)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;單價 (Unit Price)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;數量 (Quantity)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;小計 (Total)&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1000&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;David&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$35.00&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$105.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1001&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Jim&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$25.00&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$50.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1002&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Bob&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$25.00&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$75.00&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;在本例中，非主鍵欄位完全依賴於主鍵訂單編號,也就是說唯一的訂單編號能導出唯一非主鍵欄位值，符合第二正規化。第三正規化要求非主鍵欄位之間不能有依賴關系，顯然本例中小計依賴於非主鍵欄位單價和數量，不符合第三正規化。小計不應該放在這個資料表裡面，只要把單價乘上數量就可以得到小計了；如果想要符合第三正規化的話，就把小計拿掉吧 (不過在做查詢的時候，本來用 &quot;SELECT Orders.Total FROM Order&quot; 就要改成用 &quot;SELECT UnitPrice * Quantity FROM Order&quot; 了)。&lt;/div&gt;&lt;table align=&quot;center&quot; border=&quot;0&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; style=&quot; border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px;&quot;&gt;&lt;caption&gt;訂單 (Order)&lt;/caption&gt;&lt;tbody&gt;
&lt;tr style=&quot;background-color: silver; text-align: left; vertical-align: top;&quot;&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;訂單編號 (Order Number)&lt;br /&gt;
(主鍵)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;客戶名稱 (Customer Name)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;單價 (Unit Price)&lt;/th&gt;&lt;th style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;數量 (Quantity)&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1000&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;David&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$35.00&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1001&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Jim&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$25.00&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;1002&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;Bob&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;$25.00&lt;/td&gt;&lt;td style=&quot;border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: black; border-left-style: solid; border-left-width: 1px; border-right-color: black; border-right-style: solid; border-right-width: 1px; border-top-color: black; border-top-style: solid; border-top-width: 1px;&quot;&gt;3&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/5151030547282993218/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-3nf.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/5151030547282993218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/5151030547282993218'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-3nf.html' title='[SQL] 第三正規化 (3NF)'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-7334966647686195633</id><published>2012-02-06T16:00:00.001+08:00</published><updated>2012-02-06T16:00:00.939+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>[SQL] 第二正規化 (2NF)</title><content type='html'>第二正規化（2NF，中國大陸譯作第二范式，台灣譯作第二正规化）是資料庫正規化中所使用的一種正規形式。它的規則是要求資料表裡的所有資料都要和該資料表的主鍵有完全相依關係；如果有哪些資料只和主鍵的一部份有關的話，就得把它們獨立出來變成另一個資料表。如果一個資料表的主鍵只有單一一個欄位的話，它就一定符合第二正規化。&lt;br /&gt;
&lt;br /&gt;
一個資料表符合第二正規化若且唯若&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;它符合第一正規化&lt;/li&gt;
&lt;li&gt;所有非主鍵的欄位都一定和主鍵有關&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;有一個資料表記錄了設備元件的資訊，如下所示：&lt;/div&gt;&lt;table class=&quot;wikitable&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 1em; margin-left: 0px; margin-right: 1em; margin-top: 1em;&quot;&gt;&lt;caption style=&quot;font-weight: bold;&quot;&gt;元件來源&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;元件 ID (主鍵)&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;供應商 ID (主鍵)&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;供應商名稱&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;價格&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;供應商住址&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;65&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Stylized Parts&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;59.99&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;VA&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;73&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Stylized Parts&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;20.00&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;VA&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;65&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;ACME Industries&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;69.99&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;CA&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;這個資料表的每個值都是單一值，所以它符合第一正規化。因為同一個元件有可能由不同的供應商提供，所以得把元件 ID 和供應商 ID 合在一起組成一個主鍵。&lt;/div&gt;&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;主鍵和價格之間的關係很正確：同一個元件在不同供應商有可能會有不同的報價，所以價格確實和主鍵完全相關(完全依賴)。&lt;/div&gt;&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;另一方面，供應商的名稱和住址就只和供應商 ID 有關(部分依賴)，這不符合第二正規化的原則。仔細看就會發現 &quot;Stylized Parts&quot; 這個名稱和 &quot;VA&quot; 這個住址重複出現了兩次；要是它改名了或是被其他公司併購了怎麼辦？這時候最好把這些資料存到第二個資料表中：&lt;/div&gt;&lt;table class=&quot;wikitable&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 1em; margin-left: 0px; margin-right: 1em; margin-top: 1em;&quot;&gt;&lt;caption style=&quot;font-weight: bold;&quot;&gt;供應商&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;供應商 ID (主鍵)&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;名稱&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;住址&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;ACME Industries&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;CA&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Stylized Parts&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;VA&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;這麼一來，原本的 &quot;元件來源&quot; 資料表就得要做相對應的更動：&lt;/div&gt;&lt;table class=&quot;wikitable&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 1em; margin-left: 0px; margin-right: 1em; margin-top: 1em;&quot;&gt;&lt;caption style=&quot;font-weight: bold;&quot;&gt;元件來源&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;元件 ID (主鍵)&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;供應商 ID (主鍵)&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;價格&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;65&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;59.99&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;73&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;20.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;65&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;69.99&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;檢查資料表裡的每個欄位，確認它們是不是都和主鍵完全相關，這樣才能知道這個資料表是不是符合第二正規化；如果不是的話，就把那些不完全相關的欄位移到獨立的資料表裡。接下來的步驟是要確保所有不是鍵的欄位都和彼此沒有相依關係，這就叫做第三正規化。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/7334966647686195633/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-2nf.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/7334966647686195633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/7334966647686195633'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-2nf.html' title='[SQL] 第二正規化 (2NF)'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-33338283104539904</id><published>2012-02-06T16:00:00.000+08:00</published><updated>2012-02-06T16:00:17.360+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>[SQL] 第一正規化 (1NF)</title><content type='html'>第一正規化（1NF，中國大陸譯作第一范式，台灣譯做第一正規化）是資料庫正規化中所使用的一種正規形式。第一正規化是為了要排除 &lt;b&gt;重複群&lt;/b&gt; 的出現，所採用的方法是要求資料庫的每個欄位都只能存放單一值，而且每筆記錄都要能利用一個惟一的主鍵來加以識別。&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: initial; font-family: sans-serif; font-size: 19px; line-height: 22px; margin-bottom: 0.3em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: hidden; overflow-y: hidden; padding-bottom: 0.17em; padding-top: 0.5em; width: auto;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;.E9.87.8D.E8.A4.87.E7.BE.A4&quot;&gt;重複群&lt;/span&gt;&lt;/h3&gt;重複群通常會出現在會計帳上，每一筆記錄可能有不定個數的值。舉例來說：&lt;br /&gt;
&lt;table class=&quot;wikitable&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 1em; margin-left: 0px; margin-right: 1em; margin-top: 1em;&quot;&gt;&lt;caption style=&quot;font-weight: bold;&quot;&gt;交易&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial;  background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;顧客&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;日期&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;數量&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Monday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;19.00&lt;br /&gt;
&lt;div style=&quot;line-height: 1.5em; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;-28.20&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Wednesday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;-84.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Sarah&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Friday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;100.00&lt;br /&gt;
&lt;div style=&quot;line-height: 1.5em; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;150.00&lt;/div&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;-40.00&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;&#39;數量&#39; 就是所謂的重複群了，而在這種情況下這份資料就不符合第一正規化。想要消除重複群的話，只要把每筆記錄都轉化為單一記錄即可：&lt;/div&gt;&lt;table class=&quot;wikitable&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 1em; margin-left: 0px; margin-right: 1em; margin-top: 1em;&quot;&gt;&lt;caption style=&quot;font-weight: bold;&quot;&gt;交易&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial;  background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;&lt;u&gt;交易 ID&lt;/u&gt;&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial;  background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;顧客&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial;  background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;日期&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial;  background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;數量&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Monday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;19.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Monday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;-28.20&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Wednesday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;-84.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;4&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Sarah&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Friday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;100.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;5&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Sarah&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Friday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;150.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;6&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Sarah&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Friday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;-40.00&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;h3 style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: initial; font-family: sans-serif; font-size: 19px; line-height: 22px; margin-bottom: 0.3em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: hidden; overflow-y: hidden; padding-bottom: 0.17em; padding-top: 0.5em; width: auto;&quot;&gt;&lt;span class=&quot;editsection&quot; style=&quot;float: right; font-size: 15px; font-weight: normal; margin-left: 1em;&quot;&gt;[&lt;a href=&quot;http://zh.wikipedia.org/w/index.php?title=%E7%AC%AC%E4%B8%80%E6%AD%A3%E8%A6%8F%E5%8C%96&amp;amp;action=edit&amp;amp;section=3&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #0b0080; text-decoration: none;&quot; title=&quot;编辑段落：缺乏唯一識別碼&quot;&gt;编辑&lt;/a&gt;]&lt;/span&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;.E7.BC.BA.E4.B9.8F.E5.94.AF.E4.B8.80.E8.AD.98.E5.88.A5.E7.A2.BC&quot;&gt;缺乏唯一識別碼&lt;/span&gt;&lt;/h3&gt;&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;一樣是在交易這個例子中，同一天同一個人買了同樣的數量，這樣的交易做了兩次：&lt;/div&gt;&lt;table class=&quot;wikitable&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 1em; margin-left: 0px; margin-right: 1em; margin-top: 1em;&quot;&gt;&lt;caption style=&quot;font-weight: bold;&quot;&gt;交易&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial;  background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;顧客&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;日期&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;數量&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Monday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;19.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Monday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;19.00&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 0.5em; margin-top: 0.4em;&quot;&gt;如上所示，這兩筆交易可以說是一模一樣，也就是說如果只靠這些資料我們沒有辦法分辨這兩筆記錄。我們之所以說它不符合第一正規化，是因為上面這樣的表示法欠缺一個唯一識別碼，可以是一個欄位，也可以是一組欄位，而且可以保證在這個資料中唯一識別碼不會重複出現。要將它正規化到符合第一正規化的原則只需要加入一個唯一識別碼即可：&lt;/div&gt;&lt;table class=&quot;wikitable&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; color: black; font-family: sans-serif; font-size: 15px; line-height: 22px; margin-bottom: 1em; margin-left: 0px; margin-right: 1em; margin-top: 1em;&quot;&gt;&lt;caption style=&quot;font-weight: bold;&quot;&gt;交易&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial;  background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;&lt;u&gt;交易 ID&lt;/u&gt;&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;顧客&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;日期&lt;/th&gt;&lt;th style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;&quot;&gt;數量&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Monday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;19.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Pete&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;Monday&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;&quot;&gt;19.00&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/33338283104539904/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-1nf.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/33338283104539904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/33338283104539904'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-1nf.html' title='[SQL] 第一正規化 (1NF)'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-1638612379686636761</id><published>2012-02-04T15:43:00.000+08:00</published><updated>2012-02-07T17:14:32.517+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>[SQL] .BAT的應用</title><content type='html'>&lt;br /&gt;
副檔名是bat的文件就是批次處理文件。&lt;br /&gt;
簡單的說，批次處理的作用就是自動的連續執行多條指令。&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
以下提供的例子是利用.bat來一次執行多個SQL檔案&lt;br /&gt;
[執行.bat的資料夾]&lt;br /&gt;
所有要用批次跑的程式要放在同一個資料夾中&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJjkqbt4uCBjgIY30rqGgp4lmK8uiAp7WoB1hfHL9PMI582YD28CTc5p1qSN47KODLF1YgaBtYm_hGC9ghdMPz5b58rZzYApGQDk4qnfnZiFOveRuxFpnEQjDnjhmQXLsv9oBr2UpCS4Tw/s1600/snap046.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;206&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJjkqbt4uCBjgIY30rqGgp4lmK8uiAp7WoB1hfHL9PMI582YD28CTc5p1qSN47KODLF1YgaBtYm_hGC9ghdMPz5b58rZzYApGQDk4qnfnZiFOveRuxFpnEQjDnjhmQXLsv9oBr2UpCS4Tw/s400/snap046.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[.bat內容]&lt;br /&gt;
set sqlcmdpara=-U sa -P password -S severname&lt;br /&gt;
set scriptpath=C:\Users\ck18\Desktop\QueryItem整理Scripts\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type01.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type02.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type03.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type04.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type05.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type06.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type07.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type08.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type09.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type10.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type11.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type12.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type13.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type14.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type15.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type16.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type17.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type18.sql&lt;br /&gt;
&lt;br /&gt;
pause&lt;br /&gt;
&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type001.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type002.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type003.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type004.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type005.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type006.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type007.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type008.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type009.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type010.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type011.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type012.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type013.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type014.sql&lt;br /&gt;
sqlcmd %sqlcmdpara% -d CkmainInsurance -i %scriptpath%Type015.sql&lt;br /&gt;
&lt;br /&gt;
pause&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
在最上面的時候可以先設定路徑以及連結字串,不然下面每一條都要打一次很麻煩&lt;br /&gt;
基本上來說,只要路徑有指對,批次執行時就不會有甚麼問題了&lt;br /&gt;
而我之所以加了PAUSE,是為了看執行的結果,不加也沒關係&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
以上&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/1638612379686636761/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-bat.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/1638612379686636761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/1638612379686636761'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql-bat.html' title='[SQL] .BAT的應用'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJjkqbt4uCBjgIY30rqGgp4lmK8uiAp7WoB1hfHL9PMI582YD28CTc5p1qSN47KODLF1YgaBtYm_hGC9ghdMPz5b58rZzYApGQDk4qnfnZiFOveRuxFpnEQjDnjhmQXLsv9oBr2UpCS4Tw/s72-c/snap046.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-6541108620702101483</id><published>2012-02-01T17:09:00.000+08:00</published><updated>2012-02-07T17:14:43.459+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>[SQL] 暫存資料表的應用</title><content type='html'>&lt;br /&gt;
狀況：TABLE中會儲存各式各樣的資料，當你想要針對兩個TABLE中的某些特定資料來做GROUP BY或DISTINCT時&lt;br /&gt;
就會需要用到暫存TABLE了&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
如何使用暫存TABLE來做比對及運算&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.CREAT TABLE #temptablename (a int ,b int)&lt;br /&gt;
2.或是說可以利用SELECT式，把搜尋來的東西　into #temptablename ，這樣也可以做到如上面的動作&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
例如&lt;br /&gt;
&lt;br /&gt;
select * into #a from AllProductsname&lt;br /&gt;
where inscompanyidname like &#39;777%&#39;&lt;br /&gt;
&lt;br /&gt;
select * into #b &amp;nbsp;from AllProductsname&lt;br /&gt;
where inscompanyidname like &#39;888%&#39;&lt;br /&gt;
&lt;br /&gt;
select distinct #a.HTML_N 香港的,#b.HTML_N 中國的,#a.ID,#b.ID from #a&lt;br /&gt;
inner join #b on #a.prodmodelname = #b.prodmodelname&lt;br /&gt;
where #a.HTML_N=#b.HTML_N&lt;br /&gt;
&lt;br /&gt;
drop table #a&lt;br /&gt;
drop table #b&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
最後記得把暫存資料表drop掉，不然會一直佔住效能&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
以上</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/6541108620702101483/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/6541108620702101483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/6541108620702101483'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/02/sql.html' title='[SQL] 暫存資料表的應用'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-8839586718896430714</id><published>2012-01-30T17:38:00.001+08:00</published><updated>2012-02-02T14:33:17.731+08:00</updated><title type='text'>[.NET] 連接資料庫字串</title><content type='html'>&lt;br /&gt;
狀況：我們在撰寫程式時常常會需要用到資料庫,而我最常碰到的問題就是遇連接的目標資料庫驗證方式是否有設定密碼,常常要上網查&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
以下提供兩種連接字串給大家參考&lt;br /&gt;
&lt;br /&gt;
１.資料庫驗證方式設定為windows驗證&lt;br /&gt;
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;&lt;br /&gt;
&lt;br /&gt;
２.資料庫驗證方式設定密碼&lt;br /&gt;
Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=administrator;Password=Password&quot;&lt;br /&gt;
&lt;br /&gt;
另外補充一個網站，裡面有各式各樣的連接字串，提供給大家參考&lt;br /&gt;
http://www.connectionstrings.com/&lt;br /&gt;
以上&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/8839586718896430714/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/01/net.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/8839586718896430714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/8839586718896430714'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/01/net.html' title='[.NET] 連接資料庫字串'/><author><name>光</name><uri>http://www.blogger.com/profile/08887297346603268623</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-3790456370966889255</id><published>2012-01-29T01:00:00.004+08:00</published><updated>2012-01-29T01:00:00.285+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>[C#] 取得 Mac And IP</title><content type='html'>&lt;br /&gt;&lt;br /&gt;
寫Web常常需要抓IP,但MAC就比較少遇到了&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
網路卡號碼(MAC)&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Management;&lt;br /&gt;
&lt;br /&gt;
public class MyClass&lt;br /&gt;
{&lt;br /&gt;
public static void Main()&lt;br /&gt;
{&lt;br /&gt;
ManagementObjectSearcher query = new ManagementObjectSearcher(&quot;SELECT * FROM Win32_NetworkAdapterConfiguration&quot;);&lt;br /&gt;
ManagementObjectCollection queryMAC = query.Get();&lt;br /&gt;
foreach (ManagementObject mac in queryMAC)&lt;br /&gt;
{&lt;br /&gt;
if (mac[&quot;IPEnabled&quot;].ToString() == &quot;True&quot;)&lt;br /&gt;
Console.WriteLine(mac[&quot;MacAddress&quot;].ToString());&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
本機IP&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Net;&lt;br /&gt;
&lt;br /&gt;
public class MyClass&lt;br /&gt;
{&lt;br /&gt;
public static void Main()&lt;br /&gt;
{&lt;br /&gt;
IPHostEntry HostEntry = Dns.Resolve(Dns.GetHostName());&lt;br /&gt;
foreach (IPAddress ip in HostEntry.AddressList)&lt;br /&gt;
Console.WriteLine(ip.ToString());&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
ps. 如果找不到System.Management 去.NET元件找出來加入參考就好~!</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/3790456370966889255/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/01/c-mac-and-ip.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/3790456370966889255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/3790456370966889255'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/01/c-mac-and-ip.html' title='[C#] 取得 Mac And IP'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-5455200653706483838</id><published>2012-01-27T11:00:00.000+08:00</published><updated>2012-01-27T11:00:01.141+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>[C#] 網頁截圖</title><content type='html'>很簡單,幾行程式碼就可以搞定~!&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Image myImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);&lt;br /&gt;
Graphics g = Graphics.FromImage(myImage);&lt;br /&gt;
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)); &lt;br /&gt;
IntPtr dc1 = g.GetHdc();&lt;br /&gt;
g.ReleaseHdc(dc1);&lt;br /&gt;
myImage.Save(&quot;c:\\test.jpeg&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/5455200653706483838/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/01/c_27.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/5455200653706483838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/5455200653706483838'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/01/c_27.html' title='[C#] 網頁截圖'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2928978240024428405.post-4436561891947769867</id><published>2012-01-22T01:00:00.001+08:00</published><updated>2012-01-22T01:00:03.732+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>[C#] 取得網路上的圖片</title><content type='html'>&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
private System.Drawing.Image GetImageFromURL(string strUrl)&lt;br /&gt;
{&lt;br /&gt;
    System.Drawing.Image MyImage = null;&lt;br /&gt;
&lt;br /&gt;
    try&lt;br /&gt;
    {&lt;br /&gt;
        //建立一個 Web Request&lt;br /&gt;
        WebRequest MyRequest = WebRequest.Create(strUrl);&lt;br /&gt;
        //由 Web Request 取得 Web Response&lt;br /&gt;
        WebResponse MyResponse = MyRequest.GetResponse();&lt;br /&gt;
        //由 Web Response 取得 Stream&lt;br /&gt;
        Stream MyStream = MyResponse.GetResponseStream();&lt;br /&gt;
        //由 Stream 取得 Image&lt;br /&gt;
        MyImage = System.Drawing.Image.FromStream(MyStream);&lt;br /&gt;
&lt;br /&gt;
        //該關的關一關, 該放的放一放&lt;br /&gt;
        MyStream.Close();&lt;br /&gt;
        MyStream.Dispose();&lt;br /&gt;
        MyResponse.Close();&lt;br /&gt;
        MyResponse = null;&lt;br /&gt;
        MyRequest = null;&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    catch (Exception ex)&lt;br /&gt;
    {&lt;br /&gt;
        throw new Exception(&quot;抓不到網路上的圖片，發生錯誤：&quot; + strUrl);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //回傳 Image&lt;br /&gt;
    return MyImage;&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://diiuuli520.blogspot.com/feeds/4436561891947769867/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://diiuuli520.blogspot.com/2012/01/c_22.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/4436561891947769867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2928978240024428405/posts/default/4436561891947769867'/><link rel='alternate' type='text/html' href='http://diiuuli520.blogspot.com/2012/01/c_22.html' title='[C#] 取得網路上的圖片'/><author><name>Ryan</name><uri>http://www.blogger.com/profile/16291884227447638902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmUn0iT0QpV-ejG7qVcdCcC_kY6HTbaPTh1tGrPBL0ZZq54Jb8n9IOJRQ7JmCpjQHp1IBSIqQoZTk2HzpCgyYGMbhS1J4BBSjUqXq19lcWTRMP8ieGwqGLqmzawPYVvQ/s220/DSC00644.JPG'/></author><thr:total>0</thr:total></entry></feed>