From the course: PostgreSQL: Advanced Queries
Using the exercise files - PostgreSQL Tutorial
From the course: PostgreSQL: Advanced Queries
Using the exercise files
- [Narrator] If you'd like to follow along with me throughout this course, then you can download the same exercise files that I'll be using from the course overview page. I have placed a copy of them here on my desktop, but you can save them wherever is most convenient for you. Now inside of the main folder is a folder for each chapter, and inside of here are the individual script files that show the completed SQL code from the end of each movie. In the chapter zero folder, there's also a script that'll set up the sample database that I'll be using for demonstrations. To set that up, just open up that file and copy the entire contents to your clipboard. Then we can jump into the Postgres SQL query editor. I'll be using PG admin throughout the course, but you can use whatever management interface you prefer. First, we need to create the database. To do that, I'll send the command create database two underscore trees. I'll execute the query, and that'll create the database on my server. Then I can close this query window, and not save any changes to the script. I'll right click on the server and choose refresh, and that should show me the new two trees database. I'll then click on it to connect. Next, we'll open up a new query editor, attached to the two trees database, and I'll paste in the contents of the script from the exercise files. Then, we'll execute the entire script. That'll go through and set up all of the tables and fill in a bunch of data rows. We can verify that everything worked by right clicking on the two trees database and choosing refresh. Then you should see a couple of new schemas. We have the inventory schema with the categories and products table, as well as the sales schema, that includes customers, order lines and orders. So these are the data tables that we'll be working with throughout the course. Now, the only other change that I've made to my system is to streamline what's shown on the screen in order to remove a number of items that we won't be working with. This step is optional, but to get the exact same configuration that I'm using, here inside of PG admin, go up to the file menu, choose preferences. Then in the browser group, click on nodes. I've gone through all of these nodes and turn everything off except for columns, constraints, databases. And I'll scroll through here to find indexes, as well as schemas and tables. So go ahead and toggle all those off except for those few items, and you'll have the same streamlined interface that we're seeing here on my screen. So now you're all set up and ready to explore PostgreSQL's queries and functions.
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.