This page is probably only helpful to me, but here are some of the SQL commands I use which I can never remember the syntax for.

 

SELECT `First Name`, `Last Name`, `Age`, `Gender`, `CANSK1 Badge`, `CANSK2 Badge` FROM `#__canskate_skaters`

SELECT COUNT(expression) FROM tables

SELECT phase6.name_natural, phase6.name_first, phase6.name_last, concat(phase6.bio,' ', phase6.link), phase6.other

FROM phase6 WHERE phase6.link <> 'NULL'

ORDER by phase6.name_last;

SELECT concat(`First Name`,' ',`Last Name`) FROM `#__canskate_skaters` WHERE `Prog Type` = 'PROGREG' AND `Program ID` ='PRGID0000000357'

"SELECT `First Name`, `Last Name`, `Age`, `Gender`, `CANSK1 Badge`, `CANSK2 Badge` FROM `#__canskate_skaters` WHERE `Prog Type` = 'PROGREG' AND `Program ID` ='PRGID0000000357'";

INSERT INTO phase1a (name_natural, name_first, name_last, name_first_init, other) SELECT * FROM player_names

UPDATE <table_name> SET <field_name> = REPLACE(<field_name>, 'old text','new text')

Sorting out e-mail lists to generate a list of only those that are in one group but not the other.

INSERT INTO `table 2` SELECT DISTINCT `Email` FROM `table 1` WHERE `Prog Type` = 'PROGREG'

INSERT INTO `fall` SELECT DISTINCT `Email` FROM `table 1` WHERE `Prog Type` = 'PROGREG' AND `Program Name` LIKE '%Sep%'

INSERT INTO `fallnotwinter` SELECT email FROM `fall` WHERE email NOT IN (SELECT email FROM `winter` WHERE email is not null)

INSERT INTO `fallandwinter` SELECT DISTINCT email FROM `table 1`

INSERT INTO from2012 SELECT `Email Address` FROM `table 6` WHERE `Email Address` NOT IN (Select email FROM `fallandwinter`)