Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 7th, 2004, 11:06 PM
tjtee tjtee is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 101 tjtee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
How to normalised a table with data in it?

Hi!

I have the following table:

USER Table
--------------
user id
user name
user group
user location

I would like to normalised it to

USER2 TABLE
-----------------
user id
user name
group id
location id

GROUP TABLE
------------------
group id
group name

LOCATION TABLE
---------------------
location id
location name
What is the sql statement which could do this? Thank you.

Reply With Quote
  #2  
Old January 8th, 2004, 07:32 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 6
Use the CTAS (Create Table As Select) command of SQL, An example is given below:

CREATE TABLE normal2
AS
SELECT a. userid, a.user_name, b.group_id,b.group_name
FROM table1 a, table2 b
WHERE a.user_id = b.user_id
/

It is only an example not the exact query you wanted, but you can modifiy it. Lets see how you accomplish your task.

Regards,

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > How to normalised a table with data in it?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT