From the course: Angular: Creating and Hosting a Full-Stack Site

Why MySQL?

From the course: Angular: Creating and Hosting a Full-Stack Site

Start my 1-month free trial

Why MySQL?

- [Instructor] So now that we have our client side built out and a rudimentary server with a few routes, it's time to start integrating a database into our backend. And this will enable us to store users' data and persist that data indefinitely. In this course, the database we're going to be using is MySQL. Now, MySQL is an extremely popular database management system and it's also open source, which means that it can be installed and used for free. First of all, as you might have guessed by the name, MySQL uses SQL to make database queries. In practice, SQL queries can get really as complex as you need them to be but in this course we'll be keeping our queries as simple as possible. So don't worry if you're not already familiar with SQL. This will be a great opportunity to get your first contact with it. The second thing to know about MySQL databases, if you haven't already worked with them, is that they're relational databases. What this means is that the data they contain is structured into rows and columns. Now, rows are basically just individual records, such as users or in our case, listings. And columns denote the different pieces of data that each record has such as name, description, price, et cetera. The data in our database is also organized into different tables, each of which contains records that all have the same column attributes. So we might have a users table that contains all of our website's users and a listings table with information such as the listings ID, name, description, and price, as well as the user ID of the user who listed it and whatever other stuff we need to store about each of our listings. Now, you may have heard of a different kind of database called a non-relational or a NoSQL database. Mongo DB is probably the most popular of these databases. In contrast with relational databases, which is what we're going to be using in this course, non-relational databases primarily store unstructured data. And usually what this means is that instead of storing data in rows and columns, the data in these non-relational databases is just stored in JSON objects. And there are certain trade-offs to doing this, none of which is really going to be relevant for this course. For now, I just wanted you to be aware of the distinction here. At the end of the day, it's best just to try both ways and see which is best for you. But in this course, we're going to be using a relational SQL database.

Contents