Learn PostgreSQL Tutorial - Full Course for Beginners

Поділитися
Вставка
  • Опубліковано 26 сер 2024
  • Learn how to use PostgreSQL in this full course. PostgreSQL is a general purpose and object-relational database management system. It is the most advanced open source database system widely used to build back-end systems.
    ⭐️ Contents ⭐️
    ⌨️ (0:03:16) What is a Database
    ⌨️ (0:05:17) What is SQL And Relational Database
    ⌨️ (0:09:10) What is PostreSQL AKA Postrgres
    ⌨️ (0:10:53) PostgreSQL Installation (Mac OS)
    ⌨️ (0:14:21) PostgreSQL Installation (Windows)
    ⌨️ (0:17:38) GUI Clients vs Terminal/CMD Clients
    ⌨️ (0:21:39) Setup PSQL (MAC OS)
    ⌨️ (0:25:22) Setup PSQL (Windows)
    ⌨️ (0:30:15) How to Create Database
    ⌨️ (0:33:35) How to Connect to Databases
    ⌨️ (0:38:12) A Very Dangerous Command
    ⌨️ (0:41:37) How To Create Tables
    ⌨️ (0:45:46) Creating Tables Without Constraints
    ⌨️ (0:49:12) Creating Tables with Constraints
    ⌨️ (0:55:55) Insert Into
    ⌨️ (0:59:14) Insert Into Example
    ⌨️ (1:02:36) Generate 1000 Rows with Mockaroo
    ⌨️ (1:12:28) Select From
    ⌨️ (1:15:18) Order By
    ⌨️ (1:19:53) Distinct
    ⌨️ (1:21:59) Where Clause and AND
    ⌨️ (1:25:29) Comparison Operators
    ⌨️ (1:29:35) Limit, Offset & Fetch
    ⌨️ (1:32:43) IN
    ⌨️ (1:35:43) Between
    ⌨️ (1:37:45) Like And iLike
    ⌨️ (1:43:10) Group By
    ⌨️ (1:46:41) Group By Having
    ⌨️ (1:52:08) Adding New Table And Data Using Mockaroo
    ⌨️ (1:55:40) Calculating Min, Max & Average
    ⌨️ (1:59:48) Sum
    ⌨️ (2:01:55) Basics of Arithmetic Operators
    ⌨️ (2:05:59) Arithmetic Operators (ROUND)
    ⌨️ (2:09:43) Alias
    ⌨️ (2:12:32) Coalesce
    ⌨️ (2:16:15) NULLIF
    ⌨️ (2:20:21) Timestamps And Dates Course
    ⌨️ (2:23:21) Adding And Subtracting With Dates
    ⌨️ (2:25:58) Extracting Fields From Timestamp
    ⌨️ (2:27:28) Age Function
    ⌨️ (2:29:24) What Are Primary Keys
    ⌨️ (2:31:23) Understanding Primary Keys
    ⌨️ (2:36:26) Adding Primary Key
    ⌨️ (2:40:55) Unique Constraints
    ⌨️ (2:49:15) Check Constraints
    ⌨️ (2:54:45) How to Delete Records
    ⌨️ (3:01:36) How to Update Records
    ⌨️ (3:05:55) On Conflict Do Nothing
    ⌨️ (3:11:09) Upsert
    ⌨️ (3:16:41) What Is A Relationship/Foreign Keys
    ⌨️ (3:19:48) Adding Relationship Between Tables
    ⌨️ (3:25:04) Updating Foreign Keys Columns
    ⌨️ (3:29:30) Inner Joins
    ⌨️ (3:35:17) Left Joins
    ⌨️ (3:40:53) Deleting Records With Foreign Keys
    ⌨️ (3:47:27) Exporting Query Results to CSV
    ⌨️ (3:50:42) Serial & Sequences
    ⌨️ (3:57:18) Extensions
    ⌨️ (3:59:39) Understanding UUID Data Type
    ⌨️ (4:05:54) UUID As Primary Keys
    ⌨️ (4:16:30) Conclusion
    ✏️ Course from Amigoscode.
    🔗 Subscribe to Amigoscode UA-cam channel | bit.ly/2HpF5V8
    🔗 Visit Amigoscode.com for more courses | bit.ly/2JgGW0w
    🔗 Full Playlist Available Here | bit.ly/2ClGPdY
    🔗 Follow Amigoscode on Instagram | bit.ly/2TSkA9w
    🔗 Join Amigoscode Closed Facebook Group | bit.ly/2FbuIkx
    --
    Learn to code for free and get a developer job: www.freecodeca...
    Read hundreds of articles on programming: medium.freecod...
    And subscribe for new videos on technology: ua-cam.com/users/su...

