1
00:00:05,320 --> 00:00:08,920
Welcome everyone to this lecture, which is going to give an overview of databases.

2
00:00:09,890 --> 00:00:13,910
Now, put simply, databases allow us to store information that we can use on our website.

3
00:00:14,360 --> 00:00:19,940
And we should briefly cover how SQL based databases work so we can understand that Django models analogous

4
00:00:19,940 --> 00:00:24,500
operations that interact with that database, and we'll be talking about those in the very next lecture.

5
00:00:25,840 --> 00:00:30,200
Now, sequel databases are tabular, similar to a spreadsheet like Excel.

6
00:00:30,640 --> 00:00:37,420
But students often ask us the question What about no SQL databases like MongoDB, where no SQL stands

7
00:00:37,420 --> 00:00:38,910
for not only sequel?

8
00:00:39,340 --> 00:00:43,120
Let's quickly explore the visual difference between SQL versus no sequel.

9
00:00:44,400 --> 00:00:49,680
Sequel, as we mentioned, stores data in a tabular format, and this includes things like a column

10
00:00:49,680 --> 00:00:56,910
name and then rose defined by some sort of index often called a primary key in the sequel syntax.

11
00:00:57,210 --> 00:01:00,660
Now here we can see an ID column, a name column and a color column.

12
00:01:00,900 --> 00:01:04,530
And then each row is an individual entry like John or Mary.

13
00:01:05,160 --> 00:01:11,520
Not only SQL formatting, such as MongoDB stores the data and a key value pair format very similar to

14
00:01:11,520 --> 00:01:12,780
a Python dictionary.

15
00:01:13,140 --> 00:01:19,590
So we can see here that same information just in a NoSQL format where you have ID, the name and color.

16
00:01:21,470 --> 00:01:26,660
Now, the next question we're often asked is, which is better NoSQL databases or school databases?

17
00:01:27,140 --> 00:01:30,890
And the simple answer is one format is not better than another.

18
00:01:30,920 --> 00:01:32,690
They're just different ways of storing data.

19
00:01:33,170 --> 00:01:37,880
However, you should note that if you're working with Django and Django models, they're designed to

20
00:01:37,880 --> 00:01:41,000
work really well with a tabular skill based format.

21
00:01:41,330 --> 00:01:43,580
So that is what we're going to choose for this course.

22
00:01:43,880 --> 00:01:48,690
That isn't to say that Django can't work with MongoDB or not only sequel formats.

23
00:01:48,710 --> 00:01:52,970
In fact, there's plenty of libraries that you can easily install in order to connect Django models

24
00:01:53,240 --> 00:01:56,120
to a not only sequel or a no sequel database.

25
00:01:56,270 --> 00:02:01,660
However, right out of the box, Django works so well sequel that we would highly recommend that we

26
00:02:01,940 --> 00:02:05,280
that you work with that first before moving on to no sequel.

27
00:02:05,300 --> 00:02:06,440
If you feel the need to.

28
00:02:07,370 --> 00:02:12,090
Now, keep in mind, for most applications, a sequel tabular database is going to be completely fine.

29
00:02:12,110 --> 00:02:16,100
And again, if you're beginning of Django, you should try to stick to a sequel before making a jump

30
00:02:16,100 --> 00:02:16,880
to no sequel.

31
00:02:17,150 --> 00:02:22,330
And you should really carefully consider if no sequel actually provides a major advantage to your project.

32
00:02:22,340 --> 00:02:25,320
You shouldn't just choose no sequel because you think it sounds cool.

33
00:02:25,340 --> 00:02:30,050
It should be pretty necessary rather than just upgrading to a larger sequel database.

34
00:02:31,560 --> 00:02:36,810
So then speaking of a sequel database and sequel engines, we have to actually choose the type of sequel

35
00:02:36,810 --> 00:02:39,210
engine we're going to operate in and there's lots of options.

