Skip to content

Instantly share code, notes, and snippets.

@danferth
Last active May 22, 2019 22:49
Show Gist options
  • Save danferth/6468934 to your computer and use it in GitHub Desktop.
Save danferth/6468934 to your computer and use it in GitHub Desktop.
SQL statements

SQL Statements

Cheat sheet SQL staements

This is for SQL staements to be used in PHP

create table

"CREATE TABLE people(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), age INT, description VARCHAR(200))"

query from table

"SELECT * FROM table_name WHERE ID=1"

insert into table

"INSERT INTO people (`ID`, `name`, `age`, `description`) VALUES (NULL,:name, :age, :desc)"
//this includes the :varName for PDO prepared statements

More to come


With all the cheat sheets thay are a work in progress and could contain mistakes. If you find these helpfull or find shit that is just plain wrong, please comment so I can fix.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment