Menu iconMenu iconPython & SQL Bible
Python & SQL Bible

Chapter 23 - Appendix D: SQL Cheat Sheet

CRUD Operations

  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_name
ADD 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.

CRUD Operations

  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_name
ADD 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.

CRUD Operations

  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_name
ADD 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.

CRUD Operations

  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_name
ADD 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.