00:01
Hello students, so to construct an sql schema definition for a car rental company database so we can use the concept of an inheritance to represent the special data for the different types of vehicles.
00:15
So here i am representing an sql schema with the definition for the databases.
00:22
So here you can see the first is the create table vehicles.
00:26
So in a create table vehicles what you are performing here you are first initially creating a table for all the vehicles.
00:34
So you can say it is an you create a table like it is a table for all the vehicles.
00:48
So now you can see in this table the vehicle table stores the common attributes of all the vehicles and it includes all the vehicles all the common data of all the vehicles and it includes the vehicle identification number that is vehicle id in of int of primary key.
01:09
So it will be a primary key vehicle id.
01:11
So next will be the license number of the vehicle, its manufacturers, its model and its date of purchase and the next we also consider the color and the type of the vehicle.
01:25
So type of the vehicle it includes like the it is like a truck, a sports car, van or what it is.
01:32
Each specialization of type of vehicles those are like trucks, sports car, vans, off -road vehicle has its own table now.
01:42
We are creating their own table.
01:44
So example here we are creating for table create a table for the truck.
01:50
So here for the truck you can see each specialization table has a foreign key of a constants of vehicle id for this table create table truck, create table sports car, create table vans, create table off -road vehicles.
02:07
So they all have their vehicle id as the foreign key.
02:13
It is a foreign key that is referencing the primary key of the vehicle tables.
02:18
You can see in a truck table the vehicle id that is it is a end primary key.
02:26
Fine.
02:26
Here your next van or your truck is out it is it has some wheels specified with its cargo capacity.
02:34
So the foreign key which we are referring is to the vehicles the main table vehicles vehicle id...