I've trying to make database with few tables and relations between them. As I'm not very good in databases at all I need some clarifications. The idea is to connect
table_3 Here are two options:
Option 1 - table is directly connected to other tables and in query will be joining them.
Option 2 - will use middle tables to connect them with foreign keys..
Currently my database schema is a
mess I have relations with both methods. Some are with middle table and some are without. This is my current view of relations which I think is not very good.
In option 3(current) you can see that connection are double - one from middle table and one directly. What is the best solution here?
table = hotel,
table_1 = rooms,
table_2 = reservation and
table_3 = food.
When user make reservation the system shows him free rooms. He can also see what kind of food has restaurant in this hotel. So hotel table should be connected with rooms, food and reservation.
update: One of the query's that I use to show meals is
$hotels_id = $_GET['meal_id']; $strSQL = "SELECT m.meal_id, meal_name, meal_image, meal_image_big, meal_weight, meal_price, meal_description FROM meals m JOIN meal_hotel mr ON m.meal_id = mr.meal_id WHERE hotels_id = '$hotels_id'";
So the table
meal_hotel has two columns
hotels_id and this two columns are FK for hotels and meals. Am I right?