КОМЕНТАРІ • 2 тис.

  • @andrerangel7654
    @andrerangel7654 5 років тому +1717

    Somebody give that man a medal!!

  • @calvinbarajas5144
    @calvinbarajas5144 3 роки тому +593

    This lecture is amazing because (a) Nelson knows the exact technical terminology, (b) he is very patient and methodical, (c) covers the basics very well, (d) gives professional insight into how to use PostgreSQL.

    • @elco7956
      @elco7956 Рік тому +4

      **proceeds to call an asterisk a star**

    • @user-xw4mu6nz4t
      @user-xw4mu6nz4t Рік тому

      @@elco7956 I've been a web developer for 7 years and I still do that.

    • @IceEnglish-ii7jv
      @IceEnglish-ii7jv Рік тому +3

      ​@@elco7956 asterisk AS star 😮

    • @electrolyteorb
      @electrolyteorb Рік тому +1

      ​@@elco7956 @IceEN Holy mother of GOD!!!!

    • @dzzygaming
      @dzzygaming 3 місяці тому

      @@elco7956 imagine being overly critical because someone didnt say asterisk XD

  • @sewind6613
    @sewind6613 2 роки тому +187

    That someone would take their time to make such a complete set of tutorials, and to make them available for free, is amazing. Words are not enough to express my gratitude, and my respect for you.

    • @Friend_2162
      @Friend_2162 7 місяців тому +1

      I believe they were not free in the beginning. We can just appreciate they are free eventually after just 4 years :)

  • @mercantilism954
    @mercantilism954 Рік тому +474

    Note for beginners:
    34:50
    Here, he is using a command prompt, not postgres shell. If " psql - -help" does not work on your terminal, you need to add an environment variable. This video explains how to add one. ua-cam.com/video/0EBkVzIBnoc/v-deo.html
    35:44
    If your password does not work, use 'postgres' for the username. Your code should look like this " psql -h localhost -p 5432 -U postgres test"
    This is simply because you have not created a user account called 'user'

    • @omar-bb3dv
      @omar-bb3dv Рік тому +7

      thank you so much

    • @chantelboiro3899
      @chantelboiro3899 Рік тому +1

      Thank you! I was wondering what I was missing

    • @JadeObidosXP
      @JadeObidosXP Рік тому +1

      I was wondering why that part doesn't work on my end. Thank you so much for this!

    • @leishmaniaful
      @leishmaniaful Рік тому +9

      Thanks, man. How can they miss this from the video? freecodecamp tutorials used to be proficient...

    • @windows99
      @windows99 Рік тому

      Oh my god. I was so confused why it doesn't work on my part. Thank you so much.

  • @user-ro2do2uh5y
    @user-ro2do2uh5y 4 роки тому +834

    Thank You for using easy English. I understand a lot of.
    Respect from Russia with 41 peoples.

    • @nyteskun
      @nyteskun 4 роки тому +15

      41+1

    • @sergeyvechkitov221
      @sergeyvechkitov221 4 роки тому +9

      +1

    • @WeirdAlSuperFan
      @WeirdAlSuperFan 4 роки тому +2

      just fyi this guy's English is terrible, but hey at least it's simple

    • @user-mh7kx3oo7t
      @user-mh7kx3oo7t 4 роки тому +30

      @nabil libre just racist up there

    • @diegodelsol1309
      @diegodelsol1309 4 роки тому +23

      @@WeirdAlSuperFan How so? He is speaking slowly and clearly and obviously has a good grasp of the concepts.

  • @gunk4196
    @gunk4196 Рік тому +30

    The fact that this is free is insane! A very good course on Postgres. I finished this in less than 24 hours and before starting I didn't even know what 'SQL' was but now I feel like I have a solid understanding of Postgres.

    • @richumathew7352
      @richumathew7352 3 місяці тому

      Also train and make project before you forget

  • @khateebanwer7466
    @khateebanwer7466 2 роки тому +42

    For someone who is following this tutorial currently :
    1) at around 01:06:00 when you go through the SQL file in VSCode , do change the value of varchar of gender greater than 20 because Mockaroo includes more than 2 genders in randomly generated database which will throw an error during its execution through cli when not changed.
    2)When using terminal (for windows users ) , you might get errors during execution of sql file through cli due to path format which can easily be dealt with --> before even opening your postgres ,navigate through the command line where the actual file is located and then open postgres and use \i filename.extension to execute your file.
    3)When installing postgres , always provide passwords without any alphanumeric characters like "$" otherwise it will throw an error during the installation phase ( I don't know what is that error as it was really vague but this worked for me).

    • @TheBenTonks
      @TheBenTonks 2 роки тому +4

      just so you know you can also change the data Mockaroo gives, you can set it to only be male and female

    • @khateebanwer7466
      @khateebanwer7466 2 роки тому +1

      @@TheBenTonks Thanks for the information , brother.

    • @MrMadmaggot
      @MrMadmaggot 2 роки тому

      In ubuntu when I try to import the person.sql it denies me the permission.

    • @Technomic-o
      @Technomic-o Рік тому +1

      Thanks man , can you please elaborate more on pointe 2 ? following the way mention on the video Im getting missing requirement error . i even went through the command line where the actual file is located and used \i filename.extension but still not able to execute it

    • @facundoarrascaeta3143
      @facundoarrascaeta3143 Рік тому +6

      @@Technomic-o I used i\ 'C:/Users/:myuser/Downloads/person.sql' on windows and it worked, you have to put the path in quotes

  • @phen2841
    @phen2841 2 роки тому +64

    For anyone who needs the resource link for 3:19:48 (Adding Relationship Between Tables): drive.google.com/drive/folders/1v0I19Ed2his8otHRLm5i6W7feD9sIMc6

  • @Terzaghi12
    @Terzaghi12 3 роки тому +52

    For Windows users, the command 'psql' only will work if you edit the environment variables and add 'C:\Program Files\PostgreSQL\13\bin' to your path, the 13 it's the version of Postgres i've installed.
    After that, the command you have to enter on the cmd or powershell is:
    psql -U postgres
    then it will ask for the password you set on the installation

  • @TheAremoh
    @TheAremoh 5 років тому +31

    From being scared to run sql command from command line to liking it. Thanks for this awesome video

  • @kieranbarker1902
    @kieranbarker1902 3 роки тому +98

    This video is excellent. I'm only as far as creating tables (around the 41-minute mark) but it's already better than the courses I could find on Udemy! Thank you! 🙏

  • @alexnavarro2628
    @alexnavarro2628 2 роки тому +23

    Seriously a 10/10 course! I sat down and watched this whole thing in a single session. I seriously appreciate your teaching style, and how well you explained everything. Thank you!

  • @madhanmurali4877
    @madhanmurali4877 4 роки тому +35

    Completed till WHERE Clause and you're getting straight to the point without wasting time. It is really helpful for a complete newbie like me. Thank you!

  • @gwagner3446
    @gwagner3446 5 років тому +56

    Dude, this course was VERY GOOD! Basically binged through the whole 4 hours and felt like no time! Very didactic and well explained. THANK YOU SO MUCH FOR THIS AMAZING CONTENT!!

  • @richard1991ish
    @richard1991ish Місяць тому +1

    also just going to take a moment to appreciate how excellent this tutorial is. Clear, concise, straight to the point with real-world examples. Worked through the whole thing, and learned a TON. TYSM! ⭐⭐⭐⭐⭐

  • @O_o___o_0
    @O_o___o_0 2 роки тому +170

    First thank you so much for this amazing course, easy to follow and straight to the point
    For those like me that will be learning on PostgreSQL 14, at 33:50 he uses the command
    psql --help
    for the option help and on Windows and PSQL 14 it's actually the
    \? options
    command that will give you the same result.

    • @SamareshMaity231
      @SamareshMaity231 2 роки тому +2

      thanks Johan

    • @olamideadigun9206
      @olamideadigun9206 2 роки тому +3

      So many things have changed with mockaroo too. My Gender column has 8 inputs so you don't have to add Hello to practice CHECK CONSTRAINT.

    • @SHrehman12
      @SHrehman12 2 роки тому +2

      OMG, Thank you

    • @kalamansihans
      @kalamansihans 2 роки тому +2

      thanks! I didn't notice this helpful comment. Anyway another work around I found for this is to go to the directory of the bin folder and enter psql --help. It works the same.

    • @ady4230
      @ady4230 2 роки тому

      Thanks man

  • @fahansheikh
    @fahansheikh Рік тому +25

    for user using ubuntu/linux(check if postgres is preinstalled in your system) following the installation steps may cause installation of two versions of postgres simultaneously which can cause unnecessary trouble for beginners.

  • @niyazi95
    @niyazi95 3 роки тому +17

    33:39 guys if you cant run "psql" command in the command line, you must add it to system environments, find the postgresql folder in C:\ and add its "bin" folder to "Path" variable in the env.

    • @divakarsiva623
      @divakarsiva623 3 роки тому +1

      @Niyazi Yildirim
      can u explain in detail....since many of us have the same problem

    • @mergenberdiyev8438
      @mergenberdiyev8438 3 роки тому +4

      @@divakarsiva623 Maybe it's already late, but here is a video how to do that ua-cam.com/video/0EBkVzIBnoc/v-deo.html&ab_channel=jinujawadm

    • @arpansingh4284
      @arpansingh4284 3 роки тому

      @@mergenberdiyev8438 Nope , its never late . Thanks !

    • @billyssk666
      @billyssk666 2 роки тому +1

      @@mergenberdiyev8438 This tutorial doesn't work with version 14. There is no "bin" folder with the psql.exe file. Anyone have another fix?

    • @yatskovych
      @yatskovych 2 роки тому

      @@billyssk666 worked just fine for me (version 14.1). Maybe you didn't see bin folder of psql.exe file

  • @maaxmith
    @maaxmith 3 роки тому +10

    To anyone getting an error when using the psql command in Windows Terminal:
    You need to add "psql" to your system path variables:
    - In the search bar, type "env" and click on "Edit the system environment variables"
    - Click on "Environment Variables"
    - Then, in the "System Variables" table, click on the column with the Variable name "Path" and then click on "Edit"
    - Click on "New" and paste the path to the "bin" folder of your psql installation. E.g. in my case, its "C:\Program Files\PostgreSQL\13\bin", but it could be different based on where you installed PostgreSQL or what version you have.
    Now restart the Console, and the command should work.

    • @BexruzXolmuminov
      @BexruzXolmuminov 3 роки тому

      thank you man.

    • @afunnykorean
      @afunnykorean 3 роки тому

      Im getting this prompt after I have typed "psql"
      Password for user "****":
      (Note "****" is my folder path, that looks like this when i open command prompt-> C:\Users\"****">)
      When i enter my postgressql database password, it says psql: error: FATAL: password authentication failed for user "****"
      My postgressql username is set to default, and not "****". Any idea what is causing this?

    • @afunnykorean
      @afunnykorean 3 роки тому +3

      I figured it out, you have to type:
      psql -U 'userName'

    • @maaxmith
      @maaxmith 3 роки тому +3

      @@afunnykorean or "psql -U postgres". I actually don't know the cause of that bug, but its at least easy to fix :)

    • @elBanananas
      @elBanananas Рік тому

      this should be top comment.

  • @adamrolczyk7217
    @adamrolczyk7217 2 роки тому +4

    It was my long long dream to learn Postgres. I watched the entire video almost in one sitting, making notes in vscode and using commands in terminal. Thank you so much for sharing this knowledge. Can't wait to use it to build something cool.

    • @sadramohh
      @sadramohh 2 роки тому +1

      Can we maybe have the notes? pretty please?

  • @franciscojavierramirezhern8588
    @franciscojavierramirezhern8588 5 років тому +32

    I had a lot of extra work trying to follow some parts of this awesome course, the difference between MacOS and Windows are tinny, but important, when you try to import file using \i you must have to use '/' not '\' and other differences that I had to search on google and stack, but finally.... Thanks for sharing this course, I appreciate this. I heard something that bad MySql settings are so dangerous and complicate to fix and protect from SQL injection, so, he said PostgreSQL is more secure and flexible, but I just looking for answers. Anyway, nice work! greetings!

    • @yepyepyep3
      @yepyepyep3 4 роки тому +2

      thanks! needed help with that exact part

    • @Nephros
      @Nephros 2 роки тому +1

      Thanks a lot

    • @tunmbi_okediran
      @tunmbi_okediran 7 місяців тому

      Yeah, thanks a bunch

  • @ugljesavojvodic3384
    @ugljesavojvodic3384 4 роки тому +16

    For Windows users it's even easier, even though it seems to be confusing, just enter database name when it ask for it.
    This how it looks in the shell:
    -
    Server [localhost]:
    Database [postgres]: test
    Port [5433]:
    Username [postgres]:
    Password for user postgres:your_pw
    -
    Please note when you connect for the first time you are actually connect to default one and that's why you don't enter any name, it will have name"postgres", and the owner is also default one, guess the name - "postgres".
    -
    When you login with all empty parameters you noted line in terminal like "postgres=#", well the part before "=#" is actually name of database, so in this default case "postgres".
    -
    You noted he has owner "amigoscode" (when he list all databases) , it's actually added role, check postgres documentation how to add role and change owner of table.
    -
    Also, when you are in "postgres=#" database you can easily switch to another (that is already created, it won't create it by itself) database using command:
    \c another_database_name
    (example: "postgres=# \c test"
    result: "test=#")

    • @pranayreddy7303
      @pranayreddy7303 3 роки тому

      thank u its really helpful
      could u please tell me how to clear the terminal

    • @ugljesavojvodic3384
      @ugljesavojvodic3384 3 роки тому

      ​@@pranayreddy7303 Actually I never clear terminal, no matter of what I am working on :)
      Try with \! clear
      Usually I just hit enter few times... :D
      Be aware of using ; at the end of sequence... It's mentioned in this tutorial.
      But during login to database, I'm not sure how can it be cleared...

    • @yatskovych
      @yatskovych 2 роки тому +2

      thanks so much! I was confused about switching to another DB, so I went to the comments. You rock

    • @ugljesavojvodic3384
      @ugljesavojvodic3384 2 роки тому +1

      @@yatskovych I'm glad to se it is helpful 👍 Thank for feedback.

    • @O_o___o_0
      @O_o___o_0 2 роки тому +1

      @@ugljesavojvodic3384 Man, thank you soooooo much! I ended up stuck with that yesterday and you made my day this morning 🤘🙏

  • @John-fd9fe
    @John-fd9fe 2 роки тому +13

    I love the fact that we have timestamps.
    I already knew a lot of SQL, I just needed to learn PostgreSQL and I could skip a lot of the lessons.
    Thank you very much.

  • @user-kn4oi9oh4i
    @user-kn4oi9oh4i Місяць тому +3

    Finished this in 3 days! Thank you good sir

  • @LordBenjamin1998
    @LordBenjamin1998 5 років тому +13

    One of the best tutorials out here for PostgreSQL, the explanation is clear and the pace of it is great for beginners. Props to you.

  • @chriswilson8584
    @chriswilson8584 5 років тому +30

    The best PostgresQL tutorial I've seen so far.

  • @prometheus8457
    @prometheus8457 2 роки тому +11

    To those on Windows, to clear the screen, run "\! clear" or "\! cls". Hope this helps.

    • @az-ni7hc
      @az-ni7hc 2 роки тому +1

      Awesome. Thanks a lot

  • @timothyajani7100
    @timothyajani7100 16 днів тому

    Finally I've faced my Fears. This is the best database course ever. I'll be done with the course today. I never knew database could be this easy. I'm so happy

  • @OladipupoPopoola
    @OladipupoPopoola 5 років тому +31

    Wow! I just finished this course and I must confess you took me from a noob to an intermediate pro. Thank you so much. but I can't fid your other courses.....please share link in reply. I really appreciate. God bless you bro.

  • @rohitdalal954
    @rohitdalal954 4 роки тому +16

    If you are on Windows, to insert the data using Mockaroo:
    \i 'C:\\INSERT\\YOUR\\PATH\\HERE';
    What a great tutorial this is. A simple and clear explanation.
    Thank you so much ;)

    • @BearRockin47
      @BearRockin47 4 роки тому +2

      G.O.A.T.

    • @pranayreddy7303
      @pranayreddy7303 3 роки тому +1

      atill i cant open the .sql file in terminal

    • @Dineshsharma-ec6ys
      @Dineshsharma-ec6ys 3 роки тому +1

      I got permission denied error help me out

    • @rohitdalal954
      @rohitdalal954 3 роки тому

      @@Dineshsharma-ec6ys Try to use single quote 'path' for the file path.

    • @adeyemiblessing
      @adeyemiblessing 2 роки тому

      Thanks a lot for this. Just saved me from fraustration

  • @gideonrichards1862
    @gideonrichards1862 3 роки тому +4

    Thanks you this was a really helpful course, even as we are now on 13.2. A couple of comments to aid the user of the tutorial, if I may:
    1) Please can you explain at the beginning how to get back to the =# prompt - I struggled on the Mac because the ctrl is ctrl button and not cmd button;
    2) Please can you explain how you clear the screen at the beginning of the tutorial;
    3) Please can yous tree at the beginning how important accurate typing is for the student;
    4) Please can you ensure when you are using a comma and not a dot (e.g. NUMERIC(19, 2)) that that is clear. I did miss that.
    Apart from that this has really helped me and I would recommend it to anyone doing PostgreSQL as a beginner. I will look up the longer more advance course!
    Kind Regards
    Gideon

  • @stalinengoma7680
    @stalinengoma7680 3 роки тому +3

    Very comprehensive video. I didn’t know about any database before and this man just plugged everything I needed to know how databases work. Thank you man

  • @AmanSinghYT
    @AmanSinghYT 4 роки тому +572

    ⭐️ Contents ⭐️
    ⌨️ (0:03:16) What is a Database
    ⌨️ (0:05:17) What is SQL And Relational Database
    ⌨️ (0:09:10) What is PostreSQL AKA Postrgres
    ⌨️ (0:10:53) PostgreSQL Installation (Mac OS)
    ⌨️ (0:14:21) PostgreSQL Installation (Windows)
    ⌨️ (0:17:38) GUI Clients vs Terminal/CMD Clients
    ⌨️ (0:21:39) Setup PSQL (MAC OS)
    ⌨️ (0:25:22) Setup PSQL (Windows)
    ⌨️ (0:30:15) How to Create Database
    ⌨️ (0:33:35) How to Connect to Databases
    ⌨️ (0:38:12) A Very Dangerous Command
    ⌨️ (0:41:37) How To Create Tables
    ⌨️ (0:45:46) Creating Tables Without Constraints
    ⌨️ (0:49:12) Creating Tables with Constraints
    ⌨️ (0:55:55) Insert Into
    ⌨️ (0:59:14) Insert Into Example
    ⌨️ (1:02:36) Generate 1000 Rows with Mockaroo
    ⌨️ (1:12:28) Select From
    ⌨️ (1:15:18) Order By
    ⌨️ (1:19:53) Distinct
    ⌨️ (1:21:59) Where Clause and AND
    ⌨️ (1:25:29) Comparison Operators
    ⌨️ (1:29:35) Limit, Offset & Fetch
    ⌨️ (1:32:43) IN
    ⌨️ (1:35:43) Between
    ⌨️ (1:37:45) Like And iLike
    ⌨️ (1:43:10) Group By
    ⌨️ (1:46:41) Group By Having
    ⌨️ (1:52:08) Adding New Table And Data Using Mockaroo
    ⌨️ (1:55:40) Calculating Min, Max & Average
    ⌨️ (1:59:48) Sum
    ⌨️ (2:01:55) Basics of Arithmetic Operators
    ⌨️ (2:05:59) Arithmetic Operators (ROUND)
    ⌨️ (2:09:43) Alias
    ⌨️ (2:12:32) Coalesce
    ⌨️ (2:16:15) NULLIF
    ⌨️ (2:20:21) Timestamps And Dates Course
    ⌨️ (2:23:21) Adding And Subtracting With Dates
    ⌨️ (2:25:58) Extracting Fields From Timestamp
    ⌨️ (2:27:28) Age Function
    ⌨️ (2:29:24) What Are Primary Keys
    ⌨️ (2:31:23) Understanding Primary Keys
    ⌨️ (2:36:26) Adding Primary Key
    ⌨️ (2:40:55) Unique Constraints
    ⌨️ (2:49:15) Check Constraints
    ⌨️ (2:54:45) How to Delete Records
    ⌨️ (3:01:36) How to Update Records
    ⌨️ (3:05:55) On Conflict Do Nothing
    ⌨️ (3:11:09) Upsert
    ⌨️ (3:16:41) What Is A Relationship/Foreign Keys
    ⌨️ (3:19:48) Adding Relationship Between Tables
    ⌨️ (3:25:04) Updating Foreign Keys Columns
    ⌨️ (3:29:30) Inner Joins
    ⌨️ (3:35:17) Left Joins
    ⌨️ (3:40:53) Deleting Records With Foreign Keys
    ⌨️ (3:47:27) Exporting Query Results to CSV
    ⌨️ (3:50:42) Serial & Sequences
    ⌨️ (3:57:18) Extensions
    ⌨️ (3:59:39) Understanding UUID Data Type
    ⌨️ (4:05:54) UUID As Primary Keys
    ⌨️ (4:16:30) Conclusion

  • @TubeSwarn
    @TubeSwarn 4 роки тому +16

    The teacher's pace is just awesome!! He is the best teacher in the world.

  • @banisan2035
    @banisan2035 2 роки тому +19

    Thank you so much for this tutorial! It always fills me with joy when so much effort is put into something that simply benefits everyone without expecting anything in return. So much wholesome altruism in the IT community.

  • @banisan2035
    @banisan2035 2 роки тому +37

    Hey everyone. For windows users on the mockaroo section: I encountered some problems importing the .sql file. Apparently psql doesn't accept the common backslashes \ that are used for paths on windows. So you need to use forward slashes / like on linux or mac. So for example, here's what I typed in psql:
    \i C:/Users/MyName/Desktop/person.sql

    • @olamideadigun9206
      @olamideadigun9206 2 роки тому

      I am stuck with "No such file or directory".

    • @Adivasi7777
      @Adivasi7777 2 роки тому +2

      @@olamideadigun9206 \i 'C:/wherever_you_downloaded_it/person.sql' ......Don't forget the single apostrophe...

    • @rezafadillah5129
      @rezafadillah5129 2 роки тому +1

      @@Adivasi7777 thank you bro

    • @rezafadillah5129
      @rezafadillah5129 2 роки тому +2

      thank you for the information

    • @hrishavdeka4187
      @hrishavdeka4187 2 роки тому

      thanks a lot I was stuck here for so long

  • @TonnySanjiao
    @TonnySanjiao 5 років тому +14

    Great work man. Thank you from Barcelona. I like your voice, it's very clear to understand to non English-speaking like me.

    • @yunjiehong4649
      @yunjiehong4649 4 роки тому

      Really clear accent! Easy to understand. Thank u, bro.

  • @vs4vijay
    @vs4vijay 5 років тому +59

    Very Informative!!!
    Watched the whole video in 1.25x speed. I would suggest to walk us through on TRIGGERS, VIEWS, INDEXING, TRANSACTIONS and JSON data handling.

    • @smyasir0
      @smyasir0 5 років тому +6

      good suggestion Soni !
      you know any tutorials regarding these ?

  • @ianawilsonn
    @ianawilsonn Рік тому +6

    Halfway through, and it's a great course so far. Some of the material is a little dated, as Postgresql has made some changes as they are at version 15+. For example: Postgresql uses "SELECT factorial(5);" now instead of "SELECT 5!;" to get the factorial of 5. Might be time for an updated course.

  • @zulfiqaralikhan3227
    @zulfiqaralikhan3227 3 роки тому

    I am from Pakistan yesterday I downloaded this video and watched it offline. After watching then I open youtube and search your video just for saying thank you for such a clear , simple and educated tutorial. Now I subscribed to your channel and will explore this channel. Keep it up sir

  • @arvi8843
    @arvi8843 3 роки тому +5

    Thank you so much for congratulating me by the end of this video for finishing this course. I learned a lot! 💯 💯 💯

  • @Ou8y2k2
    @Ou8y2k2 5 років тому +8

    1:21:60 should be 1:21:59 in the description. Thanks for the course.

  • @sarathradhakrishnan2135
    @sarathradhakrishnan2135 3 роки тому +9

    I must admit, this is way more better than some Udemy courses.

    • @reynaldlamury4772
      @reynaldlamury4772 3 роки тому

      there is also good course about postgreSQL there in udemy from Jose Portilla if iam not mistaken

  • @kasperkat2004
    @kasperkat2004 3 роки тому +2

    Nelson, you outdid yourself with this! I am using Windows and psql and it works. There are no problems with it. But I have been using command lines/terminals for years. Thanks again Lad.

  • @leondaz7380
    @leondaz7380 4 роки тому +8

    If you're having trouble in AVG, use this "SELECT AVG(price::money::numeric) from car;" and this basically casts the VARCHAR money to Money (adds commas every 3 numbers) and casts the result to a number (decimal) as numeric is an alias for decimal in postgreSQL.

  • @michaelvigato3228
    @michaelvigato3228 5 років тому +11

    Boi this is excellent, it's really hard to believe this is free

  • @vandergaming8952
    @vandergaming8952 2 роки тому +8

    There is a problem with the new Mockaroo options. You have to have a currency infront of the NUMERIC value, which creates a problem when importing the file into a terminal (at least in windows). you'd have to use Studio Code, Edit > Repalce > Find $ (whatever currency) and leave the replace with what as blank. Hold down enter until it replaced every line. Save and import.

    • @wOhtest
      @wOhtest Рік тому +1

      Thanks. Same thing on MAC. You literally save my dawn studying. Lol

    • @mitchelldirt
      @mitchelldirt Рік тому

      Alternatively you can change the data type to MONEY :)
      EDIT: You'll need to specify how you want to average your money type by doing AVG(price::numeric)
      NOTE: To output a factorial you'll need to use factorial(number) if using postgres >= 14

    • @samuelsunday9965
      @samuelsunday9965 Рік тому

      thank so much. I was stuck here before i saw your comment.

  • @kokoyoke2775
    @kokoyoke2775 3 роки тому

    Working as an oracle dba, even non IT employees could use this db.
    This is really help me to learn postgres, respect sir!!!

  • @kjane3390
    @kjane3390 4 роки тому +16

    I am only 8.42 minutes through and I already felt the urge to thank you for such an incredible video. I have a terrible attention span and I am genuinely excited for what the next 4 hours will bring. Thank you thank you thank you!!!!!

    • @user-xw4mu6nz4t
      @user-xw4mu6nz4t Рік тому +1

      Legend has it Mr. Terrible-Attention-Span still hasn't finished the video,

  • @StarBattle08
    @StarBattle08 4 роки тому +4

    1:53:33 Make sure the currency is set to none, otherwise it won't work if you use numeric for the type for the price

  • @shashanksingh4968
    @shashanksingh4968 Рік тому +2

    This is an awesome go to guide for learning Postgres SQL DB for an absolute beginner, you can get your SQL refreshed also along the way.
    I learnt a lot along the way, though the course is bit outdated for November 2022, have some execution errors for the queries shown in videos, but thanks to people in comment section who become savior and help the fellows out along the way.
    Happy Learning team. Let's code something! ❤❤

  • @mythic414
    @mythic414 2 роки тому +13

    Thank you for this video! You're a great teacher and the material was clear and straight to the point. Definitely one of the best online courses i've come across

    • @harlanreece2348
      @harlanreece2348 2 роки тому

      I am reaching out to you because your post appears to be the most recent. I have a basic question that you may be able to answer. No luck reaching Nelson.

    • @random-0
      @random-0 11 місяців тому +1

      @@harlanreece2348 you should have asked the doubt directly in the comment

  • @krzysztoflechowski81
    @krzysztoflechowski81 5 років тому +12

    you are great, I wish your tutorial was there when I started my SQL journey 15 years ago.

    • @kirollosmagdy275
      @kirollosmagdy275 5 років тому +5

      does it mean that after 15 years of experience , you're still looking for tutorials ? , omg what scary future do we juniors have 😅

    • @krzysztoflechowski81
      @krzysztoflechowski81 5 років тому +15

      @@kirollosmagdy275 you'll allways be learning as there's more to know, not that scary these days. I haven't worked on PG as much as on other databases. I knew it was great, but haven't had a chance in my projects. The more I appreciate how effective the author made it here.

  • @m.alisetiapratama6932
    @m.alisetiapratama6932 5 років тому +23

    What a timing! Just in time when I want to learn it. Appreciate it a lot guys!

  • @notsoaverageraj7917
    @notsoaverageraj7917 3 роки тому +20

    2:16:57 : "I have 10 apples and I want to divide it with 0 people"
    That totally makes sense as it sounds like my sibling.

  • @ciscogopro8481
    @ciscogopro8481 Рік тому +2

    Thank you Nelson, I went through the whole video and for the first time after so many tutorial finally I understood and learn about database and Postgres. Thank you do much for make easy for newbies.

  • @anandkulkarni6992
    @anandkulkarni6992 3 роки тому +14

    For those who are wondering where to run "psql" --> Run it in command prompt
    If it says 'psql' is not recognized as an internal or external command, operable program, or batch file.
    Set the path in an environment variable (ua-cam.com/video/0EBkVzIBnoc/v-deo.html)
    and run the command "psql -U postgres" in command prompt and enter your password

    • @yatskovych
      @yatskovych 2 роки тому

      Thank you! I tried simply running the command "psql", without "-U postgres", but it didn't accept my password. Thanks to you, I now realize that one needs to state the user by using -U

    • @tejaltelang3558
      @tejaltelang3558 2 роки тому

      Thank you very much!! I ran into the same problem and was looking for solution!

    • @venusbahrami2875
      @venusbahrami2875 2 роки тому

      I am trying to get the data that Nelson is referring to in the "Adding Relationship Between Tables" chapter. Can anyone help me find it?

    • @windows99
      @windows99 Рік тому

      What exactly is environment variable? Description to me looks like a background app, not a variable.

    • @varshamane2374
      @varshamane2374 Рік тому

      Thanks for your help .😊

  • @brian1801
    @brian1801 3 роки тому +9

    Nelson -- quite simply -- YOU ROCK!!! Seriously outstanding content, videos and presentation skills. Thank you for taking the time to create this awesome course. Wishing you nothing but the greatest success!

  • @martinpenchev2263
    @martinpenchev2263 3 роки тому +2

    NOT all HEROES wear CAPES, but this guys in not hero, he is a legend, A LEGEND, thanks man !

  • @vladimiraleksic4066
    @vladimiraleksic4066 6 місяців тому

    Great job. I am enrolled in the Code Institute online boot camp and the tutorials there cannot be compared with this material in terms of quality. Thank you a lot.

  • @Ian69885
    @Ian69885 5 років тому +18

    I can not thank you enough. you explain the subject way better than my lecturer

    • @diegopiscoya4318
      @diegopiscoya4318 5 років тому +3

      Lmao that seems to be a really recurrent event in cs matters

    • @shahman1
      @shahman1 5 років тому

      @@diegopiscoya4318 its true, surprisingly or unsurprisingly

  • @dalvandi
    @dalvandi 2 роки тому +3

    Tutorial really gets down to the basics and is a really good starting point for beginners like myself with no previous experience with databases! Especially cool that you covered the installation for both MacOS and Windows!

    • @xilllllix
      @xilllllix 2 роки тому

      indeed! what a great teacher and lecture! i feel like i can do whatever i want now with Postgres...

  • @rohankapur5776
    @rohankapur5776 2 роки тому +1

    wonderful course. I'm ditching nosql dbs for postgres permanently after this. thank you

  • @uddayagupta911
    @uddayagupta911 8 місяців тому +1

    It's 2023 the course still holds strong, one thing that I would like to mention is to also refer to the official postgres documentation side by side. Most of the things that you would need to run query on a database are listed in the video, but variety of some things is not covered, which you can learn on your own (read documentation). I would highly recommend watching this as your first beginner video as the explanation is really good. Some things you can only learn after working on projects, so don't worry about them.

  • @EuanFR
    @EuanFR 2 роки тому +3

    Really good, for beginners or as a refresher to prepare interviews.
    Just a small improvement that could be made: I was especting a chapter to explain (summarize) the differents types of alter table queries (ie ADD, DROP, MODIFY, CHANGE).
    It would be an honor to help you providing a french version of these courses.

  • @michabartoszek5749
    @michabartoszek5749 5 років тому +24

    Idk why, but commands: "psql --help" doesn't work on windows 10 in SQL Shell (psql), it only works in CMD. So it's not exact the same on windows as on mac.

    • @mconn86
      @mconn86 4 роки тому +5

      That is the way it is supposed to be. It's not clear in the video but he is running everything from the mac terminal (CMD shell is the equivalent in windows). He is calling psql from the terminal so if you were to type psql --help into the SQL Shell (psql) it won't work because you are already in psql

    • @thuyvuong9874
      @thuyvuong9874 4 роки тому +12

      @@mconn86 I tried running psql - - help in the cmd but I get an error, " is not recognized as an internal or external command operable program or batch file" . What am I doing wrong? The tutorial is so confusing because the commands don't work the same in windows.

    • @abdullaashraf1998
      @abdullaashraf1998 4 роки тому +1

      @@thuyvuong9874 you only need to add the directory of psql to the path variable

    • @nureyna629
      @nureyna629 4 роки тому +6

      @@thuyvuong9874 You are not alone!! I found myself difficult to follow this command on windows.

    • @sidm2290
      @sidm2290 4 роки тому +2

      @@thuyvuong9874 Even i tried to do same failed miserably even i added the environment to path. Did everything that can be possible but nothing worked out. So just stick to the pysql shell.

  • @itsReshad
    @itsReshad 2 роки тому +1

    I cant believe the quality of content and explanation in this video. Brilliant course explaining PostgreSQL. Very easy to follow - Highly recommend it!

  • @Lampalot
    @Lampalot 2 роки тому +1

    MashAllah brother such an amazing course, May Allah give you jannah !

  • @inventaunmanana4860
    @inventaunmanana4860 2 роки тому +5

    In 1:57:00 you might not be able to calculate the average of the price column. This happens if you generated the table using the dollar sign on the price.
    The solution I found is: cast price to a text, replace the '$' by nothing (' '), and cast back to numeric:
    SELECT AVG(REGEXP_REPLACE(price::text, '[$,]', '', 'g')::numeric) from car;

    • @venusbahrami2875
      @venusbahrami2875 2 роки тому

      can you say where we should use it?

    • @olakunleoluwatobi3054
      @olakunleoluwatobi3054 Рік тому

      Thanks, it worked.

    • @rgraptor2542
      @rgraptor2542 4 місяці тому

      This dollar sign also can cause an error, "invalid input syntax for type numeric",
      another way to fix if you don't want to regenerate the data is to go into the vscode file and highlight one of the dollar signs and ctrl+shift+L which should select every dollar sign then delete them and save it.
      edit: or someone else says you can switch the data type in the file from NUMERIC to MONEY

  • @michaelvigato3228
    @michaelvigato3228 5 років тому +54

    50:35
    Isn't a PRIMARY KEY attribute automatically also NOT NULL?

    • @panther-xc8929
      @panther-xc8929 4 роки тому +24

      Correct! Primary key columns cannot have NULL values, so it's pointless to define it there

    • @mahdipakravan676
      @mahdipakravan676 4 роки тому

      Actually , Not Null is unuseful command for primary

    • @Getaneh188
      @Getaneh188 3 роки тому

      Yes, primary key is not null and unique

    • @shimanshuyadav5654
      @shimanshuyadav5654 2 роки тому

      thanks bro even I had this doubt

  • @vedeshp3274
    @vedeshp3274 2 місяці тому +1

    I really appreciate everything in this course
    It was perfect course for me
    very nicely explained
    Thank You !
    If you can provide the link for the advanced postgresql course , that would be great!

  • @kevintran1488
    @kevintran1488 2 роки тому

    So I learned mySQL and Oracle in faculty, but I didn't remembered one thing and this course really gave me the courage to apply to a job. Thanks

  • @user-mv8nk8tl9r
    @user-mv8nk8tl9r 5 років тому +16

    Thanks from Russia. Great tutorial!

  • @mauroavellaneda9019
    @mauroavellaneda9019 3 роки тому +6

    Minute 24:57: To be able to write in bash profile or like in this case, zshrc, after you open the text editor, you need to type "i" to start typing.
    Another way of saving it is, when you finish what you need to type, press scape and then Shift + z + z. (two times "z")

  • @mgultas
    @mgultas 3 роки тому

    This video is one of the best SQL and PostgreSQL intro videos that I have come across. Thanks.

  • @abdikhaliqmohamoud3373
    @abdikhaliqmohamoud3373 2 роки тому +1

    The best and complete PostgreSQL Course out there.

  • @henrikflindt3086
    @henrikflindt3086 5 років тому +4

    These 4 hours was better than 15 + lecturers

  • @manishseal8990
    @manishseal8990 2 роки тому +3

    For 1:09:04, for windows user, type in the following command \i 'C:\\Users\\your_name\\Downloads\\person.sql'. (Take note of the double slashes and apostrophes)

  • @laurscode5778
    @laurscode5778 3 роки тому

    So I usually don't like tutorials but this one was really cool and the author really know what he is teaching about. Explained in a really easy way so everybody will understand that)

  • @farahanib4960
    @farahanib4960 2 роки тому

    All i can say is wow.. just from the very beginning, i added more learnings prior to what i have. Thanks a lot🙏and more power...👌

  • @hokage97531
    @hokage97531 4 роки тому +10

    I'm at 35:00, using windows and bversion 12 of PostgresQL, and the commands seem completely different.
    first off I get a prompt that says "(database name)=#", rather than the ~ he gets, second, the --h commans isnt working. I'm typing in "help" to get commands, and it says \h for sql help, and \? for psql help. I typed in \? assuming it would show me the same PSQL help it shows on the video, but it shows a completely different set of commands, al starting with \ instead of with --.
    I haven't watched the rest of the video, but so far it seems like it's different for windows. I hope not.
    EDIT: I did manage to do the rest of the tutorial without problems, it works on windows aswell, I just skipped this step in particular. Wonderful tutorial. However I'm having trouble trying to add a NOT NULL constraint to an already created row. Is this possible? I'm using " ALTER TABLE person MODIFY name VARCHAR(30) NOT NULL; " and it says there's a syntax error around modify. Any help?

    • @WatchcubeYT
      @WatchcubeYT 4 роки тому +1

      do 'ALTER TABLE person ALTER COUMN name SET VARCHAR(30) NOT NULL;' this might help

    • @darkdraconium
      @darkdraconium 4 роки тому

      Thank you for including this top bit, when it got to this point in the video I was dreading that this video might have already gotten out dated as I'm also working with 12 myself.

  • @tejasparekh6808
    @tejasparekh6808 4 роки тому +12

    Amazing explanation man!!! you just made my lockdown fruitful....thanks a lot.

  • @danielnadar75
    @danielnadar75 2 роки тому

    This is one of the best SQL course out there for FREE!!! I can't praise enough of this course and the instructor, I always feared SQL until I took this course and I can now call myself a SQL pro! Thanks Nelson for this amazing course.

  • @aditidump
    @aditidump 12 днів тому

    great tutorial nelson! very intuitive and well structured

  • @ruixue6955
    @ruixue6955 2 роки тому +3

    19:59 client
    20:53 Postico
    22:24 client in terminal: psql
    22:32 *-p* for the port
    25:58 connect to db with psql

  • @scienceofart9121
    @scienceofart9121 4 роки тому +9

    I'm only in the 20th minute but I liked this tutorial soo much, Thanks man !

  • @mmkamalraj8931
    @mmkamalraj8931 Рік тому

    End to End Postgres. Starting with SELECT * to JOINS in the same methodical explanation. Best vid to learn and practice postgres.

  • @shivangchaturvedi237
    @shivangchaturvedi237 Рік тому

    This is pretty much everything you need to learn PostgreSQL. Just these 4 good hours and you're good to go!

  • @christianhorauf9958
    @christianhorauf9958 3 роки тому +5

    Hint about loading data from an SQL-file (1h 2m-1h-12m): Since the Video has been shot, Mockaroo seems to have changed their policy for representing gender. When I tried to import the sql file I ran into the error ERROR: value too long for type character varying(7). This happens, because Mockaroo not only outputs Male and Female but also several other genders like 'Genderfluid', 'Non-binary', etc. To fix this change the size of the gender-colum to 25 in the CREATE TABLE command:
    create table person (
    id BIGSERIAL NOT NULL PRIMARY KEY,
    first_name VARCHAR(50) NOT NULL,
    last_name VARCHAR(50) NOT NULL,
    email VARCHAR(150),
    gender VARCHAR(25) NOT NULL,
    date_of_birth DATE NOT NULL,
    country_of_birth VARCHAR(50) NOT NULL
    );

  • @antonkorshunov4979
    @antonkorshunov4979 5 років тому +6

    My applause to the speaker! Enough deep and straightforward material at the same time!

  • @alexandrspiridonov9569
    @alexandrspiridonov9569 2 роки тому

    It is not the first PostgreSQL tutorial I watch, but this one is the best. Thank you)))))

  • @osjerick
    @osjerick 12 днів тому

    8:41 A relational database doesn't necessarily require relationships between tables to be considered relational. A 'relation' in this context is simply a table, which is a set of tuples (rows) with attributes (columns) drawn from different domains. This concept is fundamental to relational algebra.

  • @dvitsupakorn
    @dvitsupakorn 4 роки тому +23

    As for window user this is really confusing when you switch back and forth with shell batch since window SQL shell doesn't have it.

    • @David-2501
      @David-2501 4 роки тому +1

      Open the Windows Store
      Install Ubuntu
      Start Ubuntu
      Get cracking.

    • @BruceNorikane
      @BruceNorikane 4 роки тому +3

      @@David-2501 It is by no means that simple. I've implemented Ubuntu using the recent Windows 10 Windows System for Linux feature. When I started this course, I considered using Postgres in Linux. None of the material addresses using Linux or WSL. At the very least, learners would need a link to Windows 10 WSL start up guide, then the Ubuntu Linux guides.

    • @jpaldama9963
      @jpaldama9963 4 роки тому

      Build a VM with Linux OR use docker

    • @jpaldama9963
      @jpaldama9963 4 роки тому

      ​@@BruceNorikane I agree. I always recommend learning Bash CLI. for those that want to learn goto netacad dot com and create a free account and do linux essentials. its free. and its not expert level stuff but you will get the basics.

    • @rogerbacon7746
      @rogerbacon7746 4 роки тому +1

      @@BruceNorikane I know I'm late but if you're serious about programming get a mac or atleast use linux. It's for your own sanity.

  • @user-io4jl9ev3z
    @user-io4jl9ev3z Рік тому +7

    Thank you so much! Such a great job you've did. Wish you all the best and inspiration to learning people. Thank you again!

  • @renanfayad5237
    @renanfayad5237 7 місяців тому

    Thank you very much! Excellent course, great didactics, easy-to-understand english and well-explained content!

  • @melanieprevot4926
    @melanieprevot4926 Рік тому

    Definitely the best psql tutorial for beginners i have ever seen ! Thank you sir.

  • @HolgerJakobs
    @HolgerJakobs 5 років тому +49

    Since PostgreSQL is mostly used on Linux systems, they should be dominant and not missing in the installation part of this video.

    • @danibaba7058
      @danibaba7058 4 роки тому +4

      linux omegalul

    • @HolgerJakobs
      @HolgerJakobs 3 роки тому

      @@PatrickMcMunn The installation part is almost the same, whether you use Linux or a BSD system.

    • @pauloTx
      @pauloTx 3 роки тому +1

      Linux users are supposed to know how to do it.

    • @HolgerJakobs
      @HolgerJakobs 3 роки тому +2

      @@pauloTx Even among Linux users are some beginners. There are new Linux users every day.

    • @eduardoo31
      @eduardoo31 3 роки тому

      @@HolgerJakobs this is why it's so hard to get into linux. if you ask a question on stack overflow or something everyone assumes you are an expert and know what every command means...

  • @seannagle1714
    @seannagle1714 2 роки тому +4

    This is fantastic, and I am learning a lot. It is nice to have someone who takes it slow and allows you to follow through the command line perspective. Very helpful.
    One thing I think might be a mistake, or correct me if I am confused, but around 1:19:00 you give an example of "SELECT * FROM person ORDER BY id, email". I am pretty sure that SQL never gets to sorting by email considering the first item it is sorting by is a primary key. Am I right there? You make reference to the emails all starting with a at the top, but that must just be coincidental, no?
    Thanks a million for this video, and I look forward to finishing it and recommending it to anyone who wants to learn SQL!

  • @kimberlytacunanhuayllas9791
    @kimberlytacunanhuayllas9791 2 роки тому +1

    This is the best tutorial for beginners! Thank you so much..!

  • @earthmother4599
    @earthmother4599 2 роки тому

    Just finished; took a few days (I like to let info settle in) but worth every minute!
    Thank you!