From the course: Database Foundations: Database Management
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Create a function
From the course: Database Foundations: Database Management
Create a function
- [Instructor] Functions take one or more input values, process them and then output some new value. We can use a function to help us navigate the two_trees database and make queries on the data a little bit easier to write. Let's first review the data that's currently stored in the customers and the orders table by running the select statement that I have here in the script on lines four and five. We'll just select everything out of sales.customers and sales.orders. Now the orders information is stored based off of the customer ID. And you can see that in this column right over here. But it's unlikely that any database user will have all of these ID values memorized. When they want to look up orders for a customer they most likely know the company name. The problem is, is that end users will have to do a search first in order to get the appropriate customer ID number for the company that they're interested in. We can streamline this process by creating a function that takes 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)
Add programming elements to the database3m 54s
-
(Locked)
Create a function4m 51s
-
(Locked)
Create a stored procedure in PostgreSQL4m 30s
-
(Locked)
Create a stored procedure in SQL Server3m 6s
-
(Locked)
Challenge: Write a stored procedure58s
-
(Locked)
Solution: Write a stored procedure8m 7s
-
(Locked)
-