0
Existing table
CREATE TABLE `dataleitura` (
`idLeitura` INT(6) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT,
`DataLeitura` DATE NULL DEFAULT NULL,
PRIMARY KEY (`idLeitura`)
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=11
dice:
"000001" "2020-01-13"
"000002" "2020-02-11"
"000003" "2020-03-13"
"000004" "2020-04-14"
"000005" "2020-05-13"
"000006" "2020-06-12"
"000007" "2020-07-10"
"000008" "2020-08-12"
"000009" "2020-09-11"
"000010" "2020-10-13"
I need to create a calculated column giving me the days between a date and another
"2020-10-13" - "2020-09-11"
CREATE TABLE `dataleitura` (
`idLeitura` INT(6) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT,
`DataLeitura` DATE NULL DEFAULT NULL,
`dias` [GENERATED ALWAYS] AS expressão [VIRTUAL | STORED] constraints
PRIMARY KEY (`idLeitura`)
as the expression would be, someone can help me
It is not easier to create a Rigger than after some data is inserted if this column is null you perform the calculation?
– Heitor Scalabrini
could explain to me how I would do it, I’m new and never used Rigger
– Salomao Coelho