This includes materials, exercises and solutions used in the DBclass offered by Stanford.
This includes exercises for relational algebra. The utils/bin folder contains ra to run relational algebra easier.
It used the ra to evaluate relational algebra expressions.
- Follow the steps to install
ra. - Put the executive
rato your$HOME/binand remember to edit the path to findra.jarin your system. - run
rato get the ra REPL to the database environment. - run
ra -i q1.rato run particular algebra and see the result.
This includes exercises for sql in the classes.
The first line in all examples is used by the dbext vim plugin to correctly connect to the right database.
Option 1, open a sqlite3 console with sqlite3 and copy and paste the SQL in the console.
Option 2, uses the dbext vim plugin to communicate with the sqlite3 database. Select the sql in visual mode, execute :DBExecRangeSQL or press <leader>se.
This includes exercises for xml .
The utils/bin folder contains script to run xquery or xslt easier.
The utils/xquery-helper.vim contains an util funciton I used to make xquery easier to run inside vim.
First, install the xpath/xslt implementation on unix system - saxon.
On Mac:
brew install saxon
Others, follow the instruction on the official site.
Use the bin file utils/bin/xquery in this repo. It is a simple wrapper around saxon to make queries easier to type.
Important: Each xpath file should only contain one return clause, so if you run the xquery manually, you need to comment out other clauses to make it run.
xquery <xpath file>
If you are using vim you could use the function I write in vim to run the pieces of code one by one. Just select the code you need to run into a visual block, and press<leader>xe to run them.
More detailed usage: checkout the document on the official site for more details.
Use the bin file utils/bin/xslt in this repo. It is a simple wrapper around saxon to make queries easier to type.
xslt -xsl:<xslt file> <original xml>
For example
xslt -xsl:core-q1.xsl courses.xml
More detailed usage: checkout the document on the official site for more details.
Same as 3.SQL