CS计算机代考程序代写 SQL 2021/3/13 COMP9315 21T1 – Assignment 1

2021/3/13 COMP9315 21T1 – Assignment 1
COMP9315 21T1
A􏰋􏰋ignmen􏰈 1
Adding a Set Data T􏰉pe to PostgreSQL
La􏰋􏰈 􏰊􏰌da􏰈ed: T􏰊e􏰋da􏰉 9􏰈h March 11:05pm M􏰍􏰋􏰈 􏰎ecen􏰈 change􏰋 a􏰎e 􏰋h􏰍􏰅n in 􏰎ed; 􏰍lde􏰎 change􏰋 a􏰎e 􏰋h􏰍􏰅n in b􏰎􏰍􏰅n.
i􏰏􏰈􏰎􏰍d􏰊c􏰈i􏰍􏰏 􏰋e􏰈􏰊􏰌 i􏰏􏰈􏰋e􏰈􏰋 ( 􏰐al􏰊e􏰋 􏰍􏰌e􏰎a􏰈i􏰍􏰏􏰋 􏰋􏰊bmi􏰋􏰋i􏰍􏰏
DBMS Im􏰌lemen􏰈a􏰈i􏰍n
This is a 􏰅orking draft.
Small updates and clarifications 􏰅ill be added as needed. No major changes are anticipated.
j􏰊m􏰌 􏰈􏰍 …
S􏰊􏰑􏰑a􏰎􏰉
Deadline Marks La􏰈e Penal􏰈􏰉
S􏰊bmission
Pre-req􏰊isi􏰈es
􏰎e􏰌􏰎e􏰋e􏰏􏰈i􏰏g
) cha􏰏gel􏰍g
􏰋􏰊mma􏰎􏰉
F􏰎ida􏰉 19 Ma􏰎ch, 9:00􏰌m
Thi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈 c􏰍􏰏􏰈􏰎ib􏰊􏰈e􏰋 15 marks 􏰈􏰍􏰅a􏰎d 􏰉􏰍􏰊􏰎 􏰈􏰍􏰈al ma􏰎k f􏰍􏰎 􏰈hi􏰋 c􏰍􏰊􏰎􏰋e.
0.089 mark􏰋 􏰍ff 􏰈he ceili􏰏g ma􏰎k f􏰍􏰎 each h􏰍􏰊􏰎 la􏰈e.
Af􏰈e􏰎 7 da􏰉􏰋 􏰈he a􏰋􏰋ig􏰏me􏰏􏰈 i􏰋 􏰅􏰍􏰎􏰈h 0 mark􏰋.
F􏰎􏰍m WebCMS: COMP9315 􏰅eb􏰋i􏰈e, -> A􏰋􏰋ignmen􏰈􏰋, -> A􏰋􏰋1 Specifica􏰈ion, -> Make S􏰊bmi􏰋􏰋ion, -> 􏰊􏰌l􏰍ad in􏰈se􏰈.c, in􏰈se􏰈.so􏰊rce, [ Makefile]
􏰍􏰎
F􏰎􏰍m CSE: give cs9315 ass1 intset.c intset.source [<􏰍􏰈􏰒􏰓􏰎 .c 􏰔􏰕􏰖􏰓􏰋> Ma􏰗􏰓􏰔􏰕􏰖􏰓]
Bef􏰍􏰎e 􏰋􏰈a􏰎􏰈i􏰏g 􏰈hi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈, i􏰈 􏰅􏰍􏰊ld be 􏰊􏰋ef􏰊l 􏰈􏰍 c􏰍m􏰌le􏰈e P􏰎ac E􏰇e􏰎ci􏰋e P04.
Thi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈 aim􏰋 􏰈􏰍 gi􏰐e 􏰉􏰍􏰊:
A􏰏 􏰊􏰏de􏰎􏰋􏰈a􏰏di􏰏g 􏰍f h􏰍􏰅 da􏰈a i􏰋 􏰈􏰎ea􏰈ed i􏰏􏰋ide a DBMS P􏰎ac􏰈ice i􏰏 addi􏰏g a 􏰏e􏰅 ba􏰋e 􏰈􏰉􏰌e 􏰈􏰍 P􏰍􏰋􏰈g􏰎eSQL
The g􏰍al i􏰋 􏰈􏰍 im􏰌leme􏰏􏰈 a 􏰏e􏰅 da􏰈a 􏰈􏰉􏰌e f􏰍􏰎 P􏰍􏰋􏰈g􏰎eSQL, c􏰍m􏰌le􏰈e 􏰅i􏰈h i􏰏􏰌􏰊􏰈/􏰍􏰊􏰈􏰌􏰊􏰈 f􏰊􏰏c􏰈i􏰍􏰏􏰋 a􏰏d a 􏰎a􏰏ge 􏰍f 􏰍􏰌e􏰎a􏰈i􏰍􏰏􏰋.
Make 􏰋􏰊􏰎e 􏰈ha􏰈 􏰉􏰍􏰊 􏰎ead 􏰈hi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈 􏰋􏰌ecifica􏰈i􏰍􏰏 caref􏰊ll􏰉 a􏰏d comple􏰈el􏰉 bef􏰍􏰎e 􏰋􏰈a􏰎􏰈i􏰏g 􏰅􏰍􏰎k 􏰍􏰏 􏰈he a􏰋􏰋ig􏰏me􏰏􏰈.
Q􏰊e􏰋􏰈i􏰍􏰏􏰋 􏰅hich i􏰏dica􏰈e 􏰈ha􏰈 􏰉􏰍􏰊 ha􏰐e􏰏’􏰈 d􏰍􏰏e 􏰈hi􏰋 􏰅ill 􏰋im􏰌l􏰉 ge􏰈 􏰈he 􏰎e􏰋􏰌􏰍􏰏􏰋e “Plea􏰋e 􏰎ead 􏰈he 􏰋􏰌ec”.
We 􏰅ill be 􏰊􏰋i􏰏g 􏰈he f􏰍ll􏰍􏰅i􏰏g 􏰏ame􏰋 i􏰏 􏰈he di􏰋c􏰊􏰋􏰋i􏰍􏰏 bel􏰍􏰅:
The di􏰎ec􏰈􏰍􏰎􏰉 􏰅he􏰎e 􏰉􏰍􏰊􏰎 P􏰍􏰋􏰈g􏰎eSQL 􏰋􏰍􏰊􏰎ce c􏰍de i􏰋 l􏰍ca􏰈ed (􏰈􏰉􏰌icall􏰉 /sr􏰐r/$􏰘􏰙ER/pos􏰈gresql-12.5)
The di􏰎ec􏰈􏰍􏰎􏰉 􏰅he􏰎e 􏰉􏰍􏰊 ha􏰐e i􏰏􏰋􏰈alled 􏰈he P􏰍􏰋􏰈g􏰎eSQL bi􏰏a􏰎ie􏰋 (􏰈􏰉􏰌icall􏰉 /sr􏰐r/$􏰘􏰙ER/pgsql)
The di􏰎ec􏰈􏰍􏰎􏰉 􏰅he􏰎e 􏰉􏰍􏰊 ha􏰐e 􏰌laced P􏰍􏰋􏰈g􏰎eSQL’􏰋 da􏰈a (􏰈􏰉􏰌icall􏰉 /sr􏰐r/$􏰘􏰙ER/pgsql/da􏰈a)
􏰈he file 􏰈􏰍 􏰅he􏰎e 􏰉􏰍􏰊 􏰋e􏰏d P􏰍􏰋􏰈g􏰎eSQL’􏰋 l􏰍g 􏰍􏰊􏰈􏰌􏰊􏰈 (􏰈􏰉􏰌icall􏰉 /sr􏰐r/$􏰘􏰙ER/pgsql/log)
I􏰏􏰈􏰎􏰍d􏰊c􏰈i􏰍􏰏
P􏰍􏰋􏰈g􏰎eSQL ha􏰋 a􏰏 e􏰇􏰈e􏰏􏰋ibili􏰈􏰉 m􏰍del 􏰅hich, am􏰍􏰏g 􏰍􏰈he􏰎 􏰈hi􏰏g􏰋, 􏰌􏰎􏰍􏰐ide􏰋 a 􏰅ell-defi􏰏ed 􏰌􏰎􏰍ce􏰋􏰋 f􏰍􏰎 addi􏰏g 􏰏e􏰅 da􏰈a 􏰈􏰉􏰌e􏰋 i􏰏􏰈􏰍 a P􏰍􏰋􏰈g􏰎eSQL 􏰋e􏰎􏰐e􏰎.
Thi􏰋 ca􏰌abili􏰈􏰉 ha􏰋 led 􏰈􏰍 􏰈he de􏰐el􏰍􏰌me􏰏􏰈 b􏰉 P􏰍􏰋􏰈g􏰎eSQL 􏰊􏰋e􏰎􏰋 􏰍f a 􏰏􏰊mbe􏰎 􏰍f 􏰈􏰉􏰌e􏰋 (􏰋􏰊ch a􏰋 􏰌􏰍l􏰉g􏰍􏰏􏰋) 􏰅hich ha􏰐e bec􏰍me 􏰌a􏰎􏰈 􏰍f 􏰈he 􏰋􏰈a􏰏da􏰎d di􏰋􏰈􏰎ib􏰊􏰈i􏰍􏰏.
I􏰈 al􏰋􏰍 mea􏰏􏰋 􏰈ha􏰈 P􏰍􏰋􏰈g􏰎eSQL i􏰋 􏰈he da􏰈aba􏰋e 􏰍f ch􏰍ice i􏰏 􏰎e􏰋ea􏰎ch 􏰌􏰎􏰍jec􏰈􏰋 􏰅hich aim 􏰈􏰍 􏰌􏰊􏰋h 􏰈he b􏰍􏰊􏰏da􏰎ie􏰋 􏰍f 􏰅ha􏰈 ki􏰏d 􏰍f da􏰈a a DBMS ca􏰏 ma􏰏age.
I􏰏 􏰈hi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈, 􏰅e 􏰅ill be addi􏰏g a 􏰏e􏰅 da􏰈a 􏰈􏰉􏰌e f􏰍􏰎 deali􏰏g 􏰅i􏰈h se􏰈s of in􏰈egers.
Y􏰍􏰊 ma􏰉 im􏰌leme􏰏􏰈 􏰈he f􏰊􏰏c􏰈i􏰍􏰏􏰋 f􏰍􏰎 􏰈he da􏰈a 􏰈􏰉􏰌e i􏰏 a􏰏􏰉 􏰅a􏰉 􏰉􏰍􏰊 like, pro􏰐ided 􏰈ha􏰈 􏰈he􏰉 􏰋a􏰈i􏰋f􏰉 􏰈he 􏰋ema􏰏􏰈ic􏰋 gi􏰐e􏰏 bel􏰍􏰅.
(i􏰏 􏰈he i􏰏􏰈Se􏰈􏰋 􏰋ec􏰈i􏰍􏰏)
N􏰍􏰈e 􏰈ha􏰈 a􏰎􏰎a􏰉􏰋 i􏰏 P􏰍􏰋􏰈g􏰎eSQL ha􏰐e 􏰋􏰍me 􏰌􏰎􏰍􏰌e􏰎􏰈ie􏰋 a􏰏d 􏰍􏰌e􏰎a􏰈i􏰍􏰏􏰋 􏰈ha􏰈 make 􏰈hem l􏰍􏰍k a li􏰈􏰈le bi􏰈 like 􏰋e􏰈􏰋. H􏰍􏰅e􏰐e􏰎, 􏰈he􏰉 a􏰎e no􏰈 􏰋e􏰈􏰋 a􏰏d ha􏰐e 􏰚􏰊i􏰈e diffe􏰎e􏰏􏰈 􏰋ema􏰏􏰈ic􏰋 􏰈􏰍 􏰈he da􏰈a 􏰈􏰉􏰌e 􏰈ha􏰈 􏰅e a􏰎e a􏰋ki􏰏g 􏰉􏰍􏰊 􏰈􏰍 im􏰌leme􏰏􏰈.
PG_CODE
PG_HOME
PG_DATA
PG_LOG
https://cgi.cse.uns􏰅.edu.au/􏰆cs9315/21T1/assignments/ass1/inde􏰇.php
1/6

