Grade 12 results are out. Where to check yours

Grade 12 Information Technology unit 3

Which columns, which rows: SELECT, WHERE and UPDATE

4 min · 2 past exam questions worked through

Parts of the lesson

Tap a part to play the lesson from there.

A 4-minute Temari video lesson on Grade 12 Information Technology unit 3: Which columns, which rows: SELECT, WHERE and UPDATE. Free to watch, no account needed.

More on unit 3

The chapter's own page holds the rest of what Temari has on it, such as short notes and practice questions with their answers.

Open the unit 3 page

Everything the lesson says

The lesson's words, part by part. Tap a time to play the lesson from there.

0:00Introduction

A database answers exactly what you ask it. In SQL, one part of a command chooses the columns, and another part chooses the rows. Leave the second part out, and the command reaches every row in the table. Let's see how that works.

0:18SELECT chooses the columns

SQL is the language you use to work with a database. A query starts with SELECT, then the columns you want, then FROM, and the table's name. SELECT * FROM COURSE; The asterisk, the star, means all columns in the table.

It is the same as listing every field by name. To see only some columns, list them, separated by commas. SELECT S_Fname, S_sex, FROM STUDENT; And spell each field name exactly as it is in the table.

0:54WHERE chooses the rows

Now the rows. To keep only some records, add a WHERE clause. WHERE S_sex = 'male'; Now only the male students come back. Text like male goes inside single quotation marks.

WHERE can compare too: equal, greater than, less than, and you can join conditions with AND or OR. WHERE is optional. Without it, you get every record. So remember the split. SELECT chooses the columns. WHERE chooses the rows.

1:29Practice question 1Past exam

Here is a practice question. In an SQL SELECT statement, what does the asterisk symbol signify? Pause the video, and try it.

The asterisk after SELECT means all columns in the table. It is the same as listing every field by name. The answer is C. It has nothing to do with the primary key. Rows are chosen by WHERE, not by the star, so B is wrong too. And the star does not pick out number columns.

2:07UPDATE: WHERE decides how many

Now a command that changes data. UPDATE changes values in records that are already in a table. It does not add records, and it does not remove them. Look at this one. UPDATE Teacher, SET T_Salary = 15000, WHERE T_Salary < 10000; Only teachers earning less than ten thousand get the new salary.

Your book says it plainly. It is the WHERE clause that decides how many records are updated. So what if you leave WHERE out? Then the command changes the salary of every teacher in the table. DELETE works the same way. With no WHERE, it deletes all the records.

2:49Practice question 2Past exam

Try this one. A school administrator in Hawassa executes the following SQL command. UPDATE Teacher SET T_Salary = 15000; What is the result of running this command? Pause, and try it.

Look for the WHERE clause. There isn't one. With no WHERE to choose the rows, the update reaches every record. So every teacher's salary becomes fifteen thousand birr. The answer is B. A is wrong: nothing limits it to the first row. C is wrong: WHERE can be left out, and then it simply changes every row. And D would need a WHERE clause, like the one we saw.

3:40Summary

So remember. After SELECT, the star means all columns. The WHERE clause chooses the rows. And an UPDATE or a DELETE with no WHERE reaches every record in the table. Keep practising questions like these on Temari.et.

Practise this unit in the app

Temari turns this chapter into timed practice and marks it as you go, with an AI tutor to explain anything that did not land.

Start free

Temari.et is also an Android app, free on Google Play.

Sign inCreate your account