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

    compound primary key

    fayala Newbie

      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
          Simon Rodway Newbie

          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 )