Skip to content

Instantly share code, notes, and snippets.

@jonny-gates
Created January 31, 2020 09:50
Show Gist options
  • Save jonny-gates/8051a59015e604d6f4f946c012ee6080 to your computer and use it in GitHub Desktop.
Save jonny-gates/8051a59015e604d6f4f946c012ee6080 to your computer and use it in GitHub Desktop.
CRUD SQL
# http://airbnb.com/flats/42
SELECT * FROM flats
WHERE id = 42
# https://github.com/users/jonnygates
SELECT * FROM users
WHERE username = 'jonnygates'
# Gmail Delete
UPDATE messages SET deleted=true WHERE id = 3
# SQL Injection Protection
DB.execute('SELECT * FROM users WHERE id = ?', 3)
DB.execute('UPDATES users SET username = ?, age = ? WHERE id = ?','jonnygates', 30, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment