This SQL statement causes a 1064 error in MYSQLWorkbench

Viewed 19

I am trying to create a temporary table under SQL 8.023 on RDS. When I run the below command in Codeigniter 3 I get no error but the table is not created. When I run it in MYSQLWorkbench I get I 1064 error at the line that starts CONSTRAINT.

       $sql = "CREATE TEMPORARY TABLE BC_PR_list_temp(
              
               taxyear  VARCHAR(10),
               employee_email VARCHAR(80),
               employee  VARCHAR(80),        
               qualified_dollars int NOT NULL, 
               title varchar(80),
               role varchar(80),
               num_BC int NOT NULL,
               num_PR int NOT NULL,
               tipe varchar(4),
               item varchar(80),
               dollarsPerBC int NOT NULL,
               dollarsPerPR int NOT NULL,
               business_component_string varchar(120),
               project_string varchar(120),
               CONSTRAINT ONLYONE UNIQUE(employee_email, item, qualified_dollars)
                        )";


    $iRc=$this->db->query($sql);

As I said, I get no error, but the table is not created. Perhaps I don't have privilege to create temp tables? How can I check this? I am using MYSQL 8.023 on RDS.

0 Answers
Related