Page 153 - SQL
P. 153

Chapter 43: Relational Algebra




        Examples



        Overview


        Relational Algebra is not a full-blown SQL language, but rather a way to gain theoretical
        understanding of relational processing. As such it shouldn't make references to physical entities
        such as tables, records and fields; it should make references to abstract constructs such as
        relations, tuples and attributes. Saying that, I won't use the academic terms in this document and
        will stick to the more widely known layman terms - tables, records and fields.


        A couple of rules of relational algebra before we get started:

            •  The operators used in relational algebra work on whole tables rather than individual records.
            •  The result of a relational expression will always be a table (this is called the closure property)

        Throughout this document I will be referring to the follow two tables:





















        SELECT



        The select operator returns a subset of the main table.
        select < table > where < condition >


        For example, examine the expression:


        select People where DepartmentID = 2

        This can be written as:






        This will result in table whose records comprises of all records in the People table where the
        DepartmentID value is equal to 2:







        https://riptutorial.com/                                                                             135
   148   149   150   151   152   153   154   155   156   157   158