1、- 1 - 外文原文 Now lets look at an example that actually does something operationally. Consider the following: SELECT name, type_id FROM foods; This performs a projection on foods, selecting two of its three columnsname and type_id.The id column is thrown out, as shown in Figure 4-5. Figure 4-5. A proje
2、ction of foods Lets summarize: the FROM clause takes the input relations and performs a join, which combines them into a single relation R1. The WHERE clause takes R1 and filters it via restriction, producing a new relation R2. The SELECT clause takes R2 and performs projection, producing the final
3、result. This process is shown in Figure 4-6. Figure 4-6. Restriction and projection in SELECT With this simple example, you can begin to see how a query language in general and SQL in particular ultimately operates in terms of relational operations. There is real math under the hood. Filtering If th
4、e SELECT command is the most complex command in SQL, then the WHERE clause is the most complex clause in SELECT. And, just as the SELECT command pulls in aspects of set theory,the WHERE clause also pulls in aspects of formal logic. By and large, the WHERE clause is usually the part of the SELECT command that harbors the most - 2 - complexity. But it also does most of the work. Having a solid understanding of its mechanics will most likely bring the best overall returns in your day-to-day use