If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Thursday, February 21, 2013

Using sqlite with Firefox sqlite-manager extension

The Stanford database course is using sqlite to experiment with SQL, Constraints, Triggers and so on. As the downloadable executable from this site only has a command line interface I decided to search for a GUI manager for sqlite. I am currently trying the firefox add-on which seems to work just fine.

/* First we create a table with a tuple constraint */
create table Apply(sID int, cName text, major text, decision text, 
check(decision = 'N' or cName <> 'Stanford' or major <> 'CS'));

/* next we try to insert a few tuples but the 3rd one should throw a constraint violation exception */
insert into Apply values(123, 'Stanford', 'CS', 'N');
insert into Apply values(123, 'MIT', 'CS', 'Y');
insert into Apply values(123, 'Stanford', 'CS', 'Y');

2 comments:

  1. Just to nitpick: it's sqlite (1 'l')

    And the Firefox Add-on is a real treat. I'm missing just one thing: being able to start the add-on from the command line, without starting FF (my Chrome's open 24/7)

    ReplyDelete
  2. Oh... I guess I just had that spelling mistake somehow inprinted into my brain :) I actually will start using Chrome more as well.. the dev tools are awesome.

    ReplyDelete