Page 457 - Computer_Science_F5
P. 457

Computer Science






          FOR ONLINE READING ONLY














                            Figure 8.11: Selection operation in a relational database

           The projection is defined as the set obtained when the components of the tuples are
           restricted to the set, it discards (or excludes) the other attributes. It extracts only the
           specified relation attributes from a tuple or set of tuples. It is a vertical subset of
           table columns, and it may include one column, two columns or all table columns.
           Projection answers the question: which columns shall the query return? For example,
           `Select empno, fname, job From emp`; returns columns as shown in Figure 8.12.

























                           Figure 8.12: Projection operation in the relational database

           Projection differs from selection as SELECT is used to select all rows of a specific
           relation  that meet a particular  condition, whereas the project is used to select
           particular columns. However, one query may contain both: selection and projection:
           For example, `select empno, fname, job From emp Where deptno=10`; returns
           enclosed columns and rows as in Figure 8.13.

                                                 448
                                                                for Advanced Secondary Schools



     Computer Science Form 5.indd   448                                                     23/07/2024   12:34
   452   453   454   455   456   457   458   459   460   461   462