Add to the trucking company model a little, (Http web server)
Friday, December 21st, 2007Add to the trucking company model a little, as shown in Figure 12-5. Long field names have been used in Figure 12-5 for descriptive purposes. It is inadvisable to name fields with great big, nasty, long names programmers can get confused, and so can end users for that matter. Figure 12-5: Expanding the trucking company database model ERD from Figure 12-1. Figure 12-5 shows the LOAD table containing a WEIGHT field (the weight of each load hauled), and a MILEGAGE field (the distance in miles that each load was hauled over). The following procedure can be used to periodically update the totals, up through the table hierarchy, on both the TRUCK and DRIVER tables, from the LOAD.WEIGHT and LOAD MILEAGE fields. CREATE PROCEDURE AGGREGATE_TOTALS AS BEGIN UPDATE TRUCK SET TOTAL_MILEAGE_SINCE_LAST_MAINTENANCE, TOTAL_WEIGHT_HAULED_SINCE_LAST_MAINTENANCE = ( SELECT S.MILEAGE, S.WEIGHT FROM ( SELECT TRUCK_ID, SUM(MILEAGE) MILEAGE , SUM(WEIGHT) WEIGHT FROM LOAD ) S WHERE S.TRUCK_ID = LOAD.TRUCK_ID ); UPDATE DRIVER SET TOTAL_MILEAGE, TOTAL_HAULED = ( Driver driver_id driver sex pay_rate total_mileage total_weight Load load_id truck_id (FK) load_type load_content origination_city destination_city origination_date destination_date mileage weight Truck truck_id driver_id (FK) truck_type last_maintenance_date total_mileage_since_last_maintenance total_weight_hauled_since_last_maintenance Hour hour_id driver_id (FK) load_id (FK) start_time end_time Log hour_id (FK) hours minutes 361 Business Rules and Field Settings
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.