“Attribute table joins is the process of combining two or more tables based on columns containing the same data type.”
A join is a means of appending data from another layer using common attributes. There are mainly two types of joins 1-1 and 1-many joins. 1 -1 joins explore the relationship between single rows from two separate layers. This is useful in order to link external data to spatial features. An attribute join provides a temporary view and records that have been joined have limited functionality in QGIS i.e. you can filter a table with join without creating a virtual layer first. Once records are joined to make the join permanent one has to invoke the save as feature to create a new permanent vector layer.
In this module, we will look at joining two or more tables together based on occurrences of the same data type. Attribute join works when the data type is the same. If a layer contains strings type data it will only join to string type data. This simple relationship between two tables is called a 1-1 join where a row in table A matches a row in table B.
The columns that are to be linked can have different names but contain/represent the same values.
Goal: To explore the use case of joining attributes from two tables sharing a unique column
Problem: add population data to district data
Table Join
1. Load the exercise data into QGIS.
2. Add the kzn_population.csv using add vector menu. (Why didn't we add it using the delimited text layer? )
3. Open the attribute table for the districts and kzn_population layer side by side for comparison.
Can you identify the column's containing identical data?
4. Navigate to the properties of the district layer and select the Join tab
5. Create a join to the district layer and kzn_population layers. Select the matching columns for the join to work.
6. Select which fields to join to ( we need area_km, population_2016, and density).
7. Activate the custom field name prefix and leave it blank.
8. Apply the changes and open the attribute table to inspect the joined fields.
Describe a table join:❗
Which of the following is True:❗
Table joins can only be used when the two tables use column with identical names:❗
Spatial Joins tutorial https://www.qgistutorials.com/en/docs/3/performing_spatial_joins.html
❗Download the sample data for the lesson.