adding base for lecture 4 of db course
This commit is contained in:
parent
27adf0c2e2
commit
71dd33342a
1
cst363/.gitignore
vendored
1
cst363/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
lab/
|
|
16
cst363/lab/patients.sql
Normal file
16
cst363/lab/patients.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
drop table if exists patient;
|
||||||
|
|
||||||
|
create table patient (
|
||||||
|
patient_no integer primary key,
|
||||||
|
last_name varchar(64) not null,
|
||||||
|
first_name varchar(64) not null,
|
||||||
|
sex varchar(1) not null,
|
||||||
|
date_of_birth varchar(8) not null,
|
||||||
|
ward integer not null
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into patient values(454, "Smith", "John", "M", "14.08.78", 6);
|
||||||
|
insert into patient values(223, "Jones", "Peter", "M", "07.12.85", 8);
|
||||||
|
insert into patient values(597, "Brown", "Brenda", "F", "17.06.61", 3);
|
||||||
|
insert into patient values(234, "Jenkins", "Alan", "M", "29.01.72", 7);
|
||||||
|
insert into patient values(244, "Wells", "Chris", "F", "25.02.95", 6);
|
BIN
cst363/lab/table.pdf
Normal file
BIN
cst363/lab/table.pdf
Normal file
Binary file not shown.
@ -3,14 +3,14 @@
|
|||||||
## Relational Algebra and its relation to SQL
|
## Relational Algebra and its relation to SQL
|
||||||
|
|
||||||
### SELECT
|
### SELECT
|
||||||
Used to select rows from some table.
|
Used to select columns from some table.
|
||||||
|
|
||||||
> `SELECT [...] FROM [...]`
|
> `SELECT [...] FROM [...]`
|
||||||
|
|
||||||
> Relational symbol: sigma
|
> Relational symbol: sigma
|
||||||
|
|
||||||
### Projection
|
### Projection
|
||||||
Picks out the columns of a (set of) table(s)
|
Picks out the rows of a (set of) table(s)
|
||||||
|
|
||||||
> `PROJECTION [table...]`
|
> `PROJECTION [table...]`
|
||||||
|
|
||||||
|
15
cst363/lec/lec4.md
Normal file
15
cst363/lec/lec4.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# lec4
|
||||||
|
|
||||||
|
|
||||||
|
## Lab*
|
||||||
|
|
||||||
|
This lecture has some lab questions in the `lec/` dircory named `table1.pdf` *and* some example data called `patients.sql`
|
||||||
|
Intro to some sql commands
|
||||||
|
|
||||||
|
## Serverless
|
||||||
|
|
||||||
|
Instead of having listen server listen for requests to perform actions upon these requests we simply have some databse held on a machina and we perform all of our sql commands on that machine.
|
||||||
|
|
||||||
|
For now we'll be dealing with small test db's so that we can practice the commands and observe each one's behavior; this will give you a good feeling of what does what in sqlite3.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user