sql
stringlengths
6
1.05M
<reponame>dbrtly/ra_data_warehouse<filename>models/integration/int_ad_campaign_performance.sql {% if var('marketing_warehouse_ad_campaign_performance_sources') %} with ad_campaign_performance as ( {% for source in var('marketing_warehouse_ad_campaign_performance_sources') %} {% set relation_source = 'stg_' + source + '_campaign_performance' %} select '{{source}}' as source, * from {{ ref(relation_source) }} {% if not loop.last %}union all{% endif %} {% endfor %} ) select * from ad_campaign_performance {% else %} {{ config( enabled=false ) }} {% endif %}
<filename>sql/1-0-0/06-functions/status_changers.sql create or replace function change_status( em varchar, new_status_id int, reason varchar(50) ) returns user_summary as $$ DECLARE found_id bigint; status_name varchar(50); user_record user_summary; BEGIN set search_path = membership; select name from status where id=new_status_id into status_name; select id from users where users.email=em into found_id; if found_id is not null then --reset the status update users set status_id=new_status_id where id=found_id; --add a note insert into notes(user_id, note) values (found_id, 'Your status was changed to ' || status_name); --add a log insert into logs(user_id, subject, entry) values(found_id, 'System','Changed status to ' || status_name || ' because ' || reason); --pull the user user_record := get_user(em); end if; return user_record; END; $$ language plpgsql; create or replace function suspend_user(em varchar,reason varchar) returns user_summary as $$ select change_status(em,20, reason); $$ language sql; create or replace function lock_user(em varchar,reason varchar) returns user_summary as $$ select change_status(em,88, reason); $$ language sql; create or replace function ban_user(em varchar,reason varchar) returns user_summary as $$ select change_status(em,99, reason); $$ language sql; create or replace function activate_user(em varchar,reason varchar) returns user_summary as $$ select change_status(em,10, reason); $$ language sql;
--1-- SELECT * FROM EMPLE WHERE SALARIO > (SELECT AVG(SALARIO) FROM EMPLE); --2-- SELECT D.DNOMBRE, E.SALARIO, D.DEPT_NO FROM EMPLE E, DEPART d WHERE E.DEPT_NO = D.DEPT_NO AND D.DEPT_NO IN (SELECT D.DEPT_NO FROM DEPART D WHERE E.SALARIO > (SELECT AVG(E.SALARIO) FROM EMPLE E)); --3-- SELECT D.LOC "Localidad" FROM DEPART D, EMPLE E WHERE D.DEPT_NO = E.DEPT_NO AND E.COMISION_PCT >= 10; --3 SEGUNDA OPCION-- --4-- --5-- SELECT DEPART.DEPT_NO FROM EMPLE, DEPART WHERE EMPLE.DEPT_NO = DEPART.DEPT_NO AND NOT EXISTS (SELECT DISTINCT EMP_NO FROM EMPLE); --6-- SELECT * FROM EMPLE WHERE 2 <= (SELECT COUNT(*) FROM HJOB WHERE EMP_NO = EMPLE.EMP_NO);
-- phpMyAdmin SQL Dump -- version 4.9.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 -- Generation Time: Aug 11, 2021 at 06:53 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: `ci_test` -- -- -------------------------------------------------------- -- -- Table structure for table `articles` -- DROP TABLE IF EXISTS `articles`; CREATE TABLE IF NOT EXISTS `articles` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `body` varchar(255) NOT NULL, `user_id` int(10) UNSIGNED NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- -- Dumping data for table `articles` -- INSERT INTO `articles` (`id`, `title`, `body`, `user_id`) VALUES (1, 'Article 1', 'This is First Article', 1), (2, 'Article 2', 'This is Second Article', 2), (3, 'Article 3', 'This is Third Article', 3), (4, 'Article 4 ', 'This is Fourth Article', 1); -- -------------------------------------------------------- -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `uname` varchar(255) NOT NULL, `pword` varchar(255) NOT NULL, `fname` varchar(100) NOT NULL, `lname` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `uname`, `pword`, `fname`, `lname`) VALUES (1, 'Raj', 'abc<PASSWORD>', 'Raj', 'Banothe'), (2, 'Navin', 'abc123', 'Navin', 'Yele'), (3, 'Yamesh', 'abc123', 'Yamesh', 'Mahule'); 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 */;
CREATE TABLE `games` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `code` text, `characters` longtext, `game` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
<reponame>Iogsothot/database -- Переименование поля alter table "attachment" rename "author_1" to "author"; -- Изменение поля alter table "attachment" alter column "author" drop default; -- Переименование поля alter table "quiz" rename "amount_of_questions" to "questions_amount"; -- Изменение поля alter table "quiz" alter column "quiz_description" drop not null; -- Переименование поля alter table "user" rename "image_link" to "avatar_link"; -- Изменение поля alter table "user" alter column "avatar_link" drop not null;
-- phpMyAdmin SQL Dump -- version 4.4.10 -- http://www.phpmyadmin.net -- -- Servidor: localhost:8889 -- Temps de generació: 16-12-2015 a les 00:17:53 -- Versió del servidor: 5.5.42 -- Versió de PHP: 5.6.10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Base de dades: `incidencies` -- -- -------------------------------------------------------- -- -- Estructura de la taula 'usuaris' -- CREATE TABLE usuaris ( id int(11) NOT NULL auto_increment, nom varchar(100) character set latin1 collate latin1_bin NOT NULL, cognoms varchar(100) character set latin1 collate latin1_bin NOT NULL, passaport varchar(15) character set latin1 collate latin1_bin NOT NULL, correu varchar(50) character set latin1 collate latin1_bin NOT NULL, `password` varchar(15) character set latin1 collate latin1_bin NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Estructura de la taula `incidencies` -- CREATE TABLE `incidencies` ( `id_incidencia` int(10) NOT NULL, `nom` varchar(25) NOT NULL, `cognom1` varchar(25) NOT NULL, `cognom2` varchar(25) NOT NULL, `correu1` varchar(50) NOT NULL, `correu2` varchar(50) NOT NULL, `hora` varchar(5) NOT NULL, `dia` int(2) NOT NULL, `mes` int(2) NOT NULL, `any` int(4) NOT NULL, `tecnic` varchar(4) NOT NULL, `parroquia` varchar(5) NOT NULL, `tipus` varchar(20) NOT NULL, `estat` varchar(20) NOT NULL, `observacions` varchar(15) NOT NULL, `idioma` varchar(5) NOT NULL, `dificultat` int(11) NOT NULL, `descripcio` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Bolcant dades de la taula `incidencies` -- INSERT INTO `incidencies` (`id_incidencia`, `nom`, `cognom1`, `cognom2`, `correu1`, `correu2`, `hora`, `dia`, `mes`, `any`, `tecnic`, `parroquia`, `tipus`, `estat`, `observacions`, `idioma`, `dificultat`, `descripcio`) VALUES (1, 'nom', 'primer', 'segon', 'domini', '', '12:34', 1, 2, 2015, '0345', 'AD200', 'missatgeria', 'pendent', 'satisfet', 'en', 3, '<p><em><strong>Hola</strong></em></p>'), (123, 'nom', 'primer', 'segon', 'correu', 'domini', '12:34', 1, 2, 2015, '0345', 'AD500', 'missatgeria', 'pendent', 'satisfet', 'en', 3, ''); -- -------------------------------------------------------- -- -- Estructura de la taula `parroquies` -- CREATE TABLE `parroquies` ( `id_parroquia` varchar(5) NOT NULL, `nom_parroquia` varchar(25) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Bolcant dades de la taula `parroquies` -- INSERT INTO `parroquies` (`id_parroquia`, `nom_parroquia`) VALUES ('AD100', 'Canillo'), ('AD200', 'Encamp'), ('AD500', 'Andorra la Vella'); -- -- Indexos per taules bolcades -- -- -- Index de la taula `incidencies` -- ALTER TABLE `incidencies` ADD PRIMARY KEY (`id_incidencia`), ADD KEY `parroquia` (`parroquia`); -- -- Index de la taula `parroquies` -- ALTER TABLE `parroquies` ADD PRIMARY KEY (`id_parroquia`); -- -- Restriccions per taules bolcades -- -- -- Restriccions per la taula `incidencies` -- ALTER TABLE `incidencies` ADD CONSTRAINT `fk_parroquia` FOREIGN KEY (`parroquia`) REFERENCES `parroquies` (`id_parroquia`);
<reponame>nyluntu/mysql-perusteet-tehtavat /* --- KYSYMYS --- (Käytä tehtävässä GROUP BY ja ORDER BY -operaattoreita) 14. Tulevaa kauppiaspalaveria varten tarvitaan tieto montako elokuvan nimikettä on per kategoria/genre? Tuloksessa pitää näkyä elokuvan kategorian tunniste sekä määrä sen perässä. Järjestä tulokset suurimmasta pienimpään määrän perusteella. */
CREATE PROC BooksInfoByDateRange @DateFrom AS DATE, @DateTo AS DATE AS SELECT Books.Title_book, Purchases.Amount FROM Books JOIN Purchases ON Purchases.Code_book = Books.Code_book WHERE Purchases.Date_order BETWEEN @DateFrom AND @DateTo GO
CREATE TABLE [dbo].[DeviceAttributeUtilization] ( [guid] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY , [companyGuid] UNIQUEIDENTIFIER NOT NULL , [deviceGuid] UNIQUEIDENTIFIER NOT NULL , [attrbGuid] UNIQUEIDENTIFIER NOT NULL , [totalCount] BIGINT NOT NULL , [utilizedCount] BIGINT NOT NULL , [createdDate] DATE NOT NULL )
<filename>dataactvalidator/config/sqlrules/fabs35_detached_award_financial_assistance_2.sql -- LegalEntityZIP5 is not a valid zip code. SELECT dafa.row_number, dafa.legal_entity_zip5, dafa.afa_generated_unique AS "uniqueid_AssistanceTransactionUniqueKey" FROM detached_award_financial_assistance AS dafa WHERE dafa.submission_id = {0} AND COALESCE(dafa.legal_entity_zip5, '') <> '' AND NOT EXISTS ( SELECT 1 FROM zips AS z WHERE z.zip5 = dafa.legal_entity_zip5 ) AND UPPER(COALESCE(correction_delete_indicatr, '')) <> 'D';
<filename>coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/current_mysql/5.0.1/dml/KC_DML_01_KRACOEUS-5446_B000.sql<gh_stars>0 DELIMITER / ALTER TABLE EPS_PROPOSAL MODIFY TITLE VARCHAR(200) / DELIMITER ;
<filename>AMT/auxiliary code/insulines.sql --insulines DROP TABLE IF EXISTS dev_amt.insulines; CREATE TABLE dev_amt.insulines AS ( WITH inclusion AS ( SELECT 'insul|aspart |lispro|glulisine|velosulin|glargin|detemir|degludec|' || 'actrap|afrezza|apidra|basaglar|fiasp|humalog|' || 'humuli|hypurin|lantus|levemir|novolin|novolog|' || 'novomix|novorapid|mixtard|optisulin|protaphane|' || 'ryzodeg|semglee|soluqua|toujeo|tresiba' ), exclusion AS (SELECT 'Ctpp|Mpp|Tpp|Mpuu|Tpuu') SELECT * FROM ( SELECT DISTINCT dcs.* FROM drug_concept_stage dcs WHERE dcs.concept_name ~* (SELECT * FROM inclusion) AND dcs.concept_name !~* (SELECT * FROM exclusion) AND dcs.concept_class_id NOT IN ('Unit', 'Supplier') UNION SELECT DISTINCT dcs2.* FROM drug_concept_stage dcs1 JOIN sources.amt_rf2_full_relationships fr ON dcs1.concept_code = fr.sourceid::text JOIN drug_concept_stage dcs2 ON dcs2.concept_code = fr.destinationid::text WHERE dcs1.concept_name ~* (SELECT * FROM inclusion) AND dcs2.concept_name !~* (SELECT * FROM exclusion) AND dcs1.concept_class_id NOT IN ('Unit', 'Supplier') ) a WHERE concept_class_id IN ('Ingredient', 'Drug Product', 'Device', 'Brand Name') ); SELECT * FROM insulines ORDER BY concept_name; --check if there are more insulines (using irs) DROP TABLE IF EXISTS insulines_2; CREATE TABLE insulines_2 AS ( SELECT * FROM ( SELECT DISTINCT dcs2.* FROM drug_concept_stage dcs JOIN internal_relationship_stage irs ON dcs.concept_code = irs.concept_code_1 OR dcs.concept_code = irs.concept_code_2 JOIN drug_concept_stage dcs2 ON dcs2.concept_code = irs.concept_code_1 OR dcs2.concept_code = irs.concept_code_2 WHERE dcs.concept_code IN ( SELECT concept_code FROM insulines WHERE concept_code IS NOT NULL ) AND dcs2.concept_class_id IN ('Drug Product', 'Ingredient', 'Device', 'Brand Name') UNION SELECT DISTINCT * FROM insulines WHERE concept_class_id IN ('Drug Product', 'Ingredient', 'Device', 'Brand Name') ) AS a ) ; SELECT * FROM insulines_2 ORDER BY concept_name; --insulines attributes mapping review SELECT DISTINCT dcs.concept_code, dcs.concept_class_id, dcs.concept_name, NULL, mapping_type, precedence, concept_id_2, c.concept_code, c.concept_name, c.concept_class_id, c.standard_concept, c.invalid_reason, c.domain_id, c.vocabulary_id FROM "mapping_review_backup_2020-03-31" m JOIN drug_concept_stage dcs ON dcs.concept_code = m.concept_code_1 JOIN concept c ON m.concept_id_2 = c.concept_id WHERE m.concept_code_1 IN ( SELECT concept_code FROM insulines_2 WHERE concept_class_id IN ('Ingredient', 'Brand Name') ) ; --insulines final mapping review SELECT DISTINCT ins.concept_code, ins.concept_name as source_concept_name, ins.concept_class_id, c2.*, CASE WHEN d5c.concept_name IS NULL THEN 'new' END AS new_concept FROM insulines_2 ins LEFT JOIN concept c1 ON ins.concept_code = c1.concept_code AND c1.vocabulary_id = 'AMT' LEFT JOIN concept_relationship cr ON c1.concept_id = cr.concept_id_1 AND cr.relationship_id in ('Maps to', 'Source - RxNorm eq') AND cr.invalid_reason IS NULL LEFT JOIN concept c2 ON cr.concept_id_2 = c2.concept_id LEFT JOIN devv5.concept d5c ON c2.concept_id = d5c.concept_id ORDER BY source_concept_name ;
<filename>trade-driver-adapter/src/main/resources/data.sql<gh_stars>0 INSERT INTO party_jpa_entity (id, name) values ('05ca4474-2fb7-407d-a69a-dbb9eaaa8e47','GOOG'); INSERT INTO party_jpa_entity (id, name) values ('8c5ee939-0bfe-4632-9f77-c488a217f73c','MSFT');
-- alter table rename column alter table fooby rename column foo to bar;
--No two representation at same time from same company create or replace trigger not_two_same_representation_time before insert or update on representation for each row declare not_same_time exception; begin for rep in (select * from representation) loop refcomp := (select theater_company_id from creation, representation where creation.creation_id = rep.creation_id;) --get id of company for rep2 in (select * from representation) loop refcomp2 := (select theater_company_id from creation, representation where creation.creation_id = rep2.creation_id;) if rep.date == rep2.date AND refcomp == refcomp2 then raise not_same_time endloop; endloop; when (not_same_time) then raise_application_error (-2000, 'no representation from same company at same time'); end; --No two representation at same place from same company create or replace trigger before insert or update on representation for each row declare not_same_place exception; begin for rep in (select * from representation) loop refcomp := (select theater_company_id from creation, representation where company.creation_id = rep.creation_id;) --get id of company refhost := (select theater_company_id from host, representation where rep.representation_id = host.representation_id;) --get id of host for rep2 in (select * from representation) loop refcomp2 := (select theater_company_id from creation, representation where creation.creation_id = rep2.creation_id;) refhost2 := (select theater_company_id from host, representation where rep2.representation_id = host.representation_id;) --get id of host if refhost == refhost2 AND refcomp == refcomp2 then raise not_same_place endloop; endloop; when (not_same_place) then raise_application_error (-2001, 'no representation from same company at same place'); end; --Balance is updated daily/with any change create or replace trigger update_balance before update, insert or delete on theater_company for each row begin if inserting then insert into theater_company values (:new.theater_company_id,:new.hall_capacity,:new.budget,:new.city,:new.balance); elsif deleting then insert into theater_company values (:new.theater_company_id,:new.hall_capacity,:new.budget,:new.city,:new.balance); elseif updating then insert into theater_company values (:new.theater_company_id,:new.hall_capacity,:new.budget,:new.city,:new.balance); endif; end; --Archive transaction when there is a movement create procedure archive_transaction is curr_date DATE = getcurrdate(); declare @ReportStartDate DATE= month(curr_date, -1), --it run each end of month @ReportEndDate DATE= month(curr_date) if @ReportEndDate=curr_date Begin for curr_grant in (select * from grant) loop if curr_grant.date_start < curr_date AND curr_grant.date_end > curr_date then insert into archive values ((SELECT max(trans_id) FROM archive)+1,curr_date,curr_grant.amount,"automatic transfer from "+ entity) ; endif; endloop; end; --Compute reduce_rate if 1 of 4 condition is met (job, age, filling, date) create procedure compute_reduce_rate is reduction_p NUMBER; price NUMBER; reduce_rate NUMBER; begin for curr_customer in (select * from customer) loop if curr_customer.age in (select age_reduce from reduce_rate) then reduction_p := (select precentage from reduce_rate where curr_customer.age == age_reduce;) elsif curr_customer.job in (select job_reduce from reduce_rate) then reduction_p := (select precentage from reduce_rate where curr_customer.job == job_reduce;) elsif curr_customer.customer_id in (select customer_id from buys, reduce_rate where buying_date > reduce_rate.starting_date AND buying_date < reduce_rate.finish_date) then reduction_p := (select precentage from reduce_rate , buys where curr_customer.customer_id == buys.customer_id and buys.buying_date > reduce_rate.starting_date and buys.buying_date < reduce_rate.finish_date ;) elsif curr_customer.customer_id in (select customer_id from buys, reduce_rate where count(customer_id) < reduce_rate.completion_percentage) then reduction_p := (select precentage from reduce_rate ,buys where curr_customer.customer_id == buys.customer_id and count(customer_id) < reduce_rate.completion_percentage);) price := (select price from buys where customer_id== curr_customer.customer_id;) reduce_rate := price * (1-reduction_p) ; endloop; end;
INSERT INTO search_history SELECT ?1, 1, ?2, ?2 WHERE NOT EXISTS ( SELECT 1 FROM search_history WHERE expression = ?1 )
<gh_stars>0 /* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50622 Source Host : localhost Source Database : yii2-workshop-day2 Target Server Type : MySQL Target Server Version : 50622 File Encoding : utf-8 Date: 06/30/2015 17:02:41 PM */ SET NAMES utf8; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for `blog` -- ---------------------------- DROP TABLE IF EXISTS `blog`; CREATE TABLE `blog` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'รหัส', `title` varchar(255) DEFAULT NULL COMMENT 'ชื่อเรื่อง', `detail` varchar(255) DEFAULT NULL COMMENT 'รายละเอียด', `publish` int(11) DEFAULT NULL COMMENT 'เผยแพร่', `created_at` int(11) DEFAULT NULL COMMENT 'สร้างวันที่', `updated_at` int(11) DEFAULT NULL COMMENT 'ปรับปรุงวันที่', `created_by` int(11) DEFAULT NULL COMMENT 'สร้างโดย', `updated_by` int(11) DEFAULT NULL COMMENT 'แก้ไขโดย', `tag` varchar(255) DEFAULT NULL COMMENT 'คำค้น', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of `blog` -- ---------------------------- BEGIN; INSERT INTO `blog` VALUES ('1', 'การสร้างฟอร์ม CRUD', 'การสร้างฟอร์ม CRUD เนื้อหา', null, null, null, null, null, 'crud'), ('4', 'การสร้างฟอร์ม CRUD 4', '', null, null, null, null, null, ''), ('5', 'การสร้างฟอร์ม CRUD 5', 'การสร้างฟอร์ม CRUD 5', null, null, null, null, null, ''), ('6', 'sdf', 'sdf', null, '1435648847', '1435648847', null, null, ''), ('7', 'sdf', 'sdf', null, '1435649142', '1435649142', '100', '100', ''), ('8', '', '', null, '1435652526', '1435652526', '100', '100', ''), ('9', 'sdf', 'sdf', '1', '1435653881', '1435653881', '100', '100', '234234'); COMMIT; -- ---------------------------- -- Table structure for `employee` -- ---------------------------- DROP TABLE IF EXISTS `employee`; CREATE TABLE `employee` ( `emp_id` int(11) NOT NULL AUTO_INCREMENT, `sex` tinyint(1) DEFAULT NULL COMMENT 'เพศ', `title` varchar(50) DEFAULT NULL COMMENT 'คำนำหน้า', `name` varchar(100) DEFAULT NULL COMMENT 'ชื่อ', `surname` varchar(100) DEFAULT NULL COMMENT 'นามสกุล', `address` text COMMENT 'ที่อยู่', `zip_code` varchar(10) DEFAULT NULL COMMENT 'รหัสไปรษณีย์', `birthday` date DEFAULT NULL COMMENT 'วันเกิด', `email` varchar(100) DEFAULT NULL COMMENT 'อีเมล์', `mobile_phone` varchar(20) DEFAULT NULL COMMENT 'เบอร์มือถือ', `modify_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'แก้ไขวันที่', `create_date` datetime DEFAULT NULL COMMENT 'สร้างวันที่', `position` varchar(150) DEFAULT NULL COMMENT 'ตำแหน่งงาน', `salary` int(11) DEFAULT NULL COMMENT 'เงินเดือน', `expire_date` date DEFAULT NULL COMMENT 'วันที่ลาออก', `website` varchar(150) DEFAULT NULL, `skill` varchar(255) DEFAULT 'ความสามารถ', `countries` varchar(10) DEFAULT NULL COMMENT 'ประเทศ', `age` int(11) DEFAULT NULL COMMENT 'อายุ', `experience` varchar(10) DEFAULT NULL COMMENT 'ประสบการณ์การทำงาน', `personal_id` varchar(20) DEFAULT '20' COMMENT 'เลขที่บัตรประชาชน', `marital` int(11) DEFAULT NULL COMMENT 'สถานนะภาพการสมรส', `province` varchar(6) DEFAULT NULL COMMENT 'จังหวัด', `amphur` varchar(6) DEFAULT NULL COMMENT 'อำเภอ', `district` varchar(6) DEFAULT NULL COMMENT 'ตำบล', `social` varchar(150) DEFAULT NULL COMMENT 'ใช้ social network อะไรบ้าง', `resume` varchar(100) DEFAULT NULL COMMENT 'ไฟล์ resume', `token_forupload` varchar(100) DEFAULT NULL, `count_download_resume` int(11) DEFAULT NULL COMMENT 'นับจำนวนที่ download resume', PRIMARY KEY (`emp_id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of `employee` -- ---------------------------- BEGIN; INSERT INTO `employee` VALUES ('1', '1', 'นาย', 'สาธิต', 'สีถาพล', '44/54 ม.2 หมู่บ้านกัลยารัตน์ 3 ถนน ชาตะผดุง', '40000', '1984-02-19', '<EMAIL>', '09-1419-2801', '2015-03-20 10:32:48', '2015-03-20 01:26:04', 'นักวิชาการคอมพิวเตอร์', '73000', null, 'http://www.dimpled.me', 'Objective C,PHP,SQL,FoxPro,ASP', 'TH', '31', '7 ปี', '7474747474774', '2', '28', '393', '3491', 'facebook,twiter,google+', '8cc147dfb163f6c57a1f9b5a6853a091.pdf', 'iOOxVkSwrurplsO0DicB-K', '2'); COMMIT; SET FOREIGN_KEY_CHECKS = 1;
-- phpMyAdmin SQL Dump -- version 4.9.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3308 -- Generation Time: Mar 17, 2020 at 09:38 AM -- Server version: 8.0.18 -- 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: `fitkid` -- -- -------------------------------------------------------- -- -- Table structure for table `admins` -- DROP TABLE IF EXISTS `admins`; CREATE TABLE IF NOT EXISTS `admins` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `type` enum('superadmin','admin') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'admin', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'avatar-2.jpg', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `admins` -- INSERT INTO `admins` (`id`, `name`, `email`, `password`, `remember_token`, `type`, `created_at`, `updated_at`, `image`) VALUES (1, 'Admin', '<EMAIL>', <PASSWORD>', 'ufTLq9YMiuDD6dMRkLYfvlXF8Y7pe9j9rcBkIvLEogrZSoxEjotHsm6lGXg2', 'admin', NULL, '2020-03-06 00:40:58', NULL); -- -------------------------------------------------------- -- -- Table structure for table `banners` -- DROP TABLE IF EXISTS `banners`; CREATE TABLE IF NOT EXISTS `banners` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` text, `image` varchar(255) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; -- -- Dumping data for table `banners` -- INSERT INTO `banners` (`id`, `title`, `image`, `created_at`, `updated_at`) VALUES (1, 'We Create Your Safety', '<PASSWORD>', '2020-03-06 01:02:11', '2020-03-06 01:02:11'), (2, 'Best Institute For Karate', '2d190e2d908aa6be95b25a1f5a1cbaaf.jpg', '2020-03-06 01:03:07', '2020-03-06 01:22:27'), (3, 'We Make Your Kids Fit', 'b208a5edff5483cc41890c371160bbd2.jpg', '2020-03-06 01:03:33', '2020-03-06 01:03:33'); -- -------------------------------------------------------- -- -- Table structure for table `batch` -- DROP TABLE IF EXISTS `batch`; CREATE TABLE IF NOT EXISTS `batch` ( `id` int(11) NOT NULL AUTO_INCREMENT, `course_id` int(25) NOT NULL DEFAULT '0', `open_time` varchar(25) NOT NULL, `close_time` varchar(25) NOT NULL, `start_date` date NOT NULL, `end_date` date NOT NULL, `expiry_day` int(25) NOT NULL DEFAULT '0', `class_size` int(255) NOT NULL DEFAULT '0', `status` enum('expire','not_expire') NOT NULL DEFAULT 'not_expire', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Dumping data for table `batch` -- INSERT INTO `batch` (`id`, `course_id`, `open_time`, `close_time`, `start_date`, `end_date`, `expiry_day`, `class_size`, `status`, `created_at`) VALUES (1, 4, '01:00', '02:00', '2020-05-01', '2020-06-01', 31, 20, 'not_expire', '2020-03-17 03:50:33'); -- -------------------------------------------------------- -- -- Table structure for table `class` -- DROP TABLE IF EXISTS `class`; CREATE TABLE IF NOT EXISTS `class` ( `id` int(11) NOT NULL AUTO_INCREMENT, `student_id` int(25) DEFAULT '0', `course_id` int(25) NOT NULL DEFAULT '0', `batch_id` int(25) NOT NULL DEFAULT '0', `start_from` date NOT NULL, `expiry_days` int(25) NOT NULL DEFAULT '0', `status` enum('not_expire','expire') NOT NULL DEFAULT 'not_expire', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Dumping data for table `class` -- INSERT INTO `class` (`id`, `student_id`, `course_id`, `batch_id`, `start_from`, `expiry_days`, `status`, `created_at`) VALUES (1, 1, 1, 2, '2020-03-11', 30, 'not_expire', '2020-03-11 01:08:03'), (2, 1, 1, 1, '2020-03-11', 30, 'not_expire', '2020-03-11 01:18:50'), (3, 1, 1, 2, '2020-03-17', 30, 'not_expire', '2020-03-17 01:42:28'), (4, 1, 1, 2, '2020-03-17', 30, 'not_expire', '2020-03-17 01:42:49'), (5, 1, 1, 2, '2020-03-17', 30, 'not_expire', '2020-03-17 01:42:49'), (6, 1, 1, 2, '2020-03-17', 30, 'not_expire', '2020-03-17 01:42:49'); -- -------------------------------------------------------- -- -- Table structure for table `contact` -- DROP TABLE IF EXISTS `contact`; CREATE TABLE IF NOT EXISTS `contact` ( `id` int(55) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `mobile` varchar(55) NOT NULL, `subject` varchar(255) NOT NULL, `message` text NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Dumping data for table `contact` -- INSERT INTO `contact` (`id`, `name`, `email`, `mobile`, `subject`, `message`, `created_at`) VALUES (1, '<NAME>', '<EMAIL>', '01234567890', 'Zero Hour -Promotion Codesdfsdf', 'ddvfxgvdf', '2020-03-12 04:37:41'), (2, '<NAME>', '<EMAIL>', '01234567890', 'Zero Hour -USERNAME', 'esfsgfd', '2020-03-12 04:38:17'), (3, '<NAME>', '<EMAIL>', '01234567890', 'Domain Reneval Issues www.itservicepark.com', 'fdscsv', '2020-03-12 04:38:49'), (4, 'deepika', '<EMAIL>', '9109285994', 'demo', 'hi', '2020-03-17 00:35:56'); -- -------------------------------------------------------- -- -- Table structure for table `course` -- DROP TABLE IF EXISTS `course`; CREATE TABLE IF NOT EXISTS `course` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `image` varchar(500) NOT NULL, `fees` int(55) NOT NULL DEFAULT '0', `description` text NOT NULL, `age_from` int(15) NOT NULL DEFAULT '0', `age_to` int(15) NOT NULL DEFAULT '0', `class_size` int(15) NOT NULL DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Dumping data for table `course` -- INSERT INTO `course` (`id`, `name`, `image`, `fees`, `description`, `age_from`, `age_to`, `class_size`, `created_at`, `updated_at`) VALUES (1, 'Imagination Classes', '7d870982d38558e05e203c577c6e889c.jpg', 20, 'test', 2, 5, 20, '2020-03-06 03:15:08', '2020-03-06 03:15:32'), (4, 'Gaming Classes', 'f19574f91c778f54a63cccf1e4fb4566.jpg', 30, 'test\r\n \r\n ', 2, 6, 20, '2020-03-11 01:43:48', '2020-03-17 01:26:58'), (5, 'Learning Classes', 'f06f33d6c23d6c875721e5fe6ab13fcd.jpg', 25, 'test\r\n ', 2, 20, 30, '2020-03-11 01:44:16', '2020-03-11 01:48:08'); -- -------------------------------------------------------- -- -- Table structure for table `gallery` -- DROP TABLE IF EXISTS `gallery`; CREATE TABLE IF NOT EXISTS `gallery` ( `id` int(11) NOT NULL AUTO_INCREMENT, `image` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `created_at` timestamp NOT NULL, `updated_at` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Dumping data for table `gallery` -- INSERT INTO `gallery` (`id`, `image`, `created_at`, `updated_at`) VALUES (3, 'd4efe06656fd5431ffa51ffc1f5aab2f.jpg', '2020-03-06 01:25:00', '2020-03-06 01:25:00'), (4, '13917f0b7cd75efaac7289ce3598a03b.jpg', '2020-03-06 01:25:06', '2020-03-06 01:25:06'), (5, '2ff50c4230436340a1c5fafc172cb536.jpg', '2020-03-06 01:25:11', '2020-03-06 01:25:11'), (6, '3d34f93c93af62830d193e4f496ac3c8.jpg', '2020-03-06 01:25:15', '2020-03-06 01:25:15'), (7, '<PASSWORD>a6<PASSWORD>.jpg', '2020-03-06 01:25:20', '2020-03-06 01:25:20'), (8, 'e882ab9d50d42448284954cb<PASSWORD>.jpg', '2020-03-06 01:25:25', '2020-03-06 01:25:25'), (9, 'fd712578e2f1e2e1e108a0dbf4c3acf1.jpg', '2020-03-06 01:25:30', '2020-03-06 01:25:30'); -- -------------------------------------------------------- -- -- Table structure for table `students` -- DROP TABLE IF EXISTS `students`; CREATE TABLE IF NOT EXISTS `students` ( `id` int(11) NOT NULL AUTO_INCREMENT, `course_id` int(55) NOT NULL DEFAULT '0', `name` varchar(200) NOT NULL, `email` varchar(55) NOT NULL, `password` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `mobile` varchar(25) NOT NULL, `address` text NOT NULL, `gender` enum('Male','Female') NOT NULL, `education` varchar(255) NOT NULL, `status` enum('pending','approved','blocked','disabled') NOT NULL DEFAULT 'pending', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Dumping data for table `students` -- INSERT INTO `students` (`id`, `course_id`, `name`, `email`, `password`, `mobile`, `address`, `gender`, `education`, `status`, `created_at`) VALUES (1, 1, 'User11', '<EMAIL>', <PASSWORD>', '01234567890', 'Indore', 'Male', 'scd', 'approved', '2020-03-06 04:59:15'); -- -------------------------------------------------------- -- -- Table structure for table `testimonial` -- DROP TABLE IF EXISTS `testimonial`; CREATE TABLE IF NOT EXISTS `testimonial` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` text NOT NULL, `name` varchar(255) NOT NULL, `designation` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Dumping data for table `testimonial` -- INSERT INTO `testimonial` (`id`, `description`, `name`, `designation`, `created_at`, `updated_at`) VALUES (3, 'Teritatis et quasi architecto. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium dolore mque laudantium, totam rem aperiam', 'Johnathen', 'Businessman', '2020-03-16 01:02:34', '2020-03-16 01:02:34'); 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 */;
<filename>db/schema.sql DROP DATABASE IF EXISTS tracker_db; CREATE DATABASE tracker_db; USE tracker_db; CREATE TABLE department ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(30), PRIMARY KEY (id) ); CREATE TABLE roles ( id INT NOT NULL AUTO_INCREMENT, title VARCHAR(30), salary DECIMAL, department_id INT, PRIMARY KEY (id), FOREIGN KEY (department_id) REFERENCES department(id) ); CREATE TABLE employee ( id INT NOT NULL AUTO_INCREMENT, first_name VARCHAR(30), last_name VARCHAR(30), roles_id INT, manager_id INT, PRIMARY KEY (id), FOREIGN KEY (roles_id) REFERENCES roles(id), FOREIGN KEY (manager_id) REFERENCES employee(id) );
<reponame>fahmiaga/bajuku-e-commerce -- phpMyAdmin SQL Dump -- version 4.9.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 05 Mar 2020 pada 15.31 -- Versi server: 10.4.8-MariaDB -- Versi PHP: 7.3.11 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: `bajuku` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `invoice` -- CREATE TABLE `invoice` ( `id` int(11) NOT NULL, `email` varchar(128) NOT NULL, `nama` varchar(56) NOT NULL, `alamat` varchar(255) NOT NULL, `tgl_pesan` datetime NOT NULL, `batas_bayar` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `invoice` -- INSERT INTO `invoice` (`id`, `email`, `nama`, `alamat`, `tgl_pesan`, `batas_bayar`) VALUES (4, '<EMAIL>', '<NAME>', 'Jl Bunga No.30', '2019-12-02 20:38:39', '2019-12-03 20:38:39'), (35, '<EMAIL>', '<NAME>', 'Jl. Baru No.3', '2019-12-05 14:51:56', '2019-12-06 14:51:56'), (36, '<EMAIL>', '<NAME>', 'Jl. Baru No.3', '2019-12-24 17:31:28', '2019-12-25 17:31:28'), (37, '<EMAIL>', '<NAME>', 'Jl Bunga No.39, medan', '2020-03-02 09:24:07', '2020-03-03 09:24:07'), (38, '<EMAIL>', '<NAME>', 'jln. Pinus no.45', '2020-03-02 10:56:27', '2020-03-03 10:56:27'); -- -------------------------------------------------------- -- -- Struktur dari tabel `item` -- CREATE TABLE `item` ( `id` int(11) NOT NULL, `nama` varchar(128) NOT NULL, `jenis` varchar(50) NOT NULL, `gender` varchar(50) NOT NULL, `stock` int(128) NOT NULL, `ukuran` varchar(20) NOT NULL, `harga` int(128) NOT NULL, `gambar` varchar(128) NOT NULL, `gambar2` varchar(128) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `item` -- INSERT INTO `item` (`id`, `nama`, `jenis`, `gender`, `stock`, `ukuran`, `harga`, `gambar`, `gambar2`) VALUES (1, 'Kemeja Atasan Wanita Panjang', 'Kemeja', 'Perempuan', 100, 'M', 60000, '42d4f781e99ed438963aa138f2381fdb.jpg', 'images_(2).jpg'), (2, 'Billabong Yellow Shirt', 'Kaos', 'Laki-laki', 100, 'S', 300000, '11677788_fpx1.jpg', '11677788_fpx.jpg'), (3, 'Jaket Cotton Polos', 'Jacket', 'Perempuan', 80, 'S', 150000, 'JAKET_CARDINAL_CEWEK.jpg', '337020_3e4d0cb4-60dd-4b95-9cfb-06ad194dc61a.jpg'), (4, 'Jaket Kupluk putih', 'Jacket', 'Laki-laki', 20, 'S', 200000, 'a.jpg', '1214610856.g_0-w_g.jpg'), (5, 'Black Bird', 'Kaos', 'Laki-laki', 100, 'S', 100000, 'b.jpg', 'back.jpg'), (6, 'Kemeja Pria', 'Kemeja', 'Laki-laki', 100, 'S', 150000, 'desain-baju-kemeja-pria-lengan-panjang-terbaru-3_(1).jpg', 'desain-baju-kemeja-pria-lengan-panjang-terbaru-3.jpg'), (7, 'Kaos Wanita ', 'Kaos', 'Perempuan', 80, 'S', 70000, 'aa808aa4dd32f7a4fb3bb7fb7efba713.jpg', 'ec1fd95cabcb25c3e50d4dac0133dc44.jpg'), (8, 'Kemeja Lengan Panjang Motif Cantik', 'Kemeja', 'Perempuan', 100, 'M', 150000, 'd085083d766bd9e678abb8bb8c0a8385.jpg', 'aa.jpg'), (9, 'Sweater Putih Tebal', 'Jacket', 'Perempuan', 10, 'M', 150000, '1d1177599215afcda53a4d3d5406bb67.jpg', '7e2e4b2e5e4d51e396459d1a54fc622d.jpg'), (10, 'Kemeja Atasan Wanita Corak keren', 'Kemeja', 'Perempuan', 50, 'M', 60000, '5f70180be13145fa5fb09426cb1f7971.jpg', 'c1312f561b68052d0dfb2a65f1ff20e6.jpg'), (11, 'Kemeja Panjang Wanita Dingin', 'Kemeja', 'Perempuan', 100, 'M', 60000, '6f13ae68b6d4788a632815549dcd3805.jpg', 'd36d2eeb1d37e4a1fd8e1a990ab72522.jpg'), (12, 'Kaos Pink Wanita', 'Kaos', 'Perempuan', 80, 'S', 50000, '57a4d77a7f96f510c2242c84e4f563f4.jpg', '5095109_5e2ba828-82fa-4c3b-8c17-11fe1bbc1d5d_1080_1080.jpg'), (13, '<NAME>', 'Jacket', 'Perempuan', 20, 'M', 500000, '4415f629585851d3dedf8bba55802cc9.jpg', 'Jaket-kulit-wanita-gcw18-mocca.jpg'), (14, '<NAME>', 'Jacket', 'Perempuan', 80, 'M', 200000, '49129c9722548ac8622b6e5066356c3b.jpg', '13637242_8d98516d-8376-40ff-8987-5d1da926fd17_800_800.jpg'), (15, 'Kemeja Pria Dragon ', 'Kemeja', 'Laki-laki', 50, 'S', 100000, '67782d637e5269f7c6b164e25b68d0a4.jpg', 'Baju_Kemeja_Pria_Dragon_X_Black__Kemeja_Cowok_Corak_Dan_mode.jpg'), (16, 'Kemeja Kerja Pria', 'Kemeja', 'Laki-laki', 80, 'S', 80000, '240277_216a3436-e489-4746-9dcc-0f8221b0a145.jpg', 'kemeja_abu_motif_putih.jpg'), (17, 'Kemeja Kerja Pria Motif Simpel', 'Kemeja', 'Laki-laki', 80, 'L', 80000, '4337227_808b84d3-5abd-4aec-93b5-61e46e534b7a.jpg', 'Alonzo_abu_kemeja_pria_katun_stretch.jpg'), (18, 'Jaket Varsity Night Black', 'Jacket', 'Laki-laki', 20, 'S', 450000, '11211932_B.jpg', 'JAKET_VARSITY_NIGHT_BLACK__SK_34_.jpg'), (19, 'Kaos Oblong Pria', 'Kaos', 'Laki-laki', 80, 'XL', 50000, '47166891_11fd227a-4a05-43ab-97fb-797cc9cd34e4_975_1200.jpg', 'KAOS_PHILLIP_PLEIN_P.jpg'), (20, 'B<NAME>', 'Kemeja', 'Perempuan', 80, 'M', 150000, 'Baju-wanita-murah-KMJ04.jpg', 'c27e082d303746c5ade6ba1099bfea7f.jpg'), (21, '<NAME>', 'Kaos', 'Laki-Laki', 20, 'M', 150000, '3c95a18cac1895f5778578658c647657.jpg', 'de7775899c79077e2fc0ef6a09f7bf24.jpg'), (22, 'Jaket Pria M<NAME>', 'Kemeja', 'Laki-laki', 50, 'M', 1000000, 'Highlight_jenis-macam-model-koleksi-jaket-pria-cowok-trendy-fashionable-terbaru-branded_11.jpg', 'murah_Jaket_Pria_keren_Kece_baday_berkualitas.jpg'), (23, 'Kaos Wanita Musim Panas', 'Kaos', 'Perempuan', 3, 'S', 10000, 'hitam-seksi-musim-panas-lengan-pendek-t-shirt-jahe-kuning-0152-07222364-2824742a65e59840f3c5827d79afdac3-product.jpg', 'versi-korea-dari-katun-pullover-slim-t-shirt-bottoming-kemeja-kuning-leher-0830-60822564-46811ae1ea8675b26027ca9a973fbfff-produc'), (24, 'Jaket Motor Pria Terlaris', 'Jacket', 'Laki-laki', 80, 'M', 250000, 'Jaket_Pria_Terbaru_Terlaris_.jpg', 'murah_Jaket_Pria_keren_Kece_baday_berkualitas.jpg'), (25, 'Kemeja Polo Country Original', 'Kemeja', 'Laki-laki', 80, 'M', 400000, 'magentaroom-polo-country-kemeja-pria-lengan-panjang-biru.jpg', 'POLO_COUNTRY_C27_12_Original_Kemeja_Pria_Polos_Panjang_Abu_T.jpg'), (26, 'Kaos hitam', 'Kaos', 'Laki-Laki', 100, 'S', 150000, 'kabel_primer.jpg', 'KSATRIA_BAJA_HITAM_RX_ROBO_SATRIA_BAJA_HITAM_RX_ROBO.jpg'); -- -------------------------------------------------------- -- -- Struktur dari tabel `otp` -- CREATE TABLE `otp` ( `id` int(11) NOT NULL, `email` varchar(128) NOT NULL, `user_otp` int(11) NOT NULL, `date_created` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Struktur dari tabel `pesanan` -- CREATE TABLE `pesanan` ( `id` int(11) NOT NULL, `id_invoice` int(11) NOT NULL, `id_brg` int(11) NOT NULL, `nama_brg` varchar(50) NOT NULL, `jumlah` int(100) NOT NULL, `harga` int(100) NOT NULL, `pilihan` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `pesanan` -- INSERT INTO `pesanan` (`id`, `id_invoice`, `id_brg`, `nama_brg`, `jumlah`, `harga`, `pilihan`) VALUES (6, 3, 25, 'Kemeja Polo Country Original', 1, 400000, ''), (7, 3, 23, 'Kaos Wanita Musim Panas', 1, 10000, ''), (8, 3, 22, '<NAME>', 1, 1000000, ''), (9, 4, 22, '<NAME>', 1, 1000000, ''), (10, 4, 19, '<NAME>', 1, 50000, ''), (11, 4, 2, 'Billabong Yellow Shirt', 1, 300000, ''), (12, 4, 21, '<NAME>', 1, 150000, ''), (27, 34, 25, 'Kemeja Polo Country Original', 1, 400000, ''), (28, 35, 24, 'Jaket Motor Pria Terlaris', 1, 250000, ''), (29, 36, 25, 'Kemeja Polo Country Original', 1, 400000, ''), (30, 37, 25, 'Kemeja Polo Country Original', 1, 400000, ''), (31, 37, 24, 'Jaket Motor Pria Terlaris', 1, 250000, ''), (32, 37, 23, 'Kaos Wanita Musim Panas', 1, 10000, ''), (33, 38, 25, 'Kemeja Polo Country Original', 1, 400000, ''), (34, 38, 23, 'Kaos Wanita Musim Panas', 1, 10000, ''); -- -------------------------------------------------------- -- -- Struktur dari tabel `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `nama` varchar(128) NOT NULL, `email` varchar(128) NOT NULL, `foto` varchar(128) NOT NULL, `password` varchar(256) NOT NULL, `role_id` int(11) NOT NULL, `is_active` int(1) NOT NULL, `date_created` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `user` -- INSERT INTO `user` (`id`, `nama`, `email`, `foto`, `password`, `role_id`, `is_active`, `date_created`) VALUES (1, '<NAME>', '<EMAIL>', 'kamen-rider-shadow-moon.jpg', '$2y$10$qU..TdFQ1FL.sx6UVbxSvunhuQY0dGYYJ1kSFI8cRCPbdPzRCvpB6', 1, 1, 1574910093), (17, '<NAME>', '<EMAIL>', '61351301_441092916463287_735660335698598908_n.jpg', '$2y$10$ocjy2ALmTZNxVfNo5f/6Cu5EsKcbER3PHY3lXGqJWKpnTnKEGjPzq', 2, 1, 1575083882), (18, '<NAME>', '<EMAIL>', 'KSATRIA_BAJA_HITAM_RX_ROBO_SATRIA_BAJA_HITAM_RX_ROBO1.jpg', '$2y$10$9fyU4iw.6XSeiazsTjPM6OB2ZeOO0nT3jPNMJEcbDgNtoUIoVMjk6', 2, 1, 1575514017); -- -------------------------------------------------------- -- -- Struktur dari tabel `user_token` -- CREATE TABLE `user_token` ( `id` int(11) NOT NULL, `email` varchar(128) NOT NULL, `token` varchar(128) NOT NULL, `date_created` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `user_token` -- INSERT INTO `user_token` (`id`, `email`, `token`, `date_created`) VALUES (15, '<EMAIL>', 'mNCaMNzPpjzp51+LIK7ix29uIolm7pkHAmd3xPDsA60=', 1575083882), (17, '<EMAIL>', 'CXNXajeDKdWJZyDZSxzGyMTAAcQKZuT7N++y6RCREZw=', 1575514807), (18, '<EMAIL>', 'CuwV4OEtOqusJw5fbYnc3an1j5WIYcm2gQsdY6vXE1g=', 1583115748), (19, '<EMAIL>', 'Yvx3zVaXjcWJ4gHbX8I3NnrU2F2/CHzZ5uWb25DQE8E=', 1583115890); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `invoice` -- ALTER TABLE `invoice` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `item` -- ALTER TABLE `item` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `otp` -- ALTER TABLE `otp` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `pesanan` -- ALTER TABLE `pesanan` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `user_token` -- ALTER TABLE `user_token` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT untuk tabel yang dibuang -- -- -- AUTO_INCREMENT untuk tabel `invoice` -- ALTER TABLE `invoice` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39; -- -- AUTO_INCREMENT untuk tabel `item` -- ALTER TABLE `item` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27; -- -- AUTO_INCREMENT untuk tabel `otp` -- ALTER TABLE `otp` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39; -- -- AUTO_INCREMENT untuk tabel `pesanan` -- ALTER TABLE `pesanan` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35; -- -- AUTO_INCREMENT untuk tabel `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19; -- -- AUTO_INCREMENT untuk tabel `user_token` -- ALTER TABLE `user_token` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20; 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 */;
-- ============================================= -- Author: <NAME> -- Create date: March 1, 2011 -- Description: Synthesizes a '--' period Account for any that have numerical -- periods entries, but not corresponding '--' for the relative fiscal year. -- NOTE: Run this after newly inserting the accounts. -- -- Modifications: -- 2011-06-15 by kjt: -- Added fringe benefit fields. -- 2011-08-23 by kjt: -- Added MgrId, ReviewerId, ReviewerName, and PrincipalInvestigatorName as -- per Scott Kirkland (required for new Purchasing application). -- ============================================= CREATE PROCEDURE [dbo].[usp_InsertMissingAccountsForDashDashPeriods] -- Add the parameters for the stored procedure here @IsDebug bit = 0 --Set to 1 to print SQL only. AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. --SET NOCOUNT ON; DECLARE @TSQL varchar(MAX) = '' -- Insert statements for procedure here SELECT @TSQL = ' INSERT INTO Accounts SELECT A.[Year] ,''--'' [Period] ,A.[Chart] ,A.[Account] ,[Org] ,[AccountName] ,[SubFundGroupNum] ,[SubFundGroupTypeCode] ,[FundGroupCode] ,[EffectiveDate] ,[CreateDate] ,[ExpirationDate] , CONVERT(smalldatetime, GETDATE(), 120) AS [LastUpdateDate] ,[MgrId] ,[MgrName] ,[ReviewerId] ,[ReviewerName] ,[PrincipalInvestigatorId] ,[PrincipalInvestigatorName] ,[TypeCode] ,[Purpose] ,[ControlChart] ,[ControlAccount] ,[SponsorCode] ,[SponsorCategoryCode] ,[FederalAgencyCode] ,[CFDANum] ,[AwardNum] ,[AwardTypeCode] ,[AwardYearNum] ,[AwardBeginDate] ,[AwardEndDate] ,[AwardAmount] ,[ICRTypeCode] ,[ICRSeriesNum] ,[HigherEdFuncCode] ,[ReportsToChart] ,[ReportsToAccount] ,[A11AcctNum] ,[A11FundNum] ,[OpFundNum] ,[OpFundGroupCode] ,[AcademicDisciplineCode] ,[AnnualReportCode] ,[PaymentMediumCode] ,[NIHDocNum] ,[FringeBenefitIndicator] ,[FringeBenefitChart] ,[FringeBenefitAccount] ,[YeType] ,CONVERT(char(4), A.Year) + ''|'' + ''--'' + ''|'' + RTRIM(A.Chart) + ''|'' + A.Account AS [AccountPK] ,CONVERT(char(4), A.Year) + ''|'' + ''--'' + ''|'' + RTRIM(A.Chart) + ''|'' + A.Org AS [OrgFK] ,[FunctionCodeID] ,CONVERT(char(4), A.Year) + ''|'' + ''--'' + ''|'' + RTRIM(A.Chart) + ''|'' + A.OpFundNum AS [OPFundFK] ,[IsCAES] FROM Accounts A INNER JOIN ( select Year, MAX(Period) Period, Chart, Account FROM Accounts WHERE CONVERT(char(4), Year) + ''|'' + ''--'' + ''|'' + RTRIM(Chart) + ''|'' + Account NOT IN ( SELECT AccountPK FROM Accounts WHERE Period = ''--'' ) group by year, chart, Account ) AIG ON A.Year = AIG.Year AND A.Period = AIG.Period AND A.Chart = AIG.Chart AND A.Account = AIG.Account ' IF @IsDebug = 1 PRINT @TSQL ELSE EXEC(@TSQL) END
create type _stats_agg_accum_type AS ( n bigint, min double precision, max double precision, m1 double precision, m2 double precision, m3 double precision, m4 double precision ); create type _stats_agg_result_type AS ( count bigint, min double precision, max double precision, mean double precision, variance double precision, skewness double precision, kurtosis double precision ); create or replace function _stats_agg_accumulator(_stats_agg_accum_type, double precision) returns _stats_agg_accum_type AS ' DECLARE a ALIAS FOR $1; x alias for $2; n1 bigint; delta double precision; delta_n double precision; delta_n2 double precision; term1 double precision; BEGIN if x IS NOT NULL then n1 = a.n; a.n = a.n + 1; delta = x * 1.0 - a.m1; delta_n = delta * 1.0 / a.n; delta_n2 = delta_n * delta_n * 1.0; term1 = delta * delta_n * n1 * 1.0; a.m1 = a.m1 + delta_n; a.m4 = a.m4 + term1 * delta_n2 * (a.n * a.n - 3.0 * a.n + 3) + 6.0 * delta_n2 * a.m2 - 4.0 * delta_n * a.m3; a.m3 = a.m3 + term1 * delta_n * (a.n - 2.0) - 3.0 * delta_n * a.m2; a.m2 = a.m2 + term1; a.min = least(a.min, x); a.max = greatest(a.max, x); end if; RETURN a; END; ' language plpgsql; create or replace function _stats_agg_finalizer(_stats_agg_accum_type) returns _stats_agg_result_type AS ' BEGIN RETURN row( $1.n, $1.min, $1.max, $1.m1, $1.m2 / nullif(($1.n - 1.0), 0), case when $1.m2 = 0 then null else sqrt($1.n) * $1.m3 / nullif(($1.m2 ^ 1.5), 0) end, case when $1.m2 = 0 then null else $1.n * $1.m4 / nullif(($1.m2 * $1.m2) - 3.0, 0) end ); END; ' language plpgsql; create aggregate stats_agg(double precision) ( sfunc = _stats_agg_accumulator, stype = _stats_agg_accum_type, finalfunc = _stats_agg_finalizer, initcond = '(0,,, 0, 0, 0, 0)' );
<filename>PFA/WebContent/WEB-INF/ref/make-tables.sql CREATE TABLE `member_tier` ( `code` varchar(20) NOT NULL COMMENT '회원 등급 코드', `name` varchar(20) NOT NULL COMMENT '회원 등급 이름', `order_priority` int(11) NOT NULL COMMENT '상위 노출 우선 순위', PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='회원 등급'; CREATE TABLE `member` ( `id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '회원 아이디', `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '회원 성함', `nickname` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '회원 닉네임', `email_address` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '회원 이메', `birth` date NOT NULL DEFAULT '0000-00-00' COMMENT '회원 생년월일', `sex` varchar(11) NOT NULL, `profile_picture` varchar(20) DEFAULT NULL COMMENT '회원 프로필 사진', `introduce` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '한 줄 소개', `auth_code` varchar(20) NOT NULL COMMENT '회원 등급코드', `is_valid` int(11) DEFAULT '1' COMMENT '사용가능 상태인지(0 or 1)', `is_resign` int(11) DEFAULT '0' COMMENT '회원 탈퇴 여부(0 or1)', `regdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '가입일자', PRIMARY KEY (`id`), KEY `member_auth` (`auth_code`), CONSTRAINT `member_auth` FOREIGN KEY (`auth_code`) REFERENCES `member_tier` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='회원 테이블'; CREATE TABLE `member_password` ( `seq` int(11) NOT NULL AUTO_INCREMENT COMMENT '순차 인덱스', `member_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '유저 아이디', `member_password` varchar(50) NOT NULL COMMENT '유저 패스워드', `regdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '유저가 비밀번호를 지정한 날짜 (가장 최신 날짜)', PRIMARY KEY (`seq`), KEY `member_id_client_password_change_log` (`member_id`), CONSTRAINT `member_id_client_password` FOREIGN KEY (`member_id`) REFERENCES `member` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='회원 비밀번호 지정 내역'; CREATE TABLE `member_login_log` ( `seq` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row가 늘어날 때 마다 순차적으로 늘어나는 인덱스', `member_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '유저 ID', `tried_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '유저가 접근한 시간', `browser_info` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '''unknown''' COMMENT '접근한 클라이언트의 브라우저 정보', `req_ip` varchar(20) NOT NULL COMMENT '접근한 클라이언트의 IP', `is_success` int(11) NOT NULL COMMENT '로그인 성공 여부', PRIMARY KEY (`seq`), KEY `member_id_member_login_log` (`member_id`), CONSTRAINT `member_id_member_login_log` FOREIGN KEY (`member_id`) REFERENCES `member` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='회원 로그인 시도 로그'; CREATE TABLE `member_activity_type` ( `code` varchar(20) NOT NULL COMMENT '활동 코드', `name` varchar(20) NOT NULL COMMENT '활동의 이름', `order_priority` int(11) NOT NULL COMMENT '상위 노출 우선 순위', PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='활동 내역 종류'; CREATE TABLE `member_activity_log` ( `seq` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row가 늘어날 때 마다 순차적으로 늘어나는 인덱스', `member_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '유저 ID', `activity_code` varchar(20) NOT NULL COMMENT '활동 내역 종류 코드', `activity_content` varchar(20) DEFAULT NULL COMMENT '유저의 실제 활동 내역 이름', `is_open` int(11) NOT NULL COMMENT '공개 여부(0,1,2 :: 0 - 나만보기, 1- 팔로워에게만 공개, 2-전체 공개)', PRIMARY KEY (`seq`), KEY `member_id_activity_log` (`member_id`), KEY `activity_code` (`activity_code`), CONSTRAINT `activity_code` FOREIGN KEY (`activity_code`) REFERENCES `member_activity_type` (`code`), CONSTRAINT `member_id_activity_log` FOREIGN KEY (`member_id`) REFERENCES `member` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='회원 활동 내역'; CREATE TABLE `banned_string` ( `content` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '금지된 문자열 내용 regexp를 따름', PRIMARY KEY (`content`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='회원 지정 불가능 ID, 닉네임'; CREATE TABLE `server_log_stack` ( `seq` int(11) NOT NULL AUTO_INCREMENT, `year` varchar(11) NOT NULL, `month` varchar(11) NOT NULL, `date` varchar(11) NOT NULL, `hour` varchar(11) NOT NULL, `min` varchar(11) NOT NULL, `duration` int(11) NOT NULL, `regdate` date NOT NULL, PRIMARY KEY (`seq`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; CREATE TABLE `file_category` ( `code` varchar(20) NOT NULL, `name` varchar(20) DEFAULT NULL, `description` varchar(200) DEFAULT NULL, `order_priority` int(11) DEFAULT NULL, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='파일 종류'; CREATE TABLE `file_board_list` ( `board_id` varchar(30) NOT NULL, `board_name` varchar(100) NOT NULL, `description` varchar(500) DEFAULT NULL, `is_private` int(11) NOT NULL DEFAULT '0', `is_deleted` int(11) NOT NULL DEFAULT '0', `pwd` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, `owner_member_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `regdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`board_id`), KEY `board_mem_id` (`owner_member_id`), CONSTRAINT `board_mem_id` FOREIGN KEY (`owner_member_id`) REFERENCES `member` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; CREATE TABLE `uploaded_file` ( `board_id` varchar(30) NOT NULL, `file_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `description` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, `original_file_name` varchar(200) DEFAULT NULL, `original_file_ext` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, `file_category` varchar(50) DEFAULT NULL, `upload_member_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, `is_del` int(11) NOT NULL DEFAULT '0', `request_ip` varchar(20) DEFAULT NULL, `regdate` timestamp NULL DEFAULT NULL, PRIMARY KEY (`file_id`), KEY `boardid` (`board_id`), CONSTRAINT `boardid` FOREIGN KEY (`board_id`) REFERENCES `file_board_list` (`board_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='업로드된 파일'; CREATE TABLE `encoding_preset` ( `code` varchar(20) NOT NULL COMMENT '프리셋 코드 (영어)', `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '프리셋 이름 (한글)', `regdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='인코딩 옵션 프리셋목록'; CREATE TABLE `encoding_preset_option` ( `seq` int(11) NOT NULL AUTO_INCREMENT, `preset_code` varchar(20) NOT NULL COMMENT '프리셋 ID', `option_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '인코딩 옵션명', `option_value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '인코딩 옵션값', `orderby` int(11) NOT NULL, `regdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`seq`), KEY `encoding_preset_option-encoding_preset` (`preset_code`), CONSTRAINT `encoding_preset_option-encoding_preset` FOREIGN KEY (`preset_code`) REFERENCES `encoding_preset` (`code`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='인코딩 프리셋 옵션목록'; CREATE TABLE `encoding_queue` ( `seq` int(11) NOT NULL AUTO_INCREMENT, `file_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '원본 파일 ID', `preset_code` varchar(20) NOT NULL COMMENT '인코딩 옵션 프리셋', `status` varchar(20) NOT NULL COMMENT '인코딩 상태 (waiting : 대기중 / running : 진행중 / finished : 완료 / error : 알 수 없는 에러)', `s_date` timestamp NULL DEFAULT NULL COMMENT '인코딩 시작시간', `e_date` timestamp NULL DEFAULT NULL COMMENT '인코딩 완료시간', `new_directory` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '인코딩 파일 저장 디렉토리 (서버 어플리케이션에 로드된 HDD 디렉토리에서의 상대경로로 표시, ex: 1://video/720p/~~~.mp4)', `regdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`seq`), KEY `encoding_queue-encoding_preset` (`preset_code`), KEY `encoding_queue-video` (`file_id`), CONSTRAINT `encoding_queue-encoding_preset` FOREIGN KEY (`preset_code`) REFERENCES `encoding_preset` (`code`), CONSTRAINT `encoding_queue-video` FOREIGN KEY (`file_id`) REFERENCES `uploaded_file` (`file_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='인코딩 대기열 목록'; CREATE TABLE `file_division` ( `division_code` varchar(20) NOT NULL, `category_code` varchar(20) DEFAULT NULL, `division_name` varchar(20) DEFAULT NULL, `division_description` varchar(200) DEFAULT NULL, `order_priority` int(11) DEFAULT NULL, PRIMARY KEY (`division_code`), KEY `file_category` (`category_code`), CONSTRAINT `file_category` FOREIGN KEY (`category_code`) REFERENCES `file_category` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='저장된 파일 구분'; CREATE TABLE `uploaded_file_server_stored_directory` ( `seq` int(11) NOT NULL AUTO_INCREMENT, `file_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `file_ext` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `division_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `volume` bigint(20) DEFAULT NULL, `volume_str` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, `server_directory` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, PRIMARY KEY (`seq`), UNIQUE KEY `dir_fileID` (`file_id`,`division_code`), KEY `division` (`division_code`), CONSTRAINT `division` FOREIGN KEY (`division_code`) REFERENCES `file_division` (`division_code`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
SELECT [Name] FROM Towns ORDER BY [Name] SELECT [Name] FROM Departments ORDER BY [Name] SELECT FirstName, LastName, JobTitle, Salary FROM Employees ORDER BY Salary DESC
<reponame>acoustid/mbdata \set ON_ERROR_STOP 1 BEGIN; CREATE TABLE genre_alias_type ( -- replicate id SERIAL, -- PK, name TEXT NOT NULL, parent INTEGER, -- references genre_alias_type.id child_order INTEGER NOT NULL DEFAULT 0, description TEXT, gid uuid NOT NULL ); ALTER TABLE genre_alias_type ADD CONSTRAINT genre_alias_type_pkey PRIMARY KEY (id); CREATE UNIQUE INDEX genre_alias_type_idx_gid ON genre_alias_type (gid); -- generate_uuid_v3('6ba7b8119dad11d180b400c04fd430c8', 'genre_type' || id); INSERT INTO genre_alias_type (id, gid, name) VALUES (1, '61e89fea-acce-3908-a590-d999dc627ac9', 'Genre name'), (2, '5d81fc72-598a-3a9d-a85a-a471c6ba84dc', 'Search hint'); -- We drop and recreate the table to standardise it -- rather than adding a ton of rows to it out of the standard order. -- This is empty in production and mirrors but might not be on standalone CREATE TEMPORARY TABLE tmp_genre_alias ON COMMIT DROP AS SELECT * FROM genre_alias; DROP TABLE genre_alias; CREATE TABLE genre_alias ( -- replicate (verbose) id SERIAL, --PK genre INTEGER NOT NULL, -- references genre.id name VARCHAR NOT NULL, locale TEXT, edits_pending INTEGER NOT NULL DEFAULT 0 CHECK (edits_pending >= 0), last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW(), type INTEGER, -- references genre_alias_type.id sort_name VARCHAR NOT NULL, begin_date_year SMALLINT, begin_date_month SMALLINT, begin_date_day SMALLINT, end_date_year SMALLINT, end_date_month SMALLINT, end_date_day SMALLINT, primary_for_locale BOOLEAN NOT NULL DEFAULT false, ended BOOLEAN NOT NULL DEFAULT FALSE CHECK ( ( -- If any end date fields are not null, then ended must be true (end_date_year IS NOT NULL OR end_date_month IS NOT NULL OR end_date_day IS NOT NULL) AND ended = TRUE ) OR ( -- Otherwise, all end date fields must be null (end_date_year IS NULL AND end_date_month IS NULL AND end_date_day IS NULL) ) ), CONSTRAINT primary_check CHECK ((locale IS NULL AND primary_for_locale IS FALSE) OR (locale IS NOT NULL)), CONSTRAINT search_hints_are_empty CHECK ( (type <> 2) OR ( type = 2 AND sort_name = name AND begin_date_year IS NULL AND begin_date_month IS NULL AND begin_date_day IS NULL AND end_date_year IS NULL AND end_date_month IS NULL AND end_date_day IS NULL AND primary_for_locale IS FALSE AND locale IS NULL ) ) ); ALTER TABLE genre_alias ADD CONSTRAINT genre_alias_pkey PRIMARY KEY (id); CREATE INDEX genre_alias_idx_genre ON genre_alias (genre); CREATE UNIQUE INDEX genre_alias_idx_primary ON genre_alias (genre, locale) WHERE primary_for_locale = TRUE AND locale IS NOT NULL; INSERT INTO genre_alias (id, genre, name, locale, edits_pending, last_updated, type, sort_name) SELECT id, genre, name, locale, edits_pending, last_updated, 1, name -- sortname = name, type = genre name FROM tmp_genre_alias; COMMIT;
<reponame>TimonLio/rex-cms -- -- PostgreSQL database dump -- -- Started on 2008-04-03 20:50:55 SET client_encoding = 'UTF8'; SET standard_conforming_strings = off; SET check_function_bodies = false; SET client_min_messages = warning; SET escape_string_warning = off; SET search_path = public, pg_catalog; SET default_tablespace = ''; SET default_with_oids = false; -- -- TOC entry 1498 (class 1259 OID 16526) -- Dependencies: 6 -- Name: rax_attachment; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE rax_attachment ( id integer NOT NULL, title character varying(32) NOT NULL, upload_name character varying(128) NOT NULL, upload_date timestamp without time zone NOT NULL, file_path character varying(128) NOT NULL, downloads integer NOT NULL, size integer NOT NULL, article_id integer NOT NULL ); -- -- TOC entry 1499 (class 1259 OID 16529) -- Dependencies: 1498 6 -- Name: rax_attachment_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE rax_attachment_id_seq INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; -- -- TOC entry 1781 (class 0 OID 0) -- Dependencies: 1499 -- Name: rax_attachment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE rax_attachment_id_seq OWNED BY rax_attachment.id; -- -- TOC entry 1776 (class 2604 OID 16572) -- Dependencies: 1499 1498 -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE rax_attachment ALTER COLUMN id SET DEFAULT nextval('rax_attachment_id_seq'::regclass); -- -- TOC entry 1778 (class 2606 OID 16579) -- Dependencies: 1498 1498 -- Name: rax_attachment_primary; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY rax_attachment ADD CONSTRAINT rax_attachment_primary PRIMARY KEY (id); -- Completed on 2008-04-03 20:50:56 -- -- PostgreSQL database dump complete --
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Gegenereerd op: 27 sep 2016 om 10:20 -- Serverversie: 10.1.16-MariaDB -- PHP-versie: 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: `projectivorpim` -- -- -------------------------------------------------------- -- -- Tabelstructuur voor tabel `products` -- CREATE TABLE `products` ( `id` int(100) NOT NULL, `product` varchar(100) NOT NULL, `type` varchar(10) NOT NULL, `fabriek` varchar(10) NOT NULL, `aantal` int(10) NOT NULL, `prijs` varchar(10) NOT NULL, `inkoopprijs` varchar(10) NOT NULL, `verkoopprijs` varchar(10) NOT NULL, `waarschuwing` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Gegevens worden geëxporteerd voor tabel `products` -- INSERT INTO `products` (`id`, `product`, `type`, `fabriek`, `aantal`, `prijs`, `inkoopprijs`, `verkoopprijs`, `waarschuwing`) VALUES (1, 'Accuboorhamer', 'WX 382', 'Worx', 10, '69,55', '', '', '5'); -- -- Indexen voor geëxporteerde tabellen -- -- -- Indexen voor tabel `products` -- ALTER TABLE `products` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT voor geëxporteerde tabellen -- -- -- AUTO_INCREMENT voor een tabel `products` -- ALTER TABLE `products` MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; /*!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 */;
/* <NAME> CS 325 - Fall 2018 Last modified: 2019/02/01 */ -- NOTE! Run this script twice to avoid any errors having to do with -- sequence generation. prompt ==================================== prompt Deleting any current table contents. prompt ==================================== /* I've noticed that when I run these delete statements on tables that use sequences, it seems like there are one or two rows that end up not being deleted at all for some reason. I'm not getting any error messages about foreign key constraint violations, but I've counted by hand and I should have at least 10 rows in most of these tables. The output from running this script may show 8 or 9 rows being deleted, instead of 10. This is an interesting bug worth exploring in the future. 2019/02/01: Attempted to fix the bug by changing all "delete from"s, seen in delete statements from daycare_enrollment up to and including cat, to "delete." This did not seem to affect the problem at all. */ delete daycare_enrollment; delete doggy_daycare; delete boarding_enrollment; delete boarding; delete class_enrollment; delete class_session_date; delete pet_permitted_in_class; delete class; delete worker_providing_service; delete service; delete volunteer_handling_permissions; delete volunteer; delete employee_formal_qualifications; delete employee; delete worker_email_addr; delete worker_phone_num; delete worker; delete dog; delete cat; delete pet_diet_restriction; delete pet_medication_needed; delete pet_vaccine_received; delete pet; delete owner_email_addr; delete owner_phone_num; delete owner; prompt =================================================== prompt Creating sequence to generate owner_ids for Owners. prompt =================================================== drop sequence owner_id_seq; create sequence owner_id_seq start with 10; prompt =============================================== prompt Creating sequence to generate pet_ids for Pets. prompt =============================================== drop sequence pet_id_seq; create sequence pet_id_seq increment by 3 start with 100000; prompt ===================================================== prompt Creating sequence to generate worker_ids for Workers. prompt ===================================================== drop sequence worker_id_seq; create sequence worker_id_seq increment by 2 start with 300000; prompt ============================================================== prompt Creating sequence to generate the numeric part of section_ids prompt for Services. prompt ============================================================== drop sequence section_id_seq; create sequence section_id_seq start with 10000; prompt ============================================================ prompt Creating sequence to generate unique enrollment numbers for prompt Class, Boarding, and Daycare enrollments. prompt ============================================================ drop sequence enroll_num_seq; create sequence enroll_num_seq start with 5000000; prompt ========================== prompt Inserting rows into Owner. prompt ========================== insert into owner values (owner_id_seq.nextval, 'Maya', 'Smith'); insert into owner values (owner_id_seq.nextval, 'Karen', 'Gearhardt'); insert into owner values (owner_id_seq.nextval, 'Lea', 'Krakowski'); insert into owner values (owner_id_seq.nextval, 'Kaisa', 'Tiryaki'); insert into owner values (owner_id_seq.nextval, 'Romulo', 'Santiago'); insert into owner values (owner_id_seq.nextval, 'Brecht', 'Zambrano'); insert into owner values (owner_id_seq.nextval, 'Maisie', 'Johanneson'); insert into owner values (owner_id_seq.nextval, 'Wanda', 'Taggart'); insert into owner values (owner_id_seq.nextval, 'Ernie', 'Smith'); insert into owner values (owner_id_seq.nextval, 'Rudolf', 'Siskind'); insert into owner values (owner_id_seq.nextval, 'Desmond', 'Boone'); prompt =================================== prompt Inserting rows into Owner_phone_num. prompt =================================== insert into owner_phone_num values (10, '5185550192'); insert into owner_phone_num values (11, '4105550133'); insert into owner_phone_num values (12, '4045550154'); insert into owner_phone_num values (13, '2075550181'); insert into owner_phone_num values (13, '5735550193'); insert into owner_phone_num values (13, '5735550120'); insert into owner_phone_num values (14, '5125550172'); insert into owner_phone_num values (15, '2255550101'); insert into owner_phone_num values (15, '5155550114'); insert into owner_phone_num values (16, '5125550192'); insert into owner_phone_num values (17, '7015550197'); insert into owner_phone_num values (18, '2085550124'); insert into owner_phone_num values (18, '4025550114'); insert into owner_phone_num values (19, '6175550188'); insert into owner_phone_num values (19, '9195550188'); insert into owner_phone_num values (20, '7755550128'); prompt ===================================== prompt Inserting rows into Owner_email_addr. prompt ===================================== insert into owner_email_addr values (10, '<EMAIL>'); insert into owner_email_addr values (13, '<EMAIL>'); insert into owner_email_addr values (13, '<EMAIL>'); insert into owner_email_addr values (11, '<EMAIL>'); insert into owner_email_addr values (14, '<EMAIL>'); insert into owner_email_addr values (14, '<EMAIL>'); insert into owner_email_addr values (15, '<EMAIL>'); insert into owner_email_addr values (16, '<EMAIL>'); insert into owner_email_addr values (18, '<EMAIL>'); insert into owner_email_addr values (18, '<EMAIL>'); insert into owner_email_addr values (20, '<EMAIL>'); prompt ======================== prompt Inserting rows into Pet. prompt ======================== insert into pet(pet_id, pet_name, sex, is_spayed_neutered, pet_type, owner_id) values (pet_id_seq.nextval, 'Kiwi', 'f', 'y', 'cat', 10); insert into pet values (pet_id_seq.nextval, 'Rosie', 'f', 'y', '15-NOV-2010', 'dog', 11); insert into pet values (pet_id_seq.nextval, 'Chewy', 'm', 'n', '02-APR-2004', 'dog', 11); insert into pet values (pet_id_seq.nextval, 'Cobain', 'm', 'y', '30-SEP-2006', 'cat', 12); insert into pet(pet_id, pet_name, sex, is_spayed_neutered, pet_type, owner_id) values (pet_id_seq.nextval, 'Gertrude', 'f', 'n', 'dog', 13); insert into pet(pet_id, pet_name, sex, is_spayed_neutered, pet_type, owner_id) values (pet_id_seq.nextval, 'Chips', 'm', 'y', 'dog', 13); insert into pet values (pet_id_seq.nextval, 'Katrina', 'f', 'y', '12-MAR-2012', 'dog', 14); insert into pet values (pet_id_seq.nextval, 'Mambo', 'm', 'n', '24-DEC-2015', 'cat', 15); insert into pet values (pet_id_seq.nextval, 'Lamar', 'm', 'y', '18-JUN-2010', 'dog', 16); insert into pet values (pet_id_seq.nextval, 'Huck', 'm', 'y', '04-JAN-2013', 'cat', 17); insert into pet values (pet_id_seq.nextval, 'Baldy', 'f', 'y', '22-OCT-2014', 'cat', 18); insert into pet values (pet_id_seq.nextval, 'Tofu', 'f', 'y', '01-JAN-2015', 'dog', 19); insert into pet(pet_id, pet_name, sex, is_spayed_neutered, pet_type, owner_id) values (pet_id_seq.nextval, 'Royal', 'm', 'y', 'dog', 20); insert into pet(pet_id, pet_name, sex, is_spayed_neutered, pet_type, owner_id) values (pet_id_seq.nextval, 'Rum', 'f', 'y', 'dog', 20); insert into pet values (pet_id_seq.nextval, 'Windsor', 'm', 'y', '25-DEC-2015', 'cat', 10); insert into pet values (pet_id_seq.nextval, 'Bandit', 'm', 'y', '03-DEC-2009', 'cat', 12); insert into pet values (pet_id_seq.nextval, 'Layla', 'f', 'y', '31-JAN-2008', 'cat', 14); insert into pet values (pet_id_seq.nextval, 'Trix', 'f', 'y', '05-FEB-2010', 'cat', 16); insert into pet values (pet_id_seq.nextval, 'Magnus', 'm', 'y', '18-MAR-2013', 'dog', 18); insert into pet values (pet_id_seq.nextval, 'Carl', 'm', 'y', '02-APR-2014', 'cat', 20); prompt ========================================= prompt Inserting rows into Pet_vaccine_received. prompt ========================================= insert into pet_vaccine_received values (100003, 'distemper', '02-NOV-2012'); insert into pet_vaccine_received values (100003, 'rabies', '02-NOV-2012'); insert into pet_vaccine_received values (100006, 'distemper', '04-APR-2011'); insert into pet_vaccine_received values (100006, 'rabies', '23-MAR-2011'); insert into pet_vaccine_received values (100009, 'distemper', '31-AUG-2005'); insert into pet_vaccine_received values (100009, 'rabies', '11-SEP-2005'); insert into pet_vaccine_received values (100012, 'distemper', '03-JAN-2007'); insert into pet_vaccine_received values (100012, 'rabies', '27-DEC-2006'); insert into pet_vaccine_received values (100015, 'distemper', '09-JUN-2016'); insert into pet_vaccine_received values (100015, 'rabies', '18-JUL-2016'); insert into pet_vaccine_received values (100018, 'distemper', '29-AUG-2010'); insert into pet_vaccine_received values (100018, 'rabies', '19-JUL-2010'); insert into pet_vaccine_received values (100021, 'distemper', '09-FEB-2014'); insert into pet_vaccine_received values (100021, 'rabies', '09-FEB-2014'); insert into pet_vaccine_received values (100024, 'distemper', '18-MAR-2016'); insert into pet_vaccine_received values (100024, 'rabies', '03-APR-2016'); insert into pet_vaccine_received values (100027, 'distemper', '16-OCT-2011'); insert into pet_vaccine_received values (100027, 'rabies', '16-OCT-2011'); insert into pet_vaccine_received values (100030, 'distemper', '10-MAY-2014'); insert into pet_vaccine_received values (100030, 'rabies', '13-MAY-2014'); insert into pet_vaccine_received values (100033, 'distemper', '12-JAN-2015'); insert into pet_vaccine_received values (100033, 'rabies', '12-JAN-2015'); insert into pet_vaccine_received values (100036, 'distemper', '02-AUG-2015'); insert into pet_vaccine_received values (100036, 'rabies', '25-AUG-2015'); insert into pet_vaccine_received values (100039, 'distemper', '23-MAR-2015'); insert into pet_vaccine_received values (100039, 'rabies', '12-APR-2015'); insert into pet_vaccine_received values (100000, 'distemper', '07-AUG-2010'); insert into pet_vaccine_received values (100000, 'rabies', '07-AUG-2010'); insert into pet_vaccine_received values (100045, 'distemper', '03-MAR-2010'); insert into pet_vaccine_received values (100045, 'rabies', '03-MAR-2010'); insert into pet_vaccine_received values (100051, 'distemper', '01-AUG-2010'); insert into pet_vaccine_received values (100051, 'rabies', '01-AUG-2010'); insert into pet_vaccine_received values (100054, 'distemper', '15-OCT-2013'); insert into pet_vaccine_received values (100054, 'rabies', '15-OCT-2013'); insert into pet_vaccine_received values (100048, 'distemper', '24-MAY-2008'); insert into pet_vaccine_received values (100048, 'rabies', '24-MAY-2008'); insert into pet_vaccine_received values (100042, 'distemper', '10-MAR-2016'); insert into pet_vaccine_received values (100042, 'rabies', '10-MAR-2016'); insert into pet_vaccine_received values (100057, 'distemper', '18-AUG-2014'); insert into pet_vaccine_received values (100057, 'rabies', '18-AUG-2014'); prompt ========================================== prompt Inserting rows into Pet_medication_needed. prompt ========================================== insert into pet_medication_needed values (100003, 'Amoxicillin', '50 mg'); insert into pet_medication_needed values (100003, 'Aspirin', '75 mg'); insert into pet_medication_needed values (100006, 'Tramadol', '10 mg'); insert into pet_medication_needed values (100009, 'Simplicef', '10 mg'); insert into pet_medication_needed values (100009, 'Orbax', '5 mg'); insert into pet_medication_needed values (100015, 'Hydrocodone', '1 mg'); insert into pet_medication_needed values (100015, 'Erythromycin', '50 mg'); insert into pet_medication_needed values (100015, 'Fluconazole', '50 mg'); insert into pet_medication_needed values (100027, 'Trimethoprim', '75 mg'); insert into pet_medication_needed values (100036, 'Melatonin', '1 mg'); prompt ========================================= prompt Inserting rows into Pet_diet_restriction. prompt ========================================= insert into pet_diet_restriction values (100006, 'wet food only'); insert into pet_diet_restriction values (100006, 'no dairy'); insert into pet_diet_restriction values (100009, 'no chicken'); insert into pet_diet_restriction values (100012, 'wet food only'); insert into pet_diet_restriction values (100012, 'no fish'); insert into pet_diet_restriction values (100021, 'no soy'); insert into pet_diet_restriction values (100024, 'no wheat'); insert into pet_diet_restriction values (100030, 'no chicken'); insert into pet_diet_restriction values (100036, 'wet food only'); insert into pet_diet_restriction values (100036, 'no chicken'); prompt ======================== prompt Inserting rows into Cat. prompt ======================== insert into cat values (100000); insert into cat values (100009); insert into cat values (100021); insert into cat values (100027); insert into cat values (100030); insert into cat values (100042); insert into cat values (100045); insert into cat values (100048); insert into cat values (100051); insert into cat values (100057); prompt ======================== prompt Inserting rows into Dog. prompt ======================== insert into dog values (100003, 'small'); insert into dog values (100006, 'medium'); insert into dog values (100012, 'large'); insert into dog values (100015, 'small'); insert into dog values (100018, 'medium'); insert into dog values (100024, 'large'); insert into dog values (100033, 'small'); insert into dog values (100036, 'medium'); insert into dog values (100039, 'large'); insert into dog values (100054, 'small'); prompt =========================== prompt Inserting rows into Worker. prompt =========================== insert into worker values (worker_id_seq.nextval, 'employee', 'Dua', 'Mcknight'); insert into worker values (worker_id_seq.nextval, 'employee', 'Konrad', 'Goddard'); insert into worker values (worker_id_seq.nextval, 'employee', 'Daphne', 'Villanueva'); insert into worker values (worker_id_seq.nextval, 'employee', 'Marian', 'Sosa'); insert into worker values (worker_id_seq.nextval, 'employee', 'Fannie', 'Paine'); insert into worker values (worker_id_seq.nextval, 'employee', 'Tala', 'Grey'); insert into worker values (worker_id_seq.nextval, 'employee', 'Jovan', 'Gale'); insert into worker values (worker_id_seq.nextval, 'employee', 'Josef', 'Finley'); insert into worker values (worker_id_seq.nextval, 'employee', 'Aubree', 'Cole'); insert into worker values (worker_id_seq.nextval, 'employee', 'Scott', 'Millar'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Kara', 'Kelley'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Blaine', 'Henderson'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Saara', 'Thorne'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Zayden', 'Powell'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Alexis', 'Li'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Loren', 'Daniel'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Stanislaw', 'Wicks'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Prisha', 'Mills'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Hall', 'Needham'); insert into worker values (worker_id_seq.nextval, 'volunteer', 'Claire', 'Strong'); prompt ===================================== prompt Inserting rows into Worker_phone_num. prompt ===================================== insert into worker_phone_num values (300000, '3175550148'); insert into worker_phone_num values (300002, '3175550158'); insert into worker_phone_num values (300002, '3175550152'); insert into worker_phone_num values (300004, '3175550162'); insert into worker_phone_num values (300006, '3175550113'); insert into worker_phone_num values (300006, '3175550145'); insert into worker_phone_num values (300006, '3175550148'); insert into worker_phone_num values (300008, '6015550190'); insert into worker_phone_num values (300010, '6015550186'); insert into worker_phone_num values (300012, '6015550169'); insert into worker_phone_num values (300014, '6015550161'); insert into worker_phone_num values (300016, '6015550168'); insert into worker_phone_num values (300018, '6015550115'); insert into worker_phone_num values (300018, '9045550128'); insert into worker_phone_num values (300020, '9045550118'); insert into worker_phone_num values (300022, '9045550174'); insert into worker_phone_num values (300024, '9045550132'); insert into worker_phone_num values (300024, '9045550114'); insert into worker_phone_num values (300026, '9045550188'); insert into worker_phone_num values (300028, '5735550115'); insert into worker_phone_num values (300030, '5735550107'); insert into worker_phone_num values (300032, '5735550169'); insert into worker_phone_num values (300034, '5735550182'); insert into worker_phone_num values (300036, '5735550156'); insert into worker_phone_num values (300038, '5735550111'); prompt ====================================== prompt Inserting rows into Worker_email_addr. prompt ====================================== insert into worker_email_addr values (300000, '<EMAIL>'); insert into worker_email_addr values (300002, '<EMAIL>'); insert into worker_email_addr values (300004, '<EMAIL>'); insert into worker_email_addr values (300006, '<EMAIL>'); insert into worker_email_addr values (300008, '<EMAIL>'); insert into worker_email_addr values (300010, '<EMAIL>'); insert into worker_email_addr values (300012, '<EMAIL>'); insert into worker_email_addr values (300014, '<EMAIL>'); insert into worker_email_addr values (300016, '<EMAIL>'); insert into worker_email_addr values (300018, '<EMAIL>'); insert into worker_email_addr values (300020, '<EMAIL>'); insert into worker_email_addr values (300020, '<EMAIL>'); insert into worker_email_addr values (300022, '<EMAIL>'); insert into worker_email_addr values (300024, '<EMAIL>'); insert into worker_email_addr values (300024, '<EMAIL>'); insert into worker_email_addr values (300026, '<EMAIL>'); insert into worker_email_addr values (300028, '<EMAIL>'); insert into worker_email_addr values (300030, '<EMAIL>'); insert into worker_email_addr values (300032, '<EMAIL>'); insert into worker_email_addr values (300034, '<EMAIL>'); insert into worker_email_addr values (300034, '<EMAIL>'); insert into worker_email_addr values (300036, '<EMAIL>'); insert into worker_email_addr values (300036, '<EMAIL>'); insert into worker_email_addr values (300038, '<EMAIL>'); prompt ============================= prompt Inserting rows into Employee. prompt ============================= insert into employee values (300000, 'Veterinarian', 3461.50, '23-JAN-2008'); insert into employee values (300002, 'Groomer', 1538.50, '12-FEB-2008'); insert into employee values (300004, 'Groomer', 1541, '20-MAR-2010'); insert into employee values (300006, 'Teacher', 1540, '06-APR-2011'); insert into employee values (300008, 'Teacher', 1545, '01-MAY-2012'); insert into employee values (300010, 'Veterinarian', 3455, '27-JUN-2013'); insert into employee values (300012, 'Animal Care Associate', 1155, '23-JAN-2008'); insert into employee values (300014, 'Animal Care Associate', 1154, '30-AUG-2008'); insert into employee values (300016, 'Animal Care Associate', 1153, '11-SEP-2016'); insert into employee values (300018, 'Animal Care Associate', 1150.50, '20-OCT-2017'); prompt =================================================== prompt Inserting rows into Employee_formal_qualifications. prompt =================================================== insert into employee_formal_qualifications values (300000, 'Bachelor of Science in Zoology'); insert into employee_formal_qualifications values (300000, 'Doctor of Veterinary Medicine'); insert into employee_formal_qualifications values (300000, 'Diplomate of the Western University College of Veterinary Medicine'); insert into employee_formal_qualifications values (300000, 'Certificate of Specialization in Canine Health'); insert into employee_formal_qualifications values (300010, 'Doctor of Veterinary Medicine'); insert into employee_formal_qualifications values (300010, 'Diplomate of the University of Smithton Veterinary School'); insert into employee_formal_qualifications values (300010, 'Bachelor of Science in Biology'); insert into employee_formal_qualifications values (300010, 'Certificate of Accreditation in Feline Organ Systems'); insert into employee_formal_qualifications values (300002, 'Completion of Apprenticeship in Grooming'); insert into employee_formal_qualifications values (300002, 'General Education Diploma'); insert into employee_formal_qualifications values (300004, 'High School Diploma'); insert into employee_formal_qualifications values (300004, 'National Certified Master Groomer'); insert into employee_formal_qualifications values (300004, 'Completion of Apprenticeship in Grooming'); insert into employee_formal_qualifications values (300006, 'High School Diploma'); insert into employee_formal_qualifications values (300008, 'Certified Professional Dog Trainer'); insert into employee_formal_qualifications values (300012, 'General Education Diploma'); insert into employee_formal_qualifications values (300016, 'Associate of Science in Chemistry'); prompt ============================== prompt Inserting rows into Volunteer. prompt ============================== insert into volunteer values (300020); insert into volunteer values (300022); insert into volunteer values (300024); insert into volunteer values (300026); insert into volunteer values (300028); insert into volunteer values (300030); insert into volunteer values (300032); insert into volunteer values (300034); insert into volunteer values (300036); insert into volunteer values (300038); prompt =================================================== prompt Inserting rows into Volunteer_handling_permissions. prompt =================================================== insert into volunteer_handling_permissions values (300020, 'dog'); insert into volunteer_handling_permissions values (300020, 'cat'); insert into volunteer_handling_permissions values (300022, 'dog'); insert into volunteer_handling_permissions values (300024, 'cat'); insert into volunteer_handling_permissions values (300026, 'dog'); insert into volunteer_handling_permissions values (300026, 'cat'); insert into volunteer_handling_permissions values (300028, 'dog'); insert into volunteer_handling_permissions values (300028, 'cat'); insert into volunteer_handling_permissions values (300030, 'dog'); insert into volunteer_handling_permissions values (300032, 'cat'); insert into volunteer_handling_permissions values (300034, 'dog'); insert into volunteer_handling_permissions values (300034, 'cat'); insert into volunteer_handling_permissions values (300036, 'dog'); insert into volunteer_handling_permissions values (300036, 'cat'); insert into volunteer_handling_permissions values (300038, 'dog'); prompt ============================ prompt Inserting rows into Service. prompt ============================ insert into service values ('B' || section_id_seq.nextval, 'boarding'); insert into service values ('B' || section_id_seq.nextval, 'boarding'); insert into service values ('B' || section_id_seq.nextval, 'boarding'); insert into service values ('B' || section_id_seq.nextval, 'boarding'); insert into service values ('D' || section_id_seq.nextval, 'daycare'); insert into service values ('D' || section_id_seq.nextval, 'daycare'); insert into service values ('D' || section_id_seq.nextval, 'daycare'); insert into service values ('D' || section_id_seq.nextval, 'daycare'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); insert into service values ('C' || section_id_seq.nextval, 'class'); prompt ============================================= prompt Inserting rows into Worker_providing_service. prompt ============================================= insert into worker_providing_service values (300000, 'B10000'); insert into worker_providing_service values (300000, 'B10001'); insert into worker_providing_service values (300000, 'B10002'); insert into worker_providing_service values (300000, 'B10003'); insert into worker_providing_service values (300010, 'D10004'); insert into worker_providing_service values (300010, 'D10005'); insert into worker_providing_service values (300010, 'D10006'); insert into worker_providing_service values (300010, 'D10007'); insert into worker_providing_service values (300002, 'B10000'); insert into worker_providing_service values (300002, 'B10001'); insert into worker_providing_service values (300002, 'B10002'); insert into worker_providing_service values (300002, 'B10003'); insert into worker_providing_service values (300004, 'D10004'); insert into worker_providing_service values (300004, 'D10005'); insert into worker_providing_service values (300004, 'D10006'); insert into worker_providing_service values (300004, 'D10007'); insert into worker_providing_service values (300006, 'C10008'); insert into worker_providing_service values (300006, 'C10009'); insert into worker_providing_service values (300006, 'C10010'); insert into worker_providing_service values (300006, 'C10011'); insert into worker_providing_service values (300006, 'C10012'); insert into worker_providing_service values (300008, 'C10013'); insert into worker_providing_service values (300008, 'C10014'); insert into worker_providing_service values (300008, 'C10015'); insert into worker_providing_service values (300008, 'C10016'); insert into worker_providing_service values (300008, 'C10017'); insert into worker_providing_service values (300012, 'B10000'); insert into worker_providing_service values (300012, 'B10001'); insert into worker_providing_service values (300014, 'B10002'); insert into worker_providing_service values (300014, 'B10003'); insert into worker_providing_service values (300016, 'D10004'); insert into worker_providing_service values (300016, 'D10005'); insert into worker_providing_service values (300018, 'D10006'); insert into worker_providing_service values (300018, 'D10007'); /* Here, I am assigning each volunteer one Boarding session to focus on. That being said, according to the business rules, workers (including volunteers) are perfectly welcome to help with other services as well. These are just the ones that they are being asked to focus on for now. Perhaps volunteers who have been with Loving Care Pet Boarding for a long time and have lots of experience would be permitted to help out with multiple sections or with daycare, or even classes in the future. When these experienced volunteers help with multiple services on a regular basis, those might be added to the database to more accurately reflect volunteer activities. */ insert into worker_providing_service values (300020, 'B10000'); insert into worker_providing_service values (300022, 'B10001'); insert into worker_providing_service values (300024, 'B10002'); insert into worker_providing_service values (300026, 'B10003'); insert into worker_providing_service values (300028, 'B10000'); insert into worker_providing_service values (300030, 'B10001'); insert into worker_providing_service values (300032, 'B10002'); insert into worker_providing_service values (300034, 'B10003'); insert into worker_providing_service values (300036, 'B10000'); insert into worker_providing_service values (300038, 'B10001'); prompt ========================== prompt Inserting rows into Class. prompt ========================== insert into class values ('C10008', 'Dog Obedience Training 1', 120); insert into class values ('C10009', 'Dog Obedience Training 2', 120); insert into class values ('C10010', 'Dog Obedience Training 3', 120); insert into class values ('C10011', 'Dog Obedience Training 4', 120); insert into class values ('C10012', 'Dog Socialization', 100); insert into class values ('C10013', 'Cat Leash Training', 100); insert into class values ('C10014', 'Taming Cat Behavioral Problems', 120); insert into class values ('C10015', 'Building Trust With Your Pet', 120); insert into class values ('C10016', 'Puppy Training', 120); insert into class values ('C10017', 'Therapy Dog Training', 120); prompt =========================================== prompt Inserting rows into Pet_permitted_in_class. prompt =========================================== insert into pet_permitted_in_class values ('C10008', 'dog'); insert into pet_permitted_in_class values ('C10009', 'dog'); insert into pet_permitted_in_class values ('C10010', 'dog'); insert into pet_permitted_in_class values ('C10011', 'dog'); insert into pet_permitted_in_class values ('C10012', 'dog'); insert into pet_permitted_in_class values ('C10013', 'cat'); insert into pet_permitted_in_class values ('C10015', 'dog'); insert into pet_permitted_in_class values ('C10015', 'cat'); insert into pet_permitted_in_class values ('C10016', 'dog'); insert into pet_permitted_in_class values ('C10017', 'dog'); prompt ======================================= prompt Inserting rows into Class_session_date. prompt ======================================= insert into class_session_date values ('C10008', '07-JAN-2019'); insert into class_session_date values ('C10008', '14-JAN-2019'); insert into class_session_date values ('C10008', '21-JAN-2019'); insert into class_session_date values ('C10008', '28-JAN-2019'); insert into class_session_date values ('C10008', '04-FEB-2019'); insert into class_session_date values ('C10008', '11-FEB-2019'); insert into class_session_date values ('C10009', '08-JAN-2019'); insert into class_session_date values ('C10009', '15-JAN-2019'); insert into class_session_date values ('C10009', '22-JAN-2019'); insert into class_session_date values ('C10009', '29-JAN-2019'); insert into class_session_date values ('C10009', '05-FEB-2019'); insert into class_session_date values ('C10009', '12-FEB-2019'); insert into class_session_date values ('C10010', '09-JAN-2019'); insert into class_session_date values ('C10010', '16-JAN-2019'); insert into class_session_date values ('C10010', '23-JAN-2019'); insert into class_session_date values ('C10010', '30-JAN-2019'); insert into class_session_date values ('C10010', '06-FEB-2019'); insert into class_session_date values ('C10010', '13-FEB-2019'); insert into class_session_date values ('C10011', '10-JAN-2019'); insert into class_session_date values ('C10011', '17-JAN-2019'); insert into class_session_date values ('C10011', '24-JAN-2019'); insert into class_session_date values ('C10011', '31-JAN-2019'); insert into class_session_date values ('C10011', '07-FEB-2019'); insert into class_session_date values ('C10011', '14-FEB-2019'); insert into class_session_date values ('C10012', '11-JAN-2019'); insert into class_session_date values ('C10012', '18-JAN-2019'); insert into class_session_date values ('C10012', '25-JAN-2019'); insert into class_session_date values ('C10012', '01-FEB-2019'); insert into class_session_date values ('C10012', '08-FEB-2019'); insert into class_session_date values ('C10012', '15-FEB-2019'); insert into class_session_date values ('C10013', '07-JAN-2019'); insert into class_session_date values ('C10013', '14-JAN-2019'); insert into class_session_date values ('C10013', '21-JAN-2019'); insert into class_session_date values ('C10013', '28-JAN-2019'); insert into class_session_date values ('C10013', '04-FEB-2019'); insert into class_session_date values ('C10013', '11-FEB-2019'); insert into class_session_date values ('C10014', '08-JAN-2019'); insert into class_session_date values ('C10014', '15-JAN-2019'); insert into class_session_date values ('C10014', '22-JAN-2019'); insert into class_session_date values ('C10014', '29-JAN-2019'); insert into class_session_date values ('C10014', '05-FEB-2019'); insert into class_session_date values ('C10014', '12-FEB-2019'); insert into class_session_date values ('C10015', '09-JAN-2019'); insert into class_session_date values ('C10015', '16-JAN-2019'); insert into class_session_date values ('C10015', '23-JAN-2019'); insert into class_session_date values ('C10015', '30-JAN-2019'); insert into class_session_date values ('C10015', '06-FEB-2019'); insert into class_session_date values ('C10015', '13-FEB-2019'); insert into class_session_date values ('C10016', '10-JAN-2019'); insert into class_session_date values ('C10016', '17-JAN-2019'); insert into class_session_date values ('C10016', '24-JAN-2019'); insert into class_session_date values ('C10016', '31-JAN-2019'); insert into class_session_date values ('C10016', '07-FEB-2019'); insert into class_session_date values ('C10016', '14-FEB-2019'); insert into class_session_date values ('C10017', '11-JAN-2019'); insert into class_session_date values ('C10017', '18-JAN-2019'); insert into class_session_date values ('C10017', '25-JAN-2019'); insert into class_session_date values ('C10017', '01-FEB-2019'); insert into class_session_date values ('C10017', '08-FEB-2019'); insert into class_session_date values ('C10017', '15-FEB-2019'); prompt ===================================== prompt Inserting rows into Class_enrollment. prompt ===================================== insert into class_enrollment values (enroll_num_seq.nextval, 11, 'C10008', '23-NOV-2018', 100003); insert into class_enrollment values (enroll_num_seq.nextval, 12, 'C10015', '01-NOV-2018', 100009); insert into class_enrollment values (enroll_num_seq.nextval, 13, 'C10008', '12-NOV-2018', 100015); insert into class_enrollment values (enroll_num_seq.nextval, 14, 'C10015', '18-NOV-2018', 100018); insert into class_enrollment values (enroll_num_seq.nextval, 15, 'C10013', '04-NOV-2018', 100021); insert into class_enrollment values (enroll_num_seq.nextval, 16, 'C10017', '09-NOV-2018', 100024); insert into class_enrollment values (enroll_num_seq.nextval, 17, 'C10013', '15-NOV-2018', 100027); insert into class_enrollment (enroll_num, owner_id, section_id, date_enrolled) values (enroll_num_seq.nextval, 18, 'C10014', '19-NOV-2018'); insert into class_enrollment values (enroll_num_seq.nextval, 19, 'C10009', '23-NOV-2018', 100033); insert into class_enrollment (enroll_num, owner_id, section_id) values (enroll_num_seq.nextval, 20, 'C10014'); insert into class_enrollment values (enroll_num_seq.nextval, 16, 'C10011', sysdate, 100024); insert into class_enrollment values (enroll_num_seq.nextval, 20, 'C10008', sysdate, 100036); insert into class_enrollment values (enroll_num_seq.nextval, 20, 'C10009', sysdate, 100039); insert into class_enrollment values (enroll_num_seq.nextval, 18, 'C10010', sysdate, 100054); prompt ============================= prompt Inserting rows into Boarding. prompt ============================= -- The "Fixed" boarding sections are for pets who have been spayed -- or neutered. insert into boarding values ('B10000', 'Regular (Fixed)', 15, 30); insert into boarding values ('B10001', 'Deluxe (Fixed)', 20, 40); -- The "Not Fixed" boarding sections are for pets who have -- NOT been spayed or neutered. These cost more. insert into boarding values ('B10002', 'Regular (Not Fixed)', 20, 38); insert into boarding values ('B10003', 'Deluxe (Not Fixed)', 25, 48); prompt ======================================== prompt Inserting rows into Boarding_enrollment. prompt ======================================== insert into boarding_enrollment values (enroll_num_seq.nextval, 100003, 'B10000', '19-NOV-2018', '23-DEC-2018', '31-DEC-2018'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100006, 'B10002', '19-NOV-2018', '14-DEC-2018', '18-DEC-2018'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100012, 'B10003', '28-NOV-2018', '27-DEC-2018', '02-JAN-2019'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100015, 'B10001', '11-NOV-2018', '09-DEC-2018', '13-DEC-2018'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100021, 'B10003', '02-NOV-2018', '28-DEC-2018', '30-DEC-2018'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100033, 'B10000', '30-NOV-2018', '02-JAN-2019', '09-JAN-2019'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100039, 'B10001', '29-NOV-2018', '10-DEC-2018', '13-DEC-2018'); insert into boarding_enrollment (enroll_num, pet_id, section_id, start_date, end_date) values (enroll_num_seq.nextval, 100042, 'B10000', '08-DEC-2018', '11-DEC-2018'); insert into boarding_enrollment (enroll_num, pet_id, section_id, start_date, end_date) values (enroll_num_seq.nextval, 100051, 'B10001', '19-DEC-2018', '22-DEC-2018'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100003, 'B10000', '19-NOV-2018', '28-JAN-2019', '01-FEB-2019'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100006, 'B10002', '19-NOV-2018', '29-JAN-2019', '02-FEB-2019'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100012, 'B10003', '28-NOV-2018', '27-JAN-2019', '03-FEB-2019'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100015, 'B10001', '11-NOV-2018', '28-JAN-2019', '02-FEB-2019'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100021, 'B10003', '02-NOV-2018', '29-JAN-2019', '03-FEB-2019'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100033, 'B10000', '30-NOV-2018', '27-JAN-2019', '02-FEB-2019'); insert into boarding_enrollment values (enroll_num_seq.nextval, 100039, 'B10001', '29-NOV-2018', '28-JAN-2019', '03-FEB-2019'); prompt ================================== prompt Inserting rows into Doggy_daycare. prompt ================================== -- The "Fixed" daycare sections are for dogs who have been spayed -- or neutered. insert into doggy_daycare values ('D10004', 'Regular (Fixed)', 10, 20); insert into doggy_daycare values ('D10005', 'Deluxe (Fixed)', 15, 30); -- The "Not Fixed" daycare sections are for pets who have -- NOT been spayed or neutered. These cost more. insert into doggy_daycare values ('D10006', 'Regular (Not Fixed)', 15, 28); insert into doggy_daycare values ('D10007', 'Deluxe (Not Fixed)', 20, 38); prompt ======================================= prompt Inserting rows into Daycare_enrollment. prompt ======================================= insert into daycare_enrollment values (enroll_num_seq.nextval, 100054, 'D10004', '10-DEC-2018', '27-NOV-2018', 0830, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100054, 'D10004', '11-DEC-2018', '27-NOV-2018', 0830, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100054, 'D10004', '12-DEC-2018', '27-NOV-2018', 0830, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100054, 'D10004', '13-DEC-2018', '27-NOV-2018', 0830, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100039, 'D10005', '07-DEC-2018', '01-DEC-2018', 0900, 1330); insert into daycare_enrollment values (enroll_num_seq.nextval, 100039, 'D10005', '13-DEC-2018', '01-DEC-2018', 0900, 1330); insert into daycare_enrollment values (enroll_num_seq.nextval, 100039, 'D10005', '14-DEC-2018', '01-DEC-2018', 1000, 1500); insert into daycare_enrollment(enroll_num, pet_id, section_id, date_of_daycare, start_time, end_time) values (enroll_num_seq.nextval, 100012, 'D10007', '13-DEC-2018', 1000, 1400); insert into daycare_enrollment(enroll_num, pet_id, section_id, date_of_daycare, start_time, end_time) values (enroll_num_seq.nextval, 100012, 'D10007', '14-DEC-2018', 1000, 1600); insert into daycare_enrollment(enroll_num, pet_id, section_id, date_of_daycare, start_time, end_time) values (enroll_num_seq.nextval, 100012, 'D10007', '16-DEC-2018', 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100003, 'D10004', '13-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100006, 'D10006', '13-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100015, 'D10005', '13-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100018, 'D10004', '13-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100024, 'D10005', '13-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100033, 'D10004', '13-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100036, 'D10005', '13-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100003, 'D10004', '15-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100006, 'D10006', '15-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100015, 'D10005', '15-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100018, 'D10004', '15-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100024, 'D10005', '15-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100033, 'D10004', '15-DEC-2018', sysdate, 0900, 1700); insert into daycare_enrollment values (enroll_num_seq.nextval, 100036, 'D10005', '15-DEC-2018', sysdate, 0900, 1700);
<reponame>ag-q/course-dbt select created_at_utc , count(distinct session_guid) sessions , count(distinct case when page_view_events > 0 or add_to_cart_events > 0 or checkout_events > 0 then session_guid else null end) page_view_sessions , count(distinct case when (page_view_events > 0 and product_guid is not null) or add_to_cart_events > 0 or checkout_events > 0 then session_guid else null end) product_page_view_sessions , count(distinct case when add_to_cart_events > 0 or checkout_events > 0 then session_guid else null end) add_to_cart_sessions , count(distinct case when checkout_events > 0 then session_guid else null end) checkout_sessions from {{ ref('fact_session_events') }} group by 1
CREATE TABLE [dbo].[Invoice] ( [InvoiceId] [varchar] (50) NOT NULL, [InvoiceDate] [datetime2] NOT NULL, [CustomerId] [varchar] (50) NOT NULL, [Amount] [decimal] (5, 2) NOT NULL, [Specification] [text] NULL, [JobIds] [varchar] (250) NULL ) GO ALTER TABLE [dbo].[Invoice] ADD CONSTRAINT [PK__Invoice__D796AAB5C913736D] PRIMARY KEY CLUSTERED ([InvoiceId]) GO
CREATE TABLE [dbo].[TargetGroup] ( [TargetGroupID] SMALLINT NOT NULL IDENTITY, [ProjectID] SMALLINT NOT NULL, [Name] NVARCHAR(100) NOT NULL, [Description] NVARCHAR(MAX) NULL, CONSTRAINT [PK_TargetGroup] PRIMARY KEY ([TargetGroupID]), CONSTRAINT [UK_TargetGroup_ProjectID_Name] UNIQUE ([ProjectID], [Name]), CONSTRAINT [FK_TargetGroup_Project] FOREIGN KEY ([ProjectID]) REFERENCES [Project]([ProjectID]) ON DELETE CASCADE ) GO CREATE INDEX [IX_TargetGroup_ProjectID] ON [dbo].[TargetGroup] ([ProjectID])
-- Final SQL mapping: SELECT attribute_2060,attribute_2061,attribute_2062,attribute_2063 FROM (((((((((SELECT attribute_2060,attribute_2061,attribute_2062,attribute_2063 FROM public.relation_1268)UNION (SELECT attribute_2548,attribute_2549,attribute_2550,attribute_2551 FROM public.relation_1269)) UNION ((SELECT attribute_2324,attribute_2325,attribute_2326,attribute_2327 FROM public.relation_1172)UNION (SELECT attribute_2356,attribute_2357,attribute_2358,attribute_2359 FROM public.relation_1173)) ) UNION (((SELECT attribute_2176,attribute_2177,attribute_2178,attribute_2179 FROM public.relation_1112)UNION (SELECT attribute_2236,attribute_2237,attribute_2238,attribute_2239 FROM public.relation_1113)) UNION ((SELECT attribute_2224,attribute_2225,attribute_2226,attribute_2227 FROM public.relation_1174)UNION ((SELECT attribute_2360,attribute_2361,attribute_2362,attribute_2363 FROM public.relation_1320)UNION (SELECT attribute_2652,attribute_2653,attribute_2654,attribute_2655 FROM public.relation_1321)) ) ) ) UNION ((((SELECT attribute_2084,attribute_2085,attribute_2086,attribute_2087 FROM public.relation_1296)UNION (SELECT attribute_2604,attribute_2605,attribute_2606,attribute_2607 FROM public.relation_1297)) UNION ((SELECT attribute_2184,attribute_2185,attribute_2186,attribute_2187 FROM public.relation_1148)UNION (SELECT attribute_2308,attribute_2309,attribute_2310,attribute_2311 FROM public.relation_1149)) ) UNION (((SELECT attribute_2092,attribute_2093,attribute_2094,attribute_2095 FROM public.relation_1054)UNION (SELECT attribute_2120,attribute_2121,attribute_2122,attribute_2123 FROM public.relation_1055)) UNION ((SELECT attribute_2116,attribute_2117,attribute_2118,attribute_2119 FROM public.relation_1062)UNION ((SELECT attribute_2136,attribute_2137,attribute_2138,attribute_2139 FROM public.relation_1064)UNION (SELECT attribute_2140,attribute_2141,attribute_2142,attribute_2143 FROM public.relation_1065)) ) ) ) ) UNION (((((SELECT attribute_2076,attribute_2077,attribute_2078,attribute_2079 FROM public.relation_1092)UNION (SELECT attribute_2196,attribute_2197,attribute_2198,attribute_2199 FROM public.relation_1093)) UNION ((SELECT attribute_2180,attribute_2181,attribute_2182,attribute_2183 FROM public.relation_1108)UNION (SELECT attribute_2228,attribute_2229,attribute_2230,attribute_2231 FROM public.relation_1109)) ) UNION (((SELECT attribute_2152,attribute_2153,attribute_2154,attribute_2155 FROM public.relation_1184)UNION (SELECT attribute_2380,attribute_2381,attribute_2382,attribute_2383 FROM public.relation_1185)) UNION ((SELECT attribute_2328,attribute_2329,attribute_2330,attribute_2331 FROM public.relation_1190)UNION ((SELECT attribute_2392,attribute_2393,attribute_2394,attribute_2395 FROM public.relation_1196)UNION (SELECT attribute_2404,attribute_2405,attribute_2406,attribute_2407 FROM public.relation_1197)) ) ) ) UNION ((((SELECT attribute_2088,attribute_2089,attribute_2090,attribute_2091 FROM public.relation_1100)UNION (SELECT attribute_2212,attribute_2213,attribute_2214,attribute_2215 FROM public.relation_1101)) UNION ((SELECT attribute_2160,attribute_2161,attribute_2162,attribute_2163 FROM public.relation_1078)UNION ((SELECT attribute_2168,attribute_2169,attribute_2170,attribute_2171 FROM public.relation_1094)UNION (SELECT attribute_2200,attribute_2201,attribute_2202,attribute_2203 FROM public.relation_1095)) ) ) UNION (((SELECT attribute_2156,attribute_2157,attribute_2158,attribute_2159 FROM public.relation_1124)UNION (SELECT attribute_2260,attribute_2261,attribute_2262,attribute_2263 FROM public.relation_1125)) UNION ((SELECT attribute_2232,attribute_2233,attribute_2234,attribute_2235 FROM public.relation_1206)UNION ((SELECT attribute_2424,attribute_2425,attribute_2426,attribute_2427 FROM public.relation_1300)UNION (SELECT attribute_2612,attribute_2613,attribute_2614,attribute_2615 FROM public.relation_1301)) ) ) ) ) ) UNION ((((((SELECT attribute_2072,attribute_2073,attribute_2074,attribute_2075 FROM public.relation_1256)UNION (SELECT attribute_2524,attribute_2525,attribute_2526,attribute_2527 FROM public.relation_1257)) UNION ((SELECT attribute_2376,attribute_2377,attribute_2378,attribute_2379 FROM public.relation_1308)UNION (SELECT attribute_2628,attribute_2629,attribute_2630,attribute_2631 FROM public.relation_1309)) ) UNION (((SELECT attribute_2216,attribute_2217,attribute_2218,attribute_2219 FROM public.relation_1178)UNION (SELECT attribute_2368,attribute_2369,attribute_2370,attribute_2371 FROM public.relation_1179)) UNION ((SELECT attribute_2244,attribute_2245,attribute_2246,attribute_2247 FROM public.relation_1120)UNION ((SELECT attribute_2252,attribute_2253,attribute_2254,attribute_2255 FROM public.relation_1122)UNION (SELECT attribute_2256,attribute_2257,attribute_2258,attribute_2259 FROM public.relation_1123)) ) ) ) UNION ((((SELECT attribute_2096,attribute_2097,attribute_2098,attribute_2099 FROM public.relation_1088)UNION (SELECT attribute_2188,attribute_2189,attribute_2190,attribute_2191 FROM public.relation_1089)) UNION ((SELECT attribute_2108,attribute_2109,attribute_2110,attribute_2111 FROM public.relation_1068)UNION ((SELECT attribute_2148,attribute_2149,attribute_2150,attribute_2151 FROM public.relation_1132)UNION (SELECT attribute_2276,attribute_2277,attribute_2278,attribute_2279 FROM public.relation_1133)) ) ) UNION (((SELECT attribute_2100,attribute_2101,attribute_2102,attribute_2103 FROM public.relation_1098)UNION (SELECT attribute_2208,attribute_2209,attribute_2210,attribute_2211 FROM public.relation_1099)) UNION ((SELECT attribute_2172,attribute_2173,attribute_2174,attribute_2175 FROM public.relation_1246)UNION ((SELECT attribute_2504,attribute_2505,attribute_2506,attribute_2507 FROM public.relation_1324)UNION (SELECT attribute_2660,attribute_2661,attribute_2662,attribute_2663 FROM public.relation_1325)) ) ) ) ) UNION (((((SELECT attribute_2080,attribute_2081,attribute_2082,attribute_2083 FROM public.relation_1136)UNION (SELECT attribute_2284,attribute_2285,attribute_2286,attribute_2287 FROM public.relation_1137)) UNION ((SELECT attribute_2272,attribute_2273,attribute_2274,attribute_2275 FROM public.relation_1380)UNION (SELECT attribute_2772,attribute_2773,attribute_2774,attribute_2775 FROM public.relation_1381)) ) UNION (((SELECT attribute_2240,attribute_2241,attribute_2242,attribute_2243 FROM public.relation_1192)UNION (SELECT attribute_2396,attribute_2397,attribute_2398,attribute_2399 FROM public.relation_1193)) UNION ((SELECT attribute_2352,attribute_2353,attribute_2354,attribute_2355 FROM public.relation_1280)UNION ((SELECT attribute_2572,attribute_2573,attribute_2574,attribute_2575 FROM public.relation_1368)UNION (SELECT attribute_2748,attribute_2749,attribute_2750,attribute_2751 FROM public.relation_1369)) ) ) ) UNION ((((SELECT attribute_2104,attribute_2105,attribute_2106,attribute_2107 FROM public.relation_1060)UNION (SELECT attribute_2132,attribute_2133,attribute_2134,attribute_2135 FROM public.relation_1061)) UNION ((SELECT attribute_2124,attribute_2125,attribute_2126,attribute_2127 FROM public.relation_1066)UNION ((SELECT attribute_2144,attribute_2145,attribute_2146,attribute_2147 FROM public.relation_1152)UNION (SELECT attribute_2316,attribute_2317,attribute_2318,attribute_2319 FROM public.relation_1153)) ) ) UNION (((SELECT attribute_2112,attribute_2113,attribute_2114,attribute_2115 FROM public.relation_1118)UNION (SELECT attribute_2248,attribute_2249,attribute_2250,attribute_2251 FROM public.relation_1119)) UNION ((SELECT attribute_2128,attribute_2129,attribute_2130,attribute_2131 FROM public.relation_1090)UNION ((SELECT attribute_2192,attribute_2193,attribute_2194,attribute_2195 FROM public.relation_1134)UNION (SELECT attribute_2280,attribute_2281,attribute_2282,attribute_2283 FROM public.relation_1135)) ) ) ) ) ) ) UNION (((((((SELECT attribute_2068,attribute_2069,attribute_2070,attribute_2071 FROM public.relation_1274)UNION (SELECT attribute_2560,attribute_2561,attribute_2562,attribute_2563 FROM public.relation_1275)) UNION ((SELECT attribute_2468,attribute_2469,attribute_2470,attribute_2471 FROM public.relation_1302)UNION (SELECT attribute_2616,attribute_2617,attribute_2618,attribute_2619 FROM public.relation_1303)) ) UNION (((SELECT attribute_2436,attribute_2437,attribute_2438,attribute_2439 FROM public.relation_1226)UNION (SELECT attribute_2464,attribute_2465,attribute_2466,attribute_2467 FROM public.relation_1227)) UNION ((SELECT attribute_2456,attribute_2457,attribute_2458,attribute_2459 FROM public.relation_1250)UNION ((SELECT attribute_2512,attribute_2513,attribute_2514,attribute_2515 FROM public.relation_1374)UNION (SELECT attribute_2760,attribute_2761,attribute_2762,attribute_2763 FROM public.relation_1375)) ) ) ) UNION ((((SELECT attribute_2268,attribute_2269,attribute_2270,attribute_2271 FROM public.relation_1150)UNION (SELECT attribute_2312,attribute_2313,attribute_2314,attribute_2315 FROM public.relation_1151)) UNION ((SELECT attribute_2300,attribute_2301,attribute_2302,attribute_2303 FROM public.relation_1188)UNION ((SELECT attribute_2388,attribute_2389,attribute_2390,attribute_2391 FROM public.relation_1208)UNION (SELECT attribute_2428,attribute_2429,attribute_2430,attribute_2431 FROM public.relation_1209)) ) ) UNION (((SELECT attribute_2292,attribute_2293,attribute_2294,attribute_2295 FROM public.relation_1238)UNION (SELECT attribute_2488,attribute_2489,attribute_2490,attribute_2491 FROM public.relation_1239)) UNION ((SELECT attribute_2320,attribute_2321,attribute_2322,attribute_2323 FROM public.relation_1244)UNION ((SELECT attribute_2500,attribute_2501,attribute_2502,attribute_2503 FROM public.relation_1422)UNION (SELECT attribute_2856,attribute_2857,attribute_2858,attribute_2859 FROM public.relation_1423)) ) ) ) ) UNION (((((SELECT attribute_2264,attribute_2265,attribute_2266,attribute_2267 FROM public.relation_1252)UNION (SELECT attribute_2516,attribute_2517,attribute_2518,attribute_2519 FROM public.relation_1253)) UNION ((SELECT attribute_2508,attribute_2509,attribute_2510,attribute_2511 FROM public.relation_1266)UNION (SELECT attribute_2544,attribute_2545,attribute_2546,attribute_2547 FROM public.relation_1267)) ) UNION (((SELECT attribute_2384,attribute_2385,attribute_2386,attribute_2387 FROM public.relation_1438)UNION (SELECT attribute_2888,attribute_2889,attribute_2890,attribute_2891 FROM public.relation_1439)) UNION (SELECT attribute_2876,attribute_2877,attribute_2878,attribute_2879 FROM public.relation_1433)) ) UNION ((((SELECT attribute_2348,attribute_2349,attribute_2350,attribute_2351 FROM public.relation_1474)UNION (SELECT attribute_2960,attribute_2961,attribute_2962,attribute_2963 FROM public.relation_1475)) UNION (SELECT attribute_2752,attribute_2753,attribute_2754,attribute_2755 FROM public.relation_1371)) UNION (((SELECT attribute_2448,attribute_2449,attribute_2450,attribute_2451 FROM public.relation_1516)UNION (SELECT attribute_3044,attribute_3045,attribute_3046,attribute_3047 FROM public.relation_1517)) UNION (SELECT attribute_2976,attribute_2977,attribute_2978,attribute_2979 FROM public.relation_1483)) ) ) ) UNION ((((((SELECT attribute_2164,attribute_2165,attribute_2166,attribute_2167 FROM public.relation_1410)UNION (SELECT attribute_2832,attribute_2833,attribute_2834,attribute_2835 FROM public.relation_1411)) UNION (SELECT attribute_2552,attribute_2553,attribute_2554,attribute_2555 FROM public.relation_1271)) UNION (((SELECT attribute_2536,attribute_2537,attribute_2538,attribute_2539 FROM public.relation_1442)UNION (SELECT attribute_2896,attribute_2897,attribute_2898,attribute_2899 FROM public.relation_1443)) UNION ((SELECT attribute_2884,attribute_2885,attribute_2886,attribute_2887 FROM public.relation_1446)UNION ((SELECT attribute_2904,attribute_2905,attribute_2906,attribute_2907 FROM public.relation_1470)UNION (SELECT attribute_2952,attribute_2953,attribute_2954,attribute_2955 FROM public.relation_1471)) ) ) ) UNION (((SELECT attribute_2472,attribute_2473,attribute_2474,attribute_2475 FROM public.relation_1476)UNION ((SELECT attribute_2964,attribute_2965,attribute_2966,attribute_2967 FROM public.relation_1486)UNION (SELECT attribute_2984,attribute_2985,attribute_2986,attribute_2987 FROM public.relation_1487)) ) UNION ((SELECT attribute_2712,attribute_2713,attribute_2714,attribute_2715 FROM public.relation_1404)UNION ((SELECT attribute_2820,attribute_2821,attribute_2822,attribute_2823 FROM public.relation_1456)UNION ((SELECT attribute_2924,attribute_2925,attribute_2926,attribute_2927 FROM public.relation_1494)UNION (SELECT attribute_3000,attribute_3001,attribute_3002,attribute_3003 FROM public.relation_1495)) ) ) ) ) UNION (((((SELECT attribute_2220,attribute_2221,attribute_2222,attribute_2223 FROM public.relation_1258)UNION (SELECT attribute_2528,attribute_2529,attribute_2530,attribute_2531 FROM public.relation_1259)) UNION ((SELECT attribute_2484,attribute_2485,attribute_2486,attribute_2487 FROM public.relation_1282)UNION (SELECT attribute_2576,attribute_2577,attribute_2578,attribute_2579 FROM public.relation_1283)) ) UNION (((SELECT attribute_2432,attribute_2433,attribute_2434,attribute_2435 FROM public.relation_1334)UNION (SELECT attribute_2680,attribute_2681,attribute_2682,attribute_2683 FROM public.relation_1335)) UNION ((SELECT attribute_2480,attribute_2481,attribute_2482,attribute_2483 FROM public.relation_1290)UNION ((SELECT attribute_2592,attribute_2593,attribute_2594,attribute_2595 FROM public.relation_1318)UNION (SELECT attribute_2648,attribute_2649,attribute_2650,attribute_2651 FROM public.relation_1319)) ) ) ) UNION ((((SELECT attribute_2408,attribute_2409,attribute_2410,attribute_2411 FROM public.relation_1518)UNION (SELECT attribute_3048,attribute_3049,attribute_3050,attribute_3051 FROM public.relation_1519)) UNION ((SELECT attribute_2792,attribute_2793,attribute_2794,attribute_2795 FROM public.relation_1406)UNION ((SELECT attribute_2824,attribute_2825,attribute_2826,attribute_2827 FROM public.relation_1412)UNION (SELECT attribute_2836,attribute_2837,attribute_2838,attribute_2839 FROM public.relation_1413)) ) ) UNION (((SELECT attribute_2684,attribute_2685,attribute_2686,attribute_2687 FROM public.relation_1394)UNION (SELECT attribute_2800,attribute_2801,attribute_2802,attribute_2803 FROM public.relation_1395)) UNION ((SELECT attribute_2688,attribute_2689,attribute_2690,attribute_2691 FROM public.relation_1426)UNION ((SELECT attribute_2864,attribute_2865,attribute_2866,attribute_2867 FROM public.relation_1490)UNION (SELECT attribute_2992,attribute_2993,attribute_2994,attribute_2995 FROM public.relation_1491)) ) ) ) ) ) ) ) UNION ((((((((SELECT attribute_2064,attribute_2065,attribute_2066,attribute_2067 FROM public.relation_1424)UNION (SELECT attribute_2860,attribute_2861,attribute_2862,attribute_2863 FROM public.relation_1425)) UNION ((SELECT attribute_2780,attribute_2781,attribute_2782,attribute_2783 FROM public.relation_1408)UNION (SELECT attribute_2828,attribute_2829,attribute_2830,attribute_2831 FROM public.relation_1409)) ) UNION (((SELECT attribute_2632,attribute_2633,attribute_2634,attribute_2635 FROM public.relation_1398)UNION (SELECT attribute_2808,attribute_2809,attribute_2810,attribute_2811 FROM public.relation_1399)) UNION ((SELECT attribute_2744,attribute_2745,attribute_2746,attribute_2747 FROM public.relation_1430)UNION ((SELECT attribute_2872,attribute_2873,attribute_2874,attribute_2875 FROM public.relation_1478)UNION (SELECT attribute_2968,attribute_2969,attribute_2970,attribute_2971 FROM public.relation_1479)) ) ) ) UNION ((SELECT attribute_2496,attribute_2497,attribute_2498,attribute_2499 FROM public.relation_1502)UNION ((SELECT attribute_3016,attribute_3017,attribute_3018,attribute_3019 FROM public.relation_1508)UNION ((SELECT attribute_3028,attribute_3029,attribute_3030,attribute_3031 FROM public.relation_1524)UNION (SELECT attribute_3060,attribute_3061,attribute_3062,attribute_3063 FROM public.relation_1525)) ) ) ) UNION (((((SELECT attribute_2332,attribute_2333,attribute_2334,attribute_2335 FROM public.relation_1224)UNION (SELECT attribute_2460,attribute_2461,attribute_2462,attribute_2463 FROM public.relation_1225)) UNION ((SELECT attribute_2440,attribute_2441,attribute_2442,attribute_2443 FROM public.relation_1500)UNION (SELECT attribute_3012,attribute_3013,attribute_3014,attribute_3015 FROM public.relation_1501)) ) UNION (((SELECT attribute_2344,attribute_2345,attribute_2346,attribute_2347 FROM public.relation_1386)UNION (SELECT attribute_2784,attribute_2785,attribute_2786,attribute_2787 FROM public.relation_1387)) UNION ((SELECT attribute_2476,attribute_2477,attribute_2478,attribute_2479 FROM public.relation_1314)UNION ((SELECT attribute_2640,attribute_2641,attribute_2642,attribute_2643 FROM public.relation_1326)UNION (SELECT attribute_2664,attribute_2665,attribute_2666,attribute_2667 FROM public.relation_1327)) ) ) ) UNION ((((SELECT attribute_2336,attribute_2337,attribute_2338,attribute_2339 FROM public.relation_1522)UNION (SELECT attribute_3056,attribute_3057,attribute_3058,attribute_3059 FROM public.relation_1523)) UNION ((SELECT attribute_2920,attribute_2921,attribute_2922,attribute_2923 FROM public.relation_1468)UNION (SELECT attribute_2948,attribute_2949,attribute_2950,attribute_2951 FROM public.relation_1469)) ) UNION (((SELECT attribute_2372,attribute_2373,attribute_2374,attribute_2375 FROM public.relation_1306)UNION (SELECT attribute_2624,attribute_2625,attribute_2626,attribute_2627 FROM public.relation_1307)) UNION ((SELECT attribute_2400,attribute_2401,attribute_2402,attribute_2403 FROM public.relation_1254)UNION ((SELECT attribute_2520,attribute_2521,attribute_2522,attribute_2523 FROM public.relation_1376)UNION (SELECT attribute_2764,attribute_2765,attribute_2766,attribute_2767 FROM public.relation_1377)) ) ) ) ) ) UNION ((((((SELECT attribute_2288,attribute_2289,attribute_2290,attribute_2291 FROM public.relation_1402)UNION (SELECT attribute_2816,attribute_2817,attribute_2818,attribute_2819 FROM public.relation_1403)) UNION ((SELECT attribute_2588,attribute_2589,attribute_2590,attribute_2591 FROM public.relation_1298)UNION (SELECT attribute_2608,attribute_2609,attribute_2610,attribute_2611 FROM public.relation_1299)) ) UNION (((SELECT attribute_2416,attribute_2417,attribute_2418,attribute_2419 FROM public.relation_1388)UNION (SELECT attribute_2788,attribute_2789,attribute_2790,attribute_2791 FROM public.relation_1389)) UNION ((SELECT attribute_2420,attribute_2421,attribute_2422,attribute_2423 FROM public.relation_1278)UNION ((SELECT attribute_2568,attribute_2569,attribute_2570,attribute_2571 FROM public.relation_1304)UNION (SELECT attribute_2620,attribute_2621,attribute_2622,attribute_2623 FROM public.relation_1305)) ) ) ) UNION ((((SELECT attribute_2364,attribute_2365,attribute_2366,attribute_2367 FROM public.relation_1378)UNION (SELECT attribute_2768,attribute_2769,attribute_2770,attribute_2771 FROM public.relation_1379)) UNION ((SELECT attribute_2676,attribute_2677,attribute_2678,attribute_2679 FROM public.relation_1364)UNION ((SELECT attribute_2740,attribute_2741,attribute_2742,attribute_2743 FROM public.relation_1444)UNION (SELECT attribute_2900,attribute_2901,attribute_2902,attribute_2903 FROM public.relation_1445)) ) ) UNION (((SELECT attribute_2412,attribute_2413,attribute_2414,attribute_2415 FROM public.relation_1264)UNION (SELECT attribute_2540,attribute_2541,attribute_2542,attribute_2543 FROM public.relation_1265)) UNION ((SELECT attribute_2492,attribute_2493,attribute_2494,attribute_2495 FROM public.relation_1260)UNION ((SELECT attribute_2532,attribute_2533,attribute_2534,attribute_2535 FROM public.relation_1294)UNION (SELECT attribute_2600,attribute_2601,attribute_2602,attribute_2603 FROM public.relation_1295)) ) ) ) ) UNION (((((SELECT attribute_2296,attribute_2297,attribute_2298,attribute_2299 FROM public.relation_1342)UNION (SELECT attribute_2696,attribute_2697,attribute_2698,attribute_2699 FROM public.relation_1343)) UNION ((SELECT attribute_2564,attribute_2565,attribute_2566,attribute_2567 FROM public.relation_1330)UNION (SELECT attribute_2672,attribute_2673,attribute_2674,attribute_2675 FROM public.relation_1331)) ) UNION (((SELECT attribute_2340,attribute_2341,attribute_2342,attribute_2343 FROM public.relation_1292)UNION (SELECT attribute_2596,attribute_2597,attribute_2598,attribute_2599 FROM public.relation_1293)) UNION ((SELECT attribute_2444,attribute_2445,attribute_2446,attribute_2447 FROM public.relation_1272)UNION ((SELECT attribute_2556,attribute_2557,attribute_2558,attribute_2559 FROM public.relation_1360)UNION (SELECT attribute_2732,attribute_2733,attribute_2734,attribute_2735 FROM public.relation_1361)) ) ) ) UNION ((((SELECT attribute_2304,attribute_2305,attribute_2306,attribute_2307 FROM public.relation_1372)UNION (SELECT attribute_2756,attribute_2757,attribute_2758,attribute_2759 FROM public.relation_1373)) UNION ((SELECT attribute_2656,attribute_2657,attribute_2658,attribute_2659 FROM public.relation_1458)UNION (SELECT attribute_2928,attribute_2929,attribute_2930,attribute_2931 FROM public.relation_1459)) ) UNION (((SELECT attribute_2580,attribute_2581,attribute_2582,attribute_2583 FROM public.relation_1362)UNION (SELECT attribute_2736,attribute_2737,attribute_2738,attribute_2739 FROM public.relation_1363)) UNION ((SELECT attribute_2700,attribute_2701,attribute_2702,attribute_2703 FROM public.relation_1348)UNION ((SELECT attribute_2708,attribute_2709,attribute_2710,attribute_2711 FROM public.relation_1416)UNION (SELECT attribute_2844,attribute_2845,attribute_2846,attribute_2847 FROM public.relation_1417)) ) ) ) ) ) ) UNION (((((SELECT attribute_2204,attribute_2205,attribute_2206,attribute_2207 FROM public.relation_1512)UNION (SELECT attribute_3036,attribute_3037,attribute_3038,attribute_3039 FROM public.relation_1513)) UNION (((SELECT attribute_2848,attribute_2849,attribute_2850,attribute_2851 FROM public.relation_1520)UNION (SELECT attribute_3052,attribute_3053,attribute_3054,attribute_3055 FROM public.relation_1521)) UNION (SELECT attribute_3040,attribute_3041,attribute_3042,attribute_3043 FROM public.relation_1515)) ) UNION (((((SELECT attribute_2636,attribute_2637,attribute_2638,attribute_2639 FROM public.relation_1382)UNION (SELECT attribute_2776,attribute_2777,attribute_2778,attribute_2779 FROM public.relation_1383)) UNION ((SELECT attribute_2728,attribute_2729,attribute_2730,attribute_2731 FROM public.relation_1392)UNION (SELECT attribute_2796,attribute_2797,attribute_2798,attribute_2799 FROM public.relation_1393)) ) UNION (((SELECT attribute_2704,attribute_2705,attribute_2706,attribute_2707 FROM public.relation_1504)UNION (SELECT attribute_3020,attribute_3021,attribute_3022,attribute_3023 FROM public.relation_1505)) UNION (SELECT attribute_2868,attribute_2869,attribute_2870,attribute_2871 FROM public.relation_1429)) ) UNION ((((SELECT attribute_2692,attribute_2693,attribute_2694,attribute_2695 FROM public.relation_1460)UNION (SELECT attribute_2932,attribute_2933,attribute_2934,attribute_2935 FROM public.relation_1461)) UNION ((SELECT attribute_2840,attribute_2841,attribute_2842,attribute_2843 FROM public.relation_1480)UNION (SELECT attribute_2972,attribute_2973,attribute_2974,attribute_2975 FROM public.relation_1481)) ) UNION (((SELECT attribute_2720,attribute_2721,attribute_2722,attribute_2723 FROM public.relation_1400)UNION (SELECT attribute_2812,attribute_2813,attribute_2814,attribute_2815 FROM public.relation_1401)) UNION ((SELECT attribute_2804,attribute_2805,attribute_2806,attribute_2807 FROM public.relation_1484)UNION ((SELECT attribute_2980,attribute_2981,attribute_2982,attribute_2983 FROM public.relation_1488)UNION (SELECT attribute_2988,attribute_2989,attribute_2990,attribute_2991 FROM public.relation_1489)) ) ) ) ) ) UNION ((((SELECT attribute_2452,attribute_2453,attribute_2454,attribute_2455 FROM public.relation_1506)UNION ((SELECT attribute_3024,attribute_3025,attribute_3026,attribute_3027 FROM public.relation_1510)UNION (SELECT attribute_3032,attribute_3033,attribute_3034,attribute_3035 FROM public.relation_1511)) ) UNION (SELECT attribute_2996,attribute_2997,attribute_2998,attribute_2999 FROM public.relation_1493)) UNION (((((SELECT attribute_2584,attribute_2585,attribute_2586,attribute_2587 FROM public.relation_1472)UNION (SELECT attribute_2956,attribute_2957,attribute_2958,attribute_2959 FROM public.relation_1473)) UNION ((SELECT attribute_2912,attribute_2913,attribute_2914,attribute_2915 FROM public.relation_1466)UNION (SELECT attribute_2944,attribute_2945,attribute_2946,attribute_2947 FROM public.relation_1467)) ) UNION (((SELECT attribute_2716,attribute_2717,attribute_2718,attribute_2719 FROM public.relation_1440)UNION (SELECT attribute_2892,attribute_2893,attribute_2894,attribute_2895 FROM public.relation_1441)) UNION ((SELECT attribute_2852,attribute_2853,attribute_2854,attribute_2855 FROM public.relation_1434)UNION ((SELECT attribute_2880,attribute_2881,attribute_2882,attribute_2883 FROM public.relation_1448)UNION (SELECT attribute_2908,attribute_2909,attribute_2910,attribute_2911 FROM public.relation_1449)) ) ) ) UNION ((((SELECT attribute_2644,attribute_2645,attribute_2646,attribute_2647 FROM public.relation_1462)UNION (SELECT attribute_2936,attribute_2937,attribute_2938,attribute_2939 FROM public.relation_1463)) UNION ((SELECT attribute_2724,attribute_2725,attribute_2726,attribute_2727 FROM public.relation_1452)UNION ((SELECT attribute_2916,attribute_2917,attribute_2918,attribute_2919 FROM public.relation_1464)UNION (SELECT attribute_2940,attribute_2941,attribute_2942,attribute_2943 FROM public.relation_1465)) ) ) UNION (((SELECT attribute_2668,attribute_2669,attribute_2670,attribute_2671 FROM public.relation_1498)UNION (SELECT attribute_3008,attribute_3009,attribute_3010,attribute_3011 FROM public.relation_1499)) UNION (SELECT attribute_3004,attribute_3005,attribute_3006,attribute_3007 FROM public.relation_1497)) ) ) ) ) ) ) as relation_1025 ORDER BY attribute_2060,attribute_2061,attribute_2062,attribute_2063 /*SELECT attribute_2060,attribute_2061,attribute_2062,attribute_2063 FROM ( ( ( ( ( ( ( (public.relation_1268 UNION public.relation_1269 ) UNION (public.relation_1172 UNION public.relation_1173 ) ) UNION ( (public.relation_1112 UNION public.relation_1113 ) UNION (public.relation_1174 UNION (public.relation_1320 UNION public.relation_1321 ) ) ) ) UNION ( ( (public.relation_1296 UNION public.relation_1297 ) UNION (public.relation_1148 UNION public.relation_1149 ) ) UNION ( (public.relation_1054 UNION public.relation_1055 ) UNION (public.relation_1062 UNION (public.relation_1064 UNION public.relation_1065 ) ) ) ) ) UNION ( ( ( (public.relation_1092 UNION public.relation_1093 ) UNION (public.relation_1108 UNION public.relation_1109 ) ) UNION ( (public.relation_1184 UNION public.relation_1185 ) UNION (public.relation_1190 UNION (public.relation_1196 UNION public.relation_1197 ) ) ) ) UNION ( ( (public.relation_1100 UNION public.relation_1101 ) UNION (public.relation_1078 UNION (public.relation_1094 UNION public.relation_1095 ) ) ) UNION ( (public.relation_1124 UNION public.relation_1125 ) UNION (public.relation_1206 UNION (public.relation_1300 UNION public.relation_1301 ) ) ) ) ) ) UNION ( ( ( ( (public.relation_1256 UNION public.relation_1257 ) UNION (public.relation_1308 UNION public.relation_1309 ) ) UNION ( (public.relation_1178 UNION public.relation_1179 ) UNION (public.relation_1120 UNION (public.relation_1122 UNION public.relation_1123 ) ) ) ) UNION ( ( (public.relation_1088 UNION public.relation_1089 ) UNION (public.relation_1068 UNION (public.relation_1132 UNION public.relation_1133 ) ) ) UNION ( (public.relation_1098 UNION public.relation_1099 ) UNION (public.relation_1246 UNION (public.relation_1324 UNION public.relation_1325 ) ) ) ) ) UNION ( ( ( (public.relation_1136 UNION public.relation_1137 ) UNION (public.relation_1380 UNION public.relation_1381 ) ) UNION ( (public.relation_1192 UNION public.relation_1193 ) UNION (public.relation_1280 UNION (public.relation_1368 UNION public.relation_1369 ) ) ) ) UNION ( ( (public.relation_1060 UNION public.relation_1061 ) UNION (public.relation_1066 UNION (public.relation_1152 UNION public.relation_1153 ) ) ) UNION ( (public.relation_1118 UNION public.relation_1119 ) UNION (public.relation_1090 UNION (public.relation_1134 UNION public.relation_1135 ) ) ) ) ) ) ) UNION ( ( ( ( ( (public.relation_1274 UNION public.relation_1275 ) UNION (public.relation_1302 UNION public.relation_1303 ) ) UNION ( (public.relation_1226 UNION public.relation_1227 ) UNION (public.relation_1250 UNION (public.relation_1374 UNION public.relation_1375 ) ) ) ) UNION ( ( (public.relation_1150 UNION public.relation_1151 ) UNION (public.relation_1188 UNION (public.relation_1208 UNION public.relation_1209 ) ) ) UNION ( (public.relation_1238 UNION public.relation_1239 ) UNION (public.relation_1244 UNION (public.relation_1422 UNION public.relation_1423 ) ) ) ) ) UNION ( ( ( (public.relation_1252 UNION public.relation_1253 ) UNION (public.relation_1266 UNION public.relation_1267 ) ) UNION ( (public.relation_1438 UNION public.relation_1439 ) UNION public.relation_1433 ) ) UNION ( ( (public.relation_1474 UNION public.relation_1475 ) UNION public.relation_1371 ) UNION ( (public.relation_1516 UNION public.relation_1517 ) UNION public.relation_1483 ) ) ) ) UNION ( ( ( ( (public.relation_1410 UNION public.relation_1411 ) UNION public.relation_1271 ) UNION ( (public.relation_1442 UNION public.relation_1443 ) UNION (public.relation_1446 UNION (public.relation_1470 UNION public.relation_1471 ) ) ) ) UNION ( (public.relation_1476 UNION (public.relation_1486 UNION public.relation_1487 ) ) UNION (public.relation_1404 UNION (public.relation_1456 UNION (public.relation_1494 UNION public.relation_1495 ) ) ) ) ) UNION ( ( ( (public.relation_1258 UNION public.relation_1259 ) UNION (public.relation_1282 UNION public.relation_1283 ) ) UNION ( (public.relation_1334 UNION public.relation_1335 ) UNION (public.relation_1290 UNION (public.relation_1318 UNION public.relation_1319 ) ) ) ) UNION ( ( (public.relation_1518 UNION public.relation_1519 ) UNION (public.relation_1406 UNION (public.relation_1412 UNION public.relation_1413 ) ) ) UNION ( (public.relation_1394 UNION public.relation_1395 ) UNION (public.relation_1426 UNION (public.relation_1490 UNION public.relation_1491 ) ) ) ) ) ) ) ) UNION ( ( ( ( ( ( (public.relation_1424 UNION public.relation_1425 ) UNION (public.relation_1408 UNION public.relation_1409 ) ) UNION ( (public.relation_1398 UNION public.relation_1399 ) UNION (public.relation_1430 UNION (public.relation_1478 UNION public.relation_1479 ) ) ) ) UNION (public.relation_1502 UNION (public.relation_1508 UNION (public.relation_1524 UNION public.relation_1525 ) ) ) ) UNION ( ( ( (public.relation_1224 UNION public.relation_1225 ) UNION (public.relation_1500 UNION public.relation_1501 ) ) UNION ( (public.relation_1386 UNION public.relation_1387 ) UNION (public.relation_1314 UNION (public.relation_1326 UNION public.relation_1327 ) ) ) ) UNION ( ( (public.relation_1522 UNION public.relation_1523 ) UNION (public.relation_1468 UNION public.relation_1469 ) ) UNION ( (public.relation_1306 UNION public.relation_1307 ) UNION (public.relation_1254 UNION (public.relation_1376 UNION public.relation_1377 ) ) ) ) ) ) UNION ( ( ( ( (public.relation_1402 UNION public.relation_1403 ) UNION (public.relation_1298 UNION public.relation_1299 ) ) UNION ( (public.relation_1388 UNION public.relation_1389 ) UNION (public.relation_1278 UNION (public.relation_1304 UNION public.relation_1305 ) ) ) ) UNION ( ( (public.relation_1378 UNION public.relation_1379 ) UNION (public.relation_1364 UNION (public.relation_1444 UNION public.relation_1445 ) ) ) UNION ( (public.relation_1264 UNION public.relation_1265 ) UNION (public.relation_1260 UNION (public.relation_1294 UNION public.relation_1295 ) ) ) ) ) UNION ( ( ( (public.relation_1342 UNION public.relation_1343 ) UNION (public.relation_1330 UNION public.relation_1331 ) ) UNION ( (public.relation_1292 UNION public.relation_1293 ) UNION (public.relation_1272 UNION (public.relation_1360 UNION public.relation_1361 ) ) ) ) UNION ( ( (public.relation_1372 UNION public.relation_1373 ) UNION (public.relation_1458 UNION public.relation_1459 ) ) UNION ( (public.relation_1362 UNION public.relation_1363 ) UNION (public.relation_1348 UNION (public.relation_1416 UNION public.relation_1417 ) ) ) ) ) ) ) UNION ( ( ( (public.relation_1512 UNION public.relation_1513 ) UNION ( (public.relation_1520 UNION public.relation_1521 ) UNION public.relation_1515 ) ) UNION ( ( ( (public.relation_1382 UNION public.relation_1383 ) UNION (public.relation_1392 UNION public.relation_1393 ) ) UNION ( (public.relation_1504 UNION public.relation_1505 ) UNION public.relation_1429 ) ) UNION ( ( (public.relation_1460 UNION public.relation_1461 ) UNION (public.relation_1480 UNION public.relation_1481 ) ) UNION ( (public.relation_1400 UNION public.relation_1401 ) UNION (public.relation_1484 UNION (public.relation_1488 UNION public.relation_1489 ) ) ) ) ) ) UNION ( ( (public.relation_1506 UNION (public.relation_1510 UNION public.relation_1511 ) ) UNION public.relation_1493 ) UNION ( ( ( (public.relation_1472 UNION public.relation_1473 ) UNION (public.relation_1466 UNION public.relation_1467 ) ) UNION ( (public.relation_1440 UNION public.relation_1441 ) UNION (public.relation_1434 UNION (public.relation_1448 UNION public.relation_1449 ) ) ) ) UNION ( ( (public.relation_1462 UNION public.relation_1463 ) UNION (public.relation_1452 UNION (public.relation_1464 UNION public.relation_1465 ) ) ) UNION ( (public.relation_1498 UNION public.relation_1499 ) UNION public.relation_1497 ) ) ) ) ) ) ) as relation_1025 ORDER BY attribute_2060,attribute_2061,attribute_2062,attribute_2063*/
create or replace view campaigns_latest_sms_messages as select campaign_id, sms_message_id from ( select sms_messages.campaign_id as campaign_id, sms_messages.id as sms_message_id, ROW_NUMBER() over ( PARTITION BY sms_messages.campaign_id ORDER BY sms_messages.sent_at DESC ) as row_number from sms_messages ) as result where row_number = 1;
<gh_stars>1-10 CREATE OR REPLACE FUNCTION jobcenter.check_wait(a_action_id integer, a_wait boolean) RETURNS boolean LANGUAGE plpgsql SET search_path TO jobcenter, pg_catalog, pg_temp AS $function$BEGIN IF a_wait THEN RETURN TRUE; END IF; PERFORM true FROM actions WHERE action_id = a_action_id AND type = 'workflow'; RETURN FOUND; END;$function$
<reponame>dapivei/data-product-architecture-final-project create schema if not exists preprocessed; drop table if exists preprocessed.etl_execution; create table preprocessed.etl_execution ( "name" TEXT, "extention" TEXT, "schema" TEXT, "action" TEXT, "creator" TEXT, "machine" TEXT, "ip" TEXT, "creation_date" TEXT, "size" TEXT, "location" TEXT, "status" TEXT, "param_year" TEXT, "param_month" TEXT, "param_day" TEXT, "param_bucket" TEXT ); comment on table preprocessed.etl_execution is 'Metadata from ETL-PREPROCESSED';
<gh_stars>0 /* ******************************************************************************** // Execute to RESET THE DATABASE // // Software: Microsoft SQL Server Management Studio - (Transact SQL) // SQL Server 2012 architecture <<<<<<< HEAD // version: 05.28.2021 ======= // version: 05.23.2021 >>>>>>> 643283eda794d644472cebe1eb52cc78b735f0a8 // Notes: copy/paste this in SQL Server Management Studio and execute ******************************************************************************** */ USE cis234a_team_JK_LOL; GO /* ================ */ /* DROP statements: */ /* ================ */ IF OBJECT_ID('RECIPIENT', 'U') IS NOT NULL BEGIN DROP TABLE RECIPIENT; PRINT 'RECIPIENT table has been dropped'; END; IF OBJECT_ID('MESSAGE', 'U') IS NOT NULL BEGIN DROP TABLE MESSAGE; PRINT 'MESSAGE table has been dropped'; END; IF OBJECT_ID('TEMPLATE', 'U') IS NOT NULL BEGIN DROP TABLE TEMPLATE; PRINT 'TEMPLATE table has been dropped'; END; IF OBJECT_ID('SETTINGS', 'U') IS NOT NULL BEGIN DROP TABLE SETTINGS; PRINT 'SETTINGS table has been dropped'; END; IF OBJECT_ID('PERSON', 'U') IS NOT NULL BEGIN DROP TABLE PERSON; PRINT 'PERSON table has been dropped'; END; /* ============== */ /* CREATE tables: */ /* ============== */ CREATE TABLE PERSON ( /*autonumber*/ PK_Person_ID INT IDENTITY (1, 1) NOT NULL PRIMARY KEY , firstname NVARCHAR(35) NULL , lastname NVARCHAR(35) NULL , username VARCHAR(30) NOT NULL , password_hash VARBINARY(128) NOT NULL /* allows 64 char password and 64 char salt */ , email VARCHAR(60) NOT NULL , role NVARCHAR(30) NOT NULL , phone NVARCHAR(10) NULL , activated BIT NOT NULL DEFAULT 0 <<<<<<< HEAD , receive_email BIT NOT NULL DEFAULT 0 , receive_sms BIT NOT NULL DEFAULT 0 ======= >>>>>>> 643283eda794d644472cebe1eb52cc78b735f0a8 ); CREATE TABLE TEMPLATE ( PK_Template_ID INT IDENTITY (1, 1) NOT NULL PRIMARY KEY , name NVARCHAR(45) NOT NULL , temp_subject NVARCHAR(78) NULL , temp_body NVARCHAR(4000) NULL ); CREATE TABLE MESSAGE ( PK_Message_ID INT IDENTITY (1, 1) NOT NULL PRIMARY KEY , FK_FromPerson_ID INT NOT NULL , FK_Template_ID INT NULL , subject NVARCHAR(78) NULL , textbody NVARCHAR(4000) NULL , datetime SMALLDATETIME NOT NULL ); CREATE TABLE RECIPIENT ( PK_Recipient_ID INT IDENTITY (1, 1) NOT NULL PRIMARY KEY , FK_ToPerson_ID INT NOT NULL , FK_Message_ID INT NOT NULL , to_email VARCHAR(60) NOT NULL ); CREATE TABLE SETTINGS ( PK_Settings_ID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY , FK_Person_ID INT NULL , email BIT NOT NULL DEFAULT 0 , sms BIT NOT NULL DEFAULT 0 , both BIT NOT NULL DEFAULT 0 , opt_out BIT NOT NULL DEFAULT 0 ); /* =================== */ /* ADD fk constraints: */ /* =================== */ ALTER TABLE MESSAGE ADD CONSTRAINT FK_MESSAGE_FromPerson_PERSON_id FOREIGN KEY (FK_FromPerson_ID) REFERENCES PERSON(PK_Person_ID); ALTER TABLE MESSAGE ADD CONSTRAINT FK_MESSAGE_template_TEMPLATE_id FOREIGN KEY (FK_Template_ID) REFERENCES TEMPLATE(PK_Template_ID); ALTER TABLE RECIPIENT ADD CONSTRAINT FK_RECIPIENT_ToPerson_PERSON_id FOREIGN KEY (FK_ToPerson_ID) REFERENCES PERSON(PK_Person_ID); ALTER TABLE RECIPIENT ADD CONSTRAINT FK_RECIPIENT_message_MESSAGE_id FOREIGN KEY (FK_Message_ID) REFERENCES MESSAGE(PK_Message_ID); <<<<<<< HEAD ======= ALTER TABLE SETTINGS ADD CONSTRAINT FK_SETTINGS_Person_PERSON_id FOREIGN KEY (FK_Person_ID) REFERENCES PERSON(PK_Person_ID); >>>>>>> 643283eda794d644472cebe1eb52cc78b735f0a8 /* =============== */ /* CREATE indexes: */ /* =============== */ CREATE UNIQUE INDEX IDX_PERSON_username ON PERSON (username ASC); CREATE INDEX IDX_PERSON_email ON PERSON (email ASC); CREATE UNIQUE INDEX IDX_TEMPLATE_name ON TEMPLATE (name ASC); PRINT 'DB tables were sucessfully re-created';
<gh_stars>0 -- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jul 20, 2017 at 06:38 AM -- Server version: 10.1.21-MariaDB -- PHP Version: 7.1.2 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: `db_karyawan` -- -- -------------------------------------------------------- -- -- Table structure for table `karyawans` -- CREATE TABLE `karyawans` ( `id` int(10) UNSIGNED NOT NULL, `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `nopeg` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `alamat` 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 `karyawans` -- INSERT INTO `karyawans` (`id`, `nama`, `nopeg`, `alamat`, `created_at`, `updated_at`) VALUES (1, '<NAME>', 'K001', 'Probolinggo', '2017-07-18 02:11:25', '2017-07-18 20:36:41'), (2, '<NAME>', 'K002', 'Malang', '2017-07-18 18:25:56', '2017-07-18 18:25:56'), (6, '<NAME>', 'K004', 'Malang', '2017-07-18 20:36:15', '2017-07-18 20:36:15'), (7, '<NAME>', 'K005', 'Surabaya', '2017-07-18 20:36:33', '2017-07-18 20:36:33'); -- -------------------------------------------------------- -- -- 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 (4, '2017_07_18_071104_create_karyawans_table', 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `karyawans` -- ALTER TABLE `karyawans` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `karyawans` -- ALTER TABLE `karyawans` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; /*!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 */;
CREATE DATABASE IF NOT EXISTS `cms`;
<reponame>kikotulawan/seabase INSERT INTO `documents` VALUES (1, 'Passport', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (2, 'Seaman\'s Book', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (3, 'SRC', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (4, 'FSMB', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (5, 'Medical', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (6, 'PDOS', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (7, 'OEC', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (8, 'Philippine License', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (9, 'UK Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (10, 'US Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (11, 'Electronic Receipt', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (12, 'OTB', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (13, 'NL Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (14, 'Chinese Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (15, 'Schengen Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (16, 'Entry permit (solomon islands)', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (17, 'Bulgarian Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (18, 'Bahamas Seaman\'s Book', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (19, 'Indian Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (20, 'Brazilian Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (21, 'Canadian Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (22, 'Nigerian Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (23, 'Argentine Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (24, 'Australian Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (25, 'Working Permit', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (26, 'UAE Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (27, 'Chilean visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (28, 'Working Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (29, 'Kuwait Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (30, 'Cuban Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (31, 'Qatar Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (32, 'OWWA ', 2, 90, NULL, NULL); INSERT INTO `documents` VALUES (33, 'Crew ERS# (SBECS)', 2, 0, NULL, NULL); INSERT INTO `documents` VALUES (34, 'ER#', 2, 0, NULL, NULL); INSERT INTO `documents` VALUES (35, 'Pre Departure Orientation Seminar', 2, 0, NULL, NULL); INSERT INTO `documents` VALUES (36, 'Russian Visa', 2, 60, NULL, NULL); INSERT INTO `documents` VALUES (37, 'Panama Seamans Book', 2, 0, NULL, NULL); INSERT INTO `documents` VALUES (38, 'Schengen Visa 2', 2, 0, NULL, NULL); INSERT INTO `documents` VALUES (39, 'SID', 2, 0, NULL, NULL);
CREATE TABLE IF NOT EXISTS pipeline_importer_history ( id identity not null, repository_uuid varchar(100) not null unique, last_checked_at timestamp not null, primary key (id), foreign key (repository_uuid) references repository (uuid) ); CREATE TABLE IF NOT EXISTS pull_request_importer_history ( id identity not null, repository_uuid varchar(100) not null unique, last_checked_at timestamp not null, primary key (id), foreign key (repository_uuid) references repository (uuid) ); ALTER TABLE pull_request ADD COLUMN imported_at timestamp; ALTER TABLE pull_request ADD COLUMN last_checked_at timestamp; ALTER TABLE pipeline ADD COLUMN imported_at timestamp; ALTER TABLE pipeline ADD COLUMN last_checked_at timestamp;
UPDATE shop.employees SET town_id = 1 WHERE id = 1; UPDATE shop.employees SET town_id = 2 WHERE id = 2; UPDATE shop.employees SET town_id = 3 , last_name = 'Apostolov' , salary = 900.0 WHERE id = 3; SELECT * FROM shop.employees; SELECT * FROM shop.towns; # Добавяме нов ред INSERT INTO `shop`.`towns` (`name`, ``) VALUES ('Targovishte') , ('Sofia') , ('Burgas'); SELECT concat(emp.`first_name`, ' ', emp.`last_name`) AS full_name , emp.`salary` , (emp.`salary` - 300.0) AS 'dds_salary_rest' , twn.`name` AS 'town_name' FROM `shop`.`employees` AS emp INNER JOIN `shop`.`towns` AS twn ON emp.town_id = twn.id WHERE (emp.salary - 300.0) >= 0.0;
/* -- Query: SELECT * FROM fseletro.pedidos LIMIT 0, 1000 -- Date: 2020-10-26 00:05 */ INSERT INTO `` (`id`,`nome_cliente`,`endereco`,`telefone`,`nome_produto`,`valor_unitario`,`quantidade`,`valor_total`) VALUES (1,'<NAME>','Ruas das Palmeiras, 718 - Vila Santa Clementina','99999-9999','Geladeira Três Portas',1500,2,3000); INSERT INTO `` (`id`,`nome_cliente`,`endereco`,`telefone`,`nome_produto`,`valor_unitario`,`quantidade`,`valor_total`) VALUES (2,'<NAME>','Rua Rua Deolinda de Almeida Corrêa , 13 - Distrito Industrial Nova Avaré','99999-9999','Fogão ATLAS',599.9,1,599.9); INSERT INTO `` (`id`,`nome_cliente`,`endereco`,`telefone`,`nome_produto`,`valor_unitario`,`quantidade`,`valor_total`) VALUES (3,'<NAME>','Rua Adutora, 590 - Chácara São Domingos Shop','99999-9999','Geladeira Dodge',1500,2,3000); INSERT INTO `` (`id`,`nome_cliente`,`endereco`,`telefone`,`nome_produto`,`valor_unitario`,`quantidade`,`valor_total`) VALUES (4,'<NAME>','Rua Silvio <NAME>, 395 - Residencial Ouro Verde','99999-9999','Geladeira Brastemp',899.9,1,899.9); INSERT INTO `` (`id`,`nome_cliente`,`endereco`,`telefone`,`nome_produto`,`valor_unitario`,`quantidade`,`valor_total`) VALUES (5,'<NAME>','Alameda dos Beija-Flor, 349 - Recanto Camp<NAME>','99999-9999','Lavadora de Pratos Elec.',599.9,3,1799.7); INSERT INTO `` (`id`,`nome_cliente`,`endereco`,`telefone`,`nome_produto`,`valor_unitario`,`quantidade`,`valor_total`) VALUES (6,'<NAME>','Rua Anhanguera, 952 - Jardim do Prado','99999-9999','Máquina de Lavar',899.9,5,4499.5); INSERT INTO `` (`id`,`nome_cliente`,`endereco`,`telefone`,`nome_produto`,`valor_unitario`,`quantidade`,`valor_total`) VALUES (7,'<NAME>','Rua <NAME>, 752 - Parque das Cerejeiras','99999-9999','Microondas Philco',490,2,980); INSERT INTO `` (`id`,`nome_cliente`,`endereco`,`telefone`,`nome_produto`,`valor_unitario`,`quantidade`,`valor_total`) VALUES (8,'<NAME>','Rua <NAME>, 604 - Jardim Veneto II','99999-9999','Geladeira Dodge',999.9,1,999.9);
CREATE PROC usp_GetHoldersFullName AS BEGIN SELECT CONCAT(FirstName,' ', LastName) AS [Full Name] FROM AccountHolders END
<reponame>Jaeggel/AppPerros -- phpMyAdmin SQL Dump -- version 4.5.0.2 -- http://www.phpmyadmin.net -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 26-07-2017 a las 05:03:44 -- Versión del servidor: 10.0.17-MariaDB -- Versión de PHP: 5.5.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 utf8mb4 */; -- -- Base de datos: `app_perros` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `perros` -- CREATE TABLE `perros` ( `id_perro` int(11) NOT NULL, `NOMBRE_PERRO` varchar(100) NOT NULL, `EDAD_PERRO` varchar(20) NOT NULL, `SEXO` varchar(20) NOT NULL, `DESC_PERRO` varchar(500) NOT NULL, `RAZA` varchar(100) NOT NULL, `FOTO` varchar(100) DEFAULT NULL, `ESTADO` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `perros` -- INSERT INTO `perros` (`id_perro`, `NOMBRE_PERRO`, `EDAD_PERRO`, `SEXO`, `DESC_PERRO`, `RAZA`, `FOTO`, `ESTADO`) VALUES (1, 'Clara', '2 años y 1 mes', 'Hembra', 'Clara fue encontrada por un lugareño que cuidó de ella hasta que fuimos a recogerla, \r\nno la quería porque no le servía para cazar. Es muy miedosa pero cariñosa cuando conoce, \r\nhay que acercarse a ella despacio y con tranquilidad', 'Mestizo', '1.jpg', 0), (2, 'Coqueta', '4 meses y 3 dias', 'Hembra', 'Fue rescatada hace unas semanas junto a sus 12 hermanos. ha tenido suerte \r\ny ha encontrado una estupenda casa de acogida donde esta descubriendo el calor de un hogar.\r\nes un cachorrita buena, juguetona y sociable. \r\nLe gustan los mimos y esta empezando a descubrir lo que son los juguetes, esta encantada.', 'Labrador/Mastín', '2.jpg', 0), (3, 'Toby', '4 años y 3 meses', 'Macho', 'A este pequeño, Aster, su dueña ya no lo quiere, simplemente se ha cansado de él.', 'C<NAME>', '3.jpg', 0), (4, 'Maya', '4 meses y 3 días', 'Hembra', 'Maya fue rescatada hace unas semanas junto a sus 12 hermanos. \r\nHa tenido suerte y ha encontrado una estupenda casa de acogida donde esta descubriendo el calor de un hogar.\r\nEs un cachorrita buena, juguetona y sociable. Le gustan los mimos y esta empezando a descubrir lo que son los juguetes, esta encantada.', 'Cruce de Border Collie', '4.jpg', 0), (5, 'Kiwi', '1 año y 6 meses', 'Hembra', 'Kiwi fue encontrada en el campo junto con Foxi.\r\nLas dos perritas se han dejado coger fácilmente, porque son muy sociales y cariñosas.\r\nKiwi es muy juguetona y le encanta ser el centro del atención. Nos hace reír cuando se pone en sus patitas de atrás,\r\ncon sus patitas de alante a los lados como si dos brazos humanos fuesen, mostrando sus dientes, como si se estuviese esforzando en mirar', 'Mestizo', '5.jpg', 0), (6, 'Rabbit', '1 año y mes', 'Macho', 'Rabbit (que así lo hemos llamado, trataba de llamar la atención de los humanos para que ayudaran a su madre, \r\nque no se movía…, seguramente debido al hambre que pasaban y que les hizo comer cualquier cosa…\r\nAfortunadamente la perrita se recuperó muy rápidamente, y los dos fueron acogidos de forma provisional \r\npor la vecina, que nos refiere que los dos perritos son un amor, cariñosos, alegres y muy agradecidos de vivir \r\nen una casita Buscamos a esa familia que le quiera para toda una vida feli', 'Mestizo', '6.jpg', 0), (7, 'Eros', '2 años y 1 mes', 'Macho', 'Eros tenia una familia, pero por problemas de salud no pueden tenerlo mas.', 'Beagle/Teckle', '7.jpg', 0), (8, 'Pinta', '3 meses y 4 días', 'Hembra', 'Pinta proviene de una camada no deseada. Fue encontrada abandonada junto a sus hermanos en una finca en la que no vive nadie. \r\nNecesita urgentemente un hogar o casa de acogida, donde pueda recibir cariño y jugar, que es lo que más le gusta.', '<NAME>', '8.jpg', 0), (9, 'Baddy', '3 meses y 4 días', 'Hembra', 'Baddy proviene de una camada no deseada. Fue encontrada abandonada junto a sus hermanos en una finca en la que no vive nadie. \r\nNecesita urgentemente un hogar o casa de acogida, donde pueda recibir cariño y jugar, que es lo que más le gusta.', '<NAME>', '9.jpg', 0), (10, 'Marcus', '3 meses y 3 días', 'Macho', 'Marcus proviene de una camada no deseada. Fue encontrado abandonado junto a sus hermanos en una finca en la que no vive nadie.\r\nNecesita urgentemente un hogar o casa de acogida, donde pueda recibir cariño y jugar, que es lo que más le gusta.', '<NAME>', '10.jpg', 0), (11, 'Oso', '3 meses y 4 días', 'Macho', 'Oso proviene de una camada no deseada. Fue encontrado abandonado junto a sus hermanos en una finca en la que no vive nadie. \r\nNecesita urgentemente un hogar o casa de acogida, donde pueda recibir cariño y jugar, que es lo que más le gusta.', '<NAME>', '11.jpg', 0), (12, 'Cala', '11 meses y 11 días', 'Hembra', 'Cala es una perrita muy querida, pero su joven dueño tiene que irse a trabajar muy muy lejos de España, \r\na un país donde los perros no son bienvenidos, asi que nos pide que le busquemos a la mejor familia del mundo. \r\nEs una cachorra activa, juguetona y muy cariñosa…. Ya está esterilizada, y lista para empezar una nueva vida.', 'Cruce de Beagle', '12.jpg', 0), (13, 'Coke', '1 año y 6 meses', 'Macho', 'Coke era el perro de un vagabundo. Este individuo tenia al perro todo el dia atado, expuesto al sol 24h \r\ny sin agua ni comida. Sin que pudiera moverse, haciendose sus necesidades encima. \r\nBuscamos un hogar digno para este encanto de perrito.', 'Mestizo', '13.jpg', 0), (14, 'Mulán', '3 meses y 13 días', 'Hembra', 'Nos encontramos a Mulan y Choco en el entorno de Jaen, estaban junto a su mami en el campo. Solo las dos \r\nbebes han venido al albergue de Nueva Vida.\r\nSon dos pequeñas con mucho miedo. \r\nNecesitan rapido un hogar definitivo donde aprenderán a confiar en los humanos y disfrutar la vida.', 'Mestizo', '14.jpg', 0), (15, 'Choco', '3 meses y 13 días', 'Hembra', 'Nos encontramos a Mulan y Choco en el entorno de Jaen, estaban junto a su mami en el campo. Solo las dos \r\nbebes han venido al albergue de Nueva Vida.Son dos pequeñas con mucho miedo. \r\nNecesitan rapido un hogar definitivo donde aprenderán a confiar en los humanos y disfrutar la vida.', 'Mestizo', '15.jpg', 0), (16, 'Roky', '8 años y 6 meses', 'Macho', 'Roky fue a vivir con su familia hace tiempo, pero la situación en su casa ahora es un poco difícil,ya que hay tres miembros humanos nuevos.', 'Mestizo', '16.jpg', 0), (34, 'Duke', '12', 'Macho', 'Perro muy cariñoso ', 'french', 'IMG-20130401-WA0000.jpg', 0), (35, 'Kasiuki', '12 meses y 7 dias', 'Macho', 'Muy cariñoso ', 'pastor aleman', '2688916488_1a125cd0e7_b.jpg', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `solicitud` -- CREATE TABLE `solicitud` ( `ID_SOLICITUD` int(11) NOT NULL, `ID_PERRO` int(11) DEFAULT NULL, `NOMBRE_ADOPTANTE` varchar(100) NOT NULL, `APELLIDO_ADOPTANTE` varchar(100) NOT NULL, `CEDULA` int(11) NOT NULL, `EDAD` int(11) NOT NULL, `SEXO_ADOPTANTE` varchar(50) NOT NULL, `DIRECCION` varchar(100) NOT NULL, `TELEFONO` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `solicitud` -- INSERT INTO `solicitud` (`ID_SOLICITUD`, `ID_PERRO`, `NOMBRE_ADOPTANTE`, `APELLIDO_ADOPTANTE`, `CEDULA`, `EDAD`, `SEXO_ADOPTANTE`, `DIRECCION`, `TELEFONO`) VALUES (6, 34, '<NAME>', '<NAME>', 1719668863, 23, 'Hombre', 'san luis de chillogallo', '0979020055'), (7, 35, '<NAME>', '<NAME>', 1719219081, 15, 'Hombre', 'Las casas NO32-212', '02254567'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuario` -- CREATE TABLE `usuario` ( `user` varchar(50) NOT NULL, `password` int(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `usuario` -- INSERT INTO `usuario` (`user`, `password`) VALUES ('jo<PASSWORD>', <PASSWORD>); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `perros` -- ALTER TABLE `perros` ADD PRIMARY KEY (`id_perro`), ADD UNIQUE KEY `PERROS_PK` (`id_perro`); -- -- Indices de la tabla `solicitud` -- ALTER TABLE `solicitud` ADD PRIMARY KEY (`ID_SOLICITUD`), ADD UNIQUE KEY `SOLICITUD_PK` (`ID_SOLICITUD`), ADD KEY `RELATIONSHIP_1_FK` (`ID_PERRO`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `perros` -- ALTER TABLE `perros` MODIFY `id_perro` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36; -- -- AUTO_INCREMENT de la tabla `solicitud` -- ALTER TABLE `solicitud` MODIFY `ID_SOLICITUD` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `solicitud` -- ALTER TABLE `solicitud` ADD CONSTRAINT `FK_SOLICITU_RELATIONS_PERROS` FOREIGN KEY (`ID_PERRO`) REFERENCES `perros` (`id_perro`); /*!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 */;
create or replace package ddlt_ut as function sample_ut( n int default 1 ) return clob; function sample_utp( n int default 1 ) return clob; function generate_json( test# int default 1 ) return clob; end; /
<reponame>blockchainbox/blockchainbox-docker CREATE USER root WITH PASSWORD '<PASSWORD>'; GRANT ALL PRIVILEGES ON DATABASE "postgres" to root;
.print 'Loading mimic3 DATETIMEEVENTS csv files...' .mode csv DROP TABLE IF EXISTS load_temp; .print 'DATETIMEEVENTS' .import ../rawdata/DATETIMEEVENTS.csv load_temp INSERT INTO DATETIMEEVENTS select * from load_temp; DROP TABLE IF EXISTS load_temp; .exit
<filename>db_apotik.sql -- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 14, 2020 at 04:57 AM -- Server version: 10.1.38-MariaDB -- PHP Version: 7.3.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: `db_apotik` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `USERNAME` varchar(225) NOT NULL, `PASSWORD` varchar(225) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`USERNAME`, `PASSWORD`) VALUES ('jeje', '<PASSWORD>'); -- -------------------------------------------------------- -- -- Table structure for table `detil_transaksi` -- CREATE TABLE `detil_transaksi` ( `KODE_DETIL` int(11) NOT NULL, `KODE_TRANSAKSI` int(11) DEFAULT NULL, `KODE_OBAT` int(11) NOT NULL, `SUB_TOTAL` int(11) DEFAULT NULL, `JUMLAH` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `obat` -- CREATE TABLE `obat` ( `KODE_OBAT` int(11) NOT NULL, `KODE_SUPPLIER` int(11) NOT NULL, `KODE_DETIL` int(11) DEFAULT NULL, `NAMA_OBAT` varchar(225) DEFAULT NULL, `PRODUSEN` varchar(225) DEFAULT NULL, `HARGA` int(11) DEFAULT NULL, `JML_STOK` int(11) DEFAULT NULL, `FOTO` longblob ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `supplier` -- CREATE TABLE `supplier` ( `KODE_SUPPLIER` int(11) NOT NULL, `NAMA_SUPPLIER` varchar(225) DEFAULT NULL, `ALAMAT` varchar(225) DEFAULT NULL, `KOTA` varchar(225) DEFAULT NULL, `TELP` int(11) DEFAULT NULL, `USERNAME` varchar(50) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `transaksi` -- CREATE TABLE `transaksi` ( `KODE_TRANSAKSI` int(11) NOT NULL, `KODE_DETIL` int(11) NOT NULL, `USERNAME` varchar(225) NOT NULL, `NAMA_PEMBELI` varchar(225) DEFAULT NULL, `TGL_TRANSAKSI` date DEFAULT NULL, `SUB_TOTAL` int(11) DEFAULT NULL, `TOTAL` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`USERNAME`); -- -- Indexes for table `detil_transaksi` -- ALTER TABLE `detil_transaksi` ADD PRIMARY KEY (`KODE_DETIL`), ADD KEY `FK_MEMILIKI2` (`KODE_TRANSAKSI`), ADD KEY `FK_MEMPUNYAI` (`KODE_OBAT`); -- -- Indexes for table `obat` -- ALTER TABLE `obat` ADD PRIMARY KEY (`KODE_OBAT`), ADD KEY `FK_MEMPUNYAI2` (`KODE_DETIL`), ADD KEY `FK_MENYUPLAI` (`KODE_SUPPLIER`); -- -- Indexes for table `supplier` -- ALTER TABLE `supplier` ADD PRIMARY KEY (`KODE_SUPPLIER`), ADD KEY `FK_MENGELOLA` (`USERNAME`); -- -- Indexes for table `transaksi` -- ALTER TABLE `transaksi` ADD PRIMARY KEY (`KODE_TRANSAKSI`), ADD KEY `FK_MELAKUKAN` (`USERNAME`), ADD KEY `FK_MEMILIKI` (`KODE_DETIL`); -- -- Constraints for dumped tables -- -- -- Constraints for table `detil_transaksi` -- ALTER TABLE `detil_transaksi` ADD CONSTRAINT `FK_MEMILIKI2` FOREIGN KEY (`KODE_TRANSAKSI`) REFERENCES `transaksi` (`KODE_TRANSAKSI`), ADD CONSTRAINT `FK_MEMPUNYAI` FOREIGN KEY (`KODE_OBAT`) REFERENCES `obat` (`KODE_OBAT`); -- -- Constraints for table `obat` -- ALTER TABLE `obat` ADD CONSTRAINT `FK_MEMPUNYAI2` FOREIGN KEY (`KODE_DETIL`) REFERENCES `detil_transaksi` (`KODE_DETIL`), ADD CONSTRAINT `FK_MENYUPLAI` FOREIGN KEY (`KODE_SUPPLIER`) REFERENCES `supplier` (`KODE_SUPPLIER`); -- -- Constraints for table `supplier` -- ALTER TABLE `supplier` ADD CONSTRAINT `FK_MENGELOLA` FOREIGN KEY (`USERNAME`) REFERENCES `admin` (`USERNAME`); -- -- Constraints for table `transaksi` -- ALTER TABLE `transaksi` ADD CONSTRAINT `FK_MELAKUKAN` FOREIGN KEY (`USERNAME`) REFERENCES `admin` (`USERNAME`), ADD CONSTRAINT `FK_MEMILIKI` FOREIGN KEY (`KODE_DETIL`) REFERENCES `detil_transaksi` (`KODE_DETIL`); 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>manikanth/sql-server-samples<filename>samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/DataLoadSimulation/Stored Procedures/GetRandomStockItemToAdjust.sql<gh_stars>1000+ CREATE PROCEDURE [DataLoadSimulation].[GetRandomStockItemToAdjust] @QuantityToAdjust INT , @StockItemIDToAdjust INT OUTPUT AS BEGIN /* Notes: Selects stock item to adjust ID. As with other similar procs, we have to use a proc as opposed to a function as random tools such as NEWID and RAND don't work in functions Usage: DECLARE @myStockItemIDToAdjust INT EXEC [DataLoadSimulation].[GetRandomStockItemToAdjust] 10, @StockItemIDToAdjust = @myStockItemIDToAdjust OUTPUT SELECT @myStockItemIDToAdjust */ SELECT TOP(1) @StockItemIDToAdjust = StockItemID FROM Warehouse.StockItemHoldings WHERE (QuantityOnHand + @QuantityToAdjust) >= 0 ORDER BY NEWID() RETURN END
<filename>coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/current/4.0/dml/KC_DML_31005_AWARD_UNIT_CONTACTS_00S0.sql<gh_stars>0 INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00001' AND SEQUENCE_NUMBER = '1'),'001002-00001',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00002' AND SEQUENCE_NUMBER = '1'),'001002-00002',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00003' AND SEQUENCE_NUMBER = '1'),'001002-00003',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00004' AND SEQUENCE_NUMBER = '1'),'001002-00004',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00004' AND SEQUENCE_NUMBER = '2'),'001002-00004',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00005' AND SEQUENCE_NUMBER = '1'),'001002-00005',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00006' AND SEQUENCE_NUMBER = '1'),'001002-00006',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00007' AND SEQUENCE_NUMBER = '1'),'001002-00007',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00008' AND SEQUENCE_NUMBER = '1'),'001002-00008',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00006' AND SEQUENCE_NUMBER = '2'),'001002-00006',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00007' AND SEQUENCE_NUMBER = '2'),'001002-00007',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00008' AND SEQUENCE_NUMBER = '2'),'001002-00008',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00009' AND SEQUENCE_NUMBER = '1'),'001002-00009',1,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00001' AND SEQUENCE_NUMBER = '2'),'001002-00001',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00002' AND SEQUENCE_NUMBER = '2'),'001002-00002',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00009' AND SEQUENCE_NUMBER = '2'),'001002-00009',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00003' AND SEQUENCE_NUMBER = '2'),'001002-00003',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00004' AND SEQUENCE_NUMBER = '3'),'001002-00004',3,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00005' AND SEQUENCE_NUMBER = '2'),'001002-00005',2,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00006' AND SEQUENCE_NUMBER = '3'),'001002-00006',3,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00007' AND SEQUENCE_NUMBER = '3'),'001002-00007',3,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) / INSERT INTO AWARD_UNIT_CONTACTS (AWARD_UNIT_CONTACT_ID,AWARD_ID,AWARD_NUMBER,SEQUENCE_NUMBER,PERSON_ID,FULL_NAME,UNIT_ADMINISTRATOR_TYPE_CODE,UNIT_ADMINISTRATOR_UNIT_NUMBER,UNIT_CONTACT_TYPE,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR) VALUES (SEQUENCE_AWARD_ID.NEXTVAL,(SELECT AWARD_ID FROM AWARD WHERE AWARD_NUMBER = '001002-00001' AND SEQUENCE_NUMBER = '3'),'001002-00001',3,'10000000001','<NAME>',(SELECT UNIT_ADMINISTRATOR_TYPE_CODE FROM UNIT_ADMINISTRATOR_TYPE WHERE DESCRIPTION = 'UNIT_HEAD'),'IN-CARD','CONTACT','quickstart',SYSDATE,SYS_GUID(),0) /
<filename>coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/log/Release_2_0_logs/KRACOEUS-2394.sql --DROP TYPE TABLE_PERS_SAL_SUMMARY; --DROP TYPE TYPE_PERS_SAL_SUMMARY; CREATE OR REPLACE TYPE TYPE_PERS_SAL_SUMMARY AS OBJECT ( PROPOSAL_NUMBER VARCHAR2(12), VERSION_NUMBER NUMBER(3), BUDGET_PERIOD NUMBER(3), LINE_ITEM_NUMBER NUMBER(3), START_DATE DATE, END_DATE DATE, CATEGORY VARCHAR2(200), PERSON_NAME VARCHAR2(90), PERCENT_EFFORT NUMBER(5,2), PERCENT_CHARGED NUMBER(5,2), EB_RATE VARCHAR2(10), VAC_RATE VARCHAR2(10), CATEGORY_CODE NUMBER(3), SALARY NUMBER(12,2), COST_SHARING_AMOUNT NUMBER(12,2), FRINGE NUMBER(12,2), FRINGE_COST_SHARING NUMBER(12,2), PRINCIPAL_INVESTIGATOR CHAR(1), COST_ELEMENT VARCHAR2(8), COST_ELEMENT_DESC VARCHAR2(200) ); CREATE OR REPLACE TYPE TABLE_PERS_SAL_SUMMARY IS TABLE OF TYPE_PERS_SAL_SUMMARY; CREATE OR REPLACE VIEW OSP$BUDGET_CONS_SALARY_SUMMARY AS select proposal_number, version_number, budget_period, line_item_number, start_date, end_date, fdesc as category, full_name as person_name, percent_effort, percent_charged, max(decode(rate_class_type, 'E', applied_rate, 0) ) || '%' eb_rate, max(decode(rate_class_type, 'V', applied_rate, 0) ) || '%' vac_rate, budget_category_code as category_code, max(salary_requested) as salary, max(cost_sharing_amount) as cost_sharing_amount, max(calculated_cost) as fringe, max(calculated_cost_sharing) as fringe_cost_sharing, PRINCIPAL_INVESTIGATOR, cost_element, gdesc as cost_element_desc from ( select proposal_number, version_number, budget_period, line_item_number, budget_category_code, cost_element, fdesc, gdesc, person_number, person_id, full_name, percent_charged, percent_effort, job_code, start_date, end_date, SALARY_REQUESTED, cost_sharing_amount, decode(rate_class_code, null, sRATE_CLASS_CODE, rate_class_code) rate_class_code, decode(rate_type_code, null, srate_type_code, rate_type_code) rate_type_code, decode(rate_class_type, null, srate_class_type, rate_class_type) rate_class_type, decode(calculated_cost, null, scalculated_cost, calculated_cost) calculated_cost, decode(calculated_cost_sharing, null, scalculated_cost_sharing, calculated_cost_sharing) calculated_cost_sharing, decode(applied_rate, null, sAPPLIED_RATE, applied_rate) applied_rate, PRINCIPAL_INVESTIGATOR from ( select A1.proposal_number proposal_number, A1.version_number version_number, A1.budget_period budget_period, A1.line_item_number line_item_number, A1.budget_category_code budget_category_code, A1.cost_element cost_element, A1.fdesc fdesc, A1.gdesc gdesc, A1.person_number person_number, A1.person_id person_id, A1.full_name full_name, A1.percent_charged percent_charged, A1.percent_effort percent_effort, A1.job_code job_code, A1.start_date start_date, A1.end_date end_date, A1.SALARY_REQUESTED SALARY_REQUESTED, a1.cost_sharing_amount cost_sharing_amount, A1.rate_class_code rate_class_code, A1.rate_type_code rate_type_code, a1.rate_class_type rate_class_type, a1.calculated_cost calculated_cost, A1.calculated_cost_sharing calculated_cost_sharing, a1.applied_rate applied_rate, a1.PRINCIPAL_INVESTIGATOR PRINCIPAL_INVESTIGATOR, a2.RATE_CLASS_CODE sRATE_CLASS_CODE, a2.RATE_TYPE_CODE sRATE_TYPE_CODE, d.RATE_CLASS_TYPE sRATE_CLASS_TYPE, rb.APPLIED_RATE sAPPLIED_RATE, a2.CALCULATED_COST sCALCULATED_COST, a2.CALCULATED_COST_SHARING sCALCULATED_COST_SHARING from OSP$BUDGET_SALARY_SUMMARY A1, osp$budget_details_cal_amts a2, osp$budget_rate_and_base rb, osp$rate_class d, osp$rate_type e where a1.proposal_number = a2.PROPOSAL_NUMBER(+) AND A2.PROPOSAL_NUMBER = RB.PROPOSAL_NUMBER and a1.version_number = a2.VERSION_NUMBER(+) AND A2.VERSION_NUMBER = RB.VERSION_NUMBER and a1.budget_period = a2.BUDGET_PERIOD(+) AND A2.BUDGET_PERIOD = RB.BUDGET_PERIOD and a1.line_item_number = a2.LINE_ITEM_NUMBER(+) AND A2.LINE_ITEM_NUMBER = RB.LINE_ITEM_NUMBER AND A2.RATE_CLASS_CODE = RB.RATE_CLASS_CODE AND A2.RATE_TYPE_CODE = RB.RATE_TYPE_CODE AND RB.RATE_CLASS_CODE = D.RATE_CLASS_CODE AND D.RATE_CLASS_CODE = E.RATE_CLASS_CODE AND E.RATE_CLASS_CODE = RB.RATE_CLASS_CODE AND E.RATE_TYPE_CODE = RB.RATE_TYPE_CODE AND d.rate_class_type in ('E', 'V') MINUS select A1.proposal_number proposal_number, A1.version_number version_number, A1.budget_period budget_period, A1.line_item_number line_item_number, A1.budget_category_code budget_category_code, A1.cost_element cost_element, A1.fdesc fdesc, A1.gdesc gdesc, A1.person_number person_number, A1.person_id person_id, A1.full_name full_name, A1.percent_charged percent_charged, A1.percent_effort percent_effort, A1.job_code job_code, A1.start_date start_date, A1.end_date end_date, A1.SALARY_REQUESTED SALARY_REQUESTED, a1.cost_sharing_amount cost_sharing_amount, A1.rate_class_code rate_class_code, A1.rate_type_code rate_type_code, a1.rate_class_type rate_class_type, a1.calculated_cost calculated_cost, A1.calculated_cost_sharing calculated_cost_sharing, a1.applied_rate applied_rate, a1.PRINCIPAL_INVESTIGATOR PRINCIPAL_INVESTIGATOR, a2.RATE_CLASS_CODE sRATE_CLASS_CODE, a2.RATE_TYPE_CODE sRATE_TYPE_CODE, d.RATE_CLASS_TYPE sRATE_CLASS_TYPE, rb.APPLIED_RATE sAPPLIED_RATE, a2.CALCULATED_COST sCALCULATED_COST, a2.CALCULATED_COST_SHARING sCALCULATED_COST_SHARING from OSP$BUDGET_SALARY_SUMMARY A1, osp$budget_details_cal_amts a2, osp$budget_rate_and_base rb, osp$rate_class d, osp$rate_type e, (SELECT RATE_CLASS_CODE, RATE_TYPE_CODE FROM osp$VALID_CALC_TYPES WHERE RATE_CLASS_TYPE IN ('E', 'V')) R where a1.proposal_number = a2.PROPOSAL_NUMBER(+) AND A2.PROPOSAL_NUMBER = RB.PROPOSAL_NUMBER and a1.version_number = a2.VERSION_NUMBER(+) AND A2.VERSION_NUMBER = RB.VERSION_NUMBER and a1.budget_period = a2.BUDGET_PERIOD(+) AND A2.BUDGET_PERIOD = RB.BUDGET_PERIOD and a1.line_item_number = a2.LINE_ITEM_NUMBER(+) AND A2.LINE_ITEM_NUMBER = RB.LINE_ITEM_NUMBER AND A2.RATE_CLASS_CODE = RB.RATE_CLASS_CODE AND A2.RATE_TYPE_CODE = RB.RATE_TYPE_CODE AND RB.RATE_CLASS_CODE = D.RATE_CLASS_CODE AND D.RATE_CLASS_CODE = E.RATE_CLASS_CODE AND E.RATE_CLASS_CODE = RB.RATE_CLASS_CODE AND E.RATE_TYPE_CODE = RB.RATE_TYPE_CODE AND A2.rate_class_code = R.rate_class_code and A2.rate_type_code = R.rate_type_code AND d.rate_class_type in ('E', 'V')) ) group by proposal_number, version_number, budget_period, line_item_number, budget_category_code, cost_element, fdesc, gdesc, person_number, person_id, full_name, job_code, principal_investigator, percent_charged, percent_effort, start_date, end_date order by proposal_number, version_number, budget_period, line_item_number, person_number; CREATE OR REPLACE VIEW OSP$V_SALARY_SUMMARY AS select a.proposal_number, a.version_number, a.budget_period, a.line_item_number, decode(b.start_date, null, a.START_DATE, b.START_DATE) START_DATE, decode(b.end_date, null, a.END_DATE, b.END_DATE) END_DATE, f.description category, p.full_name person_name, b.percent_effort, b.percent_charged, null eb_rate, null vac_rate, a.BUDGET_CATEGORY_CODE, decode(b.SALARY_REQUESTED, null, a.LINE_ITEM_cost, b.SALARY_REQUESTED) salary , b.cost_sharing_amount cost_sharing_amount, null fringe, null fringe_cost_sharing, DECODE(inv.PRINCIPAL_INVESTIGATOR_FLAG, 'Y', '1', 'N', '2', NULL, '3', '4') AS PRINCIPAL_INVESTIGATOR, g.COST_ELEMENT, g.description cost_element_desc from osp$budget_details a, osp$budget_personnel_details b, osp$person p , osp$budget_category f, osp$cost_element g , osp$eps_prop_investigators inv where a.proposal_number = b.proposal_number (+) and a.version_number = b.version_number (+) and a.budget_period = b.budget_period (+) and a.line_item_number = b.line_item_number (+) and b.person_id = p.person_id (+) and a.budget_category_code = f.budget_category_code and a.budget_category_code = g.budget_category_code and a.cost_element = g.cost_element and b.proposal_number = inv.proposal_number (+) and b.person_id = inv.person_id (+) and f.CATEGORY_TYPE = 'P' ; CREATE OR REPLACE PROCEDURE get_salary_summary ( as_proposal_number IN osp$budget_per_details_for_edi.PROPOSAL_NUMBER%TYPE, ai_version IN osp$budget_details.version_number%TYPE, ai_period IN osp$budget_per_details_for_edi.budget_period%TYPE, cur_summary IN OUT result_sets.cur_generic) is li_cost_element varchar2(50); view_result_count number; v_tmp_ce_result TABLE_PERS_SAL_SUMMARY; v_result TABLE_PERS_SAL_SUMMARY; begin v_tmp_ce_result := TABLE_PERS_SAL_SUMMARY(); v_result := TABLE_PERS_SAL_SUMMARY(); DECLARE CURSOR tmp_cur is select distinct t.cost_element from budget_details t, budget_category t1 where t.budget_category_code = t1.budget_category_code and t.proposal_number = as_proposal_number and t.version_number = ai_version and t.budget_period = ai_period AND t1.category_type = 'P' ; BEGIN OPEN TMP_CUR; LOOP FETCH TMP_CUR INTO li_cost_element; EXIT WHEN TMP_CUR%NOTFOUND; select count(1) into view_result_count from Osp$budget_Salary_Summary v1 where v1.proposal_number = as_proposal_number and v1.version_number = ai_version and v1.budget_period = ai_period and v1.cost_element = li_cost_element; v_tmp_ce_result := TABLE_PERS_SAL_SUMMARY(); if view_result_count > 0 then select TYPE_PERS_SAL_SUMMARY( proposal_number, version_number, budget_period, line_item_number, start_date, end_date, category, person_name, percent_effort, percent_charged, eb_rate, vac_rate, category_code, salary, cost_sharing_amount, fringe, fringe_cost_sharing, PRINCIPAL_INVESTIGATOR, cost_element, cost_element_desc ) BULK COLLECT INTO v_tmp_ce_result from OSP$BUDGET_CONS_SALARY_SUMMARY v WHERE v.proposal_number = as_proposal_number and v.version_number = ai_version and v.budget_period = ai_period and v.cost_element = li_cost_element; dbms_output.put_line('li_cost_element: case 1: ' || li_cost_element); DBMS_OUTPUT.PUT_LINE('Number of rows: case 1: ' || SQL%ROWCOUNT); else -- OPEN CUR_SUMMARY FOR select TYPE_PERS_SAL_SUMMARY( a.proposal_number, a.version_number, a.budget_period, a.line_item_number, A.START_DATE, A.END_DATE, A.category, A.person_name, A.percent_effort, A.percent_charged, A.eb_rate, A.vac_rate, A.BUDGET_CATEGORY_CODE, A.salary , A.cost_sharing_amount, A.fringe, A.fringe_cost_sharing, A.PRINCIPAL_INVESTIGATOR, A.COST_ELEMENT, A.cost_element_desc ) BULK COLLECT INTO v_tmp_ce_result from OSP$V_SALARY_SUMMARY A where a.proposal_number = as_proposal_number and a.version_number = ai_version and a.budget_period = ai_period and a.cost_element = li_cost_element; dbms_output.put_line('li_cost_element: case 2: ' || li_cost_element); DBMS_OUTPUT.PUT_LINE('Number of rows: case 2: ' || SQL%ROWCOUNT); end if; FOR i IN v_tmp_ce_result.FIRST .. v_tmp_ce_result.LAST LOOP v_result.EXTEND; v_result ( v_result.LAST ) := v_tmp_ce_result(i); dbms_output.put_line(li_cost_element || i); END LOOP; ENd loop; END; OPEN CUR_SUMMARY FOR select start_date, end_date, category, person_name, percent_effort, percent_charged, eb_rate, vac_rate, salary, cost_sharing_amount, fringe, fringe_cost_sharing, PRINCIPAL_INVESTIGATOR, cost_element_desc from TABLE ( v_result ); end; / CREATE OR REPLACE PROCEDURE get_cum_salary_summary ( as_proposal_number IN osp$budget_per_details_for_edi.PROPOSAL_NUMBER%TYPE, ai_version IN osp$budget_details.version_number%TYPE, cur_summary IN OUT result_sets.cur_generic) is li_cost_element varchar2(50); view_result_count number; v_tmp_ce_result TABLE_PERS_SAL_SUMMARY; v_result TABLE_PERS_SAL_SUMMARY; begin v_tmp_ce_result := TABLE_PERS_SAL_SUMMARY(); v_result := TABLE_PERS_SAL_SUMMARY(); DECLARE CURSOR tmp_cur is select distinct t.cost_element from budget_details t, budget_category t1 where t.budget_category_code = t1.budget_category_code and t.proposal_number = as_proposal_number and t.version_number = ai_version and t1.category_type = 'P' ; BEGIN OPEN TMP_CUR; LOOP FETCH TMP_CUR INTO li_cost_element; EXIT WHEN TMP_CUR%NOTFOUND; select count(1) into view_result_count from Osp$budget_Salary_Summary v1 where v1.proposal_number = as_proposal_number and v1.version_number = ai_version and v1.cost_element = li_cost_element; v_tmp_ce_result := TABLE_PERS_SAL_SUMMARY(); if view_result_count > 0 then select TYPE_PERS_SAL_SUMMARY( proposal_number, version_number, budget_period, line_item_number, start_date, end_date, category, person_name, percent_effort, percent_charged, eb_rate, vac_rate, category_code, salary, cost_sharing_amount, fringe, fringe_cost_sharing, PRINCIPAL_INVESTIGATOR, cost_element, cost_element_desc ) BULK COLLECT INTO v_tmp_ce_result from OSP$BUDGET_CONS_SALARY_SUMMARY v WHERE v.proposal_number = as_proposal_number and v.version_number = ai_version and v.cost_element = li_cost_element; dbms_output.put_line('li_cost_element: case 1: ' || li_cost_element); DBMS_OUTPUT.PUT_LINE('Number of rows: case 1: ' || SQL%ROWCOUNT); else select TYPE_PERS_SAL_SUMMARY( a.proposal_number, a.version_number, a.budget_period, a.line_item_number, A.START_DATE, A.END_DATE, A.category, A.person_name, A.percent_effort, A.percent_charged, A.eb_rate, A.vac_rate, A.BUDGET_CATEGORY_CODE, A.salary , A.cost_sharing_amount, A.fringe, A.fringe_cost_sharing, A.PRINCIPAL_INVESTIGATOR, A.COST_ELEMENT, A.cost_element_desc ) BULK COLLECT INTO v_tmp_ce_result from OSP$V_SALARY_SUMMARY A where a.proposal_number = as_proposal_number and a.version_number = ai_version and a.cost_element = li_cost_element; dbms_output.put_line('li_cost_element: case 2: ' || li_cost_element); DBMS_OUTPUT.PUT_LINE('Number of rows: case 2: ' || SQL%ROWCOUNT); end if; FOR i IN v_tmp_ce_result.FIRST .. v_tmp_ce_result.LAST LOOP v_result.EXTEND; v_result ( v_result.LAST ) := v_tmp_ce_result(i); dbms_output.put_line(li_cost_element || i); END LOOP; ENd loop; END; OPEN CUR_SUMMARY FOR select start_date, end_date, category, person_name, percent_effort, percent_charged, eb_rate, vac_rate, category_code, salary, cost_sharing_amount, fringe, fringe_cost_sharing, PRINCIPAL_INVESTIGATOR, cost_element_desc from TABLE ( v_result ); end; /
DELETE FROM `spell_affect` WHERE `entry` IN (36591);
create temporary table evens select * from nos where v%2=0;
-- -- SELECT concat('DROP TABLE IF EXISTS ', table_name, ';') FROM information_schema.tables WHERE table_schema = 'attribute_mapper'; -- DROP TABLE IF EXISTS users; DROP TABLE IF EXISTS schema_version;
ALTER TABLE application ADD COLUMN scale_out_limit int; UPDATE application SET scale_out_limit=(select scale_in_out where application.id=application.id); ALTER TABLE application DROP COLUMN scale_in_out;
<gh_stars>1-10 CREATE TABLE users (id serial primary key, name varchar)
<filename>queries/diagnosis.sql SELECT diag.icd9_code, diag_types.short_title, diag_types.long_title FROM `physionet-data.mimiciii_clinical.icustays` AS icustay INNER JOIN `physionet-data.mimiciii_clinical.diagnoses_icd` AS diag ON icustay.hadm_id = diag.hadm_id INNER JOIN `physionet-data.mimiciii_clinical.d_icd_diagnoses` as diag_types ON diag.icd9_code = diag_types.icd9_code INNER JOIN `milan-datathon.temp7.icustays` as icustays ON icustays.ids = icustay.icustay_id
<reponame>kafka0202/spring-cloud-demo DROP TABLE IF EXISTS `organization`; CREATE TABLE `organization` ( `id` VARCHAR(36) NOT NULL, `name` VARCHAR(32) NOT NULL, `contact_name` VARCHAR(32) NOT NULL, `contact_email` VARCHAR(50) NOT NULL, `contact_phone` VARCHAR(16) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `organization` (`id`, `name`, `contact_name`, `contact_email`, `contact_phone`) VALUES ('e254f8c-c442-4ebe-a82a-e2fc1d1ff78a', 'customer-crm-co', '<NAME>', '<EMAIL>', '823-555-1212'); INSERT INTO `organization` (`id`, `name`, `contact_name`, `contact_email`, `contact_phone`) VALUES ('442adb6e-fa58-47f3-9ca2-ed1fecdfe86c', 'HR-PowerSuite', '<NAME>', '<EMAIL>', '920-555-1212');
{{ config( materialized = 'view', bind=False ) }} with data_monitoring_metrics as ( select * from {{ ref('data_monitoring_metrics') }} ), max_bucket_end as ( select full_table_name, column_name, metric_name, max(bucket_end) as last_bucket_end from data_monitoring_metrics group by 1,2,3 ) select * from max_bucket_end
--# Copyright IBM Corp. All Rights Reserved. --# SPDX-License-Identifier: Apache-2.0 /* * Check table sparisty by comparing row counts in base tables vs sum of tuple span ranges from their synopsis tables * * When Db2 UPDATEs or DELETEs from a ORGANIZE BY COLUMN table, it marks the exiting row as deleted * and if it was a INSERT, writes a new row to the "end of the" tables * * This can cause "sparsity" issue as Db2 can (currenlty) only RECLAIM EXTENTs on a COL table * if *all* rows in an extent have been marked as deleted. * * This is fine if you are doing mass deleted based on some date range (and if the data in the table was ordered on insert) * or if you are doing mass updated of whole ranges of rows. * But if you do more random updates or deletes, you can end up with many extents with only a few non-deleted rows * * * The script below uses the fact that Db2 only removes synopsis rows when all references tuples have been RECLAIMed * By compating the TSN Range from the Synopsis table to the acutal table row count, you can have some idea on how * much sparsity a table has. * */ --DROP TABLE DB_TSN_SPAN --TRUNCATE TABLE DB_TSN_SPAN IMMEDIATE CREATE TABLE DB_TSN_SPAN ( TABSCHEMA VARCHAR(128) NOT NULL , TABNAME VARCHAR(128) NOT NULL , ROW_COUNT BIGINT NOT NULL , SYN_ROWS BIGINT NOT NULL , TSN_SPAN BIGINT NOT NULL --, PRIMARY KEY (TABSCHEMA, TABNAME ) ENFORCED ) DISTRIBUTE ON ( TABSCHEMA, TABNAME ) @ CREATE OR REPLACE VIEW DB_TABLE_SPARCITY AS SELECT T.* , TSN_SPAN / NULLIF(SYN_ROWS,0) AS AVG_TSN_SPAN , ROW_COUNT / NULLIF(SYN_ROWS,0) AS ROWS_PER_SYN_ROW , MAX(TSN_SPAN - ROW_COUNT,0) AS ROWS_NOT_RECLAIMED , QUANTIZE(100 * (MAX(TSN_SPAN - ROW_COUNT,0)) / NULLIF(ROW_COUNT,0)::DECFLOAT,0.01) AS PCT_DELETED FROM DB_TSN_SPAN T @ BEGIN DECLARE NOT_ALLOWED CONDITION FOR SQLSTATE '57016'; -- Skip LOAD pending tables etc. I.e. SQL0668N Operation not allowed DECLARE UNDEFINED_NAME CONDITION FOR SQLSTATE '42704'; -- Skip tables that no longer exist/not commited DECLARE CONTINUE HANDLER FOR NOT_ALLOWED, UNDEFINED_NAME BEGIN END; --- FOR C AS cur CURSOR WITH HOLD FOR SELECT VARCHAR( 'INSERT INTO DB_TSN_SPAN' || CHR(10) || ' SELECT' || CHR(10) || ' ''' || T.TABSCHEMA || ''' AS TABSCHEMA' || CHR(10) || ', ''' || T.TABNAME || ''' AS TABNAME' || CHR(10) || ', ROW_COUNT' || CHR(10) || ', SYN_ROWS' || CHR(10) || ', TSN_SPAN' || CHR(10) || 'FROM (SELECT COUNT(*) SYN_ROWS, SUM(TSNMAX-TSNMIN+1) AS TSN_SPAN FROM SYSIBM."' || S.TABNAME || '") AS S' || CHR(10) || ', (SELECT COUNT(*) ROW_COUNT FROM "' || RTRIM(T.TABSCHEMA) || '"."' || T.TABNAME || '") AS T' || CHR(10) || 'WHERE SYN_ROWS > 0' || CHR(10) || 'WITH UR' ,4000) AS INSERT_STMT , 'DELETE FROM DB_TSN_SPAN WHERE TABSCHEMA = ''' || T.TABSCHEMA || ''' AND TABNAME = ''' || T.TABNAME || '''' AS DELETE_STMT FROM SYSCAT.TABLES T , SYSCAT.TABDEP D , SYSCAT.TABLES S WHERE T.TABSCHEMA = D.BSCHEMA AND T.TABNAME = D.BNAME AND D.DTYPE = '7' AND S.TABSCHEMA = D.TABSCHEMA AND S.TABNAME = D.TABNAME AND (T.TABSCHEMA, T.TABNAME) NOT IN (SELECT TABSCHEMA, TABNAME FROM DB_TSN_SPAN) AND T.TABSCHEMA IN ('SSSS') -- add your own filters here if you wish AND T.TABNAME IN ('TTTT') -- add your own filters here if you wish ORDER BY T.TABSCHEMA, T.TABNAME WITH UR DO -- EXECUTE IMMEDIATE C.DELETE_STMT; EXECUTE IMMEDIATE C.INSERT_STMT; COMMIT; END FOR; END @ SELECT * FROM DB_TABLE_SPARCITY ORDER BY PCT_DELETED DESC @
<reponame>utrad-ical/circus_cs_web_ui<gh_stars>1-10 -- CIRCUS CS DB Migration 11 CREATE INDEX ON feedback_list (job_id);
<reponame>opengauss-mirror/Yat<gh_stars>0 -- @testpoint:opengauss关键字option非保留),作为序列名 --关键字不带引号-成功 drop sequence if exists option; create sequence option start 100 cache 50; drop sequence option; --关键字带双引号-成功 drop sequence if exists "option"; create sequence "option" start 100 cache 50; drop sequence "option"; --关键字带单引号-合理报错 drop sequence if exists 'option'; create sequence 'option' start 100 cache 50; --关键字带反引号-合理报错 drop sequence if exists `option`; create sequence `option` start 100 cache 50;
<reponame>Eamon02/Employee-Management-System USE employee_db; INSERT INTO department (department) VALUES ('Marketing'); INSERT INTO department (department) VALUES ('Accounting'); INSERT INTO department (department) VALUES ('Finance'); INSERT INTO department (department) VALUES ('Legal'); INSERT INTO roles (title, salary, department_id) VALUES ('manager', 80000, 1); INSERT INTO roles (title, salary, department_id) VALUES ('manager', 80000, 2); INSERT INTO roles (title, salary, department_id) VALUES ('manager', 80000, 3); INSERT INTO roles (title, salary, department_id) VALUES ('manager', 80000, 4); INSERT INTO roles (title, salary, department_id) VALUES ('associate', 60000, 1); INSERT INTO roles (title, salary, department_id) VALUES ('associate', 60000, 2); INSERT INTO roles (title, salary, department_id) VALUES ('associate', 60000, 3); INSERT INTO roles (title, salary, department_id) VALUES ('associate', 60000, 4); INSERT INTO roles (title, salary, department_id) VALUES ('assistant', 60000, 1); INSERT INTO roles (title, salary, department_id) VALUES ('assistant', 60000, 2); INSERT INTO roles (title, salary, department_id) VALUES ('assistant', 60000, 3); INSERT INTO roles (title, salary, department_id) VALUES ('assistant', 60000, 4); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES ('Kevin', 'James', 1, 0); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES ('Billy', 'Bob', 2, 0); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES ('Phil', 'Dude', 1, 1); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES ('Dude', 'Man', 2, 2); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES ('Toast', 'Er', 3, 3); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES ('Pop', 'Corn', 4, 4); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES ('Steve', 'Story', 5, 5);
### Schema create DATABASE employeetracker; use employeetracker; CREATE TABLE departments ( id int NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE employees ( id int NOT NULL AUTO_INCREMENT, first_name varchar(255) NOT NULL, last_name varchar(255) NOT NULL, role_id INT NOT NULL, manager_id INT NULL, PRIMARY KEY (id) ); CREATE TABLE roles ( id int NOT NULL AUTO_INCREMENT, title varchar(50) NOT NULL, salary DECIMAL NOT NULL, department_id INT NOT NULL, PRIMARY KEY (id) );
<reponame>joe-cipolla/nyiso_sql CREATE TABLE public.rt_lmp ( id SERIAL, date_id integer NOT NULL, zone_id integer NOT NULL, he01 numeric(7,2), he02 numeric(7,2), he03 numeric(7,2), he04 numeric(7,2), he05 numeric(7,2), he06 numeric(7,2), he07 numeric(7,2), he08 numeric(7,2), he09 numeric(7,2), he10 numeric(7,2), he11 numeric(7,2), he12 numeric(7,2), he13 numeric(7,2), he14 numeric(7,2), he15 numeric(7,2), he16 numeric(7,2), he17 numeric(7,2), he18 numeric(7,2), he19 numeric(7,2), he20 numeric(7,2), he21 numeric(7,2), he22 numeric(7,2), he23 numeric(7,2), he24 numeric(7,2), CONSTRAINT rt_lmp_pkey PRIMARY KEY (id), CONSTRAINT fk_date FOREIGN KEY (date_id) REFERENCES public.dim_date (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT fk_zone FOREIGN KEY (zone_id) REFERENCES public.dim_zone (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ) TABLESPACE pg_default; ALTER TABLE public.rt_lmp OWNER to admin;
-- MySQL dump 10.13 Distrib 8.0.24, for Win64 (x86_64) -- -- Host: localhost Database: gama_exercicio_3 -- ------------------------------------------------------ -- Server version 8.0.24 /*!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 `cidade_estado` -- DROP TABLE IF EXISTS `cidade_estado`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `cidade_estado` ( `id` int NOT NULL AUTO_INCREMENT, `cidade` varchar(45) NOT NULL, `estado` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `clientes` -- DROP TABLE IF EXISTS `clientes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `clientes` ( `id` int NOT NULL AUTO_INCREMENT, `nome` varchar(45) NOT NULL, `whatsapp` bigint DEFAULT NULL, `senha` varchar(45) NOT NULL, `email` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `departamentos` -- DROP TABLE IF EXISTS `departamentos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `departamentos` ( `id` int NOT NULL AUTO_INCREMENT, `nome_departamento` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `enderecos` -- DROP TABLE IF EXISTS `enderecos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `enderecos` ( `id` int NOT NULL AUTO_INCREMENT, `tipo` varchar(45) NOT NULL, `logradouro` varchar(45) DEFAULT NULL, `numero` varchar(45) DEFAULT NULL, `bairro` varchar(45) DEFAULT NULL, `complemento` varchar(45) DEFAULT NULL, `cep` varchar(45) DEFAULT NULL, `cidade_estado` int NOT NULL, `cliente_id` int NOT NULL, PRIMARY KEY (`id`), KEY `fkcidadeestado_idx` (`cidade_estado`), KEY `fkcliente_idx` (`cliente_id`), CONSTRAINT `fkcidadeestado` FOREIGN KEY (`cidade_estado`) REFERENCES `cidade_estado` (`id`), CONSTRAINT `fkcliente` FOREIGN KEY (`cliente_id`) REFERENCES `clientes` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `estoque` -- DROP TABLE IF EXISTS `estoque`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `estoque` ( `id` int NOT NULL AUTO_INCREMENT, `produto_id` int NOT NULL, `quantidade` int NOT NULL, PRIMARY KEY (`id`), KEY `fkproduto_id_idx` (`produto_id`), CONSTRAINT `fkproduto_id` FOREIGN KEY (`produto_id`) REFERENCES `produtos` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `pedidos` -- DROP TABLE IF EXISTS `pedidos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `pedidos` ( `id` int NOT NULL AUTO_INCREMENT, `codigo` int DEFAULT NULL, `data` datetime NOT NULL, `clientes` int NOT NULL, `pedido_status` int NOT NULL, PRIMARY KEY (`id`), KEY `fkpedidos_status_idx` (`pedido_status`), KEY `fkclientes_idx` (`clientes`), CONSTRAINT `fkclientes` FOREIGN KEY (`clientes`) REFERENCES `clientes` (`id`), CONSTRAINT `fkpedidos_status` FOREIGN KEY (`pedido_status`) REFERENCES `pedidos_status` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `pedidos_status` -- DROP TABLE IF EXISTS `pedidos_status`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `pedidos_status` ( `id` int NOT NULL AUTO_INCREMENT, `status` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `produtos` -- DROP TABLE IF EXISTS `produtos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `produtos` ( `id` int NOT NULL AUTO_INCREMENT, `codigo` int NOT NULL, `descricao` varchar(45) NOT NULL, `preco` double NOT NULL, `disponivel` int NOT NULL, `destaque` int NOT NULL, `departamento_id` int NOT NULL, PRIMARY KEY (`id`), KEY `fkdepartamento_idx` (`departamento_id`), CONSTRAINT `fkdepartamento` FOREIGN KEY (`departamento_id`) REFERENCES `departamentos` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `produtos_pedidos` -- DROP TABLE IF EXISTS `produtos_pedidos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `produtos_pedidos` ( `id` int NOT NULL AUTO_INCREMENT, `preco_unitario` double NOT NULL, `descricao` varchar(45) NOT NULL, `quantidade` int NOT NULL, `preco_total` double NOT NULL, `id_pedido` int NOT NULL, PRIMARY KEY (`id`), KEY `fkid_pedido_idx` (`id_pedido`), CONSTRAINT `fkid_pedido` FOREIGN KEY (`id_pedido`) REFERENCES `pedidos` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!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 2021-05-20 20:18:00
<reponame>mateusfaustino/php-login-system<gh_stars>0 CREATE database mydb; use mydb; CREATE TABLE users ( id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY, email VARCHAR(200), password VARCHAR(200), name VARCHAR(100), lastname VARCHAR(100), token VARCHAR(200) ); INSERT INTO users values ( null, "<EMAIL>", "@1234567", "Mateus", "Faustino", null ); SELECT id, email, name, lastname from users;
<reponame>marleysidapple/share-market<filename>public/zone.sql<gh_stars>1-10 INSERT INTO `zone` (`zone_id`, `zone_name`) VALUES (1, 'Mechi'), (2, 'Rapti'), (3, 'Bagmati'), (4, 'Karnali'), (5, 'Sagarmatha'), (6, 'Koshi'), (7, 'Narayani'), (8, 'Mahakali'), (9, 'Gandaki'), (10, 'Janakpur'), (11, 'Lumbini'), (12, 'Seti'), (13, 'Bheri'), (14, 'Dhawalagiri');
<gh_stars>10-100 CREATE TABLE `fi_custom_fields` ( `custom_field_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `custom_field_table` VARCHAR( 35 ) NOT NULL , `custom_field_label` VARCHAR( 35 ) NOT NULL , `custom_field_column` VARCHAR( 35 ) NOT NULL , INDEX ( `custom_field_table` ) ) ENGINE = MYISAM ; CREATE TABLE `fi_client_custom` ( `client_custom_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `client_id` INT NOT NULL , INDEX ( `client_id` ) ) ENGINE = MYISAM ; CREATE TABLE `fi_payment_custom` ( `payment_custom_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `payment_id` INT NOT NULL , INDEX ( `payment_id` ) ) ENGINE = MYISAM ; CREATE TABLE `fi_user_custom` ( `user_custom_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `user_id` INT NOT NULL , INDEX ( `user_id` ) ) ENGINE = MYISAM ; CREATE TABLE `fi_invoice_custom` ( `invoice_custom_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `invoice_id` INT NOT NULL , INDEX ( `invoice_id` ) ) ENGINE = MYISAM ; CREATE TABLE `fi_quote_custom` ( `quote_custom_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `quote_id` INT NOT NULL , INDEX ( `quote_id` ) ) ENGINE = MYISAM ; DELETE FROM fi_invoice_amounts WHERE invoice_id NOT IN (SELECT invoice_id FROM fi_invoices);
-- https://www.hackerrank.com/challenges/the-report/problem -- The Report select if(grade > 7, name, NULL), grade, marks from students s inner join grades g on s.marks >= g.min_mark and s.marks <= g.max_mark order by grade desc, name
<gh_stars>10-100 -- +migrate Up CREATE TABLE `tag_evidence_map` ( `tag_id` INT NOT NULL, `evidence_id` INT NOT NULL, `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (`tag_id`,`evidence_id`), KEY `evidence_id` (`evidence_id`), FOREIGN KEY (`tag_id`) REFERENCES tags(`id`), FOREIGN KEY (`evidence_id`) REFERENCES evidence(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- +migrate Down DROP TABLE `tag_evidence_map`;
-- file:errors.sql ln:32 expect:true select * from pg_database where nonesuch = pg_database.datname
<gh_stars>100-1000 DROP TABLE IF EXISTS users CASCADE; DROP TYPE role;
<reponame>scala-steward/bitcoin-s<gh_stars>100-1000 -- Fix dummy event descriptor to be a parsable one UPDATE events SET event_descriptor_tlv = 'fdd8060800010564756d6d79' WHERE event_descriptor_tlv = 'fdd806090001000564756d6d79';
-- ----------------------------- -- 导出时间 `2018-03-27 17:33:49` -- ----------------------------- -- ----------------------------- -- 表结构 `dp_meeting_list` -- ----------------------------- DROP TABLE IF EXISTS `dp_meeting_list`; CREATE TABLE `dp_meeting_list` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `m_time` varchar(11) NOT NULL COMMENT '会议日期', `s_time` varchar(11) NOT NULL COMMENT '开始时间', `e_time` varchar(11) NOT NULL COMMENT '结束时间', `title` varchar(255) NOT NULL COMMENT '会议主题', `room_id` int(10) NOT NULL COMMENT '开会地点', `user_id` varchar(255) NOT NULL COMMENT '参会人员', `compare` int(10) NOT NULL COMMENT '主持人', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ----------------------------- -- 表数据 `dp_meeting_list` -- ----------------------------- INSERT INTO `dp_meeting_list` VALUES ('1', '1521216000', '1522117800', '1522121400', '开会测', '1', '1', '3'); -- ----------------------------- -- 表结构 `dp_meeting_rooms` -- ----------------------------- DROP TABLE IF EXISTS `dp_meeting_rooms`; CREATE TABLE `dp_meeting_rooms` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL COMMENT '会议室名', `r_number` int(10) NOT NULL COMMENT '容纳人数', `r_resource` varchar(255) NOT NULL COMMENT '配置,资源', `r_sort` tinyint(1) NOT NULL COMMENT '排序', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -- ----------------------------- -- 表数据 `dp_meeting_rooms` -- ----------------------------- INSERT INTO `dp_meeting_rooms` VALUES ('1', '大会议室', '80', '投影仪,音响,话筒', '1'); INSERT INTO `dp_meeting_rooms` VALUES ('2', '中会议室', '60', '投影仪,电脑', '2');
ALTER TABLE regmgr_medication RENAME COLUMN id TO ident;
<filename>worldmap/prep/clients.sql SELECT row, lat, lon, metro FROM ( SELECT ROW_NUMBER() OVER(PARTITION BY metro) as row, c, m, CEIL(20000 * m/c) as lim, metro, lat, lon FROM ( SELECT c, count(*) over(partition by metro_raw) as m, CASE WHEN metro_raw = "sjc" THEN "nuq" ELSE metro_raw END as metro, lat, lon FROM ( SELECT count(*) over() as c, REGEXP_EXTRACT(connection_spec.server_hostname, r"mlab\d.([a-z]{3})..") AS metro_raw, connection_spec.client_geolocation.latitude AS lat, connection_spec.client_geolocation.longitude AS lon FROM `measurement-lab.base_tables.ndt` WHERE _PARTITIONTIME = TIMESTAMP_SUB(TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), DAY), INTERVAL 24 HOUR) AND connection_spec.data_direction = 1 AND connection_spec.tls IS NOT FALSE -- AND connection_spec.tls IS TRUE -- AND connection_spec.client_geolocation.continent_code = 'NA' AND web100_log_entry.snap.HCThruOctetsAcked >= 8192 AND (web100_log_entry.snap.SndLimTimeRwin + web100_log_entry.snap.SndLimTimeCwnd + web100_log_entry.snap.SndLimTimeSnd) >= 9000000 AND (web100_log_entry.snap.SndLimTimeRwin + web100_log_entry.snap.SndLimTimeCwnd + web100_log_entry.snap.SndLimTimeSnd) < 600000000 AND connection_spec.client_geolocation.latitude IS NOT NULL AND connection_spec.client_geolocation.longitude IS NOT NULL GROUP BY metro_raw, lat, lon ) ) ) WHERE row < lim
 create database dbusmgr; CREATE USER dbusmgr IDENTIFIED BY 'HxP31vevLw9PoiT/'; GRANT ALL ON dbusmgr.* TO dbusmgr@'%' IDENTIFIED BY 'HxP31vevLw9PoiT/'; flush privileges;
CREATE TABLE `mst_area` ( `area_id` varchar(30) NOT NULL , `area_name` varchar(60) NOT NULL , `area_descr` varchar(90) , `_createby` varchar(13) NOT NULL , `_createdate` datetime NOT NULL DEFAULT current_timestamp(), `_modifyby` varchar(13) , `_modifydate` datetime , UNIQUE KEY `area_name` (`area_name`), PRIMARY KEY (`area_id`) ) ENGINE=InnoDB COMMENT='Master Area'; INSERT INTO mst_area (`area_id`, `area_name`, `_createby`, `_createdate`) VALUES ('DK', 'DALAM KOTA', 'root', NOW()); INSERT INTO mst_area (`area_id`, `area_name`, `_createby`, `_createdate`) VALUES ('LK', 'LUAR KOTA', 'root', NOW());
-- @testpoint:opengauss关键字Key(非保留),自定义数据类型名为explain --关键字explain作为数据类型不带引号,创建成功 drop type if exists Key; CREATE TYPE Key AS (f1 int, f2 text); select typname from pg_type where typname ='Key'; drop type Key; --关键字explain作为数据类型加双引号,创建成功 drop type if exists "Key"; CREATE TYPE "Key" AS (f1 int, f2 text); select typname from pg_type where typname ='Key'; drop type "Key"; --关键字explain作为数据类型加单引号,合理报错 drop type if exists 'Key'; CREATE TYPE 'Key' AS (f1 int, f2 text); select * from pg_type where typname ='Key'; drop type 'Key'; --关键字explain作为数据类型加反引号,合理报错 drop type if exists `Key`; CREATE TYPE `Key` AS (f1 int, f2 text); select * from pg_type where typname =`Key`; drop type `Key`;
INTO TABLE sage_document CHARACTER SET UTF8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' ( sage_document_article, sage_document_client_sage, sage_document_nbre, sage_document_numero_piece, sage_document_reference, sage_document_designation, sage_document_type, sage_document_prix_unitaire, sage_document_date );
<filename>DevTools/Modules/SimpleNoteService/Database/Scripts/InitialLoading/SimpleNoteService/Insert/RootFolder.sql<gh_stars>0 SET IDENTITY_INSERT [simple-note-service].[Folder] ON; INSERT INTO [simple-note-service].[Folder] ([Id], [Name]) VALUES (0, 'Root'); SET IDENTITY_INSERT [simple-note-service].[Folder] OFF;
<reponame>AlihanE/course-bot-backend alter table clients drop column if exists create_date, drop column if exists update_date;
/* Warnings: - A unique constraint covering the columns `[slug]` on the table `Bucket` will be added. If there are existing duplicate values, this will fail. - Added the required column `slug` to the `Bucket` table without a default value. This is not possible if the table is not empty. */ -- AlterTable ALTER TABLE `Bucket` ADD COLUMN `slug` VARCHAR(191) NOT NULL; -- CreateIndex CREATE UNIQUE INDEX `Bucket_slug_key` ON `Bucket`(`slug`);
<gh_stars>0 CREATE DATABASE appdb; CREATE USER flexberryuser WITH password '<PASSWORD>'; GRANT ALL privileges ON DATABASE appdb TO flexberryuser;
-- phpMyAdmin SQL Dump -- version 3.4.11.1deb2+deb7u8 -- http://www.phpmyadmin.net -- -- Host: localhost -- Erstellungszeit: 20. Jul 2019 um 00:12 -- Server Version: 5.5.60 -- PHP-Version: 5.4.45-0+deb7u14 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 */; -- -- Datenbank: `Funksteckdosen` -- -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `Automatik` -- CREATE TABLE IF NOT EXISTS `Automatik` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `FunkId` int(11) NOT NULL, `Zeit` text NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `Hersteller` -- CREATE TABLE IF NOT EXISTS `Hersteller` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `Name` text NOT NULL, `Codename` text NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; -- -- Daten für Tabelle `Hersteller` -- INSERT INTO `Hersteller` (`Id`, `Name`, `Codename`) VALUES (1, 'Pollin', 'pollin'), (2, 'Elro', 'elro_400_switch'), (3, 'Brennenstuhl', 'brennenstuhl'), (4, 'Mumbi', 'mumbi'), (5, 'Intertechno', 'intertechno_switch'), (6, 'Raw', 'raw'); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `Profil` -- CREATE TABLE IF NOT EXISTS `Profil` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `Name` text NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; -- -- Daten für Tabelle `Profil` -- INSERT INTO `Profil` (`Id`, `Name`) VALUES (1, 'Stube'), (5, 'Panik'), (6, 'Außen'), (8, 'Weihnachten'); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `ProfilSteckdosen` -- CREATE TABLE IF NOT EXISTS `ProfilSteckdosen` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `ProfilId` int(11) NOT NULL, `SteckdosenId` int(11) NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=78 ; -- -- Daten für Tabelle `ProfilSteckdosen` -- INSERT INTO `ProfilSteckdosen` (`Id`, `ProfilId`, `SteckdosenId`) VALUES (48, 5, 1), (50, 5, 39), (51, 5, 42), (52, 5, 43), (53, 5, 44), (54, 6, 43), (55, 6, 44), (56, 1, 47), (57, 5, 47), (58, 5, 47), (62, 1, 39), (66, 1, 1), (67, 1, 42), (74, 8, 1), (75, 8, 48), (76, 8, 49), (77, 8, 42); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `Profilzeit` -- CREATE TABLE IF NOT EXISTS `Profilzeit` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `ProfilId` int(11) NOT NULL, `Von` text, `Bis` text, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Daten für Tabelle `Profilzeit` -- INSERT INTO `Profilzeit` (`Id`, `ProfilId`, `Von`, `Bis`) VALUES (1, 1, 'U', '00:30'); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `Rawcode` -- CREATE TABLE IF NOT EXISTS `Rawcode` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `Raw_On` text NOT NULL, `Raw_Off` text NOT NULL, `Comment` varchar(20) NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; -- -- Daten für Tabelle `Rawcode` -- INSERT INTO `Rawcode` (`Id`, `Raw_On`, `Raw_Off`, `Comment`) VALUES (1, '330 4940 330 1000 320 1010 970 360 320 1010 310 1010 970 370 320 1010 970 360 320 1010 970 370 960 370 960 360 320 1010 970 380 310 1020 300 1020 960 370 960 380 310 1020 960 370 310 1010 970 380 300 1030 950 380 300 1020 960 380 950 370 310 1020', '320 4950 330 1000 320 1010 970 360 320 1010 320 1000 980 370 310 1010 320 1020 310 1010 970 370 320 1010 970 360 970 360 310 1030 960 370 960 360 970 360 320 1020 320 1010 970 360 310 1020 310 1040 300 1020 310 1020 310 1010 970 370 960 370 310 1020', 'Stern'), (2, '330 4950 320 1010 320 1000 980 350 330 1010 310 1010 980 360 320 1010 320 1010 320 1010 970 370 970 360 320 1010 970 360 970 370 970 360 310 1030 950 370 960 380 310 1020 960 370 310 1020 960 370 320 1020 310 1010 310 1020 960 380 310 1010 960 370', '320 4950 320 1010 320 1000 980 350 330 1000 320 1020 960 370 320 1020 310 1010 970 360 970 370 970 360 970 360 960 370 310 1030 310 1020 310 1020 960 360 970 370 310 1030 300 1020 310 1020 310 1030 310 1020 960 370 960 370 960 370 310 1010 970 370', 'Weihnachtsbaum'); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `Steckdosen` -- CREATE TABLE IF NOT EXISTS `Steckdosen` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `UId` int(11) NOT NULL, `SysCode` int(11) NOT NULL, `Hersteller` int(11) NOT NULL, `Name` text CHARACTER SET latin1 COLLATE latin1_general_ci, `Intervall` int(11) DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=50 ; -- -- Daten für Tabelle `Steckdosen` -- INSERT INTO `Steckdosen` (`Id`, `UId`, `SysCode`, `Hersteller`, `Name`, `Intervall`) VALUES (1, 1, 21, 1, 'Laterne', NULL), (39, 2, 21, 1, 'Vitrine', NULL), (41, 29, 11, 2, 'Pumpe', 10), (42, 4, 21, 1, 'Lampe', NULL), (43, 30, 11, 2, '<NAME>', NULL), (44, 1, 1, 5, 'Außentür', 10), (45, 23, 11, 2, 'Drucker', 10), (47, 15, 11, 2, '<NAME>', NULL), (48, 1, 1, 6, 'Stern', NULL), (49, 1, 2, 6, 'Weihnachtsbaum', NULL); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `Zeit` -- CREATE TABLE IF NOT EXISTS `Zeit` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `FunkId` int(11) NOT NULL, `Von` text NOT NULL, `Bis` text NOT NULL, `Dusk` tinyint(1) DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=41 ; -- -- Daten für Tabelle `Zeit` -- INSERT INTO `Zeit` (`Id`, `FunkId`, `Von`, `Bis`, `Dusk`) VALUES (40, 41, '06:00', '06:30', NULL); /*!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>sozezzo/sqlwatch CREATE FUNCTION [dbo].[ufn_sqlwatch_get_previous_snapshot_time] ( @snapshot_type_id tinyint, @sql_instance varchar(32), @snapshot_time datetime2(0) ) RETURNS datetime2(0) with schemabinding AS BEGIN return( select top 1 snapshot_time=[snapshot_time] from [dbo].[sqlwatch_logger_snapshot_header] where snapshot_type_id = @snapshot_type_id and sql_instance = @sql_instance and snapshot_time < @snapshot_time order by [snapshot_time] desc ); END;
<reponame>Xachman/data-merge-java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * Author: xach * Created: Aug 5, 2018 */ SET sql_mode = ''; SET GLOBAL sql_mode=''; DROP DATABASE database1; DROP DATABASE database2; CREATE DATABASE IF NOT EXISTS database1; CREATE DATABASE IF NOT EXISTS database2; USE database1; CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_bin NOT NULL, `email` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY(`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `users_meta` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `meta_key` varchar(255) COLLATE utf8_bin NOT NULL, `meta_value` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY (user_id) REFERENCES users(id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `posts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `content` longtext COLLATE utf8_bin NOT NULL, `created_date` datetime NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY (user_id) REFERENCES users(id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1; INSERT INTO users (username, email) VALUES ('timtheone', '<EMAIL>'), ('sassysara', '<EMAIL>'), ('jason', '<EMAIL>'); INSERT INTO users_meta (user_id, meta_key, meta_value) VALUES (1, 'address', '123 tim lane'), (2, 'address', '567 main street'), (2, 'phone', '555-555-5556'), (3, 'address', '935 wall street'), (3, 'phone', '555-555-5589'), (2, 'home_phone', '555-555-5569'); INSERT INTO posts (user_id, content, created_date) VALUES (1, 'Post 1 content', '2019-03-30 10:00:00'), (2, 'Post 2 content', '2019-03-30 10:00:00'), (3, 'Post 3 content', '2019-03-30 10:00:00'); USE database2; CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_bin NOT NULL, `email` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY(`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `users_meta` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `meta_key` varchar(255) COLLATE utf8_bin NOT NULL, `meta_value` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY (user_id) REFERENCES users(id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `posts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `content` longtext COLLATE utf8_bin NOT NULL, `created_date` datetime NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY (user_id) REFERENCES users(id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1; INSERT INTO users (username, email) VALUES ('timtheone', '<EMAIL>'), ('sassysara', '<EMAIL>'), ('john', '<EMAIL>'); INSERT INTO users_meta (user_id, meta_key, meta_value) VALUES (1, 'address', '123 tim lane'), (2, 'address', '567 main street'), (3, 'address', '456 elm street'), (2, 'phone', '555-555-5557'), (3, 'phone', '555-555-5550'), (2, 'home_phone', '555-555-5570'); INSERT INTO posts (user_id, content, created_date) VALUES (1, 'Post 1 content', '2019-03-30 10:00:00'), (2, 'Post 2 content', '2019-03-30 10:00:00'), (3, 'Post 4 content', '0000-00-00 00:00:00');
<reponame>tchenkov/JavaDB-Basics-MySQL # 04. Find Full Name of Each Employee # # Write SQL query to find the first, middle and last name of each # employee. Sort the information by id. USE soft_uni; SELECT e.first_name, e.middle_name, e.last_name FROM employees e ORDER BY employee_id
<gh_stars>0 CREATE TABLE tmp_cpf ( cpf bigint NOT NULL, CONSTRAINT pk PRIMARY KEY (cpf) ) WITH ( OIDS=FALSE ); ALTER TABLE tmp_cpf OWNER TO postgres; CREATE INDEX idx_only_tmp_cpf ON tmp_cpf ( cpf ); CREATE TABLE "PESSOA" ( "CD_CPF" numeric(11,0) NOT NULL, "CD_PESSOA" jsonb NOT NULL, "CD_JORNAL" integer NOT NULL, "NM_PESSOA" text NOT NULL, "SEXO" character(1), "DT_NASC" date, "ID_ESTADO_CIVIL" character varying(10), "ID_EMAIL" character varying(100), "CEP" character(8), "UF" character(2), "CIDADE" character varying(50), "BAIRRO" character varying(50), "TIPO_LOGRADOURO" character varying(50), "LOGRADOURO" character varying(50), "NUMERO" character varying(10), "COMPLEMENTO" character varying(10), "DT_INCLUSAO" date, "DT_ALTERACAO" date, "QTD_ASS" bigint NOT NULL DEFAULT 0, "QTD_ASS_ATIVAS" bigint NOT NULL DEFAULT 0, "TOTAL_PAGO" money NOT NULL DEFAULT 0, "FREQUENCIA" bigint NOT NULL DEFAULT 0, "TOTAL_PAGO_3" money NOT NULL DEFAULT 0, "FREQUENCIA_3" bigint NOT NULL DEFAULT 0, "TOTAL_PAGO_12" money NOT NULL DEFAULT 0, "FREQUENCIA_12" bigint NOT NULL DEFAULT 0, "RECENCIA" bigint NOT NULL DEFAULT 0, "LONGEVIDADE" bigint NOT NULL DEFAULT 0, CONSTRAINT pk_pessoa PRIMARY KEY ("CD_CPF") ) WITH ( OIDS=FALSE ); ALTER TABLE "PESSOA" OWNER TO postgres; CREATE INDEX idx_only_pessoa ON "PESSOA" ( "CD_CPF" ); CREATE INDEX idx_only_pessoa_cep ON "PESSOA" ( "CEP" ); CREATE INDEX idx_only_pessoa_qtd_ass ON "PESSOA" ( "QTD_ASS" ); CREATE TABLE tmp_processed ( cpf bigint NOT NULL, CONSTRAINT pk_tmp_processed PRIMARY KEY (cpf) ) WITH ( OIDS=FALSE ); ALTER TABLE tmp_processed OWNER TO postgres; CREATE INDEX idx_only_tmp_processed ON tmp_processed ( cpf );
<reponame>Kingcano124/PruebaTienda<filename>tiendadb.sql -- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 30-06-2020 a las 00:02:30 -- Versión del servidor: 10.4.11-MariaDB -- Versión de PHP: 7.4.5 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 */; -- -- Base de datos: `tiendadb` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `carrusel` -- CREATE TABLE `carrusel` ( `idcarrusel` int(11) NOT NULL, `ruta` varchar(45) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `categoria` -- CREATE TABLE `categoria` ( `idCategoria` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `categoria` -- INSERT INTO `categoria` (`idCategoria`, `descripcion`) VALUES (1, 'alimento para gatos '), (2, 'alimento para perros'), (3, 'accesorios'), (4, 'aseo'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cita` -- CREATE TABLE `cita` ( `idCita` int(11) NOT NULL, `cliente` int(11) NOT NULL, `asunto` varchar(45) NOT NULL, `fechaCita` date NOT NULL, `horaCita` time NOT NULL, `observaciones` varchar(45) NOT NULL, `idServicio` int(11) NOT NULL, `estado` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `cita` -- INSERT INTO `cita` (`idCita`, `cliente`, `asunto`, `fechaCita`, `horaCita`, `observaciones`, `idServicio`, `estado`) VALUES (14, 13, 'Peluqueria Canina 02:00 pm', '2020-06-30', '11:00:00', 'Perro grande', 2, 7), (15, 14, 'Peluqueria Canina ', '2020-06-30', '12:00:00', 'Perro pequeño', 2, 7), (16, 16, 'cita vacunacion', '2020-06-30', '03:31:00', 'vacunacion felina', 3, 7); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `compras` -- CREATE TABLE `compras` ( `idCompras` int(11) NOT NULL, `proveedor` int(11) NOT NULL, `facturaProveedor` varchar(45) NOT NULL, `fechafacturaProveedor` date NOT NULL, `fechaRegistroCompra` date NOT NULL DEFAULT current_timestamp(), `estado` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `contacto` -- CREATE TABLE `contacto` ( `idContacto` int(11) NOT NULL, `descripcion` int(120) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `detallecompra` -- CREATE TABLE `detallecompra` ( `idDetalleCompra` int(11) NOT NULL, `idCompra` int(11) NOT NULL, `idProducto` int(11) NOT NULL, `cantidad` int(11) NOT NULL, `costoProducto` int(11) NOT NULL, `iva` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `detallemascotacliente` -- CREATE TABLE `detallemascotacliente` ( `idDetalleMascotaCliente` int(11) NOT NULL, `documentoCliente` varchar(20) NOT NULL, `idmascota` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `detallemascotacliente` -- INSERT INTO `detallemascotacliente` (`idDetalleMascotaCliente`, `documentoCliente`, `idmascota`) VALUES (13, '1001661421', 3), (14, '1001661421', 2), (15, '71224697', 4), (16, '71224697', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `detalleproductofactura` -- CREATE TABLE `detalleproductofactura` ( `idDetalleproductofactura` int(11) NOT NULL, `factura` int(11) NOT NULL, `producto` int(11) DEFAULT NULL, `cantidad` int(11) NOT NULL, `descuento` int(11) NOT NULL, `precioVenta` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `detalleserviciofactura` -- CREATE TABLE `detalleserviciofactura` ( `idDetalleserviciofactura` int(11) NOT NULL, `factura` int(11) NOT NULL, `idServicio` int(11) NOT NULL, `cantidad` int(11) NOT NULL, `precioventa` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `detallevacunamascota` -- CREATE TABLE `detallevacunamascota` ( `idDetalleVacunaMascota` int(11) NOT NULL, `idMascota` int(11) NOT NULL, `idVacuna` int(11) NOT NULL, `dosis` int(11) NOT NULL, `fechaAplicacion` datetime NOT NULL, `fechaProxima` datetime NOT NULL, `observaciones` varchar(80) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `estado` -- CREATE TABLE `estado` ( `idEstado` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `estado` -- INSERT INTO `estado` (`idEstado`, `descripcion`) VALUES (1, 'Atendido'), (2, 'Cancelado'), (3, 'No asistio'), (4, 'En proceso'), (7, 'Programado'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `factura` -- CREATE TABLE `factura` ( `idFactura` int(11) NOT NULL, `fecha` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `vendedor` int(11) NOT NULL, `descuentoTotal` int(11) NOT NULL, `formaPago` int(11) NOT NULL, `nComprobante` int(11) DEFAULT NULL, `cita` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `formapago` -- CREATE TABLE `formapago` ( `idFormaPago` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `formapago` -- INSERT INTO `formapago` (`idFormaPago`, `descripcion`) VALUES (1, 'Efectivo'), (2, 'tarjeta de credito'), (3, 'transferencia'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `horario` -- CREATE TABLE `horario` ( `idhorario` int(11) NOT NULL, `diaInicio` varchar(10) COLLATE utf8_spanish_ci NOT NULL, `diaFin` varchar(10) COLLATE utf8_spanish_ci NOT NULL, `horaInicio` time NOT NULL, `horaFin` time NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `marca` -- CREATE TABLE `marca` ( `idMarca` int(11) NOT NULL, `descripcion` varchar(45) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `marca` -- INSERT INTO `marca` (`idMarca`, `descripcion`) VALUES (1, 'IPRA'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `mascota` -- CREATE TABLE `mascota` ( `idMascota` int(11) NOT NULL, `tipoMascota` int(11) NOT NULL, `nombreMascota` varchar(45) NOT NULL, `raza` int(11) NOT NULL, `sexo` varchar(11) NOT NULL, `fechaCumpleanos` date NOT NULL, `peso` float NOT NULL, `unidadMedida` int(11) NOT NULL, `observaciones` varchar(45) DEFAULT NULL, `estado` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `mascota` -- INSERT INTO `mascota` (`idMascota`, `tipoMascota`, `nombreMascota`, `raza`, `sexo`, `fechaCumpleanos`, `peso`, `unidadMedida`, `observaciones`, `estado`) VALUES (1, 2, 'Popi', 3, 'Hembra', '2020-05-01', 4, 1, 'felino joven enfermo moquillo', '1'), (2, 1, 'Rambu', 1, 'Macho', '2020-04-01', 10, 1, 'perro grande enfermo de gripa', '1'), (3, 2, 'pelos', 3, 'Macho', '2020-03-03', 12, 1, 'gato mediano enfermo de dolor estomago', '1'), (4, 1, 'Bruno', 2, 'Macho', '2020-03-01', 25, 1, 'perro con lagrimeo en los ojos ', '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `mision` -- CREATE TABLE `mision` ( `idMision` int(11) NOT NULL, `descripcion` int(120) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `persona` -- CREATE TABLE `persona` ( `documento` varchar(20) NOT NULL, `tipoDocumento` int(11) NOT NULL, `nombre` varchar(45) NOT NULL, `telefono` varchar(20) NOT NULL, `celular` varchar(20) NOT NULL, `direccion` varchar(45) NOT NULL, `correo` varchar(45) NOT NULL, `tipoPersona` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `persona` -- INSERT INTO `persona` (`documento`, `tipoDocumento`, `nombre`, `telefono`, `celular`, `direccion`, `correo`, `tipoPersona`) VALUES ('1001661421', 1, '<NAME>', '2222222', '3017474883', 'Carrera 80', '<EMAIL>', 1), ('71224697', 1, '<NAME>', '2245217', '3115823694', 'cra 36 2055', '<EMAIL>', 2); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `precioproducto` -- CREATE TABLE `precioproducto` ( `idPrecioProducto` int(11) NOT NULL, `registroPrecio` int(11) NOT NULL, `producto` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `preguntaseguridad` -- CREATE TABLE `preguntaseguridad` ( `idPreguntaSeguridad` int(11) NOT NULL, `pregunta` varchar(80) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `preguntaseguridad` -- INSERT INTO `preguntaseguridad` (`idPreguntaSeguridad`, `pregunta`) VALUES (1, 'En que año nacio su padre'), (2, 'En que año nacio su madre'), (3, 'Nombre del primer colegio'), (4, 'Nombre de su primera mascota'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `presentacion` -- CREATE TABLE `presentacion` ( `idPresentacion` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `presentacion` -- INSERT INTO `presentacion` (`idPresentacion`, `descripcion`) VALUES (1, 'bolsa'), (2, 'paquete'), (3, 'botella'), (4, 'frasco'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `producto` -- CREATE TABLE `producto` ( `idProducto` int(11) NOT NULL, `nombreProducto` varchar(45) NOT NULL, `descripcion` varchar(80) DEFAULT NULL, `categoria` int(11) NOT NULL, `marca` int(11) NOT NULL, `proveedor` int(11) NOT NULL, `existencia` int(11) NOT NULL, `unidadMedida` int(11) NOT NULL, `valorMedida` float NOT NULL, `presentacion` int(11) NOT NULL, `costo` int(11) NOT NULL, `utilidad` float NOT NULL, `precio` int(11) NOT NULL, `imagen` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `proveedor` -- CREATE TABLE `proveedor` ( `idProveedor` int(11) NOT NULL, `documento` varchar(20) NOT NULL, `nombreConctato` varchar(45) NOT NULL, `diaVisita` varchar(45) NOT NULL, `observaciones` varchar(80) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `quienessomos` -- CREATE TABLE `quienessomos` ( `idquienesSomos` int(11) NOT NULL, `descripcion` varchar(120) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `raza` -- CREATE TABLE `raza` ( `idRaza` int(11) NOT NULL, `descripcion` varchar(45) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `raza` -- INSERT INTO `raza` (`idRaza`, `descripcion`) VALUES (1, 'Pitbull'), (2, '<NAME>'), (3, 'Angora'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `registroprecio` -- CREATE TABLE `registroprecio` ( `idRegistroPrecio` int(11) NOT NULL, `motivoCambio` varchar(45) NOT NULL, `nuevoPrecio` int(11) NOT NULL, `fechaInicial` datetime NOT NULL DEFAULT current_timestamp(), `fechaFinal` datetime DEFAULT current_timestamp(), `estado` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `registroprecio` -- INSERT INTO `registroprecio` (`idRegistroPrecio`, `motivoCambio`, `nuevoPrecio`, `fechaInicial`, `fechaFinal`, `estado`) VALUES (1, 'primer precio peluqueria felina', 20000, '2020-05-23 10:29:07', '2020-07-31 00:00:00', 0), (2, 'Primer precio peluqueria canina', 53000, '2020-05-23 10:29:15', NULL, 1), (3, '2do precio Peluqueria felina', 40000, '2020-05-23 10:29:24', NULL, 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `respuesta` -- CREATE TABLE `respuesta` ( `idRespuesta` int(11) NOT NULL, `preguntaSeguridad` int(11) NOT NULL, `usuario` int(11) NOT NULL, `respuesta` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `rol` -- CREATE TABLE `rol` ( `idRol` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `rol` -- INSERT INTO `rol` (`idRol`, `descripcion`) VALUES (1, 'Administrador'), (2, 'Empleado'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `servicio` -- CREATE TABLE `servicio` ( `idServicio` int(11) NOT NULL, `nombreServicio` varchar(45) NOT NULL, `responsable` int(11) NOT NULL, `descripcion` varchar(80) NOT NULL, `recomendacionesPrevias` varchar(80) NOT NULL, `recomendacionesPosteriores` varchar(80) NOT NULL, `precio` int(11) NOT NULL, `imagenServicio` varchar(20) NOT NULL, `estado` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `servicio` -- INSERT INTO `servicio` (`idServicio`, `nombreServicio`, `responsable`, `descripcion`, `recomendacionesPrevias`, `recomendacionesPosteriores`, `precio`, `imagenServicio`, `estado`) VALUES (1, 'Peluqueria felina', 0, 'peluqueria general para gatos ', 'traer el gato con el carnet de las vacunas ', 'no bañar al gato por una semana ', 0, '', 1), (2, 'peluqueria canina ', 0, 'baño general de perros ', 'traer el carnet de las vacunas ', 'no bañarlo por dos semanas', 0, '', 1), (3, 'Vacuna gatos', 0, 'servicio de vacunacion ', 'traer todo el carnet de las vacunas ', 'retomar alimentacion de calidad ', 0, '', 1), (4, 'Vacunas perros', 0, 'vacunacion para perros', 'traer el carnet para vacunas', 'traerlo bañado', 0, '', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tipodocumento` -- CREATE TABLE `tipodocumento` ( `idTipoDocumento` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `tipodocumento` -- INSERT INTO `tipodocumento` (`idTipoDocumento`, `descripcion`) VALUES (1, 'Cédula de ciudadanía'), (2, 'Cédula de extranjería'), (3, 'Pasaporte'), (4, 'Tarjeta de identidad'), (5, 'Registro civil'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tipomascota` -- CREATE TABLE `tipomascota` ( `idTipoMascota` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `tipomascota` -- INSERT INTO `tipomascota` (`idTipoMascota`, `descripcion`) VALUES (1, 'Perro'), (2, 'Gato'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tipopersona` -- CREATE TABLE `tipopersona` ( `idTipoPersona` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `tipopersona` -- INSERT INTO `tipopersona` (`idTipoPersona`, `descripcion`) VALUES (1, 'Usuario'), (2, 'cliente'), (3, 'proveedor'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tipovacuna` -- CREATE TABLE `tipovacuna` ( `idTipoVacuna` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `tipovacuna` -- INSERT INTO `tipovacuna` (`idTipoVacuna`, `descripcion`) VALUES (1, 'vacuna felinos'), (2, 'vacuna caninos'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `unidadmedida` -- CREATE TABLE `unidadmedida` ( `idUnidadMedida` int(11) NOT NULL, `descripcion` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `unidadmedida` -- INSERT INTO `unidadmedida` (`idUnidadMedida`, `descripcion`) VALUES (1, 'kilogramos'), (2, 'unidad'), (3, 'paquete'), (4, 'libras'), (5, 'mililitros'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuario` -- CREATE TABLE `usuario` ( `idUsuario` int(11) NOT NULL, `personaDocumento` varchar(20) NOT NULL, `nombreUsuario` varchar(45) NOT NULL, `contrasena` varchar(45) NOT NULL, `rol` int(11) NOT NULL, `fechaRegistro` date NOT NULL DEFAULT current_timestamp(), `estado` int(11) NOT NULL DEFAULT 1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `usuario` -- INSERT INTO `usuario` (`idUsuario`, `personaDocumento`, `nombreUsuario`, `contrasena`, `rol`, `fechaRegistro`, `estado`) VALUES (23, '1001661421', 'Kingcano', '12345469813611', 1, '2020-06-03', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `vacuna` -- CREATE TABLE `vacuna` ( `idVacuna` int(11) NOT NULL, `nombre` varchar(45) NOT NULL, `marca` int(11) NOT NULL, `presentacion` int(11) NOT NULL, `tipoVacuna` int(11) NOT NULL, `valorMedida` int(11) NOT NULL, `unidadMedida` int(11) NOT NULL, `fechaCaducidad` date NOT NULL, `calendario` varchar(80) NOT NULL, `indicaciones` varchar(80) NOT NULL, `contraindicaciones` varchar(80) NOT NULL, `existencias` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `vacuna` -- INSERT INTO `vacuna` (`idVacuna`, `nombre`, `marca`, `presentacion`, `tipoVacuna`, `valorMedida`, `unidadMedida`, `fechaCaducidad`, `calendario`, `indicaciones`, `contraindicaciones`, `existencias`) VALUES (4, 'Parvovirus', 1, 4, 1, 1, 5, '2020-06-30', '', 'Se debe de tomar en cuenta el carnet de vacunacion ', '', 10), (5, 'Distemper', 1, 1, 2, 1, 5, '0000-00-00', '', 'inyectable', 'ninguna', 6), (6, 'Triplefelina', 1, 1, 1, 1, 5, '0000-00-00', '', 'inyectable', '', 8), (7, 'Triplefelina', 1, 1, 1, 1, 5, '0000-00-00', '', 'Inyectable', '', 6); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `vision` -- CREATE TABLE `vision` ( `idVision` int(11) NOT NULL, `descripcion` int(120) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `carrusel` -- ALTER TABLE `carrusel` ADD PRIMARY KEY (`idcarrusel`); -- -- Indices de la tabla `categoria` -- ALTER TABLE `categoria` ADD PRIMARY KEY (`idCategoria`); -- -- Indices de la tabla `cita` -- ALTER TABLE `cita` ADD PRIMARY KEY (`idCita`), ADD KEY `FK_CITA_SERVICIO` (`idServicio`), ADD KEY `FK_CITA_ESTADO` (`estado`), ADD KEY `FK_CITA_DETALLEMASCOTACLIENTE` (`cliente`); -- -- Indices de la tabla `compras` -- ALTER TABLE `compras` ADD PRIMARY KEY (`idCompras`), ADD KEY `FK_COMPRAS_PROVEEDOR` (`proveedor`); -- -- Indices de la tabla `contacto` -- ALTER TABLE `contacto` ADD PRIMARY KEY (`idContacto`); -- -- Indices de la tabla `detallecompra` -- ALTER TABLE `detallecompra` ADD PRIMARY KEY (`idDetalleCompra`), ADD KEY `FK_DETALLECOMPRA_COMPRAS` (`idCompra`), ADD KEY `FK_DETALLECOMPRA_PRODUCTO` (`idProducto`); -- -- Indices de la tabla `detallemascotacliente` -- ALTER TABLE `detallemascotacliente` ADD PRIMARY KEY (`idDetalleMascotaCliente`), ADD UNIQUE KEY `mascota` (`idmascota`), ADD KEY `FK_DETALLEMASCOTACLIENTE_PERSONA` (`documentoCliente`); -- -- Indices de la tabla `detalleproductofactura` -- ALTER TABLE `detalleproductofactura` ADD PRIMARY KEY (`idDetalleproductofactura`), ADD KEY `FK_DETALLEFACTURA_FACTURA` (`factura`), ADD KEY `FK_DETALLEFACTURA_PRODUCTO` (`producto`); -- -- Indices de la tabla `detalleserviciofactura` -- ALTER TABLE `detalleserviciofactura` ADD PRIMARY KEY (`idDetalleserviciofactura`), ADD KEY `FK_DETALLESERVICIOFACTURA_FACTURA` (`factura`), ADD KEY `FK_DETALLESERVICIOFACTURA_SERVICIO` (`idServicio`); -- -- Indices de la tabla `detallevacunamascota` -- ALTER TABLE `detallevacunamascota` ADD PRIMARY KEY (`idDetalleVacunaMascota`), ADD KEY `FK_DETALLEVACUNAMASCOTA_MASCOTA` (`idMascota`), ADD KEY `FK_DETALLEVACUNAMASCOTA_VACUNA` (`idVacuna`); -- -- Indices de la tabla `estado` -- ALTER TABLE `estado` ADD PRIMARY KEY (`idEstado`); -- -- Indices de la tabla `factura` -- ALTER TABLE `factura` ADD PRIMARY KEY (`idFactura`), ADD KEY `FK_FACTURA_FORMAPAGO` (`formaPago`), ADD KEY `FK_FACTURA_CITA` (`cita`), ADD KEY `FK_FACTURA_USUARIO` (`vendedor`); -- -- Indices de la tabla `formapago` -- ALTER TABLE `formapago` ADD PRIMARY KEY (`idFormaPago`); -- -- Indices de la tabla `horario` -- ALTER TABLE `horario` ADD PRIMARY KEY (`idhorario`); -- -- Indices de la tabla `marca` -- ALTER TABLE `marca` ADD PRIMARY KEY (`idMarca`); -- -- Indices de la tabla `mascota` -- ALTER TABLE `mascota` ADD PRIMARY KEY (`idMascota`), ADD KEY `FK_MASCOTA_TIPOMASCOTA` (`tipoMascota`), ADD KEY `FK_MASCOTA_RAZA` (`raza`), ADD KEY `FK_MASCOTA_UNIDADMEDIDA` (`unidadMedida`); -- -- Indices de la tabla `persona` -- ALTER TABLE `persona` ADD PRIMARY KEY (`documento`), ADD KEY `FK_PERSONA_TIPODOCUMENTO` (`tipoDocumento`), ADD KEY `FK_PERSONA_TIPOPERSONA` (`tipoPersona`); -- -- Indices de la tabla `precioproducto` -- ALTER TABLE `precioproducto` ADD PRIMARY KEY (`idPrecioProducto`), ADD KEY `FK_PRECIOPRODUCTO_PRODUCTO` (`producto`), ADD KEY `FK_PRECIOPRODUCTO_REGISTROPRECIO` (`registroPrecio`); -- -- Indices de la tabla `preguntaseguridad` -- ALTER TABLE `preguntaseguridad` ADD PRIMARY KEY (`idPreguntaSeguridad`); -- -- Indices de la tabla `presentacion` -- ALTER TABLE `presentacion` ADD PRIMARY KEY (`idPresentacion`); -- -- Indices de la tabla `producto` -- ALTER TABLE `producto` ADD PRIMARY KEY (`idProducto`), ADD KEY `FK_PRODUCTO_PRESENTACION` (`presentacion`), ADD KEY `FK_PRODUCTO_UNIDADMEDIDA` (`unidadMedida`), ADD KEY `FK_PRODUCTO_CATEGORIA` (`categoria`), ADD KEY `FK_PRODUCTO_MARCA` (`marca`); -- -- Indices de la tabla `proveedor` -- ALTER TABLE `proveedor` ADD PRIMARY KEY (`idProveedor`), ADD KEY `FK_PROVEEDOR_PERSONA` (`documento`); -- -- Indices de la tabla `quienessomos` -- ALTER TABLE `quienessomos` ADD PRIMARY KEY (`idquienesSomos`); -- -- Indices de la tabla `raza` -- ALTER TABLE `raza` ADD PRIMARY KEY (`idRaza`); -- -- Indices de la tabla `registroprecio` -- ALTER TABLE `registroprecio` ADD PRIMARY KEY (`idRegistroPrecio`); -- -- Indices de la tabla `respuesta` -- ALTER TABLE `respuesta` ADD PRIMARY KEY (`idRespuesta`), ADD KEY `FK_RESPUESTA_PREGUNTASEGURIDAD` (`preguntaSeguridad`), ADD KEY `FK_RESPUESTA_USUARIO` (`usuario`); -- -- Indices de la tabla `rol` -- ALTER TABLE `rol` ADD PRIMARY KEY (`idRol`); -- -- Indices de la tabla `servicio` -- ALTER TABLE `servicio` ADD PRIMARY KEY (`idServicio`); -- -- Indices de la tabla `tipodocumento` -- ALTER TABLE `tipodocumento` ADD PRIMARY KEY (`idTipoDocumento`); -- -- Indices de la tabla `tipomascota` -- ALTER TABLE `tipomascota` ADD PRIMARY KEY (`idTipoMascota`); -- -- Indices de la tabla `tipopersona` -- ALTER TABLE `tipopersona` ADD PRIMARY KEY (`idTipoPersona`); -- -- Indices de la tabla `tipovacuna` -- ALTER TABLE `tipovacuna` ADD PRIMARY KEY (`idTipoVacuna`); -- -- Indices de la tabla `unidadmedida` -- ALTER TABLE `unidadmedida` ADD PRIMARY KEY (`idUnidadMedida`); -- -- Indices de la tabla `usuario` -- ALTER TABLE `usuario` ADD PRIMARY KEY (`idUsuario`), ADD KEY `FK_USUARIO_PERSONA` (`personaDocumento`), ADD KEY `FK_USUARIO_ROL` (`rol`); -- -- Indices de la tabla `vacuna` -- ALTER TABLE `vacuna` ADD PRIMARY KEY (`idVacuna`), ADD KEY `FK_VACUNA_TIPOVACUNA` (`tipoVacuna`), ADD KEY `FK_VACUNA_MARCA` (`marca`), ADD KEY `FK_VACUNAPRESENTACION_PRESENTACION` (`presentacion`), ADD KEY `FK_VACUNA_UNIDADMEDIDA` (`unidadMedida`); -- -- Indices de la tabla `vision` -- ALTER TABLE `vision` ADD PRIMARY KEY (`idVision`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `carrusel` -- ALTER TABLE `carrusel` MODIFY `idcarrusel` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `categoria` -- ALTER TABLE `categoria` MODIFY `idCategoria` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT de la tabla `cita` -- ALTER TABLE `cita` MODIFY `idCita` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT de la tabla `compras` -- ALTER TABLE `compras` MODIFY `idCompras` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT de la tabla `contacto` -- ALTER TABLE `contacto` MODIFY `idContacto` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `detallemascotacliente` -- ALTER TABLE `detallemascotacliente` MODIFY `idDetalleMascotaCliente` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT de la tabla `detalleproductofactura` -- ALTER TABLE `detalleproductofactura` MODIFY `idDetalleproductofactura` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT de la tabla `detalleserviciofactura` -- ALTER TABLE `detalleserviciofactura` MODIFY `idDetalleserviciofactura` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT de la tabla `detallevacunamascota` -- ALTER TABLE `detallevacunamascota` MODIFY `idDetalleVacunaMascota` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `estado` -- ALTER TABLE `estado` MODIFY `idEstado` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT de la tabla `factura` -- ALTER TABLE `factura` MODIFY `idFactura` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- AUTO_INCREMENT de la tabla `formapago` -- ALTER TABLE `formapago` MODIFY `idFormaPago` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `horario` -- ALTER TABLE `horario` MODIFY `idhorario` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `marca` -- ALTER TABLE `marca` MODIFY `idMarca` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT de la tabla `mascota` -- ALTER TABLE `mascota` MODIFY `idMascota` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT de la tabla `precioproducto` -- ALTER TABLE `precioproducto` MODIFY `idPrecioProducto` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de la tabla `preguntaseguridad` -- ALTER TABLE `preguntaseguridad` MODIFY `idPreguntaSeguridad` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT de la tabla `presentacion` -- ALTER TABLE `presentacion` MODIFY `idPresentacion` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT de la tabla `proveedor` -- ALTER TABLE `proveedor` MODIFY `idProveedor` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT de la tabla `quienessomos` -- ALTER TABLE `quienessomos` MODIFY `idquienesSomos` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `raza` -- ALTER TABLE `raza` MODIFY `idRaza` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `registroprecio` -- ALTER TABLE `registroprecio` MODIFY `idRegistroPrecio` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT de la tabla `respuesta` -- ALTER TABLE `respuesta` MODIFY `idRespuesta` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `rol` -- ALTER TABLE `rol` MODIFY `idRol` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de la tabla `servicio` -- ALTER TABLE `servicio` MODIFY `idServicio` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT de la tabla `tipodocumento` -- ALTER TABLE `tipodocumento` MODIFY `idTipoDocumento` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT de la tabla `tipomascota` -- ALTER TABLE `tipomascota` MODIFY `idTipoMascota` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `tipopersona` -- ALTER TABLE `tipopersona` MODIFY `idTipoPersona` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `tipovacuna` -- ALTER TABLE `tipovacuna` MODIFY `idTipoVacuna` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de la tabla `unidadmedida` -- ALTER TABLE `unidadmedida` MODIFY `idUnidadMedida` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT de la tabla `usuario` -- ALTER TABLE `usuario` MODIFY `idUsuario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24; -- -- AUTO_INCREMENT de la tabla `vacuna` -- ALTER TABLE `vacuna` MODIFY `idVacuna` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT de la tabla `vision` -- ALTER TABLE `vision` MODIFY `idVision` int(11) NOT NULL AUTO_INCREMENT; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `cita` -- ALTER TABLE `cita` ADD CONSTRAINT `FK_CITA_DETALLEMASCOTACLIENTE` FOREIGN KEY (`cliente`) REFERENCES `detallemascotacliente` (`idDetalleMascotaCliente`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_CITA_ESTADO` FOREIGN KEY (`estado`) REFERENCES `estado` (`idEstado`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_CITA_SERVICIO` FOREIGN KEY (`idServicio`) REFERENCES `servicio` (`idServicio`) ON UPDATE CASCADE; -- -- Filtros para la tabla `compras` -- ALTER TABLE `compras` ADD CONSTRAINT `FK_COMPRAS_PROVEEDOR` FOREIGN KEY (`proveedor`) REFERENCES `proveedor` (`idProveedor`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `detallecompra` -- ALTER TABLE `detallecompra` ADD CONSTRAINT `FK_DETALLECOMPRA_COMPRAS` FOREIGN KEY (`idCompra`) REFERENCES `compras` (`idCompras`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `FK_DETALLECOMPRA_PRODUCTO` FOREIGN KEY (`idProducto`) REFERENCES `producto` (`idProducto`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `detallemascotacliente` -- ALTER TABLE `detallemascotacliente` ADD CONSTRAINT `FK_DETALLEMASCOTACLIENTE_MASCOTA` FOREIGN KEY (`idmascota`) REFERENCES `mascota` (`idMascota`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `FK_DETALLEMASCOTACLIENTE_PERSONA` FOREIGN KEY (`documentoCliente`) REFERENCES `persona` (`documento`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `detalleproductofactura` -- ALTER TABLE `detalleproductofactura` ADD CONSTRAINT `FK_DETALLEFACTURA_FACTURA` FOREIGN KEY (`factura`) REFERENCES `factura` (`idFactura`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_DETALLEFACTURA_PRODUCTO` FOREIGN KEY (`producto`) REFERENCES `producto` (`idProducto`) ON UPDATE CASCADE; -- -- Filtros para la tabla `detalleserviciofactura` -- ALTER TABLE `detalleserviciofactura` ADD CONSTRAINT `FK_DETALLESERVICIOFACTURA_FACTURA` FOREIGN KEY (`factura`) REFERENCES `factura` (`idFactura`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_DETALLESERVICIOFACTURA_SERVICIO` FOREIGN KEY (`idServicio`) REFERENCES `servicio` (`idServicio`) ON UPDATE CASCADE; -- -- Filtros para la tabla `detallevacunamascota` -- ALTER TABLE `detallevacunamascota` ADD CONSTRAINT `FK_DETALLEVACUNAMASCOTA_MASCOTA` FOREIGN KEY (`idMascota`) REFERENCES `mascota` (`idMascota`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_DETALLEVACUNAMASCOTA_VACUNA` FOREIGN KEY (`idVacuna`) REFERENCES `vacuna` (`idVacuna`) ON UPDATE CASCADE; -- -- Filtros para la tabla `factura` -- ALTER TABLE `factura` ADD CONSTRAINT `FK_FACTURA_CITA` FOREIGN KEY (`cita`) REFERENCES `cita` (`idCita`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_FACTURA_FORMAPAGO` FOREIGN KEY (`formaPago`) REFERENCES `formapago` (`idFormaPago`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `FK_FACTURA_USUARIO` FOREIGN KEY (`vendedor`) REFERENCES `usuario` (`idUsuario`) ON UPDATE CASCADE; -- -- Filtros para la tabla `mascota` -- ALTER TABLE `mascota` ADD CONSTRAINT `FK_MASCOTA_RAZA` FOREIGN KEY (`raza`) REFERENCES `raza` (`idRaza`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_MASCOTA_TIPOMASCOTA` FOREIGN KEY (`tipoMascota`) REFERENCES `tipomascota` (`idTipoMascota`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_MASCOTA_UNIDADMEDIDA` FOREIGN KEY (`unidadMedida`) REFERENCES `unidadmedida` (`idUnidadMedida`) ON UPDATE CASCADE; -- -- Filtros para la tabla `persona` -- ALTER TABLE `persona` ADD CONSTRAINT `FK_PERSONA_TIPODOCUMENTO` FOREIGN KEY (`tipoDocumento`) REFERENCES `tipodocumento` (`idTipoDocumento`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_PERSONA_TIPOPERSONA` FOREIGN KEY (`tipoPersona`) REFERENCES `tipopersona` (`idTipoPersona`) ON UPDATE CASCADE; -- -- Filtros para la tabla `precioproducto` -- ALTER TABLE `precioproducto` ADD CONSTRAINT `FK_PRECIOPRODUCTO_PRODUCTO` FOREIGN KEY (`producto`) REFERENCES `producto` (`idProducto`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `FK_PRECIOPRODUCTO_REGISTROPRECIO` FOREIGN KEY (`registroPrecio`) REFERENCES `registroprecio` (`idRegistroPrecio`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `producto` -- ALTER TABLE `producto` ADD CONSTRAINT `FK_PRODUCTO_CATEGORIA` FOREIGN KEY (`categoria`) REFERENCES `categoria` (`idCategoria`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_PRODUCTO_MARCA` FOREIGN KEY (`marca`) REFERENCES `marca` (`idMarca`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_PRODUCTO_PRESENTACION` FOREIGN KEY (`presentacion`) REFERENCES `presentacion` (`idPresentacion`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_PRODUCTO_UNIDADMEDIDA` FOREIGN KEY (`unidadMedida`) REFERENCES `unidadmedida` (`idUnidadMedida`) ON UPDATE CASCADE; -- -- Filtros para la tabla `proveedor` -- ALTER TABLE `proveedor` ADD CONSTRAINT `FK_PROVEEDOR_PERSONA` FOREIGN KEY (`documento`) REFERENCES `persona` (`documento`) ON UPDATE CASCADE; -- -- Filtros para la tabla `respuesta` -- ALTER TABLE `respuesta` ADD CONSTRAINT `FK_RESPUESTA_PREGUNTASEGURIDAD` FOREIGN KEY (`preguntaSeguridad`) REFERENCES `preguntaseguridad` (`idPreguntaSeguridad`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_RESPUESTA_USUARIO` FOREIGN KEY (`usuario`) REFERENCES `usuario` (`idUsuario`) ON UPDATE CASCADE; -- -- Filtros para la tabla `usuario` -- ALTER TABLE `usuario` ADD CONSTRAINT `FK_USUARIO_PERSONA` FOREIGN KEY (`personaDocumento`) REFERENCES `persona` (`documento`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_USUARIO_ROL` FOREIGN KEY (`rol`) REFERENCES `rol` (`idRol`) ON UPDATE CASCADE; -- -- Filtros para la tabla `vacuna` -- ALTER TABLE `vacuna` ADD CONSTRAINT `FK_VACUNAPRESENTACION_PRESENTACION` FOREIGN KEY (`presentacion`) REFERENCES `presentacion` (`idPresentacion`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_VACUNA_MARCA` FOREIGN KEY (`marca`) REFERENCES `marca` (`idMarca`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_VACUNA_TIPOVACUNA` FOREIGN KEY (`tipoVacuna`) REFERENCES `tipovacuna` (`idTipoVacuna`) ON UPDATE CASCADE, ADD CONSTRAINT `FK_VACUNA_UNIDADMEDIDA` FOREIGN KEY (`unidadMedida`) REFERENCES `unidadmedida` (`idUnidadMedida`) ON UPDATE 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 */;
-- -- Create table for products and special accessories -- CREATE TABLE T_PRODUCT ( ID BIGINT NOT NULL, CATEGORIE BIGINT, COLOR VARCHAR(20), DESIRED_DELIVERY DATE, PRIMARY KEY (ID) ); CREATE TABLE T_ACCESSORY ( ID BIGINT NOT NULL, PRODUCT_ID BIGINT, SPECIAL SMALLINT NOT NULL, DESCRIPTION VARCHAR(60), PRIMARY KEY (ID) ); CREATE SEQUENCE SEQ_ID_PRODUCT START WITH 1000000 INCREMENT BY 10; CREATE SEQUENCE SEQ_ID_ACCESSORY START WITH 1000000 INCREMENT BY 10;
DROP TABLE INSTRUCTOR; CREATE TABLE INSTRUCTOR (ins_id integer NOT NULL PRIMARY KEY, lastname varchar(24) NOT NULL, firstname varchar(24) NOT NULL, city varchar(24), country char(2)); INSERT INTO INSTRUCTOR (ins_id, lastname, firstname, city, country) VALUES(1, 'Ahuja', 'Rav', 'Toronto', 'CA'); INSERT INTO INSTRUCTOR (ins_id, lastname, firstname, city, country) VALUES(2, 'Chong', 'Raul', 'Toronto', 'CA'), (3, 'Vasudevan', 'Hima', 'Chicago', 'US'); SELECT * FROM INSTRUCTOR; SELECT firstname, lastname FROM INSTRUCTOR WHERE city='Toronto'; UPDATE INSTRUCTOR SET city='Markham' WHERE lastname='Ahuja'; DELETE FROM INSTRUCTOR WHERE lastname='Chong'; SELECT * FROM INSTRUCTOR;
<filename>db/posts_table.sql CREATE TABLE posts ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), topic_id INT REFERENCES topics(id), content TEXT NOT NULL, post_time timestamp without time zone NOT NULL DEFAULT '1970-01-01 00:00:00'::timestamp without time zone, post_number INT NOT NULL ); CREATE INDEX posts_topic_id_idx ON public.posts USING btree (topic_id) TABLESPACE pg_default;
<reponame>vijayraavi/sqlops-mssql-db-insights -- -- Author: Matticusau -- Purpose: Provides insights into open sessions in the current database -- License: https://github.com/Matticusau/sqlops-mssql-db-insights/blob/master/LICENSE -- -- When Who What -- 2018-06-27 Matticusau Friendly column names -- SELECT es.[session_id] [Session Id] , es.[status] [Status] , es.[login_name] [Login Name] , es.[login_time] [Login Time] , es.[host_name] [Host Name] , es.[program_name] [Program Name] , es.[client_interface_name] [Client Interface Name] , es.[cpu_time] [CPU Time] , es.[memory_usage] [Memory Usage] , es.[reads] [Reads] , es.[writes] [Writes] , es.[logical_reads] [Logical Reads] , es.[last_request_start_time] [Last Request Start Time] , es.[last_request_end_time] [Last Request End Time] , es.[total_elapsed_time] [Total Elapsed Time] , es.[open_transaction_count] [Open Transaction Count] FROM [sys].[dm_exec_sessions] es WHERE es.[database_id] = DB_ID() ORDER BY es.[session_id]
-- set up database CREATE DATABASE rst2html; \connect rst2html; DROP TABLE sites CASCADE; CREATE TABLE sites ( id serial PRIMARY KEY, sitename VARCHAR UNIQUE ); CREATE TABLE site_settings ( id serial PRIMARY KEY, site_id INTEGER REFERENCES sites, settname VARCHAR, settval VARCHAR ); CREATE TABLE templates ( id serial PRIMARY KEY, site_id INTEGER REFERENCES sites, name VARCHAR, text VARCHAR ); CREATE TABLE directories ( id serial PRIMARY KEY, site_id INTEGER REFERENCES sites, dirname VARCHAR ); CREATE TABLE doc_stats ( id serial PRIMARY KEY, dir_id INTEGER REFERENCES directories, docname VARCHAR, source_docid INTEGER, /* references TABLES[4] */ source_updated TIMESTAMP, source_deleted BOOLEAN, target_docid INTEGER, /* references TABLES[4] */ target_updated TIMESTAMP, target_deleted BOOLEAN, mirror_updated TIMESTAMP ); CREATE TABLE documents ( id serial PRIMARY KEY, name VARCHAR, previous VARCHAR, currtext VARCHAR );
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jun 10, 2016 at 03:54 AM -- Server version: 10.1.10-MariaDB -- PHP Version: 5.5.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 utf8mb4 */; -- -- Database: `smug` -- CREATE DATABASE IF NOT EXISTS `smug` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; USE `smug`; -- -------------------------------------------------------- -- -- Table structure for table `feedback` -- DROP TABLE IF EXISTS `feedback`; CREATE TABLE `feedback` ( `id` int(11) NOT NULL, `user_id` int(11) DEFAULT NULL, `review` varchar(400) COLLATE utf8_unicode_ci NOT NULL, `dislike` varchar(400) COLLATE utf8_unicode_ci DEFAULT NULL, `rate` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `food` -- DROP TABLE IF EXISTS `food`; CREATE TABLE `food` ( `id` int(11) NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `price` float NOT NULL, `type_id` int(11) NOT NULL, `rate` int(11) DEFAULT '0', `users_count` int(11) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `food` -- INSERT INTO `food` (`id`, `name`, `description`, `price`, `type_id`, `rate`, `users_count`) VALUES (21, 'Big Mac', 'Bread with hot spicy peace of burger with Col', 25, 1, 3, 1), (22, 'Pizza', 'Sea food with cheese and vegetables ', 50, 2, 4, 2), (23, 'Chicken Macdo', 'Chicken with fries and bread', 20, 1, 5, 1), (24, 'Pepsi', 'Drink and Shrink', 100, 3, 0, 0); -- -------------------------------------------------------- -- -- Table structure for table `food_catagories` -- DROP TABLE IF EXISTS `food_catagories`; CREATE TABLE `food_catagories` ( `id` int(11) NOT NULL, `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `food_catagories` -- INSERT INTO `food_catagories` (`id`, `type`) VALUES (1, 'Burgers'), (3, 'Cold Drinks'), (2, 'Pizza'); -- -------------------------------------------------------- -- -- Table structure for table `member_details` -- DROP TABLE IF EXISTS `member_details`; CREATE TABLE `member_details` ( `user_id` int(11) NOT NULL, `password` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `address` varchar(45) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `order` -- DROP TABLE IF EXISTS `order`; CREATE TABLE `order` ( `id` int(11) NOT NULL, `user_id` int(11) DEFAULT NULL, `date` date NOT NULL, `time` time NOT NULL, `address` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `total_money` float DEFAULT NULL, `method_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `order_food` -- DROP TABLE IF EXISTS `order_food`; CREATE TABLE `order_food` ( `food_id` int(11) DEFAULT NULL, `order_id` int(11) DEFAULT NULL, `amount` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `password_reset` -- DROP TABLE IF EXISTS `password_reset`; CREATE TABLE `password_reset` ( `id` int(11) NOT NULL, `user_id` int(11) DEFAULT NULL, `random_code` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `payment_details` -- DROP TABLE IF EXISTS `payment_details`; CREATE TABLE `payment_details` ( `id` int(11) NOT NULL, `method_id` int(11) NOT NULL, `option_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `payment_details` -- INSERT INTO `payment_details` (`id`, `method_id`, `option_id`) VALUES (1, 1, 1), (2, 1, 2); -- -------------------------------------------------------- -- -- Table structure for table `payment_method` -- DROP TABLE IF EXISTS `payment_method`; CREATE TABLE `payment_method` ( `id` int(11) NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `payment_method` -- INSERT INTO `payment_method` (`id`, `name`) VALUES (2, 'cash'), (1, 'visa'); -- -------------------------------------------------------- -- -- Table structure for table `payment_options` -- DROP TABLE IF EXISTS `payment_options`; CREATE TABLE `payment_options` ( `id` int(11) NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `payment_options` -- INSERT INTO `payment_options` (`id`, `name`, `type`) VALUES (1, 'credit_card_number', 'number'), (2, 'cvc', 'number'), (3, 'expiration_date', 'date'); -- -------------------------------------------------------- -- -- Table structure for table `payment_values` -- DROP TABLE IF EXISTS `payment_values`; CREATE TABLE `payment_values` ( `id` int(11) NOT NULL, `details_id` int(11) DEFAULT NULL, `order_id` int(11) NOT NULL, `value` varchar(50) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `pictures` -- DROP TABLE IF EXISTS `pictures`; CREATE TABLE `pictures` ( `id` int(11) NOT NULL, `food_id` int(11) NOT NULL, `picture` varchar(100) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `pictures` -- INSERT INTO `pictures` (`id`, `food_id`, `picture`) VALUES (11, 21, 'photo/2016_05_11_09_23_29_Big-Mac.jpg.jpg'), (12, 22, 'photo/2016_05_11_09_25_28_Pizza.jpg.jpg'), (13, 23, 'photo/2016_05_11_09_26_28_Chicken-macdo.jpg.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `reservations` -- DROP TABLE IF EXISTS `reservations`; CREATE TABLE `reservations` ( `id` int(11) NOT NULL, `user_id` int(11) DEFAULT NULL, `date` date NOT NULL, `time` time NOT NULL, `duration` int(11) DEFAULT '2' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `reservation_tables` -- DROP TABLE IF EXISTS `reservation_tables`; CREATE TABLE `reservation_tables` ( `reservation_id` int(11) DEFAULT NULL, `table_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `tab` -- DROP TABLE IF EXISTS `tab`; CREATE TABLE `tab` ( `id` int(11) NOT NULL, `file_name` varchar(45) CHARACTER SET utf8 NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `tab` -- INSERT INTO `tab` (`id`, `file_name`) VALUES (1, 'reservations.php'), (2, 'food-orders.php'), (3, 'generate-report.php'), (4, 'tables-control.php'), (5, 'user-role.php'), (6, 'user-type.php'), (7, 'feedback.php'); -- -------------------------------------------------------- -- -- Table structure for table `table` -- DROP TABLE IF EXISTS `table`; CREATE TABLE `table` ( `id` int(11) NOT NULL, `table_number` int(11) NOT NULL, `chairs_number` int(11) NOT NULL, `x` float NOT NULL, `y` float NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `table` -- INSERT INTO `table` (`id`, `table_number`, `chairs_number`, `x`, `y`) VALUES (1, 1, 2, 15, 15), (2, 2, 2, 15, 30), (3, 3, 8, 30, 15), (4, 4, 4, 30, 30), (5, 12, 4, 47.75, 34.7967), (6, 0, 2, 50, 65), (7, 9, 6, 15, 70), (23, 17, 4, 50, 55), (25, 25, 6, 26.25, 42.1951); -- -------------------------------------------------------- -- -- Table structure for table `user` -- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` int(11) NOT NULL, `first_name` varchar(45) CHARACTER SET utf8 NOT NULL, `last_name` varchar(45) CHARACTER SET utf8 NOT NULL, `email` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `phone_number` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `user_type_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `user_access` -- DROP TABLE IF EXISTS `user_access`; CREATE TABLE `user_access` ( `id` int(11) NOT NULL, `tab_id` int(11) DEFAULT NULL, `type_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `user_access` -- INSERT INTO `user_access` (`id`, `tab_id`, `type_id`) VALUES (1, 7, 2), (2, 2, 2), (3, 3, 2), (4, 1, 2), (5, 4, 2), (6, 5, 2), (7, 6, 2), (8, 1, 3), (9, 1, 1), (10, 2, 1); -- -------------------------------------------------------- -- -- Table structure for table `user_types` -- DROP TABLE IF EXISTS `user_types`; CREATE TABLE `user_types` ( `id` int(11) NOT NULL, `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `user_types` -- INSERT INTO `user_types` (`id`, `type`) VALUES (0, 'guest'), (1, 'user'), (2, 'admin'), (3, 'theif'); -- -- Indexes for dumped tables -- -- -- Indexes for table `feedback` -- ALTER TABLE `feedback` ADD PRIMARY KEY (`id`), ADD KEY `fk_feedback_user_idx` (`user_id`); -- -- Indexes for table `food` -- ALTER TABLE `food` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `name` (`name`), ADD KEY `fk_food__idx` (`type_id`); -- -- Indexes for table `food_catagories` -- ALTER TABLE `food_catagories` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `type_UNIQUE` (`type`); -- -- Indexes for table `member_details` -- ALTER TABLE `member_details` ADD UNIQUE KEY `user_id_UNIQUE` (`user_id`), ADD KEY `userID_idx` (`user_id`); -- -- Indexes for table `order` -- ALTER TABLE `order` ADD PRIMARY KEY (`id`), ADD KEY `fk__idx` (`user_id`), ADD KEY `fk_2_idx` (`method_id`); -- -- Indexes for table `order_food` -- ALTER TABLE `order_food` ADD KEY `fk_food_order_food_idx` (`food_id`), ADD KEY `fk_food_order_idx` (`order_id`); -- -- Indexes for table `password_reset` -- ALTER TABLE `password_reset` ADD PRIMARY KEY (`id`), ADD KEY `userID_idx` (`user_id`); -- -- Indexes for table `payment_details` -- ALTER TABLE `payment_details` ADD PRIMARY KEY (`id`), ADD KEY `fk_payment_details_payment_method_idx` (`method_id`), ADD KEY `fk_payment_details_payment_options_idx` (`option_id`); -- -- Indexes for table `payment_method` -- ALTER TABLE `payment_method` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `name_UNIQUE` (`name`); -- -- Indexes for table `payment_options` -- ALTER TABLE `payment_options` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `name_UNIQUE` (`name`); -- -- Indexes for table `payment_values` -- ALTER TABLE `payment_values` ADD PRIMARY KEY (`id`), ADD KEY `fk_payment_values__idx` (`details_id`), ADD KEY `fk_payment_values_order_idx` (`order_id`); -- -- Indexes for table `pictures` -- ALTER TABLE `pictures` ADD PRIMARY KEY (`id`), ADD KEY `fk_pictures_food_idx` (`food_id`); -- -- Indexes for table `reservations` -- ALTER TABLE `reservations` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `uk_time_date` (`time`,`date`), ADD KEY `fk_reservations_user_idx` (`user_id`); -- -- Indexes for table `reservation_tables` -- ALTER TABLE `reservation_tables` ADD KEY `fk_reservation_tables_reservation_idx` (`reservation_id`), ADD KEY `fk_reservation_tables_table_idx` (`table_id`); -- -- Indexes for table `tab` -- ALTER TABLE `tab` ADD PRIMARY KEY (`id`); -- -- Indexes for table `table` -- ALTER TABLE `table` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `table_number_UNIQUE` (`table_number`), ADD UNIQUE KEY `POINT_UNIQUE` (`x`,`y`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD KEY `userType_idx` (`user_type_id`); -- -- Indexes for table `user_access` -- ALTER TABLE `user_access` ADD PRIMARY KEY (`id`), ADD KEY `typeID_idx` (`type_id`), ADD KEY `fk_user_access_tab_idx` (`tab_id`); -- -- Indexes for table `user_types` -- ALTER TABLE `user_types` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `feedback` -- ALTER TABLE `feedback` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `food` -- ALTER TABLE `food` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; -- -- AUTO_INCREMENT for table `food_catagories` -- ALTER TABLE `food_catagories` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `order` -- ALTER TABLE `order` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `password_reset` -- ALTER TABLE `password_reset` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `payment_details` -- ALTER TABLE `payment_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `payment_method` -- ALTER TABLE `payment_method` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `payment_options` -- ALTER TABLE `payment_options` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `payment_values` -- ALTER TABLE `payment_values` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `pictures` -- ALTER TABLE `pictures` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `reservations` -- ALTER TABLE `reservations` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51; -- -- AUTO_INCREMENT for table `tab` -- ALTER TABLE `tab` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `table` -- ALTER TABLE `table` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `user_access` -- ALTER TABLE `user_access` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `user_types` -- ALTER TABLE `user_types` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- Constraints for dumped tables -- -- -- Constraints for table `feedback` -- ALTER TABLE `feedback` ADD CONSTRAINT `fk_feedback_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; -- -- Constraints for table `food` -- ALTER TABLE `food` ADD CONSTRAINT `fk_food_food_catagories` FOREIGN KEY (`type_id`) REFERENCES `food_catagories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `member_details` -- ALTER TABLE `member_details` ADD CONSTRAINT `fk_member_details_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `order` -- ALTER TABLE `order` ADD CONSTRAINT `fk_order_payment_method` FOREIGN KEY (`method_id`) REFERENCES `payment_method` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk_order_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; -- -- Constraints for table `order_food` -- ALTER TABLE `order_food` ADD CONSTRAINT `fk_food_order` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_food_order_food` FOREIGN KEY (`food_id`) REFERENCES `food` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; -- -- Constraints for table `password_reset` -- ALTER TABLE `password_reset` ADD CONSTRAINT `fk_password_reset_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `payment_details` -- ALTER TABLE `payment_details` ADD CONSTRAINT `fk_payment_details_payment_method` FOREIGN KEY (`method_id`) REFERENCES `payment_method` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_payment_details_payment_options` FOREIGN KEY (`option_id`) REFERENCES `payment_options` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `payment_values` -- ALTER TABLE `payment_values` ADD CONSTRAINT `fk_payment_values_order` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_payment_values_payment_details` FOREIGN KEY (`details_id`) REFERENCES `payment_details` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; -- -- Constraints for table `pictures` -- ALTER TABLE `pictures` ADD CONSTRAINT `fk_pictures_food` FOREIGN KEY (`food_id`) REFERENCES `food` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `reservations` -- ALTER TABLE `reservations` ADD CONSTRAINT `fk_reservations_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; -- -- Constraints for table `reservation_tables` -- ALTER TABLE `reservation_tables` ADD CONSTRAINT `fk_reservation_tables_reservation` FOREIGN KEY (`reservation_id`) REFERENCES `reservations` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_reservation_tables_table` FOREIGN KEY (`table_id`) REFERENCES `table` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; -- -- Constraints for table `user` -- ALTER TABLE `user` ADD CONSTRAINT `fk_user_user_type` FOREIGN KEY (`user_type_id`) REFERENCES `user_types` (`id`) ON UPDATE CASCADE; -- -- Constraints for table `user_access` -- ALTER TABLE `user_access` ADD CONSTRAINT `fk_user_access_tab` FOREIGN KEY (`tab_id`) REFERENCES `tab` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_user_access_user_types` FOREIGN KEY (`type_id`) REFERENCES `user_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; /*!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 */;
CREATE TABLE reach_frequency_estimates_demo_breakdown ( ) ENGINE = Log
ALTER TABLE schema.repos ADD UNIQUE (branch);