Introduction
Text information
Boolean
Date and time
Summary

Instruction

Excellent! As you can see, the database sorted the results in the order we asked for. Convenient, isn't it?

We can also compare text information using logical operators <,>,<=, >=,=,!= which you learned in the course on SQL queries.

It's quite easy to use = (equals) and != (not equals) and the result is pretty much predictable. The following statement:

SELECT * FROM user_account WHERE first_name = 'Mark';

will select all Marks on the website. But how about the following statement?

SELECT * FROM user_account WHERE nickname >= 'D';

The above query will select all users whose nickname starts with D, E, F. Since A, B and C come first in the alphabet (they are "lower" so to speak), nicknames which start with them will be skipped.

Exercise

Peter hasn't done anything since the last exercise, so we're still working with the table user_account and the columns first_name and nickname. Check all the users whose first name start with A, B, C or D. Use a single logical operator.

Stuck? Here's a hint!

Type

SELECT * FROM user_account WHERE first_name < 'E';

Console

Code editor

Result

TableConsole