Home > Database > Mysql Tutorial > 善用 SELECT INTO 功能_MySQL

善用 SELECT INTO 功能_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:55:05
Original
881 people have browsed it

很多时候我们都需要覆制某 Table 的结构,而使用 SQL Server 的话当然可以找 Enterprise Manager 来解决这问题,但在操作上老是感到比较烦覆。

其实我只需要一句 SQL 语言便能较易地覆制 Table 的结构,例如我们要覆制 Orders 到 OrderHistory 的语法如下:

SELECT * INTO OrderHistory FROM Orders WHERE 0 = 1

由於 0 永远都不会等於 1 所以这句 SELECT 语法便是 0 rows 的结果,所以新的 Table: OrderHistory 就没有任何资料。 (当然要使用 SELECT INTO 的话就必须先把 sp_dboption 设定为 true)

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template