Understanding the distribution of dynamic tags in a dataset is crucial for metadata generation, content categorization, and trend analysis. This tutorial will guide you through SQL queries that help you:
By the end of this tutorial, you’ll be able to extract structured insights from dynamic tag metadata using SQL.
Note: This tutorial uses the V3 Dynamic Tags table schema. If you’re using an older version, table names may differ (e.g.,
group_[name]instead ofdt_[group_name]_visual).
This query calculates how often each dynamic tag appears across the dataset, helping you understand category distribution.
CTE (ranked): Assigns a rank to each dynamic tag within every image based on the tag’s score.
CTE (image_tag_table): Filters the ranked results to include:
rn <= 3).Final Query: Counts how many unique images contain each dynamic tag.

This query retrieves the most significant dynamic tags for each image, helping with content categorization.
CTE (video_only): Ensures the analysis focuses on standalone images by excluding video-related data in the next step, which is not necessary if your dataset only contains images.
CTE (ranked): Assigns a rank to each dynamic tag for every image (coactive_image_id), based on the tag’s score.
Final Query: Filters results to include only:
rn <= 5).
This query retrieves the most significant dynamic tags for each video, helping structure video metadata.
CTE (video_only): Filters to keep only valid video data.
CTE (ranked): Ranks tags within each video by confidence score.
CTE (distinct_tags): Ensures that each tag appears only once per video, keeping the highest confidence score.
CTE (video_tag_table): Retrieves the top 5 tags per video.
