Recently I have been asked a couple of SQL questions, so I decided to brush up on some of it. I was going to talk about mild being things like “CREATE TABLE” or “INSERT INTO”, medium being joins, then hot being this other thing.
I don’t have patience for all of that, so lets get straight into the HOT.
Did you know you can create TRIGGERs in SQLite? Yeah, you can create snippets of SQL that run before or after specified events to specified data. I know this because originally I was interested in adding a last modified column to my data, but could not figure out a way short of me coding it into all of my statements. Not any more! Here is an example of creating a table which will update last modified column, if I understand correctly.
Yeah, I haven’t tested it yet, I found that idea after I commited for the last time tonight. (Maybe/probably) Anyway, hasta la pasta! Be safe and watch for ninjas!