From the course: SQL for Exploratory Data Analysis Essential Training
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Simple histogram visualization - PostgreSQL Tutorial
From the course: SQL for Exploratory Data Analysis Essential Training
Simple histogram visualization
- [Instructor] SQL is not known for visualizations. Most of us use other reporting tools to visualize data sets, but histograms are simple visualizations. There are times when you may want a quick visualization of buckets and values. We can do this in SQL using some simple ASCII stream manipulation. Let's start with a select statement we created in the last lesson. Now, let's add a string of asterisks, with a length that corresponds to the average cost of each person in the bucket. We can create a string with repeating characters of a certain length using the REPEAT function. It takes a character and a length. For example, REPEAT with a star and indicating 10, will produce a series of 10 asterisks. And REPEAT with an asterisk and 20 will produce a string with 20 asterisks. We had an average cost that ranged from $650 to $5,000. We don't want to have string from 650 to 5,000 characters long, so we'll make the length…