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

Using COUNTIF

One of the most useful GoogleSQL aggregate functions is COUNTIF which allows you to calculate conditional counts with less code. In this exercise, you will count all the products over a specific weight and group them by category.

Bu egzersiz

Introduction to BigQuery

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

Egzersiz talimatları

  • Write a query that uses the COUNTIF function to find all the products over 5000 grams from the ecommerce.ecomm_products table.
  • Group the query by the product_category_name_english column.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

-- Complete the query to count all the products over 5000 grams

SELECT
  product_category_name_english,
  
  -- Add the function name and conditional expression
  ___(product_weight_g ___)
FROM ecommerce.ecomm_products

-- Add the correct column for grouping
GROUP BY ___; 
Kodu Düzenle ve Çalıştır