-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `zug_trenesanas_eksamenam_1`
--

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

--
-- Stand-in structure for view `darba_atskaite`
-- (See below for the actual view)
--
CREATE TABLE `darba_atskaite` (
`nedelas_diena` varchar(9)
,`sakums` timestamp
,`darba_tips` varchar(255)
,`vieta` varchar(255)
,`beigas` timestamp
,`kopa_stundas` decimal(23,2)
,`darba_veicejs` varchar(255)
,`darba_nr` decimal(4,2)
,`darba_variants` varchar(255)
,`merv` varchar(10)
,`cena` int
,`daudzums` int
,`summa` bigint
);

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

--
-- Structure for view `darba_atskaite`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`zukovskis_g`@`localhost` SQL SECURITY DEFINER VIEW `darba_atskaite`  AS SELECT dayname(`d`.`sakums`) AS `nedelas_diena`, `d`.`sakums` AS `sakums`, `d`.`darba_tips` AS `darba_tips`, `v`.`name` AS `vieta`, `d`.`beigas` AS `beigas`, round((timestampdiff(MINUTE,`d`.`sakums`,`d`.`beigas`) / 60),2) AS `kopa_stundas`, `db`.`vards` AS `darba_veicejs`, `dn`.`darba_nr` AS `darba_nr`, `dn`.`darba_variants` AS `darba_variants`, `dn`.`merv` AS `merv`, `dn`.`cena` AS `cena`, `nd`.`daudzums` AS `daudzums`, (`dn`.`cena` * `nd`.`daudzums`) AS `summa` FROM ((((`Darbs` `d` left join `Darba_numurs` `dn` on((`d`.`darba_numurs_id` = `dn`.`id`))) left join `Darbinieki` `db` on((`d`.`darbinieka_id` = `db`.`id`))) left join `Vieta` `v` on((`d`.`vieta_id` = `v`.`id`))) left join `Naudas_dati` `nd` on((`d`.`nauda_id` = `nd`.`id`))) ;
COMMIT;

