Python & SQL BibleChapter 232

CRUD Operations

Section 1 of 2-~ 12 min read-Synced from Cuantum content
  1. Insert into a table
INSERT INTO table_name (column1, column2) VALUES ('value1', 'value2');
  1. Update a table
UPDATE table_name SET column1 = 'new_value' WHERE condition;
  1. Delete from a table
DELETE FROM table_name WHERE condition;
  1. Create a table
CREATE TABLE table_name (    column1 datatype,    column2 datatype,    column3 datatype);
  1. Drop a table
DROP TABLE table_name;
  1. Alter a table
ALTER TABLE table_nameADD column_name datatype;

This cheat sheet covers the basics of SQL, providing an overview of common SQL operations. It doesn't cover all aspects of SQL, but it's a good starting point for most tasks.