sql
stringlengths
6
1.05M
<filename>importer/src/main/resources/scripts/component-centric/component-centric-snapshot-description-fsn-uppercase.sql /******************************************************************************** component-centric-snapshot-description-fsn-uppercase Assertion: The first letter of the active FSN associated with active concept should be capitalized. note: due to a large number of exceptions, this implementation is focused on terms edited in the current propspective release ********************************************************************************/ insert into qa_result (runid, assertionuuid, concept_id, details) select <RUNID>, '<ASSERTIONUUID>', a.conceptid, concat('DESC: id=',a.id, ':First letter of the active FSN of active concept not capitalized.') from curr_description_d a join curr_concept_s b on a.conceptid = b.id and b.active = a.active where a.active = 1 and a.typeid = '900000000000003001' and a.casesignificanceid != '900000000000017005' and binary left(a.term,1) != binary upper(left(a.term,1)); commit;
CREATE TABLE T (c MEDIUMINT)
<reponame>netfire1/SimpleMailer -- phpMyAdmin SQL Dump -- version 4.0.10deb1 -- http://www.phpmyadmin.net -- -- Хост: localhost -- Время создания: Авг 10 2015 г., 01:07 -- Версия сервера: 5.5.44-0ubuntu0.14.04.1 -- Версия PHP: 5.5.9-1ubuntu4.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 utf8 */; -- -- База данных: `mailer` -- -- -------------------------------------------------------- -- -- Структура таблицы `email` -- CREATE TABLE IF NOT EXISTS `email` ( `id` int(11) NOT NULL AUTO_INCREMENT, `email` varchar(100) NOT NULL, `sent_date` datetime DEFAULT NULL, `status` tinyint(4) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; -- -- Дамп данных таблицы `email` -- INSERT INTO `email` (`id`, `email`, `sent_date`, `status`) VALUES (2, '<EMAIL>', '2015-08-09 12:33:18', 1), (3, '<EMAIL>', '2015-08-09 12:47:19', 1), (5, '<EMAIL>', '2015-08-09 10:18:43', 1), (7, '<EMAIL>', '2015-08-09 12:38:48', 1), (8, '<EMAIL>', '2015-08-09 12:38:43', 1), (9, '<EMAIL>', '2015-08-09 12:47:14', 1), (10, '<EMAIL>', '2015-08-09 12:33:26', 1); /*!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 */;
<reponame>cooliyev/yii-advanced -- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1 -- Время создания: Май 07 2021 г., 17:59 -- Версия сервера: 10.4.13-MariaDB -- Версия PHP: 7.4.8 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 */; -- -- База данных: `yii2advanced` -- -- -------------------------------------------------------- -- -- Структура таблицы `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `status` smallint(6) NOT NULL DEFAULT 10, `created_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL, `verification_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Дамп данных таблицы `user` -- INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`, `verification_token`) VALUES (1, 'cooliyev', 'qrIFirqFkQVn3voeAigny4TkRPFUoO2W', '$2<PASSWORD>$tlGI8rztBJQxi4S48HBzWe<PASSWORD>8<PASSWORD>E<PASSWORD>/TZdnC6eVOC', NULL, '<EMAIL>', 10, 1620378497, 1620379098, 'InilpfuOGJE736_XBLQSokZhY7ajnJZD_1620378497'); -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username` (`username`), ADD UNIQUE KEY `email` (`email`), ADD UNIQUE KEY `password_reset_token` (`<PASSWORD>`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; 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 */;
DO $$ BEGIN IF register_patch('UpdateTableNamingConventions.sql', 'jekabskarklins', 'Updating database naming conventions for generic templates', '2020-05-26') THEN BEGIN /* altering table names*/ ALTER TABLE proposal_answers RENAME TO answers; ALTER TABLE proposal_answers_files RENAME TO answer_has_files; ALTER TABLE proposal_question__proposal_template__rels RENAME TO templates_has_questions; ALTER TABLE proposal_question_datatypes RENAME TO question_datatypes; ALTER TABLE proposal_questions RENAME TO questions; ALTER TABLE proposal_templates RENAME TO templates; ALTER TABLE proposal_topics RENAME TO topics; ALTER TABLE proposal_topic_completenesses RENAME TO topic_completenesses; /* simply altering name of columns */ ALTER TABLE templates_has_questions RENAME COLUMN proposal_question_id TO question_id; ALTER TABLE templates_has_questions RENAME COLUMN dependency_proposal_question_id TO dependency_question_id; ALTER TABLE answers RENAME COLUMN proposal_question_id TO question_id; ALTER TABLE question_datatypes RENAME COLUMN proposal_question_datatype_id TO question_datatype_id; ALTER TABLE questions RENAME COLUMN proposal_question_id TO question_id; /* changing from proposal_id to questionary_id */ ALTER TABLE topic_completenesses RENAME COLUMN proposal_id TO questionary_id; /* constraint updated down */ ALTER TABLE answers RENAME COLUMN proposal_id TO questionary_id; /* constraint updated down */ /* changing from template_id to questionary_id */ ALTER TABLE proposals RENAME COLUMN template_id TO questionary_id; /* constraint updated down */ CREATE TABLE IF NOT EXISTS template_categories ( template_category_id serial PRIMARY KEY , name VARCHAR(100) NOT NULL ); CREATE TABLE IF NOT EXISTS questionaries ( questionary_id serial PRIMARY KEY , template_id INTEGER REFERENCES templates (template_id) , created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() ); CREATE TABLE IF NOT EXISTS answer_has_questionaries ( questionary_id INTEGER REFERENCES questionaries (questionary_id) , answer_id INTEGER REFERENCES answers (answer_id) ); CREATE TABLE IF NOT EXISTS questions_has_template ( template_id INTEGER REFERENCES templates (template_id) , question_id VARCHAR(64) REFERENCES questions (question_id) ); /* renaming constraints */ ALTER TABLE answer_has_files RENAME CONSTRAINT proposal_answers_files_answer_id_fkey TO answer_has_files_answer_id_fkey; ALTER TABLE answer_has_files RENAME CONSTRAINT proposal_answers_files_file_id_fkey TO answer_has_files_file_id_fkey; ALTER TABLE templates_has_questions RENAME CONSTRAINT proposal_question__proposal_template__rels_pkey TO templates_has_questions_pkey; ALTER TABLE templates_has_questions RENAME CONSTRAINT proposal_question__proposal_t_dependency_proposal_question_fkey TO templates_has_questions_dependency_question_id_fkey; ALTER TABLE templates_has_questions RENAME CONSTRAINT proposal_question__proposal_template__proposal_question_id_fkey TO templates_has_questions_question_id_fkey; ALTER TABLE templates_has_questions RENAME CONSTRAINT proposal_question__proposal_template__rels_template_id_fkey TO templates_has_questions_template_id_fkey; ALTER TABLE templates_has_questions RENAME CONSTRAINT proposal_question__proposal_template__rels_topic_id_fkey TO templates_has_questions_topic_id_fkey; ALTER TABLE templates_has_questions RENAME CONSTRAINT unq_proposal_question_id_template_id TO unq_question_id_template_id; ALTER TABLE question_datatypes RENAME CONSTRAINT proposal_question_datatypes_pkey TO question_datatypes_pkey; ALTER TABLE questions RENAME CONSTRAINT proposal_questions_pkey TO questions_pkey; ALTER TABLE questions RENAME CONSTRAINT proposal_questions_data_type_fkey TO questions_data_type_fkey; ALTER TABLE questions RENAME CONSTRAINT proposal_questions_natural_key_key TO questions_natural_key_key; ALTER TABLE templates RENAME CONSTRAINT proposal_templates_pkey TO templates_pkey; ALTER TABLE topics RENAME CONSTRAINT proposal_topics_pkey TO topics_pkey; ALTER TABLE topics RENAME CONSTRAINT proposal_topics_template_id_fkey TO topics_template_id_fkey; ALTER TABLE topic_completenesses RENAME CONSTRAINT proposal_topic_completenesses_pkey TO topic_completenesses_pkey; ALTER TABLE topic_completenesses RENAME CONSTRAINT proposal_topic_completenesses_topic_id_fkey TO topic_completenesses_topic_id_fkey; ALTER TABLE answers RENAME CONSTRAINT proposal_answers_pkey TO answers_pkey; ALTER TABLE answers RENAME CONSTRAINT proposal_answers_proposal_question_id_fkey TO answers_question_id_fkey; ALTER TABLE answers RENAME CONSTRAINT proposal_answers_answer_id_key TO answers_answer_id_key; /* altering constraints to point to questionary_id */ /* proposals(questionary_id) */ ALTER TABLE public.proposals DROP CONSTRAINT proposals_template_id_fkey; CREATE OR REPLACE FUNCTION CreateQuestionary() RETURNS integer AS $func$ declare q_id integer; BEGIN insert into questionaries(template_id) values(1) returning questionary_id into q_id; RETURN q_id; END; $func$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION UpdateProposalsTable() RETURNS VOID AS $func$ DECLARE t_row proposals%rowtype; BEGIN FOR t_row in SELECT * FROM proposals LOOP update proposals set questionary_id = CreateQuestionary() where proposal_id = t_row.proposal_id; END LOOP; END; $func$ LANGUAGE plpgsql; PERFORM UpdateProposalsTable(); /* Create new questionary for each proposal */ ALTER TABLE public.proposals ADD CONSTRAINT proposals_questionary_id_fkey FOREIGN KEY (questionary_id) REFERENCES public.questionaries (questionary_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; /* topic_completenesses(questionary_id) */ ALTER TABLE topic_completenesses DROP CONSTRAINT proposal_topic_completenesses_proposal_id_fkey; CREATE OR REPLACE FUNCTION UpdateCompletenesses() RETURNS VOID AS $func$ DECLARE t_row topic_completenesses%rowtype; BEGIN FOR t_row in SELECT * FROM topic_completenesses LOOP update topic_completenesses TC set questionary_id = (SELECT questionary_id from proposals P where TC.questionary_id = P.proposal_id) where questionary_id = t_row.questionary_id AND topic_id = t_row.topic_id ; END LOOP; END; $func$ LANGUAGE plpgsql; PERFORM UpdateCompletenesses(); ALTER TABLE topic_completenesses ADD CONSTRAINT topic_completenesses_questionary_id_fkey FOREIGN KEY (questionary_id) REFERENCES questionaries (questionary_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE; /* answers(questionary_id)*/ ALTER TABLE answers DROP CONSTRAINT proposal_answers_proposal_id_fkey; CREATE OR REPLACE FUNCTION UpdateAnswers() RETURNS VOID AS $func$ DECLARE t_row answers%rowtype; BEGIN FOR t_row in SELECT * FROM answers LOOP update answers A set questionary_id = (SELECT questionary_id from proposals P where A.questionary_id = P.proposal_id) where answer_id = t_row.answer_id; END LOOP; END; $func$ LANGUAGE plpgsql; PERFORM UpdateAnswers(); ALTER TABLE answers ADD CONSTRAINT answers_questionary_id_fkey FOREIGN KEY (questionary_id) REFERENCES questionaries (questionary_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE; END; END IF; END; $$ LANGUAGE plpgsql;
create table foo (id varchar(20), parent_id varchar(20),use_yn char(1)); insert into foo values('AFAC000002', 'AFA','Y'); insert into foo values('AFAC000018', 'AFAC000002','Y'); insert into foo values('AFAC000019', 'AFAC000002','Y'); insert into foo values('AFAC000020', 'AFAC000002','Y'); insert into foo values('AFAC000022', 'AFAC000002','Y'); select id,parent_id,use_yn from foo start with id='AFAC000002' connect by nocycle prior id=parent_id order by 1,2,3; drop table foo;
<filename>dhis-2/dhis-support/dhis-support-db-migration/src/main/resources/org/hisp/dhis/db/migration/2.35/V2_35_13__Add_visualization_colorset.sql -- Adds "colorset" property to "visualization" table alter table visualization add column if not exists "colorset" varchar(255);
<reponame>opengauss-mirror/Yat -- @testpoint:opengauss关键字no(非保留),作为模式名 --关键字不带引号-成功 drop schema if exists no; create schema no; drop schema no; --关键字带双引号-成功 drop schema if exists "no"; create schema "no"; drop schema "no"; --关键字带单引号-合理报错 drop schema if exists 'no'; create schema 'no'; --关键字带反引号-合理报错 drop schema if exists `no`; create schema `no`;
<reponame>iTZUNAMI/ionic-iosandroid-statsroyale-multihost -- phpMyAdmin SQL Dump -- version 4.6.6 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Creato il: Set 12, 2017 alle 03:46 -- Versione del server: 5.1.73 -- Versione PHP: 5.6.30 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 utf8 */; -- -- Database: `admindb_itzunami` -- -- -------------------------------------------------------- -- -- Struttura della tabella `sr_user` -- CREATE TABLE `sr_user` ( `id` int(11) NOT NULL, `creato` text NOT NULL, `stato` text NOT NULL, `aggiorna_data_last` text NOT NULL, `tag` text NOT NULL, `username` text NOT NULL, `livello` text NOT NULL, `clan` text NOT NULL, `clantag` text NOT NULL, `chest` text NOT NULL, `s1` text NOT NULL, `s2` text NOT NULL, `s3` text NOT NULL, `s4` text NOT NULL, `s5` text NOT NULL, `s6` text NOT NULL, `s7` text NOT NULL, `s8` text NOT NULL, `s9` text NOT NULL, `s10` text NOT NULL, `s11` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Indici per le tabelle scaricate -- -- -- Indici per le tabelle `sr_user` -- ALTER TABLE `sr_user` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT per le tabelle scaricate -- -- -- AUTO_INCREMENT per la tabella `sr_user` -- ALTER TABLE `sr_user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; /*!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 */;
--2008 DECLARE @ts_now BIGINT select @ts_now = cpu_ticks / (cpu_ticks/ms_ticks) from sys.dm_os_sys_info; SELECT --record_id, DATEADD(ms, -1 * (@ts_now - [timestamp]), GETDATE()) AS EventTime, SQLProcessUtilization, SystemIdle, 100 - SystemIdle - SQLProcessUtilization AS OtherProcessUtilization FROM ( SELECT record.value('(./Record/@id)[1]', 'bigint') AS record_id, record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'bigint') AS SystemIdle, record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'bigint') AS SQLProcessUtilization, TIMESTAMP FROM ( SELECT TIMESTAMP, CONVERT(XML, record) AS record FROM sys.dm_os_ring_buffers WHERE ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR' AND record LIKE '% %') AS x ) AS y ORDER BY record_id DESC --2005 declare @ts_now bigint select @ts_now = cpu_ticks / convert(float, cpu_ticks_in_ms) from sys.dm_os_sys_info select record_id, dateadd(ms, -1 * (@ts_now - [timestamp]), GetDate()) as EventTime, SQLProcessUtilization, SystemIdle, 100 - SystemIdle - SQLProcessUtilization as OtherProcessUtilization from ( select record.value('(./Record/@id)[1]', 'int') as record_id, record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') as SystemIdle, record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') as SQLProcessUtilization, timestamp from ( select timestamp, convert(xml, record) as record from sys.dm_os_ring_buffers where ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR' and record like '%<SystemHealth>%') as x ) as y order by record_id desc --select * from sys.dm_os_sys_info
<reponame>frigus02/futurenhs-platform<gh_stars>0 INSERT INTO groups ( id, title ) VALUES ( '66aea3a6-6775-4f85-90a9-05a71766c25f', 'Example workspace Members' ); INSERT INTO user_groups ( user_id, group_id ) SELECT users.id, '66aea3a6-6775-4f85-90a9-05a71766c25f' FROM users; INSERT INTO groups ( id, title ) VALUES ( '3d9144cd-f5f9-4126-84b8-1fb7a69f1ab7', 'Example workspace Admins' ); INSERT INTO user_groups (user_id, group_id) SELECT users.id, '3d9144cd-f5f9-4126-84b8-1fb7a69f1ab7' FROM users WHERE email_address = '<EMAIL>'; INSERT INTO workspaces (title, description, members, admins) VALUES ( 'Example workspace', 'Example workspace description', '66aea3a6-6775-4f85-90a9-05a71766c25f', '3d9144cd-f5f9-4126-84b8-1fb7a69f1ab7' );
<filename>ChineseIdiomService/db/chinese-idiom.sql<gh_stars>0 -- MySQL dump 10.13 Distrib 8.0.23, for Win64 (x86_64) -- -- Host: localhost Database: chinese-idiom -- ------------------------------------------------------ -- Server version 8.0.23 /*!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 */; /*!50503 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!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 */; -- -- Table structure for table `table_idiom` -- DROP TABLE IF EXISTS `table_idiom`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `table_idiom` ( `id` int NOT NULL AUTO_INCREMENT, `word` varchar(45) DEFAULT NULL COMMENT '成语', `length` int DEFAULT NULL COMMENT '长度', `pingyin` varchar(90) DEFAULT NULL COMMENT '完整拼音', `explanation` varchar(255) DEFAULT NULL COMMENT '解释', `source` varchar(255) DEFAULT NULL COMMENT '出处,来源', `tPintin` varchar(90) DEFAULT NULL COMMENT '去调拼音', `abbreviation` varchar(45) DEFAULT NULL COMMENT '拼音缩写', `firstchar` varchar(90) DEFAULT NULL COMMENT '首字', `lastchar` varchar(90) DEFAULT NULL COMMENT '尾字', `firstWordPinyin` varchar(45) DEFAULT NULL COMMENT '首字拼音,成语接龙时用', `lastWordPinyin` varchar(45) DEFAULT NULL COMMENT '末字拼音,成语接龙时用', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=30959 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `table_idiom_allusion` -- DROP TABLE IF EXISTS `table_idiom_allusion`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `table_idiom_allusion` ( `id` int NOT NULL AUTO_INCREMENT, `word` varchar(45) DEFAULT NULL COMMENT '成语', `allusion` text COMMENT '成语典故', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=389 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `table_idiom_story` -- DROP TABLE IF EXISTS `table_idiom_story`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `table_idiom_story` ( `id` int NOT NULL AUTO_INCREMENT, `word` varchar(45) DEFAULT NULL COMMENT '成语', `story` text COMMENT '成语故事', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=830 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!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 */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2022-03-20 12:46:03
<filename>example_insert_operation.sql<gh_stars>0 insert into test.akciahistory set investor_id=1, fond_id=41, akciacena=(select likvidstoim/akciacount as last_nav from test.likvid_book li join (select fond_id,max(time) as timeM from test.likvid_book where fond_id = 41 group by fond_id ) l on li.fond_id = l.fond_id and li.time=l.timeM ), akciacount=5000/akciacena+(select akciacount from test.likvid_book li join (select fond_id,max(time) as timeM from test.likvid_book where fond_id = 41 group by fond_id ) l on li.fond_id = l.fond_id and li.time=l.timeM ), akciacenamiddle = 21 , akciacenamaxmiddle = 321, voznagrupravl_bool = 0, likvid_book_id = 0, `time`=111, date__ = '2200-01-01 11:11:11'
-------------------------------------------------------- -- Miscelaneous data to be inserted at database creation -------------------------------------------------------- BEGIN TRANSACTION; -- ------------ -- CANON Models -- ------------ /*INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('Canon EOS 200D', 'EXIF', 'RGGB', 2048, '.CR2'); INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('Canon EOS 400D DIGITAL', 'EXIF', 'RGGB', 256, '.CR2'); INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('Canon EOS 450D', 'EXIF', 'RGGB', 1024, '.CR2'); INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('Canon EOS 550D', 'EXIF', 'GBRG', 2048, '.CR2'); INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('Canon EOS 750D', 'EXIF', 'RGGB', 2048, '.CR2'); INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('Canon EOS 1300D', 'EXIF', 'GRBG', 2048, '.CR2'); -- REVIEW BIAS AND EXTENSION !!!!!!!! ... INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('Canon EOS 77D', 'EXIF', 'RGGB', 0, '.CR2'); */ -- ------------ -- Nikon Models -- ------------ /*INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('NIKON D5200', 'EXIF', 'RGGB', 0, '.NEF'); INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('NIKON 1 V1', 'EXIF', 'RGGB', 0, '.NEF'); INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('NIKON D50', 'EXIF', 'BGGR', 0, '.NEF'); */ -- -------------- -- Olympus Models -- -------------- /*INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('E-M10', 'EXIF', 'RGGB', 256, '.ORF');*/ -- -------------- -- Pentax Models -- -------------- /* INSERT INTO camera_t(model, header_type, bayer_pattern, bias, extension) VALUES ('PENTAX K100D Super', 'EXIF', 'RGGB', 128, '.PEF');*/ COMMIT;
DROP TABLE IF EXISTS photos, answers, questions; CREATE TABLE questions ( id SERIAL NOT NULL, product_id INT NOT NULL, body TEXT, date_written BIGINT, asker_name VARCHAR (50), asker_email VARCHAR (50), reported BOOLEAN, helpful INT, PRIMARY KEY (id) ); copy questions(id, product_id, body, date_written, asker_name, asker_email, reported, helpful) FROM '/Users/meilinchen/sei/SDC/questions.csv' DELIMITER ',' CSV HEADER; CREATE INDEX product_idx ON questions USING HASH (product_id);
<reponame>JeanDevonne/Admision /* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50721 Source Host : localhost:3306 Source Database : admision Target Server Type : MYSQL Target Server Version : 50721 File Encoding : 65001 Date: 2018-04-19 00:45:30 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for area -- ---------------------------- DROP TABLE IF EXISTS `area`; CREATE TABLE `area` ( `idarea` int(11) NOT NULL, `area_nombre` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `area_detalle` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, PRIMARY KEY (`idarea`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- ---------------------------- -- Table structure for especialidad -- ---------------------------- DROP TABLE IF EXISTS `especialidad`; CREATE TABLE `especialidad` ( `idcarrera` int(11) NOT NULL, `especialidad_nombre` varchar(50) COLLATE utf8_spanish_ci NOT NULL, `numero_vacantes` int(11) DEFAULT NULL, PRIMARY KEY (`idcarrera`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- ---------------------------- -- Table structure for omr -- ---------------------------- DROP TABLE IF EXISTS `omr`; CREATE TABLE `omr` ( `idomr` int(11) NOT NULL AUTO_INCREMENT, `omrcol1` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol2` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol3` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol4` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol5` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol6` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol7` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol8` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol9` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol10` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol11` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol12` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol13` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol14` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol15` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol16` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol17` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol18` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol19` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol20` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol21` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol22` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol23` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol24` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol25` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol26` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol27` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol28` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol29` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol30` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol31` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol32` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol33` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol34` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol35` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol36` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol37` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol38` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol39` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol40` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol41` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol42` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol43` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol44` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol45` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol46` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol47` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol48` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol49` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol50` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol51` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol52` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol53` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol54` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol55` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol56` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol57` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol58` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol59` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol60` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol61` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol62` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol63` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol64` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol65` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol66` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol67` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol68` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol69` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol70` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol71` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol72` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol73` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol74` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol75` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol76` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol77` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol78` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol79` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol80` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol81` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol82` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol83` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol84` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol85` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol86` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol87` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol88` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol89` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol90` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol91` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol92` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol93` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol94` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol95` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol96` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol97` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol98` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol99` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `omrcol100` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `puntaje` int(11) DEFAULT NULL, PRIMARY KEY (`idomr`) ) ENGINE=InnoDB AUTO_INCREMENT=5101 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- ---------------------------- -- Table structure for postulante -- ---------------------------- DROP TABLE IF EXISTS `postulante`; CREATE TABLE `postulante` ( `idpostulante` int(11) NOT NULL, `nombres` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `apellidos` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `telefono` int(10) DEFAULT NULL, `email` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `sexo` char(1) COLLATE utf8_spanish_ci DEFAULT NULL, `tipo_documento` char(5) COLLATE utf8_spanish_ci NOT NULL, `numero_documento` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `imagen` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL COMMENT 'Ruta de la imagen del postulante', `especialidad_idcarrera` int(11) NOT NULL, `omr_idomr` int(11) NOT NULL, PRIMARY KEY (`idpostulante`), KEY `fk_postulante_especialidad1_idx` (`especialidad_idcarrera`), KEY `fk_postulante_omr1_idx` (`omr_idomr`), CONSTRAINT `fk_postulante_especialidad1` FOREIGN KEY (`especialidad_idcarrera`) REFERENCES `especialidad` (`idcarrera`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_postulante_omr1` FOREIGN KEY (`omr_idomr`) REFERENCES `omr` (`idomr`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- ---------------------------- -- Table structure for pregunta -- ---------------------------- DROP TABLE IF EXISTS `pregunta`; CREATE TABLE `pregunta` ( `idpregunta` int(11) NOT NULL COMMENT 'Id de la pregunta, será autoincremental, no acepta nulos y será llave primaria', `pregunta_detalle` varchar(500) COLLATE utf8_spanish_ci DEFAULT NULL COMMENT 'Es el enunciado de la pregunta en si.', `pregunta_imagen` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL COMMENT 'almacena la ruta en al que se encuentra ubicada la imagen asociada a dicha pregunta.\nPuede tomar valores NULL', `pregunta_respuesta` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, PRIMARY KEY (`idpregunta`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- ---------------------------- -- Table structure for vacantes -- ---------------------------- DROP TABLE IF EXISTS `vacantes`; CREATE TABLE `vacantes` ( `vacantes` int(11) DEFAULT NULL, `especialidad_idcarrera` int(11) NOT NULL, KEY `fk_vacantes_especialidad1_idx` (`especialidad_idcarrera`), CONSTRAINT `fk_vacantes_especialidad1` FOREIGN KEY (`especialidad_idcarrera`) REFERENCES `especialidad` (`idcarrera`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; SET FOREIGN_KEY_CHECKS=1;
select distinct title from content a join TVProgram b on a.content_id = b.content_id and a.Kids_content = "Y" and a.content_type = "Movies" and year(b.program_date) = "2020" and month(b.program_date) = "6"
-- Create the database CREATE DATABASE `calendar_app`; USE `calendar_app`; -- Create the table CREATE TABLE `phone_numbers` ( `id` varchar(25) NOT NULL DEFAULT '', `credentials` varchar(2048) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server version: 5.6.27-0ubuntu0.14.04.1 - (Ubuntu) -- Server OS: debian-linux-gnu -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!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' */; -- Dumping database structure for db_buku CREATE DATABASE IF NOT EXISTS `db_buku` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `db_buku`; -- Dumping structure for table db_buku.bukus CREATE TABLE IF NOT EXISTS `bukus` ( `isbn` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `judul` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `pengarang` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `penerbit` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `halaman` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`isbn`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- Dumping data for table db_buku.bukus: ~14 rows (approximately) /*!40000 ALTER TABLE `bukus` DISABLE KEYS */; INSERT INTO `bukus` (`isbn`, `judul`, `pengarang`, `penerbit`, `halaman`, `created_at`, `updated_at`) VALUES ('9786022910954', 'Perahu Kertas', 'Dee Lestari', 'Bentang Pustaka', 564, '2016-03-28 02:34:48', '2016-03-28 02:34:48'), ('9786022910985', 'Filosofi Kopi', '<NAME>', 'Bentang Pustaka', 112, '2016-03-28 02:36:44', '2016-03-28 02:36:44'), ('9786022911029', 'Ayah', '<NAME>', 'Bentang Pustaka', 432, '2016-03-28 02:01:42', '2016-03-28 02:01:42'), ('9786022911111', 'Rudy', '<NAME>', 'Bentang Pustaka', 280, '2016-03-28 02:05:42', '2016-03-28 02:05:42'), ('9786028811095', 'Dwilogi Padang Bulan & Cinta di Dalam Gelas', '<NAME>', 'Bentang Pustaka', 544, '2016-03-28 02:11:52', '2016-03-28 02:11:52'), ('9786028811521', '<NAME>', '<NAME>', 'Bentang Pustaka', 124, '2016-03-28 02:13:45', '2016-03-28 02:13:45'), ('9789791227025', 'Edensor', '<NAME>', 'Bentang Pustaka', 290, '2016-03-28 02:20:33', '2016-03-28 02:20:33'), ('9789791227452', '<NAME>', '<NAME>', 'Bentang Pustaka', 504, '2016-03-28 02:09:36', '2016-03-28 02:09:36'), ('9789792248616', 'Negeri 5 Menara', '<NAME>', 'Gramedia', 432, '2016-03-28 02:25:54', '2016-03-28 02:25:54'), ('9789792263251', '<NAME>', '<NAME>', 'Gramedia', 473, '2016-03-28 02:28:30', '2016-03-28 02:28:30'), ('9789792294736', '<NAME>', '<NAME>', 'Gramedia', 400, '2016-03-28 02:30:31', '2016-03-28 02:30:31'), ('9789793062792', '<NAME>', '<NAME>', 'Bentang Pustaka', 548, '2016-03-28 02:03:48', '2016-03-28 02:03:48'), ('9789793062921', '<NAME>', '<NAME>', 'Bentang Pustaka', 292, '2016-03-28 02:23:41', '2016-03-28 02:23:41'), ('9789797803629', 'Refrain', '<NAME>', 'Gagas Media', 318, '2016-03-28 02:40:52', '2016-03-28 02:40:52'); /*!40000 ALTER TABLE `bukus` ENABLE KEYS */; -- Dumping structure for table db_buku.migrations CREATE TABLE IF NOT EXISTS `migrations` ( `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- Dumping data for table db_buku.migrations: ~2 rows (approximately) /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; INSERT INTO `migrations` (`migration`, `batch`) VALUES ('2014_10_12_000000_create_users_table', 1), ('2014_10_12_100000_create_password_resets_table', 1), ('2016_03_24_073701_create_bukus_table', 1); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; -- Dumping structure for table db_buku.password_resets CREATE TABLE IF NOT EXISTS `password_resets` ( `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY `password_resets_email_index` (`email`), KEY `password_resets_token_index` (`token`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- Dumping data for table db_buku.password_resets: ~0 rows (approximately) /*!40000 ALTER TABLE `password_resets` DISABLE KEYS */; /*!40000 ALTER TABLE `password_resets` ENABLE KEYS */; -- Dumping structure for table db_buku.users CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- Dumping data for table db_buku.users: ~0 rows (approximately) /*!40000 ALTER TABLE `users` DISABLE KEYS */; /*!40000 ALTER TABLE `users` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
<reponame>lvbuwei/pgsql-utils CREATE OR REPLACE FUNCTION last1hours() RETURNS timestamp AS $$ SELECT (current_timestamp - INTERVAL '1 hours')::timestamp; $$ LANGUAGE sql immutable;
<reponame>kokowijanarko/popperca ALTER TABLE `popperca`.`dev_invoice` ADD COLUMN `invoice_courier` VARCHAR(100) NULL AFTER `invoice_amount`, ADD COLUMN `invoice_courier_pakage` VARCHAR(100) NULL AFTER `invoice_courier`, ADD COLUMN `invoice_courier_amount` INT NULL AFTER `invoice_courier_pakage`;
 CREATE VIEW [internal].[execution_info] AS SELECT execs.[execution_id], execs.[folder_name], execs.[project_name], execs.[package_name], execs.[reference_id], execs.[reference_type], execs.[environment_folder_name], execs.[environment_name], execs.[project_lsn], execs.[executed_as_sid], execs.[executed_as_name], execs.[use32bitruntime], opers.[operation_type], opers.[created_time], opers.[object_type], opers.[object_id], opers.[status], opers.[start_time], opers.[end_time], opers.[caller_sid], opers.[caller_name], opers.[process_id], opers.[stopped_by_sid], opers.[stopped_by_name], opers.[operation_guid] as [dump_id], opers.[server_name], opers.[machine_name] FROM [internal].[executions] execs INNER JOIN [internal].[operations] opers ON execs.[execution_id]= opers.[operation_id] WHERE opers.[operation_id] in (SELECT id FROM [internal].[current_user_readable_operations]) OR (IS_MEMBER('ssis_admin') = 1) OR (IS_SRVROLEMEMBER('sysadmin') = 1)
<filename>server/resources/patches/1.Init.sql -- create table user CREATE TABLE IF NOT EXISTS user ( id int(10) unsigned NOT NULL AUTO_INCREMENT, client_public_key_hash BINARY(20) NOT NULL, client_public_key TEXT, server_private_key TEXT, created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY client_public_key_hash (client_public_key_hash) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- create table account CREATE TABLE IF NOT EXISTS account ( id int(10) unsigned NOT NULL AUTO_INCREMENT, user_id int(10) unsigned DEFAULT NULL, ext_id VARCHAR(255) NOT NULL, provider int(10) unsigned NOT NULL, created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), CONSTRAINT fk_account_user FOREIGN KEY (user_id) REFERENCES user(id), UNIQUE KEY ext_id (ext_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--liquibase formatted sql --changeset uk.gov.pay:add_payment_requests_fk-gateway_accounts_id ALTER TABLE payment_requests ADD CONSTRAINT fk_payment_requests_gateway_accounts FOREIGN KEY (gateway_account_id) REFERENCES gateway_accounts (id) ON DELETE NO ACTION ; --rollback ALTER TABLE payment_requests DROP CONSTRAINT fk_payment_requests_gateway_accounts;
<filename>src/SFA.Apprenticeships.Data.AvmsPlus/dbo/Stored Procedures/uspTrainingProviderHistorySelectByHistoryId.sql create PROCEDURE [dbo].[uspTrainingProviderHistorySelectByHistoryId] @historyId INT AS BEGIN SET NOCOUNT ON select TPH.TrainingProviderHistoryId as 'HistoryId', TPH.TrainingProviderId, TPH.EventTypeId as 'EventTypeId', ISNULL(TPH.Comment,'') as 'Comment', TPH.HistoryDate as 'EventDate', ISNULL(TPH.UserName,'') as 'UserName' from [ProviderSiteHistory] TPH WHERE TrainingProviderHistoryId = @historyId SET NOCOUNT OFF END
<reponame>mbbaraka/mianzi -- phpMyAdmin SQL Dump -- version 4.9.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 25, 2020 at 12:33 PM -- Server version: 10.4.10-MariaDB -- PHP Version: 7.3.12 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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: `mianzi` -- -- -------------------------------------------------------- -- -- Table structure for table `addresses` -- CREATE TABLE `addresses` ( `id` bigint(20) UNSIGNED NOT NULL, `customer_id` bigint(20) UNSIGNED NOT NULL, `region_id` bigint(20) UNSIGNED NOT NULL, `district_id` bigint(20) UNSIGNED NOT NULL, `address1` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `address2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `note` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `default` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `addresses` -- INSERT INTO `addresses` (`id`, `customer_id`, `region_id`, `district_id`, `address1`, `address2`, `phone`, `note`, `default`, `created_at`, `updated_at`) VALUES (1, 1, 2, 2, 'Kayunga', 'Busaana', '0773034311', 'Hello world', '1', '2020-08-25 21:00:00', '2020-08-26 21:00:00'); -- -------------------------------------------------------- -- -- Table structure for table `attributes` -- CREATE TABLE `attributes` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `attributes` -- INSERT INTO `attributes` (`id`, `name`, `created_at`, `updated_at`) VALUES (6, 'Material', '2020-08-08 14:18:31', '2020-08-08 14:18:31'), (7, 'Size', '2020-08-08 14:18:43', '2020-08-08 14:18:43'); -- -------------------------------------------------------- -- -- Table structure for table `attribute_product` -- CREATE TABLE `attribute_product` ( `id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `attribute_value_id` bigint(20) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `attribute_product` -- INSERT INTO `attribute_product` (`id`, `product_id`, `attribute_value_id`, `created_at`, `updated_at`) VALUES (25, 11, 8, '2020-08-08 14:20:06', '2020-08-08 14:20:06'); -- -------------------------------------------------------- -- -- Table structure for table `attribute_values` -- CREATE TABLE `attribute_values` ( `id` bigint(20) UNSIGNED NOT NULL, `attribute_id` bigint(20) UNSIGNED NOT NULL, `value` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `attribute_values` -- INSERT INTO `attribute_values` (`id`, `attribute_id`, `value`, `created_at`, `updated_at`) VALUES (7, 7, 'Small', '2020-08-08 14:18:55', '2020-08-08 14:18:55'), (8, 7, 'Medium', '2020-08-08 14:19:13', '2020-08-08 14:19:13'), (9, 7, 'Large', '2020-08-08 14:19:21', '2020-08-08 14:19:21'), (10, 6, 'Soft', '2020-08-08 14:19:37', '2020-08-08 14:19:37'), (11, 6, 'Hard', '2020-08-08 14:19:44', '2020-08-08 14:19:44'); -- -------------------------------------------------------- -- -- Table structure for table `banners` -- CREATE TABLE `banners` ( `id` bigint(20) UNSIGNED NOT NULL, `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `sub_title` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `button` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` enum('0','1') COLLATE utf8mb4_unicode_ci DEFAULT NULL, `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `banners` -- INSERT INTO `banners` (`id`, `title`, `sub_title`, `description`, `button`, `url`, `status`, `image`, `type`, `created_at`, `updated_at`) VALUES (2, 'Special Message', 'hello world', 'This is gallery page', 'Shop Now', 'www.mianzi.io', '1', '2020-08-05-5f29ea43704f7.jpg', 'slider', '2020-08-04 19:02:09', '2020-08-04 23:07:47'), (3, 'Banner title', 'This is subtitle', 'This is banner description', 'Shop Now', 'www.mianzi.io', '1', '2020-08-04-5f29b0eb7a8de.jpg', 'slider', '2020-08-04 19:03:07', '2020-08-04 19:03:07'); -- -------------------------------------------------------- -- -- Table structure for table `blog_categories` -- CREATE TABLE `blog_categories` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `order` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `created_by` int(10) UNSIGNED DEFAULT NULL, `updated_by` int(10) UNSIGNED DEFAULT NULL, `deleted_by` int(10) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `carts` -- CREATE TABLE `carts` ( `id` bigint(20) UNSIGNED NOT NULL, `customer_id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `qty` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `carts` -- INSERT INTO `carts` (`id`, `customer_id`, `product_id`, `price`, `qty`, `created_at`, `updated_at`) VALUES (10, 1, 10, '89.00', 1, '2020-08-08 14:13:18', '2020-08-22 19:53:22'), (11, 2, 11, '8900', 1, '2020-08-18 15:59:56', '2020-08-18 15:59:56'), (12, 3, 3, '4000', 3, '2020-08-19 12:20:48', '2020-08-19 12:20:48'), (13, 1, 13, '74500', 1, '2020-08-21 15:30:08', '2020-08-21 15:30:08'), (14, 1, 4, '8900', 1, '2020-08-22 18:51:13', '2020-08-22 18:51:13'); -- -------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE `categories` ( `id` bigint(20) UNSIGNED NOT NULL, `root` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `thumbnail` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `categories` -- INSERT INTO `categories` (`id`, `root`, `title`, `slug`, `thumbnail`, `created_at`, `updated_at`) VALUES (1, '0', 'Furniture', 'furniture', '2020-07-14-5f0d5f95119a1.jpg', '2020-07-14 04:24:47', '2020-07-14 04:32:37'), (2, '0', 'Cookery', 'cookery', '2020-07-14-5f0d5f876fd9d.jpg', '2020-07-14 04:29:25', '2020-07-14 04:32:23'), (3, '0', 'Seedling', 'seedling', '2020-07-14-5f0d5f60384a0.jpg', '2020-07-14 04:31:44', '2020-07-14 04:31:44'), (4, '3', 'Sub Seedling', 'sub-seedling', '2020-07-14-5f0d665f1cf9a.jpg', '2020-07-14 05:01:35', '2020-07-14 05:01:35'), (6, '3', 'sub seedling three', 'sub-seedling-three', '2020-07-14-5f0d6725d69df.jpg', '2020-07-14 05:04:53', '2020-07-14 05:04:53'), (8, '3', 'sub seedling five', 'sub-seedling-five', '2020-07-14-5f0d67c0b7f1f.jpg', '2020-07-14 05:07:28', '2020-07-14 05:07:28'), (10, '0', 'Main Category One', 'main-category-one', '2020-08-06-5f2c563b830e6.jpg', '2020-08-06 19:12:59', '2020-08-06 19:12:59'), (11, '10', 'Sub Category One', 'sub-category-one', '2020-08-06-5f2c5663ba200.jpg', '2020-08-06 19:13:39', '2020-08-06 19:13:39'), (12, '11', 'SUb SUb category one', 'sub-sub-category-one', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (13, '11', 'SUb SUb category two', 'sub-sub-category-two', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (14, '11', 'SUb SUb category three', 'sub-sub-category-three', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (15, '11', 'SUb SUb category four', 'sub-sub-category-four', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (16, '10', 'Sub Category Two', 'sub-category-two', '2020-08-06-5f2c5917166c2.jpg', '2020-08-06 19:25:11', '2020-08-06 19:25:11'), (17, '10', 'Sub Category Three', 'sub-category-three', '2020-08-06-5f2c5917166c2.jpg', '2020-08-06 19:25:11', '2020-08-06 19:25:11'), (18, '8', 'sub seedling three', 'sub-seedling-three', '2020-07-14-5f0d6725d69df.jpg', '2020-07-14 05:04:53', '2020-07-14 05:04:53'), (19, '16', 'SUb SUb category one', 'sub-sub-category-one1', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (20, '16', 'SUb SUb category two', 'sub-sub-category-two2', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (21, '16', 'SUb SUb category three', 'sub-sub-category-three2', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (22, '16', 'SUb SUb category four', 'sub-sub-category-four2', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (23, '17', 'SUb SUb category one', 'sub-sub-category-one11', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (24, '17', 'SUb SUb category two', 'sub-sub-category-two21', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (25, '17', 'SUb SUb category three', 'sub-sub-category-three21', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (26, '17', 'SUb SUb category four', 'sub-sub-category-four21', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (27, '10', 'Sub Category Three', 'sub-category-threed', '2020-08-06-5f2c5917166c2.jpg', '2020-08-06 19:25:11', '2020-08-06 19:25:11'), (28, '27', 'SUb SUb category one', 'sub-sub-category-one11s', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (29, '27', 'SUb SUb category two', 'sub-sub-category-two21d', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (30, '27', 'SUb SUb category three', 'sub-sub-category-three21d', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (31, '27', 'SUb SUb category four', 'sub-sub-category-four21d', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (32, '10', 'SUb SUb category four', 'sub-sub-category-four21df', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (33, '32', 'SUb SUb category two', 'sub-sub-category-two21dee', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (34, '32', 'SUb SUb category three', 'sub-sub-category-three21ddd', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'), (35, '32', 'SUb SUb category four', 'sub-sub-category-four21dxc', '2020-08-06-5f2c569dc9937.jpg', '2020-08-06 19:14:37', '2020-08-06 19:14:37'); -- -------------------------------------------------------- -- -- Table structure for table `category_product` -- CREATE TABLE `category_product` ( `id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `category_id` bigint(20) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `category_product` -- INSERT INTO `category_product` (`id`, `product_id`, `category_id`, `created_at`, `updated_at`) VALUES (1, 1, 1, '2020-07-14 08:31:52', '2020-07-14 08:31:52'), (2, 1, 3, '2020-07-14 08:31:52', '2020-07-14 08:31:52'), (3, 3, 1, '2020-07-14 08:35:50', '2020-07-14 08:35:50'), (5, 4, 2, '2020-07-14 08:39:52', '2020-07-14 08:39:52'), (6, 4, 3, '2020-07-14 08:39:52', '2020-07-14 08:39:52'), (7, 4, 4, '2020-07-14 08:39:52', '2020-07-14 08:39:52'), (8, 4, 6, '2020-07-14 08:39:52', '2020-07-14 08:39:52'), (9, 5, 1, '2020-07-14 08:44:34', '2020-07-14 08:44:34'), (10, 5, 3, '2020-07-14 08:44:35', '2020-07-14 08:44:35'), (11, 6, 1, '2020-07-14 08:45:09', '2020-07-14 08:45:09'), (12, 6, 3, '2020-07-14 08:45:09', '2020-07-14 08:45:09'), (13, 7, 1, '2020-07-14 08:48:39', '2020-07-14 08:48:39'), (14, 7, 2, '2020-07-14 08:48:39', '2020-07-14 08:48:39'), (15, 7, 4, '2020-07-14 08:48:39', '2020-07-14 08:48:39'), (16, 8, 2, '2020-07-14 08:51:54', '2020-07-14 08:51:54'), (17, 8, 3, '2020-07-14 08:51:54', '2020-07-14 08:51:54'), (18, 8, 6, '2020-07-14 08:51:54', '2020-07-14 08:51:54'), (24, 10, 6, '2020-07-14 11:55:02', '2020-07-14 11:55:02'), (25, 9, 6, '2020-07-14 11:55:53', '2020-07-14 11:55:53'), (26, 10, 4, '2020-07-14 12:18:10', '2020-07-14 12:18:10'), (27, 10, 8, '2020-07-14 12:22:24', '2020-07-14 12:22:24'), (28, 9, 2, '2020-07-27 19:34:43', '2020-07-27 19:34:43'), (29, 11, 2, '2020-07-28 23:05:00', '2020-07-28 23:05:00'), (30, 11, 6, '2020-07-28 23:05:00', '2020-07-28 23:05:00'), (31, 12, 10, '2020-08-19 19:41:16', '2020-08-19 19:41:16'), (33, 12, 3, '2020-08-19 19:54:49', '2020-08-19 19:54:49'), (34, 13, 8, '2020-08-19 20:12:00', '2020-08-19 20:12:00'), (35, 13, 10, '2020-08-19 20:12:00', '2020-08-19 20:12:00'), (36, 13, 1, '2020-08-19 20:14:18', '2020-08-19 20:14:18'); -- -------------------------------------------------------- -- -- Table structure for table `compares` -- CREATE TABLE `compares` ( `id` bigint(20) UNSIGNED NOT NULL, `customer_id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `compares` -- INSERT INTO `compares` (`id`, `customer_id`, `product_id`, `created_at`, `updated_at`) VALUES (2, 1, 9, '2020-08-06 21:50:05', '2020-08-06 21:50:05'), (3, 1, 7, '2020-08-06 22:10:34', '2020-08-06 22:10:34'), (4, 1, 8, '2020-08-06 22:10:59', '2020-08-06 22:10:59'), (5, 1, 4, '2020-08-06 22:11:22', '2020-08-06 22:11:22'); -- -------------------------------------------------------- -- -- Table structure for table `coupons` -- CREATE TABLE `coupons` ( `id` bigint(20) UNSIGNED NOT NULL, `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `percentage` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `start_date` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `end_date` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `customers` -- CREATE TABLE `customers` ( `id` bigint(20) UNSIGNED NOT NULL, `first_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `last_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `mobile` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `gender` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `date_of_birth` date DEFAULT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `customers` -- INSERT INTO `customers` (`id`, `first_name`, `last_name`, `email`, `mobile`, `gender`, `date_of_birth`, `email_verified_at`, `password`, `avatar`, `created_at`, `updated_at`) VALUES (1, 'Mark', 'Baraka', '<EMAIL>', '0772568963', NULL, NULL, NULL, '$2y$10$ks8LZWgcSkjhVP4.wuM1he5wdEj8peFbDotu.D6XsFfJrncehyUSm', NULL, '2020-07-18 07:56:38', '2020-07-18 07:56:38'), (2, 'mark', 'bright', '<EMAIL>', NULL, NULL, NULL, NULL, '$2y$10$59OFDjqQar6z/lTIk70KlePPFlAvkemteLepEPHBvPEzGqmpylvxW', NULL, '2020-07-18 12:39:46', '2020-07-18 12:39:46'), (3, 'Mark', 'Baraka', '<EMAIL>', NULL, NULL, NULL, NULL, '$2y$10$3M.LqsrErse4bgNoQszHheWKWsLsLdOMIlNhHDyWNc4WIVQBcGN.a', NULL, '2020-08-19 11:56:21', '2020-08-19 11:56:21'); -- -------------------------------------------------------- -- -- Table structure for table `districts` -- CREATE TABLE `districts` ( `id` bigint(20) UNSIGNED NOT NULL, `region_id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `districts` -- INSERT INTO `districts` (`id`, `region_id`, `name`, `created_at`, `updated_at`) VALUES (2, 2, 'Mayuged', '2020-07-16 07:48:30', '2020-07-16 08:10:29'); -- -------------------------------------------------------- -- -- Table structure for table `failed_jobs` -- CREATE TABLE `failed_jobs` ( `id` bigint(20) UNSIGNED NOT NULL, `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `failed_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2019_08_19_000000_create_failed_jobs_table', 1), (4, '2020_03_01_124317_create_permission_tables', 1), (5, '2020_04_03_131427_create_trackers_table', 1), (6, '2020_04_03_132037_create_user_login_logs_table', 1), (7, '2020_07_13_223641_create_products_table', 1), (8, '2020_07_13_223842_create_categories_table', 1), (9, '2020_07_13_223916_create_customers_table', 1), (10, '2020_07_13_223930_create_regions_table', 1), (11, '2020_07_13_223940_create_districts_table', 1), (12, '2020_07_13_224013_create_attributes_table', 1), (13, '2020_07_13_224049_create_attribute_values_table', 1), (14, '2020_07_13_224108_create_attribute_products_table', 1), (15, '2020_07_13_224119_create_addresses_table', 1), (16, '2020_07_13_224141_create_shippings_table', 1), (17, '2020_07_13_224207_create_shipping_prices_table', 1), (18, '2020_07_13_224233_create_order_statuses_table', 1), (19, '2020_07_13_224252_create_category_products_table', 1), (20, '2020_07_13_224305_create_product_images_table', 1), (21, '2020_07_13_224342_create_pickup_stations_table', 1), (22, '2020_07_13_224404_create_coupons_table', 1), (23, '2020_07_13_224414_create_wishlists_table', 1), (24, '2020_07_13_224513_create_subscriptions_table', 1), (25, '2020_07_13_230635_create_orders_table', 1), (26, '2020_07_13_233726_create_blog_categories_table', 1), (27, '2020_07_16_120836_create_order_products_table', 2), (28, '2020_07_16_141840_create_shipping_price_table', 3), (29, '2020_08_04_202711_create_banners_table', 4), (31, '2020_08_05_175715_create_reviews_table', 5), (32, '2020_08_05_193512_create_compares_table', 6), (33, '2020_08_05_193539_create_carts_table', 6), (34, '2020_08_18_213210_create_recently_vieweds_table', 7), (35, '2020_08_18_220705_create_recently_vieweds_table', 8); -- -------------------------------------------------------- -- -- Table structure for table `model_has_permissions` -- CREATE TABLE `model_has_permissions` ( `permission_id` bigint(20) UNSIGNED NOT NULL, `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `model_id` bigint(20) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `model_has_roles` -- CREATE TABLE `model_has_roles` ( `role_id` bigint(20) UNSIGNED NOT NULL, `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `model_id` bigint(20) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `model_has_roles` -- INSERT INTO `model_has_roles` (`role_id`, `model_type`, `model_id`) VALUES (1, 'App\\User', 1), (2, 'App\\User', 2); -- -------------------------------------------------------- -- -- Table structure for table `orders` -- CREATE TABLE `orders` ( `id` bigint(20) UNSIGNED NOT NULL, `reference` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `customer_id` bigint(20) UNSIGNED NOT NULL, `address_id` bigint(20) UNSIGNED NOT NULL, `order_status_id` bigint(20) UNSIGNED NOT NULL, `shipping_id` bigint(20) UNSIGNED NOT NULL, `total_price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `order_products` -- CREATE TABLE `order_products` ( `id` bigint(20) UNSIGNED NOT NULL, `order_id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `qty` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `order_statuses` -- CREATE TABLE `order_statuses` ( `id` bigint(20) UNSIGNED NOT NULL, `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `order_statuses` -- INSERT INTO `order_statuses` (`id`, `status`, `created_at`, `updated_at`) VALUES (1, 'Pending', NULL, NULL), (2, 'paid', NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `permissions` -- CREATE TABLE `permissions` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `guard_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `permissions` -- INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES (1, 'admin', 'web', '2020-07-13 16:39:52', '2020-07-13 16:39:52'), (2, 'user', 'web', '2020-07-13 16:39:52', '2020-07-13 16:39:52'); -- -------------------------------------------------------- -- -- Table structure for table `pickup_stations` -- CREATE TABLE `pickup_stations` ( `id` bigint(20) UNSIGNED NOT NULL, `district_id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `close_to` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `pickup_stations` -- INSERT INTO `pickup_stations` (`id`, `district_id`, `name`, `address`, `close_to`, `created_at`, `updated_at`) VALUES (1, 2, 'Pickup station one', 'Muni university', 'Arua Hospital', '2020-07-16 08:46:05', '2020-07-16 08:46:05'), (3, 2, 'Awiniri', '+256773034311', 'Arua Hospital', '2020-07-16 09:02:35', '2020-07-16 09:02:35'); -- -------------------------------------------------------- -- -- Table structure for table `products` -- CREATE TABLE `products` ( `id` bigint(20) UNSIGNED NOT NULL, `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `sku` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `cover` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `information` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `qty` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `sale_price` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `featured` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL, `publish_date` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` enum('1','0') COLLATE utf8mb4_unicode_ci NOT NULL, `sold` int(11) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `products` -- INSERT INTO `products` (`id`, `title`, `sku`, `slug`, `cover`, `description`, `information`, `qty`, `price`, `sale_price`, `type`, `featured`, `publish_date`, `status`, `sold`, `created_at`, `updated_at`) VALUES (3, 'Special Message', '5f0d9896d8b54', 'special-message-3', '2020-07-14-5f0dd5c55f81f.jpg', '<span style=\"color: rgb(119, 119, 119); font-family: \"PT Sans\", sans-serif; letter-spacing: 0.7px;\">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span>', '<h3 class=\"spec__header\" style=\"margin-bottom: 50px; font-family: Roboto, sans-serif; color: rgb(61, 70, 77); font-size: 28px;\">Specification</h3><div class=\"spec__section\" style=\"color: rgb(61, 70, 77); font-family: Roboto, sans-serif; font-size: 15px;\"><h4 class=\"spec__section-title\" style=\"margin-right: 0px; margin-bottom: 12px; margin-left: 0px; font-weight: 500; line-height: 20px; font-size: 18px; letter-spacing: -0.03em;\">General</h4><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235); border-top: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Material</div><div class=\"spec__value\">Aluminium, Plastic</div></div><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Engine Type</div><div class=\"spec__value\">Brushless</div></div><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Battery Voltage</div><div class=\"spec__value\">18 V</div></div><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Battery Type</div><div class=\"spec__value\">Li-lon</div></div><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Number of Speeds</div><div class=\"spec__value\">2</div></div><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Charge Time</div><div class=\"spec__value\">1.08 h</div></div><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Weight</div><div class=\"spec__value\">1.5 kg</div></div></div><div class=\"spec__section\" style=\"margin-top: 40px; color: rgb(61, 70, 77); font-family: Roboto, sans-serif; font-size: 15px;\"><h4 class=\"spec__section-title\" style=\"margin-right: 0px; margin-bottom: 12px; margin-left: 0px; font-weight: 500; line-height: 20px; font-size: 18px; letter-spacing: -0.03em;\">Dimensions</h4><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235); border-top: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Length</div><div class=\"spec__value\">99 mm</div></div><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Width</div><div class=\"spec__value\">207 mm</div></div><div class=\"spec__row\" style=\"padding: 8px 12px; display: flex; border-bottom: 1px solid rgb(235, 235, 235);\"><div class=\"spec__name\" style=\"width: 230px; flex-shrink: 0; padding-right: 30px; color: rgb(153, 153, 153);\">Height</div><div class=\"spec__value\">208 mm</div></div></div><div class=\"spec__disclaimer\" style=\"margin-top: 40px; line-height: 22px; color: rgb(153, 153, 153); font-family: Roboto, sans-serif;\">Information on technical characteristics, the delivery set, the country of manufacture and the appearance of the goods is for reference only and is based on the latest information available at the time of publication.</div>', '90', '5000', '4000', 'Physical', '1', NULL, '1', 9, '2020-07-14 08:35:50', '2020-08-05 14:54:50'), (4, 'Product one', '5f0d9987f3376', 'product-one-4', '2020-07-14-5f0dd60387158.jpg', 'use App\\Models\\Mianzi\\Category;use App\\Models\\Mianzi\\Category;use App\\Models\\Mianzi\\Category;use App\\Models\\Mianzi\\Category;use App\\Models\\Mianzi\\Category;use App\\Models\\Mianzi\\Category;', 'use App\\Models\\Mianzi\\Category;use App\\Models\\Mianzi\\Category;use App\\Models\\Mianzi\\Category;use App\\Models\\Mianzi\\Category;', '0', '10000', '8900', 'Physical', '1', NULL, '1', NULL, '2020-07-14 08:39:51', '2020-08-06 21:02:49'), (5, 'product two', '5f0d9aa2c65ed', 'product-two-5', '2020-07-14-5f0dd57a71b67.jpg', '$file->move(storage_path(\'app\\public\\category\'), $imagename);$file->move(storage_path(\'app\\public\\category\'), $imagename);', '$file->move(storage_path(\'app\\public\\category\'), $imagename);$file->move(storage_path(\'app\\public\\category\'), $imagename);$file->move(storage_path(\'app\\public\\category\'), $imagename);', '90', '10000', '89900', 'Physical', '0', NULL, '1', NULL, '2020-07-14 08:44:34', '2020-07-14 12:55:38'), (6, 'product two', '5f0d9ac577621', 'product-two-6', '2020-07-14-5f0dd3c49da94.jpg', '$file->move(storage_path(\'app\\public\\category\'), $imagename);$file->move(storage_path(\'app\\public\\category\'), $imagename);', '$file->move(storage_path(\'app\\public\\category\'), $imagename);$file->move(storage_path(\'app\\public\\category\'), $imagename);$file->move(storage_path(\'app\\public\\category\'), $imagename);', '90', '10000', '89900', 'Physical', '0', NULL, '1', NULL, '2020-07-14 08:45:09', '2020-07-14 12:48:20'), (7, 'product four', '5f0d9b96ed5ea', 'product-four-7', '2020-07-14-5f0d9b96ec32f.jpg', 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem,Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem,', 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem,Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem,', '4', '5000', '17690', 'Physical', '1', '2020-04-24', '1', NULL, '2020-07-14 08:48:38', '2020-07-24 22:30:47'), (8, 'product five', '5f0d9c5a17aae', 'product-five-8', '2020-07-14-5f0d9c5a16416.jpg', '$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);', '$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);', '4', '13000', '8900', 'Physical', '1', '2020-08-01', '1', NULL, '2020-07-14 08:51:54', '2020-07-14 08:51:54'), (9, 'Special Message', '5f0db203bb9e9', 'special-message-9', '2020-07-14-5f0db203ab861.jpg', '$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);', '$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);', '81', '5000', '89.00', 'Physical', '0', '2020-07-30', '1', NULL, '2020-07-14 10:24:19', '2020-07-14 12:44:37'), (10, 'news article one', '5f0db2b25d0ec', 'news-article-one-10', '2020-07-14-5f0db2b25b05b.jpg', '$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);', '$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);$image->move(\'product/gallary\', $imagenames);', '90', '12.00', '89.00', 'Physical', '1', '2020-07-31', '1', NULL, '2020-07-14 10:27:14', '2020-07-14 11:55:02'), (11, 'bamboo basket', '99jal1n1zo', 'bamboo-basket-11', '2020-07-29-5f20af1c26c35.jpg', '<span style=\"color: rgb(119, 119, 119); font-family: &quot;PT Sans&quot;, sans-serif; font-size: 14.6538px; letter-spacing: 0.732688px; background-color: rgb(249, 249, 249);\">Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem,</span>', '<span style=\"color: rgb(119, 119, 119); font-family: &quot;PT Sans&quot;, sans-serif; font-size: 14.6538px; letter-spacing: 0.732688px; background-color: rgb(249, 249, 249);\">Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem,</span>', '90', '10000', '8900', 'Physical', '1', '2020-07-30', '1', NULL, '2020-07-28 23:05:00', '2020-07-28 23:05:00'), (13, 'Test product two', 'h7yBPInuYv', 'test-product-two-13', '2020-08-19-5f3d87902237a.jpg', '<span style=\"color: rgb(119, 119, 119); font-family: \"PT Sans\", sans-serif; font-size: 14.6538px; letter-spacing: 0.732688px; background-color: rgb(249, 249, 249);\">Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem,</span>', '<span style=\"color: rgb(119, 119, 119); font-family: \"PT Sans\", sans-serif; font-size: 14.6538px; letter-spacing: 0.732688px; background-color: rgb(249, 249, 249);\">Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem,</span>', '78', '80000', '74500', 'Physical', '1', '2020-08-28', '1', NULL, '2020-08-19 20:12:00', '2020-08-19 20:14:18'); -- -------------------------------------------------------- -- -- Table structure for table `product_images` -- CREATE TABLE `product_images` ( `id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `product_images` -- INSERT INTO `product_images` (`id`, `product_id`, `image`, `created_at`, `updated_at`) VALUES (10, 8, '-5f0d9c5a7d2a2.jpg', '2020-07-14 08:51:54', '2020-07-14 08:51:54'), (12, 8, '-5f0d9c5aa25fe.jpg', '2020-07-14 08:51:54', '2020-07-14 08:51:54'), (13, 8, '-5f0d9c5aafefe.jpg', '2020-07-14 08:51:54', '2020-07-14 08:51:54'), (22, 10, '-5f0dccb2b54e8.jpg', '2020-07-14 12:18:10', '2020-07-14 12:18:10'), (24, 10, '-5f0dccb2db847.jpg', '2020-07-14 12:18:10', '2020-07-14 12:18:10'), (27, 9, '-5f0dd23f7df2d.jpg', '2020-07-14 12:41:51', '2020-07-14 12:41:51'), (35, 6, '-5f0dd4da95a27.jpg', '2020-07-14 12:52:58', '2020-07-14 12:52:58'), (36, 6, '-5f0dd55a4d9a2.jpg', '2020-07-14 12:55:06', '2020-07-14 12:55:06'), (37, 5, '-5f0dd57a82963.jpg', '2020-07-14 12:55:38', '2020-07-14 12:55:38'), (38, 5, '-5f0dd57a8e4e1.jpg', '2020-07-14 12:55:38', '2020-07-14 12:55:38'), (39, 1, '-5f0dd59fdc912.jpg', '2020-07-14 12:56:15', '2020-07-14 12:56:15'), (40, 1, '-5f0dd59ff09e5.jpg', '2020-07-14 12:56:15', '2020-07-14 12:56:15'), (41, 1, '-5f0dd5a00737e.jpg', '2020-07-14 12:56:16', '2020-07-14 12:56:16'), (42, 3, '-5f0dd5c57f940.jpg', '2020-07-14 12:56:53', '2020-07-14 12:56:53'), (43, 3, '-5f0dd5c58f0aa.jpg', '2020-07-14 12:56:53', '2020-07-14 12:56:53'), (44, 4, '-5f0dd603a56d2.jpg', '2020-07-14 12:57:55', '2020-07-14 12:57:55'), (45, 4, '-5f0dd603af09d.jpg', '2020-07-14 12:57:55', '2020-07-14 12:57:55'), (46, 7, '-5f1b60d1d8f2e.jpg', '2020-07-24 22:29:37', '2020-07-24 22:29:37'), (47, 7, '-5f1b60d1eae26.jpg', '2020-07-24 22:29:37', '2020-07-24 22:29:37'), (48, 7, '-5f1b60d2066c9.jpg', '2020-07-24 22:29:38', '2020-07-24 22:29:38'), (49, 7, '-5f1b60d213032.jpg', '2020-07-24 22:29:38', '2020-07-24 22:29:38'), (50, 11, '-5f20af1c68fea.jpg', '2020-07-28 23:05:00', '2020-07-28 23:05:00'), (51, 11, '-5f20af1c722ac.jpg', '2020-07-28 23:05:00', '2020-07-28 23:05:00'), (52, 11, '-5f20af1c7cd87.jpg', '2020-07-28 23:05:00', '2020-07-28 23:05:00'), (53, 11, '-5f20af1c87189.jpg', '2020-07-28 23:05:00', '2020-07-28 23:05:00'), (54, 12, '-5f3d805c93f3d.jpg', '2020-08-19 19:41:16', '2020-08-19 19:41:16'), (55, 12, '-5f3d805cb0af8.jpg', '2020-08-19 19:41:16', '2020-08-19 19:41:16'), (56, 12, '-5f3d805cbf501.jpg', '2020-08-19 19:41:16', '2020-08-19 19:41:16'), (57, 12, '-5f3d805cccd7e.jpg', '2020-08-19 19:41:16', '2020-08-19 19:41:16'), (58, 13, '-5f3d87908829b.jpg', '2020-08-19 20:12:00', '2020-08-19 20:12:00'), (59, 13, '-5f3d8790957ae.jpg', '2020-08-19 20:12:00', '2020-08-19 20:12:00'), (60, 13, '-5f3d8790a637f.jpg', '2020-08-19 20:12:00', '2020-08-19 20:12:00'), (61, 13, '-5f3d8790b6034.jpg', '2020-08-19 20:12:00', '2020-08-19 20:12:00'), (62, 13, '-5f3d8790df41d.jpg', '2020-08-19 20:12:00', '2020-08-19 20:12:00'); -- -------------------------------------------------------- -- -- Table structure for table `recently_vieweds` -- CREATE TABLE `recently_vieweds` ( `id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `customer_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `recently_vieweds` -- INSERT INTO `recently_vieweds` (`id`, `product_id`, `customer_id`, `created_at`, `updated_at`) VALUES (14, 13, 'qDMqFgIPNldhhmhWwmSUFlcHcDPxazTLYVcIcgeP', '2020-08-19 21:13:34', '2020-08-19 21:13:34'), (15, 11, 'qDMqFgIPNldhhmhWwmSUFlcHcDPxazTLYVcIcgeP', '2020-08-19 21:13:44', '2020-08-19 21:13:44'), (16, 8, 'qDMqFgIPNldhhmhWwmSUFlcHcDPxazTLYVcIcgeP', '2020-08-19 21:28:33', '2020-08-19 21:28:33'), (17, 13, 'y4TurxJDDYsyBvJUD6qN1Pw8Db72W0ifx1k7H23E', '2020-08-20 15:42:27', '2020-08-20 15:42:27'), (18, 3, 'y4TurxJDDYsyBvJUD6qN1Pw8Db72W0ifx1k7H23E', '2020-08-20 15:50:07', '2020-08-20 15:50:07'), (19, 6, 'y4TurxJDDYsyBvJUD6qN1Pw8Db72W0ifx1k7H23E', '2020-08-20 15:59:11', '2020-08-20 15:59:11'), (20, 3, '1', '2020-08-20 16:38:23', '2020-08-20 16:38:23'), (21, 11, 'aLqydfAFHmTCIxbibhGuYuQlN1ZfhqkdzjYLzeSv', '2020-08-21 13:16:59', '2020-08-21 13:16:59'), (22, 13, 'aLqydfAFHmTCIxbibhGuYuQlN1ZfhqkdzjYLzeSv', '2020-08-21 13:20:31', '2020-08-21 13:20:31'), (23, 7, 'aLqydfAFHmTCIxbibhGuYuQlN1ZfhqkdzjYLzeSv', '2020-08-21 13:22:28', '2020-08-21 13:22:28'), (24, 4, 'aLqydfAFHmTCIxbibhGuYuQlN1ZfhqkdzjYLzeSv', '2020-08-21 13:22:46', '2020-08-21 13:22:46'); -- -------------------------------------------------------- -- -- Table structure for table `regions` -- CREATE TABLE `regions` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `regions` -- INSERT INTO `regions` (`id`, `name`, `created_at`, `updated_at`) VALUES (2, 'Eastern Regions', '2020-07-16 07:26:31', '2020-07-16 07:54:28'); -- -------------------------------------------------------- -- -- Table structure for table `reviews` -- CREATE TABLE `reviews` ( `id` bigint(20) UNSIGNED NOT NULL, `customer_id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `rating` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `review` text COLLATE utf8mb4_unicode_ci NOT NULL, `status` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `reviews` -- INSERT INTO `reviews` (`id`, `customer_id`, `product_id`, `rating`, `review`, `status`, `created_at`, `updated_at`) VALUES (1, 1, 7, '4', 'Hllo world and they alll laughed at hiim descpite the fact that they are the pnly ones who led', '1', '2020-08-05 15:40:56', '2020-08-05 15:40:56'), (2, 1, 7, '5', 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt,', '1', '2020-08-05 15:51:36', '2020-08-05 15:51:36'), (3, 1, 7, '5', '<!-- Sweet Alert -->\r\n@include(\'sweetalert::alert\')\r\n<!--- Sweet Alert -->', '0', '2020-08-05 15:53:45', '2020-08-05 15:53:45'), (4, 1, 3, '4', 'hello world and they all alghed', '0', '2020-08-13 13:02:19', '2020-08-13 13:02:19'); -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE `roles` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `guard_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `roles` -- INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES (1, 'admin', 'web', '2020-07-13 16:39:52', '2020-07-13 16:39:52'), (2, 'user', 'web', '2020-07-13 16:39:53', '2020-07-13 16:39:53'); -- -------------------------------------------------------- -- -- Table structure for table `role_has_permissions` -- CREATE TABLE `role_has_permissions` ( `permission_id` bigint(20) UNSIGNED NOT NULL, `role_id` bigint(20) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `role_has_permissions` -- INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES (1, 1), (2, 2); -- -------------------------------------------------------- -- -- Table structure for table `shippings` -- CREATE TABLE `shippings` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `status` enum('1','0') COLLATE utf8mb4_unicode_ci NOT NULL, `fixed` enum('1','0') COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `shippings` -- INSERT INTO `shippings` (`id`, `name`, `status`, `fixed`, `created_at`, `updated_at`) VALUES (1, 'Pickup Stations', '1', '0', '2020-07-14 07:07:01', '2020-07-14 07:25:44'), (3, 'Home Delivery', '1', '1', '2020-07-16 11:28:19', '2020-07-16 11:28:19'); -- -------------------------------------------------------- -- -- Table structure for table `shipping_prices` -- CREATE TABLE `shipping_prices` ( `id` bigint(20) UNSIGNED NOT NULL, `shipping_id` bigint(20) UNSIGNED NOT NULL, `station_id` bigint(20) UNSIGNED NOT NULL, `fee` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `shipping_prices` -- INSERT INTO `shipping_prices` (`id`, `shipping_id`, `station_id`, `fee`, `created_at`, `updated_at`) VALUES (8, 3, 2, '23000', '2020-08-21 16:22:52', '2020-08-21 16:22:52'); -- -------------------------------------------------------- -- -- Table structure for table `subscriptions` -- CREATE TABLE `subscriptions` ( `id` bigint(20) UNSIGNED NOT NULL, `subscription_email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `subscriptions` -- INSERT INTO `subscriptions` (`id`, `subscription_email`, `created_at`, `updated_at`) VALUES (7, '<EMAIL>', '2020-07-16 06:26:36', '2020-07-16 06:26:36'), (8, '<EMAIL>', '2020-07-16 06:26:36', '2020-07-16 06:26:36'), (9, '<EMAIL>', '2020-07-16 06:27:06', '2020-07-16 06:27:06'), (10, '<EMAIL>', '2020-07-16 06:27:06', '2020-07-16 06:27:06'), (11, '<EMAIL>', '2020-07-16 06:30:01', '2020-07-16 06:30:01'), (12, '<EMAIL>', '2020-07-16 06:30:01', '2020-07-16 06:30:01'), (13, '<EMAIL>', '2020-08-09 19:53:58', '2020-08-09 19:53:58'), (14, '<EMAIL>', '2020-08-09 19:56:07', '2020-08-09 19:56:07'), (15, '<EMAIL>', '2020-08-09 19:57:13', '2020-08-09 19:57:13'), (16, '<EMAIL>', '2020-08-09 19:58:48', '2020-08-09 19:58:48'), (17, '<EMAIL>', '2020-08-09 20:01:25', '2020-08-09 20:01:25'), (18, '<EMAIL>', '2020-08-09 20:03:47', '2020-08-09 20:03:47'), (19, '<EMAIL>', '2020-08-09 20:04:32', '2020-08-09 20:04:32'), (20, '<EMAIL>', '2020-08-20 15:36:09', '2020-08-20 15:36:09'); -- -------------------------------------------------------- -- -- Table structure for table `trackers` -- CREATE TABLE `trackers` ( `id` bigint(20) UNSIGNED NOT NULL, `current_date` date NOT NULL, `ip` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `hits` int(11) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `trackers` -- INSERT INTO `trackers` (`id`, `current_date`, `ip`, `hits`, `created_at`, `updated_at`) VALUES (2, '2020-07-28', '127.0.0.1', NULL, '2020-07-28 18:34:14', '2020-07-28 18:34:14'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `mobile` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `email`, `mobile`, `avatar`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'Admin', '<EMAIL>', '<PASSWORD>', '1594992418.jpg', NULL, '$2y$10$I/w2WmC.ZYgkLmvhv1P9IOMneUGakTrCsvUBt3S/wDGlHmZ9qK0AG', NULL, '2020-07-13 16:39:53', '2020-07-17 13:26:58'), (2, '<NAME>', '<EMAIL>', NULL, NULL, NULL, '$2y$10$GBsw7VAfEOzT7RZ6F0nOnOKAUdcwH8kOyZKDm7OBIO.GM8WX9YwPu', NULL, '2020-07-13 16:39:54', '2020-07-13 16:39:54'); -- -------------------------------------------------------- -- -- Table structure for table `user_login_logs` -- CREATE TABLE `user_login_logs` ( `id` bigint(20) UNSIGNED NOT NULL, `subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `ip` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `agent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `user_id` int(11) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `user_login_logs` -- INSERT INTO `user_login_logs` (`id`, `subject`, `ip`, `agent`, `user_id`, `created_at`, `updated_at`) VALUES (1, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-13 16:40:16', '2020-07-13 16:40:16'), (2, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-14 03:53:15', '2020-07-14 03:53:15'), (3, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-16 06:31:13', '2020-07-16 06:31:13'), (4, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-16 15:38:29', '2020-07-16 15:38:29'), (5, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-17 11:19:44', '2020-07-17 11:19:44'), (6, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-17 11:44:20', '2020-07-17 11:44:20'), (7, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-20 11:43:15', '2020-07-20 11:43:15'), (8, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-24 22:25:54', '2020-07-24 22:25:54'), (9, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-27 18:22:21', '2020-07-27 18:22:21'), (10, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 1, '2020-07-28 18:20:16', '2020-07-28 18:20:16'), (11, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0', 1, '2020-07-28 20:26:56', '2020-07-28 20:26:56'), (12, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 1, '2020-08-03 12:20:04', '2020-08-03 12:20:04'), (13, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 1, '2020-08-04 17:14:46', '2020-08-04 17:14:46'), (14, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 1, '2020-08-05 13:56:13', '2020-08-05 13:56:13'), (15, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 1, '2020-08-06 11:48:09', '2020-08-06 11:48:09'), (16, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.0 Safari/537.36', 1, '2020-08-06 19:12:01', '2020-08-06 19:12:01'), (17, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 1, '2020-08-06 23:01:31', '2020-08-06 23:01:31'), (18, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 1, '2020-08-08 05:54:18', '2020-08-08 05:54:18'), (19, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 1, '2020-08-08 14:01:16', '2020-08-08 14:01:16'), (20, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36', 1, '2020-08-19 19:37:24', '2020-08-19 19:37:24'), (21, 'User Login Succesfully. Email: <EMAIL>', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36', 1, '2020-08-21 16:21:25', '2020-08-21 16:21:25'); -- -------------------------------------------------------- -- -- Table structure for table `wishlists` -- CREATE TABLE `wishlists` ( `id` bigint(20) UNSIGNED NOT NULL, `product_id` bigint(20) UNSIGNED NOT NULL, `customer_id` bigint(20) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `wishlists` -- INSERT INTO `wishlists` (`id`, `product_id`, `customer_id`, `created_at`, `updated_at`) VALUES (27, 3, 1, '2020-08-01 19:46:13', '2020-08-01 19:46:13'), (28, 4, 1, '2020-08-05 17:32:58', '2020-08-05 17:32:58'), (29, 3, 1, '2020-08-05 17:58:05', '2020-08-05 17:58:05'), (31, 4, 1, '2020-08-06 20:20:58', '2020-08-06 20:20:58'), (32, 10, 1, '2020-08-06 21:49:52', '2020-08-06 21:49:52'); -- -- Indexes for dumped tables -- -- -- Indexes for table `addresses` -- ALTER TABLE `addresses` ADD PRIMARY KEY (`id`); -- -- Indexes for table `attributes` -- ALTER TABLE `attributes` ADD PRIMARY KEY (`id`); -- -- Indexes for table `attribute_product` -- ALTER TABLE `attribute_product` ADD PRIMARY KEY (`id`); -- -- Indexes for table `attribute_values` -- ALTER TABLE `attribute_values` ADD PRIMARY KEY (`id`); -- -- Indexes for table `banners` -- ALTER TABLE `banners` ADD PRIMARY KEY (`id`); -- -- Indexes for table `blog_categories` -- ALTER TABLE `blog_categories` ADD PRIMARY KEY (`id`); -- -- Indexes for table `carts` -- ALTER TABLE `carts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `categories` -- ALTER TABLE `categories` ADD PRIMARY KEY (`id`); -- -- Indexes for table `category_product` -- ALTER TABLE `category_product` ADD PRIMARY KEY (`id`); -- -- Indexes for table `compares` -- ALTER TABLE `compares` ADD PRIMARY KEY (`id`); -- -- Indexes for table `coupons` -- ALTER TABLE `coupons` ADD PRIMARY KEY (`id`); -- -- Indexes for table `customers` -- ALTER TABLE `customers` ADD PRIMARY KEY (`id`); -- -- Indexes for table `districts` -- ALTER TABLE `districts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `failed_jobs` -- ALTER TABLE `failed_jobs` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `model_has_permissions` -- ALTER TABLE `model_has_permissions` ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`), ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`); -- -- Indexes for table `model_has_roles` -- ALTER TABLE `model_has_roles` ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`), ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`); -- -- Indexes for table `orders` -- ALTER TABLE `orders` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `orders_reference_unique` (`reference`); -- -- Indexes for table `order_products` -- ALTER TABLE `order_products` ADD PRIMARY KEY (`id`); -- -- Indexes for table `order_statuses` -- ALTER TABLE `order_statuses` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `permissions` -- ALTER TABLE `permissions` ADD PRIMARY KEY (`id`); -- -- Indexes for table `pickup_stations` -- ALTER TABLE `pickup_stations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `products` -- ALTER TABLE `products` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `products_sku_unique` (`sku`), ADD UNIQUE KEY `products_slug_unique` (`slug`); -- -- Indexes for table `product_images` -- ALTER TABLE `product_images` ADD PRIMARY KEY (`id`); -- -- Indexes for table `recently_vieweds` -- ALTER TABLE `recently_vieweds` ADD PRIMARY KEY (`id`); -- -- Indexes for table `regions` -- ALTER TABLE `regions` ADD PRIMARY KEY (`id`); -- -- Indexes for table `reviews` -- ALTER TABLE `reviews` ADD PRIMARY KEY (`id`); -- -- Indexes for table `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id`); -- -- Indexes for table `role_has_permissions` -- ALTER TABLE `role_has_permissions` ADD PRIMARY KEY (`permission_id`,`role_id`), ADD KEY `role_has_permissions_role_id_foreign` (`role_id`); -- -- Indexes for table `shippings` -- ALTER TABLE `shippings` ADD PRIMARY KEY (`id`); -- -- Indexes for table `shipping_prices` -- ALTER TABLE `shipping_prices` ADD PRIMARY KEY (`id`); -- -- Indexes for table `subscriptions` -- ALTER TABLE `subscriptions` ADD PRIMARY KEY (`id`); -- -- Indexes for table `trackers` -- ALTER TABLE `trackers` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`), ADD UNIQUE KEY `users_mobile_unique` (`mobile`); -- -- Indexes for table `user_login_logs` -- ALTER TABLE `user_login_logs` ADD PRIMARY KEY (`id`); -- -- Indexes for table `wishlists` -- ALTER TABLE `wishlists` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `addresses` -- ALTER TABLE `addresses` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `attributes` -- ALTER TABLE `attributes` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `attribute_product` -- ALTER TABLE `attribute_product` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26; -- -- AUTO_INCREMENT for table `attribute_values` -- ALTER TABLE `attribute_values` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `banners` -- ALTER TABLE `banners` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `blog_categories` -- ALTER TABLE `blog_categories` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `carts` -- ALTER TABLE `carts` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `categories` -- ALTER TABLE `categories` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36; -- -- AUTO_INCREMENT for table `category_product` -- ALTER TABLE `category_product` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37; -- -- AUTO_INCREMENT for table `compares` -- ALTER TABLE `compares` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `coupons` -- ALTER TABLE `coupons` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `customers` -- ALTER TABLE `customers` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `districts` -- ALTER TABLE `districts` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `failed_jobs` -- ALTER TABLE `failed_jobs` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36; -- -- AUTO_INCREMENT for table `orders` -- ALTER TABLE `orders` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `order_products` -- ALTER TABLE `order_products` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `order_statuses` -- ALTER TABLE `order_statuses` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `permissions` -- ALTER TABLE `permissions` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `pickup_stations` -- ALTER TABLE `pickup_stations` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `products` -- ALTER TABLE `products` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `product_images` -- ALTER TABLE `product_images` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=63; -- -- AUTO_INCREMENT for table `recently_vieweds` -- ALTER TABLE `recently_vieweds` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; -- -- AUTO_INCREMENT for table `regions` -- ALTER TABLE `regions` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `reviews` -- ALTER TABLE `reviews` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `roles` -- ALTER TABLE `roles` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `shippings` -- ALTER TABLE `shippings` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `shipping_prices` -- ALTER TABLE `shipping_prices` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `subscriptions` -- ALTER TABLE `subscriptions` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- AUTO_INCREMENT for table `trackers` -- ALTER TABLE `trackers` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `user_login_logs` -- ALTER TABLE `user_login_logs` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; -- -- AUTO_INCREMENT for table `wishlists` -- ALTER TABLE `wishlists` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33; -- -- Constraints for dumped tables -- -- -- Constraints for table `model_has_permissions` -- ALTER TABLE `model_has_permissions` ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE; -- -- Constraints for table `model_has_roles` -- ALTER TABLE `model_has_roles` ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE; -- -- Constraints for table `role_has_permissions` -- ALTER TABLE `role_has_permissions` ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE; 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 */;
SELECT * FROM scrap.bods_control_statement_view WHERE subject_entity_statement = '1dc0e987-5c57-4a1c-b3ad-61353b66a9b7' ; select name, entity_id, statement_id, statement_type from scrap.bods_person_view WHERE statement_id in (SELECT interested_person_statement_id FROM scrap.bods_control_statement_view WHERE subject_entity_statement = '1dc0e987-5c57-4a1c-b3ad-61353b66a9b7') ; select entity_name, country, statement_id, statement_type from scrap.bods_entity_view WHERE statement_id in (SELECT interested_entity_statement_id FROM scrap.bods_control_statement_view WHERE subject_entity_statement = '1dc0e987-5c57-4a1c-b3ad-61353b66a9b7') ; SELECT DISTINCT subject_entity_statement FROM scrap.bods_control_statement_view ; select name, entity_id, statement_id, statement_type from scrap.bods_person_view WHERE statement_id in (SELECT interested_person_statement_id FROM scrap.bods_control_statement_view WHERE subject_entity_statement = '1dc0e987-5c57-4a1c-b3ad-61353b66a9b7') ; select entity_name, country, statement_id, statement_type from scrap.bods_entity_view WHERE statement_id in (SELECT interested_entity_statement_id FROM scrap.bods_control_statement_view WHERE subject_entity_statement = '1dc0e987-5c57-4a1c-b3ad-61353b66a9b7') ;
select -CAST(REPLACE(REPLACE(Valor1, '.', ''), ',', '.') AS DECIMAL(10, 2)) from TB1 select -1 * REPLACE(REPLACE(Valor1, '.', ''), ',', '.') from TB1 update TB1 set Valor1 = -1 * REPLACE(REPLACE(Valor1, '.', ''), ',', '.') --https://pt.stackoverflow.com/q/104641/101
<reponame>juankruizcarrera/SIAIOT -- MySQL Script generated by MySQL Workbench -- Fri Oct 2 14:00:41 2020 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; -- ----------------------------------------------------- -- Schema sia -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema sia -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `sia` DEFAULT CHARACTER SET utf8 ; USE `sia` ; -- ----------------------------------------------------- -- Table `sia`.`TipoGranja` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`TipoGranja` ( `idTipGra` INT NOT NULL AUTO_INCREMENT, `nomTipGra` VARCHAR(45) NOT NULL, PRIMARY KEY (`idTipGra`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Estado` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Estado` ( `idEst` INT NOT NULL AUTO_INCREMENT, `nomEst` VARCHAR(45) NOT NULL, PRIMARY KEY (`idEst`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`GrupoGranja` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`GrupoGranja` ( `idGruGra` INT NOT NULL AUTO_INCREMENT, `nomGruGra` VARCHAR(45) NOT NULL, `fecCreGruGra` DATETIME NOT NULL COMMENT 'fecha de creacion del grupo', `obsGruGra` VARCHAR(150) NULL COMMENT 'observacion del grupo\n', `idEstPer` INT NOT NULL, PRIMARY KEY (`idGruGra`), INDEX `fk_GrupoGranja_Estado1_idx` (`idEstPer` ASC), CONSTRAINT `fk_GrupoGranja_Estado1` FOREIGN KEY (`idEstPer`) REFERENCES `sia`.`Estado` (`idEst`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Granja` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Granja` ( `idGra` INT NOT NULL AUTO_INCREMENT, `ubiGra` VARCHAR(45) NOT NULL, `nomGra` VARCHAR(150) NULL, `idTipGraPer` INT NOT NULL, `idGruGraPer` INT NOT NULL, PRIMARY KEY (`idGra`), INDEX `fk_Granja_TipoGranja1_idx` (`idTipGraPer` ASC) , INDEX `fk_Granja_GrupoGranja1_idx` (`idGruGraPer` ASC), CONSTRAINT `fk_Granja_TipoGranja1` FOREIGN KEY (`idTipGraPer`) REFERENCES `sia`.`TipoGranja` (`idTipGra`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Granja_GrupoGranja1` FOREIGN KEY (`idGruGraPer`) REFERENCES `sia`.`GrupoGranja` (`idGruGra`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Unidades` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Unidades` ( `idUni` VARCHAR(3) NOT NULL, `nomUni` VARCHAR(45) NOT NULL, PRIMARY KEY (`idUni`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`AreaCultivo` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`AreaCultivo` ( `idAreCul` INT NOT NULL AUTO_INCREMENT, `nomAre` VARCHAR(150) NULL, `ubiAreCul` VARCHAR(45) NOT NULL, `areAreCul` DECIMAL(5,2) NOT NULL, `obsAreCul` VARCHAR(150) NULL COMMENT 'observaciones del area de cultivo', `idGraPer` INT NOT NULL, `idUniPer` VARCHAR(3) NOT NULL, PRIMARY KEY (`idAreCul`), INDEX `fk_AreaCultivo_Granja_idx` (`idGraPer` ASC) , INDEX `fk_AreaCultivo_Unidades1_idx` (`idUniPer` ASC) , CONSTRAINT `fk_AreaCultivo_Granja` FOREIGN KEY (`idGraPer`) REFERENCES `sia`.`Granja` (`idGra`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_AreaCultivo_Unidades1` FOREIGN KEY (`idUniPer`) REFERENCES `sia`.`Unidades` (`idUni`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Perfiles` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Perfiles` ( `idPer` INT NOT NULL AUTO_INCREMENT, `nomPer` VARCHAR(45) NOT NULL, PRIMARY KEY (`idPer`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`PersonalGranja` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`PersonalGranja` ( `cedPerGra` VARCHAR(10) NOT NULL, `nomPerGra` VARCHAR(45) NOT NULL, `apeAgri` VARCHAR(45) NOT NULL, `fecNacPerGra` VARCHAR(45) NOT NULL, `carEcoPerGra` INT NULL COMMENT 'cargas economicas del personal de granja', `telPerGra` VARCHAR(10) NOT NULL, `emaAgri` VARCHAR(45) NULL, `usuPerGraSiNo` TINYINT NOT NULL COMMENT 'indica si la personal registrado tiene o no un usuario y contraseña para ingresar en el sistema', `idGraPer` INT NOT NULL, `idPerPer` INT NOT NULL, PRIMARY KEY (`cedPerGra`), INDEX `fk_Agricultor_Granja1_idx` (`idGraPer` ASC) , INDEX `fk_PersonalGranja_Perfiles1_idx` (`idPerPer` ASC) , CONSTRAINT `fk_Agricultor_Granja1` FOREIGN KEY (`idGraPer`) REFERENCES `sia`.`Granja` (`idGra`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_PersonalGranja_Perfiles1` FOREIGN KEY (`idPerPer`) REFERENCES `sia`.`Perfiles` (`idPer`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Usuario` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Usuario` ( `idUsu` INT NOT NULL AUTO_INCREMENT, `conUsu` VARCHAR(45) NOT NULL, `nomUsu` VARCHAR(45) NOT NULL, `emaUsu` VARCHAR(45) NOT NULL, `fecCreUsu` DATETIME NOT NULL, `idGraPer` INT NOT NULL, `idPerPer` INT NOT NULL, PRIMARY KEY (`idUsu`), INDEX `fk_Usuario_Granja1_idx` (`idGraPer` ASC) , UNIQUE INDEX `emaUsu_UNIQUE` (`emaUsu` ASC) , INDEX `fk_Usuario_Perfiles1_idx` (`idPerPer` ASC) , CONSTRAINT `fk_Usuario_Granja1` FOREIGN KEY (`idGraPer`) REFERENCES `sia`.`Granja` (`idGra`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Usuario_Perfiles1` FOREIGN KEY (`idPerPer`) REFERENCES `sia`.`Perfiles` (`idPer`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`TipoCultivo` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`TipoCultivo` ( `idTipCul` INT NOT NULL AUTO_INCREMENT, `nomTipCul` VARCHAR(45) NOT NULL, `perTipCul` DATETIME NOT NULL COMMENT 'periodo de plantacion de cada tipo de cultivo', PRIMARY KEY (`idTipCul`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`TipoSuelo` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`TipoSuelo` ( `idTipSue` INT NOT NULL AUTO_INCREMENT, `nomTipSue` VARCHAR(45) NOT NULL, PRIMARY KEY (`idTipSue`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`TipoRendimiento` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`TipoRendimiento` ( `idTipRen` INT NOT NULL AUTO_INCREMENT, `nomTipRen` VARCHAR(45) NOT NULL COMMENT 'Produccion Integrada\nProduccion Organica\nProduccion Convencional', PRIMARY KEY (`idTipRen`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`UnidadPlantacion` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`UnidadPlantacion` ( `idUniPla` INT NOT NULL AUTO_INCREMENT, `nomUniPla` VARCHAR(45) NOT NULL COMMENT 'Peso\nPiezas(plantas)', PRIMARY KEY (`idUniPla`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`CentroCosto` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`CentroCosto` ( `idCenCos` VARCHAR(20) NOT NULL, `lotCenCos` VARCHAR(45) NOT NULL, `idAreCulPer` INT NOT NULL, `fecIniCulCenCos` DATETIME NOT NULL, `idTipCulPer` INT NOT NULL, `idTipSuePer` INT NOT NULL, `idTipRenPer` INT NOT NULL, `idUniPlaPer` INT NOT NULL, `idEstPer` INT NOT NULL, PRIMARY KEY (`idCenCos`, `lotCenCos`, `idAreCulPer`), INDEX `fk_CentroCosto_AreaCultivo1_idx` (`idAreCulPer` ASC) , INDEX `fk_CentroCosto_TipoCultivo1_idx` (`idTipCulPer` ASC) , INDEX `fk_CentroCosto_TipoSuelo1_idx` (`idTipSuePer` ASC) , INDEX `fk_CentroCosto_TipoRendimiento1_idx` (`idTipRenPer` ASC) , INDEX `fk_CentroCosto_Estado1_idx` (`idEstPer` ASC) , INDEX `fk_CentroCosto_UnidadPlantacion1_idx` (`idUniPlaPer` ASC) , CONSTRAINT `fk_CentroCosto_AreaCultivo1` FOREIGN KEY (`idAreCulPer`) REFERENCES `sia`.`AreaCultivo` (`idAreCul`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_CentroCosto_TipoCultivo1` FOREIGN KEY (`idTipCulPer`) REFERENCES `sia`.`TipoCultivo` (`idTipCul`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_CentroCosto_TipoSuelo1` FOREIGN KEY (`idTipSuePer`) REFERENCES `sia`.`TipoSuelo` (`idTipSue`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_CentroCosto_TipoRendimiento1` FOREIGN KEY (`idTipRenPer`) REFERENCES `sia`.`TipoRendimiento` (`idTipRen`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_CentroCosto_Estado1` FOREIGN KEY (`idEstPer`) REFERENCES `sia`.`Estado` (`idEst`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_CentroCosto_UnidadPlantacion1` FOREIGN KEY (`idUniPlaPer`) REFERENCES `sia`.`UnidadPlantacion` (`idUniPla`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`TipoAnalisis` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`TipoAnalisis` ( `idTipAna` INT NOT NULL, `nomTipAna` VARCHAR(45) NOT NULL, PRIMARY KEY (`idTipAna`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Laboratorios` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Laboratorios` ( `idLab` VARCHAR(10) NOT NULL, `nomLab` VARCHAR(45) NOT NULL, `idEstPer` INT NOT NULL, PRIMARY KEY (`idLab`), INDEX `fk_Laboratorios_Estado1_idx` (`idEstPer` ASC) , CONSTRAINT `fk_Laboratorios_Estado1` FOREIGN KEY (`idEstPer`) REFERENCES `sia`.`Estado` (`idEst`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`AnalisisLaboratorio` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`AnalisisLaboratorio` ( `idAnaLab` INT NOT NULL AUTO_INCREMENT, `nomAnaLab` VARCHAR(45) NOT NULL, `fecAnaLab` DATETIME NOT NULL, `docAnaLab` BLOB NULL, `idTipAnaPer` INT NOT NULL, `idLabPer` VARCHAR(10) NULL, `idGraPer` INT NOT NULL, PRIMARY KEY (`idAnaLab`), INDEX `fk_Laboratorio_TipoExamen1_idx` (`idTipAnaPer` ASC) , INDEX `fk_AnalisisLaboratorio_Laboratorios1_idx` (`idLabPer` ASC) , INDEX `fk_AnalisisLaboratorio_Granja1_idx` (`idGraPer` ASC) , CONSTRAINT `fk_Laboratorio_TipoExamen1` FOREIGN KEY (`idTipAnaPer`) REFERENCES `sia`.`TipoAnalisis` (`idTipAna`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_AnalisisLaboratorio_Laboratorios1` FOREIGN KEY (`idLabPer`) REFERENCES `sia`.`Laboratorios` (`idLab`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_AnalisisLaboratorio_Granja1` FOREIGN KEY (`idGraPer`) REFERENCES `sia`.`Granja` (`idGra`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`ActividadCultivo` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`ActividadCultivo` ( `idActCul` INT NOT NULL AUTO_INCREMENT, `actCul` VARCHAR(150) NOT NULL, `fecIniAct` DATETIME NOT NULL, `fecFinAct` DATETIME NULL, `notActCul` TINYINT NOT NULL COMMENT 'activa o desactiva la notificacion de la actividad', `idCenCosPer` VARCHAR(20) NOT NULL, `idAnaLabPer` INT NULL, PRIMARY KEY (`idActCul`), INDEX `fk_ActividadCultivo_CentroCosto1_idx` (`idCenCosPer` ASC) , INDEX `fk_ActividadCultivo_Laboratorio1_idx` (`idAnaLabPer` ASC) , CONSTRAINT `fk_ActividadCultivo_CentroCosto1` FOREIGN KEY (`idCenCosPer`) REFERENCES `sia`.`CentroCosto` (`idCenCos`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ActividadCultivo_Laboratorio1` FOREIGN KEY (`idAnaLabPer`) REFERENCES `sia`.`AnalisisLaboratorio` (`idAnaLab`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`ResponsableActividad` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`ResponsableActividad` ( `idResAct` INT NOT NULL AUTO_INCREMENT, `valHorResAct` DECIMAL(5,2) NULL COMMENT 'valor por cada hora de la actividad', `idActCulPer` INT NOT NULL, `cedulaPer` VARCHAR(10) NOT NULL, PRIMARY KEY (`idResAct`), INDEX `fk_ResponsableActividad_ActividadCultivo1_idx` (`idActCulPer` ASC) , INDEX `fk_ResponsableActividad_PersonalGranja1_idx` (`cedulaPer` ASC) , CONSTRAINT `fk_ResponsableActividad_ActividadCultivo1` FOREIGN KEY (`idActCulPer`) REFERENCES `sia`.`ActividadCultivo` (`idActCul`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ResponsableActividad_PersonalGranja1` FOREIGN KEY (`cedulaPer`) REFERENCES `sia`.`PersonalGranja` (`cedPerGra`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`TipoRecurso` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`TipoRecurso` ( `idTipRec` INT NOT NULL AUTO_INCREMENT, `nomTipRec` VARCHAR(45) NOT NULL COMMENT 'nombre del tipo del recurso', PRIMARY KEY (`idTipRec`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Recursos` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Recursos` ( `idRec` INT NOT NULL AUTO_INCREMENT, `nomRec` VARCHAR(45) NOT NULL, `cosRec` DECIMAL(5,2) NOT NULL, `modRec` VARCHAR(45) NOT NULL COMMENT 'modelo del recurso', `marRec` VARCHAR(45) NOT NULL COMMENT 'marca del recurso', `plaRec` VARCHAR(45) NULL COMMENT 'placa de recurso', `idTipRecPer` INT NOT NULL, `idUniPer` VARCHAR(3) NOT NULL, `idGraPer` INT NOT NULL, PRIMARY KEY (`idRec`), INDEX `fk_Recursos_Unidades1_idx` (`idUniPer` ASC) , INDEX `fk_Recursos_TipoRecurso1_idx` (`idTipRecPer` ASC) , INDEX `fk_Recursos_Granja1_idx` (`idGraPer` ASC) , CONSTRAINT `fk_Recursos_Unidades1` FOREIGN KEY (`idUniPer`) REFERENCES `sia`.`Unidades` (`idUni`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Recursos_TipoRecurso1` FOREIGN KEY (`idTipRecPer`) REFERENCES `sia`.`TipoRecurso` (`idTipRec`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Recursos_Granja1` FOREIGN KEY (`idGraPer`) REFERENCES `sia`.`Granja` (`idGra`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Almacen` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Almacen` ( `idAlm` VARCHAR(10) NOT NULL, `nomAlm` VARCHAR(45) NOT NULL, `actAlm` TINYINT NOT NULL COMMENT 'si esta activo o no el almacen', `idEstPer` INT NOT NULL, `idGraPer` INT NOT NULL, PRIMARY KEY (`idAlm`), INDEX `fk_Almacen_Estado1_idx` (`idEstPer` ASC) , INDEX `fk_Almacen_Granja1_idx` (`idGraPer` ASC) , CONSTRAINT `fk_Almacen_Estado1` FOREIGN KEY (`idEstPer`) REFERENCES `sia`.`Estado` (`idEst`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Almacen_Granja1` FOREIGN KEY (`idGraPer`) REFERENCES `sia`.`Granja` (`idGra`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`TipoDocumento` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`TipoDocumento` ( `idTipDoc` VARCHAR(3) NOT NULL, `nomTipDoc` VARCHAR(45) NOT NULL, PRIMARY KEY (`idTipDoc`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`EntradaSalida` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`EntradaSalida` ( `idEntSal` INT NOT NULL AUTO_INCREMENT, `idTipDocPer` VARCHAR(3) NOT NULL, `nomEntSal` VARCHAR(45) NOT NULL, `fecEntSal` DATETIME NOT NULL, `idActCulPer` INT NOT NULL, `idAlmPer` VARCHAR(10) NOT NULL, `idEstPer` INT NOT NULL, PRIMARY KEY (`idEntSal`, `idTipDocPer`), INDEX `fk_EntradaSalida_ActividadCultivo1_idx` (`idActCulPer` ASC) , INDEX `fk_EntradaSalida_Almacen1_idx` (`idAlmPer` ASC) , INDEX `fk_EntradaSalida_TipoDocumento1_idx` (`idTipDocPer` ASC) , INDEX `fk_EntradaSalida_Estado1_idx` (`idEstPer` ASC) , CONSTRAINT `fk_EntradaSalida_ActividadCultivo1` FOREIGN KEY (`idActCulPer`) REFERENCES `sia`.`ActividadCultivo` (`idActCul`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_EntradaSalida_Almacen1` FOREIGN KEY (`idAlmPer`) REFERENCES `sia`.`Almacen` (`idAlm`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_EntradaSalida_TipoDocumento1` FOREIGN KEY (`idTipDocPer`) REFERENCES `sia`.`TipoDocumento` (`idTipDoc`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_EntradaSalida_Estado1` FOREIGN KEY (`idEstPer`) REFERENCES `sia`.`Estado` (`idEst`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`MovimientoLote` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`MovimientoLote` ( `idMovLot` INT NOT NULL AUTO_INCREMENT, `fecMovLot` DATETIME NOT NULL COMMENT 'fecha que se realizo el movimiento del lote', `canMovLot` INT NOT NULL COMMENT 'cantidad del movimiento', `cosMovLot` DECIMAL(5,2) NULL COMMENT 'costo del movimiento (unitario)', `cosComMovLot` DECIMAL(5,2) NULL COMMENT 'costo compra del movimiento (unitario)', `entMovLot` TINYINT NOT NULL COMMENT 'indica si es entrada o salida del movimiento', `desMovLot` VARCHAR(80) NULL COMMENT 'descripcion del movimiento lote', `impMovLot` DECIMAL(10,2) NULL COMMENT 'impuesto o valor del iva', `porMovLot` DECIMAL(10) NULL COMMENT 'porcentaje del iva', `arrRecMovLot` TINYINT NOT NULL COMMENT 'campo de si o no de si se arrienda un recurso', `idRecPer` INT NULL, `idEntSalPer` INT NOT NULL, `idTipDocPer` VARCHAR(3) NOT NULL, PRIMARY KEY (`idMovLot`), INDEX `fk_MovimientoLote_Recursos1_idx` (`idRecPer` ASC) , INDEX `fk_MovimientoLote_EntradaSalida1_idx` (`idEntSalPer` ASC, `idTipDocPer` ASC) , CONSTRAINT `fk_MovimientoLote_Recursos1` FOREIGN KEY (`idRecPer`) REFERENCES `sia`.`Recursos` (`idRec`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_MovimientoLote_EntradaSalida1` FOREIGN KEY (`idEntSalPer` , `idTipDocPer`) REFERENCES `sia`.`EntradaSalida` (`idEntSal` , `idTipDocPer`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`PlantasVariedades` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`PlantasVariedades` ( `idPlaVar` INT NOT NULL AUTO_INCREMENT, `tipPlaVar` VARCHAR(45) NOT NULL, `idTipCulPer` INT NOT NULL, PRIMARY KEY (`idPlaVar`), INDEX `fk_PlantasVariedades_TipoCultivo1_idx` (`idTipCulPer` ASC) , CONSTRAINT `fk_PlantasVariedades_TipoCultivo1` FOREIGN KEY (`idTipCulPer`) REFERENCES `sia`.`TipoCultivo` (`idTipCul`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Plantacion` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Plantacion` ( `idPla` INT NOT NULL AUTO_INCREMENT, `numPlaPla` INT NULL COMMENT 'numero de plantas', `numFilPla` INT NULL COMMENT 'numero de filasa de la plantacion', `numPlaFil` INT NULL COMMENT 'numero de plantas por fila de la plantacion', `supPla` DECIMAL(5,2) NULL, `disFilPla` DECIMAL(5,2) NULL COMMENT 'distancia entre filas de la plantacion', `fecIniPla` DATETIME NOT NULL COMMENT 'Fecha de la plantacion', `fecFinPla` DATETIME NULL, `obsPlan` VARCHAR(150) NULL, `idCenCosPer` VARCHAR(20) NOT NULL, `lotCenCosPer` VARCHAR(45) NOT NULL, `idAreCulPer` INT NOT NULL, `idPlaVarPer` INT NOT NULL, `idEstPer` INT NOT NULL, PRIMARY KEY (`idPla`), INDEX `fk_Plantacion_CentroCosto1_idx` (`idCenCosPer` ASC, `lotCenCosPer` ASC, `idAreCulPer` ASC) , INDEX `fk_Plantacion_PlantasVariedades1_idx` (`idPlaVarPer` ASC) , INDEX `fk_Plantacion_Estado1_idx` (`idEstPer` ASC) , CONSTRAINT `fk_Plantacion_CentroCosto1` FOREIGN KEY (`idCenCosPer` , `lotCenCosPer` , `idAreCulPer`) REFERENCES `sia`.`CentroCosto` (`idCenCos` , `lotCenCos` , `idAreCulPer`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Plantacion_PlantasVariedades1` FOREIGN KEY (`idPlaVarPer`) REFERENCES `sia`.`PlantasVariedades` (`idPlaVar`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Plantacion_Estado1` FOREIGN KEY (`idEstPer`) REFERENCES `sia`.`Estado` (`idEst`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`DetalleRendimientoEsperado` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`DetalleRendimientoEsperado` ( `idDetRenEsp` INT NOT NULL AUTO_INCREMENT, `nomDetRenEsp` VARCHAR(60) NOT NULL COMMENT 'nombre de la tarea', `desDetRenEsp` VARCHAR(300) NULL COMMENT 'descripcion del tiopo de rendimiento', `idTipRenPer` INT NOT NULL, `idTipAnaPer` INT NOT NULL, `idGraPer` INT NOT NULL, PRIMARY KEY (`idDetRenEsp`), INDEX `fk_TareasTipoRendimiento_TipoRendimiento1_idx` (`idTipRenPer` ASC) , INDEX `fk_TareasTipoRendimiento_TipoAnalisis1_idx` (`idTipAnaPer` ASC) , INDEX `fk_DetalleRendimientoEsperado_Granja1_idx` (`idGraPer` ASC) , CONSTRAINT `fk_TareasTipoRendimiento_TipoRendimiento1` FOREIGN KEY (`idTipRenPer`) REFERENCES `sia`.`TipoRendimiento` (`idTipRen`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_TareasTipoRendimiento_TipoAnalisis1` FOREIGN KEY (`idTipAnaPer`) REFERENCES `sia`.`TipoAnalisis` (`idTipAna`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_DetalleRendimientoEsperado_Granja1` FOREIGN KEY (`idGraPer`) REFERENCES `sia`.`Granja` (`idGra`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Rendimiento` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Rendimiento` ( `idRen` INT NOT NULL AUTO_INCREMENT, `renRen` INT NOT NULL COMMENT 'Rendimiento Esperado', `preRen` DECIMAL(5,2) NOT NULL COMMENT 'precio del rendimiento', `ingRen` DECIMAL(5,2) NULL COMMENT 'ingreso del rendimiento', `obsRen` VARCHAR(150) NULL, `idPlaVarPer` INT NOT NULL, `idUniPer` VARCHAR(3) NOT NULL, `idEstPer` INT NOT NULL, PRIMARY KEY (`idRen`), INDEX `fk_Rendimiento_PlantasVariedades1_idx` (`idPlaVarPer` ASC) , INDEX `fk_Rendimiento_Unidades1_idx` (`idUniPer` ASC) , INDEX `fk_Rendimiento_Estado1_idx` (`idEstPer` ASC) , CONSTRAINT `fk_Rendimiento_PlantasVariedades1` FOREIGN KEY (`idPlaVarPer`) REFERENCES `sia`.`PlantasVariedades` (`idPlaVar`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Rendimiento_Unidades1` FOREIGN KEY (`idUniPer`) REFERENCES `sia`.`Unidades` (`idUni`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Rendimiento_Estado1` FOREIGN KEY (`idEstPer`) REFERENCES `sia`.`Estado` (`idEst`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`DetalleLaboratorio` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`DetalleLaboratorio` ( `idDetLab` INT NOT NULL AUTO_INCREMENT, `resDetLab` VARCHAR(150) NOT NULL COMMENT 'resultado del examen del laboratorio', `nitDetLab` INT NULL COMMENT 'nitrogeno del resultado', `hpDetLab` DECIMAL(5,2) NULL COMMENT 'hp del resultado', `humDetLab` DECIMAL(5,2) NULL COMMENT 'humus del resultado del laboratorio en porcentaje', `p2o5DetLab` VARCHAR(20) NULL COMMENT 'p205 del resultado', `k2oDetLab` VARCHAR(20) NULL COMMENT 'k2o del resultado', `docDetLab` BLOB NULL COMMENT 'documento (subir) del resultado', `idAnaLabPer` INT NOT NULL, PRIMARY KEY (`idDetLab`), INDEX `fk_DetalleLaboratorio_Laboratorio1_idx` (`idAnaLabPer` ASC) , CONSTRAINT `fk_DetalleLaboratorio_Laboratorio1` FOREIGN KEY (`idAnaLabPer`) REFERENCES `sia`.`AnalisisLaboratorio` (`idAnaLab`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`MedidasAmbientales` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`MedidasAmbientales` ( `idMedAmb` INT NOT NULL AUTO_INCREMENT, `nomMedAmb` VARCHAR(60) NOT NULL COMMENT 'temperatura\nhumedad\nviento\n', `uniMedAmb` VARCHAR(45) NOT NULL COMMENT 'unidades de las medidas hambientales:\ngrados centigrados\nhpa\nkm/h', PRIMARY KEY (`idMedAmb`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`InformacionAmbiental` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`InformacionAmbiental` ( `idInfAmb` INT NOT NULL AUTO_INCREMENT, `fecInfAmb` DATETIME NOT NULL COMMENT 'fecha de toma de la informacion', `valInfAmb` DECIMAL(5,2) NOT NULL COMMENT 'valor de la informacion hambiental', `desInfAmb` VARCHAR(150) NULL COMMENT 'descripcion o observacion de la informacion hambiental', `idPlaPer` INT NULL, `idMedAmbPer` INT NOT NULL, `idActCulPer` INT NOT NULL, PRIMARY KEY (`idInfAmb`), INDEX `fk_InformacionHambiental_MedidasHambientales1_idx` (`idMedAmbPer` ASC) , INDEX `fk_InformacionAmbiental_Plantacion1_idx` (`idPlaPer` ASC) , INDEX `fk_InformacionAmbiental_ActividadCultivo1_idx` (`idActCulPer` ASC) , CONSTRAINT `fk_InformacionHambiental_MedidasHambientales1` FOREIGN KEY (`idMedAmbPer`) REFERENCES `sia`.`MedidasAmbientales` (`idMedAmb`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_InformacionAmbiental_Plantacion1` FOREIGN KEY (`idPlaPer`) REFERENCES `sia`.`Plantacion` (`idPla`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_InformacionAmbiental_ActividadCultivo1` FOREIGN KEY (`idActCulPer`) REFERENCES `sia`.`ActividadCultivo` (`idActCul`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`Periodicidad` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`Periodicidad` ( `idPer` INT NOT NULL AUTO_INCREMENT, `nomPer` VARCHAR(45) NOT NULL COMMENT 'nombre de la periodicidad para la notificacion', `perPer` INT NOT NULL COMMENT 'periodo en dias de la notificacion', `idActCulPer` INT NOT NULL, PRIMARY KEY (`idPer`), INDEX `fk_Periodicidad_ActividadCultivo1_idx` (`idActCulPer` ASC) , CONSTRAINT `fk_Periodicidad_ActividadCultivo1` FOREIGN KEY (`idActCulPer`) REFERENCES `sia`.`ActividadCultivo` (`idActCul`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`ImagenPlantacion` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`ImagenPlantacion` ( `idImaPla` INT NOT NULL, `fecImaPla` DATETIME NOT NULL, `imaImaPla` BLOB NULL COMMENT 'imagen de la plantacion', `obsImaPla` VARCHAR(150) NULL, `idActCulPer` INT NOT NULL AUTO_INCREMENT, `idPlaPer` INT NOT NULL, PRIMARY KEY (`idImaPla`), INDEX `fk_ImagenPlantacion_ActividadCultivo1_idx` (`idActCulPer` ASC) , INDEX `fk_ImagenPlantacion_Plantacion1_idx` (`idPlaPer` ASC) , CONSTRAINT `fk_ImagenPlantacion_ActividadCultivo1` FOREIGN KEY (`idActCulPer`) REFERENCES `sia`.`ActividadCultivo` (`idActCul`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ImagenPlantacion_Plantacion1` FOREIGN KEY (`idPlaPer`) REFERENCES `sia`.`Plantacion` (`idPla`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`TipoParametro` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`TipoParametro` ( `idTipPar` VARCHAR(3) NOT NULL, `nomTipPar` VARCHAR(45) NOT NULL, PRIMARY KEY (`idTipPar`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `sia`.`ParametrosSistema` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sia`.`ParametrosSistema` ( `idParSis` INT NOT NULL AUTO_INCREMENT, `nomParSis` VARCHAR(45) NULL, `valParSis` DECIMAL(18,4) NULL COMMENT 'valor del parametro', `desParSis` VARCHAR(150) NULL, `idTipParPer` VARCHAR(3) NOT NULL, `actParSis` TINYINT NULL COMMENT 'peimte saber si el campo esta activo o no', PRIMARY KEY (`idParSis`), INDEX `fk_ParametrosSistema_TipoParametro1_idx` (`idTipParPer` ASC) , CONSTRAINT `fk_ParametrosSistema_TipoParametro1` FOREIGN KEY (`idTipParPer`) REFERENCES `sia`.`TipoParametro` (`idTipPar`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
select g.name, us.user_id, tblgroup_id from usergroup us inner join tblgroup g on us.tblgroup_id = g.id where us.user_id = 2;
<reponame>hznu-maguochun/longlinkandqrcode -- -------------------------------------------------------- -- -- 表的结构 `jobs` -- CREATE TABLE `jobs` ( `id` int(11) NOT NULL, `queue` varchar(255) NOT NULL, `payload` longtext NOT NULL, `attempts` tinyint(3) UNSIGNED NOT NULL, `reserved` tinyint(3) UNSIGNED NOT NULL, `reserved_at` int(10) UNSIGNED DEFAULT NULL, `available_at` int(10) UNSIGNED NOT NULL, `created_at` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Indexes for dumped tables -- -- -- Indexes for table `jobs` -- ALTER TABLE `jobs` ADD PRIMARY KEY (`id`); -- -- 在导出的表使用AUTO_INCREMENT -- -- -- 使用表AUTO_INCREMENT `jobs` -- ALTER TABLE `jobs` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
<gh_stars>0 -- Basic Modules insert into module(code, name, moduleorder, enablecomment, enablecategory) values('BLOG', 'Blog', 0, true, true); insert into module(code, name, moduleorder, enablecomment, enablecategory) values('STORY', 'Stories', 1, true, true); insert into module(code, name, moduleorder, enablecomment, enablecategory) values('PROJECT', 'Projects', 2, true, false); insert into module(code, name, moduleorder, enablemodule, enablecomment, enablecategory) values('ABOUT', 'About', 3, false, false, false); -- Default Categories with module_blog as ( select * from module where code = 'BLOG' ), cats as ( select 'Development' as name union all select 'Movie' union all select 'Book' union all select 'Blog' ) insert into category(name, moduleid) select c.name, m.id from cats c, module_blog m ; -- Statistic insert into statistic(tablename, statname, value) values('file', 'total_count', '0'); insert into statistic(tablename, statname, value) values('message', 'total_count', '0'); insert into statistic(tablename, statname, value) values('comment', 'total_count', '0'); insert into statistic(tablename, statname, value) values('message', 'blog.total_count', '0'); insert into statistic(tablename, statname, value) values('message', 'project.total_count', '0'); insert into statistic(tablename, statname, value) values('message', 'story.total_count', '0'); insert into statistic(tablename, statname, value) values('message', 'about.total_count', '0'); -- Default / disabled account insert into userinfo(username, password, displayname, email, role, enabled) values('admin@system', '-', 'System', 'admin@system', 'author', false); -- Welcome message with module_blog as ( select * from module where code = 'BLOG' ), default_account as ( select * from userinfo where username = 'admin@system' ) insert into message(title, body, html, published, authorname, authorid, prettyurl, moduleid) select 'Welcome', 'Welcome to your blog!', '<p>Welcome to your blog!</p>', true, a.displayname, a.id, '/welcome', m.id from module_blog m, default_account a;
<reponame>wangsikai/learn ## 按条件从数据库里面随机获取一些题目 #macro($zyPullQuestions(sectionCode,types,exQIds,count,minDifficulty,maxDifficulty)) SELECT * FROM question WHERE sub_flag = 0 #if(sectionCode) AND section_code = :sectionCode #end #if(types) AND type IN (:types) #end #if(exQIds) AND id NOT IN (:exQIds) #end #if(minDifficulty) AND difficulty > :minDifficulty #end #if(maxDifficulty) AND difficulty < :maxDifficulty #end ORDER BY RAND() LIMIT :count #end ## 按照题目篮子要求获取题目列表 #macro($previewQuestions(ids)) SELECT * FROM question t WHERE t.sub_flag = 0 AND t.id in :ids ORDER BY t.type ASC, t.difficulty DESC #end ##判断是否有简答题 #macro($hasQuestionAnswering(ids)) SELECT count(id) FROM question WHERE id IN (:ids) AND type = 5 #end ## 查找需要批改的题目(Homework未过批改时间) #macro($queryNeedCorrectQuestion(hkId)) SELECT q.* FROM question q WHERE q.id IN ( SELECT shq.question_id FROM student_homework_question shq INNER JOIN student_homework sh ON shq.student_homework_id = sh.id WHERE sh.homework_id = :hkId AND sh.status = 1 AND shq.correct_type=3 ) GROUP BY q.id; #end ## 查找需要批改的题目(Homework已经过了批改时间) #macro($queryNeedCorrectQuestionAll(hkId)) SELECT q.* FROM question q WHERE q.id IN ( SELECT shq.question_id FROM student_homework_question shq INNER JOIN student_homework sh ON shq.student_homework_id = sh.id WHERE sh.homework_id = :hkId AND sh.status = 1 AND shq.correct_type=3 ) GROUP BY q.id; #end ## 查询需要批改的题目ID列表(未过人工批改时间) #macro($queryNeedCorrectQuestions(hkId)) SELECT DISTINCT(shq.question_id) FROM student_homework_question shq INNER JOIN student_homework sh ON shq.student_homework_id = sh.id INNER JOIN homework h ON h.id = sh.homework_id WHERE h.id = :hkId AND sh.status = 1 AND shq.correct_type=3 #end ## 查找需要批改的题目ID列表(已过人工批改时间) #macro($queryNeedCorrectQuestionsAll(hkId)) SELECT DISTINCT(shq.question_id) FROM student_homework_question shq INNER JOIN student_homework sh ON shq.student_homework_id = sh.id WHERE sh.homework_id = :hkId AND sh.status = 1 AND shq.correct_type=3 #end ## Recommend-获取教辅习题 #macro($listRecommendQuestionFromUserBook(teacherId, sectionCode, sectionCodes, eliminateQuestionIds,questionType,diff1,diff2,kpCode)) SELECT DISTINCT(bq.question_id) as question_id,t.book_id as book_id FROM user_school_book t INNER JOIN book_version bv ON bv.book_id=t.book_id AND bv.main_flag=1 AND bv.status=2 INNER JOIN book_catalog bc ON bc.book_version_id=bv.id INNER JOIN book_catalog_section bcs ON bcs.book_catalog_id=bc.id #if(sectionCode) AND bcs.section_code=:sectionCode #end #if(sectionCodes) AND bcs.section_code in (:sectionCodes) #end INNER JOIN book_question bq ON bq.book_version_id=bv.id AND bq.book_catalog_id=bc.id INNER JOIN question q on q.id=bq.question_id AND q.status=2 AND q.del_status=0 #if(questionType) AND q.type IN (1,3,5) #elseif AND q.type IN (1,3) #end #if(questionType) and q.type = :questionType #end #if(diff1) and q.difficulty >= :diff1 #end #if(diff2) and q.difficulty < :diff2 #end #if(kpCode) inner join question_knowledge kk on kk.question_id = q.id and kk.knowledge_code = :kpCode #end #if(eliminateQuestionIds) AND bq.question_id not in (:eliminateQuestionIds) #end WHERE t.user_id=:teacherId and t.status=0 #end ## Recommend-获取热门习题 ## 添加教辅书本的限定条件 #macro($listRecommendQuestionFromHot(sectionCode, sectionCodes, num, eliminateQuestionIds,questionType,diff1,diff2,kpCode)) SELECT DISTINCT(hq.question_id) FROM homework_question hq INNER JOIN question q on q.id=hq.question_id AND q.status=2 AND q.del_status=0 #if(questionType) AND q.type IN (1,3,5) #elseif AND q.type IN (1,3) #end #if(questionType) and q.type = :questionType #end #if(diff1) and q.difficulty >= :diff1 #end #if(diff2) and q.difficulty < :diff2 #end #if(kpCode) inner join question_knowledge kk on kk.question_id = q.id and kk.knowledge_code = :kpCode #end INNER JOIN book_question bq ON bq.question_id=q.id INNER JOIN question_section qs ON qs.question_id=hq.question_id and qs.v2=1 #if(sectionCode) AND qs.section_code=:sectionCode #end #if(sectionCodes) AND qs.section_code in (:sectionCodes) #end #if(eliminateQuestionIds) WHERE hq.question_id not in (:eliminateQuestionIds) #end ORDER BY RAND() DESC LIMIT :num #end ## Recommend-获取错题 #macro($listRecommendQuestionFromFall(teacherId, sectionCode, sectionCodes, num, eliminateQuestionIds,questionType,diff1,diff2,kpCode)) SELECT DISTINCT(t.question_id) FROM teacher_fallible_question t INNER JOIN question q ON q.id=t.question_id AND q.status=2 AND q.del_status=0 #if(questionType) AND q.type IN (1,3,5) #elseif AND q.type IN (1,3) #end #if(questionType) and q.type = :questionType #end #if(diff1) and q.difficulty >= :diff1 #end #if(diff2) and q.difficulty < :diff2 #end #if(kpCode) inner join question_knowledge kk on kk.question_id = q.id and kk.knowledge_code = :kpCode #end INNER JOIN question_section qs ON qs.question_id=q.id AND qs.v2=1 #if(sectionCode) AND qs.section_code=:sectionCode #end #if(sectionCodes) AND qs.section_code in (:sectionCodes) #end WHERE t.teacher_id=:teacherId AND t.right_rate <= 50 #if(eliminateQuestionIds) AND t.question_id not in (:eliminateQuestionIds) #end ORDER BY RAND() LIMIT :num #end ## Recommend-获取好题 #macro($listRecommendQuestionFromGood(teacherId, sectionCode, sectionCodes, num, eliminateQuestionIds,questionType,diff1,diff2,kpCode)) SELECT DISTINCT(t.question_id) FROM question_collection t INNER JOIN question q ON q.id=t.question_id AND q.status=2 AND q.del_status=0 #if(questionType) AND q.type IN (1,3,5) #elseif AND q.type IN (1,3) #end #if(questionType) and q.type = :questionType #end #if(diff1) and q.difficulty >= :diff1 #end #if(diff2) and q.difficulty < :diff2 #end #if(kpCode) inner join question_knowledge kk on kk.question_id = q.id and kk.knowledge_code = :kpCode #end INNER JOIN question_section qs ON qs.question_id=t.question_id and qs.v2=1 #if(sectionCode) AND qs.section_code=:sectionCode #end #if(sectionCodes) AND qs.section_code in (:sectionCodes) #end WHERE t.user_id=:teacherId #if(eliminateQuestionIds) AND t.question_id not in (:eliminateQuestionIds) #end ORDER BY RAND() LIMIT :num #end ## Recommend-获取班级薄弱知识点习题 #macro($listRecommendQuestionFromClassWeek(teacherId, sectionCode, sectionCodes, num, eliminateQuestionIds,questionType,diff1,diff2,kpCode)) SELECT DISTINCT(a.id) AS question_id FROM ( SELECT q.* FROM question_knowledge qk INNER JOIN question q ON q.id=qk.question_id AND qk.knowledge_code IN( SELECT kp.code FROM knowledge_point kp INNER JOIN knowledge_section ks ON kp.code = ks.knowledge_code WHERE 1=1 #if(sectionCode) AND ks.section_code = :sectionCode #end #if(sectionCodes) AND ks.section_code IN (:sectionCodes) #end AND kp.status=0 AND kp.difficulty IN(1,2) AND kp.code IN( SELECT dckp.knowpoint_code FROM diagno_class_kp dckp INNER JOIN homework_class c ON c.id=dckp.class_id AND c.teacher_id = :teacherId AND c.status=0 AND (dckp.right_count+1)/(dckp.do_count+2) <=0.3 ) ) #if(questionType) and q.type = :questionType #end #if(diff1) and q.difficulty >= :diff1 #end #if(diff2) and q.difficulty < :diff2 #end #if(kpCode) inner join question_knowledge kk on kk.question_id = q.id and kk.knowledge_code = :kpCode #end WHERE q.status=2 AND q.del_status=0 #if(questionType) AND q.type IN (1,3,5) #elseif AND q.type IN (1,3) #end #if(eliminateQuestionIds) AND qk.question_id NOT in (:eliminateQuestionIds) #end ) a ORDER BY a.difficulty DESC LIMIT :num #end ## Recommend-根据章节获取对应的考点 #macro($listExampointForRecommendQuestion(sectionCode, sectionCodes)) SELECT ep.* FROM examination_point ep INNER JOIN examination_point_knowledge_point ek ON ek.examination_point_id=ep.id INNER JOIN knowledge_point kp ON kp.code=ek.knowledge_point_code AND kp.status=0 AND (kp.difficulty=1 OR kp.difficulty=2) INNER JOIN knowledge_section ks ON ks.knowledge_code=kp.code #if(sectionCode) AND ks.section_code=:sectionCode #end #if(sectionCodes) AND ks.section_code in (:sectionCodes) #end WHERE ep.status=0 AND (ep.frequency=0 OR ep.frequency=2) #end ## Recommend-根据考点获取对应的习题 #macro($listRecommendQuestionFromExampoint(questionIds, num,questionType,diff1,diff2,kpCode)) select q.* from question q #if(kpCode) inner join question_knowledge kk on kk.question_id = q.id and kk.knowledge_code = :kpCode #end INNER JOIN book_question bq ON bq.question_id=q.id #if(questionType) and q.type = :questionType #end #if(diff1) and q.difficulty >= :diff1 #end #if(diff2) and q.difficulty < :diff2 #end where q.status=2 AND q.del_status=0 #if(questionType) AND q.type IN (1,3,5) #elseif AND q.type IN (1,3) #end and q.id in (:questionIds) ORDER BY RAND() LIMIT :num #end ## Recommend-直接从章节对应关系获取习题 ## 添加教辅书的 #macro($listRecommendQuestionFromQuestionSection(sectionCode, sectionCodes, num, eliminateQuestionIds, hasQuestionIds,questionType,diff1,diff2,kpCode)) SELECT DISTINCT(q.id) FROM question q INNER JOIN book_question bq ON bq.question_id=q.id INNER JOIN question_section qs ON qs.question_id=q.id AND qs.v2=1 #if(questionType) and q.type = :questionType #end #if(diff1) and q.difficulty >= :diff1 #end #if(diff2) and q.difficulty < :diff2 #end #if(kpCode) inner join question_knowledge kk on kk.question_id = q.id and kk.knowledge_code = :kpCode #end #if(sectionCode) AND qs.section_code=:sectionCode #end #if(sectionCodes) AND qs.section_code in (:sectionCodes) #end WHERE q.status=2 AND q.del_status=0 #if(questionType) AND q.type IN (1,3,5) #elseif AND q.type IN (1,3) #end #if(eliminateQuestionIds) AND q.id not in (:eliminateQuestionIds) #end #if(hasQuestionIds) AND (q.same_show_id is null or q.same_show_id not in (:hasQuestionIds)) #end ORDER BY RAND() LIMIT :num #end
SELECT reference_data::JSON FROM function_reference WHERE function_id = ? ORDER BY CREATE_DATE ASC OFFSET ? LIMIT ?;
<filename>test/build_scenario.sql<gh_stars>1-10 use orm_test go -- For convenience and clarity, gather the IDs as needed declare @String_Type_ID int , @Integer_Type_ID int , @Decimal_Type_ID int , @Datetime_Type_ID int set @String_Type_ID = (select top 1 template_id from [orm_meta].[templates] where name = 'nvarchar(max)') set @Integer_Type_ID = (select top 1 template_id from [orm_meta].[templates] where name = 'bigint') set @Decimal_Type_ID = (select top 1 template_id from [orm_meta].[templates] where name = 'decimal(19,8)') set @Datetime_Type_ID = (select top 1 template_id from [orm_meta].[templates] where name = 'datetime') -- Create the types insert into [orm_meta].[templates] (name) values ('First Type'),('Another Thing') exec [orm].[template_add] 'Third Type' -- For convenience get the IDs for the types declare @FirstType_ID int , @AnotherThing_ID int , @ThirdType_ID int set @FirstType_ID = (select top 1 template_id from [orm_meta].[templates] where name = 'First Type') set @AnotherThing_ID = (select top 1 template_id from [orm_meta].[templates] where name = 'Another Thing') set @ThirdType_ID = (select top 1 template_id from [orm_meta].[templates] where name = 'Third Type') -- Add some properties to the types exec [orm].[property_add] 'First Type', 'Integer', 'bigint' insert into [orm_meta].[properties] (template_id, name, datatype_id) values (5, 'String', 1) -- 5 happens to be the first ID after the base 4. , (@FirstType_ID, 'DT', @Datetime_Type_ID) exec [orm].[property_add] 'Another Thing', 'Realish', 'decimal(19,8)' exec [orm].[property_add] 'Another Thing', 'Real 2', 'decimal(19,8)' insert into [orm_meta].[properties] (template_id, name, datatype_id) values (@ThirdType_ID, 'Addon Prop', 1) , (@ThirdType_ID, 'Beginning', @Datetime_Type_ID) , (@ThirdType_ID, 'Ending', 4) -- Create some instances insert into [orm_meta].[instances] (template_id, name) values (5, 'FirstObj') , (@ThirdType_ID, 'ThirdObj') exec [orm].[instance_add] 'Another Thing', 'Another Obj' exec [orm].[instance_add] 'Another Thing', 'AnotherObject2' declare @FirstObj_ID int , @ThirdObj_ID int , @AnotherObj_ID int , @AnotherObject2 int set @FirstObj_ID = (select top 1 instance_id from [orm_meta].[instances] where name = 'FirstObj') set @ThirdObj_ID = (select top 1 instance_id from [orm_meta].[instances] where name = 'ThirdObj') set @AnotherObj_ID = (select top 1 instance_id from [orm_meta].[instances] where name = 'Another Obj') set @AnotherObject2 = (select top 1 instance_id from [orm_meta].[instances] where name = 'AnotherObject2') -- Add some data exec [orm].[value_change] 'First Type', 'FirstObj', 'String', 'First words.' exec [orm].[value_change_datetime] 'First Type', 'FirstObj', 'DT', '2020-02-20 20:02' declare @template_id int, @instance_id int, @property_id int set @template_id = (select top 1 template_id from [orm_meta].[templates] where name = 'First Type') set @instance_id = (select top 1 instance_id from [orm_meta].[instances] where name = 'FirstObj' and template_id = @template_id) set @property_id = (select top 1 property_id from [orm_meta].[properties] where name = 'DT' and template_id = @template_id) insert into [orm_meta].[values_decimal] (instance_id, property_id, value) values ( @AnotherObj_ID , (select top 1 property_id from [orm_meta].[properties] where template_id = @AnotherThing_ID and name = 'Real 2') , 123.45)
create procedure p(a int, b int) begin print 'a=' || a; print 'b=' || b; end; call p(1,2); call p(1);
/* Navicat MySQL Data Transfer Source Server : 192.168.1.231 Source Server Version : 50623 Source Host : 192.168.1.231:3306 Source Database : anjie Target Server Type : MYSQL Target Server Version : 50623 File Encoding : 65001 Date: 2018-03-27 09:14:08 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for tst_msgtype -- ---------------------------- DROP TABLE IF EXISTS `tst_msgtype`; CREATE TABLE `tst_msgtype` ( `msgtype_id` int(11) NOT NULL COMMENT '消息类型ID', `system_id` tinyint(4) NOT NULL COMMENT '系统ID', `msgcategory_id` tinyint(4) NOT NULL COMMENT '消息类别ID', `msgtype_name` varchar(32) NOT NULL COMMENT '消息类型名称', PRIMARY KEY (`msgtype_id`), UNIQUE KEY `XAK1_BM_MSG` (`msgtype_name`,`system_id`), KEY `BM_03_R_2` (`msgcategory_id`), KEY `BM_03_R_7` (`system_id`), CONSTRAINT `BM_03_R_2` FOREIGN KEY (`msgcategory_id`) REFERENCES `tst_msgcategory` (`msgcategory_id`), CONSTRAINT `BM_03_R_7` FOREIGN KEY (`system_id`) REFERENCES `tsi_systems` (`system_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息类型';
<reponame>comagic/pg_export {%- for c in columns -%} {{'\n '}} {{- c.name }} {{ c.type }} {%- if c.collate %} collate {{ c.collate }} {%- endif %} {%- if c.not_null %} not null{% endif %} {%- if c.default %} default {{ c.default|replace('public.', '')|untype_default(c.type) }}{% endif %} {%- if not loop.last %},{% endif %} {%- if c.comment %} -- {{ c.comment|replace('\n', '\\n') }}{% endif %} {%- endfor %}
-- phpMyAdmin SQL Dump -- version 5.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Oct 21, 2020 at 06:39 AM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.4.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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: `paibaaco_dev` -- -- -------------------------------------------------------- -- -- Table structure for table `ad_post` -- CREATE TABLE `ad_post` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED NOT NULL, `category_id` bigint(20) UNSIGNED NOT NULL, `title` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL, `lang` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `address` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `contact` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `price` double(10,2) DEFAULT 0.00, `is_negotiable` tinyint(3) UNSIGNED NOT NULL DEFAULT 2 COMMENT '1=Yes, 2=Fixed', `tag` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, `link` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `is_approved` tinyint(3) UNSIGNED NOT NULL DEFAULT 2 COMMENT '1=Yes, 2=Pending,3=No', `deliverable` tinyint(1) NOT NULL DEFAULT 2 COMMENT '1=Yes deliverable, 2=No deliverable', `delivery_fee` float(8,2) DEFAULT 0.00, `status` tinyint(4) NOT NULL DEFAULT 0, `visitor` bigint(20) UNSIGNED DEFAULT NULL, `approved_by` bigint(20) UNSIGNED DEFAULT NULL, `published_till` datetime DEFAULT NULL, `created_by` bigint(20) UNSIGNED NOT NULL, `updated_by` bigint(20) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `ad_post` -- INSERT INTO `ad_post` (`id`, `user_id`, `category_id`, `title`, `lang`, `address`, `contact`, `price`, `is_negotiable`, `tag`, `link`, `description`, `is_approved`, `deliverable`, `delivery_fee`, `status`, `visitor`, `approved_by`, `published_till`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (55, 1, 1, 'Title update', NULL, 'Dhaka', NULL, 1000.00, 2, 'good,Good Food,new Tag', 'title-update-1-200719171812', '<p>Description Description Description Description&nbsp;</p>', 1, 1, 160.00, 1, NULL, NULL, NULL, 1, 1, '2020-07-16 01:22:39', '2020-07-19 11:18:12'), (56, 1, 1, 'New Post', NULL, 'Nawqbgonj', NULL, 1500.00, 2, 'Good Price,Best electronic', 'new-post-1-200720114441', '<p>post Descriptionpost Descriptionpost Descriptionpost Descriptionpost Description</p>', 1, 1, 200.00, 1, NULL, NULL, NULL, 1, 1, '2020-07-20 05:42:50', '2020-07-20 05:44:41'), (57, 1, 2, 'Mobile Sale needed', NULL, 'Narayengonj', NULL, 16000.00, 2, 'Mobile,Best Mobile,Second Hand Mobile', 'mobile-sale-needed-1-200724220535', '<p>Mobile Description&nbsp;Mobile Description&nbsp;Mobile Description</p>', 1, 1, 350.00, 1, NULL, NULL, NULL, 1, 1, '2020-07-20 05:48:12', '2020-07-24 16:05:35'), (63, 1, 3, 'House rent', NULL, 'Dhaka Mirpur', NULL, 2500.00, 2, 'Good Rome,Nice House', 'house-rent-1-200725085548', '<p>House Rent House Rent Dhaka, Dhaka House Rent</p>', 1, 2, NULL, 1, NULL, NULL, NULL, 1, 1, '2020-07-25 02:55:02', '2020-07-25 02:55:48'), (64, 1, 5, 'Which are Brone Removing Best Creame?', 'English', NULL, NULL, 0.00, 2, 'Beauti care,Beauti matter', 'which-are-brone-removing-best--1-200808171741', '<p><span style=\"font-family: Lato;\">Founder <NAME> provides a fresh voice to the beauty industry with content from her perspective, and through her lens. BeautyMatter also publishes highly curated news and exclusive original pieces by thought leaders and beauty insiders.</span></p>', 1, 2, 0.00, 1, NULL, NULL, NULL, 1, 1, '2020-07-29 04:32:57', '2020-08-08 11:17:41'), (65, 8, 4, 'Service Ads', NULL, 'Ddhanmondi, Dhaka', NULL, 1500.00, 2, 'Best Service,Quality Service,Unique Service', 'service-ads-8-201021070535', '<p>Some Content about my Service</p>', 2, 2, NULL, 1, NULL, NULL, NULL, 8, 8, '2020-10-21 00:59:09', '2020-10-21 01:05:35'); -- -------------------------------------------------------- -- -- Table structure for table `ad_post_areas` -- CREATE TABLE `ad_post_areas` ( `id` bigint(20) UNSIGNED NOT NULL, `area_id` bigint(20) UNSIGNED DEFAULT NULL, `ad_post_id` bigint(20) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `ad_post_comments` -- CREATE TABLE `ad_post_comments` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED NOT NULL, `ad_post_id` bigint(20) UNSIGNED NOT NULL, `comment` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `status` tinyint(3) UNSIGNED NOT NULL COMMENT '1=Active, 2=Inactive', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `ad_post_comments` -- INSERT INTO `ad_post_comments` (`id`, `user_id`, `ad_post_id`, `comment`, `status`, `created_at`, `updated_at`) VALUES (8, 1, 64, 'Good One', 0, '2020-07-29 10:43:10', '2020-07-29 10:43:10'), (9, 1, 64, 'hjytrrsf', 0, '2020-09-05 16:35:44', '2020-09-05 16:35:44'), (10, 1, 64, 'Good', 0, '2020-09-05 18:26:33', '2020-09-05 18:26:33'), (11, 1, 64, 'new comment', 0, '2020-09-07 10:18:44', '2020-09-07 10:18:44'); -- -------------------------------------------------------- -- -- Table structure for table `ad_post_locations` -- CREATE TABLE `ad_post_locations` ( `id` bigint(20) UNSIGNED NOT NULL, `ad_post_id` bigint(20) UNSIGNED NOT NULL, `category_id` bigint(20) UNSIGNED NOT NULL, `location_id` bigint(20) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `ad_post_locations` -- INSERT INTO `ad_post_locations` (`id`, `ad_post_id`, `category_id`, `location_id`, `created_at`, `updated_at`) VALUES (74, 55, 1, 2, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (75, 55, 1, 7, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (76, 55, 1, 9, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (83, 56, 1, 2, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (84, 56, 1, 10, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (85, 56, 1, 11, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (92, 57, 2, 12, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (93, 57, 2, 13, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (94, 57, 2, 14, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (97, 63, 3, 19, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (98, 63, 3, 2, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (123, 64, 5, 2, '2020-08-08 11:17:41', '2020-08-08 11:17:41'), (124, 64, 5, 20, '2020-08-08 11:17:41', '2020-08-08 11:17:41'), (131, 65, 4, 21, '2020-10-21 01:05:35', '2020-10-21 01:05:35'), (132, 65, 4, 22, '2020-10-21 01:05:35', '2020-10-21 01:05:35'), (133, 65, 4, 23, '2020-10-21 01:05:35', '2020-10-21 01:05:35'); -- -------------------------------------------------------- -- -- Table structure for table `ad_post_prices` -- CREATE TABLE `ad_post_prices` ( `id` bigint(20) UNSIGNED NOT NULL, `ad_post_id` bigint(20) UNSIGNED NOT NULL, `category_id` bigint(20) UNSIGNED NOT NULL, `sub_category_id` bigint(20) UNSIGNED DEFAULT NULL, `price_title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL, `price` double(10,2) NOT NULL, `is_negotiable` tinyint(3) UNSIGNED NOT NULL DEFAULT 2 COMMENT '1=Yes, 2=Fixed', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `ad_post_prices` -- INSERT INTO `ad_post_prices` (`id`, `ad_post_id`, `category_id`, `sub_category_id`, `price_title`, `price`, `is_negotiable`, `created_at`, `updated_at`) VALUES (204, 55, 1, 2, 'Peice Tk', 1000.00, 2, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (205, 55, 1, 2, 'Peice Tk 1', 1500.00, 2, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (206, 55, 1, 2, 'update price', 200.00, 2, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (231, 56, 1, 45, 'First Price', 1500.00, 2, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (232, 56, 1, 45, 'Last Price', 1400.00, 2, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (233, 56, 1, 45, 'Second Price', 1450.00, 2, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (258, 57, 2, 47, 'Ac Buss', 16000.00, 2, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (259, 57, 2, 47, 'First Price', 18000.00, 2, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (260, 57, 2, 47, 'Second Price', 17500.00, 2, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (287, 63, 3, 59, 'Monthly', 2500.00, 2, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (288, 63, 3, 59, 'Quarterly', 7000.00, 2, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (295, 65, 4, 62, 'One Month', 1500.00, 2, '2020-10-21 01:05:35', '2020-10-21 01:05:35'), (296, 65, 4, 62, 'Tow Month', 2800.00, 2, '2020-10-21 01:05:35', '2020-10-21 01:05:35'), (297, 65, 4, 62, 'Four Month', 5000.00, 2, '2020-10-21 01:05:35', '2020-10-21 01:05:35'); -- -------------------------------------------------------- -- -- Table structure for table `ad_post_sub_category` -- CREATE TABLE `ad_post_sub_category` ( `id` bigint(20) UNSIGNED NOT NULL, `ad_post_id` bigint(20) UNSIGNED NOT NULL, `category_id` bigint(20) UNSIGNED DEFAULT NULL, `sub_category_id` bigint(20) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `ad_post_sub_category` -- INSERT INTO `ad_post_sub_category` (`id`, `ad_post_id`, `category_id`, `sub_category_id`, `created_at`, `updated_at`) VALUES (82, 55, 1, 1, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (83, 55, 1, 43, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (84, 55, 1, 2, '2020-07-19 11:18:12', '2020-07-19 11:18:12'), (91, 56, 1, 44, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (92, 56, 1, 2, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (93, 56, 1, 45, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (100, 57, 2, 7, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (101, 57, 2, 46, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (102, 57, 2, 47, '2020-07-24 16:05:35', '2020-07-24 16:05:35'), (115, 63, 3, 58, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (116, 63, 3, 59, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (148, 64, 5, 60, '2020-08-08 11:17:41', '2020-08-08 11:17:41'), (149, 64, 5, 61, '2020-08-08 11:17:41', '2020-08-08 11:17:41'), (152, 65, 4, 62, '2020-10-21 01:05:35', '2020-10-21 01:05:35'); -- -------------------------------------------------------- -- -- Table structure for table `answer_replays` -- CREATE TABLE `answer_replays` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED DEFAULT NULL, `ad_post_id` bigint(20) UNSIGNED DEFAULT NULL, `answer_id` bigint(20) UNSIGNED DEFAULT NULL, `replay` text COLLATE utf8mb4_unicode_ci NOT NULL, `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '1=Active, 2=Inactive', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `answer_replays` -- INSERT INTO `answer_replays` (`id`, `user_id`, `ad_post_id`, `answer_id`, `replay`, `status`, `created_at`, `updated_at`) VALUES (14, 1, 64, 1, 'Good Answer', 1, '2020-09-07 11:05:51', '2020-09-07 11:05:51'); -- -------------------------------------------------------- -- -- Table structure for table `areas` -- CREATE TABLE `areas` ( `id` bigint(20) UNSIGNED NOT NULL, `division_town_id` bigint(20) UNSIGNED NOT NULL, `area_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `area_name_bn` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `serial_num` int(10) UNSIGNED DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `areas` -- INSERT INTO `areas` (`id`, `division_town_id`, `area_name`, `area_name_bn`, `serial_num`, `status`, `created_at`, `updated_at`) VALUES (1, 3, 'Bagerhat', NULL, 1, 1, '2020-02-16 15:02:42', '2020-02-16 15:02:42'), (2, 5, 'Paltan', NULL, 1, 1, '2020-02-18 06:40:25', '2020-02-18 06:40:25'), (3, 5, 'Jatrabari', NULL, 1, 1, '2020-02-18 06:40:25', '2020-02-18 06:40:25'), (4, 4, 'Mirpur', NULL, 1, 1, '2020-02-18 06:41:12', '2020-02-18 06:41:12'), (5, 4, 'Mohammadpur', NULL, 1, 1, '2020-02-18 06:41:12', '2020-02-18 06:41:12'); -- -------------------------------------------------------- -- -- Table structure for table `blog_answers` -- CREATE TABLE `blog_answers` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED DEFAULT NULL, `ad_post_id` bigint(20) UNSIGNED DEFAULT NULL, `answer` text COLLATE utf8mb4_unicode_ci NOT NULL, `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '1=Active, 2=Inactive', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `blog_answers` -- INSERT INTO `blog_answers` (`id`, `user_id`, `ad_post_id`, `answer`, `status`, `created_at`, `updated_at`) VALUES (1, 1, 64, '<p><span style=\"color: #7b7b7b; font-family: Lato; font-size: 16px;\"><NAME> provides a fresh voice to the beauty industry with content from her perspective, and through her lens. BeautyMatter also publishes highly curated news and exclusive original pieces by thought leaders and beauty insider&nbsp;</span></p>', 1, '2020-07-29 16:48:37', '2020-09-04 04:46:05'); -- -------------------------------------------------------- -- -- Table structure for table `brands` -- CREATE TABLE `brands` ( `id` bigint(20) UNSIGNED NOT NULL, `brand_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `brand_name_bn` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `serial_num` int(10) UNSIGNED DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `created_by` bigint(20) UNSIGNED NOT NULL, `updated_by` bigint(20) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE `categories` ( `id` bigint(20) UNSIGNED NOT NULL, `category_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `category_name_bn` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `order_label` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `serial_num` tinyint(4) NOT NULL, `short_description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `icon_photo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `icon_class` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `link` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=Business, 2=Product', `post_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=Normal, 2=Special', `ad_view_type` tinyint(1) NOT NULL DEFAULT 1, `status` tinyint(4) NOT NULL DEFAULT 1, `created_by` bigint(20) UNSIGNED NOT NULL, `updated_by` bigint(20) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `categories` -- INSERT INTO `categories` (`id`, `category_name`, `category_name_bn`, `order_label`, `serial_num`, `short_description`, `icon_photo`, `icon_class`, `link`, `type`, `post_type`, `ad_view_type`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (1, 'Need', NULL, 'Apply', 1, 'dfdfg', 'images/categories/2019/12/06/b06-12-201900-26-04.jpg', 'fa fa-desktop', 'need', 1, 1, 2, 1, 1, 1, '2019-12-05 17:39:14', '2020-07-01 01:52:06'), (2, 'SALE', NULL, 'Order', 2, 'Sale', 'images/categories/2019/12/06/dashboard-m19-09-201912-18-4506-12-201916-00-09.png', NULL, 'sale', 1, 1, 1, 1, 1, 1, '2019-12-06 09:59:37', '2020-07-25 10:30:52'), (3, 'RENT', NULL, 'Request', 3, NULL, 'images/categories/2019/12/08/dashboard-m19-09-201912-18-4508-12-201923-08-17.png', NULL, 'rent', 1, 1, 1, 1, 1, 1, '2019-12-08 17:08:17', '2020-07-25 10:31:06'), (4, 'SERVICE', NULL, 'Order', 4, NULL, 'images/categories/2019/12/08/dashboard-m19-09-201912-18-4508-12-201923-08-37.png', NULL, 'service', 1, 1, 1, 1, 1, 1, '2019-12-08 17:08:37', '2020-07-01 01:52:27'), (5, 'Write/Ask', NULL, 'Request', 5, NULL, 'images/categories/2019/12/08/users08-12-201923-08-55.png', NULL, 'write-ask', 1, 2, 2, 1, 1, 1, '2019-12-08 17:08:55', '2020-07-25 10:31:51'); -- -------------------------------------------------------- -- -- Table structure for table `category_wise_ad_counts` -- CREATE TABLE `category_wise_ad_counts` ( `id` bigint(20) UNSIGNED NOT NULL, `category_id` bigint(20) UNSIGNED DEFAULT NULL, `total_ad` int(10) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `category_wise_ad_counts` -- INSERT INTO `category_wise_ad_counts` (`id`, `category_id`, `total_ad`, `created_at`, `updated_at`) VALUES (1, 1, 2, '2020-07-19 11:02:08', '2020-07-20 05:44:41'), (2, 2, 1, '2020-07-20 05:49:55', '2020-07-20 05:49:55'), (3, 3, 1, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (12, 5, 1, '2020-07-29 04:55:56', '2020-07-29 04:56:59'), (13, 4, 1, '2020-10-21 01:02:48', '2020-10-21 01:02:48'); -- -------------------------------------------------------- -- -- Table structure for table `designations` -- CREATE TABLE `designations` ( `id` bigint(20) UNSIGNED NOT NULL, `designation` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, `designation_bn` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, `created_by` bigint(20) UNSIGNED NOT NULL, `updated_by` bigint(20) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `districts` -- CREATE TABLE `districts` ( `id` bigint(20) UNSIGNED NOT NULL, `division_id` bigint(20) UNSIGNED DEFAULT NULL, `district` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `district_bn` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `serial_num` int(10) UNSIGNED DEFAULT NULL, `show_at_home` tinyint(3) UNSIGNED DEFAULT 0, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `divisions` -- CREATE TABLE `divisions` ( `id` bigint(20) UNSIGNED NOT NULL, `division` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `division_bn` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `serial_num` int(10) UNSIGNED DEFAULT NULL, `show_at_home` tinyint(3) UNSIGNED DEFAULT 0, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `division_towns` -- CREATE TABLE `division_towns` ( `id` bigint(20) UNSIGNED NOT NULL, `division_town` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `division_town_bn` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `link` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, `type` tinyint(4) DEFAULT NULL COMMENT '1=Division, 2=Town', `serial_num` int(10) UNSIGNED DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `division_towns` -- INSERT INTO `division_towns` (`id`, `division_town`, `division_town_bn`, `link`, `type`, `serial_num`, `status`, `created_at`, `updated_at`) VALUES (1, 'Dhaka', NULL, 'dhaka', 1, 1, 1, '2020-02-16 15:01:35', '2020-02-16 15:01:35'), (2, 'Rajshahi', NULL, 'rajshahi', 1, 1, 1, '2020-02-16 15:01:35', '2020-02-16 15:01:35'), (3, 'Khulna', NULL, 'khulna', 1, 1, 1, '2020-02-16 15:01:35', '2020-02-16 15:01:35'), (4, 'Dhaka North City', NULL, 'dhaka-north-city', 2, 2, 1, '2020-02-18 06:37:49', '2020-02-18 06:37:49'), (5, 'Dhaka South City', NULL, 'dhaka-south-city', 2, 2, 1, '2020-02-18 06:37:49', '2020-02-18 06:37:49'); -- -------------------------------------------------------- -- -- Table structure for table `failed_jobs` -- CREATE TABLE `failed_jobs` ( `id` bigint(20) UNSIGNED NOT NULL, `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `failed_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `locations` -- CREATE TABLE `locations` ( `id` bigint(20) UNSIGNED NOT NULL, `location_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `location_name_bn` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `url` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `created_by` bigint(20) UNSIGNED DEFAULT NULL, `updated_by` bigint(20) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `locations` -- INSERT INTO `locations` (`id`, `location_name`, `location_name_bn`, `url`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (2, 'Dhaka', NULL, 'dhaka', 1, 1, NULL, '2020-07-05 10:33:49', '2020-07-05 11:11:30'), (7, 'kholna', NULL, 'kholna', 1, NULL, NULL, '2020-07-15 05:30:50', '2020-07-15 05:30:50'), (8, 'Barishal', NULL, 'barishal', 1, NULL, NULL, '2020-07-15 16:43:48', '2020-07-15 16:43:48'), (9, 'new onea', NULL, 'new-onea', 1, NULL, NULL, '2020-07-17 00:21:05', '2020-07-17 00:21:05'), (10, 'Chadpur', NULL, 'chadpur', 1, NULL, NULL, '2020-07-20 05:42:50', '2020-07-20 05:42:50'), (11, 'Nawabgonj', NULL, 'nawabgonj', 1, NULL, NULL, '2020-07-20 05:42:50', '2020-07-20 05:42:50'), (12, 'Narayengonj', NULL, 'narayengonj', 1, NULL, NULL, '2020-07-20 05:48:12', '2020-07-20 05:48:12'), (13, 'Rupgonj', NULL, 'rupgonj', 1, NULL, NULL, '2020-07-20 05:48:12', '2020-07-20 05:48:12'), (14, 'Sonarga', NULL, 'sonarga', 1, NULL, NULL, '2020-07-20 05:48:12', '2020-07-20 05:48:12'), (19, 'Mirpur', NULL, 'mirpur', 1, NULL, NULL, '2020-07-25 02:55:02', '2020-07-25 03:08:36'), (20, 'Dhanmondi', NULL, 'dhanmondi', 1, NULL, NULL, '2020-07-29 04:32:57', '2020-07-29 04:32:57'), (21, 'Sholla', NULL, 'sholla', 1, NULL, NULL, '2020-10-21 00:59:09', '2020-10-21 00:59:09'), (22, 'Nawab', NULL, 'nawab', 1, NULL, NULL, '2020-10-21 00:59:09', '2020-10-21 00:59:09'), (23, 'Dohar', NULL, 'dohar', 1, NULL, NULL, '2020-10-21 00:59:09', '2020-10-21 00:59:09'); -- -------------------------------------------------------- -- -- Table structure for table `location_wise_ad_counts` -- CREATE TABLE `location_wise_ad_counts` ( `id` bigint(20) UNSIGNED NOT NULL, `location_id` bigint(20) UNSIGNED DEFAULT NULL, `total_ad` int(10) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `location_wise_ad_counts` -- INSERT INTO `location_wise_ad_counts` (`id`, `location_id`, `total_ad`, `created_at`, `updated_at`) VALUES (1, 2, 3, '2020-07-19 11:02:08', '2020-07-29 04:56:59'), (2, 7, 1, '2020-07-19 11:02:08', '2020-07-19 11:18:12'), (3, 9, 1, '2020-07-19 11:02:08', '2020-07-19 11:18:12'), (4, 10, 1, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (5, 11, 1, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (6, 12, 1, '2020-07-20 05:49:55', '2020-07-20 05:49:55'), (7, 13, 1, '2020-07-20 05:49:55', '2020-07-20 05:49:55'), (8, 14, 1, '2020-07-20 05:49:55', '2020-07-20 05:49:55'), (9, 19, 1, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (13, 20, 1, '2020-07-29 04:55:56', '2020-07-29 04:56:59'), (14, 21, 1, '2020-10-21 01:02:48', '2020-10-21 01:02:48'), (15, 22, 1, '2020-10-21 01:02:48', '2020-10-21 01:02:48'), (16, 23, 1, '2020-10-21 01:02:48', '2020-10-21 01:02:48'); -- -------------------------------------------------------- -- -- Table structure for table `menu` -- CREATE TABLE `menu` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `name_bn` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `icon_class` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `big_icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, `serial_num` tinyint(3) UNSIGNED NOT NULL, `type` tinyint(3) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `menu` -- INSERT INTO `menu` (`id`, `name`, `name_bn`, `url`, `icon_class`, `slug`, `icon`, `big_icon`, `status`, `serial_num`, `type`, `created_at`, `updated_at`) VALUES (1, 'Setting', NULL, '#', 'fa fa-config', '[\"setting\"]', 'images/menu/icon/2019/12/06/setting06-12-201909-59-03.png', 'images/menu/big-icon/2019/12/06/setting06-12-201909-59-03.png', 1, 4, 1, '2019-12-06 03:59:03', '2020-02-02 22:58:26'), (2, 'Set Up', NULL, '#', 'fa fa-setup', '[\"set-up\"]', 'images/menu/icon/2019/12/06/setting06-12-201910-02-01.png', 'images/menu/big-icon/2019/12/06/setting06-12-201910-02-01.png', 1, 4, 1, '2019-12-06 04:02:01', '2020-02-02 22:58:12'), (3, 'Pending Ads', NULL, 'manage-ad', 'fa fa-folder', '[\"manage-ad.view\",\"manage-ad.create\",\"manage-ad.update\",\"manage-ad.delete\"]', 'images/menu/icon/2019/12/25/information25-12-201922-24-34.png', 'images/menu/big-icon/2019/12/25/information25-12-201922-24-34.png', 1, 1, 1, '2019-12-25 16:24:34', '2020-02-02 22:56:21'), (4, 'All Approve Ads', NULL, 'all-ads', 'fa fa-folder', '[\"manage-ad.view\"]', 'images/menu/icon/2019/12/25/information25-12-201922-25-39.png', 'images/menu/big-icon/2019/12/25/information25-12-201922-25-39.png', 1, 2, 1, '2019-12-25 16:25:39', '2020-02-02 22:56:46'), (5, 'All Admin Users', NULL, 'all-users', 'fa fa', '[\"admin-users\"]', 'images/menu/icon/2020/02/02/information25-12-201922-25-3902-02-202023-09-49.png', 'images/menu/big-icon/2020/02/02/information25-12-201922-25-3902-02-202023-09-49.png', 1, 3, 1, '2020-02-02 22:09:49', '2020-02-02 22:57:28'); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2015_12_20_100001_create_permissions_table', 1), (4, '2015_12_20_100002_create_roles_table', 1), (5, '2015_12_20_100003_create_permission_role_table', 1), (6, '2015_12_20_100004_create_role_user_table', 1), (7, '2018_12_08_225702_create_divisions_table', 1), (8, '2018_12_09_173537_create_districts_table', 1), (9, '2018_12_09_180420_create_thana_upazilas_table', 1), (10, '2019_05_19_224359_create_designations_table', 1), (11, '2019_08_19_000000_create_failed_jobs_table', 1), (13, '2019_11_07_123603_create_primary_info_table', 1), (14, '2019_11_07_172733_create_menu_table', 1), (15, '2019_11_07_173956_create_sub_menu_table', 1), (16, '2019_11_07_174703_create_sub_sub_menu_table', 1), (17, '2019_11_08_090748_create_page_table', 1), (18, '2019_11_08_091123_create_page_photo_table', 1), (19, '2019_11_15_123151_add_address_image_users_table', 1), (21, '2019_11_02_100237_create_categories_table', 2), (22, '2018_12_10_102736_create_division_towns_table', 3), (23, '2018_12_11_103448_create_areas_table', 3), (24, '2018_12_10_104034_create_brands_table', 4), (25, '2019_12_05_110517_create_post_files_table', 5), (28, '2019_11_02_120849_create_sub_category_table', 6), (29, '2019_12_05_123613_create_sub_category_wise_brands_table', 7), (30, '2019_12_05_124015_create_sub_category_wise_field_table', 8), (31, '2019_12_05_152247_create_ad_post_table', 9), (32, '2019_12_05_154250_create_post_field_value_table', 10), (33, '2019_12_05_154642_create_post_wise_number_table', 11), (34, '2019_12_05_155010_create_post_photos_table', 12), (35, '2019_12_07_093627_create_change_table_post_files_to_post_fields_table', 13), (36, '2019_11_16_064126_create_user_infos_table', 14), (37, '2019_12_31_210655_create_price_negotiations_table', 15), (39, '2020_01_16_152918_create_ad_post_comments_table', 16), (40, '2019_11_05_154604_create_locations_table', 17), (41, '2019_12_06_002020_create_ad_post_areas_table', 20), (43, '2020_07_06_100249_create_ad_post_locations_table', 22), (44, '2020_07_06_100607_create_ad_post_prices_table', 22), (45, '2019_12_06_095445_create_ad_post_sub_categories_table', 23), (46, '2020_07_15_093557_create_location_wise_ad_counts_table', 24), (47, '2020_07_15_093841_create_category_wise_ad_counts_table', 24), (48, '2020_07_15_093904_create_sub_category_wise_ad_counts_table', 24), (51, '2020_07_29_171902_create_blog_answers_table', 25), (52, '2020_07_29_172415_create_answer_replays_table', 25), (53, '2020_09_30_101129_create_orders_table', 26), (54, '2020_09_30_103535_create_order_prices_table', 26); -- -------------------------------------------------------- -- -- Table structure for table `orders` -- CREATE TABLE `orders` ( `id` bigint(20) UNSIGNED NOT NULL, `ad_post_id` bigint(20) UNSIGNED DEFAULT NULL, `customer_id` bigint(20) UNSIGNED DEFAULT NULL, `post_user_id` bigint(20) UNSIGNED DEFAULT NULL, `category_id` bigint(20) UNSIGNED DEFAULT NULL, `booking_date_start` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for rend and service', `booking_date_end` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for rend and service', `booking_time_start` time DEFAULT NULL COMMENT 'for rend and service', `booking_time_end` time DEFAULT NULL COMMENT 'for rend and service', `txt_message` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `attach_file` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for need', `delivery_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for sale', `total_amount` double(10,1) NOT NULL DEFAULT 0.0, `service_meet_up` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for service', `status` tinyint(3) UNSIGNED NOT NULL COMMENT '0=new order,1=view, 2=delivered,3=reject', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `orders` -- INSERT INTO `orders` (`id`, `ad_post_id`, `customer_id`, `post_user_id`, `category_id`, `booking_date_start`, `booking_date_end`, `booking_time_start`, `booking_time_end`, `txt_message`, `attach_file`, `delivery_address`, `total_amount`, `service_meet_up`, `status`, `created_at`, `updated_at`) VALUES (1, 63, 8, 1, 3, '2020-10-21', '2020-10-23', '01:00:00', '01:01:00', 'dfdff', NULL, NULL, 0.0, NULL, 0, '2020-10-21 04:38:47', '2020-10-21 04:38:47'); -- -------------------------------------------------------- -- -- Table structure for table `order_prices` -- CREATE TABLE `order_prices` ( `id` bigint(20) UNSIGNED NOT NULL, `order_id` bigint(20) UNSIGNED DEFAULT NULL, `price_title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `price` double(10,1) NOT NULL DEFAULT 0.0, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `order_prices` -- INSERT INTO `order_prices` (`id`, `order_id`, `price_title`, `price`, `created_at`, `updated_at`) VALUES (1, 1, 'Monthly', 0.0, '2020-10-21 04:38:47', '2020-10-21 04:38:47'), (2, 1, 'Quarterly', 0.0, '2020-10-21 04:38:47', '2020-10-21 04:38:47'); -- -------------------------------------------------------- -- -- Table structure for table `page` -- CREATE TABLE `page` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `name_bn` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `title_bn` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description_ban` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `file` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, `serial_num` tinyint(3) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `page` -- INSERT INTO `page` (`id`, `name`, `name_bn`, `title`, `title_bn`, `description`, `description_ban`, `link`, `file`, `status`, `serial_num`, `created_at`, `updated_at`) VALUES (1, 'Term & Condition', NULL, 'Our Term & Condition', NULL, '<p>Our Term &amp; Condition<br></p><p>Our Term &amp; Condition<br></p><p>Our Term &amp; Condition<br></p><p><br></p>', NULL, 'term-&-condition', NULL, 1, 1, '2020-01-30 11:26:04', '2020-01-30 11:26:04'), (2, 'FAQ', NULL, 'FAQ', NULL, '<p>faq..</p>', NULL, 'faq', NULL, 1, 2, '2020-02-02 09:53:28', '2020-02-02 09:54:15'), (3, 'Advertise with Paibaa', NULL, 'Advertise with Paibaa', NULL, '<p><a target=\"_blank\" rel=\"nofollow\" href=\"https://docs.google.com/forms/d/e/1FAIpQLSfvf0QhCsl4Jp72Kp5a_JIx-KakSPUKJJhYlDj2TcZh5sdnqg/viewform\">https://docs.google.com/forms/d/e/1FAIpQLSfvf0QhCsl4Jp72Kp5a_JIx-KakSPUKJJhYlDj2TcZh5sdnqg/viewform</a> <br></p>', NULL, 'advertise-with-paibaa', NULL, 1, 3, '2020-02-02 09:56:01', '2020-02-02 09:56:01'); -- -------------------------------------------------------- -- -- Table structure for table `page_photo` -- CREATE TABLE `page_photo` ( `id` bigint(20) UNSIGNED NOT NULL, `fk_page_id` bigint(20) UNSIGNED NOT NULL, `photo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `permissions` -- CREATE TABLE `permissions` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, `resource` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'System', `system` tinyint(1) NOT NULL DEFAULT 0, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `permissions` -- INSERT INTO `permissions` (`id`, `name`, `slug`, `resource`, `system`, `created_at`, `updated_at`) VALUES (1, 'Primary Info', 'primary-info', '', 1, NULL, NULL), (2, 'Admin Users', 'admin-users', '', 1, NULL, '2020-02-02 22:07:19'), (3, 'ACL', 'acl', '', 1, NULL, NULL), (4, 'Others', 'others', '', 1, NULL, NULL), (5, 'Menu', 'menu', '', 1, NULL, NULL), (7, 'Setting', 'setting', '', 1, '2019-12-06 03:58:14', '2019-12-06 03:58:14'), (8, 'Set Up', 'set-up', '', 1, '2019-12-06 04:01:19', '2019-12-06 04:01:19'), (9, 'category', 'category', '', 1, '2019-12-06 04:02:52', '2019-12-06 04:02:52'), (10, 'Brand', 'brand', '', 1, '2019-12-07 03:16:18', '2020-02-02 22:27:21'), (12, 'division-town', 'division-town', '', 1, '2019-12-08 16:54:36', '2019-12-08 16:54:36'), (13, 'View Manage-ad', 'manage-ad.view', 'Manage-ad', 1, '2019-12-23 06:31:39', '2019-12-23 06:31:39'), (14, 'Create Manage-ad', 'manage-ad.create', 'Manage-ad', 1, '2019-12-23 06:31:39', '2019-12-23 06:31:39'), (15, 'Update Manage-ad', 'manage-ad.update', 'Manage-ad', 1, '2019-12-23 06:31:39', '2019-12-23 06:31:39'), (16, 'Delete Manage-ad', 'manage-ad.delete', 'Manage-ad', 1, '2019-12-23 06:31:39', '2019-12-23 06:31:39'), (17, 'Alla Approve Ads', 'all-approve-ads', '', 1, '2020-02-02 22:25:15', '2020-02-02 22:25:55'), (18, 'area', 'area', '', 1, '2020-02-02 22:26:27', '2020-02-02 22:26:27'), (19, 'Sub Category', 'sub-category', '', 1, '2020-02-02 22:26:58', '2020-02-02 22:26:58'), (20, 'Pages', 'pages', '', 1, '2020-02-02 22:28:52', '2020-02-02 22:28:52'), (21, 'location', 'location', '', 1, '2020-07-25 10:26:15', '2020-07-25 10:26:15'); -- -------------------------------------------------------- -- -- Table structure for table `permission_role` -- CREATE TABLE `permission_role` ( `id` bigint(20) UNSIGNED NOT NULL, `permission_id` bigint(20) UNSIGNED NOT NULL, `role_id` bigint(20) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `permission_role` -- INSERT INTO `permission_role` (`id`, `permission_id`, `role_id`, `created_at`, `updated_at`) VALUES (203, 13, 1, NULL, NULL), (204, 14, 1, NULL, NULL), (205, 15, 1, NULL, NULL), (206, 16, 1, NULL, NULL), (207, 1, 1, NULL, NULL), (208, 2, 1, NULL, NULL), (209, 3, 1, NULL, NULL), (210, 4, 1, NULL, NULL), (211, 5, 1, NULL, NULL), (212, 7, 1, NULL, NULL), (213, 8, 1, NULL, NULL), (214, 9, 1, NULL, NULL), (215, 10, 1, NULL, NULL), (216, 12, 1, NULL, NULL), (217, 17, 1, NULL, NULL), (218, 18, 1, NULL, NULL), (219, 19, 1, NULL, NULL), (220, 20, 1, NULL, NULL), (221, 21, 1, NULL, NULL), (222, 13, 2, NULL, NULL), (223, 14, 2, NULL, NULL), (224, 15, 2, NULL, NULL), (225, 16, 2, NULL, NULL), (226, 1, 2, NULL, NULL), (227, 2, 2, NULL, NULL), (228, 8, 2, NULL, NULL), (229, 9, 2, NULL, NULL), (230, 10, 2, NULL, NULL), (231, 12, 2, NULL, NULL), (232, 17, 2, NULL, NULL), (233, 18, 2, NULL, NULL), (234, 19, 2, NULL, NULL), (235, 20, 2, NULL, NULL), (236, 21, 2, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `post_photos` -- CREATE TABLE `post_photos` ( `id` bigint(20) UNSIGNED NOT NULL, `ad_post_id` bigint(20) UNSIGNED NOT NULL, `photo_one` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `photo_two` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `photo_three` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `photo_four` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `photo_five` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `post_photos` -- INSERT INTO `post_photos` (`id`, `ad_post_id`, `photo_one`, `photo_two`, `photo_three`, `photo_four`, `photo_five`, `created_at`, `updated_at`) VALUES (12, 55, '2020/07/16/16331087507-8dbd6304cf-b16-07-202007-22-39.jpg', '2020/07/16/gt16-07-202007-22-39.jpg', '', '', NULL, '2020-07-16 01:22:40', '2020-07-16 01:22:40'), (13, 56, '2020/07/20/gt20-07-202011-42-50.jpg', '2020/07/20/gt20-07-202011-42-50.jpg', '', '', NULL, '2020-07-20 05:42:50', '2020-07-20 05:42:50'), (14, 57, '2020/07/20/gt20-07-202011-48-12.jpg', '2020/07/20/gt20-07-202011-48-12.jpg', '', '', NULL, '2020-07-20 05:48:12', '2020-07-20 05:48:12'), (15, 63, '2020/07/25/gt25-07-202008-55-02.jpg', '2020/07/25/gt25-07-202008-55-02.jpg', '2020/07/25/gt25-07-202008-55-02.jpg', '', NULL, '2020-07-25 02:55:02', '2020-07-25 02:55:02'), (16, 64, '2020/07/29/244-kiss-skin-woes-good-bye-homemade-face-packs-with-besan-569264845-624x70229-07-202010-32-57.jpg', '', '', '', NULL, '2020-07-29 04:32:58', '2020-07-29 04:32:58'), (17, 65, '2020/10/21/demo-logo21-10-202006-59-09.png', '2020/10/21/gt21-10-202006-59-09.jpg', '2020/10/21/server-client-list21-10-202006-59-09.PNG', '2020/10/21/16331087507-8dbd6304cf-b21-10-202006-59-09.jpg', NULL, '2020-10-21 00:59:09', '2020-10-21 00:59:09'); -- -------------------------------------------------------- -- -- Table structure for table `post_wise_number` -- CREATE TABLE `post_wise_number` ( `id` bigint(20) UNSIGNED NOT NULL, `ad_post_id` bigint(20) UNSIGNED NOT NULL, `mobile_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `price_negotiations` -- CREATE TABLE `price_negotiations` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED DEFAULT NULL, `ad_post_id` bigint(20) UNSIGNED NOT NULL, `request_by` bigint(20) UNSIGNED NOT NULL, `request_to` bigint(20) UNSIGNED NOT NULL, `price` double(10,2) NOT NULL DEFAULT 0.00, `request_message` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `price_message` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `offer` tinyint(3) UNSIGNED NOT NULL COMMENT '1=Offer, 2=Replay', `status` tinyint(1) NOT NULL DEFAULT 0, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `price_negotiations` -- INSERT INTO `price_negotiations` (`id`, `user_id`, `ad_post_id`, `request_by`, `request_to`, `price`, `request_message`, `price_message`, `offer`, `status`, `created_at`, `updated_at`) VALUES (6, NULL, 63, 8, 1, 9500.00, 'Good News', 'Monthly : 2500,Quarterly : 7000,', 1, 0, '2020-10-21 02:09:06', '2020-10-21 02:09:06'), (7, 1, 63, 8, 1, 0.00, 'Good', NULL, 1, 0, '2020-10-21 03:07:26', '2020-10-21 03:07:26'), (8, 1, 63, 8, 1, 0.00, 'cxcx', NULL, 1, 0, '2020-10-21 04:03:13', '2020-10-21 04:03:13'), (9, 1, 63, 8, 1, 0.00, 'fdg', NULL, 1, 0, '2020-10-21 04:05:19', '2020-10-21 04:05:19'); -- -------------------------------------------------------- -- -- Table structure for table `primary_info` -- CREATE TABLE `primary_info` ( `id` bigint(20) UNSIGNED NOT NULL, `company_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `company_name_ban` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `logo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `favicon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `address_ban` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `mobile_no` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `mobile_no_ban` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `phone` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `email` varchar(120) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `type` tinyint(3) UNSIGNED DEFAULT NULL COMMENT '1=Group of Company, 2=Single Company', `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description_ban` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `meta_description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `meta_description_ban` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `primary_info` -- INSERT INTO `primary_info` (`id`, `company_name`, `company_name_ban`, `logo`, `favicon`, `address`, `address_ban`, `mobile_no`, `mobile_no_ban`, `phone`, `email`, `type`, `description`, `description_ban`, `meta_description`, `meta_description_ban`, `created_at`, `updated_at`) VALUES (1, 'paibaa | khujlei paibaa', NULL, 'images/default/logo.png', 'images/logo/favicon.png', 'Dhaka, Bangladesh', NULL, '01640008633', NULL, NULL, '<EMAIL>', 1, NULL, NULL, NULL, NULL, NULL, '2020-02-03 06:42:33'); -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE `roles` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `system` tinyint(1) NOT NULL DEFAULT 0, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `roles` -- INSERT INTO `roles` (`id`, `name`, `slug`, `description`, `system`, `created_at`, `updated_at`) VALUES (1, 'Developer', 'developer', 'Developer Mode', 1, NULL, NULL), (2, 'Super Admin', 'super-admin', 'Super Admins', 1, NULL, NULL), (3, 'Admin', 'admin', 'Admin role', 1, NULL, NULL), (4, 'Client', 'client', 'Whose Post ads', 1, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `role_user` -- CREATE TABLE `role_user` ( `id` bigint(20) UNSIGNED NOT NULL, `role_id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `role_user` -- INSERT INTO `role_user` (`id`, `role_id`, `user_id`, `created_at`, `updated_at`) VALUES (1, 1, 1, NULL, NULL), (5, 2, 6, NULL, NULL), (6, 4, 7, NULL, NULL), (7, 4, 8, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `sub_category` -- CREATE TABLE `sub_category` ( `id` bigint(20) UNSIGNED NOT NULL, `category_id` bigint(20) UNSIGNED NOT NULL, `sub_category_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `sub_category_name_bn` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `serial_num` tinyint(3) UNSIGNED DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `created_by` bigint(20) UNSIGNED DEFAULT NULL, `updated_by` bigint(20) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `sub_category` -- INSERT INTO `sub_category` (`id`, `category_id`, `sub_category_name`, `sub_category_name_bn`, `description`, `serial_num`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (1, 1, 'Product', NULL, 'Sub Category of Need', 1, 1, 1, 1, '2019-12-06 04:35:56', '2019-12-08 17:11:35'), (2, 1, 'Man Power', NULL, 'Sub Category 2 for Need', 2, 1, 1, 1, '2019-12-06 09:27:45', '2019-12-08 17:11:15'), (3, 1, 'Rent', NULL, NULL, 3, 1, 1, NULL, '2019-12-08 17:11:49', '2019-12-08 17:11:49'), (4, 1, 'Tutor', NULL, NULL, 4, 1, 1, NULL, '2019-12-08 17:12:07', '2019-12-08 17:12:07'), (5, 2, 'Fashion', NULL, NULL, 1, 1, 1, NULL, '2019-12-08 17:13:00', '2019-12-08 17:13:00'), (6, 2, 'Education', NULL, NULL, 2, 1, 1, NULL, '2019-12-08 17:13:08', '2019-12-08 17:13:08'), (7, 2, 'Electronics', NULL, NULL, 3, 1, 1, 1, '2019-12-08 17:13:21', '2020-07-01 01:25:01'), (8, 2, 'Course', NULL, NULL, 4, 1, 1, NULL, '2019-12-08 17:13:29', '2019-12-08 17:13:29'), (9, 2, 'Food', NULL, NULL, 5, 1, 1, NULL, '2019-12-08 17:13:35', '2019-12-08 17:13:35'), (10, 3, 'Property', NULL, NULL, 1, 1, 1, NULL, '2019-12-08 17:14:07', '2019-12-08 17:14:07'), (11, 3, 'Transport', NULL, NULL, 2, 1, 1, NULL, '2019-12-08 17:17:41', '2019-12-08 17:17:41'), (12, 3, 'Camera', NULL, NULL, 3, 1, 1, NULL, '2019-12-08 17:18:12', '2019-12-08 17:18:12'), (13, 4, 'IT', NULL, NULL, 1, 1, 1, NULL, '2019-12-08 17:18:57', '2019-12-08 17:18:57'), (14, 4, 'Macanics', NULL, NULL, 2, 1, 1, NULL, '2019-12-08 17:19:16', '2019-12-08 17:19:16'), (15, 4, 'Cleaning', NULL, NULL, 3, 1, 1, NULL, '2019-12-08 17:19:26', '2019-12-08 17:19:26'), (16, 4, 'Tuition', NULL, NULL, 4, 1, 1, NULL, '2019-12-08 17:19:32', '2019-12-08 17:19:32'), (17, 4, 'Mechanical', NULL, NULL, 5, 1, 1, NULL, '2019-12-08 17:19:50', '2019-12-08 17:19:50'), (18, 4, 'Media', NULL, NULL, 6, 1, 1, NULL, '2019-12-08 17:19:59', '2019-12-08 17:19:59'), (19, 5, 'Fashion', NULL, NULL, 1, 1, 1, NULL, '2019-12-08 17:24:27', '2019-12-08 17:24:27'), (20, 5, 'Product', NULL, NULL, 2, 1, 1, NULL, '2019-12-08 17:24:42', '2019-12-08 17:24:42'), (21, 5, 'Rent', NULL, NULL, 3, 1, 1, NULL, '2019-12-08 17:24:50', '2019-12-08 17:24:50'), (22, 5, 'Manpower', NULL, NULL, 4, 1, 1, NULL, '2019-12-08 17:25:00', '2019-12-08 17:25:00'), (25, 2, 'Dhakadfs', NULL, NULL, NULL, 1, NULL, NULL, '2020-07-10 02:15:51', '2020-07-10 02:15:51'), (38, 1, 'd', NULL, NULL, 5, 1, NULL, 1, '2020-07-11 10:36:55', '2020-07-25 10:20:53'), (43, 1, 'demo-sub', NULL, NULL, 6, 1, NULL, 1, '2020-07-15 05:30:50', '2020-07-25 10:21:00'), (44, 1, 'Fashion', NULL, NULL, 7, 1, NULL, 1, '2020-07-20 05:42:50', '2020-07-25 10:21:07'), (45, 1, 'Electronic', NULL, NULL, 8, 1, NULL, 1, '2020-07-20 05:42:50', '2020-07-25 10:21:14'), (46, 2, 'Mobile', NULL, NULL, NULL, 1, NULL, NULL, '2020-07-20 05:48:12', '2020-07-20 05:48:12'), (47, 2, 'Mobile Phone', NULL, NULL, NULL, 1, NULL, NULL, '2020-07-20 05:48:12', '2020-07-20 05:48:12'), (58, 3, 'Rent', NULL, NULL, NULL, 1, NULL, NULL, '2020-07-25 02:55:02', '2020-07-25 02:55:02'), (59, 3, 'House Rent', NULL, NULL, NULL, 1, NULL, NULL, '2020-07-25 02:55:02', '2020-07-25 02:55:02'), (60, 5, 'Face care', NULL, NULL, NULL, 1, NULL, NULL, '2020-07-29 04:32:57', '2020-07-29 04:32:57'), (61, 5, 'Beauti expert', NULL, NULL, NULL, 1, NULL, NULL, '2020-07-29 04:32:57', '2020-07-29 04:32:57'), (62, 4, 'Sub Category', NULL, NULL, NULL, 1, NULL, NULL, '2020-10-21 00:59:09', '2020-10-21 00:59:09'); -- -------------------------------------------------------- -- -- Table structure for table `sub_category_wise_ad_counts` -- CREATE TABLE `sub_category_wise_ad_counts` ( `id` bigint(20) UNSIGNED NOT NULL, `sub_category_id` bigint(20) UNSIGNED DEFAULT NULL, `total_ad` int(10) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `sub_category_wise_ad_counts` -- INSERT INTO `sub_category_wise_ad_counts` (`id`, `sub_category_id`, `total_ad`, `created_at`, `updated_at`) VALUES (1, 1, 1, '2020-07-19 11:02:08', '2020-07-19 11:18:12'), (2, 43, 1, '2020-07-19 11:02:08', '2020-07-19 11:18:12'), (3, 2, 2, '2020-07-19 11:02:08', '2020-07-20 05:44:41'), (4, 44, 1, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (5, 45, 1, '2020-07-20 05:44:41', '2020-07-20 05:44:41'), (6, 7, 1, '2020-07-20 05:49:55', '2020-07-20 05:49:55'), (7, 46, 1, '2020-07-20 05:49:55', '2020-07-20 05:49:55'), (8, 47, 1, '2020-07-20 05:49:55', '2020-07-20 05:49:55'), (9, 58, 1, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (10, 59, 1, '2020-07-25 02:55:48', '2020-07-25 02:55:48'), (24, 60, 1, '2020-07-29 04:55:56', '2020-07-29 04:56:59'), (25, 61, 1, '2020-07-29 04:55:56', '2020-07-29 04:56:59'), (26, 62, 1, '2020-10-21 01:02:48', '2020-10-21 01:02:48'); -- -------------------------------------------------------- -- -- Table structure for table `sub_menu` -- CREATE TABLE `sub_menu` ( `id` bigint(20) UNSIGNED NOT NULL, `fk_menu_id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `name_bn` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `icon_class` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `big_icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, `serial_num` tinyint(3) UNSIGNED NOT NULL, `type` tinyint(3) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `sub_menu` -- INSERT INTO `sub_menu` (`id`, `fk_menu_id`, `name`, `name_bn`, `url`, `icon_class`, `slug`, `icon`, `big_icon`, `status`, `serial_num`, `type`, `created_at`, `updated_at`) VALUES (1, 1, 'Menu Setting', NULL, 'menu', NULL, '[\"menu\"]', 'images/menu/sub-menu/icon/2019/12/06/information06-12-201910-00-27.png', 'images/menu/sub-menu/big-icon/2019/12/06/information06-12-201910-00-27.png', 1, 1, 1, '2019-12-06 04:00:27', '2019-12-06 04:00:27'), (2, 2, 'Categories', NULL, 'category', NULL, '[\"category\"]', 'images/menu/sub-menu/icon/2019/12/06/courses05-09-201917-14-3106-12-201910-03-26.png', 'images/menu/sub-menu/big-icon/2019/12/06/courses05-09-201917-14-3106-12-201910-03-26.png', 1, 1, 1, '2019-12-06 04:03:26', '2019-12-06 04:04:00'), (5, 2, 'Location', NULL, 'location', NULL, '[\"location\"]', 'images/menu/sub-menu/icon/2019/12/08/courses05-09-201917-14-3108-12-201922-55-17.png', 'images/menu/sub-menu/big-icon/2019/12/08/courses05-09-201917-14-3108-12-201922-55-17.png', 1, 4, 1, '2019-12-08 16:55:17', '2020-07-25 10:26:58'), (6, 1, 'Acl Role', NULL, 'acl-role', NULL, '[\"acl\"]', 'images/menu/sub-menu/icon/2019/12/13/courses05-09-201917-14-3113-12-201918-52-03.png', 'images/menu/sub-menu/big-icon/2019/12/13/courses05-09-201917-14-3113-12-201918-52-03.png', 1, 2, 1, '2019-12-13 12:52:03', '2019-12-13 12:52:03'), (7, 2, 'Pages', NULL, 'pages', NULL, '[\"set-up\"]', NULL, NULL, 1, 5, 1, '2020-01-30 11:58:40', '2020-01-30 11:58:53'), (8, 2, 'Company Info', NULL, 'primary-info', NULL, '[\"primary-info\"]', 'images/menu/sub-menu/icon/2020/02/02/icon-white02-02-202023-55-08.png', 'images/menu/sub-menu/big-icon/2020/02/02/icon-white02-02-202023-55-08.png', 1, 6, 1, '2020-02-02 22:55:08', '2020-02-02 22:55:08'); -- -------------------------------------------------------- -- -- Table structure for table `sub_sub_menu` -- CREATE TABLE `sub_sub_menu` ( `id` bigint(20) UNSIGNED NOT NULL, `fk_menu_id` bigint(20) UNSIGNED NOT NULL, `fk_sub_menu_id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `name_bn` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `icon_class` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `big_icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, `serial_num` tinyint(3) UNSIGNED NOT NULL, `type` tinyint(3) UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `thana_upazilas` -- CREATE TABLE `thana_upazilas` ( `id` bigint(20) UNSIGNED NOT NULL, `district_id` bigint(20) UNSIGNED NOT NULL, `thana_upazila` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, `thana_upazila_bn` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` tinyint(4) NOT NULL DEFAULT 1, `serial_num` int(10) UNSIGNED DEFAULT NULL, `show_at_home` tinyint(3) UNSIGNED DEFAULT 0, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `user_name` varchar(150) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `social_id` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `mobile` varchar(15) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '1=System/Super Admin,2= Admin, 3=General User', `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1=Active,0= Inactive', `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `user_name`, `email`, `social_id`, `mobile`, `email_verified_at`, `password`, `address`, `image`, `type`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'Developer', 'developer', '<EMAIL>', NULL, '01829655974', NULL, '$2y$10$B3xARGCh6W7zCU6u0Fh8a.C2L/P.nIgmCg2gwCPUVk/1pdJ2RLZ5C', 'Dhakas', 'images/users/2019/11/22/logo22-11-201900-01-34.png', 1, 1, NULL, '2019-11-20 18:00:00', '2019-12-10 03:01:23'), (6, '<NAME>', 'mehedicandy', '<EMAIL>', NULL, '01640008633', NULL, '$2y$10$7ak3mnWS64LNgzyq/0anPeHnChoN6aUcH0K4XPB7w9.wp91IzEn6K', 'Mirpur 12, Dhaka, Bangladesh\r\ni\'m freelance camera man..', 'images/users/2019/12/13/78456041-1018369261830642-1651569106047991808-o13-12-201917-10-46.jpg', 1, 1, NULL, '2019-12-13 11:10:46', '2020-02-16 23:05:40'), (7, '<NAME>', 'elisaspark7', '<EMAIL>', '1002088015602', NULL, NULL, NULL, NULL, 'https://graph.facebook.com/v3.3/1002088015602/picture?type=normal', 3, 0, 'wPwdgoYaOwS54UfmVwXZDSMienO1PiuxOcuujX2e5BjoArnKAfYqE80bFvXg', '2020-02-18 01:02:32', '2020-02-18 01:02:32'), (8, 'Demo', 'demo8', '<EMAIL>', NULL, '01829655975', NULL, '$2y$10$tztWZJtPz2YQaggzfJdjouYcF/WnfGYyxLvfQZ4kqPHOZ1erkNXP.', 'Dhaka', 'images/users/2020/10/20/demo-logo20-10-202016-50-35.png', 3, 1, NULL, '2020-10-20 10:47:00', '2020-10-20 10:50:35'); -- -------------------------------------------------------- -- -- Table structure for table `user_infos` -- CREATE TABLE `user_infos` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED NOT NULL, `location_id` bigint(20) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `user_infos` -- INSERT INTO `user_infos` (`id`, `user_id`, `location_id`, `created_at`, `updated_at`) VALUES (18, 1, 2, '2020-07-15 16:44:06', '2020-07-15 16:44:06'), (19, 1, 7, '2020-07-15 16:44:06', '2020-07-15 16:44:06'), (20, 1, 8, '2020-07-15 16:44:06', '2020-07-15 16:44:06'), (21, 8, 2, '2020-10-20 10:50:35', '2020-10-20 10:50:35'), (22, 8, 20, '2020-10-20 10:50:35', '2020-10-20 10:50:35'), (23, 8, 10, '2020-10-20 10:50:35', '2020-10-20 10:50:35'); -- -- Indexes for dumped tables -- -- -- Indexes for table `ad_post` -- ALTER TABLE `ad_post` ADD PRIMARY KEY (`id`), ADD KEY `ad_post_approved_by_foreign` (`approved_by`), ADD KEY `ad_post_created_by_foreign` (`created_by`), ADD KEY `ad_post_updated_by_foreign` (`updated_by`), ADD KEY `ad_post_user_id_foreign` (`user_id`), ADD KEY `ad_post_category_id_foreign` (`category_id`); -- -- Indexes for table `ad_post_areas` -- ALTER TABLE `ad_post_areas` ADD PRIMARY KEY (`id`), ADD KEY `ad_post_areas_area_id_foreign` (`area_id`), ADD KEY `ad_post_areas_ad_post_id_foreign` (`ad_post_id`); -- -- Indexes for table `ad_post_comments` -- ALTER TABLE `ad_post_comments` ADD PRIMARY KEY (`id`), ADD KEY `ad_post_comments_user_id_foreign` (`user_id`), ADD KEY `ad_post_comments_ad_post_id_foreign` (`ad_post_id`); -- -- Indexes for table `ad_post_locations` -- ALTER TABLE `ad_post_locations` ADD PRIMARY KEY (`id`), ADD KEY `ad_post_locations_ad_post_id_foreign` (`ad_post_id`), ADD KEY `ad_post_locations_location_id_foreign` (`location_id`), ADD KEY `ad_post_locations_categories_category_id_foreign` (`category_id`); -- -- Indexes for table `ad_post_prices` -- ALTER TABLE `ad_post_prices` ADD PRIMARY KEY (`id`), ADD KEY `ad_post_prices_ad_post_id_foreign` (`ad_post_id`), ADD KEY `ad_post_prices_categories_category_id_foreign` (`category_id`); -- -- Indexes for table `ad_post_sub_category` -- ALTER TABLE `ad_post_sub_category` ADD PRIMARY KEY (`id`), ADD KEY `ad_post_sub_categories_ad_post_id_foreign` (`ad_post_id`), ADD KEY `ad_post_sub_categories_category_id_foreign` (`category_id`), ADD KEY `ad_post_sub_categories_sub_category_id_foreign` (`sub_category_id`); -- -- Indexes for table `answer_replays` -- ALTER TABLE `answer_replays` ADD PRIMARY KEY (`id`), ADD KEY `answer_replays_user_id_foreign` (`user_id`), ADD KEY `answer_replays_ad_post_id_foreign` (`ad_post_id`), ADD KEY `answer_replays_answer_id_foreign` (`answer_id`); -- -- Indexes for table `areas` -- ALTER TABLE `areas` ADD PRIMARY KEY (`id`), ADD KEY `areas_division_town_id_foreign` (`division_town_id`); -- -- Indexes for table `blog_answers` -- ALTER TABLE `blog_answers` ADD PRIMARY KEY (`id`), ADD KEY `blog_answers_user_id_foreign` (`user_id`), ADD KEY `blog_answers_ad_post_id_foreign` (`ad_post_id`); -- -- Indexes for table `brands` -- ALTER TABLE `brands` ADD PRIMARY KEY (`id`), ADD KEY `brands_created_by_foreign` (`created_by`), ADD KEY `brands_updated_by_foreign` (`updated_by`); -- -- Indexes for table `categories` -- ALTER TABLE `categories` ADD PRIMARY KEY (`id`), ADD KEY `categories_created_by_foreign` (`created_by`), ADD KEY `categories_updated_by_foreign` (`updated_by`); -- -- Indexes for table `category_wise_ad_counts` -- ALTER TABLE `category_wise_ad_counts` ADD PRIMARY KEY (`id`), ADD KEY `category_wise_ad_counts_category_id_foreign` (`category_id`); -- -- Indexes for table `designations` -- ALTER TABLE `designations` ADD PRIMARY KEY (`id`), ADD KEY `designations_created_by_foreign` (`created_by`), ADD KEY `designations_updated_by_foreign` (`updated_by`); -- -- Indexes for table `districts` -- ALTER TABLE `districts` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `districts_district_unique` (`district`), ADD UNIQUE KEY `districts_district_bn_unique` (`district_bn`), ADD KEY `districts_division_id_foreign` (`division_id`); -- -- Indexes for table `divisions` -- ALTER TABLE `divisions` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `divisions_division_unique` (`division`), ADD UNIQUE KEY `divisions_division_bn_unique` (`division_bn`); -- -- Indexes for table `division_towns` -- ALTER TABLE `division_towns` ADD PRIMARY KEY (`id`); -- -- Indexes for table `failed_jobs` -- ALTER TABLE `failed_jobs` ADD PRIMARY KEY (`id`); -- -- Indexes for table `locations` -- ALTER TABLE `locations` ADD PRIMARY KEY (`id`), ADD KEY `locations_created_by_foreign` (`created_by`), ADD KEY `locations_updated_by_foreign` (`updated_by`); -- -- Indexes for table `location_wise_ad_counts` -- ALTER TABLE `location_wise_ad_counts` ADD PRIMARY KEY (`id`), ADD KEY `location_wise_ad_counts_location_id_foreign` (`location_id`); -- -- Indexes for table `menu` -- ALTER TABLE `menu` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `orders` -- ALTER TABLE `orders` ADD PRIMARY KEY (`id`), ADD KEY `orders_ad_post_id_foreign` (`ad_post_id`), ADD KEY `orders_customer_id_foreign` (`customer_id`), ADD KEY `orders_post_user_id_foreign` (`post_user_id`), ADD KEY `orders_category_id_foreign` (`category_id`); -- -- Indexes for table `order_prices` -- ALTER TABLE `order_prices` ADD PRIMARY KEY (`id`), ADD KEY `order_prices_order_id_foreign` (`order_id`); -- -- Indexes for table `page` -- ALTER TABLE `page` ADD PRIMARY KEY (`id`); -- -- Indexes for table `page_photo` -- ALTER TABLE `page_photo` ADD PRIMARY KEY (`id`), ADD KEY `page_photo_fk_page_id_foreign` (`fk_page_id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `permissions` -- ALTER TABLE `permissions` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `permissions_slug_unique` (`slug`); -- -- Indexes for table `permission_role` -- ALTER TABLE `permission_role` ADD PRIMARY KEY (`id`), ADD KEY `permission_role_permission_id_index` (`permission_id`), ADD KEY `permission_role_role_id_index` (`role_id`); -- -- Indexes for table `post_photos` -- ALTER TABLE `post_photos` ADD PRIMARY KEY (`id`), ADD KEY `post_photos_ad_post_id_foreign` (`ad_post_id`); -- -- Indexes for table `post_wise_number` -- ALTER TABLE `post_wise_number` ADD PRIMARY KEY (`id`), ADD KEY `post_wise_number_ad_post_id_foreign` (`ad_post_id`); -- -- Indexes for table `price_negotiations` -- ALTER TABLE `price_negotiations` ADD PRIMARY KEY (`id`), ADD KEY `price_negotiations_ad_post_id_foreign` (`ad_post_id`), ADD KEY `price_negotiations_request_by_foreign` (`request_by`), ADD KEY `price_negotiations_request_to_foreign` (`request_to`); -- -- Indexes for table `primary_info` -- ALTER TABLE `primary_info` ADD PRIMARY KEY (`id`); -- -- Indexes for table `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `roles_slug_unique` (`slug`); -- -- Indexes for table `role_user` -- ALTER TABLE `role_user` ADD PRIMARY KEY (`id`), ADD KEY `role_user_role_id_index` (`role_id`), ADD KEY `role_user_user_id_index` (`user_id`); -- -- Indexes for table `sub_category` -- ALTER TABLE `sub_category` ADD PRIMARY KEY (`id`), ADD KEY `sub_category_category_id_foreign` (`category_id`), ADD KEY `sub_category_created_by_foreign` (`created_by`), ADD KEY `sub_category_updated_by_foreign` (`updated_by`); -- -- Indexes for table `sub_category_wise_ad_counts` -- ALTER TABLE `sub_category_wise_ad_counts` ADD PRIMARY KEY (`id`), ADD KEY `sub_category_wise_ad_counts_sub_category_id_foreign` (`sub_category_id`); -- -- Indexes for table `sub_menu` -- ALTER TABLE `sub_menu` ADD PRIMARY KEY (`id`), ADD KEY `sub_menu_fk_menu_id_foreign` (`fk_menu_id`); -- -- Indexes for table `sub_sub_menu` -- ALTER TABLE `sub_sub_menu` ADD PRIMARY KEY (`id`), ADD KEY `sub_sub_menu_fk_menu_id_foreign` (`fk_menu_id`), ADD KEY `sub_sub_menu_fk_sub_menu_id_foreign` (`fk_sub_menu_id`); -- -- Indexes for table `thana_upazilas` -- ALTER TABLE `thana_upazilas` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `thana_upazilas_thana_upazila_unique` (`thana_upazila`), ADD UNIQUE KEY `thana_upazilas_thana_upazila_bn_unique` (`thana_upazila_bn`), ADD KEY `thana_upazilas_district_id_foreign` (`district_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_mobile_unique` (`mobile`), ADD UNIQUE KEY `users_email_unique` (`email`), ADD UNIQUE KEY `user_name` (`user_name`); -- -- Indexes for table `user_infos` -- ALTER TABLE `user_infos` ADD PRIMARY KEY (`id`), ADD KEY `user_infos_user_id_foreign` (`user_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `ad_post` -- ALTER TABLE `ad_post` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=66; -- -- AUTO_INCREMENT for table `ad_post_areas` -- ALTER TABLE `ad_post_areas` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `ad_post_comments` -- ALTER TABLE `ad_post_comments` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `ad_post_locations` -- ALTER TABLE `ad_post_locations` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=134; -- -- AUTO_INCREMENT for table `ad_post_prices` -- ALTER TABLE `ad_post_prices` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=298; -- -- AUTO_INCREMENT for table `ad_post_sub_category` -- ALTER TABLE `ad_post_sub_category` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=153; -- -- AUTO_INCREMENT for table `answer_replays` -- ALTER TABLE `answer_replays` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `areas` -- ALTER TABLE `areas` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `blog_answers` -- ALTER TABLE `blog_answers` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `brands` -- ALTER TABLE `brands` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `categories` -- ALTER TABLE `categories` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `category_wise_ad_counts` -- ALTER TABLE `category_wise_ad_counts` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `designations` -- ALTER TABLE `designations` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `districts` -- ALTER TABLE `districts` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `divisions` -- ALTER TABLE `divisions` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `division_towns` -- ALTER TABLE `division_towns` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `failed_jobs` -- ALTER TABLE `failed_jobs` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `locations` -- ALTER TABLE `locations` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24; -- -- AUTO_INCREMENT for table `location_wise_ad_counts` -- ALTER TABLE `location_wise_ad_counts` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT for table `menu` -- ALTER TABLE `menu` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=55; -- -- AUTO_INCREMENT for table `orders` -- ALTER TABLE `orders` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `order_prices` -- ALTER TABLE `order_prices` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `page` -- ALTER TABLE `page` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `page_photo` -- ALTER TABLE `page_photo` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `permissions` -- ALTER TABLE `permissions` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; -- -- AUTO_INCREMENT for table `permission_role` -- ALTER TABLE `permission_role` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=237; -- -- AUTO_INCREMENT for table `post_photos` -- ALTER TABLE `post_photos` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18; -- -- AUTO_INCREMENT for table `post_wise_number` -- ALTER TABLE `post_wise_number` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `price_negotiations` -- ALTER TABLE `price_negotiations` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `primary_info` -- ALTER TABLE `primary_info` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `roles` -- ALTER TABLE `roles` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `role_user` -- ALTER TABLE `role_user` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `sub_category` -- ALTER TABLE `sub_category` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=63; -- -- AUTO_INCREMENT for table `sub_category_wise_ad_counts` -- ALTER TABLE `sub_category_wise_ad_counts` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27; -- -- AUTO_INCREMENT for table `sub_menu` -- ALTER TABLE `sub_menu` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `sub_sub_menu` -- ALTER TABLE `sub_sub_menu` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `thana_upazilas` -- ALTER TABLE `thana_upazilas` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `user_infos` -- ALTER TABLE `user_infos` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24; -- -- Constraints for dumped tables -- -- -- Constraints for table `ad_post` -- ALTER TABLE `ad_post` ADD CONSTRAINT `ad_post_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `ad_post_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`), ADD CONSTRAINT `ad_post_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `ad_post_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `ad_post_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); -- -- Constraints for table `ad_post_areas` -- ALTER TABLE `ad_post_areas` ADD CONSTRAINT `ad_post_areas_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `ad_post_areas_area_id_foreign` FOREIGN KEY (`area_id`) REFERENCES `areas` (`id`); -- -- Constraints for table `ad_post_comments` -- ALTER TABLE `ad_post_comments` ADD CONSTRAINT `ad_post_comments_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `ad_post_comments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); -- -- Constraints for table `ad_post_locations` -- ALTER TABLE `ad_post_locations` ADD CONSTRAINT `ad_post_locations_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `ad_post_locations_categories_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`), ADD CONSTRAINT `ad_post_locations_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`); -- -- Constraints for table `ad_post_prices` -- ALTER TABLE `ad_post_prices` ADD CONSTRAINT `ad_post_prices_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `ad_post_prices_categories_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`); -- -- Constraints for table `ad_post_sub_category` -- ALTER TABLE `ad_post_sub_category` ADD CONSTRAINT `ad_post_sub_categories_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `ad_post_sub_categories_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`), ADD CONSTRAINT `ad_post_sub_categories_sub_category_id_foreign` FOREIGN KEY (`sub_category_id`) REFERENCES `sub_category` (`id`); -- -- Constraints for table `answer_replays` -- ALTER TABLE `answer_replays` ADD CONSTRAINT `answer_replays_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `answer_replays_answer_id_foreign` FOREIGN KEY (`answer_id`) REFERENCES `blog_answers` (`id`), ADD CONSTRAINT `answer_replays_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); -- -- Constraints for table `areas` -- ALTER TABLE `areas` ADD CONSTRAINT `areas_division_town_id_foreign` FOREIGN KEY (`division_town_id`) REFERENCES `division_towns` (`id`); -- -- Constraints for table `blog_answers` -- ALTER TABLE `blog_answers` ADD CONSTRAINT `blog_answers_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `blog_answers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); -- -- Constraints for table `brands` -- ALTER TABLE `brands` ADD CONSTRAINT `brands_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `brands_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`); -- -- Constraints for table `categories` -- ALTER TABLE `categories` ADD CONSTRAINT `categories_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `categories_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`); -- -- Constraints for table `category_wise_ad_counts` -- ALTER TABLE `category_wise_ad_counts` ADD CONSTRAINT `category_wise_ad_counts_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`); -- -- Constraints for table `designations` -- ALTER TABLE `designations` ADD CONSTRAINT `designations_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `designations_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`); -- -- Constraints for table `districts` -- ALTER TABLE `districts` ADD CONSTRAINT `districts_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`); -- -- Constraints for table `locations` -- ALTER TABLE `locations` ADD CONSTRAINT `locations_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `locations_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`); -- -- Constraints for table `location_wise_ad_counts` -- ALTER TABLE `location_wise_ad_counts` ADD CONSTRAINT `location_wise_ad_counts_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`); -- -- Constraints for table `orders` -- ALTER TABLE `orders` ADD CONSTRAINT `orders_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `orders_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`), ADD CONSTRAINT `orders_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`), ADD CONSTRAINT `orders_post_user_id_foreign` FOREIGN KEY (`post_user_id`) REFERENCES `users` (`id`); -- -- Constraints for table `order_prices` -- ALTER TABLE `order_prices` ADD CONSTRAINT `order_prices_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`); -- -- Constraints for table `page_photo` -- ALTER TABLE `page_photo` ADD CONSTRAINT `page_photo_fk_page_id_foreign` FOREIGN KEY (`fk_page_id`) REFERENCES `page` (`id`); -- -- Constraints for table `permission_role` -- ALTER TABLE `permission_role` ADD CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE; -- -- Constraints for table `post_photos` -- ALTER TABLE `post_photos` ADD CONSTRAINT `post_photos_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`); -- -- Constraints for table `post_wise_number` -- ALTER TABLE `post_wise_number` ADD CONSTRAINT `post_wise_number_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`); -- -- Constraints for table `price_negotiations` -- ALTER TABLE `price_negotiations` ADD CONSTRAINT `price_negotiations_ad_post_id_foreign` FOREIGN KEY (`ad_post_id`) REFERENCES `ad_post` (`id`), ADD CONSTRAINT `price_negotiations_request_by_foreign` FOREIGN KEY (`request_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `price_negotiations_request_to_foreign` FOREIGN KEY (`request_to`) REFERENCES `users` (`id`); -- -- Constraints for table `role_user` -- ALTER TABLE `role_user` ADD CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `role_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; -- -- Constraints for table `sub_category` -- ALTER TABLE `sub_category` ADD CONSTRAINT `sub_category_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`), ADD CONSTRAINT `sub_category_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`), ADD CONSTRAINT `sub_category_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`); -- -- Constraints for table `sub_category_wise_ad_counts` -- ALTER TABLE `sub_category_wise_ad_counts` ADD CONSTRAINT `sub_category_wise_ad_counts_sub_category_id_foreign` FOREIGN KEY (`sub_category_id`) REFERENCES `sub_category` (`id`); -- -- Constraints for table `sub_menu` -- ALTER TABLE `sub_menu` ADD CONSTRAINT `sub_menu_fk_menu_id_foreign` FOREIGN KEY (`fk_menu_id`) REFERENCES `menu` (`id`); -- -- Constraints for table `sub_sub_menu` -- ALTER TABLE `sub_sub_menu` ADD CONSTRAINT `sub_sub_menu_fk_menu_id_foreign` FOREIGN KEY (`fk_menu_id`) REFERENCES `menu` (`id`), ADD CONSTRAINT `sub_sub_menu_fk_sub_menu_id_foreign` FOREIGN KEY (`fk_sub_menu_id`) REFERENCES `sub_menu` (`id`); -- -- Constraints for table `thana_upazilas` -- ALTER TABLE `thana_upazilas` ADD CONSTRAINT `thana_upazilas_district_id_foreign` FOREIGN KEY (`district_id`) REFERENCES `districts` (`id`); -- -- Constraints for table `user_infos` -- ALTER TABLE `user_infos` ADD CONSTRAINT `user_infos_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); 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 */;
<reponame>oamaok/basic-chat<filename>server/migrations/000-base.sql<gh_stars>0 BEGIN; SELECT _v.register_patch('000-base', NULL, NULL); CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE TABLE users ( "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4(), "createdAt" timestamp NOT NULL, "email" text UNIQUE, "firstName" text NOT NULL, "lastName" text NOT NULL, "password" text NOT NULL ); CREATE TABLE rooms ( "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4(), "createdAt" timestamp NOT NULL, "creatorId" uuid REFERENCES users ("id"), "type" integer NOT NULL, "name" text UNIQUE ); INSERT INTO users ( "id", "createdAt", "email", "firstName", "lastName", "password" ) VALUES ( '<PASSWORD>', NOW(), '', 'System', '', '' ); INSERT INTO rooms ( "id", "createdAt", "type", "name" ) VALUES ( '00000000-0000-4000-8000-000000000000', NOW(), 0, 'general' ); ALTER TABLE users ADD COLUMN "currentRoomId" uuid REFERENCES rooms ("id") DEFAULT '00000000-0000-4000-8000-000000000000'; CREATE TABLE user_rooms ( "createdAt" timestamp NOT NULL, "userId" uuid NOT NULL REFERENCES users ("id"), "roomId" uuid NOT NULL REFERENCES rooms ("id"), PRIMARY KEY ("userId", "roomId") ); CREATE TABLE messages ( "id" serial PRIMARY KEY, "createdAt" timestamp NOT NULL, "userId" uuid NOT NULL REFERENCES users ("id"), "roomId" uuid NOT NULL REFERENCES rooms ("id") ); COMMIT;
<reponame>nationalarchives/tdr-consignment-api-data INSERT INTO "FileProperty" ("PropertyId" , "Name", "Description", "Shortname") VALUES (uuid_generate_v4(), 'SHA256ServerSideChecksum', 'The SHA-256 checksum calculated after upload', 'SHA256Checksum');
insert into services (id, default_port, updated_by_user_id) values ('postgresql', 5432, 'usr-20151006-1'); insert into services (id, default_port, updated_by_user_id) values ('play', 9000, 'usr-20151006-1'); insert into services (id, default_port, updated_by_user_id) values ('nodejs', 7050, 'usr-20151006-1');
<gh_stars>1-10 -- ********************************************************************************************************************* -- * Oracle SQL: Fundamentals level (Student Guide) -- * Scheme: Human Resources -- * Author: <NAME> -- * Contact: <EMAIL> -- ********************************************************************************************************************* -- ********************************************************************************************************************* -- * Lab 1 -- ********************************************************************************************************************* SELECT last_name, job_id, salary As sal FROM employees; ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id, last_name, SALARY * 12 as "ANNUAL SALARY" FROM employees; ------------------------------------------------------------------------------------------------------------------------ DESC departments; ------------------------------------------------------------------------------------------------------------------------ select * from departments; ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id, last_name, job_id, hire_date AS "StartDate" FROM employees; ------------------------------------------------------------------------------------------------------------------------ SELECT DISTINCT job_id FROM employees; ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id AS "Emp #", last_name AS "Employee", job_id AS "Job", hire_date AS "Hire Date" FROM employees; ------------------------------------------------------------------------------------------------------------------------ SELECT last_name || ', ' || job_id AS "Employee and Title" FROM employees; ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id || ',' || first_name || ',' || last_name || ',' || email || ',' || phone_number || ',' || hire_date || ',' || job_id || ',' || salary || ',' || commission_pct || ',' || manager_id || ',' || department_id AS "THE_OUTPUT" FROM employees; -- ********************************************************************************************************************* -- * Lab 2 -- ********************************************************************************************************************* SELECT last_name, salary FROM employees WHERE salary > 12000; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, DEPARTMENT_ID FROM EMPLOYEES WHERE EMPLOYEE_ID = 176; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, SALARY FROM EMPLOYEES WHERE SALARY NOT BETWEEN 5000 AND 12000; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, JOB_ID, HIRE_DATE FROM EMPLOYEES WHERE HIRE_DATE BETWEEN '20-FEB-1998' AND '10-MAY-1998' ORDER BY HIRE_DATE ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, DEPARTMENT_ID FROM EMPLOYEES WHERE DEPARTMENT_ID IN(20, 50) ORDER BY LAST_NAME ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME AS "Employee", SALARY AS "Mounthly Salary" FROM EMPLOYEES WHERE DEPARTMENT_ID IN(20, 50) AND SALARY BETWEEN 5000 AND 12000 ORDER BY LAST_NAME ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, HIRE_DATE FROM EMPLOYEES WHERE HIRE_DATE LIKE '%94'; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, JOB_ID FROM EMPLOYEES WHERE MANAGER_ID IS NULL; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, SALARY, COMMISSION_PCT FROM EMPLOYEES WHERE COMMISSION_PCT IS NOT NULL ORDER BY SALARY, COMMISSION_PCT DESC; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, SALARY FROM EMPLOYEES WHERE SALARY > &SAL; -- 15000 ------------------------------------------------------------------------------------------------------------------------ SELECT EMPLOYEE_ID, LAST_NAME, SALARY, DEPARTMENT_ID FROM EMPLOYEES WHERE MANAGER_ID = &NUM; -- 205 ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME FROM EMPLOYEES WHERE LAST_NAME LIKE '__a%'; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME FROM EMPLOYEES WHERE LAST_NAME LIKE '%a%' AND LAST_NAME LIKE '%e%'; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, JOB_ID, SALARY FROM EMPLOYEES WHERE ( JOB_ID = 'SA_REP' OR JOB_ID = 'ST_CLERK' ) AND SALARY NOT IN(2500, 3500, 7000); ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, SALARY, COMMISSION_PCT FROM EMPLOYEES WHERE COMMISSION_PCT = 0.2; -- ********************************************************************************************************************* -- * Lab 3 -- ********************************************************************************************************************* SELECT SYSDATE AS "Date" FROM DUAL; ------------------------------------------------------------------------------------------------------------------------ SELECT EMPLOYEE_ID, LAST_NAME, SALARY, ROUND((SALARY + (SALARY * 15.5) /100)) AS "New Salary" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ DEFINE SAL = (SALARY + (SALARY * 15.5) /100); SELECT EMPLOYEE_ID, LAST_NAME, SALARY, ROUND(&SAL) AS "New Salary", (ROUND(&SAL) - SALARY) AS "Increase" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT INITCAP(LAST_NAME) AS "Name", LENGTH(LAST_NAME) AS "Length" FROM EMPLOYEES WHERE LAST_NAME LIKE 'J%' OR LAST_NAME LIKE 'A%' OR LAST_NAME LIKE 'M%' ORDER BY LAST_NAME ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT CONCAT(UPPER(SUBSTR(LAST_NAME, 1, 1)), SUBSTR(LOWER(LAST_NAME), 2)) AS "Name", CASE WHEN LAST_NAME LIKE 'J%' THEN LENGTH(LAST_NAME) WHEN LAST_NAME LIKE 'A%' THEN LENGTH(LAST_NAME) WHEN LAST_NAME LIKE 'M%' THEN LENGTH(LAST_NAME) ELSE NULL END "Lenght" FROM EMPLOYEES ORDER BY LAST_NAME ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT INITCAP(LAST_NAME) AS "Name", LENGTH(LAST_NAME) AS "Length" FROM EMPLOYEES WHERE LAST_NAME LIKE UPPER('&A%') ORDER BY LAST_NAME ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, ROUND(MONTHS_BETWEEN(SYSDATE, HIRE_DATE)) AS "MONTHS_WORKED" FROM EMPLOYEES ORDER BY MONTHS_WORKED ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME || ' earns' || TO_CHAR(SALARY, '$99,999.00') || ' monthly but wants ' || TO_CHAR(SALARY * 3, '$99,999.00') AS "Dream Salaries" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, LPAD(SALARY, 15 ,'$') AS "SALARY" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, HIRE_DATE, TO_CHAR( NEXT_DAY( ADD_MONTHS(HIRE_DATE, 6), 'MON'), 'Day, "the" fmDdspth "of" Month, YYYY') AS "REVIEW" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, HIRE_DATE, TO_CHAR(HIRE_DATE, 'DAY') AS "DAY" FROM EMPLOYEES ORDER BY TO_CHAR(HIRE_DATE, 'D'); ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, NVL(TO_CHAR(COMMISSION_PCT), 'No Commission') AS "COMM" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT last_name || RPAD(' ', salary / 1000, '*') AS "EMPLOYEES AND THEIR SALARIES" FROM employees ORDER BY salary DESC; ------------------------------------------------------------------------------------------------------------------------ SELECT JOB_ID, DECODE( JOB_ID, 'AD_PRES', 'A', 'ST_MAN', 'B', 'IT_PROG', 'C', 'SA_REP', 'D', 'ST_CLERK', 'E', 0 ) AS "G" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT JOB_ID, (CASE JOB_ID WHEN 'AD_PRES' THEN 'A' WHEN 'ST_MAN' THEN 'B' WHEN 'IT_PROG' THEN 'C' WHEN 'SA_REP' THEN 'D' WHEN 'ST_CLERK' THEN 'E' ELSE '0' END) AS "G" FROM EMPLOYEES; -- ********************************************************************************************************************* -- * Lab 4 -- ********************************************************************************************************************* SELECT ROUND(MAX(SALARY)) AS "Maximum", ROUND(MIN(SALARY)) AS "Minimum", ROUND(AVG(SALARY)) AS "Average", ROUND(SUM(SALARY)) AS "Sum" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT JOB_ID, ROUND(MAX(SALARY)) AS "Maximum", ROUND(MIN(SALARY)) AS "Minimum", ROUND(AVG(SALARY)) AS "Average", ROUND(SUM(SALARY)) AS "Sum" FROM EMPLOYEES GROUP BY JOB_ID; ------------------------------------------------------------------------------------------------------------------------ SELECT JOB_ID, COUNT(*) FROM EMPLOYEES GROUP BY JOB_ID; ------------------------------------------------------------------------------------------------------------------------ SELECT COUNT(DISTINCT MANAGER_ID) AS "Number of Managers" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT (MAX(SALARY) - MIN(SALARY)) AS "DIFFERENCE" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT DEPARTMENTS.DEPARTMENT_NAME AS "Name", DEPARTMENTS.LOCATION_ID AS "Location", COUNT(EMPLOYEES.EMPLOYEE_ID) AS "Number of People", ROUND(AVG(EMPLOYEES.SALARY)) AS "Salary" FROM DEPARTMENTS, EMPLOYEES WHERE DEPARTMENTS.DEPARTMENT_ID = EMPLOYEES.DEPARTMENT_ID GROUP BY DEPARTMENTS.DEPARTMENT_NAME, DEPARTMENTS.LOCATION_ID ------------------------------------------------------------------------------------------------------------------------ SELECT COUNT(EMPLOYEE_ID) AS "TOTAL", COUNT(DECODE(TO_CHAR(HIRE_DATE, 'YYYY'), '1995', HIRE_DATE ) ) AS "1995", COUNT(DECODE(TO_CHAR(HIRE_DATE, 'YYYY'), '1996', HIRE_DATE ) ) AS "1996", COUNT(DECODE(TO_CHAR(HIRE_DATE, 'YYYY'), '1997', HIRE_DATE ) ) AS "1997", COUNT(DECODE(TO_CHAR(HIRE_DATE, 'YYYY'), '1998', HIRE_DATE ) ) AS "1998" FROM EMPLOYEES; ------------------------------------------------------------------------------------------------------------------------ SELECT JOB_ID AS "Job", SUM(DECODE(DEPARTMENT_ID, '20', SALARY )) AS "Dept20", SUM(DECODE(DEPARTMENT_ID, '50', SALARY )) AS "Dept50", SUM(DECODE(DEPARTMENT_ID, '80', SALARY )) AS "Dept80", SUM(DECODE(DEPARTMENT_ID, '90', SALARY )) AS "Dept90", SUM(SALARY) "Total" FROM EMPLOYEES GROUP BY JOB_ID; -- ********************************************************************************************************************* -- * Lab 5 -- ********************************************************************************************************************* SELECT emp.last_name, emp.department_id, dep.department_name FROM employees emp INNER JOIN departments dep ON( emp.department_id = dep.department_id ) ------------------------------------------------------------------------------------------------------------------------ SELECT DISTINCT emp.job_id, dep.location_id FROM employees emp INNER JOIN departments dep ON( emp.department_id = dep.department_id ) WHERE dep.department_id = 80; ------------------------------------------------------------------------------------------------------------------------ SELECT DISTINCT emp.last_name, dep.department_name, dep.location_id, loc.city FROM employees emp INNER JOIN departments dep ON( emp.department_id = dep.department_id ) INNER JOIN locations loc ON( loc.location_id = dep.location_id ) WHERE emp.commission_pct IS NOT NULL; ------------------------------------------------------------------------------------------------------------------------ SELECT emp.last_name, dep.department_name FROM employees emp INNER JOIN departments dep ON( dep.department_id = emp.department_id ) WHERE emp.last_name LIKE '%a%'; ------------------------------------------------------------------------------------------------------------------------ SELECT emp.last_name, emp.job_id, dep.department_id, dep.department_name FROM employees emp INNER JOIN departments dep ON( dep.department_id = emp.department_id ) INNER JOIN locations loc ON( loc.location_id = dep.location_id ) WHERE loc.city = 'Toronto'; ------------------------------------------------------------------------------------------------------------------------ SELECT emp1.last_name AS "Employee", emp1.employee_id AS "EMP#", emp2.last_name AS "Manager", emp2.manager_id AS "Mgr#" FROM employees emp1 INNER JOIN employees emp2 ON( emp1.manager_id = emp2.employee_id ) ------------------------------------------------------------------------------------------------------------------------ SELECT emp1.last_name AS "Employee", emp1.employee_id AS "EMP#", emp2.last_name AS "Manager", emp2.manager_id AS "Mgr#" FROM employees emp1 LEFT OUTER JOIN employees emp2 ON( emp1.manager_id = emp2.employee_id ) ORDER BY emp1.employee_id ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT emp1.department_id AS "DEPARTMENT", emp1.last_name AS "EMPLOYEE", emp2.last_name AS "COLLEAGUE" FROM employees emp1 INNER JOIN employees emp2 ON( emp1.department_id = emp2.department_id ) WHERE emp1.employee_id <> emp2.employee_id ------------------------------------------------------------------------------------------------------------------------ SELECT emp.last_name, emp.job_id, dep.department_name, emp.salary, job.grade_level FROM employees emp INNER JOIN departments dep ON( emp.department_id = dep.department_id ) INNER JOIN job_grades job ON( emp.salary BETWEEN job.lowest_sal AND job.highest_sal ); ------------------------------------------------------------------------------------------------------------------------ SELECT emp1.last_name, emp1.hire_date FROM employees emp1 INNER JOIN employees emp2 ON( emp1.hire_date > emp2.hire_date ) WHERE emp2.last_name = 'Davies'; ------------------------------------------------------------------------------------------------------------------------ SELECT emp1.last_name AS "Employee", emp1.hire_date AS "Emp Hired", emp2.last_name AS "Manager", emp2.hire_date AS "Mgr hired" FROM employees emp1 INNER JOIN employees emp2 ON( emp1.manager_id = emp2.employee_id ) WHERE emp1.hire_date < emp2.hire_date ------------------------------------------------------------------------------------------------------------------------ SELECT dep.department_id, dep.department_name, dep.location_id, COUNT(emp.employee_id) FROM employees emp RIGHT OUTER JOIN departments dep ON( emp.department_id = dep.department_id ) GROUP BY dep.department_id, dep.department_name, dep.location_id ------------------------------------------------------------------------------------------------------------------------ SELECT emp.job_id, COUNT(emp.employee_id) AS "FREQUENCY" FROM employees emp INNER JOIN departments dep ON( emp.department_id = dep.department_id ) WHERE dep.department_name = 'Administration' OR dep.department_name = 'Executive' GROUP BY emp.job_id ORDER BY COUNT(emp.employee_id) DESC; ------------------------------------------------------------------------------------------------------------------------ SELECT emp1.last_name, emp2.last_name AS Manager, emp2.salary, job.grade_level AS "GRA" FROM employees emp1 INNER JOIN employees emp2 ON( emp1.manager_id = emp2.employee_id ) INNER JOIN job_grades job ON( emp2.salary BETWEEN job.lowest_sal AND job.highest_sal) WHERE emp2.salary > 15000 -- ********************************************************************************************************************* -- * Lab 6 -- ********************************************************************************************************************* SELECT last_name, hire_date FROM employees WHERE department_id = ( SELECT department_id FROM employees WHERE last_name = 'Zlotkey' ) AND last_name NOT IN('Zlotkey'); ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id, last_name, salary FROM employees WHERE salary > ( SELECT AVG(salary) FROM employees ) ORDER BY salary ASC; ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id, last_name FROM employees WHERE department_id IN ( SELECT department_id FROM employees WHERE last_name LIKE '%u%' ) ------------------------------------------------------------------------------------------------------------------------ SELECT last_name, department_id, job_id FROM employees WHERE department_id IN ( SELECT department_id FROM departments WHERE location_id = 1700 ) ------------------------------------------------------------------------------------------------------------------------ SELECT last_name, salary FROM employees WHERE employee_id IN ( SELECT emp1.employee_id FROM employees emp1 INNER JOIN employees emp2 ON( emp1.manager_id = emp2.employee_id ) WHERE emp2.last_name = 'King' ) ------------------------------------------------------------------------------------------------------------------------ SELECT dep.department_id, emp.last_name, emp.job_id FROM employees emp INNER JOIN departments dep ON( emp.department_id = dep.department_id ) WHERE emp.employee_id IN ( SELECT em.employee_id FROM departments de INNER JOIN employees em ON( em.department_id = de.department_id ) WHERE department_name = 'Executive' ) ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id, last_name, salary FROM employees WHERE department_id IN ( SELECT e.department_id FROM employees e WHERE e.last_name LIKE '%u%' ) AND salary > ( SELECT AVG(salary) FROM employees ) ------------------------------------------------------------------------------------------------------------------------ SELECT department_id, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID FROM departments WHERE DEPARTMENT_ID NOT IN ( SELECT department_id FROM employees WHERE job_id = 'SA_REP’' ) -- ********************************************************************************************************************* -- * Lab 7 -- ********************************************************************************************************************* SELECT department_id FROM departments MINUS SELECT department_id FROM employees WHERE job_id = 'ST_CLERK' ------------------------------------------------------------------------------------------------------------------------ SELECT COUNTRY_ID AS CO, COUNTRY_NAME FROM COUNTRIES WHERE COUNTRY_ID IN (SELECT COUNTRY_ID FROM COUNTRIES MINUS SELECT DISTINCT LOCATIONS.COUNTRY_ID FROM DEPARTMENTS JOIN LOCATIONS ON DEPARTMENTS.LOCATION_ID=LOCATIONS.LOCATION_ID) ------------------------------------------------------------------------------------------------------------------------ select job_id, department_id from ( SELECT job_id, department_id, 1 dummy FROM employees WHERE department_id = 10 UNION SELECT job_id, department_id, 2 dummy FROM employees WHERE department_id = 50 UNION SELECT job_id, department_id, 3 dummy FROM employees WHERE department_id = 20 ORDER BY dummy ); ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id, job_id FROM employees INTERSECT SELECT employee_id, job_id FROM job_history ------------------------------------------------------------------------------------------------------------------------ SELECT employee_id, department_id, TO_CHAR(null) AS department_name FROM employees UNION SELECT TO_NUMBER(null), department_id, department_name FROM departments; -- ********************************************************************************************************************* -- * Lab 8 -- ********************************************************************************************************************* CREATE TABLE MY_EMPLOYEE( ID NUMBER(4) CONSTRAINT MY_EMPLOYEE_ID_NN NOT NULL, LAST_NAME VARCHAR2(25), FIRST_NAME VARCHAR2(25), USERID VARCHAR2(8), SALARY NUMBER(9,2) ); ------------------------------------------------------------------------------------------------------------------------ INSERT INTO MY_EMPLOYEE (id, last_name, first_name, userid, salary) VALUES(2, 'Dancs', 'Betty', 'bdancs', 860); ------------------------------------------------------------------------------------------------------------------------ SET ECHO OFF SET VERIFY OFF INSERT INTO my_employee VALUES( &id, '&&l_name', '&&f_name', lower(substr('&f_name', 1, 1) || substr('&l_name', 1, 7)), &sal ); UNDEFINE f_name; UNDEFINE l_name; ------------------------------------------------------------------------------------------------------------------------ UPDATE my_employee SET last_name = 'Drexler' WHERE id = 3; ------------------------------------------------------------------------------------------------------------------------ UPDATE my_employee SET salary = 1000 WHERE salary < 900 ------------------------------------------------------------------------------------------------------------------------ DELETE FROM my_employee WHERE first_name = 'Betty' AND last_name = 'Dancs' ------------------------------------------------------------------------------------------------------------------------ INSERT INTO my_employee VALUES ( 5, 'Ropeburn', 'Andrey', 'Aropebur', 1550 ); ------------------------------------------------------------------------------------------------------------------------ DELETE FROM my_employee; ------------------------------------------------------------------------------------------------------------------------ SELECT dep1.department_id, dep1.location_id, loc.city FROM departments DEP1 INNER JOIN departments DEP2 ON( dep1.location_id = dep2.location_id AND dep1.department_id <> dep2.department_id ) INNER JOIN LOCATIONS LOC ON(loc.location_id = dep2.location_id ) INNER JOIN EMPLOYEES EMP ON(emp.department_id = dep1.department_id) HAVING SUM(emp.salary) > ( SELECT AVG(SUM(emp.salary)) FROM departments DEP1 INNER JOIN departments DEP2 ON( dep1.location_id = dep2.location_id AND dep1.department_id <> dep2.department_id ) INNER JOIN LOCATIONS LOC ON(loc.location_id = dep2.location_id ) INNER JOIN EMPLOYEES EMP ON(emp.department_id = dep1.department_id) GROUP BY dep1.department_id ) GROUP BY dep1.department_id, dep1.location_id, loc.city -- ********************************************************************************************************************* -- * Lab 9 -- ********************************************************************************************************************* CREATE TABLE DEPT ( id NUMBER(7), name VARCHAR2(25) ); DESC dept; ------------------------------------------------------------------------------------------------------------------------ CREATE TABLE emp ( id NUMBER(7), last_name VARCHAR2(25), first_name VARCHAR2(25), dept_id NUMBER(7) ); DESC EMP; ------------------------------------------------------------------------------------------------------------------------ CREATE TABLE emloyees2 AS( SELECT EMPLOYEE_ID AS "ID", FIRST_NAME, LAST_NAME, SALARY, DEPARTMENT_ID AS "DEPT_ID" FROM employees ); ------------------------------------------------------------------------------------------------------------------------ DROP TABLE emp; -- ********************************************************************************************************************* -- * Lab 10 -- ********************************************************************************************************************* CREATE VIEW employees_vu AS SELECT employee_id, last_name AS employee, department_id FROM employees; ------------------------------------------------------------------------------------------------------------------------ CREATE VIEW dept50 (empno, employee, deptno) AS SELECT employee_id, last_name, department_id FROM employees WHERE department_id = 50 WITH READ ONLY; ------------------------------------------------------------------------------------------------------------------------ UPDATE dept50 SET deptno = 80 WHERE employee = 'Matos' ------------------------------------------------------------------------------------------------------------------------ CREATE VIEW salary_vu ("Employee", "Department", "Salary", "Grade" ) AS SELECT emp.last_name, dep.department_name, emp.salary, job.grade_level FROM employees emp INNER JOIN departments dep ON( emp.department_id = dep.department_id ) INNER JOIN job_grades JOB ON( emp.salary BETWEEN job.lowest_sal AND job.highest_sal ); ------------------------------------------------------------------------------------------------------------------------ CREATE SEQUENCE dept_id_seq MINVALUE 1 MAXVALUE 1000 INCREMENT BY 10 START WITH 200 CACHE 20 NOORDER NOCYCLE ; ------------------------------------------------------------------------------------------------------------------------ CREATE INDEX dept_index_name ON dept ( name ); ------------------------------------------------------------------------------------------------------------------------ CREATE SYNONYM emp FOR employees; -- ********************************************************************************************************************* -- * Lab 11 -- ********************************************************************************************************************* SELECT column_name, data_type, data_length, data_precision precision, data_scale scale, nullable FROM user_tab_columns WHERE table_name = UPPER('&table'); ------------------------------------------------------------------------------------------------------------------------ SELECT user_col.column_name, user_con.constraint_name, user_con.constraint_type, user_con.search_condition, user_con.status FROM user_constraints user_con INNER JOIN user_cons_columns user_col ON(user_con.table_name = user_col.table_name) WHERE user_col.table_name = UPPER('&table'); ------------------------------------------------------------------------------------------------------------------------ COMMENT ON TABLE DEPARTMENTS IS 'Hello World !!!'; SELECT * FROM user_tab_comments WHERE table_name = 'DEPARTMENTS'; -- ********************************************************************************************************************* -- * Lab 12 -- ********************************************************************************************************************* ALTER USER user IDENTIFIED BY password. ------------------------------------------------------------------------------------------------------------------------ REVOKE SELECT ON emp FROM user2; -- ********************************************************************************************************************* -- * Lab 13 -- ********************************************************************************************************************* ALTER TABLE emp2 MODIFY (last_name VARCHAR(50)); ------------------------------------------------------------------------------------------------------------------------ CREATE TABLE employees2 ( employee_ID NUMBER(6) NOT NULL, first_name VARCHAR2(20), last_name VARCHAR2(25), salary NUMBER(8,2), department_id NUMBER(4) ); ALTER TABLE employees2 RENAME COLUMN employee_id TO id; ALTER TABLE employees2 RENAME COLUMN department_id TO dept_id; ------------------------------------------------------------------------------------------------------------------------ SELECT * FROM user_recyclebin; FLASHBACK TABLE emp2 TO BEFORE DROP; ------------------------------------------------------------------------------------------------------------------------ ALTER TABLE employees2 DROP (first_name); DESC employees2; ------------------------------------------------------------------------------------------------------------------------ ALTER TABLE employees2 SET UNUSED COLUMN dept_id; ------------------------------------------------------------------------------------------------------------------------ ALTER TABLE employees2 DROP UNUSED COLUMNS; ------------------------------------------------------------------------------------------------------------------------ ALTER TABLE emp2 ADD CONSTRAINT my_emp_id_pk PRIMARY KEY ( id ); ------------------------------------------------------------------------------------------------------------------------ ALTER TABLE dept2 ADD CONSTRAINT my_dept_id_pk PRIMARY KEY ( id ); ------------------------------------------------------------------------------------------------------------------------ ALTER TABLE emp2 ADD CONSTRAINT my_emp_dept_id_fk FOREIGN KEY (dept_id) REFERENCES dept2(id); ------------------------------------------------------------------------------------------------------------------------ ALTER TABLE emp2 ADD ( commission NUMBER(2, 2) ) ADD CONSTRAINT commission_not_null CHECK(commission > 0); ------------------------------------------------------------------------------------------------------------------------ DROP TABLE emp2 PURGE; ------------------------------------------------------------------------------------------------------------------------ CREATE TABLE DEPT_NAMED_INDEX ( DEPTNO NUMBER(4) PRIMARY KEY USING INDEX ( CREATE INDEX DEPT_PK_IDX ON DEPT_NAMED_INDEX (DEPTNO)), DNAME VARCHAR2(30) ); SELECT * FROM user_indexes; -- ********************************************************************************************************************* -- * Lab 14 -- ********************************************************************************************************************* INSERT ALL WHEN SAL > 20000 THEN INTO SPECIAL_SAL VALUES (EMP, SAL) ELSE INTO SAL_HISTORY VALUES (EMP, H_DATE, SAL) INTO MGR_HISTORY VALUES (EMP, MANAGER, SAL) SELECT HIRE_DATE AS H_DATE, EMPLOYEE_ID AS EMP, SALARY AS SAL, MANAGER_ID AS MANAGER FROM EMPLOYEES WHERE EMPLOYEE_ID < 125; ------------------------------------------------------------------------------------------------------------------------ INSERT ALL INTO SALES_INFO VALUES(EMP, WEEK, MON ) INTO SALES_INFO VALUES(EMP, WEEK, TUE ) INTO SALES_INFO VALUES(EMP, WEEK, THUR) INTO SALES_INFO VALUES(EMP, WEEK, WED ) INTO SALES_INFO VALUES(EMP, WEEK, FRI ) SELECT EMPLOYEE_ID AS EMP, WEEK_ID AS WEEK, SALES_MON AS MON, SALES_TUE AS TUE, SALES_THUR AS THUR, SALES_WED AS WED, SALES_FRI AS FRI FROM SALES_SOURCE_DATA; ------------------------------------------------------------------------------------------------------------------------ CREATE TABLE EMP_DATA ( FIRST_NAME VARCHAR2(25), LAST_NAME VARCHAR2(25), EMAIL VARCHAR2(25) )ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY EMP_DIR ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE NOBADFILE NOLOGFILE FIELDS TERMINATED BY ',' ( FIRST_NAME POSITION (1:20) CHAR, LAST_NAME POSITION (22:41) CHAR, EMAIL POSITION (40:90) CHAR ) ) LOCATION ('emp.dat') ); ------------------------------------------------------------------------------------------------------------------------ MERGE INTO EMP_HIST EMP_H USING EMP_DATA EMP_D ON( EMP_H.FIRST_NAME = EMP_D.FIRST_NAME AND EMP_H.LAST_NAME = EMP_D.LAST_NAME) WHEN MATCHED THEN UPDATE SET EMP_H.EMAIL = EMP_D.EMAIL WHEN NOT MATCHED THEN INSERT ( EMP_H.FIRST_NAME, EMP_H.LAST_NAME, EMP_H.EMAIL )VALUES ( EMP_D.FIRST_NAME, EMP_D.LAST_NAME, EMP_D.EMAIL ); -- ********************************************************************************************************************* -- * Lab 15 -- ********************************************************************************************************************* SELECT MANAGER_ID, JOB_ID, SUM(SALARY) FROM EMPLOYEES WHERE MANAGER_ID < 120 GROUP BY ROLLUP( MANAGER_ID, JOB_ID); ------------------------------------------------------------------------------------------------------------------------ SELECT MANAGER_ID, JOB_ID, SUM(SALARY), GROUPING(MANAGER_ID), GROUPING(JOB_ID) FROM EMPLOYEES WHERE MANAGER_ID < 120 GROUP BY ROLLUP (MANAGER_ID, JOB_ID) ------------------------------------------------------------------------------------------------------------------------ SELECT MANAGER_ID, JOB_ID, SUM(SALARY) FROM EMPLOYEES GROUP BY CUBE(MANAGER_ID, JOB_ID); ------------------------------------------------------------------------------------------------------------------------ SELECT MANAGER_ID, JOB_ID, SUM(SALARY), GROUPING(MANAGER_ID), GROUPING(JOB_ID) FROM EMPLOYEES GROUP BY CUBE (MANAGER_ID, JOB_ID); ------------------------------------------------------------------------------------------------------------------------ SELECT department_id, manager_id, job_id, SUM(salary) FROM employees GROUP BY GROUPING SETS (department_id, manager_id, job_id), (department_id, job_id), (manager_id, job_id); -- ********************************************************************************************************************* -- * Lab 16 -- ********************************************************************************************************************* ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS'; ------------------------------------------------------------------------------------------------------------------------ SELECT TZ_OFFSET('US/Pacific-New'), TZ_OFFSET('Singapore'), TZ_OFFSET('Egypt') FROM dual; ------------------------------------------------------------------------------------------------------------------------ ALTER SESSION SET TIME_ZONE = '-08:00'; SELECT CURRENT_DATE, CURRENT_TIMESTAMP, LOCALTIMESTAMP FROM dual; ------------------------------------------------------------------------------------------------------------------------ ALTER SESSION SET TIME_ZONE = '+08:00'; SELECT CURRENT_DATE, CURRENT_TIMESTAMP, LOCALTIMESTAMP FROM dual; ------------------------------------------------------------------------------------------------------------------------ SELECT DBTIMEZONE, SESSIONTIMEZONE FROM dual; ------------------------------------------------------------------------------------------------------------------------ SELECT EXTRACT (YEAR FROM HIRE_DATE) FROM EMPLOYEES WHERE DEPARTMENT_ID = 80; ------------------------------------------------------------------------------------------------------------------------ ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, EXTRACT(MONTH FROM HIRE_DATE) AS "MONTH", HIRE_DATE FROM EMPLOYEES WHERE EXTRACT(MONTH FROM HIRE_DATE) = 1; -- ********************************************************************************************************************* -- * Lab 17 -- ********************************************************************************************************************* SELECT LAST_NAME, DEPARTMENT_ID, SALARY FROM EMPLOYEES WHERE (SALARY, DEPARTMENT_ID) IN ( SELECT SALARY, DEPARTMENT_ID FROM EMPLOYEES WHERE COMMISSION_PCT IS NOT NULL ); ------------------------------------------------------------------------------------------------------------------------ SELECT EMP.LAST_NAME, DEP.DEPARTMENT_NAME, EMP.SALARY FROM EMPLOYEES EMP INNER JOIN DEPARTMENTS DEP ON( EMP.DEPARTMENT_ID = DEP.DEPARTMENT_ID ) WHERE (EMP.SALARY, NVL(EMP.COMMISSION_PCT, 0)) IN( SELECT E.SALARY, NVL(E.COMMISSION_PCT, 0) FROM EMPLOYEES E INNER JOIN DEPARTMENTS D ON(E.DEPARTMENT_ID = D.DEPARTMENT_ID) WHERE D.LOCATION_ID = 1700 ); ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, HIRE_DATE, SALARY FROM EMPLOYEES WHERE (SALARY, NVL(COMMISSION_PCT, 0)) IN( SELECT SALARY, NVL(COMMISSION_PCT, 0) FROM EMPLOYEES WHERE LAST_NAME = 'Kochhar' ) AND LAST_NAME <> 'Kochhar'; ------------------------------------------------------------------------------------------------------------------------ SELECT LAST_NAME, JOB_ID, SALARY FROM EMPLOYEES WHERE SALARY > ALL ( SELECT SALARY FROM EMPLOYEES WHERE JOB_ID = 'SA_MAN' ) ORDER BY SALARY DESC; ------------------------------------------------------------------------------------------------------------------------ SELECT EMPLOYEE_ID, LAST_NAME, DEPARTMENT_ID FROM EMPLOYEES WHERE DEPARTMENT_ID IN( SELECT DEPARTMENT_ID FROM DEPARTMENTS WHERE LOCATION_ID IN( SELECT LOCATION_ID FROM LOCATIONS WHERE CITY LIKE 'T%' ) ); ------------------------------------------------------------------------------------------------------------------------ SELECT EMP1.LAST_NAME AS ENAME, EMP1.SALARY AS SALARY, EMP1.DEPARTMENT_ID AS DEPTNO, ROUND(AVG(EMP2.SALARY), 4) AS DEPT_AVG FROM EMPLOYEES EMP1 INNER JOIN EMPLOYEES EMP2 ON( EMP1.DEPARTMENT_ID = EMP2.DEPARTMENT_ID) AND EMP1.SALARY > ( SELECT AVG(SALARY) FROM EMPLOYEES WHERE DEPARTMENT_ID = EMP1.DEPARTMENT_ID ) GROUP BY EMP1.LAST_NAME, EMP1.SALARY, EMP1.DEPARTMENT_ID ORDER BY AVG(EMP2.SALARY); ------------------------------------------------------------------------------------------------------------------------ SELECT EMP.LAST_NAME FROM EMPLOYEES EMP WHERE NOT EXISTS ( SELECT * FROM EMPLOYEES E WHERE E.MANAGER_ID = EMP.EMPLOYEE_ID ) ------------------------------------------------------------------------------------------------------------------------ SELECT EMP.LAST_NAME FROM EMPLOYEES EMP WHERE EMP.EMPLOYEE_ID NOT IN( SELECT E.MANAGER_ID FROM EMPLOYEES E ) ------------------------------------------------------------------------------------------------------------------------ SELECT EMP1.LAST_NAME FROM EMPLOYEES EMP1 WHERE SALARY < ( SELECT AVG(SALARY) FROM EMPLOYEES EMP2 WHERE EMP2.DEPARTMENT_ID = EMP1.DEPARTMENT_ID ) -- ********************************************************************************************************************* -- * Lab 18 -- ********************************************************************************************************************* SELECT * FROM employees WHERE REGEXP_LIKE (first_name, '^Na|Ne'); ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_REPLACE( STREET_ADDRESS, ' ', '') AS “ALL” FROM LOCATIONS; ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_REPLACE(STREET_ADDRESS, 'St$', 'Street') AS ALL FROM LOCATIONS WHERE REGEXP_LIKE( STREET_ADDRESS, 'St$' ); -- ********************************************************************************************************************* -- * Lab 19 -- ********************************************************************************************************************* SELECT REGEXP_replace('C:\Talk to Me NV\Fonts \ emp.dat', '(^\D+\\\s+)|(\d\D)$') FROM dual; ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_REPLACE('http://127.0.0.1:8080', ':[0-9]+$', '') AS "Adress" FROM DUAL; ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_REPLACE( REGEXP_REPLACE( REGEXP_REPLACE('hello hello world ffgalff jfb y ilya ilya', '([^ ]{2,})\s\1', '###\1### ###\1###'), '([^\#]{3})[^ ]([^\#]{3})', ''), '\#', '') FROM Dual; ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_SUBSTR('555-55-55', '^\([0-9]{3}\).([0-9]{3}-[0-9]{2}-[0-9]{2})|^([0-9]{3}-[0-9]{2}-[0-9]{2})') FROM dual; ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_REPLACE('akfklaj "ajsgkjsgksh" aagjajgoiagj "kopskgopsgk"', '[a-z]+[^\"a-z\n]', '') FROM Dual; ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_SUBSTR('<EMAIL>', '^[a-z]+@[a-z]+.[a-z]{2,10}$') FROM Dual; ------------------------------------------------------------------------------------------------------------------------ SELECT '&&regex', CASE WHEN LENGTH(REGEXP_REPLACE('&regex', '\(', '')) != LENGTH(REGEXP_REPLACE('&regex', '\)', '')) THEN 'Different count of close and open brackets' WHEN 0 > ANY(SELECT LENGTH(REGEXP_REPLACE('&regex', '\(', '', level))- LENGTH(REGEXP_REPLACE('&regex', '\)', '', level)) FROM dual CONNECT BY LEVEL <= LENGTH('&regex')) THEN 'Bracket misplacing' ELSE '&regex' END FROM dual; UNDEFINE regex; ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_REPLACE('2*9-6*5 (34+555)-9*4)', '[0-9]+(\+)', '') FROM dual; ------------------------------------------------------------------------------------------------------------------------ SELECT REGEXP_REPLACE('<EMAIL> prev<EMAIL>', '@[a-z]+.[a-z]+', '') FROM dual; ------------------------------------------------------------------------------------------------------------------------ --REGEXP_LIKE(‘123.56 4654.3 45642 5465 44 5 474445’, ‘[0-9]+(\.[0-9]+)’) select REGEXP_SUBSTR(STR, '[0-9]+\\s[0-9]+[.]{1}[0-9]+|[0-9]+[.]{1}[0-9]+|[0-9]+.[0-9]+[.]{1}[0-9]+', 1, level) STR from ( SELECT '10 5646.45, 45 sd eds,.sd 9 882,566.11 ' str FROM dual) table_1 connect by regexp_substr(str,'([0-9][.]{1}[0-9])+',1, level) is not null;
CREATE TABLE analysis.e_dianping_name AS SELECT DISTINCT "name", "type", "category" FROM detail_space.e_dianping_dtl ORDER BY "name", "type", "category" ; CREATE TABLE analysis.e_mxj_name AS SELECT DISTINCT "brand_name", "category" FROM detail_space.e_mxj_dtl ORDER BY "brand_name", "category" ; CREATE TABLE analysis.l_hospital_name AS SELECT DISTINCT "name", "type", "typecode" FROM detail_space.l_hospital_dtl ORDER BY "name", "type", "typecode" ; CREATE TABLE analysis.m_food_amap_name AS SELECT DISTINCT "name", "type", "typecode" FROM detail_space.m_food_amap_dtl ORDER BY "name", "type", "typecode" ; CREATE TABLE analysis.m_hotel_amap_name AS SELECT DISTINCT "name", "type", "typecode" FROM detail_space.m_hotel_amap_dtl ORDER BY "name", "type", "typecode" ; CREATE TABLE analysis.m_ktv_amap_name AS SELECT DISTINCT "name", "type", "typecode" FROM detail_space.m_ktv_amap_dtl ORDER BY "name", "type", "typecode" ; CREATE TABLE analysis.m_shopping_amap_name AS SELECT DISTINCT "name", "type", "typecode" FROM detail_space.m_shopping_amap_dtl ORDER BY "name", "type", "typecode" ; CREATE TABLE analysis.mall_shopping_data_name AS SELECT DISTINCT "name", "tags" FROM "public".mall_shopping_data_ods ORDER BY "name", "tags" ; CREATE TABLE analysis.mall_shopping_params_name AS SELECT DISTINCT "name" FROM "public".mall_shopping_params_ods ORDER BY "name" ; CREATE TABLE analysis.mall_center_stat AS SELECT DISTINCT "name", "bid" FROM "public".mall_shopping_params_ods ORDER BY "name" ;
-- Exercise 1: -- Goal: Here we use users table to pull a list of user email addresses. -- Edit the query to pull email addresses, but only for non-deleted users. SELECT email_address FROM dsv1069.users WHERE deleted_at is NULL; -- Exercise 2: -- Goal: Use the items table to count the number of items for sale in each category SELECT category, COUNT(id) AS item_count FROM dsv1069.items GROUP BY category ORDER BY item_count ASC; -- Exercise 3: --Goal: Select all of the columns from the result when you JOIN the users -- table to the orders table SELECT * FROM dsv1069.users u JOIN dsv1069.orders o ON u.id = o.user_id ORDER BY u.id ASC; -- Exercise 4: --Goal: Check out the query below. This is not the right way to count the -- number of viewed_item events. Determine what is wrong and correct the error. SELECT COUNT(DISTINCT event_id) AS events FROM dsv1069.events WHERE event_name = 'view_item'; -- Exercise 5: --Goal:Compute the number of items in the items table which have been -- ordered. The query below runs, but it isn’t right. Determine what is -- wrong and correct the error or start from scratch. SELECT COUNT(DISTINCT o.item_id) AS item_count FROM dsv1069.orders o; -- Exercise 6: --Goal: For each user figure out IF a user has ordered something, and -- when their first purchase was. The query below doesn’t return info -- for any of the users who haven’t ordered anything. SELECT users.id as user_id, MIN(orders.paid_at) AS min_paid_at FROM dsv1069.users LEFT JOIN dsv1069.orders ON users.id = orders.user_id GROUP BY users.id ORDER BY min_paid_at DESC; -- Exercise 7: --Goal: Figure out what percent of users have ever viewed the user -- profile page, but this query isn’t right. Check to make sure the -- number of users adds up, and if not, fix the query. SELECT ( CASE WHEN first_view IS NULL THEN false ELSE true END ) AS has_viewed_profile_page, COUNT(user_id) AS users -- creates first_profile_views table FROM ( SELECT users.id AS user_id, MIN(event_time) AS first_view FROM dsv1069.users LEFT JOIN dsv1069.events ON events.user_id = users.id AND event_name = 'view_user_profile' GROUP BY users.id ) first_profile_views GROUP BY has_viewed_profile_page;
use blueboat_syslog; create table `inbound_2` ( `raw` String ) engine = Kafka() settings kafka_broker_list = 'redpanda.core.svc.cluster.local:9092', kafka_topic_list = 'net.univalent.usw-miniprod.blueboat-log.sys', kafka_group_name = 'net.univalent.usw-miniprod.clickhouse', kafka_format = 'RawBLOB'; create table `logs` ( `host` String, `pid` Int32, `tid` String, `ts` DateTime64(6), `name` String, `target` String, `level` String, `module_path` String, `file` String, `line` Int32, `fields` Map(String, String), `span_id` String ) engine = MergeTree() order by `ts` partition by toYYYYMM(ts); create materialized view `logs_consumer_2` to `logs` as select JSONExtract(raw, 'host', 'String') as host, JSONExtract(raw, 'pid', 'Int32') as pid, JSONExtract(raw, 'tid', 'String') as tid, fromUnixTimestamp64Micro(cast(JSONExtract(raw, 'ts', 'Float64') * 1000000 as Int64)) as ts, JSONExtract(raw, 'name', 'String') as name, JSONExtract(raw, 'target', 'String') as target, JSONExtract(raw, 'level', 'String') as level, JSONExtract(raw, 'module_path', 'String') as module_path, JSONExtract(raw, 'file', 'String') as file, JSONExtract(raw, 'line', 'Int32') as line, cast(JSONExtractKeysAndValues(raw, 'fields', 'String'), 'Map(String, String)') as fields, JSONExtract(raw, 'span_id', 'String') as span_id from inbound_2;
<gh_stars>1-10 -- -- PostgreSQL database dump -- SET statement_timeout = 0; SET lock_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; SET search_path = public, pg_catalog; SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: quality; Type: TABLE; Schema: public; Owner: schwingbach-user; Tablespace: -- CREATE TABLE quality ( id integer NOT NULL, name character varying, comment character varying ); ALTER TABLE public.quality OWNER TO "schwingbach-user"; -- -- Name: TABLE quality; Type: COMMENT; Schema: public; Owner: schwingbach-user -- COMMENT ON TABLE quality IS 'Quality of data in a dataset'; -- -- Name: quality_id_seq; Type: SEQUENCE; Schema: public; Owner: schwingbach-user -- CREATE SEQUENCE quality_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.quality_id_seq OWNER TO "schwingbach-user"; -- -- Name: quality_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: schwingbach-user -- ALTER SEQUENCE quality_id_seq OWNED BY quality.id; -- -- Name: id; Type: DEFAULT; Schema: public; Owner: schwingbach-user -- ALTER TABLE ONLY quality ALTER COLUMN id SET DEFAULT nextval('quality_id_seq'::regclass); -- -- Name: quality_pkey; Type: CONSTRAINT; Schema: public; Owner: schwingbach-user; Tablespace: -- ALTER TABLE ONLY quality ADD CONSTRAINT quality_pkey PRIMARY KEY (id); -- -- PostgreSQL database dump complete --
-- in.test -- -- execsql {SELECT a FROM t1 WHERE b IN (b+8,64)} SELECT a FROM t1 WHERE b IN (b+8,64)
 SELECT TOP(2) //#A [p].[BookId], //#B [p].[Description], //#B [p].[ImageUrl], //#B [p].[Price], //#B [p].[PublishedOn], //#B [p].[Publisher], //#B [p].[Title] //#B FROM [Books] AS [p] //#B WHERE [p].[Title] = N'Quantum Networking' //#C SET NOCOUNT ON; UPDATE [Books] //#D SET [PublishedOn] = @p0 //#E WHERE [BookId] = @p1; //#F SELECT @@ROWCOUNT; //#G #A This reads up to 2 entries from the Books table - we asked for a single item in out code, but this makes sure it fails if there is more than one row that fits #B The read loads all the columns in the table #C This is our LINQ Where method. It picks out the entry by its title #D This is the SQL UPDATE command in this case on the Books table #E Because EF Core's DetectChanges method found only the PublishedOn property had changed it can target that column in the table #F EF Core used the primary key from the original book to uniquely select the row it wants to update #G Finally it sends back the number of rows that were inserted in this transaction. SaveChanges returns this integer, but normally I ignore it.
<reponame>Ambal/mangos<gh_stars>0 ALTER TABLE db_version CHANGE COLUMN required_11489_01_mangos_creature_template required_11501_01_mangos_spell_proc_event bit; DELETE FROM spell_proc_event WHERE entry = 64571; INSERT INTO spell_proc_event VALUES (64571, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10);
select distinct(city) from station where city regexp "^[^aeiouAEIOU].*";
select * from #./c c
<reponame>gutenbadgers/OpenReader<gh_stars>1-10 DROP TABLE IF EXISTS user; DROP TABLE IF EXISTS bookshelf; DROP TABLE IF EXISTS bookmark; CREATE TABLE user ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT UNIQUE NOT NULL, password TEXT NOT NULL ); CREATE TABLE bookshelf ( book_id INTEGER NOT NULL, user_id INTEGER NOT NULL, UNIQUE (book_id, user_id), FOREIGN KEY (user_id) REFERENCES user (id) ); CREATE TABLE bookmark ( bookmark_id INTEGER PRIMARY KEY AUTOINCREMENT, book_id INTEGER NOT NULL, user_id INTEGER NOT NULL, page INTEGER NOT NULL, implicit BOOLEAN NOT NULL, FOREIGN KEY (user_id) REFERENCES user (id) );
DROP TABLE IF EXISTS deliveries;
<reponame>jinilover/type-safe-ws<filename>src/resources/dbscripts/02_user_add_columns.sql<gh_stars>0 ALTER TABLE users ADD COLUMN age integer NOT NULL, ADD COLUMN email varchar(50) NOT NULL;
<gh_stars>0 -- @testpoint: 关键字with,用作字符串 drop table if exists with_test cascade; create table with_test(id int,name varchar(20)); create or replace procedure with_insert as begin for i in 1..10 loop insert into with_test values(i,'with'||i); end loop; end; / call with_insert(); select * from with_test; drop table if exists with_test cascade; drop procedure with_insert;
<reponame>roopansh/LocCab -- phpMyAdmin SQL Dump -- version 4.5.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Oct 21, 2016 at 07:36 PM -- Server version: 10.1.16-MariaDB -- PHP Version: 7.0.9 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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: `rickshaw` -- CREATE DATABASE `rickshaw`; USE `rickshaw`; -- -------------------------------------------------------- -- -- Table structure for table `driver` -- CREATE TABLE `driver` ( `id` varchar(255) NOT NULL, `longitude` double NOT NULL, `latitude` double NOT NULL, `avail` tinyint(1) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `driverlogin` -- CREATE TABLE `driverlogin` ( `id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `driverlogin` -- -- -- Indexes for dumped tables -- -- -- Indexes for table `driverlogin` -- ALTER TABLE `driverlogin` ADD PRIMARY KEY (`id`,`username`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `driverlogin` -- ALTER TABLE `driverlogin` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; /*!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 */;
SET DEFINE OFF; CREATE SEQUENCE AFW_04_CONTX_ETEND_SEQ START WITH 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER /
<filename>migrations/sqlite/2019-08-29-143242_alter_news_annoucement/down.sql -- Alter the table to remove the column ALTER TABLE news DROP COLUMN announcement;
<reponame>delimbetov/telegram_filtered_feed -- rename username -> joiner ALTER TABLE "monitored_chats" RENAME COLUMN "username" TO "joiner"; -- add new column ALTER TABLE "monitored_chats" ADD COLUMN "title" text; -- fill with default vals UPDATE "monitored_chats" SET "title"='placeholder_1141_fill_me'; -- add constraint ALTER TABLE "monitored_chats" ALTER COLUMN "title" SET NOT NULL; -- now run follow on all these chats so title gets updated
with base as ( SELECT * FROM {{ ref('sfdc_users_source') }} ) SELECT * FROM base
<gh_stars>1000+ INSERT INTO nyct2010 (boroname, ntaname, ntacode, geom) SELECT 'New Jersey', 'Newark Airport', 'NJ01', (SELECT geom FROM taxi_zones WHERE zone = 'Newark Airport');
<gh_stars>100-1000 --Add vocabulary for Payer, Plan, Sponsor and Stop Reason [AVOF-1243] --new vocabularies DO $_$ BEGIN PERFORM VOCABULARY_PACK.AddNewVocabulary( pVocabulary_id => 'Plan', pVocabulary_name => 'Health Plan - contract to administer healthcare transactions by the payer, facilitated by the sponsor', pVocabulary_reference => null, pVocabulary_version => null, pOMOP_req => 'Y', --NULL or 'Y' pClick_default => 'Y', --NULL or 'Y' pAvailable => NULL, --NULL, 'Currently not available','License required' or 'EULA required' pURL => NULL, pClick_disabled => NULL, --NULL or 'Y' pSEQ_VIP_gen => FALSE --TRUE if VIP ); END $_$; DO $_$ BEGIN PERFORM VOCABULARY_PACK.AddNewVocabulary( pVocabulary_id => 'Sponsor', pVocabulary_name => 'Sponsor - institution or individual financing healthcare transactions', pVocabulary_reference => null, pVocabulary_version => null, pOMOP_req => 'Y', --NULL or 'Y' pClick_default => 'Y', --NULL or 'Y' pAvailable => NULL, --NULL, 'Currently not available','License required' or 'EULA required' pURL => NULL, pClick_disabled => NULL, --NULL or 'Y' pSEQ_VIP_gen => FALSE --TRUE if VIP ); END $_$; DO $_$ BEGIN PERFORM VOCABULARY_PACK.AddNewVocabulary( pVocabulary_id => 'PHDSC', pVocabulary_name => 'Source of Payment Typology (PHDSC)', pVocabulary_reference => 'http://www.phdsc.org/standards/payer-typology-source.asp', pVocabulary_version => 'Version 3.0', pOMOP_req => 'Y', --NULL or 'Y' pClick_default => 'Y', --NULL or 'Y' pAvailable => NULL, --NULL, 'Currently not available','License required' or 'EULA required' pURL => NULL, pClick_disabled => NULL, --NULL or 'Y' pSEQ_VIP_gen => FALSE --TRUE if VIP ); END $_$; DO $_$ BEGIN PERFORM VOCABULARY_PACK.AddNewVocabulary( pVocabulary_id => 'Plan Stop Reason', pVocabulary_name => 'Plan Stop Reason - Reason for termination of the Health Plan', pVocabulary_reference => null, pVocabulary_version => null, pOMOP_req => 'Y', --NULL or 'Y' pClick_default => 'Y', --NULL or 'Y' pAvailable => NULL, --NULL, 'Currently not available','License required' or 'EULA required' pURL => NULL, pClick_disabled => NULL, --NULL or 'Y' pSEQ_VIP_gen => FALSE --TRUE if VIP ); END $_$; --new domain_ids DO $$ DECLARE z int; ex int; pDomain_id constant varchar(100):='Plan'; pDomain_name constant varchar(200):= 'Health Plan - contract to administer healthcare transactions by the payer, facilitated by the sponsor'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pDomain_name, 'Metadata', 'Domain', 'Domain', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO domain (domain_id, domain_name, domain_concept_id) VALUES (pDomain_id, pDomain_name, z); DROP SEQUENCE v5_concept; END $$; DO $$ DECLARE z int; ex int; pDomain_id constant varchar(100):='Sponsor'; pDomain_name constant varchar(100):= 'Sponsor - institution or individual financing healthcare transactions'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pDomain_name, 'Metadata', 'Domain', 'Domain', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO domain (domain_id, domain_name, domain_concept_id) VALUES (pDomain_id, pDomain_name, z); DROP SEQUENCE v5_concept; END $$; DO $$ DECLARE z int; ex int; pDomain_id constant varchar(100):='Payer'; pDomain_name constant varchar(100):= 'Payer - institution administering healthcare transactions'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pDomain_name, 'Metadata', 'Domain', 'Domain', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO domain (domain_id, domain_name, domain_concept_id) VALUES (pDomain_id, pDomain_name, z); DROP SEQUENCE v5_concept; END $$; DO $$ DECLARE z int; ex int; pDomain_id constant varchar(100):='Plan Stop Reason'; pDomain_name constant varchar(100):= 'Plan Stop Reason - Reason for termination of the Health Plan'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pDomain_name, 'Metadata', 'Domain', 'Domain', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO domain (domain_id, domain_name, domain_concept_id) VALUES (pDomain_id, pDomain_name, z); DROP SEQUENCE v5_concept; END $$; --new concept_class_ids DO $$ DECLARE z int; ex int; pConcept_class_id constant varchar(100):='Payer'; pConcept_class_name constant varchar(100):= 'Payer - institution administering healthcare transactions'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pConcept_class_name, 'Metadata', 'Concept Class', 'Concept Class', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO concept_class (concept_class_id, concept_class_name, concept_class_concept_id) VALUES (pConcept_class_id, pConcept_class_name, z); DROP SEQUENCE v5_concept; END $$; DO $$ DECLARE z int; ex int; pConcept_class_id constant varchar(100):='Sponsor'; pConcept_class_name constant varchar(100):= 'Sponsor - institution or individual financing healthcare transactions'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pConcept_class_name, 'Metadata', 'Concept Class', 'Concept Class', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO concept_class (concept_class_id, concept_class_name, concept_class_concept_id) VALUES (pConcept_class_id, pConcept_class_name, z); DROP SEQUENCE v5_concept; END $$; DO $$ DECLARE z int; ex int; pConcept_class_id constant varchar(100):='Plan Stop Reason'; pConcept_class_name constant varchar(100):= 'Plan Stop Reason - Reason for termination of the Health Plan'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pConcept_class_name, 'Metadata', 'Concept Class', 'Concept Class', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO concept_class (concept_class_id, concept_class_name, concept_class_concept_id) VALUES (pConcept_class_id, pConcept_class_name, z); DROP SEQUENCE v5_concept; END $$; DO $$ DECLARE z int; ex int; pConcept_class_id constant varchar(100):='Benefit'; pConcept_class_name constant varchar(100):= 'Benefit - healthcare items or services covered under a Health Plan'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pConcept_class_name, 'Metadata', 'Concept Class', 'Concept Class', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO concept_class (concept_class_id, concept_class_name, concept_class_concept_id) VALUES (pConcept_class_id, pConcept_class_name, z); DROP SEQUENCE v5_concept; END $$; DO $$ DECLARE z int; ex int; pConcept_class_id constant varchar(100):='Metal level'; pConcept_class_name constant varchar(100):= 'Metal level: ratio of split of the healthcare transaction costs between Health Plan and patient'; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept --WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts WHERE concept_id >= 31967 AND concept_id < 72245; EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; SELECT nextval('v5_concept') INTO z; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) VALUES (z, pConcept_class_name, 'Metadata', 'Concept Class', 'Concept Class', null, 'OMOP generated', TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null); INSERT INTO concept_class (concept_class_id, concept_class_name, concept_class_concept_id) VALUES (pConcept_class_id, pConcept_class_name, z); DROP SEQUENCE v5_concept; END $$; --select * From dev_test.concept_manual; --clearing update dev_test.concept_manual set concept_name=trim(concept_name) where concept_name<>trim(concept_name); update dev_test.concept_manual set concept_code=trim(concept_code) where concept_code<>trim(concept_code); update dev_test.concept_manual set domain_id=trim(domain_id) where domain_id<>trim(domain_id); update dev_test.concept_manual set vocabulary_id=trim(vocabulary_id) where vocabulary_id<>trim(vocabulary_id); update dev_test.concept_manual set concept_class_id=trim(concept_class_id) where concept_class_id<>trim(concept_class_id); update dev_test.concept_manual set standard_concept=trim(standard_concept) where standard_concept<>trim(standard_concept); --insert concepts DO $$ DECLARE ex int; BEGIN DROP SEQUENCE IF EXISTS v5_concept; SELECT MAX (concept_id) + 1 INTO ex FROM concept WHERE concept_id>=200 and concept_id<1000; --only for VIP concepts EXECUTE 'CREATE SEQUENCE v5_concept INCREMENT BY 1 START WITH ' || ex || ' CACHE 20'; INSERT INTO concept (concept_id, concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason) SELECT nextval('v5_concept'), concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, TO_DATE ('19700101', 'YYYYMMDD'), TO_DATE ('20991231', 'YYYYMMDD'), null from dev_test.concept_manual; DROP SEQUENCE v5_concept; END $$; --create/update 'Maps to' for all 'S' without 'Maps to' WITH to_be_upserted AS ( SELECT c.concept_id, c.valid_start_date, lat.relationship_id FROM concept c LEFT JOIN concept_relationship cr ON cr.concept_id_1=c.concept_id AND cr.concept_id_1=cr.concept_id_2 AND cr.relationship_id='Maps to' AND cr.invalid_reason IS NULL CROSS JOIN LATERAL (SELECT case when generate_series=1 then 'Maps to' ELSE 'Mapped from' END AS relationship_id FROM generate_series(1,2)) lat WHERE c.standard_concept='S' AND c.invalid_reason IS NULL AND cr.concept_id_1 IS NULL ), to_be_updated AS ( UPDATE concept_relationship cr SET invalid_reason = NULL, valid_end_date = TO_DATE ('20991231', 'yyyymmdd') FROM to_be_upserted up WHERE cr.invalid_reason IS NOT NULL AND cr.concept_id_1 = up.concept_id AND cr.concept_id_2 = up.concept_id AND cr.relationship_id = up.relationship_id RETURNING cr.* ) INSERT INTO concept_relationship SELECT tpu.concept_id, tpu.concept_id, tpu.relationship_id, tpu.valid_start_date, TO_DATE ('20991231', 'yyyymmdd'), NULL FROM to_be_upserted tpu WHERE (tpu.concept_id, tpu.concept_id, tpu.relationship_id) NOT IN ( SELECT up.concept_id_1, up.concept_id_2, up.relationship_id FROM to_be_updated up UNION ALL SELECT cr_int.concept_id_1, cr_int.concept_id_2, cr_int.relationship_id FROM concept_relationship cr_int WHERE cr_int.concept_id_1=cr_int.concept_id_2 AND cr_int.relationship_id IN ('Maps to','Mapped from') ); --create 'Is a' relationships for 'PHDSC' INSERT INTO concept_relationship WITH t AS ( SELECT c1.concept_id AS concept_id_1, c2.concept_id AS concept_id_2, TO_DATE('19700101', 'YYYYMMDD') AS valid_start_date, TO_DATE('20991231', 'YYYYMMDD') AS valid_end_date, NULL AS invalid_reason FROM concept c1 JOIN concept c2 ON c2.vocabulary_id = c1.vocabulary_id AND c2.concept_code LIKE c1.concept_code || '%' AND length(c2.concept_code) - 1 = length(c1.concept_code) WHERE c1.vocabulary_id = 'PHDSC' ) SELECT concept_id_1, concept_id_2, 'Subsumes' AS relationship_id, valid_start_date, valid_end_date, invalid_reason FROM t UNION ALL SELECT concept_id_2, concept_id_1, 'Is a' AS relationship_id, valid_start_date, valid_end_date, invalid_reason FROM t;
<gh_stars>0 SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [AutoWho].[ResetAutoWhoData] /* Copyright 2016 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ------------------------------------------------------------------------ PROJECT NAME: ChiRho https://github.com/AaronMorelli/ChiRho PROJECT DESCRIPTION: A T-SQL toolkit for troubleshooting performance and stability problems on SQL Server instances FILE NAME: AutoWho.ResetAutoWhoData.StoredProcedure.sql PROCEDURE NAME: AutoWho.ResetAutoWhoData AUTHOR: <NAME> <EMAIL> @sqlcrossjoin sqlcrossjoin.wordpress.com PURPOSE: Clear out/reset all "collected" data in the AutoWho tables so that we can start testing over again. This proc is primarily aimed at development/testing OUTSTANDING ISSUES: None at this time. To Execute ------------------------ exec AutoWho.ResetAutoWhoData @DeleteConfig=N'N' */ ( @DeleteConfig NCHAR(1)=N'N' ) AS BEGIN SET NOCOUNT ON; IF @DeleteConfig IS NULL OR UPPER(@DeleteConfig) NOT IN (N'N', N'Y') BEGIN SET @DeleteConfig = N'N'; END TRUNCATE TABLE [AutoWho].[LightweightSessions]; TRUNCATE TABLE [AutoWho].[LightweightTasks]; TRUNCATE TABLE [AutoWho].[LightweightTrans]; TRUNCATE TABLE [AutoWho].[LockDetails]; TRUNCATE TABLE [AutoWho].[TransactionDetails]; TRUNCATE TABLE [AutoWho].[TasksAndWaits]; TRUNCATE TABLE [AutoWho].[SessionsAndRequests]; TRUNCATE TABLE [AutoWho].[BlockingGraphs]; TRUNCATE TABLE [AutoWho].[ThresholdFilterSpids]; TRUNCATE TABLE [AutoWho].[SARException]; TRUNCATE TABLE [AutoWho].[TAWException]; TRUNCATE TABLE [AutoWho].[SignalTable]; --We have pre-reserved certain ID values for certain dimension members, so we need to keep those. DELETE FROM [AutoWho].[DimCommand] WHERE DimCommandID > 3; DELETE FROM [AutoWho].[DimConnectionAttribute] WHERE DimConnectionAttributeID > 1; DELETE FROM [AutoWho].[DimLoginName] WHERE DimLoginNameID > 2; DELETE FROM [AutoWho].[DimNetAddress] WHERE DimNetAddressID > 2; DELETE FROM [AutoWho].[DimSessionAttribute] WHERE DimSessionAttributeID > 1; DELETE [AutoWho].[DimWaitType] WHERE DimWaitTypeID > 2; DELETE FROM [CoreXR].[OrdinalCachePosition] WHERE Utility IN (N'AutoWho',N'SessionViewer',N'QueryProgress'); DELETE FROM [CoreXR].[CaptureOrdinalCache] WHERE Utility IN (N'AutoWho', N'SessionViewer', N'QueryProgress'); DELETE FROM [CoreXR].[Traces] WHERE Utility = N'AutoWho'; TRUNCATE TABLE [AutoWho].[CaptureSummary]; TRUNCATE TABLE [AutoWho].[CaptureTimes]; TRUNCATE TABLE [AutoWho].[Log]; IF @DeleteConfig = N'Y' BEGIN TRUNCATE TABLE [AutoWho].[CollectorOptFakeout]; TRUNCATE TABLE [AutoWho].[Options]; TRUNCATE TABLE [AutoWho].[Options_History]; TRUNCATE TABLE [CoreXR].[Version]; TRUNCATE TABLE [CoreXR].[Version_History]; TRUNCATE TABLE [AutoWho].[DimCommand]; TRUNCATE TABLE [AutoWho].[DimConnectionAttribute]; TRUNCATE TABLE [AutoWho].[DimLoginName]; TRUNCATE TABLE [AutoWho].[DimNetAddress]; TRUNCATE TABLE [AutoWho].[DimSessionAttribute]; TRUNCATE TABLE [AutoWho].[DimWaitType]; END RETURN 0; END GO
--liquibase formatted sql --changeset reference:create-configuration_value context:ddl runOnChange:false create table public.configuration_value ( id uuid not null constraint configuration_value_pkey primary key, value text not null, component_configuration_id uuid null constraint fk_configuration_value_component_configuration references component_configuration (id), environment_id uuid not null constraint fk_configuration_value_environment references environment (id), environment_host_id uuid not null constraint fk_configuration_value_environment_host references environment_host (id) ); alter table public.configuration_value owner to postgres; comment on table public.configuration_value is 'Component application'; comment on column public.configuration_value.id is 'ID'; comment on column public.configuration_value.value is 'Name'; comment on column public.configuration_value.component_configuration_id is 'Description'; comment on column public.configuration_value.environment_id is 'Environment ID'; comment on column public.configuration_value.environment_host_id is 'Environment host ID'; --rollback drop table public.configuration_value;
<reponame>styleandsubstance/StockTraderBackend # --- !Ups ALTER TABLE RecommendationAnalysis ADD COLUMN scheduled_earnings_date date; # --- !Downs
select @@version; go select @@version; go
<reponame>takashi-uesaka/Dapper.outsidesql DELETE FROM DEPT WHERE DEPTNO = /*no*/99
<filename>query/compute/compute_ssl_policy_with_no_weak_cipher.sql with all_proxies as ( select name, self_link, split_part(kind, '#', 2) proxy_type, ssl_policy, title, location, project from gcp_compute_target_ssl_proxy union select name, self_link, split_part(kind, '#', 2) proxy_type, ssl_policy, title, location, project from gcp_compute_target_https_proxy ), ssl_policy_without_weak_cipher as ( select self_link from gcp_compute_ssl_policy where (profile = 'MODERN' and min_tls_version = 'TLS_1_2') or profile = 'RESTRICTED' or (profile = 'CUSTOM' and not (enabled_features ?| array['TLS_RSA_WITH_AES_128_GCM_SHA256', 'TLS_RSA_WITH_AES_256_GCM_SHA384', 'TLS_RSA_WITH_AES_128_CBC_SHA', 'TLS_RSA_WITH_AES_256_CBC_SHA', 'TLS_RSA_WITH_3DES_EDE_CBC_SHA'])) ) select -- Required Columns self_link resource, case when ssl_policy is null or ssl_policy in (select self_link from ssl_policy_without_weak_cipher) then 'ok' else 'alarm' end status, case when ssl_policy is null then proxy_type || ' ' || title || ' has no SSL policy.' when ssl_policy is null or ssl_policy in (select self_link from ssl_policy_without_weak_cipher) then proxy_type || ' ' || title || ' SSL policy contains CIS compliant cipher.' else proxy_type || ' ' || title || ' SSL policy contains weak cipher.' end reason, -- Additional Dimensions location, project from all_proxies;
ALTER TABLE `billing_invoices` ADD `site` VARCHAR(50) NULL DEFAULT NULL AFTER `number`;
<filename>sql/_17_sql_extension2/_02_full_test/_03_alter_table/_01_alter_change/cases/alter_change_type_short.sql --+ holdcas on; --alter_table_change_type_strict --change the type of a short column to other types create class coo( col1 short, col2 short, col3 short, col4 short, col5 short, col6 short, col7 short, col8 short, col9 short, col10 short, col11 short, col12 short, col13 short, col14 short, col15 short ); insert into coo values(12345, 123, -12345, 23451, -1234, 23451, 12345, 123, -12345, 23451, -1234, 23451, -8899, -80, 11889); show columns in coo; --short -> numeric, precision - scale >= 5 alter table coo change col1 col1 numeric(10, 4); select col1 from coo order by 1; --short -> numeric, precision - scale < 5, enough room for conversion alter table coo change col2 col2 numeric(10, 6); select col2 from coo order by 1; --short -> numeric, precision - scale < 5, lack of room for conversion set system parameters 'alter_table_change_type_strict=yes'; alter table coo change col3 col3 numeric(10, 7); set system parameters 'alter_table_change_type_strict=no'; alter table coo change col3 col3 numeric(10, 7); select col3 from coo order by 1; --short -> char, precision > 5+1 alter table coo change col4 col4 char(10); select col4 from coo order by 1; --short -> char, precision <= 5+1, enough room for conversion alter table coo change col5 col5 char(6); select col5 from coo order by 1; --short -> char, precision <= 5+1, lack of room for conversion set system parameters 'alter_table_change_type_strict=yes'; alter table coo change col6 col6 char(4); set system parameters 'alter_table_change_type_strict=no'; alter table coo change col6 col6 char(4); select length(col6) from coo order by 1; --short -> varchar, precision > 5+1 or new prec=-1 alter table coo change col7 col7 varchar; select col7 from coo order by 1; --short -> varchar, precision <= 5+1, enough room for conversion alter table coo change col8 col8 varchar(6); select col8 from coo order by 1; --short -> varchar, precision <= 5+1, lack of room for conversion set system parameters 'alter_table_change_type_strict=yes'; alter table coo change col9 col9 varchar(4); set system parameters 'alter_table_change_type_strict=no'; alter table coo change col9 col9 varchar(4); select length(col9) from coo order by 1; --short -> nchar, precision > 5+1 alter table coo change col10 col10 nchar(10); select col10 from coo order by 1; --short -> nchar, precision <= 5+1, enough room for conversion alter table coo change col11 col11 nchar(6); select col11 from coo order by 1; --short -> nchar, precision <= 5+1, lack of room for conversion set system parameters 'alter_table_change_type_strict=yes'; alter table coo change col12 col12 nchar(4); set system parameters 'alter_table_change_type_strict=no'; alter table coo change col12 col12 nchar(4); select length(col12) from coo order by 1; --short -> nchar varying, precision > 5+1, or new prec=-1 alter table coo change col13 col13 nchar varying(10); select col13 from coo order by 1; --short -> nchar varying, precision <= 5+1, enough room for conversion alter table coo change col14 col14 nchar varying(6); select col14 from coo order by 1; --short -> nchar varying, precision <= 5+1, lack of room for conversion set system parameters 'alter_table_change_type_strict=yes'; alter table coo change col15 col15 nchar varying(4); set system parameters 'alter_table_change_type_strict=no'; alter table coo change col15 col15 nchar varying(4); select length(col15) from coo order by 1; show columns in coo; drop table coo; commit; --+ holdcas off;
-- @testpoint:opengauss关键字type(非保留),作为用户组名 --关键字不带引号-成功 drop group if exists type; create group type with password '<PASSWORD>'; drop group type; --关键字带双引号-成功 drop group if exists "type"; create group "type" with password '<PASSWORD>'; drop group "type"; --关键字带单引号-合理报错 drop group if exists 'type'; create group 'type' with password '<PASSWORD>'; --关键字带反引号-合理报错 drop group if exists `type`; create group `type` with password '<PASSWORD>';
<reponame>Eman8618/CreatingAnAPIwithPostgresSql-Express /* Delete orderproductscart table */ DROP TABLE IF EXISTS orderproductscart CASCADE;
<reponame>AyatoKirishima/sql_avance<filename>TP_Blanc/test_sp_calcul_prix.sql<gh_stars>0 CALL sp_calcul_prix(12,0,15,100,@prix)
CREATE TABLE [dbo].[attribute_definition] ( [attribute_definition_id] INT NOT NULL, [attribute_name] VARCHAR (255) NOT NULL, [attribute_description] VARCHAR (MAX) NULL, [attribute_type_concept_id] INT NOT NULL, [attribute_syntax] VARCHAR (MAX) NULL );
CREATE DATABASE [CigarShop] USE [CigarShop] --- 1. DDL CREATE TABLE Sizes ( Id INT PRIMARY KEY IDENTITY NOT NULL, [Length] INT CHECK([Length] BETWEEN 10 AND 25) NOT NULL, RingRange DECIMAL(18, 2) CHECK((RingRange) BETWEEN 1.5 AND 7.5) NOT NULL ); CREATE TABLE Tastes ( Id INT PRIMARY KEY IDENTITY NOT NULL, TasteType VARCHAR(20) NOT NULL, TasteStrength VARCHAR(15) NOT NULL, ImageURL NVARCHAR(100) NOT NULL ); CREATE TABLE Brands ( Id INT PRIMARY KEY IDENTITY NOT NULL, BrandName VARCHAR(30) UNIQUE NOT NULL, BrandDescription VARCHAR(MAX) ); CREATE TABLE Cigars ( Id INT PRIMARY KEY IDENTITY NOT NULL, CigarName VARCHAR(80) NOT NULL, BrandId INT FOREIGN KEY REFERENCES Brands(Id) NOT NULL, TastId INT FOREIGN KEY REFERENCES Tastes(Id) NOT NULL, SizeId INT FOREIGN KEY REFERENCES Sizes(Id) NOT NULL, PriceForSingleCigar DECIMAL(18, 2) NOT NULL, ImageURL NVARCHAR(100) NOT NULL ); CREATE TABLE Addresses ( Id INT PRIMARY KEY IDENTITY NOT NULL, Town VARCHAR(30) NOT NULL, Country NVARCHAR(30) NOT NULL, Streat NVARCHAR(100) NOT NULL, ZIP VARCHAR(20) NOT NULL ); CREATE TABLE Clients ( Id INT PRIMARY KEY IDENTITY NOT NULL, FirstName NVARCHAR(30) NOT NULL, LastName NVARCHAR(30) NOT NULL, Email NVARCHAR(50) NOT NULL, AddressId INT FOREIGN KEY REFERENCES Addresses(Id) ); CREATE TABLE ClientsCigars ( ClientId INT FOREIGN KEY REFERENCES Clients(Id) NOT NULL, CigarId INT FOREIGN KEY REFERENCES Cigars(Id) NOT NULL, PRIMARY KEY(ClientId, CigarId) ) --- 2. Insert INSERT INTO Cigars(CigarName, BrandId, TastId, SizeId, PriceForSingleCigar, ImageURL) VALUES ('<NAME>', 9, 1, 5, 15.50, 'cohiba-robusto-stick_18.jpg'), ('<NAME>', 9, 1, 10, 410.00, 'cohiba-siglo-i-stick_12.jpg'), ('<NAME>', 14, 5, 11, 7.50, 'hoyo-du-maire-stick_17.jpg'), ('<NAME>', 14, 4, 15, 32.00, 'hoyo-de-san-juan-stick_20.jpg'), ('<NAME>', 2, 3, 8, 85.21, 'trinidad-coloniales-stick_30.jpg') INSERT INTO Addresses(Town, Country, Streat, ZIP) VALUES ('Sofia', 'Bulgaria', '18 Bul. Vasil levski', 1000), ('Athens', 'Greece', '4342 McDonald Avenue', 10435), ('Zagreb', 'Croatia', '4333 Lauren Drive', 10000) --- 3. Update UPDATE Cigars SET PriceForSingleCigar += PriceForSingleCigar * 0.20 WHERE [TastId] = 1 UPDATE Brands SET BrandDescription = 'New description' WHERE BrandDescription IS NULL --- 4. Delete DELETE FROM Clients WHERE AddressId IN (7, 8 , 10) DELETE FROM Addresses WHERE Country LIKE 'C%' --- 5. Cigars by Price SELECT CigarName, PriceForSingleCigar, ImageURL FROM Cigars ORDER BY PriceForSingleCigar ASC, CigarName DESC --- 6. Cigars by Taste SELECT c.Id, c.CigarName, c.PriceForSingleCigar, t.TasteType, t.TasteStrength FROM Cigars AS c JOIN Tastes AS t ON c.TastId = t.Id WHERE TasteType IN ('Earthy', 'Woody') ORDER BY PriceForSingleCigar DESC --- 7. Clients without Cigars SELECT Id, CONCAT(FirstName, ' ', LastName) AS ClientName, Email FROM Clients AS cl LEFT JOIN ClientsCigars AS cc ON cl.Id = cc.ClientId WHERE cc.CigarId IS NULL ORDER BY ClientName ASC --- 8. First 5 Cigars SELECT TOP(5) c.CigarName, c.PriceForSingleCigar, c.ImageURL FROM Cigars AS c JOIN Sizes AS s ON c.SizeId = s.Id WHERE s.[Length] >= 12 AND (c.CigarName LIKE '%ci%' OR c.PriceForSingleCigar > 50) AND s.RingRange > 2.55 ORDER BY c.CigarName ASC, c.PriceForSingleCigar DESC --- 9. Clients with ZIP Codes SELECT CONCAT(FirstName, ' ', LastName) AS FullName, a.Country, a.ZIP, CONCAT('$', MAX(c.PriceForSingleCigar)) AS CigarPrice FROM Clients AS cl JOIN [Addresses] AS a ON cl.AddressId = a.Id JOIN ClientsCigars AS cc ON cl.Id = cc.ClientId JOIN Cigars AS c ON cc.CigarId = c.Id WHERE a.ZIP NOT LIKE '%[A-Za-z]%' GROUP BY cl.FirstName, cl.LastName, a.Country, a.ZIP ORDER BY FullName ASC --- 10. Cigars by Size SELECT cl.LastName, AVG(s.[Length]) AS CiagrLength, CEILING(AVG(s.RingRange)) AS CiagrRingRange FROM Clients AS cl LEFT JOIN ClientsCigars AS cc ON cl.Id = cc.ClientId LEFT JOIN Cigars AS c ON cc.CigarId = c.Id LEFT JOIN Sizes AS s ON c.SizeId = s.Id WHERE cc.CigarId IS NOT NULL GROUP BY cl.LastName ORDER BY AVG(s.[Length])DESC --- 11. Client with Cigars GO CREATE FUNCTION udf_ClientWithCigars(@name VARCHAR(30)) RETURNS INT AS BEGIN DECLARE @totalCountOfCigars INT = (SELECT COUNT(cc.CigarId) FROM Clients AS cl INNER JOIN ClientsCigars AS cc ON cl.Id = cc.ClientId WHERE cl.FirstName = @name) RETURN @totalCountOfCigars END GO SELECT dbo.udf_ClientWithCigars('Betty') --- 12. Search for Cigar with Specific Taste GO CREATE PROC usp_SearchByTaste (@taste VARCHAR(20)) AS SELECT c.CigarName, CONCAT('$', c.PriceForSingleCigar) AS Price, t.TasteType, b.BrandName, CONCAT(s.[Length], ' ', 'cm') AS CigarLength, CONCAT(s.RingRange, ' ', 'cm') AS CigarRingRange FROM Cigars AS c JOIN Tastes AS t ON c.TastId = t.Id JOIN Brands AS b ON c.BrandId = b.Id JOIN Sizes AS s ON c.SizeId = s.Id WHERE t.TasteType = @taste ORDER BY CigarLength ASC, CigarRingRange DESC GO EXEC usp_SearchByTaste 'Woody'
<gh_stars>0 -- phpMyAdmin SQL Dump -- version 4.9.5deb2 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Tempo de geração: 19-Abr-2021 às 18:22 -- Versão do servidor: 8.0.23-0ubuntu0.20.04.1 -- versão do PHP: 7.4.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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 */; -- -- Banco de dados: `brasileirao_serie_a` -- -- -------------------------------------------------------- -- -- Estrutura da tabela `campeonato` -- CREATE TABLE `campeonato` ( `id_campeonato` int UNSIGNED NOT NULL, `nome_campeonato` varchar(255) COLLATE utf8mb4_bin NOT NULL, `qtd_rodadas` int NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; -- -- Extraindo dados da tabela `campeonato` -- INSERT INTO `campeonato` (`id_campeonato`, `nome_campeonato`, `qtd_rodadas`, `created_at`, `updated_at`) VALUES (1, 'Brasileirão série A', 38, NULL, NULL); -- -------------------------------------------------------- -- -- Estrutura da tabela `clubes` -- CREATE TABLE `clubes` ( `id_clube` int UNSIGNED NOT NULL, `nome_clube` varchar(255) COLLATE utf8mb4_bin NOT NULL, `pontos` int NOT NULL, `qtd_jogos` int NOT NULL, `qtd_vitorias` int NOT NULL, `qtd_empates` int NOT NULL, `qtd_derrotas` int NOT NULL, `gols_P` int NOT NULL, `gols_C` int NOT NULL, `saldo_gols` int NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; -- -- Extraindo dados da tabela `clubes` -- INSERT INTO `clubes` (`id_clube`, `nome_clube`, `pontos`, `qtd_jogos`, `qtd_vitorias`, `qtd_empates`, `qtd_derrotas`, `gols_P`, `gols_C`, `saldo_gols`, `created_at`, `updated_at`) VALUES (2, 'Atletico-MG', 0, 0, 0, 0, 0, 0, 0, 0, '2021-04-18 20:41:26', '2021-04-18 20:41:26'), (3, 'Palmeiras', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (4, 'Flamengo', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (5, 'Corinthians', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (6, 'São Paulo-FC', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (7, 'Internacional', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (8, 'Grêmio', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (9, 'Atlético-GO', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (10, 'Baiha', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (11, 'Bragantino', 3, 1, 1, 0, 0, 3, 1, 3, NULL, NULL), (12, 'América-MG', 3, 1, 1, 0, 0, 2, 1, 2, NULL, NULL), (13, 'Athletico-PR', 0, 1, 0, 0, 1, 1, 3, 1, NULL, NULL), (14, 'Ceará', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (15, 'Fluminense', 0, 1, 0, 0, 1, 1, 2, 1, NULL, NULL), (16, 'Santos', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (17, 'Juventude', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (18, 'Sport', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (19, 'Fortaleza', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (20, 'Chapecoense', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL), (21, 'Cuiabá', 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL); -- -------------------------------------------------------- -- -- Estrutura da tabela `confrotos` -- CREATE TABLE `confrotos` ( `id_confronto` int UNSIGNED NOT NULL, `id_rodada` int NOT NULL, `placar` varchar(255) COLLATE utf8mb4_bin NOT NULL, `mandante` int NOT NULL, `visitante` int NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; -- -------------------------------------------------------- -- -- Estrutura da tabela `migrations` -- CREATE TABLE `migrations` ( `id` int UNSIGNED NOT NULL, `migration` varchar(255) COLLATE utf8mb4_bin NOT NULL, `batch` int NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; -- -- Extraindo dados da tabela `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2021_04_18_143138_create_clubes_table', 1), (2, '2014_10_12_000000_create_users_table', 2), (3, '2014_10_12_100000_create_password_resets_table', 2), (4, '2021_04_19_165147_create_campeonato_table', 3), (5, '2021_04_19_165849_create_rodadas_table', 3), (6, '2021_04_19_170702_create_confrotos_table', 3), (7, '2021_04_19_172026_alter_rodadas_table', 4); -- -------------------------------------------------------- -- -- Estrutura da tabela `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_bin NOT NULL, `token` varchar(255) COLLATE utf8mb4_bin NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; -- -------------------------------------------------------- -- -- Estrutura da tabela `rodadas` -- CREATE TABLE `rodadas` ( `id_rodada` int UNSIGNED NOT NULL, `id_campeonato` int NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `num_rodada` int NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; -- -- Extraindo dados da tabela `rodadas` -- INSERT INTO `rodadas` (`id_rodada`, `id_campeonato`, `created_at`, `updated_at`, `num_rodada`) VALUES (1, 1, '2021-04-19 21:20:07', '2021-04-19 21:20:07', 1); -- -------------------------------------------------------- -- -- Estrutura da tabela `users` -- CREATE TABLE `users` ( `id` int UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_bin NOT NULL, `email` varchar(255) COLLATE utf8mb4_bin NOT NULL, `password` varchar(255) COLLATE utf8mb4_bin NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; -- -- Índices para tabelas despejadas -- -- -- Índices para tabela `campeonato` -- ALTER TABLE `campeonato` ADD PRIMARY KEY (`id_campeonato`); -- -- Índices para tabela `clubes` -- ALTER TABLE `clubes` ADD PRIMARY KEY (`id_clube`); -- -- Índices para tabela `confrotos` -- ALTER TABLE `confrotos` ADD PRIMARY KEY (`id_confronto`); -- -- Índices para tabela `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Índices para tabela `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Índices para tabela `rodadas` -- ALTER TABLE `rodadas` ADD PRIMARY KEY (`id_rodada`); -- -- Índices para tabela `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT de tabelas despejadas -- -- -- AUTO_INCREMENT de tabela `campeonato` -- ALTER TABLE `campeonato` MODIFY `id_campeonato` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT de tabela `clubes` -- ALTER TABLE `clubes` MODIFY `id_clube` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; -- -- AUTO_INCREMENT de tabela `confrotos` -- ALTER TABLE `confrotos` MODIFY `id_confronto` int UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de tabela `migrations` -- ALTER TABLE `migrations` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT de tabela `rodadas` -- ALTER TABLE `rodadas` MODIFY `id_rodada` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de tabela `users` -- ALTER TABLE `users` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT; 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 */;
<reponame>Indexical-Metrics-Measure-Advisory/watchmen<gh_stars>0 -- noinspection SpellCheckingInspectionForFile CREATE TABLE topic_dqc_raw_rule_result ( id_ DECIMAL(20), data_ JSON, rulecode VARCHAR(50), topicid VARCHAR(50), factorid VARCHAR(50), detected SMALLINT, processdate TIMESTAMP, tenant_id_ VARCHAR(50) NOT NULL, insert_time_ TIMESTAMP NOT NULL, update_time_ TIMESTAMP NOT NULL, CONSTRAINT pk_topic_dqc_raw_rule_result PRIMARY KEY (id_) ); CREATE INDEX i_topic_dqc_raw_rule_result_1 ON topic_dqc_raw_rule_result (rulecode); CREATE INDEX i_topic_dqc_raw_rule_result_2 ON topic_dqc_raw_rule_result (topicid); CREATE INDEX i_topic_dqc_raw_rule_result_3 ON topic_dqc_raw_rule_result (factorid); CREATE INDEX i_topic_dqc_raw_rule_result_4 ON topic_dqc_raw_rule_result (processdate); CREATE INDEX i_topic_dqc_raw_rule_result_5 ON topic_dqc_raw_rule_result (tenant_id_); CREATE INDEX i_topic_dqc_raw_rule_result_6 ON topic_dqc_raw_rule_result (update_time_);
CREATE TABLE [dbo].[PostUrl] ( [PostUrlId] INT IDENTITY (1, 1) NOT NULL, [Url] VARCHAR(4000) NOT NULL, [PostId] INT NOT NULL, [Provider] VARCHAR(4000) NOT NULL CONSTRAINT [FK_PostUrl_Post] FOREIGN KEY ([PostId]) REFERENCES [Post]([PostId]), CONSTRAINT [PK_PostUrl] PRIMARY KEY CLUSTERED ([PostUrlId] ASC) )
<gh_stars>0 INSERT INTO TEST(OID) VALUES 2;
INSERT INTO categories (category) values ('grocery'); INSERT INTO categories (category) values ('fuel'); INSERT INTO categories (category) values ('utility'); INSERT INTO categories (category) values ('cloths'); INSERT INTO categories (category) values ('Entertainment');
<reponame>dvsa/poc-new-selenium<filename>src/server/resources/queries/authorised-examiner/AE_NOT_REJECTED.sql select afe.ae_ref as ae_ref, o.name as ae_name from organisation o, auth_for_ae afe where o.name is not null and afe.organisation_id = o.id and afe.status_id != 6 -- AE is not rejected status and afe.ao_site_id != 8 -- not DVSA Area Office 08 limit 20
DROP DATABASE IF EXISTS `isuketch`; CREATE DATABASE `isuketch`; GRANT ALL PRIVILEGES ON `isuketch`.* TO 'isucon'@'localhost' IDENTIFIED BY 'isucon'; GRANT ALL PRIVILEGES ON `isuketch`.* TO 'isucon'@'%' IDENTIFIED BY 'isucon';
<filename>Chapter04/Exercise07/Exercise 7 – Replicate an external applications built in function.sql<gh_stars>1-10 USE autoclub; DROP FUNCTION IF EXISTS NZ; DELIMITER $$ CREATE FUNCTION NZ(TestValue VARCHAR(255), NullValue VARCHAR(255) ) RETURNS VARCHAR(255) no sql BEGIN RETURN COALESCE(TestValue,NullValue); END $$ DELIMITER ;
<reponame>Shuttl-Tech/antlr_psql<filename>src/test/resources/sql/select/03029db2.sql<gh_stars>10-100 -- file:json.sql ln:470 expect:true SELECT c FROM json_populate_record(NULL::jsrec, '{"c": null}') q
SET @sName = 'bx_accounts'; -- MENUS UPDATE `sys_menu_items` SET `onclick`='javascript:{js_object}.onClickResendCemail({content_id}, this);' WHERE `set_name`='bx_accounts_menu_manage_tools' AND `name`='resend-cemail'; UPDATE `sys_menu_items` SET `onclick`='javascript:{js_object}.onClickDelete({content_id}, this);' WHERE `set_name`='bx_accounts_menu_manage_tools' AND `name`='delete'; UPDATE `sys_menu_items` SET `onclick`='javascript:{js_object}.onClickDeleteWithContent({content_id}, this);' WHERE `set_name`='bx_accounts_menu_manage_tools' AND `name`='delete-with-content'; UPDATE `sys_menu_items` SET `onclick`='javascript:{js_object}.onClickMakeOperator({content_id}, this);' WHERE `set_name`='bx_accounts_menu_manage_tools' AND `name`='make-operator'; UPDATE `sys_menu_items` SET `onclick`='javascript:{js_object}.onClickUnmakeOperator({content_id}, this);' WHERE `set_name`='bx_accounts_menu_manage_tools' AND `name`='unmake-operator';
<reponame>NordiCelt/TraXdotNet CREATE PROCEDURE [dbo].[BugNet_ProjectIssueTypes_CreateNewIssueType] @ProjectId INT, @IssueTypeName NVARCHAR(50), @IssueTypeImageUrl NVarChar(50) AS IF NOT EXISTS(SELECT IssueTypeId FROM BugNet_ProjectIssueTypes WHERE LOWER(IssueTypeName)= LOWER(@IssueTypeName) AND ProjectId = @ProjectId) BEGIN DECLARE @SortOrder int SELECT @SortOrder = ISNULL(MAX(SortOrder + 1),1) FROM BugNet_ProjectIssueTypes WHERE ProjectId = @ProjectId INSERT BugNet_ProjectIssueTypes ( ProjectId, IssueTypeName, IssueTypeImageUrl , SortOrder ) VALUES ( @ProjectId, @IssueTypeName, @IssueTypeImageUrl, @SortOrder ) RETURN scope_identity() END RETURN -1
/* Populate :: Exemplo 02 Autor: <NAME> (<EMAIL>) 17/01/2017 Entidades: [cliente]1---*[pedido]*---*[item]*---1[categoria] */ drop table if exists cliente cascade; create table cliente ( id INTEGER primary key, nome VARCHAR(60) NOT NULL, nasc timestamp NOT NULL /* idade pode ser campo calulado via function */ ); -- --------------------------------------------------------------- insert into cliente select generate_series as id, initcap(random_string(5, 15, random_int_range(3, 4))::varchar(60)) as nome, random_date('1920-01-01 00:00:00', '2016-12-31 23:59:59') as nasc from generate_series(1, 1e5); -- --------------------------------------------------------------- drop table if exists categoria cascade; create table categoria ( id INTEGER primary key, nome VARCHAR(20) NOT NULL, descricao VARCHAR(100) ); -- --------------------------------------------------------------- insert into categoria select generate_series as id, 'Cat ' || initcap(random_string(random_int_range(5,15))::varchar(20)) as nome, 'Desc ' || initcap(random_string(10, 22, random_int_range(3, 4))::varchar(100)) as descricao from generate_series(1, 1e3); -- --------------------------------------------------------------- drop table if exists pedido cascade; create table pedido ( id INTEGER primary key, dt_pedido TIMESTAMP NOT NULL, cliente_id INTEGER NOT NULL, FOREIGN KEY (cliente_id) references cliente (id) ); -- --------------------------------------------------------------- insert into pedido select generate_series as id, random_date('2008-01-01 00:00:00', '2017-01-10 23:59:59') as dt_pedido, random_int_range(1, 1e5::INTEGER) as cliente_id from generate_series(1, 1e4); -- --------------------------------------------------------------- drop table if exists item cascade; create table item ( id INTEGER primary key, nome VARCHAR(20) NOT NULL, descricao VARCHAR(100), preco NUMERIC(5,2) NOT NULL, cat_id INTEGER, FOREIGN KEY (cat_id) references categoria (id) ); -- --------------------------------------------------------------- insert into item select generate_series as id, 'Item ' || initcap(random_string(random_int_range(5,15))::varchar(20)) as nome, 'Desc ' || initcap(random_string(10, 22, random_int_range(3, 4))::varchar(100)) as descricao, round(cast(random()*1e3 as numeric), 2), random_int_range(1, 1e3::INTEGER) as cat_id from generate_series(1, 1e5); -- --------------------------------------------------------------- drop table if exists pedido_item cascade; create table pedido_item ( pedido_id INTEGER NOT NULL, item_id INTEGER NOT NULL, PRIMARY KEY (pedido_id, item_id), FOREIGN KEY (pedido_id) references pedido (id), FOREIGN KEY (item_id) references item (id) ); -- --------------------------------------------------------------- insert into pedido_item select generate_series as pedido_id, random_int_range(1, 1e5::INTEGER) as item_id from generate_series(1, 1e4);
#namespace("wechatMemberProfit") #sql("findReceiveWechatMemberProfit") SELECT wmp.* FROM joy_wechat_member_profit wmp INNER JOIN joy_wechat_member_recommend wmr ON wmp.wechat_member_id = wmr.receive_wechat_member_id WHERE wmr.wechat_member_id=#para(0) #end #end
SELECT CAST(1 AS UInt8); SELECT CAST([] AS Array(UInt8)); SELECT CAST(1, 'UInt8'); SELECT SUBSTRING('Hello, world' FROM 8); SELECT SUBSTRING('Hello, world' FROM 8 FOR 5); SELECT SUBSTRING('Hello, world', 8); SELECT SUBSTRING('Hello, world', 8, 5); SELECT TRIM(LEADING 'abc' FROM 'abcdef'); SELECT TRIM(TRAILING 'def' FROM 'abcdef'); SELECT TRIM(BOTH 'af' FROM 'abcdef'); SELECT TRIM(' abcdef '); SELECT LTRIM(' abcdef '); SELECT RTRIM(' abcdef '); SELECT EXTRACT(YEAR FROM DATE '2022-01-01'); SELECT EXTRACT('Hello, world', '^\w+'); SELECT POSITION('ll' IN 'Hello'); SELECT POSITION('Hello', 'll'); SELECT DATE_ADD(YEAR, 1, DATE '2022-01-01'); SELECT DATE_ADD(INTERVAL 1 YEAR, DATE '2022-01-01'); SELECT DATEADD(YEAR, 1, DATE '2022-01-01'); SELECT DATEADD(INTERVAL 1 YEAR, DATE '2022-01-01'); SELECT TIMESTAMP_ADD(YEAR, 1, DATE '2022-01-01'); SELECT TIMESTAMP_ADD(INTERVAL 1 YEAR, DATE '2022-01-01'); SELECT TIMESTAMPADD(YEAR, 1, DATE '2022-01-01'); SELECT TIMESTAMPADD(INTERVAL 1 YEAR, DATE '2022-01-01'); SELECT DATE_SUB(YEAR, 1, DATE '2022-01-01'); SELECT DATE_SUB(DATE '2022-01-01', INTERVAL 1 YEAR); SELECT DATESUB(YEAR, 1, DATE '2022-01-01'); SELECT DATESUB(DATE '2022-01-01', INTERVAL 1 YEAR); SELECT TIMESTAMP_SUB(YEAR, 1, DATE '2022-01-01'); SELECT TIMESTAMP_SUB(DATE '2022-01-01', INTERVAL 1 YEAR); SELECT TIMESTAMPSUB(YEAR, 1, DATE '2022-01-01'); SELECT TIMESTAMPSUB(DATE '2022-01-01', INTERVAL 1 YEAR); SELECT DATE_DIFF(YEAR, DATE '2021-01-01', DATE '2022-01-01'); SELECT DATEDIFF(YEAR, DATE '2021-01-01', DATE '2022-01-01'); SELECT EXISTS (SELECT 1);
<gh_stars>1-10 -- Deploy ggircs:swrs/history/computed_column/report_latest_swrs_report to pg -- requires: swrs/history/table/report begin; create or replace function swrs_history.report_latest_swrs_report(report swrs_history.report) returns swrs_history.report as $$ select r.* from swrs_history.report r join swrs_extract.eccc_xml_file x on r.eccc_xml_file_id = x.id join swrs_extract.eccc_zip_file z on x.zip_file_id = z.id where r.swrs_report_id = report.swrs_report_id order by zip_file_name desc limit 1; $$ language 'sql' stable; comment on function swrs_history.report_latest_swrs_report is 'Computed column returns the latest report ordered by zip_file_name'; commit;
<reponame>Ed-Fi-Exchange-OSS/Tableau-Attendance-Dashboard GO IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE name = N'EdFiX_PrincipalDashboard' ) EXEC('CREATE SCHEMA [EdFiX_PrincipalDashboard]'); GO /****** Object: Table [EdFiX_PrincipalDashboard].[Lookup] Script Date: 8/16/2020 7:08:27 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Print 'Create Lookup Table' Print '-----------------------------------------------------------' BEGIN IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'EdFiX_PrincipalDashboard' AND TABLE_NAME = 'Lookup') DROP TABLE [EdFiX_PrincipalDashboard].[Lookup]; PRINT 'Lookup Table Dropped' END CREATE TABLE [EdFiX_PrincipalDashboard].[Lookup]( [LOOKUP_TYPE] [varchar](250) NULL, [LOOKUP_NAME] [varchar](150) NULL, [LOOKUP_CODE] [varchar](50) NULL, [LOOKUP_CODE_DESC] [varchar](150) NULL, [LOOKUP_VALUE] [numeric](18, 0) NULL, [LOOKUP_VALUE_DESC] [varchar](150) NULL, [LOOKUP_CODE_DIST] [varchar](50) NULL, [LOOKUP_CODE_DESC_DIST] [varchar](150) NULL, [ACTIVE_FLG] [varchar](1) NULL ) ON [PRIMARY] GO PRINT 'Lookup Table Successfully Created' Print '-----------------------------------------------------------' /****** Object: Table [EdFiX_PrincipalDashboard].[Schools] Script Date: 8/16/2020 7:08:28 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Print 'Create Schools Table' Print '-----------------------------------------------------------' BEGIN IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'EdFiX_PrincipalDashboard' AND TABLE_NAME = 'Schools') DROP TABLE [EdFiX_PrincipalDashboard].[Schools]; PRINT 'Schools Table Dropped' END CREATE TABLE [EdFiX_PrincipalDashboard].[Schools]( [SchoolId] [int] NOT NULL, [NameOfInstitution] [nvarchar](75) NULL, [schooltype_description] [nvarchar](1024) NULL, [charterstatus_description] [nvarchar](1024) NULL, [titlepartschooldesignation_Description] [nvarchar](1024) NULL, [magnetspecialprogramemphasisschool_description] [nvarchar](1024) NULL, [adminstrativefundingcontrol_description] [nvarchar](1024) NULL, [internetaccess_Description] [nvarchar](1024) NULL, [Charterapprovalagency_description] [nvarchar](1024) NULL, [LocalEducationAgencyId] [int] NULL, [LocalEducationAgencyDescription] [nvarchar](1024) NULL, [AddressTypeDescriptorId] [int] NULL, [EOAddressTypeDesc] [nvarchar](1024) NULL, [ApartmentRoomSuiteNumber] [nvarchar](50) NULL, [BuildingSiteNumber] [nvarchar](20) NULL, [City] [nvarchar](30) NULL, [StreetNumberName] [nvarchar](150) NULL, [MailingDescription] [nvarchar](1024) NULL, [MailingApartmentRoomsuiteNumber] [nvarchar](50) NULL, [MailingBuildingSiteNumber] [nvarchar](20) NULL, [MailingCity] [nvarchar](30) NULL, [mailingStreetNumberName] [nvarchar](150) NULL, [Latitude] [nvarchar](20) NULL, [Longitude] [nvarchar](20) NULL, [Website] [nvarchar](255) NULL, [TelephoneNumber] [nvarchar](24) NULL, [TelephoneType] [nvarchar](1024) NULL, [Fax] [nvarchar](24) NULL, [Fax_type] [nvarchar](1024) NULL, [PrincipalName] [nvarchar](151) NULL, [PositionTitle] [nvarchar](100) NULL, [Description] [nvarchar](1024) NULL, [ShortDescription] [nvarchar](75) NULL, [PrincipalEmail] [nvarchar](128) NULL, [BeginDate] [date] NULL, [EndDate] [date] NULL, [principal_id] [int] NULL, [LoginId] [nvarchar](60) NULL ) ON [PRIMARY] GO PRINT 'Schools Table Successfully Created' Print '-----------------------------------------------------------' /****** Object: Table [EdFiX_PrincipalDashboard].[StudentAttendance] Script Date: 8/16/2020 7:08:28 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Print 'Create Student Attendance Table' Print '-----------------------------------------------------------' BEGIN IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'EdFiX_PrincipalDashboard' AND TABLE_NAME = 'StudentAttendance') DROP TABLE [EdFiX_PrincipalDashboard].[StudentAttendance]; PRINT 'StudentAttendance Table Dropped' END CREATE TABLE [EdFiX_PrincipalDashboard].[StudentAttendance]( [EventDate] [date] NULL, [LastModifiedDate] [datetime2](7) NOT NULL, [SchoolId] [int] NOT NULL, [EnrolledDate] [date] NULL, [StudentUSI] [int] NOT NULL, [PrimarySchool] [bit] NULL, [EntryGradeLevelDescriptorId] [nvarchar](75) NULL, [AttendanceEventCategoryDescriptorId] [int] NULL, [AttendaceEventCode] [nvarchar](50) NULL, [SchoolYear] [int] NULL, [RepeatGradeIndicator] [bit] NULL, [ClassOfSchoolYear] [int] NULL, [SchoolChoiceTransfer] [bit] NULL, [ExitWithdrawDate] [date] NULL, [ExitWithDrawDescriptorId] [int] NULL, [GraduationPlan] [int] NULL, [Month_Name] [nvarchar](4000) NULL, [HomelessId] [varchar](3) NULL, [ESLId] [varchar](3) NULL, [Race] [nvarchar](1024) NULL, [SpedID] [int] NULL, [MonthNumber] [int] NULL, [AttendanceEventReason] [nvarchar](40) NULL, [EnrollmentStatus] [int] NULL, [Present] [int] NULL, [ExcusedAbsent] [int] NULL, [UnExcusedAbsent] [int] NULL ) ON [PRIMARY] GO PRINT 'StudentAttendance Table Successfully Created' Print '-----------------------------------------------------------' /****** Object: Table [EdFiX_PrincipalDashboard].[Students] Script Date: 8/16/2020 7:08:28 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO PRINT 'Create Students Table' Print '-----------------------------------------------------------' BEGIN IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'EdFiX_PrincipalDashboard' AND TABLE_NAME = 'Students') DROP TABLE [EdFiX_PrincipalDashboard].[Students]; PRINT 'Students Table Dropped' END CREATE TABLE [EdFiX_PrincipalDashboard].[Students]( [LastModifiedDate] [datetime2](7) NOT NULL, [StudentUSI] [int] NOT NULL, [StudentUniqueId] [nvarchar](32) NOT NULL, [PersonalTitlePrefix] [nvarchar](30) NULL, [FirstName] [nvarchar](75) NULL, [MiddleName] [nvarchar](75) NULL, [LastSurname] [nvarchar](75) NULL, [GenerationCodeSuffix] [nvarchar](10) NULL, [MaidenName] [nvarchar](75) NULL, [BirthDate] [date] NULL, [BirthCity] [nvarchar](30) NULL, [BirthStateAbbreviationDescriptorId] [int] NULL, [BirthCountry] [nvarchar](1024) NULL, [BirthInternationalProvince] [nvarchar](150) NULL, [DateEnteredUS] [date] NULL, [MultipleBirthStatus] [bit] NULL, [BirthSex] [nvarchar](1024) NULL, [CitizenshipStatus] [nvarchar](1024) NULL, [HomelessProgram] [varchar](3) NULL, [LanguageClassification] [nvarchar](75) NULL, [LowSES] [int] NULL, [SpecialGroupLookupCode] [int] NULL, [EL] [varchar](3) NULL, [Race] [nvarchar](75) NULL, [Sped] [varchar](3) NULL, [AwaitingFosterCare] [bit] NULL, [SchoolYear] [smallint] NULL, [EntryGradeLevelDescriptorId] [int] NULL, [GradeLevel] [nvarchar](75) NULL, [GraduationPlanTypeDescriptorId] [int] NULL, [GraduationPlanTypeDescription] [nvarchar](1024) NULL, [cohort] [smallint] NULL, [ParentName] [nvarchar](151) NULL, [PrimaryContactStatus] [bit] NULL, [EmergencyContactStatus] [bit] NULL, [LivesWith] [bit] NULL, [ContactPriority] [int] NULL, [ContactRestrictions] [nvarchar](250) NULL, [StreetNumberName] [nvarchar](150) NULL, [ApartmentRoomSuiteNumber] [nvarchar](50) NULL, [City] [nvarchar](30) NULL, [NameOfCounty] [nvarchar](30) NULL, [ParentEmailaddress] [nvarchar](128) NULL, [Latitude] [nvarchar](20) NULL, [Longitude] [nvarchar](20) NULL, [ProgramTypeDescriptorId] [int] NULL, [ProgramTypeDescriptionMealOfferings] [nvarchar](1024) NULL, [ELLimitlevel] [nvarchar](1024) NULL, [StudentPhoto] [int] NULL, [NoOfStudent] [bigint] NULL ) ON [PRIMARY] GO PRINT 'Students Table Successfully Created' Print '-----------------------------------------------------------' /****** Object: Table [EdFiX_PrincipalDashboard].[Students] Script Date: 8/16/2020 7:08:28 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO PRINT 'Insert Lookup Table Values' Print '-----------------------------------------------------------' BEGIN IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'EdFiX_PrincipalDashboard' AND TABLE_NAME = 'Lookup') PRINT 'Table Students Exists, Insert master data to this table' INSERT INTO [EdFiX_PrincipalDashboard].[Lookup] VALUES ( 'PRESENT_LOOKUP_CODE','','','In Attendance',1,'','','','Y'), ( 'PRESENT_LOOKUP_CODE','','','Partial',1,'','','','Y'), ( 'PRESENT_LOOKUP_CODE','','','Tardy',1,'','','','Y'), ( 'PRESENT_LOOKUP_CODE','','','Early departure',1,'','','','Y'), ( 'EXABS_LOOKUP_CODE','','','Excused Absence',1,'','','','Y'), ( 'UNEXABS_LOOKUP_CODE','','','Unexcused Absence',1,'','','','Y'), ( 'SCHOOL_YEAR','','','School Year',2010,'','','','N'), ( 'SCHOOL_YEAR','','','School Year',2011,'','','','Y'), ( 'SCHOOL_YEAR','','','School Year',2012,'','','','N') END; GO PRINT 'Insert Rows to Lookup Successfully Completed' Print '-----------------------------------------------------------' /****** Object: StoredProcedure [EdFiX_PrincipalDashboard].[AttendanceData] Script Date: 8/16/2020 7:08:28 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO PRINT 'Create Attendance data Procedure' Print '-----------------------------------------------------------' GO CREATE OR ALTER PROCEDURE [EdFiX_PrincipalDashboard].[AttendanceData] as BEGIN DELETE FROM [EdFiX_PrincipalDashboard].StudentAttendance WHERE SchoolYear in (Select Lookup_Value From [EdFiX_PrincipalDashboard].Lookup Where Lookup_Type = 'SCHOOL_YEAR' and Active_Flg = 'Y'); WITH max_cal AS (SELECT case when max(schoolyear) = YEAR(GETDATE())+1 and MONTH(GETDATE()) in (8,9,10,11,12) then GETDATE() else max(Date) end SchoolEndDate FROM edfi.CalendarDate WHERE schoolyear = (SELECT lookup_value FROM [EdFiX_PrincipalDashboard].[Lookup] WHERE lookup_type = 'SCHOOL_YEAR' AND active_flg = 'Y')) , enroll_date AS (SELECT Dateadd(d, v.number, d.entrydate) adate, studentusi, schoolid, d.primaryschool, d.entrygradeleveldescriptorid, d.entrygradelevelreasondescriptorid, d.repeatgradeindicator, d.classofschoolyear, d.schoolchoicetransfer, d.exitwithdrawdate, d.exitwithdrawtypedescriptorid, d.graduationplantypedescriptorid, d.educationorganizationid, d.graduationschoolyear, d.employedwhileenrolled, d.calendarcode, D.schoolyear, d.lastmodifieddate FROM edfi.studentschoolassociation d JOIN max_cal ON 1=1 JOIN master..spt_values v ON v.type = 'P' AND v.number BETWEEN 0 AND Datediff(d, entrydate, Try_convert(date, COALESCE(d.exitwithdrawdate, max_cal.SchoolEndDate), 102)) WHERE EXISTS (SELECT 1 FROM edfi.studentschoolattendanceevent att WHERE d.studentusi = att.studentusi AND d.schoolid = att.schoolid)), enr AS (SELECT adate Date, Datepart(MONTH, date) MonthNumber, Format(date, 'MMM') Month_Name, studentusi, enroll_date.schoolid, primaryschool, entrygradeleveldescriptorid, entrygradelevelreasondescriptorid, repeatgradeindicator, classofschoolyear, schoolchoicetransfer, exitwithdrawdate, exitwithdrawtypedescriptorid, graduationplantypedescriptorid, educationorganizationid, graduationschoolyear, employedwhileenrolled, enroll_date.calendarcode, cd.schoolyear, enroll_date.lastmodifieddate FROM enroll_date JOIN edfi.calendardate cd ON (enroll_date.adate = cd.[date] AND enroll_date.schoolid = cd.schoolid) WHERE cd.schoolyear = (SELECT lookup_value FROM [EdFiX_PrincipalDashboard].[Lookup] WHERE lookup_type = 'SCHOOL_YEAR' AND active_flg = 'Y')), stud_det AS (SELECT DISTINCT att.eventdate, enr.lastmodifieddate, enr.schoolid, enr.date EnrolledDate , enr.studentusi, enr.primaryschool, egl.shortdescription EntryGradeLevelDescriptorId, att.attendanceeventcategorydescriptorid, dsc.codevalue AttendaceEventCode, Try_convert(int, enr.schoolyear) SchoolYear, enr.repeatgradeindicator, Try_convert(int, enr.classofschoolyear) ClassOfSchoolYear, enr.schoolchoicetransfer, Try_convert(date, enr.exitwithdrawdate, 102) ExitWithdrawDate, Try_convert(int, enr.exitwithdrawtypedescriptorid) ExitWithDrawDescriptorId, enr.graduationplantypedescriptorid GraduationPlan, enr.month_name, CASE WHEN hlp.programtypedescriptorid IS NULL THEN 'No' ELSE 'Yes' END HomelessId, CASE WHEN lip.programtypedescriptorid IS NULL THEN 'No' ELSE 'Yes' END ESLId, rcdesc.description Race , sped.programtypedescriptorid SpedID, Try_convert(int, enr.monthnumber) AS MonthNumber, att.attendanceeventreason, CASE WHEN enr.date IS NULL THEN 0 ELSE 1 END EnrollmentStatus, Try_convert(int, CASE WHEN COALESCE(dsc.codevalue, 'In Attendance') IN (SELECT lookup_code_desc FROM [EdFiX_PrincipalDashboard].[Lookup] WHERE lookup_type = 'PRESENT_LOOKUP_CODE' AND active_flg = 'Y') THEN 1 ELSE 0 END) AS Present, Try_convert(int, CASE WHEN dsc.codevalue IN (SELECT lookup_code_desc FROM [EdFiX_PrincipalDashboard].[Lookup] WHERE lookup_type = 'EXABS_LOOKUP_CODE' AND active_flg = 'Y') THEN 1 ELSE 0 END) AS ExcusedAbsent, Try_convert(int, CASE WHEN dsc.codevalue IN (SELECT lookup_code_desc FROM [EdFiX_PrincipalDashboard].[Lookup] WHERE lookup_type = 'UNEXABS_LOOKUP_CODE' AND active_flg = 'Y') THEN 1 ELSE 0 END) AS UnExcusedAbsent FROM enr LEFT OUTER JOIN edfi.school sc ON (sc.schoolid = enr.schoolid) LEFT OUTER JOIN edfi.studentschoolattendanceevent att ON (att.studentusi = enr.studentusi AND enr.date = att.eventdate AND enr.schoolyear = att.schoolyear) LEFT OUTER JOIN edfi.descriptor dsc ON (att.attendanceeventcategorydescriptorid = dsc.descriptorid) LEFT OUTER JOIN edfi.descriptor egl ON (enr.entrygradeleveldescriptorid = egl.descriptorid) LEFT OUTER JOIN edfi.descriptor ext ON (Try_convert(int, enr.exitwithdrawtypedescriptorid) = ext.descriptorid) LEFT OUTER JOIN edfi.descriptor grd ON (enr.graduationplantypedescriptorid = grd.descriptorid) INNER JOIN edfi.student stu ON (enr.studentusi = stu.studentusi) LEFT OUTER JOIN edfi.studenthomelessprogramassociation hlp ON (enr.studentusi = hlp.studentusi) LEFT OUTER JOIN (SELECT lip.*, lipdesc.CodeValue, lipdesc.Description, lipdesc.ShortDescription FROM edfi.generalstudentprogramassociation lip JOIN edfi.Descriptor lipdesc ON lip.programtypedescriptorid = lipdesc.Descriptorid) lip ON (enr.studentusi = lip.studentusi AND enr.schoolid = lip.educationorganizationid AND lip.codevalue = 'English as a Second Language (ESL)' AND enr.date = lip.begindate AND enr.exitwithdrawdate = lip.enddate) LEFT OUTER JOIN (SELECT * FROM (SELECT Row_number() OVER(PARTITION BY educationorganizationid, studentusi ORDER BY studentusi) rownum, studentusi, educationorganizationid, racedescriptorid FROM edfi.studenteducationorganizationassociationrace) ac WHERE rownum = 1) rc ON (enr.studentusi = rc.studentusi) LEFT OUTER JOIN edfi.descriptor rcdesc ON (rc.racedescriptorid = rcdesc.descriptorid) LEFT OUTER JOIN edfi.studentspecialeducationprogramassociation sped ON (enr.studentusi = sped.studentusi)) INSERT INTO [EdFiX_PrincipalDashboard].studentattendance SELECT * FROM stud_det END GO PRINT 'Procedure Attendance Data Successfully Created' Print '-----------------------------------------------------------' /****** Object: StoredProcedure [EdFiX_PrincipalDashboard].[SchoolData] Script Date: 8/16/2020 7:08:28 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO PRINT 'Create School Data Procedure' Print '-----------------------------------------------------------' GO CREATE OR ALTER PROCEDURE [EdFiX_PrincipalDashboard].[SchoolData] as BEGIN TRUNCATE TABLE [EdFiX_PrincipalDashboard].Schools; DECLARE @PrincipalType nvarchar(50); SET @PrincipalType = 'Principal High School'; WITH sch AS (SELECT DISTINCT s.schoolid, eo.nameofinstitution NameOfInstitution, stdesc.description schooltype_description, csdesc.description charterstatus_description, titschdesgdesc.description titlepartschooldesignation_Description, mspesd.description magnetspecialprogramemphasisschool_description, afcdesc.description adminstrativefundingcontrol_description, iadesc.description internetaccess_Description, chappagtype.description Charterapprovalagency_description, s.localeducationagencyid, loedag.description LocalEducationAgencyDescription, eoaddr.addresstypedescriptorid, eoaddr.description EOAddressTypeDesc, eoaddr.apartmentroomsuitenumber, eoaddr.buildingsitenumber, eoaddr.city, mailing.streetnumbername streetnumbername, mailing.description MailingDescription, mailing.apartmentroomsuitenumber MailingApartmentRoomsuiteNumber, mailing.buildingsitenumber MailingBuildingSiteNumber, mailing.city MailingCity, mailing.streetnumbername mailingStreetNumberName, eoaddr.latitude, eoaddr.longitude, eo.website Website , eotel.telephonenumber TelephoneNumber, eotel.description TelephoneType, fax.telephonenumber Fax, fax.description Fax_type, Concat(prin_name.firstname, ' ', prin_name.lastsurname) PrincipalName, prin.positiontitle, prindesc.description, prindesc.shortdescription, pemail.electronicmailaddress PrincipalEmail, prin.begindate, prin.enddate, prin_name.staffusi principal_id, prin_name.loginid FROM edfi.school s LEFT OUTER JOIN edfi.educationorganization eo ON (s.schoolid = eo.educationorganizationid) LEFT OUTER JOIN edfi.descriptor stdesc ON (s.schooltypedescriptorid = stdesc.descriptorid) LEFT OUTER JOIN edfi.descriptor csdesc ON (s.charterstatusdescriptorid = csdesc.descriptorid) LEFT OUTER JOIN edfi.descriptor titschdesgdesc ON (s.titleipartaschooldesignationdescriptorid = titschdesgdesc.descriptorid) LEFT OUTER JOIN edfi.descriptor mspesd ON (s.magnetspecialprogramemphasisschooldescriptorid = mspesd.descriptorid) LEFT OUTER JOIN edfi.descriptor afcdesc ON (s.administrativefundingcontroldescriptorid = afcdesc.descriptorid) LEFT OUTER JOIN edfi.descriptor iadesc ON (s.internetaccessdescriptorid = iadesc.descriptorid) LEFT OUTER JOIN edfi.descriptor chappagtype ON (s.charterapprovalagencytypedescriptorid = chappagtype.descriptorid) LEFT OUTER JOIN (SELECT le.localeducationagencyid, d.description FROM edfi.localeducationagency le, edfi.localeducationagencycategorydescriptor l , edfi.descriptor d WHERE l.localeducationagencycategorydescriptorid = d.descriptorid AND le.localeducationagencycategorydescriptorid = l.localeducationagencycategorydescriptorid) loedag ON (s.localeducationagencyid = loedag.localeducationagencyid) LEFT OUTER JOIN (SELECT eoaddr.addresstypedescriptorid, eoaddr.educationorganizationid, eoaddrdesc.description, eoaddr.apartmentroomsuitenumber, eoaddr.buildingsitenumber, eoaddr.city, latitude, longitude FROM edfi.educationorganizationaddress eoaddr, edfi.descriptor eoaddrdesc WHERE eoaddr.addresstypedescriptorid = eoaddrdesc.descriptorid AND eoaddrdesc.CodeValue = 'Physical') eoaddr ON (eo.educationorganizationid = eoaddr.educationorganizationid) LEFT OUTER JOIN (SELECT fax.telephonenumber, fax.educationorganizationid, faxtype.description FROM edfi.educationorganizationinstitutiontelephone fax, edfi.descriptor faxtype WHERE fax.institutiontelephonenumbertypedescriptorid = faxtype.descriptorid AND faxtype.CodeValue = 'Main') eotel ON (eo.educationorganizationid = eotel.educationorganizationid) LEFT OUTER JOIN (SELECT educationorganizationid, staffclassificationdescriptorid, staffusi, positiontitle, begindate, enddate, Row_number() OVER ( ORDER BY staffusi ASC) AS rownum FROM edfi.staffeducationorganizationassignmentassociation WHERE positiontitle LIKE @PrincipalType) prin ON (eo.educationorganizationid = prin.educationorganizationid AND rownum = 1) LEFT OUTER JOIN (SELECT fax.telephonenumber, fax.educationorganizationid, faxtype.description FROM edfi.educationorganizationinstitutiontelephone fax, edfi.descriptor faxtype WHERE fax.institutiontelephonenumbertypedescriptorid = faxtype.descriptorid AND faxtype.CodeValue = 'fax')fax ON (s.schoolid = fax.educationorganizationid) LEFT OUTER JOIN edfi.staff prin_name ON (prin.staffusi = prin_name.staffusi) LEFT OUTER JOIN edfi.descriptor prindesc ON (prin.staffclassificationdescriptorid = prindesc.descriptorid) LEFT OUTER JOIN edfi.staffelectronicmail pemail ON (prin.staffusi = pemail.staffusi) LEFT OUTER JOIN (SELECT mailtype.description, mail.educationorganizationid, mail.apartmentroomsuitenumber, mail.buildingsitenumber, mail.city, mail.streetnumbername FROM edfi.educationorganizationaddress mail, edfi.descriptor mailtype WHERE mail.addresstypedescriptorid = mailtype.descriptorid AND mailtype.CodeValue = 'mailing') mailing ON (s.schoolid = mailing.educationorganizationid)) INSERT INTO [EdFiX_PrincipalDashboard].schools SELECT * FROM sch END GO PRINT 'Procedure School Data Successfully Created' Print '-----------------------------------------------------------' /****** Object: StoredProcedure [EdFiX_PrincipalDashboard].[StudentData] Script Date: 8/16/2020 7:08:28 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO PRINT 'Create Student Data Procedure' Print '-----------------------------------------------------------' GO CREATE OR ALTER PROCEDURE [EdFiX_PrincipalDashboard].[StudentData] as BEGIN TRUNCATE TABLE [EdFiX_PrincipalDashboard].Students; WITH mulrace AS (SELECT studentusi, educationorganizationid, Count(racedescriptorid) rccnt FROM edfi.studenteducationorganizationassociationrace GROUP BY studentusi, educationorganizationid), mulracedesc AS (SELECT mr.studentusi, CASE WHEN mr.rccnt > 1 THEN 'MultiRacial' ELSE rcdesc.shortdescription END Description FROM mulrace mr JOIN edfi.studenteducationorganizationassociationrace mrr ON (mr.studentusi = mrr.studentusi) JOIN edfi.descriptor rcdesc ON (mrr.racedescriptorid = rcdesc.descriptorid)), stud_det AS (SELECT DISTINCT st.studentusi, st.studentuniqueid StudentUniqueId, st.lastmodifieddate, st.personaltitleprefix, st.firstname FirstName, st.middlename MiddleName, st.lastsurname LastSurname, st.generationcodesuffix, st.maidenname, st.birthdate, st.birthcity, st.birthstateabbreviationdescriptorid, bcdsc.description AS BirthCountry, st.birthinternationalprovince, st.dateenteredus, st.multiplebirthstatus, bsdsc.description AS BirthSex, csdsc.description AS CitizenshipStatus, CASE WHEN hlp.programname IS NOT NULL THEN 'Yes' ELSE 'No' END HomelessProgram, CASE WHEN stlangdesc.shortdescription IS NULL THEN 'Unknown Lang' ELSE stlangdesc.shortdescription END LanguageClassification, NULL LowSES, NULL SpecialGroupLookupCode, CASE WHEN el.programname IS NOT NULL THEN 'Yes' ELSE 'No' END EL, race.description Race, CASE WHEN sped.programname IS NOT NULL THEN 'Yes' ELSE 'No' END Sped, hlp.awaitingfostercare, ssa.schoolyear, ssa.entrygradeleveldescriptorid, gdesc.shortdescription GradeLevel, ssa.graduationplantypedescriptorid, gpdesc.description GraduationPlanTypeDescription, ssa.graduationschoolyear cohort, par_det.parentname, par_det.primarycontactstatus, par_det.emergencycontactstatus, par_det.liveswith, par_det.contactpriority, par_det.contactrestrictions, par_det.streetnumbername StreetNumberName, par_det.apartmentroomsuitenumber, par_det.city, par_det.nameofcounty, par_det.parentemailaddress, par_det.latitude, par_det.longitude, mprg.programtypedescriptorid, mprgdesc.description ProgramTypeDescriptionMealOfferings , eldesc.description ELLimitlevel, NULL AS StudentPhoto FROM edfi.student st LEFT OUTER JOIN edfi.studenteducationorganizationassociation ellvl ON (ellvl.studentusi = st.studentusi) LEFT OUTER JOIN edfi.descriptor eldesc ON (eldesc.descriptorid = ellvl.limitedenglishproficiencydescriptorid) LEFT OUTER JOIN mulracedesc race ON (race.studentusi = st.studentusi) LEFT OUTER JOIN edfi.studenthomelessprogramassociation hlp ON (st.studentusi = hlp.studentusi) LEFT OUTER JOIN edfi.studentlanguageinstructionprogramassociation el ON (st.studentusi = el.studentusi) LEFT OUTER JOIN edfi.descriptor bcdsc ON (Try_convert(int, st.birthcountrydescriptorid) = bcdsc.descriptorid) LEFT OUTER JOIN edfi.descriptor csdsc ON (Try_convert(int, st.citizenshipstatusdescriptorid) = csdsc.descriptorid) LEFT OUTER JOIN edfi.studenteducationorganizationassociation stsex ON (st.studentusi = stsex.studentusi) LEFT OUTER JOIN edfi.descriptor bsdsc ON (Try_convert(int, stsex.sexdescriptorid) = bsdsc.descriptorid) LEFT OUTER JOIN edfi.studentspecialeducationprogramassociation sped ON (st.studentusi = sped.studentusi) LEFT OUTER JOIN edfi.studentschoolassociation ssa ON (st.studentusi = ssa.studentusi) INNER JOIN edfi.school sc ON (ssa.schoolid = sc.schoolid) LEFT OUTER JOIN edfi.descriptor gdesc ON (ssa.entrygradeleveldescriptorid = gdesc.descriptorid) LEFT OUTER JOIN (SELECT DISTINCT a.studentusi, b.contactpriority, b.contactrestrictions, b.emergencycontactstatus, b.liveswith, b.primarycontactstatus, paddr.streetnumbername, paddr.apartmentroomsuitenumber, paddr.city, paddr.nameofcounty, paddr.latitude, paddr.longitude, Concat(c.firstname, ' ', c.lastsurname) ParentName, pe.electronicmailaddress ParentEmailaddress FROM edfi.student a LEFT JOIN edfi.studentparentassociation b ON (a.studentusi = b.studentusi AND b.primarycontactstatus = 1) LEFT JOIN edfi.parent c ON (b.parentusi = c.parentusi) LEFT JOIN edfi.descriptor d ON (b.relationdescriptorid = d.descriptorid) LEFT JOIN edfi.parentelectronicmail pe ON (c.parentusi = pe.parentusi) LEFT JOIN (SELECT stdaddr.*, dscaddr.CodeValue, dscaddr.Description, dscaddr.ShortDescription FROM edfi.studenteducationorganizationassociationaddress stdaddr JOIN edfi.descriptor dscaddr ON stdaddr.addresstypedescriptorid = dscaddr.descriptorid) paddr ON (a.studentusi = paddr.studentusi AND paddr.codeValue = 'Home')) par_det ON (st.studentusi = par_det.studentusi) LEFT OUTER JOIN edfi.descriptor gpdesc ON (gpdesc.descriptorid = ssa.graduationplantypedescriptorid) LEFT OUTER JOIN edfi.studentschoolfoodserviceprogramassociation mprg ON (st.studentusi = mprg.studentusi) LEFT OUTER JOIN edfi.descriptor mprgdesc ON (mprg.programtypedescriptorid = mprgdesc.descriptorid) LEFT OUTER JOIN edfi.studenteducationorganizationassociationlanguage stulang ON (st.studentusi = stulang.studentusi) LEFT OUTER JOIN edfi.descriptor stlangdesc ON (stulang.languagedescriptorid = stlangdesc.descriptorid)), reyum_dup AS (SELECT lastmodifieddate, studentusi, studentuniqueid, personaltitleprefix, firstname, middlename, lastsurname, generationcodesuffix, maidenname, birthdate, birthcity, birthstateabbreviationdescriptorid, birthcountry, birthinternationalprovince, dateenteredus, multiplebirthstatus, birthsex, citizenshipstatus, homelessprogram, languageclassification, lowses, specialgrouplookupcode, el, race, sped, awaitingfostercare, schoolyear, entrygradeleveldescriptorid, gradelevel, graduationplantypedescriptorid, graduationplantypedescription, cohort, parentname, primarycontactstatus, emergencycontactstatus, liveswith, contactpriority, contactrestrictions, streetnumbername, apartmentroomsuitenumber, city, nameofcounty, parentemailaddress, latitude, longitude, programtypedescriptorid, programtypedescriptionmealofferings, ellimitlevel, NULL AS StudentPhoto, Row_number() OVER(PARTITION BY studentusi ORDER BY gradelevel DESC) NoOfStudent FROM stud_det) INSERT INTO [EdFiX_PrincipalDashboard].Students SELECT * FROM reyum_dup WHERE noofstudent = 1 END GO PRINT 'Procedure Student Data Successfully Created' Print '-----------------------------------------------------------'
<reponame>mi-erasmusmc/CommonEvidenceModel /*@vocabSchema*/ IF OBJECT_ID('@tableName', 'U') IS NOT NULL DROP TABLE @tableName; SELECT * INTO @tableName FROM @sourceSchema.@sourceId; ALTER TABLE @tableName OWNER TO RW_GRP;
-- phpMyAdmin SQL Dump -- version 4.0.10.6 -- http://www.phpmyadmin.net -- -- Хост: 127.0.0.1:3306 -- Время создания: Апр 22 2015 г., 23:44 -- Версия сервера: 5.5.41-log -- Версия PHP: 5.4.35 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 utf8 */; -- -- База данных: `git` -- -- -------------------------------------------------------- -- -- Структура таблицы `project_likes` -- CREATE TABLE IF NOT EXISTS `project_likes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `project_name` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; -- -- Дамп данных таблицы `project_likes` -- INSERT INTO `project_likes` (`id`, `project_name`) VALUES (1, 'yiisoft_yii'); -- -------------------------------------------------------- -- -- Структура таблицы `tbl_migration` -- CREATE TABLE IF NOT EXISTS `tbl_migration` ( `version` varchar(180) NOT NULL, `apply_time` int(11) DEFAULT NULL, PRIMARY KEY (`version`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `tbl_migration` -- INSERT INTO `tbl_migration` (`version`, `apply_time`) VALUES ('m000000_000000_base', 1429695100), ('m150419_160742_likes', 1429695124); -- -------------------------------------------------------- -- -- Структура таблицы `users_likes` -- CREATE TABLE IF NOT EXISTS `users_likes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_login` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; -- -- Дамп данных таблицы `users_likes` -- INSERT INTO `users_likes` (`id`, `user_login`) VALUES (1, 'samdark'), (2, 'cebe'), (3, 'qiangxue'); /*!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 */;
<reponame>opengauss-mirror/Yat -- @testpoint:opengauss关键字get(非保留),作为模式名 --关键字不带引号-成功 drop schema if exists get; create schema get; drop schema get; --关键字带双引号-成功 drop schema if exists "get"; create schema "get"; drop schema "get"; --关键字带单引号-合理报错 drop schema if exists 'get'; create schema 'get'; --关键字带反引号-合理报错 drop schema if exists `get`; create schema `get`;
<gh_stars>0 -- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: 2018-12-19 03:27:28 -- 服务器版本: 10.1.28-MariaDB -- PHP Version: 5.6.32 SET NAMES UTF8; DROP DATABASE IF EXISTS manluotuo; CREATE DATABASE manluotuo CHARSET=UTF8; USE manluotuo; SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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: `manluotuo` -- -- -------------------------------------------------------- -- -- 表的结构 `cart` -- CREATE TABLE `cart` ( `iid` int(11) NOT NULL, `uid` int(11) DEFAULT NULL, `pid` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, `is_checked` tinyint(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `cart` -- INSERT INTO `cart` (`iid`, `uid`, `pid`, `count`, `is_checked`) VALUES (72, 74, 1, 2, 0), (74, 1, 1, 1, 0), (75, 1, 2, 1, 0), (76, 74, 2, 1, 0); -- -------------------------------------------------------- -- -- 表的结构 `product` -- CREATE TABLE `product` ( `pid` int(11) NOT NULL, `family_id` int(11) DEFAULT NULL, `title` varchar(128) DEFAULT NULL, `price` decimal(10,2) DEFAULT NULL, `oldprice` decimal(10,2) DEFAULT NULL, `brand` varchar(64) DEFAULT NULL, `stock` int(11) DEFAULT NULL, `type` varchar(32) DEFAULT NULL, `goodPic` varchar(256) DEFAULT NULL, `detailPic` mediumtext, `indexPic` varchar(256) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `product` -- INSERT INTO `product` (`pid`, `family_id`, `title`, `price`, `oldprice`, `brand`, `stock`, `type`, `goodPic`, `detailPic`, `indexPic`) VALUES (1, 1, '漫骆驼官方出品 少司命手办-《秦时明月》十周年纪念版手办 myethos 正版', '628.00', '628.00', 'myethos', 20, '现货628', 'http://127.0.0.1:3000/img/good-detail/01-1-big.jpg http://127.0.0.1:3000/img/good-detail/01-2-big.jpg http://127.0.0.1:3000/img/good-detail/01-3-big.jpg', 'http://127.0.0.1:3000/img/good-detail/01-detail-0.jpg http://127.0.0.1:3000/img/good-detail/01-detail-1.jpg http://127.0.0.1:3000/img/good-detail/01-detail-2.jpg http://127.0.0.1:3000/img/good-detail/01-detail-3.jpg http://127.0.0.1:3000/img/good-detail/01-detail-4.jpg http://127.0.0.1:3000/img/good-detail/01-detail-5.jpg http://127.0.0.1:3000/img/good-detail/01-detail-6.jpg http://127.0.0.1:3000/img/good-detail/01-detail-7.jpg http://127.0.0.1:3000/img/good-detail/01-detail-8.jpg http://127.0.0.1:3000/img/good-detail/01-detail-9.jpg', 'http://127.0.0.1:3000/img/product/pro1.jpg'), (2, 2, '城户丈哥玛兽MegaHouse手办-《数码宝贝》Megahouse G.E.M 数码宝贝大冒险', '179.00', '399.00', '数码宝贝', 10, '现货179', 'http://127.0.0.1:3000/img/good-detail/02-1-big.jpg http://127.0.0.1:3000/img/good-detail/02-2-big.jpg http://127.0.0.1:3000/img/good-detail/02-3-big.jpg', 'http://127.0.0.1:3000/img/good-detail/02-detail-1.jpg http://127.0.0.1:3000/img/good-detail/02-detail-2.jpg http://127.0.0.1:3000/img/good-detail/02-detail-3.jpg http://127.0.0.1:3000/img/good-detail/02-detail-4.jpg http://1172.16.58.3:3000/img/good-detail/02-detail-5.jpg http://127.0.0.1:3000/img/good-detail/02-detail-6.jpg http://127.0.0.1:3000/img/good-detail/02-detail-6.jpg http://127.0.0.1:3000/img/good-detail/02-detail-6.jpg http://127.0.0.1:3000/img/good-detail/02-detail-7.jpg http://127.0.0.1:3000/img/good-detail/02-detail-8.jpg', 'http://127.0.0.1:3000/img/product/pro2.jpg'); -- -------------------------------------------------------- -- -- 表的结构 `xz_user` -- CREATE TABLE `xz_user` ( `uid` int(11) NOT NULL, `uname` varchar(32) DEFAULT NULL, `upwd` varchar(32) DEFAULT NULL, `email` varchar(64) DEFAULT NULL, `phone` varchar(16) DEFAULT NULL, `avatar` varchar(128) DEFAULT NULL, `user_name` varchar(32) DEFAULT NULL, `gender` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `xz_user` -- INSERT INTO `xz_user` (`uid`, `uname`, `upwd`, `email`, `phone`, `avatar`, `user_name`, `gender`) VALUES (1, 'dingding', '123456', '<EMAIL>', '13501234567', 'img/avatar/default.png', '丁伟', 1), (2, 'dangdang', '123456', '<EMAIL>', '13501234568', 'img/avatar/default.png', '林当', 1), (3, 'doudou', '123456', '<EMAIL>', '13501234569', 'img/avatar/default.png', '窦志强', 1), (4, 'yaya', '123456', '<EMAIL>', '13501234560', 'img/avatar/default.png', '秦小雅', 0), (74, 'lyyolyy', '2655814', '', '', NULL, '', 0), (75, 'lyyolyy1', '2655814', '', '', NULL, '', 0), (76, 'lyyolyy2', '123456', '<EMAIL>', '2655814', NULL, '丁伟20', 2), (77, 'lyyolyy5', '123456', '', '', NULL, '', 1), (78, '问问', '123456', '', '', NULL, '', 1), (79, 'lyyolyy3', '123456', '<EMAIL>', NULL, NULL, NULL, 0), (80, 'lyyolyy4', '123456', '<EMAIL>', NULL, NULL, NULL, 0), (81, 'lyyolyy123', '123456', '<EMAIL>', NULL, NULL, NULL, 0), (82, 'hususu', '123456', '<EMAIL>', NULL, NULL, NULL, 0), (83, 'lyyolyy22', '123456', '<EMAIL>', NULL, NULL, NULL, 0), (84, 'lyyolyy33', '123456', 'ding<EMAIL>', NULL, NULL, NULL, 0); -- -- Indexes for dumped tables -- -- -- Indexes for table `cart` -- ALTER TABLE `cart` ADD PRIMARY KEY (`iid`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`pid`); -- -- Indexes for table `xz_user` -- ALTER TABLE `xz_user` ADD PRIMARY KEY (`uid`); -- -- 在导出的表使用AUTO_INCREMENT -- -- -- 使用表AUTO_INCREMENT `cart` -- ALTER TABLE `cart` MODIFY `iid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=77; -- -- 使用表AUTO_INCREMENT `product` -- ALTER TABLE `product` MODIFY `pid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- 使用表AUTO_INCREMENT `xz_user` -- ALTER TABLE `xz_user` MODIFY `uid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=85; 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 */; --创建表的结构 `home` # DECIMAL 高精度浮点数 CREATE TABLE home( pid INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255), img_url VARCHAR(255), price DECIMAL(15,2), oldprice DECIMAL(15,2), brand VARCHAR(255) ); --插入数据 INSERT INTO home VALUES(null,'园田海未OP装良笑社粘土人510-《Love Live》良笑社 No.510 Q版粘土人','http://127.0.0.1:3000/product/home1.jpg',175,210,'Good Smile Company No.510'), (null,'站立版Saber新娘版SEGA景品-《Fate Extra CCC》 SEGA 景品手办','http://127.0.0.1:3000/product/home2.jpg',95,0,'良笑社 Fare Extra CCC 新娘Ver.'), (null,'皮卡丘眼镜厂挂件-《口袋妖怪》眼镜厂 毛绒钥匙挂件特价(随机发货)','http://127.0.0.1:3000/product/home3.jpg',11,13.2,'眼镜厂 毛绒钥匙挂件'), (null,'双叶杏景品-《偶像大师》眼镜厂 SQ系列 景品手办','http://127.0.0.1:3000/product/home4.jpg',75,90,'眼镜厂 SQ景品 Candy Island'), (null,'定春长款钱包-《银魂》 万事屋吉祥物 正版拉链钱包 现货','http://127.0.0.1:3000/product/home5.jpg',22,26.4,'漫能 万事屋吉祥物'); CREATE TABLE login( id INT PRIMARY KEY AUTO_INCREMENT, uname VARCHAR(25), upwd VARCHAR(32), email VARCHAR(50) check (email like '%@%'), level VARCHAR(32) DEFAULT NULL, integral VARCHAR(32) DEFAULT NULL ); INSERT INTO login VALUES (null,'dingding',md5('123456'),'<EMAIL>','注册用户','30'), (null,'dangdang',md5('654321'),'<EMAIL>','金卡用户','9999'); #md5密码加密 理解:用户输入123对 用户密码的内容加密 CREATE TABLE Category_product( pid INT PRIMARY KEY, family_id INT(11) DEFAULT NULL, title VARCHAR(128) DEFAULT NULL, price DECIMAL(10,2) DEFAULT NULL, oldprice DECIMAL(10,2) DEFAULT NULL, brand VARCHAR(64) DEFAULT NULL, stock VARCHAR(32) DEFAULT NULL, imagePic VARCHAR(256) DEFAULT NULL, categoryPic VARCHAR(256) DEFAULT NULL, goodsPic VARCHAR(256) DEFAULT NULL, cartPic VARCHAR(256) DEFAULT NULL ); INSERT INTO Category_product VALUES (1,1,'园田海未OP装良笑社粘土人510-《Love Live》良笑社 No.510 Q版粘土人',175,210,'Love Live','暂时缺货','http://1172.16.58.3:3000/xq/1.jpg','http://127.0.0.1:3000/xq/1.jpg http://127.0.0.1:3000/xq/12.jpg http://127.0.0.1:3000/xq/13.jpg','http://127.0.0.1:3000/xq/14.jpg http://127.0.0.1:3000/xq/15.jpg http://127.0.0.1:3000/xq/16.jpg http://127.0.0.1:3000/xq/19.jpg','http://127.0.0.1:3000/xq/1.jpg'), (2,2,'站立版Saber新娘版SEGA景品-《Fate Extra CCC》 SEGA 景品手办',95,0,'Fate stay night','暂时缺货','http://127.0.0.1:3000/xq/2.jpg','http://127.0.0.1:3000/xq/2.jpg http://127.0.0.1:3000/xq/21.jpg http://127.0.0.1:3000/xq/21.jpg','http://127.0.0.1:3000/xq/22.jpg http://127.0.0.1:3000/xq/23.jpg http://127.0.0.1:3000/xq/24.jpg http://127.0.0.1:3000/xq/30.jpg','http://127.0.0.1:3000/xq/2.jpg'), (3,3,'皮卡丘眼镜厂挂件-《口袋妖怪》眼镜厂 毛绒钥匙挂件特价(随机发货)',11,13.2,'口袋妖怪','暂时缺货','http://127.0.0.1:3000/xq/pkq.jpg','http://127.0.0.1:3000/xq/pkq.jpg http://127.0.0.1:3000/xq/pkq.jpg http://127.0.0.1:3000/xq/pkq.jpg','http://127.0.0.1:3000/xq/pkqxq1.jpg http://127.0.0.1:3000/xq/pkqxq2.jpg http://127.0.0.1:3000/xq/pkqxq3.jpg http://127.0.0.1:3000/xq/pkqxq4.jpg','http://127.0.0.1:3000/xq/pkq.jpg'), (4,4,'双叶杏景品-《偶像大师》眼镜厂 SQ系列 景品手办',75,90,'偶像大师','暂时缺货','http://127.0.0.1:3000/xq/3.jpg','http://127.0.0.1:3000/xq/3.jpg http://127.0.0.1:3000/xq/3.jpg http://127.0.0.1:3000/xq/3.jpg','http://127.0.0.1:3000/xq/6.jpg http://127.0.0.1:3000/xq/61.jpg http://127.0.0.1:3000/xq/62.jpg http://127.0.0.1:3000/xq/63.jpg','http://127.0.0.1:3000/xq/3.jpg' ), (5,5,'定春长款钱包-《银魂》 万事屋吉祥物 正版拉链钱包 现货',22,26.4,'银魂','暂时缺货','http://127.0.0.1:3000/xq/4.jpg','http://127.0.0.1:3000/xq/4.jpg http://127.0.0.1:3000/xq/4.jpg http://127.0.0.1:3000/xq/4.jpg','http://127.0.0.1:3000/xq/9.jpg http://127.0.0.1:3000/xq/91.jpg http://127.0.0.1:3000/xq/92.jpg http://127.0.0.1:3000/xq/93.jpg','http://127.0.0.1:3000/xq/4.jpg'), (6,6,'苏九儿手办-《妖怪名单》特典版 Myethos 正版',570,0,'myethos','暂时缺货','http://127.0.0.1:3000/scr/1.jpg','http://127.0.0.1:3000/scr/1.jpg http://127.0.0.1:3000/scr/111.jpg http://127.0.0.1:3000/scr/112.jpg','http://127.0.0.1:3000/scr/111.jpg http://127.0.0.1:3000/scr/112.jpg http://127.0.0.1:3000/scr/111.jpg http://127.0.0.1:3000/scr/112.jpg','http://127.0.0.1:3000/scr/1.jpg'), (7,7,'myethos 希尔手办-《崩坏学园2》 1/8 普通版 正版 预售',648,0,'myethos','暂时缺货','http://127.0.0.1:3000/scr/2.jpg','http://127.0.0.1:3000/scr/2.jpg http://127.0.0.1:3000/scr/211.jpg http://127.0.0.1:3000/scr/212.jpg','http://127.0.0.1:3000/scr/211.jpg http://127.0.0.1:3000/scr/212.jpg http://127.0.0.1:3000/scr/211.jpg http://127.0.0.1:3000/scr/212.jpg','http://127.0.0.1:3000/scr/212.jpg'), (8,8,'漫骆驼官方出品 少司命手办-《秦时明月》十周年纪念版手办 myethos 正版',624,628,'myethos','暂时缺货','http://127.0.0.1:3000/scr/3.jpg','http://127.0.0.1:3000/scr/3.jpg http://127.0.0.1:3000/scr/311.jpg http://127.0.0.1:3000/scr/312.jpg','http://127.0.0.1:3000/scr/311.jpg http://127.0.0.1:3000/scr/312.jpg http://127.0.0.1:3000/scr/311.jpg http://127.0.0.1:3000/scr/312.jpg','http://127.0.0.1:3000/scr/312.jpg'), (9,9,'【特价】雪之下雪乃 和服 Ver-《我的青春恋爱物语果然有问题。》雪之下雪乃 和服 Ver代理版 预售',832,0,'<<我的青春恋爱物语果然有问题.>>','暂时缺货','http://127.0.0.1:3000/scr/4.jpg','http://127.0.0.1:3000/scr/4.jpg http://127.0.0.1:3000/scr/411.jpg http://127.0.0.1:3000/scr/412.jpg','http://127.0.0.1:3000/scr/411.jpg http://127.0.0.1:3000/scr/412.jpg http://127.0.0.1:3000/scr/411.jpg http://127.0.0.1:3000/scr/412.jpg','http://127.0.0.1:3000/scr/412.jpg'), (10,10,'【特价】figma 敌法师(带封内特典)-《DOTA2》figma 敌法师(带封内特典)代理版 预售',461,0,'DOTA2','暂时缺货','http://127.0.0.1:3000/scr/5.jpg','http://127.0.0.1:3000/scr/5.jpg http://127.0.0.1:3000/scr/511.jpg http://127.0.0.1:3000/scr/512.jpg','http://127.0.0.1:3000/scr/511.jpg http://127.0.0.1:3000/scr/512.jpg http://127.0.0.1:3000/scr/511.jpg http://127.0.0.1:3000/scr/512.jpg','http://127.0.0.1:3000/scr/512.jpg'), (11,11,'【特价】粘土人 米拉娜(带封内特典)-《DOTA2》粘土人 米拉娜(带封内特典)代理版 预售',283,0,'DOTA2','暂时缺货','http://127.0.0.1:3000/scr/6.jpg','http://127.0.0.1:3000/scr/6.jpg http://127.0.0.1:3000/scr/611.jpg http://127.0.0.1:3000/scr/612.jpg','http://127.0.0.1:3000/scr/611.jpg http://127.0.0.1:3000/scr/612.jpg http://127.0.0.1:3000/scr/611.jpg http://127.0.0.1:3000/scr/612.jpg','http://127.0.0.1:3000/scr/612.jpg'), (12,12,'【特价】粘土人 龙骑士(带封内特典)-《DOTA2》粘土人 龙骑士代理版 预售',283,0,'DOTA2','暂时缺货','http://127.0.0.1:3000/scr/7.jpg','http://127.0.0.1:3000/scr/7.jpg http://127.0.0.1:3000/scr/711.jpg http://127.0.0.1:3000/scr/712.jpg','http://127.0.0.1:3000/scr/711.jpg http://127.0.0.1:3000/scr/712.jpg http://127.0.0.1:3000/scr/711.jpg http://127.0.0.1:3000/scr/712.jpg','http://127.0.0.1:3000/scr/712.jpg'), (13,13,'【特价】粘土人 战栗的龙卷-《一拳超人》粘土人 战栗的龙卷 代理版 预售',309,0,'一拳超人','暂时缺货','http://127.0.0.1:3000/scr/8.jpg','http://127.0.0.1:3000/scr/8.jpg http://127.0.0.1:3000/scr/811.jpg http://127.0.0.1:3000/scr/812.jpg','http://127.0.0.1:3000/scr/811.jpg http://127.0.0.1:3000/scr/812.jpg http://127.0.0.1:3000/scr/811.jpg http://127.0.0.1:3000/scr/812.jpg','http://127.0.0.1:3000/scr/812.jpg'), (14,14,'【特价】粘土人 Archer Super Movable Edition(再販)预售',243,0,'Fate stay night','暂时缺货','http://127.0.0.1:3000/scr/9.jpg','http://127.0.0.1:3000/scr/9.jpg http://127.0.0.1:3000/scr/911.jpg http://127.0.0.1:3000/scr/912.jpg','http://127.0.0.1:3000/scr/911.jpg http://127.0.0.1:3000/scr/912.jpg http://127.0.0.1:3000/scr/911.jpg http://127.0.0.1:3000/scr/912.jpg','http://127.0.0.1:3000/scr/912.jpg'), (15,15,'TAKARA TOMY MP33 火地狱-《变形金刚》 消防车 大师级 3C 正版模型 代理版 预售',0,0,'变形金刚','暂时缺货','http://127.0.0.1:3000/scr/10.jpg','http://127.0.0.1:3000/scr/10.jpg http://127.0.0.1:3000/scr/1111.jpg http://127.0.0.1:3000/scr/1112.jpg','http://127.0.0.1:3000/scr/1111.jpg http://127.0.0.1:3000/scr/1112.jpg http://127.0.0.1:3000/scr/1111.jpg http://127.0.0.1:3000/scr/1112.jpg','http://127.0.0.1:3000/scr/1112.jpg'), (16,16,'联盟款T恤-《魔兽世界》 2016夏季新款男装 全款预售 6月初发货 正版T恤 预售',129,129,'魔兽世界','暂时缺货','http://127.0.0.1:3000/scr/11.jpg','http://127.0.0.1:3000/scr/11.jpg http://127.0.0.1:3000/scr/11.jpg http://127.0.0.1:3000/scr/1222.jpg','http://127.0.0.1:3000/scr/11.jpg http://127.0.0.1:3000/scr/1222.jpg http://127.0.0.1:3000/scr/11.jpg http://127.0.0.1:3000/scr/1222.jpg','http://127.0.0.1:3000/scr/1222.jpg'), (17,17,'部落款T恤-《魔兽世界》 2016夏季新款男装 全款预售 6月初发货 正版T恤 预售',129,129,'魔兽世界','暂时缺货','http://1172.16.58.3:3000/scr/12.jpg','http://127.0.0.1:3000/scr/12.jpg http://127.0.0.1:3000/scr/12.jpg http://127.0.0.1:3000/scr/1322.jpg','http://127.0.0.1:3000/scr/12.jpg http://127.0.0.1:3000/scr/1322.jpg http://127.0.0.1:3000/scr/12.jpg http://127.0.0.1:3000/scr/1322.jpg','http://127.0.0.1:3000/scr/1322.jpg'), (18,18,'万代 宇智波鼬 人偶-《火影忍者》魂限定 SHF 疾风传 佐助VS鼬 正版人偶',419,419,'火隐忍者','暂时缺货','http://127.0.0.1:3000/scr/13.jpg','http://127.0.0.1:3000/scr/13.jpg http://127.0.0.1:3000/scr/13.jpg http://127.0.0.1:3000/scr/13.jpg','http://127.0.0.1:3000/scr/13.jpg http://127.0.0.1:3000/scr/13.jpg http://127.0.0.1:3000/scr/13.jpg http://127.0.0.1:3000/scr/13.jpg','http://127.0.0.1:3000/scr/13.jpg'), (19,19,'TAKARA TOMY IDW LG_31 巨无霸福特-《变形金刚》 泰坦级 正版模型 日版 预售',0,0,'变形金刚','暂时缺货','http://127.0.0.1:3000/scr/14.jpg','http://127.0.0.1:3000/scr/14.jpg http://127.0.0.1:3000/scr/14.jpg http://127.0.0.1:3000/scr/14.jpg','http://127.0.0.1:3000/scr/14.jpg http://127.0.0.1:3000/scr/14.jpg http://127.0.0.1:3000/scr/14.jpg http://127.0.0.1:3000/scr/14.jpg','http://127.0.0.1:3000/scr/14.jpg'), (20,20,'Alter 绀菊 手办-《胧村正》 妖刀传 正版手办 再版 现货',758,710,'胧村正','暂时缺货','http://127.0.0.1:3000/scr/15.jpg','http://127.0.0.1:3000/scr/15.jpg http://127.0.0.1:3000/scr/15.jpg http://127.0.0.1:3000/scr/15.jpg','http://127.0.0.1:3000/scr/15.jpg http://127.0.0.1:3000/scr/15.jpg http://127.0.0.1:3000/scr/15.jpg http://127.0.0.1:3000/scr/15.jpg','http://127.0.0.1:3000/scr/15.jpg') CREATE TABLE Catproduct( pid INT PRIMARY KEY AUTO_INCREMENT, family_id INT(11) DEFAULT NULL, title VARCHAR(128) DEFAULT NULL, price DECIMAL(10,2) DEFAULT NULL, oldprice DECIMAL(10,2) DEFAULT NULL, brand VARCHAR(64) DEFAULT NULL, stock VARCHAR(32) DEFAULT NULL, categoryPic VARCHAR(256) DEFAULT NULL, goodsPic VARCHAR(256) DEFAULT NULL, cartPic VARCHAR(256) DEFAULT NULL ); INSERT INTO Catproduct VALUES (null,1,'园田海未OP装良笑社粘土人510-《Love Live》良笑社 No.510 Q版粘土人',175,210,'Love Live','暂时缺货','http://127.0.0.1:3000/xq/1.jpg http://127.0.0.1:3000/xq/12.jpg http://127.0.0.1:3000/xq/13.jpg','http://127.0.0.1:3000/xq/14.jpg http://127.0.0.1:3000/xq/15.jpg http://127.0.0.1:3000/xq/16.jpg http://127.0.0.1:3000/xq/19.jpg','http://127.0.0.1:3000/xq/1.jpg'), (null,2,'站立版Saber新娘版SEGA景品-《Fate Extra CCC》 SEGA 景品手办',95,0,'Fate stay night','暂时缺货','http://127.0.0.1:3000/xq/2.jpg http://127.0.0.1:3000/xq/21.jpg http://127.0.0.1:3000/xq/21.jpg','http://127.0.0.1:3000/xq/22.jpg http://127.0.0.1:3000/xq/23.jpg http://127.0.0.1:3000/xq/24.jpg http://127.0.0.1:3000/xq/30.jpg','http://127.0.0.1:3000/xq/2.jpg'), (null,3,'皮卡丘眼镜厂挂件-《口袋妖怪》眼镜厂 毛绒钥匙挂件特价(随机发货)',11,13.2,'口袋妖怪','暂时缺货','http://127.0.0.1:3000/xq/pkq.jpg http://127.0.0.1:3000/xq/pkq.jpg http://127.0.0.1:3000/xq/pkq.jpg','http://127.0.0.1:3000/xq/pkqxq1.jpg http://127.0.0.1:3000/xq/pkqxq2.jpg http://127.0.0.1:3000/xq/pkqxq3.jpg http://127.0.0.1:3000/xq/pkqxq4.jpg','http://127.0.0.1:3000/xq/pkq.jpg'), (null,4,'双叶杏景品-《偶像大师》眼镜厂 SQ系列 景品手办',75,90,'偶像大师','暂时缺货','http://127.0.0.1:3000/xq/3.jpg http://127.0.0.1:3000/xq/3.jpg http://127.0.0.1:3000/xq/3.jpg','http://127.0.0.1:3000/xq/6.jpg http://127.0.0.1:3000/xq/61.jpg http://127.0.0.1:3000/xq/62.jpg http://127.0.0.1:3000/xq/63.jpg','http://127.0.0.1:3000/xq/3.jpg' ), (null,5,'定春长款钱包-《银魂》 万事屋吉祥物 正版拉链钱包 现货',22,26.4,'银魂','暂时缺货','http://127.0.0.1:3000/xq/4.jpg http://127.0.0.1:3000/xq/4.jpg http://127.0.0.1:3000/xq/4.jpg','http://127.0.0.1:3000/xq/9.jpg http://127.0.0.1:3000/xq/91.jpg http://127.0.0.1:3000/xq/92.jpg http://127.0.0.1:3000/xq/93.jpg','http://127.0.0.1:3000/xq/4.jpg') CREATE TABLE mlt_cart( id INT PRIMARY KEY AUTO_INCREMENT, count INT, price DECIMAL(10,2), pid INT, uid INT ); INSERT INTO mlt_cart VALUES ()
<reponame>moguchev/BD-Forum<filename>forum.sql CREATE EXTENSION IF NOT EXISTS citext; -- ###################################################### -- USERS -- ###################################################### DROP TABLE IF EXISTS users CASCADE; CREATE UNLOGGED TABLE users( about TEXT, email CITEXT NOT NULL UNIQUE CONSTRAINT email_right CHECK(email ~ '^.*@[A-Za-z0-9\-_\.]*$'), fullname TEXT NOT NULL, nickname CITEXT PRIMARY KEY COLLATE "POSIX" CONSTRAINT nick_right CHECK(nickname ~ '^[A-Za-z0-9_\.]*$') ); -- indexes CREATE INDEX IF NOT EXISTS idx_users_nick ON users (LOWER(nickname)); CREATE INDEX IF NOT EXISTS idx_users_email ON users (email); -- ###################################################### -- Forums -- ###################################################### DROP TABLE IF EXISTS forums CASCADE; CREATE UNLOGGED TABLE forums ( slug CITEXT PRIMARY KEY UNIQUE CONSTRAINT slug_correct CHECK(slug ~ '^(\d|\w|-|_)*(\w|-|_)(\d|\w|-|_)*$'), threads INTEGER DEFAULT 0, posts INTEGER DEFAULT 0, user_nick CITEXT REFERENCES Users (nickname) ON DELETE RESTRICT ON UPDATE RESTRICT NOT NULL, title TEXT NOT NULL ); -- indexes CREATE INDEX IF NOT EXISTS idx_forum_slug ON forums (LOWER(slug)); -- ###################################################### -- USERS IN FORUM -- ###################################################### DROP TABLE IF EXISTS UsersInForum CASCADE; CREATE UNLOGGED TABLE UsersInForum ( nickname CITEXT COLLATE "POSIX", forum CITEXT ); -- indexes CREATE UNIQUE INDEX forum_users_idx ON UsersInForum(forum, nickname); -- ###################################################### -- Threads -- ###################################################### DROP TABLE IF EXISTS threads CASCADE; CREATE UNLOGGED TABLE threads ( id SERIAL PRIMARY KEY, slug CITEXT UNIQUE CONSTRAINT slug_correct CHECK(slug ~ '^(\d|\w|-|_)*(\w|-|_)(\d|\w|-|_)*$'), forum CITEXT REFERENCES forums (slug) ON DELETE CASCADE ON UPDATE RESTRICT NOT NULL, author CITEXT REFERENCES users (nickname) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, created TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, message TEXT NOT NULL, title TEXT NOT NULL, votes INTEGER NOT NULL DEFAULT 0 ); -- indexes CREATE INDEX IF NOT EXISTS thread_id ON threads (LOWER(slug), id); CREATE UNIQUE INDEX thread_slug_index ON threads (LOWER(slug)); CREATE INDEX IF NOT EXISTS thread_author ON threads (LOWER(author)); CREATE INDEX IF NOT EXISTS thread_forum ON threads (forum); CREATE INDEX IF NOT EXISTS thread_forum_created on threads(LOWER(forum), created); -- ###################################################### -- VOTES -- ###################################################### DROP TABLE IF EXISTS votes CASCADE; CREATE UNLOGGED TABLE votes ( thread BIGINT REFERENCES threads (id) ON DELETE CASCADE ON UPDATE CASCADE, author CITEXT REFERENCES users (nickname) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, vote SMALLINT CONSTRAINT check_vote CHECK (vote = -1 OR vote = 1 ) DEFAULT 0, UNIQUE (thread, author) ); -- indexes CREATE INDEX IF NOT EXISTS vote_coverage ON votes(thread, lower(author), vote); -- ###################################################### -- POSTS -- ###################################################### CREATE OR REPLACE FUNCTION get_thread_by_post(post_ BIGINT) RETURNS INTEGER AS $$ BEGIN RETURN (SELECT thread FROM posts WHERE id = post_); END; $$ LANGUAGE plpgsql; DROP TABLE IF EXISTS posts CASCADE; CREATE UNLOGGED TABLE posts ( author CITEXT REFERENCES users (nickname) NOT NULL, created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, forum CITEXT, id SERIAL PRIMARY KEY, isEdited BOOLEAN NOT NULL DEFAULT false, message TEXT NOT NULL DEFAULT '', parent INTEGER REFERENCES posts (id) ON DELETE CASCADE ON UPDATE RESTRICT CONSTRAINT par CHECK (get_thread_by_post(parent)=thread), thread INTEGER, path INTEGER[] not null ); -- indexes CREATE INDEX IF NOT EXISTS post__thread ON posts(thread); CREATE INDEX IF NOT EXISTS post__id_thread ON posts(id, thread); CREATE INDEX IF NOT EXISTS post__path__first ON posts((path[1])); CREATE INDEX IF NOT EXISTS post_forum_author ON posts(forum, author); CREATE INDEX post_parent_thread_path_id ON posts(thread, (path[1]), id) WHERE parent IS NUll; CREATE INDEX IF NOT EXISTS idx_sth ON posts (LOWER(author)); -- ###################################################### -- FORUM-POSTS -- ###################################################### DROP TABLE IF EXISTS ForumPosts CASCADE; CREATE UNLOGGED TABLE ForumPosts ( forum citext PRIMARY KEY, posts INTEGER DEFAULT 0 ); -- functions -- AUTO ForumPosts CREATE OR REPLACE FUNCTION update_forum_posts() RETURNS trigger AS $update_forum_posts$ BEGIN IF TG_OP='DELETE' OR TG_OP='TRUNCATE' THEN UPDATE ForumPosts SET posts=posts-1 WHERE forum=OLD.forum; RETURN OLD; ELSIF TG_OP='UPDATE' THEN IF NEW.created!=OLD.created THEN RAISE EXCEPTION 'const .created'; END IF; IF NEW.forum!=OLD.forum THEN RAISE EXCEPTION 'const .forum'; END IF; IF NEW.id!=OLD.id THEN RAISE EXCEPTION 'const .id'; END IF; IF NEW.isEdited!=OLD.isEdited THEN RAISE EXCEPTION 'const .isEdited'; END IF; IF NEW.thread!=OLD.thread THEN RAISE EXCEPTION 'const .thread'; END IF; if NEW.message!=OLD.message OR NEW.parent!=OLD.parent then NEW.isEdited=TRUE; end if; RETURN NEW; END IF; RETURN NEW; END $update_forum_posts$ LANGUAGE plpgsql; -- triggers DROP TRIGGER IF EXISTS update_forum_posts ON posts; CREATE TRIGGER update_forum_posts BEFORE UPDATE OR DELETE ON posts FOR EACH ROW EXECUTE PROCEDURE update_forum_posts(); -- functions -- AUTO threads+- IN FORUMS CREATE OR REPLACE FUNCTION update_forum_threads() RETURNS trigger AS $update_forum_threads$ BEGIN IF TG_OP='INSERT' THEN UPDATE forums SET threads=threads+1 WHERE slug=NEW.forum; RETURN NEW; ELSIF TG_OP='DELETE' OR TG_OP='TRUNCATE' THEN UPDATE forums SET threads=threads-1 WHERE slug=OLD.forum; RETURN OLD; ELSIF TG_OP='UPDATE' THEN IF NEW.forum!=OLD.forum THEN RAISE EXCEPTION 'const .forum'; END IF; IF NEW.id!=OLD.id THEN RAISE EXCEPTION 'const .id'; END IF; IF NEW.slug!=OLD.slug THEN RAISE EXCEPTION 'const .slug'; END IF; RETURN NEW; END IF; RETURN NEW; END $update_forum_threads$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS update_forum_threads ON threads; CREATE TRIGGER update_forum_threads AFTER UPDATE OR INSERT OR DELETE ON threads FOR EACH ROW EXECUTE PROCEDURE update_forum_threads(); -- functions -- AUTO INSERT TO UsersInForum CREATE OR REPLACE FUNCTION users_forum() RETURNS trigger AS $$ BEGIN IF NEW.forum IS NOT NULL THEN INSERT INTO UsersInForum(forum, nickname) VALUES (NEW.forum, new.author) ON conflict do nothing; END IF; RETURN new; END; $$ language plpgsql; -- trigers DROP trigger IF EXISTS users_forum ON threads; CREATE trigger users_forum AFTER INSERT ON threads FOR EACH ROW EXECUTE PROCEDURE users_forum(); -- AUTO votes+- IN THREADS CREATE OR REPLACE FUNCTION update_thread_vote_counter() RETURNS trigger AS $$ BEGIN IF TG_OP='INSERT' THEN UPDATE threads SET votes=votes+NEW.vote WHERE id=NEW.thread; RETURN NEW; ELSIF TG_OP='UPDATE' THEN UPDATE threads SET votes=votes+(NEW.vote-OLD.vote) WHERE id=NEW.thread; RETURN NEW; ELSE RAISE EXCEPTION 'Invalid call update_thread_vote_counter()'; END IF; END $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS update_thread_vote ON votes; CREATE TRIGGER update_thread_vote AFTER INSERT OR UPDATE ON votes FOR EACH ROW EXECUTE PROCEDURE update_thread_vote_counter(); --functions -- AUTO path IN POSTS CREATE OR REPLACE FUNCTION post_path() RETURNS TRIGGER AS $$ BEGIN NEW.path = (SELECT path FROM posts WHERE id = NEW.parent) || NEW.id; RETURN NEW; END; $$ LANGUAGE plpgsql; -- triggers DROP TRIGGER IF EXISTS post_path ON posts; CREATE TRIGGER post_path BEFORE INSERT ON posts FOR EACH ROW EXECUTE PROCEDURE post_path(); CREATE OR REPLACE FUNCTION forum_user() RETURNS trigger AS $forum_user$ BEGIN NEW.user_nick = (SELECT nickname FROM users WHERE lower(nickname)=lower(NEW.user_nick)); RETURN NEW; END $forum_user$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS forum_user ON forums; CREATE TRIGGER forum_user BEFORE INSERT ON forums FOR EACH ROW EXECUTE PROCEDURE forum_user(); cluster UsersInForum USING forum_users_idx;
SET HEADING OFF SET FEEDBACK OFF SET TRIMSPOOL ON SET PAGESIZE 0 SET LINESIZE 300 SPOOL 'psexports\mastschd.txt'; -- Write course column headers. -- SELECT DISTINCT '01 Section ID' || :TAB || '02 Site ID' || :TAB || '03 Term Name' || :TAB || '04 Course ID' || :TAB || '05 User ID' || :TAB || '06 Period' || :TAB || '07 AcademicYear' || :TAB || '08 Room Number' || :TAB || '09 Session Type' || :TAB || '10 Unique Term ID' || :TAB || '11 Quarter Number' || :TAB || '12 User Start Date' || :TAB || '13 User End Date' || :TAB || '14 Primary User' || :TAB || '15 Highly Qualified Teacher Competency Code' --BEGIN additional column headers --END additional column headers FROM DUAL / -- Write course data. -- SELECT DISTINCT s.ID || :TAB || s.SCHOOLID || :TAB || 'Y' || :TAB || s.COURSE_NUMBER || :TAB || CASE WHEN LENGTH(u.teachernumber) = 6 AND SUBSTR(u.teachernumber,1,2) IN ('10','20') THEN u.teachernumber ELSE TO_CHAR(900000 + (SELECT max(id) FROM teachers WHERE teachernumber = u.teachernumber)) END -- OCW : This line matches the User ID line from users.sql || :TAB || CASE WHEN s.course_number = '3' THEN 'Homeroom' ELSE COALESCE(COALESCE(ps_customfields.getSectionsCF(s.id,'Homeroom'),s.section_number),'NONE') END -- OCW : This returns 'Homeroom' for the Homeroom section and the cohort Homeroom name (i.e. 'UVA') for all other sections || :TAB || TO_CHAR(t.yearid + 1990)||'-'||TO_CHAR(t.yearid + 1991) || :TAB || COALESCE(COALESCE(ps_customfields.getSectionsCF(s.id,'Homeroom'),s.section_number),s.room) || :TAB || '' || :TAB || '' || :TAB || '' || :TAB || '' || :TAB || '' || :TAB || CASE WHEN r.name = 'Lead Teacher' THEN 1 ELSE 0 END -- OCW : Default role in PowerSchool is 'Lead Teacher' || :TAB || '' --BEGIN additional data columns --Acceptable fields: --Terms table(t). Custom section fields: ps_customfields.getTermsCF(c.id, 'FIELDNAME') --Section table(s). Custom section fields: ps_customfields.getSectionsCF(c.id, 'FIELDNAME') -- OCW : SectionTeacher table includes TeacherIDs for non-Lead Teachers -- OCW : SchoolStaff/Users tables link to UserID as defined in users.sql. This numbering convention is specific to KIPP DC -- OCW : RoleDef table defines the type of teacher role, i.e. Lead Teacher or Co-Teacher/Class Observer/etc. -- OCW : The Homeroom (course number = '3') and cohort Homeroom structure is specific to KIPP DC --END additional data columns FROM sections s JOIN terms t ON t.id = s.termid AND t.schoolid = s.schoolid JOIN sectionteacher st ON st.sectionid = s.id JOIN schoolstaff ss ON ss.id = st.teacherid JOIN users u ON u.dcid = ss.users_dcid JOIN roledef r ON r.id = st.roleid WHERE t.yearid = &IE_YEAR_ID / SPOOL OFF
<reponame>KebecStatoil/SqlJambalaya<filename>Scripts/ASAQC - NGRMDF/Pending_Updates/old/ShotInfoMinimal/01_AddShotPointEvent.sql /****** Object: StoredProcedure [system_p].[AddShotPointEvent] Script Date: 27.06.2019 11:19:11 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER PROCEDURE [system_p].[AddShotPointEvent] ( @EventID uniqueidentifier, @ShotInfoID uniqueidentifier, @event_text nvarchar(max) ) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DECLARE @event_type nvarchar(128) = 'event.system.shotpoint', -- event_type @SurveyID int = (SELECT SurveyID FROM [acquisition].[ShotInfo] WHERE [ShotInfoID] = @ShotInfoID), @Payload nvarchar(max) = ( SELECT [SurveyID] ,[ShotInfoID] ,[type] ,[imo_num] ,[mmsi_num] ,[survey_name] ,[survey_id] ,[shottime] ,[shotpoint_num] ,[sailline_num] ,[seq_num] ,[epsg] ,JSON_QUERY([northing]) [northing] ,JSON_QUERY([srcline_num]) [srcline_num] ,JSON_QUERY([easting]) [easting] ,[bearing] ,[vessel_speed] ,[water_depth] ,[src_num] ,JSON_QUERY([gun_mask]) [gun_mask] ,JSON_QUERY([src_delay]) [src_delay] ,JSON_QUERY([deviation]) [deviation] ,[guninfo] FROM [acquisition_v].[ShotInfoExtended] WHERE ShotInfoID = @ShotInfoID FOR JSON PATH , WITHOUT_ARRAY_WRAPPER ) INSERT INTO [survey].[Event] ( SurveyID, EventID, survey_name, event_text, event_type ) VALUES ( @SurveyID, @EventID, (SELECT survey_name FROM [acquisition].[ShotInfo] WHERE [ShotInfoID] = @ShotInfoID), @event_text, @event_type ) INSERT INTO [survey].[SystemEvent] ( SurveyID, EventID, payload ) VALUES ( @SurveyID, @EventID, @Payload ) SELECT EventID FROM [survey].[SystemEvent] WHERE EventID = @EventID END GO
<reponame>Paul-PADataAnalytics/CaravanSystemsProject<filename>csp-backend/create.sql CREATE DATABASE csp; --CREATE DATABASE csp; CREATE SCHEMA csp; CREATE TABLE csp.user( id SERIAL, username TEXT, passwordhash TEXT, created TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated TIMESTAMPTZ NOT NULL DEFAULT NOW(), deleted TEXT NOT NULL DEFAULT 'N' ); CREATE TABLE csp.locationrating( id SERIAL, locationid int, overallrating INT, facilitiesrating INT, locationrating INT, journeyrating INT, sceneryrating INT, comment text, created TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated TIMESTAMPTZ NOT NULL DEFAULT NOW(), deleted TEXT NOT NULL DEFAULT 'N' ); CREATE TABLE csp.location( id SERIAL, lat TEXT, lng TEXT, name TEXT NOT NULL DEFAULT 'UNKNOWN LOCATION', created TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated TIMESTAMPTZ NOT NULL DEFAULT NOW(), deleted TEXT NOT NULL DEFAULT 'N' ); CREATE TABLE csp.trip( id SERIAL, startdate DATE, enddate DATE, bookinguserid int, triplocationid int, created TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated TIMESTAMPTZ NOT NULL DEFAULT NOW(), deleted TEXT NOT NULL DEFAULT 'N' );