Apart from lots of interactivity, I tend to use anecdotes and humour when teaching a MySQL training course, as it really helps people to remember.
Sometimes I call something “evil” (no I’m not religious), and attach a little story to it. One example the NATURAL join. It’s not a join type (like inner, left outer, right outer), it’s a modifier keyword that can be used with any join type, and it directs the way the join is resolved.
Instead of specifying a join condition through ON, USING or a WHERE clause, the NATURAL keyword tells the server to match up any column names between the two tables, and automatically use those columns to resolve the join. For example, if two tables that you’re doing a natural join on have a column foo_id, the server would automatically use that column. But of course a server has no idea about context, so it’s indiscriminate. There can be multiple columns that have a name which is also used in the other table, they will ALL be used for the join (like
a.id=b.id AND a.name=b.name)
I like explicit join syntax, I try to steer people away from comma/WHERE constructs. But NATURAL is a whole other level of evil, because it’s dangerously implicit: you can’t tell by looking at the query what columns are going to be used! If, at any point, a column name is changed, or a column added in one table, or a column is removed (or normalised away to another table again), the join can (equally magical) break by either including fewer, or more, columns.
Thus I reckon that NATURAL joins are just nasty beyond belief, and I’ve been putting this to my students: if you ever find a dev using this, a) fire them on the spot and b) tell me about it! Of course there’s an aspect of humour in there, but it gets the point across. Have you ever seen NATURAL join used anywhere? Please do tell in a comment!