1
00:00:02,200 --> 00:00:05,210
Now, if we do compare SQL to NoSQL,

2
00:00:05,210 --> 00:00:07,400
the obvious question that comes up,

3
00:00:07,400 --> 00:00:10,610
is which approach should be chosen?

4
00:00:10,610 --> 00:00:14,300
And the answer which you get very often in programming,

5
00:00:14,300 --> 00:00:16,920
is that there is no clear winner.

6
00:00:16,920 --> 00:00:19,090
Both approaches are fine,

7
00:00:19,090 --> 00:00:22,630
both database systems are after a place in the world.

8
00:00:22,630 --> 00:00:26,950
And both database systems are extremely popular

9
00:00:26,950 --> 00:00:31,620
and are getting used a lot by big and small companies.

10
00:00:31,620 --> 00:00:34,310
So, there is no single database system

11
00:00:34,310 --> 00:00:36,840
that would be better than the other systems.

12
00:00:36,840 --> 00:00:39,500
You can also use both database systems

13
00:00:39,500 --> 00:00:41,760
for all kinds of use cases.

14
00:00:41,760 --> 00:00:43,560
If you're building an online shop

15
00:00:43,560 --> 00:00:47,370
and you need to store products and customers and orders,

16
00:00:47,370 --> 00:00:50,640
you could build that with a relational database

17
00:00:50,640 --> 00:00:54,190
and have an orders, a customers, and a product table,

18
00:00:54,190 --> 00:00:57,490
or you build it with a NoSQL database,

19
00:00:57,490 --> 00:00:59,710
and work with less tables.

20
00:00:59,710 --> 00:01:02,507
So, there is no clear decision criteria

21
00:01:02,507 --> 00:01:06,420
when it comes to choosing a database system.

22
00:01:06,420 --> 00:01:09,590
Now, what can help with choosing a system,

23
00:01:09,590 --> 00:01:13,270
is to think about the queries you'll be running

24
00:01:13,270 --> 00:01:15,540
and the kind of data you'll be storing,

25
00:01:15,540 --> 00:01:18,320
and how often you're going to write data

26
00:01:18,320 --> 00:01:21,160
and how often you're going to read data.

27
00:01:21,160 --> 00:01:23,220
By the way, in very big websites,

28
00:01:23,220 --> 00:01:25,810
you could also work with both systems

29
00:01:25,810 --> 00:01:27,700
and store different kinds of data

30
00:01:27,700 --> 00:01:30,100
in different kinds of database systems.

31
00:01:30,100 --> 00:01:32,773
So, it's also not that either or option.

32
00:01:33,990 --> 00:01:37,300
But there are a couple of things you can keep in mind.

33
00:01:37,300 --> 00:01:38,133
For example,

34
00:01:38,133 --> 00:01:40,540
SQL databases have the advantage

35
00:01:40,540 --> 00:01:44,270
of providing more structures and rules.

36
00:01:44,270 --> 00:01:47,660
That can help you when you plan your website

37
00:01:47,660 --> 00:01:50,290
and when you plan your database,

38
00:01:50,290 --> 00:01:54,440
and it can enforce some data strictness,

39
00:01:54,440 --> 00:01:57,510
which can help you as your website grows,

40
00:01:57,510 --> 00:02:00,210
and as you gain more and more traffic,

41
00:02:00,210 --> 00:02:03,050
because you can't accidentally store

42
00:02:03,050 --> 00:02:05,250
a lot of different data,

43
00:02:05,250 --> 00:02:09,310
which then could become difficult to query in the future.

44
00:02:09,310 --> 00:02:10,210
On the other hand,

45
00:02:10,210 --> 00:02:11,820
this could also be a downside

46
00:02:11,820 --> 00:02:14,790
because as your web application grows,

47
00:02:14,790 --> 00:02:18,030
your use cases for the data might also change.

48
00:02:18,030 --> 00:02:21,650
And if you have a certain structure and schema in place,

49
00:02:21,650 --> 00:02:24,710
it could then become difficult to handle

50
00:02:24,710 --> 00:02:26,490
all possible use cases

