如果我不了解我按记录居住的领域的数量,那么我应如何建立我的数据库/表格?
例如,如果我有一个网络形式,使用户能够进入他拥有的所有汽车,而且我不想将他限制在一定数目之内,那么我如何在数据库中储存这一点?
以上问题涉及类似情况,如储存用户订单(每批物品数量不变)。
如果我不了解我按记录居住的领域的数量,那么我应如何建立我的数据库/表格?
例如,如果我有一个网络形式,使用户能够进入他拥有的所有汽车,而且我不想将他限制在一定数目之内,那么我如何在数据库中储存这一点?
以上问题涉及类似情况,如储存用户订单(每批物品数量不变)。
相反,在相关数据库管理系统中,你在与上级实体(用户)联系的附属表格中制作儿童记录。 有一个称为数据库热化>的概念,目标是每个表格都包含单一类型的实体的数据。
因此,有<条码>用户条码>。 用户信息表:
user_id | user_name | email | ...
1234 | User1 | user1@example.com | ...
2356 | User2 | user2@example.com | ...
接下来是一份储存用户每辆汽车信息的表格:
user_car_id | user_id | car_label | make | model | ...
1 | 1234 | MyCar | Ford | 2011 | ...
2 | 2356 | A Car | Chevrolet | 2010 | ...
3 | 1234 | MyOtherCar| BMW | 2000 | ...
因此,不要在<条码>用户条码>上储存汽车的内装。 表1. 按<代码>用户_id栏列出的与每个用户有关的信息。 这是一种单人关系的例子,在这种关系中,用户可以拥有许多相关的汽车。
这是一个完整的议题:数据库的正常化。
答案很短,你的发言不止一个。
在你的例子中,你有一张个人桌子、一张汽车桌和一个把人与汽车联系起来的第三张汽车。
I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
我把我的用心从使用QQL转向MySQL。 它与凯科特合作,现在不工作,因为我已经改变,使用MySQL。 这里的错误信息是:
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...
Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...
What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...
My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...