I need to create a derived attribute Age that calculates the age of the tuple based on its Datebought attribute. I found that it can be made with views, but I have no idea on where to put the view.
CREATE TABLE Kids_Bike(
BikeId ID,
BrandName VARCHAR(max),
ModelName VARCHAR(max),
DateBought DATE,
/*??????????????????????*/
Age (SELECT datediff(day, DateBought , GETdate()) / 365.2425 ) DECIMAL,
Color VARCHAR(max),
StationId ID,
TrainingWheels BIT,
PRIMARY KEY (BikeId),
FOREIGN KEY (StationId) REFERENCES RentingStation(StationID)
);