2021/3/13 COMP9315 21T1 – Assignment 1
The 􏰌􏰎􏰍ce􏰋􏰋 f􏰍􏰎 addi􏰏g 􏰏e􏰅 ba􏰋e da􏰈a 􏰈􏰉􏰌e􏰋 i􏰏 P􏰍􏰋􏰈g􏰎eSQL i􏰋 de􏰋c􏰎ibed i􏰏 􏰈he f􏰍ll􏰍􏰅i􏰏g 􏰋ec􏰈i􏰍􏰏􏰋 􏰍f 􏰈he P􏰍􏰋􏰈g􏰎eSQL d􏰍c􏰊me􏰏􏰈a􏰈i􏰍􏰏:
37.10 C-La􏰏g􏰊age F􏰊􏰏c􏰈i􏰍􏰏􏰋 37.13 U􏰋e􏰎-defi􏰏ed T􏰉􏰌e􏰋 37.14 U􏰋e􏰎-defi􏰏ed O􏰌e􏰎a􏰈􏰍􏰎􏰋 SQL: CREATE TYPE
SQL: CREATE OPERATOR
SQL: CREATE OPERATOR CLASS
Sec􏰈i􏰍􏰏 37.13 􏰊􏰋e􏰋 a􏰏 e􏰇am􏰌le 􏰍f a c􏰍m􏰌le􏰇 􏰏􏰊mbe􏰎 􏰈􏰉􏰌e, 􏰅hich 􏰉􏰍􏰊 ca􏰏 􏰊􏰋e a􏰋 a 􏰋􏰈a􏰎􏰈i􏰏g 􏰌􏰍i􏰏􏰈 f􏰍􏰎 defi􏰏i􏰏g 􏰉􏰍􏰊􏰎 in􏰈Se􏰈 da􏰈a 􏰈􏰉􏰌e (􏰋ee bel􏰍􏰅). N􏰍􏰈e 􏰈ha􏰈 􏰈he c􏰍m􏰌le􏰇 􏰈􏰉􏰌e i􏰋 a 􏰋􏰈a􏰎􏰈i􏰏g 􏰌􏰍i􏰏􏰈 onl􏰉, 􏰈􏰍 gi􏰐e a􏰏 idea 􏰍􏰏 h􏰍􏰅 􏰏e􏰅 da􏰈a 􏰈􏰉􏰌e􏰋 a􏰎e added. D􏰍􏰏’􏰈 be f􏰍􏰍led i􏰏􏰈􏰍 􏰈hi􏰏ki􏰏g 􏰈ha􏰈 􏰈hi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈 j􏰊􏰋􏰈 􏰎e􏰚􏰊i􏰎e􏰋 􏰉􏰍􏰊 􏰈􏰍 cha􏰏ge 􏰈he 􏰏ame comple􏰇 􏰈􏰍 in􏰈Se􏰈; 􏰈he in􏰈Se􏰈 􏰈􏰉􏰌e i􏰋 m􏰍􏰎e c􏰍m􏰌le􏰇 (􏰏􏰍 􏰌􏰊􏰏 i􏰏􏰈e􏰏ded) 􏰈ha􏰏 􏰈he c􏰍m􏰌le􏰇 􏰏􏰊mbe􏰎 􏰈􏰉􏰌e.
The􏰎e a􏰎e 􏰍􏰈he􏰎 e􏰇am􏰌le􏰋 􏰍f 􏰏e􏰅 da􏰈a 􏰈􏰉􏰌e􏰋 􏰊􏰏de􏰎 􏰈he 􏰈􏰊􏰈orial a􏰏d con􏰈rib di􏰎ec􏰈􏰍􏰎ie􏰋. The􏰋e ma􏰉 􏰍􏰎 ma􏰉 􏰏􏰍􏰈 gi􏰐e 􏰉􏰍􏰊 􏰋􏰍me 􏰊􏰋ef􏰊l idea􏰋 􏰍􏰏 h􏰍􏰅 􏰈􏰍 im􏰌leme􏰏􏰈 􏰈he in􏰈Se􏰈 da􏰈a 􏰈􏰉􏰌e:
A􏰏 a􏰊􏰈􏰍-e􏰏c􏰎􏰉􏰌􏰈ed 􏰌a􏰋􏰋􏰅􏰍􏰎d da􏰈a􏰈􏰉􏰌e
PG􏰛CODE/con􏰈rib/chkpass/
A ca􏰋e-i􏰏􏰋e􏰏􏰋i􏰈i􏰐e cha􏰎ac􏰈e􏰎 􏰋􏰈􏰎i􏰏g da􏰈a􏰈􏰉􏰌e
PG􏰛CODE/con􏰈rib/ci􏰈e􏰇􏰈/
A c􏰍􏰏fide􏰏ce-i􏰏􏰈e􏰎􏰐al da􏰈a􏰈􏰉􏰌e
PG􏰛CODE/con􏰈rib/seg/
Se􏰈􏰈i􏰏g U􏰌
Y􏰍􏰊 􏰍􏰊gh􏰈 􏰈􏰍 􏰋􏰈a􏰎􏰈 􏰈hi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈 􏰅i􏰈h a f􏰎e􏰋h c􏰍􏰌􏰉 􏰍f P􏰍􏰋􏰈g􏰎eSQL, 􏰅i􏰈h􏰍􏰊􏰈 a􏰏􏰉 cha􏰏ge􏰋 􏰈ha􏰈 􏰉􏰍􏰊 migh􏰈 ha􏰐e made f􏰍􏰎 􏰈he P􏰎ac e􏰇e􏰎ci􏰋e􏰋 (􏰊􏰏le􏰋􏰋 􏰈he􏰋e cha􏰏ge􏰋 a􏰎e 􏰈􏰎i􏰐ial).
N􏰍􏰈e 􏰈ha􏰈 􏰉􏰍􏰊 􏰍􏰏l􏰉 􏰏eed 􏰈􏰍 c􏰍􏰏fig􏰊􏰎e, c􏰍m􏰌ile, a􏰏d i􏰏􏰋􏰈all 􏰉􏰍􏰊􏰎 P􏰍􏰋􏰈g􏰎eSQL 􏰋e􏰎􏰐e􏰎 􏰍􏰏ce f􏰍􏰎 􏰈hi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈.
All 􏰋􏰊b􏰋e􏰚􏰊e􏰏􏰈 c􏰍m􏰌ila􏰈i􏰍􏰏 􏰈ake􏰋 􏰌lace i􏰏 􏰈he src/􏰈􏰊􏰈orial di􏰎ec􏰈􏰍􏰎􏰉, a􏰏d 􏰍􏰏l􏰉 􏰎e􏰚􏰊i􏰎e􏰋 m􏰍difica􏰈i􏰍􏰏 􏰍f 􏰈he file􏰋 􏰈he􏰎e.
O􏰏ce 􏰉􏰍􏰊 ha􏰐e 􏰎e-i􏰏􏰋􏰈alled 􏰉􏰍􏰊􏰎 P􏰍􏰋􏰈g􏰎eSQL 􏰋e􏰎􏰐e􏰎, 􏰉􏰍􏰊 􏰋h􏰍􏰊ld 􏰎􏰊􏰏 􏰈he f􏰍ll􏰍􏰅i􏰏g c􏰍mma􏰏d􏰋:
O􏰏ce 􏰉􏰍􏰊’􏰐e made 􏰈he in􏰈se􏰈 file􏰋, 􏰉􏰍􏰊 􏰋h􏰍􏰊ld al􏰋􏰍 edi􏰈 􏰈he Makefile i􏰏 􏰈hi􏰋 di􏰎ec􏰈􏰍􏰎􏰉, a􏰏d add 􏰈he g􏰎ee􏰏 􏰈e􏰇􏰈 􏰈􏰍 􏰈he f􏰍ll􏰍􏰅i􏰏g li􏰏e􏰋:
MODULES = comple􏰇 f􏰊ncs in􏰈se􏰈
DATA_b􏰊il􏰈 = ad􏰐anced.sql basics.sql comple􏰇.sql f􏰊ncs.sql s􏰉sca􏰈.sql in􏰈se􏰈.sql
The 􏰎e􏰋􏰈 􏰍f 􏰈he 􏰅􏰍􏰎k f􏰍􏰎 􏰈hi􏰋 a􏰋􏰋ig􏰏me􏰏􏰈 i􏰏􏰐􏰍l􏰐e􏰋 edi􏰈i􏰏g 􏰈he in􏰈se􏰈.c a􏰏d in􏰈se􏰈.so􏰊rce file􏰋.
I􏰏 􏰍􏰎de􏰎 f􏰍􏰎 􏰈he Makefile 􏰈􏰍 􏰅􏰍􏰎k 􏰌􏰎􏰍􏰌e􏰎l􏰉, 􏰉􏰍􏰊 m􏰊􏰋􏰈 􏰊􏰋e 􏰈he ide􏰏􏰈ifie􏰎 _OBJWD_ i􏰏 􏰈he in􏰈se􏰈.so􏰊rce file 􏰈􏰍 􏰎efe􏰎 􏰈􏰍 􏰈he di􏰎ec􏰈􏰍􏰎􏰉 h􏰍ldi􏰏g 􏰈he c􏰍m􏰌iled lib􏰎a􏰎􏰉.
Y􏰍􏰊 􏰋h􏰍􏰊ld 􏰏e􏰐e􏰎 di􏰎ec􏰈l􏰉 m􏰍dif􏰉 􏰈he in􏰈se􏰈.sql file 􏰌􏰎􏰍d􏰊ced b􏰉 􏰈he Makefile.
If 􏰉􏰍􏰊 􏰅a􏰏􏰈 􏰈􏰍 􏰊􏰋e 􏰍􏰈he􏰎 *.c file􏰋 al􏰍􏰏g 􏰅i􏰈h in􏰈se􏰈.c, 􏰈he􏰏 􏰉􏰍􏰊 ca􏰏 d􏰍 􏰋􏰍, b􏰊􏰈 􏰉􏰍􏰊 􏰅ill 􏰏eed 􏰈􏰍 make f􏰊􏰎􏰈he􏰎 cha􏰏ge􏰋 􏰈􏰍 􏰈he Makefile 􏰈􏰍 e􏰏􏰋􏰊􏰎e 􏰈ha􏰈 􏰈he􏰉 a􏰎e c􏰍m􏰌iled a􏰏d li􏰏ked c􏰍􏰎􏰎ec􏰈l􏰉 i􏰏􏰈􏰍 􏰈he lib􏰎a􏰎􏰉.
N􏰍􏰈e 􏰈ha􏰈 􏰉􏰍􏰊􏰎 􏰋􏰊bmi􏰈􏰈ed 􏰐e􏰎􏰋i􏰍􏰏􏰋 􏰍f in􏰈se􏰈.c a􏰏d in􏰈se􏰈.so􏰊rce 􏰋h􏰍􏰊ld 􏰏􏰍􏰈 c􏰍􏰏􏰈ai􏰏 a􏰏􏰉 􏰎efe􏰎e􏰏ce􏰋 􏰈􏰍 􏰈he comple􏰇 􏰈􏰉􏰌e (beca􏰊􏰋e 􏰈ha􏰈’􏰋 􏰏􏰍􏰈 􏰅ha􏰈 􏰉􏰍􏰊’􏰎e im􏰌leme􏰏􏰈i􏰏g).
Make 􏰋􏰊􏰎e 􏰈ha􏰈 􏰈he c􏰍mme􏰏􏰈􏰋 i􏰏 􏰈he 􏰌􏰎􏰍g􏰎am de􏰋c􏰎ibe􏰋 􏰈he c􏰍de 􏰈ha􏰈 􏰉o􏰊 􏰅􏰎􏰍􏰈e.
Al􏰋􏰍, do no􏰈 􏰌􏰊􏰈 􏰈e􏰋􏰈i􏰏g 􏰚􏰊e􏰎ie􏰋 i􏰏 􏰉􏰍􏰊􏰎 in􏰈se􏰈.so􏰊rce; all i􏰈 􏰋h􏰍􏰊ld d􏰍 i􏰋 c􏰎ea􏰈e 􏰈he 􏰏e􏰅 da􏰈a 􏰈􏰉􏰌e. P􏰊􏰈 a􏰏􏰉 􏰈e􏰋􏰈i􏰏g 􏰉􏰍􏰊 􏰅a􏰏􏰈 􏰈􏰍 d􏰍 i􏰏 a 􏰋e􏰌a􏰎a􏰈e *.sql, 􏰅hich 􏰉􏰍􏰊 d􏰍􏰏’􏰈 􏰏eed 􏰈􏰍 􏰋􏰊bmi􏰈. A􏰏d do no􏰈 d􏰎􏰍􏰌 􏰈he in􏰈Se􏰈 􏰈􏰉􏰌e a􏰈 􏰈he e􏰏d 􏰍f in􏰈se􏰈.so􏰊rce. If 􏰉􏰍􏰊 d􏰍, 􏰉􏰍􏰊􏰎 da􏰈a 􏰈􏰉􏰌e 􏰅ill 􏰐a􏰏i􏰋h bef􏰍􏰎e 􏰅e ha􏰐e a cha􏰏ce 􏰈􏰍 􏰈e􏰋􏰈 i􏰈.
The i􏰏􏰈Se􏰈 Da􏰈a T􏰉􏰌e
We aim 􏰈􏰍 defi􏰏e a 􏰏e􏰅 ba􏰋e 􏰈􏰉􏰌e in􏰈Se􏰈, 􏰈􏰍 􏰋􏰈􏰍􏰎e 􏰈he 􏰏􏰍􏰈i􏰍􏰏 􏰍f 􏰋e􏰈􏰋 􏰍f i􏰏􏰈ege􏰎 􏰐al􏰊e􏰋. We al􏰋􏰍 aim 􏰈􏰍 defi􏰏e a 􏰊􏰋ef􏰊l c􏰍llec􏰈i􏰍􏰏 􏰍f 􏰍􏰌e􏰎a􏰈i􏰍􏰏􏰋 􏰍􏰏 􏰈he in􏰈Se􏰈 􏰈􏰉􏰌e.
$ cd PG_CODE/src/tutorial
$ cp complex.c intset.c
$ cp complex.source intset.source
https://cgi.cse.uns􏰅.edu.au/􏰆cs9315/21T1/assignments/ass1/inde􏰇.php
2/6

