A police officer action figure and several other action figures wearing overalls stand near a stack of white birthday candles. One candle on the lefthand side is slightly broken, and the police officer is pointing to it.

Fix “Broken” SQL Statement (CIS)

Activity aim: Spot common error in SQL statements, fix errors by writing correct SQL

Materials: Printed worksheets

Time estimated: 60 minutes

Prep for teacher: Set up worksheets. Break students into pairs or groups (no more than 4)

Note: Designed for a class of >40 students. This activity was used for a pre-test review, so it involved many types of SQL statements. To enable wider coverage of material, 24 statements were broken into 6 versions of worksheet. The main worksheet has 24 questions, while group worksheets have 4 to 5. Question 1 on main worksheet will correspond to question 1 of group 1, question 2 main – to question 1 group 2, etc. Therefore all pairs/groups will have a chance to get their turn to discuss their solutions. A variation of this would be working on one worksheet of 4-5 statements at a time.


Activity Description:

Prior to class, the instructor will prepare enough copies of the worksheet described below so that each pair/group has one.

At the start of the activity instructor distributes worksheets with the list of SQL statements (4 or 5).
Students will be asked to review the worksheets individually, and try to spot the errors. (5 minutes)

Next, students will be paired off with people next to them: small groups of 3 are okay. Students are asked to discuss their solution with the partners. The worksheets are used by every pair/group to record the answers. This discussion will last another 10 minutes.

After the discussion, the instructor turns to the projector and displays the worksheet with incorrect SQL. The main worksheet has 24 questions. The pairs who have question 1 asked to volunteer the solution to the first question. While first pair is reporting, the other pairs who had the same question are commenting, the rest of the class is observing, and is asked if they are agreed that these indeed are the problems, and whether they agreed with the correction.

The instructor guides the discussion from her point at the projector. When the correct answer is found, that SQL statement is typed onto the worksheet document below the incorrect one, in a different color, and the error(s) is(are) highlighted on the original statement.

Repeat for next questions and using other groups. As the activity progresses, keep updating the worksheet document, so everyone can see the correct answers on the projector as they are being given. Eventually all statements are completed and displayed. This discussion lasts 40-50 minutes.

Leave a Reply