51
00:02:26,490 --> 00:02:29,920
since you can't easily change your schema.

52
00:02:29,920 --> 00:02:33,460
You can, but it always means more work.

53
00:02:33,460 --> 00:02:36,670
So, this can be both an advantage or disadvantage,

54
00:02:36,670 --> 00:02:40,340
but especially if you're getting started with databases,

55
00:02:40,340 --> 00:02:41,600
in my experience,

56
00:02:41,600 --> 00:02:45,040
it tends to be more of an advantage.

57
00:02:45,040 --> 00:02:48,550
Now, the advantage of NoSQL databases as I mentioned,

58
00:02:48,550 --> 00:02:51,320
is that they can be a bit more flexible

59
00:02:51,320 --> 00:02:53,730
because there is no fixed schema.

60
00:02:53,730 --> 00:02:56,730
And if you have a database where you,

61
00:02:56,730 --> 00:02:58,960
for example, read a lot of data,

62
00:02:58,960 --> 00:03:02,040
then the NoSQL databases could really shine

63
00:03:02,040 --> 00:03:05,130
because you can have simpler queries there,

64
00:03:05,130 --> 00:03:08,110
where you don't need to join a bunch of tables,

65
00:03:08,110 --> 00:03:09,340
but where instead,

66
00:03:09,340 --> 00:03:12,370
you can get more data with less queries

67
00:03:12,370 --> 00:03:15,730
and therefore you might have better performance.

68
00:03:15,730 --> 00:03:17,710
And speaking of performance,

69
00:03:17,710 --> 00:03:21,760
if you think about super large websites

70
00:03:21,760 --> 00:03:25,950
and web applications with millions of active users

71
00:03:25,950 --> 00:03:27,470
on a single day,

72
00:03:27,470 --> 00:03:32,470
then SQL databases tend to have some scalability issues.

73
00:03:33,560 --> 00:03:37,430
There are strategies for overcoming these issues.

74
00:03:37,430 --> 00:03:38,270
And as I said,

75
00:03:38,270 --> 00:03:42,580
you could use SQL databases for some parts of your website

76
00:03:42,580 --> 00:03:46,700
and maybe go for a NoSQL databases for other parts,

77
00:03:46,700 --> 00:03:50,930
but due to their simplicity when it comes to storing data,

78
00:03:50,930 --> 00:03:55,930
NoSQL databases tend to outperform SQL databases

79
00:03:55,930 --> 00:03:57,950
for large amounts of data

80
00:03:57,950 --> 00:04:01,670
and large amounts of visitors and queries.

81
00:04:01,670 --> 00:04:04,690
However, that always is under the assumption

82
00:04:04,690 --> 00:04:08,610
that the database is used and implement correctly.

83
00:04:08,610 --> 00:04:12,320
You can definitely use a NoSQL database in the wrong way,

84
00:04:12,320 --> 00:04:14,530
and then it will lead to worse performance

85
00:04:14,530 --> 00:04:17,603
than a SQL database and the other way around.

86
00:04:18,540 --> 00:04:20,480
So, the ultimate answer is,

87
00:04:20,480 --> 00:04:22,998
there is no clear winner here.

88
00:04:22,998 --> 00:04:27,000
NoSQL databases tend to be very popular these days,

89
00:04:27,000 --> 00:04:31,180
but both databases have their strengths and weaknesses,

90
00:04:31,180 --> 00:04:35,260
and both databases are being used by large companies

91
00:04:35,260 --> 00:04:38,930
for all kinds of use cases and scenarios.

92
00:04:38,930 --> 00:04:40,460
That's why in this course,

93
00:04:40,460 --> 00:04:43,360
we will also cover both systems

94
00:04:43,360 --> 00:04:45,650
so that you can make your own decisions

95
00:04:45,650 --> 00:04:47,040
and more importantly,

96
00:04:47,040 --> 00:04:50,120
so that you are prepared to then dive deeper

97
00:04:50,120 --> 00:04:51,870
into either system,

98
00:04:51,870 --> 00:04:54,780
depending on what you need for your next project,

99
00:04:54,780 --> 00:04:57,483
your next job, or whatever it is.

