Skip to content

Instantly share code, notes, and snippets.

@cormobro
Created Jan 14, 2019
Embed
What would you like to do?
query.sql
-- #1
SELECT nom, salaire FROM `equipe` WHERE campus_mgr IS NULL
-- #2
SELECT IF(id_camp=140, "#####", nom) FROM `equipe`
-- #3
SELECT nom, SUBSTR(date_embauche, 6, 2) FROM `equipe`
-- #4
SELECT nom, IF(SUBSTR(date_embauche, 1, 4)!=2017, "13", 13 - SUBSTR(date_embauche, 6, 2)) FROM `equipe`
-- #5
SELECT nom, fonction, date_embauche, campus.nom_camp, campus.nom_camp FROM `equipe` INNER JOIN campus ON equipe.id_camp=campus.id_camp WHERE campus.nom_camp="nurn"
-- #6
SELECT nom FROM `equipe` WHERE date_embauche < "2017-12-03"
-- #7
SELECT IF(b.date_embauche < a.date_embauche, b.date_embauche, NULL), IF(b.date_embauche < a.date_embauche, b.nom, NULL) FROM equipe b INNER JOIN equipe a ON b.campus_mgr=a.id_eqp
-- #8
SELECT IF(date_embauche="2017-01-23", IF(nom="Pippin", NULL, nom), NULL), IF(date_embauche="2017-01-23", IF(nom="Pippin", NULL, date_embauche), NULL) FROM equipe
-- #9
SELECT nom, date_embauche FROM equipe WHERE date_embauche < "2017-01-23"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment