title: SQL ADD Constraint rule to employees about gender (M,F)
body: <p>I want to write an SQL query where a constraint rule is assigned to employees about gender.</p>
  <p>i tried to do it but i keep getting an error.</p>
  <p>I have a Table named employees and there i have the gender and i want to apply a constraint rule that employees only can get M or F. so its 1 varchar.</p>
  <p>can someone help me please.</p>
  <pre><code>my Error:
  postgres.public&gt; ALTER TABLE medewerkers ADD CONSTRAINT m_geslacht_chk
                       CHECK (REGEXP_LIKE(COL, '^[MF]*$'))
  [2021-09-13 21:08:16] [42P01] ERROR: relation &quot;medewerkers&quot; does not exist
  </code></pre>
  <p>my code:</p>
  <pre><code>ALTER TABLE medewerkers ADD CONSTRAINT m_geslacht_chk CHECK (REGEXP_LIKE(geslacht, '^[MF]*$'));
  
  CREATE TABLE medewerkers
  (
      mnr      NUMERIC(4)     CONSTRAINT m_pk         PRIMARY KEY
                              CONSTRAINT m_mnr_chk    CHECK (mnr &gt; 7000),
      naam     VARCHAR(12)    CONSTRAINT m_naam_nn    NOT NULL,
      voorl    VARCHAR(5)     CONSTRAINT m_voorl_nn   NOT NULL,
      functie  VARCHAR(10),
      chef     NUMERIC(4)     CONSTRAINT m_chef_fk    REFERENCES medewerkers DEFERRABLE,
      gbdatum  DATE           CONSTRAINT m_gebdat_nn  NOT NULL,
      maandsal NUMERIC(6, 2)  CONSTRAINT m_mndsal_nn  NOT NULL,
      comm     NUMERIC(6, 2),
      afd      NUMERIC(2)     DEFAULT 10,
      geslacht VARCHAR(2)     CONSTRAINT m_geslacht_chk NOT NULL
  );
  </code></pre>