[英]How to connect two tables in oracle 10g database?
I have table named REGISTRATION
with fields like ID, NAME, PASSWORD, USERNAME
. 我有名为
REGISTRATION
表,其中包含ID, NAME, PASSWORD, USERNAME
等字段。 I want to make another table named PHOTOS
with fields ID, TITLE, PHOTO
. 我要创建另一个名为
PHOTOS
表,其字段ID, TITLE, PHOTO
。 The thing I want to ask is that I want the ID
field of the PHOTOS
table should match with the ID
field of the REGISTRATION
table. 我要问的事情是,我想要的
ID
基于场PHOTOS
表应与匹配ID
在现场REGISTRATION
表。 Whenever there is any entry in the REGISTRATION
table the content of ID
field gets copied into the ID
field of PHOTOS
table....?? 只要
REGISTRATION
表中有任何条目, ID
字段的内容就会复制到PHOTOS
表的ID
字段中。
If you have only one photo per user, then yes, it is a good idea to make ID the same. 如果每个用户只有一张照片,那么可以,使ID相同是个好主意。 But then why it is not just one table that contains info from registration and photos?
但是,为什么它不只是一张包含注册和照片信息的表呢?
if you have multiply photos per user, then no. 如果每个用户拥有多张照片,则不会。 ID usually recognized as unique identifier of a record in a table (2 records in the same table have different IDs).
通常将ID识别为表中记录的唯一标识符(同一表中的2条记录具有不同的ID)。 So instead of using ID for user, you use UserId as an additional column in PHOTOS table.
因此,您可以将UserId用作PHOTOS表中的附加列,而不是为用户使用ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.