user871457
user871457

Reputation:

How to structure Dynamic data in MySQL?

Please help in structuring following type of data (example)- >

i have 1 table with list of all addresses of Restaurants.(1 database table for each City )

On querying each restaurant it returns a list of people who are in restaurant in format {name ,timeduration,bill} The number of rows returned in List is dynamic.

Now how can i store this data in mysql .

I would like to search by name etc so i cannot put full text in one column!

Upvotes: 0

Views: 536

Answers (1)

Sven van Zoelen
Sven van Zoelen

Reputation: 7229

Here is a structure to get you started:

CITY
----------
id
name

RESTAURANT
-----------
id
name
phone
address
city_id

PEOPLE
----------
id
name

ORDER
----------
id
restaurant_id
people_id
total (bill)
duration
date

RESTAURANT_ORDER
-----------------
id
restaurant_id
order_id

The restaurant_order table connects the restaurant with the people that ate there. Look here http://www.tizag.com/mysqlTutorial/mysqljoins.php for info how to retrieve stuff from it.

Upvotes: 2

Related Questions