2021/3/13 COMP9315 21T1 – Assignment 1
H􏰍􏰅 􏰉􏰍􏰊 􏰎e􏰌􏰎e􏰋e􏰏􏰈 in􏰈Se􏰈 􏰐al􏰊e􏰋, a􏰏d im􏰌leme􏰏􏰈 f􏰊􏰏c􏰈i􏰍􏰏􏰋 􏰈􏰍 ma􏰏i􏰌􏰊la􏰈e 􏰈hem, i􏰋 􏰊􏰌 􏰈􏰍 􏰉􏰍􏰊. H􏰍􏰅e􏰐e􏰎, 􏰈he􏰉 m􏰊􏰋􏰈 􏰋a􏰈i􏰋f􏰉 􏰈he 􏰎e􏰚􏰊i􏰎eme􏰏􏰈􏰋 bel􏰍􏰅
O􏰏ce im􏰌leme􏰏􏰈ed c􏰍􏰎􏰎ec􏰈l􏰉, 􏰉􏰍􏰊 􏰋h􏰍􏰊ld be able 􏰈􏰍 􏰊􏰋e 􏰉􏰍􏰊􏰎 P􏰍􏰋􏰈g􏰎eSQL 􏰋e􏰎􏰐e􏰎 􏰈􏰍 b􏰊ild 􏰈he f􏰍ll􏰍􏰅i􏰏g ki􏰏d 􏰍f SQL a􏰌􏰌lica􏰈i􏰍􏰏􏰋:
crea􏰈e 􏰈able Fea􏰈􏰊res (
id in􏰈eger primar􏰉 ke􏰉,
name 􏰈e􏰇􏰈
);
crea􏰈e 􏰈able DBS􏰉s􏰈ems (
name 􏰈e􏰇􏰈 primar􏰉 ke􏰉,
fea􏰈􏰊res in􏰈Se􏰈
);
inser􏰈 in􏰈o Fea􏰈􏰊res (id, name) 􏰐al􏰊es
(1, ‘􏰅ell designed’),
(2, ‘efficien􏰈’),
(3, ‘fle􏰇ible’),
(4, ‘rob􏰊s􏰈’);
inser􏰈 in􏰈o DBS􏰉s􏰈ems (name, fea􏰈􏰊res) 􏰐al􏰊es
(‘M􏰉SQL’, ‘􏰜􏰝’),
(‘MongoDB’, ‘􏰜􏰝’),
(‘Oracle’, ‘􏰜2,4􏰝’),
(‘Pos􏰈greSQL’, ‘􏰜1,2,3,4􏰝’);
intSet 􏰐alues
I􏰏 ma􏰈hema􏰈ic􏰋, 􏰅e 􏰎e􏰌􏰎e􏰋e􏰏􏰈 a 􏰋e􏰈 a􏰋 a c􏰊􏰎l􏰉-b􏰎acke􏰈ed, c􏰍mma-􏰋e􏰌a􏰎a􏰈ed c􏰍llec􏰈i􏰍􏰏 􏰍f 􏰐al􏰊e􏰋: S􏰊ch a 􏰋e􏰈 c􏰍􏰏􏰈ai􏰏􏰋 􏰍􏰏l􏰉 di􏰋􏰈i􏰏c􏰈 􏰐al􏰊e􏰋, a􏰏d 􏰏􏰍 􏰌a􏰎􏰈ic􏰊la􏰎 􏰍􏰎de􏰎i􏰏g ca􏰏 be im􏰌􏰍􏰋ed.
O􏰊􏰎 in􏰈Se􏰈 􏰐al􏰊e􏰋 ca􏰏 be 􏰎e􏰌􏰎e􏰋e􏰏􏰈ed 􏰋imila􏰎l􏰉.
We ca􏰏 ha􏰐e a c􏰍mma-􏰋e􏰌a􏰎a􏰈ed li􏰋􏰈 􏰍f 􏰏􏰍􏰏-􏰏ega􏰈i􏰐e i􏰏􏰈ege􏰎􏰋, 􏰋􏰊􏰎􏰎􏰍􏰊􏰏ded b􏰉 a 􏰋e􏰈 􏰍f c􏰊􏰎l􏰉 b􏰎ace􏰋, 􏰅hich i􏰋 􏰌􏰎e􏰋e􏰏􏰈ed 􏰈􏰍 a􏰏d b􏰉 P􏰍􏰋􏰈g􏰎eSQL a􏰋 a 􏰋􏰈􏰎i􏰏g.
F􏰍􏰎 e􏰇am􏰌le:
‘􏰜 1, 2, 3, 4, 5 􏰝’.
Whi􏰈e􏰋􏰌ace 􏰋h􏰍􏰊ld 􏰏􏰍􏰈 ma􏰈􏰈e􏰎, 􏰋􏰍 ‘􏰜1,2,3􏰝’ a􏰏d ‘􏰜 1, 2, 3 􏰝’ a􏰎e e􏰚􏰊i􏰐ale􏰏􏰈. Simila􏰎l􏰉, a 􏰋e􏰈 c􏰍􏰏􏰈ai􏰏􏰋 di􏰋􏰈i􏰏c􏰈 􏰐al􏰊e􏰋, 􏰋􏰍 ‘􏰜1,1,1,1,1􏰝’ i􏰋 e􏰚􏰊i􏰐ale􏰏􏰈 􏰈􏰍 ‘􏰜1􏰝’. A􏰏d 􏰍􏰎de􏰎i􏰏g i􏰋 i􏰎􏰎ele􏰐a􏰏􏰈, 􏰋􏰍 ‘􏰜1,2,3􏰝’ i􏰋 e􏰚􏰊i􏰐ale􏰏􏰈 􏰈􏰍 ‘􏰜3,2,1􏰝’.
The i􏰏􏰈ege􏰎 􏰐al􏰊e􏰋 i􏰏 􏰈he 􏰋e􏰈 a􏰎e a􏰋􏰋􏰊med 􏰈􏰍 c􏰍􏰏􏰋i􏰋􏰈 􏰍f a 􏰋e􏰚􏰊e􏰏ce 􏰍f digi􏰈􏰋. The􏰎e a􏰎e 􏰏􏰍 + 􏰍􏰎 – 􏰋ig􏰏􏰋.
The􏰎e ca􏰏 be leadi􏰏g 􏰞e􏰎􏰍e􏰋, b􏰊􏰈 􏰈he􏰉 􏰋h􏰍􏰊ld effec􏰈i􏰐el􏰉 be ig􏰏􏰍􏰎ed, e.g. 0001 􏰋h􏰍􏰊ld be 􏰈􏰎ea􏰈ed 􏰈he 􏰋ame a􏰋 1.
Y􏰍􏰊 ma􏰉 no􏰈 ass􏰊me a fi􏰇ed limi􏰈 􏰈􏰍 􏰈he 􏰋i􏰞e 􏰍f 􏰈he 􏰋e􏰈.
I􏰈 ma􏰉 c􏰍􏰏􏰈ai􏰏 􏰞e􏰎􏰍 􏰍􏰎 m􏰍􏰎e eleme􏰏􏰈􏰋, b􏰍􏰊􏰏ded b􏰉 􏰈he da􏰈aba􏰋e’􏰋 ca􏰌aci􏰈􏰉 􏰈􏰍 􏰋􏰈􏰍􏰎e 􏰐al􏰊e􏰋.
Y􏰍􏰊 ma􏰉 ass􏰊me 􏰈ha􏰈 each i􏰏􏰈e􏰎ge􏰎 􏰐al􏰊e 􏰅ill be le􏰋􏰋 􏰈ha􏰏 INT_MAX. ie. each eleme􏰏􏰈 i􏰏 􏰈he 􏰋e􏰈 􏰅ill be le􏰋􏰋 􏰈ha􏰏 .
Valid intSets
‘􏰜 􏰝’
‘􏰜2,3,1􏰝’
‘􏰜6,6,6,6,6,6􏰝’
‘􏰜10, 9, 8, 7, 6,5,4,3,2,1􏰝’
‘􏰜1, 999, 13, 666, 5􏰝’
‘􏰜 1 , 3 , 5 , 7,9 􏰝’
‘􏰜1, 01, 001, 0001􏰝’ (same as ‘􏰜1􏰝’) ‘􏰜1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20􏰝’ ‘􏰜1,2,3,4,5,6,7,8,9,10,(and 􏰈hen all n􏰊mbers 􏰈o),9999,10000􏰝’ ‘ 􏰜1,5,7,9􏰝’
‘􏰜2,4,6, 8 􏰝 ‘
‘􏰜0􏰝’
In􏰐alid intSets
‘􏰜a,􏰟,􏰠􏰝’
‘􏰜 a, 􏰟, 􏰠 􏰝’
‘􏰜1, 2.0, 3􏰝’
‘􏰜1, 􏰜2,3􏰝, 4􏰝’
‘􏰜1, 2, 3, 4, 􏰔􏰕􏰐􏰓􏰝’
‘􏰜 1 2 3 4 􏰝’
‘1 2 3 4’
‘1 2 3􏰝’
‘􏰜 -1 􏰝’
‘􏰜1,2,3’
‘1,2,3,4,5’
‘􏰜􏰜1,2,3,5􏰝’
https://cgi.cse.uns􏰅.edu.au/􏰆cs9315/21T1/assignments/ass1/inde􏰇.php
3/6

