-- --------------------------------------------------------
-- Host:                         153.92.1.116
-- Server version:               8.0.45-0ubuntu0.22.04.1 - (Ubuntu)
-- Server OS:                    Linux
-- HeidiSQL Version:             12.12.0.7122
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


-- Dumping database structure for el_trenesanas_eksamenam_1
CREATE DATABASE IF NOT EXISTS `el_trenesanas_eksamenam_1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `el_trenesanas_eksamenam_1`;

-- Dumping structure for view el_trenesanas_eksamenam_1.el_result_1
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `el_result_1` (
	`id` INT NOT NULL COMMENT 'Unikāls numurs',
	`week_day` TINYINT NULL COMMENT 'Nedēļas diena',
	`date` DATE NULL COMMENT 'Datums katrai dienai',
	`time` TIME NULL COMMENT 'Stundas laiks',
	`start_time` DATETIME NULL COMMENT 'Sākuma laiks',
	`end_time` DATETIME NULL COMMENT 'Beigu laiks'
);

-- Dumping structure for view el_trenesanas_eksamenam_1.el_result_2
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `el_result_2` (
	`id` INT NOT NULL COMMENT 'Unikālais numurs',
	`work_type` VARCHAR(1) NULL COMMENT 'Darba nosaukums' COLLATE 'utf8mb4_general_ci',
	`work_problem` VARCHAR(1) NULL COMMENT 'Darba kļūdu apraksts' COLLATE 'utf8mb4_general_ci',
	`work_nr` DECIMAL(5,2) NULL COMMENT 'Darba numurs',
	`follow_nr` VARCHAR(1) NULL COMMENT 'Apsekojuma numurs' COLLATE 'utf8mb4_general_ci',
	`unit` INT NULL COMMENT 'Mērvienības norādes skaitlis',
	`measurement` VARCHAR(1) NULL COMMENT 'Mērvienības nosaukums' COLLATE 'utf8mb4_general_ci'
);

-- Dumping structure for view el_trenesanas_eksamenam_1.el_result_3
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `el_result_3` (
	`id` INT NOT NULL COMMENT 'Unikāls numurs',
	`worker_name` VARCHAR(1) NULL COMMENT 'Darbinieka vārds' COLLATE 'utf8mb4_general_ci'
);

-- Dumping structure for view el_trenesanas_eksamenam_1.el_result_4
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `el_result_4` (
	`id` INT NOT NULL COMMENT 'Unikāls numurs',
	`work_name` VARCHAR(1) NULL COMMENT 'Darba vietas nosaukums' COLLATE 'utf8mb4_general_ci'
);

-- Dumping structure for view el_trenesanas_eksamenam_1.el_result_5
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `el_result_5` (
	`id` INT NOT NULL COMMENT 'Unikāls numurs',
	`price` DECIMAL(20,0) NULL COMMENT 'Cena par darbu',
	`amount` DECIMAL(20,0) NULL COMMENT 'Daudzums cik nepieciešams',
	`sum` DECIMAL(20,0) NULL COMMENT 'Kopējā summa'
);

-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `el_result_1`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `el_result_1` AS select `date`.`id` AS `id`,`date`.`week_day` AS `week_day`,`date`.`date` AS `date`,`date`.`time` AS `time`,`date`.`start_time` AS `start_time`,`date`.`end_time` AS `end_time` from `date`
;

-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `el_result_2`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `el_result_2` AS select `work`.`id` AS `id`,`work`.`work_type` AS `work_type`,`work`.`work_problem` AS `work_problem`,`work`.`work_nr` AS `work_nr`,`work`.`follow_nr` AS `follow_nr`,`work`.`unit` AS `unit`,`work`.`measurement` AS `measurement` from `work`
;

-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `el_result_3`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `el_result_3` AS select `worker`.`id` AS `id`,`worker`.`worker_name` AS `worker_name` from `worker`
;

-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `el_result_4`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `el_result_4` AS select `work_place`.`id` AS `id`,`work_place`.`work_name` AS `work_name` from `work_place`
;

-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `el_result_5`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `el_result_5` AS select `funds_info`.`id` AS `id`,`funds_info`.`price` AS `price`,`funds_info`.`amount` AS `amount`,`funds_info`.`sum` AS `sum` from `funds_info`
;

/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
