Add Relational algebra (first part)
This commit is contained in:
parent
2d157c675e
commit
a61170161e
4 changed files with 706 additions and 0 deletions
|
@ -0,0 +1,162 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="79.80867mm"
|
||||
height="52.19289mm"
|
||||
viewBox="0 0 79.808673 52.192889"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
|
||||
sodipodi:docname="difference.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="false"
|
||||
fit-margin-top="3"
|
||||
lock-margins="true"
|
||||
fit-margin-left="3"
|
||||
fit-margin-right="3"
|
||||
fit-margin-bottom="3"
|
||||
inkscape:zoom="0.57549102"
|
||||
inkscape:cx="212.86171"
|
||||
inkscape:cy="100.7835"
|
||||
inkscape:window-width="1428"
|
||||
inkscape:window-height="862"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
xlink:href="#pattern36848"
|
||||
id="pattern38379"
|
||||
patternTransform="matrix(1.0197042,1.0197042,-5.8762732,5.8762738,0.30114133,13.459245)" />
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
xlink:href="#pattern6953"
|
||||
id="pattern36848"
|
||||
patternTransform="matrix(1.7505111,1.7505111,-10.087711,10.087712,0,0)" />
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker70291"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow2Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.3,0,0,-0.3,0.69,0)"
|
||||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
|
||||
id="path70289" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker70281"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path70279" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow1Send"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path70018" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow2Send"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow2Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.3,0,0,-0.3,0.69,0)"
|
||||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
|
||||
id="path70036" />
|
||||
</marker>
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
patternUnits="userSpaceOnUse"
|
||||
width="2"
|
||||
height="1"
|
||||
patternTransform="translate(0,0) scale(10,10)"
|
||||
inkscape:stockid="Stripes 1:1"
|
||||
inkscape:isstock="true"
|
||||
id="pattern6953">
|
||||
<rect
|
||||
style="fill:#41e6a8;stroke:none"
|
||||
x="0"
|
||||
y="-0.5"
|
||||
width="1"
|
||||
height="2"
|
||||
id="rect37629" />
|
||||
</pattern>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(2.2786723,-29.239102)">
|
||||
<path
|
||||
id="path30788"
|
||||
style="mix-blend-mode:normal;fill:url(#pattern38379);fill-opacity:1;stroke:none;stroke-width:0.609896;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="M 23.794537,32.439559 A 22.474851,22.474763 0 0 0 1.319584,54.914032 22.474851,22.474763 0 0 0 23.794537,77.3889 22.474851,22.474763 0 0 0 37.918826,72.389317 22.474851,22.474763 0 0 1 36.757008,71.389478 22.474851,22.474763 0 0 1 35.56839,70.200866 a 22.474851,22.474763 0 0 1 -1.096003,-1.273737 22.474851,22.474763 0 0 1 -0.998264,-1.352563 22.474851,22.474763 0 0 1 -0.894221,-1.423099 22.474851,22.474763 0 0 1 -0.78545,-1.485765 22.474851,22.474763 0 0 1 -0.671948,-1.540544 22.474851,22.474763 0 0 1 -0.555291,-1.586265 22.474851,22.474763 0 0 1 -0.434698,-1.623702 22.474851,22.474763 0 0 1 -0.312524,-1.651288 22.474851,22.474763 0 0 1 -0.188381,-1.670207 22.474851,22.474763 0 0 1 -0.06267,-1.679664 22.474851,22.474763 0 0 1 0.06267,-1.679269 22.474851,22.474763 0 0 1 0.188381,-1.670207 22.474851,22.474763 0 0 1 0.312524,-1.651681 22.474851,22.474763 0 0 1 0.434698,-1.623308 22.474851,22.474763 0 0 1 0.555291,-1.586262 22.474851,22.474763 0 0 1 0.671948,-1.540547 22.474851,22.474763 0 0 1 0.78545,-1.486159 22.474851,22.474763 0 0 1 0.894221,-1.423104 22.474851,22.474763 0 0 1 0.998264,-1.352165 22.474851,22.474763 0 0 1 1.096003,-1.273739 22.474851,22.474763 0 0 1 1.188618,-1.188612 22.474851,22.474763 0 0 1 1.164577,-1.002203 22.474851,22.474763 0 0 0 -14.127048,-4.997217 z" />
|
||||
<path
|
||||
id="path702"
|
||||
style="color:#000000;fill:#df6b67;fill-opacity:1;stroke-width:0.762633;-inkscape-stroke:none"
|
||||
d="m 23.500439,32.239102 c -12.577318,0 -22.77911129,10.201796 -22.77911129,22.779114 0,12.577322 10.20179329,22.780701 22.77911129,22.780701 5.334644,0 10.241466,-1.836329 14.124234,-4.91012 3.882804,3.073901 8.789875,4.91012 14.124628,4.91012 12.57732,0 22.780694,-10.203379 22.780694,-22.780701 0,-12.577318 -10.203374,-22.779114 -22.780694,-22.779114 -5.334753,0 -10.241824,1.83574 -14.124628,4.909333 -3.882768,-3.073479 -8.78959,-4.909333 -14.124234,-4.909333 z m 0,0.610464 c 5.146129,0 9.881081,1.752116 13.642641,4.691788 -4.994634,4.179124 -8.173289,10.457579 -8.173289,17.476862 0,7.019287 3.178655,13.298119 8.173289,17.477661 -3.76156,2.939974 -8.496512,4.692573 -13.642641,4.692573 -12.247593,0 -22.1702239,-9.922637 -22.1702239,-22.170234 0,-12.247593 9.9226309,-22.16865 22.1702239,-22.16865 z m 28.248862,0 c 12.247592,0 22.169831,9.921057 22.169831,22.16865 0,12.247597 -9.922239,22.170234 -22.169831,22.170234 -5.146054,0 -9.881501,-1.752278 -13.643035,-4.692182 4.99488,-4.179536 8.173289,-10.458566 8.173289,-17.478052 0,-7.019483 -3.178409,-13.29813 -8.173289,-17.477255 3.761534,-2.939596 8.496981,-4.691395 13.643035,-4.691395 z m -14.124628,5.078403 c 4.914979,4.06546 8.0456,10.21063 8.0456,17.090247 0,6.879619 -3.130621,13.025561 -8.0456,17.09144 -4.914846,-4.065879 -8.0456,-10.211928 -8.0456,-17.09144 0,-6.879509 3.130754,-13.024784 8.0456,-17.090247 z" />
|
||||
<g
|
||||
aria-label="A"
|
||||
id="text5154"
|
||||
style="font-size:10.5833px;line-height:1.25;fill:#515151;stroke-width:0.264583"
|
||||
transform="matrix(0.76263455,0,0,0.76263455,95.468092,-16.673393)">
|
||||
<path
|
||||
d="m -116.63217,123.30077 h -3.11091 l -0.49093,1.4056 h -1.99987 l 2.8577,-7.71527 h 2.37194 l 2.8577,7.71527 h -1.99987 z m -2.61482,-1.43143 h 2.11356 l -1.05419,-3.06957 z"
|
||||
style="font-weight:bold;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold'"
|
||||
id="path13941" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="B"
|
||||
id="text13006"
|
||||
style="font-size:10.5833px;line-height:1.25;fill:#515151;stroke-width:0.264583"
|
||||
transform="matrix(0.76263455,0,0,0.76263455,95.468092,-16.673393)">
|
||||
<path
|
||||
d="m -33.557146,119.97799 q 0.470254,0 0.713133,-0.20671 0.242878,-0.2067 0.242878,-0.60978 0,-0.3979 -0.242878,-0.60461 -0.242879,-0.21187 -0.713133,-0.21187 h -1.100704 v 1.63297 z m 0.06718,3.37446 q 0.599445,0 0.899168,-0.25321 0.30489,-0.25322 0.30489,-0.76481 0,-0.50126 -0.299723,-0.74931 -0.299722,-0.25321 -0.904335,-0.25321 h -1.167883 v 2.02054 z m 1.850011,-2.77502 q 0.640786,0.18604 0.992184,0.6873 0.351399,0.50126 0.351399,1.22989 0,1.11621 -0.754474,1.66398 -0.754473,0.54777 -2.294426,0.54777 h -3.302113 v -7.71527 h 2.986888 q 1.607132,0 2.325432,0.48576 0.723468,0.48575 0.723468,1.55545 0,0.56327 -0.263549,0.96118 -0.263549,0.39274 -0.764809,0.58394 z"
|
||||
style="font-weight:bold;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold'"
|
||||
id="path13938" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 8.7 KiB |
|
@ -0,0 +1,157 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="79.80867mm"
|
||||
height="52.19289mm"
|
||||
viewBox="0 0 79.808673 52.192889"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
|
||||
sodipodi:docname="intersection.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="false"
|
||||
fit-margin-top="3"
|
||||
lock-margins="true"
|
||||
fit-margin-left="3"
|
||||
fit-margin-right="3"
|
||||
fit-margin-bottom="3"
|
||||
inkscape:zoom="0.57549102"
|
||||
inkscape:cx="212.86171"
|
||||
inkscape:cy="100.7835"
|
||||
inkscape:window-width="1428"
|
||||
inkscape:window-height="862"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
xlink:href="#pattern6953"
|
||||
id="pattern37182"
|
||||
patternTransform="matrix(0,1.4798286,-6.3324839,-5.1243094e-7,0.27446455,16.293261)" />
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker70291"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow2Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.3,0,0,-0.3,0.69,0)"
|
||||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
|
||||
id="path70289" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker70281"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path70279" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow1Send"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path70018" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow2Send"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow2Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.3,0,0,-0.3,0.69,0)"
|
||||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
|
||||
id="path70036" />
|
||||
</marker>
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
patternUnits="userSpaceOnUse"
|
||||
width="2"
|
||||
height="1"
|
||||
patternTransform="translate(0,0) scale(10,10)"
|
||||
inkscape:stockid="Stripes 1:1"
|
||||
inkscape:isstock="true"
|
||||
id="pattern6953">
|
||||
<rect
|
||||
style="fill:#41e6a8;stroke:none"
|
||||
x="0"
|
||||
y="-0.5"
|
||||
width="1"
|
||||
height="2"
|
||||
id="rect37629" />
|
||||
</pattern>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(2.2786723,-29.239102)">
|
||||
<path
|
||||
id="path702-3"
|
||||
style="fill:url(#pattern37182);fill-opacity:1;stroke:none;stroke-width:0.610106"
|
||||
d="m 37.921585,37.436776 a 22.474851,22.474763 0 0 0 -1.164577,1.002203 22.474851,22.474763 0 0 0 -1.188618,1.188612 22.474851,22.474763 0 0 0 -1.096003,1.273739 22.474851,22.474763 0 0 0 -0.998264,1.352165 22.474851,22.474763 0 0 0 -0.894221,1.423104 22.474851,22.474763 0 0 0 -0.78545,1.486159 22.474851,22.474763 0 0 0 -0.671948,1.540547 22.474851,22.474763 0 0 0 -0.555291,1.586262 22.474851,22.474763 0 0 0 -0.434698,1.623308 22.474851,22.474763 0 0 0 -0.312524,1.651681 22.474851,22.474763 0 0 0 -0.188381,1.670207 22.474851,22.474763 0 0 0 -0.06267,1.679269 22.474851,22.474763 0 0 0 0.06267,1.679664 22.474851,22.474763 0 0 0 0.188381,1.670207 22.474851,22.474763 0 0 0 0.312524,1.651288 22.474851,22.474763 0 0 0 0.434698,1.623702 22.474851,22.474763 0 0 0 0.555291,1.586265 22.474851,22.474763 0 0 0 0.671948,1.540544 22.474851,22.474763 0 0 0 0.78545,1.485765 22.474851,22.474763 0 0 0 0.894221,1.423099 22.474851,22.474763 0 0 0 0.998264,1.352563 22.474851,22.474763 0 0 0 1.096003,1.273737 22.474851,22.474763 0 0 0 1.188618,1.188612 22.474851,22.474763 0 0 0 1.161818,0.999839 22.474851,22.474763 0 0 0 8.350272,-17.475285 22.474851,22.474763 0 0 0 -8.347513,-17.477256 z" />
|
||||
<path
|
||||
id="path702"
|
||||
style="color:#000000;fill:#df6b67;fill-opacity:1;stroke-width:0.762633;-inkscape-stroke:none"
|
||||
d="m 23.500439,32.239102 c -12.577318,0 -22.77911129,10.201796 -22.77911129,22.779114 0,12.577322 10.20179329,22.780701 22.77911129,22.780701 5.334644,0 10.241466,-1.836329 14.124234,-4.91012 3.882804,3.073901 8.789875,4.91012 14.124628,4.91012 12.57732,0 22.780694,-10.203379 22.780694,-22.780701 0,-12.577318 -10.203374,-22.779114 -22.780694,-22.779114 -5.334753,0 -10.241824,1.83574 -14.124628,4.909333 -3.882768,-3.073479 -8.78959,-4.909333 -14.124234,-4.909333 z m 0,0.610464 c 5.146129,0 9.881081,1.752116 13.642641,4.691788 -4.994634,4.179124 -8.173289,10.457579 -8.173289,17.476862 0,7.019287 3.178655,13.298119 8.173289,17.477661 -3.76156,2.939974 -8.496512,4.692573 -13.642641,4.692573 -12.247593,0 -22.1702239,-9.922637 -22.1702239,-22.170234 0,-12.247593 9.9226309,-22.16865 22.1702239,-22.16865 z m 28.248862,0 c 12.247592,0 22.169831,9.921057 22.169831,22.16865 0,12.247597 -9.922239,22.170234 -22.169831,22.170234 -5.146054,0 -9.881501,-1.752278 -13.643035,-4.692182 4.99488,-4.179536 8.173289,-10.458566 8.173289,-17.478052 0,-7.019483 -3.178409,-13.29813 -8.173289,-17.477255 3.761534,-2.939596 8.496981,-4.691395 13.643035,-4.691395 z m -14.124628,5.078403 c 4.914979,4.06546 8.0456,10.21063 8.0456,17.090247 0,6.879619 -3.130621,13.025561 -8.0456,17.09144 -4.914846,-4.065879 -8.0456,-10.211928 -8.0456,-17.09144 0,-6.879509 3.130754,-13.024784 8.0456,-17.090247 z" />
|
||||
<g
|
||||
aria-label="A"
|
||||
id="text5154"
|
||||
style="font-size:10.5833px;line-height:1.25;fill:#515151;stroke-width:0.264583"
|
||||
transform="matrix(0.76263455,0,0,0.76263455,95.468092,-16.673393)">
|
||||
<path
|
||||
d="m -116.63217,123.30077 h -3.11091 l -0.49093,1.4056 h -1.99987 l 2.8577,-7.71527 h 2.37194 l 2.8577,7.71527 h -1.99987 z m -2.61482,-1.43143 h 2.11356 l -1.05419,-3.06957 z"
|
||||
style="font-weight:bold;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold'"
|
||||
id="path13941" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="B"
|
||||
id="text13006"
|
||||
style="font-size:10.5833px;line-height:1.25;fill:#515151;stroke-width:0.264583"
|
||||
transform="matrix(0.76263455,0,0,0.76263455,95.468092,-16.673393)">
|
||||
<path
|
||||
d="m -33.557146,119.97799 q 0.470254,0 0.713133,-0.20671 0.242878,-0.2067 0.242878,-0.60978 0,-0.3979 -0.242878,-0.60461 -0.242879,-0.21187 -0.713133,-0.21187 h -1.100704 v 1.63297 z m 0.06718,3.37446 q 0.599445,0 0.899168,-0.25321 0.30489,-0.25322 0.30489,-0.76481 0,-0.50126 -0.299723,-0.74931 -0.299722,-0.25321 -0.904335,-0.25321 h -1.167883 v 2.02054 z m 1.850011,-2.77502 q 0.640786,0.18604 0.992184,0.6873 0.351399,0.50126 0.351399,1.22989 0,1.11621 -0.754474,1.66398 -0.754473,0.54777 -2.294426,0.54777 h -3.302113 v -7.71527 h 2.986888 q 1.607132,0 2.325432,0.48576 0.723468,0.48575 0.723468,1.55545 0,0.56327 -0.263549,0.96118 -0.263549,0.39274 -0.764809,0.58394 z"
|
||||
style="font-weight:bold;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold'"
|
||||
id="path13938" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 8.3 KiB |
180
content/bdd_avancees/3-algebre_relationnelle/images/union.svg
Normal file
180
content/bdd_avancees/3-algebre_relationnelle/images/union.svg
Normal file
|
@ -0,0 +1,180 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="79.80867mm"
|
||||
height="52.19289mm"
|
||||
viewBox="0 0 79.808673 52.192889"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
|
||||
sodipodi:docname="union.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="false"
|
||||
fit-margin-top="3"
|
||||
lock-margins="true"
|
||||
fit-margin-left="3"
|
||||
fit-margin-right="3"
|
||||
fit-margin-bottom="3"
|
||||
inkscape:zoom="0.57549102"
|
||||
inkscape:cx="212.86171"
|
||||
inkscape:cy="100.7835"
|
||||
inkscape:window-width="1428"
|
||||
inkscape:window-height="862"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
xlink:href="#pattern36848"
|
||||
id="pattern38379"
|
||||
patternTransform="matrix(1.0197042,1.0197042,-5.8762732,5.8762738,0.30114133,13.459245)" />
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
xlink:href="#pattern36848"
|
||||
id="pattern37445"
|
||||
patternTransform="matrix(-1.0197042,1.0197042,5.8762732,5.8762738,75.204929,13.459245)" />
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
xlink:href="#pattern6953"
|
||||
id="pattern37182"
|
||||
patternTransform="matrix(0,1.4798286,-6.3324839,-5.1243094e-7,0.27446455,16.293261)" />
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
xlink:href="#pattern6953"
|
||||
id="pattern36848"
|
||||
patternTransform="matrix(1.7505111,1.7505111,-10.087711,10.087712,0,0)" />
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker70291"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow2Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.3,0,0,-0.3,0.69,0)"
|
||||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
|
||||
id="path70289" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker70281"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path70279" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow1Send"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path70018" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow2Send"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow2Send"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.3,0,0,-0.3,0.69,0)"
|
||||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
|
||||
id="path70036" />
|
||||
</marker>
|
||||
<pattern
|
||||
inkscape:collect="always"
|
||||
patternUnits="userSpaceOnUse"
|
||||
width="2"
|
||||
height="1"
|
||||
patternTransform="translate(0,0) scale(10,10)"
|
||||
inkscape:stockid="Stripes 1:1"
|
||||
inkscape:isstock="true"
|
||||
id="pattern6953">
|
||||
<rect
|
||||
style="fill:#41e6a8;stroke:none"
|
||||
x="0"
|
||||
y="-0.5"
|
||||
width="1"
|
||||
height="2"
|
||||
id="rect37629" />
|
||||
</pattern>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(2.2786723,-29.239102)">
|
||||
<path
|
||||
id="path37443"
|
||||
style="mix-blend-mode:normal;fill:url(#pattern37445);fill-opacity:1;stroke:none;stroke-width:0.609896;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="M 51.711526,32.439559 A 22.474851,22.474763 0 0 1 74.186484,54.914032 22.474851,22.474763 0 0 1 51.711526,77.3889 22.474851,22.474763 0 0 1 37.587237,72.389317 a 22.474851,22.474763 0 0 0 1.161818,-0.999839 22.474851,22.474763 0 0 0 1.188618,-1.188612 22.474851,22.474763 0 0 0 1.096003,-1.273737 22.474851,22.474763 0 0 0 0.998264,-1.352563 22.474851,22.474763 0 0 0 0.894221,-1.423099 22.474851,22.474763 0 0 0 0.78545,-1.485765 22.474851,22.474763 0 0 0 0.671948,-1.540544 22.474851,22.474763 0 0 0 0.555291,-1.586265 22.474851,22.474763 0 0 0 0.434698,-1.623702 22.474851,22.474763 0 0 0 0.312524,-1.651288 22.474851,22.474763 0 0 0 0.188382,-1.670207 22.474851,22.474763 0 0 0 0.06267,-1.679664 22.474851,22.474763 0 0 0 -0.06267,-1.679269 22.474851,22.474763 0 0 0 -0.188382,-1.670207 22.474851,22.474763 0 0 0 -0.312524,-1.651681 22.474851,22.474763 0 0 0 -0.434698,-1.623308 22.474851,22.474763 0 0 0 -0.555291,-1.586262 22.474851,22.474763 0 0 0 -0.671948,-1.540547 22.474851,22.474763 0 0 0 -0.78545,-1.486159 22.474851,22.474763 0 0 0 -0.894221,-1.423104 22.474851,22.474763 0 0 0 -0.998264,-1.352165 22.474851,22.474763 0 0 0 -1.096003,-1.273739 22.474851,22.474763 0 0 0 -1.188618,-1.188612 22.474851,22.474763 0 0 0 -1.164576,-1.002203 22.474851,22.474763 0 0 1 14.127047,-4.997217 z" />
|
||||
<path
|
||||
id="path30788"
|
||||
style="mix-blend-mode:normal;fill:url(#pattern38379);fill-opacity:1;stroke:none;stroke-width:0.609896;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="M 23.794537,32.439559 A 22.474851,22.474763 0 0 0 1.319584,54.914032 22.474851,22.474763 0 0 0 23.794537,77.3889 22.474851,22.474763 0 0 0 37.918826,72.389317 22.474851,22.474763 0 0 1 36.757008,71.389478 22.474851,22.474763 0 0 1 35.56839,70.200866 a 22.474851,22.474763 0 0 1 -1.096003,-1.273737 22.474851,22.474763 0 0 1 -0.998264,-1.352563 22.474851,22.474763 0 0 1 -0.894221,-1.423099 22.474851,22.474763 0 0 1 -0.78545,-1.485765 22.474851,22.474763 0 0 1 -0.671948,-1.540544 22.474851,22.474763 0 0 1 -0.555291,-1.586265 22.474851,22.474763 0 0 1 -0.434698,-1.623702 22.474851,22.474763 0 0 1 -0.312524,-1.651288 22.474851,22.474763 0 0 1 -0.188381,-1.670207 22.474851,22.474763 0 0 1 -0.06267,-1.679664 22.474851,22.474763 0 0 1 0.06267,-1.679269 22.474851,22.474763 0 0 1 0.188381,-1.670207 22.474851,22.474763 0 0 1 0.312524,-1.651681 22.474851,22.474763 0 0 1 0.434698,-1.623308 22.474851,22.474763 0 0 1 0.555291,-1.586262 22.474851,22.474763 0 0 1 0.671948,-1.540547 22.474851,22.474763 0 0 1 0.78545,-1.486159 22.474851,22.474763 0 0 1 0.894221,-1.423104 22.474851,22.474763 0 0 1 0.998264,-1.352165 22.474851,22.474763 0 0 1 1.096003,-1.273739 22.474851,22.474763 0 0 1 1.188618,-1.188612 22.474851,22.474763 0 0 1 1.164577,-1.002203 22.474851,22.474763 0 0 0 -14.127048,-4.997217 z" />
|
||||
<path
|
||||
id="path702-3"
|
||||
style="fill:url(#pattern37182);fill-opacity:1;stroke:none;stroke-width:0.610106"
|
||||
d="m 37.921585,37.436776 a 22.474851,22.474763 0 0 0 -1.164577,1.002203 22.474851,22.474763 0 0 0 -1.188618,1.188612 22.474851,22.474763 0 0 0 -1.096003,1.273739 22.474851,22.474763 0 0 0 -0.998264,1.352165 22.474851,22.474763 0 0 0 -0.894221,1.423104 22.474851,22.474763 0 0 0 -0.78545,1.486159 22.474851,22.474763 0 0 0 -0.671948,1.540547 22.474851,22.474763 0 0 0 -0.555291,1.586262 22.474851,22.474763 0 0 0 -0.434698,1.623308 22.474851,22.474763 0 0 0 -0.312524,1.651681 22.474851,22.474763 0 0 0 -0.188381,1.670207 22.474851,22.474763 0 0 0 -0.06267,1.679269 22.474851,22.474763 0 0 0 0.06267,1.679664 22.474851,22.474763 0 0 0 0.188381,1.670207 22.474851,22.474763 0 0 0 0.312524,1.651288 22.474851,22.474763 0 0 0 0.434698,1.623702 22.474851,22.474763 0 0 0 0.555291,1.586265 22.474851,22.474763 0 0 0 0.671948,1.540544 22.474851,22.474763 0 0 0 0.78545,1.485765 22.474851,22.474763 0 0 0 0.894221,1.423099 22.474851,22.474763 0 0 0 0.998264,1.352563 22.474851,22.474763 0 0 0 1.096003,1.273737 22.474851,22.474763 0 0 0 1.188618,1.188612 22.474851,22.474763 0 0 0 1.161818,0.999839 22.474851,22.474763 0 0 0 8.350272,-17.475285 22.474851,22.474763 0 0 0 -8.347513,-17.477256 z" />
|
||||
<path
|
||||
id="path702"
|
||||
style="color:#000000;fill:#df6b67;fill-opacity:1;stroke-width:0.762633;-inkscape-stroke:none"
|
||||
d="m 23.500439,32.239102 c -12.577318,0 -22.77911129,10.201796 -22.77911129,22.779114 0,12.577322 10.20179329,22.780701 22.77911129,22.780701 5.334644,0 10.241466,-1.836329 14.124234,-4.91012 3.882804,3.073901 8.789875,4.91012 14.124628,4.91012 12.57732,0 22.780694,-10.203379 22.780694,-22.780701 0,-12.577318 -10.203374,-22.779114 -22.780694,-22.779114 -5.334753,0 -10.241824,1.83574 -14.124628,4.909333 -3.882768,-3.073479 -8.78959,-4.909333 -14.124234,-4.909333 z m 0,0.610464 c 5.146129,0 9.881081,1.752116 13.642641,4.691788 -4.994634,4.179124 -8.173289,10.457579 -8.173289,17.476862 0,7.019287 3.178655,13.298119 8.173289,17.477661 -3.76156,2.939974 -8.496512,4.692573 -13.642641,4.692573 -12.247593,0 -22.1702239,-9.922637 -22.1702239,-22.170234 0,-12.247593 9.9226309,-22.16865 22.1702239,-22.16865 z m 28.248862,0 c 12.247592,0 22.169831,9.921057 22.169831,22.16865 0,12.247597 -9.922239,22.170234 -22.169831,22.170234 -5.146054,0 -9.881501,-1.752278 -13.643035,-4.692182 4.99488,-4.179536 8.173289,-10.458566 8.173289,-17.478052 0,-7.019483 -3.178409,-13.29813 -8.173289,-17.477255 3.761534,-2.939596 8.496981,-4.691395 13.643035,-4.691395 z m -14.124628,5.078403 c 4.914979,4.06546 8.0456,10.21063 8.0456,17.090247 0,6.879619 -3.130621,13.025561 -8.0456,17.09144 -4.914846,-4.065879 -8.0456,-10.211928 -8.0456,-17.09144 0,-6.879509 3.130754,-13.024784 8.0456,-17.090247 z" />
|
||||
<g
|
||||
aria-label="A"
|
||||
id="text5154"
|
||||
style="font-size:10.5833px;line-height:1.25;fill:#515151;stroke-width:0.264583"
|
||||
transform="matrix(0.76263455,0,0,0.76263455,95.468092,-16.673393)">
|
||||
<path
|
||||
d="m -116.63217,123.30077 h -3.11091 l -0.49093,1.4056 h -1.99987 l 2.8577,-7.71527 h 2.37194 l 2.8577,7.71527 h -1.99987 z m -2.61482,-1.43143 h 2.11356 l -1.05419,-3.06957 z"
|
||||
style="font-weight:bold;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold'"
|
||||
id="path13941" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="B"
|
||||
id="text13006"
|
||||
style="font-size:10.5833px;line-height:1.25;fill:#515151;stroke-width:0.264583"
|
||||
transform="matrix(0.76263455,0,0,0.76263455,95.468092,-16.673393)">
|
||||
<path
|
||||
d="m -33.557146,119.97799 q 0.470254,0 0.713133,-0.20671 0.242878,-0.2067 0.242878,-0.60978 0,-0.3979 -0.242878,-0.60461 -0.242879,-0.21187 -0.713133,-0.21187 h -1.100704 v 1.63297 z m 0.06718,3.37446 q 0.599445,0 0.899168,-0.25321 0.30489,-0.25322 0.30489,-0.76481 0,-0.50126 -0.299723,-0.74931 -0.299722,-0.25321 -0.904335,-0.25321 h -1.167883 v 2.02054 z m 1.850011,-2.77502 q 0.640786,0.18604 0.992184,0.6873 0.351399,0.50126 0.351399,1.22989 0,1.11621 -0.754474,1.66398 -0.754473,0.54777 -2.294426,0.54777 h -3.302113 v -7.71527 h 2.986888 q 1.607132,0 2.325432,0.48576 0.723468,0.48575 0.723468,1.55545 0,0.56327 -0.263549,0.96118 -0.263549,0.39274 -0.764809,0.58394 z"
|
||||
style="font-weight:bold;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold'"
|
||||
id="path13938" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 12 KiB |
207
content/bdd_avancees/3-algebre_relationnelle/index.md
Normal file
207
content/bdd_avancees/3-algebre_relationnelle/index.md
Normal file
|
@ -0,0 +1,207 @@
|
|||
---
|
||||
title: "Base de données avancées : Algèbre relationnelle"
|
||||
date: 2022-01-12
|
||||
tags: ["schema", "algèbre relationnelle", "relation"]
|
||||
categories: ["Base de données avancées", "Cours"]
|
||||
mathjax: true
|
||||
---
|
||||
|
||||
L'agèbre relationnelle est un langage de requêtes dans une base de donnée
|
||||
relationelle. Inventé par Edgar F. Codd en 1970, il représente le fondement
|
||||
théorique du langage SQL.
|
||||
|
||||
|
||||
C'est un langage procédural : les requêtes sont des suites d'opérations qui
|
||||
construise la réponse.Il permet la manipulation des relations par interrogation
|
||||
en combiant les relations avec différents opérateurs afin d'obtenir de nouvelles
|
||||
relations.
|
||||
|
||||
## La projection
|
||||
|
||||
La projection permet de ne garder que les *n_uplets* des attibuts indiqué par
|
||||
l'opérateur en supprimant les éventuels doublons. Il est noté \\(\pi\\), son
|
||||
équivalent SQL est `SELECT`. On parle alors de *partition verticale*
|
||||
|
||||
* Soit \\(R(\underline{A,B},C,D)\\)
|
||||
* La projection des attibuts C et D donne \\(\pi_D(R) = R'(C,D)\\)
|
||||
|
||||
## La selection
|
||||
|
||||
L'opérateur de selection (ou restriction) ne permet de retenir que *n_uplets*
|
||||
vérifiant une condition particulière donnée sous forme de prédicat[^n_predicat].
|
||||
Il est noté \\(\sigma\\)) et équivaut à la clause `WHERE` en SQL.
|
||||
|
||||
* Soit \\(R(\underline{A,B},C,D)\\)
|
||||
* la selection \\(\sigma_{C>2}(R) = R'(A,B,C,D)\\) sélection les ligne de la
|
||||
relation \\(R\\) dont \\(C\\) est supérieur à 2
|
||||
|
||||
Les opérateurs possibles sont \\(>, <, \geqslant, \leqslant, =, \ne, \subset,
|
||||
\subseteq, \nsubseteq \\)
|
||||
|
||||
Utilisons les relations de notre exemple de la compagne aérienne, pour trouver
|
||||
les numéros de séries des avions avec une capacité supérieure à 150 passagers.
|
||||
|
||||
\\( \pi_{\text{num_serie}}(\sigma_{capacité > 150}(avions)) \\)
|
||||
|
||||
|
||||
[^n_predicat]:propriété des objets du langage exprimée dans le langage en
|
||||
question (source [Wikipédia](https://fr.wikipedia.org/wiki/Pr%C3%A9dicat))
|
||||
|
||||
## jointure
|
||||
|
||||
La jointure (ou jointure naturelle) rapproche deux relations liées par des
|
||||
attributs communs. Les *n_uplets* du résultat sont obtenus par concaténation des
|
||||
attributs des deux relations lorsque les attributs communs ont des valeurs
|
||||
identiques. La jointure est notée \bowtie, son équivalent au `JOIN` en SQL.
|
||||
|
||||
* soit deux relations \\( conso(plat, client) \\) et \\( client(id, nom,
|
||||
prénom) \\)
|
||||
* \\( \pi_{nom, prénom}(\sigma_{plat = donuts}(conso \bowtie_{conso.client =
|
||||
client.id} client)) \\) donne les clients ayant commandé des donuts.
|
||||
|
||||
## auto-jointure
|
||||
|
||||
L'auto-jointure est la jointure d'une table sur elle-même. elle permet, par
|
||||
exemple, de calculer une hiérarchie. Lors de l'utilisation de cet operateur, il
|
||||
faut renommer chaque relation qui compose la jointure de façon unique. Cet
|
||||
|
||||
l'opérateur \\( \rho \\) permet de renommer une relation le temps d'une requête.
|
||||
|
||||
* soit une relation \\( employés(matricule, nom, prénom, supérieur) \\)
|
||||
* \\( \pi_{D}(\sigma_{nom = Simpson}((employés \bowtie_{employés.matricule = s.D}
|
||||
(\rho{s(A,B,C,D}(employés))) \\) permet de trouver le superieur
|
||||
hiérarchique de Simpson.
|
||||
|
||||
## Opérations binaires
|
||||
|
||||
Les opérations binaires sont des opérations mathématiques standard de la
|
||||
théories des ensembles. Elles ne peuvent s'appliquer **que sur des relations
|
||||
compatibles**. On y trouve
|
||||
|
||||
* Union
|
||||
* Intersection
|
||||
* Différence
|
||||
* Division
|
||||
|
||||
Pour deux relations \\(A(A_1, A_2, A_3, ..., A_n)\\) et \\(B(B_1, B_2, B_3, ...,
|
||||
B_n\\) sont **compatibles** si et seulement si elles ont le même degrès
|
||||
[^n_degres] et si \\(dom(A_i) = dom(B_i)\\) pour \\(1 \leqslant i \leqslant n
|
||||
\\)
|
||||
|
||||
[^n_degres]:le degrés représente le nombre d'attributs d'une relation
|
||||
|
||||
### Union
|
||||
|
||||
\\(A \cup B\\) est une relation qui inclue tous les *n_uplets* qui
|
||||
appartiennent à A, B ou au deux. Les doublons sont éliminés.
|
||||
|
||||

|
||||
|
||||
### Intersection
|
||||
|
||||
\\( A \cap B \\) est une relation qui inclue les *n_uplets* appartenant à A et à
|
||||
B et seulement ceux-ci.
|
||||
|
||||

|
||||
|
||||
### Différence
|
||||
|
||||
\\( A - B \\) est une relation qui inclue tous les *n_uplets* appartenant à A
|
||||
mais pas à B.
|
||||
|
||||

|
||||
|
||||
Elle répond à la question quel sont les A qui n'ont aucun B.
|
||||
|
||||
### Division
|
||||
|
||||
La division permet de conserver une sous ensemble de *n_uplets* partie de
|
||||
\\(R\\) qui sont tous présent dans \\(S\\). Elle permet de répondre à des
|
||||
questions du type *quel est le truc qui a tous les machins?*.
|
||||
|
||||
Pour l'exemple, reprenons notre base de donnée de la compagnie aérienne du
|
||||
chapitre précédent.
|
||||
|
||||

|
||||
|
||||
Utilisons la division pour répondre à la question "Quels commandants ont volé
|
||||
sur tous les type d'avion:
|
||||
|
||||
\\[
|
||||
\Pi_{matricule, type}(
|
||||
pilotes \underset{pilotes.matricule = planning.matricule}{\bowtie}
|
||||
planning \underset{\text{planning.num_avion} = \text{avions.num_serie}}{\bowtie}
|
||||
avions)
|
||||
\div \Pi_{type}(avion)
|
||||
\\]
|
||||
|
||||
## Calcul relationnel
|
||||
|
||||
Le calcul relationnel est un langage formel permettant, tout comme l'algèbre
|
||||
relationnel, d'exprimer des requêtes afin d'interroger des base de données
|
||||
relationnelles.
|
||||
|
||||
Les requêtes se présentent sous la forme \\({t|P(t)}\\), elle représente
|
||||
l'ensemble des *n_uplets* tel que le prédicat \\(P(t)\\) est vrai pour \\(t\\).
|
||||
|
||||
\\(t\\) est une variable de *n_uplet* et \\(t[A]\\) représente la valeur de
|
||||
l'attribut \\(A\\) dans \\(t\\). \\(t \in r\\) signifie que \\(t\\) est un
|
||||
*n_uplet* de \\(r\\).
|
||||
|
||||
Il existe aussi les connecteur logiques :
|
||||
* \\(\lor\\) : **ou** logique
|
||||
* \\((\land\\) : **et** logique
|
||||
* \\(\neg\\) : la négation
|
||||
|
||||
Mais aussi des quantificateurs :
|
||||
* \\(\exists\\) : **il existe**, par exemple \\(\exists t \in r(Q(t))\\) il
|
||||
existe un tuple t de r tel que Q est vrai.
|
||||
* \\(\forall\\) : **pour tout**, par exemple \\(\forall t \in r(Q(t))\\) - Q
|
||||
est vrai pour tout tuple t de r.
|
||||
* \\(\nexists\\) : **il n'existe pas**, par exemple \\(\nexists t \in
|
||||
r(Q(t))\\) - il n'existe pas de tuple t dans r tel que Q est vrai.
|
||||
|
||||
### Un exemple concret : base de donnée cinéma
|
||||
|
||||
Essayons d'éclaicir tout celà à l'aide d'un exemple concret, considérons les
|
||||
relations suivantes:
|
||||
|
||||
* Films(titre, realisateur, Acteur) instance f
|
||||
* Programme(nom_cinemas, titre, horaire) instance p
|
||||
|
||||
#### les films réalisés par Terry Gilliam
|
||||
|
||||
\\( \\{ t | t \in f \land t[realisateur] = "\text{Terry Gilliam"} \\} \\)
|
||||
|
||||
#### les films ou jouent Jay et Silent Bob
|
||||
|
||||
\\( \\{ t | t \in f \land \exists s \in f( t[titre] = s[titre] \land
|
||||
t[acteur] = "Jay" \land s[acteur] = "Silent Bob" ) \\} \\)
|
||||
|
||||
#### tous les films programmés dans toutes les salles
|
||||
|
||||
\\( \\{ t | \exists s \in p(t[titre] = s[titre]) \\} \\)
|
||||
|
||||
#### Les films programmés à l'UGC mais pas au Megarama
|
||||
|
||||
\\( \\{
|
||||
t | \exists s \in p(s[titre] = t[titre]
|
||||
\land s[\text{nom_cinemas}] = "UCG"
|
||||
\land {\not} {\exists} u \in p( u[\text{nom_cinemas}] = "Megarama"
|
||||
\land u[titre] = t[titre]
|
||||
\\} \\)
|
||||
|
||||
#### Les titres des films qui sont passés à l'UGC et leurs réalisateurs
|
||||
|
||||
\\( \\{
|
||||
t | \exists \in p(\exists u \in f((s[\text{nom_cinemas}] = "UGC"
|
||||
\land s[titre] = u[titre] = t[titre]
|
||||
\land t[realisateur] = u[realisateur]
|
||||
\\} \\)
|
||||
|
||||
## Retour sur la notion de clé
|
||||
|
||||
comme nous lavons abordé précédement, une clé est nécessaire pour identifier des
|
||||
*n_uplets* de façon unique sans pour autant en donner toutes leurs valeurs et
|
||||
respecter leurs unicité.
|
Loading…
Add table
Add a link
Reference in a new issue