Interfaces 103: Build Complex Interfaces by Adapting Patterns

I am trying to import SQL file attached in the module to create Personal Finance tables in Cloud Database but I am getting below error:

-- --------------------------------------------------------

--
-- Table structure for table `PF_ACCOUNT`
--

CREATE TABLE `PF_ACCOUNT` (
  `ACCOUNT_ID` int(11) NOT NULL,
  `TYPE_ID` int(11) DEFAULT NULL,
  `BALANCE` double DEFAULT NULL,
  `NAME` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

MySQL said: 

#1173 - This table type requires a primary key

Can anyone help me here.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Senior Developer

    CREATE TABLE `PF_ACCOUNT` (
      `ACCOUNT_ID` int(11) NOT NULL AUTO_INCREMENT, 
      `TYPE_ID` int(11) DEFAULT NULL,
      `BALANCE` double DEFAULT NULL,
      `NAME` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`ACCOUNT_ID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;


     You can't create table without primary key. 
    I assumed that 'ACCOUNT_ID' will be a primary key.
    A primary key is a crucial element in a relational database table, and MySQL requires it for InnoDB tables (the engine you're using).

Reply
  • +1
    Certified Senior Developer

    CREATE TABLE `PF_ACCOUNT` (
      `ACCOUNT_ID` int(11) NOT NULL AUTO_INCREMENT, 
      `TYPE_ID` int(11) DEFAULT NULL,
      `BALANCE` double DEFAULT NULL,
      `NAME` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`ACCOUNT_ID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;


     You can't create table without primary key. 
    I assumed that 'ACCOUNT_ID' will be a primary key.
    A primary key is a crucial element in a relational database table, and MySQL requires it for InnoDB tables (the engine you're using).

Children