Skip to content

Instantly share code, notes, and snippets.

@amirrajabi
Created July 14, 2015 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirrajabi/45d7a4f61e873a9b0d07 to your computer and use it in GitHub Desktop.
Save amirrajabi/45d7a4f61e873a9b0d07 to your computer and use it in GitHub Desktop.
SQL Commands
# ----------------------------- SQL ------------------------
# SELECT *
# FROM movies
# WHERE ganre = "Horrer"
# ORDER BY duration;
# ORDER BY duration DESC;
# WHERE duration > 100; >= <= = > < <>
# AND
# OR
# INSERT INTO movies (id, title, genre, duration)
# VALUES (5, 'The Circus', 'Comedy', 71)
# UPDATE movies
# SET item = new
# WHERE item = old
# UPDATE concessions
# SET item = 'Hamburger'
# WHERE item = 'Pizza';
# UPDATE concessions
# SET price = '1.00'
# WHERE item = 'Popcorn' OR item='Candy';
# DELETE FROM
# WHERE item = old
# CREATE DATABASE -----;
# DROP DATABASE -----;
# DROP TABLE -----;
# CREATE TABLE MOVIES
# (
# id int,
# genre varchar(15),
# column_name datatype
# );
# CREATE TABLE advertisements
# (
# id int,
# title varchar(10),
# type varchar(10),
# price int
# );
#
# INSERT INTO advertisements (id, title, type, price)
# VALUES (1, 'Poster', 'Paper', 20);
# ALTER TABLE movies
# ADD COLUMN ratings
# UPDATE concessions
# SET ratings = 9
# WHERE item = 'The wine';
# ALTER TABLE movies
# DROP COLUMN ratings;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment