From the course: Database Foundations: Database Management

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Solution: Write a stored procedure

Solution: Write a stored procedure

From the course: Database Foundations: Database Management

Start my 1-month free trial

Solution: Write a stored procedure

(upbeat music) - [Instructor] I hope you were able to create the store procedure for filling in new rows, into the customer's table. Let's walk through the solution here in PostgreSQL first, and then I'm going to show how the syntax changes when you move over to SQL server. So let's right click on the two trees database and the PostgreSQL database server and choose New Query. And the first thing I want to do is just take a quick look at the existing data that we have. So I'm going to select everything from the sales.customers table. And I'm going to run that. So I can see that I have six customers already in there and this gives me an easy access to view all of the different column names that we have to work with in our store procedure. So let's go ahead and start the store procedure. So we're going to CREATE PROCEDURE and let's call it insert_customer. And this insert_customer procedure is going to take a number of different parameters. We need a different parameter for each column…

Contents