关于数据库的问题 [英] problem about database
本文介绍了关于数据库的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何插入1行
从1个表到另一个表
how i insert 1 row
from 1 table to another table
推荐答案
INSERT Table2
(columnX, columnY)
SELECT column1, column2 FROM Table1
WHERE [Conditions]
您可以使用
You can use
insert into tbl_test1 (col1,col2,col3)
(select col_1,col_2,col_3 from tbl_test)
插入tbl_test1从tbl_test中选择col1,col2,col3
(这是一个条件,列必须与tbl_test相同)
但是,如果你只想插入一行,那么,
您可以应用条件来选择查询。
OR
insert into tbl_test1 select col1,col2,col3 from tbl_test
(here is one condition that Columns has to be same as tbl_test)
But, If you want to insert only one row then,
you can apply condition to select query.
这篇关于关于数据库的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文