Creating Copies of Data
In this chapter we stressed that views are not copies of data but rather virtual tables with no physical data associated with them. If an independent copy of data is what you want, check to see what your system provides. At a minimum, you can create a new table and then INSERT data from an existing table (your system may use a different datatype for price).
SQLcreate table bizprices (title_id char(6) not null , price numeric(8,2) null) [table created] insert into bizprices select title_id, price from titles where type = 'business' [4 rows] select * from bizprices title_id price ======== ========== BU1032 29.99 BU1111 21.95 BU2075 12.99 BU7832 29.99 [4 rows]
This technique is useful for creating test tables, new tables ...
Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.