在一列数据中持有一个向量 [英] holding a vector with in a column of data

查看:60
本文介绍了在一列数据中持有一个向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网站,其中一个活动可以包含多个人。所以,我想,嘿!我可以制作一个包含人物的矢量,然后将该矢量放入数据库中供我查看。但我找不到矢量的列类型。任何想法我怎么能做到这一点?

I am creating a website in which multiple people can be included in one activity. so to do this i thought, Hey! i can just make a vector of the people included, then put that vector in the database for me to view whenever. but i cant find a column type for vector. any ideas how i could make this happen?

推荐答案

当你有多个要存储的东西时,你不想把它们存储在一列中。他们应该有自己的行。


把人放进入他们自己的桌子,给那张桌子一把钥匙。


把活动放在进入自己的表并给它一个主键。


然后创建一个链接表,链接哪些人参与哪些活动。此表将包含2列:活动的ID和人员的ID。


如果要检索给定活动的人员,请使用链接/查找表,加入人员表,其中activity-id是您要查找的活动。


研究链接(或加入)表,以及如何使用加入表在一个SQL语句中。


-Frinny
When you have multiple things to store, you don''t want to store them in a column. They should have their own rows.

Put "people" into their own table, give that table a primary key.

Put the "activity" into its own table and give it a primary key.

Then create a link table that links which people are involved in which activity. This table will have 2 columns: the id for the activity and the id to a person.

When you want to retrieve the people for a given activity, use the link/look-up table, joined to the people table where the activity-id is the activity that you are looking for.

Research link (or join) tables, and how to use "JOIN" in an SQL statement.

-Frinny


但是如果我不知道活动中有多少人会怎么样呢。我能够按照一定的顺序放置它们。我想我完全不明白你的意思,(数据库新手)
But what if i dont know how many people are going to be in the activity. and i was to be able to put them in a certain order. i guess i quite dont understand what your saying, (new to database)


你可以使用ORDER BY按特定顺序返回结果。


使用此设计的活动中的人数没有限制。


-Frinny
You can use ORDER BY to return the results in a specific order.

There is no limitation to the number of people in an activity with this design.

-Frinny


这篇关于在一列数据中持有一个向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