In this video we're going to start designing our database to store the data coming from our farm.
So far our database we will be using a school server Express and we will be designing at least two tables
based on what we have here one to store the rental record and another one to store the type of car because
well this is a drop done this and that this stuff cars is subject to change.
Maybe one gets added one gets taken away you know.
So we want to create a table where we're actually storing the list of cars available for rental.
So a first step is to install a secure express addition.
So if you already have a school server then you're fine but if you don't then you can proceed to go
to Microsoft comes that I mean give you the link or I can just google Askew a server and then when you
get to this site you just think downloads and the one that we're interested in is express so you can
get developer you can get the Express expresses you know it's free and it's a smaller edition so it
takes less to install less time and fewer resources but then developer is fully featured and it's you
know it takes a longer time.
So for this purpose I would encourage that you just get express you won't be losing much along the way
anyway and then it's a straight forward installation step you can check all my youtube video on the
installing it if you need some more guidance but you can go ahead and install it and the management
studio and then I'm going to just pick up from the fact that the management studio has been installed
the server husband installed and then we start designing our database now after installing a secure
server.
EXPRESS you'll be able to open the management studio and then you'll be able to log into your server
so you'll see the name of your P.C. backslash and the name Eskew will express and once you see that
you can just connect if you don't see that then you probably want to you can drop me a line and ask
me for some guidance.
Otherwise if you click on it and you're unable to connect then you probably want to go and do your services
check for askew Express and make sure that that service is running and then you can try again either
way feel free to reach out to me for further details though once you have connected to your server you
can start building your database.
So I'm going to just right click
and click new database.
This launches a dialog box I'm going to call my database car rental and then I click Okay.
Once the database is created it will appear in the object explorer to your left.
So I'm just going to drill down both the tables right click and trick new and I'm creating a new table
so the first table that I'm creating like I said is car rental.
So I'll see what the table is for the car into a red card.
So the data that I intend to collect would be in keeping with what I would have designed my form to
colleagues.
So I want the customer name the cost the data into their data returned and the type of car are it's
a type of car will be a foreign key.
So at this stage I'm hoping everybody on the basic database design and why we have foreign keys and
primary keys.
If not then you can tickle my other course on database development.
I have my Chris soft escudos server for everyone and I have my Eskew a data base development and mastery.
So both those courses bring an end to end with database development and they explain why we have foreign
keys and relationships and all those things.
So I'm not going to spend this course going through those details I'm going to continue assuming that
you have the basic information.
So we need table to collect these fields and then we have another section for a foreign key and we remember
we're creating another table just to keep the types of cars and that will inform the dropdown list here.
So back in my school server management studio I went to go ahead and create the car Intel table first
with an idea of type int.
And it will be foreign key primary keys sorry.
So right.
Say said primary key.
And I wanted to be auto incrementing so I got down to the identity selection and see is it easier.
So I just looked at the No.
And it becomes yes.
And that means it will count automatically.
Right.
The other field I want is customer name.
And this one can be in via char maybe a hundred characters long.
Next I want the date for entered and Askew it actually has a date time data type also on dates returned
and this also will be a beat time data type.
I do believe I had costs.
So on cost and this would be double so they do have a double.
Do the double.
Some of those some flawed stimulus verify that is a data type it is not.
It's actually a decimal.
Sorry about that.
So in it for cost.
We're using decimal and we can leave that default sitting there and then I'm going to see a car or type
of car I.D. So type of car I.D. And that's integer we can leave it at that.
Then we can click save.
So we can save here or control us and then we're seeing this as a car and a red card.
All right.
So the table name is car into a record.
And once again it will have all the basic details surrounding an actual car in tow.
So if I walked into the place or into a car and they put me in that application the expectation is that
when they fill this form with my information and the details of their info it will get saved in this
table.
All right.
So the next thing that's I want to do is create another table and that is just for the list of cars.
So I go back to object explorer or I click open a new table and then I want an I.D..
And this is integer right click set its primary key and then make its identity scrolling through the
properties go into identity selection dropping it though and is identity should be.
Yes.
All right.
And then I want the name of the vehicle.
So I just want I.D. and name.
That's literally all I want.
I want each car to have its own I.T. unique identifier and its name.
Right.
And I'm going to meet that that's an n var char of size 50.
All right.
And then I see of this table and I'm calling these types of cars.
So that's all I want.
The next thing I need to do is make a relationship between the I.D. or the primary key for the type
of car and the the column that is supposed to be the foreign key for the type of car.
So I just right click anywhere instead of the design view for either table really.
And then I see relationships.
Well actually no.
Not for either two.
I wanted for car into a record so I right click instead of car into the record and then I go to relationships
click ad and then I drop down the tables and specifications when I need to drop it down I just don't
need the ellipses really.
So I just think it's this ellipses button and then it's going to see it whereas a Primary Key table
the Primary Key is coming from the type of car table or the types of car stable and the column that
is the primary key is I.
And then the field in car and so that it matches to is type of car I.D..
So I dropped bone and then I'm just making the link something that a primary key from the types of cars
table should reflect in the type of car i.e. the column in the car in the record table.
Right.
And then click Okay.
Click close and then save.
And then all things being equal everything should be all right.
If you get an error that point does make sure that they're both in.
So here in the foreign key table or in the car into a record table.
This should be in it.
And the primary keys should also be if those steps are foreign to you or you're not familiar with them
once again I encourage you to just go through my course.
My school developed the database development and mastery or Microsoft school serve for everyone.
Those two courses will get you up to speed with everything you need to know about database design.
So far no.
That's it for designing our database that we are.
You know we developed to a company or wind farms application in the next video we will look at how we
actually link this application to the database.