From the course: Database Foundations: Application Development

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Add data to a database

Add data to a database

- [Narrator] PostgreSQL functions allow us to do more than just connect and send requests to the database server. There are additional functions that allow us to work with information that comes back from the server such as the results of a select query. To see this in action, scroll down on this page all the way to the bottom until you find the link to the Two Trees Olive Oil database. Alternatively, you could just browse to local host:8080/2_trees. This will open up another batch of files that we previously uploaded from the exercise files folder up into our web server. So that we have some interesting data to look at, the first script on this page will set up a sample database. It goes through a couple of different steps. The first thing that it's going to do is create a database. It does that by creating a connection, connection number one, and it uses the pg_connect function with these parameters. Then we'll set up a…

Contents