CREATE TABLE machelomaria (
  idmachelomaria VARCHAR(50)  NOT NULL  ,
  nome VARCHAR(35)  NULL  ,
  contador INTEGER UNSIGNED  NULL  ,
  limite INTEGER UNSIGNED  NULL  ,
  ativo BOOL  NULL    ,
PRIMARY KEY(idmachelomaria));



CREATE TABLE leiturahelomaria (
  idleiturahelomaria INTEGER UNSIGNED  NOT NULL   AUTO_INCREMENT,
  machelomaria_idmachelomaria VARCHAR(50)  NOT NULL  ,
  dataleitura DATE  NULL  ,
  horaleitura TIME  NULL  ,
  umidade REAL  NULL  ,
  temperatura REAL  NULL  ,
  luz INT  NULL    ,
PRIMARY KEY(idleiturahelomaria)  ,
INDEX leiturahelomaria_FKIndex1(machelomaria_idmachelomaria),
  FOREIGN KEY(machelomaria_idmachelomaria)
    REFERENCES machelomaria(idmachelomaria)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION);




