WHERE clause in SQLite

WHERE clause in SQLite

The WHERE clause is used to filter rows from the worktable generated by the FROM clause. It provides expressions that evaluate each row. When the expression returns false or NULL, the row is discarded. This discard simply deletes the record and is not treated as an error. So, the resulting table after filtering by the WHERE clause will have the same number of columns as the original table, but possibly fewer rows. Figure 3.10 shows how the WHERE clause works.

Figure 3.10 How the WHERE clause works

[Example 3-3] The WHERE clause will be used below to filter and output records with scores greater than 60 in the Students table. The corresponding SQL statement is as follows:

SELECT * FROM Students WHERE Score>60

Run the program and execute as shown in Figure 3.11.

Figure 3.11 Records with scores greater than 60

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325294264&siteId=291194637