- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: create table
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 06:09 PM
тАО03-02-2004 06:09 PM
create table
the direct method. What we want to do is create a clean copy of the temp_table which does not have
duplicate records. Does anyone know if its possible to create a copy of the temp_table with a primary key
column thereby removing duplicate records and also including indexes? If so, what would be the syntax
of the sql statement?(ie. create copy_of_temp_table ..... as select * from temp_table; )
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 07:23 PM
тАО03-02-2004 07:23 PM
Re: create table
as select disctinct * from temp table
/
You may want to add a storage clause, and to add a Primary Key after creation, but this will remove duplicates.
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 08:28 PM
тАО03-02-2004 08:28 PM
Re: create table
The fact temp_table has approx 2.8 billion records, would the select not take days to get a result?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 08:41 PM
тАО03-02-2004 08:41 PM
Re: create table
Well, there is no such thing as a free lunch, but given your data size, a better option may to create an empty copy table, add the PK, then populate it using an EXCEPTIONS clause.
More here ...
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/clauses3a.htm#998196
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 08:51 PM
тАО03-02-2004 08:51 PM
Re: create table
I am not sure what RDBMS you are using. But if you are using RDBMS like Sybase, then you have an option to use BCP (bulk copy) instead of the conventional method of copy as.
If you are using Oracle, i bet they would have some tool like the Sybase BCP for carrying this out instead of depending on COPY AS
regards
Mobeen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2004 09:42 PM
тАО03-02-2004 09:42 PM
Re: create table
how about adding a unique constraint on the columns in question and using "exceptions into".
For example:
==========================================
create table t as select * from temp_table;
create table exceptions(row_id rowid,
owner varchar2(30),
table_name varchar2(30),
constraint varchar2(30));
alter table t add constraint t_unique unique(a,b,c) exceptions into exceptions;
create table dups
as
select *
from t
where rowid in ( select row_id from exceptions )
/
delete from t where rowid in ( select row_id from exceptions );
insert into t select distinct * from dups;
...
hope this helps too!
regards
Yogeeraj