# SQL - การคิวรีเชิงวิเคราะห์ขั้นสูง (Data Analytics) > การวิเคราะห์ cohort, funnel, retention, การคำนวณ KPI, การคิวรี pivot, การปรับให้เหมาะสม - 20 คำถามสัมภาษณ์ - Senior - [คำถามสัมภาษณ์: Data Analytics](https://sharpskill.dev/th/technologies/data-analytics/interview-questions.md) ## 1. ในการวิเคราะห์ cohort บทบาทหลักของวันที่ติดต่อครั้งแรก (first touch date) คืออะไร? **คำตอบ** วันที่ติดต่อครั้งแรกช่วยให้สามารถจัดกลุ่มผู้ใช้เป็น cohort ตามเวลาที่พวกเขาเริ่มโต้ตอบกับผลิตภัณฑ์ การแบ่งกลุ่มตามเวลานี้มีความสำคัญในการเปรียบเทียบพฤติกรรมของกลุ่มผู้ใช้ที่ได้มาในช่วงเวลาต่างๆ และระบุแนวโน้มหรือการเปลี่ยนแปลงประสิทธิภาพตามเวลา ## 2. ฟังก์ชัน window ใดที่ควรใช้ในการคำนวณจำนวนวันระหว่างกิจกรรมแรกและกิจกรรมสุดท้ายของผู้ใช้? **คำตอบ** ฟังก์ชัน FIRST_VALUE และ LAST_VALUE พร้อมคำสั่ง OVER ช่วยให้สามารถดึงค่าแรกและค่าสุดท้ายของคอลัมน์ภายใน window ที่กำหนดได้ตามลำดับ เมื่อรวมกับ DATEDIFF หรือการลบวันที่ จะช่วยให้คำนวณอายุการใช้งานของผู้ใช้ได้โดยไม่ต้องใช้ subquery หลายตัว ## 3. จะสร้างตาราง retention รายเดือนด้วย SQL โดยใช้ cohort ตามเดือนที่ลงทะเบียนได้อย่างไร? **คำตอบ** การสร้างตาราง retention ต้องระบุ cohort ของผู้ใช้แต่ละคนผ่าน DATE_TRUNC บนวันที่ลงทะเบียนก่อน จากนั้นคำนวณจำนวนเดือนที่ผ่านไประหว่าง cohort และกิจกรรมแต่ละครั้ง GROUP BY บนสองมิติเหล่านี้และ COUNT DISTINCT ของผู้ใช้ที่ใช้งานอยู่จะให้ตารางที่สมบูรณ์ ## มีอีก 17 คำถาม - ในการวิเคราะห์ funnel การแปลง 4 ขั้นตอน (เข้าชม → ลงทะเบียน → เปิดใช้งาน → ซื้อ) วิธีการ SQL ใดที่แข็งแกร่งที่สุด? - จะคำนวณอัตรา churn รายเดือนใน SQL สำหรับฐานสมาชิกได้อย่างไร? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Data Analytics อื่นๆ - [Google Sheets - พื้นฐาน](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/google-sheets-basics.md): 20 คำถาม, Junior - [Google Sheets - สูตรขั้นสูง](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/google-sheets-advanced.md): 20 คำถาม, Junior - [SQL - พื้นฐาน](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/sql-basics.md): 25 คำถาม, Junior - [SQL - การรวมและการจัดกลุ่ม](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/sql-aggregations.md): 20 คำถาม, Junior - [SQL - Joins](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/sql-joins.md): 20 คำถาม, Junior - [BigQuery - พื้นฐาน](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/bigquery-fundamentals.md): 20 คำถาม, Junior - [Data Cleaning - การทำความสะอาดข้อมูล](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/data-cleaning.md): 20 คำถาม, Junior - [KPI และเมตริกทางธุรกิจ](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/kpis-metrics.md): 20 คำถาม, Junior - [สถิติเชิงพรรณนา](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/descriptive-statistics.md): 20 คำถาม, Junior - [Zapier และระบบอัตโนมัติ No-Code](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/zapier-automation.md): 20 คำถาม, Junior - [หลักการ Data Visualization](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/data-viz-principles.md): 20 คำถาม, Junior - [Python & Pandas - พื้นฐาน](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/python-pandas-basics.md): 20 คำถาม, Junior - [Google Sheets - แดชบอร์ดอัตโนมัติ](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/google-sheets-dashboards.md): 20 คำถาม, Mid-Level - [SQL - Subquery และ CTE](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/sql-subqueries-ctes.md): 20 คำถาม, Mid-Level - [SQL - Window Functions](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/sql-window-functions.md): 20 คำถาม, Mid-Level - [BigQuery - ฟีเจอร์ขั้นสูง](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/bigquery-advanced.md): 20 คำถาม, Mid-Level - [Data Modeling](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/data-modeling.md): 20 คำถาม, Mid-Level - [การวิเคราะห์ Funnel และ Conversion](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/funnel-analysis.md): 20 คำถาม, Mid-Level - [การวิเคราะห์ Cohort และ Retention](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/cohort-retention.md): 20 คำถาม, Mid-Level - [Google Tag Manager และการติดตาม](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/gtm-tracking.md): 20 คำถาม, Mid-Level - [API และ Webhook](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/apis-webhooks.md): 20 คำถาม, Mid-Level - [dbt - พื้นฐาน](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/dbt-fundamentals.md): 20 คำถาม, Mid-Level - [AB Testing และสถิติประยุกต์](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/ab-testing.md): 20 คำถาม, Mid-Level - [Looker Studio (Google Data Studio)](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/looker-studio.md): 20 คำถาม, Mid-Level - [Power BI - พื้นฐาน](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/power-bi-fundamentals.md): 20 คำถาม, Mid-Level - [dbt - ฟีเจอร์ขั้นสูง](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/dbt-advanced.md): 20 คำถาม, Senior - [Power BI - DAX และแดชบอร์ดขั้นสูง](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/power-bi-dax.md): 20 คำถาม, Senior - [Python Analytics - การวิเคราะห์ขั้นสูงและ ML](https://sharpskill.dev/th/technologies/data-analytics/interview-questions/python-analytics-advanced.md): 20 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/data-analytics/interview-questions/sql-advanced-analytics