2023-05-05 - CRUD with SQL

#sql


main topics


INSERT

INSERT INTO table (field1, fieldN)
VALUES (value1, valueN);

UPDATE

Important

NEVER forget to use a WHERE when using UPDATE (unless you really know what you're doing).

UPDATE table
SET field = new_value
WHERE id = some_id

DELETE

Important

NEVER forget to use a WHERE when using DELETE.

DELETE FROM table
WHERE condition