6
$\begingroup$

I think that it is vital to introduce each subject area with a few handy, even if limited, images or concepts that make the idea clear. Here is how I introduce SQL (in part):

SQL takes a set of data and transforms it in to a new set: a two-dimensional result. Stop reading until you have memorized that, because it is the whole point. Every outcome of an SQL statement (with a few exceptions) is a new Table. That table might be printed on the screen and disappear, or it might be stored in to a new table, or it could be used to update an existing table, or it could be used as input to a program which could do… anything. But, it is a two-dimensional table, and nothing more.

I think that this is the very first concept that needs to lodge in their awareness if they are to make any progress at all. Perhaps it is incomplete, incorrect, too literal, doesn't use the right word (the correct word for Table is 'Relation') and so on. But we have to start somewhere.

I'll compare a database table to a table in Excel, because my students are more familiar with Excel. I'll compare SQL to a command line interface, because my students already know about command line interfaces. Are there better metaphors or analogies to teach SQL and relational database concepts?

$\endgroup$
15
  • 1
    $\begingroup$ What is the post office box model? I have never encountered that. My very first first lesson involves a stack. $\endgroup$
    – Ben I.
    Commented Jul 5, 2017 at 14:47
  • 1
    $\begingroup$ I use the "post office" model to explain a lot of CS concepts; from DNS & IPs to memory. You need a (even if imperfect) model that people can relate too. These days, students may relate better to mobile phones; each one has a unique address, you can set up linked lists (call forwarding) etc. $\endgroup$
    – AlG
    Commented Jul 5, 2017 at 16:13
  • $\begingroup$ For a growing list of analogies, try teaching-analogy. $\endgroup$ Commented Jul 5, 2017 at 18:03
  • 1
    $\begingroup$ When my daughter was 6 I introduced her to Ruby and Postgresql because she wanted to know what i did at work. She soon lost interest, but the analogy I used for her was "cubbies" like she stored her stuff in at kindergarten. Cubbies come in blocks, which are assembled into larger installations. A database is just a very large wall of cubbies, and the DML side of SQL is about getting stuff into or out of the cubbies. DDL side of SQL is making the rules about what is allowed to be put into the cubbies. $\endgroup$
    – pojo-guy
    Commented Jul 7, 2017 at 2:59
  • 1
    $\begingroup$ Instead of using abstract words to describe what it is, instead describe what it solves. "You want to save information from one invocation of your program to the next". "You don't have memory enough for all your data." "You need to do extract and generate data without writing a new program for it every time". The list is endless. $\endgroup$ Commented Jul 7, 2017 at 17:49

4 Answers 4

5
$\begingroup$

Beware. "The One True Lecture" is an oxymoron. I have a horror story about trying to create such a lecture to teach elementary statistics. It was perfect in every way and explains sampling without ambiguity. It. Was. Perfect - for me. A generous evaluation of it would suggest I reached maybe 15% of my students.

The problem was (and often is) "Your students are not like you." Recognize that even if they are bright and hard working (like yourself), they may not learn in the same way you do. Learning Modalities is the term of art.

Instead of trying to find a straight and direct path from where your students are to some target/goal, plan a twisty path instead (and have the path make visits to the Active Learning shrine, I think).

Many instructors have had the experience of walking out of a lecture feeling terrible about it. They said the wrong thing in the wrong way. They stumbled. They struggled with student questions. They wrote stupid-stupid code on the board and had to backtrack and patch it up. Then later they bumped into one or more of the students who thanked them for the wonderful lecture. I've been there. Part of that is learning how to get up after a fall, which is an important lesson.

But you have part of the solution in your question. After your first "Statement of Principles", draw them a picture to illustrate it, even if the "picture" is a metaphor. So:

SQL takes a set of data and transforms it in to a new set: a two-dimensional result.

Show picture of a map between sets.. (imagine a picture here)

AND/OR, use the In Their Own Words Pedagogical Pattern and have one or two of the students tell you back what you just said in their own words.

Let the visual learners into the game as well as the aural learners and readers. Do this sort of thing a lot.

$\endgroup$
0
7
$\begingroup$

I think that to understand the SELECT queries, the Who is Who? / Guess Who? game could serve as a nice metaphor.

guess who game board

