Skip to content

Instantly share code, notes, and snippets.

@stanistan
Created December 6, 2012 22:28
Show Gist options
  • Save stanistan/4229070 to your computer and use it in GitHub Desktop.
Save stanistan/4229070 to your computer and use it in GitHub Desktop.
student {
    name
}
select now()

Anonymous Table Declarations!

in development branch (but working)

-> { now() }

Write Queries!

The difference between insert syntax and update syntax is if you're filtering criteria

Insert query:

<- student {
    name <- 'John'
}
insert into student (name) values ('John')

Update query:

Having a where clause implies that this is an update query

<- student {
    lname <- 'Doe'
    where name = 'John' 
}
update student set lname = 'Doe' where name = 'John'

Inserting multiple records:

<- student {
    name <- ('John', 'Frank'),
    lname <- ('Doe', 'Lin')
}
insert into student (name, lname) values ('John', 'Doe'), ('Frank', 'Lin')

also need to add DEFAULT keyword for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment