HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to store an array in a table column?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
columnarraystorehowtable

Problem

I have multiple contacts for a user and I want to store them in a single column.

uID |  Contact
----| ---------
2   | 1221
    | 1223
----|----------
3   | 1123


How can I do that?

Solution

You can create separate tables, like user table and contact table:

-
user table

uID
---
2


-
contact table

Contact | uID
1221    | 2
1223    | 2

Code Snippets

Contact | uID
1221    | 2
1223    | 2

Context

StackExchange Database Administrators Q#191954, answer score: 4

Revisions (0)

No revisions yet.