-: Hi guys, and welcome back.
I hope you're doing great.
In this video, we're going to be setting up our
local SQL development environment when you're programming,
and that includes programming in SQL is a good idea
to type things out and try them out as you go along.
So that's why it's a good idea to download a SQL Data Viewer
so that you can create your database
and start typing out the commands
and trying them out as we go along.
So let's get to it.
I recommend you download SQLite browser
to download it just go to sqlitebrowser.org/dl.
And you'll find they've got Windows,
Mac OS and Linux builds and so forth.
We're going to cover how to instal it on Mac OS here in
this video and on windows in a future video,
but it's really quite straightforward.
In Windows, you wanna download the standard installer
for either 32 bits or 64 bits.
For most of you, you'll want 64 bits
and for Mac OS just download the latest release here.
Now that that's downloaded, we can click it
and go ahead and instal it.
You'll see that when opening it up on Mac OS,
you get your installer icon in your desktop.
And then when that opens,
you can simply drag the application over
to your applications.
And in my case, I've already got it.
So it's asking me what I wanna replace,
which I do wanna do, since this is a later version.
And that's it, you've got it.
Now I've gone ahead and opened DB Browser for SQLite here.
And you can see that it looks kinda tricky,
kind of complicated.
You've got a few things going on.
But don't worry, we're gonna go over exactly
how you use it.
The first thing to do when you're working with SQLite
is you want to create a database.
A database is gonna hold tables,
tables are gonna hold your rows and columns.
So let's go ahead and create a new database.
I'm going to put it just in my home folder
anywhere you want is fine.
I'm gonna call it data.db.
It's quite common for SQLite databases
to have the.db end file suffix there.
So you can use that if you want.
Alternatively, you can use .sqlite.sqlite3
or.db3.
Now that we've got that,
and the DB Browser will ask us whether we want
to add a table and it pops up with this window
for adding your table definition,
I'm just gonna cancel out of that
and show you how you can create your own tables
whenever you want.
And that's what this button here on the left,
just click CREATE TABLE, and you get the same thing back.
We're going to create a table here
that I'm gonna call users.
And notice that as you type here,
you get down here the SQL equivalent of all the things
that we're doing with our graphical interface.
So we're going to learn more about create table
as we go along and also in the next video.
And but this shows you what the application is executing on
the SQLite database in text format.
Now we can add fields
and one field is one column in traditional database peak.
So we're gonna add a new column
and I'm gonna call it first name.
And the type that I'm gonna use is text.
You've got integers for whole numbers, reals, and numerics
for non-whole numbers blob for like all other data,
text is simply for text, these check boxes here,
we're going to learn more about
them as we go along the course.
So don't worry about them just now,
we're also going to add another field that is surname,
that is also going to be text.
Again, we'll explore the other data types
and everything else in here in due course.
Okay, so let's press OK.
And we've got our first table here.
It tells you how it was created,
and you've got the name in there.
Now at any point,
you can create new tables by clicking
the CREATE TABLE icon up there.
If we want to execute arbitrary SQL commands,
as we will be learning throughout the course,
we want to go to the execute SQL tab.
And here we've got a place to write our SQL code,
I'm going to type a SQL query here, select star from users,
we're going to learn everything about this syntax
as we go along in the next few videos.
But for now, I'm just gonna type this query in here end it
with a semicolon,
and then press this button here to play the query.
Notice that if we have any results, i.e,
if we had already put some data into our table,
which we haven't done yet,
then we would get that data output in this square here.
Finally, the output from the server
that gives us a little bit of information about
what happened is shown at the bottom and it says result,
zero rows returned in two milliseconds.
So that was pretty quick.
And then it tells you what run.
So at line one, we run this query here,
notice that that matches exactly what we typed.
You've got a few more options up here in terms of you know,
printing out your results and things like that.
You can explore them if you want, but we will only be using
the play command, which allows us to run the queries here.
All right, that's it for getting set up.
As you can see, it's pretty straightforward.
We've created a table.
And now in the next video we're going
to learn more about the CREATE TABLE command
and what we can do with it by typing
the SQL out ourselves and exploring a few of its options.
So I'll see you in the next video.