Interacting with the database
Course: SQL databases - chapter 7
There are 4 things you’d like to do with a database
1. INSERT
Section titled “1. INSERT”INSERT INTO users (username, email, password)VALUES ('username_here', 'user@example.com', 'user_password');💡 Notice how you didn’t have to specify the
idbecause it auto increments
2. UPDATE
Section titled “2. UPDATE”UPDATE usersSET password = 'new_password'WHERE email = 'user@example.com';3. DELETE
Section titled “3. DELETE”DELETE FROM usersWHERE id = 1;4. Select
Section titled “4. Select”SELECT * FROM usersWHERE id = 1;💡 Try running all 4 of these in your terminal if you have
psqlinstalled locally. If not, that’s fine we’ll eventually be doing these through thepglibrary