1 Reply Latest reply on Jul 26, 2002 10:47 AM by srodway

    compound primary key

    fayala

      hi, all, i write a program,
      using cloudscape db,
      JDBC API,
      want create a table with compound primary key, and the sql is:
      create table t(id Integer, name String primary key(id, name), addr LONG VARCHAR)

      the program has runtime exception saying that the sql has syntax error.

        • 1. Re: compound primary key
          srodway

          You haven't said what database you are using, but here is a working SQL statement from Oracle, the same also works with MS-SQLServer as well as postgres

          CREATE TABLE T (
          id NUMBER,
          name VARCHAR(255),
          addr VARCHAR(255),
          PRIMARY KEY ( id, name )
          )