1
00:00:05,360 --> 00:00:07,580
in this video we're going to install the

2
00:00:07,580 --> 00:00:09,860
sql lite three command line shell for

3
00:00:09,860 --> 00:00:12,500
Windows computers now if you're using a

4
00:00:12,500 --> 00:00:13,940
Mac or Linux machine

5
00:00:13,940 --> 00:00:15,770
skip to the next video or the video

6
00:00:15,770 --> 00:00:18,260
after that for your operating system but

7
00:00:18,260 --> 00:00:19,550
if you're in Windows you're in the right

8
00:00:19,550 --> 00:00:22,610
place so let's make a start now python

9
00:00:22,610 --> 00:00:24,650
includes sqlite in its standard

10
00:00:24,650 --> 00:00:26,630
library so we don't need to install

11
00:00:26,630 --> 00:00:28,310
anything to use sqlite in our Python

12
00:00:28,310 --> 00:00:31,670
programs now thing to keep in mind here

13
00:00:31,670 --> 00:00:33,410
that writing data base code

14
00:00:33,410 --> 00:00:35,240
straightaway isn't the easiest way to

15
00:00:35,240 --> 00:00:37,450
learn about sqlite and the sql

16
00:00:37,450 --> 00:00:40,060
language so if you get errors you have to

17
00:00:40,060 --> 00:00:42,490
work out if it's the error or the errors

18
00:00:42,490 --> 00:00:45,110
in your python code or in the sql

19
00:00:45,110 --> 00:00:47,830
statement that you've used so what we're

20
00:00:47,830 --> 00:00:49,630
going to do to start is we're going to

21
00:00:49,630 --> 00:00:51,970
start by installing the sqlite command line

22
00:00:51,970 --> 00:00:54,610
shell so that we can create databases

23
00:00:54,610 --> 00:00:56,410
and use sql commands without having

24
00:00:56,410 --> 00:00:58,810
to worry about Python code yet on

25
00:00:58,810 --> 00:01:00,610
Windows the sqlite command-line

26
00:01:00,610 --> 00:01:03,400
shell is an executable file called sql

27
00:01:03,400 --> 00:01:07,090
light three dot exe unfortunately this

28
00:01:07,090 --> 00:01:09,470
isn't included with python so this video

29
00:01:09,470 --> 00:01:11,210
we're going to see how to download that

30
00:01:11,210 --> 00:01:12,950
executable and add it to our computers

31
00:01:12,950 --> 00:01:14,780
path so that we can use it

32
00:01:14,780 --> 00:01:16,670
first things first we're going to go to

33
00:01:16,670 --> 00:01:25,070
the sqlite website....and

34
00:01:25,070 --> 00:01:26,360
you can see at the top we get there there's

35
00:01:26,360 --> 00:01:27,770
a download link so i'm going to click on

36
00:01:27,770 --> 00:01:31,340
that now there is actually an installer

37
00:01:31,340 --> 00:01:32,900
for sqlite instead it's packaged

38
00:01:32,900 --> 00:01:35,540
into a number of zip files now I mention

39
00:01:35,540 --> 00:01:37,430
that sqlite is included in the standard

40
00:01:37,430 --> 00:01:39,980
Python libraries so consequently we

41
00:01:39,980 --> 00:01:41,300
don't need to install sqlite

42
00:01:41,300 --> 00:01:44,330
itself the file we want actually is a

43
00:01:44,330 --> 00:01:46,610
bundle up command line tools for managing

44
00:01:46,610 --> 00:01:48,530
sql li like databases you can see we've

45
00:01:48,530 --> 00:01:50,060
got one here we've got a osx version

46
00:01:50,060 --> 00:01:52,160
there and down here we've got a windows

47
00:01:52,160 --> 00:01:54,250
version here a bundle of command line

48
00:01:54,250 --> 00:01:55,820
tools for managing sqlite databases

49
00:01:55,820 --> 00:01:57,800
i'm going to click on that link now

50
00:01:57,800 --> 00:02:00,050
bearing in mind when you're

51
00:02:00,050 --> 00:02:01,490
watching this video the version number

52
00:02:01,490 --> 00:02:03,950
may have changed but that's alright if

53
00:02:03,950 --> 00:02:05,480
it's a later version and click on that

54
00:02:05,480 --> 00:02:08,990
one and leave that downloading it's

55
00:02:08,990 --> 00:02:10,160
actually finished it was quite a quick

56
00:02:10,160 --> 00:02:12,680
download I do notice that the description

57
00:02:12,680 --> 00:02:15,280
for this file includes links to the

