SQL | Data Analytics | AI
1.9K subscribers
97 photos
9 files
66 links
SQL, Big Query, Looker and DBT for Data Analytics.

https://medium.com/@khavanski
Download Telegram
Why Do Investors Care So Much About LTV:CAC?


https://a16z.com/why-do-investors-care-so-much-about-ltvcac
❀6
Recursive CTE in SQL
❀6πŸ‘2πŸ‘1
πŸš€ Essential SaaS Metrics: What Really Matters?

A SaaS business runs on subscriptions.
Its health = predictable revenue + strong retention + efficient growth.

Here are the core metrics every SaaS founder, operator, and investor should track.

---

## πŸ’° Core Financial Metrics

πŸ”Ή MRR / ARR β€” Monthly / Annual Recurring Revenue
Your primary indicator of predictable revenue.

πŸ”Ή ARPU β€” Average Revenue Per User
How much revenue each customer generates on average.

πŸ”Ή ARR Growth Rate β€” Percentage increase in ARR
Shows how fast the company is scaling.

πŸ”Ή Expansion Revenue β€” Upsells, upgrades, add-ons
The healthiest form of growth comes from existing customers.

πŸ”Ή Gross Profit Margin
Revenue minus cost of goods sold. Strong SaaS businesses typically operate at 70–90%.

---

## πŸ” Retention & Customer Success Metrics

πŸ”Ή Churn Rate (Logo & Revenue)
Percentage of customers or revenue lost during a period. Lower = stronger stability.

πŸ”Ή Net Dollar Retention (NDR / NRR)
Revenue retained from existing customers including upgrades/downgrades.
If >100%, your revenue grows even without acquiring new customers.

πŸ”Ή NPS (Net Promoter Score)
Measures customer loyalty and likelihood to recommend.

πŸ”Ή Usage / Activation Rate
How actively customers use your product. Low usage today = churn tomorrow.

---

## πŸ“ˆ Acquisition & Efficiency Metrics

πŸ”Ή CAC (Customer Acquisition Cost)
Total sales & marketing spend required to acquire a new customer.

πŸ”Ή LTV / CLV (Customer Lifetime Value)
Total revenue expected from a customer over their lifecycle.

πŸ”Ή LTV-to-CAC Ratio
Measures ROI on acquisition. Ideal benchmark: 3:1 or higher.

πŸ”Ή CAC Payback Period
Months required to recover acquisition costs. Ideally < 12 months.

πŸ”Ή Rule of 40
Revenue growth rate + profit margin should exceed 40%.
A strong benchmark for balanced growth.

---

## πŸ”₯ Additional Stability Metrics

β€’ Cash Runway β€” How long the company can operate before running out of cash
β€’ Customer Concentration β€” Revenue dependence on a few major customers
β€’ Burn Multiple β€” Efficiency of growth relative to cash burned

---

πŸ“Œ SaaS isn’t just about growth.
It’s about *predictable, efficient, and sustainable growth.*

Track the right metrics. Build with discipline. Scale with confidence.
❀5
SQL execution orderπŸ“ˆ

One day at an interview you will be asked this question
❀4πŸ‘2
❀3
What is difference between COUNT and COUNT (DISTINCT) ?
πŸ₯°3πŸ’©1
AnalyticsEngineeringSQLdbt.pdf
10.3 MB
Rui Machado / Analytics Engineering with SQL and dbt
πŸ‘4❀2πŸ”₯2πŸ‘2😐1
Key Differences between List and Tuple in #Python
❀6
πŸ”° The 4 Types of SQL Joins

SQL joins combine rows from two or more tables based on a related column. Here are the different types of joins you can use:

1⃣ Inner Join
Returns only the matching rows between both tables. It keeps common data only.

πŸ”’ Left Join
Returns all rows from the left table and matching rows from the right table. If a row in the left table doesn’t have a match in the right table, the right table’s columns will contain NULL values in that row.

πŸ”’ Right Join
Returns all rows from the right table and matching rows from the left table. If no matching record exists in the left table for a record in the right table, the columns from the left table in the result will contain NULL values.

πŸ”’ FULL OUTER JOIN
Returns all rows from both tables, filling in NULL for missing matches.
πŸ‘6❀2
πŸ”₯ Top 8 SQL Tricks Every Data Person Should Know

1️⃣ QUALIFY instead of subqueries
Filter window function results directly β€” no wrapping needed:
QUALIFY ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY created_at DESC) = 1

2️⃣ EXCEPT in SELECT * (BigQuery)
Grab everything but the noise:
SELECT * EXCEPT (raw_payload, _synced_at) FROM t

3️⃣ COUNT(DISTINCT x) vs APPROX_COUNT_DISTINCT(x)
On billions of rows, approximate counts are 10x faster and usually accurate within ~1%.

4️⃣ NULL-safe comparisons
a = b is NULL when either side is NULL. Use IS NOT DISTINCT FROM (or <=> in MySQL) to compare safely.

5️⃣ Window frames are not all the same
ORDER BY inside OVER() silently changes the default frame to RANGE UNBOUNDED PRECEDING β†’ CURRENT ROW. Running totals? Fine. Full-partition aggregates? Bug.

6️⃣ Anti-joins done right
NOT EXISTS beats NOT IN β€” the latter returns nothing if the subquery contains a single NULL. 😬

7️⃣ GROUP BY ALL
Stop counting column positions. Group by every non-aggregated column automatically (BigQuery, Snowflake, DuckDB).

8️⃣ CTEs β‰  optimization
In some engines CTEs are inlined, in others materialized. If a CTE is referenced twice and it's heavy β€” check the query plan, don't assume.



#SQL #BigQuery #DataEngineering #Analytics
❀5πŸ‘2πŸ”₯1
Channel name was changed to Β«SQL | Data Analytics | AIΒ»