ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١ /
ﻓﺼﻞ ﺍﻭﻝ : ﻣﻌﺮﻓﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ -١-١ﺗﻌﺮﻳﻒ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ: ﻣﻔﻬـﻮﻡ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻫـﺎ ﺍﺯ ﻧﻈـﺮ ﻣﺆﻟﻔـﻴﻦ ﻣﺨـﺘﻠﻒ ﺩﺭ ﺑﻴﺎﻥ ﺑﺎ ﺗﻔﺎﻭﺗﻬﺎﻳﻲ ﻫﻤﺮﺍﻩ ﻭﻟﻲ ﺍﺯ ﻧﻈﺮ ﺗﻜﻨﻴﻜﻲ ﺑﻪ ﮔﻮﻧﻪ ﺍﻱ ﻣﺸﺎﺑﻪ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﺳﺖ .ﻳﻜﻲ ﺍﺯ ﺗﻌﺎﺭﻳﻒ ﻣﻨﺎﺳﺐ ﺁﻥ ﺑﻪ ﻓﺮﻡ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ:
ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗـﻲ ،ﻣﺠﻤـﻮﻋﻪ ﺍﻱ ﺍﺳـﺖ ﺍﺯ ﺩﺍﺩﻩ ﻫـﺎﻱ ﺫﺧﻴـﺮﻩ ﺷـﺪﻩ ﻭ ﭘﺎﻳـﺎ )ﺩﺭ ﻣﻮﺭﺩ ﺍﻧﻮﺍﻉ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻱ ﻳﻚ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗـﻲ ﻭ ﺍﺭﺗـﺒﺎﻃﺎﺕ ﺑـﻴﻦ ﺁﻧﻬـﺎ( ﺑﺼـﻮﺭﺕ ﻣﺠﺘﻤﻊ ﻭ ﻣﺒﺘﻨﻲ ﺑﺮ ﻳﻚ ﺳﺎﺧﺘﺎﺭ ،ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺑﻄﻮﺭ ﺻﻮﺭﻱ ﺑﺎ ﺣﺪﺍﻗﻞ ﺍﻓﺰﻭﻧﮕﻲ، ﺗﺤﺖ ﻣﺪﻳﺮﻳﺖ ﻳﻚ ﺳﻴﺴﺘﻢ ﻛﻨﺘﺮﻝ ﻣﺘﻤﺮﻛﺰ ،ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻳﻚ ﻳﺎ ﭼﻨﺪ ﻛﺎﺭﺑﺮ ،ﺑﻄﻮﺭ ﺍﺷﺘﺮﺍﻛﻲ ﻭ ﻫﻤﺰﻣﺎﻥ. ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻦ ﺗﻌﺮﻳﻒ ﻣﻲ ﺗﻮﺍﻥ ﺩﺭﻳﺎﻓﺖ ﻛﻪ ﺍﺯ ﺩﻳﺪﮔﺎﻩ ﺗﺨﺼﺼﻲ ﻫﺮ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﻓﺎﻳﻠﻬﺎ ﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﻟﺰﻭﻣﺎ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﺤﺴﻮﺏ ﻧﻤﻴﮕﺮﺩﺩ.ﺩﺭ ﺍﺩﺍﻣﻪ ﺑﺮﺧﻲ ﺍﺻﻄﻼﺣﺎﺕ ﻣﻮﺟﻮﺩ ﺩﺭ ﺗﻌﺮﻳﻒ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺗﻮﺿﻴﺢ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﻧﺪ: ﻣﺠﺘﻤﻊ Integrityﻭ ﻣﺒﺘﻨﻲ ﺑﺮ ﻳﻚ ﺳﺎﺧﺘﺎﺭ ﺑـﻪ ﻣﻌﻨـﻲ ﺁﻥ ﺍﺳـﺖ ﻛﻪ ﻛﻞ ﺩﺍﺩﻩ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﻣﺤﻴﻂ ﻣﻮﺭﺩ ﻧﻈﺮ ﻛﺎﺭﺑﺮﺍﻥ ﻣﺨﺘﻠﻒ ،ﺩﺭ ﻗﺎﻟﺐ ﻳﻚ ﺳﺎﺧﺘﺎﺭ ﻣﺸﺨﺺ ﺑﺼﻮﺭﺕ ﻳﻜﺠﺎ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺑﺎﺷﻨﺪ .ﺑﻪ ﻋﺒﺎﺭﺗﻲ ﭘﺮﺍﻛﻨﺪﮔﻲ ﺩﺭ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺩﺍﺩﻩ ﻫﺎﻱ ﻣﺤﻴﻂ ﻭﺟﻮﺩ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﺪ. ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺑﺼﻮﺭﺕ ﺻﻮﺭﻱ: ﺑـﻪ ﻣﻌﻨـﻲ ﺁﻥ ﺍﺳﺖ ﻛﻪ ﺩﺍﺩﻩ ﻫﺎ ﺑﻪ ﻛﻤﻚ ﺍﺣﻜﺎﻡ ﺧﺎﺻﻲ ،ﺩﺭ ﻛﺎﺩﺭ ﺗﻌﺮﻳﻒ ﻓﺎﻳﻠﻬﺎﻱ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ،ﺗﺸﺮﻳﺢ ﻭ ﺗﻌﺮﻳﻒ ﺷﻮﻧﺪ ﻭ ﺍﻳﻦ ﻛﺎﺭ ﺯﺑﺎﻥ ﺧﺎﺻﻲ ﺭﺍ ﻻﺯﻡ ﺩﺍﺭﺩ. ﻣﺜﺎﻟﻲ ﺑﺮﺍﻱ ﺩﺭﻙ ﺑﻬﺘﺮ ﻣﻔﻬﻮﻡ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﺤـﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺩﺍﻧﺸﮕﺎﻩ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﺪ ﻛﻪ ﺩﺍﺭﺍﻱ ﺑﺨﺶ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﻣﺨﺘﻠﻒ ﻣﻲ ﺑﺎﺷﺪ .ﻓﺮﺽ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺳﻪ ﺑﺨﺶ ﺍﻣﻮﺭ ﺁﻣﻮﺯﺵ ،ﺍﻣﻮﺭ ﺩﺍﻧﺸﺠﻮﻳﻲ ﻭ ﺍﻣﻮﺭ ﻣﺎﻟﻲ ﺩﺍﻧﺸﮕﺎﻩ ﺑﺨﺸﻬﺎﻳﻲ ﻫﺴﺘﻨﺪ ﻛﻪ ﻣﻲ ﺧﻮﺍﻫﻴﻢ ﺑﺮﺍﻱ ﺁﻧﻬﺎ ﻳﻚ ﺳﻴﺴﺘﻢ ﺫﺧﻴـﺮﻩ ﻭ ﺑﺎﺯﻳﺎﺑﻲ ﻛﺎﻣﭙﻴﻮﺗﺮﻱ ﺍﻳﺠﺎﺩ ﻧﻤﺎﻳﻴﻢ ﻭ ﻧﻴﺰ ﻓﺮﺽ ﻣﻲ ﻛﻨﻴﻢ ﻛﻪ ﺗﻨﻬﺎ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻮﺭﺩ ﻧﻈﺮ ،ﻣﻮﺟﻮﺩﻳﺖ ﺩﺍﻧﺸﺠﻮ ﺑﺎﺷـﺪ ﻭ ﺑﺨﺸﻬﺎﻱ ﻓﻮﻕ ﻣﻲ ﺧﻮﺍﻫﻨﺪ ﺍﻃﻼﻋﺎﺗﻲ ﺭﺍ ﺩﺭ ﻣﻮﺭﺩ ﺍﻳﻦ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ .ﻭﺍﺿﺢ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﻫﺮ ﻳﻚ ﺍﺯ ﺑﺨﺸﻬﺎﻱ ﻓﻮﻕ ﺍﻧﻮﺍﻉ ﺩﻳﮕﺮﻱ ﺍﺯ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ ﻛﻪ ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﻣﻮﺭﺩ ﺑﺤﺚ ﻗﺮﺍﺭ ﻧﻤﻲ ﮔﻴﺮﻧﺪ. ﺩﻭ ﺭﻭﺵ ﻭ ﻣﺸﻲ ﻛﻠﻲ ﺩﺭ ﻃﺮﺍﺣﻲ ﺍﻳﻦ ﺳﻴﺴﺘﻢ ﻭﺟﻮﺩ ﺩﺍﺭﺩ:
ﺍﻣﻮﺭ ﻣﺎﻟﻲ
ﺍﺩﺍﺭﻩ ﺁﻣﻮﺯﺵ ﺩﺍﻧﺸﺠﻮ
……
ﺍﻣﻮﺭ ﺩﺍﻧﺸﺠﻮﻳﻲ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢ /
ﺍﻟﻒ – ﻣﺸﻲ ﻏﻴﺮ ﺑﺎﻧﻜﻲ )ﺳﻴﺴﺘﻢ ﻓﺎﻳﻞ ﭘﺮﺩﺍﺯﻱ( File Processing
ﻼ ﻣﻄﺎﻟﻌﻪ ﻣﻲ ﺷﻮﺩ ﻭ ﺑﺮﺍﻱ ﻫﺮ ﺯﻳﺮ ﻣﺠﻤﻮﻋﻪ ﻳﻚ ﺳﻴﺴﺘﻢ ﺧﺎﺹ ﺩﺭ ﺍﻳﻦ ﺭﻭﺵ ﻫﺮ ﻳﻚ ﺍﺯ ﺯﻳﺮ ﻣﺤﻴﻂ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﻣﺴﺘﻘ ﹰ ﻫﻤـﺎﻥ ﺯﻳـﺮ ﻣﺤـﻴﻂ ﻃﺮﺍﺣـﻲ ﻭ ﺗﻮﻟـﻴﺪ ﻣﻲ ﺷﻮﺩ ،ﺑﮕﻮﻧﻪ ﺍﻱ ﻛﻪ ﻓﻘﻂ ﭘﺎﺳﺨﮕﻮﻱ ﻫﻤﺎﻥ ﺯﻳﺮ ﻣﺤﻴﻂ ﺍﺳﺖ.ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻣﺜﺎﻝ ﻣﻄﺮﺡ ﺷﺪﻩ ﻫﺮ ﻗﺴﻤﺖ ﺍﺯ ﺩﺍﻧﺸﮕﺎﻩ ﺳﻴﺴﺘﻢ ﻛﺎﺭﺑﺮﺩﻱ ﺧﺎﺹ ﻭ ﺟﺪﺍﮔﺎﻧﻪ ﺧﻮﺩ ﺭﺍ ﺧﻮﺍﻫﺪ ﺩﺍﺷﺖ .
ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﺍﻳﺠﺎﺩ ﻓﺎﻳﻠﻬﺎﻱ ﺧﺎﺹ
ﺳﻴﺴﺘﻢ ﻓﺎﻳﻞ
ﻛﻨﻨﺪﻩ ﻭ ﭘﺮﺩﺍﺯﺷﮕﺮ ﻓﺎﻳﻠﻬﺎ
ﺍﺩﺍﺭﻩ ﺁﻣﻮﺯﺵ
ﻣﺤﻴﻂ ﻓﻴﺰﻳﻜﻲ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺧﺎﺹ ﻛﺎﺭﺑﺮﺍﻥ ﺁﻣﻮﺯﺵ
ﺍﺩﺍﺭﻩ ﺁﻣﻮﺯﺵ
ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﺳﻴﺴﺘﻢ ﻭﺍﺳﻂ
ﻗﺎﻟﺐ ﺭﻛﻮﺭﺩ ﺍﺯ ﺩﻳﺪ ﺁﻣﻮﺯﺵ ) :ﺩﺍﻧﺸﻜﺪﻩ ،ﺳﺎﻝ ﻭﺭﻭﺩ ،ﺗﺎﺭﻳﺦ ﺗﻮﻟﺪ ،ﻧﺎﻡ ﺧﺎﻧﻮﺍﺩﮔﻲ ،ﻧﺎﻡ ،ﺷﻤﺎﺭﻩ ﺩﺍﻧﺸﺠﻮ( ﺍﻣﻮﺭ ﺩﺍﻧﺸﺠﻮﻳﻲ ﻧﻴﺰ ﻓﺎﻳﻠﻬﺎﻱ ﺧﺎﺹ ﺧﻮﺩ ﺭﺍ ﺩﺍﺭﺩ: ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﺍﻳﺠﺎﺩ ﻓﺎﻳﻠﻬﺎﻱ ﺧﺎﺹ
ﺳﻴﺴﺘﻢ ﻓﺎﻳﻞ
ﺍﺩﺍﺭﻩ ﺍﻣﻮﺭ
ﻛﻨﻨﺪﻩ ﻭ ﭘﺮﺩﺍﺯﺷﮕﺮ ﻓﺎﻳﻠﻬﺎ
ﺩﺍﻧﺸﺠﻮﻳﻲ ﺍﻣﻮﺭ ﺩﺍﻧﺸﺠﻮﻳﻲ
ﻗﺎﻟﺐ ﺭﻛﻮﺭﺩ ﺍﺯ ﺩﻳﺪ ﺍﻣﻮﺭ ﺩﺍﻧﺸﺠﻮﻳﻲ: )ﺳﺎﻝ ﻭﺭﻭﺩ ،ﺗﺎﺭﻳﺦ ﺗﻮﻟﺪ ،ﻧﺎﻡ ﺧﺎﻧﻮﺍﺩﮔﻲ ،ﻧﺎﻡ ،ﺷﻤﺎﺭﻩ ﺩﺍﻧﺸﺠﻮ( ﻣﺸﺨﺼﻪ ﻫﺎﻱ ﺍﻳﻦ ﺭﻭﺵ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ: – ١ﺩﺭ ﺭﻭﺵ ﻓﺎﻳﻞ ﭘﺮﺩﺍﺯﻱ ﺩﺍﺩﻩ ﻫﺎ ﺍﺯ ﻫﻢ ﻣﺠﺰﺍ ﻣﻲ ﺑﺎﺷﻨﺪ. – ٢ﻣﺤﻴﻂ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﻧﺎﻣﺠﺘﻤﻊ ﺍﺳﺖ )ﺗﻌﺪﺍﺩﻱ ﺳﻴﺴﺘﻢ ﺟﺪﺍﮔﺎﻧﻪ ﻭ ﻣﺤﻴﻂ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺟﺪﺍﮔﺎﻧﻪ( – ٣ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﻭﺍﺑﺴﺘﻪ ﺑﻪ ﻗﺎﻟﺐ ﻓﺎﻳﻞ ﻣﻲ ﺑﺎﺷﻨﺪ. – ٤ﻋﺪﻡ ﺳﺎﺯﮔﺎﺭﻱ ﺩﺭ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻓﺎﻳﻠﻬﺎ ﺩﻳﺪﻩ ﻣﻲ ﺷﻮﺩ. – ٥ﺍﺷﺘﺮﺍﻛﻲ ﻧﺒﻮﺩﻥ ﺩﺍﺩﻩ ﻫﺎ :ﺩﺍﺩﻩ ﻫﺎﻱ ﺯﻳﺮ ﻣﺤﻴﻂ ١ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺎﺭﺑﺮﺍﻥ ﺯﻳﺮ ﻣﺤﻴﻂ ٢ﻧﻤﻲ ﺗﻮﺍﻧﻨﺪ ﻗﺮﺍﺭ ﮔﻴﺮﻧﺪ. – ٦ﺍﻃﻼﻋﺎﺕ ﺗﻜﺮﺍﺭﻱ ﻭ ﺍﻓﺰﻭﻧﮕﻲ ﺩﺭ ﺩﺍﺩﻩ ﻫﺎ ﻭﺟﻮﺩ ﺩﺍﺭﺩ. – ٧ﻋـﺪﻡ ﺍﻣﻜـﺎﻥ ﺍﺳﺘﺎﻧﺪﺍﺭﺩﻫﺎﻱ ﻭﺍﺣﺪ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺑﺪﻟﻴﻞ ﻭﺟﻮﺩ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﻣﺘﻌﺪﺩ ﻭ ﭘﺮﺍﻛﻨﺪﻩ ﻛﻪ ﺍﺣﻴﺎﻧﹰﺎ ﺗﻮﺳﻂ ﺗﻴﻢ ﻫﺎﻱ ﻣﺨﺘﻠﻒ ﻃﺮﺍﺣﻲ ﻭ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ ﺍﻣﻜﺎﻥ ﺍﻋﻤﺎﻝ ﻳﻜﺴﺮﻱ ﺍﺯ ﻋﻤﻠﻴﺎﺕ ﻣﻨﺴﺠﻢ ﺭﻭﻱ ﺁﻥ ﺳﻴﺴﺘﻢ ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣ /
-٨ﻣﺼـﺮﻑ ﻏﻴـﺮ ﺑﻬﻴـﻨﻪ ﺍﻣﻜﺎﻧـﺎﺕ ﺳـﺨﺖ ﺍﻓـﺰﺍﺭﻱ ﻭ ﻧﺮﻡ ﺍﻓﺰﺍﺭﻱ ﻭ ﺣﺠﻢ ﺯﻳﺎﺩ ﺑﺮﻧﺎﻣﻪ ﺳﺎﺯﻱ ﻭ ﺍﺳﺘﻔﺎﺩﻩ ﻏﻴﺮ ﺑﻬﻴﻨﻪ ﺍﺯ ﻣﻬﺎﺭﺕ ﻭ ﻭﻗﺖ ﺗﻴﻤﻬﺎﻱ ﺑﺮﻧﺎﻣﻪ ﺳﺎﺯﻱ . ﺏ – ﻣﺸﻲ ﺑﺎﻧﻜﻲ )ﭘﺎﻳﮕﺎﻫﻲ(
Database Approach
ﺩﺭ ﺍﻳـﻦ ﺭﻭﺵ ﻳـﻚ ﺗـﻴﻢ ﻭﺍﺣﺪ ﻃﺮﺍﺣﻲ ﻭ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﺑﻪ ﺳﺮﭘﺮﺳﺘﻲ ﻣﺘﺨﺼﺼﻲ ﺑﻪ ﻧﺎﻡ DBAﻣﺠﻤﻮﻋﻪ ﻧﻴﺎﺯﻫﺎﻱ ﺍﻃﻼﻋﺎﺗﻲ ﻛـﻞ ﻣﺤـﻴﻂ ﻋﻤﻠﻴﺎﺗـﻲ ﻣـﻮﺭﺩ ﻧﻈـﺮ ﻣﺪﻳـﺮﻳﺖ ﻛـﻞ ﺳﺎﺯﻣﺎﻥ ﺭﺍ ﺑﺮﺭﺳﻲ ﻣﻲ ﻛﻨﺪ ﻭ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻧﻴﺎﺯﻫﺎﻱ ﺍﻃﻼﻋﺎﺗﻲ ﺗﻤﺎﻡ ﻛﺎﺭﺑﺮﺍﻥ ﻣﺤـﻴﻂ ﻭ ﺿـﻤﻦ ﺍﺳـﺘﻔﺎﺩﻩ ﺍﺯ ﻳـﻚ ﻧـﺮﻡ ﺍﻓﺰﺍﺭ ﺧﺎﺹ ﺑﻪ ﻧﺎﻡ DBMSﻣﺤﻴﻂ ﻭﺍﺣﺪ ﻭ ﻣﺠﺘﻤﻊ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺍﻃﻼﻋﺎﺕ ﺍﻳﺠﺎﺩ ﻣﻲ ﺷـﻮﺩ.ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻣﺜﺎﻝ ﻣﻄﺮﺡ ﺷﺪﻩ ،ﺭﻛﻮﺭﺩ ﻧﻮﻉ ﺩﺍﻧﺸﺠﻮ ﻓﻘﻂ ﻳﻜﺒﺎﺭ ﺩﺭ ﻓﺎﻳﻞ ﺫﺧﻴﺮﻩ ﻣﻲ ﺷﻮﺩ ﻭﻛﺎﺭﺑﺮﺍﻥ ﻣﺨﺘﻠﻒ ﻫﺮ ﻳﻚ ﻃﺒﻖ ﻧﻴﺎﺯ ﺍﻃﻼﻋﺎﺗﻲ ﺧﻮﺩ ﺍﺯ ﺁﻥ ﺑﻄﻮﺭ ﻣﺸﺘﺮﻙ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﻧﻤﺎﻳﻨﺪ .ﺩﺭ ﺭﻛﻮﺭﺩ ﻧﻮﻉ ﺩﺍﻧﺸﺠﻮ ،ﺗﻤﺎﻡ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﻛﺎﺭﺑﺮﺍﻥ ﻣﺨﺘﻠﻒ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ ﻭ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻣﺸﺘﺮﻙ ،ﺗﻨﻬﺎ ﻳﻜﺒﺎﺭ ﺩﺭ ﺭﻛﻮﺭﺩ ﻣﻨﻈﻮﺭ ﻣﻲ ﺷﻮﻧﺪ. ﺩﺭ ﺍﻳـﻦ ﺭﻭﺵ ﻫـﺮ ﻛﺎﺭﺑـﺮﻱ ،ﺩﻳـﺪ ﺧـﺎﺹ ﺧـﻮﺩ ﺭﺍ ﻧﺴـﺒﺖ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺩﺭ ﺑﺎﻧﻚ ﺩﺍﺭﺩ .ﺩﻳﺪ ﻛﺎﺭﺑﺮﺍﻥ ﻣﺨﺘﻠﻒ ﺍﺯ ﻳﻜﺪﻳﮕﺮ ﻣﺘﻔﺎﻭﺕ ﻭ ﺣﺘﻲ ﮔﺎﻩ ﺑﺎ ﻫﻢ ﻣﺘﻀﺎﺩ ﺍﺳﺖ. U1
ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ
D
DB: Fils
A M
AP1
B M
ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺁﻣﻮﺯﺵ
U2 AP2
ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺍﻣﻮﺭ ﺩﺍﻧﺸﺠﻮﻳﻲ
S AP3
U3 ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺍﻣﻮﺭ ﻣﺎﻟﻲ
ﻣﺤﻴﻂ ﻓﻴﺰﻳﻜﻲ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﻣﺠﺘﻤﻊ ﻭ ﻭﺍﺣﺪ
ﻣﺸﺨﺼﻪ ﻫﺎﻱ ﺍﻳﻦ ﺭﻭﺵ : – ١ﺩﺍﺩﻩ ﻫـﺎﻱ ﻣﺠـﺘﻤﻊ :ﻛـﻞ ﺩﺍﺩﻩ ﻫـﺎ ﺑﺼﻮﺭﺕ ﻳﻚ ﺑﺎﻧﻚ ﻣﺠﺘﻤﻊ ﺩﻳﺪﻩ ﻣﻲ ﺷﻮﻧﺪ ﻭ ﺍﺯ ﻃﺮﻳﻖ DBMSﺑﺎ ﺁﻧﻬﺎ ﺍﺭﺗﺒﺎﻁ ﺑﺮﻗﺮﺍﺭ ﻣﻲ ﺷﻮﺩ. – ٢ﻋـﺪﻡ ﻭﺍﺑﺴﺘﮕﻲ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻓﺎﻳﻠﻬﺎ :ﺯﻳﺮﺍ DBMSﺧﻮﺩ ﺑﻪ ﻣﺴﺎﺋﻞ ﻓﺎﻳﻠﻴﻨﮓ ﻣﻲ ﭘﺮﺍﺯﺩ ﻭ ﻛﺎﺭﺑﺮﺍﻥ ﺩﺭ ﻣﺤﻴﻂ ﺍﻧﺘﺰﺍﻋﻲ ﻫﺴﺘﻨﺪ. – ٣ﺗﻌﺪﺩ ﺷﻴﻮﻩ ﻫﺎﻱ ﺩﺳﺘﻴﺎﺑﻲ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎ – ٤ﻋﺪﻡ ﻭﺟﻮﺩ ﻧﺎﺳﺎﺯﮔﺎﺭﻱ ﺩﺭ ﺩﺍﺩﻩ ﻫﺎ – ٥ﺍﺷﺘﺮﺍﻛﻲ ﺑﻮﺩﻥ ﺩﺍﺩﻩ ﻫﺎ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤ /
– ٦ﺍﻣﻜﺎﻥ ﺗﺮﻣﻴﻢ ﺩﺍﺩﻩ ﻫﺎ – ٧ﻛﺎﻫﺶ ﺍﻓﺰﻭﻧﮕﻲ – ٨ﻛﺎﻫﺶ ﺯﻣﺎﻥ ﺗﻮﻟﻴﺪ ﺳﻴﺴﺘﻢ ﻫﺎ – ٩ﺍﻣﻜﺎﻥ ﺍﻋﻤﺎﻝ ﺿﻮﺍﺑﻂ ﺩﻗﻴﻖ ﺍﻳﻤﻨﻲ -٢-١ﻋﻨﺎﺻﺮ ﺍﺻﻠﻲ ﺗﺸﻜﻴﻞ ﺩﻫﻨﺪﻩ ﻣﺤﻴﻂ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ: ﻣﺤﻴﻂ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ،ﻧﻈﻴﺮ ﻫﺮ ﻣﺤﻴﻂ ﺩﻳﮕﺮ ﺫﺧﻴﺮﻩ ﻭ ﺑﺎﺯﻳﺎﺑﻲ ،ﺍﺯ ﻋﻨﺎﺻﺮ ﺯﻳﺮ ﺗﺸﻜﻴﻞ ﻣﻲ ﺷﻮﺩ:
– ١ﺳﺨﺖ ﺍﻓﺰﺍﺭ
ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﺳﻴﺴﺘﻢ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺕ
– ٢ﻧﺮﻡ ﺍﻓﺰﺍﺭ
ﺑﺮﻧﺎﻣﻪ ﻛﺎﺭﺑﺮﺩﻱ
– ٣ﻛﺎﺭﺑﺮ – ٤ﺩﺍﺩﻩ
Data
ﻛﺎﺭﺑﺮﺍﻥ – ١-٢-١ﺳﺨﺖ ﺍﻓﺰﺍﺭ : ﺳﺨﺖ ﺍﻓﺰﺍﺭ ﻣﺤﻴﻂ ﺑﺎﻧﻜﻲ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺗﻘﺴﻴﻢ ﺑﻨﺪﻱ ﻧﻤﻮﺩ: ﺍﻟﻒ -ﺳﺨﺖ ﺍﻓﺰﺍﺭ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺩﺍﺩﻩ ﻫﺎ ﻻ ﺑﺮﺍﻱ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺩﺍﺩﻩ ﻫﺎ ﺍﺯ ﺩﻳﺴﻜﻬﺎﻱ ﺳﺮﻳﻊ ﺑﺎ ﻇﺮﻓﻴﺖ ﺑﺎﻻ ﻣـﻨﻈﻮﺭ ﻫﻤـﺎﻥ ﺭﺳـﺎﻧﻪ ﻫـﺎﻱ ﺫﺧﻴـﺮﻩ ﺳـﺎﺯﻱ ﺍﺳـﺖ ﻛـﻪ ﻣﻌﻤﻮ ﹰ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ. ﺏ -ﺳﺨﺖ ﺍﻓﺰﺍﺭ ﭘﺮﺩﺍﺯﺷﻲ ﻣـﻨﻈﻮﺭ ﻫﻤـﺎﻥ ﻛﺎﻣﭙﻴﻮﺗﺮ ﻳﺎ ﻣﺎﺷﻴﻦ ﺍﺳﺖ .ﻣﺎﺷﻴﻨﻬﺎﻱ ﺧﺎﺹ ﺑﺮﺍﻱ ﻣﺤﻴﻄﻬﺎﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻧﻴﺰ ﻃﺮﺍﺣﻲ ﻭ ﺗﻮﻟﻴﺪ
ﺷﺪﻩ ﺍﻧﺪ
ﻛـﻪ ﺑـﻪ ﻧـﺎﻡ DBMﻣﺎﺷـﻴﻨﻬﺎﻱ ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗـﻲ ﻧﻴﺰ ﺧﻮﺍﻧﺪﻩ ﻣﻲ ﺷﻮﻧﺪ .ﺍﻳﻦ ﻣﺎﺷﻴﻨﻬﺎ ﺍﺯ ﻧﻈﺮ ﻣﻌﻤﺎﺭﻱ ،ﺣﺎﻓﻈﻪ ﺍﺻﻠﻲ ...،ﻭ ﺳﺎﻳﺮ ﺍﺟﺰﺍﺀ ﺍﺯ ﻭﻳﮋﮔﻴﻬﺎ ﻭ ﺟﻨﺒﻪ ﻫﺎﻳﻲ ﺑﺮﺧﻮﺭﺩﺍﺭﻧﺪ ﻛﻪ ﺷﺮﺡ ﺁﻥ ﺩﺭ ﺍﻳﻦ ﺟﺰﻭﻩ ﻧﻤﻲ ﮔﻨﺠﺪ. ﺝ -ﺳﺨﺖ ﺍﻓﺰﺍﺭ ﺍﺭﺗﺒﺎﻃﻲ ﻣﻨﻈﻮﺭ ﻣﺠﻤﻮﻋﻪ ﺍﻣﻜﺎﻧﺎﺕ ﺳﺨﺖ ﺍﻓﺰﺍﺭﻱ ﺍﺳﺖ ﻛﻪ ﺑﺮﺍﻱ ﺑﺮﻗﺮﺍﺭﻱ ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﻛﺎﻣﭙﻴﻮﺗﺮ ﻭ ﺩﺳﺘﮕﺎﻫﻬﺎﻱ ﺟﺎﻧﺒﻲ ﻭ ﻧﻴﺰ ﺑﻴﻦ ﺩﻭ ﻛﺎﻣﭙﻴﻮﺗـﺮ ﻳـﺎ ﺑﻴﺸـﺘﺮ ﺑﻜـﺎﺭ ﮔﺮﻓﺘﻪ ﻣﻲ ﺷﻮﻧﺪ ،ﺍﻋﻢ ﺍﺯ ﺍﻳﻨﻜﻪ ﺍﺭﺗﺒﺎﻁ ﻧﺰﺩﻳﻚ ﺑﺎﺷﺪ ﻭ ﻳﺎ ﺍﺭﺗﺒﺎﻁ ﺩﻭﺭ .ﺳﺨﺖ ﺍﻓﺰﺍﺭ ﺍﺭﺗﺒﺎﻃﻲ ﺧﺎﺹ ﻣﺤﻴﻂ ﻫﺎﻱ ﺑﺎﻧﻜﻲ ﻧﻴﺴﺖ ﻭ ﺩﺭ ﻫﺮ ﻣﺤﻴﻂ ﻏﻴﺮ ﺑﺎﻧﻜﻲ ﻧﻴﺰ ﻣﻤﻜﻦ ﺍﺳﺖ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺎﺷﻨﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥ /
– ٢-٢-١ﻧﺮﻡ ﺍﻓﺰﺍﺭ: ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﻣﺤﻴﻂ ﺑﺎﻧﻜﻲ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﻪ ﺩﻭ ﺩﺳﺘﻪ ﺗﻘﺴﻴﻢ ﻧﻤﻮﺩ: –١-٢-٢-١ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﻛﺎﺭﺑﺮﺩﻱ: ﻧﺮﻡ ﺍﻓﺰﺍﺭﻱ ﺍﺳﺖ ﻛﻪ ﻛﺎﺭﺑﺮ ﺑﺎﻳﺪ ﺑﺮﺍﻱ ﺗﻤﺎﺱ ﺑﺎ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺁﻣﺎﺩﻩ ﻛﻨﺪ. -٢-٢-٢-١ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﺳﻴﺴﺘﻤﻲ: ﺑﻴﻦ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻓﻴﺰﻳﻜﻲ ﻛﻪ ﺩﺍﺩﻩ ﻫﺎ ﺑﺼﻮﺭﺕ ﻓﻴﺰﻳﻜﻲ ﺩﺭ ﺁﻥ ﺫﺧﻴﺮﻩ ﻣﻲ ﺷﻮﻧﺪ ﻭ ﻛﺎﺭﺑﺮﺍﻥ ﺳﻴﺴﺘﻢ ،ﻻﻳﻪ ﺍﻱ ﺍﺯ ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﻣﻮﺳـﻮﻡ ﺑـﻪ ﻣﺪﻳـﺮ ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗـﻲ ﻗﺮﺍﺭ ﺩﺍﺭﺩ .ﺳﻴﺴﺘﻢ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻧﺮﻡ ﺍﻓﺰﺍﺭﻱ ﺍﺳﺖ ﻛﻪ ﺑﻪ ﻛﺎﺭﺑﺮﺍﻥ ﺍﻣﻜﺎﻥ ﻣﻲ ﺩﻫـﺪ ﻛـﻪ ﭘﺎﻳﮕـﺎﻩ ﺍﺯ ﺩﻳـﺪ ﺧـﻮﺩ ﺭﺍ ﺗﻌﺮﻳﻒ ﻛﻨﻨﺪ ﻭ ﺑﻪ ﭘﺎﻳﮕﺎﻩ ﺧﻮﺩ ﺩﺳﺘﻴﺎﺑﻲ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ ،ﺑﺎ ﭘﺎﻳﮕﺎﻩ ﺧﻮﺩ ﻛﺎﺭ ﻛﻨﻨﺪ ﻭ ﺭﻭﻱ ﺁﻥ ﻛﻨﺘﺮﻝ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ. -٣-٢-١ﻛﺎﺭﺑﺮﺍﻥ: ﺍﺯ ﻧﻈﺮ ﻭﻇﺎﻳﻔﻲ ﻛﻪ ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﻨﺪ ﺑﻪ ﺩﻭ ﺩﺳﺘﻪ ﻛﻠﻲ ﺗﻘﺴﻴﻢ ﻣﻲ ﺷﻮﻧﺪ: ﺍﻟﻒ :ﻛﺎﺭﺑﺮﺍﻥ ﺑﺎ ﻧﻘﺶ ﻣﺪﻳﺮﻳﺘﻲ )(DBA
ﺏ :ﻛﺎﺭﺑـﺮﺍﻥ ﺑـﺎ ﻧﻘـﺶ ﺍﺳـﺘﻔﺎﺩﻩ ﻛﻨـﻨﺪﻩ ﻛـﻪ ﺑـﻪ ﺩﻭ ﺩﺳـﺘﻪ :ﻛﺎﺭﺑﺮﺍﻥ ﺗﻮﻟﻴﺪ ﻛﻨﻨﺪﻩ ﺳﻴﺴﺘﻢ )ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﺎﻥ ﻛﺎﺭﺑﺮﺩﻱ( ﻭ ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨـﻨﺪﮔﺎﻥ ﻧﻬﺎﻳـﻲ ﺳﻴﺴـﺘﻢ ﻣـﻲ ﺗـﻮﺍﻧﺪ ﺗﻘﺴـﻴﻢ ﮔـﺮﺩﺩ .ﺑـﺮﻧﺎﻣﻪ ﻧﻮﻳﺴـﺎﻥ ﻛﺎﺭﺑـﺮﺩﻱ ﻣﺴـﺌﻮﻝ ﻧﻮﺷـﺘﻦ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺑﻪ ﺯﺑﺎﻥ ﺳﻄﺢ ﺑﺎﻻ ﻳﺎ ﺯﺑﺎﻧﻬﺎﻱ ﻧﺴﻞ ﭼﻬﺎﺭﻡ ) (4GLﻫﺴﺘﻨﺪ. – ٤-٢-١ﺩﺍﺩﻩ: ﻣـﻨﻈﻮﺭ ﺩﺍﺩﻩ ﻫﺎﻳـﻲ ﺍﺳـﺖ ﻛـﻪ ﺩﺭ ﻣـﻮﺭﺩ ﺍﻧﻮﺍﻉ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻱ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﻭ ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﺁﻧﻬﺎ ﻣﻲ ﺑﺎﺷﻨﺪ ﻛﻪ ﺍﺻﻄﻼﺣﹰﺎ ﺑﻪ ﺁﻧﻬـﺎ ﺩﺍﺩﻩ ﻫـﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﻭ ﻳﺎ ﺩﺍﺩﻩ ﻫﺎﻱ ﭘﺎﻳﺎ ﮔﻔﺘﻪ ﻣﻲ ﺷﻮﺩ .ﺩﺍﺩﻩ ﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻧﻲ ﺩﺭ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﺩﺭ ﺑﺎﻻﺗﺮﻳﻦ ﺳـﻄﺢ ﺍﻧﺘـﺰﺍﻉ ﻣﺪﻟﺴـﺎﺯﻱ ﻣﻌﻨﺎﻳـﻲ ﺷـﻮﻧﺪ .ﻣﻔﺎﻫـﻴﻢ ﺩﺍﺩﻩ ﻫـﺎ ﺩﺭ ﻫـﺮ ﻣﺤـﻴﻂ ﺑﻪ ﻛﻤﻚ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎ ﻭ ﺍﺭﺗﺒﺎﻃﺎﺕ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻴﺸﻮﻧﺪ . ﺍﻧﺘﺨﺎﺏ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ : ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ : ﻋﺒﺎﺭﺗﺴـﺖ ﺍﺯ ﻣﻔﻬﻮﻡ ﻛﻠﻲ ﺷﻲﺀ ﭘﺪﻳﺪﻩ ﻭ ﺑﻄﻮﺭ ﻛﻠﻲ ﻫﺮ ﺁﻧﭽﻪ ﺍﺯ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﻛﻪ ﻣﻲ ﺧﻮﺍﻫﻴﻢ ﺩﺭ ﻣﻮﺭﺩﺵ ﺍﻃﻼﻉ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ .ﻣﺜﺎﻝ :ﺩﺍﻧﺸﻜﺪﻩ ،ﺩﺭﺱ ،ﺩﺍﻧﺸﺠﻮ ،ﮔﺮﻭﻩ ﺁﻣﻮﺯﺷﻲ . ﺩﺭ ﻫـﺮ ﻣﺤـﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺍﻧﻮﺍﻉ ﻣﺨﺘﻠﻒ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ .ﻃﺮﺍﺡ ﭘﺎﻳﮕﺎﻩ ﭘﺲ ﺍﺯ ﻣﻄﺎﻟﻌﻪ ﺩﻗﻴﻖ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ،ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻱ ﻣﺤﻴﻂ ﺭﺍ ﺗﻌﻴﻴﻦ ﻣﻲ ﻛﻨﺪ ﻭ ﺍﻳﻦ ﺍﻭﻟﻴﻦ ﻗﺪﻡ ﺩﺭ ﻃﺮﺍﺣﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﺍﺳﺖ. ﺗـﻮﺟﻪ :ﺗﺸـﺨﻴﺺ ﺩﺭﺳـﺖ ﻣﻮﺟـﻮﺩﻳﺖ ﻫﺎ ﻭ ﺷﻨﺎﺳﺎﻳﻲ ﺭﻭﺍﺑﻂ ﺑﻴﻦ ﺁﻧﻬﺎ ﻗﺒﻞ ﺍﺯ ﻫﺮ ﭼﻴﺰ ﺑﺴﺘﮕﻲ ﺑﻪ ﺍﻳﻦ ﺩﺍﺭﺩ ﻛﻪ ﺩﺭ ﻣﻮﺭﺩ ﭼﻪ ﭘﺪﻳـﺪﻩ ﻫﺎﻳـﻲ ﭼـﻪ ﺍﻃﻼﻋﺎﺗـﻲ ﺭﺍ ﻣـﻲ ﺧﻮﺍﻫـﻴﻢ ﺩﺍﺷـﺘﻪ ﺑﺎﺷـﻴﻢ .ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻳـﻲ ﺍﻧـﺘﺨﺎﺏ ﻣـﻲ ﺷﻮﻧﺪ ﻛﻪ ﻧﻴﺎﺯﻫﺎﻱ ﺍﻃﻼﻋﺎﺗﻲ ﻫﻤﻪ ﻛﺎﺭﺑﺮﺍﻥ ﻣﺤﻴﻂ ﻧﺎﻇﺮ ﺑﻪ ﺁﻧﻬﺎ ﺑﺎﺷﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٦ /
ﺻﻔﺎﺕ ﺧﺎﺻﻪ: ﻫـﺮ ﻣﻮﺟـﻮﺩﻳﺖ ﻣﺠﻤـﻮﻋﻪ ﺍﻱ ﺍﺯ ﺻـﻔﺎﺕ ﺧﺎﺻـﻪ ﺍﺳـﺖ ﻛﻪ ﺍﻳﻦ ﻣﺠﻤﻮﻋﻪ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺭﺍ ﻧﻴﺰ ﺑﺎﻳﺪ ﻃﺮﺍﺡ ﺗﻌﻴﻴﻦ ﻛﻨﺪ .ﻫﺮ ﺻﻔﺖ ﺍﺯ ﻧﻈﺮ ﻛﺎﺭﺑﺮﺍﻥ ﻳﻚ ﻧﺎﻡ ،ﻳﻚ ﻧﻮﻉ ﻭ ﻳﻚ ﻣﻌﻨﺎﻱ ﻣﺸﺨﺺ ﺩﺍﺭﺩ . ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ :ﻣﻮﺟﻮﺩﻳﺖ ﻛﺎﺭﻣﻨﺪ ﻣﻲ ﺗﻮﺍﻧﺪ ﺩﺍﺭﺍﻱ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺷﻤﺎﺭﻩ ﻛﺎﺭﻣﻨﺪﻱ ،ﻧﺎﻡ ﻭ ﺣﻘﻮﻕ ﺑﺎﺷﺪ. ﺍﺭﺗﺒﺎﻁ: ﻫـﺮ ﻧـﻮﻉ ﺍﺭﺗـﺒﺎﻁ ﻳﻚ ﻣﻌﻨﺎﻱﻣﺸﺨﺺ ﺩﺍﺭﺩ ﻭ ﺑﺎ ﻳﻚ ﻧﺎﻡ ﺑﻴﺎﻥ ﻣﻲ ﺷﻮﺩﻭ ﻧﻴﺰ ﻣﻲ ﺗﻮﺍﻥ ﮔﻔﺖ ﻛﻪ ﻫﺮ ﻧﻮﻉ ﺍﺭﺗﺒﺎﻁ ،ﻋﻤﻠﻲ ﺍﺳﺖ ﻛﻪ ﺑﻴﻦ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﻭﺟﻮﺩ ﺩﺍﺭﺩ. ﻻ ﺑﺎ ﻳﻚ ﻋﺒﺎﺭﺕ ﻓﻌﻠﻲ ﻫﻤﺮﺍﻩ ﺍﺳﺖ .ﺍﻳﻦ ﺍﺭﺗﺒﺎﻃﺎﺕ ﺍﻧﻮﺍﻉ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎﻱ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺑﺎ ﻳﻜﺪﻳﮕﺮ ﺍﺭﺗﺒﺎﻁ ﺩﺍﺭﻧﺪ ﻛﻪ ﻣﻌﻤﻮ ﹰ ﻛﻪ ﻫﺮ ﻳﻚ ﺳﻤﺎﻧﺘﻴﻚ ﺧﺎﺹ ﺭﺍ ﺩﺍﺭﺩ ﺑﺎﻳﺪ ﺷﻨﺎﺳﺎﻳﻲ ﺷﺪﻩ ﻭ ﺩﺭ ﭘﺎﻳﮕﺎﻩ ﺫﺧﻴﺮﻩ ﺷﻮﻧﺪ. ﻣﺜﺎﻝ - :ﺩﺍﻧﺸﺠﻮ ﺩﺭﺱ ﺭﺍ ﺍﻧﺘﺨﺎﺏ ﻣﻲ ﻛﻨﺪ -ﺩﺭﺱ ﺗﻮﺳﻂ ﺩﺍﻧﺸﺠﻮ ﺍﻧﺘﺨﺎﺏ ﻣﻲ ﺷﻮﺩ
ﺍﻧﺘﺨﺎﺏ ﻣﻲ ﻛﻨﺪ ﺩﺭﺱ
ﺍﻧﺘﺨﺎﺏ ﻣﻲ ﺷﻮﺩ
ﺩﺍﻧﺸﺠﻮ
ﺑﻴﻦ ﺩﻭ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻲ ﺗﻮﺍﻧﺪ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺍﺭﺗﺒﺎﻁ ﻣﺘﻔﺎﻭﺕ ﺑﺎ ﻣﻌﻨﺎﻱ )ﺳﻤﺎﻧﺘﻴﻚ( ﻣﺘﻔﺎﻭﺕ ﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ.ﺍﺭﺗـﺒﺎﻁ ﻣﻤﻜـﻦ ﺍﺳـﺖ ﺑـﻴﻦ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﻭ ﺧﻮﺩﺵ ﺑﺎﺷﺪ .ﻣﺜﺎﻝ :ﻗﻄﻌﻪ Xﺩﺭ ﺳﺎﺧﺖ ﻗﻄﻌﻪ Yﺑﻜﺎﺭﻣﻲ ﺭﻭﺩ .ﺑﻪ ﺍﻳﻦ ﻧﻮﻉ ﺍﺭﺗﺒﺎﻁ ،ﺍﺭﺗﺒﺎﻁ ﺑﺎﺯﮔﺸﺘﻲ ) (Recursive Relationshipﻧﻴﺰ ﮔﻔﺘﻪ ﻣﻲ ﺷﻮﺩ.
ﺩﺍﻧﺸﺠﻮ ﻣﺎﻫﻴﺖ ﺍﺭﺗﺒﺎﻁ: ﺗﻨﺎﻇـﺮ ﺑـﻴﻦ ﻋﻨﺎﺻﺮ ﻣﺠﻤﻮﻋﻪ ﻧﻤﻮﻧﻪ ﻫﺎﻱ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ،ﺑﺎ ﻋﻨﺎﺻﺮ ﻣﺠﻤﻮﻋﻪ ﻧﻤﻮﻧﻪ ﻫﺎﻱ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺩﻳﮕﺮ ﺭﺍ ﻣﺎﻫﻴﺖ ﺍﺭﺗﺒﺎﻁ ﮔﻮﻳﻨﺪ. ﻣﺎﻫﻴﺖ ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﺍﻧﻮﺍﻉ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ: ﺍﺭﺗﺒﺎﻁ
١:١
ﺗﻨﺎﻇﺮ ﻳﻚ ﺑﻪ ﻳﻚ
ﺍﺭﺗﺒﺎﻁ
١:n
ﺗﻨﺎﻇﺮ ﻳﻚ ﺑﻪ ﭼﻨﺪ
ﺍﺭﺗﺒﺎﻁ
n:n
ﺗﻨﺎﻇﺮ ﭼﻨﺪ ﺑﻪ ﭼﻨﺪ
ﻣﺎﻫﻴﺖ ﺍﺭﺗﺒﺎﻁ ﺑﺮ ﻣﺒﻨﺎﻱ ﻗﻮﺍﻋﺪﻣﻌﻨﺎﻳﻲ) ﺳﻤﺎﻧﺘﻴﻚ (ﺣﺎﻛﻢ ﺑﺮ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺗﻌﻴﻴﻦ ﻣﻲ ﺷﻮﺩ.ﻣﺜﺎﻝ :ﺭﺍﺑﻄﻪ ﺑﻴﻦ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎﻱ ﺍﺳﺘﺎﺩ ﻭ ﺩﺭﺱ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﻢ. ﺍﻟﻒ :ﻳﻚ ﺍﺳﺘﺎﺩ ﺣﺪﺍﻛﺜﺮ ﻳﻚ ﺩﺭﺱ ﺭﺍ ﺍﺭﺍﺋﻪ ﻣﻲ ﻛﻨﺪ ﻭ ﻫﺮ ﺩﺭﺱ ﺩﻗﻴﻘﹰﺎ ﺗﻮﺳﻂ ﻳﻚ ﺍﺳﺘﺎﺩ ﺍﺭﺍﺋﻪ ﻣﻲ ﺷﻮﺩ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
F C101
P1 F
F PH108
P2 F
F SH0
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٧ /
ﺍﺭﺍﺋﻪ ﻣﻲ ﻛﻨﺪ
ﺍﺳﺘﺎﺩ
ﺩﺭﺱ
P3 F
ﺍ ﺭﺍﺋﻪ ﻣﻲ ﺷﻮﺩ
ﺏ) :ﺍﺭﺗﺒﺎﻁ ﻳﻚ ﺑﻪ ﭼﻨﺪ( )ﺩﺭﺱ – ﺍﺳﺘﺎﺩ ( ﻳﻚ ﺩﺭﺱ ﻣﻤﻜﻦ ﺍﺳﺖ ﺗﻮﺳﻂ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺍﺳﺘﺎﺩ ﺍﺭﺍﺋﻪ ﺷﻮﺩ ﻭﻟﻲ ﻳﻚ ﺍﺳﺘﺎﺩ ﺣﺪﺍﻛﺜﺮ ﻳﻚ ﺩﺭﺱ ﺭﺍ ﺍﺭﺍﺋﻪ ﻣﻲ ﻛﻨﺪ . ﺝ):ﺍﺭﺗﺒﺎﻁ ﭼﻨﺪ ﺑﻪ ﭼﻨﺪ( : ﻳـﻚ ﺍﺳـﺘﺎﺩ ﻣﻤﻜـﻦ ﺍﺳـﺖ ﺑـﻴﺶ ﺍﺯ ﻳﻚ ﺩﺭﺱ ﺭﺍ ﺍﺭﺍﺋﻪ ﻛﻨﺪ ﻭ ﻳﻚ ﺩﺭﺱ ﻣﻤﻜﻦ ﺍﺳﺖ ﺗﻮﺳﻂ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺍﺳﺘﺎﺩ ﺍﺭﺍﺋﻪ ﺷﻮﺩ. ﺩﺭﺟﻪ ﺍﺭﺗﺒﺎﻁ: ﺗﻌﺪﺍﺩ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻳﻲ ﻛﻪ ﺩﺭ ﺁﻥ ﺍﺭﺗﺒﺎﻁ ﻣﺸﺎﺭﻛﺖ ﺩﺍﺭﻧﺪ ﺩﺭﺟﻪ ﺍﺭﺗﺒﺎﻁ ﻧﺎﻣﻴﺪﻩ ﻣﻲ ﺷﻮﺩ. ﻣﺜﺎﻝ:
ﻗﻄﻌﻪ
ﺍﺭﺗﺒﺎﻁ ﺩﺭﺟﻪ ١ﻳﺎ ﺭﺍﺑﻄﻪ ﺑﺎﺯﮔﺸﺘﻲ: ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ
ﺍﺭﺗﺒﺎﻁ ﺩﺭﺟﻪ :٢
ﺩﺍﻧﺸﺠﻮ
ﺍﺳﺘﺎﺩ
ﺭﺍﻫﻨﻤﺎﻳﻲ ﺗﻤﺮﻳﻦ : -١ﺳﻴﺴﺘﻢ ﺑﺎﻧﻜﻲ ﭼﻪ ﻣﺰﺍﻳﺎﻳﻲ ﺑﺮ ﺳﻴﺴﺘﻢ ﻏﻴﺮ ﺑﺎﻧﻜﻲ ﺩﺍﺭﺩ؟ -٢ﺑﻪ ﻧﻈﺮ ﺷﻤﺎ ﻣﻌﺎﻳﺐ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﭼﻴﺴﺖ؟ -٣ﺗﺤﺖ ﭼﻪ ﺷﺮﺍﻳﻄﻲ ﻭ ﻧﻪ ﻟﺰﻭﻣﺎ ﺑﺎﻳﺪ ﺍﺯ ﺗﻜﻨﻮﻟﻮﮊﻱ ﭘﺎﻳﮕﺎﻫﻲ ﺻﺮﻑ ﻧﻈﺮ ﻛﺮﺩ؟ -٤ﺗﻌﺮﻳﻒ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺭﺍ ﺩﺭ ﺷﺶ ﻣﻨﺒﻊ ﻣﻌﺘﺒﺮ ﺧﺎﺭﺟﻲ ﺑﺮﺭﺳﻲ ﻧﻤﺎﻳﻴﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨ /
ﻓﺼﻞ ﺩﻭﻡ : ﻣــﺪ ﻝ E/R -١-٢ﻣﻘﺪﻣﻪ : ﻳـﻚ ﻣـﺪﻝ ﺩﺍﺩﻩ ﺍﻱ ﻣﺠﻤـﻮﻋﻪ ﺍﻱ ﺍﺯ ﺍﺑـﺰﺍﺭﻫﺎﻱ ﻣﻔﻬﻮﻣـﻲ ﺑـﺮﺍﻱ ﺗﻮﺻـﻴﻒ ﺩﺍﺩﻩ ﻫﺎ ،ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﺩﺍﺩﻩ ﻫﺎ،ﻣﻌﺎﻧﻲ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻣﺤـﺪﻭﺩﻳﺖ ﻫـﺎﻱ ﺁﻧﻬﺎﺳـﺖ .ﺑﻌﺒﺎﺭﺗـﻲ ﻳـﻚ ﺭﻭﺵ ﺗﻔﻜـﺮ ﺩﺭﺑـﺎﺭﻩ ﺩﺍﺩﻩ ﻫﺎ ﻛﻪ ﺑﻪ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﺭﺑﻄﻲ ﻧﺪﺍﺭﺩ.ﺩﺭ ﻳﻚ ﻧﮕﺎﻩ ﻛﻠﻲ ﻣﻴﺘﻮﺍﻥ ﺍﻧﻮﺍﻉ ﻣﺪﻟﻬﺎﻱ ﺩﺍﺩﻩ ﺍﻱ ﺭﺍ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻧﺎﻡ ﺑﺮﺩ : •
ﻣﺪﻟﻬﺎﻱ ﻣﺒﺘﻨﻲ ﺑﺮ ﺍﺷﻴﺎﺀ Object based Logical Models
ﺩﺍﺩﻩ ﻫـﺎ ﺑﺼﻮﺭﺕ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎ ﻛﻪ ﻧﻤﺎﻳﺶ ﺍﺷﻴﺎﺀ ﺩﺭ ﺩﻧﻴﺎﻱ ﻭﺍﻗﻌﻲ ﻣﻴﺒﺎﺷﻨﺪ ﺩﻳﺪﻩ ﻣﻲ ﺷﻮﻧﺪ.ﺍﺯ ﺟﻤﻠﻪ ﺍﻳﻦ ﻣﺪﻟﻬﺎ ﻣﺪﻝ ﺩﺍﺩﻩ ﺍﻱ E/Rﻭ ﻣﺪﻝ ﺷﻲﺀﮔﺮﺍﻳﻲ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﻧﺎﻡ ﺑﺮﺩ. •
ﻣﺪﻟﻬﺎﻱ ﻣﺒﺘﻨﻲ ﺑﺮ ﺭﻛﻮﺭﺩ Record based Logical Models
ﺩﺍﺩﻩ ﻫﺎ ﺩﺭ ﻗﺎﻟﺐ ﺭﻛﻮﺭﺩﻫﺎﻱ ﺛﺎﺑﺖ ﻭ ﻳﺎ ﺑﺎ ﻃﻮﻝ ﻣﺘﻐﻴﻴﺮ ﺩﻳﺪﻩ ﻣﻴﺸﻮﻧﺪ. ﺍﺯ ﺍﻧﻮﺍﻉ ﺩﻳﮕﺮ ﻣﺪﻟﻬﺎﻱ ﺩﺍﺩﻩ ﺍﻱ ﻣﻲ ﺗﻮﺍﻥ ﺑﻪ ﻣﺪﻝ ﻫﺎﻱ ﺩﺍﺩﻩ ﺍﻱ ﺷﺒﻪ ﺳﺎﺧﺘﻴﺎﻓﺘﻪ ،ﻣﺪﻟﻬﺎﻱ ﺷﺒﻜﻪ ﺍﻱ ﻭ ﻣﺪﻟﻬﺎﻱ ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺒﻲ ﺍﺷﺎﺭﻩ ﻧﻤﻮﺩ. ﺍﺯﺟﻤﻠـﻪ ﻣـﺪﻟﻬﺎﻱ ﻣﻨﻄﻘـﻲ ﻣﺒﺘﻨـﻲ ﺑـﺮ ﺍﺷـﻴﺎ ﻣﻲ ﺗﻮﺍﻥ ﻣﺪﻝ E/Rﺭﺍ ﻧﺎﻡ ﺑﺮﺩ .ﺩﺭ ﺳﺎﻝ ١٩٧٦ﻳﻚ ﺩﺍﻧﺸﺠﻮﻱ ﺩﻛﺘﺮﺍﻱ ﻛﺎﻣﭙﻴﻮﺗﺮ ﺩﺍﻧﺸﮕﺎﻩ MITﺑﻪ ﻧﺎﻡ ﭼﻦ ) ( chenﻣﺪﻟﻲ ﺑﺮﺍﻱ ﻃﺮﺍﺣﻲ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﭘﻴﺸﻨﻬﺎﺩ ﻛﺮﺩ ﻛﻪ ﻣﻮﺭﺩ ﺗﻮﺟﻪ ﻋﺎﻡ ﻭﺍﻗﻊ ﺷﺪ .ﻭﻱ ﻣﺪﻝ ﺧـﻮﺩ ﺭﺍ E / Rﻧﺎﻣـﻴﺪ .ﺍﻳـﻦ ﻣـﺪﻝ ﺩﺭ ﻃﻮﻝ ﺯﻣﺎﻥ ﭘﻴﺸﺮﻓﺖ ﻛﺮﺩ ﻭ ﺳﺎﺧﺘﺎﺭﻫﺎﻱ ﺟﺪﻳﺪﻱ ﺑﻪ ﺁﻥ ﺍﻓﺰﻭﺩﻩ ﺷﺪ .ﺩﺭ ﻣﺪﻝ E / Rﻫﺮ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺩﺍﺭﺍﻱ ﺩﻭ ﺑﺨﺶ ﭘﺪﻳﺪﻩ ﻳﺎ ﻣﻮﺟﻮﺩﻳﺖ ﻭ ﺍﺭﺗﺒﺎﻁ ﻣﻲ ﺑﺎﺷﺪ Chen .ﻧﻪ ﺗﻨﻬﺎ ﻣﺪﻝ E / Rﺭﺍ ﻣﻌﺮﻓﻲ ﻧﻤﻮﺩ ﺑﻠﻜﻪ ﻧﻤﻮﺩﺍﺭ ﻣﻮﺟـﻮﺩﻳﺖ ﺭﺍﺑﻄﻪ ﺭﺍ ﻧﻴﺰ ﻣﻄﺮﺡ ﺳﺎﺧﺖ .ﻧﻤﻮﺩﺍﺭ E / Rﺭﻭﺷﻲ ﺑﺮﺍﻱ ﻧﻤﺎﻳﺶ ﺳﺎﺧﺘﺎﺭﻱ ﻣﻨﻄﻘﻲ ﻳﻚ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺑﻪ ﺭﻭﺵ ﺗﺼـﻮﻳﺮﻱ ﺍﺳﺖ .ﺍﻳﻦ ﻧﻤﻮﺩﺍﺭﻫﺎ ﺍﺑﺰﺍﺭﻫﺎﻳﻲ ﺭﺍﺣﺖ ﻭ ﻣﻨﺎﺳﺐ ﺭﺍ ﺑﺮﺍﻱ ﺩﺭﻙ ﺍﺭﺗﺒﺎﻃﺎﺕ ﻣﺎﺑﻴﻦ ﻣﻮﺟﻮﺩﻳﻬﺎ ﻓﺮﺍﻫﻢ ﻣﻲ ﻛﻨﻨﺪ) .ﻳﻚ ﺗﺼﻮﻳﺮ ﮔﻮﻳﺎ ﺗﺮ ﺍﺯ ﻫﺰﺍﺭ ﻛﻠﻤﻪ ﺍﺳﺖ(. ﻻ ﺑﻪ ﺭﻭﺵ ﺭﺳﻢ ﻧﻤﻮﺩﺍﺭﻫﺎﻱ ﺩﺭ ﻭﺍﻗـﻊ ،ﺷﻬﺮﺕ ﻭ ﻣﺤﺒﻮﺑﻴﺖ ﻣﺪﻝ E / Rﺑﻪ ﻋﻨﻮﺍﻥ ﺭﻭﺷﻲ ﺑﺮﺍﻱ ﻃﺮﺍﺣﻲ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺣﺘﻤﺎ ﹰ E / Rﻣﺮﺑﻮﻁ ﻣﻲ ﺷﺪ ﺗﺎ ﺑﻪ ﺟﻨﺒﻪ ﻫﺎﻱ ﺩﻳﮕﺮ ﺁﻥ. – ٢ – ٢ﻧﻤﺎﻳﺶ ﻧﻤﻮﺩﺍﺭﻱ E / R
ﻣـﺪﻝ E/Rﺑﻜﻤـﻚ ﻧﻤـﻮﺩﺍﺭﻱ ﺗﺤـﺖ ﻧـﺎﻡ ﺧـﻮﺩ ﻗﺎﺑـﻞ ﻧﻤﺎﻳﺶ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﺍﻳﻦ ﻧﻤﻮﺩﺍﺭ ﻣﻔﺎﻫﻴﻢ ﻣﺮﺑﻮﻃﻪ ﺑﺎ ﺍﺷﻜﺎﻝ ﻣﺸﺨﺼﻲ ﺗﺮﺳﻴﻢ ﻣﻴﮕﺮﺩﻧﺪ.ﺩﺭ ﺍﺩﺍﻣﻪ ﻫﺮ ﻳﻚ ﺍﺯ ﺍﻳﻦ ﺍﺷﻜﺎﻝ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﻧﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩ /
-١-٢-٢ﻣﻮﺟﻮﺩﻳﺖ: ﻣﻮﺟـﻮﺩﻳﺖ ،ﭼﻴـﺰﻱ ﺍﺳـﺖ ﻛـﻪ ﺑﺼـﻮﺭﺕ ﻣﺘﻤﺎﻳـﺰ ﻗﺎﺑـﻞ ﺷﻨﺎﺳﺎﻳﻲ ﺑﺎﺷﺪ .ﺁﻗﺎﻱ ﭼﻦ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﺭﺍ ﺑﻪ ﺩﻭ ﺩﺳﺘﻪ ﻣﻨﻈﻢ )ﻗﻮﻱ( ﻭ ﺿﻌﻴﻒ ﺩﺳﺘﻪ ﺑﻨﺪﻱ ﻛﺮﺩ. – ١ﻣﻮﺟـﻮﺩﻳﺖ ﻣـﻨﻈﻢ)ﻗـﻮﻱ( :ﻣﻮﺟﻮﺩﻳﺘـﻲ ﺍﺳﺖ ﻛﻪ ﻭﺟﻮﺩﺵ ﻭﺍﺑﺴﺘﻪ ﺑﻪ ﻣﻮﺟﻮﺩﻳﺖ ﺩﻳﮕﺮﻱ ﻧﻴﺴﺖ .ﻣﺜﻞ ﻣﻮﺟﻮﺩﻳﺖ ﺩﺍﻧﺸﺠﻮ ﻭ ﻣﻮﺟﻮﺩﻳﺖ ﺩﺭﺱ ﻛﻪ ﻫﺮﻳﻚ ﺑﻪ ﺗﻨﻬﺎﻳﻲ ﺩﺭ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺩﺍﻧﺸﻜﺪﻩ ﻣﻄﺮﺡ ﻣﻴﺒﺎﺷﻨﺪ. – ٢ﻣﻮﺟـﻮﺩﻳﺖ ﺿﻌﻴﻒ :ﻣﻮﺟﻮﺩﻳﺘﻲ ﺍﺳﺖ ﻛﻪ ﻭﺟﻮﺩﺵ ﻭﺍﺑﺴﺘﻪ ﺑﻪ ﻣﻮﺟﻮﺩﻳﺖ ﺩﻳﮕﺮ ﺍﺳﺖ .ﺑﻄﻮﺭ ﻣﺜﺎﻝ ﻣﻮﺟﻮﺩﻳﺖ ﺍﻋﻀﺎﺀ ﺧﺎﻧـﻮﺍﺩﻩ ﻛﺎﺭﻣـﻨﺪ ﻭﺍﺑﺴﺘﻪ ﺑﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻛﺎﺭﻣﻨﺪ ﻣﻲ ﺑﺎﺷﺪ .ﻭ ﻳﺎ ﻣﻮﺟﻮﺩﻳﺖ ﺁﺛﺎﺭ ﻣﻨﺘﺸﺮﻩ ﺍﺳﺘﺎﺩ ،ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒ ﻣﻮﺟﻮﺩﻳﺖ ﺍﺳﺘﺎﺩ ﺍﺳﺖ. ﺩﺭ ﻧﻤـﻮﺩﺍﺭ E / Rﻣﻮﺟﻮﺩﻳـﺘﻬﺎﻱ ﻗـﻮﻱ ﺑﺼـﻮﺭﺕ ﻳـﻚ ﻣﺴـﺘﻄﻴﻞ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﻧﺪ ﻛﻪ ﻣﺤﺘﻮﺍﻱ ﺁﻥ ﺩﺭ ﺑﺮ ﮔﻴﺮﻧﺪﻩ ﻧﺎﻡ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻮﺭﺩ ﻧﻈﺮ ﺍﺳﺖ .ﺩﺭ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻱ ﺿﻌﻴﻒ ﻣﺮﺯ ﻣﺴﺘﻄﻴﻞ ﺑﺼﻮﺭﺕ ﺩﻭ ﺧﻄﻲ ﺍﺳﺖ.
ﻣﻮﺟﻮﺩﻳﺖ ﻗﻮﻱ
ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒ :-٢-٢-٢ﺻﻔﺎﺕ ﺧﺎﺻﻪ Attributes
ﺩﺭ ﻧﻤـﻮﺩﺍﺭ E/Rﺻـﻔﺎﺕ ﺧﺎﺻـﻪ ﺑﺼﻮﺭﺕ ﺑﻴﻀﻲ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﻧﺪ ﻛﻪ ﻣﺤﺘﻮﺍﻱ ﺁﻥ ﺍﺳﻢ ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﻮﺭﺩ ﻧﻈﺮ ﺭﺍ ﺩﺭ ﺑﺮ ﻣﻲ ﮔﻴﺮﺩ ﻭ ﺑﻪ ﻭﺳﻴﻠﻪ ﺧﻄﻮﻁ ﺗﻮ ﭘﺮ ﺑﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻳﺎ ﺭﺍﺑﻄﻪ ﻣﺮﺑﻮﻁ ﻣﺘﺼﻞ ﻣﻲ ﺷﻮﻧﺪ.
ﺍﺳﻢ ﺻﻔﺖ ﺧﺎﺻﻪ
ﺩﺭ ﻳﻚ ﺗﻘﺴﻴﻢ ﺑﻨﺪﻱ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﻪ ﺷﺮﺡ ﺯﻳﺮ ﺗﻘﺴﻴﻢ ﺑﻨﺪﻱ ﻧﻤﻮﺩ: ﺍﻟﻒ – ﺻﻔﺖ ﺧﺎﺻﻪ ﻛﻠﻴﺪ)ﺷﻨﺎﺳﻪ ﻣﻮﺟﻮﺩﻳﺖ(: ﻳﻚ ﻳﺎ ﭼﻨﺪ ﺻﻔﺖ ﺧﺎﺻﻪ ﻛﻪ ﺩﺭ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻨﺤﺼﺮ ﺑﻪ ﻓﺮﺩ ﺍﺳﺖ. ﺻﻔﺖ ﺧﺎﺻﻪ ﻛﻠﻴﺪ :ﺷﻤﺎﺭﻩ ﺩﺍﻧﺸﺠﻮ
ﻣﺜﺎﻝ :ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ :ﺩﺍﻧﺸﺠﻮ : ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ :ﮔﺮﻭﻩ ﺩﺭﺳﻲ :
ﺻﻔﺖ ﺧﺎﺻﻪ ﻛﻠﻴﺪ :ﺷﻤﺎﺭﻩ ﺩﺭﺱ ،ﺷﻤﺎﺭﻩ ﮔﺮﻭﻩ ﻭ ﺗﺮﻡ
ﺑﺮﺍﻱ ﻣﺸﺨﺺ ﻛﺮﺩﻥ ﻛﻠﻴﺪ ﺩﺭ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﺯﻳﺮ ﺻﻔﺖ ﻳﺎ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻛﻠﻴﺪ ﺧﻂ ﻛﺸﻴﺪﻩ ﻣﻲ ﺷﻮﺩ. ﺏ – ﺻﻔﺖ ﺧﺎﺻﻪ ﺳﺎﺩﻩ /ﻣﺮﻛﺐ: •
ﺻﻔﺖ ﺧﺎﺻﻪ ﺳﺎﺩﻩ ﺻﻔﺘﻲ ﺍﺳﺖ ﻛﻪ ﺑﻪ ﺍﺟﺰﺍﺀ ﻛﻮﭼﻜﺘﺮ ﺗﺠﺰﻳﻪ ﭘﺬﻳﺮ ﻧﺒﺎﺷﺪ.
•
ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺮﻛﺐ ﺻﻔﺘﻲ ﺍﺳﺖ ﻛﻪ ﺑﻪ ﺍﺟﺰﺍﺀ ﻛﻮﭼﻜﺘﺮ ﺗﺠﺰﻳﻪ ﭘﺬﻳﺮ ﺑﺎﺷﺪ.
ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ :ﺻﻔﺖ ﺧﺎﺻﻪ ﺁﺩﺭﺱ ﻣﻲ ﺗﻮﺍﻧﺪ ﺑﻪ ﻗﺴﻤﺘﻬﺎﻳﻲ ﻧﻈﻴﺮ ﺷﻬﺮ ،ﻛﻮﭼﻪ ،ﺧﻴﺎﺑﺎﻥ … ﺗﻘﺴﻴﻢ ﺷﻮﺩ. ﺷﻬﺮ
ﻛﻮﭼﻪ
ﺧﻴﺎﺑﺎﻥ
ﺁﺩﺭﺱ
ﭘﻼﻙ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠ /
ﻧﻜﺘﻪ :ﺩﺭ ﻣﺪﻝ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺭﺍﺑﻄﻪ ﺍﻱ ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺮﻛﺐ ﺟﺎﻳﻲ ﻧﺪﺍﺭﺩ. Single Valued / Multi Valued
ﺝ– ﺻﻔﺖ ﺧﺎﺻﻪ ﺗﻚ ﻣﻘﺪﺍﺭﻱ /ﭼﻨﺪ ﻣﻘﺪﺍﺭﻱ
ﺻـﻔﺎﺗﻲ ﻛـﻪ ﻓﻘـﻂ ﻳﻚ ﻣﻘﺪﺍﺭ ﺭﺍ ﺩﺭ ﻫﺮ ﻟﺤﻈﻪ ﺍﺯ ﺯﻣﺎﻥ ﺑﻪ ﺧﻮﺩ ﺍﺧﺘﺼﺎﺹ ﺩﻫﻨﺪ ﺑﻪ ﺻﻔﺎﺕ ﺗﻚ ﻣﻘﺪﺍﺭﻱ ﻣﻌﺮﻭﻓﻨﺪ .ﺑﻪ ﻋﻨﻮﺍﻥ ﻣـﺜﺎﻝ ﺷـﻤﺎﺭﻩ ﺩﺍﻧﺸـﺠﻮﻳﻲ ،ﺗـﺎﺭﻳﺦ ﺗـﻮﻟﺪ ﺗـﻚ ﻣﻘـﺪﺍﺭﻱ ﻫﺴﺘﻨﺪ.ﺍﮔﺮ ﺑﺮﺍﻱ ﻳﻚ ﺻﻔﺖ ﺧﺎﺻﻪ ﭼﻨﺪﻳﻦ ﻣﻘﺪﺍﺭ ﺑﺘﻮﺍﻧﺪ ﻗﺮﺍﺭ ﮔﻴﺮﺩ ﺻﻔﺖ ﺧﺎﺻﻪ ﭼﻨﺪ ﻣﻘﺪﺍﺭﻱ ﻧﺎﻣﻴﺪﻩ ﻣﻲ ﺷﻮﺩ. ﺑﻄـﻮﺭ ﻣـﺜﺎﻝ :ﺻـﻔﺖ ﺧﺎﺻﻪ ﻣﺪﺭﻙ ﻭ ﻳﺎ ﺗﻠﻔﻦ ﺑﺮﺍﻱ ﺍﺳﺘﺎﺩ ﭼﻨﺪ ﻣﻘﺪﺍﺭﻱ ﻣﺤﺴﻮﺏ ﻣﻲ ﺷﻮﺩ .ﺯﻳﺮﺍ ﻳﻚ ﺍﺳﺘﺎﺩ ﻣﻲ ﺗﻮﺍﻧﺪ ﺩﺍﺭﺍﻱ ﭼـﻨﺪ ﻣـﺪﺭﻙ ﻭ ﻳـﺎ ﺗﻠﻔـﻦ ﻣﺨـﺘﻠﻒ ﺑﺎﺷﺪ .ﺩﺭ ﻧﻤﻮﺩﺍﺭ E / Rﺑﺮﺍﻱ ﺻﻔﺖ ﺧﺎﺻﻪ ﭼﻨﺪ ﻣﻘﺪﺍﺭﻱ ﺍﺯ ﺑﻴﻀﻲ ﺩﻭ ﺧﻄﻲ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ. ﺩ– ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺸﺘﻖ )ﺍﺳﺘﻨﺘﺎﺟﻲ( ]ﺩﺍﺭﺍﻱ ﻣﻘﺪﺍﺭ ﻣﺤﺎﺳﺒﻪ ﺷﺪﻧﻲ[
ﺻﻔﺘﻲ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﻣﻮﺟﻮﺩﻳﺖ ﻭﺟﻮﺩ ﺧﺎﺭﺟﻲ ﻧﺪﺍﺭﺩ ﻭﻟﻲ ﺩﺭ ﺻﻮﺭﺕ ﻟﺰﻭﻡ ﻣﻲ ﺗﻮﺍﻥ ﺁﻥ ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﺩ. ﻣﺜﺎﻝ :ﻣﻮﺟﻮﺩﻳﺖ :ﺍﺳﺘﺎﺩ ،ﺻﻔﺖ ﺧﺎﺻﻪ :ﺗﺎﺭﻳﺦ ﺗﻮﻟﺪ ،ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺸﺘﻖ :ﺳﻦ ﺩﺭ ﻧﻤﻮﺩﺍﺭ ERﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺸﺘﻖ ﺑﺎ ﻳﻚ ﺑﻴﻀﻲ ﺑﺎ ﻣﺮﺯ ﻧﻘﻄﻪ ﭼﻴﻦ ﻣﺸﺨﺺ ﻣﻲ ﺷﻮﺩ. ﻧﻜﺘﻪ :ﺗﺼﻤﻴﻢ ﮔﻴﺮﻱ ﺩﺭ ﻣﻮﺭﺩ ﺻﻔﺖ ﻣﺸﺘﻖ ﺩﺭ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﺑﻌﻬﺪﻩ ﻃﺮﺍﺡ ﺍﺳﺖ. ﻩ -ﺻﻔﺖ ﺧﺎﺻﻪ ﻫﻴﭽﻤﻘﺪﺍﺭ ﭘﺬﻳﺮ : ﻫـﻴﭽﻤﻘﺪﺍﺭ ﻳﻌﻨﻲ ﻳﻚ ﻣﻘﺪﺍﺭ ﻧﺎﺷﻨﺎﺧﺘﻪ ﻭ ﻳﺎ ﻣﻘﺪﺍﺭ ﻏﻴﺮ ﻗﺎﺑﻞ ﺍﻋﻤﺎﻝ .ﺍﮔﺮ ﻣﻘﺪﺍﺭ ﻳﻚ ﺻﻔﺖ ﺩﺭ ﻳﻚ ﻳﺎ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﻧﻤﻮﻧﻪ ﺍﺯ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺑﺮﺍﺑﺮ ﻫﻴﭽﻤﻘﺪﺍﺭ ﺑﺎﺷﺪ ﺁﻥ ﺻﻔﺖ ﺧﺎﺻﻪ ﻫﻴﭽﻤﻘﺪﺍﺭ ﭘﺬﻳﺮ ﺍﺳﺖ. •
ﻣﺜﺎﻝ :ﺷﻤﺎﺭﻩ ﺗﻠﻔﻦ ﻳﻚ ﻧﻤﻮﻧﻪ ﺍﺳﺘﺎﺩ ﻣﻤﻜﻦ ﺍﺳﺖ ﺩﺭ ﺩﺳﺖ ﻧﺒﺎﺷﺪ.
•
ﻧﺎﻡ ﺍﺳﺘﺎﺩ ﺩﺭ ﻳﻚ ﺑﺮﻧﺎﻣﻪ ﺩﺭﺳﻲ ﺗﺮﻡ ﻣﻤﻜﻦ ﺍﺳﺖ ﻫﻨﻮﺯ ﺍﻋﻼﻡ ﻧﺸﺪﻩ ﺑﺎﺷﺪ.
ﺗﻮﺟﻪ :ﺩﺭ ﻧﻤﻮﺩﺍﺭ E/Rﺍﻳﻦ ﺧﺎﺻﻴﺖ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻧﻤﻲ ﺷﻮﺩ. :-٣-٢-٢ﺍﺭﺗﺒﺎﻁ: ﻫﺮ ﺍﺭﺗﺒﺎﻁ ﺑﺼﻮﺭﺕ ﻳﻚ ﻟﻮﺯﻱ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﻣﺤﺘﻮﺍﻱ ﺁﻥ ﺩﺭ ﺑﺮ ﮔﻴﺮﻧﺪﻩ ﻧﺎﻡ ﻧﻮﻉ ﺭﺍﺑﻄﻪ ﻣﻮﺭﺩ ﻧﻈﺮ ﺍﺳﺖ. ﺩﺭ ﻧﻤﻮﺩﺍﺭ ERﺍﺭﺗﺒﺎﻁ ﺑﺎ ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒ ﺑﺼﻮﺭﺕ ﻟﻮﺯﻱ ﺩﻭ ﺧﻄﻲ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ. ﺍﺭﺗﺒﺎﻁ
ﺍﺭﺗﺒﺎﻁ ﺑﺎ ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒ
ﻋﻨﺼـﺮﻫﺎﻱ ﻫﺮ ﺭﺍﺑﻄﻪ )ﺷﺎﻣﻞ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻭ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎ( ﺑﻮﺳﻴﻠﻪ ﺧﻄﻮﻁ ﭘﺮ ﺑﻪ ﺭﺍﺑﻄﻪ ﻣﺮﺑﻮﻃﻪ ﻭﺻﻞ ﻣﻲ ﺷﻮﻧﺪ .ﻫﺮ ﺧﻂ ﺍﺭﺗﺒﺎﻃﻲ ﺑﻴﻦ ﻣﻮﺟﻮﺩﻳﺖ ﻭ ﺭﺍﺑﻄﻪ ﺩﺍﺭﺍﻱ ﺑﺮﭼﺴﺐ ١ﻳﺎ nﻣﻲ ﺑﺎﺷﺪ ﻛﻪ ﻣﺎﻫﻴﺖ ﺍﺭﺗﺒﺎﻁ ﺭﺍ ﻣﺸﺨﺺ ﻣﻲ ﻛﻨﺪ. ﺩﺍﻧﺸﺠﻮ
ﺍﻧﺘﺨﺎﺏ
ﺣﺬﻑ
ﺩﺭﺱ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١ /
-١-٣-٢-٢ﻭﺿﻊ ﻣﺸﺎﺭﻛﺖ ﺩﺭ ﺍﺭﺗﺒﺎﻁ ﺍﻧـﻮﺍﻉ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻳـﻲ ﻛـﻪ ﺑـﻴﻦ ﺁﻧﻬـﺎ ﺍﺭﺗـﺒﺎﻁ ﺑﺮﻗـﺮﺍﺭ ﺍﺳـﺖ ﺷـﺮﻛﺖ ﻛﻨﻨﺪﮔﺎﻥ ﺁﻥ ﺍﺭﺗﺒﺎﻁ ﻧﺎﻡ ﺩﺍﺭﻧﺪ .ﻣﺸﺎﺭﻛﺖ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺩﺭ ﻳﻚ ﻧﻮﻉ ﺍﺭﺗﺒﺎﻁ ﻣﻤﻜﻦ ﺍﺳﺖ ﺍﻟﺰﺍﻣﻲ )ﻛﺎﻣﻞ( ﻳﺎ ﻏﻴﺮﺍﻟﺰﺍﻣﻲ )ﻧﺎﻛﺎﻣﻞ( ﺑﺎﺷﺪ. ﻣﺸـﺎﺭﻛﺖ ﻳـﻚ ﻧـﻮﻉ ﻣﻮﺟـﻮﺩﻳﺖ ﺩﺭ ﻳـﻚ ﻧﻮﻉ ﺍﺭﺗﺒﺎﻁ ﺭﺍ ﺍﻟﺰﺍﻣﻲ ﮔﻮﻳﻨﺪ ﺍﮔﺮ ﺗﻤﺎﻡ ﻧﻤﻮﻧﻪ ﻫﺎﻱ ﺁﻥ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺩﺭ ﺁﻥ ﺑﺎﻳﺪ ﺩﺭ ﺍﺭﺗﺒﺎﻁ ﺷﺮﻛﺖ ﻛﻨﻨﺪ.ﺩﺭ ﻏﻴﺮ ﺍﻳﻨﺼﻮﺭﺕ ﻣﺸﺎﺭﻛﺖ ﻏﻴﺮ ﺍﻟﺰﺍﻣﻲ )ﺍﺧﺘﻴﺎﺭﻱ( ﺍﺳﺖ. ﻣـﺜﺎﻝ :ﻣﺸﺎﺭﻛﺖ ﺩﺍﻧﺸﺠﻮ ﺩﺭ ﺍﺭﺗﺒﺎﻁ ﺍﻧﺘﺨﺎﺏ ﺍﻟﺰﺍﻣﻲ ﺍﺳﺖ ﻭﻟﻲ ﻣﺸﺎﺭﻛﺖ ﺩﺍﻧﺸﺠﻮ ﺩﺭ ﺍﺭﺗﺒﺎﻁ ﺣﺬﻑ ﺩﺭﺱ ﺍﻟﺰﺍﻣﻲ ﻧﻴﺴﺖ ﺯﻳﺮﺍ ﻟﺰﻭﻣﺎ ﻫﻤﻪ ﺩﺍﻧﺸﺠﻮﻳﺎﻥ ﺩﺭﺱ ﺭﺍ ﺣﺬﻑ ﻧﻤﻴﻜﻨﻨﺪ .ﺩﺭ ﻧﻤﻮﺩﺍﺭ E/Rﻣﺸﺎﺭﻛﺖ ﺍﻟﺰﺍﻣﻲ ﺑﺎ ﺩﻭﺧﻂ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﻴﺸﻮﺩ. ﺩﺍﻧﺸﺠﻮ
ﺍﻧﺘﺨﺎﺏ
ﺩﺭﺱ
ﺣﺬﻑ :Total participation:ﻫﺮ ﻣﻮﺟﻮﺩﻳﺖ ﺣﺪﺍﻗﻞ ﺩﺭ ﻳﻚ ﺭﺍﺑﻄﻪ ﺍﺯ ﻣﺠﻤﻮﻋﻪ ﺍﺭﺗﺒﺎﻁ ﻣﺸﺎﺭﻛﺖ ﺩﺍﺭﺩ. ﻣﺜﺎﻝ :ﻣﺸﺎﺭﻛﺖ ﻭﺍﻡ ﺩﺭ ﺍﺭﺗﺒﺎﻁ ﻭﺍﻡ ﮔﺮﻓﺘﻦ ﻛﺎﻣﻞ ﺍﺳﺖ .ﻫﺮ ﻭﺍﻡ ﺑﺎﻳﺪ ﺣﺪﺍﻗﻞ ﻳﻚ ﻣﺸﺘﺮﻱ ﻣﺘﻨﺎﻇﺮ ﺑﺎ ﺍﺭﺗﺒﺎﻁ ﻭﺍﻡ ﮔﻴﺮﻧﺪﻩ ﺩﺍﺭﺩ. : Partial participationﺑﺮﺧﻲ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎ ﻣﻤﻜﻦ ﺍﺳﺖ ﺩﺭ ﻫﻴﭻ ﺍﺭﺗﺒﺎﻃﻲ ﺍﺯ ﻣﺠﻤﻮﻋﻪ ﺍﺭﺗﺒﺎﻃﺎﺕ ﻣﺸﺎﺭﻛﺖ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ. ﻣﺜﻼ :ﻫﻤﻪ ﻣﺸﺘﺮﻳﺎﻥ ﻣﻤﻜﻦ ﺍﺳﺖ ﻭﺍﻡ ﻧﮕﻴﺮﻧﺪ.ﻳﻌﻨﻲ ﻣﺸﺎﺭﻛﺖ ﻣﺸﺘﺮﻱ ﻧﺎﻛﺎﻣﻞ ﺍﺳﺖ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٢ /
-٢-٣-٢-٢ﻧﻮﻉ ﺍﺭﺗﺒﺎﻁ ﺑﻪ ﻣﺜﺎﺑﻪ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ )ﺍﺭﺗﺒﺎﻁ ﻣﻮﺟﻮﺩﻳﺘﻲ( ﺩﺭ ﻳـﻚ ﺩﻳـﺪ ﻛﻠـﻲ ﻣـﻲ ﺗـﻮﺍﻥ ﮔﻔـﺖ ﻧـﻮﻉ ﺍﺭﺗﺒﺎﻁ ﺧﻮﺩ ﻧﻮﻋﻲ ﻣﻮﺟﻮﺩﻳﺖ ﺍﺳﺖ .ﺯﻳﺮﺍ ﭘﺪﻳﺪﻩ ﺍﻱ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﺩﻧﻴﺎﻱ ﻭﺍﻗﻌﻲ ﻭﺟـﻮﺩ ﺩﺍﺭﺩ .ﺑـﺎ ﺗـﻮﺟﻪ ﺑﻪ ﺍﻳﻦ ﺗﻌﺮﻳﻒ ﻣﻲ ﺗﻮﺍﻥ ﮔﻔﺖ ﭼﻮﻥ ﻧﻮﻉ ﺍﺭﺗﺒﺎﻁ ﺧﻮﺩ ﻧﻮﻋﻲ ﻣﻮﺟﻮﺩﻳﺖ ﺍﺳﺖ ﻟﺬﺍ ﻣﻲ ﺗﻮﺍﻧﺪ ﺻﻔﺖ ﻳﺎ ﺻـﻔﺎﺕ ﺧﺎﺻـﻪ ﺍﻱ ﺩﺍﺷـﺘﻪ ﺑﺎﺷﺪ.ﺍﻣﺎ ﻣﻌﻤﻮﻻ ﻓﺎﻗﺪ ﺻﻔﺖ ﺷﻨﺎﺳﻪ ﺍﺳﺖ.ﺍﺭﺗﺒﺎﻁ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒ ﺑﺎ ﻣﻮﺟﻮﺩﻳﺖ ﻗﻮﻱ ﻣﻌﻤﻮﻻ ﺻﻔﺖ ﺧﺎﺻﻪ ﻧﺪﺍﺭﺩ. ﺩﺭ ﻣـﺜﺎﻝ ﺩﺍﻧﺸـﺠﻮ ﻭ ﺩﺭﺱ ﻭ ﺭﺍﺑﻄـﻪ ﺍﻧـﺘﺨﺎﺏ ﻣـﻲ ﺗـﻮﺍﻥ ﺻﻔﺖ ﺧﺎﺻﻪ ﻫﺎﻱ ﺗﺮﻡ ﻭ ﻧﻤﺮﻩ ﻭ ﺩﺭ ﺭﺍﺑﻄﻪ ﺣﺬﻑ ﺻﻔﺎﺕ ﺗﺮﻡ ﻭ ﻧﻮﻉ ﺣﺬﻑ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺖ. ﻧﻤﺮﻩ
ﺗﺮﻡ
ﺩﺭﺱ
ﺍﻧﺘﺨﺎﺏ
ﺩﺍﻧﺸﺠﻮ
ﺣﺬﻑ ﺗﺮﻡ ﻧﻮﻉ ﺣﺬﻑ
-٣-٣-٢-٢ﻣﺎﻫﻴﺖ ﻧﻮﻉ ﺍﺭﺗﺒﺎﻁ ﭼﮕﻮﻧﮕﻲ ﺗﻨﺎﻇﺮ ﺑﻴﻦ ﺩﻭ ﻣﺠﻤﻮﻋﻪ ﻧﻤﻮﻧﻪ ﻫﺎﻱ ﻣﻮﺟﻮﺩﻳﺖ ﺭﺍ ﻣﺎﻫﻴﺖ ﺍﺭﺗﺒﺎﻁ ﮔﻮﻳﻨﺪ.ﻣﻲ ﺩﺍﻧﻴﻢ ﺳﻪ ﻧﻮﻉ ﺗﻨﺎﻇﺮ ﻭﺟﻮﺩ ﺩﺍﺭﺩ : ﺗﻨﺎﻇﺮ ﻳﻚ ﺑﻴﻚ ،ﺗﻨﺎﻇﺮ ﻳﻚ ﺑﻪ ﭼﻨﺪ ﻭ ﺗﻨﺎﻇﺮ ﭼﻨﺪ ﺑﻪ ﭼﻨﺪ .ﺍﻳﻦ ﺳﻪ ﮔﻮﻧﻪ ﺗﻨﺎﻇﺮ ﺭﺍ ﭼﻨﻴﻦ ﻧﺸﺎﻥ ﻣﻴﺪﻫﻴﻢ : .N : M ، 1 : N ، 1 : 1 ﻣـﺜﺎﻝ :ﻣﺎﻫـﻴﺖ ﺍﺭﺗﺒﺎﻁ ﺩﺭ ﺭﺍﺑﻄﻪ ﺣﺬﻑ ﺗﻚ ﺩﺭﺱ ﻣﻌﻤﻮﻻ 1:Nﺍﺳﺖ )ﻳﻌﻨﻲ ﻳﻚ ﺩﺍﻧﺸﺠﻮ ﻳﻚ ﺩﺭﺱ ﺭﺍ ﺣﺬﻑ ﻣﻴﻜﻨﺪﺩﻭﻟﻲ ﻳﻚ ﺩﺭﺱ ﻣﻤﻜﻦ ﺍﺳﺖ ﺗﻮﺳﻂ ﭼﻨﺪ ﺩﺍﻧﺸﺠﻮ ﺣﺬﻑ ﺷﻮﺩ (. N
M
ﺩﺭﺱ
ﺍﻧﺘﺨﺎﺏ
ﺩﺍﻧﺸﺠﻮ N
ﺣﺬﻑ
1
ﺑـﺮﺍﻱ ﻧﻤـﺎﻳﺶ ﻣﺎﻫـﻴﺖ ﺍﺭﺗـﺒﺎﻁ ﺩﺭ ﻧﻤـﻮﺩﺍﺭ E/Rﺭﻭﺵ ﺩﻳﮕـﺮﻱ ﻧﻴـﺰ ﻭﺟـﻮﺩ ﺩﺍﺭﺩ .ﺩﺭ ﺍﻳـﻦ ﺭﻭﺵ ﺑﻪ ﻫﺮ ﻣﺸﺎﺭﻛﺖ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺩﺭ ﻳﻚ ﺍﺭﺗﺒﺎﻁ ،ﻳﻚ ﺯﻭﺝ ﻋﺪﺩ ﺻﺤﻴﺢ ﺑﻪ ﺻﻮﺭﺕ )( min,max
ﺍﻧﺘﺴﺎﺏ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ.ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﻲ ﻛﻪ ﺩﺭ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٣ /
ﻫـﺮ ﻟﺤﻈـﻪ ،ﻫـﺮ ﻧﻤـﻮﻧﻪ ﻣﻮﺟﻮﺩﻳﺖ eﺍﺯ ﻧﻮﻉ Eﺑﺎﻳﺪ ﺣﺪﺍﻗﻞ ﺩﺭ minﻭ ﺣﺪﺍﻛﺜﺮ ﺩﺭ maxﻧﻤﻮﻧﻪ ﺍﺯ ﺍﺭﺗﺒﺎﻁ Rﺷﺮﻛﺖ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ .ﺍﮔﺮ min=0ﻣﺸﺎﺭﻛﺖ ﻏﻴﺮ ﺍﻟﺰﺍﻣﻲ)ﺍﺧﺘﻴﺎﺭﻱ( ﻭ ﺩﺭ ﻏﻴﺮ ﺍﻳﻨﺼﻮﺭﺕ ﻣﺸﺎﺭﻛﺖ ﺍﻟﺰﺍﻣﻲ ﺍﺳﺖ .
ﻣﻮﺍﺭﺩ ﺍﻇﺎﻓﻪ ﺷﺪﻩ ﺑﻪ ﻧﻤﻮﺩﺍﺭ E/R
-٤-٢-٢ﺗﺠﺰﻳﻪ ﻭ ﺗﺮﻛﻴﺐ : ﺗﺠـﺰﻳﻪ ﻳـﺎ ﺟﺪﺍﺳـﺎﺯﻱ ﻳﻌﻨـﻲ ﻳـﻚ ﺷـﻲﺀ ﻛﻠﻲ ﺭﺍ ﺑﻪ ﺍﺟﺰﺍﺀ ﺗﺸﻜﻴﻞ ﺩﻫﻨﺪﻩ ﺁﻥ ﺗﻘﺴﻴﻢ ﻛﻨﻴﻢ .ﺷﻲﺀ ﻛﻞ ،ﺻﻔﺎﺕ ،ﺳﺎﺧﺘﺎﺭ ﻭ ﺭﻓـﺘﺎﺭ ﺧـﻮﺩ ﺭﺍ ﺩﺍﺭﺩ ﻭ ﻫـﺮ ﻳـﻚ ﺍﺯ ﺍﺟـﺰﺍﺀ ﻧﻴـﺰ ﺻـﻔﺎﺕ ،ﺳﺎﺧﺘﺎﺭ ﻭ ﺭﻓﺘﺎﺭ ﺧﺎﺹ ﺧﻮﺩﺭﺍ ﺩﺍﺭﻧﺪ .ﺑﻪ ﺍﻳﻦ ﻧﻮﻉ ﺍﺭﺗﺒﺎﻁ ﺩﺭ E/ R
ﺍﺭﺗﺒﺎﻁ “ ﺟﺰﺋﻲ ﺍﺳﺖ ﺍﺯ “..ﻭ ﻳﺎ I S –A PART -OFﮔﻔﺘﻪ ﻣﻲ ﺷﻮﺩ . Computer
keyboard
Monitor
-٥-٢-٢ﺯﻳﺮ ﻧﻮﻉ ﻫﺎ ﻭ ﺍﺑﺮﻧﻮﻉ ﻫﺎﻱ ﻣﻮﺟﻮﺩﻳﺖ
Hard
RAM
Subtype and Supertype
ﻼ ﺍﮔﺮ ﺑﻌﻀﻲ ﻛﺎﺭﻣﻨﺪﺍﻥ ،ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺲ ﺑﺎﺷﻨﺪ ﻭ ﺗﻤﺎﻡ ﺑﺮﻧﺎﻣﻪ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻲ ﺗﻮﺍﻧﺪ ﺑﻄﻮﺭ ﻫﻤﺰﻣﺎﻥ ﺍﺯ ﺍﻧﻮﺍﻉ ﻣﺨﺘﻠﻔﻲ ﺑﺎﺷﺪ .ﻣﺜ ﹰ ﻧﻮﻳﺴﺎﻥ ﻛﺎﺭﻣﻨﺪ ،ﺁﻧﮕﺎﻩ ﻣﻲ ﺗﻮﺍﻥ ﮔﻔﺖ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺲ ﻳﻚ ﺯﻳﺮ ﻧﻮﻉ ﺍﺯ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﻛﺎﺭﻣﻨﺪ ﺍﺳﺖ. ﺍﮔـﺮ ﻧـﻮﻉ ﻣﻮﺟـﻮﺩﻳﺖ ، yﻳـﻚ ﺯﻳﺮ ﻧﻮﻉ ﺍﺯ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ xﺑﺎﺷﺪ ﺁﻧﮕﺎﻩ ﺧﻄﻲ ﺟﻬﺖ ﺩﺍﺭ ﺍﺯ ﻣﺴﺘﻄﻴﻞ xﺑﻪ ﻣﺴﺘﻄﻴﻞ yﺭﺳﻢ ﻣﻲ ﺷﻮﺩ) .ﻫﺮ yﻳﻚ xﺍﺳﺖ( ﺍﻳﻦ ﺍﺭﺗﺒﺎﻁ ﺑﺮﺍﻱ ﭘﺮﻫﻴﺰ ﺍﺯ ﺗﻜﺮﺍﺭ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺑﻴﻦ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﺩﺭ ﻳﻚ ﻧﻤﻮﺩﺍﺭ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ
ﺷﻤﺎﺭﻩ
ﻛﺎﺭﻣﻨﺪ ﻧﺎﻡ
ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺲ ﻧﺎﻡ
-١ -٥-٢-٢ﺗﺨﺼﻴﺺ ):(SPECIALIZATION ﻣﺸـﺨﺺ ﻛـﺮﺩﻥ ﮔـﻮﻧﻪ ﻫﺎﻱ ﺧﺎﺹ ﻳﻚ ﺷﻲﺀ ﺭﺍ ﺗﺨﺼﻴﺺ ﮔﻮﻳﻨﺪ .ﺑﻄﻮﺭ ﻣﺜﺎﻝ ﺍﮔﺮ ﺷﻲﺀ ﻣﻮﺟﻮﺩ ﺯﻧﺪﻩ ﺭﺍ ﺩﺭﻧﻈﺮ ﺑﮕﻴﺮﻳﻢ ﺳـﻪ ﮔـﻮﻧﻪ ﺧﺎﺹ ﺁﻥ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ :ﺍﻧﺴﺎﻥ ،ﺣﻴﻮﺍﻥ ﻭ ﻧﺒﺎﺕ .ﺩﺭ ﻧﻤﻮﺩﺍﺭ E/Rﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻴﺘﻮﺍﻧﺪ ﺯﻳﺮﻧﻮﻉ ﻫﺎﻳﻲ ﺩﺍﺷﺘﻪ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٤ /
ﺑﺎﺷﺪ .ﮔﻮﻳﻴﻢ ﺑﻴﻦ ﻫﺮ ﺯﻳﺮ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﻭ ﺍﺑﺮ ﻧﻮﻉ ﺁﻥ ﺍﺭﺗﺒﺎﻁ “ ﮔﻮﻧﻪ ﺍﻱ ﺍﺳﺖ ﺍﺯ”...
ﻳﺎ ﻫﺴﺖ ﻳﻚ …
IS
- Aﻭﺟﻮﺩ ﺩﺍﺭﺩ . ﺗﺨﺼـﻴﺺ :ﻳـﻚ ﻓـﺮﺍﻳﻨﺪ ﺍﺯ ﺑـﺎﻻ ﺑـﻪ ﭘﺎﻳـﻴﻦ ﺍﺳـﺖ .ﺩﺭ ﺗﺨﺼـﻴﺺ ﻳـﻚ ﻣﻮﺟـﻮﺩﻳﺖ ﺑﻪ ﮔﻮﻧﻪ ﻫﺎﻱ ﻣﺨﺘﻠﻒ ﮔﺮﻭﻩ ﺑﻨﺪﻱ ﻣـﻲ ﺷﻮﺩ .ﺍﻳﻦ ﮔﺮﻭﻫﻬﺎ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﭘﺎﻳﻴﻦ ﺗﺮ ﺁﻥ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻨﻈﻮﺭ ﻣﻲ ﮔﺮﺩﻧﺪ .ﺩﺭ ﻧﻤﻮﺩﺍﺭ E/Rﺗﺨﺼﻴﺺ ﺑـﺎ ﻳـﻚ ﻣـﺜﻠﺚ ﺣـﺎﻭﻱ ISAﻧﺸـﺎﻥ ﺩﺍﺩﻩ ﻣـﻲ ﺷـﻮﺩ .ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﭘﺎﻳﻴﻦ ﺗﻤﺎﻡ ﺧﺼﻮﺻﻴﺎﺕ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﺑﺎﻻﺗﺮ ﺭﺍ ﺑﻪ ﺍﺭﺙ ﻣﻲ ﺑﺮﺩ.
ﻧﺎﻡ
ﺩﺍﻧﺸﺠﻮ
ﺷﻤﺎﺭﻩ
ﻧﺎﻡ ﺧﺎﻧﻮﺍﺩﮔﻲ
ﺩﺍﻧﺸﺠﻮﻱ ﻛﺎﺭﺷﻨﺎﺳﻲ
٢
-٢-٥-٢-٢ﺗﻌﻤﻴﻢ :
ﺩﺍﻧﺸﺠﻮﻱ ﻛﺎﺭﺩﺍﻧﻲ
ﺩﺍﻧﺸﺠﻮﻱ ﺩﻛﺘﺮﺍ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٥ /
ﺗﻌﻤـﻴﻢ ﻋﻜـﺲ ﻋﻤـﻞ ﺗﺨﺼـﻴﺺ ﺍﺳـﺖ ﺑـﻪ ﺍﻳﻦ ﻣﻌﻨﺎ ﻛﻪ ﺑﺎ ﺩﺍﺷﺘﻦ ﺯﻳﺮ ﻧﻮﻉ ﻫﺎﻱ ﺧﺎﺹ ،ﺻﻔﺎﺕ ﻣﺸﺘﺮﻙ ﺑﻴﻦ ﺁﻧﻬﺎ ﺭﺍ ﺩﺭ ﻳﻚ ﻣﺠﻤـﻮﻋﻪ ﺻـﻔﺎﺕ ﺑـﺮﺍﻱ ﻳـﻚ ﺍﺑـﺮﻧﻮﻉ ﻣﻮﺟـﻮﺩﻳﺖ ﺩﺭ ﻧﻈـﺮ ﻣـﻲ ﮔﻴﺮﻳﻢ .ﺗﻌﻤﻴﻢ ﻳﻚ ﻓﺮﺍﻳﻨﺪ ﺍﺯ ﭘﺎﻳﻴﻦ ﺑﻪ ﺑﺎﻻﺳﺖ ﻛﻪ ﺗﻌﺪﺍﺩﻱ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺘﻲ ﻛﻪ ﺧﺼﻮﺻﻴﺎﺕ ﻣﺸﺘﺮﻙ ﺩﺍﺭﻧﺪ ﺭﺍ ﺑﺎﻫﻢ ﺗﺮﻛﻴﺐ ﻣﻲ ﻛﻨﺪ.
ﺩﺍﻧﺸﺠﻮﻱ ﻛﺎﺭﺩﺍﻧﻲ ﺷﻤﺎﺭﻩ
ﺻﻔﺎﺕ ﺧﺎﺹ
ﺩﺍﻧﺸﺠﻮﻱ ﻛﺎﺭﺷﻨﺎﺳﻲ ﻧﺎﻡ
ﺷﻤﺎﺭﻩ
ﺻﻔﺎﺕ ﻣﺸﺘﺮﻙ
ﺻﻔﺎﺕ ﻣﺸﺘﺮﻙ
ﻧﺎﻡ
ﺻﻔﺎﺕ ﺧﺎﺹ
ﻧﺎﻡ
ﺻﻔﺎﺕ ﻣﺸﺘﺮﻙ
ﺩﺍﻧﺸﺠﻮ ﺷﻤﺎﺭﻩ
ﻧﺎﻡ ﺧﺎﻧﻮﺍﺩﮔﻲ
ﺩﺍﻧﺸﺠﻮﻱ ﻛﺎﺭﺷﻨﺎﺳﻲ
ﺩﺍﻧﺸﺠﻮﻱ ﻛﺎﺭﺩﺍﻧﻲ
ﺻﻔﺎﺕ ﺧﺎﺹ
ﺻﻔﺎﺕ ﺧﺎﺹ
ﺗﻮﺟﻪ -:ﺗﺨﺼﻴﺺ ﻭ ﺗﻌﻤﻴﻢ ﻣﻌﻜﻮﺱ ﻳﻜﺪﻳﮕﺮﻧﺪ ﻛﻪ ﻫﺮ ﺩﻭ ﺩﺭ ﻧﻤﻮﺩﺍﺭ ﺑﺎﻳﻚ ﺷﻜﻞ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﻧﺪ. ﻗﻴﻮﺩ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﺍﺭﺗﺒﺎﻁ ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺒﻲ ﺗﻌﻤﻴﻢ/ﺗﺨﺼﻴﺺ ﺑﺮﺍﻱ ﻣﺪﻝ ﺳﺎﺯﻱ ﺩﻗﻴﻖ ﺗﺮ ﻳﻚ ﺳﺎﺯﻣﺎﻥ ،ﻃﺮﺍﺡ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﻤﻜﻦ ﺍﺳﺖ ﻣﺤﺪﻭﺩﻳﺖ ﻫﺎ /ﻗﻴﺪﻫﺎ ﻳﻲ ﺭﺍ ﺩﺭ ﻳﻚ ﺗﻌﻤﻴﻢ ﻭﻳﮋﻩ ﺩﺭ ﻧﻈـﺮ ﺑﮕﻴﺮﺩ .ﻳﻜﻲ ﺍﺯﺍﻳﻦ ﻗﻴﺪ ﻫﺎ ﺗﻌﻴﻴﻦ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻲ ﺗﻮﺍﻧﺪﻋﻀﻮﻱ ﺍﺯ ﻳﻚ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﭘﺎﻳﻴﻦ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺘﻪ ﺷﻮﺩ .ﻋﻀﻮﻳﺖ ﻣﻲ ﺗﻮﺍﻧﺪﺑﺮ ﺍﺳﺎﺱ ﺷﺮﺍﻳﻂ ﻭ ﻳﺎ ﺗﻮﺳﻂ ﻛﺎﺭﺑﺮ ﺗﻌﻴﻴﻦ ﮔﺮﺩﺩ. ﺑﺮ ﺣﺴﺐ ﺷﺮﻁ ﺧﺎﺹ ﺗﻌﺮﻳﻒ ﺷﺪﻩ: ﺩﺭﺍﻳﻦ ﺣﺎﻟﺖ ﻋﻀﻮﻳﺖ ﺑﺮ ﺍﺳﺎﺱ ﻳﻚ ﺷﺮﻁ ﺻﺮﻳﺢ ﻳﺎ ﮔﺰﺍﺭﻩ ﺍﻱ ﺑﻴﺎﻥ ﻣﻲ ﺷﻮﺩ. condition-defined ;E.g. all customers over 65 years are members of senior-citizen entity set senior-citizen ISA person.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٦ /
ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺗﻮﺳﻂ ﻛﺎﺭﺑﺮ: ﻛﺎﺭﺑﺮ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﻮﺟﻮﺩﻳﺖ ﺭﺍ ﺑﻪ ﻳﻚ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻮﺭﺩ ﻧﻈﺮ ﺗﺨﺼﻴﺺ ﻣﻲ ﺩﻫﺪ. ﻧﻮﻉ ﺩﻳﮕﺮ ﻣﺤﺪﻭﺩﻳﺖ ﺍﺯ ﻧﻈﺮ ﺍﻳﻨﻜﻪ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﺑﻪ ﻳﻚ ﻳﺎ ﺑﻴﺸﺘﺮ ﺍﺯ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﭘﺎﻳﻴﻦ ﺗﻌﻠﻖ ﺩﺍﺭﺩ ﺗﻌﺮﻳﻒ ﻣﻲ ﮔﺮﺩﺩ.ﺍﻳﻦ ﻧﻮﻉ ﻣﺤﺪﻭﺩﻳﺖ ﺑﻪ ﺩﻭ ﺷﻜﻞ ﻣﺠﺰﺍ ) (Disjointﻭ ﻫﻤﭙﻮﺷﺎﻧﻲ )(Overlappingﻭﺟﻮﺩ ﺩﺍﺭﺩ. Disjoint ﺑﻪ ﻣﻌﻨﺎﻱ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻲ ﺗﻮﺍﻧﺪ ﻓﻘﻂ ﺑﻪ ﻳﻚ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﭘﺎﻳﻴﻦ ﺗﻌﻠﻖ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ .ﺩﺭ ﻧﻤﻮﺩﺍﺭ E/Rﺑﺎ ﻧﻮﺷﺘﻦ ﻋﺒﺎﺭﺕ disjointﺩﺭ ﻛﻨﺎﺭ ﻣﺜﻠﺚ ISAﺍﻳﻦ ﻗﻴﺪ ﺗﻌﺮﻳﻒ ﻣﻴﺸﻮﺩ. Overlapping ﺑﻪ ﻣﻌﻨﺎﻱ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻲ ﺗﻮﺍﻧﺪ ﻓﻘﻂ ﺑﻪ ﻳﻚ ﻳﺎ ﺑﻴﺸﺘﺮ ﺍﺯﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﭘﺎﻳﻴﻦ ﺗﻌﻠﻖ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ﻗـﻴﺪ ﺩﻳﮕﺮﻱ ﻛﻪ ﺩﺭ ﺗﻌﻤﻴﻢ ﻣﻄﺮﺡ ﺷﺪﻩ ،ﻗﻴﺪ ﻛﺎﻣﻞ ﺑﻮﺩﻥ ﺍﺳﺖ ﻛﻪ ﺑﻴﺎﻧﮕﺮ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﺑﺎﻻﺗﺮ ﺑﺎﻳﺪ ﻣـﺘﻌﻠﻖ ﺑﻪ ﺣﺪﺍﻗﻞ ﻳﻜﻲ ﺍﺯ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎﻱ ﺳﻄﺢ ﭘﺎﻳﻴﻦ ﺗﺮ ﺑﺎﺷﺪ ﻳﺎ ﺧﻴﺮ .ﺑﺮ ﺍﻳﻦ ﺍﺳﺎﺱ ﺩﻭ ﻧﻮﻉ ﻗﻴﺪ ﻛﺎﻣﻞ ﻭ ﺟﺰﺋﻲ ﺭﺍ ﺩﺍﺭﻳﻢ : : totalﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﺑﺎﻳﺪ ﻣﺘﻌﻠﻖ ﺑﻪ ﻳﻜﻲ ﺍﺯ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎﻱ ﺳﻄﺢ ﭘﺎﻳﻴﻨﺘﺮ ﺑﺎﺷﺪ. :partialﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻲ ﺗﻮﺍﻧﺪ ﻣﺘﻌﻠﻖ ﺑﻪ ﻳﻜﻲ ﺍﺯ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎﻱ ﺳﻄﺢ ﭘﺎﻳﻴﻨﺘﺮ ﻧﺒﺎﺷﺪ. ﺣﺎﻟـﺖ ﭘـﻴﺶ ﻓﺮﺽ ﻣﺴﺎﻟﻪ ،ﺣﺎﻟﺖ ﺟﺰﺋﻲ ﺍﺳﺖ .ﺑﺮﺍﻱ ﺑﻴﺎﻥ ﻗﻴﺪ ﻛﺎﻣﻞ ﺑﻮﺩﻥ ﺑﺎﻳﺪ ﺍﺯ ﺩﻭ ﺧﻂ ﺍﺳﺘﻔﺎﺩﻩ ﮔﺮﺩﺩ)ﻫﻤﺎﻧﻨﺪ ﻣﺸﺎﺭﻛﺖ ﺍﻟﺰﺍﻣﻲ/ﻛﺎﻣﻞ ﺩﺭ ﻧﻤﻮﺩﺍﺭ ( E/R ﺗﻤﺮﻳﻦ ٥ :ﻣﺜﺎﻝ ﻣﺨﺘﻠﻒ ﺍﺯ ﺗﻌﻤﻴﻢ ﺫﻛﺮ ﻛﻨﻴﺪ ﻭ ﺩﺭ ﻫﺮ ﻛﺪﺍﻡ ﻗﻴﻮﺩ ﻣﺨﺘﻠﻒ ﺭﺍ ﺑﺮﺭﺳﻲ ﻧﻤﺎﻳﻴﺪ. -٦-٢-٢ﺗﺠﻤﻊ
Aggregation
ﺗﺠﻤـﻊ ﻳﻌﻨﻲ ﺳﺎﺧﺘﻦ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺟﺪﻳﺪ ﻭ ﻭﺍﺣﺪ ﺑﺮ ﺍﺳﺎﺱ ﺩﻭ ﻳﺎ ﺑﻴﺶ ﺍﺯ ﺩﻭ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ،ﻛﻪ ﺧﻮﺩ ﺑﺎﻫﻢ ﺍﺭﺗﺒﺎﻁ ﺩﺍﺭﻧـﺪ.ﺩﺭ ﻭﺍﻗﻊ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﻭ ﺍﺭﺗﺒﺎﻃﺎﺕ ﺭﺍ ﺑﺎ ﻫﻢ ﻣﺠﺘﻤﻊ ﻛﺮﺩﻩ ﻭ ﺑﻪ ﻋﻨﻮﺍﻥ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﻭﺍﺣﺪ ﺩﺭ ﻧﻈﺮ ﻣﻴﮕﻴـﺮﻧﺪ .ﻭ ﺍﻳـﻦ ﻧـﻮﻉ ﻣﻮﺟـﻮﺩﻳﺖ ﺧـﻮﺩ ﻣـﻲ ﺗـﻮﺍﻧﺪ ﺑـﺎ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺩﻳﮕﺮﻱ ﺍﺭﺗﺒﺎﻁ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ .ﺩﺭ ﻭﺍﻗﻊ ﺯﻣﺎﻧﻲ ﺍﺯ ﺗﺠﻤﻊ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻴﺸﻮﺩ ﻛﻪ ﺑﺨﻮﺍﻫﻴﻢ ﺍﺭﺗﺒﺎﻃﻲ ﺭﺍ ﺑﻴﻦ ﺍﺭﺗﺒﺎﻁ ﻫﺎ ﺑﻴﺎﻥ ﻛﻨﻴﻢ ﻭ ﻳﺎ ﺑﺨﻮﺍﻫﻴﻢ ﺍﺭﺗﺒﺎﻃﺎﺕ ﺍﻓﺰﻭﻧﻪ ﺭﺍ ﻛﻢ ﻛﻨﻴﻢ. ﻣﺜﺎﻝ :ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻱ ﺩﺍﻧﺸﺠﻮ ،ﺩﺭﺱ ﻭ ﺍﺳﺘﺎﺩ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﻫﻤﺎﻧﻨﺪ ﺷﻜﻞ ﺯﻳﺮ ﻣﺪﻟﺴﺎﺯﻱ ﻧﻤﻮﺩ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﺩﺍﻧﺸﺠﻮ
ﮔﺮﻭﻩ ﺩﺭﺳﻲ
ﺍﻧﺘﺨﺎﺏ
ﺁﻣﻮﺯﺵ
ﺍﺳﺘﺎﺩ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٧ /
ﺩﺭﺱ
ﺗﺮﻡ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺜﺎﻝ :ﻧﻤﻮﺩﺍﺭ E/Rﻳﻚ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻜﻲ :
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٨ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٩ /
ﻣﺜﺎﻟﻲ ﺩﻳﮕﺮ : ﻣﺤـﻴﻂ ﻋﻤﻠﻴﺎﺗـﻲ :ﺳـﺎﺯﻣﺎﻥ ﻳـﺎ ﺷـﺮﻛﺘﻲ ﺭﺍ ﺩﺭ ﻧﻈـﺮ ﻣـﻲ ﮔﻴـﺮﻳﻢ ﻛﻪ ﭘﺮﻭﮊﻩ ﻫﺎﻳﻲ ﺭﺍ ﺩﺭ ﺩﺳﺖ ﺍﺟﺮﺍ ﺩﺍﺭﺩ.ﺩﺭ ﭘﺮﻭﮊﻩ ﻫﺎ ﺍﺯ ﻗﻄﻌﺎﺗـﻲ ﺩﺭ ﻛﺎﺭ ﺳﺎﺧﺖ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ ﻭ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﺍﻳﻦ ﻗﻄﻌﺎﺕ ﺭﺍ ﺗﺄﻣﻴﻦ ﻣﻲ ﻛﻨﻨﺪ .ﻗﻄﻌﺎﺕ ﺩﺭ ﭘﺮﻭﮊﻩ ﻫﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷـﻮﻧﺪ .ﻫﺮ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﺩﺭ ﻳﻚ ﺷﻬﺮ ﺩﻓﺘﺮ ﺩﺍﺭﺩ .ﻫﺮ ﻗﻄﻌﻪ ﻣﻲ ﺗﻮﺍﻧﺪ ﺩﺭ ﺳﺎﺧﺖ ﻗﻄﻌﻪ ﺩﻳﮕﺮ ﻧﻴﺰ ﺑﻜﺎﺭ ﺭﻭﺩ .ﻛﺎﺭﻣﻨﺪ ﻣﺪﻳﺮ ﭘﺮﻭﮊﻩ ﺍﺳﺖ ﻭ ﻳﺎ ﺩﺭ ﭘﺮﻭﮊﻩ ﻛﺎﺭ ﻣﻲ ﻛﻨﺪ. ﻳﻚ ﻧﻤﻮﺩﺍﺭ ﺳﺎﺩﻩ E/Rﻣﻲ ﺗﻮﺍﻧﺪ ﺑﻪ ﻓﺮﻡ ﺯﻳﺮ ﺑﺎﺷﺪ:
City
J Name
city
J#
ﭘﺮﻭﮊﻩ
SJ
J
S tatus
S#
S Name
ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ Supplier
Qty
MJ
SPJ
PJ
EJ
SP Qty
ﻗﻄﻌﻪ
)(P
Part
ﻛﺎﺭﻣﻨﺪ
weight
city
color
P#
PP E nane
E mp#
Dept#
Salary
P name
Qty
ﺍﺭﺗـﺒﺎﻁ ﻣﻤﻜـﻦ ﺍﺳـﺖ ﻣﺎﺑﻴﻦ ﺑﻴﺶ ﺍﺯ ﺩﻭ ﻣﻮﺟﻮﺩﻳﺖ ﺑﺎﺷﺪ) . (SPJﺍﻃﻼﻋﺎﺗﻲ ﻛﻪ ﺍﺯ ﺍﻳﻦ ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﺳﻪ ﻣﻮﺟﻮﺩﻳﺖ ﺑﻪ ﺩﺳﺖ ﻣﻲ ﺁﻳﺪ ﻫﻤﻴﺸﻪ ﻟﺰﻭﻣﹰﺎ ﻫﻤﺎﻥ ﺍﻃﻼﻋﺎﺗﻲ ﻧﻴﺴﺖ ﻛﻪ ﺍﺯ ﺍﺭﺗﺒﺎﻁ ﺩﻭ ﺑﻪ ﺩﻭﻱ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎ ﺑﺪﺳﺖ ﻣﻲ ﺁﻳﺪ. ﻣﺜﺎﻝ: – ١ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ S1ﻗﻄﻌﻪ P1ﺭﺍ ﺗﻬﻴﻪ ﻣﻲ ﻛﻨﺪ. – ٢ﻗﻄﻌﻪ P1ﺩﺭ ﭘﺮﻭﮊﻩ J1ﺑﻜﺎﺭ ﺭﻓﺘﻪ ﺍﺳﺖ. – ٣ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ S1ﺑﺮﺍﻱ ﭘﺮﻭﮊﻩ J1ﻗﻄﻌﻪ ﺗﻬﻴﻪ ﻛﺮﺩﻩ ﺍﺳﺖ. – ٤ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ S1ﻗﻄﻌﻪ P1ﺭﺍ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺩﺭ ﭘﺮﻭﮊﻩ J1ﺗﻬﻴﻪ ﻛﺮﺩﻩ ﺍﺳﺖ. ﻫﻤﻴﺸﻪ ﺍﺯ ﺍﻃﻼﻉ ١ﻭ ٢ﻭ ٣ﻧﻤﻲ ﺗﻮﺍﻥ ﺍﻃﻼﻉ ٤ﺭﺍ ﻧﺘﻴﺠﻪ ﮔﺮﻓﺖ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٠ /
-٣-٢ﺍﺻﻄﻼﺡ ﺩﺍﻡ ﭘﻴﻮﻧﺪﻱ )(Connection trap ﺍﮔـﺮ ﺍﺯ ﺍﺭﺗـﺒﺎﻁ ﺑﻴﻦ ﺩﻭ ﺑﻪ ﺩﻭﻱ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﻧﺘﻴﺠﻪ ﮔﺮﻓﺘﻪ ﺷﻮﺩ ﻛﻪ ﺣﺘﻤﹰﺎ ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﺳﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻳﺎ ﺑﻴﺸﺘﺮ ﺍﺯ ﺁﻥ ﺑﺪﺳﺖ ﺁﻳﺪ ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﻃﺮﺍﺡ ﮔﺮﻓﺘﺎﺭ ﺩﺍﻡ ﭘﻴﻮﻧﺪﻱ ﺷﺪﻩ ﺍﺳﺖ. -٤-٢ﻃﺮﺍﺣﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﻃﺮﺍﺣـﻲ ﻳـﻚ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﺴﺘﻠﺰﻣﻲ ﻣﺮﺍﺣﻠﻲ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﻫﺮ ﻣﺮﺣﻠﻪ ﻓﻌﺎﻟﻴﺘﻬﺎﻳﻲ ﺍﻧﺠﺎﻡ ﻣﻴﺸﻮﺩ .ﺷﻜﻞ ﺯﻳﺮ ﻧﻤﻮﺩﺍﺭ ﺳﺎﺩﻩ ﺷﺪﻩ ﻣﺮﺍﺣﻞ ﻃﺮﺍﺣﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲ ﺩﻫﺪ.
-٤-٢ﻃﺮﺍﺣﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﺍﺑﺰﺍﺭﻫﺎﻱ Case
ﺑـﺮﺍﻱ ﻃﺮﺍﺣﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﺍﺑﺰﺍﺭﻫﺎﻱ ﻣﺨﺘﻠﻔﻲ ﺍﺭﺍﺋﻪ ﺷﺪﻩ ﺍﻧﺪ .ﺍﻳﻦ ﺍﺑﺰﺍﺭﻫﺎ ﺑﻪ ﻃﺮﺍﺡ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻛﻤﻚ ﻣﻴﻜﻨﻨﺪ ﺗﺎ ﺩﺭﻣﺮﺍﺣﻞ ﻣﺨـﺘﻠﻒ ﻣﺪﻟﺴـﺎﺯﻱ ﻭ ﻃﺮﺍﺣـﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ،ﺗﺼﻤﻴﻢ ﮔﻴﺮﻱ ﻣﻨﺎﺳﺐ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﺪ.ﺍﻳﻦ ﺍﺑﺰﺍﺭﻫﺎ ﺍﻣﻜﺎﻥ ﺗﺮﺳﻴﻢ ﻧﻤﻮﺩﺍﺭ E/Rﺭﺍ ﺑﺎ ﺍﺳـﺘﻔﺎﺩﻩ ﺍﺯ ﺍﻧـﺘﺨﺎﺏ ﺍﺷـﻴﺎﺀ ﺍﺯ ﻳـﻚ ﺟﻌـﺒﻪ ﺍﺑـﺰﺍﺭﺭﺍ ﺑﻮﺟـﻮﺩ ﻣـﻲ ﺁﻭﺭﻧـﺪ.ﺑﻄﻮﺭ ﻛﻠﻲ ﻣﺰﺍﻳﺎﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﻳﻦ ﺍﺑﺰﺍﺭﻫﺎ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻧﺎﻡ ﺑﺮﺩ : -١ﺳﺎﺩﮔﻲ ﻓﺮﺍﻳﻨﺪ ﺍﻳﺠﺎﺩ ﻧﻤﻮﺩﺍﺭﻫﺎ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢١ /
-٢ﺗﻮﻟﻴﺪ ﺧﻮﺩﻛﺎﺭ ﺟﻤﻼﺕ SQLﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﺟﺪﻭﻟﻬﺎ ،ﻣﺤﺪﻭﺩﻳﺖ ﻫﺎ ،ﺍﻧﺪﻳﺲ ﻫﺎ ﻭ ﺩﻳﮕﺮ ﺍﺷﻴﺎﺀ ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ. -٣ﺍﻣﻜﺎﻥ ﻣﺴﺘﻨﺪ ﺳﺎﺯﻱ ﻫﺮ ﻣﻮﺟﻮﺩﻳﺖ ،ﺻﻔﺖ ﺧﺎﺻﻪ ،ﺭﺍﺑﻄﻪ ﻭ ﻣﺤﺪﻭﺩﻳﺖ. -٤ ﺑﺮﺧﻲ ﺍﺑﺰﺍﺭ ﻫﺎ ﻳﻲ ﻛﻪ ﺩﺭ ﺣﺎﻝ ﺣﺎﺿﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﻧﺪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ:: ER STUDIO -١ﺑﺮﺍﻱ ﻣﺪﻟﺴﺎﺯﻱ E/Rﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ DB Atrisan -٢ﺑﺮﺍﻱ ﻣﺪﻳﺮﻳﺖ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﺍﻣﻨﻴﺖ ﺁﻥ Oracle Developer 2000 & Designer 2000 -٣ﺑﺮﺍﻱ ﻣﺪﻟﺴﺎﺯﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻭ ﺗﻮﺳﻌﻪ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ Platinum Enterprise Modeling suite : ER Win , BpWin -٤ﺑﺮﺍﻱ ﻣﺪﻟﺴﺎﺯﻱ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﭘﺮﺩﺍﺯﺵ ﻫﺎ RW Metro -٥ﺑﺮﺍﻱ ﺗﺒﺪﻳﻞ ﺍﺯ O-Oﺑﻪ ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ. Rational Rose -٦ﺑﺮﺍﻱ ﻣﺪﻟﺴﺎﺯﻱ UMLﻭ ﺗﻮﻟﻴﺪ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺑﻪ ﺯﺑﺎﻥ ﺟﺎﻭﺍ ﻭ .C++ Visio Enterprise Visual Basic -٧ﺑﺮﺍﻱ ﻣﺪﻟﺴﺎﺯﻱ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻃﺮﺍﺣﻲ ﻡ ﻣﻬﻨﺪﺳﻲ ﻣﺠﺪﺩ. X Case -٨ﺑﺮﺍﻱ ﻣﺪﻟﺴﺎﺯﻱ ﻣﻔﻬﻮﻣﻲ . Case Studio -٩ﺑﺮﺍﻱ ﻣﺪﻟﺴﺎﺯﻱ E/Rﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ. ﺗﻤﺮﻳﻦ :ﻧﻤﻮﺩﺍﺭ E/Rﻫﺮ ﻳﻚ ﺍﺯ ﻣﺤﻴﻄﻬﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﺯﻳﺮ ﺭﺍ ﺭﺳﻢ ﻛﻨﻴﺪ: -
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﻳﻚ ﻧﻤﺎﻳﺸﮕﺎﻩ ﺑﻴﻦ ﺍﻟﻤﻠﻠﻲ
-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﮔﻴﺎﻫﺎﻥ
-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﺷﺨﺼﻲ )( P I S
-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﺁﺯﻣﺎﻳﺸﮕﺎﻩ ﻃﺒﻲ
-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﺗﻌﻤﻴﺮ ﻭ ﻧﮕﻬﺪﺍﺭﻱ ﻛﺎﻣﭙﻴﻮﺗﺮ ﻫﺎ
-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﺩﺍﺭﻭﺧﺎﻧﻪ ﻳﻚ ﺑﻴﻤﺎﺭﺳﺘﺎﻥ
-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﻓﻌﺎﻟﻴﺘﻬﺎﻱ ﻛﻠﻮﭖ ﻓﻴﻠﻢ
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﻣﺴﺎﺑﻘﺎﺕ ﻋﻠﻤﻲ-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﻳﻚ ﺑﺎﻧﻚ
-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﻣﻮﺳﻴﻘﻲ ﻭ ﻣﻮﺳﻴﻘﻲ ﺩﺍﻧﺎﻥ
-
ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﻧﻘﺎﺷﻲ ﻭ ﻧﻘﺎﺷﺎﻥ
-ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ ﻳﻚ ﻣﺮﻛﺰ ﺗﺤﻘﻴﻘﺎﺗﻲ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٢ /
ﺧﻼﺻﻪ ﺷﻜﻠﻬﺎﻱ ﺑﻜﺎﺭﺭﻓﺘﻪ ﺩﺭ ﻧﻤﻮﺩﺍﺭ E/R
ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ
ﺻﻔﺖ ﺧﺎﺻﻪ
E
ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒ
A A
ﺻﻔﺖ ﺧﺎﺻﻪ ﭼﻨﺪ ﻣﻘﺪﺍﺭﻱ
E
A R
ﻧﻮﻉ ﺭﺍﺑﻄﻪ
ﺭﺍﺑﻄﻪ ﺑﻴﻦ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﻭ ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒ ﻛﻠﻴﺪ ﺍﺻﻠﻲ
ﺭﺍﺑﻄﻪ ﭼﻨﺪ ﺑﻪ ﭼﻨﺪ ﺭﺍﺑﻄﻪ ﻳﻚ ﺑﻪ ﻳﻚ
ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺸﺘﻖ ﺷﺮﻛﺖ ﻛﺎﻣﻞ )ﺍﻟﺰﺍﻣﻲ(ﻣﻮﺟﻮﺩﻳﺖ ﺩﺭ ﺭﺍﺑﻄﻪ
R
R
E2
A
*
R
R
١
R
E1
R *
ﺭﺍﺑﻄﻪ ﻳﻚ ﺑﻪ ﭼﻨﺪ
*
١ ١
R
R ﻣﺤﺪﻭﺩﻳﺘﻬﺎﻱ Cardinality
E
R
ISA
)(Specialization or Generalization
E2 IS-A E1
E1 E2 E2
ISA
E1
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٣ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٤ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ -٥-٢ﭼﻨﺪ ﻣﺜﺎﻝ ﺍﺯ ﻧﻤﻮﺩﺍﺭ E/R
ﻣﺜﺎﻟﻲ ﺍﺯ ﻳﻚ ﺳﻴﺴﺘﻢ ﻛﺎﺭﻣﻨﺪ -ﭘﺮﻭﮊﻩ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٥ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻧﻤﻮﺩﺍﺭ E/Rﻳﻚ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻜﻲ:
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٦ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
‹ﻣﺜﺎﻟﻲ ﺍﺯ ﺗﺨﺼﻴﺺ ﻭ ﺗﻌﻤﻴﻢ:
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٧ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٨ /
ﺗﻤﺮﻳﻨﺎﺕ ﻓﺼﻞ ﺩﻭﻡ: -١ﺩﺭ ﻣـﺪﻝ ﺳـﺎﺯﻱ ﺩﺍﺩﻩ ﻫـﺎ ﺑـﺎ ﺭﻭﺵ E/Rﮔـﺎﻩ ﻣﺸـﻜﻼﺗﻲ ﺑـﺮﻭﺯ ﻣﻲ ﻧﻤﺎﻳﺪ ﻛﻪ ﺍﺯ ﺟﻤﻠﻪ ﺁﻧﻬﺎﺗﻠﻪ ﺍﺭﺗﺒﺎﻃﻲ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﻧﺎﻡ ﺑﺮﺩ.ﺩﻭ ﺣﺎﻟﺖ ﺭﺍﻳﺞ ﺗﺮ ﺍﻳﻦ ﺗﻠﻪ ﺍﺭﺗﺒﺎﻃﻲ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ :ﺗﻠﻪ ﻳﻚ ﭼﻨﺪﻱ ﻭ ﺗﻠﻪ ﺷﻜﺎﻑ ،ﺑﺎ ﺫﻛﺮ ﻣﺜﺎﻟﻲ ﺍﻳﻦ ﺩﻭ ﺣﺎﻟﺖ ﺭﺍ ﺗﻮﺿﻴﺢ ﺩﻫﻴﺪ.
٣
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٢٩ /
ﻓﺼﻞ ﺳﻮﻡ : ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ -١-٣ﺗﻌﺮﻳﻒ ﺭﺍﺑﻄﻪ : ﺭﺍﺑﻄﻪ ﺍﺯ ﺩﻭ ﻣﺠﻤﻮﻋﻪ ﺗﺸﻜﻴﻞ ﺷﺪﻩ ﺍﺳﺖ :ﻳﻜﻲ ﻣﻮﺳﻮﻡ ﺑﻪ ﻣﺠﻤﻮﻋﻪ ﻋﻨﻮﺍﻥ ﻳﺎ h eadingﺭﺍﺑﻄﻪ ﻭ ﺩﻳﮕﺮﻱ ﻣﺠﻤﻮﻋﻪ ﺑﺪﻧـﻪ ﻳـﺎ . bodyﻋﻨﻮﺍﻥ ،ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺛﺎﺑﺖ ﺍﺯ ﺻﻔﺎﺕ ﺧﺎﺻﻪ An ........A1ﺍﺳﺖ ﻛﻪ ﺍﻳﻦ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻫﺮ ﻳﻚ ﻣﻘﺎﺩﻳﺮﺷﺎﻥ ﺭﺍ ﺍﺯ ﻳـﻚ ﻣـﻴﺪﺍﻥ ) ﺣـﻮﺯﻩ( ﻣﻲ ﮔﻴﺮﻧﺪ .ﻣﺠﻤﻮﻋﻪ ﺑﺪﻧﻪ ﻣﺠﻤﻮﻋﻪ ﺍﻳﺴﺖ ﻣﺘﻐﻴﺮ ﺩﺭ ﺯﻣﺎﻥ ﺍﺯ ﭼﻨﺪ ﺗﺎﻳﻲ ﻣﻘﺎﺩﻳﺮ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺑﻨﺎﻡ ﻻ ﺩﺭ ﻣـﺪﻝ ﺭﺍﺑﻄـﻪ ﺍﻱ ﺍﺯ ﺍﺻـﻼﺡ ﺟـﺪﻭﻝ ﺑﺠﺎﻱ ﺭﺍﺑﻄﻪ ﻧﻴﺰﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ .ﻳﻌﻨﻲ ﺟﺪﻭﻝ ﺍﻣﻜﺎﻧﻲ ﺍﺳﺖ ﺗﺎﭘـﻞ) .( tupleﻣﻌﻤـﻮ ﹰ ﺑـﺮﺍﻱ ﻧﻤـﺎﻳﺶ ﻣﻔﻬـﻮﻡ ﺭﺍﺑﻄﻪ ﺑﺨﺎﻃﺮ ﺗﺎﻣﻴﻦ ﻭ ﻭﺿﻮﺡ ﻛﺎﺭﺑﺮﺩﻱ .ﻣﻌﻤﻮﻻ ﺭﺍﺑﻄﻪ ﺭﺍ ﺑﺼﻮﺭﺕ ) r ( Rﻧﻤﺎﻳﺶ ﻣﻴﺪﻫﻨﺪ ﻛﻪ ﺑﻪ R ﺷﻤﺎﻱ ﺭﺍﺑﻄﻪ ﻧﻴﺰ ﮔﻔﺘﻪ ﻣﻴﺸﻮﺩR = ( A1,A2,A3,…) . CITY
-١-١-٣ﺗﻌﺮﻳﻒ ﺩﺍﻣﻨﻪ /ﻣﻴﺪﺍﻥ :
STAT
SNAME
ﻣﺠﻤﻮﻋﻪ ﺍﻳﺴﺖ ﻛﻪ ﻣﻘﺎﺩﻳﺮﻳﻚ ﺻﻔﺖ ﺧﺎﺻﻪ ﺍﺯ ﺁﻥ ﺑﺮﮔﺮﻓﺘﻪ ﻣﻲ ﺷﻮﻧﺪ. ﻣﺜﺎﻝ :ﻣﻮﺟﻮﺩﻳﺖ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﻣﻲ ﮔﻴﺮﻳﻢ: ﻣﺠﻤﻮﻋﻪ ﻋﻨﻮﺍﻥ
ﻣﺠﻤﻮﻋﻪ ﺑﺪﻧﻪ
S#
City
Status
SNAME
S#
ﺗﻬﺮﺍﻥ
٢٠
ﻧﺎﻡ١
١٠٠
ﻗﺰﻭﻳﻦ
٣٠
ﻧﺎﻡ٢
٢٠٠
ﻛﺮﺝ
٥٠
ﻧﺎﻡ ٣
٣٠٠
ﺗﺒﺮﻳﺰ
١٥
ﻧﺎﻡ٤
٢٥٠
ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ ﻭ ﻧﻤﺎﻳﺶ ﺟﺪﻭﻟﻲ: ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ)ﺗﺌﻮﺭﻳﺴﻴﻦ(
ﺳﺎﺧﺘﺎﺭ ﺟﺪﻭﻟﻲ)ﻃﺮﺍﺡ(
ﺭﺍﺑﻄﻪ
ﺟﺪﻭﻝ
ﺗﺎﭘﻞ
ﺳﻄﺮ
ﺻﻔﺖ ﺧﺎﺻﻪ
ﺳﺘﻮﻥ
ﻣﻴﺪﺍﻥ
ﻣﻘﺎﺩﻳﺮ ﻣﺠﺎﺯ ﻳﻚ ﺳﺘﻮﻥ
ﻭﻗﺘـﻴﻜﻪ ﺍﺳﻢ ﻭ ﻣﺠﻤﻮﻋﻪ ﻋﻨﻮﺍﻥ ﺭﺍﺑﻄﻪ ﻣﺸﺨﺺ ﺑﺎﺷﺪ ﮔﻮﻳﻨﺪ ﺫﺍﺕ ﻳﺎ ﺟﻮﻫﺮ ﺭﺍﺑﻄﻪ ) ( I ntensionﻣﻌﻠﻮﻡ ﺍﺳﺖ .ﺑﻪ ﺑﺪﻧﻪ ﺭﺍﺑﻄﻪ ﺑﺴﻂ ﺭﺍﺑﻄﻪ ) (Extensionﻧﻴﺰ ﮔﻮﻳﻨﺪ. ﻧﻜﺘﻪ :ﺫﺍﺕ ﺭﺍﺑﻄﻪ ﺛﺎﺑﺖ ﺩﺭ ﺯﻣﺎﻥ ﺍﺳﺖ ﺍﻣﺎ ﺑﺴﻂ ﺭﺍﺑﻄﻪ ﺩﺭ ﺯﻣﺎﻥ ﻣﺘﻐﻴﺮ ﺍﺳﺖ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٠ /
-٢-١-٣ﺩﺭﺟﻪ ﺭﺍﺑﻄﻪ: ﺗﻌـﺪﺍﺩ ﺻـﻔﺎﺕ ﺧﺎﺻـﻪ ﺭﺍﺑﻄـﻪ ﺭﺍ ﺩﺭﺟـﻪ ﺁﻥ ﮔﻮﻳـﻨﺪ .ﺍﮔﺮ ﺩﺭﺟﻪ ﺭﺍﺑﻄﻪ ﻳﻚ ﺑﺎﺷﺪ ﺭﺍﺑﻄﻪ ﻳﮕﺎﻧﻲ ،ﺭﺍﺑﻄﻪ ﺩﺭﺟﻪ ﺩﻭ ﺭﺍ ﺩﻭﮔﺎﻧﻲ ) ، (binaryﺭﺍﺑﻄﻪ ﺩﺭﺟﻪ ﺳﻪ ﺭﺍ ﺳﻪ ﮔﺎﻧﻲ ) (Ternaryﻭ ﺭﺍﺑﻄﻪ ﺑﺎ ﺩﺭﺟﻪ Nﺭﺍ Nﮔﺎﻧﻲ )(N-rayﮔﻮﻳﻨﺪ. -٣-١-٣ﻛﺎﺭﺩﻳﻨﺎﻟﻴﺘﻲ ﺭﺍﺑﻄﻪ: ﺑـﻪ ﺗﻌـﺪﺍﺩ ﺗﺎﭘﻠﻬﺎﻱ ﺭﺍﺑﻄﻪ ﺩﺭ ﻳﻚ ﻟﺤﻈﻪ ﺍﺯ ﺣﻴﺎﺕ ﺁﻥ ﻛﺎﺭﺩﻳﻨﺎﻟﻴﺘﻲ ﺭﺍﺑﻄﻪ ﮔﻮﻳﻨﺪ .ﻛﺎﺭﺩﻳﻨﺎﻟﻴﺘﻲ ﺭﺍﺑﻄﻪ ﺩﺭ ﻃﻮﻝ ﺣﻴﺎﺕ ﺭﺍﺑﻄﻪ ﻣﺘﻐﻴﺮ ﺍﺳﺖ .ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ ،ﺭﺍﺑﻄﻪ ﺍﺯ ﺩﺭﺟﻪ ﺭﺍﺑﻄﻪ ٤ﻣﻴﺒﺎﺷﺪ. -٤-١-٣ﺧﺼﻮﺻﻴﺎﺕ ﺭﺍﺑﻄﻪ: _١ﺑﻪ ﻛﻤﻚ ﻳﻚ ﺳﺎﺧﺘﺎﺭ ﺳﺎﺩﻩ ﺑﻨﺎﻡ ﺟﺪﻭﻝ ﻗﺎﺑﻞ ﻧﻤﺎﻳﺶ ﺍﺳﺖ. _٢ﺗﺎﭘـﻞ ﺗﻜـﺮﺍﺭﻱ ﺩﺭ ﺭﺍﺑﻄـﻪ ﻭﺟـﻮﺩ ﻧـﺪﺍﺭﺩ .ﺯﻳـﺮﺍ ﺑﺪﻧـﻪ ﺭﺍﺑﻄﻪ ﻣﺠﻤﻮﻋﻪ ﺍﺳﺖ ﻭ ﺩﺭ ﻣﺠﻤﻮﻋﻪ ﻋﻨﺎﺻﺮ ﺗﻜﺮﺍﺭﻱ ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ. _٣ﺗﺎﭘﻠﻬﺎﺩﺭ ﺭﺍﺑﻄﻪ ﻧﻈﻢ ﺧﺎﺻﻲ ﻧﺪﺍﺭﻧﺪ.ﺍﻳﻦ ﺧﺎﺻﻴﺖ ﻧﻴﺰ ﺍﺯ ﻣﺠﻤﻮﻋﻪ ﺑﻮﺩﻥ ﺑﺪﻧﻪ ﺭﺍﺑﻄﻪ ﻧﺘﻴﺠﻪ ﻣﻲ ﺷﻮﺩ. _٤ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻧﻈﻢ ﻧﺪﺍﺭﻧﺪ .ﺍﻳﻦ ﺧﺎﺻﻴﺖ ﻧﻴﺰ ﺍﺯ ﻣﺠﻤﻮﻋﻪ ﺑﻮﺩﻥ ﻋﻨﻮﺍﻥ ﺭﺍﺑﻄﻪ ﻧﺘﻴﺠﻪ ﻣﻲ ﺷﻮﺩ _٥ﻋﻨﺎﺻـﺮ ﺗﺸﻜﻴﻞ ﺩﻫﻨﺪﻩ ﺗﺎﭘﻞ ﺍﺗﻤﻴﻚ ﻫﺴﺘﻨﺪ ﻳﻌﻨﻲ ﺗﺠﺰﻳﻪ ﻧﺸﺪﻧﻲ ﻣﻲ ﺑﺎﺷﻨﺪ .ﺑﻌﺒﺎﺭﺗﻲ ﮔﻮﺋﻴﻢ ﻳﻚ ﻓﻘﺮﻩ ﺩﺍﺩﻩ ﺗﺠﺰﻳﻪ ﻧﺸـﺪﻧﻲ ﺍﺳـﺖ ﺍﮔـﺮ ﻧـﺘﻮﺍﻥ ﺁﻥ ﺭﺍ ﺑﻪ ﻣﻘﺎﺩﻳﺮ ﺩﻳﮕﺮ ﺗﺠﺰﻳﻪ ﻛﺮﺩ.ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ :ﻣﻘﺎﺩﻳﺮ ﺗﺎﺭﻳﺦ ﻣﺎﻫﻴﺘﻲ ﻏﻴﺮ ﺍﺗﻤﻴﻚ ﺩﺍﺭﺩ ﺯﻳﺮﺍ ﺍﺯ ﺳﻪ ﺟـﺰﺀ ﻣـﺎﻩ ،ﺳـﺎﻝ ﻭ ﺭﻭﺯ ﺗﺸﻜﻴﻞ ﺷﺪﻩ ﺍﺳﺖ .ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﺧﺎﺹ ﺍﺗﻤﻴﻚ ﻭ ﻳﺎ ﻏﻴﺮ ﺍﺗﻤﻴﻚ ﺑﻮﺩﻥ ﺗﺎﺭﻳﺦ ﺑﺴﺘﮕﻲ ﺑﻪ ﺩﻳﺪ ﻃﺮﺍﺡ ﺩﺭ ﻃﺮﺍﺣﻲ ﺩﺍﺭﺩ ﺑﻨﺎﺑﺮﺍﻳﻦ ﺍﻳﻦ ﺩﻭ ﻣﻔﻬﻮﻡ ﻣﻄﻠﻖ ﻧﻴﺴﺘﻨﺪ ﻭ ﺑﻪ ﻣﻌﻨﺎﻳﻲ ﻛﻪ ﻃﺮﺍﺡ ﺑﺮﺍﻱ ﺩﺍﺩﻩ ﻫﺎ ﻗﺎﺋﻞ ﻣﻲ ﺷﻮﺩ ﺑﺴﺘﮕﻲ ﺩﺍﺭﺩ. -٢-٣ﻣﻔﻬﻮﻡ ﻣﻴﺪﺍﻥ ﻭ ﻧﻘﺶ ﺁﻥ ﺩﺭ ﻋﻤﻠﻴﺎﺕ ﺭﻭﻱ ﺑﺎﻧﻚ: ﻣﻴﺪﺍﻥ :ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﻣﻘﺎﺩﻳﺮ ﺍﺳﺖ ﻛﻪ ﻳﻚ ﻳﺎ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺻﻔﺖ ﺧﺎﺻﻪ ﺍﺯ ﺁﻥ ﻣﻘﺪﺍﺭ ﻣﻲ ﮔﻴﺮﻧﺪ .ﻣﻴﺪﺍﻥ ﺩﺭ ﻋﻤﻠﻴﺎﺕ ﺭﻭﻱ ﺑﺎﻧﻚ ﻣﺰﺍﻳﺎﻳﻲ ﺩﺍﺭﺩ ﻛﻪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ: -١-٢-٣ﺳﺒﺐ ﺳﺎﺩﻩ ﺗﺮ ﺷﺪﻥ ﻭ ﻛﻮﺗﺎﻫﺘﺮ ﺷﺪﻥ ﺷﻤﺎﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﻴﮕﺮﺩﺩ ).ﺍﺯ ﻧﻈﺮ ﺗﻌﺪﺍﺩ ﺍﺣﻜﺎﻡ ( .ﺯﻳﺮﺍ ﻻﺯﻡ ﻧﻴﺴﺖ ﻛﻪ ﺩﺭ ﺗﻤﺎﻡ ﺭﺍﺑﻄﻪ ﻫﺎ ،ﻫﺮﺑﺎﺭ ﻣﺸﺨﺼﺎﺕ ﺻﻔﺎﺕ ﺭﺍ ﺑﺪﻫﻴﻢ٠. _٢-٢-٣ﻛﻨﺘﺮﻝ ﻣﻘﺪﺍﺭﻱ ﻋﻤﻠﻴﺎﺕ ﺩﺭ ﭘﺎﻳﮕﺎﻩ. ﻣﻘﺎﺩﻳـﺮ ﻳـﻚ ﺻـﻔﺖ ﺧﺎﺻﻪ ﺩﺭ ﻃﻮﻝ ﺣﻴﺎﺕ ﺭﺍﺑﻄﻪ ،ﺍﺯ ﻣﻘﺎﺩﻳﺮ ﻣﻴﺪﺍﻥ ﺑﺮﮔﺮﻓﺘﻪ ﻣﻲ ﺷﻮﻧﺪ .ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺑﺎﻳﺪ ﺩﺭ ﻣﻴﺪﺍﻥ ﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ .ﺑﻨﺎﺑﺮﺍﻳﻦ ﺑﻪ ﻛﻤﻚ ﻣﻔﻬﻮﻡ ﻣﻴﺪﺍﻥ ﻣﻲ ﺗﻮﺍﻥ ﻋﻤﻠﻴﺎﺕ ﺭﻭﻱ ﺑﺎﻧﻚ ﺭﺍ ﺍﺯ ﻧﻈﺮ ﻣﻘﺎﺩﻳﺮ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻛﻨﺘﺮﻝ ﻛﺮﺩ. ﺑﻄـﻮﺭ ﻣـﺜﺎﻝ ﺍﮔـﺮ ﻣﻴﺪﺍﻥ ﻣﻘﺎﺩﻳﺮ STAUSﺑﺼﻮﺭﺕ } Domain STATUS = {10,20,30,40,50ﺑﺎﺷﺪ ﺍﻣﻜﺎﻥ ﺩﺭﺝ ﺍﻃﻼﻉ ) ﺗﻬﺮﺍﻥ ﻭ ( S7, Sn7, 60ﺩﺭ ﺑﺎﻧﻚ ﻣﻴﺴﺮ ﻧﻤﻲ ﺑﺎﺷﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣١ /
-٣-٢-٣ﺍﻣﻜﺎﻧﻲ ﺍﺳﺖ ﺑﺮﺍﻱ ﻛﻨﺘﺮﻝ ﻣﻌﻨﺎﻳﻲ ﭘﺮﺱ ﻭ ﺟﻮﻫﺎ ﻣﺜﺎﻝ :ﺷﻤﺎﺭﻩ ﻗﻄﻌﺎﺗﻲ ﺭﺍ ﺑﺪﻫﻴﺪ ﻛﻪ ﻭﺯﻥ ﺁﻧﻬﺎ ﺑﺮﺍﺑﺮ ﺗﻌﺪﺍﺩ ﺗﻬﻴﻪ ﺷﺪﻩ ﺁﻧﻬﺎ ﺑﺎﺷﺪ. ﺻـﻔﺎﺕ ﻭﺯﻥ ﻭ ﺗﻌﺪﺍﺩ ﺑﻪ ﺍﻋﺘﺒﺎﺭ ﻫﻤﻨﻮﻉ ﺑﻮﺩﻥ ﻗﺎﺑﻞ ﻣﻘﺎﻳﺴﻪ ﺍﻧﺪ ﻭ ﺳﻴﺴﺘﻢ ﻣﻲ ﺗﻮﺍﻧﺪ ﺑﺎ ﺍﻧﺠﺎﻡ ﻣﻘﺎﻳﺴﻪ ﻫﺎﻱ ﻻﺯﻡ ،ﺑﻪ ﭘﺮﺳﺶ ﻛﺎﺭﺑﺮ ﭘﺎﺳﺦ ﺩﻫﺪ .ﺍﻣﺎ ﺍﻳﻦ ﺩﻭ ﺻﻔﺖ ﺑﻪ ﻟﺤﺎﻅ ﻣﻔﻬﻮﻣﻲ ﻏﻴﺮ ﻗﺎﺑﻞ ﻣﻘﺎﻳﺴﻪ ﺍﻧﺪ ،ﺯﻳﺮﺍ ﺭﻭﻱ ﺩﻭ ﻣﻴﺪﺍﻥ ﻣﺎﻫﻴﺘﹰﺎ ﻣﺘﻔﺎﻭﺕ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﻧﺪ. _٤-٢-٣ﭘﺎﺳﺨﮕﻮﻳﻲ ﺑﻪ ﺑﻌﻀﻲ ﺍﺯ ﭘﺮﺱ ﻭ ﺟﻮﻫﺎ ﺭﺍ ﺁﺳﺎﻥ ﻣﻴﻜﻨﺪ. ﺍﮔﺮ ﺍﻣﻜﺎﻥ ﺗﻌﺮﻳﻒ ﻣﻴﺪﺍﻥ ﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺍﻳﻦ ﺗﻌﺮﻳﻒ ﻭﺍﺭﺩ ﻛﺎﺗﺎﻟﻮﮒ ﺳﻴﺴﺘﻢ ﺑﻌﻨﻮﺍﻥ ﺑﺨﺸﻲ ﺍﺯ ﺷﻤﺎﻱ ﺍﺩﺭﺍﻛﻲ ﭘﺎﻳﮕﺎﻩ ﻣﻲ ﺷﻮﺩ ﻭ ﺩﺭ ﺷﺮﺍﻳﻄﻲ ﺑﺮﺧﻲ ﺍﺯ ﻛﺎﺭﺑﺮﺍﻥ ﻣﻲ ﺗﻮﺍﻧﻨﺪ ﺍﺯ ﺁﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻨﺪ. ﻣﺜﺎﻝ :ﺩﺭﭼﻪ ﺭﺍﺑﻄﻪ ﻫﺎﻳﻲ ﺍﺯ ﭘﺎﻳﮕﺎﻩ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺯ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﻭﺟﻮﺩ ﺩﺍﺭﺩ؟ ﺍﮔﺮ ﻣﻴﺪﺍﻥ ﻫﺎ ﺗﻌﺮﻳﻒ ﺷﻮﻧﺪ ﺑﺮﺍﻱ ﭘﺎﺳﺨﮕﻮﻳﻲ ﺑﻪ ﺍﻳﻦ ﭘﺮﺱ ﻭ ﺟﻮ ﻓﻘﻂ ﻣﺮﺍﺟﻌﻪ ﺑﻪ ﻛﺎﺗﺎﻟﻮﮒ ﻛﻔﺎﻳﺖ ﻣﻲ ﻛﻨﺪ . -٣-٣ﻣﻔﻬﻮﻡ ﻛﻠﻴﺪ ﺩﺭ ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ: ﺩﺭ ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ ﭼﻨﺪ ﻣﻔﻬﻮﻡ ﺩﺭ ﺧﺼﻮﺹ ﻛﻠﻴﺪ ﻣﻄﺮﺡ ﺍﺳﺖ ﻛﻪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ : •
ﺍﺑﺮ ﻛﻠﻴﺪ
•
ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ
•
ﻛﻠﻴﺪ ﺍﺻﻠﻲ
•
ﻛﻠﻴﺪ ﺑﺪﻳﻞ
•
ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ
-١-٣-٣ﻣﻔﻬﻮﻡ ﺍﺑﺮ ﻛﻠﻴﺪ super key ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯﻳﻚ ﻳﺎ ﭼﻨﺪ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺭﺍ ﻛﻪ ﺩﺍﺭﺍﻱ ﻳﻜﺘﺎﻳﻲ ﻣﻘﺪﺍﺭ ﺑﺎﺷﻨﺪ ﺍﺑﺮﻛﻠﻴﺪ ﮔﻮﻳﻨﺪ .ﺑﻪ ﺑﻴﺎﻥ ﺩﻳﮕﺮ ،ﻫﺮ ﺗﺮﻛﻴﺒﻲ ﺍﺯ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺭﺍﺑﻄﻪ ﻛﻪ ﺩﺭ ﻫﻴﭻ ﺩﻭ ﺗﺎﭘﻞ ﻣﻘﺪﺍﺭ ﻳﻜﺴﺎﻥ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﺪ. ١_٣ _٤ﻛﻠﻴﺪ)ﻧﺎﻣﺰﺩ( ﻛﺎﻧﺪﻳﺪ:
Candidate Key
ﺍﺑـﺮ ﻛﻠـﻴﺪﻱ ﻛـﻪ ﺧﺎﺻـﻴﺘﻲ ﻛـﺎﻫﺶ ﻧﺎﭘﺬﻳـﺮﻱ ﺩﺍﺷـﺘﻪ ﺑﺎﺷـﺪ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﮔﻮﻳﻨﺪ .ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﻫﺮ ﺯﻳﺮ ﻣﺠﻤﻮﻋﻪ ﺍﺯ ﻣﺠﻤﻮﻋﻪ ﻋﻨﻮﺍﻥ ) ( Ai, Aj ..Akﻛﻪ ﺩﻭ ﺧﺎﺻﻴﺖ ﺯﻳﺮ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﮔﻮﻳﻨﺪ. _١ﻳﻜﺘﺎﻳﻲ ﻣﻘﺪﺍﺭ ) ( Uniqueness ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﺎ ﻛﻪ ﺩﺭ ﻫﺮ ﻟﺤﻈﻪ ﺍﺯ ﺣﻴﺎﺕ ﺭﺍﺑﻄﻪ ﻣﻘﺪﺍﺭ ) ( A i , Aj ..Akﻳﻜﺘﺎ ﺑﺎﺷﺪ. _٢ﻛﺎﻫﺶ ﻧﺎﭘﺬﻳﺮﻱ minimatlity
ﺑـﻪ ﺍﻳـﻦ ﻣﻌﻨـﻲ ﺍﺳﺖ ﻛﻪ ﺍﺯ ﻧﻈﺮ ﺗﻌﺪﺍﺩ ﺍﺟﺰﺍﺀ ﺩﺭ ﺣﺪﺍﻗﻞ ﺑﺎﺷﺪ ﺩﺭ ﻋﻴﻦ ﺣﺎﻝ ﻛﻪ ﻳﻜﺘﺎﻳﻲ ﻣﺤﻔﻮﻅ ﺑﻤﺎﻧﺪ .ﮔﻮﺋﻴﻢ ﺯﻳﺮ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﻛـﺎﻫﺶ ﻧﺎﭘﺬﻳـﺮ ﺍﺳـﺖ ﻳـﺎ ﺣﺪﺍﻗﻞ ﺍﺟﺰﺍﺀ ﺩﺍﺭﺩ ﺍﮔﺮ ﻳﻜﻲ ﺍﺯ ﻋﻨﺎﺻﺮ ﺍﻳﻦ ﺯﻳﺮﻣﺠﻤﻮﻋﻪ ﺣﺬﻑ ﺷﻮﺩ ﺩﺭ ﺯﻳﺮﻣﺠﻤﻮﻋﻪ ﺑﺎﻗﻴﻤﺎﻧﺪﻩ ﺧﺎﺻﻴﺖ ﻳﻜﺘﺎﻳﻲ ﻣﻘﺪﺍﺭﺍﺯ ﺑﻴﻦ ﺑﺮﻭﺩ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٢ /
ﺑـﺎ ﺗـﻮﺟﻪ ﺑـﻪ ﺗﻌﺎﺭﻳﻒ ﻣﻲ ﺑﻴﻨﻴﻢ ﻫﺮ ﺍﺑﺮﻛﻠﻴﺪ ﻟﺰﻭﻣﺎ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻧﻴﺴﺖ ﺍﻣﺎ ﻫﺮ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺟﺰﺀ ﻣﺠﻤﻮﻋﻪ ﻫﺎﻱ ﺍﺑﺮ ﻛﻠﻴﺪ ﺭﺍﺑﻄﻪ ﻫﺴﺖ. ﻣﺜﺎﻝ :ﺩﺭ ﺭﺍﺑﻄﻪ Sﺻﻔﺖ ﺧﺎﺻﻪ S#ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺍﺳﺖ ﻭ ﺩﺭ ﺭﺍﺑﻄﻪ ( S#, P# ) SPﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺍﺳﺖ. ﻧﻜﺘﻪ :١ :ﺭﺍﺑﻄﻪ ﻣﻤﻜﻦ ﺍﺳﺖ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ﻧﻜـﺘﻪ _٢ﻭﺟـﻮﺩ ﺣـﺪﺍﻗﻞ ﻳﻚ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺩﺭ ﺭﺍﺑﻄﻪ ﺗﻀﻤﻴﻦ ﺍﺳﺖ ﺯﻳﺮﺍ ﺩﺭ ﺑﺪﺗﺮﻳﻦ ﺣﺎﻟﺖ ﺑﺎ ﺗﺮﻛﻴﺐ ﺗﻤﺎﻡ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺑﻪ ﻳﻜﺘﺎﻳـﻲ ﻣﻘـﺪﺍﺭ ﻣـﻲ ﺭﺳـﻴﻢ .ﺑﻪ ﺭﺍﺑﻄﻪ ﺍﻱ ﻛﻪ ﻣﺠﻤﻮﻋﻪ ﻋﻨﻮﺍﻧﺶ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺁﻥ ﺑﺎﺷﺪ ﺍﺻﻄﻼﺣﹰﺎ ﺭﺍﺑﻄﻪ ﺗﻤﺎﻡ ﻛﻠﻴﺪ
(All
) keyﻧﺎﻣﻴﺪﻩ ﻣﻲ ﺷﻮﺩ. ﻧﻜﺘﻪ _٣ﻧﻘﺶ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ :ﺍﻣﻜﺎﻧﻲ ﺍﺳﺖ ﺑﺮﺍﻱ ﺍﺭﺟﺎﻉ ﺑﻪ ﺗﺎﭘﻞ ﻳﻌﻨﻲ ﻧﻮﻋﻲ ﻣﻜﺎﻧﻴﺴﻢ ﺁﺩﺭﺱ ﺩﻫﻲ ﺩﺭ ﺳﻄﺢ ﺗﺎﭘﻞ ﺍﺳﺖ. ٢_٣ _٣ﻛﻠﻴﺪ ﺍﺻﻠﻲPrimary Key :
ﻳﻜـــﻲ ﺍﺯ ﻛﻠـــﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳـــﺪ ﺍﺳـــﺖ ﻛـــﻪ ﻃـــﺮﺍﺡ ﺑـــﺎ ﺗـــﻮﺟﻪ ﺑـــﻪ ﻣﻼﺣﻀـــﺎﺕ ﻣﺤـــﻴﻂ ﻋﻤﻠﻴﺎﺗـــﻲ ،ﺧـــﻮﺩ ﺍﻧـــﺘﺨﺎﺏ ﻣﻲ ﻛﻨﺪ .ﺩﻭ ﺿﺎﺑﻄﻪ ﺩﺭ ﺗﻌﻴﻴﻦ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺯ ﺑﻴﻦ ﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﺑﺎﻳﺪ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺘﻪ ﺷﻮﻧﺪ. _١ﻧﻘﺶ ﻭ ﺍﻫﻤﻴﺖ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻧﺴﺒﺖ ﺑﻪ ﺳﺎﻳﺮ ﻛﻠﻴﺪ ﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﺩﺭ ﭘﺎﺳﺨﮕﻮﻳﻲ ﺑﻪ ﻧﻴﺎﺯ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺍﻥ _٢ﻛﻮﺗﺎﻫﺘﺮ ﺑﻮﺩﻥ ﻃﻮﻝ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺍﺯ ﻧﻈﺮ ﻃﻮﻝ ﺭﺷﺘﻪ ﺑﺎﻳﺘﻲ ﺣﺎﺻﻠﻪ ﺍﺯ ﺗﺮﻛﻴﺐ ﺻﻔﺎﺕ ﺧﺎﺻﻪ. ﻛﻠـﻴﺪ ﺍﺻـﻠﻲ ﺷﻨﺎﺳـﻪ ﺗﺎﭘـﻞ ﺍﺳـﺖ ﻭ ﺑﺎﻳﺴـﺘﻲ ﺑـﻪ ﻧﻮﻋـﻲ ﺑـﻪ ﺳﻴﺴﺘﻢ ﻣﻌﺮﻓﻲ ﺷﻮﺩ ﻛﻪ ﻣﻌﻤﻮﻻ ﺩﺭ ﺳﻴﺴﺘﻤﻬﺎﻱ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﺎ ﻋﺒﺎﺭﺕ ) Primary Key (Attributeﺗﻌﺮﻳﻒ ﻣﻴﺸﻮﺩ. - ٣ _٣ _٣ﻛﻠﻴﺪ ﻧﺎﻣﺰﺩ)ﺑﺪﻳﻞ(
Alternate Key
ﻫـﺮ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻏﻴﺮ ﺍﺯ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻛﻠﻴﺪ ﺑﺪﻳﻞ ﻧﺎﻣﻴﺪﻩ ﻣﻲ ﺷﻮﺩ.ﺍﮔﺮ ﻫﻤﻪ ﻛﻠﻴﺪ ﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﺭﺍﺑﻄﻪ ﻭ ﻧﻴﺰ ﺧﻮﺩ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺑﻪ ﺳﻴﺴﺘﻢ ﻣﻌﺮﻓﻲ ﺷﻮﻧﺪ ،ﺩﻳﮕﺮ ﻧﻴﺎﺯﻱ ﺑﻪ ﺗﺼﺮﻳﺢ ﻛﻠﻴﺪ ﺩﻳﮕﺮ ﺑﺎ ﻋﺒﺎﺭﺕ Alternate Keyﻧﻴﺴﺖ. : ٤ _٣ _٣ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ
Foreign Key
ﻼ Riﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺑﺎﺷﺪ ﻛﻠﻴﺪ ﻫـﺮ ﺻـﻔﺖ ﺧﺎﺻـﻪ ﺍﻱ ﺍﺯ ﺭﺍﺑﻄـﻪ ) Rjﺳـﺎﺩﻩ ﻳﺎ ﻣﺮﻛﺐ ( ﻣﺎﻧﻨﺪ Aiﻛﻪ ﺩﺭ ﺭﺍﺑﻄﻪ ﺍﻱ ﺩﻳﮕﺮ ﻣﺜ ﹰ ﺧﺎﺭﺟﻲ Rjﻧﺎﻣﻴﺪﻩ ﻣﻲ ﺷﻮﺩ. ﻣﺜﺎﻝ :ﺻﻔﺖ ﺧﺎﺻﻪ S#ﺩﺭ ﺟﺪﻭﻝ SPﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺍﺳﺖ ﻭ ﺻﻔﺖ ﺧﺎﺻﻪ P#ﺩﺭ ﺭﺍﺑﻄﻪ SPﻧﻴﺰ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺍﺳﺖ. ﻧﻜـﺘﻪ :ﻟﺰﻭﻣـﻲ ﻧـﺪﺍﺭﺩ ﻛـﻪ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﻳﻚ ﺭﺍﺑﻄﻪ ﺟﺰﺀ ﺗﺸﻜﻴﻞ ﺩﻫﻨﺪﻩ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻫﻤﺎﻥ ﺭﺍﺑﻄﻪ ﺑﺎﺷﺪ ﻫﺮ ﭼﻨﺪ ﺩﺭ ﻣﺜﺎﻝ ﺑﺎﻻ ﭼﻨﻴﻦ ﺍﺳﺖ. ﻣﺜﺎﻝDepartment ( Dept # , Dname , manager - Emp #, budget ) : ) Employe ( Emp # , Ename, Dept # , Salary
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٣ /
ﺩﺭ ﺭﺍﺑﻄـﻪ deparmentﺻـﻔﺖ ﺧﺎﺻـﻪ dept #ﻛﻠـﻴﺪ ﺍﺻـﻠﻲ ﺍﺳـﺖ ﻟـﺬﺍ ﺩﺭ ﺭﺍﺑﻄﻪ Employeﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺍﺳﺖ ﻭ ﻧﻴﺰ ﺻـﻔﺖ ﺧﺎﺻـﻪ Emp #ﺩﺭ ﺟـﺪﻭﻝ Employeﻛﻠـﻴﺪ ﺍﺻـﻠﻲ ﺍﺳﺖ ﭘﺲ ﺻﻔﺖ ﺧﺎﺻﻪ Manager - Emp #ﺩﺭ ﺭﺍﺑﻄﻪ departmentﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺍﺳﺖ ﻭ ﺟﺰﺋﻲ ﺍﺯ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﻫﻢ ﻧﻴﺴﺖ. ﻧﻜﺘﻪ :ﻟﺰﻭﻣﻲ ﻧﺪﺍﺭﺩ Rjﺍﺯ Riﻣﺘﻤﺎﻳﺰ ﺑﺎﺷﺪ: ) E mploye ( Emp # , Ename, Manager -Emp # , Salay
ﺭﺍﺑﻄﻪ :ﻛﺎﺭﻣﻨﺪ ﻣﺪﻳﺮ ﺍﺳﺖ . ﺳﻮﺍﻝ :ﻧﻘﺶ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﭼﻴﺴﺖ؟ ﻛﻠـﻴﺪ ﺧﺎﺭﺟـﻲ ﺍﻣﻜﺎﻧﻲ ﺍﺳﺖ ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﺗﺎﭘﻠﻬﺎ .ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ ﻭﺟﻮﺩ ﻛﻠﻴﺪ ﻫﺎﻱ ﺧﺎﺭﺟﻲ P #, S#ﺩﺭ ﺭﺍﺑﻄﻪ Sp
ﻧﻤﺎﻳﺸﮕﺮ ﺍﺭﺗﺒﺎﻃﻲ ﺍﺳﺖ ﻛﻪ ﺑﻴﻦ ﺗﺎﭘﻠﻬﺎﻱ ﺭﺍﺑﻄﻪ Sﻭ ﺗﺎﭘﻠﻬﺎﻱ ﺭﺍﺑﻄﻪ Pﻭﺟﻮﺩ ﺩﺍﺭﺩ. ﻧﻜﺘﻪ :ﺁﻳﺎ ﺗﻨﻬﺎ ﻋﺎﻣﻞ ﺑﺮﻗﺮﺍﺭﻱ ﺍﺭﺗﺒﺎﻁ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺍﺳﺖ؟ ﭘﺎﺳﺦ ﻣﻨﻔﻲ ﺍﺳﺖ ﻫﺮ ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺸﺘﺮﻙ ﺩﺭ ﻋﻨﻮﺍﻥ ﺩﻭ ﺭﺍﺑﻄﻪ ﺍﻣﻜﺎﻧﻲ ﺍﺳﺖ ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ﻭ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﻧﻮﻋﻲ ﺍﺭﺗﺒﺎﻁ. ﻣﺜﺎﻝ, S (S#, ...,city ) :
) ... city
P ( P#,
ﻭﺟﻮﺩ Cityﺩﺭ ﺭﺍﺑﻄﻪ ﺍﻣﻜﺎﻥ ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﺩﻭ ﻣﻮﺟﻮﺩﻳﺖ ﺭﺍ ﺑﻮﺟﻮﺩ ﻣﻲ ﺁﻭﺭﺩ .ﺩﺭ ﺻﻮﺭﺗﻴﻜﻪ C ityﻧﻪ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ Sﻭ ﻧﻪ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ Pﺍﺳﺖ. ﻧﻜﺘﻪ:ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺭﺍﺑﻄﻪ ﺭﺍ ﻧﻴﺰ ﺑﺎﻳﺪ ﺑﻪ ﺳﻴﺴﺘﻢ ﻣﻌﺮﻓﻲ ﻧﻤﻮﺩ .ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻴﺸﻮﺩ : Relation name
FOREIGN KEY (Attribute) REFERENCE
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٤ /
-٤-٣ﺗﺒﺪﻳﻞ ﻣﺪﻝ E/Rﺑﻪ ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ ﻳـﻚ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻃﺮﺍﺣـﻲ ﺷـﺪﻩ ﺑـﺮ ﺍﺳﺎﺱ ﻣﺪﻝ ﻣﻮﺟﻮﺩﻳﺖ/ﺍﺭﺗﺒﺎﻁ ﻣﻲ ﺗﻮﺍﻧﺪ ﺗﻮﺳﻂ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﺟﺪﻭﻝ ﻫﺎ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﺷـﻮﺩ.ﺑـﺮﺍﻱ ﺗـﺒﺪﻳﻞ ﻣـﺪﻝ ﻣﻮﺟـﻮﺩﻳﺖ/ﺍﺭﺗﺒﺎﻁ ﺑﻪ ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ ﺍﺯ ﻳﻜﺴﺮﻱ ﻗﻮﺍﻧﻴﻦ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺩﺭ ﺍﺩﺍﻣﻪ ﺁﻭﺭﺩﻩ ﺷﺪﻩ ﺍﻧﺪ:
ﻗﺎﻋﺪﻩ :١ﻫﺮ ﻣﻮﺟﻮﺩﻳﺖ ﻗﻮﻱ ﺗﻮﺳﻂ ﻳﻚ ﺟﺪﻭﻝ ﺑﺎ ﻫﻤﺎﻥ ﺻﻔﺎﺕ ﻣﻮﺭﺩ ﻧﻈﺮ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ. ﺻـﻔﺎﺕ ﻣـﺮﻛﺐ ﺩﺭ ﻣـﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ ﻭﺟﻮﺩ ﻧﺪﺍﺷﺘﻪ ﺑﻠﻜﻪ ﻓﻘﻂ ﺻﻔﺎﺕ ﺟﺰﺀ ﺁﻥ ﺻﻔﺎﺕ ﻣﺮﻛﺐ ﺑﻄﻮﺭ ﻣﺠﺰﺍ ﺩﺭ ﺟﺪﻭﻝ ﻗﺮﺍﺭ ﻣﻲ ﮔﻴﺮﻧﺪ. ﺻـﻔﺖ ﭼـﻨﺪ ﻣﻘﺪﺍﺭﻱ Mﺍﺯ ﻣﻮﺟﻮﺩﻳﺖ Eﺑﺎ ﻳﻚ ﺟﺪﻭﻝ ﻣﺠﺰﺍﻱ EMﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ .ﺍﻳﻦ ﺟﺪﻭﻝ ﺩﺍﺭﺍﻱ ﺳﺘﻮﻧﻬﺎﻱ ﻣﺘﻨﺎﻇﺮ ﺑﺎ ﻛﻠﻴﺪ ﺍﺻﻠﻲ Eﻭ ﺻﻔﺖ Mﺧﻮﺍﻫﺪ ﺑﻮﺩ. ﻣﺜﺎﻝ :ﻣﻮﺟﻮﺩﻳﺖ Employeeﺑﺎ ﺻﻔﺖ ﭼﻨﺪ ﻣﻘﺪﺍﺭﻱ Skill
Last_Name
Employee_Name
EMPLOYEE
Skill
First_Name
Employee_ID
EMPLOYEE Last_Nam
First_Name
Employee_ID
SKILL Skill
Employee_I
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٥ /
ﻗﺎﻋـﺪﻩ :٢ﻫـﺮ ﻣﻮﺟـﻮﺩﻳﺖ ﺿـﻌﻴﻒ ﺗﻮﺳـﻂ ﻳﻚ ﺟﺪﻭﻝ ﺑﺎ ﻫﻤﺎﻥ ﺻﻔﺎﺕ ﻣﻮﺭﺩ ﻧﻈﺮ ﺑﻪ ﻫﻤﺮﺍﻩ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻣﻮﺟﻮﺩﻳﺖ ﻗﻮﻱ )ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺍﻳﻦ ﺟﺪﻭﻝ( ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ. ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺟﺪﻭﻝ ﺟﺪﻳﺪ ،ﺗﺮﻛﻴﺒﻲ ﺍﺳﺖ ﺍﺯ ﺷﻨﺎﺳﻪ ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒ ﻭ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻣﻮﺟﻮﺩﻳﺖ ﻗﻮﻱ ﻣﻮﺭﺩ ﻧﻈﺮ . ﻣﺜﺎﻝ :ﻣﻮﺟﻮﺩﻳﺖ ﺿﻌﻴﻒDEPENDENT
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٦ /
ﻗﺎﻋﺪﻩ : ٣ﺍﺭﺗﺒﺎﻃﺎﺕ ﺩﺭﺟﻪ . ٢ ﻫﺮ ﺍﺭﺗﺒﺎﻁ ﺩﺭﺟﻪ ﺩﻭ ﭼﻨﺪ ﺑﻪ ﭼﻨﺪ ﺑﺎ ﻳﻚ ﺟﺪﻭﻝ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺳﺘﻮﻧﻬﺎﻳﺶ ﺍﺯ ﻛﻠﻴﺪﻫﺎﻱ ﺍﺻﻠﻲ ﺩﻭ ﻣﻮﺟﻮﺩﻳﺖ ﻣﺸﺎﺭﻛﺖ ﻳﺎﻓﺘﻪ ﺩﺭ ﺍﺭﺗﺒﺎﻁ ﺑﻪ ﻫﻤﺮﺍﻩ ﺻﻔﺎﺕ ﺩﻳﮕﺮ ﻣﺠﻤﻮﻋﻪ ﺍﺭﺗﺒﺎﻁ ﺗﺸﻜﻴﻞ ﻣﻲ ﮔﺮﺩﻧﺪ. ﺍﺭﺗﺒﺎﻃﺎﺕ ﭼﻨﺪ ﺑﻪ ﻳﻚ ﻳﺎ ﻳﻚ ﺑﻪ ﭼﻨﺪ ﺩﺭ ﻃﺮﻑ ﭼﻨﺪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺻﻔﺖ ﺍﺿﺎﻓﻪ ﺷﺪﻩ ﻛﻪ ﻫﻤﺎﻥ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻃﺮﻑ ﻳﻚ ﻣﻲ ﺑﺎﺷﺪ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﻧﺪ).ﺟﺪﻭﻝ ﻣﺠﺰﺍ ﻧﺨﻮﺍﻫﺪ ﺑﻮﺩ(ﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻃﺮﻑ ﻳﻚ ﺑﻪ ﻋﻨﻮﺍﻥ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﻃﺮﻑ ﭼﻨﺪ ﻣﻨﻈﻮﺭ ﻣﻲ ﮔﺮﺩﺩ. ﻣﺜﺎﻝ :ﺩﺭ ﺷﻜﻞ ﺯﻳﺮ ،ﺑﺠﺎﻱ ﺍﻳﺠﺎﺩ ﻳﻚ ﺟﺪﻭﻝ ﺑﺮﺍﻱ ﺍﺭﺗﺒﺎﻁ account-branchﺻﻔﺖ branchnameﺑﻪ ﺟﺪﻭﻝ accountﺍﺿﺎﻓﻪ ﻣﻲ ﺷﻮﺩ.
ﺩﺭ ﺍﺭﺗـﺒﺎﻃﺎﺕ ﻳـﻚ ﺑـﻪ ﻳـﻚ ،ﻫـﺮ ﻃﺮﻓـﻲ ﻣﻲ ﺗﻮﺍﻧﺪ ﺑﻪ ﻋﻨﻮﺍﻥ ﭼﻨﺪ ﺍﻧﺘﺨﺎﺏ ﺷﻮﺩ.ﺑﺪﻳﻦ ﻣﻌﻨﻲ ﻛﻪ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻃﺮﻑ ﻣﻬﻤﺘﺮ ﺑﻪ ﻋﻨﻮﺍﻥ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﻃﺮﻑ ﻛﻢ ﺍﻫﻤﻴﺖ ﺗﺮ ﺍﺿﺎﻓﻪ ﻣﻲ ﺷﻮﺩ.
ﻗﺎﻋﺪﻩ : ٤ﺍﺭﺗﺒﺎﻃﺎﺕ ﺩﺭﺟﻪ ﻳﻚ)ﺑﺎﺯﮔﺸﺘﻲ(. ﻫﺮ ﺍﺭﺗﺒﺎﻁ ﺩﺭﺟﻪ ﻳﻚ ﭼﻨﺪ ﺑﻪ ﭼﻨﺪ ﺑﺎ ﻳﻚ ﺟﺪﻭﻝ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺵ ﺩﻭ ﻓﻴﻠﺪ ﺑﺮﮔﺮﻓﺘﻪ ﺍﺯ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻣﻮﺟﻮﺩﻳﺖ ﺍﺳﺖ ﻛﻪ ﺑﺎ ﺗﻐﻴﻴﺮ ﻧﺎﻡ ﻳﻜﻲ ﺍﺯ ﺁﻧﻬﺎ ﺍﺯﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻣﻮﺟﻮﺩﻳﺖ ﻣﺮﺗﺒﻂ ﺗﺸﻜﻴﻞ ﻣﻲ ﺷﻮﺩ. ﺩﺭ ﺍﺭﺗﺒﺎﻁ ﺑﺎﺯﮔﺸﺘﻲ ﻳﻚ ﺑﻪ ﭼﻨﺪ ،ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺑﺎﺯﮔﺸﺘﻲ ﺩﺭ ﻫﻤﺎﻥ ﺟﺪﻭﻝ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﻮﺟﻮﺩﻳﺖ )ﺑﺎ ﺗﻐﻴﻴﺮ ﻧﺎﻡ ﻛﻠﻴﺪ ﺍﺻﻠﻲ( ﺩﺍﺭﻳﻢ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺜﺎﻝ :
ﺟﺪﻭﻝ EMPLOYEEﺑﺎ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺑﺎﺯﮔﺸﺘﻲ
ﺏ( ﺩﻭﺟﺪﻭﻝ ﺑﺪﺳﺖ ﺁﻣﺪﻩ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٧ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٨ /
ﻗﺎﻋﺪﻩ : ٥ﺍﺭﺗﺒﺎﻃﺎﺕ ﺩﺭﺟﻪ ٣ﻭ ﺑﻴﺸﺘﺮ . ﻫﺮ ﺍﺭﺗﺒﺎﻁ nﺗﺎﻳﻲ ﺑﺎ ﻳﻚ ﺟﺪﻭﻝ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺵ nﻓﻴﻠﺪ ﺑﺮﮔﺮﻓﺘﻪ ﺍﺯ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻱ ﻣﺸﺎﺭﻛﺖ ﻳﺎﻓﺘﻪ ﺩﺭ ﺍﺭﺗﺒﺎﻁ nﺗﺎﻳﻲ ﻣﻲ ﺑﺎﺷﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٣٩ /
ﻗﺎﻋﺪﻩ : ٦ﺍﺭﺗﺒﺎﻃﺎﺕ ﺗﻌﻤﻴﻢ/ﺗﺨﺼﻴﺺ . ﺭﻭﺵ ﺍﻭﻝ :ﺑﺎﺯﺍﻱ ﻫﺮ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﺑﺎﻻ ﻭ ﭘﺎﻳﻴﻦ ﻳﻚ ﺟﺪﻭﻝ ﺟﺪﺍﮔﺎﻧﻪ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺘﻪ ﺷﺪﻩ ﻛﻪ ﺩﺭ ﺟﺪﻭﻝ ﺳﻄﺢ ﭘﺎﻳﻴﻦ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﺑﺎﻻﺗﺮ ﺑﻪ ﻋﻨﻮﺍﻥ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﻗﺮﺍﺭ ﻣﻲ ﮔﻴﺮﺩ. table table attributes ) person(name, street, city )customer (name, credit-rating )employee(name, salary ﻧﻜﺘﻪ :ﺍﺷﻜﺎﻝ ﺍﻳﻦ ﺭﻭﺵ ؟ ﺟﻤﻊ ﺁﻭﺭﻱ ﺍﻃﻼﻋﺎﺕ ﻣﺴﺘﻠﺰﻡ ﻣﺮﺍﺟﻌﻪ ﺑﻪ ﺩﻭ ﺟﺪﻭﻝ ﺍﺳﺖ . ﺭﻭﺵ ﺩﻭﻡ :ﺑﺎﺯﺍﻱ ﻫﺮ ﻣﻮﺟﻮﺩﻳﺖ ﺻﻔﺎﺕ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻭ ﻏﻴﺮﻩ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﺑﺎﻻﺗﺮ ﺩﺭ ﻣﻮﺟﻮﺩﻳﺖ ﺳﻄﺢ ﭘﺎﻳﻴﻨﺘﺮ ﻗﺮﺍﺭ ﻣﻲ ﮔﻴﺮﺩ .ﺩﺭ ﺻﻮﺭﺗﻲ ﺗﻌﻤﻴﻢ ﻛﺎﻣﻞ ﺑﺎﺷﺪ ﻧﻴﺎﺯﻱ ﺑﻪ ﻭﺟﻮﺩ ﺟﺪﻭﻝ ﺳﻄﺢ ﺑﺎﻻﺗﺮ ﻧﺨﻮﺍﻫﺪ ﺑﻮﺩ. table table attributes person )(name, street, city )customer ( name, street, city, credit-rating )employee ( name, street, city, salary ﻧﻜﺘﻪ :ﺍﺷﻜﺎﻝ ﺍﻳﻦ ﺭﻭﺵ ؟ ﺍﻓﺰﻭﻧﮕﻲ ﻗﺎﻋﺪﻩ :٧ﺗﺠﻤﻊ :ﺑﺮﺍﻱ ﻧﻤﺎﻳﺶ ﺗﺠﻤﻊ ،ﻳﻚ ﺟﺪﻭﻝ ﺷﺎﻣﻞ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺭﺗﺒﺎﻁ ﺗﺠﻤﻊ ﺷﺪﻩ ،ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻣﺠﻤﻮﻋﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻣﺸﺎﺭﻛﺖ ﻳﺎﻓﺘﻪ ،ﺻﻔﺎﺕ ﻣﻮﺭﺩ ﻧﻈﺮ ﺍﻳﺠﺎﺩ ﻣﻲ ﺷﻮﺩ. ﻣﺜﺎﻝ :ﺭﺍﺑﻄﻪ ﺗﺠﻤﻊ managesﺑﻴﻦ ﺍﺭﺗﺒﺎﻃﺎﺕ Works-on , managerﺑﺼﺌﺮﺕ ﻳﻚ ﺟﺪﻭﻝ ﺯﻳﺮ ﺍﺳﺖ : )manages(employee-id, branch-name, title, manager-name
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٠ /
ﻣﺜﺎﻝ -۴ :ﻧﻤﻮﺩﺍﺭ E/Rﺯیﺮ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕیﺮیﺪ ﺳﭙﺲ ﺟﺪﺍﻭﻝ ﭘﺎیﮕﺎﻩ ﺩﺍﺩﻩ ﺭﺍ ﺑﺮ ﺍﺳﺎﺱ ﻧﻤﻮﺩﺍﺭ ﺍﺳﺘﺨﺮﺍﺝ ﻧﻤﺎییﺪ) .ﮐﻠیﺪ ﻫﺎﯼ ﺧﺎﺭﺟﯽ ﻭ ﺍﺻﻠﯽ ﻣﺸﺨﺺ ﮔﺮﺩﻧﺪ (. PATIENT :ﺑیﻤﺎﺭ DOCTOR :
ﭘﺰﺷﮏ DRUG :
ﺩﺍﺭﻭﺧﺎﻧﻪ PHARM-CO :ﺷﺮﮐﺖ ﺩﺍﺭﻭ ﺳﺎﺯﯼ
!Error
ﺩﺍﺭﻭ PHARMACY :
٤١ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
Phone
Name Phone-pharm PHARM-CO Name
Address
DRUG Name(pharmco)
Trade-name
PHARMACY Name
formula
price
address
phone
Contract Name(pharm- Name(pharmacy) from co) PATEIENT ssn
Name(pharmacy)
name
to
age
text
address
supervisor
Ssn(doctor)
Prescrip Ssn(doctor)
ssn(patient)
Trade-name
date
Doctor ssn
name
specialty
Yrs-or-exp
qty
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٢ /
-٥-٣ﻗﻮﺍﻧﻴﻦ ﺟﺎﻣﻌﻴﺖ ﺩﺭ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﺭﺍﺑﻄﻪ ﺍﻱ: ﺟﺎﻣﻌـﻴﺖ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻳﻌﻨـﻲ :ﺻـﺤﺖ ،ﺩﻗـﺖ ﻭ ﺳـﺎﺯﮔﺎﺭﻱ ﺩﺍﺩﻩ ﻫـﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺩﺭ ﭘﺎﻳﮕﺎﻩ ﺩﺭ ﺗﻤﺎﻡ ﻟﺤﻈﺎﺕ .ﻫﺮ ﺳﻴﺴﺘﻢ ﻣﺪﻳـﺮﻳﺖ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﺑﺎﻳﺪ ﺑﺘﻮﺍﻧﺪ ﺟﺎﻣﻌﻴﺖ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﺭﺍ ﻛﻨﺘﺮﻝ ﻭ ﺗﻀﻤﻴﻦ ﻧﻤﺎﻳﺪ.ﺑﺮﺍﻱ ﻛﻨﺘﺮﻝ ﻭ ﺗﻀﻤﻴﻦ ﺟﺎﻣﻌﻴﺖ ،ﻧﻴﺎﺯ ﺑـﻪ ﻣﺠﻤـﻮﻋﻪ ﺍﻱ ﺍﺯ ﻗـﻮﺍﻋﺪ ﻭ ﻣﺤﺪﻭﺩﻳﺘﻬﺎﺳـﺖ ﻛـﻪ ﺩﺭ ﻳـﻚ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺧﺎﺹ ﺭﻭﻱ ﺩﺍﺩﻩ ﻫﺎﻱ ﻫﻤﺎﻥ ﻣﺤﻴﻂ ﺑﺎﻳﺪ ﺍﻋﻤﺎﻝ ﺷﻮﻧﺪ ﻭﺑﻨﺎﻡ ﻗﻮﺍﻧﻴﻦ ﺟﺎﻣﻌﻴﺘﻲ ﺧﻮﺍﻧﺪﻩ ﻣﻲ ﺷﻮﻧﺪ .ﺍﻳﻦ ﻗﻮﺍﻋﺪ ﺑﻄﻮﺭ ﻛﻠﻲ ﺑﻪ ﺩﻭ ﺩﺳﺘﻪ ﺗﻘﺴﻴﻢ ﻣﻲ ﺷﻮﻧﺪ. ﺍﻟﻒ ـ ﻗﻮﺍﻋﺪ ﺧﺎﺹ ﻳﻚ ﻣﺤﻴﻂ )ﻛﺎﺭﺑﺮﻱ( ﻗـﻮﺍﻋﺪﻱ ﻫﺴـﺘﻨﺪ ﻛﻪ ﺗﻮﺳﻂ ﻳﻚ ﻛﺎﺭﺑﺮ ﻣﺠﺎﺯ ﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﻧﺪ .ﺍﻳﻦ ﻗﻮﺍﻋﺪ ﺩﺭ ﻣﻮﺭﺩ ﻳﻚ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺧﺎﺹ ﻣﻄﺮﺡ ﺷﺪﻩ ﻭ ﻋﻤﻮﻣﻴﺖ ﻧﺪﺍﺭﻧﺪ .ﮔﺎﻩ ﺑﻪ ﺍﻳﻦ ﻗﻮﺍﻋﺪ ،ﻗﻮﺍﻋﺪ ﻣﺤﻴﻄﻲ ﻭﺍﺑﺴﺘﻪ ﺑﻪ ﺩﺍﺩﻩ ﻭ ﻳﺎ ﻣﺤﺪﻭﺩﻳﺘﻬﺎﻱ ﺟﺎﻣﻌﻴﺖ ﻣﻌﻨﺎﻳﻲ ﻧﻴﺰ ﻣﻲ ﮔﻮﻳﻨﺪ. ﺑﻄﻮﺭ ﻣﺜﺎﻝ ،ﺩﺭ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺕ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﻭ ﻗﻄﻌﺎﺕ ﻣﻲ ﺗﻮﺍﻥ ﻗﺎﻋﺪﻩ ﺍﻱ ﺭﺍ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺗﻌﺮﻳﻒ ﻛﺮﺩ: ﻣﻘـﺪﺍﺭ Qtyﻫﻤﻴﺸـﻪ ﺑﻴﻦ ﺻﻔﺮ ﻭ ١٠٠٠٠ﺑﺎﺷﺪ .ﻭﺟﻮﺩ ﭼﻨﻴﻦ ﻗﺎﻋﺪﻩ ﺍﻱ ﺩﺭ ﺑﺎﻧﻚ ﺍﻳﺠﺎﺏ ﻣﻲ ﻛﻨﺪ ﻛﻪ ﺳﻴﺴﺘﻢ ﺍﺯ ﺍﻧﺠﺎﻡ ﻫﺮﮔﻮﻧﻪ ﻋﻤﻠﻲ ﻛﻪ ﺳﺒﺐ ﻣﻲ ﺷﻮﺩ ﻣﻘﺪﺍﺭ Q tyﺧﺎﺭﺝ ﺍﺯ ﻃﻴﻒ ﻣﻘﺎﺩﻳﺮ ﺑﺸﻮﺩ ،ﺟﻠﻮﮔﻴﺮﻱ ﻛﻨﺪ. ﺩﺭ ﺳﻴﺴـﺘﻤﻬﺎﻱ ﻣﻮﺟـﻮﺩ ﺑـﺮﺍﻱ ﻣﻌﺮﻓـﻲ ﺍﻳـﻦ ﻗﻮﺍﻋﺪ ﺍﺯ ﻣﻜﺎﻧﻴﺴﻢ ﺍﻇﻬﺎﺭ ) (Assertionﺍﺳﺘﻔﺎﺩﻩ ﻣﻴﺸﻮﺩ .ﺍﻇﻬﺎﺭ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﺷﺮﻁ ﻭ ﻳﺎ ﺷﺮﺍﻳﻄﻲ ﺍﺳﺖ ﻛﻪ ﻫﻤﻴﺸﻪ ﺑﺎﻳﺪ ﺩﺭﺭﻭﻱ ﻋﻤﻠﻴﺎﺕ ﭘﺎﻳﮕﺎﻩ ﺭﻋﺎﻳﺖ ﺷﻮﻧﺪ .ﺩﺳﺘﻮﺭ ﺗﻌﺮﻳﻒ ﺍﻇﻬﺎﺭ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ CREATE ASSERTION
CHECK < Predicate>: ﺏ ـ ﻗﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺖ ﻋﺎﻡ ﻗﻮﺍﻋﺪ ﻋﺎﻡ ﻗﻮﺍﻋﺪﻱ ﻫﺴﺘﻨﺪ ﻛﻪ ﺑﺴﺘﮕﻲ ﺑﻪ ﺳﻴﺴﺘﻢ ﻭ ﺑﺎﻧﻚ ﺧﺎﺹ ﻧﺪﺍﺭﻧﺪ ﺑﻠﻜﻪ ﺩﺭ ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ ﻣﻄﺮﺡ ﺑﻮﺩﻩ ﻭ ﻗﺎﺑﻞ ﺍﻋﻤﺎﻝ ﺩﺭ ﻫﺮ ﺳﻴﺴﺘﻢ ﺭﺍﺑﻄﻪ ﺍﻱ ﻫﺴﺘﻨﺪ .ﺑﻪ ﺍﻳﻦ ﻗﻮﺍﻋﺪ ﻣﺘﺎ ﻗﺎﻋﺪﻩ ﻧﻴﺰ ﮔﻔﺘﻪ ﻣﻴﺸﻮﺩ. ﺩﺭ ﻣـﺪﻝ ﺭﺍﺑﻄـﻪ ﺍﻱ ﺩﻭ ﻗﺎﻋـﺪﻩ ﺟﺎﻣﻌـﻴﺖ ﻭﺟـﻮﺩ ﺩﺍﺭﺩ :ﻳﻜـﻲ ﻧﺎﻇﺮ ﺑﻪ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻭ ﺩﻳﮕﺮﻱ ﻧﺎﻇﺮ ﺑﻪ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺍﻳﻦ ﻗﻮﺍﻋﺪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ : ١ـ ﻗﺎﻋﺪﻩ ﺟﺎﻣﻌﻴﺖ ﻣﻮﺟﻮﺩﻳﺘﻲ Entity Integrity Rule ٢ـ ﻗﺎﻋﺪﻩ ﺟﺎﻣﻌﻴﺖ ﺍﺭﺟﺎﻋﻲ Referential Integrity Rule ٣ـ٥ـ١ـ ﻗﺎﻋﺪﻩ ﺟﺎﻣﻌﻴﺖ ﻣﻮﺟﻮﺩﻳﺘﻲC1 :
ﻫﻴﭻ ﺟﺰ ﺗﺸﻜﻴﻞ ﺩﻫﻨﺪﻩ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻧﺒﺎﻳﺪ ﺩﺍﺭﺍﻱ " ﻣﻘﺪﺍﺭ ﻫﻴﭻ ") (NuLLﺑﺎﺷﺪ. NullValueﻣﻔﻬﻮﻣـﻲ ﺩﺭ ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗـﻲ ﺍﺳـﺖ ﻛﻪ ﺩﺭ ﻭﺍﻗﻊ ﻣﻘﺪﺍﺭﻱ ﺍﺳﺖ ﻛﻪ ﺑﺮﺍﻱ ﻧﻤﺎﻳﺶ ﻣﻘﺪﺍﺭ ﻧﺎﺷﻨﺎﺧﺘﻪ ﻳﺎ ﻣﻘﺪﺍﺭ ﻏﻴﺮ ﻗﺎﺑﻞ ﺍﻋﻤﺎﻝ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ ﻭ ﺑﺎ ﻓﻀﺎﻱ ﺧﺎﻟﻲ ﻭ ﺻﻔﺮ ﻓﺮﻕ ﺩﺍﺭﺩ. : NullValue ١ــ ﻣﻘـﺪﺍﺭ ﻧﺎﺷـﻨﺎﺧﺘﻪ :ﻣﺜﻞ ﻛﺎﺭﻣﻨﺪﻱ ﻛﻪ ﻛﺪ ﺍﺩﺍﺭﻩ ﺍﺵ ﻣﺸﺨﺺ ﻧﻴﺴﺖ ﻭ ﻳﺎ ﺧﺎﻧﻪ ﺍﻱ ﺩﺭ ﻛﻮﭼﻪ ﺍﻱ ﺳﺎﺧﺘﻪ ﺷﺪ ﻭ ﻫﻨﻮﺯ ﭘﻼﻙ ﺷﻬﺮﺩﺍﺭﻱ ﻧﺪﺍﺭﺩ. ٢ـ ﻣﻘﺪﺍﺭ ﻏﻴﺮ ﻗﺎﺑﻞ ﺍﻋﻤﺎﻝ )ﺑﺮﺍﻱ ﻳﻚ ﺻﻔﺖ ﻓﺎﺻﻠﻪ( ﻣﺜﻞ ﻣﺸﺨﺼﺎﺕ ﻫﻤﺴﺮ ﻛﺎﺭﻣﻨﺪﻱ ﻛﻪ ﻣﺠﺮﺩ ﺍﺳﺖ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
•
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٣ /
ﺩﻟﻴﻞ ﻗﺎﻋﺪﻩ ﺟﺎﻣﻌﻴﺖ ﻣﻮﺟﻮﺩﻳﺘﻲ:
ﭼـﻮﻥ ﻛﻠـﻴﺪ ﺍﺻـﻠﻲ ﺷﻨﺎﺳـﻪ ﺗﺎﭘـﻞ ﺍﺳـﺖ ﻭ ﺍﺯ ﺳﻮﻱ ﺩﻳﮕﺮ ﺷﻨﺎﺳﻪ ﻳﻜﻲ ﻧﻤﻮﻧﻪ ﻣﺸﺨﺺ ﻭ ﻣﺘﻤﺎﻳﺰ ﺍﺯ ﻳﻚ ﻧﻮﻉ ﻣﻮﺟﻮﺩﻳﺖ ﺍﺳﺖ ﭼﮕﻮﻧﻪ ﻣﻲ ﺗﻮﺍﻧﺪ ﻋﺎﻣﻞ ﺗﻤﺎﻳﺰ ﺧﻮﺩﺵ ﻧﺎﺷﻨﺎﺧﺘﻪ ﺑﺎﺷﺪ. ﺍﻳﻦ ﻗﺎﻋﺪﻩ ﺍﺯ ﻃﺮﻳﻖ ﻣﻌﺮﻓﻲ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺩﺭ ﺗﻌﺮﻳﻒ ﺭﺍﺑﻄﻪ ﺑﺮ ﺳﻴﺴﺘﻢ ﺍﻋﻤﺎﻝ ﻣﻲ ﺷﻮﺩ. -٢-٥-٣ﻗﺎﻋﺪﻩ ﺟﺎﻣﻌﻴﺖ ﺍﺭﺟﺎﻋﻲ C2 :
ﺍﮔـﺮ ﺻـﻔﺖ ﺧﺎﺻـﻪ AIﺍﺯ ﺭﺍﺑﻄﻪ ، R2ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺩﺭ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺑﺎﺷﺪ )ﻛﻪ ﻣﻌﻨﺎﻳﺶ ﺍﻳﻦ ﺍﺳﺖ ﺩﺭ ﺭﺍﺑﻄﻪ ﺩﻳﮕﺮ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺳﺖ( ﺻﻔﺖ ﺧﺎﺻﻪ :Ai ١ـ ﻣﻲ ﺗﻮﺍﻧﺪ ﻫﻴﭻ ﻣﻘﺪﺍﺭ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺩﺭ ﻏﻴﺮ ﺍﻳﻨﺼﻮﺭﺕ ٢ـ ﺣﺘﻤﺎ ﺑﺎﻳﺪ ﻣﻘﺪﺍﺭ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﻛﻪ ﺩﺭ ﺭﺍﺑﻄﻪ ﺍﻱ ﻛﻪ ﺩﺭ ﺁﻧﺠﺎ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺳﺖ ﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ﺑﻪ ﺭﺍﺑﻄﻪ R2ﺭﺍﺑﻄﻪ ﺍﺭﺟﺎﻉ ﺩﻫﻨﺪﻩ ﻳﺎ ﺭﺟﻮﻉ ﻛﻨﻨﺪﻩ Referencingﻭ ﺑﻪ ﺭﺍﺑﻄﻪ ﺩﻳﮕﺮ ﺭﺍﺑﻄﻪ ﻣﺮﺟﻊ ﻳﺎ ﻣﻘﺼﺪ ﮔﻮﻳﻨﺪ. ﻣﺜﺎﻝ sp.s# :ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺩﺭ Spﺍﺳﺖ .ﻣﻘﺎﺩﻳﺮ S#ﺩﺭ Spﺑﺎﻳﺪ ﭼﻨﺎﻥ ﺑﺎﺷﻨﺪ ﻛﻪ ﺣﺘﻤﹰﺎ ﺑﺎﻳﺪ ﺩﺭ sﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ. ﻧﻜﺘﻪ :ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﺧﺎﺹ S#ﺩﺭ Spﻧﻤﻲ ﺗﻮﺍﻧﺪ ﻣﻘﺪﺍﺭ Nullﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺯﻳﺮﺍ ﺧﻮﺩ ﺟﺰﺋﻲ ﺍﺯ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺳﺖ. •
ﺩﻟﻴﻞ ﺗﻮﺟﻴﻪ ﻛﻨﻨﺪﻩ ﻗﺎﻋﺪﻩ ﺟﺎﻣﻌﻴﺖ ﺍﺭﺟﺎﻋﻲ:
ﻧﻤﻲ ﺗﻮﺍﻥ ﺑﻪ ﻧﻤﻮﻧﻪ ﻣﻮﺟﻮﺩﻳﺘﻲ ﺍﺭﺟﺎﻉ ﺩﺍﺩ ﻛﻪ ﺩﺭ ﺟﻬﺎﻥ ﻭﺍﻗﻌﻲ ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ. ﺍﻳﻦ ﻗﺎﻋﺪﻩ ﺍﺯ ﻃﺮﻳﻖ ﺣﻜﻢ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﻭ ﺗﻌﺮﻳﻒ ﺭﺍﺑﻄﻪ ﺑﻪ ﺳﻴﺴﺘﻢ ﺍﻋﻼﻡ ﻣﻲ ﺷﻮﺩ. ٣ـ٥ـ٣ـ ﺗﺒﻌﺎﺕ ﻗﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺖ: ﻗـﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺖ ﺑﺎﻳﺪ ﺩﺭ ﺗﻤﺎﻡ ﻣﺪﺕ ﺣﻴﺎﺕ ﺭﺍﺑﻄﻪ ﻫﺎﻱ ﻳﻚ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺑﺮﻗﺮﺍﺭ ﺑﻮﺩﻩ ،ﺭﻋﺎﻳﺖ ﺷﻮﻧﺪ ﺍﺯ ﺁﻧﺠﺎﺋﻴﻜﻪ ﺍﻳﻦ ﺩﻭ ﻗﺎﻋـﺪﻩ ﻧﺎﻇـﺮ ﺑﺮﻭﺿـﻌﻴﺖ ﺑﺎﻧـﻚ ﻫﺴـﺘﻨﺪ .ﻫـﺮ ﻭﺿـﻌﻴﺘﻲ ﺍﺯ ﺑﺎﻧﻚ ﻛﻪ ﺩﺭ ﺁﻥ ﺍﻳﻦ ﻗﻮﺍﻋﺪ ﺭﻋﺎﻳﺖ ﻧﺸﺪﻩ ﺑﺎﺷﻨﺪ ﻧﺎﺻﺤﻴﺢ ﺗﻠﻘﻲ ﻣﻲ ﮔﺮﺩﺩ. ﻓﺮﺽ ﻛﻨﻴﺪ ﺩﺳﺘﻮﺭ
ﺩﺭ ﺧﻮﺍﺳﺖ ﺷﺪﻩ ﺑﺎﺷﺪ.
ﻭ ﺳﻴﺴﺘﻢ ﺑﺨﻮﺍﻫﺪ ﺗﺎﭘﻞ S2ﺭﺍ ﺍﺯ Sﺣﺬﻑ ﻛﻨﺪ ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﻗﺎﻋﺪﻩ ﺩﻭﻡ ﺧﺪﺷﻪ ﺩﺍﺭﻣﻲ ﺷﻮﺩ ﻣﮕﺮ ﺍﻳﻨﻜﻪ ﺳﻴﺴﺘﻢ ﺭﻭﺵ ﺧﺎﺻﻲ ﺩﺭ ﺣﻞ ﺍﻳﻦ ﻣﺸﻜﻞ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ﺍﺭﺟﺎﻉ Spﺑﻪ Sﻣﺸﻜﻞ ﺧﻮﺍﻫﺪ ﺩﺍﺷﺖ ﺯﻳﺮﺍ S2ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ. SP
Sﻣﺮﺟﻊ
ﺭﺟﻮﻉ ﻛﻨﻨﺪﻩ
Qty
P#
S#
S#
100 70 200 60
P1 P1 P3 P2
S1 S2 S1 S4
S1 S2 S3 S4
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٤ /
ﺑﺮﺍﻱ ﺣﻔﻆ ﻗﺎﻋﺪﻩ ﺟﺎﻣﻌﻴﺖ ﺍﺭﺟﺎﻋﻲ ﭼﻬﺎﺭ ﺭﻭﺵ ﻣﺸﻬﻮﺭ ﺍﺳﺖ: ﺍﻟﻒ ـ ﺭﻭﺵ ) Restrictedﻣﺤﺪﻭﺩ ﺷﺪﻩ(ﻭﻳﺎ ﺣﺬﻑ ﺗﻌﻮﻳﻘﻲ ﺩﺭ ﺍﻳـﻦ ﺭﻭﺵ ﺍﮔـﺮ ﺩﺭﺧﻮﺍﺳـﺖ ﺣـﺬﻑ ﺗﺎﭘﻠـﻲ ﺍﺯ ﺭﺍﺑﻄﻪ ﻣﺮﺟﻊ ﺷﻮﺩ ﺗﺎ ﺯﻣﺎﻧﻴﻜﻪ ﺗﺎﭘﻠﻬﺎﻳﻲ ﺩﺭ ﺭﺍﺑﻄﻪ ﺭﺟﻮﻉ ﻛﻨﻨﺪﻩ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ ﻛﻪ ﺑﻪ ﺍﻳﻦ ﺗﺎﭘﻞ ﺍﺭﺟﺎﻉ ﻣﻲ ﺩﻫﻨﺪ ﻋﻤﻞ ﺣﺬﻑ ﺍﻧﺠﺎﻡ ﻧﻤﻲ ﺷﻮﺩ. ﺏ ـ ﺭﻭﺵ ﺁﺑﺸﺎﺭﻱ ﻳﺎ ﺗﺴﻠﺴﻠﻲ Cascaded
ﺩﺭ ﺍﻳﻦ ﺭﻭﺵ ﺑﺎﺣﺬﻑ ﻳﻚ ﺗﺎﭘﻞ ﺍﺯ ﺭﺍﺑﻄﻪ ﻣﺮﺟﻊ ﺗﻤﺎﻡ ﺗﺎﭘﻠﻬﺎﻱ ﺭﺟﻮﻉ ﻛﻨﻨﺪﻩ ﺑﻪ ﺁﻥ ﺗﺎﭘﻞ ﻧﻴﺰ ﺣﺬﻑ ﻣﻲ ﺷﻮﻧﺪ. ﺑﻄﻮﺭ ﻣﺜﺎﻝ ﺍﮔﺮ ﺩﺭﺧﻮﺍﺳﺖ
ﺑﻴﺎﻳﺪ ﭘﺲ ﺍﺯ ﺍﺟﺮﺍﻱ ﺁﻥ ﺣﻜﻢ ﺑﺎﻳﺴﺘﻲ ﺣﻜﻢ ﺯﻳﺮ ﻧﻴﺰ ﺍﺟﺮﺍ ﺷﻮﺩ :
ﺍﻳـﻦ ﺣﻜـﻢ ﻣﻤﻜـﻦ ﺍﺳﺖ ﺑﻄﻮﺭ ﺍﺗﻮﻣﺎﺗﻴﻚ ﺗﻮﺳﻂ D BMSﺗﻮﻟﻴﺪ ﺷﻮﺩ ﻭ ﻣﻤﻜﻦ ﺍﺳﺖ ﻻﺯﻡ ﺑﺎﺷﺪ ﻃﺮﺍﺡ ﺁﻥ ﺭﺍ ﺑﻨﻮﻳﺴﺪ ﻻﺯﻡ ﺑﻪ ﺫﻛﺮ ﺍﺳﺖ ﺍﮔﺮ ﺩﺳﺘﻮﺭ ﺩﻭﻡ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ ﻋﻜﺲ ﺁﻥ ﺻﺎﺩﻕ ﻧﻴﺴﺖ ﻳﻌﻨﻲ ﻧﻴﺎﺯ ﺑﻪ ﺣﺬﻑ ﺩﺭ Sﻧﻤﻲ ﺑﺎﺷﺪ. ﺝ ـ ﺭﻭﺵ ﻫﻴﭻ ﻣﻘﺪﺍﺭ ﮔﺬﺍﺭﻱ Nullified
ﺩﺭ ﺍﻳﻦ ﺭﻭﺵ ﺍﮔﺮ ﺩﺭﺧﻮﺍﺳﺖ ﺷﻮﺩ ﺗﺎﭘﻠﻲ ﺍﺯ ﺭﺍﺑﻄﻪ ﻣﺮﺟﻊ ﺣﺬﻑ ﺷﻮﺩ ،ﺍﻳﻦ ﺣﺬﻑ ﺍﻧﺠﺎﻡ ﻣﻲ ﺷﻮﺩ ﺍﻣﺎ ﺩﺭ ﭘﻲ ﺁﻥ ﻣﻘﺪﺍﺭ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺩﺭ ﺭﺍﺑﻄﻪ ﺍﺭﺟﺎﻉ ﺩﻫﻨﺪﻩ NULLﮔﺬﺍﺷﺘﻪ ﻣﻲ ﺷﻮﺩ) .ﺑﺸﺮﻁ ﺍﻳﻨﻜﻪ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺟﺰ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻧﺒﺎﺷﺪ(
ﻣﺜﺎﻝ: Delete From S ’Where S# = ‘S2 Update SP Set S# = Null ’Where S# = ‘S2
ﺗﻮﺟﻪ :ﺩﺭ ﻣﺜﺎﻝ ﺑﺎﻻ ﻧﻤﻲ ﺗﻮﺍﻥ ﺭﻭﺵ ﻫﻴﭻ ﻣﻘﺪﺍﺭﮔﺬﺍﺭﻱ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﺍﺩ ﺯﻳﺮﺍ S #ﺩﺭ SPﺟﺰ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺳﺖ. ﻧﻜﺘﻪ :ﺑﻪ ﻣﺠﻤﻮﻋﻪ ﺟﺪﺍﻭﻝ ﻭ ﺗﻌﺎﺭﻳﻒ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻭ ﻛﻠﻴﺪﻫﺎﻱ ﺩﻳﮕﺮ ﻭ ﻣﺤﺪﻭﺩﻳﺘﻬﺎ ﻧﻴﺰ ﺷﻤﺎﻱ ﺭﺍﺑﻄﻪ ﮔﻔﺘﻪ ﻣﻲ ﺷﻮﺩ. ﺩ ـ ﺭﻭﺵ ﻣﻘﺪﺍﺭﮔﺬﺍﺭﻱ ﺑﺎ ﻣﻘﺪﺍﺭ ﭘﻴﺶ ﻓﺮﺽ SET TO DEFAULT ﺩﺭ ﺍﻳـﻦ ﺭﻭﺵ ،ﺑـﺎ ﺣـﺬﻑ ﺗﺎﭘﻞ ﻣﺮﺟﻊ ،ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ ﺩﺭ ﺗﺎﭘﻞ ﻫﺎﻱ ﺭﺟﻮﻉ ﻛﻨﻨﺪﻩ ﺑﻪ ﺁﻥ ﺑﺎ ﻣﻘﺪﺍﺭ ﭘﻴﺶ ﻓﺮﺽ ﻣﻘﺪﺍﺭﮔﺬﺍﺭﻱ ﻣﻴﺸﻮﺩ. ٣ـ٥ـ٤ـ ﺭﺍﻫﻬﺎﻱ ﺍﻋﻤﺎﻝ ﻗﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺖ : ﺑﻄﻮﺭ ﻛﻠﻲ ﻣﻴﺘﻮﺍﻥ ﺭﺍﻫﻬﺎﻱ ﺍﻋﻤﺎﻝ ﻗﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺖ ﺭﺍ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻧﺎﻡ ﺑﺮﺩ : -١ﻣﻌﺮﻓﻲ ﻛﻠﻴﺪ ﺍﺻﻠﻲ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٥ /
-٢ﺍﻋﻼﻡ ﺻﻔﺖ ﻫﻴﭽﻤﻘﺪﺍﺭ ﻧﺎﭘﺬﻳﺮ -٣ﻣﻌﺮﻓﻲ ﻛﻠﻴﺪ ﺧﺎﺭﺟﻲ -٤ﺍﻋﻼﻥ ﻣﺤﺪﻭﺩﻳﺘﻬﺎﻱ ﻣﻮﺭﺩ ﻧﻈﺮ ﺩﺭ ﺷﻤﺎﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ -٥ﻧﻮﺷﺘﻦ ﺭﺍﻩ ﺍﻧﺪﺍﺯ )(Trigger ﺭﺍﻩ ﺍﻧـﺪﺍﺯ ﻣﻜﺎﻧﻴﺴـﻤﻲ ﺍﺳـﺖ ﺑـﺮﺍﻱ ﺭﺍﻩ ﺍﻧﺪﺍﺯﻱ ﺍﺟﺮﺍﻱ ﻳﻚ ﻋﻤﻞ ﺩﺭ ﭘﻲ ﺍﻧﺠﺎﻡ ﻳﻚ ﻋﻤﻞ ﺩﻳﮕﺮ .ﺑﻪ ﺑﻴﺎﻥ ﺩﻳﮕﺮ ﺩﺭﺻﻮﺭﺕ ﺑـﺮﻭﺯ ﻳـﻚ ﺭﻭﻳﺪﺍﺩ ،ﻋﻤﻠﻲ ﺑﺎﻳﺪ ﺍﻧﺠﺎﻡ ﺷﻮﺩ ﺗﺎ ﺳﺎﺯﮔﺎﺭﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺗﺎﻣﻴﻦ ﮔﺮﺩﺩ.ﻣﺜﻼ ﺩﺭ ﭘﻲ ﺍﻧﺠﺎﻡ ﻳﻚ ﻋﻤﻞ ﺑﻬﻨﮕﺎﻡ ﺳﺎﺯﻱ ﺩﺭ ﺗﺎﭘﻠﻲ ﺍﺯ ﻳﻚ ﺭﺍﺑﻄﻪ ،ﺗﺎﭘﻞ)ﻫﺎﻳﻲ( ﺍﺯ ﺭﺍﺑﻄﻪ ﻫﺎﻱ ﺩﻳﮕﺮ ﻧﻴﺰ ﺑﻬﻨﮕﺎﻡ ﺩﺭ ﻣﻲ ﺁﻳﻨﺪ. -٦ﻣﻌﺮﻓﻲ ﻣﻴﺪﺍﻥ ﻭ ﻣﻘﺎﺩﻳﺮ ﺁﻥ -٧ﻣﻌﺮﻓﻲ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺗﺎﺑﻌﻲ ﺑﻴﻦ ﺻﻔﺎﺕ ﺧﺎﺻﻪ )ﺑﻪ ﻓﺼﻞ ﻫﻔﺘﻢ ﻣﺮﺍﺟﻌﻪ ﺷﻮﺩ (. ٣ـ -٦ﻣﺸﺨﺼﺎﺕ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﺭﺍﺑﻄﻪ ﺍﻱ: ﺩﺭﺟﻪ ﻳﺎ ﻣﻴﺰﺍﻥ ﻳﺎ ﺣﺪ ﺭﺍﺑﻄﻪ ﺑﻮﺩﻥ ﺳﻴﺴﺘﻤﻬﺎﻱ ﺭﺍﺑﻄﻪ ﺍﻱ ﻣﺘﻔﺎﻭﺕ ﺍﺳﺖ .ﺍﺯ ﻧﻈﺮ C ODDﺳﻴﺴﺘﻤﻲ ﺩﺭ ﺣﺪﺍﻗﻞ ﺭﺍﺑﻄﻪ ﺍﻱ ﺍﺳﺖ. ﺍﮔﺮ : ١ـ ﭘﺎﻳﮕﺎﻩ ﺟﺪﻭﻟﻲ ﺭﺍ ﺑﺮﺍﻱ ﻛﺎﺭﺑﺮ ﺗﺎﻣﻴﻦ ﻛﻨﺪ. ٢ـ ﺳﻪ ﻋﻤﻞ ﺍﺳﺎﺳﻲ ﺍﺯ ﻋﻤﻠﻴﺎﺕ ﺩﺭ ﺭﺍﺑﻄﻪ ﻫﺎ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ :ﻋﻤﻞ ﮔﺰﻳﻨﺶ ﻳﺎ ﺗﺤﺪﻳﺪ ،ﻋﻤﻞ ﭘﺮﺗﻮ ﻭ ﻋﻤﻞ ﭘﻴﻮﻧﺪ ﻼ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﺎﻳﺪ ﺧﺼﻮﺻﻴﺎﺕ ﺯﻳﺮ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ: ﺍﻣﺎ ﻳﻚ ﺳﻴﺴﺘﻢ ﻛﺎﻣ ﹰ ١ـ ﭘﺎﻳﮕﺎﻩ ﺭﺍﺑﻄﻪ ﺍﻱ ﺭﺍ ﺍﻳﺠﺎﺩ ﻛﻨﺪ :ﺍﻣﻜﺎﻧﺎﺕ ﻛﺎﻣﻞ ﺗﻌﺮﻳﻒ ﺍﻧﻮﺍﻉ ﺭﺍﺑﻄﻪ ﻫﺎ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ٢ـ ﺍﻣﻜﺎﻧﺎﺕ ﻛﺎﻣﻞ DMLﺭﺍﺑﻄﻪ ﺍﻱ ٣ـ ﺍﻣﻜﺎﻥ ﺗﻌﺮﻳﻒ ﻣﺠﻤﻮﻋﻪ ﻛﺎﻣﻠﻲ ﺍﺯ ﻗﻮﺍﻧﻴﻦ ﺟﺎﻣﻌﻴﺖ ﺑﺸﺮﺡ ﺩﻳﺪﻩ ﺷﺪﻩ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. •
ﻳﻚ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺭﺍﺑﻄﻪ ﺍﻱ ﺩﺍﺭﺍﻱ ﺳﻪ ﻣﺆﻟﻔﻪ ﺍﺳﺎﺳﻲ ﺍﺳﺖ :
Objects -١ﺍﺯ ﻧﻈﺮ ﺳﺎﺧﺘﺎﺭﻱ ﺭﺍﺑﻄﻪ ﺍﻧﺪ Operators -٢ﻋﻤﻠﮕﺮﻫﺎﻱ ﺭﺍﺑﻄﻪ ﺍﻱ Rules -٣ﻗﻮﺍﻧﻴﻦ ﺟﺎﻣﻌﻴﺖ ﺗﻤﺮﻳﻦ : -١ﻧﺤﻮﻩ ﺗﻌﺮﻳﻒ ﺍﻧﻮﺍﻉ ﻛﻠﻴﺪ ﺭﺍ ﺩﺭ ﻳﻚ ﺳﻴﺴﺘﻢ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﺮﺭﺳﻲ ﻧﻤﺎﻳﻴﺪ : -٢ﺭﺍﻫﻬﺎﻱ ﻗﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺖ ﺭﺍ ﺩﺭ ﻳﻚ ﺳﻴﺴﺘﻢ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﺮﺭﺳﻲ ﻧﻤﺎﻳﻴﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٦ /
ﻓﺼﻞ ﭼﻬﺎﺭﻡ :ﻣﺪﻝ ﺭﺍﺑﻄﻪ ﺍﻱ -ﻋﻤﻠﻴﺎﺕ ﺭﻭﻱ ﺭﺍﺑﻄﻪ ﻫﺎ -١-٤ﻣﻘﺪﻣﻪ : ﺯﺑﺎﻥ ﻛﺎﺭ ﺑﺎ ﺩﺍﺩﻩ ﻫﺎ ﺩﺍﺭﺍﻱ ﻣﺠﻤﻮﻋﻪ ﺍﻳﺴﺖ ﺍﺯ ﻋﻤﻠﮕﺮﻫﺎ ﻛﻪ ﺩﺭ ﻛﺎﺩﺭ ﻣﺪﻝ ﺩﺍﺩﻩ ﺍﻱ ﻋﻤﻞ ﻣﻲ ﻛﻨﻨﺪ .ﺩﺭ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻚ ﺭﺍﺑﻄﻪ ﺍﻱ ﻋﻤﻠﮕﺮﻫﺎﻱ ﻋﻤﻞ ﻛﻨﻨﺪﻩ ﺭﻭﻱ ﺭﺍﺑﻄﻪ ﻋﻤﻠﮕﺮﻫﺎﻱ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﻭ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﻣﻲ ﺑﺎﺷﻨﺪ. ٤ـ -٢ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ: Coddﺩﺭ ﻣﻘﺎﻟﻪ ﺧﻮﺩ ٨ﻋﻤﻠﮕﺮ ﺑﺮﺍﻱ ﻛﺎﺭ ﺑﺎ ﺭﺍﺑﻄﻪ ﻫﺎ ﺗﻌﺮﻳﻒ ﻛﺮﺩﻩ ﺍﺳﺖ ﻛﻪ ﺍﻳﻦ ﻋﻤﻠﮕﺮﻫﺎ ﺑﻪ ﺩﻭ ﺩﺳﺘﻪ ﺗﻘﺴﻴﻢ ﻣﻲ ﺷﻮﻧﺪ: ﺍﻟﻒ :ﻋﻤﻠﮕﺮﻫﺎﻱ ﻣﺘﻌﺎﺭﻑ ﺩﺭ ﻣﺠﻤﻮﻋﻪ ﻫﺎ ﻧﻈﻴﺮ :ﺍﺟﺘﻤﺎﻉ ،ﺍﺷﺘﺮﺍﻙ ،ﺗﻔﺎﺿﻞ ﻭ ﺿﺮﺏ ﺩﻛﺎﺭﺗﻲ ﺏ :ﻋﻤﻠﮕﺮﻫﺎﻱ ﺧﺎﺹ ﻧﻈﻴﺮ :ﻣﺤﺪﻭﺩﻳﺖ ،ﺗﺼﻮﻳﺮ ﻳﺎ ﭘﺮﺗﻮ ،ﺗﺮﻛﻴﺐ ﻳﺎ ﭘﻴﻮﻧﺪ ﻭ ﺗﻘﺴﻴﻢ -١ -٢-٤ﻋﻤﻠﮕﺮ ﮔﺰﻳﻨﺶ ﻳﺎ ﺗﺤﺪﻳﺪ )(Select
ﺍﻳﻦ ﻋﻤﻠﮕﺮ ﺗﺎﭘﻠﻬﺎﻳﻲ ﺭﺍ ﺍﺯ ﻳﻚ ﺭﺍﺑﻄﻪ ﮔﺰﻳﻨﺶ ﻣﻲ ﻛﻨﺪ .ﺑﻌﺒﺎﺭﺗﻲ ﺯﻳﺮ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﻓﻘﻲ ﺍﺯ ﻳﻚ ﺭﺍﺑﻄﻪ ﺭﺍ ﺑﺮ ﻣﻲ ﺩﺍﺭﺩ .ﮔﺰﻳﻨﺶ ﻻ ﺑﺮ ﺍﺳﺎﺱ ﺷﺮﻁ ﻳﺎ ﺷﺮﺍﻳﻄﻲ ﺻﻮﺭﺕ ﻣﻲ ﭘﺬﻳﺮﺩ. ﺗﺎﭘﻞ ﻳﺎ ﺗﺎﭘﻠﻬﺎﻳﻲ ﺍﺯ ﺭﺍﺑﻄﻪ ،ﻣﻌﻤﻮ ﹰ •
ﻧﻤﺎﺩ ﺗﺤﺪﻳﺪ бp( r ) :
•
Pﺷﺮﻁ ﮔﺰﻳﻨﺶ ﺍﺳﺖ r ،ﺭﺍﺑﻄﻪ )ﺟﺪﻭﻝ(
• ﻛﻪ pﻓﺮﻣﻮﻟﻲ ﻣﺤﺎﺳﺒﺎﺗﻲ ﺍﺳﺖ ﺷﺎﻣﻞ not ،Or،andﻳﺎ ﻫﺮ ﻳﻚ ﺍﺯ ﺟﻤﻼﺕ ﺑﻔﺮﻡ : })p(t
бp( r ) = {t | t∈r and
> opor< constantﻛﻪ opﻳﻜﻲ ﺍﺯ = ، ≤ ،≥ ، <، > ، #،ﺍﺳﺖ. D
C
7 10
1 23
B α β
A
D
C
B
A
α β
7 17
1 5
α β
α α
12 β Relation r:
β
10 )бA = B ∧ D > 5 (r
٢-٤ـ ٢ﻋﻤﻠﮕﺮ ﭘﺮﺗﻮ Project
ﺍﻳـﻦ ﻋﻤﻠﮕـﺮ ﺯﻳـﺮ ﻣﺠﻤـﻮﻋﻪ ﺍﻱ ﻋﻤـﻮﺩﻱ ﺍﺯ ﻳﻚ ﺭﺍﺑﻄﻪ ﺭﺍ ﺍﺳﺘﺨﺮﺍﺝ ﻣﻲ ﻛﻨﺪ ﺻﻔﺎﺕ ﺧﺎﺻﻪ )ﺳﺘﻮﻧﻬﺎﻱ( ﭘﺎﺳﺦ ﺍﻋﻤﺎﻝ ﻋﻤﻠﮕﺮ ﺩﺍﺭﺍﻱ ﺗﺮﺗﻴﺒﻲ ﻫﺴﺘﻨﺪ ﻛﻪ ﺩﺭ ﻋﻤﻠﮕﺮ ﻣﺸﺨﺺ ﻣﻲ ﺷﻮﺩ. •
ﻧﻤﺎﺩ ﻋﻤﻠﮕﺮ
•
ﻧﺘـﻴﺠﻪ ﺑﻌـﻨﻮﺍﻥ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﺎ Kﺳﺘﻮﻥ ﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺑﺎ ﺣﺬﻑ ﺳﺘﻮﻧﻬﺎﻳﻲ ﻛﻪ ﺩﺭ ﻟﻴﺴﺖ ﻗﺮﺍﺭ ﻧﺪﺍﺭﻧﺪ ﺑﺪﺳﺖ ﺁﻣﺪﻩ
) (r
π A , A ,... Aﻛﻪ ... A2 , A1ﺍﺳﺎﻣﻲ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻭ rﻧﺎﻡ ﺭﺍﺑﻄﻪ ﺍﺳﺖ
K
2
1
ﺍﺳﺖ. •
ﺳﻄﺮﻫﺎﻱ ﺗﻜﺮﺍﺭﻱ ﺍﺯ ﻧﺘﻴﺠﻪ ﺣﺬﻑ ﻣﻲ ﺷﻮﻧﺪ.
•
ﻣﺜﺎﻝ :
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
C
A
C
A
1 1 2
α β β
1 1 1 2
α α β β
=
)∏ A,C (r
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٧ / C
B
A
1 1 1 2
10 20 30 40
α α β β
٤ـ٢ـ٣ـ ﻋﻤﻠﮕﺮ ﺍﺟﺘﻤﺎﻉ union
R1
ﺍﺟﺘﻤﺎﻉ ﺩﻭ ﺭﺍﺑﻄﻪ ﺭﺍﺑﻄﻪ ﺍﻳﺴﺖ ﻛﻪ ﺗﺎﭘﻠﻬﺎﻳﺶ ﺩﺭ ﻳﻚ ﻳﺎ ﻫﺮ ﺩﻭ ﺭﺍﺑﻄﻪ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ. R2
R = R1 union R2
•
ﻧﻤﺎﺩ ﻋﻤﻠﮕﺮ:
• •
}r ∪ s = {t | t∈r or t∈s r ∪ sﻣﻮﻗﻌﻲ ﻣﻌﺘﺒﺮ ﺍﺳﺖ ﻛﻪ :
r∪s
١ـ r,sﺑﺎﻳﺴﺘﻲ ﺗﻌﺪﺍﺩ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺑﺮﺍﺑﺮ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ. ٢ــ ﺣـﻮﺯﻩ )ﻣـﻴﺪﺍﻥ ( ﺻـﻔﺎﺕ ﺧﺎﺻـﻪ ﺩﻭ ﻣﺠﻤﻮﻋﻪ ﺑﺎﻳﺴﺘﻲ ﺳﺎﺯﮔﺎﺭ ﺑﺎﺷﻨﺪ .ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺻﻔﺖ ﺧﺎﺻﻪ iﺍﻡ ﺍﺯ ﻫﺮ ﺩﻭ ﺭﺍﺑﻄﻪ ﻳﻜﺴﺎﻥ ﺑﺎﺷﻨﺪ. ﻣﺜﺎﻝ: B
A
1 2 1 3
α α β β
r∪s:
B
A
B
A
2 3
α β
1 2 1
α α β
s
Relation r,s
r R1
: ٤-٢-٤ﺍﺷﺘﺮﺍﻙ
R2
Intersect
ﺍﺷﺘﺮﺍﻙ ﺩﻭ ﺭﺍﺑﻄﻪ،ﺭﺍﺑﻄﻪ ﺍﻳﺴﺖ ﻛﻪ ﺗﺎﭘﻠﻬﺎﻳﺶ ﺩﺭ ﻫﺮ ﺩﻭ ﺭﺍﺑﻄﻪ ﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ •
ﻧﻤﺎﺩ
• •
}t∈s sﻭ rﺑﺎﻳﺪ ﺍﺯ ﻧﻈﺮ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺑﺮﺍﺑﺮ ﻭ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻣﺘﻨﺎﻇﺮ ﺍﺯ ﻳﻚ ﻣﻴﺪﺍﻥ ﺑﺮ ﮔﺮﻓﺘﻪ ﺷﻮﻧﺪ
B
r∩s and
R = R1 ∩ R2 r ∩ s = {t | t ∈ r
A
B
A
B
A
1 α r1 ∩ r2
1 3
α β
1 2 1
α α β
r2
r1
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٨ /
set difference
: ٥-٢-٤ﻋﻤﻠﮕﺮ ﺗﻔﺎﺿﻞ :
ﺗﻔﺎﺿﻞ ﺩﻭ ﺭﺍﺑﻄﻪ ،ﺭﺍﺑﻄﻪ ﺍﻳﺴﺖ ﻛﻪ ﺗﺎﭘﻠﻬﺎﻳﺶ ﺩﺭ ﺭﺍﺑﻄﻪ ﺍﻭﻝ ﻣﻮﺟﻮﺩ ﺑﺎﺷﻨﺪ ﻭ ﺩﺭ ﺭﺍﺑﻄﻪ ﺩﻭﻡ ﻭﺟﻮﺩ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ R1 . r–s
ﻧﻤﺎﺩ :
R2
•
ﺗﻌﺮﻳﻒ ﻋﻤﻠﮕﺮ t ∉ s } :
•
ﺍﺧﺘﻼﻑ ﺩﻭ ﻣﺠﻤﻮﻋﻪ ﺑﻴﻦ ﺩﻭ ﻣﺠﻤﻮﻋﻪ ﺳﺎﺯﮔﺎﺭ ﺍﻧﺠﺎﻡ ﻣﻲ ﺷﻮﺩ s .ﻭ rﺑﺎﻳﺪ ﺩﺍﺭﺍﻱ ﺳﺘﻮﻧﻬﺎﻱ ﻳﻜﺴﺎﻥ ﺑﺎﺷﻨﺪ.
•
ﻣﺜﺎﻝ :
r - s = {t | t ∈ r
and
B
A
B
A
B
A
1 1
α β
2 3
α β
1 2
α α
1
β
s
r–s
r Cartesian Product
: ٦-٢-٤ﺣﺎﺻﻠﻀﺮﺏ ﻛﺎﺭﺗﺰﻳﻦ :
ﺣﺎﺻﻞ ﺭﺍﺑﻄﻪ ﺍﻳﺴﺖ ﺣﺎﻭﻱ ﺗﺮﻛﻴﺐ ﻫﺎﻱ ﻣﻤﻜﻦ ﺗﺎﭘﻠﻬﺎﻱ ﺩﻭ ﺭﺍﺑﻄﻪ ﻛﻪ ﺑﺎﻳﺪ ﺩﺭ ﻫﻢ ﺿﺮﺏ ﺷﻮﻧﺪ . •
ﻧﻤﺎﺩ ﻋﻤﻠﮕﺮ :
•
ﺗﻌﺮﻳﻒ ﻋﻤﻠﮕﺮ :
•
ﻓﺮﺽ ﻣﻲ ﺷﻮﺩ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ) r(Rﻭ ) s(Sﻣﺠﺰﺍ ﺑﺎﺷﻨﺪ
•
ﺍﮔﺮ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ) r(Rﻭ ) s(Sﻣﺠﺰﺍ ﻧﺒﺎﺷﻨﺪ ﺗﻐﻴﻴﺮ ﻧﺎﻡ ﺑﺎﻳﺴﺘﻲ ﺻﻮﺭﺕ ﭘﺬﻳﺮﺩ .
•
ﻣﺜﺎﻝ :
E
r×s } r × s = {(t,q) | t ∈ r and q ∈ s
D
C
B
A
a a b
10 10 10
α β γ
1 1 1
α α α
a a b
10 10 10
α β γ
2 2 2
β β β
: ٧-٢-٤ﺗﺮﻛﻴﺐ )ﭘﻴﻮﻧﺪ(
E
r×s:
a a b
∅ = R ∩S
D
C
10 10 10
α β γ
A
B
α β
1 2
r
S
join
)(Natural join
ﺣﺎﺻﻞ ﺭﺍﺑﻄﻪ ﺍﻱ ﺍﺳﺖ ﻛﻪ ﺗﺎﭘﻠﻬﺎﻱ ﺁﻥ ﺍﺯ ﭘﻴﻮﻧﺪ )ﺗﺮﻛﻴﺐ( ﺗﺎﭘﻠﻬﺎﻳﻲ ﺍﺯ ﺩﻭ ﺭﺍﺑﻄﻪ ﺑﺪﺳﺖ ﻣﻲ ﺁﻳﺪ ﺑﺸﺮﻁ ﺗﺴﺎﻭﻱ ﻣﻘﺎﺩﻳﺮ ﻳﻚ ﻳﺎ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺻﻔﺖ ﺧﺎﺻﻪ . •
ﻧﻤﺎﺩ ﻋﻤﻠﮕﺮ :
r ∞s
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
•
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٤٩ /
ﻓـﺮﺽ rﺭﺍﺑﻄﻪ ﺭﻭﻱ ﺍﺳﻜﻴﻤﺎﻱ Rﻭ sﺭﺍﺑﻄﻪ ﺍﻱ ﺭﻭﻱ ﺍﺳﻜﻴﻤﺎﻱ Sﺑﺎﺷﺪ .ﻧﺘﻴﺠﻪ ﺭﺍﺑﻄﻪ ﺍﻱ ﺩﺭ ﺍﺳﻜﻴﻤﺎﻱ R ∪ Sﺍﺳﺖ ﻛﻪ ﺑﺎ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺘﻦ ﻫﺮ ﺟﻔﺖ ﺗﺎﭘﻞ trﺍﺯ rﻭ tsﺍﺯ sﺑﺪﺳﺖ ﻣﻲ ﺁﻳﺪ .
•
ﺍﮔـﺮ trﻭ tsﺩﺍﺭﺍﻱ ﻣﻘﺎﺩﻳـﺮ ﻳﻜﺴـﺎﻥ ﺩﺭ ﻫـﺮ ﻳﻚ ﺍﺯ ﺻﻔﺎﺕ ﺧﺎﺻﻪ R ∩Sﺑﺎﺷﻨﺪ ﻳﻚ ﺗﺎﭘﻞ tﺑﻪ ﻧﺘﻴﺠﻪ ﺍﺿﺎﻓﻪ ﻣﻴﺸﻮﺩ ﺑﻄﻮﺭﻳﻜﻪ t :ﻫﻤﺎﻥ ﻣﻘﺎﺩﻳﺮ trﺩﺭ rﻭ tsﺩﺭ sﺭﺍﺩﺍﺭﺩ. )R = (A,B,C,D
ﻣﺜﺎﻝ :
)S = (E,B,D ) == (A,B,C,D,Eﺍﺳﻜﻴﻤﺎﻱ ﻧﺘﻴﺠﻪ
r ∞ sﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺗﻌﺮﻳﻒ ﻣﻴﺸﻮﺩ :
•
) )( r × s
r.D = s.D
and
∏ r.A,r.B,r.C,r.D,s.E (бr.B = s.B
ﻣﺜﺎﻝ : E
C D
B
A
E
D
B
D
C
B
A
α γ α γ δ
α α γ γ β
1 1 1 1 2
α α α α δ
α β γ δ ε
a a a b b
1 3 1 2 3
a a b a b
α γ β γ β
1 2 4 1 2
α β γ α δ
a a a a b
r ∞s
٨-٢-٤ﻋﻤﻠﮕﺮ ﺗﻘﺴﻴﻢ
s
r
Division
ﺩﻭﺭﺍﺑﻄﻪ ﻳﻜﻲ ﺍﺯ ﺩﺭﺟﻪ m + nﻭ ﺩﻳﮕﺮﻱ ﺍﺯ ﺩﺭﺟﻪ nﺭﺍ ﺑﺮﻫﻢ ﺗﻘﺴﻴﻢ ﻣﻲ ﻛﻨﺪ .ﺣﺎﺻﻞ ﺭﺍﺑﻄﻪ ﺍﻳﺴﺖ ﺣﺎﻭﻱ ﻣﻘﺎﺩﻳﺮﻱ ﺍﺯ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺭﺍﺑﻄﻪ ﺍﺯ ﺩﺭﺟﻪ m + nﻛﻪ ﻣﻘﺎﺩﻳﺮ ﺻﻔﺖ ﺧﺎﺻﻪ ﺩﻳﮕﺮ ﺑﻪ ﺗﻤﺎﻣﻲ ﺩﺭ ﺭﺍﺑﻄﻪ ﺩﺭﺟﻪ nﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ . ÷
•
ﻧﻤﺎﺩ
•
ﺍﻳﻦ ﻋﻤﻠﮕﺮ ﺑﺮﺍﻱ ﺑﺮﺍﻱ ﭘﺮﺱ ﻭ ﺟﻮﻫﺎﻳﻲ ﻛﻪ ﻋﺒﺎﺭﺕ ﺑﺮﺍﻱ ﺗﻤﺎﻡ ) (for allﺭﺍ ﺩﺍﺭﻧﺪ ﻣﻨﺎﺳﺐ ﺍﺳﺖ .
•
ﻓﺮﺽ ﻛﻨﻴﺪ rﻭ sﺭﺍﺑﻄﻪ ﻫﺎﻳﻲ ﺭﻭﻱ ﺍﺳﻜﻴﻤﺎﻩ ﺍﻱ Rﻭ Sﺑﺎﺷﻨﺪ ﺑﻄﻮﺭﻳﻜﻪ :
)R = (A1,…,Am,B1,…,Bn )S = (B1,…,Bn ﻧﺘﻴﺠﻪ ﺗﻘﺴﻴﻢ rﺑﺮ sﺭﺍﺑﻄﻪ ﺍﻳﺴﺖ ﺩﺭ ﺍﺳﻜﻴﻤﺎﻱ R – S )R – S = (A1,…,Am } )r ÷ s = {t | t ∈ ∏R – S(r) ∧ ∀ u ∈ s(tu ∈ r
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
•
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥٠ /
ﻣﺜﺎﻝ :
A
B
B
A
α β r÷s
1 2
1 2 3 1 1 1 3 4 2
α α α β γ δ δ δ β
s
r C
B
A
E
D
E
D
C
B
A
γ γ
a a
α γ
1 1
a b
1 1 1 1 3 1 1 1
a a b a b a b b
α γ γ γ γ γ γ β
A A A A A A A A
α α α β β γ γ γ
r÷s
s
r - ٣-٤ﻋﻤﻠﮕﺮﻫﺎﻱ ﺍﺿﺎﻓﻪ ﺷﺪﻩ ﻭ ﻋﻤﻠﻴﺎﺕ ﺩﻳﮕﺮ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ : ١-٣-٤ﻋﻤﻠﮕﺮ ﺗﻐﻴﻴﺮ ﻧﺎﻡ
Rename
ﺍﻳﻦ ﺍﻣﻜﺎﻥ ﺭﺍ ﻣﻲ ﺩﻫﺪ ﻛﻪ ﺑﻪ ﻳﻚ ﺭﺍﺑﻄﻪ ﺑﺎ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺍﺳﻢ ﺭﺟﻮﻉ ﺷﻮﺩ .
)Px(E
•
ﻋﺒﺎﺭﺕ Eﺭﺍ ﺗﺤﺖ ﻧﺎﻡ Xﺑﺮ ﻣﻲ ﮔﺮﺩﺍﻧﺪ. •
ﺍﮔﺮ ﻳﻚ ﻋﺒﺎﺭﺕ ﺟﺒﺮﺭﺍﺑﻄﻪ ﺍﻱ n ، Eﺳﺘﻮﻥ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ
Px(A1, … ,An)E
ﺑﻪ ﻣﻌﻨﻲ ﺁﻥ ﺍﺳﺖ ﻛﻪ ﻧﺘﻴﺠﻪ ﻋﺒﺎﺭﺕ Eﺗﺤﺖ ﻧﺎﻡ Xﺑﺎ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺗﻐﻴﻴﺮ ﻧﺎﻡ ﻳﺎﻓﺘﻪ
An, … ,A1
ﺑﺮ ﻣﻲ
ﮔﺮﺩﺍﻧﺪ. : ٢-٣-٤ﻋﻤﻠﮕﺮ ﺑﺴﻂ
Extend
ﻋﻤﻠﮕﺮ ﺍﺳﺖ ﻛﻪ ﺑﺮﺍﻱ ﮔﺴﺘﺮﺵ ﻋﻨﻮﺍﻥ ﻳﻚ ﺭﺍﺑﻄﻪ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ .ﻛﻪ ﻣﻌﻤﻮﻻ ﺻﻔﺖ ﺧﺎﺻﻪ ﺍﺿﺎﻓﻪ ﺷﺪﻩ ﻣﻘﺎﺩﻳﺮ ﺁﻥ ﺑﺎ ﺍﺭﺯﻳﺎﺑﻲ ﻳﻚ ﻋﺒﺎﺭﺕ ﻣﺤﺎﺳﺒﺎﺗﻲ ﻣﺸﺨﺺ ﺑﺪﺳﺖ ﻣﻲ ﺁﻳﺪ . Extend P Add (weight ∗ 454) As GMWT
GMWTﻭﺯﻥ ﻗﻄﻌﺎﺕ ﺑﺮ ﺣﺴﺐ ﮔﺮﻡ ﻣﻲ ﺑﺎﺷﺪ ﻛﻪ ﺩﺭ ﻭﺍﻗﻊ ﺗﺒﺪﻳﻞ ﺷﺪﻩ ﭘﻮﻧﺪ ﺑﻪ ﮔﺮﻡ ﺍﺳﺖ .
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥١ /
Aggregate Operator
: ٣-٣-٤ﻋﻤﻠﮕﺮ ﻫﺎﻱ ﺟﻤﻌﻲ
ﻋﻤﻠﮕﺮﻫﺎﻳﻲ ﻛﻪ ﺑﺮﺍﻱ ﺷﻤﺎﺭﺵ ،ﻣﺠﻤﻮﻉ ،ﻣﻴﺎﻧﮕﻴﻦ ﻭ ﻣﻲ ﻧﻴﻤﻢ ﻭ ﻣﺎﻛﺰﻳﻤﻢ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﻧﺪ .ﺩﺭ ﻭﺍﻗﻊ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﻣﻘﺎﺩﻳﺮ ﺭﺍ ﮔﺮﻓﺘﻪ ﻭ ﻳﻚ ﻣﻘﺪﺍﺭ ﺗﻜﻲ ﺭﺍ ﺑﻌﻨﻮﺍﻥ ﺧﺮﻭﺟﻲ ﺑﺎﺯ ﻣﻲ ﮔﺮﺩﺍﻧﻨﺪ. Min , Max , Avg , Sum , Count )(sp
ﻣﺜﺎﻝ :ﻣﺠﻤﻮﻉ ﻗﻄﻌﺎﺕ ﺗﻬﻴﻪ ﺷﺪﻩ ﺗﻮﺳﻂ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ . s1
)gsum(Qty) (sp
ﻳﺎ -٤-٣-٤ﻋﻤﻠﮕﺮ ﺍﻧﺘﺴﺎﺏ
)бs# = ‘s1’g sum(Qty
Assignment
←
•
ﻧﻤﺎﺩ
•
ﺍﻳﻦ ﻋﻤﻠﮕﺮ ﻳﻚ ﺭﻭﺵ ﻣﻨﺎﺳﺐ ﺑﺮﺍﻱ ﺑﻴﺎﻥ ﭘﺮﺱ ﻭ ﺟﻮﻫﺎﻱ ﭘﻴﭽﻴﺪﻩ ﺍﺳﺖ .
•
ﺍﻧﺘﺴﺎﺏ ﺑﺎﻳﺴﺘﻲ ﺑﻪ ﻳﻚ ﻣﺘﻐﻴﻴﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﻣﻮﻗﺖ ﻧﺴﺒﺖ ﺩﺍﺩﻩ ﺷﻮﺩ :
-٥-٣-٤ﻋﻤﻠﮕﺮ ﻧﻴﻢ ﭘﻴﻮﻧﺪ Semi Join
ﺍﻳﻦ ﻋﻤﻠﮕﺮ ﮔﻮﻧﻪ ﺍﻱ ﺩﻳﮕﺮ ﺍﺯ ﭘﻴﻮﻧﺪ ﻃﺒﻴﻌﻲ ﺍﺳﺖ ﻛﻪ ﺩﺭﺁﻥ ،ﺗﻨﻬﺎ ﺗﺎﭘﻠﻬﺎﻱ ﭘﻴﻮﻧﺪ ﺷﺪﻧﻲ ﺍﺯ ﺭﺍﺑﻄﻪ ﺳﻤﺖ ﭼﭗ ﺩﺭ ﺭﺍﺑﻄﻪ ﺟﻮﺍﺏ ﻭﺍﺭﺩ ﻣﻴﺸﻮﻧﺪ .ﺍﻳﻦ ﻋﻤﻠﮕﺮ ﺩﺭ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎﻱ ﺗﻮﺯﻳﻊ ﺷﺪﻩ ﻛﺎﺭﺑﺮﺩ ﺩﺍﺭﺩ . )R1 ∝ R2 = ∏ Attribute(R1) (R1 ∞ R2 -٥-٣-٤ﻋﻤﻠﮕﺮ ﻧﻴﻢ ﺗﻔﺎﺿﻞ Semi Minus
ﺍﻳﻦ ﻋﻤﻠﮕﺮ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﺳﺖ : )R1 SEMIMINUS R2 = R1 MINUS ( R1 ∝ R2
-٤-٤ﻣﺠﻤﻮﻋﻪ ﻛﺎﻣﻞ ﻋﻤﻠﮕﺮﻫﺎ ﺩﺭ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ : ﺍﺯ ﻋﻤﻠﮕﺮﻫﺎﻱ ﻣﻄﺮﺡ ﺷﺪﻩ ،ﺑﺮﺧﻲ ﻣﺒﻨﺎﻳﻲ ﻫﺴﺘﻨﺪ ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﺎ ﻛﻪ ﻣﺠﻤﻮﻋﻪ ﺁﻧﻬﺎ ﺍﺯ ﻧﻈﺮ ﻋﻤﻠﻴﺎﺗﻲ ﻛﺎﻣﻞ ﺍﺳﺖ ﻭ ﻫﺮ ﻋﻤﻠﮕﺮ ﺩﻳﮕﺮ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﺮ ﺣﺴﺐ ﻋﻤﻠﮕﺮﻫﺎﻱ ﺍﻳﻦ ﻣﺠﻤﻮﻋﻪ ﺑﻴﺎﻥ ﻛﺮﺩ .ﺍﻳﻦ ﻣﺠﻤﻮﻋﻪ ﻛﺎﻣﻞ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ : } {Select , Project , Union , Minus, Time
ﺑﺮﺧﻲ ﻋﻤﻠﮕﺮﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺑﺎ ﺍﻳﻦ ﻣﺠﻤﻮﻋﻪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ : )R1 ∩ R2 = R1 – (R1 – R2) = R2 – ( R2 – R1 )R1 ∩ R2 = ( R1 ∪ R2 ) – ( R1 – R2) ∪ ( R2 – R1 ]R1(Y,X) ÷ R2(X) = R1[Y] – (( R1[Y] × R2 ) – R1 )[Y
-٥-٤ﺑﺮﺧﻲ ﺧﻮﺍﺹ ﻋﻤﻠﮕﺮﻫﺎ : ﺍﮔﺮ R,S,Tﺭﺍﺑﻄﻪ ﺑﺎﺷﻨﺪ ﺩﺍﺭﻳﻢ : R∞S=S∞R )(R ∞ S) ∞ T = R ∞ (S ∞ T
) ∏ A1..Ap (∏ Ai..Aj) ( R ) = ∏ A1..Ap ( R
)б Ai=’a’ ( R ) U бAi=’a’( S ) = бAi=’a’ (RUS )б Ai=’a’ ( R ) ∩ бAi=’a’( S ) = бAi=’a’ (R∩S )б Ai=’a’ ( R ) - бAi=’a’( S ) = бAi=’a’ (R-S
123456-
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥٢ /
) ∏ A1..Ap ( R ) U ∏ A1..Ap ( S ) = ∏ A1..Ap (R U S
7-
ﻣﺜﺎﻝ :ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ،ﻗﻄﻌﺎﺕ ،ﭘﺮﻭﮊﻩ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﺪ .ﺳﺎﺧﺘﺎﺭ ﺁﻥ ﺩﺭ ﺯﻳﺮ ﺍﺭﺍﺋﻪ ﺷﺪﻩ ﺍﺳﺖ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﻪ ﭘﺮﺱ ﻭ ﺟﻮﻫﺎﻱ ﺯﻳﺮ ﭘﺎﺳﺦ ﺩﻫﻴﺪ . )S (s# , sname , status , city )P (p# , pname , color , weight , city )J (j# , jname , city )SPJ (s# , p# , j# , Qty
-١ﺟﺰﺋﻴﺎﺕ ﻛﺎﻣﻞ ﺗﻤﺎﻡ ﭘﺮﻭﮊﻩ ﻫﺎﻱ ﺷﻬﺮ “ﺗﻬﺮﺍﻥ” ﺭﺍ ﻣﺸﺨﺺ ﻛﻨﻴﺪ . ‘ ﺗﻬﺮﺍﻥ‘ = J where city
) ‘ (Jﺗﻬﺮﺍﻥ‘ = бcity
ﻳﺎ
-٢ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﻗﻄﻌﻪ P2ﺭﺍ ﺑﺪﻫﻴﺪ : )’∏Sname (S join SPJ where P# = ‘P2
ﻳﺎ
))∏Sname (бP# = ‘P2’(S ∞ SPJ
temp1 ← S join SPJ
ﻳﺎ
’temp2 ← temp1 where P# =’P2 )result ← ∏Sname (temp2
-٣ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﻛﻪ ﺍﻗﻼ ﻳﻚ ﻗﻄﻌﻪ ﺁﺑﻲ ﺭﺍ ﺗﻬﻴﻪ ﻣﻲ ﻛﻨﻨﺪ : ] ‘) ∞ SPJ) ∞ S)[snameﺁﺑﻲ‘ = ((P where color ‘ P) ∞ SPJ) ∞ Sﺁﺑﻲ‘ = ∏Sname ((бcolor
-٤ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﺭﺍ ﺑﺪﻫﻴﺪ ﻛﻪ ﺗﻤﺎﻡ ﻗﻄﻌﺎﺕ ﺭﺍ ﺗﻬﻴﻪ ﻣﻲ ﻛﻨﻨﺪ : )∏Sname ((∏(S# , P#) (SPJ) ÷ ∏P# (P) ∞ S
-٥ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﻛﻪ ﻗﻄﻌﻪ P2ﺭﺍ ﺗﻬﻴﻪ ﻧﻤﻲ ﻛﻨﻨﺪ : ](∏S# (S) – (∏S# (бP# = ‘P2’( SPJ)) ∞ S [sname ](S[S#] – (SPJ where P# = ‘p2’) [S#] ) ∞ S [sname
ﻳﺎ
-٦ﺷﻤﺎﺭﻩ ﻗﻄﻌﺎﺗﻲ ﺭﺍ ﻣﺸﺨﺺ ﻛﻨﻴﺪ ﻛﻪ ﺗﻮﺳﻂ ﻳﻚ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﺩﺭ ﺷﻬﺮ ﺗﻬﺮﺍﻥ ﻳﺎ ﭘﺮﻭﮊﻩ ﺍﻱ ﺩﺭ ﺷﻬﺮ ﺗﻬﺮﺍﻥ ﻋﺮﺿﻪ ﻣﻲ ﺷﻮﺩ : ]‘ )) [P#ﺗﻬﺮﺍﻥ‘ = ‘ )) [P#] ∪ SPJ ∞ ( J Where cityﺗﻬﺮﺍﻥ‘ = SPJ ∞ ( S Where city ) ‘ Jﺗﻬﺮﺍﻥ‘ = ∏P# (SPJ ∞ (бcity
∪ )) ‘ (Sﺗﻬﺮﺍﻥ‘ = (SPJ ∞ (бcity
ﻣﺜﺎﻝ : ٢ﻳﻚ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺩﺭ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺑﺎﻧﻚ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﺪ ﻛﻪ ﺩﺍﺭﺍﻱ ﺟﺪﺍﻭﻝ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ : ﺷﻌﺒﻪ ﺑﺎﻧﻚ )ﻧﺎﻡ ﺷﻌﺒﻪ ،ﺷﻬﺮ ﺷﻌﺒﻪ ،ﺩﺍﺭﺍﻳﻴﻬﺎ ( ﻣﺸﺘﺮﻱ )ﻧﺎﻡ ﻣﺸﺘﺮﻱ ،ﺁﺩﺭﺱ ( ﺣﺴﺎﺏ )ﺷﻤﺎﺭﻩ ﺣﺴﺎﺏ ،ﻧﺎﻡ ﺷﻌﺒﻪ ،ﻣﻮﺟﻮﺩﻱ ( ﻭﺍﻡ )ﺷﻤﺎﺭﻩ ﻭﺍﻡ ،ﻧﺎﻡ ﺷﻌﺒﻪ ،ﻣﻘﺪﺍﺭ ﻭﺍﻡ (
∏P#
٥٣ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
( ﺷﻤﺎﺭﻩ ﺣﺴﺎﺏ،ﺳﭙﺮﺩﻩ ﮔﺬﺍﺭﻱ )ﻧﺎﻡ ﻣﺸﺘﺮﻱ ( ﺷﻤﺎﺭﻩ ﻭﺍﻡ،ﻭﺍﻡ ﮔﻴﺮﻧﺪﻩ )ﻧﺎﻡ ﻣﺸﺘﺮﻱ branch (branch_name , branch_city , assests) customer (customer_name , customer_street , customer_city) account (account_number , branch_name , balance) loan (loan_number , branch_name , amount) depositor (customer_name , account_number) borrower (customer_name , loan_number)
depositor
loan_branch
customer street city
loan
borrower
loan_num
amount
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥٤ /
queryﻫﺎ : -١ﺗﻤﺎﻣﻲ ﻭﺍﻣﻬﺎﻱ ﺑﻴﺶ ﺍﺯ ١٠٠٠٠٠ﺭﻳﺎﻝ ﺭﺍ ﺑﺪﻫﻴﺪ :
)бamount > 100000 (loan -٢ﺷﻤﺎﺭﻩ ﻭﺍﻣﻬﺎﻳﻲ ﺭﺍ ﻛﻪ ﺑﻴﺶ ﺍﺯ ١٠٠٠٠٠ﺭﻳﺎﻝ ﻣﻲ ﺑﺎﺷﻨﺪ ﺑﺪﻫﻴﺪ :
))∏loan_number (бamount > 100000 (loan -٣ﺍﺳﺎﻣﻲ ﺗﻤﺎﻣﻲ ﻣﺸﺘﺮﻳﺎﻧﻲ ﻛﻪ ﻭﺍﻡ ﮔﺮﻓﺘﻪ ﻭ ﺷﻤﺎﺭﻩ ﺣﺴﺎﺏ ﺩﺍﺭﻧﺪ ﺭﺍ ﺑﺪﻫﻴﺪ :
)∏customer_name (borrower) ∩ ∏customer_name (depositor -٤ﺍﺳﺎﻣﻲ ﺗﻤﺎﻡ ﻣﺸﺘﺮﻳﺎﻧﻲ ﺭﺍ ﻛﻪ ﺩﺭ ﺷﻌﺒﻪ ﻣﺮﻛﺰﻱ ﻭﺍﻡ ﮔﺮﻓﺘﻪ ﺍﻧﺪ ﺑﺪﻫﻴﺪ :
)))’ ( бborrower.loan_number = loan .loan_number (borrower × loanﻣﺮﻛﺰﻱ‘ = ∏customer_name (бbranch_name -٥ﺍﺳﺎﻣﻲ ﺗﻤﺎﻡ ﻣﺸﺘﺮﻳﺎﻧﻲ ﻛﻪ ﺩﺭ ﺷﻌﺒﻪ ﻧﺎﺩﺭﻱ ﻭﺍﻡ ﮔﺮﻓﺘﻪ ﺍﻧﺪ ﺭﺍ ﺑﺪﻫﻴﺪ : ’)( бborrower.loan_number = loan .loan_numberﻧﺎﺩﺭﻱ‘ = Q1: ∏customer_name (бbranch_name )))(borrower × loan ’ﻧﺎﺩﺭﻱ‘ = Q2: ∏customer_name ( бloan .loan_number = borrower.loan_number (бbranch_name ))(loan)) × borrower
-٦ﺍﺳﺎﻣﻲ ﺗﻤﺎﻡ ﻣﺸﺘﺮﻳﺎﻧﻲ ﺭﺍ ﻛﻪ ﻳﻚ ﺣﺴﺎﺏ ﺩﺭ ﺗﻤﺎﻡ ﺷﻌﺒﻪ ﻫﺎﻱ ﺷﻬﺮ ﻗﺰﻭﻳﻦ ﺩﺍﺭﻧﺪ ﺭﺍ ﺑﺪﻫﻴﺪ : )) ” (branchﻗﺰﻭﻳﻦ“ = ∞ account) ÷∏branch_name (бbranch_city
•
∏customer_name , branch_name (depositor
ﻧﻜﺎﺕ ﻣﻬﻢ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ : -١ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﺯﺑﺎﻧﻲ ﺍﺳﺖ ﺭﻭﺷﻤﻨﺪ ﻳﻌﻨﻲ ﺑﺮﻧﺎﻣﻪ ﺳﺎﺯ ﻧﻪ ﺗﻨﻬﺎ ﺑﻪ ﺳﻴﺴﺘﻢ ﻣﻲ ﮔﻮﻳﺪ ﭼﻪ ﻣﻲ ﺧﻮﺍﻫﺪ ﺑﻠﻜﻪ ﻧﺤﻮﻩ ﺑﺪﺳﺖ ﺁﻭﺭﺩﻥ ﺁﻧﭽﻪ ﺭﺍ ﻛﻪ ﻣﻲ ﺧﻮﺍﻫﺪ ﻧﻴﺰ ﺑﻴﺎﻥ ﻣﻲ ﻛﻨﺪ . -٢ﻣﻌﺎﺩﻝ ﺍﺳﺖ ﺑﺎ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﻳﻌﻨﻲ ﻫﺮﺗﻮﺍﻧﻲ ﻛﻪ ﻣﺠﻤﻮﻋﻪ ﺍﻣﻜﺎﻧﺎﺕ ﻣﺤﺎﺳﺒﺎﺗﻲ ﺩﺍﺭﺩ ﺟﺒﺮﺭﺍﺑﻄﻪ ﺍﻱ ﻧﻴﺰ ﺩﺍﺭﺩ . -٣ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﻓﻘﻂ ﺑﺮﺍﻱ ﺑﺎﺯﻳﺎﺑﻲ ﻧﻴﺴﺖ ﺑﻠﻜﻪ ﻣﻲ ﺗﻮﺍﻥ ﺩﺭ ﻋﻤﻠﻴﺎﺕ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﻭ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﻧﻴﺰ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ . ﻣﺜﺎﻝ :ﺩﺭﺝ ﻛﻨﻴﺪ
> < S7,S n7, ...
ﺩﺭ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﻣﻲ ﺗﻮﺍﻥ ﺍﺯ ﻋﻤﻠﮕﺮ ﺍﺟﺘﻤﺎﻉ ﺑﺮﺍﻱ ﺩﺭﺝ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ r U E :
Eﺭﺍﺑﻄﻪ ﺛﺎﺑﺖ ﻭ ﺩﺍﺭﺍﻱ ﻳﻚ ﺗﺎﭘﻠﻲ ﺍﺳﺖ . ﻣﺜﺎﻝ :ﺣﺬﻑ ﻛﻨﻴﺪ
}S U {s# = s7, sname =sn7,...
> < S4,Sn4, ...
} S Minus {s# = s4 r ﺍﺯ ﻋﻤﻠﮕﺮ ﺗﻔﺮﻳﻖ ﺑﺮﺍﻱ ﺣﺬﻑ ﺍﺯ ﻳﻚ ﺭﺍﺑﻄﻪ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ r - E .
rﺭﺍﺑﻄﻪ ﻭ Eﺭﺍﺑﻄﻪ ﺍﻱ ﺑﺎ ﺷﺮﺍﻳﻂ ﺣﺬﻑ ﻣﻲ ﺑﺎﺷﺪ .
r
r ,ﺭﺍﺑﻄﻪ ﻭ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
-٦-٥ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥٥ /
Relational calculus
ﻣﺤﺎﺳـﺒﺎﺕ ﺭﺍﺑﻄـﻪ ﺍﻱ ﺍﻣﻜـﺎﻥ ﺩﻳﮕـﺮﻱ ﺍﺳﺖ ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﻋﻤﻠﻴﺎﺕ ﺭﻭﻱ ﺭﺍﺑﻄﻪ ﻫﺎ ﻭ ﻛﺎﺭ ﺑﺎ ﺑﺎﻧﻚ ﺭﺍﺑﻄﻪ ﺍﻱ
ﻣﺤﺎﺳﺒﺎﺕ
ﺭﺍﺑﻄ ـﻪ ﺍﻱ ﺣﺎﻟــﺖ ﻧﺎﺭﻭﺷــﻤﻨﺪ )ﻏﻴــﺮ ﺭﻭﻳــﻪ ﺍﻱ ( ﺩﺍﺭﺩ ﻳﻌﻨــﻲ ﺩﺭ ﺁﻥ ﻋﻤﻠــﻴﺎﺕ ﻻﺯﻡ ﺑــﺮﺍﻱ ﺍﺷــﺘﻘﺎﻕ ﺭﺍﺑﻄــﻪ ﺍﻱ ﺍﺯ ﺭﺍﺑﻄــﻪ ﻫــﺎﻱ ﺩﻳﮕﺮﺗﺼﺮﻳﺢ ﻧﻤﻲ ﺷﻮﺩ .ﺑﻪ ﻋﺒﺎﺭﺗﻲ ﺗﻨﻬﺎ ﺁﻧﭽﻪ ﻛﻪ ﺑﺎﻳﺪ ﺑﺎﺯﻳﺎﺑﻲ ﺷﻮﺩ ﺗﺸﺮﻳﺢ ﻣﻲ ﺷﻮﺩ ﻭ ﭼﮕﻮﻧﮕﻲ ﺑﺎﺯﻳﺎﺑﻲ ﺁﻧﻬﺎ ﺑﻴﺎﻥ ﻧﻤﻲ ﺷﻮﺩ . ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﺩﺭ ﺩﻭ ﺷﺎﺧﻪ ﺑﻴﺎﻥ ﻣﻲ ﺷﻮﺩ : -١ﻣﺤﺎﺳﺒﺎﺕ ﺭﻭﻱ ﺗﺎﭘﻞ ﻫﺎ
Tuple Relational Calculus
-٢ﻣﺤﺎﺳﺒﺎﺕ ﺭﻭﻱ ﻣﻴﺪﺍﻥ ﻫﺎ
Domain Relational calculus
ﺍﻳـﺪﻩ ﺍﻭﻟـﻴﻪ ﺍﺳـﺘﻔﺎﺩﻩ ﺍﺯ ﻣﺤﺎﺳـﺒﺎﺕ ﺭﺍﺑﻄـﻪ ﺍﻱ ﻧﺨﺴـﺘﻴﻦ ﺑﺎﺭ ﺗﻮﺳﻂ Knuthﻣﻄﺮﺡ ﺷﺪ ﻭ ﺳﭙﺲ ﻛﺎﺩ ﻧﺤﻮﻩ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺁﻥ ﺭﺍ ﺑـﺮﺍﻱ ﺍﻧﺠـﺎﻡ ﻋﻤﻠـﻴﺎﺕ ﺭﻭﻱ ﺭﺍﺑﻄﻪ ﻫﺎﻱ ﺑﺎﻧﻚ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﻴﺎﻥ ﻛﺮﺩ .ﺑﺮ ﺍﺳﺎﺱ ﻛﺎﺭﻫﺎﻱ ﻛﺎﺩ ﺯﺑﺎﻥ Alphaﻃﺮﺍﺣﻲ ﺷﺪ ﻛﻪ ﺍﻟﺒﺘﻪ ﺑـﻪ ﻣـﺮﺣﻠﻪ ﭘـﻴﺎﺩﻩ ﺳـﺎﺯﻱ ﻧﺮﺳـﻴﺪ .ﺑﻌﺪﻫﺎ ﺯﺑﺎﻧﻲ ﺑﻨﺎﻡ Quelﺑﺮﮔﺮﻓﺘﻪ ﺍﺯ Alphaﻃﺮﺍﺣﻲ ﺷﺪ ﻛﻪ ﺑﻪ ﻧﻮﻋﻲ ﻣﻲ ﺗﻮﺍﻥ ﺁﻥ ﺭﺍ ﻧﻤﻮﻧﻪ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ Alphaﺩﺍﻧﺴﺖ . ﻳﻜـﻲ ﺍﺯ ﻣﻬﻤﺘـﺮﻳﻦ ﺟﻨـﺒﻪ ﻫـﺎﻱ ﻣﺤﺎﺳـﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ،ﻣﻔﻬﻮﻡ ﻣﺘﻐﻴﺮ ﻃﻴﻔﻲ ﻳﺎ ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﺍﺳﺖ .ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﻣﺘﻐﻴﺮﻱ ﺍﺳﺖ ﻛﻪ ﻣﻘﺎﺩﻳـﺮﺵ ﺍﺯ ﻳـﻚ ﺭﺍﺑﻄـﻪ ﺑﺮﮔـﺮﻓﺘﻪ ﻣـﻲ ﺷﻮﺩ ﻭﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ،ﻃﻴﻒ ﻣﻘﺎﺩﻳﺮ ﻣﺠﺎﺯﺵ ،ﻫﻤﺎﻥ ﺗﺎﭘﻠﻬﺎﻱ ﻣﺠﻤﻮﻋﻪ ﺑﺪﻧﻪ ﺭﺍﺑﻄﻪ ﺍﺳﺖ .ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﺭﺍ ﺑﺎﻳﺴﺘﻲ ﺗﻌﺮﻳﻒ ﻛﺮﺩ ﻛﻪ ﺩﺭ ﺯﺑﺎﻥ Quel
ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ :
; Range of SX is S `RETRIEVE ( SX.S#) WHERE SX.CITY = `TEHRAN ﺩﺭ ﺍﻳﻨﺠﺎ ﻣﺘﻐﻴﺮ SXﻫﻤﺎﻥ ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﺍﺳﺖ ﻛﻪ ﻣﻘﺎﺩﻳﺮﺵ ﺗﺎﭘﻠﻬﺎﻱ Sﻫﺴﺘﻨﺪ .
ﺩﺭ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﺎ ﻣﺘﻐﻴﺮ ﻣﻴﺪﺍﻧﻲ ﻧﻴﺰ ﺑﺠﺎﻱ ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ،ﻣﺘﻐﻴﺮ ﻣﻴﺪﺍﻧﻲ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻭ ﺯﺑﺎﻧﻬﺎﻱ ﻣﺘﻌﺪﺩﻱ ﻣﺒﺘﻨﻲ ﺑﺮ ﺍﻳﻨﮕﻮﻧﻪ ﺍﺯ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﻃﺮﺍﺣﻲ ﺷﺪﻩ ﺍﻧﺪ ﻛﻪ ﺍﺯ ﺟﻤﻠﻪ ﻣﻲ ﺗﻮﺍﻥ ﺑﻪ ﺯﺑﺎﻧﻬﺎﻱ ﺯﻳﺮ ﺍﺷﺎﺭﻩ ﻛﺮﺩ . ILLFQL -
Formal Query Language
QBE -
Query By Example
: ١-٦-٥ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﺗﺎﭘﻠﻲ ﮔﺮﺍﻣـﺮ ﺯﺑـﺎﻥ ﻣﺒﺘﻨﻲ ﺑﺮ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺩﺭ ﻛﺘﺎﺑﻬﺎﻱ ﻣﺨﺘﻠﻒ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺯ ﺟﻤﻠﻪ ﻛﺘﺎﺏ DATE
ﻣﺸـﺎﻫﺪﻩ ﻛـﺮﺩ ﻛـﻪ ﺧـﺎﺭﺝ ﺍﺯ ﺑﺤﺚ ﺍﻳﻦ ﺩﺭﺱ ﻣﻲ ﺑﺎﺷﺪ .ﺩﺭ ﺍﻳﻨﺠﺎ ﺑﻄﻮﺭ ﺧﻼﺻﻪ ﺑﺮﺧﻲ ﻣﻔﺎﻫﻴﻢ ﺍﺳﺎﺳﻲ ﻣﻮﺟﻮﺩ ﺩﺭ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﻴﺎﻥ ﻣﻲ ﺷﻮﺩ ﻭ ﺳﭙﺲ ﺑﻪ ﺫﻛﺮ ﭼﻨﺪ ﻣﺜﺎﻝ ﺑﺴﻨﺪﻩ ﻣﻲ ﻛﻨﻴﻢ . : ١-١-٦-٥ﺗﻌﺮﻳﻒ ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ : ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﺑﻪ ﻛﻤﻚ ﺣﻜﻢ ﺯﻳﺮ ﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﺩ : Range of T is x1 ; x2 ; x3 ; ... ; xn
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥٦ /
ﻛﻪ ﺩﺭ ﺁﻥ Tﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﻭ X1ﻭ X2ﻭ Xn ...ﻋﺒﺎﺭﺍﺕ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﻫﺴﺘﻨﺪ ﻭ ﻧﻤﺎﻳﺎﻧﮕﺮ ﺭﺍﺑﻄﻪ ﻫﺎﻳﻲ ﻣﺜﻞ R2 , R1ﻭ Rn ...ﻣﻲ ﺑﺎﺷﻨﺪ .ﺑﺪﻳﻬﻲ ﺍﺳﺖ ﺍﮔﺮ ﺩﺭﻟﻴﺴﺖ ﺭﺍﺑﻄﻪ ﻫﺎ ﺗﻨﻬﺎ ﻳﻚ ﺭﺍﺑﻄﻪ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﻣﻘﺎﺩﻳﺮﺵ ﺭﺍ ﺍﺯ ﻫﻤﺎﻥ ﺭﺍﺑﻄﻪ Rﻣﻲ ﮔﻴﺮﺩ . RANGE OF SX IS S
ﻣﺜﺎﻝ :
; RANGEVAR SX RANGES OVER S
ﻳﺎ
; RANGE OF SPX IS SP ; RANGEVAR SPX RANGES OVER SPﻳﺎ
: ٢-١-٦-٥ﻋﻤﻠﮕﺮ ﻫﺎ ﺩﻭ ﻋﻤﻠﮕﺮ ﺩﺭ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﻧﺪ ﻛﻪ ﺑﻪ ﺁﻧﻬﺎ ﺳﻮﺭ ﮔﻮﻳﻨﺪ .ﻛﻪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ : -ﺳﻮﺭ ﻭﺟﻮﺩﻱ
Exist Quantifireﺑﻪ ﻣﻌﻨﺎﻱ ﻭﺟﻮﺩ ﺩﺍﺭﺩ :
-ﺳﻮﺭ ﻫﻤﮕﺎﻧﻲ
FOR.ALL Quantifireﺑﻪ ﻣﻌﻨﺎﻱ ﺑﺮﺍﻱ ﻫﻤﻪ :
ﺑـﻪ ﻛﻤﻚ ﺍﻳﻦ ﺩﻭ ﺳﻮﺭ ﻋﺒﺎﺭﺍﺕ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﻧﻮﺷﺘﻪ ﻣﻲ ﺷﻮﻧﺪ ﻭ ﺩﺭ ﺁﻥ ﮔﺰﺍﺭﻩ ﻫﺎﻳﻲ ﺑﺮ ﻧﻬﺎﺩﻩ ﻣﻴﺸﻮﺩ .ﺣﺎﺻﻞ ﺍﺭﺯﻳﺎﺑﻲ ﺍﻳﻦ ﻋﺒﺎﺭﺍﺕ ﻣﻤﻜﻦ ﺍﺳﺖ trueﻭ ﻳﺎ falseﺑﺎﺷﺪ . ﻳﺎﺩﺁﻭﺭﻱ :ﻓﺮﺽ X
N )EXISTS X (X>10 )EXISTS X (X<-5
True False
N3 3 4 4
1) EXISTS T (T(N1)=1) : True 2) FORALL T (T(N1)=1) : True 3 )EXISTS T (T(N1)=1 AND T(N3)>5) : False
N2 2 2 3
N1 1 1 1
Tﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﺭﻭﻱ ﺟﺪﻭﻝ NumB
ﺗﻮﺟﻪ :ﺳﻮﺭ ﻫﻤﮕﺎﻧﻲ FORALLﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﻪ ﻛﻤﻚ ﺳﻮﺭ ﻭﺟﻮﺩﻱ EXISTSﺑﻴﺎﻥ ﻧﻤﻮﺩ . )FORALL X(f) =NOT EXISTS X (NOT f
: ٢-٦-٥ﺍﺳﺘﻔﺎﺩﻩ ﺩﺭ ﺣﺴﺎﺏ ﻣﺤﻤﻮﻻﺕ ﺩﺭ ﻓﺮﻣﻮﻟﻪ ﻛﺮﺩﻥ ﭘﺮﺱ ﻭ ﺟﻮ ﻫﺎ : ﺳﻮﺍﻝ : ١ﺷﻤﺎﺭﻩ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﺳﺎﻛﻦ C2ﺑﺎ ﻭﺿﻌﻴﺖ ﺑﻴﺸﺘﺮ ﺍﺯ ٢٠ﺭﺍ ﺑﻴﺎﺑﻴﺪ . Sx.s# WHERE sx.city = `c2` AND sx.STATUS > 20
ﺳﻮﺍﻝ : ٢ﺷﻤﺎﺭﻩ ﺟﻔﺖ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﺳﺎﻛﻦ ﻳﻚ ﺷﻬﺮ ﺭﺍ ﺑﺪﻫﻴﺪ . WHERE sx.city =sy.city AND sx.s# < sy.s#
Sx.s# , Sy. s#
ﺳﻮﺍﻝ : ٣ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﻗﻄﻌﻪ p2ﺭﺍ ﺑﺪﻫﻴﺪ . )`Sx.SNAME WHERE EXISTS Spx (Spx.s# = Sx. s# AND Spx.p# = ` p2
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥٧ /
ﺳﻮﺍﻝ : ٤ﻧﺎﻡ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﺭﺍ ﺑﺪﻫﻴﺪ ﻛﻪ ﺩﺳﺖ ﻛﻢ ﻳﻚ ﻗﻄﻌﻪ ﻗﺮﻣﺰ ﺭﺍ ﺗﻬﻴﻪ ﻣﻲ ﻛﻨﻨﺪ . SX.SNAME WHERE EXISTS SPX (SX.S# =SPX.S# AND EXISTS PX (PX.P# =SPX.P# AND ))`PX.COLOR = `RED
ﺳﻮﺍﻝ : ٥ﻧﺎﻡ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﺭﺍ ﻣﺸﺨﺺ ﻛﻨﻴﺪ ﻛﻪ ﺣﺪﺍﻗﻞ ﻳﻚ ﻗﻄﻌﻪ ﺍﺯ ﻗﻄﻌﺎﺕ ﻋﺮﺿﻪ ﺷﺪﻩ ﺗﻮﺳﻂ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ S2ﺭﺍ ﺗﺎﻣﻴﻦ SX.SNAME
ﻣﻲ ﻛﻨﻨﺪ .
WHERE EXISTS Spx ( EXISTS SPY ( SX.S# =SPX.S# AND SPX.P# =SPY.P# AND SPY.S# )) `=`S2
ﺳﻮﺍﻝ : ٦ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﺭﺍ ﺑﺪﻫﻴﺪ ﻛﻪ ﺗﻤﺎﻡ ﻗﻄﻌﺎﺕ ﺭﺍ ﺗﻬﻴﻪ ﻣﻲ ﻛﻨﻨﺪ . PX (EXISTS SPX (SPX.S# =SX.S# AND SPX.P# )) =PX.P# ﺟﻮﺍﺏ ﭘﺮﺱ ﻭ ﺟﻮ ﺑﺪﻭﻥ FORALL
FORALL
WHERE
SX.SNAME
Sx.SNAME WHERE NOT EXISTS PX (NOT EXISTS SPX (SPX.S# = SX.S# AND SPX )) .P# = PX.P#
ﺳﻮﺍﻝ : ٧ﺷﻤﺎﺭﻩ ﻭ ﻭﺯﻥ ﻗﻄﻌﺎﺗﻲ ﺭﺍ ﺗﻬﻴﻪ ﻛﻨﻴﺪ ﻛﻪ ﻭﺯﻥ ﻫﺮ ﻗﻄﻌﻪ ﺑﺮ ﺣﺴﺐ ﮔﺮﻡ ﺑﻴﺸﺘﺮ ﺍﺯ ١٠٠٠ﺑﺎﺷﺪ . )(px.p# , px.WEIGHT * 454 AS GWMT )WHERE (px.WEIGHT * 454> 1000
ﺳﻮﺍﻝ : ٨ﺷﻬﺮ ﻗﻄﻌﺎﺗﻲ ﺭﺍ ﻣﺸﺨﺺ ﻛﻨﻴﺪ ﻛﻪ ﺑﻴﺶ ﺍﺯ ﺳﻪ ﻗﻄﻌﻪ ﺁﺑﻲ ﺩﺭ ﺁﻥ ﺍﻧﺒﺎﺭ ﺷﺪﻩ ﺑﺎﺷﺪ . Px.city WHERE COUNT (PY WHERE PY.city =px.city AND py.color=`BLUE` )>3
•
ﻧﻜﺎﺕ ﻣﻬﻢ ﺩﺭ ﺧﺼﻮﺹ ﺁﻧﺎﻟﻴﺰ ﺭﺍﺑﻄﻪ ﺍﻱ : -١ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﻧﺎﺭﻭﺷﻤﻨﺪ ﺍﺳﺖ ﻭ ﺗﻔﺎﻭﺕ ﺍﺻﻠﻲ ﺍﺵ ﺑﺎ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﻫﻤﻴﻦ ﺍﺳﺖ . -٢ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﻭ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﻣﻌﺎﺩﻟﻨﺪ . -٣ﻫﺮ ﺩﻭ ﺍﻛﻤﺎﻝ ﺭﺍﺑﻄﻪ ﺍﻱ ﺩﺍﺭﻧﺪ ﻳﻌﻨﻲ ﻫﺮ ﺭﺍﺑﻄﻪ ﻣﺘﺼﻮﺭ ﺍﺯ ﺭﺍﺑﻄﻪ ﻫﺎﻱ ﻣﻤﻜﻦ ﻗﺎﺑﻞ ﺍﺷﺘﻘﺎﻕ ﺑﻪ ﻛﻤﻚ ﻫﺮ ﻳﻚ ﺍﺯ ﺍﻳﻦ ﺩﻭ ﺍﻣﻜﺎﻥ ﻣﻲ ﺑﺎﺷﺪ . -٤ﺯﺑﺎﻧﻬﺎﻱ ﻣﺒﺘﻨﻲ ﺑﺮ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﺑﻪ ﺩﻟﻴﻞ ﻧﺎﺭﻭﺷﻤﻨﺪ ﺑﻮﺩﻥ ﺳﻄﺤﺸﺎﻥ ﺑﺎﻻﺗﺮ ﺍﺳﺖ . -٥ﻫﺮ ﭘﺮﺱ ﻭ ﺟﻮ ﻣﺒﺘﻨﻲ ﺑﺮ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍﺑﻄﻪ ﺍﻱ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﻔﺮﻡ } ) {t /p (tﻧﻴﺰ ﻧﻤﺎﻳﺶ ﺩﺍﺩ . ﺑﻄﻮﺭﻳﻜﻪ : ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﺗﻤﺎﻡ ﺗﺎﭘﻠﻬﺎﻱ tﺍﺳﺖ ﻛﻪ ﺷﺮﻁ pﺑﺮﺍﻱ ﺁﻥ ﺩﺭﺳﺖ ﺍﺳﺖ . tﻳﻚ ﻣﺘﻐﻴﺮ ﺗﺎﭘﻠﻲ ﺍﺳﺖ ﻭ ] t[Aﻧﺸﺎﻥ ﺩﻫﻨﺪﻩ ﻣﻘﺪﺍﺭ ﺗﺎﭘﻞ tﺭﻭﻱ ﺻﻔﺖ ﺧﺎ ﺻﻪ Aﻣﻲ ﺑﺎﺷﺪ . t∈ r -ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﺎﺳﺖ ﻛﻪ ﺗﺎﭘﻞ tﺩﺭ ﺭﺍﺑﻄﻪ rﺍﺳﺖ .
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥٨ /
pﻳﻚ ﻓﺮﻣﻮﻝ ﺍﺳﺖ ﻛﻪ ﺷﺮﻁ ﻣﺤﺎﺳﺒﺎﺕ ﻣﻲ ﺑﺎﺷﺪ .ﻣﺜﺎﻝ :ﻣﺸﺨﺼﺎﺕ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﺑﺎ ﻭﺿﻌﻴﺖ ﺑﻴﺶ ﺍﺯ ١٠ﺭﺍ ﺑﺪﻫﻴﺪ . } {t / t
ﺗﻤﺮﻳﻨﺎﺕ ﺍﻳﻦ ﻓﺼﻞ :
t[ status ] > 10
^
S
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٥٩ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٦٠ /
ﻓﺼﻞ ﭘﻨﺠﻢ : ﺁﺷﻨﺎﻳﻲ ﺑﺎ ﺯﺑﺎﻥ
SQL
-١-٥ﻣﻘﺪﻣﻪ : SQLﻳـﻚ ﺯﺑـﺎﻥ ﺍﺳﺘﺎﻧﺪﺍﺭﺩ ﺑﺮﺍﻱ ﻛﺎﺭ ﺭﻭﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺭﺍﺑﻄﻪ ﺍﻱ ﺍﺳﺖ ﻭ ﻫﺮ ﻣﺤﺼﻮﻝ ﻧﺮﻡ ﺍﻓﺰﺍﺭﻱ ﻣﻮﺟﻮﺩ ﺩﺭ ﺑﺎﺯﺍﺭ ﺍﺯ ﺁﻥ ﭘﺸـﺘﻴﺒﺎﻧﻲ ﻣـﻲ ﻛـﻨﺪ SQL .ﺍﻭﻟـﻴﻦ ﺑـﺎﺭ ﺩﺭ ﺍﻭﺍﻳـﻞ ﺩﻫﻪ ١٩٦٠ﺩﺭ ﺑﺨﺶ ﺗﺤﻘﻴﻘﺎﺕ IBMﻃﺮﺍﺣﻲ ﺷﺪ ﻭ ﺑﺮﺍﻱ ﺍﻭﻟﻴﻦ ﺑﺎﺭ ﺩﺭ ﻣﻘـﻴﺎﺱ ﺑـﺰﺭﮒ ﺭﻭﻱ ﻛﺎﻣﭙﻴﻮﺗـﺮﻫﺎﻱ IBMﺑـﻪ ﻧـﺎﻡ ﺳﻴﺴﺘﻢ Rﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﺷﺪ ﻭ ﺳﭙﺲ ﺑﺮ ﺭﻭﻱ ﺍﻧﻮﺍﻉ ﻣﺘﻌﺪﺩﻱ ﺍﺯ ﻣﺤﺼﻮﻻﺕ ﺗﺠﺎﺭﻱ ﺩﺭ IBMﻭ ﻣﺤﺼﻮﻻﺕ ﺩﻳﮕﺮ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﺷﺪ .ﺩﺭ ﺍﻳﻦ ﻓﺼﻞ ﺯﺑﺎﻥ SQLﻣﻮﺭﺩ ﺑﺤﺚ SQL 92ﻳﺎ SQL 2ﺍﺳﺖ ﻛﻪ ﻧﺎﻡ ﺭﺳﻤﻲ ﺁﻥ ) International Standard Database Language SQL (1992ﻣﻲ ﺑﺎﺷﺪ . SQLﺑﺠـﺎﻱ ﺩﻭ ﺍﺻـﻄﻼﺡ ﺭﺍﺑﻄـﻪ ﻭ ﻣﺘﻐﻴـﺮ ﺭﺍﺑﻄـﻪ ﺍﻱ ﺍﺯ ﺍﺻﻄﻼﺡ ﺟﺪﻭﻝ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﻛﻨﺪ S QL .ﺗﺎ ﺗﺒﺪﻳﻞ ﺷﺪﻥ ﺑﻪ ﻳﻚ ﺯﺑـﺎﻥ ﺭﺍﺑﻄـﻪ ﺍﻱ ﻛﺎﻣـﻞ ﻓﺎﺻﻠﻪ ﺯﻳﺎﺩﻱ ﺩﺍﺭﺩ .ﺑﺎ ﺍﻳﻦ ﻫﻤﻪ SQLﺍﺳﺘﺎﻧﺪﺍﺭﺩ ﺍﺳﺖ ﻭ ﺗﻘﺮﻳﺒﺎ ﺗﻮﺳﻂ ﻫﺮ ﻣﺤﺼﻮﻝ ﻧﺮﻡ ﺍﻓﺰﺍﺭﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺕ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲ ﺷﻮﺩ ﻭ ﻫﺮ ﻓﺮﺩ ﺣﺮﻓﻪ ﺍﻱ ﻧﻴﺎﺯﻣﻨﺪ ﺁﻥ ﺍﺳﺖ . -٢-٥ﺍﺣﻜﺎﻡ ﺗﻌﺮﻳﻒ ﺩﺍﺩﻩ ﻫﺎ ) ( DDLﺩﺭ SQL
ﺍﻳﻦ ﺍﺣﻜﺎﻡ ﺷﺎﻣﻞ ﺗﻌﺮﻳﻒ ﺟﺪﺍﻭﻝ ،ﺷﺎﺧﺺ ،ﺣﺬﻑ ﺟﺪﺍﻭﻝ ،ﺷﺎﺧﺺ ﻭ ﺗﻐﻴﻴﺮﺍﺕ ﻣﻲ ﺑﺎﺷﺪ . ﺍﻧﻮﺍﻉ ﺩﺍﻣﻨﻪ ﻫﺎ ﺩﺭ SQLﺑﻪ ﺷﺮﺡ ﺯﻳﺮ ﺍﺳﺖ : •
) Char (nﻳﻚ ﺭﺷﺘﻪ ﻛﺎﺭﺍﻛﺘﺮﻱ ﺑﺎ ﻃﻮﻝ ﺛﺎﺑﺖ ﻛﻪ ﺗﻮﺳﻂ ﻛﺎﺭﺑﺮ nﻣﺸﺨﺺ ﻣﻲ ﺷﻮﺩ .
•
) Varchar (nﺭﺷﺘﻪ ﻫﺎﻱ ﺑﺎ ﻃﻮﻝ ﻣﺘﻐﻴﺮ ﺣﺪﺍﻛﺜﺮ ﺑﻪ ﻃﻮﻝ n
ﺩﺭ Oracleﻧﻮﻉ Varchar2ﺑﺮﺍﻱ ﺭﺷﺘﻪ ﻫﺎﻱ ﺑﺎ ﻃﻮﻝ ﻣﺘﻐﻴﺮ ﻭ ﺣﺪﺍﻛﺜﺮ ٢٠٠٠ﻛﺎﺭﺍﺗﺮ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﺳﺖ. •
Intﺍﻋﺪﺍﺩ ﺻﺤﻴﺢ
•
Small intﺍﻋﺪﺍﺩ ﻛﻮﭼﻚ
•
) Numeric (p,dﺍﻋﺪﺍﺩ ﺍﻋﺸﺎﺭﻱ pﺣﺪﺍﻛﺜﺮﺗﻌﺪﺍﺩ ﺭﻗﻤﻬﺎ ﻭ dﺗﻌﺪﺍﺩ ﺭﻗﻢ ﻫﺎﻱ ﺍﻋﺸﺎﺭﻱ .
• •
Double , real ) Float(nﺍﻋﺪﺍﺩ ﺍﻋﺸﺎﺭﻱ ﺑﺎ ﺩﻗﺖ ﺣﺪﺍﻗﻞ nﺭﻗﻢ .
•
Not nullﻣﻲ ﺗﻮﺍﻧﺪ ﺩﺭ ﺍﻧﺘﻬﺎﻱ ﺗﻌﺮﻳﻒ ﻓﻴﻠﺪ ﺑﻪ ﻛﺎﺭ ﺭﻭﺩ ﺑﻄﻮﺭﻳﻜﻪ ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﻮﺭﺩ ﻧﻈﺮ ﻧﻤﻲ ﺗﻮﺍﻧﺪ ﻣﻘﺪﺍﺭ null
ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ . •
Dateﺗﺎﺭﻳﺦ ﺷﺎﻣﻞ ٤ﺭﻗﻢ ﺑﺮﺍﻱ ﺳﺎﻝ ،ﻣﺎﻩ ﻭ ﺭﻭﺯ :
•
Timeﺑﺮﺍﻱ ﻧﻤﺎﻳﺶ ﺳﺎﻋﺖ .
: 2001 – 7 – 27ﻣﺜﺎﻝ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٦١ /
‘ ‘09 : 00 : 30 ‘ ‘09 : 00 : 30 : 75
•
time time
Timestampﺷﺎﻣﻞ ﺗﺎﺭﻳﺦ ﻭ ﺯﻣﺎﻥ
Timestamp :’ 2001 – 1 – 27 09 : ’30: 27 . 75
•
Intervalﺩﻭﺭﻩ ﻫﺎﻱ ﺯﻣﺎﻧﻲ ‘1’ day
ﻣﺜﺎﻝ :
interval
ﻣﻘﺎﺩﻳﺮ Intervalﻣﻲ ﺗﻮﺍﻧﻨﺪ ﺑﻪ ﻣﻘﺎﺩﻳﺮ date / time / timestampﺍﺿﺎﻓﻪ ﺷﻮﻧﺪ . •
ﺍﻣﻜﺎﻥ ﺍﺳﺘﺨﺮﺍﺝ ﻓﻴﻠﺪ ﺍﺯ ﺩﺍﺩﻩ ﻫﺎﻱ ﺗﺎﺭﻳﺦ ﻭ ﺯﻣﺎﻥ ﻭﺟﻮﺩ ﺩﺍﺭﺩ . )extract (year from r . time 1
•
ﺍﻣﻜﺎﻥ ﺗﺒﺪﻳﻞ ﺭﺷﺘﻪ ﺑﻪ ﺗﺎﺭﻳﺦ ﻭ ﺯﻣﺎﻥ ﻧﻴﺰ ﻭﺟﻮﺩ ﺩﺍﺭﺩ . date
•
as
> < string – valued expression
cast
ﺩﺭ SQL 92ﺍﻣﻜﺎﻥ ﺗﻌﺮﻳﻒ ﺩﺍﻣﻨﻪ ﻧﻴﺰ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﺑﺮﺍﻱ ﺍﻳﻨﻜﺎﺭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺑﺎﻳﺴﺘﻲ ﻧﻮﺷﺘﻪ ﺷﻮﺩ : ] [ not null
ﻧﻮﻉ
Create domain
ﻧﺎﻡ ﺟﺪﻳﺪ
)create domain Dollars numeric(12, 2
)create domain AccountType char(10 constraint account-type-test ))’check (value in (‘Checking’, ‘Saving : ١– ٢-٥ﺩﺳﺘﻮﺭﺍﺕ ﺗﻌﺮﻳﻒ ﺟﺪﺍﻭﻝ )) r ( A1 D1 , A2 D2 ,... An Dn ..., ( integrity – constraint k * rﻧﺎﻡ ﺭﺍﺑﻄﻪ ﺍﺳﺖ .
table
Create
* ﻫﺮ Aiﻧﺎﻡ ﺻﻔﺖ ﺧﺎﺻﻪ ﺩﺭ ﺷﻤﺎﻱ rﺍﺳﺖ . * Diﻧﻮﻉ ﺩﺍﺩﻩ ﺍﻱ ﺩﺭ ﺩﺍﻣﻨﻪ ﺻﻔﺖ ﺧﺎﺻﻪ Aiﺍﺳﺖ .ﻣﺜﺎﻝ : not null ,
)char (15 char (30) , ) integer
Create table branch ( branch – name branch –city assest
ﻣﺤﺪﻭﺩﻳﺖ ﻫﺎﻱ ﺟﺎﻣﻌﻴﺖ ﺩﺭ ﺗﻌﺮﻳﻒ ﺟﺪﺍﻭﻝ : not null ) Primary key ( A1 ,... An
ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﻧﺘﺨﺎﺏ not nullﺭﺍ ﺑﻄﻮﺭ ﺧﻮﺩﻛﺎﺭ ﺑﺮﺍﻱ ﻓﻴﻠﺪ ﺩﺭ ﻧﻈﺮ ﺧﻮﺍﻫﺪ ﮔﺮﻓﺖ . •
) Check ( Pﻛﻪ Pﺷﺮﻁ ﺍﺳﺖ ﺑﺮﺍﻱ ﻛﻨﺘﺮﻝ ﻣﻘﺪﺍﺭ ﻓﻴﻠﺪﻫﺎ .
• •
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٦٢ /
FOREGIN Key ( A1 ... ) References
•
ﻣﺜﺎﻝ: Create table branch (branch – neme char (15) , Branch – city char (30) , Assests Integer , Primary key ( branch – name ) , )) Check ( assests > = 0 Create table S ( SNO char (5) , sname char (20) , status Numeric (5) , city char (15) , ; )) Primary key ( SNO Create table P ( PNO char (6) , color char (20) , weight Numeric (5,1) , city char (15) , Primary key ( PNO )) , Create table SP ( SNO char (5) , PNO char (6) , Qty Numeric (9) , Primary key ( SNO , PNO ) , Foreign key ( PNO ) References P, Foreign key ( SNO ) References ;S : ٢ – ٢ – ٦ﺣﺬﻑ ﻭ ﺗﻐﻴﻴﺮ ﺟﺪﺍﻭﻝ D rop and Alter tables
ﻋﺒﺎﺭﺕ Drop tableﺗﻤﺎﻡ ﺍﻃﻼﻋﺎﺕ ﻳﻚ ﺟﺪﻭﻝ ﻭ ﺧﻮﺩ ﺟﺪﻭﻝ ﺭﺍ ﺍﺯ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺣﺬﻑ ﻣﻲ ﻛﻨﺪ ﻭ ﻋﺒﺎﺭﺕ
a lter
tableﺑﺮﺍﻱ ﺍﺿﺎﻓﻪ ﻛﺮﺩﻥ ﻭ ﻳﺎ ﺣﺬﻑ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺑﻪ ﺟﺪﻭﻝ ﻣﻮﺟﻮﺩ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ .ﺑﺎ ﺍﺿﺎﻓﻪ ﻛﺮﺩﻥ ﺻﻔﺖ ﺧﺎﺻﻪ ﺟﺪﻳﺪ ﺗﻤﺎﻣﻲ ﺗﺎﭘﻠﻬﺎﻱ ﺭﺍﺑﻄﻪ ﻣﻘﺪﺍﺭ nullﺭﺍ ﺑﺮﺍﻱ ﺁﻥ ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﻲ ﮔﻴﺮﻧﺪ .ﻓﺮﻡ ﻛﻠﻲ ﺩﺳﺘﻮﺭ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ : alter table r add A D Aﺍﺳﻢ ﺻﻔﺖ ﻓﺎﺻﻠﻪ ﺟﺪﻳﺪ ﻭ Dﺩﺍﻣﻨﻪ ﺁﻥ ﻣﻲ ﺑﺎﺷﺪ .
Alter table r drop Aﺻﻔﺖ ﺧﺎﺻﻪ ﺭﺍ ﺍﺯ ﺟﺪﻭﻝ ﺣﺬﻑ ﻣﻲ ﻛﻨﺪ . •
ﺍﻳﻦ ﺩﺳﺘﻮﺭ ) ﺩﺭ ﻋﻤﻞ ﺣﺬﻑ ﺻﻔﺖ ﺧﺎﺻﻪ ( ﺗﻮﺳﻂ ﺑﻴﺸﺘﺮ ﺑﺎﻧﻜﻬﺎﻱ ﺍﻃﻼﻋﺎﺗﻲ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻧﻤﻲ ﺷﻮﺩ .
NewType
•
Modify A
r
Alter table
ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﺮﺍﻱ ﺗﻐﻴﻴﺮ ﻧﻮﻉ ﻳﻚ ﺻﻔﺖ ﺧﺎﺻﻪ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ.
: ٣ – ٦ﺍﺣﻜﺎﻡ ﻛﺎﺭ ﺑﺎ ﺩﺍﺩﻩ ﻫﺎ ﺩﺭ SQL
ﺩﺭ SQLﭼﻬﺎﺭ ﺩﺳﺘﻮﺭ ﺍﺳﺎﺳﻲ ﺑﺮﺍﻱ ﻛﺎﺭ ﺑﺎ ﺩﺍﺩﻩ ﻫﺎ ﻭﺟﻮﺩ ﺩﺍﺭﺩ : • •
SELECT UPDATE
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ •
•
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٦٣ /
DELETE INSERT
: ١ – ٣ – ٦ﺍﺣﻜﺎﻡ ﺑﺎﺯﻳﺎﺑﻲ ﺩﺍﺩﻩ ﻫﺎ ﺩﺭ SQLﺗـﻨﻬﺎ ﻳـﻚ ﺣﻜـﻢ ﻭﺍﺣـﺪ ﺑﺮﺍﻱ ﺑﺎﺯﻳﺎﺑﻲ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻭ ﺁﻥ ﺩﺳﺘﻮﺭ SELECTﺍﺳﺖ .ﺷﻜﻞ ﻛﻠﻲ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﻪ ﻓﺮﻡ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ : A1 , A2 ,... An r1 , r2 ,...rm
]P ] columns ]P BY A1 ... Ak
SELECT FROM [where [ Group by [ Having [ ORDER
Aiﻫﺎ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻭ Riﻫﺎ ﺭﺍﺑﻄﻪ ﻫﺎ ﻭ Pﺷﺮﻁ ﺍﺳﺖ . ﺩﺭ ﺻﻮﺭﺕ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺳﻪ ﻗﺴﻤﺖ ﺍﻭﻝ ﭘﺮﺱ ﻭ ﺟﻮ ﻣﻌﺎﺩﻝ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ : )
) ( r1 × r2 ,...rn
π A1 , A2 ,... An (σ P
ﻋـﺒﺎﺭﺕ ﺟﻠـﻮﻱ ﺩﺳـﺘﻮﺭ selectﻣﻌـﺎﺩﻝ ﻋﻤـﻞ ﭘـﺮﺗﻮ ﺩﺭ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﺍﺳﺖ ﻭ ﻋﺒﺎﺭﺕ ﺟﻠﻮﻱ whereﻣﻌﺎﺩﻝ ﻫﻤﺎﻥ ﺗﺤﺪﻳﺪ ﻳﺎ ﮔﺰﻳﻨﺶ ﺍﺳﺖ .ﺑﺮﺧﻲ ﻧﻜﺎﺕ ﻣﻬﻢ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ : •
ﻋﺒﺎﺭﺕ ) * ( ﺩﺭ ﺟﻠﻮﻱ selectﻣﻌﺎﺩﻝ ﺗﻤﺎﻡ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺭﺍﺑﻄﻪ ﺍﺳﺖ .
•
ﺩﺭ SQLﻣﻤﻜـﻦ ﺍﺳـﺖ ﻧﺘـﻴﺠﻪ ﭘـﺮﺱ ﻭ ﺟﻮ ﺣﺎﻭﻱ ﺩﺍﺩﻩ ﻫﺎﻱ ﺗﻜﺮﺍﺭﻱ ﺑﺎﺷﺪ ﻟﺬﺍ ﺑﺮﺍﻱ ﺣﺬﻑ ﻣﻘﺎﺩﻳﺮ ﺗﻜﺮﺍﺭﻱ ﻛﻠﻤﻪ distinctﺭﺍ ﺑﺎﻳﺴﺘﻲ ﺑﻌﺪ ﺍﺯ selectﺑﻜﺎﺭ ﺑﺮﺩ . A1 ,...
distinct ri
•
ﺩﺭ ﺻﻮﺭﺕ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻛﻠﻤﻪ allﺑﻌﺪ ﺍﺯ selectﺣﺬﻑ ﻣﻘﺎﺩﻳﺮ ﺗﻜﺮﺍﺭﻱ ﺍﻧﺠﺎﻡ ﻧﺨﻮﺍﻫﺪ ﮔﺮﻓﺖ .
•
ﺩﺭ ﺟﻠﻮﻱ selectﻣﻲ ﺗﻮﺍﻥ ﺍﺯ ﻋﺒﺎﺭﺍﺕ ﺭﻳﺎﺿﻲ ﺷﺎﻣﻞ ﻋﻤﻠﮕﺮﻫﺎﻱ +ﻭ – ﻭ * ﻭ /ﻧﻴﺰ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ .
•
S# , P# , Qty * 5 from SP ﺩﺭ ﺟﻠﻮﻱ ﻋﺒﺎﺭﺕ whereﺷﺮﻁ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ ﻛﻪ ﻣﻲ ﺗﻮﺍﻧﺪ ﺑﺎ or ، andﻭ notﻧﻴﺰ ﺗﺮﻛﻴﺐ ﺷﻮﺩ .
•
ﺩﺭ ﺷﺮﻁ ﺟﻠﻮﻱ whereﺍﺯ ﻋﺒﺎﺭﺕ betweenﻧﻴﺰ ﻣﻲ ﺗﻮﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ . 5
and
2
between
SP Qty
From Where
*
Select From
Select
Select
•
ﺍﮔﺮ ﭼﻨﺪ ﺟﺪﻭﻝ ﺟﻠﻮﻱ ﻋﺒﺎﺭﺕ f romﺁﻭﺭﺩﻩ ﺷﻮﺩ ﺑﻪ ﻣﻨﺰﻟﻪ ﺣﺎﺻﻠﻀﺮﺏ ﺩﻛﺎﺭﺗﻲ ﺭﺍﺑﻄﻪ ﻫﺎﺳﺖ .
•
ﺩﺭ SQLﺍﻣﻜـﺎﻥ ﺩﻭﺑـﺎﺭﻩ ﻧﺎﻣـﻴﺪﻥ ﺭﺍﺑﻄﻪ ﻭ ﻳﺎ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻋﺒﺎﺭﺕ asﻭﺟﻮﺩ ﺩﺍﺭﺩ .ﻗﺎﻟﺐ ﻛﻠﻲ ﺩﺳﺘﻮﺭ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ :
•
as new name new name ﻣﺘﻐﻴﺮﻫﺎﻱ ﺗﺎﭘﻠﻲ ﺩﺭ ﻋﺒﺎﺭﺕ ﺑﻌﺪ ﺍﺯ Fromﺍﺯ ﻃﺮﻳﻖ ﻛﻠﻤﻪ asﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﻧﺪ .
Oldname Oldnameﻭ ﻳﺎ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٦٤ / *
Tsp
•
as
SP
as TS , TS.S# = Tsp.S#
Select
From S Where
ﻋـﺒﺎﺭﺕ ORDER BYﺑـﻪ ﻣﻌﻨـﻲ ﺁﻥ ﺍﺳـﺖ ﻛﻪ ﻛﺎﺭﺑﺮ ﻣﻲ ﺧﻮﺍﻫﺪ ﺟﻮﺍﺏ ﺭﺍ ﺑﻄﻮﺭ ﻣﻨﻈﻢ ﺭﻭﻱ ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﻮﺭﺩ ﻧﻈﺮﺵ ﺑﺒﻴﻨﺪ .ﺩﺭ ﺻﻮﺭﺗﻲ ﻛﻪ ﺩﺭ ﺍﻧﺘﻬﺎ ﻋﺒﺎﺭﺕ d escﺑﻴﺎﻳﺪ ﺗﺮﺗﻴﺐ ﻧﺰﻭﻟﻲ ﻭ ﺍﮔﺮ ascﺑﻴﺎﻳﺪ ﺗﺮﺗﻴﺐ ﺻﻌﻮﺩﻱ ﺍﺳﺖ . desc
ﻣﺜﺎﻝ : •
by
S#
order
ﺩﺭ ﺻـﻮﺭﺕ ﺍﺳـﺘﻔﺎﺩﻩ ﺍﺯ ﭼﻨﺪ ﺟﺪﻭﻝ ﺩﺭ ﺟﻠﻮﻱ ﻋﺒﺎﺭﺕ fromﻭ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺷﺮﻁ ﺧﺎﺹ ﻣﻲ ﺗﻮﺍﻥ ﻋﻤﻞ ﭘﻴﻮﻧﺪ ﺭﺍ ﻧﻴﺰ ﺍﻧﺠﺎﻡ ﺩﺍﺩ .
ﻣﺜﺎﻝ :ﻣﺸﺨﺼﺎﺕ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﻭ ﻗﻄﻌﺎﺕ ﺩﺭ ﻳﻚ ﺷﻬﺮ ﺭﺍ ﺑﺪﻫﻴﺪ . S,P
from
* Select S . * , P . S . city = P . city
•
ﻣﻲ ﺗﻮﺍﻥ ﻋﻤﻞ ﭘﻴﻮﻧﺪ ﺭﺍ ﺑﺎ ﺷﺮﻃﻬﺎﻱ ﺍﺿﺎﻓﻲ ﻧﻴﺰ ﺍﻧﺠﺎﻡ ﺩﺍﺩ . S . Status > 10
•
Where
Select S . * , P . * from S , P Where S . city = P . city AND
ﻧﻜﺘﻪ :ﻣﻲ ﺗﻮﺍﻥ ﻳﻚ ﺟﺪﻭﻝ ﺭﺍ ﺑﺎ ﺧﻮﺩﺵ ﻧﻴﺰ ﺗﺮﻛﻴﺐ ) ﭘﻴﻮﻧﺪ ( ﻛﺮﺩ .
ﻣﺜﺎﻝ :ﺷﻤﺎﺭﻩ ﺟﻔﺖ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﺳﺎﻛﻦ ﻳﻚ ﺷﻬﺮ ﺭﺍ ﺑﺪﻫﻴﺪ . Select First . S # , Second . S # First , S Second First . city = Second . city AND First . S # < Second . S #
•
S
From Where
ﺩﺭ ﺯﺑـﺎﻥ SQLﺍﻣﻜـﺎﻥ ﻣﻘﺎﻳﺴـﻪ ﺭﺷـﺘﻪ ﻫـﺎ ﻭ ﺗﻄﺎﺑـﻖ ﺁﻧﻬﺎ ﻧﻴﺰ ﻭﺟﻮﺩ ﺩﺍﺭﺩ .ﺍﻳﻦ ﺍﻣﻜﺎﻥ ﺗﻮﺳﻂ ﺩﻭ ﻋﻤﻠﮕﺮ %ﻭ – ﻣﻴﺴﺮ ﺍﺳـﺖ :ﻋﻼﻣـﺖ ﺩﺭﺻﺪ %ﺑﺮﺍﻱ ﺗﻄﺎﺑﻖ ﻫﺮ ﺯﻳﺮ ﺭﺷﺘﻪ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ ﻭ ﻋﻼﻣﺖ u nderlineـ ﺑﺮﺍﻱ ﺗﻄﺎﺑﻖ ﻳﻚ ﻛﺎﺭﺍﻛﺘﺮ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ .
… Select P# , From P Where Pname like
“” w %
w %ﻳﻌﻨﻲ ﺁﻧﻬﺎﻳﻲ ﻛﻪ ﺑﺎ wﺁﻏﺎﺯ ﺷﺪﻩ ﺍﻧﺪ .ﻭ ” “% Wﻳﻌﻨﻲ ﺁﻧﻬﺎﻳﻲ ﻛﻪ ﺑﻪ wﺧﺘﻢ ﺷﺪﻩ ﺍﻧﺪ . S ‘‘% C ---
like
city
* From
Select
Where
ﺷﻬﺮ ﺣﺪﺍﻗﻞ ﭼﻬﺎﺭ ﺣﺮﻑ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﻭ ﭼﻬﺎﺭﻣﻴﻦ ﺣﺮﻑ ﺍﺯ ﺁﺧﺮ ﺑﺎ Cﺁﻏﺎﺯﺷﻮﺩ . ’_ _SELECT SNAME FROM S WHERE SNAME LIKE ‘C
ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﻛﻪ ﺩﻗﻴﻘﺎ ﺳﻪ ﺣﺮﻑ ﺩﺍﺷﺘﻪ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ.ﺩﺭ ﺻﻮﺭﺗﻲ ﻛﻪ ﻋﺪﻡ ﺗﻄﺎﺑﻖ ﺑﺨﻮﺍﻫﺪ ﭼﻚ ﺷﻮﺩ ﻣﻲ ﺗﻮﺍﻥ ﺑﻪ ﺟﺎﻱ L I K Eﺍﺯ NOT LIKEﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ . •
ﺍﻟﺤﺎﻕ ﺭﺷﺘﻪ ﻫﺎ ﺩﺭ SQLﺗﻮﺳﻂ ﻋﻤﻠﮕﺮ || ﺍﻧﺠﺎﻡ ﻣﻲ ﮔﻴﺮﺩ .
٦٥ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
ﺑــﺮﺍﻱ ﺍﺟـﺘﻤﺎﻉ ﻭ ﻋــﺒﺎﺭﺕUNION ﻋـﺒﺎﺭﺕ. ﻭﺟـﻮﺩ ﺩﺍﺭﻧــﺪSQL ﻋﻤﻠـﻴﺎﺕ ﺍﺟـﺘﻤﺎﻉ ﻭ ﺍﺷــﺘﺮﺍﻙ ﻭ ﻧﻘـﻴﺾ ﻧﻴــﺰ ﺩﺭ
•
. ﺑﺮﺍﻱ ﻋﻤﻠﮕﺮ ﻣﻨﻬﺎ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﻧﺪEXCEPT ﺑﺮﺍﻱ ﺍﺷﺘﺮﺍﻙ ﻭ ﻋﺒﺎﺭﺕINTERSECT ﺁﻧﻬﺎ ﺭﺍ ﺗﻬﻴﻪ ﻛﺮﺩﻩS2 ﭘﻮﻧﺪ ﺑﺎﺷﺪ ﻭ ﻳﺎ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ١٦ ﺷـﻤﺎﺭﻩ ﻗﻄﻌﺎﺗـﻲ ﺭﺍ ﻣﺸـﺨﺺ ﻛﻨـﻴﺪ ﻛﻪ ﻳﺎ ﻭﺯﻥ ﺁﻧﻬﺎ ﺑﻴﺶ ﺍﺯ: ﻣـﺜﺎﻝ . ﺑﺎﺷﺪ SELECT P.P# FROM P WHERE WEIGHT > 16.0 UNION SELECT SP.P# FROM SP WHERE SP.S# = ‘S2’ ﺍﻣﺎ. ﺣﺬﻑ ﻣﻲ ﺷﻮﻧﺪEXCEPT ﻭ ﻳﺎINTERSECT ، U NION ﺳﻄﺮﻫﺎﻱ ﺗﻜﺮﺍﺭﻱ ﺍﺿﺎﻓﻲ ﻫﻤﻴﺸﻪ ﺍﺯ ﻧﺘﻴﺠﻪ ﻳﻚ
. ﻓﺮﺍﻫﻢ ﺷﺪﻩ ﻛﻪ ﺩﺭ ﺁﻥ ﺳﻄﺮﻫﺎﻱ ﺗﻜﺮﺍﺭﻱ ﺑﺎﻗﻲ ﻣﻲ ﻣﺎﻧﻨﺪEXCEPT ALL ، UNION ALL ﻧﺴﺨﻪ ﻫﺎﻱSQL ﺩﺭ : ﻣﺜﺎﻝ ﻫﺎﻱ ﺍﺿﺎﻓﻲ : ﺷﻤﺎﻱ ﺑﻪ ﻛﺎﺭ ﺭﻓﺘﻪ ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ
Find the names of all branches in the loan relations, and remove duplicates select distinct branch-name from loan To find all loan number for loans made at the Perryridge branch with loan amounts greater than $1200. select loan-number from loan where branch-name = ‘Perryridge’ and amount > 1200 Find the name, loan number and loan amount of all customers having a loan at the Perryridge branch.
٦٦ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
select customer-name, borrower.loan-number, amount from borrower, loan where borrower.loan-number = loan.loan-number and branch-name = ‘Perryridge’ Find the name, loan number and loan amount of all customers; rename the column name loan-number as loan-id. select customer-name, borrower.loan-number as loan-id, amount from borrower, loan where borrower.loan-number = loan.loan-number Find the customer names and their loan numbers for all customers having a loan at some branch. select customer-name, T.loan-number, S.amount from borrower as T, loan as S where T.loan-number = S.loan-number Find the names of all branches that have greater assets than some branch located in Brooklyn. select distinct T.branch-name from branch as T, branch as S where T.assets > S.assets and S.branch-city = ‘Brooklyn’ Find the names of all customers whose street includes the substring “Main”. select customer-name from customer where customer-street like ‘%Main%’ Match the name “Main%” like ‘Main\%’ escape ‘\’ List in alphabetic order the names of all customers having a loan in Perryridge branch select distinct customer-name from borrower, loan where borrower loan-number = loan.loan-number and branch-name = ‘Perryridge’ order by customer-name Find all customers who have a loan, an account, or both: (select customer-name from depositor) union (select customer-name from borrower) Find all customers who have both a loan and an account. (select customer-name from depositor) intersect (select customer-name from borrower) Find all customers who have an account but no loan. (select customer-name from depositor) except (select customer-name from borrower)
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٦٧ /
•
ﺗﻮﺍﺑﻊ ﺟﻤﻌﻲ SQL
•
ﺩﺭ ﺯﺑـﺎﻥ SQLﺗﻮﺍﺑـﻊ ﺟﻤﻌﻲ ﻧﻴﺰ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ .ﺍﻳﻦ ﺗﻮﺍﺑﻊ ﺭﻭﻱ ﻟﻴﺴﺘﻲ ﺍﺯ ﻣﻘﺎﺩﻳﺮ ﻳﻚ ﺳﺘﻮﻥ ﻳﺎ ﺭﺍﺑﻄﻪ ﻋﻤﻞ ﻛﺮﺩﻩ ﻭ ﻳﻚ ﻣﻘﺪﺍﺭ ﺭﺍ ﺑﺮﻣﻲ ﮔﺮﺩﺍﻧﻨﺪ .ﺗﻮﺍﺑﻊ ﺟﻤﻌﻲ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ :
-
A VGﺑﺮﺍﻱ ﻣﺤﺎﺳﺒﻪ ﻣﻴﺎﻧﮕﻴﻦ
-
M AX , MINﻣﻴﻨﻴﻤﻢ ،ﻣﺎﻛﺰﻳﻤﻢ
-
S UMﻣﺠﻤﻮﻉ ﻣﻘﺎﺩﻳﺮ
-
C OUNT
ﺗﻌﺪﺍﺩ ﻣﻘﺎﺩﻳﺮ
ﻣﺜﺎﻝ : )max( status from S
ﺗﻌﺪﺍﺩ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﺭﺍ ﻣﻲ ﺩﻫﺪ
select
)*(SELECT COUNT
.
FROM S ) COUNT ( DISTINCT P# FROM SP
SELECT
ﻋﺒﺎﺭﺕ group byﺩﺭ ﺩﺳﺘﻮﺭ ﺑﺎﻋﺚ ﻣﻲ ﺷﻮﺩ ﺭﺍﺑﻄﻪ ﺩﺍﺩﻩ ﺷﺪﻩ ﺑﻌﺪ ﺍﺯ ﺟﻤﻠﻪ fromﺭﺍ ﺑﺮﺣﺴﺐ ﻣﻘﺎﺩﻳﺮ ﺳﺘﻮﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﮔﺮﻭﻩ ﺑﻨﺪﻱ ﻛﺮﺩﻩ ﻭ ﺁﻧﮕﺎﻩ ﺣﻜﻢ SELECTﺩﺭ ﺍﻳﻦ ﺟﺪﻭﻝ ﺑﺎﺯﺁﺭﺍﻳﻲ ﺷﺪﻩ ﺍﺟﺮﺍ ﻣﻲ ﺷﻮﺩ . ﻣﺜﺎﻝ : Q1 :ﺷﻤﺎﺭﻩ ﻗﻄﻌﺎﺕ ﻭ ﻛﻞ ﺗﻌﺪﺍﺩ ﺗﻬﻴﻪ ﺷﺪﻩ ﺍﺯ ﻫﺮ ﻗﻄﻌﻪ ﺭﺍ ﺑﺪﻫﻴﺪ . )SELECT P# ، SUM(QTY ; BY P#
)Sum(QTY
P#
300
P1
350
P2
FORM SP GROUP
Qty
S# P#
103 80 120 200 150
P1 P1 P1 P2 P2 P3
S1 S2 S3 S1 S2 S1
٦٨ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
ﻇﺎﻫﺮ ﺷﺪﻩ ﺑﺎﺷﻨﺪ ﺩﺭ ﻏﻴﺮGroup by ﺧﺎﺭﺝ ﺍﺯ ﺗﻮﺍﺑﻊ ﺟﻤﻌﻲ ﺑﺎﻳﺴﺘﻲ ﺩﺭ ﻟﻴﺴﺖ ﮔﺮﻭﻩselect ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺩﺭ ﺩﺳﺘﻮﺭ: ﻧﻜـﺘﻪ . ﺍﻳﻦ ﺻﻮﺭﺕ ﺧﻄﺎ ﺭﺥ ﻣﻲ ﺩﻫﺪ . ﺷﻤﺎﺭﻩ ﻗﻄﻌﺎﺗﻲ ﺭﺍ ﺑﺪﻫﻴﺪ ﻛﻪ ﺗﻮﺳﻂ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﺗﻬﻴﻪ ﻣﻲ ﺷﻮﺩ: ﻣﺜﺎﻝ Select
•
P# From sp Group by p# Having count(*) >1
ﺩﺭ ﺳﻄﺮWhere ﻣﻲ ﺁﻳﺪ ﻭ ﻧﻘﺶ ﺁﻥ ﺩﺭ ﮔﺮﻭﻩ ﻫﻤﺎﻧﻨﺪ ﻧﻘﺶGroup by ﻣﻌـﻨﺎﻱ ﻣﺴـﺘﻘﻞ ﻧﺪﺍﺭﺩ ﻭ ﻫﻤﻴﺸﻪ ﺑﺎHaving : ﻧﻜـﺘﻪ . ﻣﻲ ﺑﺎﺷﺪ Find the average account balance at the Perryridge branch. select avg (balance) from account where branch-name = ‘Perryridge’ Find the number of tuples in the customer relation. select count (*) from customer Find the number of depositors in the bank. select count (distinct customer-name) from depositor Find the number of depositors for each branch. select branch-name, count (distinct customer-name) from depositor, account where depositor.account-number = account.account-number group by branch-name Find the names of all branches where the average account balance is more than $1,200. select branch-name, avg (balance) from account group by branch-name having avg (balance) > 1200
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
•
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٦٩ /
SQLﺩﺭ ﺑـﺮﺧﻮﺭﺩ ﺑـﺎ ﻣﻘـﺪﺍﺭ NULLﺑـﻪ ﻋـﻨﻮﺍﻥ ﻳـﻚ ﻋﻤﻠـﻮﻧﺪ ﺩﺭ ﻋﻤـﻞ ﻣﻘﺎﻳﺴـﻪ ﻧﻤﻲ ﺗﻮﺍﻧﺪ ﺗﺼﻤﻴﻤﻲ ﺑﮕﻴﺮﺩ .ﻳﻌﻨﻲ ﺳـﻄﺮﻫﺎﻱ ﺩﺍﺭﺍﻱ NULLﺩﺭ ﺳﺘﻮﻥ ﻣﻮﺭﺩ ﻧﻈﺮ ﺭﺍ ﺩﺭ ﻛﺎﺭ ﺩﺧﺎﻟﺖ ﻧﻤﻲ ﺩﻫﺪ .ﺍﻣﺎ ﺍﮔﺮ ﺍﺯ ﻋﺒﺎﺭﺕ IS NULLﺍﺳﺘﻔﺎﺩﻩ ﺷﻮﺩ ﺁﻧﮕﺎﻩ ﺳﻴﺴﺘﻢ ﺑﺎ ﻣﻘﺪﺍﺭ NULLﺑﺮﺧﻮﺭﺩ ﻣﻲ ﻛﻨﺪ . ) is NULL
sp (status > 15) OR (status
•
ﻧﺘﻴﺠﻪ ﻫﺮ ﻋﻤﻞ ﺭﻳﺎﺿﻲ ﺭﻭﻱ
•
ﺗﻤﺎﻡ ﺗﻮﺍﺑﻊ ﺟﻤﻌﻲ ﺑﺠﺰ)*( Countﺗﺎﭘﻠﻬﺎﻱ ﺑﺎ ﻣﻘﺎﺩﻳﺮNULL
NULLﻧﻴﺰ NULL
S# From Where
Select
ﺍﺳﺖ . NULL
5 + NULL
ﺩﺭ ﺁﻥ ﺻﻔﺖ ﺧﺎﺻﻪ ﺭﺍ ﻧﺎﺩﻳﺪﻩ ﻣﻲ ﮔﻴﺮﻧﺪ .
E.g. Find all loan number which appear in the loan relation with null values for amount. select loan-number from loan where amount is null •
ﺩﺭ ﺑﺮﺧﻲ ﻧﺴﺨﻪ ﻫﺎﻱ ، SQLﺗﻮﺍﺑﻊ ﺩﻳﮕﺮﻱ ﻧﻴﺰ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪﻛﻪ ﺍﺯ ﺟﻤﻠﻪ ﻣﻲ ﺗﻮﺍﻥ ﺗﻮﺍﺑﻊ ﺯﻳﺮ ﺭﺍ ﻧﺎﻡ ﺑﺮﺩ :
SYSDATE , NEXT-DAY , LN, EXP, TAN ,TANH, SIN , SINH, COS, COSH,CEIL,FLOOR,STTDEV,VARIANCE,POWER,MOD,SIGN,CHR,CONCAT,UPPER ,LOWER,LPAD,RPAD,LTRIM,RTRIM,REPLACE,TRANSLATE, lENGTH,TO_CHAR,USER,TO_NUMBER
•
ﭘﺮﺱ ﻭﺟﻮﻫﺎﻱ ﻓﺮﻋﻲ ﭘـﺮﺱ ﻭ ﺟـﻮﻫﺎﻱ ﻓﺮﻋـﻲ ﻳﻜـﻲ ﺍﺯ ﺗﻮﺍﻧﺎﻳـﻴﻬﺎﻱ ﻣﻬﻢ ﺩﺭ SQLﻣﻲ ﺑﺎﺷﺪ .ﻳﻚ ﭘﺮﺱ ﻭ ﺟﻮﻱ ﻓﺮﻋﻲ ﻳﻚ ﻋﺒﺎﺭﺕ ﭘﺮﺱ ﻭ ﺟﻮﻱ Select –from-whereﺍﺳﺖ ﻛﻪ ﺩﺭ ﺩﺍﺧﻞ ﻳﻚ ﭘﺮﺱ ﻭ ﺟﻮ ﺑﻜﺎﺭ ﺑﺮﺩﻩ ﻣﻲ ﺷﻮﺩ . ﻣﺜﺎﻝ :ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﻗﻄﻌﻪ P 2ﺭﺍ ﺑﺪﻫﻴﺪ . ﻳﻚ ﺭﺍﻩ ﺑﺮﺍﻱ ﻓﺮﻣﻮﻟﻪ ﻛﺮﺩﻥ ﺍﻳﻦ ﭘﺮﺱ ﻭ ﺟﻮ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻣﻜﺎﻧﻴﺴﻢ ﭘﻴﻮﻧﺪ ﺍﺳﺖ : Select Sname From S,Sp Where S.S# = SP.S# ’AND SP.P# = ‘P2
ﺭﺍﻩ ﺩﻳﮕﺮ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﺮﺱ ﻭ ﺟﻮﻱ ﻓﺮﻋﻲ ﺍﺳﺖ : Select Sname From S Where S# IN (Select S# From SP )’Where P# = ‘P2 Sub Query
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
•
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٧٠ /
ﺳﻴﺴﺘﻢ ﺍﺑﺘﺪﺍ ﭘﺮﺱ ﻭ ﺟﻮﻱ ﻓﺮﻋﻲ ﺭﺍ ﺍﺟﺮﺍ ﻣﻲ ﻛﻨﺪ ﻛﻪ ﺣﺎﺻﻞ ﻳﻚ ﻣﺠﻤﻮﻋﻪ ﺍﺯ S #ﻫﺎﺳﺖ .
ﻣﺜﺎﻝ :ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﺭﺍ ﺑﺪﻫﻴﺪ ﻛﻪ ﺍﻗﻼ ﻳﻚ ﻗﻄﻌﻪ ﺁﺑﻲ ﺭﻧﮓ ﺗﻬﻴﻪ ﻣﻲ ﻛﻨﻨﺪ . ﺩﺭ ﺍﻳﻦ ﭘﺮﺱ ﻭ ﺟﻮ ﺳﻪ ﺟﺪﻭﻝ SP ، P، Sﺩﺧﺎﻟﺖ ﺩﺍﺭﻧﺪ :
P )‘ ﺁﺑﻲ‘ = Where Color
•
SP IN (Select P# From
Select Sname From S Where S# IN (Select S# from Where P#
ﺍﮔﺮ ﻧﺘﻴﺠﻪ ﭘﺮﺱ ﻭ ﺟﻮﻱ ﻓﺮﻋﻲ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﻣﻘﺪﺍﺭ ﺑﺎﺷﺪ ﺍﺯ ﻋﺒﺎﺭﺕ I Nﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ ﻭ ﺍﮔﺮ ﻗﻄﻌﺎ ﺗﻚ ﻣﻘﺪﺍﺭﻱ ﺑﺎﺷﺪ ﻣﻲ ﺗﻮﺍﻥ ﺍﺯ ﻋﻤﻠﮕﺮﺩ = ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ .
ﻣﺜﺎﻝ :ﺷﻤﺎﺭﻩ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﻫﻢ ﺷﻬﺮ ﺑﺎ S1ﺭﺍ ﺑﺪﻫﻴﺪ . Select S# From S Where city = ( Select city from S Where )’S# = ‘S1
ﺟﻮﺍﺏ ﭘﺮﺱ ﻭ ﺟﻮﻱ ﻓﺮﻋﻲ ﺑﺎﻻ ﻳﻚ ﻣﻘﺪﺍﺭ ﺍﺳﺖ . •
ﻣﻲ ﺗﻮﺍﻥ ﺩﺭ ﭘﺮﺱ ﻭ ﺟﻮﻫﺎﻱ ﻓﺮﻋﻲ ﺍﺯ ﺗﺎﺑﻊ ﺟﻤﻌﻲ ﻧﻴﺰ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ .
ﻣﺜﺎﻝ :ﺷﻤﺎﺭﻩ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻧﻲ ﺭﺍ ﺑﺪﻫﻴﺪ ﻛﻪ ﻣﻘﺪﺍﺭ ﻭﺿﻌﻴﺖ ﺁﻧﻬﺎ ﺍﺯ ﻣﺎﻛﺰﻳﻤﻢ ﻣﻘﺪﺍﺭ ﻭﺿﻌﻴﺖ ﻣﻮﺟﻮﺩ ﺩﺭ Sﻛﻤﺘﺮ ﺑﺎﺷﺪ SELECT S# FROM S WHERE STATUS < ( SELECT )MAX (STATUS FROM ;) S
•
ﺩﺭ SQLﻣﻲ ﺗﻮﺍﻥ ﺍﺯ ﺳﻮﺭ ﻭﺟﻮﺩﻱ ﻧﻴﺰ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ .
ﻣﺜﺎﻝ :ﺍﺳﺎﻣﻲ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﻗﻄﻌﻪ P 2ﺭﺍ ﺑﺪﻫﻴﺪ .
•
SELECT SNAME FROM S WHERE EXISTS ( SELECT * FROM SP )’WHERE SP.S# = S.S# AND SP.P#=’P 2 ﻋﺒﺎﺭﺕ EXISTSﺩﺭ SQLﺩﺍﺭﺍﻱ ﺍﺭﺯﺵ ﺩﺭﺳﺖ ﺍﺳﺖ ﺍﮔﺮ ﻭﻓﻘﻂ ﺍﮔﺮ ﻧﺘﻴﺠﻪ ﺍﺭﺯﻳﺎﺑﻲ ) … (Selectﺗﻬﻲ ﻧﺒﺎﺷﺪ.
•
ﻧﻜﺎﺕ ﻣﻬﻢ ﺩﺭ ﻣﻮﺭﺩ ﻣﺜﺎﻝ ﻣﻄﺮﺡ ﺷﺪﻩ :
.١ﻭﺟﻮﺩ Sﺩﺭ S.S#ﺿﺮﻭﺭﻱ ﻭﻟﻲ SPﺩﺭ SP.S#ﺑﺮﺍﻱ ﻭﺿﻮﺡ ﺑﻴﺸﺘﺮ ﺍﺳﺖ .ﻭﻗﺘﻲ ﻛﻪ ﺩﺭ ﻳﻚ ﭘﺮﺱ ﻭ ﺟﻮﻱ ﺩﺭﻭﻧﻲ ﺍﺯ ﺟﺪﻭﻟﻲ ﺍﺯ ﭘﺮﺱ ﻭ ﺟﻮﻱ ﺑﻴﺮﻭﻧﻲ ﺍﺭﺟﺎﻉ ﻣﻲ ﺩﻫﻴﻢ .ﻗﻴﺪ ﻛﺮﺩﻥ ﺷﻨﺎﺳﻪ ﺁﻥ ﺳﺘﻮﻥ ﺍﻟﺰﺍﻣﻲ ﺍﺳﺖ . .٢ﻭﺟـﻮﺩ ﺷﺮﻁ SP.S# = S.S#ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﺎ ﺍﺳﺖ ﻛﻪ ﺳﻴﺴﺘﻢ ﻋﻤﻞ ﭘﻴﻮﻧﺪ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﺪ .ﻫﺮ ﭼﻨﺪ ﻇﺎﻫﺮﺵ ﻫﻤﺎﻥ ﺍﺳﺖ ﻭ ﺍﺯ ﺍﻳﻦ ﺩﻳﺪﮔﺎﻩ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ existsﻫﻤﻴﺸﻪ ﻛﺎﺭﺍﺗﺮ ﺍﺯ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﻋﻤﻞ ﭘﻴﻮﻧﺪ ﺍﺳﺖ .
٧١ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
Find all customers who have both an account and a loan at the bank. select distinct customer-name from borrower where customer-name in (select customer-name from depositor) Find all customers who have a loan at the bank but do not have an account at the bank select distinct customer-name from borrower where customer-name not in (select customer-name from depositor) Find all customers who have both an account and a loan at the Perryridge branchselect distinct customer-name from borrower, loan where borrower.loan-number = loan.loan-number and branch-name = “Perryridge” and (branch-name, customer-name) in (select branch-name, customer-name from depositor, account where depositor.account-number = account.account-number) Find all branches that have greater assets than some branch located in Brooklyn. select distinct T.branch-name from branch as T, branch as S where T.assets > S.assets and S.branch-city = ‘Brooklyn’ Same query using > some clause select branch-name from branch where assets > some (select assets from branch where branch-city = ‘Brooklyn’) (= some) =in However, (<> some) = not in (<> all)= not in However, (= all) = in
٧٢ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
Find the names of all branches that have greater assets than all branches located in Brooklyn. select branch-name from branch where assets > all (select assets from branch where branch-city = ‘Brooklyn’) The unique construct tests whether a subquery has any duplicate tuples in its result. Find all customers who have at most one account at the Perryridge branch. select T.customer-name from depositor as T where unique ( select R.customer-name from account, depositor as R where T.customer-name = R.customer-name and R.account-number = account.account-number and account.branch-name = ‘Perryridge’) Find all customers who have at least two accounts at the Perryridge branch. select distinct T.customer-name from depositor T where not unique ( select R.customer-name from account, depositor as R where T.customer-name = R.customer-name and R.account-number = account.account-number and account.branch-name = ‘Perryridge’)
: ﺍﺣﻜﺎﻡ ﺗﻐﻴﻴﺮ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ: ٢ – ٣ – ٦ ﺍﺣﻜﺎﻡ ﺣﺬﻑ ﺩﺍﺩﻩ ﻫﺎ: ١ – ٢ – ٣ – ٦ : ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩD elete ﺑﺮﺍﻱ ﺣﺬﻑ ﻳﻚ ﻳﺎ ﭼﻨﺪ ﺗﺎﭘﻞ ﺍﺯ ﺟﺪﻭﻝ ﻣﻲ ﺗﻮﺍﻥ ﺍﺯ ﺩﺳﺘﻮﺭ DELETE FROM R WHERE P
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٧٣ /
ﻣﺜﺎﻝ :ﺣﺬﻑ ﻛﻨﻴﺪ ﺍﻃﻼﻉ> < S3,P4,….ﺭﺍ . ’AND P# = ‘P4
DELETE FROM SP ’WHERE S# = ‘S3
ﺩﺭ ﺩﺳﺘﻮﺭﺯﻳﺮ ﺑﺨﺎﻃﺮ ﻗﺎﻋﺪﻩ ﺟﺎﻣﻌﻴﺖ ﺑﺎﻳﺴﺘﻲ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻧﻴﺰ ﺍﺟﺮﺍ ﺷﻮﺩ . DELETE FROM P ’WHERE P# = ‘P5 DELETE FROM SP ’WHERE P# = ‘P5
ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺑﺮﺍﻱ ﺣﺬﻑ ﺗﻤﺎﻡ ﺳﻄﺮﻫﺎﻱ Spﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ: DELETE FROM SP
: ٢ – ٢ – ٣ – ٦ﺍﺿﺎﻓﻪ ﻛﺮﺩﻥ ﺗﺎﭘﻞ ﻭ ﻳﺎ ﺗﺎﭘﻠﻬﺎﻱ ﺟﺪﻳﺪ ﻳﻚ ﺭﺍﺑﻄﻪ ) ﺟﺪﻭﻝ ( ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺩﺳﺘﻮﺭ INSERTﻣﻲ ﺗﻮﺍﻥ ﺗﺎﭘﻠﻬﺎﻳﻲ ﺭﺍ ﺑﻪ ﺟﺪﻭﻝ ﺍﺿﺎﻓﻪ ﻧﻤﻮﺩ .ﻓﺮﻣﺖ ﻛﻠﻲ ﺩﺳﺘﻮﺭ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ : )INSERT INTO R (A1,A2,…. )VALUES ( V1,V2,…..
ﻣﺜﺎﻝ : INSERT INTO P VALUES ( ‘P8’,’PN8’,’BLUE’,’10’,’C3’),
ﻣﺜﺎﻟﻲ ﺍﺯ ﺩﺭﺝ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺩﺍﺩﻩ ﻫﺎﻱ ﺟﺪﻭﻝ ﺩﻳﮕﺮ : ( INSERT INTO ACCOUNT SELECT LOAN-NUMBER, BRANCH-NAME,200 FROM LOAN ; ‘ ﻧﺎﺩﺭﻱ‘ = WHERE BRANCH-NAME ﺩﺭ ﺟﻤﻠـﻪ INSERTﺩﺳﺘﻮﺭ FROM …..
SELECTﺍﺑﺘﺪﺍ ﻗﺒﻞ ﺍﺯ ﻫﺮ ﺩﺭﺟﻲ ﺍﺭﺯﻳﺎﺑﻲ ﺷﺪﻩ ﻭ ﺳﭙﺲ ﻧﺘﻴﺠﻪ ﺑﻪ ﺭﺍﺑﻄﻪ
ﻣﻮﺭﺩ ﻧﻈﺮ ﺩﺭﺝ ﻣﻲ ﺷﻮﺩ . ﺩﺭ ﻏﻴـﺮ ﺍﻳـﻦ ﺻـﻮﺭﺕ ﺩﺳـﺘﻮﺭ I NSERT INTO TABLE1 SELECT * FROM TABLE1ﺩﭼﺎﺭ ﻣﺸﻜﻞ ﻣﻲ ﺷﻮﺩ . : ٣ – ٢ – ٣ -٥ﺣﻜﻢ ﺗﻐﻴﻴﺮ ﺭﻛﻮﺭﺩ ﺷـﻜﻞ ﻛﻠـﻲ ﺍﻳـﻦ ﺣﻜﻢ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ .ﺩﺭ ﺍﻳﻦ ﺻﻮﺭﺕ ﺗﻤﺎﻡ ﺭﻛﻮﺭﺩﻫﺎﻱ ﺟﺪﻭﻝ ﻛﻪ ﺣﺎﺋﺰ ﺷﺮﻁ ﺩﺍﺩﻩ ﺷﺪﻩ ﺑﺎﺷﻨﺪ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻣﻘﺪﺍﺭ ﺩﺍﺩﻩ ﺷﺪﻩ ﺩﺭ S etﺗﻐﻴﻴﺮ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﻧﺪ . UPDATE TABLE SET ﻋﺒﺎﺭﺕ = FIELD ] [ WHERE PERDICATE
ﻣﺜﺎﻝ : .١ﺭﻧﮓ ﻗﻄﻌﻪ P2ﺭﺍ ﺑﻪ ﺯﺭﺩ ﺗﻐﻴﻴﺮ ﺩﺍﺩﻩ ﻭ ﺑﻪ ﻭﺯﻥ ﺁﻥ ٥ﻭﺍﺣﺪ ﺑﻴﻔﺰﺍﺋﻴﺪ . UPDATE P
٧٤ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ SET
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
COLOR = ‘’ﺯﺭﺩ,
WEIGHT = WEIGHT + 5 WHERE P# = ‘P2’
ﮔﺮﻡ ﺭﺍ١٠ ﻭﺍﺣﺪ ﺍﺿﺎﻓﻪ ﻛﻨﻴﺪ ﻭ ﻗﻄﻌﺎﺕ ﻛﻤﺘﺮ ﺍﺯ٥ ﮔﺮﻡ ﻳﺎ ﺑﻴﺸﺘﺮ ﺭﺍ١٠ ﻭﺯﻥ ﻗﻄﻌﺎﺕ ﺩﺍﺭﺍﻱ ﻭﺯﻧﻲ ﺑﺎ ﻣﻘﺪﺍﺭ
.٢
. ﻭﺍﺣﺪ ﺍﺿﺎﻓﻪ ﻛﻨﻴﺪ٣ UPDATE P SET WHERE UPDATE P SET WHERE
UPDATE P SET
WEIGHT = WEIGHT + 5 WEIGHT =10 WEIGHT = WEIGHT + 3 WEIGHT < 10
. ﺗﺮﺗﻴﺐ ﺟﻤﻼﺕ ﺑﺎﻻ ﻣﻬﻢ ﺍﺳﺖ
•
: ﺑﻄﻮﺭ ﺳﺎﺩﻩ ﺗﺮ ﭘﺮﺱ ﻭ ﺟﻮ ﺭﺍ ﻧﻮﺷﺖCASEﻣﻲ ﺗﻮﺍﻥ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺟﻤﻠﻪ
•
WEIGHT = CASE WHEN ELSE
WEIGHT >= 10 WEIGHT + 5 WEIGHT + 3
THEN
END
Provide as a gift for all loan customers of the Perryridge branch, a $200 savings account. Let the loan number serve as the account number for the new savings account insert into account select loan-number, branch-name, 200 from loan where branch-name = ‘Perryridge’ insert into depositor select customer-name, loan-number from loan, borrower where branch-name = ‘Perryridge’ and loan.account-number = borrower.account-number Increase all accounts with balances over $10,000 by 6%, all other accounts receive 5%.
٧٥ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
Write two update statements: update account set balance = balance * 1.06 where balance > 10000 update account set balance = balance * 1.05 where balance £ 10000 The order is important Can be done better using the case statement (next slide) Same query as before: Increase all accounts with balances over $10,000 by 6%, all other accounts receive 5%. update account set balance = case when balance <= 10000 then balance *1.05 else balance * 1.06 end
ﻭ ﺳﻄﺢ ﺧﺎﺭﺟﻲSQL: ٤ – ٦ . ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﺩﻳﺪ ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩS QL ﺩﺭ. ﻋﺒﺎﺭﺗﻲ ﻧﺎﻣﺪﺍﺭ ﺍﺯ ﺟﺒﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ﺍﺳﺖ، ﻣﻲ ﺩﺍﻧﻴﻢ ﺩﻳﺪ CREATE
VIEW
VIEW_NAME [ ( COLUMN[,COLUMN, ….]….).] AS SUB QUERY ﻳﻚ ﭘﺮﺱ ﻭ ﺟﻮ ﺍﺳﺖ ﻛﻪ ﺍﺯ ﻃﺮﻳﻖview ﺍﺳﺖ ﻭ ﺩﺭ ﻭﺍﻗﻊ ﻣﻜﺎﻧﻴﺰﻡ ﺍﺷﺘﻘﺎﻕview ﺩﺭ ﺧﺪﻣﺖSelect ﺗﻤـﺎﻡ ﻗـﺪﺭﺕ ﺩﺳـﺘﻮﺭ
ﺍﺟﺮﺍ ﻧﻤﻲ ﺷﻮﺩ ﺑﻠﻜﻪ ﻓﻘﻂ ﺑﻪ ﻋﻨﻮﺍﻥ ﺗﻌﺮﻳﻒ ﺑﺎ ﺷﻤﺎﻱview ﭘﺮﺱ ﻭ ﺟﻮﻱ ﻣﺮﺑﻮﻃﻪ ﺩﺭ ﺯﻣﺎﻥ ﺗﻌﺮﻳﻒ. ﺩﺍﺩﻩ ﻣـﻲ ﺷـﻮﺩSelect . ﺧﺎﺭﺟﻲ ﺩﺭ ﻛﺎﺗﺎﻟﻮﮒ ﻧﮕﻬﺪﺍﺭﻱ ﻣﻲ ﺷﻮﺩ ﺗﺎ ﻫﺮﮔﺎﻩ ﻻﺯﻡ ﺑﺎﺷﺪ ﺳﻴﺴﺘﻢ ﺑﻪ ﺁﻥ ﻣﺮﺍﺟﻌﻪ ﻛﻨﺪ : ﻣﺜﺎﻝ CREATE AS
VIEW PARTS (P#,PNAME,WT,CITY) SELECT P#,PNAME, WEIGHT,CITY FROM P WHERE COLOR = ‘RED’
. ﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﺩParts ﺑﺎ ﺣﻜﻢ ﺑﺎﻻ ﻳﻚ ﺩﻳﺪ ﺑﻨﺎﻡ A view consisting of branches and their customers create view all-customer as (select branch-name, customer-name from depositor, account where depositor.account-number = account.account-number)
union
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٧٦ /
(select branch-name, customer-name from borrower, loan )where borrower.loan-number = loan.loan-number
: ١ – ٤ – ٦ﻋﻤﻠﻴﺎﺕ ﺩﺭ ﺩﻳﺪ ﺍﻟﻒ( ﺑﺎﺯﻳﺎﺑﻲ : ﻋﻤـﻞ ﺑﺎﺯﻳﺎﺑـﻲ ﺍﺯ ﻧﻈـﺮ ﺗـﺌﻮﺭﻱ ﻣﺸﻜﻠﻲ ﻧﺪﺍﺭﺩ ﻫﺮ ﭼﻨﺪ ﺩﺭ ﺑﻌﻀﻲ ﺳﻴﺴﺘﻢ ﻫﺎ ﻣﺤﺪﻭﺩﻳﺖ ﻫﺎﻳﻲ ﺩﺭ ﺍﻳﻦ ﺯﻣﻴﻨﻪ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﭼﻮﻥ viewﻣﺎﻫﻴﺘﺎ ﺟﺪﻭﻝ ﺍﺳﺖ .ﻟﺬﺍ ﻫﻤﺎﻥ ﺣﻜﻢ Selectﻧﻴﺰ ﺑﺮﺍﻱ ﺁﻥ ﻋﻤﻞ ﻣﻲ ﻛﻨﺪ . ﻣﺜﺎﻝ : PARTS
SELECT * FROM ’WHERE P# = ‘P2
ﺑـﺮﺍﻱ ﺍﺟـﺮﺍﻱ ﺣﻜـﻢ ﺑـﺎﻻ ﺑﺎﻳﺴـﺘﻲ ﺳﻴﺴﺘﻢ ﺁﻥ ﺭﺍ ﺑﻪ ﺣﻜﻤﻲ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﺗﺒﺪﻳﻞ ﻛﻨﺪ ﻭ ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﺷﺮﻁ ﻳﺎ ﺷﺮﺍﻳﻂ ﺩﺍﺩﻩ ﺷﺪﻩ ﺩﺭ ﺗﻌﺮﻳﻒ ﺩﻳﺪ ﺭﺍ ﺑﺎ ﺷﺮﻁ ﺩﺭ ﺣﻜﻢ ﺑﺎﺯﻳﺎﺑﻲ ﺗﺮﻛﻴﺐ ﻣﻲ ﻛﻨﺪ . ﻣﺜﺎﻝ : * PARTS
SELECT FROM
ﺩﻳﺪ ﻛﺎﺭﺑﺮ ﺭﺍ ﺑﻪ ﻋﻴﻨﻴﺖ ﺩﺭﻣﻲ ﺁﻭﺭﺩ . ﭼـﻮﻥ VIEWﺧـﻮﺩ ﻳـﻚ ﺟـﺪﻭﻝ ﺍﺳـﺖ ﻭ ﻟـﺬﺍ ﻣـﻲ ﺗﻮﺍﻥ ﺭﻭﻱ ﺁﻥ VIEWﺗﻌﺮﻳﻒ ﻛﺮﺩ ﻭ ﺑﺪﻳﻦ ﺗﺮﺗﻴﺐ ﺳﻄﻮﺡ ﺩﻳﮕﺮﻱ ﺍﺯ ﺍﻧﺘﺰﺍﻉ ﺭﺍ ﺍﻳﺠﺎﺩ ﻛﺮﺩ . Find all customers of the Perryridge branch select customer-name from all-customer ’where branch-name = ‘Perryridge Find the average account balance of those branches where the average account balance is greater than $1200. select branch-name, avg-balance )from (select branch-name, avg (balance from account )group by branch-name )as result (branch-name, avg-balance where avg-balance > 1200
ﺩﺭ ﺑﺮﺧـﻲ ﺳﻴﺴـﺘﻢ ﻫـﺎ ﺩﺭ ﻋﻤﻞ ﺑﺎﺯﻳﺎﺑﻲ ﺍﺯ VIEWﻣﺤﺪﻭﺩﻳﺖ ﻫﺎﻳﻲ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﺍﺯ ﺟﻤﻠﻪ ﻣﻲ ﺗﻮﺍﻥ ﻣﺸﻜﻞ ﺗﺎﺑﻊ ﺟﻤﻌﻲ ﺭﺍ ﻣﻄﺮﺡ ﻛﺮﺩ . PQ
VIEW
CREATE
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٧٧ /
AS SELECT SP.P#, SUM(SP.QTY) AS TOTALQTY FROM SP GROUP BY SP.P#
ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻏﻴﺮﻣﺠﺎﺯ ﺍﺳﺖ . AS PT
)AVG(PQ. TOTALQTY PQ
SELECT FROM
ﺏ( ﻋﻤﻠﻴﺎﺕ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺩﺭ ) : VIEWﺑﺮﻭﺯ ﺩﺭﺁﻭﺭﻱ ﺩﻳﺪﻫﺎ ( ﺗﻤـﺎﻡ ﺩﻳـﺪﻫﺎﻱ ﻗﺎﺑـﻞ ﺗﻌـﺮﻳﻒ ﺩﺭ SQLﻗﺎﺑـﻞ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﻧﻴﺴﺘﻨﺪ .ﺑﻪ ﺑﻴﺎﻥ ﺩﻳﮕﺮ ﺩﻳﺪﻫﺎﻳﻲ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ ﻛﻪ ﻧﻤﻲ ﺗﻮﺍﻥ ﺍﺯ ﻃﺮﻳﻖ ﺁﻧﻬﺎ ﻋﻤﻞ ﺩﺭﺝ ،ﺗﻐﻴﻴﺮ ﻭ ﺣﺬﻑ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﺍﺩ .ﺩﻳﺪﻫﺎ ﺭﺍ ﻣﻌﻤﻮﻻ ﺑﻪ ﺩﻭ ﺩﺳﺘﻪ ﺗﻘﺴﻴﻢ ﻣﻲ ﻛﻨﻨﺪ . .١
ﺩﻳﺪﻫﺎﻱ ﻓﺎﻗﺪ ﻣﺸﻜﻞ ﺩﺭ ﻋﻤﻠﻴﺎﺕ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ )ﭘﺬﻳﺮﺍ(
.٢
ﺩﻳﺪﻫﺎﻱ ﺩﺍﺭﺍﻱ ﻣﺸﻜﻞ )ﻧﺎﭘﺬﻳﺮﺍ(
ﺁﻧﭽـﻪ ﻛﻪ ﺩﺭ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﻣﻮﺟﻮﺩ ﺑﻪ ﻋﻨﻮﺍﻥ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﺩﻳﺪﻫﺎ ﺍﻧﺠﺎﻡ ﻣﻲ ﺷﻮﺩ ﺩﺭ ﺑﻌﻀﻲ ﻣﻮﺍﺭﺩ ﺍﺯ ﻧﻈﺮ ﻣﻨﻄﻘﻲ ﻗﺎﺑﻞ ﺩﻓﺎﻉ ﻧﻴﺴـﺖ ﻭ ﻳﺎ ﺑﺮﻋﻜﺲ ﺍﺯ ﻧﻈﺮ ﻣﻨﻄﻘﻲ ﺷﺪﻧﻲ ﺍﺳﺖ ﻭﻟﻲ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﻣﻮﺟﻮﺩ ﺍﻧﺠﺎﻡ ﻧﻤﻲ ﺩﻫﻨﺪ .ﻳﻜﻲ ﺍﺯ ﺍﻳﺮﺍﺩﻫﺎﻳﻲ ﻛﻪ ﺑﻪ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﺭﺍﺑﻄﻪ ﺍﻱ ﻣﻲ ﮔﻴﺮﻧﺪ ﻧﻴﺰ ﺑﺤﺚ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﺩﻳﺪ ﺍﺳﺖ . •
ﻧﻈﺮ ﭼﻤﺒﺮﻟﻦ ﺩﺭ ﺳﻴﺴﺘﻢ: R
ﺩﻳـﺪﻱ ﻗﺎﺑـﻞ ﺑـﻪ ﻫـﻨﮕﺎﻡ ﺳﺎﺯﻱ ﺍﺳﺖ ﺍﮔﺮ ﺭﻭﻱ ﻳﻚ ﺟﺪﻭﻝ ﻣﺒﻨﺎ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺑﺎﺷﺪ ﻭ ﻫﺮ ﺳﻄﺮ ﺩﻳﺪ ﻣﺘﻨﺎﻇﺮ ﺑﺎ ﺳﻄﺮ ﺷﺨﺼﻲ ﺍﺯ ﺟﺪﻭﻝ ﻣﺒﻨﺎ ﺑﺎﺷﺪ ﻭ ﻫﺮ ﺳﺘﻮﻥ ﺩﻳﺪ ﻧﻴﺰ ﻣﺘﻨﺎﻇﺮ ﺑﺎ ﺳﺘﻮﻥ ﻣﺸﺨﺺ ﻭ ﻧﺎﻣﺪﺍﺭﻱ ﺍﺯ ﺟﺪﻭﻝ ﻣﺒﻨﺎ ﺑﺎﺷﺪ . ﻣﺜﺎﻝ ): (١ CREATE VIEW SUPC2 AS SELECT S#,SNAME FROM S WHERE ’CITY = ‘C2
ﻓﺮﺽ ﻛﻨﻴﻢ ﺩﺳﺘﻮﺭ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ : UPDATE SUPC2 ’****‘ = Set Sname Where ’S# = ‘S2
ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﺎﻳﺴﺘﻲ ﺑﻪ ﺩﺳﺘﻮﺭﻱ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﻧﮕﺎﺷﺘﻪ ﺷﻮﺩ . UPDATE S ’****‘ = SET SNAME WHERE ’S# = ‘S2 AND ’CITY = ‘C2
ﺩﺭ ﺻﻮﺭﺗﻲ ﻛﻪ ﺑﺨﻮﺍﻫﻴﻢ ﺳﻄﺮﻱ ﺑﻪ ﺩﻳﺪ ﺩﺭﺝ ﻛﻨﻴﻢ : INSERT INTO SUPC2 )VALUES(S12,SN12
ﻛﻤﺘـﺮﻳﻦ ﻣﺸـﻜﻞ ﺁﻥ ﺍﺳـﺖ ﻛـﻪ ﺩﺭ ﺩﻭ ﺳـﺘﻮﻥ status، cityﭘﺪﻳـﺪﻩ ﻫـﻴﭽﻤﻘﺪﺍﺭ ﺑﺮﻭﺯ ﻣﻲ ﻛﻨﺪ .ﺻﺮﻓﻨﻈﺮ ﺍﺯ ﺍﻳﻨﻜﻪ ﻭﺟﻮﺩ ﺍﻳﻦ ﭘﺪﻳﺪﻩ ﻣﻄﻠﻮﺏ ﻧﻴﺴﺖ ،ﺑﺮﻭﺯ ﺁﻥ ﻣﻲ ﺗﻮﺍﻧﺪ ﻳﻜﻲ ﺍﺯ ﻗﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺖ ﭘﺎﻳﮕﺎﻩ ﺭﺍ ﺧﺪﺷﻪ ﺩﺍﺭ ﻛﻨﺪ .
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٧٨ /
INSERT INTO S VALUES ><S12,SN12,….,…..
ﺩﺭ ﺧﺼﻮﺹ ﺩﻳﺪﻫﺎﻱ ﺗﻚ ﺟﺪﻭﻟﻲ ﭼﻤﺒﺮﻟﻴﻨﻲ ﻣﻲ ﺗﻮﺍﻥ ﮔﻔﺖ ﻛﻪ ﻏﻴﺮ ﺍﺯ ﭘﺪﻳﺪﻩ ﻫﻴﭽﻤﻘﺪﺍﺭ ﻣﺸﻜﻠﻲ ﻧﺪﺍﺭﺩ . ﻣﺜﺎﻝ ): (٢ CREATE VIEW V1 )AS SELECT ( S#,STATUS FROM ;S CREATE VIEW V2 AS SELECT STATUS,CITY FROM ;S ﻣﻲ ﻫـﺮﺩﻭ ﺩﻳـﺪ ﺑـﺎﻻ ﺭﻭﻱ ﻳﻚ ﺟﺪﻭﻝ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﻧﺪ ﻭ ﻫﺮ ﺩﻭ ﺩﻳﺪ ﻣﺎﻫﻴﺘﺎ ﺣﺎﺻﻞ ﻋﻤﻞ ﭘﺮﺗﻮ ﺭﻭﻱ ﺟﺪﻭﻝ S
ﺑﺎﺷـﻨﺪ .ﺩﻳـﺪ V1ﻗﺎﺑـﻞ ﺑـﻪ ﻫـﻨﮕﺎﻡ ﺳـﺎﺯﻱ ﺍﺳـﺖ ) ﻏﻴﺮ ﺍﺯ ﻣﺴﺄﻟﻪ NULL VALUEﺩﺭ ﻋﻤﻞ ﺩﺭﺝ ( ﻭ ﺩﻳﺪ V2ﻗﺎﺑﻞ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﻧﻴﺴﺖ ﺩﻳـﺪ V1ﻣﻮﺳﻮﻡ ﺑﻪ ﺩﻳﺪ ﺣﺎﻓﻆ ﻛﻠﻴﺪ ﺍﺳﺖ ﺩﺭ ﺣﺎﻟﻴﻜﻪ ﺩﻳﺪ V2ﺣﺎﻓﻆ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻧﻴﺴﺖ .ﺩﻳﺪ ﭼﻤﺒﺮﻟﻴﻨﻲ ﻫﻤﺎﻥ ﺩﻳﺪ ﺣﺎﻓﻆ ﻛﻠﻴﺪ ﺍﺳﺖ ﻭ ﭼﻮﻥ ﺩﺭ ﺳﺎﻟﻬﺎﻱ 78-79ﻣﻔﻬﻮﻡ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺗﻌﺮﻳﻒ ﻧﺸﺪﻩ ﺑﻮﺩ ﻟﺬﺍ ﻭﻱ ﺁﻥ ﺭﺍ ﻣﻄﺮﺡ ﻧﻜﺮﺩ . ﻣﺜﺎﻝ ) : (٣ﺩﻳﺪ ﺁﻣﺎﺭﻱ : Create
view )V3(Pnum,SumQ )Select P#,sum(QTY From SP Group ;by P# ﺍﻳـﻦ ﺩﻳـﺪ ﺣـﺎﻭﻱ ﻳﻚ ﻓﻴﻠﺪ ﻣﺠﺎﺯﻱ ﺍﺳﺖ ) ﺑﻪ ﻋﻴﻨﻴﺖ ﺩﺭﺁﻭﺭﺩﻥ ﻏﻴﺮ ﻣﺴﺘﻘﻴﻢ ( S umQ :ﻳﻚ ﻓﻴﻠﺪ ﻣﺠﺎﺯﻱ ﺍﺳﺖ ﻭ ﺑﻪ ﻋﻴﻨﻪ AS
ﺭﻭﻱ ﺟﺪﻭﻝ ﻓﻴﻠﺪ ﻣﺘﻨﺎﻇﺮ ﻧﺪﺍﺭﺩ ﻭ ﻟﺬﺍ ﻫﻴﭻ ﮔﻮﻧﻪ ﻋﻤﻠﻲ ﺭﻭﻱ ﺍﻳﻦ ﺳﺘﻮﻥ ﻧﻤﻲ ﺗﻮﺍﻥ ﺍﻧﺠﺎﻡ ﺩﺍﺩ . )INTO V3 (Pnum,SumQ >Values < P11 , 111
INSERT
ﻣﻘﺪﺍﺭﻱ ﺍﺳﺖ ﺑﺮﺍﻱ ) sum(Qtyﻭ ﻧﻪ ﺑﺮﺍﻱ . Qtyﻟﺬﺍ ﻋﻤﻞ ﺩﺭﺝ ﺍﻣﻜﺎﻥ ﭘﺬﻳﺮ ﻧﻴﺴﺖ . •
ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﺩﻳﺪﻫﺎﻱ ﺣﺎﺻﻞ ﻋﻤﻞ ﭘﻴﻮﻧﺪ)ﺗﺮﻛﻴﺐ( :
ﻃـﺒﻖ ﻧﻈـﺮ ﭼﻤﺒـﺮﻟﻴﻦ ﺍﻳـﻦ ﺩﻳـﺪﻫﺎ ﻗﺎﺑﻞ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﻧﻴﺴﺘﻨﺪ ﺍﻣﺎ ﺍﻳﻦ ﻧﻈﺮ ﺭﺩ ﺷﺪﻩ ﺍﺳﺖ .ﻓﺮﺽ ﻣﻲ ﻛﻨﻴﻢ ﺑﺠﺎﻱ ﺭﺍﺑﻄﻪ S
ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ : )SX(S#,Sname,city )SY(S#,Status
ﻭ S#ﺩﺭ ﻫﺮ ﺩﻭ ﺭﺍﺑﻄﻪ SY,SXﻛﻠﻴﺪ ﺍﺳﺖ . SX ∞ SY = S
ﺍﮔﺮ ﺩﻳﺪﻱ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ ﺑﻔﺮﻡ ﻣﻘﺎﺑﻞ : CREATE VIEW S AS SELECT SX.S#,SNAME,STATUS,CITY FROM SX,SY
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٧٩ /
WHERE SX.S# = SY.S#
ﺩﺭ ﺩﻳـﺪ ﺑـﺎﻻ ﻳـﻚ ﭘـﻴﻮﻧﺪ ﺩﺍﺭﻳـﻢ ﻭ ﭘـﻴﻮﻧﺪ ﺍﺯ ﻧـﻮﻉ PK -PKﺍﺳﺖ ) .ﺻﻔﺖ ﺧﺎﺻﻪ ﺩﺧﻴﻞ ﺩﺭ ﭘﻴﻮﻧﺪ ﺩﺭ ﻫﺮ ﺩﻭ ﺭﺍﺑﻄﻪ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﺍﺳﺖ ( ﺩﻳﺪﻫﺎﻱ ﺣﺎﺻﻞ ﭼﻨﻴﻦ ﭘﻴﻮﻧﺪﻫﺎﻳﻲ ﻣﺸﻜﻠﻲ ﺩﺭ ﻋﻤﻠﻴﺎﺕ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﻧﺪﺍﺭﻧﺪ .ﻭﺟﻮﺩ ﭘﻴﻮﻧﺪﻫﺎﻱ
-P k
Pkﺳﺒﺐ ﺷﺪﻩ ﺍﺳﺖ ﻛﻪ ﺗﻨﺎﻇﺮ ﻳﻚ ﺑﻴﻚ ﺑﻴﻦ ﺳﻄﺮﻫﺎﻭ ﺳﺘﻮﻧﻬﺎﻱ ﺟﺪﺍﻭﻝ ﻣﺒﻨﺎﻱ ﺯﻳﺮﻳﻦ ﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ . Insert Into )S (S#,Sname,Status,city Values )(S9,Sn9,20,C9
Insert Into )SX (S#,Sname,city Values )(S9,Sn9,C9 Insert Into )SY (S#, Status Values )(S9,20
•
ﺩﻳﺪﻫﺎﻱ ﻧﺎﭘﺬﻳﺮﺍ : ﺍﮔـﺮ ﺍﻳـﻦ ﺍﺻـﻞ ﭘﺬﻳـﺮﻓﺘﻪ ﺷﻮﺩ ﻛﻪ ﻋﻤﻠﻴﺎﺕ ﺗﺎﭘﻠﻲ ﺩﺭ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺭﺍﺑﻄﻪ ﺍﻱ ﺍﺯ ﻃﺮﻳﻖ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻭ ﻳﺎ ﻳﻜﻲ ﺍﺯ
ﻛﻠﻴﺪ
ﻫـﺎﻱ ﻛﺎﻧﺪﻳـﺪ ﺍﻧﺠـﺎﻡ ﮔﺮﺩﺩ ،ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺩﻳﺪ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺭﻭﻱ ﻳﻚ ﺭﺍﺑﻄﻪ ﻛﻪ ﻓﺎﻗﺪ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ) ﺍﺻﻠﻲ ( ﺭﺍﺑﻄﻪ ﻣﺒﻨﺎ ﺑﺎﺷﺪ ،ﻋﻤﻠﻴﺎﺕ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺭﺍ ﻧﻤﻲ ﭘﺬﻳﺮﺩ ﻟﺬﺍ ﺩﻭ ﺣﺎﻟﺖ ﺯﻳﺮ ﺭﺍ ﻏﻴﺮ ﭘﺬﻳﺮﺍ ﺩﺭ ﻧﻈﺮ ﻣﻴﮕﻴﺮﻳﻢ : ﺍﻟﻒ ( ﺩﻳﺪ ﭘﺮﺗﻮﻱ ﻓﺎﻗﺪ ﻛﻠﻴﺪ : ﺏ ( ﺣﺎﺻﻞ ﻋﻤﻞ ﭘﻴﻮﻧﺪ)ﺗﺮﻛﻴﺐ( :FK-FK ﺍﻳـﻦ ﻧـﻮﻉ ﺩﻳﺪ ،ﺍﮔﺮ ﻋﻮﺍﺭﺽ ﺟﺎﻧﺒﻲ ﻋﻤﻠﻴﺎﺕ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺯﺍ ﺑﭙﺬﻳﺮﻳﻢ ،ﭘﺬﻳﺮﺍﻱ ﻋﻤﻠﻴﺎﺕ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺍﺳﺖ ﻭﻟﻲ ﭼﻮﻥ ﺍﻳﻦ ﻋﻮﺍﺭﺽ ﻗﺎﺑﻞ ﺗﻮﺟﻪ ﻫﺴﺘﻨﺪ ،ﻟﺬﺍ ﺁﻧﺮﺍ ﺟﺰﺀ ﺩﻳﺪﻫﺎﻱ ﻏﻴﺮ ﭘﺬﻳﺮﺍ ﻣﻨﻈﻮﺭ ﻣﻴﻜﻨﻨﺪ. •
ﺩﺭ SQL/92ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﺩﻳﺪﻫﺎ ﺍﺯ ﻗﻮﺍﻧﻴﻦ ﺯﻳﺮ ﭘﻴﺮﻭﻱ ﻣﻲ ﻛﻨﻨﺪ :
.١
ﻋﺒﺎﺭﺕ ﺟﺪﻭﻟﻲ ﻛﻪ ﺣﻮﺯﻩ ﺩﻳﺪ ﺭﺍ ﺗﻌﻴﻴﻦ ﻣﻲ ﻛﻨﺪ ﻧﺒﺎﻳﺪ ﺷﺎﻣﻞ ﻛﻠﻤﺎﺕ U NIONﻭ JOINﺑﺎﺷﺪ .
.٢
ﻗﺴﻤﺖ SELECTﻋﺒﺎﺭﺕ ﺍﻧﺘﺨﺎﺏ ﻣﺴﺘﻘﻴﻤﺎ ﺷﺎﻣﻞ DISTINCTﻧﺒﺎﺷﺪ .
.٣
ﻗﺴﻤﺖ FROMﺩﻗﻴﻘﺎ ﺷﺎﻣﻞ ﻳﻚ ﺟﺪﻭﻝ ﺍﺭﺟﺎﻉ ﺑﺎﺷﺪ .
.٤
ﻋﺒﺎﺭﺕ SELECTﻧﺒﺎﻳﺪ ﺣﺎﻭﻱ GROUPﻭ HAVINGﺑﺎﺷﺪ .
ﻧﻜﺎﺕ ﻣﻬﻢ : .١
ﻗﺎﺑﻠﻴﺖ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﺩﺭ viewﺑﻪ ﮔﻮﻧﻪ ﺍﻱ ﺍﺳﺖ ﻛﻪ ﻳﺎ ﻫﺮ ﺳﻪ ﻋﻤﻞ INSERTﻭ UPDATEﻭ DELETEﻣﻲ
ﺗﻮﺍﻧﻨﺪ ﺑﺮ ﺭﻭﻱ ﻳﻚ ﺩﻳﺪ ﺍﻋﻤﺎﻝ ﺷﻮﻧﺪ ﻭ ﻳﺎ ﻫﻴﭻ ﻛﺪﺍﻡ ﺭﺍ ﻧﻤﻲ ﺗﻮﺍﻥ ﺍﻋﻤﺎﻝ ﻛﺮﺩ . .٢
ﺩﺭ viewﺍﻳﻦ ﺍﻣﻜﺎﻥ ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ ﻛﻪ ﺑﻌﻀﻲ ﺳﺘﻮﻧﻬﺎ ﺭﺍ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﻛﺮﺩ ﻭ ﺑﺮﺧﻲ ﺳﺘﻮﻧﻬﺎ ﺭﺍ ﺩﺭ ﺩﺍﺧﻞ ﻫﻤﺎﻥ ﺩﻳﺪ
ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﻧﻜﺮﺩ . ﻣﺜﺎﻝ ) : (٣ﻓﺮﺽ ﻛﻨﻴﺪ ﺩﻳﺪ V5ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺑﺎﺷﺪ : VIEW V5 Select S#,Status,city From S
CREATE AS
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨٠ /
Where Status > 15 With ;check option V5 S#…….Status S1……16 S3……17
S S#……Status S1……16 S2……10 S3……17 S4…….15
ﺗﻬﻴﻪ ﻛﻨﻨﺪ S2ﻳﺎ S4ﺩﺭ ﺍﻳﻦ ﺩﻳﺪ ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ .ﺁﻳﺎ ﻛﺎﺭﺑﺮ ﺣﻖ ﺩﺍﺭﺩ ﻋﻤﻞ ﺯﻳﺮ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﺪ ؟ Insert Into V5 Values )(S2,18
ﺩﺭ ﺍﻳـﻦ ﺻـﻮﺭﺕ ﺑﺎﻳﺴـﺘﻲ ﺟﻠﻮﻱ ﻋﻤﻞ ﺩﺭﺝ ﺭﺍ ﺑﮕﻴﺮﺩ ﺯﻳﺮﺍ ﺑﺎﻋﺚ ﺗﻜﺮﺍﺭ ﺩﺭ ﻛﻠﻴﺪ ﻣﻲ ﺷﻮﺩ .ﻭ ﻧﻴﺰ ﺁﻳﺎ ﻛﺎﺭﺑﺮ ﺣﻖ ﺩﺍﺭﺩ ﺩﺳﺘﻮﺭ ﻣﻘﺎﺑﻞ ﺭﺍ ﻭﺍﺭﺩ ﻛﻨﺪ ؟ V5 Status = 10 Where ’S# = ‘S3 ﺩﺭ ﭼﻨـﻴﻦ ﻣـﻮﺍﺭﺩﻱ ﺩﺭ ﺑﻌﻀـﻲ ﺳﻴﺴـﺘﻢ ﻫـﺎ ﮔـﺰﻳﻨﻪcheck option
update Set
Withﺭﺍ ﻗـﺮﺍﺭ ﻣـﻲ ﺩﻫـﻨﺪ .ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﻲ ﻛﻪ ﺍﮔﺮ
ﻋﻤﻠـﻴﺎﺕ ﺩﺭﺝ ﻭ ﺑـﻪ ﻫـﻨﮕﺎﻡ ﺳﺎﺯﻱ ﺟﺎﻣﻌﻴﺖ ﺍﻋﻤﺎﻝ ﺷﺪﻩ ﺗﻮﺳﻂ ﻋﺒﺎﺭﺕ ﺗﻌﺮﻳﻒ ﻛﻨﻨﺪﻩ ﺩﻳﺪ ﺭﺍ ﻧﻘﺾ ﻛﻨﻨﺪ ﺁﻧﮕﺎﻩ ﺍﻳﻦ ﻋﻤﻠﻴﺎﺕ ﺭﻭﻱ ﺩﻳﺪ ﺭﺩ ﻣﻲ ﺷﻮﻧﺪ .
-٥-٥ﺍﻣﻜﺎﻧﺎﺕ ﺍﻣﻨﻴﺘﻲ :SQL ﻣـﻲ ﺩﺍﻧﻴﻢ ﺍﻣﻨﻴﺖ ﺑﻪ ﻣﻌﻨﻲ ﺣﻔﺎﻇﺖ ﺩﺍﺩﻩ ﻫﺎ ﺩﺭ ﻗﺒﺎﻝ ﻛﺎﺭﺑﺮﺍﻥ ﻏﻴﺮ ﻣﺠﺎﺯ ﻣﻴﺒﺎﺷﺪ .ﺟﻨﺒﻪ ﻫﺎﻱ ﻣﺨﺘﻠﻔﻲ ﺩﺭﺑﺎﺭﻩ ﺍﻣﻨﻴﺖ ﻣﻄﺮﺡ ﺍﺳﺖ ﻛﻪ ﺍﺯ ﺟﻤﻠﻪ ﻣﻲ ﺗﻮﺍﻥ ﻣﻮﺍﺭﺩ ﺯﻳﺮ ﺭﺍ ﻧﺎﻡ ﺑﺮﺩ : ﺟﻨﺒﻪ ﻫﺎﻱ ﻗﺎﻧﻮﻧﻲ ﻭ ﺍﺟﺘﻤﺎﻋﻲ ﻛﻨﺘﺮﻝ ﻫﺎﻱ ﻓﻴﺰﻳﻜﻲ ﻣﺴﺎﺋﻞ ﻋﻤﻠﻴﺎﺗﻲ ﻛﻨﺘﺮﻝ ﻫﺎﻱ ﺳﺨﺖ ﺍﻓﺰﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺳﻴﺴﺘﻢ ﻋﺎﻣﻞ ﺁﻧﭽـﻪ ﺩﺭ ﺍﻳـﻦ ﺑﺤﺚ ﺣﺎﺋﺰ ﺍﻫﻤﻴﺖ ﺍﺳﺖ ﺍﻣﻜﺎﻧﺎﺕ ﺍﻣﻨﻴﺘﻲ ﻛﻨﺘﺮﻝ ﺩﺍﺩﻩ ﻫﺎ ﺩﺭﻭﻥ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺳﺖ ﻛﻪ ﺑﺮﺧﻲ ﺍﺯ ﺁﻧﻬﺎ ﺑﺎ ﺩﺳﺘﻮﺭﺍﺕ SQLﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﻧﺪ .ﺍﺯ ﺟﻤﻠﻪ ﺍﻳﻦ ﺍﻣﻜﺎﻧﺎﺕ ﻣﻲ ﺗﻮﺍﻥ ﺗﻌﺮﻳﻒ ﻛﺎﺭﺑﺮﺍﻥ ،ﻗﻮﺍﻧﻴﻦ ﻭ ﺍﻣﺘﻴﺎﺯﺍﺕ ﺭﺍ ﻧﺎﻡ ﺑﺮﺩ . ﻛﺎﺭﺑﺮ : ﻛﺎﺭﺑﺮ ﻧﺎﻣﻲ ﺍﺳﺖ ﻛﻪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺁﻥ ﻣﻴﺘﻮﺍﻥ ﻭﺍﺭﺩ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺷﺪ .ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﻛﺎﺭﺑﺮ ﺩﺳﺘﻮﺭﺍﺕ ﺯﻳﺮ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﻧﺪ: CREATE USER user }IDENTIFIED {BY password | EXTERNALLY ][DEFAULT TABLESPACE tablespace ][TEMPORARY TABLESPACE tablespace
٨١ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
[QUOTA {integer [K|M] | UNLIMITED} ON tablespace] [PROFILE profile] ALTER USER user [IDENTIFIED {BY password | EXTERNALLY}] [DEFAULT TABLESPACE tablespace] [TEMPORARY TABLESPACE tablespace] [QUOTA {integer [K|M] | UNLIMITED} ON tablespace] [PROFILE profile] [DEFAULT ROLE { role [, role] ... | ALL [EXCEPT role [, role] ...] | NONE}]
ﺍﻣﺘﻴﺎﺯ ﻫﺎ ﻭ ﺑﺮﺍﻱ ﻟﻐﻮ ﺁﻥ ﺍﺯ ﺩﺳﺘﻮﺭGRANT ﺑﺮﺍﻱ ﺍﻋﻄﺎﺀ ﺍﻣﺘﻴﺎﺯ ﺍﺯ ﺩﺳﺘﻮﺭ. ﺍﺟﺎﺯﻩ ﺍﻧﺠﺎﻡ ﻳﻚ ﻋﻤﻞ ﺭﻭﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎﺳﺖ، ﺍﻣﺘﻴﺎﺯ . ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩREVOKE The grant statement is used to confer authorization grant <privilege list> on to <user list> <user list> is: a user-id public, which allows all valid users the privilege granted A role (more on this later) Granting a privilege on a view does not imply granting any privileges on the underlying relations. The grantor of the privilege must already hold the privilege on the specified item (or be the database administrator). select: allows read access to relation,or the ability to query using the view Example: grant users U1, U2, and U3 select authorization on the branch relation: grant select on branch to U1, U2, U3 insert: the ability to insert tuples update: the ability to update using the SQL update statement delete: the ability to delete tuples. references: ability to declare foreign keys when creating relations. usage: In SQL-92; authorizes a user to use a specified domain
٨٢ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
all privileges: used as a short form for all the allowable privileges
Roles permit common privileges for a class of users can be specified just once by creating a corresponding “role” Privileges can be granted to or revoked from roles, just like user Roles can be assigned to users, and even to other roles
SQL:1999 supports roles create role teller create role manager grant select on branch to teller grant update (balance) on account to teller grant all privileges on account to manager grant teller to manager grant teller to alice, bob grant manager to avi : ﺩﺳﺘﻮﺭ ﻟﻐﻮ ﻣﺠﻮﺯ The revoke statement is used to revoke authorization. revoke<privilege list> on from <user list> [restrict|cascade] Example: revoke select on branch from U1, U2, U3 cascade Revocation of a privilege from a user may cause other users also to lose that privilege; referred to as cascading of the revoke. We can prevent cascading by specifying restrict: revoke select on branch from U1, U2, U3 restrict With restrict, the revoke command fails if cascading revokes are required. . ﻣﺮﺍﺟﻌﻪ ﻧﻤﻮﺩhttp://members.tripod.com/er4ebus/sql/ch12.htm ﺑﺮﺍﻱ ﻣﻄﺎﻟﻌﻪ ﺑﻴﺸﺘﺮ ﻣﻲ ﺗﻮﺍﻥ ﺑﻪ ﺁﺩﺭﺱ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨٣ /
-٦-٥ﺗﻌﺮﻳﻒ ﺗﺮﺍﻛﻨﺶ ﺗـﺮﺍﻛﻨﺶ ﻭﺍﺣـﺪ ﺑـﺮﻧﺎﻣﻪ ﻧﻮﻳﺴـﻲ ﺍﺳـﺖ ﻛـﻪ ﺷـﺎﻣﻞ ﻳﻜﺴـﺮﻱ ﻋﻤﻠـﻴﺎﺕ ﻣﺮﺗﺒﻂ ﺑﺮﺍﻱ ﺩﺳﺘﺮﺳﻲ ﻭ ﺗﻐﻴﻴﺮ ﺍﻃﻼﻋﺎﺕ ﻳﻚ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗـﻲ ﻛـﻪ ﺩﺭ ﺟﻬـﺎﻥ ﻭﺍﻗﻌـﻲ ﺩﺭ ﺣﻜـﻢ ﻳـﻚ ﻋﻤـﻞ ﻭﺍﺣﺪ ﺗﻠﻘﻲ ﻣﻲ ﺷﻮﻧﺪ .ﻣﻌﻤﻮﻻ” ﺩﺳﺘﻮﺭﺍﺕ ﺗﺮﺍﻛﻨﺶ ﺑﺎ ﺩﺳﺘﻮﺭﺷﺮﻭﻉ ﺗـﺮﺍﻛﻨﺶ ) ( begin transactionﺁﻏﺎﺯ ﻭ ﺑﺎ ﻳﻚ ﻋﻤﻞ commitﻭﻳﺎ undoﭘﺎﻳﺎﻥ ﻣﻲ ﭘﺬﻳﺮﺩ .ﺩﺭ ﺧﺼﻮﺹ ﺗﺮﺍﻛﻨﺶ ﭼﻨﺪ ﻧﻜﺘﻪ ﻭﺟﻮﺩ ﺩﺍﺭﺩ : •
ﻃﺮﺍﺣﻲ ﺻﺤﻴﺢ correctness
ﺑــﺮﻧﺎﻣﻪ ﻧــﻮﻳﺲ ﺑﺎﻳــﺪ ﻋﻤﻠــﻴﺎﺕ ﺍﺟﺮﺍﻳــﻲ ﻳــﻚ ﺗــﺮﺍﻛﻨﺶ ﺭﺍ ﺑﺼــﻮﺭﺕ ﻭﺍﺣــﺪ ﻳﻜــﭙﺎﺭﭼﻪ ﻃﺮﺍﺣــﻲ ﻛــﻨﺪ ﻭ ﺍﻳــﻦ ﺑــﻪ ﺧــﻮﺩ dbmsﺭﺑﻄﻲ ﻧﺪﺍﺭﺩ. •
ﺧﻮﺍﻧﺪﻥ ﺍﻃﻼﻋﺎﺕ
ﻫﺮ ﻣﻮﺭﺩ ﺍﻃﻼﻋﺎﺗﻲ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺗﺮﺍﻛﻨﺶ ﺑﺎﻳﺪ ﻓﻘﻂ ﻳﻜﺒﺎﺭ ﺧﻮﺍﻧﺪﻩ ﺷﻮﺩ .ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺩﺭ ﺩﺍﺧﻞ ﻳﻚ ﺗﺮﺍﻛﻨﺶ ﻳﻚ ﺭﻛﻮﺭﺩ ﺩﻭﺑﺎﺭ ﺧﻮﺍﻧﺪﻩ ﻧﺸﻮﺩ. •
ﻧﻮﺷﺘﻦ ﺍﻃﻼﻋﺎﺕ:
ﻫﺮ ﻣﻮﺭﺩ ﺍﻃﻼﻋﺎﺗﻲ ﻣﻮﺭﺩ ﻋﻤﻞ ﺩﺭ ﺗﺮﺍﻛﻨﺶ ﺩﺭ ﺻﻮﺭﺕ ﺗﻐﻴﻴﺮ ﻓﻘﻂ ﻳﻜﺒﺎﺭ ﻧﻮﺷﺘﻪ ﺷﻮﺩ. -١-٦-٥ﻭﻳﮋﮔﻴﻬﺎﻱ ﺗﺮﺍﻛﻨﺶ ﺑﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﻫﺎ ﭼﻬﺎﺭ ﻭﻳﮋﮔﻲ ﻧﻴﺰ ﺫﻛﺮ ﻛﺮﺩﻩ ﺍﻧﺪ ﻛﻪ ﻣﻲ ﺗﻮﺍﻥ ﺁﻧﻬﺎ ﺭﺍ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻧﺎﻡ ﺑﺮﺩ: ﺍﻟﻒ :ﻭﻳﮋﮔﻲ ﺍﺗﻤﻲ ﺑﻮﺩﻥ Atomicity
ﺗﺮﺍﻛﻨﺶ ﻫﺎ ،ﺳﺎﺩﻩ ﻭ ﻏﻴﺮ ﻗﺎﺑﻞ ﺗﺠﺰﻳﻪ ﻫﺴﺘﻨﺪ ﺑﻌﺒﺎﺭﺗﻲ ﻛﻠﻴﻪ ﻋﻤﻠﻴﺎﺕ ﻫﺮ ﺗﺮﺍﻛﻨﺶ ﻳﺎ ﺗﻤﺎﻣﺎ“ ﺍﺟﺮﺍ ﻣﻲ ﺷﻮﻧﺪ ﻭ ﻳﺎ ﻫﻴﭽﻜﺪﺍﻡ ﺍﺟﺮﺍ ﻧﻤﻲ ﮔﺮﺩﻧﺪ. ﺏ :ﻭﻳﮋﮔﻲ ﺳﺎﺯﮔﺎﺭﻱ consistency
ﺗﺮﺍﻛﻨﺶ ﻫﺎ ﺳﺎﺯﮔﺎﺭﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺭﺍ ﺣﻔﻆ ﻣﻲ ﻛﻨﻨﺪ .ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺗﺮﺍﻛﻨﺶ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺭﺍ ﺍﺯ ﻳﻚ ﺣﺎﻟﺖ ﺳﺎﺯﮔﺎﺭ ﺑﻪ ﺣﺎﻟﺖ ﺳﺎﺯﮔﺎﺭ ﺩﻳﮕﺮﻱ ﺗﺒﺪﻳﻞ ﻣﻲ ﻛﻨﺪ. ﺝ :ﻭﻳﮋﮔﻲ ﺟﺪﺍﺳﺎﺯﻱ Isolation
ﺗﺮﺍﻛﻨﺶ ﻫﺎ ﺍﺯ ﻳﻜﺪﻳﮕﺮ ﻣﺠﺰﺍ ﻫﺴﺘﻨﺪ ﻳﻌﻨﻲ ﺍﺛﺮ ﻣﺨﺮﺏ ﺭﻭﻱ ﻳﻜﺪﻳﮕﺮ ﻧﺪﺍﺭﻧﺪ. ﺩ :ﻭﻳﮋﮔﻲ ﻫﺎﻱ ﭘﺎﻳﺪﺍﺭﻱDurability
ﭘﺲ ﺍﺯ ﺁﻧﻜﻪ ﺗﺮﺍﻛﻨﺶ ﭘﺬﻳﺮﻓﺘﻪ ﺷﺪ ﺍﺛﺮ ﺁﻥ ﺭﺍ ﺩﺭ ﺑﺎﻧﻚ ﺑﺎﻗﻲ ﻣﻲ ﻣﺎﻧﺪ ﺣﺘﻲ ﺍﮔﺮ ﺳﻴﺴﺘﻢ ﺍﻧﺪﻛﻲ ﺑﻌﺪ ﺍﺯ ﻛﺎﺭ ﺑﻴﻔﺘﺪ.
-٢-٦-٥ﻣﺜﺎﻝ ﺍﺯ ﺗﺮﺍﻛﻨﺶ ﻓﺮﺽ ﻛﻨﻴﻢ ﻣﻲ ﺧﻮﺍﻫﻴﻢ ﻣﺒﻠﻎ ٥٠٠٠٠ﺭﻳﺎﻝ ﺍﺯ ﺣﺴﺎﺏ Aﺑﻪ ﺣﺴﺎﺏ Bﻣﻨﺘﻘﻞ ﻛﻨﻴﻢ ﺩﺍﺭﻳﻢ : )1.read (A 2.A:=A-50000 )3.write(A
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨٤ / )4.read(B 5.B:=B+50000 )6.write(B
ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺧﻮﺍﺹ ﺗﺮﺍﻛﻨﺶ ﻫﺎ ﺩﺍﺭﻳﻢ : ﺍﻟﻒ( ﺧﺎﺻﻴﺖ ﺳﺎﺯﮔﺎﺭﻱ ﻣﺠﻤﻮﻉ ﻣﻘﺎﺩﻳﺮ Aﻭ Bﭘﺲ ﺍﺯ ﺍﺟﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﺗﻐﻴﻴﺮ ﻧﻤﻲ ﻛﻨﺪ. ﺏ(ﺧﺎﺻﻴﺖ ﺍﺗﻤﻲ ﺑﻮﺩﻥ: ﺍﮔـﺮ ﺗﺮﺍﻛﻨﺶ ﭘﺲ ﺍﺯ ﻣﺮﺣﻠﻪ ٣ﻭ ﻗﺒﻞ ﺍﺯ ﻣﺮﺣﻠﻪ ٦ﻣﺘﻮﻗﻒ ﮔﺮﺩﺩ ،ﺳﻴﺴﺘﻢ ﺗﻀﻤﻴﻦ ﻣﻲ ﻛﻨﺪ ﻛﻪ ﺗﻐﻴﻴﺮﺍﺕ ﺩﺭ ﺑﺎﻧﻚ ﺛﺒﺖ ﻧﮕﺮﺩﻧﺪ. ﺝ(ﭘﺎﻳﺪﺍﺭﻱ: ﭘﺲ ﺍﺯ ﺁﻧﻜﻪ ﺍﺟﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﻣﻮﺭﺩ ﺗﺎﻳﻴﺪ ﻗﺮﺍﺭ ﮔﺮﻓﺖ ﻭ ﺗﺮﺍﻛﻨﺶ ﻛﺎﻣﻞ ﮔﺮﺩﻳﺪ ،ﺍﻳﻦ ﺗﻐﻴﻴﺮﺍﺕ ﺩﺭ ﺑﺎﻧﻚ ﭘﺎﻳﺪﺍﺭ ﺧﻮﺍﻫﺪ ﺑﻮﺩ. ﺩ(ﺟﺪﺍﺳﺎﺯﻱ: ﺍﮔـﺮ ﺑـﻴﻦ ﻣـﺮﺍﺣﻞ ٣ﻭ ٦ﻳـﻚ ﺗﺮﺍﻛﻨﺶ ﺩﻳﮕﺮ ﺍﺟﺎﺯﻩ ﺩﺳﺘﻴﺎﺑﻲ ﺑﻪ ﺗﻐﻴﻴﺮﺍﺕ ﺩﺭ ﺑﺎﻧﻚ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺑﺎﻋﺚ ﻧﺎﺳﺎﺯﮔﺎﺭﻱ ﺩﺭ ﺑﺎﻧﻚ ﺧﻮﺍﻫﺪ ﮔﺮﺩﻳﺪ)ﻣﺠﻤﻮﻉ A+Bﻛﻤﺘﺮ ﺍﺯ ﻣﻘﺪﺍﺭ ﺍﺻﻠﻲ ﺧﻮﺍﻫﺪ ﺷﺪ( ﻟﺬﺍ ﻧﺒﺎﻳﺴﺘﻲ ﺍﻣﻜﺎﻥ ﺍﺟﺎﺯﻩ ﺗﺮﺍﻛﻨﺶ ﻫﺎﻱ ﺩﻳﮕﺮ ﺑﺮﺍﻱ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﭘﺎﻳﮕﺎﻩ ﺭﺍ ﺑﻮﺟﻮﺩ ﺁﻭﺭﺩ.
-٣-٦-٥ﺣﺎﻟﺘﻬﺎﻱ ﺍﺟﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﺍﻟﻒ :ﻧﺎﻗﺺ Aborted
ﺩﺭ ﺍﻳﻦ ﺣﺎﻟﺖ ﺩﺭ ﺣﻴﻦ ﺍﺟﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﺍﺷﻜﺎﻟﻲ ﭘﻴﺶ ﺁﻣﺪﻩ ﺍﺳﺖ ﻛﻪ ﻣﻨﺠﺮ ﺑﻪ ﺗﻮﻗﻒ ﺍﺟﺮﺍﻱ ﺁﻥ ﺷﺪﻩ ﺍﺳﺖ ﻭ ﻟﺬﺍ ﺗﺮﺍﻛﻨﺶ ﻧﻴﻤﻪ ﺗﻤﺎﻡ ﺭﻫﺎ ﻣﻲ ﺷﻮﺩ. ﺏ :ﺑﺮﮔﺸﺖ Rolled back
ﺩﺭ ﺻـﻮﺭﺕ ﺑـﺮﻭﺯ ﺍﺷﻜﺎﻝ ﺩﺭ ﺍﺟﺮﺍﻱ ﻳﻚ ﺗﺮﺍﻛﻨﺶ ،ﺑﺮﺍﻱ ﺣﻔﻆ ﻳﻜﭙﺎﺭﭼﮕﻲ ﺍﻃﻼﻋﺎﺕ ،ﺍﺛﺮﺍﺕ ﺍﺣﺘﻤﺎﻟﻲ ﺑﺨﺸﻲ ﺍﺯ ﺗﺮﺍﻛﻨﺶ ﻛﻪ ﺍﺟﺮﺍ ﺷﺪﻩ ﺭﻭﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺑﺎﻳﺪ ﺧﻨﺜﻲ ﺷﻮﺩ .ﺑﻪ ﺍﻳﻦ ﺣﺎﻟﺖ ﺑﺮﮔﺸﺖ ﮔﻔﺘﻪ ﻣﻲ ﺷﻮﺩ .ﻣﺴﺌﻮﻟﻴﺖ ﺍﻳﻦ ﺍﻣﺮ ﺑﻌﻬﺪﻩ dbms
ﺍﺳﺖ. ﺝ :ﭘﺬﻳﺮﺵ ﺷﺪﻩ Commited
ﺣﺎﻟﺘﻲ ﺍﺳﺖ ﻛﻪ ﻋﻤﻠﻴﺎﺕ ﺗﺮﺍﻛﻨﺶ ﺑﻄﻮﺭﻛﺎﻣﻞ ﻣﻮﻓﻘﻴﺖ ﺁﻣﻴﺰ ﺍﻧﺠﺎﻡ ﺷﺪﻩ ﻭ ﺍﺛﺮ ﺁﻥ ﻧﻴﺰ ﺛﺒﺖ ﺷﺪﻩ ﺍﺳﺖ ﭘﺲ ﺍﺯ ﺍﺟﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﺧﻨﺜﻲ ﻛﺮﺩﻥ ﺗﻐﻴﻴﺮﺍﺕ ﺍﺣﺘﻤﺎﻟﻲ ﺗﺮﺍﻛﻨﺶ ﺭﻭﻱ ﺑﺎﻧﻚ ﻏﻴﺮ ﻣﻤﻜﻦ ﺍﺳﺖ. ﺩﺭ ﺑﻴﺸﺘﺮ ﺳﻴﺴﺘﻤﻬﺎ ﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ،ﻫﺮ ﺩﺳﺘﻮﺭ SQLﻛﻪ ﺍﺟﺮﺍﻱ ﻣﻮﻓﻘﻲ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ،ﺑﻄﻮﺭ ﺧﻮﺩﻛﺎﺭ ﭘﺬﻳﺮﻓﺘﻪ ﻣﻲ ﺷﻮﺩ. ﺩﺭ SQL:1999ﺑﺮﺍﻱ ﻧﻮﺷﺘﻦ ﺑﻪ ﻓﺮﻡ ﺗﺮﺍﻛﻨﺶ ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻴﺸﻮﺩ. begin atomic … end
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨٥ /
ﻓﺼﻞ ﺷﺸﻢ: ﻧﺮﻣﺎﻟﺘﺮ ﺳﺎﺯﻱ ﺭﺍﺑﻄﻪ ﻫﺎ ١-٦ﻣﻘﺪﻣﻪ : ﺍﻳـﺪﻩ ﺍﺻـﻠﻲ ﻧﺮﻣﺎﻟﺘـﺮ ﺳﺎﺯﻱ ﺭﺍﺑﻄﻪ ﻫﺎ ﺑﺮ ﻣﺒﻨﺎﻱ ﺭﻓﻊ ﺁﻧﻮﻣﺎﻟﻲ ﻫﺎﻱ ﺭﺍﺑﻄﻪ ﻫﺎ ﺳﺖ .ﻣﻲ ﺩﺍﻧﻴﻢ ﺍﺻﻄﻼﺡ ﺁﻧﻮﻣﺎﻟﻲ ﻳﻌﻨﻲ ﺑﺮﻭﺯ ﻭﺿـﻌﻴﺖ ﻧﺎﻣﻄﻠـﻮﺏ ﺩﺭ ﺍﻧﺠـﺎﻡ ﻋﻤـﻞ ﻛـﻪ ﻣﻲ ﺗﻮﺍﻧﺪ ﻧﺎﻣﻤﻜﻦ ﺑﻮﺩﻥ ﺍﻧﺠﺎﻡ ﻳﻚ ﻋﻤﻞ ﻭ ﻳﺎ ﺑﺮﻭﺯ ﺗﺒﻌﺎﺕ ﻧﺎﻣﻄﻠﻮﺏ ﺩﺭ ﺍﻧﺠﺎﻡ ﻳﻚ ﻋﻤـﻞ ﻭ ﻳـﺎ ﺑـﺮﻭﺯ ﺩﺷـﻮﺍﺭﻱ ) ﻓـﺰﻭﻧﻜﺎﺭﻱ( ﺩﺭ ﻋﻤﻠـﻴﺎﺕ ﺑﺎﺷـﺪ .ﺑﺮﺍﻱ ﺭﻓﻊ ﺁﻧﻮﻣﺎﻟﻲ ﻫﺎ ﺑﺎﻳﺪ ﺭﺍﺑﻄﻪ ﻫﺎ ﻧﺮﻣﺎﻟﺘﺮ ﺷﻮﻧﺪ .ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺭﺍﺑﻄﻪ ﻱ ﻣﺎﻧﻨﺪ SPCﺭﺍ ﺯﻳﺮ ﺩﺭ ﻧﻈﺮ ﻣﻲ ﮔﻴﺮﻳﻢ: ﺍﻫﺪﺍﻑ ﻧﺮﻣﺎﻝ ﺳﺎﺯﻱ : P#
S#
-٣ﺗﺎﻣﻴﻦ ﻃﺮﺡ ﺑﻬﺘﺮ ﺑﺮﺍﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻗﺎﺑﻞ
s1 s1 s1
p1 p2 p3
100 200 150
c2 c2 c2
ﺩﺭﻙ ﺗﺮ
s2
p1
100
s2
p2
c3 c3 c3
-١ﻛﺎﻫﺶ ﺑﺮﺧﻲ ﺍﺯ ﺁﻧﻮﻣﺎﻟﻲ ﻫﺎ -٢ﻛﺎﻫﺶ ﺍﻓﺰﻭﻧﮕﻲ
-٤ﺍﻋﻤﺎﻝ ﺑﺮﺧﻲ ﻗﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺘﻲ ﻧﺎﺷﻲ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ
QTY CITY
s3
p1
80 90
ﺍﻳـﻦ ﺭﺍﺑﻄـﻪ ﻋﻨﺎﺻـﺮﺵ ﺍﺗﻤـﻴﻚ ) ﺳـﺎﺩﻩ ( ﻣـﻲ ﺑﺎﺷـﻨﺪ ﻛـﻪ ﺑـﻪ ﺁﻥ ﺭﺍﺑﻄﻪ ﻧﺮﻣﺎﻝ INFﻧﻴﺰ ﻣﻲ ﮔﻮﻳﻨﺪ .ﺍﻣﺎ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺩﺭ ﻋﻤﻠﻴﺎﺕ ﺁﻧﻮﻣﺎﻟﻲ ﺩﺍﺭﺩ: -١ﺩﺭ ﻋﻤﻞ ﺩﺭﺝ :ﺩﺭﺝ ﻛﻦ ﺍﻃﻼﻉ 〉〈 sv, cv
svﺳﺎﻛﻦ cvﺍﺳﺖ .
ﺍﻳﻦ ﺩﺭﺝ ﻧﺎﻣﻤﻜﻦ ﺍﺳﺖ ﺗﺎ ﻭﻗﺘﻴﻜﻪ ﻧﺪﺍﻧﻴﻢ ﭼﻪ ﻗﻄﻌﻪ ﺍﻱ ﺭﺍ ﺗﻬﻴﻪ ﻛﺮﺩﻩ ﺍﺳﺖ. -٢ﺩﺭ ﻋﻤﻞ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ: ﺷـﻬﺮ s1ﺭﺍ ﻋﻮﺽ ﻛﻨﻴﺪ .ﻋﻤﻞ ﻣﻨﻄﻘﹰﺎ ﺗﺎﭘﻠﻲ ﺑﻪ ﻋﻤﻠﻲ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺗﺒﺪﻳﻞ ﻣﻲ ﺷﻮﻧﺪ .ﻭ ﺑﻪ ﻧﻮﻋﻲ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ ﻣﻨﺘﺸﺮ ﺷﻮﻧﺪﻩ ﺩﺍﺭﻳﻢ. -٣ﺩﺭ ﻋﻤﻞ ﺣﺬﻑ : ﺑﺎ ﺣﺬﻑ ﺍﻃﻼﻉ
〉 〈 s3 , p1 ,90ﺍﻃﻼﻉ ﻧﺎﺧﻮﺍﺳﺘﻪ ﺍﺯ ﺑﻴﻦ ﻣﻲ ﺭﻭﺩ ) s3ﺳﺎﻛﻦ ﺷﻬﺮ c3ﺍﺳﺖ(.
ﺭﺍﺑﻄـﻪ spcﺧـﻮﺵ ﺳـﺎﺧﺘﺎﺭ ﻧﻴﺴـﺖ ﺭﻭﺵ ﻫـﺎﻱ ﻧﺮﻣﺎﻟﺘﺮ ﺳﺎﺯﻱ ﺑﻌﻨﻮﺍﻥ ﻳﻚ ﺍﺑﺰﺍﺭ ﻃﺮﺍﺣﻲ ﺑﻪ ﻃﺮﺍﺡ ﻣﻲ ﮔﻮﻳﺪ ﺩﺭ ﻳﻚ ﻣﺤـﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﻣﺸﺨﺺ ﭼﻪ ﺭﺍﺑﻄﻪ ﻫﺎﻳﻲ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ،ﺩﺭ ﻫﺮ ﺭﺍﺑﻄﻪ ﭼﻪ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺍﻱ ﺗﺎ ﺭﻓﺘﺎﺭ DBMSﺩﺭ ﻋﻤﻠﻴﺎﺕ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨٦ /
ﺭﻭﻱ ﭘﺎﻳﮕـﺎﻩ ﺑـﺎ ﻛﻤﺘـﺮﻳﻦ ﺁﻧﻮﻣﺎﻟـﻲ ﻫﻤـﺮﺍﻩ ﺑﺎﺷـﺪ .ﺩﺭ ﻣﺜﺎﻝ ﻓﻮﻕ ﺩﻟﻴﻞ ﺑﺮﻭﺯ ﺁﻧﻮﻣﺎﻟﻴﻬﺎﻱ ﺭﺍﺑﻄﻪ SPCﭘﺪﻳﺪﻩ ﺍﻱ ﺍﺳﺖ ﺑﻨﺎﻡ ﺍﺧـﺘﻼﻁ ﺍﻃﻼﻋﺎﺗـﻲ ﻳﻌﻨـﻲ ﺍﻃﻼﻋـﺎﺕ ﺩﺭ ﻣـﻮﺭﺩ ﺩﻭ ﭘﺪﻳـﺪﻩ ) ﻣﻮﺟـﻮﺩﻳﺖ ( ﺑﻄﻮﺭ ﻏﻴﺮ ﻻﺯﻡ ﺩﺭ ﻳﻜﺪﻳﮕﺮ ﻣﺨﻠﻮﻁ ﺷﺪﻩ ﺍﻧﺪ ﺑﻌﺒﺎﺭﺗﻲ ﺍﻃﻼﻉ ﺩﺭ ﻣﻮﺭﺩ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﻭ ﺷﻬﺮﺵ ﺑﺎ ﺍﻃﻼﻉ ﻗﻄﻌﻪ ﻣﺨﻠﻮﻁ ﺷﺪﻩ ﺍﺳﺖ. -٢-٦ﺷﻜﻞ ﻫﺎﻱ ﻧﺮﻣﺎﻝ ) ﺳﻄﻮﺡ ﻣﺨﺘﻠﻒ ﻧﺮﻣﺎﻝ( ﺳﻄﻮﺡ ﻣﺨﺘﻠﻒ ﻧﺮﻣﺎﻝ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺑﻴﺎﻥ ﻧﻤﻮﺩ: INF
INF -
2NF
2NF-
3NF
3NF-
BCNF
BCNF-
4NF
4NF-
5NF
5NPDK/NF-
ﺷﻜﻞ ﻣﻘﺎﺑﻞ ﺳﻄﻮﺡ ﻣﺨﺘﻠﻒ ﻧﺮﻣﺎﻝ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲ ﺩﻫﺪ. ﻗﺒﻞ ﺍﺯ ﺑﺮﺭﺳﻲ ﺳﻄﻮﺡ ﻧﺮﻣﺎﻝ ﺑﺮﺧﻲ ﻣﻔﺎﻫﻴﻢ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺭﺍ ﺗﻮﺿﻴﺢ ﻣﻲ ﺩﻫﻴﻢ: -٣-٦ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ )dependency
(functional
ﮔﻮﺋـﻴﻢ ﺻـﻔﺖ ﺧﺎﺻـﻪ R.Yﺑﺎ R . Xﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﺩﺍﺭﺩ ﺍﮔﺮ ﺑﺎﺯﺍﻱ ﻫﺮ ﻣﻘﺪﺍﺭ ﻣﺘﻤﺎﻳﺰ Xﻓﻘﻂ ﻳﻚ ﻣﻘﺪﺍﺭ Yﻣﺘﻨﺎﻇﺮ ﺑﺎﺷﺪ ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﻣﻲ ﮔﻮﺋﻴﻢ Yﺑﺎ Xﻭﺍﺑﺴﺘﮕﻲ ﺩﺍﺭﺩ ﻭ ﺑﻪ Xﺩﺗﺮﻣﻴﻨﺎﻥ ﻭ ﺑﻪ Yﻭﺍﺑﺴﺘﻪ ﻧﻴﺰ ﮔﻮﻳﻨﺪ .ﻭ ﺑﺼﻮﺭﺕ x → yﻧﺸﺎﻥ ﻣﻲ ﺩﻫﻴﻢ ﻣﺜﺎﻝ ﻣﻘﺪﻣﺎﺗﻲ :ﻓﺮﺽ ﻛﻨﻴﺪ ﺭﺍﺑﻄﻪ ﻣﻘﺎﺑﻞ ﺭﺍ ﺩﺍﺭﻳﻢ ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺩﺍﺭﻳﻢ: X → Z Z→ X X →Y
ﺩ ﺭ ﺗﻌﺮﻳﻒ ﻭﺍﺑﺴﺘﮕﻲ ﺑﺎﻳﺴﺘﻲ ﺑﻪ ﺩﻭ ﻧﻜﺘﻪ ﺗﻮﺟﻪ ﺩﺍﺷﺖ:
Z
Y
X
Z1 Z1 Z1 Z2 Z2
Y1 Y2 Y3 Y1 Y2
X1 X1 X1 X2 X2
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨٧ /
-١ﻭﺍﺑﺴـﺘﮕﻲ ﺗﺎﺑﻌـﻲ ﺑﺎﻳـﺪ ﺑﺮﺍﻱ ﺗﻤﺎﻡ ﺭﺍﺑﻄﻪ ﻫﺎ ﺩﺭﺳﺖ ﺑﺎﺷﺪ ﻳﻌﻨﻲ ﺍﺯ ﻣﻔﻬﻮﻡ ﻭ ﻣﻌﻨﻲ ﺁﻥ ﺻﻔﺎﺕ ﺳﺮﭼﺸﻤﻪ ﺑﮕﻴﺮﺩ ﻧﻪ ﺍﺯ ﻣﻮﺍﺭﺩ ﺧـﺎﺹ ﺩﺭ ﻳـﻚ ﻳـﺎ ﭼـﻨﺪ ﺭﺍﺑﻄـﻪ .ﺑﻌـﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺩﺭ ﺟﺪﻭﻝ ﺯﻳﺮ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺯﻳﺎﺩﻱ ﺩﻳﺪﻩ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺩﺭ ﻭﺍﻗﻊ ﺻﺤﻴﺢ ﻧﻴﺴﺖ. ﻛﻼﺱ
ﺗﺮﻡ
ﺩﺭﺱ
١٠٦
٧٩١
ﺍﺳﻤﺒﻠﻲ
ﻛﻼﺱ → ﺩﺭﺱ
١٠٥
٧٩٢
ﻣﺒﺎﻧﻲ ﻛﺎﻣﭙﻴﻮﺗﺮ
ﺍﺳﺘﺎﺩ → ﺩﺭﺱ
١٠٤
٧٩٣
ﻣﺪﺍﺭ ﺍﻟﻜﺘﺮﻳﻜﻲ ﺭﺣﻴﻤﻲ
ﺩﺭﺱ → ﺍﺳﺘﺎﺩ
٣٠١
٨٠١
ﺯﻳﻨﺎﻟﻲ
ﺍﺳﺘﺎﺩ → ﻛﻼﺱ
ﻣﺪﺍﺭ ﻣﻨﻄﻘﻲ
ﺍﺳﺘﺎﺩ ﺣﻤﻴﺪﻱ ﺷﺮﻳﻔﻲ
-٢ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﻣﺤﺪﻭﻳﺘﻬﺎﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻧﻴﺰ ﺑﻜﺎﺭ ﻣﻲ ﺭﻭﺩ .ﻳﻚ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﻣﻤﻜﻦ ﺍﺳﺖ ﺑﺮﺍﻱ ﻳﻚ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺩﺭﺳﺖ ﻭ ﺩﺭ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺩﻳﮕﺮ ﻏﻠﻂ ﺑﺎﺷﺪ ﻟﺬﺍ ﻃﺮﺍﺡ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﻲ ﺗﻮﺍﻧﺪ ﻗﻮﺍﻋﺪ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺕ ﺧﻮﺩ ﺭﺍ ﺑﺎ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﻧﻴﺰ ﺑﻴﺎﻥ ﻧﻤﺎﻳﺪ. ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺗﺎﺑﻌﻲ ﺯﻳﺮ ﺭﺍ ﻣﻲ ﺗﻮﺍﻥ ﺑﺮﺍﻱ ﺭﺍﺑﻄﻪ SPCﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺖ. Qty → city → → city s# → )( city ,Qty →
)(s# ,p# )(s# ,p# ) (s# )(s# ,p# )(s# ,p#
-١-٣-٦ﻣﻔﻬﻮﻡ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﻛﺎﻣﻞ )(FFD ﺻـﻔﺖ ﺧﺎﺻـﻪ yﺍﺯ ﺭﺍﺑﻄـﻪ Rﺑـﺎ ﺻـﻔﺖ ﺧﺎﺻﻪ xﺍﺯ ﺁﻥ FDﻛﺎﻣﻞ ﺩﺍﺭﺩ ﻫﺮ ﮔﺎﻩ yﺑﺎ FD ، xﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺍﻣﺎ ﺑﺎ ﻫﻴﭽﻜﺪﺍﻡ ﺍﺯ ﺍﺟـﺰﺍ ﺗﺸـﻜﻴﻞ ﺩﻫﻨﺪﻩ ﺁﻥ FDﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﺪ ﻭ ﺁﻥ ﺭﺍ ﺑﺼﻮﺭﺕ ⇒ R.Y
ﺩﺍﺭﻳﻢ :
( S ≠, P ≠ ) → Qty
R.Xﻧﺸﺎﻥ ﻣﻲ ﺩﻫﻴﻢ ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺩﺭ ﺭﺍﺑﻄﻪ SPC
ﻭ ﭘﺲ ( s ≠, p ≠) ⇒ Qty
s ≠→ Qty p ≠→ Qty
•
ﺍﮔﺮ ﺑﺮﺍﻱ ﺗﻤﺎﻡ ﺻﻔﺎﺕ ﺧﺎﺻﻪ yﺩﺭ Rﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ x → yﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ xﺭﺍ ﺍﺑﺮ ﻛﻠﻴﺪ Rﻣﻲ ﻧﺎﻣﻨﺪ ﻭ ﺑﺼﻮﺭﺕ x → Rﻧﻤﺎﻳﺶ ﻣﻲ ﺩﻫﻨﺪ .ﺍﮔﺮ ﺍﻳﻦ ﻭﺍﺑﺴﺘﮕﻲ ﺍﺯ ﻧﻮﻉ FFDﺑﺎﺷﺪ ﺁﻧﮕﺎﻩ Xﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ Rﺍﺳﺖ .
-٢-٣-٦ﺗﻌﺮﻳﻒ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﺑﺪﻳﻬﻲ: ﺍﮔـﺮ Yﺯﻳﺮ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ Xﺑﺎﺷﺪ ﺁﻧﮕﺎﻩ x → yﺍﻳﻦ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﺭﺍ ﺑﺪﻳﻬﻲ ) (trivalﻣﻲ ﻧﺎﻣﻴﻢ .ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﻳﻚ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﺭﺍ ﺑﺪﻳﻬﻲ ﮔﻮﻳﻨﺪ ﺍﮔﺮ ﻭ ﻓﻘﻂ ﺍﮔﺮ ﺳﻤﺖ ﺭﺍﺳﺖ ﺁﻥ ﺯﻳﺮ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﺳﻤﺖ ﭼﭗ ﺑﺎﺷﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨٨ /
ﻣﻤﻜـﻦ ﺍﺳﺖ ﺑﻌﻀﻲ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺗﺎﺑﻌﻲ ﺭﺍ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺗﺎﺑﻌﻲ ﺩﻳﮕﺮ ﻧﺘﻴﺠﻪ ﮔﺮﻓﺖ ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌــﻲ ) ( s ≠, p ≠) → (city, Qtyﻣــﻲ ﺗــﻮﺍﻥ ﺩﻭ ﻭﺍﺑﺴــﺘﮕﻲ ( s ≠, p ≠) → Qty, ( s ≠, p ≠) → cityﺭﺍ ﻧﺘــﻴﺠﻪ ﮔﺮﻓﺖ. ﻣﺠﻤـﻮﻋﻪ ﺗﻤـﺎﻡ ﻭﺍﺑﺴـﺘﮕﻲ ﻫﺎﻱ ﺗﺎﺑﻌﻲ ﻛﻪ ﺗﻮﺳﻂ ﻣﺠﻤﻮﻋﻪ ﻣﻌﻴﻨﻲ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﺑﺪﺳﺖ ﻣﻲ ﺁﻳﻨﺪ ﺭﺍ ﺑﺴﺘﺎﺭ ﺭﺍﺑﻄﻪ ﮔﻮﻳـﻨﺪ .ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺍﮔﺮ Fﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ FDﻫﺎﻱ ﺭﺍﺑﻄﻪ Fﺑﺎﺷﺪ ،ﻣﺠﻤﻮﻋﻪ ﺗﻤﺎﻡ FDﻫﺎﻳﻲ ﻛﻪ Fﻗﺎﺑﻞ ﺍﺳﺘﻨﺘﺎﺝ ﻫﺴـﺘﻨﺪ ﺭﺍ ﺑﺴـﺘﺎﺭ ) ﭘﻮﺷﺸـﻲ( ) (CLOSUREﻣﺠﻤﻮﻋﻪ Fﮔﻮﻳﻨﺪ ﻭ ﺑﺎ F+ﻧﻤﺎﻳﺶ ﻣﻲ ﺩﻫﻨﺪ ،ﺍﻭﻟﻴﻦ ﺗﻼﺵ ﺩﺭ ﺟﻬﺖ ﺣـﻞ ﺍﻳـﻦ ﻣﺴﺄﻟﻪ ﺩﺭ ﻣﻘﺎﻟﻪ ﺍﻱ ﻛﻪ ﺗﻮﺳﻂ ﺁﺭﻣﺴﺘﺮﺍﻧﮓ ﻣﻨﺘﺸﺮ ﺷﺪ ،ﺻﻮﺭﺕ ﮔﺮﻓﺖ ﻛﻪ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﻗﻮﺍﻧﻴﻦ ﺍﺳﺘﻨﺘﺎﺝ ﻛـﻪ ﺑﻌـﻨﻮﺍﻥ ﺍﺻـﻮﻝ ﺁﺭﻣﺴـﺘﺮﺍﻧﮓ ﻧﺎﻣـﻴﺪﻩ ﻣـﻲ ﺷـﺪﻧﺪ ﺭﺍ ﺍﺭﺍﺋـﻪ ﺩﺍﺩ ﻛﻪ ﺑﻪ ﻛﻤﻚ ﺁﻥ ﻣﻲ ﺗﻮﺍﻥ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺗﺎﺑﻌﻲ ﺟﺪﻳﺪﻱ ﺭﺍ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺗﺎﺑﻌﻲ ﻣﻮﺟﻮﺩ ﺍﺳﺘﻨﺘﺎﺝ ﻛﺮﺩ. -٣-٣-٦ﺍﺻﻮﻝ ﺁﺭﻣﺴﺘﺮﺍﻧﮓ -١ﻗﺎﻋﺪﻩ ﺍﻧﻌﻜﺎﺳﻲ ) : (Reflexivity ﺍﮔﺮ Bﺯﻳﺮ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ Aﺑﺎﺷﺪ ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ
A → B
-٢ﻗﺎﻋﺪﻩ ﺍﻓﺰﺍﻳﺶ ) (augmentationﺍﮔﺮ A → Bﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ )(A,C) → (B,C -٣ﻗﺎﻋﺪﻩ ﺗﻌﺪﻱ ) : (transitivityﺍﮔﺮ A → Bﻭ B → Cﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ A →C -٤ﻗﺎﻋﺪﻩ ﺗﺠﺰﻳﻪ ﭘﺬﻳﺮﻱ ) : (decompositionﺍﮔﺮ ) A → (B,Cﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ A → C,A → B -٥ﻗﺎﻋﺪﻩ ﺍﺟﺘﻤﺎﻉ ) : (unionﺍﮔﺮ A → Bﻭ A →Cﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ )A → (B,C -٦ﻗﺎﻋﺪﻩ ﺷﺒﻪ ﺗﻌﺪﻱ ) : (psoudo transitivityﺍﮔﺮ A → Bﻭ (C,B) → Dﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ (A,C) → D -٦ﻗﺎﻋﺪﻩ ﺗﺮﻛﻴﺐ :ﺍﮔﺮ A→Bﻭ C→Dﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ )(A,C) → (B,D
-٤-٣-٦ﺑﺴﺘﺎﺭ ﻳﻚ ﻣﺠﻤﻮﻋﻪ ﺍﺯ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺍﮔـﺮ Fﻣﺠﻤـﻮﻋﻪ ﺍﻱ ﺍﺯ FDﺑﺎﺷـﺪ ،ﮔـﺎﻩ ﻻﺯﻡ ﻣـﻲ ﺁﻳـﺪ ﻛـﻪ ﻣﺠﻤـﻮﻋﻪ ﺗﻤﺎﻡ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺭﺍﺑﻄﻪ Rﺭﺍ ﻛﻪ ﺑﺎ ﻳﻚ ﺻﻔﺖ ﺧﺎﺻـﻪ ﻳـﺎ ﻣﺠﻤـﻮﻋﻪ ﺍﻱ ﺍﺯ ﺻـﻔﺎﺕ ﺧﺎﺻـﻪ ﻣـﺜ ﹰ ﻼ Aﺍﺯ ﺭﺍﺑﻄـﻪ Rﻭﺍﺑﺴـﺘﮕﻲ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ ،ﻣﺸﺨﺺ ﻧﻤﺎﺋﻴﻢ ﺍﻳﻦ ﻣﺠﻤﻮﻋﻪ ﺍﺯ ﺻـﻔﺎﺕ ﺧﺎﺻـﻪ ﺭﺍ ﺑﺴﺘﺎﺭ Aﻧﺎﻣﻴﺪﻩ ﻭ ﺁﻥ ﺭﺍ ﺑﺎ A +ﻧﻤﺎﻳﺶ ﻣﻲ ﺩﻫﻴﻢ .ﻣﻲ ﺗﻮﺍﻥ A +ﺭﺍ ﺑﺎ ﻣﺤﺎﺳﺒﻪ F +ﻭ ﺍﻧﺘﺨﺎﺏ ﺁﻥ FD
ﻫﺎﻳﻲ ﻛﻪ ﺩﺭ ﺁﻥ Aﺩﺗﺮﻣﻴﻨﺎﻥ ﺍﺳﺖ ﺑﺪﺳﺖ ﺁﻭﺭﺩ. ﺗﻤﺮﻳﻦ :ﻓﺮﺽ ﻛﻨﻴﺪ A D CD B ,ad Cﻧﺎﻥ ﺩﻫﻴﺪ ADﺍﺑﺮ ﻛﻠﻴﺪ ﺍﺳﺖ ﻭﻟﻲ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻧﻴﺴﺖ. ﻣﺜﺎﻝ :ﻓﺮﺽ ﻛﻨﻴﺪ ﻣﺘﻐﻴﺮ ﺭﺍﺑﻄﻪ ﺍﻱ Rﺑﺎ ﺻﻔﺎﺕ ﺧﺎﺻﻪ FD ,F,E,D,C,B,Aﺯﻳﺮ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ ﻧﺸﺎﻥ ﺩﻫﻴﺪ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ (A,D)→ Fﺑﺮﺍﻱ Rﺑﺮﻗﺮﺍﺭ ﺍﺳﺖ. )R=(A,B,C,D,E,F })FD={ A → (B,C) , B → E , (C,D) → (E,F )1) A → (B,C
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٨٩ / 2) A →C
ﺗﺠﺰﻳﻪ
)3) (A,D) → (C,D
ﺑﺴﻂ ﭘﺬﻳﺮﻱ
)4) (C,D) → (E,F )5) (A,D) → (E,F 6) (A,D) → F
) R=(U,V,W,X,Y,Zﻭ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ Fﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ F + .ﺭﺍ
ﻣﺜﺎﻝ :ﺭﺍﺑﻄﻪ Rﺑﺎ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻣﺤﺎﺳﺒﻪ ﻛﻨﻴﺪ.
})F={ U→ (X,Y) , X → Y , (X,Y) → (Z,V } )F + = { U → X , U → Y , X → Y , (X, Y ) → ( Z,V ), U → (Z,V
-٥-٣-٦ﻣﺠﻤﻮﻋﻪ ﻭﺍﺑﺴﺘﮕﻲ ﺑﻬﻴﻨﻪ: ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻗﻮﺍﻋﺪ ﺳﻪ ﮔﺎﻧﻪ ﺯﻳﺮ ﻣﻲ ﺗﻮﺍﻥ ﻳﻚ ﻣﺠﻤﻮﻋﻪ ﻭﺍﺑﺴﺘﮕﻲ ﺭﺍ ﺑﻪ ﻣﺠﻤﻮﻋﻪ ﺑﻬﻴﻨﻪ ﻣﻌﺎﺩﻝ ﺁﻥ ﺗﺒﺪﻳﻞ ﻛﺮﺩ: -١ﺳﻤﺖ ﺭﺍﺳﺖ ﻫﺮ ﻭﺍﺑﺴﺘﮕﻲ ﻓﻘﻂ ﻳﻚ ﺻﻔﺖ ﺧﺎﺻﻪ ﺑﺎﺷﺪ -٢ﻫﺮ ﺻﻔﺘﻲ ﻛﻪ F +ﺭ ﺍ ﺗﻐﻴﻴﺮ ﻧﻤﻲ ﺩﻫﺪ ﺍﺯ ﺳﻤﺖ ﭼﭗ ﺣﺬﻑ ﺷﻮﺩ -٣ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺗﻜﺮﺍﺭﻱ ﻭ ﺍﺿﺎﻓﻲ ﺣﺬﻑ ﺷﻮﺩ. ﺍﺳﺘﻨﺘﺎﺝ ﻣﻨﻄﻖ ﺑﻌﻀﻲ ﻭﺍﺑﺴﺘﮕﻴﻬﺎ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻴﻬﺎﻱ ﺩﻳﮕﺮ ﺑﻪ ﻣﺎ ﺍﻣﻜﺎﻥ ﻣﻲ ﺩﻫﺪ ﺗﺎ ﺑﺎ ﺩﺍﺷﺘﻦ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺭﺍﺑﻄﻪ ﻣﺠﻤﻮﻋﻪ ﻛﻤﻴﻨﻪ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎ ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﺩ. ﻣﺜﺎﻝ :ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻣﺜﺎﻝ ﻗﺒﻞ ﻣﺠﻤﻮﻋﻪ ﻭﺍﺑﺴﺘﮕﻲ ﭘﻮﺷﺸﻲ ﺑﻬﻴﻨﻪ ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﻳﺪ. } )F + ={U → (X,Y) , X →Y , (X,Y) → (Z,V) , U → (Z,V
X , U→ Y
→ U
⇒ )(X,Y
⇒ U→Z ,U→V )X→ (Z,V ⇒ X→Y ⇒ X→Z , X → V
→
U
♦
)U → (Z,V )(X,Y) → (Z,V
♦ ♦ ♦
}FOPT = { U → X , U→ Y, U → Z , U → V , X→Y, X→Z , X → V
♦
)X →(Z,V
-٦-٣-٦ﻧﻤﻮﺩﺍﺭ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﻣـﻲ ﺗـﻮﺍﻥ ﻭﺍﺑﺴـﺘﮕﻲ ﺗﺎﺑﻌـﻲ ﺭﺍ ﺑـﺎ ﺍﺳـﺘﻔﺎﺩﻩ ﺍﺯ ﻧﻤﻮﺩﺍﺭ ﻧﺸﺎﻥ ﺩﺍﺩ .ﺩﺭ ﺍﻳﻦ ﻧﻤﻮﺩﺍﺭ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺩﺭ ﻣﺴﺘﻄﻴﻞ ﻗﺮﺍﺭ ﮔﻴﺮﻧﺪ ﻭ ﺧﻄﻲ ﺟﻬﺖ ﺩﺍﺭ ﺍﺯ ﺁﻧﻬﺎ ﺑﻪ ﻫﺮ ﻳﻚ ﺍﺯ ﺻﻔﺎﺕ ﻭﺍﺑﺴﺘﻪ ﺭﺳﻢ ﻣﻲ ﺷﻮﺩ. ﻣﺜﺎﻝ :ﺟﺪﻭﻝ
spﺭﺍ ﺩﺭ ﻧﻈﺮ ﻣﻲ ﮔﻴﺮﻳﻢ
) sp ( s ≠, p ≠, Qty ≠s
Qty ≠p
ﻣﻲ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٠ /
-٤-٦ﻧﺮﻣﺎﻝ ﺳﺎﺯﻱ )(normalization ١-٤-٦ﺭﺍﺑﻄﻪ ﻧﺮﻣﺎﻝ ﻳﻚ INF
ﺭﺍﺑﻄﻪ ﺍﻱ ﺭﺍ INFﮔﻮﻳﻨﺪ ﺍﮔﺮ ﻣﻘﺎﺩﻳﺮ ﺗﻤﺎﻡ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺍﺵ ﺍﺗﻤﻴﻚ ﺑﺎﺷﻨﺪ. ﻣﺜﺎﻝ :ﺭﺍﺑﻄﻪ ﺯﻳﺮ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﻣﻲ ﮔﻴﺮﻳﻢ: )(S#,P#,QTY,CITY,STATUS
FIRST :
FDﻫﺎ ﺭﺍﺑﻄﻪ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ: (S#,P# ) → Qty , (S#,P# ) → CITY , (S#,P# ) → STATUS ﻫﺮ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﺍﻱ ﺩﺭ ﻳﻚ ﺷﻬﺮ ﺳﺎﻛﻦ ﺍﺳﺖ : (S#) → CITY
ﻫﺮ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﺍﻱ ﻳﻚ ﻣﻘﺪﺍﺭ ﻭﺿﻌﻴﺖ ﺩﺍﺭﺩ
:
(S#) → STATUS
ﺗﻤﺎﻡ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ ﺳﺎﻛﻦ ﻳﻚ ﺷﻬﺮ ﻳﻚ ﻭﺿﻌﻴﺖ ﺩﺍﺭﺩCITY → STATUS :
ﻧﻤﻮﺩﺍﺭ FDﻧﻴﺰ ﺑﻔﺮﻡ ﻣﻘﺎﺑﻞ ﺍﺳﺖ . First Status
city
Qty
≠p
CITY
≠s
≠s
QTY
STATUS
s1
١٠
c1
١٠٠
p1
١٠
c1
١٢٠
p2
s1
١٠
c1
٨٠
p3
s1
١٥
c2
٩٠
p1
s2
١٥
c2
١٠٠
p1
s3
١٠
c1
٦٠
p1
s4
≠p
♦ ﺁﻧﻮﻣﺎﻟﻴﻬﺎ: -١ﺩﺭﺝ ﻛﻦ ﺍﻃﻼﻉ
〉〈 sv, c3,14
ﺍﻳﻦ ﺩﺭﺝ ﻧﺎﻣﻤﻜﻦ ﺍﺳﺖ ﺗﺎ ﻧﺪﺍﻧﻴﻢ ﭼﻪ ﻗﻄﻌﻪ ﺍﻱ ﺗﻬﻴﻪ ﻛﺮﺩﻩ ﺍﺳﺖ. -٢ﺣﺬﻑ ﻛﻦ
〉〈 s3, p1,100
ﻣﻨﺠﺮ ﺑﻪ ﺣﺬﻑ ﺍﻃﻼﻉ ﻧﺎﺧﻮﺍﺳﺘﻪ 〉 〈 s3, c 2,15ﻣﻲ ﺷﻮﺩ ﺭﺍﺑﻄﻪ FIRSTﺭﺍﺑﻄﻪ ﺧﻮﺵ ﺳﺎﺧﺘﺎﺭﻱ ﻧﻴﺴﺖ ،ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺑﺎﻳﺪ ﺑﺎ ﺍﻧﺘﺨﺎﺏ ﭘﺮﺗﻮﻫﺎﻱ ﻣﻨﺎﺳﺐ ﺑﻪ ﺩﻭ ﺭﺍﺑﻄﻪ ﺗﺠﺰﻳﻪ ﺷﻮﺩ: ) sec ond ( s ≠, status, city
ﻭ
) sp ( s ≠, p ≠, Qty
ﻧﻜﺘﻪ :ﺭﺍﺑﻄﻪ FIRSTﺑﺎﻳﺪ ﺑﮕﻮﻧﻪ ﺍﻱ ﺗﺠﺰﻳﻪ ﺷﻮﺩ ﻛﻪ ﺩﺭ ﺭﺍﺑﻄﻪ ﻫﺎﻱ ﺣﺎﺻﻠﻪ FDﻧﺎﻛﺎﻣﻞ ﻭﺟﻮﺩ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﺪ.
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩١ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
- ٢-٤-٦ﺭﺍﺑﻄﻪ 2NF
ﺭﺍﺑﻄﻪ ﺍﻱ 2NFﺍﺳﺖ ﻛﻪ : INF -١ﺑﺎﺷﺪ -٢ﻫﺮ ﺻﻔﺖ ﺧﺎﺻﻪ ﻏﻴﺮ ﻛﻠﻴﺪﺑﺎ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﻛﺎﻣﻞ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺗﻌﺮﻳﻒ 2NFﻣﻲ ﺑﻴﻨﻴﻢ ﺭﺍﺑﻄﻪ 2NF ، FIRSTﻧﻴﺴﺖ ،ﺭﺍﺑﻄﻪ SECONDﻭ SPﻫﺮ ﺩﻭ 2NFﻣﻲ ﺑﺎﺷﻨﺪ. ﻧﻜـﺘﻪ FD -١ﻫـﺎﻱ ﺑـﻴﻦ ﻣﺠﻤﻮﻋﻪ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻳﻚ ﻣﺤﻴﻂ ﺑﻴﺎﻧﮕﺮ ﻗﻮﺍﻧﻴﻦ ﺳﻤﺎﻧﺘﻴﻚ ﺣﺎﻛﻢ ﺑﺮ ﺁﻥ ﻣﺤﻴﻂ ﻣﻲ ﺑﺎﺷﻨﺪ .ﺑﻌﻨﻮﺍﻥ ﻣـﺜﺎﻝ ﻭﻗﺘـﻲ ﻣـﻲ ﮔﻮﺋـﻴﻢ ﺩﺭﺱ ≠ PR ≠→ COﺍﺳﺘﺎﺩ ﻳﻌﻨﻲ ﺍﻳﻦ ﻗﺎﻋﺪﻩ ﺑﺮ ﻣﺤﻴﻂ ﺣﺎﻛﻢ ﺍﺳﺖ ﻛﻪ ﻫﺮ ﺍﺳﺘﺎﺩ ﻓﻘﻂ ﻳﻚ ﺩﺭﺱ ﻣـﻲ ﺩﻫـﺪ .ﺍﻳـﻦ ﻗﻮﺍﻧـﻴﻦ ﺳـﻤﺎﻧﺘﻴﻚ ﺑﺎﻳﺪ ﺑﻨﺤﻮﻱ ﺑﻪ ﺳﻴﺴﺘﻢ ﺩﺍﺩﻩ ﺷﻮﺩ .ﺍﻳﻨﮕﻮﻧﻪ ﻗﻮﺍﻋﺪ ﻧﻮﻋﻲ ﻗﻮﺍﻋﺪ ﺟﺎﻣﻌﻴﺘﻲ ﺑﺮﮔﺮﻓﺘﻪ ﺍﺯ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﻫﺴﺘﻨﺪ ﻛﻪ ﻣﻮﺳﻮﻡ ﺑﻪ ﻗﻮﺍﻧﻴﻦ ﺟﺎﻣﻌﻴﺖ ﻧﺎﺷﻲ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﻣﻲ ﺑﺎﺷﻨﺪ. ﻧﻜﺘﻪ -٢ﺑﺮﺍﻱ ﺗﺒﺪﻳﻞ INFﺑﻪ 2NFﺍﺯ ﻋﻤﻠﮕﺮ ﭘﺮﺗﻮ ﺑﻄﻮﺭ ﻣﻨﺎﺳﺐ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ. •
SECOND
ﺁﻧﻮﻣﺎﻟﻴﻬﺎﻱ ﺭﺍﺑﻄﻪ
-١ﺩﺭ ﺩﺭﺝ :ﺩﺭﺝ ﻛﻦ ﺍﻃﻼﻉ > : <S5,15ﺭﺍ ﺣﺬﻑ ﻛﻦ ﺍﻳﻦ ﺣﺬﻑ ﻣﻨﺠﺮ ﺑﻪ ﺣﺬﻑ ﺍﻃﻼﻉ >
Status
-٣ﺩﺭ ﺑﻪ ﻫﻨﮕﺎﻡ ﺳﺎﺯﻱ :ﻭﺿﻌﻴﺖ ﺩﺍﺩﻩ ﺷﺪﻩ ﺑﻪ ﺷﻬﺮ c2ﺭﺍ ﻋﻮﺽ ﻛﻦ
١٠
ﺩﺭ ﺍﻳﻨﺠﺎ ﻋﻤﻞ ﺗﺎﭘﻠﻲ ﺑﻪ ﻋﻤﻞ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺗﺒﺪﻳﻞ ﻣﻴﺸﻮﺩ.
٢٠ ٢٠ ١٠ ١٥
city c1
≠s s1
c2
s2
c2
s3
c1 c4
s4 S5
ﺭﺍﺑﻄﻪ secondﻫﻢ ﺑﺎﻳﺪ ﺑﺎ ﻋﻤﻠﮕﺮ ﭘﺮﺗﻮ ﻣﻨﺎﺳﺐ ﺑﻪ ﺩﻭ ﺭﺍﺑﻄﻪ ﺗﺠﺰﻳﻪ ﺷﻮﺩ .ﻓﺮﺽ ﻛﻨﻴﻢ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺑﻪ ﺩﻭ ﺭﺍﺑﻄﻪ ) sc( s ≠, cityﻭ ) cs(city, statusﺗﺠﺰﻳﻪ ﺷﻮﺩ. SC ≠s City
CS status
city
≠s
city status
c1
s1
١٠
c1
c2
s2
٢٠
c2
c3
s3
١٥
c4
city
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٢ /
ﻣﺸﺨﺺ ﺍﺳﺖ ﺑﺎ ﺗﺮﻛﻴﺐ SCﻭ CSﻫﺮ ﮔﺎﻩ ﻻﺯﻡ ﺑﺎﺷﺪ ﺑﻪ ﺭﺍﺑﻄﻪ SECONDﻣﻲ ﺭﺳﻴﻢ. •
ﻋﻠﺖ ﺁﻧﻮﻣﺎﻟﻴﻬﺎﻱ SECOND
ﺩﺭ ﺭﺍﺑﻄﻪ SECONDﻧﻮﻋﻲ ﻭﺍﺑﺴﺘﮕﻲ ﺧﺎﺹ ﺑﻨﺎﻡ ﻭﺍﺑﺴﺘﮕﻲ ﺑﺎ ﻭﺍﺳﻄﻪ ) ﺍﺯ ﻃﺮﻳﻖ ﺗﻌﺪﻱ( ﻭﺟﻮﺩ ﺩﺍﺭﺩ. ﺗﻌﺮﻳﻒ ﻭﺍﺑﺴﺘﮕﻲ ﺑﺎ ﻭﺍﺳﻄﻪ: ﺩﺭ ﺭﺍﺑﻄﻪ ) R(A,B,Cﺍﮔﺮ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ ﻣﻲ ﮔﻮﺋﻴﻢ Cﺑﻪ Aﺍﺯ ﻃﺮﻳﻖ Bﻭﺍﺑﺴﺘﻪ ﺍﺳﺖ : ﺩﺭ ﻣﺜﺎﻝ ﻗﺒﻞ ﺩﺍﺭﻳﻢ:
B →C , B → A,A → B → A → C) ⇒ (A → B , B
C
S# → CITYﻭ CITY → STATUSﻣﻲ ﮔﻮﺋﻴﻢ STATUSﺿﻤﻦ ﺍﻳﻨﻜﻪ ﺧﻮﺩ
ﻣﺴﺘﻘﻴﻤﹰﺎ ﺑﻲ ﻭﺍﺳﻄﻪ ﺑﺎ S#ﻭﺍﺑﺴﺘﮕﻲ ﺩﺍﺭﺩ ﺍﺯ ﻃﺮﻳﻖ CITYﻧﻴﺰ ﺑﻪ ﺁﻥ ﻭﺍﺑﺴﺘﻪ ﺍﺳﺖ. : ٣-٤-٦ﺭﺍﺑﻄﻪ 3NF
ﺭﺍﺑﻄﻪ ﺍﻱ ﺭﺍ 3NFﮔﻮﻳﻨﺪ ﻫﺮ ﮔﺎﻩ: 2NF -١ﺑﻮﺩﻩ -٢ﻫﺮ ﺻﻔﺖ ﺧﺎﺻﻪ ﻏﻴﺮ ﻛﻠﻴﺪ ﺑﺎ ﻛﻠﻴﺪ ﺍﺻﻠﻲ ﻭﺍﺑﺴﺘﮕﻲ ﺑﻲ ﻭﺍﺳﻄﻪ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ≠S
ﻣﺜﺎﻝ :ﺭﺍﺑﻄﻪ SPﻭ 3NFﺍﺳﺖ
QTY ≠P
: ٤-٤-٦ﺭﺍﺑﻄﻪ BCNF ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺗﻌﺮﻳﻔﻲ ﻣﺴﺘﻘﻞ ﺍﺯ ﺳﻄﻮﺡ ﻛﻼﺳﻴﻚ ﻛﺎﺩﻱ ﺩﺍﺭﺩ :
ﺭﺍﺑﻄﻪﺍﻱ BCNFﺍﺳﺖ ﻛﻪ ﺩﺭ ﺁﻥ ﻫﺮ ﺩﺗﺮﻣﻴﻨﺎﻥ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺑﺎﺷﺪ . ﻣﺜﺎﻝ :ﺭﺍﺑﻄﻪ BCNF ، FIRSTﻧﻴﺴﺖ ﺯﻳﺮﺍ ﺩﺭ ﺭﺍﺑﻄﻪ ﺩﺍﺭﻳﻢ S# → City :ﻭ S#ﺩﺗﺮﻣﻴﻨﺎﻥ ﺍﺳﺖ ﺍﻣﺎ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻧﻴﺴﺖ . ﺩﺭ ﺳﻄﻮﺡ ﻛﻼﺳﻴﻚ Coddﻣﻔﻬﻮﻡ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻣﻄﺮﺡ ﻧﻴﺴﺖ ﻭﻟﻴﻜﻦ ﺩﺭ BCNFﻣﻄﺮﺡ ﺍﺳﺖ ﻭ ﭼﻮﻥ ﻳﻚ ﺭﺍﺑﻄﻪ ﻣﻤﻜﻦ ﺍﺳﺖ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ BCNFﺑﺎﻳﺪ ﺑﻴﺸﺘﺮ ﺑﺮﺭﺳﻲ ﺷﻮﺩ . ﻫﺮ ﺭﺍﺑﻄﻪ 3NF BCNFﺍﺳﺖ ﻭﻟﻲ ﻫﺮ 3NFﺍﻱ BCNFﻧﻴﺴﺖ .ﺑﻠﻜﻪ ﺑﺎﻳﺪ ﺑﺮﺭﺳﻲ ﺷﻮﺩ .ﻟﺬﺍ ﺩﻭ ﺣﺎﻟﺖ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﻣﻲﮔﻴﺮﻳﻢ : ﺍﻟﻒ :ﺭﺍﺑﻄﻪﻫﺎﻳﻲ ﺑﺎ ﻳﻚ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ . ﺩﺭ ﺍﻳﻦ ﺣﺎﻟﺖ ﻣﻲﺗﻮﺍﻥ ﮔﻔﺖ :ﺍﮔﺮ ﺭﺍﺑﻄﻪ 3NFﺑﺎﺷﺪ ﻗﻄﻌﹰﺎ BCNFﻫﻢ ﻫﺴﺖ . ﻣﺜﺎﻝ :ﺭﺍﺑﻄﻪ Sﻭ SP
ﺏ :ﺭﺍﺑﻄﻪﻫﺎﻳﻲ ﺑﺎ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ : ﺩﺭ ﺍﻳﻦ ﺣﺎﻟﺖ ﻧﻴﺰ ﻣﻲﺗﻮﺍﻥ ﺩﻭ ﺣﺎﻟﺖ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺖ -١ﻋﺪﻡ ﻭﺟﻮﺩ ﻫﻤﭙﻮﺷﺎﻧﻲ ﺩﺭ ﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٣ /
-٢ﻭﺟﻮﺩ ﻫﻤﭙﻮﺷﺎﻧﻲ ﺩﺭ ﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﻭ ﻣﻨﻈﻮﺭ ﺍﺯ ﻫﻤﭙﻮﺷﺎﻧﻲ :ﺍﮔﺮ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ ) R : (x,y) ,(y,zﻭﺟﻮﺩ yﻋﻨﺼﺮ ﻣﺸﺘﺮﻙ ﺭﺍ ﻫﻤﭙﻮﺷﺎﻧﻲ ﮔﻮﻳﻨﺪ . ﻣـﺜﺎﻝ ١ﺭﺍﺑﻄـﻪ Sﺭﺍ ﺩﺭ ﻧﻈﺮ ﻣﻲﮔﻴﺮﻳﻢ .ﻓﺮﺽ ﻛﻨﻴﻢ ﻋﻼﻭﻩ ﺑﺮ Sname ، S#ﻫﻢ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺑﺎﺷﺪ ) ﺍﺳﺎﻣﻲ ﺗﻜﺮﺍﺭﻱ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ ( ﻃﺒﻖ ﺗﻌﺮﻳﻒ ﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﻧﻤﻮﺩﺍﺭ FDﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ : S#
Status City
Sname
ﺍﻳﻦ ﺭﺍﺑﻄﻪ BCNFﺍﺳﺖ ﺯﻳﺮﺍ ﻫﺮ ﺩﻭ ﺗﺮﻣﻴﻨﺎﻥ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻭ 3NFﻫﻢ ﻣﻲﺑﺎﺷﺪ . ﺍﻳﻦ ﺭﺍﺑﻄﻪ 1NFﺍﺳﺖ ﺯﻳﺮﺍ ﻋﻨﺎﺻﺮﺵ ﺍﺗﻤﻴﻚ ﻫﺴﺘﻨﺪ . ﺍﻳﻦ ﺭﺍﺑﻄﻪ 2NFﺍﺳﺖ ﺯﻳﺮﺍ 1NFﺍﺳﺖ ﻭ ﻭﺍﺑﺴﺘﮕﻲ ﻧﺎﻛﺎﻣﻞ ﻧﺪﺍﺭﻳﻢ . ﺍﻳﻦ ﺭﺍﺑﻄﻪ 3NFﺍﺳﺖ ﺯﻳﺮﺍ ﺗﻌﺪﻱ ﻧﺪﺍﺭﻳﻢ . ♦ ﺩﺭ ﺍﻳﻦ ﺣﺎﻟﺖ)ﻧﺒﻮﺭ ﺻﻔﺖ ﻣﺸﺘﺮﻙ( ﺍﮔﺮ 3NFﺍﺳﺖ BCNFﻧﻴﺰ ﻣﻲ ﺑﺎﺷﺪ. ﻣـﺜﺎﻝ ٢ﺭﺍﺑﻄـﻪ SPSﺭﺍ ﺩﺭ ﻧﻈـﺮ ﺑﮕﻴﺮﻳﻢ SPS ( S# , P#, SNAME ,QTY ) :ﺩﺭ ﺍﻳﻨﺠﺎ ﺩﻭ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺩﺍﺭﻳﻢ ﻛﻪ ﺑﺎ ﻫﻢ ﻫﻤﭙﻮﺷﺎﻧﻲ ﺩﺍﺭﻧﺪ .ﻧﻤﻮﺩﺍﺭ ﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﺑﻔﺮﻡ ﺯﻳﺮ ﺍﺳﺖ :
QTY
ﺍﻳﻦ ﺭﺍﺑﻄﻪ BCNFﻧﻴﺴﺖ ﺯﻳﺮﺍ S#ﺩﺗﺮﻣﻴﻨﺎﻥ
Sname
S# P#
ﺍﺳﺖ ﻭﻟﻲ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻧﻴﺴﺖ .ﻣﻲﺧﻮﺍﻫﻴﻢ ﺑﺮﺭﺳﻲ ﻛﻨﻴﻢ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﭼﻨﺪ NFﺍﺳﺖ . ♦ ﺍﻳﻦ ﺭﺍﺑﻄﻪ 1NFﺍﺳﺖ ﺯﻳﺮﺍ ﺻﻔﺎﺕ ﺧﺎﺻﻪﺍﺵ ﺍﺗﻤﻴﻚ ﻫﺴﺘﻨﺪ . ♦ 2NFﻧﻴﺰ ﻣﻲﺑﺎﺷﺪ ﺯﻳﺮﺍ ﻭﺍﺑﺴﺘﮕﻲ ﻧﺎﻛﺎﻣﻞ ﻧﺪﺍﺭﻳﻢ . ﺍﻟﺒـﺘﻪ ﻇﺎﻫـﺮﹰﺍ ﺑـﻪ ﻧﻈـﺮ ﻣﻲﺭﺳﺪ ﻭﺍﺑﺴﺘﮕﻲ ﻧﺎﻛﺎﻣﻞ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻭﻟﻴﻜﻦ ﺍﻳﻨﻄﻮﺭ ﻧﻴﺴﺖ ﺯﻳﺮﺍ Snameﺧﻮﺩ ﺟﺰﺋﻲ ﺍﺯ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻼ ﻋﻀﻮﻳﺖ ﺻﻔﺖ ﺧﺎﺻﻪ ﺩﺭ ﻛﻠﻴﺪ ﺍﺳـﺖ ﺩﺭ ﺣﺎﻟـﻴﻜﻪ ﺩﺭ ﺗﻌـﺮﻳﻒ 2NFﻛـﺎﺩﻱ ﺁﻣﺪﻩ ﺍﺳﺖ ﻫﺮ ﺻﻔﺖ ﺧﺎﺻﻪ ﻏﻴﺮ ﻛﻠﻴﺪ ﻭ ﺍﺻ ﹰ ﻛﺎﻧﺪﻳﺪ ﻣﻄﺮﺡ ﻧﻴﺴﺖ .ﻟﺬﺍ 2NFﻣﻲﺑﺎﺷﺪ . ♦ ﺍﻳﻦ ﺭﺍﺑﻄﻪ 3NFﻧﻴﺰ ﻣﻲﺑﺎﺷﺪ ﺯﻳﺮﺍ ﺗﻌﺪﻱ ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ .
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٤ /
ﻣﻲﺑﻴﻨﻴﻢ 3NF ، SPSﺍﺳﺖ ﻭﻟﻲ BCNFﻧﻴﺴﺖ .ﻧﻜﺘﻪ ﺟﺎﻟﺒﺘﺮ ﺁﻧﻜﻪ ﺭﺍﺑﻄﻪ spsﺍﺧﺘﻼﻁ ﺍﻃﻼﻋﺎﺗﻲ ﺩﺍﺭﺩ ﺑﺎ ﺍﻳﻦ ﻫﻤﻪ ﺑﺎ ﻻ ﻭﺟﻮﺩ ﭘﺪﻳﺪﻩ ﺍﺧﺘﻼﻁ ﺍﻃﻼﻋﺎﺗﻲ ﺭﺍﺑﻄﻪ ﺭﺍ ﺩﺭ ﺣﺪ 1NFﻳﺎ ﺣﺪﺍﻛﺜﺮ ﺩﺍﺷﺘﻦ ﺩﻭ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ 3NFﺍﺳﺖ ﺩﺭ ﺣﺎﻟﻴﻜﻪ ﻣﻌﻤﻮ ﹰ 2NFﻧﮕﻪ ﻣﻲﺩﺍﺭﺩ . ﻧﺘﻴﺠﻪ :ﺻﺮﻑ ﮔﻔﺘﻦ ﺭﺍﺑﻄﻪﺍﻱ ﺍﺧﺘﻼﻁ ﺍﻃﻼﻋﺎﺗﻲ ﺩﺍﺭﺩ ﻟﺰﻭﻣﹸﺎ ﻣﻌﻨﺎﻳﺶ ﺍﻳﻦ ﻧﻴﺴﺖ ﻛﻪ ﺳﻄﺢ ﻧﺮﻣﺎﻟﻴﺘﻲ ﺁﻥ ﭘﺎﻳﻴﻦ ﺍﺳﺖ . ﺩﺭ ﻋﻤـﻞ ﺑـﺮﺍﻱ ﻃﺮﺍﺣـﻲ ﺭﺍﺑﻄـﻪﻫـﺎ ﺗـﺎ ﺳﻄﺢ BCNFﻧﺮﻣﺎﻝ ﻣﻲ ﺷﻮﻧﺪ .ﺳﻄﻮﺡ ﺑﺎﻻﺗﺮ ﺑﻴﺸﺘﺮ ﺟﻨﺒﻪ ﺗﺌﻮﺭﻳﻚ ﻭ ﭘﮋﻭﻫﺸﻲ ﺩﺍﺭﺩ ﻭ ﻼ 5NFﻭ ٤NFﻫﺴﺘﻨﺪ ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺭﺍﺑﻄﻪﻫﺎﻳﻲ ﻣﻌﻨﺎﻳﺶ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﺗﻘﺮﻳﺒﹰﺎ ﺗﻤﺎﻡ ﺭﺍﺑﻄﻪﻫﺎﻳﻲ ﻛﻪ BCNFﻫﺴﺘﻨﺪ ﻋﻤ ﹰ ﻛﻪ BCNFﺑﺎﺷﺪ ﺍﻣﺎ 4NFﻭﻳﺎ 5NFﻧﺒﺎﺷﻨﺪ ﺑﺴﻴﺎﺭ ﻛﻢﺍﻧﺪ . ﻣﺜﺎﻝ : ٣ﺭﺍﺑﻄﻪﺍﻱ ﻛﻪ 3NFﻫﺴﺖ ﺍﻣﺎ BCNFﻧﻴﺴﺖ . ﻓﺮﺽ ﻛﻨﻴﺪ ﺩﺭ ﻣﺤﻴﻂ ﺁﻣﻮﺯﺷﻲ ﻗﻮﺍﻋﺪ ﺯﻳﺮ ﻣﻮﺟﻮﺩﻧﺪ : . ١ﻳﻚ ﺩﺍﻧﺸﺠﻮ ﻳﻚ ﺩﺭﺱ ﺭﺍ ﻓﻘﻂ ﺑﺎ ﻳﻚ ﺍﺳﺘﺎﺩ ﺍﺧﺬ ﻣﻲﻛﻨﺪ . . ٢ﻳﻚ ﺍﺳﺘﺎﺩ ﻓﻘﻂ ﻳﻚ ﺩﺭﺱ ﺗﺪﺭﻳﺲ ﻣﻲﻛﻨﺪ . . ٣ﺩﺭﺱ ﻣﻤﻜﻦ ﺍﺳﺖ ﺗﻮﺳﻂ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺍﺳﺘﺎﺩ ﺗﺪﺭﻳﺲ ﺷﻮﺩ . ﺩﺭ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺩﻭ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺩﺍﺭﻳﻢ : SCP
CO#ﻭ ST#ﻭ PR#ﻭ ST#
ﻭﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﺑﺎ ﻫﻢ ﻫﻤﭙﻮﺷﺎﻧﻲ ﺩﺍﺭﻧﺪ . ﺍﻳﻦ ﺭﺍﺑﻄﻪ BCNFﻧﻴﺴﺖ ﺯﻳﺮﺍ PR#ﺩﺗﺮﻣﻴﻨﺎﻥ ﺍﺳﺖ ﻭﻟﻲ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﻧﻴﺴﺖ .
CO# PR# P1 P1 P2 P3 P2
C1 C1 C2 C2 C2
ST# ST1 ST2 ST1 ST2 ST3
ﺍﻣﺎ 3NFﻫﺴﺖ . PR# → CO# (ST# , CO#) → PR# - ٥-٤-٦ﺭﺍﺑﻄﻪ 4NF
♦
ﻭﺍﺑﺴـﺘﮕﻲ ﭼـﻨﺪ ﻣﻘـﺪﺍﺭﻱ MVD
)(multivalued dependency
ﻭﺍﺑﺴﺘﮕﻲ ﭼﻨﺪﻣﻘﺪﺍﺭﻱ ﻧﻮﻋﻲ ﻭﺍﺑﺴﺘﮕﻲ ﺑﻴﻦ ﺩﻭ ﻣﺠﻤﻮﻋﻪ ﻣﺴﺘﻘﻞ ﺍﺯ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﺍﺳﺖ .ﻭﺍﺑﺴﺘﮕﻲ ﭼﻨﺪﻣﻘﺪﺍﺭﻱ ) (A1,A2,...An ) →→ (B1,B2,...,Bmﺩﺭ ﺭﺍﺑﻄﻪ Rﺑﺮﻗﺮﺍﺭ ﺍﺳﺖ ﺍﮔﺮ ﺑﺮﺍﻱ ﺩﻭ ﺗﺎﭘﻞ tﻭ uﺩﺭ Rﻛﻪ ﺩﺭ ﺗﻤﺎﻡ ﻣﻘﺎﺩﻳﺮ A
ﻣﺸﺘﺮﻛﻨﺪ ﺗﺎﭘﻞ ﺩﻳﮕﺮ Vﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﻛﻪ : .١ﺩﺭ ﻣﻘﺎﺩﻳﺮ Aﺑﺎ tﻭ uﻣﺸﺘﺮﻙ ﺑﺎﺷﺪ . .٢ﺩﺭ ﻣﻘﺎﺩﻳﺮ Bﺑﺎ tﻣﺸﺘﺮﻙ ﺑﺎﺷﺪ .
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٥ /
.٣ﺩﺭ ﺗﻤﺎﻡ ﺳﺘﻮﻧﻬﺎﻱ ﺩﻳﮕﺮ Rﺑﺎ uﻣﺸﺘﺮﻙ ﺑﺎﺷﺪ . ﻣﺜﺎﻝ ١ﺟﺪﻭﻝ ﺗﺪﺭﻳﺲ ﺍﺳﺎﺗﻴﺪ ﺭﺍ ﺷﺎﻣﻞ ﻛﺪ ﺍﺳﺘﺎﺩ ،ﻛﺪ ﺩﺍﻧﺸﻜﺪﻩ ،ﺷﻬﺮ ﺩﺍﻧﺸﻜﺪﻩ ،ﻛﺪ ﺩﺭﺱ ﻭ ﻛﺘﺎﺏ ﺩﺭﺱ ﺩﺭ ﻧﻈﺮ ﻣـﻲ ﮔﻴـﺮﻳﻢ .ﻓـﺮﺽ ﻛﻨـﻴﻢ ﺩﺍﻧﺸﻜﺪﻩﻫﺎﻳﻲ ﻛﻪ ﺍﺳﺘﺎﺩ ﺩﺭ ﺁﻧﻬﺎ ﺗﺪﺭﻳﺲ ﻣﻲﻛﻨﺪ ﻭ ﺩﺭﻭﺳﻲ ﻛﻪ ﺩﺭﺱ ﻣﻲﺩﻫﺪ ﺍﺯ ﻫﻢ ﻣﺴﺘﻘﻞ ﺑﺎﺷـﻨﺪ ﻳﻌﻨـﻲ ﻭﺍﺑﺴـﺘﮕﻲ ﺗﺎﺑﻌﻲ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ .ﺍﮔﺮ ﺍﺳﺘﺎﺩ ﺩﺭ ﭼﻨﺪ ﺩﺍﻧﺸﻜﺪﻩ ﺩﺭﺱ ﺑﺪﻫﺪ ﻭ ﺩﺭﻭﺱ ﻣﺨﺘﻠﻒ ﺭﺍ ﻧﻴﺰ ﺗﺪﺭﻳﺲ ﻛﻨﺪ ﺍﻓﺰﻭﻧﮕﻲ ﺩﺍﺭﻳﻢ .ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺟﺪﻭﻝ ﻣﻘﺎﺑﻞ ﺩﺍﺭﻳﻢ : ﺩﺍﻧﺸـﻜﺪﻩ ﻫـﺎﻱ ﺍﺳـﺘﺎﺩ ) (100ﻭ ﻧﻴـﺰ ﺩﺭﻭﺳـﻲ ﻛـﻪ ﺗـﺪﺭﻳﺲ ﻣـﻲﻛـﻨﺪ ﺗﻜﺮﺍﺭ ﺷﺪﻩ ﺍﺳﺖ ) ﺍﻓﺰﻭﻧﮕﻲ ( ﺍﻳﻦ ﺩﺭ ﺣﺎﻟﻲ ﺍﺳﺖ ﻛﻪ ﺟﺪﻭﻝ ﻓﻮﻕ ﺗﺎ ﺳﻄﺢ BCNFﻧﺮﻣﺎﻝﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ . Book
Co#
City
College
PR#
B1
C1
ﺗﻬﺮﺍﻥ
01
100
B1
C1
ﻗﺰﻭﻳﻦ
02
100
B2
C2
ﺗﻬﺮﺍﻥ
01
100
B2
C2
ﻗﺰﻭﻳﻦ
02
100
B3
C3
ﺗﻬﺮﺍﻥ
02
100
B3
C3
ﻗﺰﻭﻳﻦ
02
ﻣﺜﺎﻝ : ٢ﺭﺍﺑﻄﻪ CTXﺣﺎﻭﻱ ﺍﻃﻼﻋﺎﺕ ﺩﺭﺱ ،ﻣﺪﺭﺱ ﻭ ﻛﺘﺎﺏ ﺩﺭ ﻧﻈﺮ ﻣﻲﮔﻴﺮﻳﻢ .ﻳﻚ ﺩﺭﺱ ﻣﻲﺗﻮﺍﻧﺪ ﺗﻮﺳﻂ ﻫﺮ ﻳﻚ ﺍﺯ ﻣﺪﺭﺳﻴﻦ ﻣﺸﺨﺺ ﺷﺪﻩ ﻭ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺗﻤﺎﻡ ﻛﺘﺎﺑﻬﺎﻱ ﻣﺸﺨﺺ ﺷﺪﻩ ﺗﺪﺭﻳﺲ ﺷﻮﺩ .ﻣﺜ ﹰ ﻼ ﺩﺭﺱ C1ﻣﻲﺗﻮﺍﻧﺪ ﺗﻮﺳﻂ t1ﻭ t2ﺗﺪﺭﻳﺲ ﺷﻮﺩ ﻫﻢ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻛﺘﺎﺏ x1ﻭ ﻫﻢ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻛﺘﺎﺏ . x2 ﺩﺭ ﻭﺍﻗﻊ ﻣﻲﺑﻴﻨﻴﻢ ﺑﻪ ﻳﻚ ﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺠﻤﻮﻋﻪﺍﻱ ﺍﺯ ﻣﻘﺎﺩﻳﺮ ﻣﺘﻨﺎﻇﺮ ﺍﺳﺖ . C →→ Tﻭ C→→ X
X
T
C
ﻣﻲﺗﻮﺍﻥ ﻭﺍﺑﺴﺘﮕﻲ ﭼﻨﺪ ﻣﻘﺪﺍﺭﻱ ﺭﺍ ﺑﻔﺮﻡ ﺯﻳﺮ ﺗﻌﺮﻳﻒ ﻧﻤﻮﺩ :
x1 x2
t1 t2
c1 c1
ﺭﺍﺑﻄﻪ Rﺑﺎ ﺻﻔﺎﺕ ﺧﺎﺻﻪ Aﻭ Bﻭ Cﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﻢ . ﻣﻲﮔﻮﻳﻴﻢ Bﺑﺎ Aﻭﺍﺑﺴﺘﮕﻲ ﭼﻨﺪﻣﻘﺪﺍﺭﻱ ﺩﺍﺭﺩ ﻭ ﭼﻨﻴﻦ ﻧﻤﺎﻳﺶ ﻣﻲﺩﻫﻴﻢ
c2
t1 x1 A →→ Bﺍﮔـﺮ ﻭ ﻓﻘﻂ ﺍﮔﺮ ﻣﺠﻤﻮﻋﻪ ﻣﻘﺎﺩﻳﺮ Bﻣﺘﻨﺎﻇﺮ ﻣﻘﺎﺩﻳﺮ Aﻭ Cﺗﻨﻬﺎ ﺑﻪ Aﺑﺴﺘﮕﻲ x3 ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﻭ ﺑﻪt1ﻣﻘﺪﺍﺭ Cﺑﺴﺘﮕﻲ t x
ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﺪ .
ﻓﺎﮔـﻴﻦ ﻧﺸـﺎﻥ ﺩﺍﺩ ﻛﻪ ﺩﺭ ﺭﺍﺑﻄﻪ ) R(A,B,Cﻭﺍﺑﺴﺘﮕﻲ ﭼﻨﺪﻣﻘﺪﺍﺭﻱ A →→ Bﻭﺟﻮﺩ ﺩﺍﺭﺩ ﺍﮔﺮ ﻭ ﻓﻘﻂ ﺍﮔﺮ ﻭﺍﺑﺴﺘﮕﻲ ﭼـﻨﺪﻣﻘﺪﺍﺭﻱ A →→ Cﻧﻴـﺰ ﺑﺮﻗـﺮﺍﺭ ﺑﺎﺷـﺪ .ﺑـﻪ ﺑـﻴﺎﻥ ﺩﻳﮕـﺮ ﺩﺭ ﻳـﻚ ﺭﺍﺑﻄـﻪ ﺑﺎ ﺳﻪ ﺻﻔﺖ ﺧﺎﺻﻪ ،ﻫﻤﻴﺸﻪ ﻭﺍﺑﺴﺘﮕﻲ ﭼﻨﺪ ﻣﻘﺪﺍﺭﻱ ﺑﺼﻮﺭﺕ ﺟﻔﺖ ﻭﺟﻮﺩ ﺩﺍﺭﺩ .
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٦ /
♦ ﺗﻌﺮﻳﻒ :ﺭﺍﺑﻄـﻪﺍﻱ ﺭﺍ 4NFﮔﻮﻳﻨﺪ ﺍﮔﺮ ﻭ ﻓﻘﻂ ﺍﮔﺮ ﻳﻚ ﻭﺍﺑﺴﺘﮕﻲ ﭼﻨﺪﻣﻘﺪﺍﺭﻱ ﻣﺜﻞ A →→ Bﺩﺭ Rﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷـﺪ ﺗﻤـﺎﻡ ﺻـﻔﺎﺕ ﺧﺎﺻـﻪ Rﺑﺎ Aﻭﺍﺑﺴﺘﮕﻲ ﺗﺎﺑﻌﻲ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ .ﺑﻪ ﺑﻴﺎﻥ ﺩﻳﮕﺮ ﻫﻤﻪ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﻣﻮﺟﻮﺩ ﺩﺭ Rﺑﺼﻮﺭﺕ K → Xﺑﺎﺷـﻨﺪ ) .ﻳﻌﻨـﻲ ﻳـﻚ ﻭﺍﺑﺴـﺘﮕﻲ ﺗﺎﺑﻌـﻲ ﺑـﻴﻦ ﺻـﻔﺎﺕ ﺧﺎﺻـﻪ Xﻭ ﻛﻠـﻴﺪ ﻛﺎﻧﺪﻳﺪ . ( Kﺑﺮ ﺍﺳﺎﺱ ﺍﻳﻦ ﺗﻌﺮﻳﻒ ﻣـﻲ ﺗـﻮﺍﻥ ﻧﺘﻴﺠﻪ ﮔﺮﻓﺖ :ﺭﺍﺑﻄﻪ Rﺑﺎ ﺳﻪ ﺻﻔﺖ ﺧﺎﺻﻪ ﺩﺭ ﭼﻬﺎﺭﻣﻴﻦ ﺻﻮﺭﺕ ﻧﺮﻣﺎﻝ ﺍﺳﺖ ﺍﮔﺮ BCNFﺑﺎﺷﺪ ﻭ ﺗﻤﺎﻡ MVDﻫﺎﻱ ﺁﻥ FDﺑﺎﺷﻨﺪ . ﻣﻲﺑﻴﻨﻴﻢ ﺭﺍﺑﻄﻪ 4NF ، CTXﻧﻴﺴﺖ ﺯﻳﺮﺍ ﻳﻚ MVDﺩﺍﺭﺩ ﻛﻪ FDﻧﻴﺴﺖ ). ( C →→X ﺍﮔﺮ CTXﺭﺍ ﺑﻪ ﺩﻭ ﺭﺍﺑﻄﻪ CTﻭ CXﺗﺠﺰﻳﻪ ﻛﻨﻴﻢ CTﻭ CXﺭﺍﺑﻄﻪ 4NFﻫﺴﺘﻨﺪ . -٦-٤-٦ﺭﺍﺑﻄﻪ 5NF
•
ﺗﻌﺮﻳﻒ ﻭﺍﺑﺴﺘﮕﻲ ﭘﻴﻮﻧﺪﻱ Join Dependency:
ﺍﮔﺮ Rﻳﻚ ﺭﺍﺑﻄﻪ ﻭ ﺳﺘﻮﻧﻬﺎﻱ ﻫﺮﻳﻚ ﺍﺯ ﺭﺍﺑﻄﻪ ﻫﺎﻱ Rn,…R2,R1ﺯﻳﺮﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﺳﺘﻮﻧﻬﺎﻱ Rﺑﺎﺷﻨﺪ ،ﺁﻧﮕﺎﻩ Rﺩﺍﺭﺍﻱ ﻭﺍﺑﺴﺘﮕﻲ ﭘﻴﻮﻧﺪﻱ ﺭﻭﻱ Rn,…R2,R1ﺍﺳﺖ ﺍﮔﺮ ﻭ ﺗﻨﻬﺎ ﺍﮔﺮ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ : R = R1 ∝R2 ∝R3 …..∝Rn
•
ﺭﺍﺑﻄﻪ 5NF
ﺭﺍﺑﻄﻪ Rﺭﺍ 5NFﮔﻮﻳﻨﺪ ﺍﮔﺮ ﻭ ﺗﻨﻬﺎ ﺍﮔﺮ ﻓﻘﻂ ﺑﻪ ﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪﺵ ﻭﺍﺑﺴﺘﮕﻲ ﭘﻴﻮﻧﺪﻱ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ .ﺑﻌﺒﺎﺭﺗﻲ ﺩﻳﮕﺮ ﻭﺟﻮﺩ ﻫﺮ ﻭﺍﺑﺴﺘﮕﻲ ﭘﻴﻮﻧﺪﻱ ﺩﺭ ﺁﻥ ﻧﺎﺷﻲ ﺍﺯ ﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﺑﺎﺷﺪ.ﺍﺯ ﺍﻳﻦ ﺗﻌﺮﻳﻒ ﺍﻳﻦ ﻧﺘﻴﺠﻪ ﺑﺪﺳﺖ ﻣﻲ ﺁﻳﺪ ﻛﻪ ﺍﮔﺮ ﺑﺘﻮﺍﻧﻴﻢ ﻳﻚ ﻭﺍﺑﺴﺘﮕﻲ ﻳﻮﻧﺪﻱ ﺩﺭ ﺭﺍﺑﻄﻪ Rﭘﻴﺪﺍ ﻛﻨﻴﻢ ﻛﻪ ﺩﺭ ﻫﻤﻪ ﭘﺮﺗﻮﻫﺎﻳﺶ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺭﺍﺑﻄﻪ ﻭﺟﻮﺩ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺭﺍﺑﻄﻪ 5NFﻧﻴﺴﺖ. ﺩﻳﺖ ﻭ ﻓﺎﮔﻴﻦ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺍﻧﺪ ﻛﻪ : ﺍﮔﺮ ﺭﺍﺑﻄﻪ ﺍﻱ 3NFﺑﺎﺷﺪ ﻭ ﺗﻤﺎﻡ ﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﺁﻥ ﺻﻔﺎﺕ ﺳﺎﺩﻩ ﺑﺎﺷﻨﺪ ﺁﻥ ﺭﺍﺑﻄﻪ 5NFﺍﺳﺖ. ﺍﮔﺮ ﺭﺍﺑﻄﻪ ﺍﻱ BCNFﺑﺎﺷﺪ ﻭﺣﺪﺍﻗﻞ ﻳﻜﻲ ﺍﺯﻛﻠﻴﺪﻫﺎﻱ ﻛﺎﻧﺪﻳﺪ ﺁﻥ ﺻﻔﺎﺕ ﺳﺎﺩﻩ ﺑﺎﺷﻨﺪ ﺁﻥ ﺭﺍﺑﻄﻪ 4NFﺍﺳﺖ.
ﻣﺮﺍﺣﻞ ﻧﺮﻣﺎﻟﺘﺮ ﺳﺎﺯﻱ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٧ /
-٥-٦ﺗﺠﺰﻳﻪ ﺧﻮﺏ ﻭ ﺑﺪ ﺩﺭ ﻓـﺮﺍﻳﻨﺪ ﻧﺮﻣﺎﻟﺘﺮﺳـﺎﺯﻱ ﻣـﻮﺍﺭﺩﻱ ﻭﺟـﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﺩﺭ ﺁﻧﻬﺎ ﺗﺠﺰﻳﻪ ﻳﻚ ﺭﺍﺑﻄﻪ ﺑﻪ ﭼﻨﺪ ﮔﻮﻧﻪ ﺍﻣﻜﺎﻥﭘﺬﻳﺮ ﺍﺳﺖ .ﻃﺮﺍﺡ ﺑﺎﻳﺴﺘﻲ ﺗﺠﺰﻳﻪ ﺧﻮﺏ ﻭ ﺑﺪ ﺭﺍ ﺑﺎﺯ ﺷﻨﺎﺳﺪ .ﺑﻌﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺭﺍﺑﻄﻪ S ECONDﺭﺍ ﺩﺭ ﻧﻈﺮ ﻣﻲﮔﻴﺮﻳﻢ : )SECOND(S#, CITY,STATUS ﻭﺍﺑﺴﺘﮕﻲﻫﺎﻱ ﺗﺎﺑﻌﻲ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺑﻔﺮﻡ S# → STATUS ، CITY → STATUS ، S# → CITYﻣﻲﺑﺎﺷﺪ .
ﻗـﺒ ﹰ ﻼ ﺍﻳـﻦ ﺭﺍﺑﻄـﻪ ﺑـﻪ ﺩﻭ ﺭﺍﺑﻄـﻪ ) S C(S#, Cityﻭ ) C S(City, Statusﺗﺠـﺰﻳﻪ ﺷﺪ .ﺍﻳﻦ ﺗﺠﺰﻳﻪ ﺗﻨﻬﺎ ﺗﺠﺰﻳﻪ ﻣﻤﻜﻦ ﻧﻴﺴﺖ ﺑﻠﻜﻪ ﺗﺠﺰﻳﻪﻫﺎﻱ ﺩﻳﮕﺮﻱ ﻣﺘﺼﻮﺭ ﺍﺳﺖ : )SC(S#, City )SS(S#, Status
B:
)SS(S#, Status )CS(City, Status
C :
ﻛﺪﺍﻣﻴﻚ ﺍﺯ ﺍﻳﻦ ﺳﻪ ﺗﺠﺰﻳﻪ ﺭﺍ ﺑﺎﻳﺪ ﺍﻧﺘﺨﺎﺏ ﻛﺮﺩ ؟ ﻼ ﻧﻤﻲﺗﻮﺍﻥ ﺍﻳﻦ ﺍﻃﻼﻉ ﺭﺍ ﻛﻪ ﺷﻬﺮ ﺧﺎﺻﻲ ﺩﺍﺭﺍﻱ ﺗﺠـﺰﻳﻪ Bﻣﻄﻠﻮﺑـﻴﺖ ﺍﻭﻟـﻴﻪ ﺭﺍ ﻧـﺪﺍﺭﺩ ﺯﻳﺮﺍ ﻣﺸﻜﻼﺗﻲ ﺩﺭ ﺁﻥ ﻭﺟﻮﺩ ﺩﺍﺭﺩ .ﻣﺜ ﹰ ﻣﻘـﺪﺍﺭ ﻭﺿـﻌﻴﺖ ﺧﺎﺻـﻲ ﺍﺳـﺖ ﺩﺭ ﺑﺎﻧـﻚ ﺩﺭﺝ ﻛـﺮﺩ ﺗـﺎ ﺯﻣﺎﻧـﻴﻜﻪ ﻧﺪﺍﻧﻴﻢ ﭼﻪ ﺗﻬﻴﻪﻛﻨﻨﺪﻩﺍﻱ ﺩﺭ ﺁﻥ ﺷﻬﺮ ﺳﺎﻛﻦ ﺍﺳﺖ .ﺍﺯ ﻧﻈﺮ ﺗـﺌﻮﺭﻱ ﺗﺠـﺰﻳﻪﺍﻱ ﺑﻬﺘـﺮ ﺍﺳـﺖ ﻛﻪ ﺩﻭ ﺭﺍﺑﻄﻪ ﺣﺎﺻﻞ ﺍﺯ ﺁﻥ ﺍﺯ ﻫﻢ ﻣﺴﺘﻘﻞ ﺑﺎﺷﻨﺪ .ﺍﮔﺮ ﺭﺍﺑﻄﻪ Rﺑﻪ ﺩﻭ ﺭﺍﺑﻄﻪ R1ﻭ R2ﺗﻘﺴﻴﻢ ﺷﻮﺩ ﮔﻮﺋﻴﻢ R1ﻭ R2ﺍﺯ ﻫﻢ ﻣﺴﺘﻘﻠﻨﺪ ﺍﮔﺮ ﺷﺮﺍﻳﻂ ﻗﻀﻴﻪ ﺭﻳﺴﺎﻧﻦ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ : -١-٥-٦ﻗﻀﻴﻪ ﺭﻳﺴﺎﻧﻦ : ﺍﮔﺮ R1ﻭ R2ﺩﻭ ﭘﺮﺗﻮ ﻣﺴﺘﻘﻞ ﺍﺯ Rﺑﺎﺷﻨﺪ ،ﺍﻳﻦ ﺩﻭ ﭘﺮﺗﻮ ﺍﺯ ﻳﻜﺪﻳﮕﺮ ﻣﺴﺘﻘﻠﻨﺪ ﺍﮔﺮ ﻭ ﻓﻘﻂ ﺍﮔﺮ .١ﺗﻤﺎﻡ ﻭﺍﺑﺴﺘﮕﻲﻫﺎﻱ ﺗﺎﺑﻌﻲ ﻣﻮﺟﻮﺩ ﺩﺭ ﺭﺍﺑﻄﻪ Rﺩﺭ R1ﻭ R2ﺑﺎ ﻫﻢ ﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ ﻭ ﻳﺎ ﺍﺯ ﻭﺍﺑﺴﺘﮕﻲﻫﺎﻱ ﻣﻮﺟﻮﺩ ﺩﺭ R1ﻭ R2ﻣﻨﻄﻘﹰﺎ ﻗﺎﺑﻞ ﺍﺳﺘﻨﺘﺎﺝ ﺑﺎﺷﻨﺪ . ﻼ ﺩﺭ ﻳﻜﻲ ﺍﺯ ﺁﻧﻬﺎ ﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺑﺎﺷﺪ . .٢ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻣﺸﺘﺮﻙ ﺩﺭ R1ﻭ R2ﺍﻗ ﹰ ﺑﺎﺗﻮﺟﻪ ﺑﻪ ﻗﻀﻴﻪ ﺭﻳﺴﺎﻧﻦ ﻣﻲﺑﻴﻨﻴﻢ ﺗﺠﺰﻳﻪ ﺍﻭﻟﻴﻪ ،ﺗﺠﺰﻳﻪ ﺧﻮﺑﻲ ﺍﺳﺖ ﺯﻳﺮﺍ CITYﺻﻔﺖ ﺧﺎﺻﻪ ﻣﺸﺘﺮﻙ ﺩﺭ ﻳﻜﻲ ﺍﺯ ﺭﺍﺑﻄﻪ ﻫﺎ ﻳﻌﻨﻲ csﻛﻠﻴﺪ ﻛﺎﻧﺪﻳﺪ ﺍﺳﺖ ﻭ ﺗﻤﺎﻡ ﻭﺍﺑﺴﺘﮕﻲ ﻫﺎﻱ ﺗﺎﺑﻌﻲ ﻗﺎﺑﻞ ﺍﺳﺘﻨﺘﺎﺝ ﻫﺴﺘﻨﺪ. S# → City City → Status
ﻭ S# → Statusﻣﻨﻄﻘﹰﺎ ﻗﺎﺑﻞ ﺍﺳﺘﻨﺘﺎﺝ ﺍﺳﺖ .
ﺑﺮﺭﺳﻲ ﺗﺠﺰﻳﻪ : Bﺩﺭ ﺍﻳﻦ ﺗﺠﺰﻳﻪ ﺩﺍﺭﻳﻢ S# → Cityﻭ S# → Statusﻭ ﻧﻤﻲﺗﻮﺍﻥ ﻭﺍﺑﺴﺘﮕﻲ City → Statusﺭﺍ ﺍﺯ ﺍﻳﻦ ﺩﻭ ﻭﺍﺑﺴﺘﮕﻲ ﻣﻨﻄﻘﹰﺎ ﺍﺳﺘﻨﺘﺎﺝ ﻛﺮﺩ . ﻻﺯﻡ ﺑﻪ ﺫﻛﺮ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﺗﺠﺰﻳﻪ ﻳﻚ ﺷﻤﺎ ) ( Schemaﺑﻪ ﭼﻨﺪ ﺷﻤﺎﻱ ﻛﻮﭼﻜﺘﺮ ﺑﺎﻳﺪ ﺗﺠﺰﻳﻪ ﺑﺪﻭﻥ ﮔﻤﺸﺪﮔﻲ ﺍﻃﻼﻋﺎﺕ ﺑﺎﺷﺪ ﻳﻌﻨﻲ ﺑﺎﺯﺍﻱ ﺗﻤﺎﻡ ﺟﺪﺍﻭﻝ ﻣﺮﺑﻮﻃﻪ ﺍﺯ ﭘﻴﻮﻧﺪ ﻃﺒﻴﻌﻲ ﺁﻥ ﺟﺪﺍﻭﻝ ﺩﻗﻴﻘﹰﺎ ﺟﺪﺍﻭﻝ ﺍﺻﻠﻲ ﺑﺪﺳﺖ ﺁﻳﺪ .
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٨ /
-٢-٥-٦ﺭﺍﺑﻄﻪ ﺍﺗﻤﻴﻚ: ﺭﺍﺑﻄـﻪﺍﻱ ﻛﻪ ﺑﻪ ﻋﻨﺎﺻﺮ ﻣﺴﺘﻘﻞ ﺗﺠﺰﻳﻪ ﻧﺸﻮﺩ )ﻃﺒﻖ ﺭﺍﺑﻄﻪ ﺭﻳﺴﺎﻧﺲ ( ﺑﻪ ﺭﺍﺑﻄﻪ ﺍﺗﻤﻴﻚ ﻣﻮﺳﻮﻡ ﺍﺳﺖ .ﺍﺗﻤﻴﻚ ﺑﻮﺩﻥ ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﺎ ﻧﻴﺴـﺖ ﻛﻪ ﻧﺒﺎﻳﺪ ﺗﺠﺰﻳﻪ ﺷﻮﺩ ﻭﻟﻲ ﻟﺰﻭﻣﻲ ﺑﻪ ﺗﺠﺰﻳﻪ ﺁﻧﻬﺎ ﻧﻴﺴﺖ ﻳﻌﻨﻲ ﺩﺭ ﺻﻮﺭﺕ ﺗﺠﺰﻳﻪ ﻣﻤﻜﻦ ﺍﺳﺖ ﺑﻪ ﺭﺍﺑﻄﻪ ﻧﺮﻣﺎﻟﺘﺮﻱ ﻧﺮﺳﻴﺪ .ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ : ) S( S#, Sname, Status, Cityﻣﻲﺗﻮﺍﻧﺪ ﺑﻪ ﺩﻭ ﺭﺍﺑﻄﻪ ) SX(S#, Sname, Statusﻭ ) SY(S#, Cityﺗﺠﺰﻳﻪ ﺷﻮﺩ ﻛﻪ ﺍﺯ ﻧﻈﺮ ﻧﺮﻣﺎﻟﻴﺘﻲ ﻓﺮﻗﻲ ﻧﺪﺍﺭﺩ ﻭ ﻣﻤﻜﻦ ﺍﺳﺖ ﺑﺪﻻﻳﻞ ﺩﻳﮕﺮ ﺗﺠﺰﻳﻪ ﺷﺪﻩ ﺑﺎﺷﺪ . -٦-٦ﻧﻤﻮﻧﻪ ﻣﺴﺎﺋﻞ ﺍﻳﻦ ﻓﺼﻞ : ﻣﺠﻤﻮﻋﻪ ﺣﺪﺍﻗﻞ FDﻫﺎﻱ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﻳﺪ . L
ﺣﻞ :ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻧﻤﻮﺩﺍﺭ FDﻫﺎ ﺩﺍﺭﻳﻢ : 4. N → Q )5.N → (L,M 6. M → Q
P
1. P → N 2. N → L 3. P → L
N M
Q
FDﺷﻤﺎﺭﻩ 3ﺍﻓﺰﻭﻧﻪ ﺍﺳﺖ ﺯﻳﺮﺍ ﻣﻨﻄﻘﹰﺎ ﺍﺯ FDﻫﺎﻱ 1ﻭ 2ﻗﺎﺑﻞ ﺍﺳﺘﻨﺘﺎﺝ ﺍﺳﺖ .ﺍﺯ FDﺷﻤﺎﺭﻩ 2ﻭ 5ﺩﺍﺭﻳﻢ :
7. N → M
ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ FDﻫﺎﻱ 7ﻭ FD ، 6ﺷﻤﺎﺭﻩ 4ﺍﻓﺰﻭﻧﻪ ﺍﺳﺖ ،ﺑﻨﺎﺑﺮﺍﻳﻦ ﻣﺠﻤﻮﻋﻪ ﺣﺪﺍﻗﻞ FDﻫﺎ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ : P → N
ﻭN → L
ﻭN→ M
ﻭ M→ Q
L
N
M
P
Q
-٢ﺩﺭ ﻧﻤﻮﺩﺍﺭ FDﻫﺎﻱ ﺯﻳﺮ ﻣﺠﻤﻮﻋﻪ ﺣﺪﺍﻗﻞ FDﻫﺎ ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﻳﺪ . 1. (X,Y) → Z 2. Y → Z 3. T → U 4. U → Y 5. T → Z
FDﺷﻤﺎﺭﻩ ٥ﺍﻓﺰﻭﻧﻪ ﺍﺳﺖ . FDﺷﻤﺎﺭﻩ ١ﻧﻴﺰ ﺍﻓﺰﻭﻧﻪ ﺍﺳﺖ .ﭼﺮﺍ ؟ ﭘﺲ ﺩﺍﺭﻳﻢ , Y → Z : ] ﭼﻮﻥ ﺍﺯ Z
Z
Y
X
U
T
T→ U
→ Yﻣﻲﺗﻮﺍﻥ ﻧﺘﻴﺠﻪ ﮔﺮﻓﺖ (X,Y) → Zﺯﻳﺮﺍ ﺍﮔﺮ (X,Y) → Zﻳﻌﻨﻲ) (X1 ,Y1 , Z١ﻭ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
) ( X1, Y1 , Z٢ﻭ ﭼﻮﻥ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ٩٩ /
) (Y1, Z2) , (Y1, Z1ﻟﺬﺍ Y→Zﺧﻼﻑ ﻓﺮﺽ ﺍﺳﺖ ﭘﺲ [ Y→Z
-٣ﺭﺍﺑﻄﻪ ) R(A,B,Cﺭﺍ ﺩﺭ ﻧﻈﺮ ﻣﻲﮔﻴﺮﻳﻢ .ﺩﺭ ﻳﻚ ﻟﺤﻈﻪ ﺍﺯ ﺣﻴﺎﺕ ﺭﺍﺑﻄﻪ ،ﺑﺴﻂ ﺁﻥ ﭼﻨﻴﻦ ﺍﺳﺖ ﻓﺮﺽ ﻛﻨﻴﻢ ﻛﻪ ﺍﻳﻦ ﺭﺍﺑﻄﻪ ﺑﺎﻳﺪ ﺗﺠﺰﻳﻪ ﺷﻮﺩ ﭼﮕﻮﻧﻪ ﺑﺎﻳﺪ ﺁﻧﺮﺍ ﺗﺠﺰﻳﻪ ﻛﺮﺩ ؟
C c3 c6 c2
A a1 a3 a3
C c3 c6 c2
B b2 b2 b4
B b2 b2 b4
A a1 a3 a3
A B C a1 b2 c3 a3 b2 c6 a3 b4 c2
Join
C c3 c6 c2
B b2 b2 b4
A a1 a3 a3
BC ∞ AC
C c3 c6 c3 c6 c2
A B a1 b2 a1 b2 ﺍﻓﺰﻭﻧﻪ b2 ﺗﺎﭘﻞ a3 a3 b2 a3 b4 C c3 c6 c2 c6 c2
B b2 b2 b2 b4 b4
AB ∞ AC
A a1 a3 a3 a3 a3
ﻣــﻲ ﺑﻴﻨــﻴﻢ ﻛــﻪ ﺗﺠــﺰﻳﻪ Rﺑﺼــﻮﺭﺕ ) R :(AB,ACﻳــﺎ )R :(AB,BCﻣﻨﺎﺳــﺐ ﻧﻴﺴــﺖ ﺯﻳــﺮﺍ ﺑــﺎ ﭘــﻴﻮﻧﺪ ﺗﺠــﺰﻳﻪﻫــﺎ ﺗﺎﭘـﻞ ﺍﻓـﺰﻭﻧﻪ ﺑـﺮﻭﺯ ﻣـﻲﻛـﻨﺪ ﺍﻣﺎ ﺩﺭ ﺗﺠﺰﻳﻪ ) R : (BC,ACﺍﻳﻦ ﭘﺪﻳﺪﻩ ﻧﺎﻣﻄﻠﻮﺏ ﺭﺍ ﺩﺭ ﭘﻲ ﻧﺪﺍﺭﺩ ﻟﺬﺍ ﺍﻳﻦ ﺗﺠﺰﻳﻪ ﻣﻨﺎﺳﺐ ﺍﺳﺖ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٠ /
ﻓﺼﻞ ﻫﻔﺘﻢ : ﻣﻌﻤﺎﺭﻱ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ
:
-١-٣ﻣﻘﺪﻣﻪ : ﻣـﻲ ﺩﺍﻧـﻴﻢ ﻃـﺮﺍﺡ ﺑﺎﻧـﻚ ،ﺗﺼـﻮﺭ ﻳﺎ ﺩﺭﻙ ﺧﻮﺩ ﺭﺍ ﺍﺯ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ )ﺟﻬﺎﻥ ﻭﺍﻗﻌﻲ( ﻭ ﺩﺭ ﻭﺍﻗﻊ ﺩﻳﺪ ﺧﻮﺩ ﺭﺍ ﺍﺯ ﺩﺍﺩﻩ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗـﻲ ﻣﺤـﻴﻂ ﺑﺼـﻮﺭﺕ ﻧﻤـﻮﺩﺍﺭ E/Rﻣﺘﺠﻠـﻲ ﻣـﻲ ﺳﺎﺯﺩ .ﺍﻳﻦ ﻧﻤﻮﺩﺍﺭ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﺑﺎﻧﻚ ﺩﺭ ﺑﺎﻻﺗﺮﻳﻦ ﺳﻄﺢ ﺍﻧﺘﺰﺍﻉ ﻣﻲ ﺑﺎﺷﺪ ﻭ ﺍﺯ ﺳﻮﻳﻲ ﺩﻳﮕﺮ ﻣﺤﻴﻂ ﻓﻴﺰﻳﻜﻲ ﺑﺎﻧﻚ ﻛﻪ ﭘﺎﻳﻴﻦ ﺗﺮﻳﻦ ﻭ ﻋﻴﻨﻲ ﺗﺮﻳﻦ ﺳﻄﺢ ﺑﺎﻧﻚ ﺍﺳﺖ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺳﺖ ﺍﺯ ﻓﺎﻳﻠﻬـﺎ ﺑﺎ ﺳﺎﺧﺘﺎﺭ ﻣﺸﺨﺺ ﻭ ﺍﺭﺗﺒﺎﻃﺎﺕ ﺑﻴﻦ ﺁﻧﻬﺎ ،ﻟﺬﺍ ﺑﺎﻳﺴﺘﻲ ﺑﻴﻦ ﺑﺎﻻﺗﺮﻳﻦ ﺳﻄﺢ ﺍﻧﺘﺰﺍﻋﻲ ﻭ ﭘﺎﻳﻴﻦ ﺗﺮﻳﻦ ﺳﻄﺢ ﻋﻴﻨﻲ ﺁﻥ ﺳﻄﻮﺡ ﻭﺍﺳـﻄﻲ ﻭﺟـﻮﺩ ﺩﺍﺷﺘﻪ ﻛﻪ ﺩﺭ ﺍﻳﻦ ﺳﻄﻮﺡ ﻭﺍﺳﻂ ﺩﺍﺩﻩ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﻣﺤﻴﻂ ﻫﻢ ﺑﺼﻮﺭﺗﻲ ﻛﻪ ﻃﺮﺍﺡ ﻣﻲ ﺑﻴﻨﺪ ﻭ ﻫﻢ ﺑﺼﻮﺭﺗﻲ ﻛﻪ ﻫﺮ ﻳﻚ ﺍﺯ ﻛﺎﺭﺑﺮﺍﻥ ﺑﻪ ﻧﺤﻮﻱ ﺗﻌﺮﻳﻒ ﺷﻮﻧﺪ. ﺑـﺎ ﺍﻳـﻦ ﺗﻮﺻـﻴﻒ ﺩﺭ ﻣﻲ ﻳﺎﺑﻴﻢ ﻛﻪ ﻳﻚ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺳﻴﺴﺘﻤﻲ ﺍﺳﺖ ﭼﻨﺪ ﺳﻄﺤﻲ ﻛﻪ ﻃﺒﻌﹰﺎ ﻣﻌﻤﺎﺭﻱ ﺧﺎﺹ ﺧﻮﺩ ﺭﺍ ﺩﺍﺭﺩ .ﺍﺯ ﺁﻧﺠﺎﻳـﻴﻜﻪ ﻃﺮﺍﺣﺎﻥ ﻣﺨﺘﻠﻒ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﺑﺎﻧﻜﻲ ﻃﺮﺣﻬﺎﻱ ﻣﺘﻔﺎﻭﺗﻲ ﺑﺮﺍﻱ ﻣﻌﻤﺎﺭﻱ ﭼﻨﻴﻦ ﺳﻴﺴﺘﻤﻲ ﺍﺭﺍﺋﻪ ﻭ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﻛﺮﺩﻩ ﺍﻧﺪ ﻟﺬﺍ ANSIﻧﻴﺰ ﻃﺮﺣﻲ ﺍﺳﺘﺎﻧﺪﺍﺭﺩ ﺑﺮﺍﻱ ﻣﻌﻤﺎﺭﻱ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻋﺮﺿﻪ ﻛﺮﺩﻩ ﺍﺳﺖ. -٢-٧ﻣﻌﻤﺎﺭﻱ ANSI
ﻣﻌﻤﺎﺭﻱ ANSIﺑﻪ ﺳﻪ ﺳﻄﺢ ﻣﺨﺘﻠﻒ ﺗﻘﺴﻴﻢ ﺑﻨﺪﻱ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺑﻪ ﺗﺮﺗﻴﺐ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ :ﺳﻄﺢ ﺩﺍﺧﻠﻲ ،ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﻭ ﺳﻄﺢ ﺧﺎﺭﺟﻲ .ﺷﻜﻞ ﺯﻳﺮ ﺑﻴﺎﻧﮕﺮ ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﺍﺳﺖ: HL + DSL
HL + DSL External View B
HL DSL
External Level
HL DSL External View A
DBMS External/conceptual Mapping Conceptual View Conceptual/internal Mapping Stored data base )(internal view
Schema A
DBA
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠١ /
ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﺩﺭ ﺷﻜﻞ ﺩﻳﺪﻩ ﻣﻲ ﺷﻮﺩ ﻣﻌﻤﺎﺭﻱ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺯ ﺍﺟﺰﺍﺀ ﺯﻳﺮ ﺗﺸﻜﻴﻞ ﺷﺪﻩ ﺍﺳﺖ HL – ١ﺯﺑﺎﻥ ﻣﻴﺰﺑﺎﻥ - ٢ﺯﺑﺎﻥ ﻓﺮﻋﻲ ﺩﺍﺩﻩ ﺍﻱ DSL – ٣ﺩﻳﺪ ﺧﺎﺭﺟﻲ External View – ٤ﺩﻳﺪ ﻣﻔﻬﻮﻣﻲ Conceptual View – ٥ﺩﻳﺪ ﺩﺍﺧﻠﻲ Internal View – ٦ﺗﺒﺪﻳﻼﺕ ﺑﻴﻦ ﺳﻄﻮﺡ mapping – ٧ﻛﺎﺭﺑﺮ User – ٨ﺍﺩﺍﺭﻩ ﻛﻨﻨﺪﻩ ﭘﺎﻳﮕﺎﻩ DBA – ٩ﺳﻴﺴﺘﻢ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ DBMS
-٣-٧ﺷﺮﺡ ﺍﺟﺰﺍﺀ ﻣﻌﻤﺎﺭﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ: – ١-٣-٧ﺩﻳﺪ ﻣﻔﻬﻮﻣﻲ )ﺍﺩﺭﺍﻛﻲ( ﺩﻳـﺪ ﻃـﺮﺍﺡ ﺑﺎﻧﻚ ﺍﺯ ﺩﺍﺩﻩ ﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺩﺭ ﺁﻥ ﻣﻲ ﺑﺎﺷﺪ .ﺍﻳﻦ ﺩﻳﺪ ﺩﻳﺪﻱ ﺟﺎﻣﻊ ﻭ ﺳﺮﺍﺳﺮﻱ ﻣﻲ ﺑﺎﺷﺪ ،ﻳﻌﻨﻲ ﺟﺎﻣﻊ ﺗﻤﺎﻡ ﻧـﻴﺎﺯﻫﺎﻱ ﻛﺎﺭﺑـﺮﺍﻥ ﺍﺳـﺖ .ﺍﻳﻦ ﺩﻳﺪ ﺗﺸﻜﻴﻞ ﺩﻫﻨﺪﻩ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﻭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﺍﺯ ﺳﻄﻮﺡ ﺍﻧﺘﺰﺍﻋﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ
ﺍﺳﺖ.
ﺩﻳـﺪ ﺍﺩﺭﺍﻛﻲ ﺑﺎﻳﺪ ﺑﻪ ﻛﻤﻚ ﺍﻣﻜﺎﻧﺎﺗﻲ ﻧﻈﻴﺮ ﺍﺣﻜﺎﻡ ﺗﻌﺮﻳﻒ ﻛﻨﻨﺪﻩ ﺍﺯ ﺍﻳﻦ ﺯﺑﺎﻥ ﺩﺍﺩﻩ ﺍﻱ ﻭ ﺳﺎﺧﺘﺎﺭ ﺩﺍﺩﻩ ﺍﻱ ﺗﻌﺮﻳﻒ ﺷﻮﺩ ﻛﻪ ﺑﻪ ﺗﻌـﺮﻳﻒ ﺁﻥ ﺷـﻤﺎﻱ ﺍﺩﺭﺍﻛـﻲ ﮔﻔـﺘﻪ ﻣـﻲ ﺷـﻮﺩ .ﺩﺭ ﻭﺍﻗﻊ ﺷﻤﺎﻱ ﺍﺩﺭﺍﻛﻲ ﺩﺭ ﻣﻌﻨﺎﻱ ﻋﺎﻡ ﻧﻮﻋﻲ ﺑﺮﻧﺎﻣﻪ ﺣﺎﻭﻱ ﺗﻌﺮﻳﻒ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﺍﺭﺗـﺒﺎﻃﺎﺕ ﺑـﻴﻦ ﺁﻧﻬـﺎ ﻭ ﻧﻴـﺰ ﻣﺠﻤـﻮﻋﻪ ﺍﻱ ﺍﺯ ﻗـﻮﺍﻋﺪ ﻋﻤﻠﻴﺎﺗﻲ ﻣﻲ ﺑﺎﺷﺪ .ﺍﻳﻦ ﻗﻮﺍﻋﺪ ﻋﻤﻠﻴﺎﺗﻲ ﻧﺎﻇﺮ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎﻱ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﻫﺴـﺘﻨﺪ .ﺍﺯ ﺟﻤﻠـﻪ ﺳـﺎﺧﺘﺎﺭﻫﺎﻱ ﺩﺍﺩﻩ ﺍﻱ ﺭﺍﻳـﺞ ﺑـﺮﺍﻱ ﺗﻌﺮﻳﻒ ﺷﻤﺎﻱ ﺍﺩﺭﺍﻛﻲ ﻣﻲ ﺗﻮﺍﻥ ﺑﻪ ﺳﺎﺧﺘﺎﺭﻫﺎﻳﻲ ﻧﻈﻴﺮ ﺭﺍﺑﻄﻪ ﺍﻱ ،ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺒﻲ ،ﺷﺒﻜﻪ ﺍﻱ ﻭ ﻫﺎﻳﭙﺮﮔﺮﺍﻑ ﺍﺷﺎﺭﻩ ﻧﻤﻮﺩ. ﻣﺜﺎﻝ (١ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺭﺍﺑﻄﻪ ﺑﻴﻦ ﻗﻄﻌﻪ ﻭ ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﺑﻪ ﻛﻤﻚ ﺍﺣﻜﺎﻡ ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺒﻲ ﺩﻳﺪ ﺍﺩﺭﺍﻛﻲ ﭘﺎﻳﮕﺎﻩ ﺭﺍ ﺗﻌﺮﻳﻒ ﻛﻨﻴﺪ. N ﺷﻤﺎﺭﻩ
١
ﺷﻤﺎﺭﻩ
ﻧﺎﻡ
ﻧﺎﻡ
ﻗﻄﻌﻪ
ﺗﻬﻴﻪ ﻣﻲ ﻛﻨﺪ
ﺭﻧﮓ
ﻭﺯﻥ
ﺗﻬﻴﻪ ﻛﻨﻨﺪﻩ ﻭﺿﻌﻴﺖ
ﺗﻌﺪﺍﺩ
ﺷﻬﺮ
DSﺳﻠﺴـﻠﻪ ﻣﺮﺍﺗﺒـﻲ ﻧﻮﻋـﻲ ﺩﺭﺧﺘﻮﺍﺭﻩ ﺍﺳﺖ ﻛﻪ ﻳﻚ ﺭﻳﺸﻪ ﺩﺍﺭﺩ ﻭ ﺩﺭ ﺳﻄﻮﺡ ﻣﺨﺘﻠﻒ ﺩﺍﺭﺍﻱ ﺍﻋﻀﺎ ﻳﺎ ﻭﺍﺑﺴﺘﮕﺎﻧﻲ ﻣﻲ ﺑﺎﺷﺪ ﺑﻪ ﺩﻭ ﺻﻮﺭﺕ ﺁﻥ ﺭﺍ ﻣﺪﻝ ﻣﻲ ﻛﻨﻴﻢ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ S type Record
ﺍﻟﻒ:
……..
Sname
type Record
ﺏ: S#
P
…… P# Pname Color
١:n
Qty
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٢ /
١:n
….
P#
….
Qty
S#
ﺗﻮﺟﻪ :ﻓﻴﻠﺪ Qtyﺩﺭ ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺐ PSﺩﺭ Sﻗﺮﺍﺭ ﺩﺍﺭﺩ ﻭ ﺩﺭ ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺐ S Pﺩﺭ .P ﻧﻤﺎﻳﺶ ﺩﻳﺪ ﺍﺩﺭﺍﻛﻲ ﺑﻪ ﻛﻤﻚ DSﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺒﻲ ) :ﺷﻤﺎﻱ ﺍﺩﺭﺍﻛﻲ( ﺍﺯ ﺩﻳـﺪ ﻃﺮﺍﺣـﻲ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﺍﺭﺗﺒﺎﻃﺎﺕ ﺑﺼﻮﺭﺕ ﻳﻚ ﺩﺭﺧﺖ ﺩﻳﺪﻩ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺭﻳﺸﻪ ﺁﻥ ﺣﺎﻭﻱ ﺍﻃﻼﻋﺎﺕ ﺩﺭ ﻣﻮﺭﺩ ﻗﻄﻌﺎﺕ ﻭ ﻭﺍﺑﺴﺘﻪ ﻳﺎ ﻓﺮﺯﻧﺪ ﺁﻥ ﺭﻳﺸﻪ ﺣﺎﻭﻱ ﺍﻃﻼﻋﺎﺗﻲ ﺩﺭ ﻣﻮﺭﺩ ﺗﻬﻴﻪ ﻛﻨﻨﺪﮔﺎﻥ .ﺩﺭ ﺳﺎﺧﺘﺎﺭ ﺩﺍﺩﻩ ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺒﻲ ﺗﻌﺪﺍﺩﻱ ﺩﺭﺧﺘﻮﺍﺭﻩ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﻃﺮﺍﺡ ﺍﻳﻦ ﺳﺎﺧﺘﺎﺭ ﺭﺍ ﺑﻪ DBMSﺍﻱ ﻛﻪ ﺁﻥ ﺭﺍ ﻣﻲ ﭘﺬﻳﺮﺩ ﺧﻮﺍﻫﺪ ﺩﺍﺩ. ﻧﻤﻮﻧﻪ ﺳﺎﺯﻱ ﺍﺯ ﺷﻤﺎﻱ ﺍﺩﺭﺍﻛﻲ ﺑﺼﻮﺭﺕ ﻏﻴﺮ ﺻﻮﺭﻱ: – ١ﻧﺎﻡ ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺐ PSﺍﺳﺖ – ٢ﺭﻳﺸﻪ ﺭﻛﻮﺭﺩ ﻧﻮﻉ Pﺍﺳﺖ ﻭ ﻓﻴﻠﺪﻫﺎﻱ P# ) Pﻛﺎﺭﺍﻛﺘﺮ Pname ، ١ .ﻛﺎﺭﺍﻛﺘﺮ (… ٢ . ﻭ ﺷﻨﺎﺳﻪ ﺭﻳﺸﻪ P#ﺍﺳﺖ. – ٣ﻭﺍﺑﺴﺘﻪ ﻳﺎ ﻓﺮﺯﻧﺪ ﺭﻛﻮﺭﺩ ﻧﻮﻉ Sﻣﻲ ﺑﺎﺷﺪ. ﻓﻴﻠﺪﻫﺎﻱ S# ) Sﻭ ……… ( Qtyﺍﺳﺖ .ﻭ ﺷﻨﺎﺳﻪ S# Sﻣﻲ ﺑﺎﺷﺪ. ﻣﺜﺎﻝ (٢ﭘﺎﻳﮕﺎﻩ ﺭﺍﺑﻄﻪ ﺍﻱ: ﻻ ﺑﺮﺍﻱ ﻫﺮ ﻣﻮﺟﻮﺩﻳﺖ ﻳﻚ ﺟﺪﻭﻝ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺘﻪ ﻣﻲ ﺷﻮﺩ ﻭ ﺑﺮﺍﻱ ﻫﺮ ﺻﻔﺖ ﺩﺭ ﺍﻳﻦ ﺳﺎﺧﺘﺎﺭ ﺑﺮﺍﻱ ﻃﺮﺍﺣﻲ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﻌﻤﻮ ﹰ ﺧﺎﺻﻪ ﻳﻚ ﺳﺘﻮﻥ ﻭ ﻫﺮ ﺳﻄﺮ ﻛﻪ ﺑﻌﺪﹰﺍ ﭘﺮ ﻣﻲ ﺷﻮﺩ ﻳﻚ ﻧﻤﻮﻧﻪ ﻣﻮﺟﻮﺩﻳﺖ ﻣﻲ ﺑﺎﺷﺪ. S
P Weight
Color
Pname
P#
City
Status
Sname
S#
١٠
ﺁﺑﻲ
Pn1
P1
ﺗﻬﺮﺍﻥ
١٠
Sn1
S1
١٥
ﺯﺭﺩ
Pn2
P2
ﻗﺰﻭﻳﻦ
١٥
Sn2
S2
ﺷﻴﺮﺍﺯ
٧
SN3
S3
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
•
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٣ /
ﺑـﺮﺍﻱ ﻧﻤـﺎﻳﺶ ﺍﺭﺗـﺒﺎﻃﺎﺕ ﺑـﻴﻦ ﺩﻭ ﻳـﺎ ﺑـﻴﺶ ﺍﺯ ﺩﻭ ﻣﻮﺟـﻮﺩﻳﺖ ﻳـﻚ ﺭﺍﻩ ﻭ ﺍﻟﺒـﺘﻪ ﺭﺍﻳﺞ ﺗﺮ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﺟﺪﻭﻟﻲ ﺩﻳﮕﺮ ﻃﺮﺍﺣـﻲ ﻣـﻲ ﺷـﻮﺩ ﻭ ﺍﺭﺗـﺒﺎﻃﺎﺕ ﺑـﻪ ﻛﻤـﻚ ﺁﻥ ﻧﻤـﺎﻳﺶ ﺩﺍﺩﻩ ﻣـﻲ ﺷـﻮﺩ .ﺩﺭ ﺍﻳـﻦ ﺟـﺪﻭﻝ ﻧﺸـﺎﻥ ﺩﻫـﻨﺪﻩ ﺍﺭﺗـﺒﺎﻁ ﺑﻴﻦ ﺩﻭ ﻣﻮﺟﻮﺩﻳﺖ ﺷﻨﺎﺳﻪ ﻣﻮﺟﻮﺩﻳﺘﻬﺎﻱ ﻣﺮﺗﺒﻂ ﺁﻭﺭﺩﻩ ﻣﻲ ﺷﻮﺩ.
•
P1ﺗﻮﺳﻂ S1ﺗﻬﻴﻪ ﻣﻲ ﺷﻮﺩ
•
S1
P1ﺭﺍ ﺑﻪ ﺗﻌﺪﺍﺩ ١٠٠ﺗﻬﻴﻪ ﻣﻲ ﻛﻨﺪ. SP
Qty
P# P1
S# S1
٥٠
P2
S2
٥٥
P3
S3
١٠٠
•
ﻫﺮ ﺳﻄﺮ ﺩﺭ ﻋﻴﻦ ﺣﺎﻝ ﻛﻪ ﻧﻤﺎﻳﺸﮕﺮ ﻳﻚ ﻣﻮﺟﻮﺩﻳﺖ ﺍﺳﺖ ﺩﺭ ﻋﻴﻦ ﺣﺎﻝ ﻧﻤﺎﻳﺸﮕﺮ ﻳﻚ ﻧﻤﻮﻧﻪ ﺍﺭﺗﺒﺎﻁ ﻧﻴﺰ ﻣﻲ ﺑﺎﺷﺪ. ﺷﻤﺎﻱ ﺳﺎﺩﻩ ﭘﺎﻳﮕﺎﻩ ﺟﺪﻭﻟﻲ:
( ١ﺍﺳﻢ ﺟﺪﻭﻝ Sﺍﺳﺖ
( ٢ﺍﺳﻢ ﺟﺪﻭﻝ
ﺳﺘﻮﻧﻬﺎﻳﺶ S #ﻛﺎﺭﺍﻛﺘﺮ
•
Pﺍﺳﺖ
ﺳﺘﻮﻧﻬﺎﻳﺶ
P #ﻛﺎﺭﺍﻛﺘﺮ
Snameﻛﺎﺭﺍﻛﺘﺮ
Pnameﻛﺎﺭﺍﻛﺘﺮ
Statusﻋﺪﺩ ﺻﺤﻴﺢ
Weightﻋﺪﺩ ﺍﻋﺸﺎﺭﻱ
Cityﻛﺎﺭﺍﻛﺘﺮ
Colorﻛﺎﺭﺍﻛﺘﺮ
ﺷﻨﺎﺳﻪ ﺟﺪﻭﻝ S
S#ﺍﺳﺖ.
ﺷﻨﺎﺳﻪ ﺟﺪﻭﻝ P
P#ﺍﺳﺖ
( ٣ﺍﺳﻢ ﺟﺪﻭﻝ S Pﺍﺳﺖ ﺳﺘﻮﻧﻬﺎ
S#ﺍﺳﺖ )ﻫﻤﺎﻥ S#ﻛﻪ ﺩﺭ Sﻣﻲ ﺑﺎﺷﺪ( P #ﺍﺳﺖ )ﻫﻤﺎﻥ P#ﻛﻪ ﺩﺭ Pﺍﺳﺖ( Q tyﺍﺳﺖ
ﻧﻜﺘﻪ :ﺷﻨﺎﺳﻪ (S# , P#) SPﺑﺎ ﻫﻢ ﺍﺳﺖ. – ٢-٣-٧ﺩﻳﺪ ﺧﺎﺭﺟﻲ: ﺩﻳﺪ ﻛﺎﺭﺑﺮ ﺧﺎﺹ ﻧﺴﺒﺖ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺩﺭ ﭘﺎﻳﮕﺎﻩ ﺍﺳﺖ ﺩﺭ ﻣﺤﺪﻭﺩﻩ ﻧﻴﺎﺯﻫﺎﻱ ﺍﻃﻼﻋﺎﺗﻲ ﻣﻮﺭﺩ ﻧﻈﺮﺵ . ﺩﻳﺪ ﺧﺎﺭﺟﻲ ﺩﺭ ﺳﻄﺢ ﺧﺎﺭﺟﻲ ﻣﻌﻤﺎﺭﻱ ﺑﺎﻧﻚ ﻣﻄﺮﺡ ﻭ ﺍﺯ ﺳﻄﻮﺡ ﺍﻧﺘﺰﺍﻋﻲ ﺍﺳﺖ .ﺩﻳﺪ ﺧﺎﺭﺟﻲ ﻣﺒﺘﻨﻲ ﺑﺮ ﺩﻳﺪ ﺍﺩﺭﺍﻛﻲ ﺍﺳﺖ ﻳﻌﻨـﻲ ﺑﺮ ﺍﺳﺎﺱ ﺩﻳﺪ ﺍﺩﺭﺍﻛﻲ ﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﺩ .ﺩﻳﺪ ﺧﺎﺭﺟﻲ ﻧﻴﺰ ﺑﺮﺍﻱ ﻣﻌﺮﻓﻲ ﺷﺪﻥ ﻧﻴﺎﺯ ﺑﻪ ﻳﻚ ﺳﺎﺧﺘﺎﺭ ﻳﺎ ﻣﺪﻝ ﺩﺍﺩﻩ ﺍﻱ ﺩﺍﺭﺩ ﻻ ﻫﻤﺎﻥ ﻣﺪﻟﻲ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﺍﺳﺖ .ﻳﻌﻨﻲ ﺍﮔﺮ ﻃﺮﺍﺡ ﭘﺎﻳﮕﺎﻩ ﺭﺍ ﺟﺪﻭﻟﻲ ﻣﻲ ﺑﻴﻨﺪ ﻛﺎﺭﺑﺮﺍﻥ ﻧﻴﺰ ﺑﺼﻮﺭﺕ ﻛـﻪ ﻣﻌﻤـﻮ ﹰ ﺟﺪﻭﻟﻲ ﻣﻲ ﺑﻴﻨﻨﺪ .ﺩﻳﺪ ﺧﺎﺭﺟﻲ ﻧﻴﺰ ﺑﺎﻳﺪ ﺑﻪ ﻛﻤﻚ ﺍﺣﻜﺎﻣﻲ ﺗﻌﺮﻳﻒ ﺷﻮﺩ ﻛﻪ ﺑﻪ ﺗﻌﺮﻳﻒ ﺁﻥ ﺷﻤﺎﻱ -ﺧﺎﺭﺟﻲ ﮔﻮﻳﻨﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٤ /
ﻣﺜﺎﻝ: Myv3 Sname City S2 ﻗﺰﻭﻳﻦ
Myv1 STA
١٠ ١٥
S# S1 S2
ﻧﻤﻮﻧﻪ ﺳﺎﺩﻩ ﺷﺪﻩ ﺍﺯ ﺷﻤﺎﻱ ﺧﺎﺭﺟﻲ – ١ﺍﺳﻢ ﺩﻳﺪ myv1ﺍﺳﺖ – ٢ﺍﻳﻦ ﺩﻳﺪ ﺭﻭﻱ ﺟﺪﻭﻝ Sﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﺩ. – ٣ﺳﺘﻮﻧﻬﺎﻳﺶ S#ﻭ STAﺍﺳﺖ. – ٤ﺳﺘﻮﻥ S#ﺍﺯ ﺳﺘﻮﻥ S#ﻣﺸﺘﻖ ﻣﻲ ﺷﻮﺩ. – ٥ﺳﺘﻮﻥ STAﺍﺯ ﺳﺘﻮﻥ Statusﻣﺸﺘﻖ ﻣﻲ ﺷﻮﺩ. – ٦ﺷﺮﻁ ﻳﺎ ﺷﺮﺍﻳﻂ ﺩﻳﺪ C1ﻭ ، C2ﻭ …… ﺍﺳﺖ. ﻻ ﺑﺎﺯﻳﺎﺑﻲ ﺍﺳﺖ. ﻧﻜﺘﻪ :ﻋﻤﺪﺗﹰﺎ Viewﻫﺎ ﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﻧﺪ ﺗﺎ ﺭﻭﻱ ﺁﻧﻬﺎ ﭘﺮﺱ ﻭ ﺟﻮ ) (Quaryﺍﻧﺠﺎﻡ ﺷﻮﺩ ﻭ ﭘﺮﺱ ﻭ ﺟﻮ ﻣﻌﻤﻮ ﹰ –٣-٣-٧ﺩﻳﺪ ﻳﺎ ﺳﻄﺢ ﺩﺍﺧﻠﻲ: ﺍﻳـﻦ ﺩﻳـﺪ ﺩﺭ ﺳـﻄﺢ ﺩﺍﺧﻠـﻲ ،ﭘﺎﻳـﻴﻦ ﺗﺮﻳﻦ ﺳﻄﺢ ﻣﻌﻤﺎﺭﻱ ﺑﺎﻧﻚ ﻣﻄﺮﺡ ﺍﺳﺖ .ﺍﻳﻦ ﺳﻄﺢ ،ﺳﻄﺤﻲ ﻭﺍﺳﻂ ﺑﻴﻦ ﻣﺤﻴﻂ ﻓﻴﺰﻳﻜﻲ ﭘﺎﻳﮕﺎﻩ ﻭ ﺳﻄﻮﺡ ﺍﻧﺘﺰﺍﻋﻲ ﺁﻥ ﻣﻲ ﺑﺎﺷﺪ ﻛﻪ DBMSﺑﻪ ﻣﺴﺎﺋﻞ ﻭ ﺟﻨﺒﻪ ﻫﺎﻱ ﻣﺨﺘﻠﻒ ﻓﺎﻳﻠﻴﻨﮓ ﻣﻲ ﭘﺮﺩﺍﺯﺩ .ﺍﻟﺒﺘﻪ ﺗﺎ ﺣﺪﻱ ﻧﻈﺎﺭﺕ ﻭ ﺩﺧﺎﻟـﺖ DBAﻧﻴـﺰ ﺩﺭ ﺁﻥ ﻧﻘـﺶ ﺩﺍﺭﺩ .ﻛـﻪ ﻣﻴـﺰﺍﻥ ﺩﺧﺎﻟﺖ ﻭ ﻣﺤﺪﻭﺩﻩ ﺍﺧﺘﻴﺎﺭﺍﺕ DBAﺩﺭ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﻣﺨﺘﻠﻒ ﻣﺘﻔﺎﻭﺕ ﺍﺳـﺖ .ﺩﻳـﺪ ﺩﺍﺧﻠـﻲ ﺑـﻪ ﻭﺳﻴﻠﻪ ﺷﻤﺎﻱ ﺩﺍﺧﻠﻲ ﺗﻮﺻﻴﻒ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﻧﻪ ﺗﻨﻬﺎ ﺍﻧﻮﺍﻉ ﻣﺨﺘﻠﻒ ﺭﻛﻮﺭﺩﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺭﺍ ﺗﻌﺮﻳﻒ ﻣﻲ ﻛﻨﺪ ﺑﻠﻜﻪ ﻣﺸﺨﺺ ﻣﻲ ﻛﻨﺪ ﭼﻪ ﺷﺎﺧﺼﻬﺎﻳﻲ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻭ ﻓﻴﻠﺪﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﭼﮕﻮﻧﻪ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﻧﺪ. HL – ٤-٣-٧ﺯﺑﺎﻥ ﻣﻴﺰﺑﺎﻥ: ﻳﻜـﻲ ﺍﺯ ﺯﺑﺎﻧﻬﺎﻱ ﻣﺘﻌﺎﺭﻑ ﺳﻄﺢ ﺑﺎﻻﺳﺖ .ﺑﺮﺍﻱ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﺎﻥ ﻛﺎﺭﺑﺮﺩﻱ ﺍﻳﻦ ﺯﺑﺎﻥ ﻣﻲ ﺗﻮﺍﻧﺪ ﻳﻜﻲ ﺍﺯ ﺯﺑﺎﻧﻬﺎﻱ ، C ++ﺟﺎﻭﺍ ﻭ ﻳـﺎ ﺯﺑﺎﻥ ﺍﺧﺘﺼﺎﺻﻲ ﺑﺎﺷﺪ ﻛﻪ ﺑﻪ ﺯﺑﺎﻧﻬﺎﻱ ﺍﺧﺘﺼﺎﺻﻲ ﺍﻏﻠﺐ ﺯﺑﺎﻧﻬﺎﻱ ﻧﺴﻞ ﭼﻬﺎﺭﻡ ﻧﻴﺰ ﮔﻔﺘﻪ ﻣﻲ ﺷﻮﺩ ،ﺯﺑﺎﻥ ﻣﻴﺰﺑﺎﻥ ﻣﺴﺌﻮﻝ ﺗﻬﻴﻪ ﻭ ﺗـﺪﺍﺭﻙ ﺍﻣﻜﺎﻧـﺎﺕ ﻣـﺘﻌﺪﺩ ﻏﻴـﺮ ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻧﻈﻴﺮ ﻣﺘﻐﻴﺮﻫﺎﻱ ﻣﺤﻠﻲ ،ﻋﻤﻠﻴﺎﺕ ﻣﻔﻬﻮﻣﻲ ﻭ ﻣﻨﻄﻖ ﺗﺼﻤﻴﻢ ﮔﻴﺮﻱ ﻭ ﻏﻴﺮﻩ ﻣﻲ ﺑﺎﺷﺪ. DSL –٥-٣-٧ﺯﺑﺎﻥ ﺩﺍﺩﻩ ﺍﻱ ﻓﺮﻋﻲ: ﻫـﺮ DBMSﻳـﻚ DSLﺩﺍﺭﺩ DSL .ﻣﺠﻤﻮﻋﻪ ﺍﺣﻜﺎﻣﻲ ﺍﺳﺖ ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻛﺎﺭ ﺑﺎ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻛﻨﺘﺮﻝ ﺁﻧﻬﺎ .ﻫﺮ ﺯﺑﺎﻥ ﻼ ﺗﺮﻛﻴﺒﻲ ﺍﺯ ﺍﺣﻜﺎﻡ ﺯﻳﺮ ﺍﺳﺖ: ﺩﺍﺩﻩ ﻓﺮﻋﻲ ﻣﺸﺨﺺ ﻋﻤ ﹰ – ١ﺍﺣﻜﺎﻡ ﺗﻌﺮﻳﻒ ﺩﺍﺩﻩ ﻫﺎ )Data Definition Language (DDL – ٢ﺍﺣﻜﺎﻡ ﺗﻌﺮﻳﻒ ﻛﺎﺭ ﺑﺎ ﺩﺍﺩﻩ ﻫﺎ )Data Manipulation Language (DML – ٣ﺍﺣﻜﺎﻡ ﻛﻨﺘﺮﻝ ﻛﺎﺭ ﺑﺎ ﺩﺍﺩﻩ ﻫﺎ )Data Control Language (DCL
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٥ /
ﻫـﺮ ﻳـﻚ ﺍﺯ ﺍﻳـﻦ ﺳـﻪ ﺩﺳـﺘﻪ ﺍﺣﻜﺎﻡ ﺑﺎﻳﺪ ﺑﺮﺍﻱ ﺳﻄﻮﺡ ﺳﻪ ﮔﺎﻧﻪ ﭘﺎﻳﮕﺎﻩ ﻧﻴﺰ ﻭﺟﻮﺩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ DSL .ﻫﺎ ﺭﺍ ﺍﺯ ﻧﻈﺮ ﻧﻴﺎﺯ ﻳﺎ ﻋﺪﻡ ﻧﻴﺎﺯ ﺑﻪ ﺯﺑﺎﻥ ﻣﻴﺰﺑﺎﻥ ﺑﻪ ﺩﻭ ﺩﺳﺘﻪ ﻣﺴﺘﻘﻞ ﻭ ﺍﺩﻏﺎﻡ ﺷﺪﻧﻲ ﺗﻘﺴﻴﻢ ﻣﻲ ﻛﻨﻨﺪ. ﺯﺑـﺎﻥ ﻓﺮﻋـﻲ ﺩﺍﺩﻩ ﺍﻱ ﻣﺴـﺘﻘﻞ ،ﺯﺑﺎﻧـﻲ ﺍﺳـﺖ ﻛﻪ ﺑﻪ ﺯﺑﺎﻥ ﻣﻴﺰﺑﺎﻥ ﻧﻴﺎﺯ ﻧﺪﺍﺭﺩ ﻭ ﺯﺑﺎﻥ ﻓﺮﻋﻲ ﺩﺍﺩﻩ ﺍﻱ ﺍﺩﻏﺎﻡ ﺷﺪﻩ ،ﺯﺑﺎﻧﻲ ﺍﺳﺖ ﻛﻪ ﻫﻤـﺮﺍﻩ ﺯﺑﺎﻥ HLﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ .ﺑﻪ ﺑﻴﺎﻥ ﺩﻳﮕﺮ ﺍﺣﻜﺎﻡ ﺁﻥ ﺑﺎﻳﺪ ﺑﻪ ﻧﺤﻮﻱ ﺩﺭ ﺍﺣﻜﺎﻡ ﺯﺑﺎﻥ ﺑﺮﻧﺎﻣﻪ ﺳﺎﺯﻱ ﺍﺩﻏﺎﻡ ﺷﻮﻧﺪ .ﻣﻜﺎﻧﻴﺰﻡ ﺍﺩﻏﺎﻡ ﺩﺭ ﺳﻴﺴﺘﻢ ﻫﺎﻱ ﻣﺨﺘﻠﻒ ﻣﺘﻔﺎﻭﺕ ﻭ ﺑﻄﻮﺭ ﻛﻠﻲ ﺑﻪ ﺩﻭ ﺻﻮﺭﺕ ﺍﺩﻏﺎﻡ ﺻﺮﻳﺢ ﻭ ﺍﺩﻏﺎﻡ ﺿﻤﻨﻲ ﻭﺟﻮﺩ ﺩﺍﺭﺩ. ﺩﺭ ﺍﺩﻏـﺎﻡ ﺿـﻤﻨﻲ ،ﺍﺣﻜـﺎﻡ ﺯﺑـﺎﻥ ﺩﺍﺩﻩ ﺍﻱ ﺑﻄـﻮﺭ ﺻـﺮﻳﺢ ﺩﺭ ﻣـﺘﻦ ﺯﺑـﺎﻥ ﻣﻴـﺰﺑﺎﻥ ﺟـﺎﻱ ﺩﺍﺩﻩ ﻧﻤـﻲ ﺷـﻮﻧﺪ ﺑﻠﻜﻪ ﺍﺯ ﻃﺮﻳﻖ ﺣﻜﻢ ﻓﺮﺍﺧﻮﺍﻧﻲ ﺑﻜﺎﺭ ﺑﺮﺩﻩ ﻣﻲ ﺷﻮﻧﺪ. ﺑﺮﺧﻲ ﻧﻜﺎﺕ ﻣﻬﻢ ﺩﺭ ﻣﻮﺭﺩ DSL
•
ﻫﺮ DBMSﺩﺍﺭﺍﻱ ﻳﻚ DSLﺍﺳﺖ.
•
ﻫـﺮ DSLﺩﺭ ﻛـﺎﺩﺭ ﻣﻔﺎﻫـﻴﻢ ﻳـﻚ ﻣـﺪﻝ ﺩﺍﺩﻩ ﺍﻱ ﻣﺸـﺨﺺ ﻃﺮﺍﺣـﻲ ﻣـﻲ ﺷﻮﺩ ﻭ ﻋﻤﻠﮕﺮﻫﺎﻱ ﺁﻥ ﻧﻴﺰ ﺩﺭ ﻛﺎﺩﺭ ﻫﻤﺎﻥ ﻣﻔﺎﻫﻴﻢ ﻋﻤﻞ ﻣﻲ ﻛﻨﻨﺪ.
•
ﻼ ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﻋﻤﻞ ﺩﺭﺝ ﻛﻪ ﻣﻨﻄﻘﹰﺎ ﻳﻚ ﺣﻜﻢ ﻭﺍﺣﺪ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺍﺻـﻞ ﻭﺣـﺪﺕ ﺍﺣﻜﺎﻡ ﺩﺭ ﺁﻥ ﺭﻋﺎﻳﺖ ﺷﺪﻩ ﺑﺎﺷﺪ .ﻣﺜ ﹰ ﻭ ﺗﺮﺟﻴﺤﹰﺎ ﻫﻤﺎﻥ ﺣﻜﻢ ﻭﺍﺣﺪ ﺩﺭ ﺳﻄﺢ ﺧﺎﺭﺟﻲ ﻭ ﻫﻢ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﻋﻤﻞ ﻧﻤﺎﻳﺪ.
–٦-٣-٧ﻧﮕﺎﺷﺖMapping :
ﻋﻼﻭﻩ ﺑﺮ ﺳﻪ ﺳﻄﺢ ﺍﺯ ﻣﻌﻤﺎﺭﻱ ،ﻣﻌﻤﺎﺭﻱ ﭘﺎﻳﮕﺎﻩ ﺍﺯ ﭼﻨﺪ ﻧﮕﺎﺷﺖ )ﺗﺒﺪﻳﻞ( ﻣﺨﺘﻠﻒ ﺗﺸﻜﻴﻞ ﻣﻲ ﺷﻮﺩ. -١–٦-٣-٧ﻧﮕﺎﺷﺖ ﻣﻔﻬﻮﻣﻲ /ﺩﺍﺧﻠﻲ: ﺗﻨﺎﻇـﺮ ﺑـﻴﻦ ﺩﻳـﺪ ﺍﺩﺭﺍﻛـﻲ ﻭ ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗـﻲ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺭﺍ ﺗﻌﺮﻳﻒ ﻭ ﻣﺸﺨﺺ ﻣﻲ ﻛﻨﺪ ﻛﻪ ﭼﮕﻮﻧﻪ ﺭﻛﻮﺭﺩﻫﺎﻱ ﺍﺩﺭﺍﻛﻲ ﻭ ﻓﻴﻠﺪﻫﺎ ﺩﺭ ﺳﻄﺢ ﺩﺍﺧﻠﻲ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﺷﻮﻧﺪ. -٢–٦-٣-٧ﻧﮕﺎﺷﺖ ﺧﺎﺭﺟﻲ /ﺍﺩﺭﺍﻛﻲ: ﺗﻨﺎﻇـﺮ ﺑـﻴﻦ ﺩﻳـﺪ ﺧﺎﺭﺟـﻲ ﺧـﺎﺹ ﻭ ﺩﻳـﺪ ﻣﻔﻬﻮﻣـﻲ ﺭﺍ ﺗﻌـﺮﻳﻒ ﻣـﻲ ﻛﻨﺪ .ﺩﺭ ﻭﺍﻗﻊ ﻣﻜﺎﻧﻴﺴﻤﻲ ﺍﺳﺖ ﺑﺮﺍﻱ ﺑﺮﻗﺮﺍﺭﻱ ﺗﻨﺎﻇﺮ ﺑﻴﻦ ﺩﻳﺪﻫﺎﻱ ﺧﺎﺭﺟﻲ ﻣﺨﺘﻠﻒ ﻭ ﺩﻳﺪ ﻭﺍﺣﺪ ﺍﺩﺭﺍﻛﻲ DBMS .ﻫﺎﻱ ﻣﺘﻌﺎﺭﻑ ﺣﺪﺍﻗﻞ ﺩﻭ ﻣﺤﻮﺭ ﺗﺒﺪﻳﻞ ﺩﺍﺭﻧﺪ :ﺗﺒﺪﻳﻞ ﺩﺍﺩﻩ ﻭ ﺗﺒﺪﻳﻞ ﺍﺣﻜﺎﻡ. •
ﺗـﺒﺪﻳﻞ ﺩﺍﺩﻩ ﻫﺎ ﻳﻌﻨﻲ ﺗﺒﺪﻳﻞ ﺩﺍﺩﻩ ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﺳﻄﺢ ﺧﺎﺭﺟﻲ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﻭ ﺑﺎﻻﺧﺮﻩ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﺳﻄﺢ ﺩﺍﺧﻠﻲ.
•
ﺗـﺒﺪﻳﻞ ﺍﺣﻜﺎﻡ ﻳﻌﻨﻲ ﺗﺒﺪﻳﻞ ﺣﻜﻢ ﻋﻤﻞ ﻛﻨﻨﺪﻩ ﺩﺭ ﺳﻄﺢ ﺧﺎﺭﺟﻲ ﺑﻪ ﺣﻜﻢ ﻋﻤﻞ ﻛﻨﻨﺪﻩ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﻭ ﺩﺭ ﻧﻬﺎﻳﺖ ﺑﻪ ﺣﻜﻢ ﻳﺎ ﺍﺣﻜﺎﻣﻲ ﺩﺭ ﺳﻄﺢ ﺩﺍﺧﻠﻲ .ﺍﻳﻦ ﺗﺒﺪﻳﻞ ﺍﺯ ﺟﻤﻠﻪ ﻭﻇﺎﻳﻒ ﻣﻬﻢ ﻫﺮ ﺳﻴﺴﺘﻢ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺳﺖ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٦ /
–٧-٣-٧ﺳﻴﺴﺘﻢ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ: ﺳﻴﺴـﺘﻢ ﻣﺪﻳـﺮﻳﺖ ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻧﺮﻡ ﺍﻓﺰﺍﺭﻱ ﺍﺳﺖ ﻛﻪ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺭﺍ ﻋﻬﺪﻩ ﺩﺍﺭ ﺍﺳﺖ ﻭ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺳﺖ ﺍﺯ ﺑـﺮﻧﺎﻣﻪ ﻫﺎ ﻛﻪ ﻭﺍﺳﻂ ﺑﻴﻦ ﻛﺎﺭﺑﺮﺍﻥ ﻭ ﻣﺤﻴﻂ ﻓﻴﺰﻳﻜﻲ ﺫﺧﻴﺮﻩ ﻭ ﺑﺎﺯﻳﺎﺑﻲ ﻣﻲ ﺑﺎﺷﻨﺪ .ﺍﻳﻦ ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﻭﺍﺳﻂ ﺑﻪ ﻛﺎﺭﺑﺮﺍﻥ ﺍﻣﻜﺎﻥ ﻣﻲ ﺩﻫﺪ ﺗﺎ ﺩﺍﺩﻩ ﻫﺎﻱ ﺧﻮﺩ ﺭﺍ ﺗﻌﺮﻳﻒ ﻛﻨﻨﺪ ﻭ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎﻱ ﺧﻮﺩ ﺩﺳﺘﻴﺎﺑﻲ ﺩﺍﺷﺘﻪ ﻭ ﺑﺎ ﺁﻧﻬﺎ ﻛﺎﺭ ﻛﻨﻨﺪ. •
ﺍﺟﺰﺍﺀ ﺗﺸﻜﻴﻞ ﺩﻫﻨﺪﻩ :DBMS
ﺍﻟﻒ( ﺑﺨﺶ ﻫﺴﺘﻪ ﺍﻱ Kernelﺷﺎﻣﻞ: – ١ﭘﻴﺶ ﻛﺎﻣﭙﺎﻳﻠﺮ – ٢ﭘﺮﺩﺍﺯﺷﮕﺮ ﭘﺮﺱ ﻭ ﺟﻮ – ٣ﺑﻬﻴﻨﻪ ﺳﺎﺯ ﭘﺮﺱ ﻭ ﺟﻮ – ٤ﻣﺪﻳﺮﻳﺖ ﻓﺎﻳﻠﻬﺎ )ﺑﺮﺍﻱ ﺳﻄﺢ ﺩﺍﺧﻠﻲ( – ٥ﻭﺍﺣﺪ ﺩﺭﻳﺎﻓﺖ ﺩﺭﺧﻮﺍﺳﺖ ﻛﺎﺭﺑﺮ ﻭ ﺍﻧﺠﺎﻡ ﻣﻘﺪﻣﺎﺕ ﻛﺎﺭ -٦ﻭﺍﺣﺪ ﻟﻮﺩ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﺏ( ﺑﺨﺶ ﻣﺪﻳﺮﻳﺘﻲ ﻣﺤﻴﻂ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ: – ١ﻭﺍﺣﺪ ﻛﻨﺘﺮﻝ ﻫﻤﺰﻣﺎﻧﻲ ﻋﻤﻠﻴﺎﺕ – ٢ﻭﺍﺣﺪ ﻛﻨﺘﺮﻝ ﺟﺎﻣﻌﻴﺖ ﭘﺎﻳﮕﺎﻩ – ٣ﻭﺍﺣﺪ ﻛﻨﺘﺮﻝ ﺍﻳﻤﻨﻲ ﭘﺎﻳﮕﺎﻩ – ٤ﻭﺍﺣﺪ ﻛﻨﺘﺮﻝ ﺗﺮﻣﻴﻢ ﭘﺎﻳﮕﺎﻩ -٥ﻭﺍﺣﺪ ﺗﻮﻟﻴﺪ ﻧﺴﺨﻪ ﻫﺎﻱ ﭘﺸﺘﻴﺒﺎﻥ ﺝ( ﺑﺨﺶ ﺍﻣﻜﺎﻧﺎﺕ ﺟﺎﻧﺒﻲ: -١ﺍﻣﻜﺎﻧﺎﺕ ﭘﺮﺱ ﻭ ﺟﻮ ﺑﻪ ﻛﻤﻚ ﻣﺜﺎﻝ ﻭ ﺑﻪ ﻛﻤﻚ ﻓﺮﻡ ﻻ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ DBAﻫﺴﺘﻨﺪ – ٢ﺭﻭﺍﻟﻬﺎﻱ ﻣﺨﺼﻮﺹ ﺗﺠﺰﻳﻪ ﻭ ﺗﺤﻠﻴﻞ ﺁﻣﺎﺭﻱ ﻛﻪ ﻣﻌﻤﻮ ﹰ – ٣ﺍﺑﺰﺍﺭ ﻫﺎﻱ ﺍﻳﺠﺎﺩ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ – ٤ﻧﺮﻡ ﺍﻓﺰﺍﺭﻫﺎﻱ ﻣﺨﺼﻮﺹ ﻣﺤﻴﻂ ﺷﺒﻜﻪ ﺍﻱ – ٥ﺍﻣﻜﺎﻧﺎﺕ ﮔﺮﺍﻓﻴﻜﻲ – ٦ﺍﻣﻜﺎﻧﺎﺕ ﺩﺳﺘﻴﺎﺑﻲ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎﻱ ﺩﻭﺭ . ﺍﻳـﻨﻜﻪ ﺳﻴﺴﺘﻢ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﭼﮕﻮﻧﻪ ﺩﺭﺧﻮﺍﺳﺘﻬﺎﻱ ﻛﺎﺭﺑﺮﺍﻥ ﺭﺍ ﻋﻤﻠﻲ ﻣﻲ ﺳﺎﺯﺩ ﺑﺴﺘﮕﻲ ﺑﻪ ﻧﻮﻉ ﺁﻥ ﺩﺍﺭﺩ .ﺑﻄﻮﺭ ﺧﻼﺻﻪ ﻧﺤﻮﻩ ﺍﺟﺮﺍﻱ ﺩﺭﺧﻮﺍﺳﺖ ﻛﺎﺭﺑﺮ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ: – ١ﺩﺭﻳﺎﻓﺖ ﺩﺭﺧﻮﺍﺳﺖ ﻛﺎﺭﺑﺮ ﻭ ﺍﻧﺠﺎﻡ ﺑﺮﺭﺳﻲ ﻫﺎﻱ ﺍﻭﻟﻴﻪ )ﻣﻌﺘﺒﺮ ﺑﻮﺩﻥ ﻛﺎﺭﺑﺮ( - ٢ﺑﺮﺭﺳﻲ ﻭ ﺗﺤﻠﻴﻞ ﺩﺭﺧﻮﺍﺳﺖ ﻛﺎﺭﺑﺮ – ٣ﺑﺮﺭﺳﻲ ﺷﻤﺎﻱ ﺧﺎﺭﺟﻲ ﻛﺎﺭﺑﺮ ﺑﺮﺍﻱ ﻣﺸﺨﺺ ﺷﺪﻥ ﻣﺤﺪﻭﺩﻩ ﺩﻳﺪ ﻛﺎﺭﺑﺮ ﺍﺯ ﭘﺎﻳﮕﺎﻩ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٧ /
– ٤ﺑﺮﺭﺳﻲ ﺷﻤﺎﻱ ﺍﺩﺭﺍﻛﻲ ﺑﺮﺍﻱ ﺗﻌﻴﻴﻦ ﻧﺤﻮﻩ ﻧﮕﺎﺷﺖ ﻋﻤﻠﻴﺎﺕ ﺳﻄﺢ ﺧﺎﺭﺟﻲ ﺑﻪ ﺍﺩﺭﺍﻛﻲ – ٥ﺍﻧﺠﺎﻡ ﺗﺒﺪﻳﻼﺕ ﻻﺯﻡ – ٦ﺑﺮﺭﺳﻲ ﺷﻤﺎﻱ ﺩﺍﺧﻠﻲ ﻭ ﺗﺒﺪﻳﻞ ﺍﺣﻜﺎﻡ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﺑﻪ ﺳﻄﺢ ﺩﺍﺧﻠﻲ – ٧ﺩﺳﺘﻴﺎﺑﻲ ﺑﻪ ﻓﺎﻳﻠﻬﺎﻱ ﻓﻴﺰﻳﻜﻲ ﻭ ﺍﺟﺮﺍﻱ ﺩﺭﺧﻮﺍﺳﺖ ﻛﺎﺭﺑﺮ •
ﺍﺻﻄﻼﺡ ﺑﻪ ﻋﻴﻨﻴﺖ ﺩﺭﺁﻭﺭﺩﻥ )(materialized
ﺍﮔـﺮ ﺩﺭﺧﻮﺍﺳﺖ ﻛﺎﺭﺑﺮ ﺑﺎﺯﻳﺎﺑﻲ ﺑﺎﺷﺪ ﺍﺻﻄﻼﺣﹰﺎ ﮔﻮﻳﻨﺪ DBMSﺩﺍﺩﻩ ﻫﺎﻱ ﻣﻮﺭﺩ ﻧﻈﺮ ﺭﺍ ﺑﻪ ﻋﻴﻨﻴﺖ ﺩﺭ ﻣﻲ ﺁﻭﺭﺩ ﻛﻪ ﺑﻪ ﺩﻭ ﻓﺮﻡ ﻭﺟﻮﺩ ﺩﺍﺭﺩ: – ١ﺑـﻪ ﻋﻴﻨﻴﺖ ﺩﺭ ﺁﻭﺭﺩﻥ ﻣﺴﺘﻘﻴﻢ :ﻣﻮﻗﻌﻴﺘﻲ ﻛﻪ ﺩﺍﺩﻩ ﻣﻮﺭﺩ ﻧﻈﺮ ﻛﺎﺭﺑﺮ ﺁﻧﭽﻪ ﺩﺭ ﺭﻛﻮﺭﺩ ﺧﺎﺭﺟﻲ ﺧﻮﺍﺳﺘﻪ ﻣﺘﻨﺎﻇﺮ ﺯﻳﺮﻳﻦ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﻳﻌﻨﻲ ﻣﺸﺨﺼﹰﺎ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﻣﺘﻨﺎﻇﺮ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ﺭﻛﻮﺭﺩ ﺧﺎﺭﺟﻲ M
A
D
ﺭﻛﻮﺭﺩ ﺍﺩﺭﺍﻛﻲ
– ٢ﻏﻴﺮ ﻣﺴﺘﻘﻴﻢ:
A B C D E F G H K
ﻣﻮﻗﻌﻴﺘﻲ ﻛﻪ ﺩﺍﺩﻩ ﻣﻮﺭﺩ ﻧﻈﺮﻛﺎﺭﺑﺮ ﻓﻴﻠﺪ ﻳﺎ ﻓﻴﻠﺪﻫﺎﻱ ﻣﺘﻨﺎﻇﺮ ﺯﻳﺮﻳﻦ ﻧﺪﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺑﻠﻜﻪ ﺣﺎﺻﻞ ﭘﺮﺩﺍﺯﺵ ﺑﺎﺷﺪ ﻣﺜﺎﻝ :ﻓﻴﻠﺪ ﻣﻴﺎﻧﮕﻴﻦ ﻣﻘﺎﺩﻳﺮ ﻳﻚ ﻓﻴﻠﺪ )ﻓﻴﻠﺪ ﻫﺎﻱ ﻣﺠﺎﺯﻱ( –٨-٣-٧ﻣﺪﻳﺮ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ : DBA ﻻ ﺩﺭ ﭘﺮﻭﮊﻩ ﻫﺎﻱ ﻓـﺮﺩﻱ ﺍﺳـﺖ ﺑـﺎ ﺗﺨﺼـﺺ ﺑـﺎﻻ ﺩﺭ ﺗﻜﻨﻮﻟﻮﮊﻱ ﺑﺎﻧﻜﻬﺎﻱ ﺍﻃﻼﻋﺎﺗﻲ ﻭ ﺩﺍﻧﺶ ﻭ ﻓﻦ ﻛﺎﻣﭙﻴﻮﺗﺮ .ﺍﻳﻦ ﻓﺮﺩ ﻣﻌﻤﻮ ﹰ ﺑـﺰﺭﮒ ﺗﻴﻤـﻲ ﺍﺯ ﺍﻓـﺮﺍﺩ ﻣﺘﺨﺼـﺺ ﺩﺭ ﺍﺧﺘـﻴﺎﺭ ﺩﺍﺭﺩ ﻭ ﻭﻇـﻴﻔﻪ ﻛﻠﻲ ﺗﻴﻢ ﻃﺮﺍﺣﻲ ،ﺍﻳﺠﺎﺩ ،ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ،ﻧﮕﻬﺪﺍﺭﻱ ﻭ ﮔﺴﺘﺮﺵ ﻭ ﺍﺩﺍﺭﻩ ﺑﺎﻧـﻚ ﺑـﺮﺍﻱ ﻳـﻚ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﺍﺳﺖ .ﺍﻣﺮﻭﺯ ﺑﻪ ﺳﺒﺐ ﺍﻫﻤﻴﺖ ﺑﺴﻴﺎﺭ ﺑﺎﻻﻱ ﺩﺍﺩﻩ ﺩﺭ ﺳﺎﺯﻣﺎﻧﻬﺎ ،ﺩﺍﺩﻩ ﻫﺎﻱ ﻳﻚ ﺳﺎﺯﻣﺎﻥ ﻧﻴﺎﺯ ﺑﻪ ﺍﺩﺍﺭﻩ ﻛﻨﻨﺪﻩ ﺩﺍﺭﻧﺪ ﻳﻌﻨﻲ ﻓﺮﺩﻱ ﺑﺎ ﺳﻤﺖ ﺍﺩﺍﺭﻩ ﻛﻨﻨﺪﻩ ﺩﺍﺩﻩ ﻫﺎ ﻳﺎ ﺑﻪ ﺍﺧﺘﺼﺎﺭ ) . (DAﺍﻳﻦ ﻓﺮﺩ ﻛﻪ ﻟﺰﻭﻣﹰﺎ ﻧﺒﺎﻳﺪ ﻣﺘﺨﺼﺺ ﺩﺭ ﻛﺎﻣﭙﻴﻮﺗـﺮ ﻭ ﻳﺎ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺑﺎﺷﺪ ﻣﺪﻳﺮﻳﺖ ﻛﻞ ﺩﺍﺩﻩ ﻫﺎﻱ ﺳﺎﺯﻣﺎﻥ ﺭﺍ ﺑﺮ ﻋﻬﺪﻩ ﺩﺍﺭﺩ ﻭ ﺑﺎ ﻫﻤﺎﻫﻨﮕﻲ ﺑﺎ ﻣﺪﻳﺮﻳﺖ ﺳﺎﺯﻣﺎﻥ، ﺧﻂ ﻣﺸﻲ ﻫﺎ ﻭ ﺗﺼﻤﻴﻤﺎﺗﻲ ﺩﺭ ﻣﻮﺭﺩ ﺩﺍﺩﻩ ﻫﺎﻱ ﻣﺆﺳﺴﻪ ﺧﻮﺩ ﺭﺍ ﺍﺗﺨﺎﺫ ﻣﻲ ﻛﻨﺪ. ﺩﺭ ﻣﺪﻳﺮﻳﺖ ﺳﺎﺯﻣﺎﻥ ﻭﻗﺘﻲ ﺍﺯ ﺳﺮﻣﺎﻳﻪ ﺳﺎﺯﻣﺎﻥ ﺑﺤﺚ ﻣﻲ ﻛﻨﻨﺪ ﻣﻲ ﮔﻮﻳﻨﺪ ﺍﺯ ﭘﻨﺞ ﺑﺨﺶ ﺗﺸﻜﻴﻞ ﻣﻲ ﺷﻮﺩ. ﻧﺮﻡ ﺍﻓﺰﺍﺭ ،ﺳﺨﺖ ﺍﻓﺰﺍﺭ ،ﻧﻴﺮﻭﻱ ﻣﺘﺨﺼﺺ ،ﺑﻮﺩﺟﻪ ﻭ ﺩﺍﺩﻩ. ﻭ ﺍﻣـﺎ ﻭﻇﺎﻳﻒ ﺍﺩﺍﺭﻩ ﻛﻨﻨﺪﻩ ﺑﺎﻧﻚ ﺩﺭ ﻃﻴﻔﻲ ﺍﺯ ﻭﻇﺎﻳﻒ ﻣﺪﻳﺮﻳﺘﻲ ﺗﺎ ﻭﻇﺎﻳﻒ ﻓﻨﻲ ﻭ ﻋﻠﻤﻲ ﺟﺎﻱ ﺩﺍﺭﺩ .ﺩﺭ ﻭﺍﻗﻊ ﻣﻲ ﺗﻮﺍﻥ DBA
ﺭﺍ ﺑﻌـﻨﻮﺍﻥ ﺗﻴﻤـﻲ ﺗﺨﺼﺼـﻲ ﺑـﻪ ﺳﺮﭘﺮﺳـﺘﻲ ) DBAﻣﺪﻳﺮ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ( ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺖ ﻛﻪ ﺑﺎ ﻣﺘﺨﺼﺺ ﻫﺎﻳﻲ ﻧﻈﻴﺮ ، DA
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٨ /
ﻣﺴـﺌﻮﻝ ﻣﺴـﺘﻘﻴﻢ ﺗـﻴﻢ ﻫـﺎﻱ ﺑـﺮﻧﺎﻣﻪ ﺳـﺎﺯﻱ ،ﻣﺪﻳـﺮ ﻛﻨﺘـﺮﻝ ﻛﻨـﻨﺪﻩ ﻋﻤﻠﻜـﺮﺩ ﺧﻮﺩ ﺳﻴﺴﺘﻢ ﻭ … ﺩﺭ ﺧﺼﻮﺹ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻫﻤﻜﺎﺭﻱ ﺩﺍﺭﻧﺪ. ﺑﻄﻮﺭ ﻛﻠﻲ ﻣﻲ ﺗﻮﺍﻥ ﻭﻇﺎﻳﻒ DBAﺭﺍ ﺑﻪ ﺷﺮﺡ ﺯﻳﺮ ﺑﻴﺎﻥ ﻧﻤﻮﺩ: – ١ﻫﻤﻜﺎﺭﻱ ﺑﺎ DAﺩﺭ ﺗﻔﻬﻴﻢ ﺍﻫﻤﻴﺖ ﻭ ﻧﻘﺶ ﺩﺍﺩﻩ ﺳﺎﺯﻣﺎﻥ. – ٢ﻫﻤﻜﺎﺭﻱ ﺩﺭ ﻣﻌﺮﻓﻲ ﺗﻜﻨﻮﻟﻮﮊﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻭ ﺟﻨﺒﻪ ﻫﺎﻱ ﻣﺨﺘﻠﻒ ﺍﺭﺟﺤﻴﺖ ﺁﻥ ﺑﺮ ﺗﻜﻨﻮﻟﻮﮊﻱ ﻏﻴﺮ ﺑﺎﻧﻜﻲ – ٣ﺗﻼﺵ ﺩﺭ ﻣﺠﺎﺏ ﻛﺮﺩﻥ ﺳﺎﺯﻣﺎﻥ ﺩﺭ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺗﻜﻨﻮﻟﻮﮊﻱ ﻛﺎﺭﺍ ﺗﺮ – ٤ﻣﻄﺎﻟﻌﻪ ﺩﻗﻴﻖ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﻭ ﺗﺸﺨﻴﺺ ﻧﻴﺎﺯﻫﺎﻱ ﻛﺎﺭﺑﺮﺍﻥ ﻣﺨﺘﻠﻒ – ٥ﺑﺎﺯﺷﻨﺎﺳﻲ ﻣﻮﺟﻮﺩﻳﺖ ﻫﺎ ﻭ ﺍﺭﺗﺒﺎﻃﺎﺕ ﺑﻴﻦ ﺁﻧﻬﺎ ﻭ ﺗﻌﻴﻴﻦ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻫﺮ ﻳﻚ ﺍﺯ ﺍﻧﻮﺍﻉ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ – ٦ﺭﺳﻢ ﻧﻤﻮﺩﺍﺭ E-R
– ٧ﺗﺨﻤﻴﻦ ﺣﺠﻢ ﺍﻃﻼﻋﺎﺕ ﺫﺧﻴﺮﻩ ﺷﺪﻧﻲ ﺩﺭ ﺑﺎﻧﻚ – ٨ﻣﺸﺎﺭﻛﺖ ﺩﺭ ﺗﻌﻴﻴﻦ ﺳﻴﺴﺘﻢ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻣﻜﺎﻧﺎﺕ ﻛﺎﻣﭙﻴﻮﺗﺮﻱ ﻭ ﻣﺤﻴﻂ – ٩ﻣﺸـﺎﻭﺭﻩ ﻭ ﻣﺸـﺎﺭﻛﺖ ﺩﺭ ﺗﻌﻴـﻴﻦ ﺳﻴﺴـﺘﻢ ﻛﺎﻣﭙﻴﻮﺗـﺮﻱ ﻭ ﭘﻴﻜـﺮﺑﻨﺪﻱ ﺁﻥ ﺍﺯ ﻟﺤـﺎﻅ ﻣﻠﺰﻭﻣﺎﺕ ﺳﺨﺖ ﺍﻓﺰﺍﺭﻱ ﻭ ﻧﺮﻡ ﺍﻓﺰﺍﺭﻱ ﺳﻴﺴﺘﻢ ﻋﺎﻣﻞ – ١٠ﻃﺮﺍﺣﻲ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﺑﺎﻧﻚ ﻭ ﻧﻮﺷﺘﻦ ﺷﻤﺎﻱ ﺍﺩﺭﺍﻛﻲ – ١١ﺍﻳﺠﺎﺩ ﭘﺎﻳﮕﺎﻩ ﺑﺎ ﺩﺍﺩﻩ ﻫﺎﻱ ﺗﺴﺘﻲ – ١٢ﺗﻌﺮﻳﻒ ﺩﻳﺪﻫﺎﻱ ﺧﺎﺭﺟﻲ ﻛﺎﺭﺑﺮﺍﻥ ﺑﺮﻧﺎﻣﻪ ﺳﺎﺯ – ١٣ﻧﻈﺎﺭﺕ ﺩﺭ ﻧﻮﺷﺘﻦ ﺷﻤﺎﻱ ﺧﺎﺭﺟﻲ – ١٤ﻧﻈﺎﺭﺕ ﺩﺭ ﺟﻤﻊ ﺍﻭﺭﻱ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻭﺭﻭﺩ ﺩﺍﺩﻩ ﻫﺎ – ١٥ﺗﺴﺖ ﭘﺎﻳﮕﺎﻩ ﺑﺎ ﺩﺍﺩﻩ ﻫﺎﻱ ﻭﺍﻗﻌﻲ )ﺁﻏﺎﺯ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﭘﺎﻳﮕﺎﻩ( – ١٦ﺗﻌﻴﻴﻦ ﺿﻮﺍﺑﻂ ﺩﺳﺘﻴﺎﺑﻲ ﺑﻪ ﺑﺎﻧﻚ ﺑﺮﺍﻱ ﻛﺎﺭﺑﺮﺍﻥ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻧﻴﺎﺯﻫﺎﻱ ﺍﻃﻼﻋﺎﺗﻲ ﺁﻧﻬﺎ – ١٧ﻧﻈﺎﺭﺕ ﻭ ﺩﺧﺎﻟﺖ ﺩﺭ ﺗﻬﻴﻪ ﻣﺴﺘﻨﺪﺍﺕ ﺳﻴﺴﺘﻢ – ١٨ﺗﺄﻣﻴﻦ ﺟﺎﻣﻌﻴﺖ ﺑﺎﻧﻚ ﺍﺯ ﻃﺮﻳﻖ ﺣﻔﻆ ﻛﻴﻔﻴﺖ ،ﻛﻨﺘﺮﻝ ﺩﺳﺘﻴﺎﺑﻲ ﻭ ﺣﻔﺎﻇﺖ ﺍﺯ ﻣﺤﺮﻣﺎﻧﮕﻲ ﻣﺤﺘﻮﺍﻱ ﺑﺎﻧﻚ – ١٩ﻛﻤﻚ ﺑﻪ ﻛﺎﺭﺑﺮﺍﻥ ﻭ ﺁﻣﻮﺯﺵ ﺁﻧﺎﻥ ﺩﺭ ﺑﺮﻧﺎﻣﻪ ﺭﻳﺰﻱ ﺩﺭ ﺩﺳﺘﻴﺎﺑﻲ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻛﺎﺭ ﺑﺎ ﺁﻧﻬﺎ – ٢٠ﺣﻔﻆ ﺍﻳﻤﻨﻲ ﺑﺎﻧﻚ – ٢١ﭘﻴﺶ ﺑﻴﻨﻲ ﺭﻭﺷﻬﺎﻱ ﺗﺮﻣﻴﻢ ﻭ ﺍﺳﺘﺮﺍﺗﮋﻱ ﻻﺯﻡ ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ – ٢٢ﻣﻌﺎﺻﺮ ﻧﮕﻪ ﺩﺍﺷﺘﻦ ﭘﺎﻳﮕﺎﻩ ﺑﺎ ﭘﻴﺸﺮﻓﺘﻬﺎﻱ ﺗﻜﻨﻮﻟﻮﮊﻳﻚ – ٢٣ﺗﻼﺵ ﺩﺭ ﺟﻬﺖ ﺍﺭﺗﻘﺎﺀ ﺳﻄﺢ ﺗﺨﺼﺼﻲ ﺍﻓﺮﺍﺩ ﻭ ﻛﺎﺭﺑﺮﺍﻥ – ٢٤ﻧﻈﺎﺭﺕ ﺑﻪ ﻛﺎﺭﺍﻳﻲ ﻭ ﭘﺎﺳﺦ ﺑﻪ ﺗﻐﻴﻴﺮ ﻧﻴﺎﺭﻫﺎ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
•
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٠٩ /
ﺩﻳﻜﺸﻨﺮﻱ ﺩﺍﺩﻩ ﻫﺎ )ﻛﺎﺗﺎﻟﻮﮒ ﺳﻴﺴﺘﻢ (
ﻳﻚ DBMSﺑﺮﺍﻱ ﺍﻧﺘﺨﺎﺏ ﻧﺤﻮﻩ ﺍﺟﺮﺍﻱ ﻋﻤﻠﻴﺎﺕ ﺭﻭﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺗﺤﺖ ﻛﻨﺘﺮﻝ ﺧﻮﺩ ﺍﻃﻼﻋﺎﺗﻲ ﺭﺍ ﺍﺯ ﺁﻥ ﺑﺎﻧﻚ ﺗﺤﺖ ﻋـﻨﻮﺍﻥ ﻛﺎﺗﺎﻟﻮﮒ ﺳﻴﺴﺘﻢ ﻧﮕﻬﺪﺍﺭﻱ ﻣﻲ ﻛﻨﺪ .ﺩﺭ ﻭﺍﻗﻊ ﻛﺎﺗﺎﻟﻮﮒ ﺟﺎﺋﻲ ﺍﺳﺖ ﻛﻪ ﺗﻤﺎﻡ ﺷﻤﺎﻫﺎﻱ ﻣﺨﺘﻠﻒ ) ﺧﺎﺭﺟﻲ ،ﻣﻔﻬﻮﻣﻲ ﻭ ﺩﺍﺧﻠـﻲ ( ﻭ ﺗﻤـﺎﻡ ﻧﮕﺎﺷـﺘﻬﺎﻱ ﻣﺘﻨﺎﻇﺮ ﺑﺎ ﺁﻧﻬﺎ ﺩﺭ ﺁﻥ ﻧﮕﻬﺪﺍﺭﻱ ﻣﻲ ﺷﻮﻧﺪ .ﺑﻪ ﺑﻴﺎﻥ ﺩﻳﮕﺮ ﻛﺎﺗﺎﻟﻮﮒ ﺷﺎﻣﻞ ﺍﻃﻼﻋﺎﺕ ﺗﻔﻀﻴﻠﻲ ) ﻛﻪ ﮔﺎﻩ ﻓﺮﺍ ﺩﺍﺩﻩ ﻧﺎﻣﻴﺪﻩ ﻣﻲ ﺷﻮﻧﺪ ( ﻣﺮﺑﻮﻁ ﺑﻪ ﺍﺷﻴﺎﺀ ﻣﺘﻌﺪﺩﻱ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﺧﻮﺩ ﺳﻴﺴﺘﻢ ﻗﺮﺍﺭ ﺩﺍﺭﻧﺪ . ﺑﻄﻮﺭ ﻛﻠﻲ ﺍﻃﻼﻋﺎﺕ ﺯﻳﺮ ﺩﺭ ﺁﻥ ﻧﮕﻬﺪﺍﺭﻱ ﻣﻲ ﺷﻮﺩ : ﻼ ﻧﺎﻡ ﺟﺪﺍﻭﻝ ﺩﺭ ﺑﺎﻧﻚ ﺭﺍﺑﻄﻪ ﺍﻱ ﻧﺎﻡ ﺳﺎﺧﺘﺎﺭﻫﺎﻱ ﺩﺍﺩﻩ ﺍﻱ ﺩﺭ ﭼﺎﺭﭼﻮﺏ ﻣﺪﻝ ﺩﺍﺩﻩ ﺍﻱ ﻣﺸﺨﺺ ﻣﺜ ﹰ ﻧﺎﻡ ﻣﻮﺟﻮﺩﻳﺘﻬﺎ ﻭ ﺍﺭﺗﺒﺎﻃﺎﺕ ﺑﻴﻦ ﺁﻧﻬﺎ ﻧﺎﻡ ﺻﻔﺎﺕ ﺧﺎﺻﻪ ﻫﺮ ﻣﻮﺟﻮﺩﻳﺖ ،ﻧﻮﻉ ﻭ ﻃﻴﻒ ﻣﻘﺎﺩﻳﺮ ﺷﻤﺎﻫﺎﻱ ﺧﺎﺭﺟﻲ ﻛﺎﺭﺑﺮﺍﻥ ﺷﻤﺎﻱ ﺍﺩﺭﺍﻛﻲ ﻣﺸﺨﺼﺎﺕ ﻓﻨﻲ ﻛﺎﺭﺑﺮﺍﻥ ﻭ ﭼﮕﻮﻧﮕﻲ ﺣﻖ ﺩﺳﺘﻴﺎﺑﻲ ﺍﻧﻬﺎ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﻣﺤﺪﻭﺩﻩ ﻋﻤﻠﻴﺎﺕ ﻣﺠﺎﺯ ﺁﻧﻬﺎ ﺭﻭﻳﻪ ﻫﺎﻱ ﺗﺒﺪﻳﻞ ﺑﻴﻦ ﺳﻄﻮﺡ ﻣﺨﺘﻠﻒ ﺗﺎﺭﻳﺦ ﺍﻳﺠﺎﺩ ﺩﺍﺩﻩ ﻫﺎ -٤-٧ﺩﻻﻳﻞ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲWhy Database ? :
-١-٤-٧ﻣﺰﺍﻳﺎﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﭼﻨﺪ ﻛﺎﺭﺑﺮﻱ : – ١ﺍﻣﻜﺎﻥ ﻣﺪﻟﺴﺎﺯﻱ ﺩﺍﺩﻩ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﺑﺮ ﺍﺳﺎﺱ ﺳﻤﺎﻧﺘﻴﻚ ﺁﻧﻬﺎ – ٢ﻭﺣﺪﺕ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﻛﻞ ﺩﺍﺩﻩ ﻫﺎﻱ ﻣﺤﻴﻂ ﻋﻤﻠﻴﺎﺗﻲ ﻭﺟـﻮﺩ ﺳـﻄﺢ ﺍﺩﺭﺍﻛﻲ ﺩﺭ ﻣﻌﻤﺎﺭﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﺍﻣﻜﺎﻥ ﻣﻲ ﺩﻫﺪ ﺗﺎ ﻛﻞ ﺩﺍﺩﻩ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﻳﻜﺒﺎﺭ ﺁﻧﮕﻮﻧﻪ ﻛﻪ ﻃﺮﺍﺡ ﻣﻲ ﺑﻴﻨﺪ ﺗﻌﺮﻳﻒ ﻭ ﺫﺧﻴﺮﻩ ﺷﻮﻧﺪ .ﺍﻳﻦ ﻭﺣﺪﺕ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺩﺭ ﻋﻴﻦ ﺗﻌﺪﺩ ﻧﺸﺎﻧﺪﻫﻨﺪﻩ ﺩﻳﺪﻫﺎﻱ ﻛﺎﺭﺑﺮﺍﻥ ﺍﺳﺖ. – ٣ﺍﺷﺘﺮﺍﻛﻲ ﺷﺪﻥ ﺩﺍﺩﻩ ﻫﺎ ﺍﻣﻜﺎﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺎﺭﺑﺮﺍﻥ ﺍﺯ ﺩﺍﺩﻩ ﻭﺍﺣﺪ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺑﺼﻮﺭﺕ ﺍﺷﺘﺮﺍﻛﻲ – ٤ﻛﺎﻫﺶ ﻣﻴﺰﺍﻥ ﺍﻓﺰﻭﻧﮕﻲ – ٥ﺗﻀﻤﻴﻦ ﺟﺎﻣﻌﻴﺖ ﺩﺍﺩﻩ ﻫﺎ – ٦ﺍﻣﻜﺎﻥ ﺍﻋﻤﺎﻝ ﺿﻮﺍﺑﻂ ﺩﻗﻴﻖ ﺍﻳﻤﻨﻲ ﺳﻴﺴﺘﻢ ﻣﺪﻳﺮﻳﺖ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺑﺎ ﺍﻋﻤﺎﻝ ﻛﻨﺘﺮﻝ ﻣﺘﻤﺮﻛﺰ ﺍﺯ ﻫﺮﮔﻮﻧﻪ ﺍﻗﺪﺍﻡ ﺑﺮﺍﻱ ﺩﺳﺘﻴﺎﺑﻲ ﻏﻴﺮ ﻣﺠﺎﺯ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎ ﺟﻠﻮﮔﻴﺮﻱ ﻣﻲ ﻛﻨﺪ – ٧ﺍﻣﻜﺎﻥ ﺗﺮﻣﻴﻢ ﺩﺍﺩﻩ ﻫﺎ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٠ /
ﺳﻴﺴـﺘﻢ ﻣﺪﻳـﺮﻳﺖ ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗـﻲ ﺑـﺎ ﻣﻜﺎﻧﻴﺴﻢ ﻫﺎﻳﻲ ﺧﺴﺎﺭﺕ ﻧﺎﺷﻲ ﺍﺯ ﺑﺮﻭﺯ ﻧﻘﺺ ﻫﺎ ﻭ ﺍﺷﺘﺒﺎﻫﺎﺕ ﺭﺍ ﺟﺒﺮﺍﻥ ﻛﺮﺩﻩ ﻭ ﺩﺍﺩﻩ - ﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺭﺍ ﺗﺮﻣﻴﻢ ﻣﻲ ﻛﻨﺪ ﺑﻨﺤﻮﻱ ﻛﻪ ﻣﺤﺘﻮﺍﻱ ﺑﺎﻧﻚ ﻭﺿﻌﻴﺖ ﺻﺤﻴﺢ ﺧﻮﺩ ﺭﺍ ﺑﺎﺯ ﻳﺎﺑﺪ. – ٨ﺗﺄﻣﻴﻦ ﺍﺳﺘﻘﻼﻝ ﺩﺍﺩﻩ ﻫﺎ ﻫﻢ ﺩﻟﻴﻞ ﺍﻳﻦ ﺗﻜﻨﻮﻟﻮﮊﻱ ﻭ ﻫﻢ ﻫﺪﻑ ﺁﻥ ﻣﻲ ﺑﺎﺷﺪ ﺗﻌﺮﻳﻒ ﺍﺳﺘﻘﻼﻝ ﺩﺍﺩﻩ ﺍﻱ: ﻣﺼﻮﻧﻴﺖ ﺩﻳﺪﻫﺎﻱ ﻛﺎﺭﺑﺮﺍﻥ ﻭ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺩﺭ ﻗﺒﺎﻝ ﺗﻐﻴﻴﺮﺍﺗﻲ ﻛﻪ ﺩﺭ ﺳﻄﻮﺡ ﻣﻌﻤﺎﺭﻱ ﭘﺎﻳﮕﺎﻩ ﭘﺪﻳﺪ ﻣﻲ ﺁﻳﻨﺪ. ﺍﺳﺘﻘﻼﻝ ﺩﺍﺩﻩ ﺍﻱ ﺩﻭ ﻭﺟﻪ ﺩﺍﺭﺩ :ﺍﺳﺘﻘﻼﻝ ﺩﺍﺩﻩ ﺍﻱ ﻣﻨﻄﻘﻲ ﻭ ﻓﻴﺰﻳﻜﻲ ﺍﺳـﺘﻘﻼﻝ ﺩﺍﺩﻩ ﺍﻱ ﻓﻴﺰﻳﻜـﻲ ﻳﻌﻨـﻲ ﻣﺼـﻮﻧﻴﺖ ﺩﻳﺪﻫﺎﻱ ﻛﺎﺭﺑﺮﺍﻥ ﻭ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺩﺭ ﻗﺒﺎﻝ ﺗﻐﻴﻴﺮﺍﺗﻲ ﻛﻪ ﺩﺭ ﺳﻄﺢ ﺩﺍﺧﻠﻲ ﭘﺎﻳﮕـﺎﻩ ﭘﺪﻳـﺪ ﻣﻲ ﺁﻳﻨﺪ ،ﺩﺭ DBMSﻫﺎﻱ ﻭﺍﻗﻌﻲ ﺍﺳﺘﻘﻼﻝ ﺩﺍﺩﻩ ﺍﻱ ﻓﻴﺰﻳﻜﻲ ﺗﻘﺮﻳﺒﹰﺎ ﺻﺪ ﺩﺭ ﺻﺪ ﺍﺳﺖ ﺯﻳﺮﺍ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻣﻌﻤﺎﺭﻱ ﭼﻨﺪ ﺳﻄﺤﻲ ﭘﺎﻳﮕﺎﻩ ﻛﺎﺭﺑﺮﺍﻥ ﺩﺭ ﺳﻄﺢ ﺧﺎﺭﺟﻲ ﺩﺭ ﻳﻚ ﻣﺤﻴﻂ ﺍﻧﺘﺰﺍﻋﻲ ﻭ ﻣﻨﻔﻚ ﺍﺯ ﻓﺎﻳﻠﻴﻨﮓ ﻋﻤﻞ ﻣﻲ ﻛﻨﻨﺪ. ﺍﺳﺘﻘﻼﻝ ﺩﺍﺩﻩ ﺍﻱ ﻣﻨﻄﻘﻲ: ﻳﻌﻨـﻲ ﻣﺼـﻮﻧﻴﺖ ﺑـﺮﻧﺎﻣﻪ ﺍﻱ ﻛﺎﺭﺑـﺮﺩﻱ ﻭ ﺩﻳﺪ ﻛﺎﺭﺑﺮﺍﻥ ﺩﺭ ﻗﺒﺎﻝ ﺗﻐﻴﻴﺮﺍﺗﻲ ﻛﻪ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﭘﺪﻳﺪ ﻣﻲ ﺁﻳﻨﺪ .ﺗﻐﻴﻴﺮﺍﺕ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﺍﺯ ﺩﻭ ﺟﻨﺒﻪ ﭘﺪﻳﺪ ﻣﻲ ﺁﻳﻨﺪ: – ١ﺍﺯ ﺭﺷﺪ ﭘﺎﻳﮕﺎﻩ ﺩﺭ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ – ٢ﺩﺭ ﺳﺎﺯﻣﺎﻧﺪﻫﻲ ﻣﺠﺪﺩ ﺳﻄﺢ ﺍﺩﺭﺍﻛﻲ ﺩﻻﻳﻞ ﺭﺷﺪ ﭘﺎﻳﮕﺎﻩ: ﻣﻄﺮﺡ ﺷﺪﻥ ﻧﻴﺎﺯﻫﺎﻱ ﺟﺪﻳﺪ ﺑﺮﺍﻱ ﻛﺎﺭﺑﺮﺍﻥ ﻣﻄﺮﺡ ﺷﺪﻥ ﻛﺎﺭ ﺑﺮﺍﻧﻲ ﺟﺪﻳﺪ ﺑﺎ ﻧﻴﺎﺯﻫﺎﻱ ﺍﻃﻼﻋﺎﺗﻲ ﺟﺪﻳﺪ ﺩﻻﻳﻞ ﺳﺎﺯﻣﺎﻧﺪﻫﻲ ﻣﺠﺪﺩ: ﺗﺄﻣﻴﻦ ﻣﺤﻴﻂ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﻛﺎﺭﺍﺗﺮ ﺑﺮﺍﻱ ﺑﺨﺸﻲ ﺍﺯ ﭘﺎﻳﮕﺎﻩ ﺗﺄﻣﻴﻦ ﺍﻳﻤﻨﻲ ﺑﻴﺸﺘﺮ ﺑﺮﺍﻱ ﭘﺎﻳﮕﺎﻩ ﺗﺄﻣﻴﻦ ﻛﺎﺭﺍﻳﻲ ﻋﻤﻠﻴﺎﺗﻲ ﺑﻴﺸﺘﺮ ﺑﺮﺍﻱ DBMSﺍﺯ ﻃﺮﻳﻖ ﻛﺎﻫﺶ ﺁﻧﻮﻣﺎﻟﻲ ﻫﺎ – ٩ﺗﺴﺮﻳﻊ ﺩﺭ ﺩﺭﻳﺎﻓﺖ ﭘﺎﺳﺦ ﭘﺮﺱ ﻭ ﺟﻮﻫﺎ – ١٠ﺗﺴﻬﻴﻞ ﺩﺭ ﺩﺭﻳﺎﻓﺖ ﮔﺰﺍﺭﺷﻬﺎﻱ ﻣﺘﻨﻮﻉ ﺁﻣﺎﺭﻱ – ١١ﺍﻣﻜﺎﻥ ﺍﻋﻤﺎﻝ ﺍﺳﺘﺎﻧﺪﺍﺭﺩﻫﺎ ﺑـﺎ ﻛﻨﺘـﺮﻝ ﻣﺘﻤﺮﻛـﺰ ﺭﻭﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ DBA ،ﻣﻲ ﺗﻮﺍﻧﺪ ﺍﻃﻤﻴﻨﺎﻥ ﺩﻫﺪ ﻛﻪ ﺗﻤﺎﻡ ﺍﺳﺘﺎﻧﺪﺍﺭﺩﻫﺎﻱ ﻣﻄﻠﻮﺏ ﺩﺭ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻫﺎ ﻣـﻮﺭﺩ ﺗـﻮﺟﻪ ﻗـﺮﺍﺭ ﮔـﺮﻓﺘﻪ ﺍﺳـﺖ .ﺍﺳـﺘﺎﻧﺪﺍﺭﺩﻫﺎﻱ ﻣﻄﻠـﻮﺏ ﻣﻤﻜﻦ ﺍﺳﺖ ﺣﺎﻭﻱ ﻳﻚ ﻳﺎ ﺗﻤﺎﻡ ﻣﻮﺍﺭﺩ ﺯﻳﺮ ﺑﺎﺷﻨﺪ :ﺍﺳﺘﺎﻧﺪﺍﺭﺩﻫﺎﻱ ﺑﺨﺶ ،ﺗﺄﺳﻴﺴﺎﺕ ،ﺷﺮﻛﺖ ،ﺻﻨﻌﺖ ،ﻣﻠﻲ ﻭ ﺑﻴﻦ ﺍﻟﻤﻠﻠﻲ. -١٢ﺍﺳﺘﻔﺎﺩﻩ ﺑﻬﺘﺮ ﺍﺯ ﺳﺨﺖ ﺍﻓﺰﺍﺭ
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١١ /
-٢-٤-٧ﻣﻌﺎﻳﺐ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ )ﭼﻨﺪ ﻛﺎﺭﺑﺮﻱ( -١ﻫﺰﻳﻨﻪ ﺑﺎﻻﻱ ﻧﺮﻡ ﺍﻓﺰﺍﺭ -٢ﻫﺰﻳﻨﻪ ﺑﺎﻻﻱ ﺳﺨﺖ ﺍﻓﺰﺍﺭ -٣ﻫﺰﻳﻨﻪ ﺑﻴﺸﺘﺮ ﺑﺮﺍﻱ ﺑﺮﻧﺎﻣﻪ ﺳﺎﺯﻱ -٤ﻫﺰﻳﻨﻪ ﺑﺎﻻ ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﻣﻬﻨﺪﺳﻲ ﻣﺠﺪﺩ ﺑﻪ ﻣﻨﻈﻮﺭ ﺗﺒﺪﻳﻞ ﺳﻴﺴﺘﻢ ﺍﺯ ﻣﺸﻲ ﻓﺎﻳﻞ ﭘﺮﺩﺍﺯﻱ ﺑﻪ ﻣﺸﻲ ﭘﺎﻳﮕﺎﻫﻲ -٥ﭘﻴﭽﻴﺪﻩ ﺑﻮﺩﻥ ﺳﻴﺴﺘﻢ ﻭ ﻧﻴﺎﺯ ﺑﻪ ﺗﺨﺼﺺ ﺑﻴﺸﺘﺮ -٥-٧ﻣﻌﻤﺎﺭﻱ ﺳﻴﺴﺘﻢ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﻣـﻨﻈﻮﺭ ﺍﺯ ﻣﻌﻤـﺎﺭﻱ ﺳﻴﺴـﺘﻢ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ،ﻧﺤﻮﻩ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﺟﺰﺍﻱ ﺳﻴﺴﺘﻤﻲ ﺍﺳﺖ ﻛﻪ ﺩﺭ ﺁﻥ ﺣﺪﺍﻗﻞ ﻳﻚ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ، ﻳـﻚ ﺳﻴﺴـﺘﻢ ﻣﺪﻳﺮﻳﺖ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ،ﻳﻚ ﺳﻴﺴﺘﻢ ﻋﺎﻣﻞ ،ﻳﻚ ﻛﺎﻣﭙﻴﻮﺗﺮ ﺑﺎ ﺩﺳﺘﮕﺎﻫﻬﺎﻱ ﺟﺎﻧﺒﻲ ﻭ ﺗﻌﺪﺍﺩﻱ ﻛﺎﺭﺑﺮ ﻭﺟﻮﺩ ﺩﺍﺭﺩﻭ ﺧـﺪﻣﺎﺕ ﭘﺎﻳﮕﺎﻫـﻲ ﺑـﻪ ﻛﺎﺭﺑﺮﺍﻥ ﺍﺭﺍﺋﻪ ﻣﻴﻜﻨﻨﺪ.ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﺑﺴﺘﮕﻲ ﺑﻪ ﺩﻭ ﻋﻨﺼﺮ ﺍﺻﻠﻲ ﻳﻌﻨﻲ ﺳﺨﺖ ﺍﻓﺰﺍﺭ ﻭ ﻧﺮﻡ ﺍﻓﺰﺍﺭ ﻣﺪﻳﺮﻳﺖ DBMSﺩﺍﺭﺩ .ﺑﻄﻮﺭ ﻛﻠﻲ ﭼﻬﺎﺭ ﻣﻌﻤﺎﺭﻱ ﺑﺮﺍﻱ ﺳﻴﺴﺘﻢ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ : -١ﻣﻌﻤﺎﺭﻱ ﻣﺘﻤﺮﻛﺰ -٢ﻣﻌﻤﺎﺭﻱ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ – ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ -٣ﻣﻌﻤﺎﺭﻱ ﺗﻮﺯﻳﻊ ﺷﺪﻩ -٤ﻣﻌﻤﺎﺭﻱ ﺑﺎ ﭘﺮﺩﺍﺯﺵ ﻣﻮﺍﺯﻱ -١-٥-٧ﻣﻌﻤﺎﺭﻱ ﻣﺘﻤﺮﻛﺰ Centeralized
ﺩﺭ ﺍﻳـﻦ ﻣﻌﻤـﺎﺭﻱ ﻳـﻚ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻫـﺎ ﺭﻭﻱ ﻳـﻚ ﺳﻴﺴـﺘﻢ ﻛﺎﻣﭙﻴﻮﺗـﺮﻱ ﻭ ﺑـﺪﻭﻥ ﺍﺭﺗﺒﺎﻁ ﺑﺎ ﺳﻴﺴﺘﻢ ﻛﺎﻣﭙﻴﻮﺗﺮﻱ ﺩﻳﮕﺮ ﺍﻳﺠﺎﺩ ﻣﻴﺸـﻮﺩ .ﺳـﺨﺖ ﺍﻓـﺰﺍﺭ ﺍﻳـﻦ ﺳﻴﺴـﺘﻢ ﻣـﻲ ﺗـﻮﺍﻧﺪ ﻛﺎﻣﭙﻴﻮﺗﺮ ﺷﺨﺼﻲ ،ﻣﺘﻮﺳﻂ ﻭ ﻳﺎ ﺑﺰﺭﮒ ﺑﺎﺷﺪ.ﺳﻴﺴﺘﻤﻲ ﻛﻪ ﺑﺮ ﺭﻭﻱ ﻛﺎﻣﭙﻴﻮﺗﺮ ﺷﺨﺼﻲ ﺍﻳﺠﺎﺩ ﻣﻲ ﺷﻮﺩ ،ﺑﻴﺸﺘﺮ ﺑﺮﺍﻱ ﻛﺎﺭﺑﺮﺩﻫﺎﻱ ﻛﻮﭼﻚ ﻭ ﺑﺎ ﺍﻣﻜﺎﻧﺎﺕ ﻣﺤﺪﻭﺩ ﺍﺳﺖ . -٢-٥-٧ﻣﻌﻤﺎﺭﻱ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ /ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ CLIENT/SERVER
ﻫـﺮ ﻣﻌﻤـﺎﺭﻱ ﻛـﻪ ﺩﺭ ﺁﻥ ﻗﺴـﻤﺘﻲ ﺍﺯ ﭘـﺮﺩﺍﺯﺵ ﺭﺍ ﻳـﻚ ﺑـﺮﻧﺎﻣﻪ ،ﺳﻴﺴـﺘﻢ ﻭ ﻳﺎ ﻣﺎﺷﻴﻦ ﺍﻧﺠﺎﻡ ﺩﻫﺪ ﻭ ﺍﻧﺠﺎﻡ ﻗﺴﻤﺖ ﺩﻳﮕﺮﻱ ﺍﺯ ﭘﺮﺩﺍﺯﺵ ﺭﺍ ﺍﺯ ﺑﺮﻧﺎﻣﻪ ،ﺳﻴﺴﺘﻢ ﻭ ﻳﺎ ﻣﺎﺷﻴﻦ ﺩﻳﮕﺮ ﺑﺨﻮﺍﻫﺪ ﻣﻌﻤﺎﺭﻱ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﻭ ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ ﻧﺎﻣﻴﺪﻩ ﻣﻲ ﺷﻮﺩ. ﺩﺭ ﻭﺍﻗـﻊ ،ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﻳﻚ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺭﺍ ﺑﺼﻮﺭﺕ ﻳﻚ ﺳﺎﺧﺘﺎﺭ ﺩﻭﻗﺴﻤﺘﻲ ﺩﺭ ﻧﻈﺮ ﻣﻲ ﮔﻴﺮﺩ :ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﻭ ﺳـﺮﻭﻳﺲ ﮔﻴـﺮﻧﺪﻩ.ﺗﻤـﺎﻡ ﺩﺍﺩﻩ ﻫـﺎ ﺩﺭ ﺑﺨـﺶ ﺳـﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﻭ ﺗﻤﺎﻡ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺩﺭ ﺑﺨﺶ ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ ﻗﺮﺍﺭ ﻣﻴﮕﻴﺮﻧﺪ. ﺍﻟﻒ -ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ : ﻳـﻚ ﺳﻴﺴﺘﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺳﺖ ﻛﻪ ﺍﺯ ﺗﻤﺎﻡ ﻋﻤﻠﻴﺎﺕ ﺍﺻﻠﻲ ﻳﻚ DBMSﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻴﻜﻨﺪ.ﺩﺭ ﻭﺍﻗﻊ ﻣﻴﺘﻮﺍﻥ ﻧﺎﻡ ﺩﻳﮕﺮﻱ ﺑﺮﺍﻱ DBMSﺭﺍ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﻧﻴﺰ ﺑﻄﻮﺭ ﺳﺎﺩﻩ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺖ. ﺏ -ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ :
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٢ /
ﺳـﺮﻭﻳﺲ ﮔﻴـﺮﻧﺪﻩ ﻫـﺎ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﻣﺨﺘﻠﻔﻲ ﻫﺴﺘﻨﺪ ﻛﻪ ﺑﺮ ﺭﻭﻱ DBMSﻗﺮﺍﺭ ﺩﺍﺭﻧﺪ .ﺍﺯ ﻗﺒﻴﻞ :ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﻧﻮﺷﺘﻪ ﺷﺪﻩ ﺗﻮﺳﻂ ﻛﺎﺭﺑﺮﺍﻥ ﻭ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ ﺗﻌﺒﻴﻪ ﺷﺪﻩ ﺩﺭ ﺳﻴﺴﺘﻢ. ﺷﻜﻞ ﺳﺎﺩﻩ ﺷﺪﻩ ﺍﻱ ﺍﺯ ﻣﻌﻤﺎﺭﻱ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ /ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ ﺭﺍ ﺩﺭ ﺯﻳﺮ ﻣﻲ ﺑﻴﻨﻴﺪ :
ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑﺮﺩﻱ
DBMS
client
Server
DB
ﻣﻌﻤـﺎﺭﻱ ﺳـﺮﻭﻳﺲ ﺩﻫـﻨﺪﻩ ،ﺳـﺮﻭﻳﺲ ﮔﻴـﺮﻧﺪﻩ ﺑﺼـﻮﺭﺗﻬﺎﻱ ﭼـﻨﺪ ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ -ﻳﻚ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ،ﻳﻚ ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ – ﭼﻨﺪ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﻭ ﭼﻨﺪ ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ -ﭼﻨﺪ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﻧﻴﺰ ﻣﻄﺮﺡ ﺍﺳﺖ. ﻣﺰﺍﻳﺎﻱ ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﻧﺴﺒﺖ ﺑﻪ ﻣﻌﻤﺎﺭﻱ ﻣﺘﻤﺮﻛﺰ : ﺗﻘﺴﻴﻢ ﭘﺮﺩﺍﺯﺵ ﻛﺎﻫﺶ ﺗﺮﺍﻓﻴﻚ ﺷﺒﻜﻪ ﺩﺭ ﻣﻌﻤﺎﺭﻱ ﺣﻮﻝ ﺷﺒﻜﻪ ﺍﺳﺘﻘﻼﻝ ﺍﻳﺴﺘﮕﺎﻩ ﻫﺎﻱ ﻛﺎﺭﻱ ﺍﺷﺘﺮﺍﻙ ﺩﺍﺩﻩ ﻫﺎ -٣-٥-٧ﻣﻌﻤﺎﺭﻱ ﺗﻮﺯﻳﻊ ﺷﺪﻩ :
Distributed
ﺍﻳـﻦ ﻣﻌﻤـﺎﺭﻱ ﺣﺎﺻـﻞ ﺗـﺮﻛﻴﺐ ﺩﻭ ﺗﻜـﻨﻮﻟﻮﮊﻱ ﺍﺳـﺖ :ﺗﻜـﻨﻮﻟﻮﮊﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﻭ ﺗﻜﻨﻮﻟﻮﮊﻱ ﺷﺒﻜﻪ .ﺩﺭ ﻳﻚ ﻧﮕﺎﻩ ﻛﻠﻲ ﻣﻴﺘﻮﺍﻥ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﺗﻮﺯﻳﻊ ﺷﺪﻩ ﺭﺍ ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺯ ﺩﺍﺩﻩ ﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﻛﻪ ﺍﺯ ﻧﻈﺮ ﻣﻨﻄﻘﻲ ﻣﺘﻌﻠﻖ ﺑﻪ ﻳﻚ ﺳﻴﺴﺘﻢ ﻣﻲ ﺑﺎﺷﻨﺪ ﻭ ﺭﻭﻱ ﺳﺎﻳﺖ ﻫﺎﻱ ﻣﺨﺘﻠﻒ ﻳﻚ ﻳﺎ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﺷﺒﻜﻪ ﺗﻮﺯﻳﻊ ﮔﺮﺩﻳﺪﻩ ﺍﻧﺪ ،ﺩﺭ ﻧﻈﺰ ﮔﺮﻓﺖ. ﺑﺮﺧﻲ ﻭﻳﮋﮔﻴﻬﺎﻱ ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ : ﻣﺠﻤﻮﻋﻪ ﺍﻱ ﺍﺳﺖ ﺍﺯ ﺩﺍﺩﻩ ﻫﺎﻱ ﻣﺮﺗﺒﻂ ﻭ ﻣﺸﺘﺮﻙ ﺩﺍﺩﻩ ﻫﺎ ﺑﻪ ﺑﺨﺸﻬﺎﻱ ﺗﻘﺴﻴﻢ ﻭ ﺩﺭ ﺳﺎﻳﺖ ﻫﺎ ﺗﻮﺯﻳﻊ ﺷﺪﻩ ﺍﻧﺪ. ﺑﻌﻀﻲ ﺍﺯ ﺑﺨﺸﻬﺎ ﻣﻤﻜﻦ ﺍﺳﺖ ﺩﺭ ﭼﻨﺪ ﻧﺴﺨﻪ )ﺑﻄﻮﺭ ﺗﻜﺮﺍﺭﻱ( ﺩﺭ ﺳﺎﻳﺘﻬﺎ ﺫﺧﻴﺮﻩ ﺷﻮﻧﺪ. ﺳﺎﻳﺘﻬﺎ ﺍﺯ ﻃﺮﻳﻖ ﻳﻚ ﺷﺒﻪ ﺑﺎ ﻫﻢ ﺍﺭﺗﺒﺎﻁ ﺩﺍﺭﻧﺪ. ﺩﺍﺩﻩ ﻫﺎﻱ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺩﺭ ﻫﺮ ﺳﺎﻳﺖ ﺗﺤﺖ ﻛﻨﺘﺮﻝ ﻳﻚ DBMSﻣﻲ ﺑﺎﺷﻨﺪ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٣ /
ﻣﻬﻤﺘـﺮﻳﻦ ﺍﺻـﻞ ﺩﺭ ﺳﻴﺴﺘﻢ ﭘﺎﻳﮕﺎﻫﻲ ﺗﻮﺯﻳﻊ ﺷﺪﻩ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﺳﻴﺴﺘﻢ ﺑﺎﻳﺪ ﭼﻨﺎﻥ ﻋﻤﻞ ﻛﻨﺪ ﻛﻪ ﺍﺯ ﻧﻈﺮ ﻛﺎﺭﺑﺮﺍﻥ ﻣﺸﺎﺑﻪ ﺑﺎ ﻳﻚ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻣﺘﻤﺮﻛﺰ ﺑﺎﺷﺪ.ﺍﻳﻦ ﻭﻳﮋﮔﻲ ﺗﺤﺖ ﻋﻨﻮﺍﻥ ﺷﻔﺎﻓﻴﺖ ﺩﺭ ﺳﻴﺴﺘﻤﻬـﺎﻱ ﺗﻮﺯﻳﻊ ﺷﺪﻩ ﻣﻄﺮﺡ ﺍﺳﺖ ﻭ ﺗﻔﺎﻭﺕ ﺳﻴﺴﺘﻤﻬﺎﻱ ﺗﻮﺯﻳﻌﻲ ﻭ ﺳﺮﻭﻳﺲ ﮔﻴﺮﻧﺪﻩ – ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﻧﻴﺰ ﺩﺭ ﻫﻤﻴﻦ ﺍﺳﺖ. -١ -٣-٥-٧ﻣﺰﺍﻳﺎﻱ ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﺳﺎﺯﮔﺎﺭﻱ ﻭ ﻫﻤﺎﻫﻨﮕﻲ ﺑﺎ ﻣﺎﻫﻴﺖ ﺳﺎﺯﻣﺎﻧﻬﺎﻱ ﻧﻮﻳﻦ ﻛﺎﺭﺍﻳﻲ ﺑﻴﺸﺘﺮ ﺩﺭ ﭘﺮﺩﺍﺯﺵ ﺩﺍﺩﻩ ﻫﺎ ﺑﻮﻳﮋﻩ ﺩﺭ ﺳﻴﺴﺘﻤﻬﺎﻱ ﺑﺴﻴﺎﺭ ﺑﺰﺭﮒ ﺩﺳﺘﻴﺎﺑﻲ ﺑﻬﺘﺮ ﺑﻪ ﺩﺍﺩﻩ ﻫﺎ -٢-٣-٥-٣
ﻣﻌﺎﻳﺐ
ﭘﻴﭽﻴﺪﮔﻲ ﻃﺮﺍﺣﻲ ﺳﻴﺴﺘﻢ ﭘﻴﭽﻴﺪﮔﻲ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﻫﺰﻳﻨﻪ ﺑﻴﺸﺘﺮ -٤-٥-٧ﻣﻌﻤﺎﺭﻱ ﺑﺎ ﭘﺮﺩﺍﺯﺵ ﻣﻮﺍﺯﻱParallel :
ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﺑﺎ ﺳﺎﺧﺖ ﻭ ﮔﺴﺘﺮﺵ ﻣﺎﺷﻴﻨﻬﺎﻱ ﻣﻮﺍﺯﻱ ،ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻫﺎﻱ ﺑﺴﻴﺎﺭ ﺑﺰﺭﮒ ﻣﻮﺭﺩ ﺗﻮﺟﻪ ﻗﺮﺍﺭ ﮔﺮﻓﺖ .ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﮔﺴﺘﺮﺵ ﻳﺎﻓﺘﻪ ﻣﻌﻤﺎﺭﻱ ﺗﻮﺯﻳﻊ ﺷﺪﻩ ﺍﺳﺖ ﻭ ﺑﺮﺍﻱ ﺗﺎﻣﻴﻦ ﻛﺎﺭﺍﻳﻲ ﻭ ﺩﺳﺘﻴﺎﺑﻲ ﺳﺮﻳﻊ ﻃﺮﺍﺣﻲ ﻣﻴﺸﻮﺩ .ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩ ﻫـﺎ ﺑـﺎ ﻣﻌﻤـﺎﺭﻱ ﭘﺮﺩﺍﺯﺵ ﻣﻮﺍﺯﻱ ،ﺑﻄﻮﺭ ﻛﻠﻲ ﭼﻨﺪﻳﻦ ﻃﺮﺡ ﺍﺯ ﺍﻳﻦ ﻣﻌﻤﺎﺭﻱ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﻣﻄﺎﻟﻌﻪ ﺁﻧﻬﺎ ﺧﺎﺭﺝ ﺍﺯ ﻣﻄﺎﻟﺐ ﺍﻳﻦ ﺩﺭﺱ ﺍﺳﺖ: ﻣﻌﻤﺎﺭﻱ ﺑﺎ ﺣﺎﻓﻈﻪ ﻣﺸﺘﺮﻙ ﻣﻌﻤﺎﺭﻱ ﺑﺎ ﺩﻳﺴﻚ ﻣﺸﺘﺮﻙ ﻣﻌﻤﺎﺭﻱ ﺳﻠﺴﻠﻪ ﻣﺮﺍﺗﺒﻲ -٦-٧ﺳﻴﺴﺘﻢ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎﻱ ﻫﻤﺮﺍﻩ Mobile Database System
ﺑـﺎ ﺭﺷـﺪ ﺳـﺮﻳﻊ ﺗﻜـﻨﻮﻟﻮﮊﻱ ﺍﺭﺗـﺒﺎﻃﺎﺕ ،ﻧـﻮﻉ ﺟﺪﻳـﺪﻱ ﺍﺯ ﺳﻴﺴـﺘﻢ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ﭘﺪﻳﺪ ﺁﻣﺪﻩ ﻭ ﺩﺭ ﺣﺎﻝ ﮔﺴﺘﺮﺵ ﺍﺳﺖ ﻛﻪ ﺳﻴﺴـﺘﻤﻬﺎﻱ ﭘﺎﻳﮕـﺎﻩ ﺩﺍﺩﻩ ﻫﻤـﺮﺍﻩ ﻧﺎﻣـﻴﺪﻩ ﻣﻴﺸـﻮﻧﺪ .ﺩﺭ ﺍﻳـﻦ ﻣﻌﻤـﺎﺭﻱ ،ﻳـﻚ ﻳﺎ ﺑﻴﺶ ﺍﺯ ﻳﻚ ﻛﺎﻣﭙﻴﻮﺗﺮ ﻣﺘﻮﺳﻂ ﻳﺎ ﺑﺰﺭﮒ ﻧﻘﺶ ﺳـﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﺭﺍ ﺍﻳﻔﺎ ﻣﻴﻜﻨﺪ .ﻫﺮ ﻛﺎﺑﺮﺑﺮ ﻛﺎﻣﭙﻴﻮﺗﺮ ﻛﻮﭼﻚ ﻫﻤﺮﺍﻩ ﺧﻮﺩ ﺭﺍ ﺩﺍﺭﺩ ﻛﻪ ﺩﺭ ﺁﻥ ﺩﺍﺩﻩ ﻫﺎﻱ ﻋﻤﻠﻴﺎﺗﻲ ﻭ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻱ ﻛﺎﺭﺑـﺮﺩﻱ ﻣـﻮﺭﺩ ﻧـﻴﺎﺯﺵ ﺫﺧﻴـﺮﻩ ﺷـﺪﻩ ﺍﻧﺪ.ﻛﺎﺭﺑﺮ ﻣﻴﺘﻮﺍﻧﺪ ﺍﺯ ﻫﺮ ﺟﺎﻳﻲ ﺑﺎ ﺳﻴﺴﺘﻢ ﺳﺮﻭﻳﺲ ﺩﻫﻨﺪﻩ ﻣﻮﺭﺩ ﻧﻈﺮﺵ ﻣﺮﺗﺒﻂ ﺑﻮﺩﻩ ﻭ ﭘﺮﺩﺍﺯﺵ ﻫﺎﻱ ﻣﻮﺭﺩ ﻧﻈﺮﺵ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﺪ. ﻣﻮﺿﻮﻋﺎﺕ ﺗﺤﻘﻴﻘﺎﺗﻲ: -١ﺑﻪ ﻧﻈﺮ ﺷﻤﺎ ﭼﻪ ﻋﻮﺍﻣﻠﻲ ﺩﺭ ﺍﻧﺘﺨﺎﺏ ﻳﻚ DBMSﻧﻘﺶ ﺩﺍﺭﻧﺪ ؟ -٢ﻳﻚ DBMSﺭﺍﺑﻄﻪ ﺍﻱ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺘﻪ ﻭ ﺍﺟﺰﺍﻱ ﺁﻥ ﺭﺍ ﺑﺮﺭﺳﻲ ﻧﻤﺎﻳﻴﺪ. ODBC -٣ JDBC -٤
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﺗﻤﺮﻳﻨﺎﺕ ﺍﻳﻦ ﻓﺼﻞ:
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٤ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٥ /
ﻓﺼﻞ ﻫﺸﺘﻢ :ﺗﺮﻣﻴﻢ -١-٨ﺗﻌﺮﻳﻒ ﺗﺮﻣﻴﻢ ﺗـﺮﻣﻴﻢ :ﻳﻌﻨـﻲ ﺍﻣﻜـﺎﻥ ﺗﺸـﺨﻴﺺ ﺍﺷـﻜﺎﻻﺕ ﺍﺣﺘﻤﺎﻟـﻲ ﺍﻳﺠﺎﺩ ﺷﺪﻩ ﺩﺭ ﺣﻴﻦ ﺍﺟﺮﺍﻱ ﺑﺮﻧﺎﻣﻪ ﻭ ﺑﺎﺯﺳﺎﺯﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﻛﻪ ﻻ ﺩﺭ ﺍﺛﺮ ﺑﺮﻭﺯ ﺍﺷﻜﺎﻝ ﺩﺭ ﺳﻴﺴﺘﻢ ﻧﺎﻗﺺ ﺷﺪﻩ ﺍﺳﺖ .ﺑﺮﺍﻱ ﺗﺸﺨﻴﺺ ﺍﺷﻜﺎﻝ ﻭ ﺗﺮﻣﻴﻢ ﺑﺎﻧﻚ ﺩﻭ ﻛﺎﺭ ﺑﺎﻳﺴﺘﻲ ﺍﻧﺠﺎﻡ ﺷﻮﺩ: ﺍﺣﺘﻤﺎ ﹼ ﺍﻟﻒ :ﺍﻗﺪﺍﻣﺎﺕ ﻗﺒﻞ ﺍﺯ ﺑﺮﻭﺯ ﻣﺸﻜﻞ ﻭﻗﺘﻲ ﺑﺮﻧﺎﻣﻪ ﺍﺟﺮﺍﻱ ﻋﺎﺩﻱ ﺧﻮﺩ ﺭﺍ ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﺪ ﺑﺎﻳﺪ DBMSﻳﻜﺴﺮﻱ ﺍﻃﻼﻋﺎﺕ ﺭﺍ ﺫﺧﻴﺮﻩ ﻛﻨﺪ ﺗﺎ ﺍﮔﺮ ﻣﺸﻜﻠﻲ ﭘﻴﺶ ﺁﻣـﺪ ﺑـﺘﻮﺍﻧﺪ ﺗـﺮﻣﻴﻢ ﻧﻤﺎﻳـﺪ .ﺩﺭ ﺍﻳـﻦ ﻣـﺮﺣﻠﻪ ﺑﻌـﻨﻮﺍﻥ ﭘـﻴﺶ ﺑﻴﻨـﻲ ﺑـﺮﻭﺯ ﻣﺸﻜﻞ ،ﺩﺭ ﺣﻴﻦ ﺍﺟﺮﺍﻱ ﺑﺮﻧﺎﻣﻪ ﺍﻗﺪﺍﻡ ﺑﻪ ﺫﺧﻴﺮﻩ ﺳﺎﺯﻱ ﺍﻃﻼﻋﺎﺗﻲ ﻣﻲ ﺷﻮﺩ ﺗﺎ ﺩﺭ ﺻﻮﺭﺕ ﺑﺮﻭﺯ ﻣﺸﻜﻞ ﺑﺘﻮﺍﻥ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺁﻧﻬﺎ ﺍﺛﺮ ﻧﺎﻣﻄﻠﻮﺏ ﺭﻭﻱ ﺍﻃﻼﻋﺎﺕ ﺭﺍ ﺧﻨﺜﻲ ﻧﻤﻮﺩ. ﺏ :ﺍﻗﺪﺍﻣﺎﺕ ﺑﻌﺪﺍﺯ ﺑﺮﻭﺯ ﺍﺷﻜﺎﻝ ﺷﺎﻣﻞ ﺍﻗﺪﺍﻣﺎﺗﻲ ﺍﺳﺖ ﻛﻪ DBMSﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﻃﻼﻋﺎﺕ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺩﺭ ﻣﺮﺣﻠﻪ ﻗﺒﻞ ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﺪ ﺗﺎ ﻧﺎﻫﻤﺎﻫﻨﮕﻲ ﻭ ﻧﺎﺳﺎﺯﮔﺎﺭﻱ ﺍﻳﺠﺎﺩ ﺷﺪﻩ ﺩﺭ ﺑﺎﻧﻚ ﺩﺭ ﺍﺛﺮ ﺑﺮﻭﺯ ﺍﺷﻜﺎﻝ ﺭﺍ ﺭﻓﻊ ﻧﻤﺎﻳﺪ. -٢-٨ﻣﺪﻳﺮﻳﺖ ﺗﺮﻣﻴﻢ: ﻳﻜﻲ ﺍﺯ ﻗﺴﻤﺘﻬﺎﻱ DBMSﻣﺪﻳﺮﻳﺖ ﺗﺮﻣﻴﻢ ﻣﻲ ﺑﺎﺷﺪ ﻛﻪ ﻣﺴﺌﻮﻟﻴﺖ ﺣﻔﻆ ﻳﻜﭙﺎﺭﭼﮕﻲ ﺍﻃﻼﻋﺎﺕ ﺩﺭ ﺣﻴﻦ ﺍﺟﺮﺍﻱ ﺑﺮﻧﺎﻣﻪ ﺑﻪ ﻋﻬﺪﻩ ﺁﻥ ﺍﺳﺖ .ﺍﻳﻦ ﻣﺴﺌﻮﻟﻴﺖ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﻧﺠﺎﻡ ﻣﻲ ﺷﻮﺩ: ﺍﻟﻒ :ﺗﺸﺨﻴﺺ ﺍﺷﻜﺎﻝ :ﺍﮔﺮ ﺩﺭ ﺣﻴﻦ ﺍﺟﺮﺍﻱ ﺑﺮﻧﺎﻣﻪ ﻣﺸﻜﻠﻲ ﺩﺭ ﺳﻴﺴﺘﻢ ﺭﺥ ﺩﺍﺩﻩ ﺑﺎﺷﺪ ﺗﺸﺨﻴﺺ ﺩﺍﺩﻩ ﻣﻲ ﺷﻮﺩ. ﺏ :ﺣﻔﻆ ﻳﻜﭙﺎﺭﭼﮕﻲ :ﺍﮔﺮ ﺑﺮﻧﺎﻣﻪ ﻧﻴﻤﻪ ﻛﺎﺭﻩ ﺭﻫﺎ ﺷﺪﻩ ﺑﺎﺷﺪ ﺑﺎﻋﺚ ﻋﺪﻡ ﻳﻜﭙﺎﺭﭼﮕﻲ ﺍﻃﻼﻋﺎﺕ ﺷﺪﻩ ﻭ ﺁﻥ ﺭﺍ ﺭﻓﻊ ﻣﻲ ﻛﻨﺪ. -١-٢-٨ﺩﺳﺘﻪ ﺑﻨﺪﻱ ﺧﻄﺎﻫﺎ : -١ﺧﻄﺎﻫﺎﻱ ﺗﺮﺍﻛﻨﺶ ﻫﺎ ﺍﻟﻒ(ﺧﻄﺎﻫﺎﻱ ﻣﻨﻄﻘﻲ :ﺩﺭ ﺻﻮﺭﺕ ﻛﺎﻣﻞ ﻧﺸﺪﻥ ﺗﺮﺍﻛﻨﺶ ﺏ(ﺧﻄﺎﻫـﺎﻱ ﺳﻴﺴـﺘﻤﻲ :ﺑﺎﻧـﻚ ﺍﻃﻼﻋﺎﺗـﻲ ﻣﻤﻜـﻦ ﺍﺳﺖ ﻳﻚ ﺗﺮﺍﻛﻨﺶ ﺩﺭ ﺣﺎﻝ ﺍﺟﺮﺍ ﺭﺍ ﻣﺘﻮﻗﻒ ﻛﻨﺪ ﻛﻪ ﺍﻳﻦ ﺍﻣﺮ ﻣﻤﻜﻦ ﺍﺳﺖ ﺩﺭ ﺍﺛﺮ ﺧﻄﺎ ﻭ ﻳﺎ ﻭﺟﻮﺩ ﺑﻦ ﺑﺴﺖ ﺻﻮﺭﺕ ﮔﻴﺮﺩ. -٢ﺧﻄﺎﻱ ﺧﺮﺍﺑﻲ ﺳﻴﺴﺘﻢ : ﺧﻄﺎﻱ ﺳﺨﺖ ﺍﻓﺰﺍﺭ ﻭ ﻳﺎ ﺧﻄﺎﻱ ﻧﺮﻡ ﺍﻓﺰﺍﺭﻱ ﺑﺎﺷﺪ ﻛﻪ ﺑﺎﻋﺚ ﺧﺮﺍﺑﻲ ﺳﻴﺴﺘﻢ ﻣﻲ ﮔﺮﺩﺩ. -٣ﺧﻄﺎﻱ ﺩﻳﺴﻚ: ﺧﺮﺍﺑﻲ ﻫﺪ ﺩﻳﺴﻚ ﻭ ﻳﺎ ﺧﻄﺎﻫﺎﻱ ﻣﺸﺎﺑﻪ ﻛﻪ ﺑﺎﻋﺚ ﺍﺯ ﺑﻴﻦ ﺭﻓﺘﻦ ﺑﺨﺸﻲ ﺍﺯ ﻳﻚ ﺩﻳﺴﻚ ﻣﻲ ﮔﺮﺩﻧﺪ. -٣-٨ﺗﺮﻣﻴﻢ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺛﺒﺖ ﻭﻗﺎﻳﻊ )(Log-Based Recovery
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٦ /
ﺭﺍﻳﺠﺘـﺮﻳﻦ ﺷﻴﻮﻩ ﺭﻓﻊ ﺍﺷﻜﺎﻝ ،ﺛﺒﺖ ﻭﻗﺎﻳﻊ ﻣﻲ ﺑﺎﺷﺪ ﻛﻪ ﺩﺭ ﺣﻴﻦ ﺍﺟﺮﺍﻱ ﻋﺎﺩﻱ ﺗﺮﺍﻛﻨﺶ ﻳﻜﺴﺮﻱ ﺍﻃﻼﻋﺎﺕ ﺑﻨﺎﻡ
logﻛﻪ
ﻣﺒـﻴﻦ ﺗﻐﻴﻴـﺮﺍﺕ ﺍﻋﻤـﺎﻝ ﺷـﺪﻩ ﺩﺭ ﺍﻃﻼﻋـﺎﺕ ﺍﺳـﺖ ﺫﺧﻴـﺮﻩ ﺷـﺪﻩ ﺗـﺎ ﺩﺭ ﺻـﻮﺭﺕ ﻟـﺰﻭﻡ ﺍﺯ ﺁﻧﻬـﺎ ﺑﺮﺍﻱ ﺗﺮﻣﻴﻢ ﺍﻃﻼﻋﺎﺕ ﺍﺳﺘﻔﺎﺩﻩ ﮔﺮﺩﺩ.ﺩﺭ ﺣﻴﻦ ﺍﺟﺮﺍﻱ ﻫﺮ ﺗﺮﺍﻛﻨﺶ ﺍﻃﻼﻋﺖ ﺯﻳﺮ ﺩﺭ logﺛﺒﺖ ﻣﻲ ﮔﺮﺩﻧﺪ: -ﺛـﺒﺖ ﺷـﺮﻭﻉ ﺗـﺮﺍﻛﻨﺶ :ﻭﻗﺘﻴﻜﻪ ﺗﺮﺍﻛﻨﺶ Tiﺷﺮﻭﻉ ﻣﻲ ﺷﻮﺩ ﺍﻃﻼﻋﺖ > <Ti,Startﺑﺮ ﺭﻭﻱ ﺭﻛﻮﺭﺩ logﺛﺒﺖ
ﻣﻲ
ﮔﺮﺩﺩ. ﺛـﺒﺖ ﻋﻤﻠـﻴﺎﺕ ﺗﺮﺍﻛﻨﺶ ﻛﻪ ﺩﺭ ﺍﺯﺍﻱ ﻫﺮ ﻋﻤﻞ Writeﺍﻧﺠﺎﻡ ﻣﻲ ﮔﻴﺮﺩ .ﺍﻃﻼﻋﺎﺕ > <Ti,Xi,V1,V2ﺩﺭ logﺛﺒﺖ ﻣﻲﺷﻮﺩ ﻛﻪ V1ﻣﻘﺪﺍﺭ Xjﻗﺒﻞ ﺍﺯ ﻋﻤﻞ Writeﻭ V2ﻣﻘﺪﺍﺭ ﻧﻮﺷﺘﻪ ﺷﺪﻩ ﺩﺭ Xﻣﻲ ﺑﺎﺷﺪ).ﺑﻌﺪ ﺍﺯ ﻋﻤﻞ ﭘﺮﺩﺍﺯﺵ( ﺛﺒﺖ ﭘﺎﻳﺎﻥ ﺗﺮﺍﻛﻨﺶﻭﻗﺘﻴﻜﻪ ﺗﺮﺍﻛﻨﺶ ﭘﺎﻳﺎﻥ ﻳﺎﻓﺖ ﺭﻛﻮﺭﺩ > <Ti,Commitﺩﺭ logﻧﻮﺷﺘﻪ ﻣﻲ ﺷﻮﺩ. ﺑﺮﺧﻲ ﻧﻜﺎﺕ ﻣﻬﻢ : -١ﺯﻣﺎﻥ ﺛﺒﺖ ﺭﻛﻮﺭﺩ :log ﻗﺒﻞ ﺍﺯ ﺍﺟﺮﺍﻱ ﻫﺮ ﺩﺳﺘﻮﺭ writeﺩﺭ ﻳﻚ ﺗﺮﺍﻛﻨﺶ ،ﺭﻛﻮﺭﺩ ﺷﺮﺡ ﻭﻗﺎﻳﻊ ﺁﻥ ﺑﺎﻳﺪ ﺍﻳﺠﺎﺩ ﺷﺪﻩ ﻭ ﺩﺭ ﺣﺎﻓﻈﻪ ﺛﺎﻧﻮﻳﻪ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺑﺎﺷﺪ ﺗﺎ ﺩﺭ ﺻﻮﺭﺕ ﻟﺰﻭﻡ ﺑﺘﻮﺍﻥ ﺍﺯ ﺁﻥ ﺑﺮﺍﻱ ﺍﻋﻤﺎﻝ ﺗﺮﻣﻴﻢ ﺍﻃﻼﻋﺎﺕ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ. -٢ﻧﺤﻮﻩ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ : log ﺩﺭ ﺻﻮﺭﺕ ﺑﺮﻭﺯ ﻣﺸﻜﻞ ﺩﺭ ﺍﺟﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﭘﺲ ﺍﺯ ﺭﺍﻩ ﺍﻧﺪﺍﺯﻱ ﻣﺠﺪﺩ ﺳﻴﺴﺘﻢ ﺍﻃﻼﻋﺎﺕ logﺭﺍ ﺑﺮﺭﺳﻲ ﻛﺮﺩﻩ ﻭ ﺩﺭ ﺻﻮﺭﺕ ﻟﺰﻭﻡ ﺍﻗﺪﺍﻡ ﺑﻪ ﺗﺮﻣﻴﻢ ﺍﻃﻼﻋﺎﺕ ﻣﻲ ﻛﻨﺪ. -٣ﺩﺳﺘﻮﺭﺍﺕ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﺩﺭ ﺗﺮﻣﻴﻢ: ﺩﺭ ﺷﻴﻮﻩ logﺩﻭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺑﺮﺍﻱ ﺗﺮﻣﻴﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﻧﺪ: ﺍﻟﻒ( ﺩﺳﺘﻮﺭ Redo
ﺑﺎ ﺍﺟﺮﺍﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ،ﻋﻤﻠﻴﺎﺕ ﺍﺟﺮﺍ ﺷﺪﻩ ﺗﻮﺳﻂ ﺗﺮﺍﻛﻨﺶ ﺑﺮﺍﻱ ﺣﺼﻮﻝ ﻳﻜﭙﺎﺭﭼﮕﻲ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﻃﻼﻋﺎﺕ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺩﺭ logﺩﻭﺑﺎﺭﻩ ﺍﺟﺮﺍ ﻣﻲ ﺷﻮﻧﺪ .ﺑﺎﻳﺴﺘﻲ ﺗﻮﺟﻪ ﺩﺍﺷﺖ ﺑﺎ ﺍﺟﺮﺍﻱ ﺩﺳﺘﻮﺭ ﻓﻮﻕ ﻋﻤﻠﻴﺎﺕ ﺗﺮﺍﻛﻨﺶ ﻣﻤﻜﻦ ﺍﺳﺖ ﺭﻭﻱ ﺑﻌﻀـﻲ ﺍﺯ ﺍﻃﻼﻋـﺎﺕ ﺩﻭﺑـﺎﺭ ﻭ ﺑﻌﻀـﻲ ﺩﻳﮕـﺮ ﻳﻜـﺒﺎﺭ ﺍﻋﻤـﺎﻝ ﺷـﻮﻧﺪ.ﺩﺭ ﺍﻳﻨﺼـﻮﺭﺕ ﺍﺟـﺮﺍﻱ ﺩﻭﺑـﺎﺭﻩ ﺗﺮﺍﻛﻨﺶ ﻧﺒﺎﻳﺪ ﺑﺎﻋﺚ ﻋﺪﻡ ﻳﻜﭙﺎﺭﭼﮕﻲ ﺍﻃﻼﻋﺎﺕ ﺷﻮﺩ ﻛﻪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺭﻛﻮﺭﺩ ﺛﺒﺖ ﻭﻗﺎﻳﻊ ﺍﻧﺠﺎﻡ ﻣﻲ ﺷﻮﺩ. ﺏ( ﺩﺳﺘﻮﺭ Undo
ﺑـﺎ ﺍﺟـﺮﺍﻱ ﺍﻳـﻦ ﺩﺳﺘﻮﺭ ﻋﻤﻠﻴﺎﺕ ﺍﺟﺮﺍ ﺷﺪﻩ ﺗﻮﺳﻂ ﺗﺮﺍﻛﻨﺶ ﺑﺮﺍﻱ ﺣﺼﻮﻝ ﻳﻜﭙﺎﺭﭼﮕﻲ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﻃﻼﻋﺎﺕ ﺫﺧﻴﺮﻩ ﺷﺪﻩ ﺩﺭ logﺧﻨﺜﻲ ﻣﻲ ﮔﺮﺩﻧﺪ. -٤-٨ﻣﺘﺪﻫﺎﻱ ﺗﺮﻣﻴﻢ ﺑﻜﺎﺭ ﺭﻓﺘﻪ ﺩﺭ ﺭﻭﺵ ) log-basedﺛﺒﺖ ﻭﻗﺎﻳﻊ( ﻣﻲ ﺩﺍﻧﻴﻢ ﺑﺤﺚ ﺗﺮﻣﻴﻢ ﻣﻮﻗﻌﻲ ﻣﻄﺮﺡ ﺍﺳﺖ ﻛﻪ ﺣﺪﺍﻗﻞ ﻳﻚ ﻋﻤﻞ ﻧﻮﺷﺘﻦ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ .ﺩﺭ ﺭﺍﺑﻄﻪ ﺑﺎ ﺍﻋﻤﺎﻝ ﻧﺘﻴﺠﻪ ﻳﻚ ﺗﺮﺍﻛﻨﺶ ﺩﻭ ﺷﻴﻮﻩ ﻣﻄﺮﺡ ﻣﻲ ﺷﻮﺩ: -١ﺗﺎﺧﻴﺮ ﺍﻋﻤﺎﻝ ﺗﻐﻴﻴﺮﺍﺕ.
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٧ /
-٢ﺍﻋﻤﺎﻝ ﺁﻧﻲ ﺗﺎﺛﻴﺮﺍﺕ. -١-٤-٨ﺭﻭﺵ ﺗﺎﺧﻴﺮ ﺍﻋﻤﺎﻝ ﺗﺎﺧﻴﺮﺍﺕ Deferred Database Modification
ﺩﺭ ﺍﻳـﻦ ﺭﻭﺵ ﺗﻤﺎﻣـﻲ ﺍﻋﻤـﺎﻝ ﻧﻮﺷـﺘﻦ ﺗـﺎ ﺍﻧـﺘﻬﺎﻱ ﺗـﺮﺍﻛﻨﺶ ﺑـﻪ ﺗﺎﺧﻴـﺮ ﻣـﻲ ﺍﻓﺘـﻨﺪ .ﺑﻌﺒﺎﺭﺗـﻲ ﺍﮔـﺮ ﺩﺭ ﻳﻚ ﺗﺮﺍﻛﻨﺶ ﺩﻭ ﺩﺳﺘﻮﺭ )write(Aﻭ ) write(Bﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ: )read(A )write(A ).read(B .. )write(B
ﺩﺳﺘﻮﺭ )write(Aﻭ) write(Bﺭﺍ ﺩﺭ ﺁﺧﺮ ﺗﺮﺍﻛﻨﺶ ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﺪ. ﺍﻃﻼﻋﺎﺗﻲ ﻛﻪ ﺩﺭ ﺍﻳﻦ ﺭﻭﺵ ﺑﺎﻳﺴﺘﻲ ﺩﺭ logﺛﺒﺖ ﮔﺮﺩﺩ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ: ﺗﺮﺍﻛﻨﺶ ﺑﺎ ﻧﻮﺷﺘﻦ ﺩﺳﺘﻮﺭ > <Ti,Startﺩﺭ logﺁﻏﺎﺯ ﻣﻲ ﺷﻮﺩ.ﺑـﺎ ﺗـﻮﺟﻪ ﺑـﻪ ﻋﻤﻠﻜـﺮﺩ ﻣﻜﺎﻧﻴـﺰﻡ ﺗـﺮﻣﻴﻢ ﻧـﻴﺎﺯﻱ ﺑـﻪ ﻧﮕﻬـﺪﺍﺭﻱ V1ﺩﺭ ) write(xﻧﻤﻲ ﺑﺎﺷﺪ )ﭼﻮﻥ ﻋﻤﻞ Undoﻧﺪﺍﺭﻳﻢ( ﻟﺬﺍ ﺍﻃﻼﻋـﺎﺕ ><Ti,X,Vﺩﺭ logﺛـﺒﺖ ﻣﻲ ﺷﻮﺩ ﻛﻪ Vﻣﻘﺪﺍﺭ ﺟﺪﻳﺪ Xﺍﺳﺖ.ﻋﻤﻞ ﻧﻮﺷﺘﻦ ﺩﺭ ﺍﻳﻦ ﻟﺤﻈﻪ ﺻﻮﺭﺕ ﻧﻤﻲ ﭘﺬﻳﺮﺩ ﺑﻠﻜﻪ ﺑﻪ ﺗﺎﺧﻴﺮ ﻣﻲ ﺍﻓﺘﺪ. ﻗـﺒﻞ ﺍﺯ ﺍﻳـﻨﻜﻪ ﺍﻭﻟـﻴﻦ writeﺍﺟـﺮﺍ ﺷـﻮﺩ ﺭﻛﻮﺭﺩ > <Ti,Commitﺭﺍ ﺩﺭ logﺛﺒﺖ ﻣﻲ ﻛﻨﺪ commit) .ﺳﻴﺴﺘﻢ ﺑﻌﺪ ﺍﺯﺁﺧﺮﻳﻦ writeﺍﺳﺖ ﺍﻣﺎ ﺩﺳﺘﻮﺭ commitﺍﻱ ﻛﻪ ﺩﺭ logﺛﺒﺖ ﻣﻲ ﺷﻮﺩ ﻗﺒﻞ ﺍﺯ ﺍﻭﻟﻴﻦ writeﻣﻲ ﺑﺎﺷﺪ(. •
ﺭﻭﺵ ﺗﺮﻣﻴﻢ:
ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻨﻜﻪ ﺩﺭ ﭼﻪ ﻣﺮﺣﻠﻪ ﺍﻱ ﺍﺯ ﺗﺮﺍﻛﻨﺶ ﺳﻴﺴﺘﻢ ﺩﭼﺎﺭ ﻣﺸﻜﻞ ﺷﺪﻩ ﺍﺳﺖ ﺗﺮﻣﻴﻢ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﻧﺠﺎﻡ ﻣﻲ ﺷﻮﺩ: ﺍﻟﻒ(ﻗﺒﻞ ﺍﺯ ﭘﺎﻳﺎﻥ ﻋﻤﻠﻴﺎﺕ ﺗﺮﺍﻛﻨﺶ: ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺍﻃﻼﻋﺎﺕ ﺩﺭﻭﻥ logﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ: ><Ti,Start ><Ti,X1,V1 . ><Ti,Xi,Vi
ﻟـﺬﺍ ﺍﺯ ﻋﻤﻠـﻴﺎﺕ ﺍﻧﺠـﺎﻡ ﺷـﺪﻩ ﺻـﺮﻓﻨﻈﺮ ﻣـﻲ ﮔﺮﺩﺩ .ﺯﻳﺮﺍ ﺍﺛﺮ ﺍﺟﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﻗﺒﻞ ﺍﺯ ﺧﺮﺍﺑﻲ ﺳﻴﺴﺘﻢ ﺭﻭﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻣﻨﻌﻜﺲ ﻧﺸﺪﻩ ﺍﺳﺖ ﻟﺬﺍ ﺍﺟﺮﺍﻱ ﺁﻥ ﻧﺎﺩﻳﺪﻩ ﮔﺮﻓﺘﻪ ﻣﻲ ﺷﻮﺩ. ﺏ( ﭘﺲ ﺍﺯ ﭘﺎﻳﺎﻥ ﻋﻤﻠﻴﺎﺕ ﺗﺮﺍﻛﻨﺶ : ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺍﻃﻼﻋﺎﺕ logﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ: ><Ti,Start ><Ti,X1,V2 ><Ti,Xn,Vn2 ><Ti,Commit
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٨ /
ﻟـﺬﺍ ﭼـﻮﻥ ﻋﻤﻠـﻴﺎﺕ ﺗـﺮﺍﻛﻨﺶ ﻗـﺒﻞ ﺍﺯ ﺧﺮﺍﺑـﻲ ﺳﻴﺴـﺘﻢ ﭘﺎﻳﺎﻥ ﻳﺎﻓﺘﻪ ﺍﺳﺖ ﻭ ﺍﺯ ﻃﺮﻓﻲ ﻣﻤﻜﻦ ﺍﺳﺖ ﺛﺒﺖ ﺗﻤﺎﻣﻲ ﺁﻧﻬﺎ ﺍﻧﺠﺎﻡ ﻧﺸﺪﻩ ﺍﺳﺖ ﻟﺬﺍ ﺍﺟﺮﺍﻱ ﺩﻭﺑﺎﺭﻩ ﺗﺮﺍﻛﻨﺶ ﺻﻮﺭﺕ ﻣﻲ ﭘﺬﻳﺮﺩ ﻳﻌﻨﻲ ﺩﺳﺘﻮﺭ > < redo,Tiﺍﻧﺠﺎﻡ ﻣﻲ ﺷﻮﺩ. ﻣﺜﺎﻝ :ﻓﺮﺽ ﻛﻨﻴﺪ ﺗﺮﺍﻛﻨﺶ ﻫﺎﻱ T0ﻭ T1ﺭﺍ ﺩﺍﺭﻳﻢ ﻭ T0ﻗﺒﻞ ﺍﺯ T1ﺍﺟﺮﺍ ﻣﻲ ﺷﻮﺩ: )T1 :Read(C C:=C-100 )write(C
)T0 :Read(A A:=A-50000 )write(A )Read(B B:=B+50000 )write(B
ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻃﻼﻋﺎﺕ ﻣﻮﺟﻮﺩ ﺩﺭ LOGﺧﻮﺍﻫﻴﻢ ﺩﺍﺷﺖ: >
ﺍﻟﻒ(
>< T0,B,2050000
ﺩﺭ ﺍﻳﻦ ﺣﺎﻟﺖ ﻫﻴﭻ ﻋﻤﻠﻲ ﺻﻮﺭﺕ ﻧﻤﻲ ﮔﻴﺮﺩ. ﺏ(
>
>< T0,B,2050000 >
ﺝ(
>
>< T0,B,2050000 >
ﺩﺭ ﺍﻳـﻦ ﺭﻭﺵ ﺣﺎﺻﻞ ﻫﺮ ﻋﻤﻠﻴﺎﺕ writeﺭﻭﻱ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺳﺮﻳﻌﺎ” ﺑﻪ ﺑﺎﻧﻚ ﻣﻨﻌﻜﺲ ﻣﻲ ﺷﻮﺩ ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﻫﺮ ﺩﺳﺘﻮﺭ writeﺩﺭ ﻣﺤـﻞ ﻇﻬـﻮﺭ ﺧﻮﺩ ﺍﺟﺮﺍ ﻣﻲ ﺷﻮﺩ .ﺍﺯ ﺁﻧﺠﺎﺋﻴﻜﻪ ﺩﺭ ﺍﻳﻨﺠﺎ ﻋﻤﻞ undoﻧﻴﺰ ﺩﺍﺭﻳﻢ ﻟﺬﺍ ﻣﻘﺪﺍﺭ ﻗﺒﻠﻲ ﻭ ﻣﻘﺪﺍﺭ ﺟﺪﻳﺪ ﻫﺮ ﻣﺘﻐﻴﻴﺮ ﻧﻴﺎﺯ ﺍﺳﺖ. ﺍﻃﻼﻋﺎﺗﻲ ﻛﻪ ﺩﺭ logﺛﺒﺖ ﻣﻲ ﮔﺮﺩﻧﺪ ﺑﺘﺮﺗﻴﺐ ﺯﻳﺮ ﻣﻲ ﺑﺎﺷﺪ: -١ﺛﺒﺖ > <Ti,Startﻗﺒﻞ ﺍﺯ ﺷﺮﻭﻉ ﺗﺮﺍﻛﻨﺶ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺩﺭ logﺛﺒﺖ ﻣﻲ ﺷﻮﺩ. -٢ﺛﺒﺖ > <Ti,X,V1,V2ﻗﺒﻞ ﺍﺯ ﺍﺟﺮﺍﻱ ﻫﺮ write
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١١٩ /
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
-٣ﺛﺒﺖ > <Ti,Commitﭘﺲ ﺍﺯ ﺍﺟﺮﺍﻱ ﺁﺧﺮﻳﻦ ﺩﺳﺘﻮﺭ ﺗﺮﺍﻛﻨﺶ ﺷﻴﻮﻩ ﺗﺮﻣﻴﻢ : ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻃﻼﻋﺎﺕ ﻣﻮﺟﻮﺩ ﺩﺭ logﺑﻪ ﻳﻜﻲ ﺍﺯ ﺣﺎﻻﺕ ﺯﻳﺮ ﻋﻤﻞ ﻣﻲ ﺷﻮﺩ. ﺍﻟﻒ( ﺣﺬﻑ ﺍﺛﺮ ﺗﺮﺍﻛﻨﺶ )Undo(Ti
ﺍﻳـﻦ ﺣﺎﻟـﺖ ﻣﻮﻗﻌـﻲ ﺍﺟـﺮﺍ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺍﺣﺘﻤﺎﻻ” ﺑﺨﺸﻲ ﺍﺯ ﭘﺎﻳﮕﺎﻩ ﺍﺻﻼﺡ ﺷﺪﻩ ﻭ ﺍﻃﻼﻋﺎﺕ ﻣﻮﺟﻮﺩ ﺩﺭ logﺑﺮﺍﻱ ﺍﻋﻤﺎﻝ ﺑﻘﻴﻪ ﺍﺻﻼﺣﺎﺕ ﻧﻴﺰ ﻛﺎﻓﻲ ﻧﺒﺎﺷﺪ .ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﻣﻮﻗﻌﻲ ﻛﻪ ﺩﺳﺘﻮﺭ ><Ti,Startﺩﺭ logﺑﺎﺷﺪ ﻭﻟﻲ > <Ti,Commitﻧﺒﺎﺷﺪ. ﺏ(ﺍﺟﺮﺍﻱ ﺩﻭﺑﺎﺭﻩ ﺗﺮﺍﻛﻨﺶ )redo(Ti
ﺍﻳﻦ ﺣﺎﻟﺖ ﻣﻮﻗﻌﻲ ﺍﺟﺮﺍ ﻣﻲ ﺷﻮﺩ ﻛﻪ ﺍﺣﺘﻤﺎﻻ” ﺑﺨﺸﻲ ﺍﺯ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﺻﻼﺡ ﺷﺪﻩ ﻭ ﺍﻃﻼﻋﺎﺕ ﻣﻮﺟﻮﺩ ﺩﺭ logﺑﺮﺍﻱ ﺍﻋﻤﺎﻝ ﺑﻘﻴﻪ ﺍﺻﻼﺣﺎﺕ ﻧﻴﺰ ﻛﺎﻓﻲ ﺍﺳﺖ .ﺑﻌﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺩﺭ ﺻﻮﺭﺗﻲ ﺻﺎﺩﺭ ﻣﻲ ﺷﻮﺩ ﻛﻪ > <Ti,Startﻭ><Ti,Commit
ﺩﺭ logﺑﺎﺷﺪ. •
ﻣﺜﺎﻝ ﺍﺯ ﺣﺎﻟﺖ ﺍﻋﻤﺎﻝ ﺁﻧﻲ ﺗﻐﻴﻴﺮﺍﺕ:
ﻣﺜﺎﻝ ﻗﺒﻞ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﺪ ﻓﺮﺽ ﻛﻨﻴﺪ ﺩﺭ logﺩﺭ ﺳﻪ ﺯﻣﺎﻥ ﻣﺨﺘﻠﻒ ﺩﺍﺩﻩ ﻫﺎﻱ ﺯﻳﺮ ﻗﺮﺍﺭ ﮔﺮﻓﺘﻪ ﺑﺎﺷﻨﺪ. >
>
ﺝ
ﺏ
ﺍﻟﻒ
ﻋﻤﻞ ﺗﺮﻣﻴﻢ ﺑﺮﺍﻱ ﻫﺮﻳﻚ ﺍﺯ ﺳﻪ ﺣﺎﻟﺖ ﺑﺎﻻ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ: ﺍﻟﻒ() undo(T0ﺩﺭ
Bﻣﻘﺪﺍﺭ ٢٠٠٠٠٠٠ﻭ ﺩﺭ Aﻣﻘﺪﺍﺭ ١٠٠٠٠٠٠ﺫﺧﻴﺮﻩ ﻣﻲ ﺷﻮﺩ
ﺏ() undo(T1ﻭ )redo(T0 ﺝ() redo(T0ﻭ )redo(T1 -٥-٨ﻋﻤﻠﻴﺎﺕ ﻛﻨﺘﺮﻝ ﺯﻣﺎﻧﻲ )(Check Point
ﻫﻨﮕﺎﻣﻴﻜﻪ ﭘﺲ ﺍﺯ ﺭﻓﻊ ﺍﺷﻜﺎﻝ ﺳﻴﺴﺘﻢ ﻣﺠﺪﺩﺍ” ﺭﺍﻩ ﺍﻧﺪﺍﺯﻱ ﻣﻲ ﺷﻮﺩ ﺩﺭ ﺍﻭﻟﻴﻦ ﻣﺮﺣﻠﻪ ﺍﻃﻼﻋﺎﺕ logﺭﺍ ﻛﻨﺘﺮﻝ ﻛﺮﺩﻩ ﻭ ﺑﺮﺍﺳﺎﺱ ﺁﻥ ﺩﺳﺘﻮﺭﺍﺕ redoﻭ undoﺭﺍ ﺟﻬﺖ ﺗﺮﻣﻴﻢ ﺑﺎﻧﻚ ﺍﻃﻼﻋﺎﺗﻲ ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﺪ ﺍﻳﻦ ﻋﻤﻞ ﺍﮔﺮﭼﻪ ﺻﺤﺖ ﺑﺎﻧﻚ ﺭﺍ ﺑﻪ ﻫﻢ ﻧﻤﻲ ﺯﻧﺪ ﻭﻟﻴﻜﻦ ﺑﺎﻋﺚ ﺩﻭ ﺍﺷﻜﺎﻝ ﺯﻳﺮ ﻣﻲ ﮔﺮﺩﺩ: -١ﺑﺮﺭﺳﻲ ﺗﻤﺎﻡ ﺭﻛﻮﺭﺩﻫﺎﻱ logﺯﻣﺎﻧﮕﻴﺮ ﺍﺳﺖ -٢ﺗﻌﺪﺍﺩ ﺯﻳﺎﺩﻱ ﺗﺮﺍﻛﻨﺶ ﺩﻭﺑﺎﺭﻩ ﺍﺟﺮﺍ ﻣﻲ ﺷﻮﻧﺪ ﺩﺭ ﺻﻮﺭﺗﻴﻜﻪ ﻭﺍﻗﻌﺎ” ﻧﻴﺎﺯﻱ ﺑﻪ ﺍﺟﺮﺍﻱ ﺁﻧﻬﺎ ﻧﻴﺴﺖ ﻭ ﻟﺬﺍ ﺑﺎﻋﺚ ﺍﺗﻼﻑ ﻭﻗﺖ ﻣﻲ ﮔﺮﺩﺩ. ﺑﺮ ﺍﺳﺎﺱ ﻋﻤﻞ ﺗﺮﻣﻴﻢ ﻣﻲ ﺗﻮﺍﻧﻨﺪ ﺩﺭ ﺯﻣﺎﻧﻬﺎﻱ ﻣﺨﺘﻠﻒ ﻛﻨﺘﺮﻝ ﺷﻮﺩ ﻭ ﺍﻳﻦ ﻛﺎﺭ ﻣﻲ ﺗﻮﺍﻧﺪ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﺍﻧﺠﺎﻡ ﺷﻮﺩ:
ﺧﻼﺻﻪ درس :اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ
ﻣﺪﺭﺱ :ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ ١٢٠ /
ﺍﻟﻒ( ﺗﻤﺎﻣﻲ ﺭﻛﻮﺭﺩﻫﺎﻱ logﺭﺍ ﺍﺯ ﺣﺎﻓﻈﻪ ﺍﺻﻠﻲ ﺑﻪ ﺣﺎﻓﻈﻪ ﺛﺎﻧﻮﻳﻪ ﻣﻨﺘﻘﻞ ﻛﺮﺩ. ﺏ( ﺗﻤﺎﻣﻲ ﺑﻠﻮﻛﻬﺎﻱ ﺣﺎﻭﻱ ﺭﻛﻮﺭﺩﻫﺎﻱ ﺍﺻﻼﺡ ﺷﺪﻩ ﺑﻪ ﺣﺎﻓﻈﻪ ﺛﺎﻧﻮﻳﻪ ﻣﻨﺘﻘﻞ ﺷﻮﺩ. ﺝ( ﻳﻚ ﺭﻛﻮﺭﺩ ﺗﺤﺖ ﻋﻨﻮﺍﻥ > <Ti,Commitﻧﺴﺒﺖ ﺑﻪ ﺭﻛﻮﺭﺩ>
ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻣﺸﺨﺺ ﻣﻲ ﺷﻮﺩ: )ﻓﺮﺽ ﻛﻨﻴﺪ Tcﺁﺧﺮﻳﻦ ﺭﻛﻮﺭﺩ check pointﻭ Tfﺯﻣﺎﻥ ﺧﺮﺍﺑﻲ ﺳﻴﺴﺘﻢ ﺑﺎﺷﺪ( ﺍﻟﻒ( > <Ti,Commitﻗﺒﻞ ﺍﺯ ﻋﻤﻞ Tcﺑﺎﺷﺪ: ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺗﺮﺍﻛﻨﺶ ﻧﺎﺩﻳﺪﻩ ﮔﺮﻓﺘﻪ ﻣﻲ ﺷﻮﺩ ﺯﻳﺮﺍ ﻋﻤﻠﻴﺎﺕ ﺗﻤﺎﻡ ﺷﺪﻩ ﻭ ﺗﺮﺍﻛﻨﺶ ﺛﺒﺖ ﺷﺪﻩ ﺍﺳﺖ. ﺏ( > <Ti,Commitﺑﻌﺪ ﺍﺯ Tnﻭ ﻗﺒﻞ ﺍﺯ Tfﺑﺎﺷﺪ: ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺑﺎ ﺍﺟﺮﺍﻱ ﺩﺳﺘﻮﺭ redoﺗﺮﺍﻛﻨﺶ ﺍﺟﺮﺍﻱ ﺩﻭﺑﺎﺭﻩ ﻣﻲ ﺷﻮﺩ. ﺝ(ﻋﺪﻡ ﺣﻀﻮﺭ ><Ti,Commit
ﺩﺭ ﺍﻳـﻦ ﺣﺎﻟـﺖ ﺗـﺮﺍﻛﻨﺶ ﻧـﻴﻤﻪ ﺗﻤـﺎﻡ ﺭﻫﺎ ﺷﺪﻩ ﻭ ﻟﺬﺍ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺷﻴﻮﻩ ﺍﺟﺮﺍﻱ ﺗﺮﺍﻛﻨﺶ ﺑﻪ ﻳﻜﻲ ﺍﺯ ﺣﺎﻟﺘﻬﺎﻱ ﺯﻳﺮ ﻋﻤﻞ
ﻣﻲ
ﺷﻮﺩ: •
ﺍﻋﻤﺎﻝ ﺁﻧﻲ ﺗﻐﻴﻴﺮﺍﺕ:
ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺍﺛﺮ ﺍﺣﺘﻤﺎﻟﻲ ﺗﺮﺍﻛﻨﺶ ﻫﺎﻳﻲ ﻛﻪ > <Ti,Commitﺁﻧﻬﺎ ﺩﺭ logﻇﺎﻫﺮ ﻧﺸﺪﻩ ﺍﺳﺖ ﺑﺎ ﺍﺟﺮﺍﻱ ﺩﺳﺘﻮﺭ undo
ﺭﻭﻱ ﺑﺎﻧﻚ ﺧﻨﺜﻲ ﻣﻲ ﺷﻮﻧﺪ. •
ﺗﺎﺧﻴﺮ ﺍﻋﻤﺎﻝ ﺍﺻﻼﺣﺎﺕ:
ﺩﺭ ﺍﻳﻨﺼﻮﺭﺕ ﺗﺮﺍﻛﻨﺶ ﻫﺎﻳﻲ ﻛﻪ > <Ti,Commitﺁﻧﻬﺎ ﺩﺭ logﻇﺎﻫﺮ ﻧﺸﺪﻩ ﺍﺳﺖ ﻧﺎﺩﻳﺪﻩ ﮔﺮﻓﺘﻪ ﻣﻲ ﺷﻮﻧﺪ. ﻣﺜﺎﻝ :ﻓﺮﺽ ﻛﻨﻴﺪ ﺩﺭ ﺯﻣﺎﻧﻬﺎﻱ ﻣﺨﺘﻠﻒ ﺗﺮﺍﻛﻨﺶ ﻫﺎﻱ T1ﻭ T4ﻫﻤﺮﺍﻩ ﺑﺎ Check pointﺑﺼﻮﺭﺕ ﻧﻤﻮﺩﺍﺭ ﺯﻳﺮ ﻇﺎﻫﺮ ﺷﺪﻩ ﺑﺎﺷﻨﺪ. Tf
system failure
ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺷﻜﻞ ﺩﺍﺭﻳﻢ : • T1ﻣﻲ ﺗﻮﺍﻧﺪ ﻧﺎﺩﻳﺪﻩ ﮔﺮﻓﺘﻪ ﺷﻮﺩ.
Tc
Check point
TIME
١٢١ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
. ﺩﻭﺑﺎﺭﻩ ﺍﺟﺮﺍ ﻣﻲ ﺷﻮﻧﺪT3ﻭT2 • .( ﻧﺎﺩﻳﺪﻩ ﮔﺮﻓﺘﻪ ﻣﻲ ﺷﻮﺩ)ﻭ ﺍﺛﺮ ﺁﻥ ﺧﻨﺜﻲ ﻣﻲ ﮔﺮﺩﺩT4 •
: ﻳﻚ ﻣﺜﺎﻝ ﻋﻤﻠﻲ LitSearch
• • • • • • •
As part of an introductory databases class at Stanford, I designed LitSearch, a database application which stores data on nearly 4000 titles and their authors as well as literary criticism related to these works. It also contains a full text index of about 100 of them. The project allows users to perform searches on the book metadata, as well as full-text searches on the bodies of the works. It also features a "motif search" which uses synonyms to find passages that are similar to a phrase that the user enters into the search box. It's very unrefined, but can produce some interesting results. The data was collected from a number of public-domain sources, including Project Gutenberg and The Internet Public Library. This page describes the various stages of my project, from the conceptual E/R diagram, to the Java Servlet-based front end. Additionally, I decided to port my database project to MySQL, which I also describe below. Entity-Relationship (E/R) Diagram Conversion to a Relational Schema SQL Schema Data Acquisition SQL Interaction MySQL Port Web Application
LitSearch: Entity/Relationship Diagram Description of Entity Sets Words: word stems that are used throughout all of the works that are cataloged in the database. It's a sort of lexicon containing every stem that the parser has ever come across. WordContexts: the full word that a particular instance of a stem corresponds to. Includes any punctuation/whitespace surrounding the word used. Criticism: online literary criticism of a particular work. Contains metadata for the criticism as well as the URL where the criticism may be found. Author: information about authors. Period: information about the various regions and eras used to classify works, such as "19th Century American" Works: information about works (books, collections, etc.) in the database. Pages: data on individual pages in a work. This is a weak entity set because the key here is the page number, so a work is required for uniqueness.
١٢٢ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
LitSearch: Conversion to a relational schema The following is the translation of the E/R Diagram into relations. Everything is in BCNF and 4NF. Conversion of Entity Sets Words(stem)
١٢٣ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
Criticism(publication, url, synopsis, title) Author(name, birth, death, description) Period(region, era) Works(id, title, year, length)
Conversion of Relationships Pages(work, pageNumber) WordContexts(work, pageNumber, position, actualText) Instance(word, work, pageNumber, position) Synonym(root, child) WrittenIn(work, region, era) Criticized(work, url) WroteCriticism(author, url) LivedIn(name, region, era) WrittenBy(author, work)
Functional Dependencies Criticism: Author: Works: WordContexts:
url -> publication, synopsis, title name -> birth, death, description id -> title, year, length work, pageNumber, position -> actualText
LitSearch: SQL Schema When translated into Oracle SQL, and after constraints and foreign keys are added, the schema becomes: CREATE TABLE Author ( name varchar(128) primary key, birth int, death int, description clob ); CREATE TABLE Criticism ( title varchar(255), critic varchar(128), url varchar(255) primary key, synopsis clob, publication varchar(255), unique (title, critic) ); CREATE TABLE Period ( region varchar(64), era varchar(32), primary key(region, era) ); CREATE TABLE Work ( id number(5) primary key, title varchar(255), year number(5), length number(8) check (length >= 0) ); CREATE TABLE Word (
١٢٤ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ id word );
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
number(6) primary key, varchar(32)
CREATE TABLE WroteCriticism ( url varchar(255) references Criticism(url), name varchar(128) references Author(name), primary key (url, name) ); CREATE TABLE LivedIn ( region varchar(64), era varchar(32), name varchar(128) references Author(name), primary key (region, era, name), foreign key (region, era) references Period(region, era) ); CREATE TABLE WrittenIn ( region varchar(64), era varchar(32), work number(5) references Work(id), primary key (region, era, work), foreign key (region, era) references Period(region, era) ); CREATE TABLE Synonym ( root number(6) references Word(id), child number(6) references Word(id), primary key (root, child) ); CREATE TABLE Criticized ( url varchar(255) references Criticism(url), work number(5) references Work(id), primary key (url, work) ); CREATE TABLE WrittenBy ( work number(5) references Work(id), name varchar(128) references Author(name), primary key (work, name) ); CREATE TABLE Page ( work number(5), pageNumber number(5), primary key (work, pageNumber) ); CREATE TABLE Instance ( word number(6), work number(5), pageNumber number(5), position number(4), primary key (word, work, pageNumber) ); CREATE TABLE WordContext ( work number(5),
١٢٥ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
pageNumber number(5), position number(4), actualText varchar(128), primary key (word, pageNumber, position) );
LitSearch: Data Acquisition Creating the Synonym table The synonym table was generated from a comma-separated version of Roget's Thesaurus from the early 1900's (the copyright had expired). Each row in the table contains the root word (the thesaurus entry), and a number of child words (the words listed as synonyms of the word). CreateThesaurus.java is a simple Java program that handles this parsing. Parsing Author, Work, and Criticism Metadata The information about authors, works, and literary criticism was parsed from online resources at Project Gutenberg and the Internet Public Library. I wrote special-case parsers to handle these pages. The parsers for the author data are given below; the others are similar. Parsing Works Works are stored in Project Gutenberg as plain text. I wrote a script to download these texts and then parse their contents into the database. After downloading the text, the header and footer that Project Gutenberg places on the text were removed. Then the body was tokenized to find individual words. Words were then "stemmed", meaning that the suffixes were stripped off such that similar words like "falling", "fallen", and "falls" would all map to the same stem, "fall". This was done such that keyword searches would also return hits containing similar words. It had the additional benefit of keeping the vocabulary size smaller. The algorithm I used was the Porter Algorithm, for which there was a publicdomain implementation available. My source code for acquiring data is very unpolished, since we were not required to turn it in. • • • • • •
Creating the synonym table CreateThesaurus.java Parsing Authors getauthors.pl stripauthors.pl Parsing Works fetch.pl AddBook.java PorterStemmer.java
LitSearch: MySQL Port Why MySQL? The accounts we were given on the Oracle server had a 50MB quota. Unfortunately, the database I wanted to load consisted of about 100 works, at 2 to 5 MB each. Factoring in
١٢٦ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
indicies and such, the total disk space required to store this data was well over 1 GB. Figuring that the CS department might balk at a request for so much space for a class project, I decided to run the project on my own box. And not wanting to pay for an Oracle license, I decided to run an open-source alternative, MySQL and port my SQL code to work under MySQL. I originally thought that the task of porting to MySQL would be relatively simple. Unfortunately, MySQL does not support some essential functionality. Specifically related to this project, MySQL doesn't support subqueries, views, stored procedures, triggers, and foreign keys. Some workarounds are discussed in MySQL's list of missing functionality. Additionally, I was unable to find a way to hint the MySQL planner, so certain operations that should have used indicies apparently were not doing so, causing severe performance problems. As a result, I was forced to change the database schema slightly, and the MySQL schema I used for creating the web application was as follows: CREATE TABLE Author ( name varchar(128) NOT NULL PRIMARY KEY, birth integer NOT NULL, death integer NOT NULL, description text ); CREATE TABLE AuthorCriticized ( url varchar(255) NOT NULL, name varchar(128) NOT NULL, PRIMARY KEY (url, name) ); CREATE TABLE Criticism ( title varchar(255), critic varchar(128), url varchar(255) NOT NULL PRIMARY KEY, synopsis text, publication varchar(255), keywords varchar(255) ); CREATE TABLE PageContainsWord ( word mediumint NOT NULL, page mediumint NOT NULL, PRIMARY KEY (word, page) ); CREATE TABLE Period ( region varchar(64) NOT NULL, era varchar(32) NOT NULL, PRIMARY KEY (region, era) ); CREATE TABLE PeriodLived ( region varchar(64) NOT NULL, era varchar(32) NOT NULL, name varchar(128) NOT NULL, PRIMARY KEY (region, era, name) ); CREATE TABLE PeriodWritten ( region varchar(64) NOT NULL, era varchar(32) NOT NULL,
١٢٧ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
work integer NOT NULL, PRIMARY KEY (region, era, work) ); CREATE TABLE Syn ( root integer NOT NULL, child integer NOT NULL, PRIMARY KEY (root, child) ); CREATE TABLE id work page global_start global_end );
UniquePage ( mediumint NOT NULL PRIMARY KEY, smallint NOT NULL, smallint NOT NULL, integer NOT NULL, integer NOT NULL
CREATE UNIQUE INDEX uniquepage_idx1 ON UniquePage(global_start); CREATE TABLE Word ( id integer NOT NULL PRIMARY KEY, word varchar(32) NOT NULL ); CREATE INDEX word_idx1 ON Word(word); CREATE TABLE WordDetails ( gpos integer NOT NULL PRIMARY KEY, context char(24) ); CREATE TABLE WordInstance ( word mediumint NOT NULL, gpos integer NOT NULL, prev mediumint NOT NULL, PRIMARY KEY (word, gpos) ); CREATE TABLE id title year length gutenberg_id include );
Work ( integer NOT NULL PRIMARY KEY, varchar(255), integer, integer, varchar(20), integer
CREATE TABLE WorkCriticized ( url varchar(255) NOT NULL, work integer NOT NULL, PRIMARY KEY (url, work) ); CREATE TABLE WrittenBy ( work integer NOT NULL, name varchar(128) NOT NULL, PRIMARY KEY (work, name) );
١٢٨ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
In retrospect, I probably should have used PostgreSQL, which is also open-source, and supports subqueries and most of the functionality that Oracle supports. But I didn't know about it at the time, so I ended up doing the MySQL port.
LitSearch: Views & Triggers Views This section creates two views, one which displays a human-readable view of various information regarding a book including the title, year written, author, region written and era written. The second view displays the text of words which are synonyms. The "Synonym" table stores the id numbers of words that are synonyms -- the view shows what the text of those words are. CREATE VIEW ReadableBookInfo AS SELECT Work.title as title, Work.year as year_written, Author.name as author, WrittenIn.region as region, WrittenIn.era as era FROM Work, Author, WrittenIn, WrittenBy WHERE Work.id = WrittenBy.work and WrittenBy.name = Author.name and WrittenIn.work = Work.id; CREATE VIEW Synonyms AS SELECT w1.word as root, w2.word as child FROM Word w1, Word w2, Synonym syn WHERE w1.id = syn.root AND w2.id = syn.child;
Triggers This section creates two triggers on the database. The first causes a little fake review to be entered in to the databse every time a new work is added to the database. The second creates an entry in the synonym table with both entries as the same value (since every word is a synonym of iteself) every time a new word is added to the vocabulary. CREATE TRIGGER GoodReviewsTrig AFTER INSERT ON Work FOR EACH ROW WHEN (NEW.title LIKE '%computer%') BEGIN INSERT INTO Criticism VALUES (:NEW.title || ' is a great book', 'Keith Ito', 'http://www.stanford.edu/~keithito/' || :NEW.id || '.html', 'I thought that ' || :NEW.title || ' was the best book of the year', 'Keiths Reviews', 'great book'); END GoodReviewsTrig; . run; CREATE TRIGGER ReflexiveSynTrig AFTER INSERT ON Word FOR EACH ROW WHEN (NEW.id > 0)
١٢٩ / ﺑﻬﺮﻭﺯﻣﻌﺼﻮﻣﻲ: ﻣﺪﺭﺱ
اﺻﻮل ﻃﺮاﺣﯽ ﭘﺎﯾﮕﺎه داده ﻫﺎ: ﺧﻼﺻﻪ درس
BEGIN INSERT INTO Syn VALUES (:NE W.id, :NEW.id); END ReflexiveSynTrig; . run;
:ﻓﻬﺮﺳﺖ ﻣﻨﺎﺑﻊ ﻭﻣﺮﺍﺟﻊ ١- H.Korth and A.silberschatz ,Database System Concepts , Fourth Edition ,Mc Graw Hill ,2001.
٢- C.J.Date , Introduction To Database Systems ,7th Edition , Addison Wesley ,2000. ٣- Elmasri and Navathe, Fundamentals of Database Systems, third edition,Addison Wesley, 1999.
٤- M.kroenke , Database Processing fundementals,Design &Implementation ,8th Edition.2002.
٥- R.Stephens,Teach Yourself SQL In 21 Days. Second Ed. .١٣٧٨. ﻣﻘﺪﻣﻪ ﺍﻱ ﺑﺮ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ ”ﭼﺎﭖ ﭼﻬﺎﺭﻡ “ ﺍﻧﺘﺸﺎﺭﺍﺕ ﺟﻠﻮﻩ. ﺳﻴﺪ ﻣﺤﻤﺪ ﺗﻘﻲ، ﺭﻭﺣﺎﻧﻲ ﺭﺍﻧﻜﻮﻫﻲ-٦ .١٣٨٠. ﻣﻔﺎﻫﻴﻢ ﺑﻨﻴﺎﺩﻱ ﭘﺎﻳﮕﺎﻩ ﺩﺍﺩﻩ ﻫﺎ“ ﭼﺎﭖ ﺍﻭﻝ ” ﺍﻧﺘﺸﺎﺭﺍﺕ ﺟﻠﻮﻩ. ﺳﻴﺪ ﻣﺤﻤﺪ ﺗﻘﻲ، ﺭﻭﺣﺎﻧﻲ ﺭﺍﻧﻜﻮﻫﻲ-٧