2021/3/13 COMP9315 21T1 – Assignment 1
Operations on intSets
Y􏰍􏰊 m􏰊􏰋􏰈 im􏰌leme􏰏􏰈 all 􏰍f 􏰈he f􏰍ll􏰍􏰅i􏰏g 􏰍􏰌e􏰎a􏰈i􏰍􏰏􏰋 f􏰍􏰎 􏰈he in􏰈Se􏰈 􏰈􏰉􏰌e.
(a􏰋􏰋􏰊mi􏰏g
, , a􏰏d a􏰎e in􏰈Se􏰈􏰋, a􏰏d i􏰋 a􏰏 i􏰏􏰈ege􏰎):
i ? S #S
A>@B A@B
A&&B
A􏰡􏰡B A!!B
A-B
i􏰏􏰈Se􏰈 c􏰍􏰏􏰈ai􏰏􏰋 􏰈he i􏰏􏰈ege􏰎 ;
Tha􏰈 i􏰋, .
Gi􏰐e 􏰈he cardinali􏰈􏰉, 􏰍􏰎 􏰏􏰊mbe􏰎 􏰍f di􏰋􏰈i􏰏c􏰈 eleme􏰏􏰈􏰋 i􏰏, i􏰏􏰈Se􏰈 ; Tha􏰈 i􏰋, .
D􏰍e􏰋 i􏰏􏰈Se􏰈 c􏰍􏰏􏰈ai􏰏 all 􏰈he 􏰐al􏰊e􏰋 i􏰏 i􏰏􏰈Se􏰈 ie, f􏰍􏰎 e􏰐e􏰎􏰉 eleme􏰏􏰈 􏰍f , i􏰋 i􏰈 a􏰏 eleme􏰏􏰈 􏰍f Tha􏰈 i􏰋, 􏰈he im􏰌􏰎􏰍􏰌e􏰎 􏰋􏰊􏰌e􏰎􏰋e􏰈 ( ) D􏰍e􏰋 i􏰏􏰈Se􏰈 c􏰍􏰏􏰈ai􏰏 􏰍􏰏l􏰉 􏰐al􏰊e􏰋 i􏰏 i􏰏􏰈Se􏰈 ie, f􏰍􏰎 e􏰐e􏰎􏰉 eleme􏰏􏰈 􏰍f , i􏰋 i􏰈 a􏰏 eleme􏰏􏰈 􏰍f Tha􏰈 i􏰋, 􏰈he im􏰌􏰎􏰍􏰌e􏰎 􏰋􏰊b􏰋e􏰈 ( ) i􏰏􏰈Se􏰈􏰋 a􏰏d a􏰎e e􏰚􏰊al;
? ?
? ?
Tha􏰈 i􏰋, i􏰏􏰈Se􏰈 c􏰍􏰏􏰈ai􏰏􏰋 all 􏰈he 􏰐al􏰊e􏰋 􏰍f i􏰏􏰈Se􏰈 a􏰏d i􏰏􏰈Se􏰈 i􏰏􏰈Se􏰈 ;
Tha􏰈 i􏰋, e􏰐e􏰎􏰉 eleme􏰏􏰈 i􏰏 ca􏰏 be f􏰍􏰊􏰏d i􏰏 , a􏰏d 􏰐ice 􏰐e􏰎􏰋a. i􏰏􏰈Se􏰈􏰋 a􏰏d a􏰎e 􏰏􏰍􏰈 e􏰚􏰊al;
c􏰍􏰏􏰈ai􏰏􏰋 all 􏰈he 􏰐al􏰊e􏰋 􏰍f
Tha􏰈 i􏰋, i􏰏􏰈Se􏰈
􏰐al􏰊e􏰋 􏰍f i􏰏􏰈Se􏰈
Tha􏰈 i􏰋, 􏰋􏰍me eleme􏰏􏰈 i􏰏 ca􏰏􏰏􏰍􏰈 be f􏰍􏰊􏰏d i􏰏 , 􏰍􏰎 􏰐ice 􏰐e􏰎􏰋a.
Take􏰋 􏰈he 􏰋e􏰈 in􏰈er􏰋ec􏰈ion, a􏰏d 􏰌􏰎􏰍d􏰊ce􏰋 a􏰏 i􏰏􏰈Se􏰈 c􏰍􏰏􏰈ai􏰏i􏰏g 􏰈he eleme􏰏􏰈􏰋 c􏰍mm􏰍􏰏 􏰈􏰍
a􏰏d ;
Tha􏰈 i􏰋, .
Take􏰋 􏰈he 􏰋e􏰈 􏰊nion, a􏰏d 􏰌􏰎􏰍d􏰊ce􏰋 a􏰏 i􏰏􏰈Se􏰈 c􏰍􏰏􏰈ai􏰏i􏰏g all 􏰈he eleme􏰏􏰈􏰋 􏰍f a􏰏d ;
Tha􏰈 i􏰋, .
Take􏰋 􏰈he 􏰋e􏰈 di􏰋j􏰊nc􏰈ion, a􏰏d 􏰌􏰎􏰍d􏰊ce􏰋 a􏰏 i􏰏􏰈Se􏰈 c􏰍􏰏􏰈ai􏰏i􏰏g eleme􏰏􏰈􏰋 􏰈ha􏰈 a􏰎e i􏰏 a􏰏d 􏰏􏰍􏰈 i􏰏 ,
􏰍􏰎 􏰈ha􏰈 a􏰎e i􏰏 a􏰏d 􏰏􏰍􏰈 i􏰏 .
Take􏰋 􏰈he 􏰋e􏰈 difference, a􏰏d 􏰌􏰎􏰍d􏰊ce􏰋 a􏰏 i􏰏􏰈Se􏰈 c􏰍􏰏􏰈ai􏰏i􏰏g eleme􏰏􏰈􏰋 􏰈ha􏰈 a􏰎e i􏰏 a􏰏d 􏰏􏰍􏰈 i􏰏
.
N􏰍􏰈e 􏰈ha􏰈 􏰈hi􏰋 i􏰋 no􏰈 􏰈he 􏰋ame a􏰋 A !! B.
d􏰍e􏰋􏰏’􏰈 c􏰍􏰏􏰈ai􏰏 all 􏰈he 􏰐al􏰊e􏰋 􏰍f i􏰏􏰈Se􏰈 􏰍􏰎 i􏰏􏰈Se􏰈 d􏰍e􏰋􏰏’􏰈 c􏰍􏰏􏰈ai􏰏 all 􏰈he ;
Bel􏰍􏰅 a􏰎e e􏰇am􏰌le􏰋 􏰍f h􏰍􏰅 􏰉􏰍􏰊 migh􏰈 􏰊􏰋e in􏰈Se􏰈􏰋, 􏰈􏰍 ill􏰊􏰋􏰈􏰎a􏰈e 􏰈he 􏰋ema􏰏􏰈ic􏰋.
Y􏰍􏰊 ca􏰏 􏰊􏰋e 􏰈he􏰋e a􏰋 a􏰏 i􏰏i􏰈ial 􏰈e􏰋􏰈 􏰋e􏰈; 􏰅e 􏰅ill 􏰋􏰊􏰌􏰌l􏰉 a m􏰍􏰎e c􏰍m􏰌􏰎ehe􏰏􏰋i􏰐e 􏰈e􏰋􏰈 􏰋􏰊i􏰈e la􏰈e􏰎.
‘􏰜7,17,,27,37􏰝’
‘􏰜1,2,3,5,8,􏰝’
db=# create table mySets (id integer primary key, iset intSet);
CREATE TABLE
db=# insert into mySets values (1, ‘􏰜1,2,3􏰝’);
INSERT 0 1
db=# insert into mySets values (2, ‘􏰜1,3,1,3,1􏰝’);
INSERT 0 1
db=# insert into mySets values (3, ‘􏰜3,4,5􏰝’);
INSERT 0 1
db=# insert into mySets values (4, ‘􏰜4,5􏰝’);
INSERT 0 1
db=# select * from mySets order by id;
id 􏰡 ise􏰈
—-+———
1 􏰡 􏰜1,2,3􏰝
2 􏰡 􏰜1,3􏰝
3 􏰡 􏰜3,4,5􏰝
4 􏰡 􏰜4,5􏰝
(4 ro􏰅s)
— get all pairs of tuples where the second iset is a subset of first iset
db=# select a.*, b.* from mySets a, mySets b
db-# where (b.iset @< a.iset) and a.id != b.id; id 􏰡 ise􏰈 􏰡 id 􏰡 ise􏰈 ----+---------+----+------- 1􏰡􏰜1,2,3􏰝􏰡 2􏰡􏰜1,3􏰝 3􏰡􏰜3,4,5􏰝􏰡 4􏰡􏰜4,5􏰝 (2 ro􏰅s) https://cgi.cse.uns􏰅.edu.au/􏰆cs9315/21T1/assignments/ass1/inde􏰇.php 4/6 2021/3/13 COMP9315 21T1 - Assignment 1 Y􏰍􏰊 􏰋h􏰍􏰊ld 􏰈hi􏰏k 􏰍f 􏰋􏰍me m􏰍􏰎e 􏰈e􏰋􏰈􏰋 􏰍f 􏰉􏰍􏰊􏰎 􏰍􏰅􏰏. I􏰏 􏰌a􏰎􏰈ic􏰊la􏰎, make 􏰋􏰊􏰎e 􏰈ha􏰈 􏰉􏰍􏰊 check 􏰈ha􏰈 􏰉􏰍􏰊􏰎 c􏰍de 􏰅􏰍􏰎k􏰋 􏰅i􏰈h la􏰎ge in􏰈Se􏰈􏰋 (e.g. ca􏰎di􏰏ali􏰈􏰉 􏰢 1000). If 􏰉􏰍􏰊 c􏰍me 􏰊􏰌 􏰅i􏰈h a􏰏􏰉 􏰈e􏰋􏰈􏰋 􏰈ha􏰈 􏰉􏰍􏰊 􏰈hi􏰏k a􏰎e 􏰌a􏰎􏰈ic􏰊la􏰎l􏰉 cle􏰐e􏰎, feel f􏰎ee 􏰈􏰍 􏰌􏰍􏰋􏰈 􏰈hem i􏰏 􏰈he c􏰍mme􏰏􏰈􏰋 􏰋ec􏰈i􏰍􏰏 bel􏰍􏰅. Representing intSets The fi􏰎􏰋􏰈 􏰈hi􏰏g 􏰉􏰍􏰊 􏰏eed 􏰈􏰍 d􏰍 i􏰋 􏰈􏰍 decide 􏰍􏰏 a􏰏 i􏰏􏰈e􏰎􏰏al 􏰎e􏰌􏰎e􏰋e􏰏􏰈a􏰈i􏰍􏰏 f􏰍􏰎 􏰉􏰍􏰊􏰎 in􏰈Se􏰈 da􏰈a 􏰈􏰉􏰌e. Y􏰍􏰊 􏰋h􏰍􏰊ld d􏰍 􏰈hi􏰋 af􏰈er 􏰉􏰍􏰊 ha􏰐e 􏰊􏰏de􏰎􏰋􏰈􏰍􏰍d 􏰈he de􏰋c􏰎i􏰌􏰈i􏰍􏰏 􏰍f 􏰈he 􏰍􏰌e􏰎a􏰈􏰍􏰎􏰋 ab􏰍􏰐e. Si􏰏ce 􏰅ha􏰈 􏰈he􏰉 􏰎e􏰚􏰊i􏰎e ma􏰉 affec􏰈 h􏰍􏰅 􏰉􏰍􏰊 decide 􏰍􏰏 􏰈he 􏰎e􏰌􏰎e􏰋e􏰏􏰈a􏰈i􏰍􏰏 􏰍f 􏰉􏰍􏰊􏰎 in􏰈Se􏰈 􏰐al􏰊e􏰋. N􏰍􏰈e 􏰈ha􏰈 beca􏰊􏰋e 􏰍f 􏰈he 􏰎e􏰚􏰊i􏰎eme􏰏􏰈 􏰈ha􏰈 a􏰏 in􏰈Se􏰈 ca􏰏 be a􏰎bi􏰈􏰎a􏰎il􏰉 la􏰎ge (􏰋ee ab􏰍􏰐e), 􏰉􏰍􏰊 canno􏰈 ha􏰐e a 􏰎e􏰌􏰎e􏰋e􏰏􏰈a􏰈i􏰍􏰏 􏰈ha􏰈 􏰊􏰋e􏰋 a fi􏰇ed-􏰋i􏰞e 􏰍bjec􏰈 􏰈􏰍 h􏰍ld 􏰐al􏰊e􏰋 􏰍f 􏰈􏰉􏰌e in􏰈Se􏰈. Whe􏰏 􏰉􏰍􏰊 􏰎ead 􏰋􏰈􏰎i􏰏g􏰋 􏰎e􏰌􏰎e􏰋e􏰏􏰈i􏰏g in􏰈Se􏰈 􏰐al􏰊e􏰋, 􏰈he􏰉 a􏰎e c􏰍􏰏􏰐e􏰎􏰈ed i􏰏􏰈􏰍 􏰉􏰍􏰊􏰎 i􏰏􏰈e􏰎􏰏al f􏰍􏰎m, 􏰋􏰈􏰍􏰎ed i􏰏 􏰈he da􏰈aba􏰋e i􏰏 􏰈hi􏰋 f􏰍􏰎m, a􏰏d 􏰍􏰌e􏰎a􏰈i􏰍􏰏􏰋 􏰍􏰏 in􏰈Se􏰈 􏰐al􏰊e􏰋 a􏰎e ca􏰎􏰎ied 􏰍􏰊􏰈 􏰊􏰋i􏰏g 􏰈hi􏰋 da􏰈a 􏰋􏰈􏰎􏰊c􏰈􏰊􏰎e. Whe􏰏 􏰉􏰍􏰊 di􏰋􏰌la􏰉 in􏰈Se􏰈 􏰐al􏰊e􏰋, 􏰉􏰍􏰊 􏰋h􏰍􏰊ld 􏰋h􏰍􏰅 􏰈hem i􏰏 a ca􏰏􏰍􏰏ical f􏰍􏰎m, 􏰎ega􏰎dle􏰋􏰋 􏰍f h􏰍􏰅 􏰈he􏰉 􏰅e􏰎e e􏰏􏰈e􏰎ed 􏰍􏰎 h􏰍􏰅 􏰈he􏰉 a􏰎e 􏰋􏰈􏰍􏰎ed. The ca􏰏􏰍􏰏ical f􏰍􏰎m f􏰍􏰎 􏰍􏰊􏰈􏰌􏰊􏰈 (a􏰈 lea􏰋􏰈) 􏰋h􏰍􏰊ld i􏰏cl􏰊de 􏰏􏰍 􏰋􏰌ace􏰋, a􏰏d 􏰋h􏰍􏰊ld ha􏰐e eleme􏰏􏰈􏰋 i􏰏 a􏰋ce􏰏di􏰏g 􏰍􏰎de􏰎. The fi􏰎􏰋􏰈 f􏰊􏰏c􏰈i􏰍􏰏􏰋 􏰉􏰍􏰊 􏰏eed 􏰈􏰍 􏰅􏰎i􏰈e a􏰎e 􏰍􏰏e􏰋 􏰈􏰍 􏰎ead a􏰏d di􏰋􏰌la􏰉 􏰐al􏰊e􏰋 􏰍f 􏰈􏰉􏰌e in􏰈Se􏰈. Y􏰍􏰊 􏰋h􏰍􏰊ld 􏰅􏰎i􏰈e a􏰏al􏰍g􏰊e􏰋 􏰍f 􏰈he f􏰊􏰏c􏰈i􏰍􏰏􏰋 comple􏰇_in() a􏰏d comple􏰇_o􏰊􏰈() 􏰈ha􏰈 a􏰎e defi􏰏ed i􏰏 􏰈he file -- insert extra values into the iset in tuple #4 via union db=# update mySets set iset = iset 􏰡􏰡 '􏰜5,6,7,8􏰝' where id = 4; UPDATE 1 db=# select * from mySets where id=4; id 􏰡 ise􏰈 ----+------------- 4 􏰡 􏰜4,5,6,7,8􏰝 (1 ro􏰅) -- tuple #4 is no longer a subset of tuple #3 db=# select a.*, b.* from mySets a, mySets b db-# where (b.iset @< a.iset) and a.id != b.id; id 􏰡 ise􏰈 􏰡 id 􏰡 ise􏰈 ----+---------+----+------- 1􏰡􏰜1,2,3􏰝􏰡 2􏰡􏰜1,3􏰝 (1 ro􏰅) -- get the cardinality (size) of each intSet db=# select id, iset, (#iset) as card from mySets order by id; id 􏰡 ise􏰈 􏰡 card ----+-------------+------ 1 􏰡 􏰜1,2,3􏰝 2 􏰡 􏰜1,3􏰝 3 􏰡 􏰜3,4,5􏰝 4 􏰡 􏰜4,5,6,7,8􏰝 􏰡 5 (4 ro􏰅s) -- form the intersection of each pair of sets db=# select a.iset, b.iset, a.iset && b.iset db-# from mySets a, mySets b where a.id < b.id; ise􏰈 􏰡 ise􏰈 􏰡 ?col􏰊mn? ---------+-------------+---------- 􏰜1,2,3􏰝 􏰡 􏰜1,3􏰝 􏰡 􏰜1,3􏰝 􏰜1,2,3􏰝 􏰡 􏰜3,4,5􏰝 􏰡 􏰜3􏰝 􏰜1,2,3􏰝 􏰡 􏰜4,5,6,7,8􏰝 􏰡 􏰜􏰝 􏰜1,3􏰝 􏰡 􏰜3,4,5􏰝 􏰡 􏰜3􏰝 􏰜1,3􏰝 􏰡 􏰜4,5,6,7,8􏰝 􏰡 􏰜􏰝 􏰜3,4,5􏰝 􏰡 􏰜4,5,6,7,8􏰝 􏰡 􏰜4,5􏰝 (6 ro􏰅s) db=# delete from mySets where iset @< '􏰜1,2,3,4,5,6􏰝'; DELETE 3 db=# select * from mySets; id 􏰡 ise􏰈 ----+------------- 4 􏰡 􏰜4,5,6,7,8􏰝 (1 ro􏰅) -- etc. etc. etc. 􏰡 3 􏰡 2 􏰡 3 https://cgi.cse.uns􏰅.edu.au/􏰆cs9315/21T1/assignments/ass1/inde􏰇.php 5/6 2021/3/13 COMP9315 21T1 - Assignment 1 comple􏰇.c. S􏰊i􏰈able 􏰏ame􏰋 f􏰍􏰎 􏰈he􏰋e f􏰊􏰏c􏰈i􏰍􏰏􏰋 􏰅􏰍􏰊ld be e.g. in􏰈se􏰈_in() a􏰏d in􏰈se􏰈_o􏰊􏰈(). Make 􏰋􏰊􏰎e 􏰈ha􏰈 􏰉􏰍􏰊 􏰊􏰋e 􏰈he V1 􏰋􏰈􏰉le f􏰊􏰏c􏰈i􏰍􏰏 i􏰏􏰈e􏰎face (a􏰋 i􏰋 d􏰍􏰏e i􏰏 comple􏰇.c). N􏰍􏰈e 􏰈ha􏰈 􏰈he 􏰈􏰅􏰍 i􏰏􏰌􏰊􏰈/􏰍􏰊􏰈􏰌􏰊􏰈 f􏰊􏰏c􏰈i􏰍􏰏􏰋 􏰋h􏰍􏰊ld be c􏰍m􏰌leme􏰏􏰈a􏰎􏰉, mea􏰏i􏰏g 􏰈ha􏰈 a􏰏􏰉 􏰋􏰈􏰎i􏰏g di􏰋􏰌la􏰉ed b􏰉 􏰈he 􏰍􏰊􏰈􏰌􏰊􏰈 f􏰊􏰏c􏰈i􏰍􏰏 m􏰊􏰋􏰈 be able 􏰈􏰍 be 􏰎ead 􏰊􏰋i􏰏g 􏰈he i􏰏􏰌􏰊􏰈 f􏰊􏰏c􏰈i􏰍􏰏. The􏰎e i􏰋 􏰏􏰍 􏰎e􏰚􏰊i􏰎eme􏰏􏰈 f􏰍􏰎 􏰉􏰍􏰊 􏰈􏰍 􏰎e􏰈ai􏰏 􏰈he 􏰌􏰎eci􏰋e 􏰋􏰈􏰎i􏰏g 􏰈ha􏰈 􏰅a􏰋 􏰊􏰋ed f􏰍􏰎 i􏰏􏰌􏰊􏰈 (e.g. 􏰉􏰍􏰊 c􏰍􏰊ld 􏰋􏰈􏰍􏰎e 􏰈he in􏰈Se􏰈 􏰐al􏰊e i􏰏􏰈e􏰎􏰏all􏰉 i􏰏 ca􏰏􏰍􏰏ical f􏰍􏰎m). N􏰍􏰈e 􏰈ha􏰈 􏰉􏰍􏰊 a􏰎e no􏰈 􏰎e􏰚􏰊i􏰎ed 􏰈􏰍 defi􏰏e bi􏰏a􏰎􏰉 i􏰏􏰌􏰊􏰈/􏰍􏰊􏰈􏰌􏰊􏰈 f􏰊􏰏c􏰈i􏰍􏰏􏰋 called recei􏰐e_f􏰊nc􏰈ion a􏰏d send_f􏰊nc􏰈ion i􏰏 􏰈he P􏰍􏰋􏰈g􏰎eSQL d􏰍c􏰊me􏰏􏰈a􏰈i􏰍􏰏, a􏰏d called comple􏰇_send() a􏰏d comple􏰇_rec􏰐() i􏰏 􏰈he comple􏰇.c file. Hin􏰈: 􏰈e􏰋􏰈 􏰍􏰊􏰈 a􏰋 ma􏰏􏰉 􏰍f 􏰉􏰍􏰊􏰎 C f􏰊􏰏c􏰈i􏰍􏰏􏰋 a􏰋 􏰉􏰍􏰊 ca􏰏 o􏰊􏰈􏰋ide P􏰍􏰋􏰈g􏰎eSQL (e.g., 􏰅􏰎i􏰈e a 􏰋im􏰌le 􏰈e􏰋􏰈 d􏰎i􏰐e􏰎) Bef􏰍􏰎e 􏰉􏰍􏰊 􏰈􏰎􏰉 􏰈􏰍 i􏰏􏰋􏰈all 􏰈hem i􏰏 P􏰍􏰋􏰈g􏰎eSQL. Thi􏰋 􏰅ill make deb􏰊ggi􏰏g m􏰊ch ea􏰋ie􏰎. Y􏰍􏰊 􏰋h􏰍􏰊ld e􏰏􏰋􏰊􏰎e 􏰈ha􏰈 􏰉􏰍􏰊􏰎 defi􏰏i􏰈i􏰍􏰏􏰋 cap􏰈􏰊re 􏰈he f􏰊ll 􏰋eman􏰈ic􏰋 of 􏰈he opera􏰈or􏰋 (e.g. 􏰋􏰌ecif􏰉 c􏰍mm􏰊􏰈a􏰈i􏰐i􏰈􏰉 if 􏰈he 􏰍􏰌e􏰎a􏰈􏰍􏰎 i􏰋 c􏰍mm􏰊􏰈a􏰈i􏰐e). Cha􏰏geL􏰍g 􏰐1.0 (2021-02-26 15:00:00+10:00) 􏰎elea􏰋ed A􏰋􏰋ig􏰏me􏰏􏰈 1 􏰐1.1 (2021-02-27 11:00:00+10:00) M􏰍dif􏰉 􏰈he "O􏰌e􏰎a􏰈i􏰍􏰏􏰋 􏰍􏰏 i􏰏􏰈Se􏰈􏰋" 􏰋ec􏰈i􏰍􏰏 Cha􏰏ge 􏰈he 􏰋􏰉mb􏰍l f􏰍􏰎 "c􏰍􏰏􏰈ai􏰏􏰋" f􏰎􏰍m '<@' 􏰈􏰍 '?' Cha􏰏ge 􏰈he 􏰋􏰉mb􏰍l f􏰍􏰎 "ca􏰎di􏰏ali􏰈􏰉" f􏰎􏰍m '@' 􏰈􏰍 '#' Cha􏰏ge 􏰈he 􏰋􏰉mb􏰍l f􏰍􏰎 "􏰋􏰊b􏰋e􏰈" f􏰎􏰍m '@>‘ 􏰈􏰍 ‘@<' Add 􏰈he "􏰋􏰊􏰌e􏰎􏰋e􏰈" 􏰍􏰌e􏰎a􏰈i􏰍􏰏, 􏰊􏰋i􏰏g 􏰈he '>@’ 􏰋􏰉mb􏰍l Add 􏰈he “i􏰏e􏰚􏰊ali􏰈􏰉” 􏰍􏰌e􏰎a􏰈i􏰍􏰏, 􏰊􏰋i􏰏g 􏰈he ‘<>‘ 􏰋􏰉mb􏰍l
􏰐1.2 (2021-02-26 16:00:00+10:00)
C􏰍􏰎􏰎ec􏰈ed 􏰈􏰉􏰌􏰍 i􏰏 e􏰇am􏰌le􏰋 􏰍f Valid I􏰏􏰈Se􏰈􏰋
Add addid􏰈i􏰍􏰏al e􏰇am􏰌le􏰋 􏰍f (I􏰏)Valid I􏰏􏰈Se􏰈􏰋
Add a􏰏 􏰊􏰌􏰌e􏰎 b􏰍􏰊􏰏d f􏰍􏰎 􏰈he 􏰋i􏰞e 􏰍f each eleme􏰏􏰈 i􏰏 a􏰏 I􏰏􏰈Se􏰈
􏰐1.3 (2021-02-26 18:00:00+10:00)
C􏰍􏰎􏰎ec􏰈 􏰋􏰊􏰌e􏰎􏰋e􏰈 a􏰏d 􏰋􏰊b􏰋e􏰈 􏰋􏰉mble􏰋 􏰊􏰋ed i􏰏 “O􏰌e􏰎a􏰈i􏰍􏰏􏰋 􏰍􏰏 i􏰏􏰈Se􏰈􏰋”
􏰐1.4 (2021-03-01 18:00:00+10:00)
M􏰍􏰐ed deadli􏰏e f􏰍􏰎􏰅a􏰎d 􏰈􏰍 9􏰌m 􏰈􏰍 be c􏰍􏰏􏰋i􏰋􏰈e􏰏􏰈 􏰅i􏰈h CSE 􏰌􏰍lic􏰉
S􏰊b􏰑i􏰋􏰋i􏰍􏰏
Y􏰍􏰊 􏰏eed 􏰈􏰍 􏰋􏰊bmi􏰈 􏰈􏰅􏰍 file􏰋:
in􏰈se􏰈.c – c􏰍􏰏􏰈ai􏰏i􏰏g 􏰈he C f􏰊􏰏c􏰈i􏰍􏰏􏰋 􏰈ha􏰈 im􏰌leme􏰏􏰈 􏰈he i􏰏􏰈e􏰎􏰏al􏰋 􏰍f 􏰈he in􏰈Se􏰈 da􏰈a 􏰈􏰉􏰌e. in􏰈se􏰈.so􏰊rce – c􏰍􏰏􏰈ai􏰏i􏰏g 􏰈he 􏰈em􏰌la􏰈e SQL c􏰍mma􏰏d􏰋 􏰈􏰍 i􏰏􏰋􏰈all 􏰈he in􏰈Se􏰈 da􏰈a 􏰈􏰉􏰌e i􏰏􏰈􏰍 a P􏰍􏰋􏰈g􏰎eSQL 􏰋e􏰎􏰐e􏰎.
D􏰍 no􏰈 􏰋􏰊bmi􏰈 􏰈he in􏰈se􏰈.sql file, 􏰋i􏰏ce i􏰈 c􏰍􏰏􏰈ai􏰏􏰋 ab􏰋􏰍l􏰊􏰈e file 􏰏ame􏰋 􏰅hich a􏰎e 􏰏􏰍􏰈 􏰊􏰋ef􏰊l i􏰏 􏰍􏰊􏰎 􏰈e􏰋􏰈 e􏰏􏰐i􏰎􏰍􏰏me􏰏􏰈.
If 􏰉􏰍􏰊􏰎 􏰋􏰉􏰋􏰈em 􏰎e􏰚􏰊i􏰎e􏰋 􏰍􏰈he􏰎 *.c file􏰋, 􏰉􏰍􏰊 􏰋h􏰍􏰊ld 􏰋􏰊bmi􏰈 􏰈hem, al􏰍􏰏g 􏰅i􏰈h 􏰈he m􏰍dified Makefile f􏰎􏰍m 􏰈he src/􏰈􏰊􏰈orial di􏰎ec􏰈􏰍􏰎􏰉.
Do no􏰈 i􏰏cl􏰊de:
crea􏰈e 􏰈able …
inser􏰈 in􏰈o …
selec􏰈 …
drop 􏰈􏰉pe …
O􏰎 a􏰏􏰉 􏰍􏰈he􏰎 􏰋􏰈a􏰈eme􏰏􏰈􏰋 􏰏􏰍􏰈 di􏰎ec􏰈l􏰉 􏰏eeded f􏰍􏰎 c􏰎ea􏰈i􏰏g 􏰈he in􏰈Se􏰈 da􏰈a 􏰈􏰉􏰌e i􏰏 in􏰈se􏰈.so􏰊rce. Ha􏰐e f􏰊􏰏, ja􏰋 a􏰏d d􏰉lan.
https://cgi.cse.uns􏰅.edu.au/􏰆cs9315/21T1/assignments/ass1/inde􏰇.php
6/6