On Jan 6, 8:12 pm, ssecorp <[email protected]> wrote:
> CREATE TABLE foo (
>   col1 INTEGER NOT NULL,
>   col2 VARCHAR(32) NOT NULL,
>   col3 DATE NOT NULL,
>   PRIMARY KEY (col1, col2)
> );
>
> how would I set primary key if it is a combination of 2 keys?


also how would I set a key to be both foreign and primary


I tried:
(defn create-toast []
  (sql/create-table :toast
                    [:customerid :int "primary key"]
                    [:movieid :int "primary key"]
                    [:reviewdate "DATE"]
                    [:grade :int]))


user=> java.lang.Exception: transaction rolled back: More than one
primary key constraint specified for table 'TOAST'. (db.clj:0)



////////////////////////////////////
(defn create-toast []
  (sql/create-table :toast
                    [:customerid :int "primary key"]
                    [:movieid :int "foreign key"]
                    [:reviewdate "DATE"]
                    [:grade :int]))


user=> java.lang.Exception: transaction rolled back: Syntax error:
Encountered "foreign" at line 1, column 61. (db.clj:0)


/////////////////////////////////////////

(defn create-toast []
  (sql/create-table :toast
                    [:customerid :int "primary key"]
                    [:movieid :int]
                    [:reviewdate "DATE"]
                    [:grade :int]))

works, it seems foreign key isnt recognized at all.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to