58
00:02:15,280 --> 00:02:17,780
three executables over here we've got

59
00:02:17,780 --> 00:02:18,980
the command line shell

60
00:02:18,980 --> 00:02:21,380
sql diff .exe and sqlite analyzer

61
00:02:21,380 --> 00:02:24,200
dot exe I suggest you bookmark

62
00:02:24,200 --> 00:02:25,820
this page so that you can come back here

63
00:02:25,820 --> 00:02:27,080
and check those links and in the future

64
00:02:27,080 --> 00:02:29,810
but the tool we need at the moment is the

65
00:02:29,810 --> 00:02:32,090
Command line shell so what we need to do is

66
00:02:32,090 --> 00:02:33,740
extract the contents of the zip file to

67
00:02:33,740 --> 00:02:35,210
a suitable directory and then add that

68
00:02:35,210 --> 00:02:37,430
directory to our path i'm going to do is

69
00:02:37,430 --> 00:02:39,890
just go to the folder where that is

70
00:02:39,890 --> 00:02:41,960
sqlite was opened and you can

71
00:02:41,960 --> 00:02:43,130
see that I've actually got sqlite tools

72
00:02:43,130 --> 00:02:45,770
there so I'm just going to extract

73
00:02:45,770 --> 00:02:47,870
all extracted currently in that current

74
00:02:47,870 --> 00:02:50,630
path for now it's quite quick because

75
00:02:50,630 --> 00:02:52,970
its only a small file what I'm going to

76
00:02:52,970 --> 00:02:54,380
do now we're going to move these

77
00:02:54,380 --> 00:02:55,730
I'm going to right-click that the

78
00:02:55,730 --> 00:02:58,310
folder that was extracted ok so I'm

79
00:02:58,310 --> 00:02:59,450
going to cut that folder and then what

80
00:02:59,450 --> 00:03:00,560
i'm going to do i'm actually going to

81
00:03:00,560 --> 00:03:04,220
put this in my users like sort of main

82
00:03:04,220 --> 00:03:06,140
home folder that you can put this in the

83
00:03:06,140 --> 00:03:07,970
program files directory or somewhere

84
00:03:07,970 --> 00:03:10,160
else doesn't really matter but for

85
00:03:10,160 --> 00:03:11,570
simplicity what i'm going to do is just

86
00:03:11,570 --> 00:03:15,500
go to my local disk into my users and

87
00:03:15,500 --> 00:03:16,880
Tim which is the folder that I'm

88
00:03:16,880 --> 00:03:18,110
gonna put it I'm going to actually save

89
00:03:18,110 --> 00:03:19,790
it in there but again the choice is

90
00:03:19,790 --> 00:03:21,080
yours to where you want to save it so

91
00:03:21,080 --> 00:03:23,270
i'm going to right click and do paste to

92
00:03:23,270 --> 00:03:25,520
put in it and that's now the folder

93
00:03:25,520 --> 00:03:28,220
I moved over and we double-click

94
00:03:28,220 --> 00:03:31,460
it now to open the folder what we can do

95
00:03:31,460 --> 00:03:33,350
up here is we can actually come up here

96
00:03:33,350 --> 00:03:35,210
and click the address bar and

97
00:03:35,210 --> 00:03:37,370
then click on control c that's

98
00:03:37,370 --> 00:03:38,930
actually gonna take a copy of the path

99
00:03:38,930 --> 00:03:40,940
which we can use to actually update the

100
00:03:40,940 --> 00:03:43,070
path on the computer now the

101
00:03:43,070 --> 00:03:45,440
instructions to set the path start off

102
00:03:45,440 --> 00:03:47,660
slightly differently depending on which

103
00:03:47,660 --> 00:03:49,300
version of windows that you're

104
00:03:49,300 --> 00:03:52,130
using i'm using Windows 10 here and if

105
00:03:52,130 --> 00:03:53,570
your keyboards got a

106
00:03:53,570 --> 00:03:55,940
Windows key the quickest way for all

107
00:03:55,940 --> 00:03:57,950
versions of windows is to use windows

108
00:03:57,950 --> 00:03:59,870
and pause i hold down the windows key

109
00:03:59,870 --> 00:04:01,430
press pause which I'm going to do or

110
00:04:01,430 --> 00:04:03,830
click pause that brings up this window

111
00:04:03,830 --> 00:04:06,050
here otherwise we just need to navigate

112
00:04:06,050 --> 00:04:08,660
to the control panel system and security

113
00:04:08,660 --> 00:04:10,880
and system on your version of windows

