@@ -32,11 +32,11 @@ With regards to boolean values, be sure not to conflate ```t``` or ```f``` as a
3232Project:M36 will complain loudly if the expected types do not match. Automatic type coercion does not exist.
3333
3434```
35−TutorialD (master): :showexpr S:{more:=add(10,@SNAME)}
35+TutorialD (master): :showexpr S:{more:=add(10,@sname)}
3636ERR: AtomFunctionTypeError "add" 2 IntAtomType StringAtomType
3737```
3838
39−The integer "10" cannot be added to the string SNAME value.
39+The integer "10" cannot be added to the string sname value.
4040
4141### Using Relation Variables
4242
@@ -75,18 +75,18 @@ Each section assumes a fresh instance of the Date examples. The relation variabl
7575
7676|Relation Variable Name|Description|
7777|----------------------|-----------|
78−|S|suppliers|
79−|P|parts|
80−|SP|contains mapping of which suppliers supply which parts|
78+|s|suppliers|
79+|p|parts|
80+|sp|contains mapping of which suppliers supply which parts|
8181
8282### Relational Expressions
8383
84−A relational expression combines relational operators to create a new relation. ```tutd``` can display the result of executing a relational expression with ":showexpr".
84+A relational expression combines relational operators to create a new relation. ```tutd``` can display the result of executing a relational expression with ":showexpr".
8585
8686```
87−TutorialD (master): :showexpr P
87+TutorialD (master): :showexpr p
8888┌──────┬─────┬──┬─────┬──────┐
89−│CITY │COLOR│P#│PNAME│WEIGHT│
89+│city │color│p#│pname│weight│
9090├──────┼─────┼──┼─────┼──────┤
9191│London│Red │P6│Cog │19 │
9292│Paris │Blue │P5│Cam │12 │
@@ -99,16 +99,16 @@ TutorialD (master): :showexpr P
9999
100100### Using Relational Operators
101101
102−Relational operators generate new relations from existing relations. The operators form the closed algebra against relations.
102+Relational operators generate new relations from existing relations. The operators form the closed algebra against relations.
103103
104104#### Rename
105105
106106The unary rename operator outputs a new relation with chosen attributes renamed. In SQL, the equivalent is to use "AS" in the column name list of SELECTS.
107107
108108```
109−TutorialD (master): :showexpr S rename {CITY as TOWN}
109+TutorialD (master): :showexpr s rename {city as town}
110110┌──┬─────┬──────┬──────┐
111−│S#│SNAME│STATUS│TOWN │
111+│s#│sname│status│town │
112112├──┼─────┼──────┼──────┤
113113│S3│Blake│30 │Paris │
114114│S4│Clark│20 │London│
@@ -125,9 +125,9 @@ Projection is applied by adding curly braces and attribute names following a rel
125125For example:
126126
127127```
128−TutorialD (master): :showexpr P{COLOR,CITY}
128+TutorialD (master): :showexpr p{color,city}
129129┌──────┬─────┐
130−│CITY │COLOR│
130+│city │color│
131131├──────┼─────┤
132132│London│Red │
133133│Paris │Blue │
@@ -141,9 +141,9 @@ TutorialD (master): :showexpr P{COLOR,CITY}
141141Restriction is applied using a "where" clause, much like in SQL.
142142
143143```
144−TutorialD (master): :showexpr P where COLOR="Blue" and CITY="Paris"
144+TutorialD (master): :showexpr p where color="Blue" and city="Paris"
145145┌─────┬─────┬──┬─────┬──────┐
146−│CITY │COLOR│P#│PNAME│WEIGHT│
146+│city │color│p#│pname│weight│
147147├─────┼─────┼──┼─────┼──────┤
148148│Paris│Blue │P5│Cam │12 │
149149└─────┴─────┴──┴─────┴──────┘
@@ -152,9 +152,9 @@ TutorialD (master): :showexpr P where COLOR="Blue" and CITY="Paris"
152152The restriction predicate can be built from "and", "not", and "or". Boolean atom functions can also appear in a restriction as long as they are preceded by "^". For example:
153153
154154```
155−TutorialD (master): :showexpr S where ^lt(@STATUS,20)
155+TutorialD (master): :showexpr s where ^lt(@status,20)
156156┌─────┬──┬─────┬──────┐
157−│CITY │S#│SNAME│STATUS│
157+│city │s#│sname│status│
158158├─────┼──┼─────┼──────┤
159159│Paris│S2│Jones│10 │
160160└─────┴──┴─────┴──────┘
@@ -165,9 +165,9 @@ TutorialD (master): :showexpr S where ^lt(@STATUS,20)
165165Joins are binary operators and are applied with the "join" keyword. The equivalent in SQL would be a "NATURAL JOIN". To join attributes which are not identically-named, use the rename operator
166166
167167```
168−TutorialD (master): :showexpr S join SP
168+TutorialD (master): :showexpr s join sp
169169┌──────┬──┬───┬──┬─────┬──────┐
170−│CITY │P#│QTY│S#│SNAME│STATUS│
170+│city │p#│QTY│s#│sname│status│
171171├──────┼──┼───┼──┼─────┼──────┤
172172│London│P6│100│S1│Smith│20 │
173173│London│P3│400│S1│Smith│20 │
@@ -190,7 +190,7 @@ The binary union operator merges tuples from both relations if-and-only-if the a
190190```
191191TutorialD (master): :showexpr S union S
192192┌──────┬──┬─────┬──────┐
193−│CITY │S#│SNAME│STATUS│
193+│city │s#│sname│status│
194194├──────┼──┼─────┼──────┤
195195│Paris │S3│Blake│30 │
196196│London│S4│Clark│20 │
@@ -207,9 +207,9 @@ The union of any relation with itself is itself.
207207The extend unary operator adds an attribute to a relation's header and body and is represented by a colon ":". The equivalent in SQL is a subselect in a SELECT column list. Typically, extend is used to add information derived from relation.
208208
209209```
210−TutorialD (master): :showexpr S:{STATUS2:=add(10,@STATUS)}
210+TutorialD (master): :showexpr s:{status2:=add(10,@status)}
211211┌──────┬──┬─────┬──────┬───────┐
212−│CITY │S#│SNAME│STATUS│STATUS2│
212+│city │s#│sname│status│status2│
213213├──────┼──┼─────┼──────┼───────┤
214214│Paris │S2│Jones│10 │20 │
215215│Athens│S5│Adams│30 │40 │
@@ -239,23 +239,23 @@ The unary group operator groups the argument attributes into subrelations for ea
239239Grouping is useful for aggregate operations (see below) or for summarizing data against a set of attributes; for example, "display all employees grouped by boss name".
240240
241241```
242−TutorialD (master): :showexpr S group ({SNAME,STATUS,S#} as subrel)
242+TutorialD (master): :showexpr s group ({sname,status,s#} as subrel)
243243┌──────┬─────────────────┐
244−│CITY │subrel │
244+│city │subrel │
245245├──────┼─────────────────┤
246246│Athens│┌──┬─────┬──────┐│
247−│ ││S#│SNAME│STATUS││
247+│ ││s#│sname│status││
248248│ │├──┼─────┼──────┤│
249249│ ││S5│Adams│30 ││
250250│ │└──┴─────┴──────┘│
251251│London│┌──┬─────┬──────┐│
252−│ ││S#│SNAME│STATUS││
252+│ ││s#│sname│status││
253253│ │├──┼─────┼──────┤│
254254│ ││S1│Smith│20 ││
255255│ ││S4│Clark│20 ││
256256│ │└──┴─────┴──────┘│
257257│Paris │┌──┬─────┬──────┐│
258−│ ││S#│SNAME│STATUS││
258+│ ││s#│sname│status││
259259│ │├──┼─────┼──────┤│
260260│ ││S3│Blake│30 ││
261261│ ││S2│Jones│10 ││
@@ -268,9 +268,9 @@ TutorialD (master): :showexpr S group ({SNAME,STATUS,S#} as subrel)
268268The unary ungroup operator "unwraps" subrelations in a relation-valued attribute. There is no equivalent in SQL.
269269
270270```
271−TutorialD (master): :showexpr (S group ({SNAME,STATUS,S#} as subrel)) ungroup subrel
271+TutorialD (master): :showexpr (s group ({sname,status,s#} as subrel)) ungroup subrel
272272┌──────┬──┬─────┬──────┐
273−│CITY │S#│SNAME│STATUS│
273+│city │s#│sname│status│
274274├──────┼──┼─────┼──────┤
275275│Paris │S3│Blake│30 │
276276│London│S4│Clark│20 │
@@ -288,11 +288,11 @@ While relational operators compose to relational expressions representing querie
288288
289289#### Define and Assign
290290
291−The relation assignment mentioned above certainly changes the state of the database.
291+The relation variable assignment mentioned above certainly changes the state of the database.
292292
293293```
294−TutorialD (master): newrel:=relation{tuple{age 3}}
295−TutorialD (master): :showexpr newrel
294+TutorialD (master): newrelvar:=relation{tuple{age 3}}
295+TutorialD (master): :showexpr newrelvar
296296┌───┐
297297│age│
298298├───┤
@@ -307,9 +307,9 @@ All further operators are convenience operators and could be implemented with si
307307To signal that a relation variable should be forgotten, undefine it.
308308
309309```
310−TutorialD (master): undefine S
311−TutorialD (master): :showexpr S
312−ERR: RelVarNotDefinedError "S"
310+TutorialD (master): undefine s
311+TutorialD (master): :showexpr s
312+ERR: RelVarNotDefinedError "s"
313313```
314314
315315#### Insert
@@ -317,10 +317,10 @@ ERR: RelVarNotDefinedError "S"
317317The insert operators accepts a relation variable and a relation of the same type (a relation having an identical header), and replaces the relation referenced by the relation variable with the union of the previous relation value and the argument's relation value.
318318
319319```
320−TutorialD (master): insert S relation{tuple{CITY "Boston",S# "S10",SNAME "Gonzalez",STATUS 10}}
321−TutorialD (master): :showexpr S
320+TutorialD (master): insert s relation{tuple{city "Boston",s# "S10",sname "Gonzalez",status 10}}
321+TutorialD (master): :showexpr s
322322┌──────┬───┬────────┬──────┐
323−│CITY │S# │SNAME │STATUS│
323+│city │s# │sname │status│
324324├──────┼───┼────────┼──────┤
325325│Paris │S3 │Blake │30 │
326326│London│S4 │Clark │20 │
@@ -334,17 +334,17 @@ TutorialD (master): :showexpr S
334334This insertion operation is equivalent to:
335335
336336```
337−S:=S union relation{tuple{CITY "Boston",S# "S10",SNAME "Gonzalez",STATUS 10}}
337+s:=s union relation{tuple{city "Boston",s# "S10",sname "Gonzalez",status 10}}
338338```
339339#### Update
340340
341341The update operator accepts a relation argument and a predicate, optionally filters and creates new tuples based on the original relation.
342342
343343```
344−TutorialD (master): update S where STATUS=20 (SNAME:="Mr. Twenty")
345−TutorialD (master): :showexpr S
344+TutorialD (master): update s where status=20 (sname:="Mr. Twenty")
345+TutorialD (master): :showexpr s
346346┌──────┬──┬──────────┬──────┐
347−│CITY │S#│SNAME │STATUS│
347+│city │s#│sname │status│
348348├──────┼──┼──────────┼──────┤
349349│Paris │S3│Blake │30 │
350350│London│S1│Mr. Twenty│20 │
@@ -357,10 +357,10 @@ TutorialD (master): :showexpr S
357357This is logically equivalent to:
358358
359359```
360−TutorialD (master): S:=(((S where STATUS=20){CITY,S#,STATUS}):{SNAME:="Mr. Twenty"}) union (S where not STATUS=20)
361−TutorialD (master): :showexpr S
360+TutorialD (master): s:=(((s where status=20){city,s#,status}):{sname:="Mr. Twenty"}) union (s where not status=20)
361+TutorialD (master): :showexpr s
362362┌──────┬──┬──────────┬──────┐
363−│CITY │S#│SNAME │STATUS│
363+│city │s#│sname │status│
364364├──────┼──┼──────────┼──────┤
365365│Paris │S3│Blake │30 │
366366│London│S1│Mr. Twenty│20 │
@@ -370,17 +370,17 @@ TutorialD (master): :showexpr S
370370└──────┴──┴──────────┴──────┘
371371```
372372
373−This query means: "Drop the SNAME attribute from S filtered where STATUS equals 20, extend the resultant relation by SNAME with value 'Mr. Twenty', then union the resultant relation with S filtered by STATUS not equaling 20, and assign that to S."
373+This query means: "Drop the sname attribute from S filtered where status equals 20, extend the resultant relation by sname with value 'Mr. Twenty', then union the resultant relation with S filtered by status not equaling 20, and assign that to S."
374374
375375#### Delete
376376
377377The delete operator accepts a relation argument and a filtering predicate, creates a new relation with only the tuples which do not match the predicate, and stores the result in the relation variable argument.
378378
379379```
380−TutorialD (master): delete SP where S#="S4"
381−TutorialD (master): :showexpr SP
380+TutorialD (master): delete sp where s#="S4"
381+TutorialD (master): :showexpr sp
382382┌──┬───┬──┐
383−│P#│QTY│S#│
383+│p#│QTY│s#│
384384├──┼───┼──┤
385385│P3│400│S1│
386386│P4│200│S1│
@@ -397,7 +397,7 @@ TutorialD (master): :showexpr SP
397397This is logically equivalent to:
398398
399399```
400−TutorialD (master): SP:=SP where not S#="S4"
400+TutorialD (master): sp:=sp where not s#="S4"
401401```
402402
403403Note the inverted predicate.
@@ -413,56 +413,56 @@ Chris Date identified that all constraints can be represented as inclusion depen
413413Uniqueness constraints ensure that a set of attributes' values are unique throughout a relational expression. For example, it is useful to ensure that all products' identifiers are unique. The equivalent in SQL is the UNIQUE expression found in table creation.
414414
415415```
416−TutorialD (master): key S_key_constraint {S#} S
416+TutorialD (master): key s_key_constraint {s#} s
417417```
418418
419−This expression creates a constraint named "S_key_constraint" and ensure that the values of the "S#" attribute are unique in the "S" relational expression.
419+This expression creates a constraint named "S_key_constraint" and ensure that the values of the "s#" attribute are unique in the "S" relational expression.
420420
421421#### Foreign Key Constraints
422422
423423Foreign keys are constraints which require that certain values appearing in one relation variable must appear in another. The equivalent in SQL is the FOREIGN KEY() construction in table creation.
424424
425425```
426−TutorialD (master): foreign key S#_in_SP SP{S#} in S{S#}
426+TutorialD (master): foreign key s#_in_sp sp{s#} in s{s#}
427427```
428428
429−This expression ensure that any SP{S#} must also appear as a value in S{S#}.
429+This expression ensure that any sp{s#} must also appear as a value in s{s#}.
430430
431431#### Other Constraints
432432
433433All other constraints can be represented by a set of inclusion dependencies.
434434
435435```
436−TutorialD (master): constraint S_status_less_than_50 (S where ^lt(50,@STATUS)){} in false
436+TutorialD (master): constraint s_status_less_than_50 (s where ^lt(50,@status)){} in false
437437```
438438
439−This expression ensures that the relation variable's relation can never include a tuple with STATUS greater than 50.
439+This expression ensures that the relation variable's relation can never include a tuple with status greater than 50.
440440
441441## Aggregate Queries
442442
443−Aggregate queries in TutorialD are able to provide much more information than SQL queries due to the support for relation-valued attributes. For example, a single query can return aggregate results alongside its constituent tuples.
443+Aggregate queries in TutorialD are able to provide much more information than SQL queries due to the support for relation-valued attributes. For example, a single query can return aggregate results alongside its constituent tuples.
444444
445−SQL supports aggregate queries using aggregate functions (SUM(), COUNT(), AVERAGE(), etc.) and GROUP BY while the aggregate functions in the relational algebra simply accept relation values as arguments.
445+SQL supports aggregate queries using aggregate functions (SUM(), COUNT(), AVERAGE(), etc.) and GROUP BY while the aggregate functions in the relational algebra simply accept relation values as arguments.
446446
447447```
448−TutorialD (master): :showexpr S group ({S#,SNAME,STATUS} as subrel):{citycount:=count(@subrel)}
448+TutorialD (master): :showexpr s group ({s#,sname,status} as subrel):{citycount:=count(@subrel)}
449449┌──────┬─────────┬─────────────────┐
450−│CITY │citycount│subrel │
450+│city │citycount│subrel │
451451├──────┼─────────┼─────────────────┤
452452│Paris │2 │┌──┬─────┬──────┐│
453−│ │ ││S#│SNAME│STATUS││
453+│ │ ││s#│sname│status││
454454│ │ │├──┼─────┼──────┤│
455455│ │ ││S3│Blake│30 ││
456456│ │ ││S2│Jones│10 ││
457457│ │ │└──┴─────┴──────┘│
458458│London│2 │┌──┬─────┬──────┐│
459−│ │ ││S#│SNAME│STATUS││
459+│ │ ││s#│sname│status││
460460│ │ │├──┼─────┼──────┤│
461461│ │ ││S1│Smith│20 ││
462462│ │ ││S4│Clark│20 ││
463463│ │ │└──┴─────┴──────┘│
464464│Athens│1 │┌──┬─────┬──────┐│
465−│ │ ││S#│SNAME│STATUS││
465+│ │ ││s#│sname│status││
466466│ │ │├──┼─────┼──────┤│
467467│ │ ││S5│Adams│30 ││
468468│ │ │└──┴─────┴──────┘│
@@ -476,4 +476,4 @@ In this query result, we can simultaneously answer how many suppliers are locate
476476|count(relation{any tuple types})|return the number of tuples in each relation value|
477477|sum(relation{int})|return the int sum of the relation's values|
478478|max(relation{int})|return the maximum int from all the relation's values|
479−|min(relation{int})|return the minimum int from all the relation's values|
479+|min(relation{int})|return the minimum int from all the relation's values|