7.7
2 Getting Started
Link to this section with
@secref["getting-started" #:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
Link to this section with
@secref["getting-started" #:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
2.1 Project Status
Link to this section with
@secref["Project_Status" #:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
Link to this section with
@secref["Project_Status" #:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
Plisqin is highly experimental and may introduce breaking changes at any time.
Plisqin’s ideal scope is Create, Read, Update, and Delete (CRUD).
Currently, only Read is supported, and even this support is incomplete.
Missing features include top/limit, distinct, union, and window functions.
Out of scope is what I call "DBA-level SQL" such as create index
which has never really been a pain point for me.
In its hypothetical final form, Plisqin is an alternate query language
supported natively by the RDBMS, bypassing SQL entirely.
2.2 The Example Database Schema
Link to this section with
@secref["The_Example_Database_Schema"
#:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
Link to this section with
@secref["The_Example_Database_Schema"
#:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
This documentation uses an example database schema, the
Video Rental Example Schema which models a brick-and-mortar video rental
store (think pre-Netflix). When you see an upper-case identifier such as Rental
it almost certainly links to the documentation of this example schema, which might
help you if you don’t understand a query.
This database diagram
might be useful to have while reading this document.
If you want to follow along using a local database, the following scripts will create the tables:
2.3 Strings vs Procedures
Link to this section with
@secref["Strings_vs_Procedures"
#:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
Link to this section with
@secref["Strings_vs_Procedures"
#:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
Here is a simple query in Plisqin:
The details of our database schema are in strings, namely the "Rental" table
and the "RentalId" column. An alternative style is to encode our database
schema into Racket procedures. Here is an [almost] equivalent query:
The details of this 2nd style won’t be explained until the
Layer 1 - Schema as Procedures section,
but any section of this guide might use either style, depending on what is convenient.
2.4 Environment Setup
Link to this section with
@secref["environment-setup" #:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
Link to this section with
@secref["environment-setup" #:doc '(lib "plisqin/scribblings/plisqin.scrbl")]
To try out Plisqin, you need Racket installed.
You can download Racket here.
Once you have Racket installed, run raco pkg install plisqin from your command line.
This should download and setup the plisqin package.
Now start DrRacket.
You should have a file that contains one line: #lang racket.
This line should be at the top of every Racket file you write.
Now paste the following code below #lang racket
When you run the program (Ctrl+R), you should see an SQL query:
select f.* from Foo f