114
00:04:10,880 --> 00:04:13,370
to get access to it and then from here

115
00:04:13,370 --> 00:04:15,260
we can actually click on the advanced

116
00:04:15,260 --> 00:04:17,120
system settings on the left i'm going

117
00:04:17,120 --> 00:04:19,700
to click on that that takes you to the

118
00:04:19,700 --> 00:04:22,550
system properties dialog which is where

119
00:04:22,550 --> 00:04:24,320
all other windows version should

120
00:04:24,320 --> 00:04:26,360
already be so basically a couple of ways

121
00:04:26,360 --> 00:04:27,710
to get there but the bottom line is you

122
00:04:27,710 --> 00:04:29,570
want to get to this location and from

123
00:04:29,570 --> 00:04:31,640
here what we want to do is click on

124
00:04:31,640 --> 00:04:32,300
environment

125
00:04:32,300 --> 00:04:35,630
variables and just a quick note that if

126
00:04:35,630 --> 00:04:37,070
for some reason you couldn't get there

127
00:04:37,070 --> 00:04:39,110
with the windows key you can actually

128
00:04:39,110 --> 00:04:41,180
just a right click the my computer icon

129
00:04:41,180 --> 00:04:42,560
on your desktop and choose properties

130
00:04:42,560 --> 00:04:44,660
and you there as well

131
00:04:44,660 --> 00:04:46,880
alright so we're actually here now and

132
00:04:46,880 --> 00:04:49,130
what we want to do is come down here to

133
00:04:49,130 --> 00:04:52,520
where it's got the edit button are

134
00:04:52,520 --> 00:04:54,200
making sure that path is selected over

135
00:04:54,200 --> 00:04:56,510
here under user variables unless you

136
00:04:56,510 --> 00:04:59,090
really comfortable with doing this leave

137
00:04:59,090 --> 00:05:00,770
the system variable section down here at

138
00:05:00,770 --> 00:05:02,840
the bottom completely alone if you mess

139
00:05:02,840 --> 00:05:04,790
up the system path variables it can be

140
00:05:04,790 --> 00:05:05,930
really quite difficult to recover

141
00:05:05,930 --> 00:05:07,850
windows so you can get into difficulty

142
00:05:07,850 --> 00:05:10,430
so just you don't touch that area but

143
00:05:10,430 --> 00:05:11,990
under the user variable their may or may not

144
00:05:11,990 --> 00:05:14,270
already be a path variable as you can

145
00:05:14,270 --> 00:05:16,370
see here in my case it already exists

146
00:05:16,370 --> 00:05:17,420
and I actually got my python

147
00:05:17,420 --> 00:05:19,850
installation actually in the path but if

148
00:05:19,850 --> 00:05:21,200
you're not there

149
00:05:21,200 --> 00:05:22,910
you don't see a path variable you click

150
00:05:22,910 --> 00:05:26,240
on new and you actually specify the

151
00:05:26,240 --> 00:05:28,220
pathnames as path the word path and then

152
00:05:28,220 --> 00:05:29,690
you type in the value or paste in the

153
00:05:29,690 --> 00:05:32,000
value right here so put those details in

154
00:05:32,000 --> 00:05:33,680
but in my case because the path already

155
00:05:33,680 --> 00:05:36,560
exists i'm going to click on edit so

156
00:05:36,560 --> 00:05:39,080
select path click on edit and what we're

157
00:05:39,080 --> 00:05:41,180
going to do now is actually add the path

158
00:05:41,180 --> 00:05:43,490
now this is actually showing a new path

159
00:05:43,490 --> 00:05:46,280
variable being created on Windows 10 if

160
00:05:46,280 --> 00:05:48,020
your editing an existing path variable

161
00:05:48,020 --> 00:05:49,610
leave the name unchange just add a

162
00:05:49,610 --> 00:05:51,560
semicolon to the end of the previous

163
00:05:51,560 --> 00:05:53,720
value as a couple of ways of doing it

164
00:05:53,720 --> 00:05:56,030
but this is the new way on Windows 10

165
00:05:56,030 --> 00:05:57,230
where you click on new

166
00:05:57,230 --> 00:06:00,830
just actually paste in the value their

167
00:06:00,830 --> 00:06:02,720
for some reason the control

168
00:06:02,720 --> 00:06:04,850
c didn't work so just

169
00:06:04,850 --> 00:06:08,930
get back to the Explorer again i can

170
00:06:08,930 --> 00:06:10,040
actually just going to their we can make

171
00:06:10,040 --> 00:06:11,360
sure that that's actually showing like

