Installment 7 Tables With No Column Presented by rexmen 2001 資管所.林彥廷. 690530031.

Slides:



Advertisements
Similar presentations
1 生物計算期末作業 暨南大學資訊工程系 2003/05/13. 2 compare f1 f2  只比較兩個檔案 f1 與 f2 ,比完後將結果輸出。 compare directory  以兩兩比對的方式,比對一個目錄下所有檔案的相 似程度。  將相似度很高的檔案做成報表輸出,報表中至少要.
Advertisements

布林代數的應用--- 全及項(最小項)和全或項(最大項)展開式
第七章 抽樣與抽樣分配 蒐集統計資料最常見的方式是抽查。這 牽涉到兩個問題: 抽出的樣本是否具有代表性?是否能反應出母體的特徵?
: A-Sequence 星級 : ★★☆☆☆ 題組: Online-judge.uva.es PROBLEM SET Volume CIX 題號: Problem D : A-Sequence 解題者:薛祖淵 解題日期: 2006 年 2 月 21 日 題意:一開始先輸入一個.
密碼學與網路安全 第4章 有限體.
:Word Morphing ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10508:word morphing 解題者:楊家豪 解題日期: 2006 年 5 月 21 日 題意: 第一行給你兩個正整數, 第一個代表下面會出現幾個字串,
1 集合論 Chapter 3. 2 Chapter 3 Set Theory 3.1 Sets and Subsets A well-defined collection of objects (the set of outstanding people, outstanding is very.
1.1 線性方程式系統簡介 1.2 高斯消去法與高斯-喬登消去法 1.3 線性方程式系統的應用(-Skip-)
代數概論 劉兆樑.
:New Land ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11871: New Land 解題者:施博修 解題日期: 2011 年 6 月 8 日 題意:國王有一個懶兒子,為了勞動兒子,他想了一個 辦法,令他在某天早上開始走路,直到太陽下山前,靠.
: OPENING DOORS ? 題組: Problem Set Archive with Online Judge 題號: 10606: OPENING DOORS 解題者:侯沛彣 解題日期: 2006 年 6 月 11 日 題意: - 某間學校有 N 個學生,每個學生都有自己的衣物櫃.
Chapter 2 聯立線性方程式與矩陣 緒言 線性方程式組 (systems of linear equations) 出現 在多數線性模式 (linear model) 中。根據以往解 題的經驗,讀者們也許已發現方程式的解僅與 該方程式的係數有關,求解的過程也僅與係數 的運算有關,只要係數間的相關位置不改變,
5.1 Rn上之長度與點積 5.2 內積空間 5.3 單範正交基底:Gram-Schmidt過程 5.4 數學模型與最小平方分析
1. 假設以下的敘述為一未提供 “ 捷徑計算 ” 能力的程式段,試用程 式設計的技巧,使此敘述經此改 寫的動作後,具有與 “ 捷徑計算 ” 之 處理方法相同之處理模式。 if and then E1 else E2 endif.
8.1 何謂高度平衡二元搜尋樹 8.2 高度平衡二元搜尋樹的加入 8.3 高度平衡二元搜尋樹的刪除
基礎物理總論 基礎物理總論 熱力學與統計力學(三) Statistical Mechanics 東海大學物理系 施奇廷.
2009fallStat_samplec.i.1 Chap10 Sampling distribution (review) 樣本必須是隨機樣本 (random sample) ,才能代表母體 Sample mean 是一隨機變數,隨著每一次抽出來的 樣本值不同,它的值也不同,但會有規律性 為了要知道估計的精確性,必需要知道樣本平均數.
JAVA 程式設計與資料結構 第十章 GUI Introdution III. File Chooser  File Chooser 是一個選擇檔案的圖形介面, 無論我們是要存檔還是要開啟檔案,使 用這個物件都會讓我們覺得容易且舒適。
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
Chapter 13 塑模靜態觀點:物件圖 Static View : Object Diagram.
Introduction to Java Programming Lecture 17 Abstract Classes & Interfaces.
:Problem D: Bit-wise Sequence ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10232: Problem D: Bit-wise Sequence 解題者:李濟宇 解題日期: 2006 年 4 月 16.
: The largest Clique ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11324: The largest Clique 解題者:李重儀 解題日期: 2008 年 11 月 24 日 題意: 簡單來說,給你一個 directed.
: Tight words ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: : Tight Words 解題者:鐘緯駿、林一帆 解題日期: 2006 年 03 月 14 日 題意: 給定數字 k 與 n (0 ≦ k.
: Happy Number ★ ? 題組: Problem Set Archive with Online Judge 題號: 10591: Happy Number 解題者:陳瀅文 解題日期: 2006 年 6 月 6 日 題意:判斷一個正整數 N 是否為 Happy Number.
: Fast and Easy Data Compressor ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10043: Fast and Easy Data Compressor 解題者:葉貫中 解題日期: 2007 年 3.
3.1 矩陣的行列式 3.2 使用基本運算求行列式 3.3 行列式的性質 3.4 特徵值介紹 3.5 行列式的應用
: Problem A : MiniMice ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11411: Problem A : MiniMice 解題者:李重儀 解題日期: 2008 年 9 月 3 日 題意:簡單的說,題目中每一隻老鼠有一個編號.
資料庫程式設計與系統管理 SQL Server 2005 Express 第六章 進階資料庫設計.
: Count DePrimes ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11408: Count DePrimes 解題者:李育賢 解題日期: 2008 年 9 月 2 日 題意: 題目會給你二個數字 a,b( 2 ≦ a ≦ 5,000,000,a.
: Multisets and Sequences ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11023: Multisets and Sequences 解題者:葉貫中 解題日期: 2007 年 4 月 24 日 題意:在這個題目中,我們要定義.
:Nuts for nuts..Nuts for nuts.. ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 10944:Nuts for nuts.. 解題者:楊家豪 解題日期: 2006 年 2 月 題意: 給定兩個正整數 x,y.
資料結構實習-一 參數傳遞.
Management Abstracts Retrieval System; MARS 檢索操作.
: A-Sequence ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10930: A-Sequence 解題者:陳盈村 解題日期: 2008 年 5 月 30 日 題意: A-Sequence 需符合以下的條件, 1 ≤ a.
: Beautiful Numbers ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11472: Beautiful Numbers 解題者:邱經達 解題日期: 2011 年 5 月 5 日 題意: 若一個 N 進位的數用到該.
Section 4.2 Probability Models 機率模式. 由實驗看機率 實驗前先列出所有可能的實驗結果。 – 擲銅板:正面或反面。 – 擲骰子: 1~6 點。 – 擲骰子兩顆: (1,1),(1,2),(1,3),… 等 36 種。 決定每一個可能的實驗結果發生機率。 – 實驗後所有的實驗結果整理得到。
函式 Function Part.2 東海大學物理系‧資訊教育 施奇廷. 遞迴( Recursion ) 函式可以「呼叫自己」,這種動作稱為 「遞迴」 此程式的執行結果相當於陷入無窮迴圈, 無法停止(只能按 Ctrl-C ) 這給我們一個暗示:函式的遞迴呼叫可以 達到部分迴圈的效果.
: GCD - Extreme II ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11426: GCD - Extreme II 解題者:蔡宗翰 解題日期: 2008 年 9 月 19 日 題意: 最多 20,000 組測資,題目會給一個數字.
資料結構實習-二.
演算法 8-1 最大數及最小數找法 8-2 排序 8-3 二元搜尋法.
: Expect the Expected ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11427: Expect the Expected 解題者:李重儀 解題日期: 2008 年 9 月 21 日 題意:玩一種遊戲 (a game.
845: Gas Station Numbers ★★★ 題組: Problem Set Archive with Online Judge 題號: 845: Gas Station Numbers. 解題者:張維珊 解題日期: 2006 年 2 月 題意: 將輸入的數字,經過重新排列組合或旋轉數字,得到比原先的數字大,
Chapter 10 m-way 搜尋樹與B-Tree
人工智慧 第八章 模糊關係及推論 王榮華教授.
: Function Overloading ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11032:Function Overloading 解題者:許智祺 解題日期: 2007 年 5 月 8 日 題意:判對輸入之數字是否為.
演算法課程 (Algorithms) 國立聯合大學 資訊管理學系 陳士杰老師 Course 7 貪婪法則 Greedy Approach.
第七章 模糊關係及推論.
JAVA 程式設計與資料結構 第十六章 Hash Tables. Introduction Hash Tables 結構為一個 Array ,稱之為 Bucket array 。 如果想要新增一個物件,要根據這個物件的特性 將其加入 Hash Table 內。 Bucket Array 用 A 來代替,其.
第五章 內積空間 5.1 Rn上之長度與點積 5.2 內積空間 5.3 單範正交基底:Gram-Schmidt過程
第4章 有限體.
Extreme Discrete Summation ★★★★☆ 題組: Contest Archive with Online Judge 題號: Extreme Discrete Summation 解題者:蔡宗翰 解題日期: 2008 年 10 月 13 日.
: Help My Brother ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11033: Help My Brother 解題者: 呂明璁 解題日期: 2007 年 5 月 14 日.
計算機概論 第6章 數位邏輯設計.
2005/7 Linear system-1 The Linear Equation System and Eliminations.
SQL 進階查詢.
: Problem E Antimatter Ray Clearcutting ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11008: Problem E Antimatter Ray Clearcutting 解題者:林王智瑞.
函式 Function 東海大學物理系‧資訊教育 施奇廷. 函式簡介 當程式越來越大、越複雜時,程式的維護、 除錯會變得更困難,此時必須引入函式來 簡化程式或將程式分段,將程式重複的部 分改寫為函式,將程式「模組化」 這種作法有下列優點:節省程式發展的時 間、邏輯容易瞭解、程式容易除錯、可分 工合作完成程式.
Visual C++重點複習.
資料結構實習-六.
:Count the Trees ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10007:Count the Trees 解題者:楊家豪 解題日期: 2006 年 3 月 題意: 給 n 個點, 每一個點有自己的 Label,
Microsoft Excel.
Introduction to Java Programming Lecture 16 Super and Sub Classes.
: Finding Paths in Grid ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11486: Finding Paths in Grid 解題者:李重儀 解題日期: 2008 年 10 月 14 日 題意:給一個 7 個 column.
:Problem E.Stone Game ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10165: Problem E.Stone Game 解題者:李濟宇 解題日期: 2006 年 3 月 26 日 題意: Jack 與 Jim.
:Rings and Glue ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10301: Rings and Glue 解題者:施博修 解題日期: 2011 年 5 月 18 日 題意:小約翰有了個大麻煩,他不小心將 rings.
幼兒行為觀察與記錄 第八章 事件取樣法.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
: How many 0's? ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11038: How many 0’s? 解題者:楊鵬宇 解題日期: 2007 年 5 月 15 日 題意:寫下題目給的 m 與 n(m
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
Presentation transcript:

Installment 7 Tables With No Column Presented by rexmen 2001 資管所.林彥廷.

Installment 7 流程大綱 Relational Algebra OperatorRelational Algebra Operator Empty set in RDBEmpty set in RDB Tables and PredicateTables and Predicate Tables with No columnTables with No column TABLE_DUM and TABLE_DEETABLE_DUM and TABLE_DEE Effect on Relational AlgebraEffect on Relational Algebra

Relational Algebra Operator Select (Restrict)Select (Restrict) ProjectProject Cartesian ProductCartesian Product UnionUnion DifferenceDifference JoinJoin IntersectionIntersection DivideDivide 原始運算子 非原始運算子

Select (Restrict) 從一個 Table 中取出符合條件的資料,也就是取得 Row 的資料,請注意這裡的 Select 是運算子並不是 指 SQL 語法中的 Select 。 從一個 Table 中取出符合條件的資料,也就是取得 Row 的資料,請注意這裡的 Select 是運算子並不是 指 SQL 語法中的 Select 。 C1C2C3C4 Select * From T1 Where

Project 從一個 Table 中取出所需要的欄位,也就是取得 Column 的資料。 從一個 Table 中取出所需要的欄位,也就是取得 Column 的資料。 C1C2C3C4 Select C1, C2 From T1

Cartesian Product( 卡氏積 ) 將兩個 Table 以普通算術中的乘法原理相乘 後組合成一個 Table 。 將兩個 Table 以普通算術中的乘法原理相乘 後組合成一個 Table 。 C11C12 A1A2 B1B2 C1C2C21C22X1X2 Y1Y2 C11C12C21C22A1A2X1X2 A1A2Y1Y2 B1B2X1X2 B1B2Y1Y2 C1C2X1X2 C1C2Y1Y2 ╳=> Select * From T1, T2

Union 從兩個 Table 中取出聯集的資料,重複的資料只 取出一筆。 從兩個 Table 中取出聯集的資料,重複的資料只 取出一筆。 C1C2 X1X2 Y1Y2C1C2X1X2 Z1Z2C1C2X1X2 Y1Y2 Z1Z2 => Select * From T1 Union Select * From T2

Difference 從一個 Table 中刪除另一個 Table 中有的資料 。 從一個 Table 中刪除另一個 Table 中有的資料 。 C1C2 X1X2 Y1Y2C1C2X1X2 Z1Z2 C1C2Y1Y2 => Select * From T1 Where not exists ( Select * From T2 Where T1.C1 = T2.C1 and T1.C2 = T2.C2 )

Set of Relational DB C1C2C3…Cn Column / Attribute Row / Tuple TABLE / RELATION

Empty Set 空集合 (empty set) 仍然是一個集合,所以 RDB 集合定理所 構成,自然也要能符合含有空集合的性質。 空集合 (empty set) 仍然是一個集合,所以 RDB 集合定理所 構成,自然也要能符合含有空集合的性質。 Empty set of rowsEmpty set of rows Empty set of columnEmpty set of columnC1C2C3…Cn

Tables and Predicate Predicate :Predicate : –a Truth-valued Function( 真值函數 ) –Return True or False –Ex. F( e, set )F( e, set ) F( 3, {1,3,5,6} ) Ans : TrueF( 3, {1,3,5,6} ) Ans : True True, if e contained by set False, otherwise Proposition( 命題 ) / Instantiation( 實例 )

Predicate of Tables 可以說 predicate 是 table 的所表示的意義 可以說 predicate 是 table 的所表示的意義 每一個 table 有一個確切的 predicate 每一個 table 有一個確切的 predicate Ex. Table EMP with heading {E#, SAL, D#}Ex. Table EMP with heading {E#, SAL, D#} –“ Employee E# earns salary SAL and works in department D#. ” –E.g. EMP(E1, 50K, D1) 如果存在此列 (E1, 50K, D1) ,則此 proposition 的結果 為 True ,反之為 False 。 如果存在此列 (E1, 50K, D1) ,則此 proposition 的結果 為 True ,反之為 False 。

TABLE EMP(E#, SAL, D#) “ Employee E# earns salary SAL and works in department D#. ”“ Employee E# earns salary SAL and works in department D#. ” E#SALD# E150KD1 E235KD2 E360KD3 E440KD2 E550KD2 E642KD3 EMP

Project Away D# From EMP Table ES is derived from table EMP(E#, SAL, D#) by “ Projecting away ” column D#Table ES is derived from table EMP(E#, SAL, D#) by “ Projecting away ” column D# –Get table ES with heading {E#, SAL} –Predicate : “ THERE EXISTS a department D# SUCH THAT employee E# earns salary SAL and works in department D#. ”“ THERE EXISTS a department D# SUCH THAT employee E# earns salary SAL and works in department D#. ”

TABLE ES(E#, SAL) “ THERE EXISTS a department D# SUCH THAT employee E# earns salary SAL and works in department D#. ”“ THERE EXISTS a department D# SUCH THAT employee E# earns salary SAL and works in department D#. ” E#SALD# E150KD1 E235KD2 E360KD3 E440KD2 E550KD2 E642KD3 E#SALE235K E440K E550K EMP ES Project away D2 From EMP

Project Away E# From ES Table S is derived from table ES(E#, SAL) by “ Projecting away ” column E#Table S is derived from table ES(E#, SAL) by “ Projecting away ” column E# –Get table S with heading {SAL} –Predicate : “ THERE EXISTS a department D# SUCH THAT THERE EXISTS an employee E# SUCH THAT employee E# earns salary SAL and works in department D# ”“ THERE EXISTS a department D# SUCH THAT THERE EXISTS an employee E# SUCH THAT employee E# earns salary SAL and works in department D# ”

TABLE S(SAL) “ THERE EXISTS a department D# SUCH THAT THERE EXISTS an employee E# SUCH THAT employee E# earns salary SAL and works in department D# ”“ THERE EXISTS a department D# SUCH THAT THERE EXISTS an employee E# SUCH THAT employee E# earns salary SAL and works in department D# ” E#SALD# E150KD1 E235KD2 E360KD3 E440KD2 E550KD2 E642KD3 E#SALE235K E440K E550K EMP ES Project away D2 From EMPSAL40K Project away E4 From ES S

Project Away SAL From S Table Z is derived from table S(SAL) by “ Projecting away ” column SALTable Z is derived from table S(SAL) by “ Projecting away ” column SAL –Get table Z with heading { } –Predicate : “ THERE EXISTS a department D# SUCH THAT THERE EXISTS an employee E# SUCH THAT THERE EXISTS a salary SAL SUCH THAT employee E# earns salary SAL and works in department D#. ”“ THERE EXISTS a department D# SUCH THAT THERE EXISTS an employee E# SUCH THAT THERE EXISTS a salary SAL SUCH THAT employee E# earns salary SAL and works in department D#. ”

Table Z “ THERE EXISTS a department D# SUCH THAT THERE EXISTS an employee E# SUCH THAT THERE EXISTS a salary SAL SUCH THAT employee E# earns salary SAL and works in department D#. ”“ THERE EXISTS a department D# SUCH THAT THERE EXISTS an employee E# SUCH THAT THERE EXISTS a salary SAL SUCH THAT employee E# earns salary SAL and works in department D#. ”E#SALD#E150KD1 E235KD2 E360KD3 E440KD2 E550KD2 E642KD3 E#SALE235K E440K E550K EMP ES Project away D2 From EMPSAL40K Project away E4 From ES S Project away 40k From S

Table with No Column ! 此種 Table 是否能存在任何的列? 此種 Table 是否能存在任何的列? 在此種 Table 中存在著一種為 0-tuple 的列 在此種 Table 中存在著一種為 0-tuple 的列 – 因為一個列也是一種欄位的集合 –0-tuple 是一種欄位為空集合的一個欄位集合 – 此種 Table 只有一種列,即為 0-tuple( 一般正規的關聯式 資料庫中的列是要消除重複性的,因為 0-tuple 與其他 0- tuple 表示相同的列,故此種 table 只能至多有一個列。 ) –Table With No Column is useful ? Of Course, YES ! Of Course, YES !

TABLE_DUM and TABLE_DEE Table with No Column 只會有兩種情形:Table with No Column 只會有兩種情形: – 只有一個列 (TABLE_DEE) → True/Yes – 沒有任何列 (TABLE_DUM) →False/No SQL 難以精確的處理 Yes/NO 問題 ,因為 SQL 並不支援 Table with No Column 。SQL 難以精確的處理 Yes/NO 問題 ,因為 SQL 並不支援 Table with No Column 。 –Ex. ” Does employee E1 work in department D1? ” 畫出 TABLE_DUM 與 TABLE_DEE 的圖形是 困難的。 畫出 TABLE_DUM 與 TABLE_DEE 的圖形是 困難的。

Effect on Relational Algebra Identity – 普通算術中數字 1 為一個 Identity a*1 = 1*a = a, for all numbers aa*1 = 1*a = a, for all numbers a – 在關聯式代數中 TABLE_DEE 為一個 Identity T TIMES DEE = DEE TIMES T = T for all tables TT TIMES DEE = DEE TIMES T = T for all tables T

Product (Cartesian product) DEE T TIMES DEE = DEE TIMES T = T for all tables TT TIMES DEE = DEE TIMES T = T for all tables T C1C2 X1X2 Y1Y2 Z1Z2 Product TABLE_DEE =C1C2X1X2 Y1Y2 Z1Z2

Product (Cartesian product) DUM T TIMES DUM = DUM TIMES T = a table with the same heading as T but with no rows at all.T TIMES DUM = DUM TIMES T = a table with the same heading as T but with no rows at all. C1C2 X1X2 Y1Y2 Z1Z2 Product TABLE_DUM =C1C2

Join DEE T JOIN DEE = DEE JOIN T = a table with the same heading as T but with no rows at all.T JOIN DEE = DEE JOIN T = a table with the same heading as T but with no rows at all. C1C2 X1X2 Y1Y2 Z1Z2 JOIN TABLE_DEE =C1C2

Join DUM T JOIN DUM = DUM JOIN T = a table with the same heading as T but with no rows at all.T JOIN DUM = DUM JOIN T = a table with the same heading as T but with no rows at all. C1C2 X1X2 Y1Y2 Z1Z2 JOIN TABLE_DEE =C1C2

THE END rexmen 2001