1

i am working on a project in php MySQL i want to design a route with dynamic tracking of van .problem i am facing right now is that how to put stops in database because i only know how to store start and end point in database but how when it comes stops between points

route(r_id, start_point,end_point)

when there are many routes with different start and end points also different stops in different routes

AHSAN KHAN
  • 426
  • 7
  • 17

1 Answers1

0
point(p_id,...)
route(r_id,start_point,end_point)
stop(r_id,stop_number_within_route,p_id)

See this answer and its question. Extract:

The tables in a relational database describe the state of an application. Each table has an associated fill-in-the-(named-)blanks statement (predicate).

The parameters of the predicate are the columns of the table.

The rows that make a table's predicate true go in the table. The rows that make if false stay out.

You need to decide on sufficient predicates to be able to fully describe the the stituations of your application. This includes abstract things like routes and transactions and events and schedules and assignments etc. (Once we have sufficitent predicates/tables we improve them via techniques like normalization.)

Community
  • 1
  • 1
philipxy
  • 14,867
  • 6
  • 39
  • 83
  • sir i cant under point for example a route A to E has 3 stops B, C , D what will be p_id in stop ?? how i will describe it in database `point(?,..??.) route(1,A,E) stop(1,3,??) ` if i say P_id as 2 for b `point(2,..B.) route(1,A,E) stop(1,3,2) ` where will C D goes @philipxy – AHSAN KHAN Mar 23 '15 at 09:50
  • Your p_ids are currently letters of the alphabet. So you example has rows point(A,*other point info*), route(1,A,E), stop(1,1,A), stop(1,2,B), stop(1,3,C). Read the link about finding parameterized natural language statements that describe your application, each of which gets a table. – philipxy Mar 23 '15 at 22:43