172
00:06:11,360 --> 00:06:12,830
that I think that is what I did last time will

173
00:06:12,830 --> 00:06:15,380
control c their or right-click

174
00:06:15,380 --> 00:06:16,760
and do a copy for want to that way to

175
00:06:16,760 --> 00:06:19,550
copy that entire path and if I go back now

176
00:06:19,550 --> 00:06:22,190
to the system environment variables area

177
00:06:22,190 --> 00:06:25,610
click on new I can paste that in and

178
00:06:25,610 --> 00:06:27,290
that's now that variable that's been

179
00:06:27,290 --> 00:06:29,450
added so either way whether you've got

180
00:06:29,450 --> 00:06:30,950
the option to do it this way we've got

181
00:06:30,950 --> 00:06:33,350
an older way may just be shown the entire

182
00:06:33,350 --> 00:06:35,030
path got the old way

183
00:06:35,030 --> 00:06:38,210
go to the end the end of the paths

184
00:06:38,210 --> 00:06:40,190
settings that the various paths the

185
00:06:40,190 --> 00:06:42,710
defined on your system put a semicolon there and

186
00:06:42,710 --> 00:06:44,060
paste in the values but in this case

187
00:06:44,060 --> 00:06:45,870
this is a new way that Windows 10 does it

188
00:06:45,870 --> 00:06:47,730
you just select new and you enter another

189
00:06:47,730 --> 00:06:50,790
values there click on ok and what's

190
00:06:50,790 --> 00:06:53,040
happened now is that Windows 10 has

191
00:06:53,040 --> 00:06:54,600
actually updated our environment variable

192
00:06:54,600 --> 00:06:57,660
so click okay close it down i can click on ok

193
00:06:57,660 --> 00:07:00,450
their alright at that point the path now

194
00:07:00,450 --> 00:07:02,460
been set so what we can do now is check

195
00:07:02,460 --> 00:07:04,290
that the sqlite command line shell is

196
00:07:04,290 --> 00:07:06,720
working the easiest way to do that is

197
00:07:06,720 --> 00:07:09,240
just to come down to here you can either

198
00:07:09,240 --> 00:07:12,270
just type it if it's under Windows 10 type

199
00:07:12,270 --> 00:07:15,780
CMD alternatively you can actually click

200
00:07:15,780 --> 00:07:17,280
on the right click on the windows

201
00:07:17,280 --> 00:07:20,760
startup image down here right click

202
00:07:20,760 --> 00:07:22,590
and select run and the type cmd

203
00:07:22,590 --> 00:07:23,820
either way you get to the command line

204
00:07:23,820 --> 00:07:25,230
prompt block like you can see the screen

205
00:07:25,230 --> 00:07:27,060
there and what we can do now is type...

206
00:07:27,060 --> 00:07:30,510
...just to verify that sqlite 3

207
00:07:30,510 --> 00:07:32,460
is working and you can see that

208
00:07:32,460 --> 00:07:34,320
is actually working actually came

209
00:07:34,320 --> 00:07:36,240
up and started up for us and that's good

210
00:07:36,240 --> 00:07:38,040
and as we can see that the things

211
00:07:38,040 --> 00:07:40,650
are working nicely and keep in mind you

212
00:07:40,650 --> 00:07:42,570
may see a slightly different version

213
00:07:42,570 --> 00:07:44,610
number showing on the screen to what I got here

214
00:07:44,610 --> 00:07:46,050
but that's ok so long as it

215
00:07:46,050 --> 00:07:47,130
actually works

216
00:07:47,130 --> 00:07:49,230
it means it's the sqlite command

217
00:07:49,230 --> 00:07:51,690
line shell is ready to go we can

218
00:07:51,690 --> 00:07:53,580
start using that in future videos

219
00:07:53,580 --> 00:07:56,760
alright so type in....to get out of

220
00:07:56,760 --> 00:07:59,580
sqlite three and type exit to close down

221
00:07:59,580 --> 00:08:01,710
the command prompt window and at this point

222
00:08:01,710 --> 00:08:03,210
your good to go sqlite three is

223
00:08:03,210 --> 00:08:06,480
installed on your Windows machine unless

224
00:08:06,480 --> 00:08:08,370
you've got a mac and a linux machine

225
00:08:08,370 --> 00:08:10,140
also you can actually skip the next two

226
00:08:10,140 --> 00:08:12,180
videos and move on to start where we

227
00:08:12,180 --> 00:08:14,490
actually start using sqlite3 i'll

228
00:08:14,490 --> 00:08:20,420
see you in the next video

