如何在SQLserver中新建一个表,其它表的数据传输到新建的表内,表列数不同
答案:6 悬赏:50
解决时间 2021-03-05 21:32
- 提问者网友:他是我的あ男人
- 2021-03-04 21:57
如何在SQLserver中新建一个表,其它表的数据传输到新建的表内,表列数不同
最佳答案
- 二级知识专家网友:不傲怎称霸
- 2021-03-04 23:00
insert into Sales(EmployeeID,ProductID,SupplierID,CustomerID,
OrderDate,UnitPrice,Total,Quantity,Discount)
select e.EmployeeID, p.ProductID, s.SupplierID,
c.CustomerID, o.OrderDate, od.UnitPrice,
od.Quantity*od.UnitPrice*(1.0-od.Discount)Total,
Od.Quantity, od.Discount
from Orders o,[Order Details] od, Employees e,
Products p, Suppliers s, Customers c
where (o.OrderID = od.OrderID) and
(o.EmployeeID = e.EmployeeID) and
(o.CustomerID = c.CustomerID) and
(od.ProductId = p.ProductID) and
(p.SupplierID = s.SupplierID);
OrderDate,UnitPrice,Total,Quantity,Discount)
select e.EmployeeID, p.ProductID, s.SupplierID,
c.CustomerID, o.OrderDate, od.UnitPrice,
od.Quantity*od.UnitPrice*(1.0-od.Discount)Total,
Od.Quantity, od.Discount
from Orders o,[Order Details] od, Employees e,
Products p, Suppliers s, Customers c
where (o.OrderID = od.OrderID) and
(o.EmployeeID = e.EmployeeID) and
(o.CustomerID = c.CustomerID) and
(od.ProductId = p.ProductID) and
(p.SupplierID = s.SupplierID);
全部回答
- 1楼网友:一池湖水
- 2021-03-05 03:40
Select Col1,Col2,Col3
into T_New
From T_Old
- 2楼网友:如果这是命
- 2021-03-05 03:01
通过将新表中的主键和其他表的主键相连接(即相等),然后再插入你想插入的字段值。
- 3楼网友:我们只是兮以城空
- 2021-03-05 01:39
第一种
第二种
create table 表名
(列名1 类型 是否非空
列名2 类型 是否非空)
- 4楼网友:为你轻狂半世殇
- 2021-03-05 00:46
简单方法:
select sno,sname,sage into sc_stu
from student
where sdept='cs'
- 5楼网友:樣嘚尐年
- 2021-03-04 23:26
create table new_table as select aa.x,aa.y,aa.z,bb.d,bb.e,bb.f from aa join bb on .....
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