This course is designed to take someone that has no experience with relational databases and teach them how to at least create, read, update, and delete. We'll explore many different aspects of SQL and what makes working in relational databases easy. This video also goes over how to install postgres on your machine so you can follow along.
Instructor: [00:00] SQL stands for Structured Query Language. It's a language we use to communicate with relational databases. Relational database is the idea of storing data in tables that contain rows and columns.
[00:12] For example, if you think of Microsoft Excel, within Excel we have columns and we have rows. Tables are referred to as relations, columns are referred to as attributes, and each row is referred to as a record or tuple.
[00:26] Some popular relational databases you've probably heard of are Microsoft SQL Server, Oracle database, MySQL, and Postgres. These are popular choice because relational databases help developers and database admins easily categorize and store data that can be queried for exact data sets.
[00:45] They're usually easy to set up and new tables can be created without needing to modify existing applications. They also provide accurate data, because it's stored only once unless designed not to.
[00:58] SQL is flexible and dynamic, meaning tables and lots of data can be meshed together for one returning result and has great security practices if they are utilized. This course is designed for beginners and those who have heard of SQL but just have not had the chance to get their hands dirty with it.
[01:17] Some of the takeaways I want you to have after going through this course is the ability to at least read from, write to, delete from, create and update rows, columns, and tables.
[01:27] We'll be using Postgres throughout this course as the database we'll run our SQL queries against. You'll find as you're working on the databases, like the ones I mentioned, don't exactly have the same types, built-in functions, errors, and other miscellaneous items. Everything that works within this course might not be 100 percent in other relational databases, but it will get you really close.
[01:49] Core commands like update, select, delete, and create are pretty universal between them, there are just a few subtle differences throughout each. After watching each lesson, be sure to check out the notes of the video. I'm posting links to various DB docs on the lesson topic so that you can dive more into them. I mentioned that this course is using Postgres for each lesson.
[02:10] If you're on a Mac it can be easily installed through the package manager Homebrew. I'll link in the video notes how to install Homebrew if you don't have it. Once it's in there, all you need to do is go to your terminal and run brew install Postgres. If you're on Windows download the interactive installer from the Postgres docs.
[02:27] This installer is pretty straightforward and will get you up and running quickly. You'll know that everything was installed correctly when you type psql Postgres in your terminal and you connect to your local database.
After installing postgres on Ubuntu 18 (via WSL) using official documentation https://www.postgresql.org/download/linux/ubuntu/, I run into multiple issues. This comment might help someone who also wants to install postgres on WSL. First issue was about how to run server, because
psql was complaining. In order to resolve that I had to do following:
After that, in order to run psql I used following command:
sudo -u postgres psql postgres
I ran into this issue.
$ psql postgres psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I did this to get it to work.
$ brew services start postgresql ==> Tapping homebrew/services Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'... remote: Enumerating objects: 14, done. remote: Counting objects: 100% (14/14), done. remote: Compressing objects: 100% (9/9), done. remote: Total 14 (delta 0), reused 8 (delta 0), pack-reused 0 Unpacking objects: 100% (14/14), done. Tapped 1 command (43 files, 59.6KB). ==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql) $ psql postgres psql (11.5) Type "help" for help. postgres=#
Do you have to create a database first ?
Do you have to create a database first ?
Hi @blackoperat, if you're talking about this lesson all you would have to do ins download and install postgres everything else will walked through in the lessons. Let me know if that helps!