Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9141363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:38:05+00:00 2026-06-17T09:38:05+00:00

I am trying to create a table from 2 other tables in Oracle SQL

  • 0

I am trying to create a table from 2 other tables in Oracle SQL Developer:

CREATE TABLE share_stock(
  share_id    NUMBER(6,0), 
  share_price NUMBER(10,2),
  company_id  NUMBER(6,0), 
  company_name VARCHAR2(50), 
  ticker_symbol VARCHAR2(4),
AS SELECT share_price.share_price_id, share_price.price, share_price.company_id, company.name, company.ticker_symbol 
FROM share_price, company
WHERE share_price.company_id = company.company_id,
CONSTRAINT sh_pk PRIMARY KEY (share_price.share_price_id),
CONSTRAINT sh_pr_fk FOREIGN KEY (share_price.share_price_id) REFERENCES share_price(share_price_id)
);

Basically I am trying to perform a CREATE AS SELECT, but I am getting this error:

Error at Command Line:294 Column:28 Error report: SQL Error:
ORA-00904: : invalid identifier
00904. 00000 – “%s: invalid identifier”

I have tried to correct my syntax and I have not managed to get it right so far,
Any ideas would be helpful,

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:38:06+00:00Added an answer on June 17, 2026 at 9:38 am

    Try this way:

    CREATE TABLE share_stock
    AS 
    SELECT SP.share_price_id as share_id , 
           SP.price as share_price, SP.company_id, C.name, 
           C.ticker_symbol 
    FROM share_price SP 
    join company C on SP.company_id = C.company_id;
    
    alter table share_stock
    add CONSTRAINT sh_pk PRIMARY KEY (share_id);
    
    alter table share_stock
    add CONSTRAINT sh_pr_fk FOREIGN KEY (share_id) 
    REFERENCES share_price(share_price_id);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a mysql table from the inner join between two other
I'm trying to export from SQL Server to Oracle a table that consists of
I am trying to create an ANI lookup table from 2 separate tables, one
I'm trying to create table from view from remote server (calling procedure UPDATE_PROC), like
I'm trying to create a record within a join table from the action of
I'm trying to create a record within a join table from the action of
I am trying to create a statement as follows: SELECT * FROM table WHERE
I'm trying to create an array from selected table rows so I can push
I'm trying to create an XML sitemap using CakePHP, from a table which has
I am trying to create a report that pulls data from 2 tables: a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.