From the course: Learning SQL Programming
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Transforming data - SQL Tutorial
From the course: Learning SQL Programming
Transforming data
- [Instructor] Just because data is stored one way in the database doesn't mean we can't transform it into something we need with our query. Some common functions we'll look at are changing the case of a string, converting a value to a different type, trimming a value, and replacing a particular string in a field. Let's start with a basic query like we've seen before. I'll write, SELECT first_name, last_name FROM people. And let's take a few liberties with the capitalization here. On the first field, I'll use the LOWER function to tell the database to give me a lowercase representation of the contents of the field. And on the last_name field, I'll add an UPPER function to transform the text into its uppercase equivalent. I'll run this, and I can see that the data has been transformed. These functions are fairly straightforward, and they can be useful when we need to present information in a particular way. We can also chop up pieces of a string. For example, if you need to get the…
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.