gpt4 book ai didi

mysql - 从一张表创建多个表

转载 作者:行者123 更新时间:2023-11-30 00:39:51 26 4
gpt4 key购买 nike

我在 MYsql 中有一个表,其中填充了所有数据(表:Archive)我想创建多个以“名称”列中的值命名的表,其中包含每个名称的所有数据

Ex. 
Table: Archive
column1 Names column3 column4
1 John Smith 10/01/2014 35
2 John Smith 20/01/2014 36
1 Pinco Pallino 07/01/2014 30
1 Cippa Lippa 01/01/2014 20
2 Cippa Lippa 02/01/2014 21
3 Cippa Lippa 03/01/2014 19

Table: John Smith
column1 Names column3 column4
1 John Smith 10/01/2014 35
2 John Smith 20/01/2014 36

Table: Pinco Pallino
column1 Names column3 column4
1 Pinco Pallino 07/01/2014 30

Table: Cippa Lippa
column1 Names column3 column4
1 Cippa Lippa 01/01/2014 20
2 Cippa Lippa 02/01/2014 21
3 Cippa Lippa 03/01/2014 19

对于“Names”中的每种名称,我必须构建一个以“Names”值命名的表(与表相关:Archive)我需要多个表来保证多个用户只能访问一个具有名称的表

有人可以帮我吗?

最佳答案

您可以使用 View 实现相同的访问限制,而不是破坏数据库结构:

CREATE VIEW cippa AS SELECT * FROM Archive WHERE Names = 'Cippa Lippa';

关于mysql - 从一张表创建多个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21862291/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com