BaşlayınÜcretsiz Başlayın

Aggregating film categories

For the final exercise in this course, let's return to the film_permit table. It contains a community_board TEXT column composed of a comma-separated list of integers. There is interest in doing an analysis of the types of film permits that are being provided for each community board. However, the representation of community boards (INTEGERs in a TEXT column) makes this difficult. By using techniques learned in this chapter, the data can be transformed to allow for such an analysis.

In this exercise, you will first create a (temporary) VIEW that represents the community_board values individually for two permit categories. A VIEW is a named query that can be used like a TABLE once created. You will use this VIEW in a subquery for aggregating the results in a pivot table.

Bu egzersiz

Cleaning Data in PostgreSQL Databases

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

CREATE OR REPLACE TEMP VIEW cb_categories AS 
SELECT
	-- Split community board values
	___(___, ___) AS community_board,
    category
FROM
	film_permit
WHERE 
    -- Restrict the categories in results
    ___ ___ (___, ___, ___);

-- View cb_categories
SELECT * FROM cb_categories;
Kodu Düzenle ve Çalıştır