Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Customer Signup Years | Advanced SQL for Data Analysis
Practice
Projects
Quizzes & Challenges
Вікторини
Challenges
/
SQL for Data Analysis

bookChallenge: Customer Signup Years

Understanding the EXTRACT Function in SQL

The EXTRACT function in SQL lets you pull out a specific part of a date or time value. For example, you can use it to get just the year, month, or day from a full date. This is especially useful when you need to group or filter data by parts of a date, like analyzing signups by year.

Example:

SELECT EXTRACT(YEAR FROM signup_date) AS signup_year FROM customers;

This statement returns only the year from each customer's signup_date. You can also use EXTRACT to get the month or day by changing the argument inside the function.

1
SELECT EXTRACT(YEAR FROM DATE '2024-06-01') AS year;
copy
Завдання

Swipe to start coding

Write a query to analyze customer signups by year. Your goal is to group customers by the year of the signup_date and count the number of signups for each year.

  • Extract the year from the signup_date column.
  • Group the customers by the extracted year.
  • Count the number of customers who signed up in each year.
  • Return the signup year and the corresponding signup count for each group.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 6
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

bookChallenge: Customer Signup Years

Свайпніть щоб показати меню

Understanding the EXTRACT Function in SQL

The EXTRACT function in SQL lets you pull out a specific part of a date or time value. For example, you can use it to get just the year, month, or day from a full date. This is especially useful when you need to group or filter data by parts of a date, like analyzing signups by year.

Example:

SELECT EXTRACT(YEAR FROM signup_date) AS signup_year FROM customers;

This statement returns only the year from each customer's signup_date. You can also use EXTRACT to get the month or day by changing the argument inside the function.

1
SELECT EXTRACT(YEAR FROM DATE '2024-06-01') AS year;
copy
Завдання

Swipe to start coding

Write a query to analyze customer signups by year. Your goal is to group customers by the year of the signup_date and count the number of signups for each year.

  • Extract the year from the signup_date column.
  • Group the customers by the extracted year.
  • Count the number of customers who signed up in each year.
  • Return the signup year and the corresponding signup count for each group.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 6
single

single

some-alt