MySQL Forums
Forum List  »  Newbie

Help for a create un trigger
Posted by: PAOLO SPAGNOLO
Date: February 05, 2023 08:59AM

I have a table that has a data diff that gets complicated upon receiving a ping control from a device , I need to fill in a data_diff field to warn how many days I do not receive communication from the device , who can help me

-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Creato il: Feb 05, 2023 alle 15:58
-- Versione del server: 10.4.21-MariaDB
-- Versione PHP: 8.0.10

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `esystem`
--

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

--
-- Struttura della tabella `autotest_ping`
--

CREATE TABLE `autotest_ping` (
`id_Autotest` int(11) NOT NULL,
`AccountCode` varchar(6) NOT NULL,
`NomeCliente` varchar(120) NOT NULL,
`messaggio` varchar(120) NOT NULL,
`data_arrivo` date NOT NULL,
`Controllo_Attivo` int(1) NOT NULL,
`day_diff` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dump dei dati per la tabella `autotest_ping`
--

INSERT INTO `autotest_ping` (`id_Autotest`, `AccountCode`, `NomeCliente`, `messaggio`, `data_arrivo`, `Controllo_Attivo`, `day_diff`) VALUES
(2048, '000002', 'FABRIANO', 'Centrale connessa correttamente alla rete', '2022-05-12', 0, 0),
(2921, '123456', 'CENTRALE TEST ---', 'Centrale connessa correttamente alla rete', '2023-05-02', 0, 0);

--
-- Indici per le tabelle scaricate
--

--
-- Indici per le tabelle `autotest_ping`
--
ALTER TABLE `autotest_ping`
ADD PRIMARY KEY (`id_Autotest`),
ADD UNIQUE KEY `AccountCode` (`AccountCode`);

--
-- AUTO_INCREMENT per le tabelle scaricate
--

--
-- AUTO_INCREMENT per la tabella `autotest_ping`
--
ALTER TABLE `autotest_ping`
MODIFY `id_Autotest` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3022;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Options: ReplyQuote


Subject
Written By
Posted
Help for a create un trigger
February 05, 2023 08:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.