adding sql lab excercises for week 6
This commit is contained in:
@@ -5,20 +5,18 @@
|
||||
### SELECT
|
||||
Used to select columns from some table.
|
||||
|
||||
> Relational symbol: sigma
|
||||
> Relational symbol: pi
|
||||
|
||||
### Projection
|
||||
Picks out the rows of a (set of) table(s)
|
||||
|
||||
> Relational symbol: pi
|
||||
> Relational symbol: sigma
|
||||
|
||||
### Union
|
||||
Adds the rows of two tables into some new table.
|
||||
Removes duplicates from resultant table as well.
|
||||
|
||||
> `UNION table[table...]`
|
||||
|
||||
> Relational symbol:
|
||||
> Relational symbol: U(looks like a U but w i d e)
|
||||
|
||||
### Relational Algebra on paper
|
||||
|
||||
|
||||
18
cst363/lec/lec6.md
Normal file
18
cst363/lec/lec6.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# lec6
|
||||
|
||||
## Lab activity
|
||||
|
||||
This lecture features a lab activity in the lab/ directory named: `courses-ddl.sql` with instructions in `simple-joins-lab.pdf`.
|
||||
|
||||
* Note: Just make sure to read int courses-ddl.sql first then courses-small.sql second otherwise there will be random errors.(I'm not taking responsibility for that garbage so don't flame me)
|
||||
|
||||
## Natural Joins
|
||||
|
||||
`Natural Joins`: allows us to join tables while getting rid of duplicate columns automatically.
|
||||
|
||||
Form:
|
||||
|
||||
```
|
||||
select columns_[...] from tableLeft natural join tableRight
|
||||
```
|
||||
While ther is no need to write extra `where` statements there is also the issue where there may be accidental matches since attributes are dropped.
|
||||
Reference in New Issue
Block a user