The idea of the game is: you have a group of pictures of persons with different facial features. One gamer selects one of them and the other gamer has to make questions to try to eliminate the ones that are not relevant and try to guess which one the other gamer has chosen. It is kind of like what you do in the WHERE part of the SELECT...

SELECT faces 
FROM board 
WHERE hair = white 
AND has glasses 
AND has a mustache 
... 

Maybe this game is now so popular currently... it sure was when I was a kid.

$\endgroup$
5
  • $\begingroup$ Hadn't seen that game before, I just looked it up. Seems related to database, but I am not sure if my students would be familiar with it either. $\endgroup$
    – user737
    Commented Jul 8, 2017 at 18:45
  • $\begingroup$ It was very popular game when I was a kid... The idea is: you have a group of persons with different facial features and have to make questions to try to eliminate the ones that are not relevant, like what you do in the WHERE part of the SELECT.... :) E.g. SELECT all faces WHERE hair = white AND Has glasses AND... $\endgroup$ Commented Jul 8, 2017 at 18:56
  • $\begingroup$ Yeah, it looks like a very realistic application of something like a Where clause. Might work for boolean logic in other ways also. $\endgroup$
    – user737
    Commented Jul 8, 2017 at 19:17
  • 1
    $\begingroup$ @nocomprende, I think it has applications in teaching basic information theory to children. My (then eight-year-old) niece wanted to play this game with me the last time she visited. After beating her a couple of times I explained how I was maximising the information gain by looking for the question which would get closest to a 50/50 split. $\endgroup$ Commented Jul 17, 2017 at 15:07
  • $\begingroup$ @PeterTaylor this is a good point about information theory - extracting useful info from data so as to make decisions, perhaps. If something is very likely, or very unlikely, then the info does not have as much value. Easy to decide whether to take your umbrella, if it is already raining, or you live in the Sahara. Not so easy in Florida, typically (closer to 50% chance). So then, on to deciding how to design a database, right? Try not to have columns with only a few distinct values, etc... $\endgroup$
    – user737
    Commented Jul 17, 2017 at 15:44
3
$\begingroup$

As requested by @heather, comment converted to answer:

When my daughter was 6 I introduced her to Ruby and Postgresql because she wanted to know what i did at work. She soon lost interest, but the analogy I used for her was "cubbies" like she stored her stuff in at kindergarten. Cubbies come in blocks, which are assembled into larger installations. A database is just a very large wall of cubbies, and the DML side of SQL is about getting stuff into or out of the cubbies. DDL side of SQL is making the rules about what is allowed to be put into the cubbies

$\endgroup$
1
  • $\begingroup$ Many are the times I have thought about the cubbies in kindergarten. Adults have the Post Office Box thing. I also recall staring at the greenbar paper my friend's father brought home from work. First I learn to read - make black marks into a stream of words in my head - then this. What are these words? What the heck does FORMAT mean and why is everything shouting at me? $\endgroup$
    – user737
    Commented Jul 17, 2017 at 15:48
-1
$\begingroup$

I am not an educator, I am just a student. But I was also interested with the idea, so while I was reading books, taking courses, and writing sample programs, I was able to think of one analogy. I am not sure if my answer is correct, I would also like a comment on its correctness. Any ways, I have written an article so read it, correct me and also see if it something you could use. Here is a link

$\endgroup$
2
  • $\begingroup$ Hi Hileamlak, welcome to Computer Science Educators! I appreciate you sharing your analogy, however here on Stack Exchange we generally prefer if you can summarize the linked content on our site, so that we can avoid issues of link rot and so that readers don't have to click through another link to get their answer. Could you please edit your post to include a summary of the linked content? $\endgroup$
    – thesecretmaster
    Commented Mar 19, 2021 at 22:57
  • 1
    $\begingroup$ I'm always surprised by how florid some analogies on this subject become. The most straightforward analogy is a filing cabinet and a secretary. Unlike the warehouse and the warehouse manager, whose primary focus is the storage of quantities of goods, the secretary is fundamentally concerned with records (i.e. information). And most people are familiar with all the tools of the secretary's trade - paper, forms, files, cabinets, photocopiers, etc. - if not all the tricks of their trade (i.e. organising their records and performing their work in an efficient and correct fashion). $\endgroup$
    – Steve
    Commented Mar 27, 2021 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.