Now, if we do compare SQL to NoSQL,
the obvious question that comes up,
is which approach should be chosen?
And the answer which you get very often in programming,
is that there is no clear winner.
Both approaches are fine,
both database systems are after a place in the world.
And both database systems are extremely popular
and are getting used a lot by big and small companies.
So, there is no single database system
that would be better than the other systems.
You can also use both database systems
for all kinds of use cases.
If you're building an online shop
and you need to store products and customers and orders,
you could build that with a relational database
and have an orders, a customers, and a product table,
or you build it with a NoSQL database,
and work with less tables.
So, there is no clear decision criteria
when it comes to choosing a database system.
Now, what can help with choosing a system,
is to think about the queries you'll be running
and the kind of data you'll be storing,
and how often you're going to write data
and how often you're going to read data.
By the way, in very big websites,
you could also work with both systems
and store different kinds of data
in different kinds of database systems.
So, it's also not that either or option.
But there are a couple of things you can keep in mind.
For example,
SQL databases have the advantage
of providing more structures and rules.
That can help you when you plan your website
and when you plan your database,
and it can enforce some data strictness,
which can help you as your website grows,
and as you gain more and more traffic,
because you can't accidentally store
a lot of different data,
which then could become difficult to query in the future.
On the other hand,
this could also be a downside
because as your web application grows,
your use cases for the data might also change.
And if you have a certain structure and schema in place,
it could then become difficult to handle
all possible use cases
since you can't easily change your schema.
You can, but it always means more work.
So, this can be both an advantage or disadvantage,
but especially if you're getting started with databases,
in my experience,
it tends to be more of an advantage.
Now, the advantage of NoSQL databases as I mentioned,
is that they can be a bit more flexible
because there is no fixed schema.
And if you have a database where you,
for example, read a lot of data,
then the NoSQL databases could really shine
because you can have simpler queries there,
where you don't need to join a bunch of tables,
but where instead,
you can get more data with less queries
and therefore you might have better performance.
And speaking of performance,
if you think about super large websites
and web applications with millions of active users
on a single day,
then SQL databases tend to have some scalability issues.
There are strategies for overcoming these issues.
And as I said,
you could use SQL databases for some parts of your website
and maybe go for a NoSQL databases for other parts,
but due to their simplicity when it comes to storing data,
NoSQL databases tend to outperform SQL databases
for large amounts of data
and large amounts of visitors and queries.
However, that always is under the assumption
that the database is used and implement correctly.
You can definitely use a NoSQL database in the wrong way,
and then it will lead to worse performance
than a SQL database and the other way around.
So, the ultimate answer is,
there is no clear winner here.
NoSQL databases tend to be very popular these days,
but both databases have their strengths and weaknesses,
and both databases are being used by large companies
for all kinds of use cases and scenarios.
That's why in this course,
we will also cover both systems
so that you can make your own decisions
and more importantly,
so that you are prepared to then dive deeper
into either system,
depending on what you need for your next project,
your next job, or whatever it is.