From the course: Database Foundations: Intro to Databases
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Mathematical operations
From the course: Database Foundations: Intro to Databases
Mathematical operations
- [Instructor] You can include additional columns in a queries results set, that don't come from any data table in your database. Consider this query that I'm going to write on line number 10. Select and then in single quotes, Adam. If I run just this little bit here, you might be surprised that we actually get some results back and we just get the name, Adam. What we're doing is asking for the server to return a single value and not a column of data. And that's exactly what we're getting back. We can even give this column an alias in the results. I'll say as Name. Now, when I run this line we'll get a proper column name and the results. So this is a neat trick but actually it can be really useful to use inside of your queries. Let's get rid of line number 10 here, and I'll turn my attention back to the original query that I had in the math start dot SQL file. This query is retrieving a few columns from 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.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Display column aliases with AS4m 59s
-
(Locked)
Mathematical operations3m 20s
-
(Locked)
Use built-in functions5m 51s
-
(Locked)
Aggregate data with GROUP BY3m 34s
-
(Locked)
Filtering groups with HAVING3m 13s
-
(Locked)
Challenge: Query data1m 3s
-
(Locked)
Solution: Query data9m 39s
-
(Locked)
Solution: Query summary statistics6m 57s
-
(Locked)
-