Can I create a view that needs to calculate its variables using multiple variables from multiple tables? <p>So I am trying to learn how to work with databases and php but I have run into some trouble concerning whether I can make a view for what i need or if i would just need to get all the variables into a php function and calculate it there.</p> <p>Here is the database structure i have decided for the project. (The premise is setup a database and webpage for a truck rental company if it helps.)</p> <pre><code>Vehicles(vehicleId, size, gas) Price(size, price) Customer(customerId, firstname, lastname, streetaddress, city, state, zipcode, email, company) Rental(rentId, customerId, vehicleId, startdate, enddate, tank(0=full positive=number of gallons missing from tank), damage(0=none)) </code></pre> <p>So the view in this example i am trying to create would calculate the total cost for each rental for easy display</p> <p>total cost is <code>price of specific vehicle size * number of days rented (if returned on same day is 1) + (tank * 5) + damage</code></p> <p>The view would also contain the rentalId, and customerId to make it simple to search for total amount spent.</p> <p>can i do this in mysql or would it need to be done in php?</p>