36
00:02:39,210 --> 00:02:43,260
There's my sequel sequel, I PostgreSQL, my sequel and many more.

37
00:02:44,250 --> 00:02:50,190
Jingo is actually pretty agnostic to most major sequel engines with the use of a single model system,

38
00:02:50,520 --> 00:02:54,720
so switching to another single engine, it's really more a matter of updating settings about pie and

39
00:02:54,720 --> 00:02:59,460
pointing it to your new SQL database rather than rewriting the actual Python Django code.

40
00:02:59,850 --> 00:03:04,110
Pretty much what we discussed in this lecture concerning models and Django and actually writing that

41
00:03:04,110 --> 00:03:07,950
Python code is going to work with any sequel database as a back end.

42
00:03:08,250 --> 00:03:10,110
So you don't really need to learn anything different.

43
00:03:10,170 --> 00:03:14,910
If you decide to use a different SQL engine, so then when it comes to the choice, we're going to end

44
00:03:14,910 --> 00:03:20,400
up using SQL light because it's actually already included and installed along with Python.

45
00:03:21,090 --> 00:03:26,190
Often, students who read up a little bit on school life will typically think of it as a smaller scale

46
00:03:26,190 --> 00:03:26,940
SQL engine.

47
00:03:27,570 --> 00:03:32,160
However, you should keep in mind that for many use cases, school actually performs just fine.

48
00:03:32,460 --> 00:03:37,410
And in fact, you can check out their official documentation on this called SQL, like the force when

49
00:03:37,410 --> 00:03:38,820
to use HTML.

50
00:03:39,210 --> 00:03:43,670
And keep in mind, it's a great choice when you're starting out because it's already installed and included

51
00:03:43,680 --> 00:03:45,060
if you already have Python.

52
00:03:45,090 --> 00:03:47,850
There's nothing necessary to add on or install.

53
00:03:49,160 --> 00:03:53,870
And you should also note that school light, while it's typically thought of as a smaller scale database,

54
00:03:54,140 --> 00:03:59,150
it actually can't scale to quite a large database and from their official website, they say quote.

55
00:03:59,450 --> 00:04:04,370
Generally speaking, any site that gets fewer than 100000 hits a day should work fine of school.

56
00:04:05,060 --> 00:04:10,280
And keep in mind that 100000 hits a day figure is a conservative estimate, not some sort of hard.

57
00:04:10,280 --> 00:04:15,800
Upper bound and scale has been demonstrated to work with up to 10 times that amount of traffic.

58
00:04:16,070 --> 00:04:18,529
So that would be up to a million hits a day.

59
00:04:18,680 --> 00:04:23,270
So since you're just learning off Django right now, it's probably unlikely that you're going to immediately

60
00:04:23,270 --> 00:04:26,000
jump to some million a day website.

61
00:04:26,240 --> 00:04:30,830
And if you're at that scale, you would probably end up hiring people to actually run the website for

62
00:04:30,830 --> 00:04:32,810
you instead of being some sort of sole developer.

63
00:04:33,110 --> 00:04:36,140
So we're going to say SQLite is going to be totally fine for our use case.

64
00:04:36,350 --> 00:04:41,840
And even if our site ends up being a really big hit and gets 100000 hits a day, it should still work

65
00:04:41,840 --> 00:04:42,710
fine if sequel like.

66
00:04:43,820 --> 00:04:48,320
OK, so what we're going to do is continue to explore these concepts by discussing Django models.

67
00:04:48,650 --> 00:04:53,300
And once you learn about the Django model system, you're going to begin to clearly see why a sequel

68
00:04:53,300 --> 00:04:57,950
is probably the better choice in regards to starting out with Django, because many of the actions and

69
00:04:57,950 --> 00:05:02,930
Python code with Django models are a one to one connection to something in a sequel database.

70
00:05:03,260 --> 00:05:04,790
Let's explore that in the next lecture.

