English 中文(简体)
数据库并入FK——基本问题
原标题:Database joins / FK - basic questions
  • 时间:2011-01-12 19:02:47
  •  标签:
  • database

There are 2 tables A & B. Each has say 10 colums. Table A has 8 columns as FK to other tables. Table B uses enums and std colunms without any FK.

  • So which table is faster / better to use?
  • If i do any action with table A, i assume I only have to touch colunms I am relating the action too and do not have to join all the 10 FK tables even if i only need 1 FK colunm?
  • If i do need to perform any action on a FK, like write, update or delete a value, do i need to join to the parent table?
  • If i understand correctly, EAV model is better than a expanded colunm table because if i need to display two text from the table then i need to use a inner join for the colunm table for for a EAV table i can use a regular select only with no join?
问题回答
  1. 仅对少数价值观,如果价值数额没有变化,国家环境论坛就能够更快,空间也较少。 然而,为了在以后添加可能的价值,你需要改变整个表格,因为这个表格不是好的。 表1 在多数情况下,选择较好。

  2. 仅请您与所需要表格一同填写表A。

  3. 无,除非你改变PK,否则你只能修改含有这一价值的表格。 不过,你应当设计你表格,以便不经常需要改变PK,即使用人工PK(自动加固是完美的)。 甚至国家也不再存在或更改名称......

  4. 您无需加入。 然而,加入钥匙的速度非常快......这是关系数据库所牵涉的内容,是它们强有力的点。





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签