在SQL中创建具有多个值的列的表
问题描述:
我分配了一个任务,以便在像这样的表上运行一些SQL查询:
T1
C1 | C2 | C3
x1 | y1 | z1
x2 | y2 | z2
I've got an assignment to run some SQL queries on a table looking like this:
T1
C1| C2 | C3
x1| y1 | z1
x2| y2 | z2
但是我不确定如何在SQL中创建表。
But I'm not sure how to create the table in SQL.
答
您确定设计表的正确方法吗?
Are you sure is the right way to design the tables?
看起来像一个简单的主/明细模型
It look like a simple Master/Detail model
可能您的T1表是master
Probably your T1 table is the master
在第二个表(C)上将带有参考ID的列添加到主表
On the second table (C) put a column with reference ID to the main table
使用简单的Join或Left做查询加入
The do the query with a simple Join or Left Join