From the course: SQL Server Intelligence: Cracking the Code of Enterprise Data
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Solution: Calculated columns and conditional logic - SQL Tutorial
From the course: SQL Server Intelligence: Cracking the Code of Enterprise Data
Solution: Calculated columns and conditional logic
- [Presenter] In this challenge, your mission is to segment customers by age into predetermined buckets. So let's take a look at how we would go about responding to such a request. Now, management has some predetermined buckets that they've associated with the ages of their customers. So let's start by going to our from clause and we can see that we've specified the customer details table. From here, we can tap into the fields of the customer details table via our select clause. Now, we have included a few fields in our select clause, starting with the ID, and we've alias this as customer ID. Again, surrounding this customer ID alias with double quotes because of the space between customer and ID, followed by the CONCAT function, which is concatenating, the first name and the last name fields, and placing a space between those fields. This singular field is going to be alias as customer name and again, surrounded by a pair of double quotes, followed by the city field, which is alias…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.