SQL Tutorial for Beginners 1: Installing PostgreSQL and Creating Your First Database
Skills:
SQL Analytics90%
Key Takeaways
This video tutorial covers the basics of setting up a PostgreSQL server and creating a first database, including installing PostgreSQL and a graphical interface program called PSequel, and creating a database using SQL commands.
Full Transcript
hey everybody how's it going in this video we'll be learning the basics of SQL queries from the ground up now SQL is a great language for programmers to learn because it's hard to find a software system these days that doesn't talk to some type of database on the back end and not only is it a great thing to know but it's also a good starting point for certain people who are interested in getting started in computer science because in my opinion it's not nearly as difficult as learning the ins and outs of a programming language like Python or JavaScript or Java I mean there are just a limited number of commands and for most jobs you're going to be using the basics of SQL such as grabbing values from a database that meet a certain criteria or something like that now there are times when more advanced queries are going to be needed but if you learn the basics then it's going to put you in a position where you can do the majority of the queries and then you can learn the more advanced stuff whenever you're ready so with that said let's go ahead and get started so in this video I'm going to show you how I set up my environment so that I can run SQL queries and also we're going to create our first database and connect to that database now for these tutorials I'm going to be using a Postgres database now I'm on a Mac so I'll show you the process that I went through to set this up on my machine so first we're gonna need to install Postgres and on the Mac the easiest way to do this is with the Postgres dot app now if you search in google here for Postgres Mac the first result is the official website and if we open up that website you can see that they have a downloader here but then they also recommend the Postgres app here as a simple native Mac app that runs in the menu bar without the need of an installer and that's what I think is the easiest so I already have that pulled up here but if you run the search it's the second result here this Postgres dot app so now that we're in this website we can just download like this like any other application so let's go ahead and run that download so now once that download is finished let's go ahead and unzip this and now let's go ahead and move this application over to our Applications folder so I've already got that pulled up here I'm gonna drag that on over okay now with that Postgres app installed that's going to give us a Postgres server that we can talk to using the command line now the command line isn't the best way to visualize what's going on so we're also going to want a graphical interface program to inspect our databases now on the Postgres app website that i had pulled up earlier they list a few of their favorite GUI tools here so I'm going to click on this link and these are some of the GUI tools that they recommend now the tool that I'm going to be using for these tutorials is this one down here near the bottom called P sequel now if you prefer another option then go ahead and use what you like but the reason that I chose this program is because it's very clean it has a simple layout and it also has the ability to enlarge fonts which a few of the other one surprisingly didn't have now these features are important to me because recording these videos I don't want a lot of windows and stuff getting in the way and also I want to make the font large enough for you guys to be able to see what I'm typing so let's go ahead and download this program just like we did the other one and then we're also going to move that to our Applications folder so let's go ahead and unzip this and I will open up Applications folder again and just drag this over here okay now with both of these programs installed let's first start our sequel server by Ronit up by running this Postgres app so now we can see that our server is running because if we look up here in the top menu we can see that this little elephant icon here and it says running on port 5 4 3 2 now it's also going to pop up this window here with this option to open P SQL and what that's going to do is it's going to open up the command line for us to start typing in commands now I know that the command line can be intimidating to some people but we're not going to be in here for long all we're gonna do is create a database that we can work with so to create this database it's just as simple as running the command create database and we're gonna call this sample underscore DB and we need to end this with a semicolon so let's go ahead and hit enter there and you can see that it says create database now there's a piece equal command here backslash L if we run that then we can view the databases that we have here and you can see that it created a few for us whenever we first installed the program but we can see here that we do have this sample underscore DB now to quit out of this command line we can do this backslash Q and it takes us back to our normal terminal so now I quit out of the command line there because we're not going to need to use it anymore because the command line it's not the prettiest way to see what's going on in our database so let's connect to the sample database that we just created using the P sequel application that we downloaded earlier so I'm going to go ahead and launch that now if you get this little error here cannot be opened because developer cannot be confirmed that's because I double clicked it's a weird thing with the Mac if you actually right click it and click open then it'll give you the option to override that and just open that up anyway now you'll see that with certain applications so now that we have this application opened up we're going to connect to our database and we're going to accept most of the defaults here you can see the port is 5 4 3 2 the same one that's listed whenever we right-click on our server it says it's running on port 5 4 3 2 the one thing that we are going to want to change here is that we're going to want to type in the database that we created so we called that sample underscore DB and now we can go ahead and connect to that database and we've successfully connected to the database now there's nothing here right now that's because we don't have any tables or any information within our database yet but we are in a position now to where we can begin writing a sequel command so for example if I wanted to create a table here I could create a table we'll just call this test underscore table now I'm not going to go too far into the details here because I'm going to go go into this further in another tutorial but if I just create a very basic table here with one column I can run that query and if i refresh our tables over here then we have a test table with one column called a so in this tutorial we installed a Postgres server we created the database and then we also installed a visual application to where we can visually inspect this database and we've also set it up to where we can now run SQL queries against this database so in the next tutorial we'll start adding tables to our database and we'll go over exactly how to do that so I hope this tutorial was useful for you guys if you have any questions just ask in the comment section below be sure to watch the other videos to get more in depth in the SQL commands and thank you all for watching
Original Description
In this video we will begin learning SQL Basics. To get started writing SQL, we need to first set up a server and a database. The server we will be using for these tutorials is Postgres. We'll walk through how to download, install, and setup PostgreSQL. Then we will create our first database so that we can begin writing SQL code. Let's get started.
✅ Support My Channel Through Patreon:
https://www.patreon.com/coreyms
✅ Become a Channel Member:
https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join
✅ One-Time Contribution Through PayPal:
https://goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
http://a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
https://www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - http://coreyms.com/
My Second Channel - https://www.youtube.com/c/coreymschafer
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Instagram - https://www.instagram.com/coreymschafer/
#SQL #Postgres
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Corey Schafer · Corey Schafer · 52 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
▶
53
54
55
56
57
58
59
60
Web fonts using CSS Font Face
Corey Schafer
Using Font Awesome in Desktop Applications (OS X)
Corey Schafer
Sublime Text 2: Setup, Package Control, and Settings
Corey Schafer
ArcGIS API for JavaScript Part 1: Our First Web Map
Corey Schafer
Mac Tip: Windows' Snapping Feature on Mac with HyperDock
Corey Schafer
Linux/Mac Terminal Tutorial: Creating Aliases for Commands
Corey Schafer
ArcGIS API for JavaScript Part 2: Starting Templates
Corey Schafer
Paver Patio Time Lapse
Corey Schafer
Mac Tip: Ways to perform Screen Capturing and Screenshots
Corey Schafer
WordPress Plugins: Imsanity
Corey Schafer
WordPress Tips: Test your theme with Theme Unit Test and Monster Widget
Corey Schafer
Sublime Text 3: Setup, Package Control, and Settings
Corey Schafer
Understanding Binary, Hexadecimal, Decimal (Base-10), and more
Corey Schafer
Mac Tip: Adding Folder Stacks to the Dock
Corey Schafer
CSS Tips and Tricks: Add External URLs to Print Stylesheets
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 7 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 1 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 5 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 4 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 3 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 2 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 6 of 7)
Corey Schafer
Python Tutorial: if __name__ == '__main__'
Corey Schafer
Sublime Text Quick Tip: "Go To Definition" Click Shortcut
Corey Schafer
How to quickly create favicons for the desktop, Apple/Android devices, tablets, and more
Corey Schafer
Easily Resize Multiple Images Using Picasa
Corey Schafer
Easily Resize Multiple Images Using the Mac Terminal
Corey Schafer
Python Tutorial: virtualenv and why you should use virtual environments
Corey Schafer
Python Tutorial: pip - An in-depth look at the package management system
Corey Schafer
Git Tutorial: Using the Stash Command
Corey Schafer
How Software Engineers, Developers, and Designers can volunteer their skills
Corey Schafer
Git Tutorial: Diff and Merge Tools
Corey Schafer
Git Tutorial: Change DiffMerge Font-Size on Mac OSX
Corey Schafer
Sublime Text Quick Tip: Launch Sublime Text from the Terminal
Corey Schafer
Python Tutorial: str() vs repr()
Corey Schafer
Programming Terms: DRY (Don't Repeat Yourself)
Corey Schafer
Programming Terms: String Interpolation
Corey Schafer
Programming Terms: Idempotence
Corey Schafer
Python Tutorial: Namedtuple - When and why should you use namedtuples?
Corey Schafer
Programming Terms: Mutable vs Immutable
Corey Schafer
Python Tutorial: Else Clauses on Loops
Corey Schafer
Overview of Online Learning Resources
Corey Schafer
Mac OS X Terminal Tutorial: Time-Saving Keyboard Shortcuts
Corey Schafer
Git Tutorial for Beginners: Command-Line Fundamentals
Corey Schafer
Quickest and Easiest Way to Run a Local Web-Server
Corey Schafer
Python Tutorial: Generators - How to use them and the benefits you receive
Corey Schafer
Python Tutorial: Comprehensions - How they work and why you should be using them
Corey Schafer
Chrome Quick Tip: Quickly Bookmark Open Tabs for Later Viewing
Corey Schafer
Programming Terms: Combinations and Permutations
Corey Schafer
Git Tutorial: Difference between "add -A", "add -u", "add .", and "add *"
Corey Schafer
Preparing for a Python Interview: 10 Things You Should Know
Corey Schafer
SQL Tutorial for Beginners 1: Installing PostgreSQL and Creating Your First Database
Corey Schafer
SQL Tutorial for Beginners 2: Creating Your First Table
Corey Schafer
SQL Tutorial for Beginners 3: INSERT - Adding Records to Your Database
Corey Schafer
Linux/Mac Terminal Tutorial: Navigating your Filesystem
Corey Schafer
Python: Ex Machina Easter Egg - Hidden Message within the Code
Corey Schafer
Mac Tip: New Split Screen Feature in El Capitan
Corey Schafer
Setting up a Python Development Environment in Eclipse
Corey Schafer
Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits
Corey Schafer
SQL Tutorial for Beginners 4: SELECT - Retrieving Records from Your Database
Corey Schafer
More on: SQL Analytics
View skill →Related Reads
📰
📰
📰
📰
Exploratory Data Analysis (EDA) — New York city Yellow taxi — Part 1: Data Preparation
Medium · Data Science
Segmentando Clientes com Análise Fatorial e Clustering
Medium · Data Science
From Four Platforms to One: How Tongcheng Travel Built a Unified Data Integration Platform with…
Medium · Data Science
Longitudinal Data Infrastructure
Medium · AI
🎓
Tutor Explanation
DeepCamp AI