【例6.39】在样例数据库pubs的employee表中,查询来自美国的员工,并将查询结果保存在新表us_employee中。
USE pubs
SELECT * INTO us_publisers FROM publishers WHERE country = 'USA'
执行结果是在数据库pubs中新建一张us_publishers表,并将查询结果保存这个表中。可以使用下面语句来查证结果:
USE pubs
SELECT * FROM us_publishers
运行结果:
pub_id pub_name city state country
------ ---------------------------------------- -------------
0736 New Moon Books Boston MA USA
0877 Binnet & Hardley Washington DC USA
1389 Algodata Infosystems Berkeley CA USA
1622 Five Lakes Publishing Chicago IL USA
1756 Ramona Publishers Dallas TX USA
9952 Scootney Books New York NY USA
(所影响的行数为 6 行)
USE pubs
SELECT * INTO us_publisers FROM publishers WHERE country = 'USA'
执行结果是在数据库pubs中新建一张us_publishers表,并将查询结果保存这个表中。可以使用下面语句来查证结果:
USE pubs
SELECT * FROM us_publishers
运行结果:
pub_id pub_name city state country
------ ---------------------------------------- -------------
0736 New Moon Books Boston MA USA
0877 Binnet & Hardley Washington DC USA
1389 Algodata Infosystems Berkeley CA USA
1622 Five Lakes Publishing Chicago IL USA
1756 Ramona Publishers Dallas TX USA
9952 Scootney Books New York NY USA
(所影响的行数为 6 行)