1 00:00:00,630 --> 00:00:06,420 The final piece of your setup puzzle is to get familiar with Pgadmin and administration and management 2 00:00:06,420 --> 00:00:08,410 tool for PostgreSQL. 3 00:00:08,430 --> 00:00:12,450 So the Pgadmin software is free, but don't underestimate its performance, right? 4 00:00:12,450 --> 00:00:19,310 So it's a full featured tool as a powerful as pie tool, such as Microsoft SQL Server Management Studio. 5 00:00:19,320 --> 00:00:24,960 So with Pgadmin, you get a graphical interface where you can configure multiple aspects of your Postgres 6 00:00:24,960 --> 00:00:27,270 SQL Server and databases. 7 00:00:27,270 --> 00:00:34,530 And most appropriately, for this course, you will use a SQL query tool for writing, running and saving 8 00:00:34,530 --> 00:00:35,280 queries. 9 00:00:35,430 --> 00:00:42,060 So now let's run the assuming you follow the installation steps for your operational system earlier 10 00:00:42,060 --> 00:00:43,520 in this section. 11 00:00:43,530 --> 00:00:51,570 So here's how you launch the Pgadmin So you can also go to start menu, find the PostgreSQL folder here. 12 00:00:52,140 --> 00:00:52,950 Let's actually. 13 00:00:53,810 --> 00:00:54,200 Here. 14 00:00:54,200 --> 00:01:00,710 You can also go to the start menu, uh, find the PostgreSQL folder here, as you can see here. 15 00:01:00,710 --> 00:01:06,200 And we have several applications here, which is one of them is Pgadmin and SQL Shell, which we will 16 00:01:06,200 --> 00:01:07,580 use all of this here. 17 00:01:07,610 --> 00:01:14,720 You can also use the application stack builder to download and install new extensions and so on. 18 00:01:14,720 --> 00:01:18,460 So let's click on the Pgadmin here and that's it. 19 00:01:18,470 --> 00:01:25,940 Now after you should see the Pgadmin splash screen followed by the application opening. 20 00:01:26,180 --> 00:01:32,390 So if it's your first time launching Pgadmin, you will also receive a prompt to set a master password, 21 00:01:32,600 --> 00:01:34,070 which you will see here. 22 00:01:38,310 --> 00:01:40,350 Let me get my pen. 23 00:01:46,970 --> 00:01:48,850 So PG admin is starting here. 24 00:01:55,040 --> 00:01:58,790 Might take some time, depending on your computer's performance. 25 00:02:00,050 --> 00:02:01,850 Let's start a write up. 26 00:02:04,540 --> 00:02:08,770 We also have pain here, which I will draw things on the screen. 27 00:02:19,510 --> 00:02:22,600 If there's a problem with starting, you know, it's starting. 28 00:02:22,600 --> 00:02:22,810 Yes. 29 00:02:22,810 --> 00:02:29,260 You can see there's a dialogue that you can read and see the status of our program. 30 00:02:32,570 --> 00:02:35,300 The Pgadmin four is started, as you can see here. 31 00:02:40,200 --> 00:02:40,800 That's it. 32 00:02:40,950 --> 00:02:43,940 So that's that's the password screen that I talked about. 33 00:02:43,950 --> 00:02:46,410 So the you will enter the password here. 34 00:02:46,410 --> 00:02:48,840 In this case, I already set my password. 35 00:02:48,840 --> 00:02:49,650 In this case. 36 00:02:49,650 --> 00:02:51,690 My password is one, two, three. 37 00:02:51,690 --> 00:02:54,120 And here after that click on. 38 00:02:54,120 --> 00:02:59,430 Okay, you can also reset master password from here to remove all the saved passwords will remove established 39 00:02:59,430 --> 00:03:02,580 connections to the server and you may need to reconnect again. 40 00:03:02,580 --> 00:03:03,270 Yes. 41 00:03:04,150 --> 00:03:05,560 Here and now. 42 00:03:05,560 --> 00:03:07,300 This is the screen you will see. 43 00:03:07,300 --> 00:03:09,730 And here I will enter my password again. 44 00:03:10,090 --> 00:03:10,960 This is a new password. 45 00:03:10,960 --> 00:03:12,250 And here, that's it. 46 00:03:12,460 --> 00:03:14,740 This is our pgadmin. 47 00:03:14,740 --> 00:03:22,270 So here on Mac on macOS, when you launch the Pgadmin the first time the dialog might appear that displays 48 00:03:22,270 --> 00:03:28,900 the Pgadmin for that application can't open because it's from an unidentified developer. 49 00:03:28,900 --> 00:03:35,650 So now you should have to right click on the icon and click open and the next dialog should give you 50 00:03:35,650 --> 00:03:38,140 the option to open the application going forward. 51 00:03:38,140 --> 00:03:41,440 Your Mac will remember your granting this permission. 52 00:03:42,040 --> 00:03:45,280 So this is only applies if you are using Mac in Linux. 53 00:03:45,280 --> 00:03:49,360 You will and in Windows you will open this program without any problems. 54 00:03:49,360 --> 00:03:53,140 So the Pgadmin layout includes a left vertical pane here. 55 00:03:53,470 --> 00:03:56,830 This is a left vertical pane here. 56 00:03:56,950 --> 00:03:58,840 This is a left vertical pane. 57 00:03:59,630 --> 00:04:05,030 Uh, that displays an object browser where you can find available servers here, as you can see here. 58 00:04:06,070 --> 00:04:09,280 And the databases, users and other objects. 59 00:04:09,310 --> 00:04:17,410 Across the top of the screen is a collection of various it's a collection of menu items and below these 60 00:04:17,410 --> 00:04:18,280 are the tabs. 61 00:04:18,280 --> 00:04:20,410 Here are the tabs. 62 00:04:21,290 --> 00:04:25,000 That displays various aspects of database objects and performance. 63 00:04:25,010 --> 00:04:27,910 So here now let's connect to our database. 64 00:04:27,920 --> 00:04:33,830 So PostgreSQL is a database management system, which means it's a software that allows you to define, 65 00:04:33,830 --> 00:04:35,630 manage and query databases. 66 00:04:35,630 --> 00:04:41,870 So when you install PostgreSQL, it created a database server, an instance of the application running 67 00:04:41,870 --> 00:04:42,590 on your computer. 68 00:04:43,310 --> 00:04:46,640 So that includes a default database called. 69 00:04:47,560 --> 00:04:48,670 Postgres here. 70 00:04:49,440 --> 00:04:54,990 A database is a collection of objects that includes tables, functions and much more. 71 00:04:55,320 --> 00:04:58,980 So this is where your actual data will lie here. 72 00:04:58,980 --> 00:05:04,950 So we use the SQL language as well as Pgadmin to manage objects and data stored in the database. 73 00:05:05,340 --> 00:05:11,970 So in next lectures you will create your own databases on your PostgreSQL server to organize your work. 74 00:05:11,970 --> 00:05:18,330 For now, let's connect to Default Postgres database to explore pgadmin that we created. 75 00:05:18,420 --> 00:05:24,660 Remember, we created this database when we started and installed some extensions and we also gave the 76 00:05:24,660 --> 00:05:27,090 passwords for this and you will use that password. 77 00:05:27,100 --> 00:05:31,770 In this case, my password is one, two, three here and click on okay. 78 00:05:32,070 --> 00:05:33,420 And that's it. 79 00:05:33,780 --> 00:05:39,330 So in the object browser, click on the downward pointing arrow to the left of the server node to show 80 00:05:39,330 --> 00:05:40,590 the default server. 81 00:05:40,590 --> 00:05:46,500 And depending on your operating system, the default server name could be localhost or PostgreSQL where 82 00:05:46,500 --> 00:05:50,710 you and the postgres SQL X here. 83 00:05:50,860 --> 00:05:52,420 In this case it's 15. 84 00:05:52,450 --> 00:05:54,220 Then this is the version number. 85 00:05:54,810 --> 00:05:55,560 So. 86 00:05:56,410 --> 00:06:00,670 Now expand the databases and then expand the default database PostgreSQL. 87 00:06:00,700 --> 00:06:07,000 Here, as you can see here, we have users table spaces, login and group roles. 88 00:06:08,310 --> 00:06:09,270 And that's it. 89 00:06:09,740 --> 00:06:10,310 So. 90 00:06:12,450 --> 00:06:17,230 So if Pgadmin doesn't show a default under servers, you will need to add it. 91 00:06:17,280 --> 00:06:19,050 Right click servers here. 92 00:06:20,100 --> 00:06:20,610 Read. 93 00:06:21,980 --> 00:06:23,030 And server group. 94 00:06:23,390 --> 00:06:25,520 And here we will name it something. 95 00:06:26,300 --> 00:06:27,560 In this case, it's my name. 96 00:06:27,590 --> 00:06:29,510 Typhoon and click on Save. 97 00:06:33,030 --> 00:06:33,270 Here. 98 00:06:33,270 --> 00:06:38,280 As you can see at the bottom, we opened some new databases, which has nothing in it. 99 00:06:39,200 --> 00:06:39,800 So. 100 00:06:40,130 --> 00:06:46,730 And after that you will add a create server group, register server and so on. 101 00:06:46,820 --> 00:06:49,040 So now. 102 00:06:50,170 --> 00:06:50,740 The. 103 00:06:50,890 --> 00:06:52,600 Let's explore the query. 104 00:06:52,810 --> 00:06:53,320 Right. 105 00:06:53,320 --> 00:06:54,310 So. 106 00:06:55,270 --> 00:07:00,660 The application includes a query tool which where you write and execute the code. 107 00:07:00,690 --> 00:07:09,660 So to open the query query tool in the object browser first, you click once on any database to highlight 108 00:07:09,660 --> 00:07:10,710 it here. 109 00:07:12,290 --> 00:07:13,690 This case is Postgres. 110 00:07:15,020 --> 00:07:15,470 That's it. 111 00:07:16,300 --> 00:07:19,230 And then you will select the tools. 112 00:07:19,240 --> 00:07:23,140 And here you will also select the query tool. 113 00:07:23,140 --> 00:07:25,530 So first you need to click on some database. 114 00:07:25,540 --> 00:07:28,300 In this case, it's Postgres here. 115 00:07:29,160 --> 00:07:29,910 That's it. 116 00:07:30,940 --> 00:07:33,580 Now after clicking postgres just once. 117 00:07:33,580 --> 00:07:37,000 And after that you will come to Tools and Query tool. 118 00:07:37,030 --> 00:07:38,020 That's it. 119 00:07:38,350 --> 00:07:39,970 So you will see. 120 00:07:41,040 --> 00:07:42,180 Three panes here. 121 00:07:42,450 --> 00:07:44,100 Separated by here. 122 00:07:44,100 --> 00:07:45,210 One, two, three. 123 00:07:45,570 --> 00:07:48,210 So this three panes. 124 00:07:50,210 --> 00:07:55,190 And you can also open the multiple tabs to connect and write queries for different databases or just 125 00:07:55,190 --> 00:07:57,560 organize your code the way you would like. 126 00:07:57,590 --> 00:08:02,240 So to open another type tab, click on database and the object browser. 127 00:08:02,540 --> 00:08:06,590 Here, as you can see, we have tab right now here we can also open this. 128 00:08:13,590 --> 00:08:14,010 Tools. 129 00:08:14,010 --> 00:08:18,450 We can also use the SQL tool, which you will see and we will use later. 130 00:08:18,450 --> 00:08:21,990 And here, as you can see here, this works like a browser here. 131 00:08:21,990 --> 00:08:23,640 We can navigate through that. 132 00:08:24,940 --> 00:08:28,570 So now let's enter the code into query editor. 133 00:08:28,570 --> 00:08:31,690 So here now we will. 134 00:08:32,850 --> 00:08:37,350 We will download the lecture extension that I uploaded here in this lecture. 135 00:08:37,350 --> 00:08:41,190 You can also find this in the Udemy downloadable section of this lecture. 136 00:08:41,250 --> 00:08:43,740 Now I will come right out here. 137 00:08:48,430 --> 00:08:53,740 So here we will use and let's actually use the basic statement here. 138 00:08:53,740 --> 00:09:00,280 So to execute this statement, highlight the line width here, select and then click execute. 139 00:09:01,240 --> 00:09:07,900 As you can see, we were successfully, successfully run and it showed us nothing. 140 00:09:08,140 --> 00:09:09,010 So. 141 00:09:09,970 --> 00:09:10,330 Here. 142 00:09:10,330 --> 00:09:11,530 This is the play button. 143 00:09:11,860 --> 00:09:12,760 Execute here. 144 00:09:12,760 --> 00:09:16,060 You can also use the F5 to execute. 145 00:09:16,070 --> 00:09:17,800 This is a shortcut for execution. 146 00:09:18,040 --> 00:09:19,120 And yeah. 147 00:09:20,580 --> 00:09:28,590 And if you write the select version like that, you will you you will see the version of our. 148 00:09:29,790 --> 00:09:31,180 For SQL Server. 149 00:09:31,190 --> 00:09:38,690 As you can see here, Postgres 15.2 compiled by Visual C plus plus built by 19 1464 bit. 150 00:09:38,930 --> 00:09:42,440 So you will learn you will learn much more about queries later in this course. 151 00:09:42,440 --> 00:09:49,310 But for now, all you need to know is that the query uses a PostgreSQL specific function called version 152 00:09:49,640 --> 00:09:52,070 to retrieve the version information for the server. 153 00:09:52,070 --> 00:09:59,720 In my case, the output proves that I'm running in 15.2 version and it provides additional specifics 154 00:09:59,720 --> 00:10:01,490 on the build of the software. 155 00:10:02,300 --> 00:10:03,110 Her here. 156 00:10:03,350 --> 00:10:08,420 Now, we can also customize the which we will do later in this section. 157 00:10:08,420 --> 00:10:09,590 So see you later.