title: How to use trigger in sql to create a certain attribute
body: <p>I have a question here. If a car that is under service is not available to be rented out. Then how do I create an attribute titled 'availability' that determines whether a car is available to be rented out? By using the trigger effect/or any other conventional method, how can I create an availability attribute that determines whether the car can be rented out based on the service period in this table.</p>
  <pre><code>CREATE TABLE VehicleService (
  vehicleServiceID    int (16) AUTO_INCREMENT,
  vehiclePlateNumber  varchar (8),
  serviceStartDate    datetime,
  serviceEndDate      datetime,
  servicePeriod   int(4)  AS (TIMESTAMPDIFF(DAY, serviceStartDate, serviceEndDate))
  location     varchar(255)
  CONSTRAINT pkvehicleServiceID PRIMARY KEY (vehicleServiceID),
  CONSTRAINT fkvehiclePlateNumber FOREIGN KEY (vehiclePlateNumber) REFERENCES Vehicle 
  (vehiclePlateNumber));
  </code></pre>