Hello everyone it's Eddie the Magic Monk in the following lessons I'm going to
take you guys through some SQL which is the language that is used to interact
with databases and we're going to learn this in the environment Microsoft Access
so if you don't have Microsoft Access it's probably easier if you get it if
you want to follow through this tutorial it's just part of the Microsoft Office
suite so if you open up Microsoft Access the first window my version is access
2016 the first window you will just create a blank desktop database so just
click that and choose where you want to save it so I'm going to save it called
let's say tutorial.accdb and where you want to save it you can change the
folder path if you want to save it somewhere else click create and you can
see that it's opened up your database with one single table so I'm going to
delete this table because I want to
let's close the table and let's go to tables oh there is no table anyway it
wasn't created yet so yeah this is a totally blank database it's got nothing
in it so we're going to start off by getting you guys to create a table in
SQL so you're going to click create query design and then this thing shows
up don't worry about it just click close and then you're going to click on SQL
view okay you can access it by clicking SQL view or click SQL view on the bottom
right it means the same seeing so click SQL view and the first
query we're going to do is to create a table so SQL is pretty simple if you
want to create a table you can just type create table and type the name of your
tables so let's say I'm going to make a simple database for a small school so
I'm going to have students all right. So each student is basically going to have a
student ID so let's put S_id and let's make it an integer and let's
make it not null which means it's not going to be allowed to have any empty
rows so we can't add a row where a student does not
have a student ID and we're also going to make it the primary key and the
reason for that is because every student is going to have a different ID so we
can use it to identify every single student so student ID is the primary key
and for each student we're going to store their last name and it's going to
be a variable character which means a character, sorry, a field with however
many characters they want up to let's say or guess a name will only be up to
let's say 50 characters can't imagine a name would be more than that actually let's
just put 100 to be safe so each student needs a lastname firstname
actually a hundred is probably too many let's just get it fifty and then address
Oh in that case let's give it more more characters you can only have up to 255
characters and let's say each person then has a phone number and let's give
it an integer again because phone numbers are basically numbers and if you
want a number with a decimal then the code for that is basically
let's say we got print balance so how much money they have in their printer
account now let's make it float meaning that it's a decimal number but you're
going to have to change your settings later for how many decimals you want
them to have and let's say that is it so close the bracket finish it off and if
we run it right now it should create a table to run and you can see here that a
table has showed up in students and if you open up students you can see that we
have just created a table and it's got all these fields in it now you can also
go into the design view of the table and you can see that these are basically the
the field names and the data types that you've assigned okay so the SQL did work
and the text fields have a field size of 50 so they did work okay so that is the
first tutorial how to create a table we will learn how to insert some data in
the next tutorial thanks for watching see you next time.