title: SQL (Oracle) : How to improve logic model and correct identifer errors?
body: <p>This is the logic model of a video store. The client borrows the copy from the store.</p>
  
  <p><a href="https://i.stack.imgur.com/q03fR.png" rel="nofollow noreferrer">logic model</a>  <strong>(please see the logic model)</strong></p>
  
  <p>After creating the logic model, the generate sequences had 5 errors.</p>
  
  <p>Some of them are:</p>
  
  <blockquote>
    <p>remove the primary key</p>
  </blockquote>
  
  <p>--> I cannot understand why should remove primary key.When I remove the primary key "clientno" on the client table. The software "oracle developer" doesn't let me remove the primary key.</p>
  
  <blockquote>
    <p>invalid identifer</p>
  </blockquote>
  
  <p>--> Googled the info on the internet but could not understand.</p>
  
  <p>The problem is on the logic model. The model want to check the average video that a client borrowed. What is the popular movie at the moment?  </p>
  
  <p>These are errors:</p>
  
  <pre><code>create table client
  (
      clientno             number(8) not null,
      clientname           varchar2(30),
      clientadress         varchar2(50),
      clientclassification varchar2(30)
  ) 
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>SQL Error: ORA-00955: name is already used by an existing object<br>
    00955. 00000 -  "name is already used by an existing object”</p>
  </blockquote>
  
  <pre><code>alter table client 
      add constraint client_pk primary key (clientno)  
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>SQL Error: ORA-02260: table can have only one primary key<br>
    02260. 00000 -  "table can have only one primary key"<br>
    *Cause:    Self-evident.<br>
    *Action:   Remove the extra primary key.</p>
  </blockquote>
  
  <pre><code>alter table copy add constraint copy_pk primary key (copycode, client_clientno, movie_movieno)  
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>SQL Error: ORA-00904: "COPYCODE": invalid identifier<br>
    00904. 00000 -  "%s: invalid identifier”</p>
  </blockquote>
  
  <pre><code>alter table store add constraint store_pk primary key (storecode, storecode1)
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>SQL Error: ORA-02260: table can have only one primary key<br>
    02260. 00000 -  "table can have only one primary key"<br>
    *Cause:    Self-evident.<br>
    *Action:   Remove the extra primary key.</p>
  </blockquote>
  
  <pre><code>alter table copy 
      add constraint copy_client_fk 
          foreign key (client_clientno) references client (clientno) 
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>SQL Error: ORA-00904: "CLIENT_CLIENTNO": invalid identifier<br>
    00904. 00000 -  "%s: invalid identifier”  </p>
  </blockquote>
  
  <pre><code>alter table copy 
      add constraint copy_movie_fk 
          foreign key (movie_movieno) references movie (movieno)  
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>SQL Error: ORA-00904: "MOVIE_MOVIENO": invalid identifier<br>
    00904. 00000 -  "%s: invalid identifier"  </p>
  </blockquote>