Giter Club home page Giter Club logo

dbclass-exercises's Introduction

DB Class Exercises

This includes materials, exercises and solutions used in the DBclass offered by Stanford.

1.Relational Algebra Exercises

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.

How to Run

  • Follow the steps to install ra.
  • Put the executive ra to your $HOME/bin and remember to edit the path to find ra.jar in your system.
  • run ra to get the ra REPL to the database environment.
  • run ra -i q1.ra to run particular algebra and see the result.

2. SQL Exercises

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.

How to Run

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.

3. XML Exercises

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.

Install Xpath/XSLT Implementations

First, install the xpath/xslt implementation on unix system - saxon.

On Mac:

brew install saxon

Others, follow the instruction on the official site.

How to Run Xpath/Xquery

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.

How to Run XSLT

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.

4. Constains and Triggers / 5. Views

Same as 3.SQL

dbclass-exercises's People

Contributors

yangchenyun avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.