Selection of records

Introduction

Tuple selection works like a filter: it allows tuples that meet the selection condition to pass and disallows tuples that do not meet the condition. The operator is given some input relation, as well as a selection condition about tuples in the input relation. A selection condition is a truth statement about a tuple’s attribute values, such as AreaSize > 1000. For some tuples in Parcel, this statement will be true and for others it will be false. Tuple selection on the Parcel relation with this condition will result in a set of Parcel tuples for which the condition is true.

Queries like the tuple selection and attribute projection do not create stored tables in the database. This is why the result tables have no name: they are virtual tables. The result of a query is a table that is shown to the user who executed the query. Whenever the user closes her/his view on the query result, that result is lost. The SQL code for the query is, however, stored for future use. The user can re-execute the query again to obtain a view on the result once more.

Figure: The two unary query operators: (a) tuple selection has a single table as input and produces another table with less tuples. Here, the condition was that AreaSize must be over 1000; (b) attribute projection has a single table as input and produces another table with fewer attributes. Here, the projection is onto the attributes PId and Location.​​​

 

Learning outcomes

  • 5 - Data management: relational database and DBMS

    Describe and explain the structure and components of a relational data model and a relational database (level 1 and 2). Describe and explain what a Database Management System (DBMS) is and how it links to a GIS.

  • 6 - Data retrieval and queries

    Explain the basic concepts of data retrieval (attribute and spatial queries) and formulate queries to make a selection on attributes and geospatial data from a spatial database.

Prior knowledge

Outgoing relations