Get Started

Correlation

What's the relationship between a company's revenue and its other financial attributes? Compute the correlation between revenues and other financial variables with the corr() function.

This is a part of the course

“Exploratory Data Analysis in SQL”

View Course

Exercise instructions

  • Compute the correlation between revenues and profits.
  • Compute the correlation between revenues and assets.
  • Compute the correlation between revenues and equity.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Correlation between revenues and profit
SELECT ___ AS rev_profits,
	   -- Correlation between revenues and assets
       ___ AS rev_assets,
       -- Correlation between revenues and equity
       ___ AS rev_equity 
  FROM fortune500;

This exercise is part of the course

Exploratory Data Analysis in SQL

IntermediateSkill Level
4.5+
64 reviews

Learn how to explore what's available in a database: the tables, relationships between them, and data stored in them.

You'll build on functions like min and max to summarize numeric data in new ways. Add average, variance, correlation, and percentile functions to your toolkit, and learn how to truncate and round numeric values too. Build complex queries and save your results by creating temporary tables.

Exercise 1: Numeric data types and summary functionsExercise 2: DivisionExercise 3: Explore with divisionExercise 4: Summarize numeric columnsExercise 5: Summarize group statisticsExercise 6: Exploring distributionsExercise 7: TruncateExercise 8: Generate seriesExercise 9: More summary functionsExercise 10: Correlation
Exercise 11: Mean and MedianExercise 12: Creating temporary tablesExercise 13: Create a temp tableExercise 14: Create a temp table to simplify a queryExercise 15: Insert into a temp table

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free