sql
stringlengths
6
1.05M
<filename>Level_Junior/Part_003_SQL_JDBC/1_Create_Update_Insert/src/main/java/ru/job4j/task1/Create_Tables.sql CREATE TABLE Rules ( id SERIAL, name CHARACTER VARYING(50) NOT NULL, description TEXT NOT NULL, PRIMARY KEY (id) ); CREATE TABLE Roles ( id SERIAL, name CHARACTER VARYING(50) NOT NULL, description TEXT NOT NULL, PRIMARY KEY (id) ); CREATE TABLE Rules_to_Roles ( id SERIAL, rules_id INTEGER REFERENCES Rules (id), roles_id INTEGER REFERENCES Roles (id), PRIMARY KEY (id) ); CREATE TABLE States ( id SERIAL, name CHARACTER VARYING(50) NOT NULL, description TEXT NOT NULL, PRIMARY KEY (id) ); CREATE TABLE Categories ( id SERIAL, name CHARACTER VARYING(50) NOT NULL, description TEXT NOT NULL, PRIMARY KEY (id) ); CREATE TABLE Items ( id SERIAL, create_date TIMESTAMP NOT NULL DEFAULT NOW(), name CHARACTER VARYING(50) NOT NULL, description TEXT NOT NULL, user_id INTEGER REFERENCES Users (id), category_id INTEGER REFERENCES Categories (id), state_id INTEGER REFERENCES States (id), PRIMARY KEY (id) ); CREATE TABLE Users ( id SERIAL, login CHARACTER VARYING(50) NOT NULL, password CHARACTER VARYING(50) NOT NULL, roles_id INTEGER REFERENCES Roles (id), item_id INTEGER REFERENCES Items (id), PRIMARY KEY(id) ); CREATE TABLE Comments ( id SERIAL, name CHARACTER VARYING(50) NOT NULL, description TEXT NOT NULL, item_id INTEGER REFERENCES Items (id) PRIMARY KEY (id) ); CREATE TABLE Attachments ( id SERIAL, name CHARACTER VARYING(50) NOT NULL, description TEXT NOT NULL, attachment TEXT NOT NULL, item_id INTEGER REFERENCES Items (id), PRIMARY KEY (id) );
<gh_stars>1-10 -- Name: InsertIntoDicomEditCompare -- Schema: posda_files -- Columns: [] -- Args: ['edit_command_file_id', 'from_file_digest', 'to_file_digest', 'short_report_file_id', 'long_report_file_id'] -- Tags: ['NotInteractive', 'Backlog', 'Transaction', 'used_in_file_import_into_posda'] -- Description: Lock the file table in posda_files insert into dicom_edit_compare( edit_command_file_id, from_file_digest, to_file_digest, short_report_file_id, long_report_file_id ) values ( ?, ?, ?, ?, ?)
<reponame>UltimateSoftware/DOI GO IF OBJECT_ID('[DOI].[vwPartitionSchemes]') IS NOT NULL DROP VIEW [DOI].[vwPartitionSchemes]; GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE VIEW [DOI].[vwPartitionSchemes] AS /* select * from DOI.vwPartitionSchemes where partitionfunctionname = 'PfMonthlyUnitTest' */ SELECT DatabaseName, PartitionSchemeName, PartitionFunctionName, PartitionFunctionDataType, BoundaryInterval, NumOfFutureIntervals AS NumOfFutureIntervals_Desired, ISNULL(FI.NumFutureIntervals, 0) AS NumOfFutureIntervals_Actual, InitialDate, UsesSlidingWindow, SlidingWindowSize, IsDeprecated, NumOfCharsInSuffix, LastBoundaryDate, NumOfTotalPartitionFunctionIntervals, --we can also use pf.fanout for this. NumOfTotalPartitionSchemeIntervals, MinValueOfDataType, CASE WHEN ps.name IS NULL THEN 1 ELSE 0 END AS IsPartitionSchemeMissing, NUF.NextUsedFileGroupName, ' IF NOT EXISTS(SELECT * FROM sys.partition_schemes WHERE name = ''' + PFM.PartitionSchemeName + ''') BEGIN CREATE PARTITION SCHEME ' + PFM.PartitionSchemeName + ' AS PARTITION ' + PFM.PartitionFunctionName + ' TO (' + STUFF(PfFileGroupList.FileGroupList, LEN(PfFileGroupList.FileGroupList), 1, SPACE(0)) + ') END' AS CreatePartitionSchemeSQL, 'IF EXISTS(SELECT ''True'' FROM sys.partition_schemes WHERE name = ''' + PFM.PartitionSchemeName + ''') BEGIN DROP PARTITION SCHEME ' + PFM.PartitionSchemeName + ' END' AS DropPartitionSchemeSQL --SELECT * FROM DOI.PartitionFunctions PFM CROSS APPLY ( SELECT CAST(PFP.FileGroupName AS VARCHAR(30)) + ',' FROM DOI.vwPartitionFunctionPartitions PFP WHERE PFP.PartitionFunctionName = PFM.PartitionFunctionName AND PFP.IncludeInPartitionScheme = 1 FOR XML PATH('')) PfFileGroupList(FileGroupList) LEFT JOIN DOI.SysPartitionSchemes ps ON ps.name = PFM.PartitionSchemeName OUTER APPLY ( SELECT x.NextUsedFileGroupName FROM DOI.SysPartitionFunctions pf OUTER APPLY ( SELECT FG.Name AS NextUsedFileGroupName, prv.value, ps.Name AS PartitionSchemeName, ps.function_id, RANK() OVER (PARTITION BY ps.name ORDER BY dds.destination_Id) AS dest_rank FROM DOI.SysPartitionSchemes ps INNER JOIN DOI.SysDestinationDataSpaces AS DDS ON DDS.database_id = ps.database_id AND DDS.partition_scheme_id = ps.data_space_id INNER JOIN DOI.SysFilegroups AS FG ON FG.data_space_id = DDS.data_space_ID AND FG.database_id = DDS.database_id LEFT JOIN DOI.SysPartitionRangeValues AS PRV ON PRV.database_id = DDS.database_id AND PRV.Boundary_ID = DDS.destination_id AND prv.function_id = ps.function_id WHERE pf.database_id = ps.database_id AND ps.function_id = pf.function_id AND prv.Value IS NULL) x WHERE x.PartitionSchemeName = PFM.PartitionSchemeName AND x.dest_rank = 2) AS NUF OUTER APPLY ( SELECT prv.function_id, COUNT(prv.boundary_id) AS NumFutureIntervals FROM DOI.SysDestinationDataSpaces AS DDS INNER JOIN DOI.SysFilegroups AS FG ON FG.data_space_id = DDS.data_space_ID LEFT JOIN DOI.SysPartitionRangeValues AS PRV ON PRV.Boundary_ID = DDS.destination_id AND prv.function_id = ps.function_id WHERE DDS.partition_scheme_id = ps.data_space_id AND prv.value > GETDATE() GROUP BY PRV.function_id)FI GO
<gh_stars>0 CREATE TABLE IF NOT EXISTS `article_categories` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `alias` varchar(255) NOT NULL, `description` text, `parent` int(11) DEFAULT '0', `published` smallint(6) NOT NULL DEFAULT '0', `access` int(11) NOT NULL DEFAULT '0', `ordering` int(11) NOT NULL DEFAULT '0', `image` varchar(255), `image_caption` text, `image_credits` varchar(255), `params` text, `metadesc` text, `metakey` text, `robots` varchar(20), `author` varchar(50), `copyright` varchar(50), `language` char(7) NOT NULL, PRIMARY KEY (`id`), KEY `category` (`published`,`access`), KEY `parent` (`parent`), KEY `ordering` (`ordering`), KEY `published` (`published`), KEY `access` (`access`), KEY `language` (`language`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; -- -------------------------------------------------------- CREATE TABLE IF NOT EXISTS `article_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `catid` int(11) NOT NULL, `userid` int(11) NOT NULL, `published` smallint(6) NOT NULL DEFAULT '0', `introtext` mediumtext, `fulltext` mediumtext, `image` varchar(255), `image_caption` text, `image_credits` varchar(255), `video` text, `video_caption` text, `video_credits` varchar(255), `created` datetime NOT NULL, `created_by` int(11) NOT NULL DEFAULT '0', `modified` datetime NOT NULL, `modified_by` int(11) NOT NULL DEFAULT '0', `access` int(11) NOT NULL DEFAULT '0', `ordering` int(11) NOT NULL DEFAULT '0', `hits` int(10) unsigned NOT NULL DEFAULT '0', `alias` varchar(255) DEFAULT NULL, `metadesc` text, `metakey` text, `robots` varchar(20), `author` varchar(50), `copyright` varchar(50), `params` text, `language` char(7) NOT NULL, PRIMARY KEY (`id`), KEY `item` (`published`,`access`), KEY `catid` (`catid`), KEY `created_by` (`created_by`), KEY `ordering` (`ordering`), KEY `hits` (`hits`), KEY `created` (`created`), KEY `language` (`language`), FULLTEXT KEY `search` (`title`,`introtext`,`fulltext`), FULLTEXT KEY `title` (`title`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE entries ( id BIGSERIAL NOT NULL CONSTRAINT entries_pkey PRIMARY KEY, title text not null, content text, document_vectors tsvector );
WITH cust_non_redhat AS ( SELECT DISTINCT t.customer_id, substring(t.email from '@(.*)$') AS domain FROM PUBLIC.api_user t WHERE substring(t.email FROM '@(.*)$') != 'redhat.com' ), filtered_customers AS ( SELECT c.id, c.account_id, cnr.domain FROM PUBLIC.api_customer c JOIN cust_non_redhat AS cnr ON cnr.customer_id = c.id WHERE c.account_id NOT IN ('6089719', '1460290', '5910538', '540155', '6289400', '6289401') GROUP BY c.id, cnr.domain ) SELECT p.type, p.setup_complete, count (DISTINCT p.uuid) as count FROM PUBLIC.api_provider AS p JOIN filtered_customers AS fc ON p.customer_id = fc.id GROUP BY p.type, p.setup_complete ORDER BY p.type, p.setup_complete
DROP TABLE `member_mail_labels`;
-- -- Table structure for table `movies` -- CREATE TABLE `movies` ( `title` char(60) NOT NULL, `star_actors` tinytext NOT NULL, `director` char(100) NOT NULL, `genre` char(100) NOT NULL, `age_classification` char(100) NOT NULL, `showing` char(100) NOT NULL, `showing_time` tinytext NOT NULL, `screen` tinyint(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `movies` -- INSERT INTO `movies` VALUES('Aquaman', '<NAME>, 50 Cents', '<NAME>', 'Action', '>13|PG', '1', '109090932', 3);
<reponame>rudnovd/heroes3toolsApi<filename>common/sql/create/heroes_spells_specialty.sql create table heroes_spells_specialty ( id smallint not null, spell_id smallint not null constraint heroes_spells_specialty_spells_id_fk references spells ); create unique index heroes_spells_specialty_id_uindex on heroes_spells_specialty (id); alter table heroes_spells_specialty add constraint heroes_spells_specialty_pk primary key (id);
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Nov 14, 2019 at 10:26 AM -- Server version: 10.1.21-MariaDB -- PHP Version: 5.6.30 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `u187093969_perpus` -- -- -------------------------------------------------------- -- -- Table structure for table `booking` -- CREATE TABLE `booking` ( `id` int(11) NOT NULL, `id_user` int(10) NOT NULL, `id_buku` int(11) NOT NULL, `tanggal_booking` date NOT NULL, `tenggat_booking` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `booking` -- INSERT INTO `booking` (`id`, `id_user`, `id_buku`, `tanggal_booking`, `tenggat_booking`) VALUES (6, 1, 1, '2019-11-14', '2019-11-15'), (7, 1, 1, '2019-11-14', '2019-11-15'); -- -------------------------------------------------------- -- -- Table structure for table `buku` -- CREATE TABLE `buku` ( `id` int(11) NOT NULL, `judul_buku` varchar(20) NOT NULL, `penerbit` varchar(20) NOT NULL, `pengarang` varchar(50) NOT NULL, `tahun` int(4) NOT NULL, `id_kategori` int(2) NOT NULL, `jumlah` int(2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `buku` -- INSERT INTO `buku` (`id`, `judul_buku`, `penerbit`, `pengarang`, `tahun`, `id_kategori`, `jumlah`) VALUES (1, 'Sistem Recognition', 'PT. Virgorasion', '<NAME>', 2018, 1, 2), (2, 'Sistem E-Tilang', 'PT. Virgorasion', '<NAME>', 2018, 1, 2); -- -------------------------------------------------------- -- -- Table structure for table `instansi` -- CREATE TABLE `instansi` ( `id` int(11) NOT NULL, `nama_instansi` varchar(20) NOT NULL, `alamat` varchar(30) NOT NULL, `username` varchar(12) NOT NULL, `password` varchar(72) NOT NULL, `token` varchar(32) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `instansi` -- INSERT INTO `instansi` (`id`, `nama_instansi`, `alamat`, `username`, `password`, `token`) VALUES (1, 'SMKN 2 Surabaya', 'Jl. Tentara Genie Pelajar', 'admin', <PASSWORD>', '<PASSWORD>'); -- -------------------------------------------------------- -- -- Table structure for table `kategori` -- CREATE TABLE `kategori` ( `id` int(2) NOT NULL, `kategori` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `pinjaman` -- CREATE TABLE `pinjaman` ( `id` int(11) NOT NULL, `nis_siswa` varchar(10) NOT NULL, `id_buku` int(11) NOT NULL, `status` int(11) NOT NULL DEFAULT '0', `tanggal_pinjam` date NOT NULL, `tanggal_kembali` datetime NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `deleted_status` binary(1) NOT NULL DEFAULT '\0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `status_pinjaman` -- CREATE TABLE `status_pinjaman` ( `id` int(11) NOT NULL, `status` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `status_pinjaman` -- INSERT INTO `status_pinjaman` (`id`, `status`) VALUES (1, 'Tersedia'), (2, 'Dipinjam'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(5) NOT NULL, `nama` varchar(50) NOT NULL, `nis` varchar(10) NOT NULL, `nisn` varchar(10) NOT NULL, `kelas` varchar(10) NOT NULL, `alamat` varchar(30) NOT NULL, `token` varchar(32) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `password` varchar(72) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `nama`, `nis`, `nisn`, `kelas`, `alamat`, `token`, `created_at`, `updated_at`, `password`) VALUES (1, '<NAME>', '13236', '0008096617', '12RPL-1', 'Kapas Madya 3i Nomor 4', 'c4ca4238a0b923820dcc509a6f75849b', '2019-11-14 08:42:53', '2019-11-14 08:42:53', '$2y$10$w8oeWl/WLyds5nJ6tIi5ped0YK2vpczQjPKa5ldb0XI6u/45ixQXO'); -- -- Indexes for dumped tables -- -- -- Indexes for table `booking` -- ALTER TABLE `booking` ADD PRIMARY KEY (`id`), ADD KEY `nis` (`id_user`), ADD KEY `id_buku` (`id_buku`); -- -- Indexes for table `buku` -- ALTER TABLE `buku` ADD PRIMARY KEY (`id`), ADD KEY `id_kategori` (`id_kategori`); -- -- Indexes for table `instansi` -- ALTER TABLE `instansi` ADD PRIMARY KEY (`id`); -- -- Indexes for table `kategori` -- ALTER TABLE `kategori` ADD PRIMARY KEY (`id`); -- -- Indexes for table `pinjaman` -- ALTER TABLE `pinjaman` ADD PRIMARY KEY (`id`), ADD KEY `nis_siswa` (`nis_siswa`), ADD KEY `id_buku` (`id_buku`); -- -- Indexes for table `status_pinjaman` -- ALTER TABLE `status_pinjaman` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `nis` (`nis`), ADD UNIQUE KEY `nisn` (`nisn`), ADD KEY `nis_2` (`nis`), ADD KEY `nisn_2` (`nisn`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `booking` -- ALTER TABLE `booking` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `buku` -- ALTER TABLE `buku` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `instansi` -- ALTER TABLE `instansi` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `kategori` -- ALTER TABLE `kategori` MODIFY `id` int(2) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `pinjaman` -- ALTER TABLE `pinjaman` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `status_pinjaman` -- ALTER TABLE `status_pinjaman` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(5) 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 */;
create database db_assignment1; use db_assignment1; -- -- (for creating Passengers table) create table Passengers ( PassengerID binary(16) primary key, FirstName varchar(30), LastName varchar(30), MobileNo varchar(8), EmailAddr varchar(45), Availability tinyint(0) default 0 ); -- -- (for creating Drivers table) create table Drivers ( DriverID binary(16) primary key, FirstName varchar(30), LastName varchar(30), MobileNo varchar(8), EmailAddr varchar(45), IdNum varchar(9), CarLicenseNum varchar(8), Availability tinyint(0) default 0 ); -- -- (for creating Trips table) create table Trips ( TripID binary(16) primary key, PassengerID binary(16), DriverID binary(16), PickUpCode varchar(6), DropOffCode varchar(6), TripStartDT datetime, TripEndDT datetime ); -- -- (for creating trigger that runs on every insert into trips table) : currently not in use as unnecessary -- create trigger uuid_getter -- after insert on trips -- for each row -- set @uuid = new.TripID;
<filename>db/seeds.sql<gh_stars>1-10 USE cheese_db; INSERT INTO cheeses (cheese_name) VALUES ("Gouda"), ("Brie"), ("Cheddar"), ("Marble"), ("Mozzarella"), ("Swiss"); SELECT * FROM cheeses;
SELECT DepositGroup, MagicWandCreator, MIN(DepositCharge) AS [MinDepositCharge] FROM WizzardDeposits GROUP BY DepositGroup, MagicWandCreator ORDER BY MagicWandCreator, DepositGroup
alter table egbpa_documentscrutiny alter column subdivisionnumber type character varying(128); alter table egbpa_documentscrutiny alter column resurveynumber type character varying(128); --------------------Tower Construction---------------------- insert into EGBPA_MSTR_CHECKLIST(id,checklisttype,servicetype,version,createdBy,createdDate) values(nextval('SEQ_EGBPA_MSTR_CHECKLIST'),'NOC', (select id from egbpa_mstr_servicetype where description='Tower Construction'), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1091','Port Trust',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1092','Railways',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1093','RTP/CTP – Layout Concurrence',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1094','Pollution Control Board',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1095','Fire Services',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1096','CRZ Clearance',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1097','Art & Heritage Commission',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1098','Forest Department',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1099','Others if any',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Tower Construction')), 0,1,now()); --------------------Pole Structures---------------------- insert into EGBPA_MSTR_CHECKLIST(id,checklisttype,servicetype,version,createdBy,createdDate) values(nextval('SEQ_EGBPA_MSTR_CHECKLIST'),'NOC', (select id from egbpa_mstr_servicetype where description='Pole Structures'), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1101','Port Trust',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1102','Railways',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1103','RTP/CTP – Layout Concurrence',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1104','Pollution Control Board',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1105','Fire Services',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1106','CRZ Clearance',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1107','Art & Heritage Commission',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1108','Forest Department',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now()); insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate) values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'1109','Others if any',true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='NOC' and servicetype= (select id from egbpa_mstr_servicetype where description='Pole Structures')), 0,1,now());
<filename>conf/mysql/aac-init.sql CREATE DATABASE aac; CREATE USER 'ac'@'%' IDENTIFIED BY 'ac'; GRANT ALL PRIVILEGES ON aac.* TO 'ac'@'%'; FLUSH PRIVILEGES;
-- Revert ovid:data/database-design-standards to sqlite BEGIN; DELETE FROM articles WHERE slug = 'database-design-standards' AND article_type_id = (SELECT article_type_id FROM article_types WHERE type = 'article'); COMMIT;
<reponame>aliostad/deep-learning-lang-detection -------------------------------------------------------- -- DDL for Table ARTICLE -------------------------------------------------------- CREATE TABLE "BROCARCL"."ARTICLE" ( "IDARTICLE" NUMBER(*,0), "IDCOMMANDE" NUMBER(*,0), "IDALBUM" NUMBER(*,0), "IDFORMAT" NUMBER(*,0), "IDPRESTATAIRE" NUMBER(*,0), "QUANTITE" NUMBER(*,0), "PRIX" NUMBER ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ;
<reponame>NowinskiK/ssdt-training CREATE TABLE [Application].[Cities]( [CityID] [int] NOT NULL, [CityName] [nvarchar](50) COLLATE Latin1_General_100_CI_AS NOT NULL, [StateProvinceID] [int] NOT NULL, [Location] [geography] NULL, [LatestRecordedPopulation] [bigint] NULL, [LastEditedBy] [int] NOT NULL, [ValidFrom] [datetime2](7) GENERATED ALWAYS AS ROW START NOT NULL, [ValidTo] [datetime2](7) GENERATED ALWAYS AS ROW END NOT NULL, CONSTRAINT [PK_Application_Cities] PRIMARY KEY CLUSTERED ( [CityID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [USERDATA], PERIOD FOR SYSTEM_TIME ([ValidFrom], [ValidTo]) ) ON [USERDATA] TEXTIMAGE_ON [USERDATA] WITH ( SYSTEM_VERSIONING = ON ( HISTORY_TABLE = [Application].[Cities_Archive] ) ) GO ALTER TABLE [Application].[Cities] WITH CHECK ADD CONSTRAINT [FK_Application_Cities_Application_People] FOREIGN KEY([LastEditedBy]) REFERENCES [Application].[People] ([PersonID]) GO ALTER TABLE [Application].[Cities] CHECK CONSTRAINT [FK_Application_Cities_Application_People] GO ALTER TABLE [Application].[Cities] WITH CHECK ADD CONSTRAINT [FK_Application_Cities_StateProvinceID_Application_StateProvinces] FOREIGN KEY([StateProvinceID]) REFERENCES [Application].[StateProvinces] ([StateProvinceID]) GO ALTER TABLE [Application].[Cities] CHECK CONSTRAINT [FK_Application_Cities_StateProvinceID_Application_StateProvinces] GO ALTER TABLE [Application].[Cities] ADD CONSTRAINT [DF_Application_Cities_CityID] DEFAULT (NEXT VALUE FOR [Sequences].[CityID]) FOR [CityID] GO /****** Object: Index [FK_Application_Cities_StateProvinceID] Script Date: 10/06/2020 18:14:17 ******/ CREATE NONCLUSTERED INDEX [FK_Application_Cities_StateProvinceID] ON [Application].[Cities] ( [StateProvinceID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [USERDATA] GO EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'Numeric ID used for reference to a city within the database' , @level0type=N'SCHEMA',@level0name=N'Application', @level1type=N'TABLE',@level1name=N'Cities', @level2type=N'COLUMN',@level2name=N'CityID' GO EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'Formal name of the city' , @level0type=N'SCHEMA',@level0name=N'Application', @level1type=N'TABLE',@level1name=N'Cities', @level2type=N'COLUMN',@level2name=N'CityName' GO EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'State or province for this city' , @level0type=N'SCHEMA',@level0name=N'Application', @level1type=N'TABLE',@level1name=N'Cities', @level2type=N'COLUMN',@level2name=N'StateProvinceID' GO EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'Geographic location of the city' , @level0type=N'SCHEMA',@level0name=N'Application', @level1type=N'TABLE',@level1name=N'Cities', @level2type=N'COLUMN',@level2name=N'Location' GO EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'Latest available population for the City' , @level0type=N'SCHEMA',@level0name=N'Application', @level1type=N'TABLE',@level1name=N'Cities', @level2type=N'COLUMN',@level2name=N'LatestRecordedPopulation' GO EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'Auto-created to support a foreign key' , @level0type=N'SCHEMA',@level0name=N'Application', @level1type=N'TABLE',@level1name=N'Cities', @level2type=N'INDEX',@level2name=N'FK_Application_Cities_StateProvinceID' GO EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'Cities that are part of any address (including geographic location)' , @level0type=N'SCHEMA',@level0name=N'Application', @level1type=N'TABLE',@level1name=N'Cities'
-- This file should undo anything in `up.sql` DROP TABLE demon_additions; DROP FUNCTION audit_demon_addition() CASCADE; DROP TABLE demon_modifications; DROP FUNCTION audit_demon_modification() CASCADE; DROP TABLE record_additions; DROP FUNCTION audit_record_addition() CASCADE; DROP TABLE record_modifications; DROP FUNCTION audit_record_modification() CASCADE; DROP TABLE record_deletions; DROP FUNCTION audit_record_deletion() CASCADE; DROP TABLE player_additions; DROP FUNCTION audit_player_addition() CASCADE; DROP TABLE player_modifications; DROP FUNCTION audit_player_modification() CASCADE; DROP TABLE player_deletions; DROP FUNCTION audit_player_deletion() CASCADE; DROP TABLE creator_additions; DROP FUNCTION audit_creator_addition() CASCADE; DROP TABLE creator_deletions; DROP FUNCTION audit_creator_deletion() CASCADE; DROP TABLE submitter_modifications; DROP FUNCTION audit_submitter_modification() CASCADE; DROP TABLE user_additions; DROP FUNCTION audit_user_addition() CASCADE; DROP TABLE user_modifications; DROP FUNCTION audit_user_modification() CASCADE; DROP TABLE user_deletions; DROP FUNCTION audit_user_deletion() CASCADE; DROP TABLE audit_log2; DROP TABLE active_user;
-- randexpr1.test -- -- db eval {SELECT coalesce((select (abs(f)/abs(coalesce((select max(19*b+d*coalesce((select max(t1.c) from t1 where case when d>=(abs((11))/abs(t1.a*13+(13)-d*e+11)) then t1.c when t1.c>=a then 19 else -17 end*t1.e> -e),t1.f)) from t1 where 13<=t1.e),t1.d))) from t1 where t1.d in (select d from t1 union select a from t1)),t1.e) FROM t1 WHERE t1.c between (11) and coalesce((select max(b*case t1.c when t1.f then t1.f else 11 end) from t1 where +(select count(distinct case when f not between -13 and 19 then t1.f++(f) | t1.e*(+13)* -(t1.c)-t1.b when 13=t1.d then 19 else t1.b end*t1.a) from t1) in (t1.e,11, -19)),d)+f} SELECT coalesce((select (abs(f)/abs(coalesce((select max(19*b+d*coalesce((select max(t1.c) from t1 where case when d>=(abs((11))/abs(t1.a*13+(13)-d*e+11)) then t1.c when t1.c>=a then 19 else -17 end*t1.e> -e),t1.f)) from t1 where 13<=t1.e),t1.d))) from t1 where t1.d in (select d from t1 union select a from t1)),t1.e) FROM t1 WHERE t1.c between (11) and coalesce((select max(b*case t1.c when t1.f then t1.f else 11 end) from t1 where +(select count(distinct case when f not between -13 and 19 then t1.f++(f) | t1.e*(+13)* -(t1.c)-t1.b when 13=t1.d then 19 else t1.b end*t1.a) from t1) in (t1.e,11, -19)),d)+f
<filename>scripts/postgres/content/sessions.sql /* if version 100000 */ select s.datname, s.pid, s.backend_type, s.usename, s.application_name, s.client_addr, s.client_hostname, s.backend_start, s.xact_start, s.query_start, s.state_change, s.wait_event_type, s.wait_event, s.state, s.backend_xid, s.backend_xmin, s.query from pg_stat_activity s order by 1, 4, 2 /* else version */ select s.datname, s.pid, s.usename, s.application_name, s.client_addr, s.client_hostname, s.backend_start, s.xact_start, s.query_start, s.state_change, /* if version 90600 */ s.wait_event_type, s.wait_event, s.state, /* else version */ s.state, /* endif version */ s.backend_xid, s.backend_xmin, s.query from pg_stat_activity s order by 1, 3, 2 /* endif version */
<gh_stars>100-1000 -- TPC_H Query 18 - Large Volume Customer SELECT TOP 100 C_NAME, C_CUSTKEY, O_ORDERKEY, O_ORDERDATE, O_TOTALPRICE, SUM(L_QUANTITY) FROM CUSTOMER, ORDERS, LINEITEM WHERE O_ORDERKEY IN (SELECT L_ORDERKEY FROM LINEITEM GROUP BY L_ORDERKEY HAVING SUM(L_QUANTITY) > 300) AND C_CUSTKEY = O_CUSTKEY AND O_ORDERKEY = L_ORDERKEY GROUP BY C_NAME, C_CUSTKEY, O_ORDERKEY, O_ORDERDATE, O_TOTALPRICE ORDER BY O_TOTALPRICE DESC, O_ORDERDATE;
DROP TABLE IF EXISTS pickuplines; CREATE TABLE pickuplines ( line VARCHAR(250) NOT NULL ); DROP TABLE IF EXISTS comebacks; CREATE TABLE comebacks ( line VARCHAR(250) NOT NULL );
<filename>application/notice/sql/uninstall.sql -- ----------------------------- -- 导出时间 `2018-03-16 09:20:08` -- ----------------------------- DROP TABLE IF EXISTS `dp_notice_list`; DROP TABLE IF EXISTS `dp_notice_cate`; DROP TABLE IF EXISTS `dp_notice_user`;
<filename>backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5591130_sys_gh_11232_Add_Croatia_To_EU_CountryArea.sql<gh_stars>1000+ CREATE TABLE backup.c_countryarea_assign_gh11232_07062021 AS SELECT * from c_countryarea_assign; UPDATE c_countryarea_assign SET AD_Client_ID = 0, AD_Org_ID = 0 WHERE c_countryarea_assign_id = 540038; -- Kroatien (Hrvatska)
/* Copyright (C) 2015 IASA - Institute of Accelerating Systems and Applications (http://www.iasa.gr) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* EGI AppDB incremental SQL script Previous version: 8.23.4 New version: 8.23.5 Author: <EMAIL> */ START TRANSACTION; INSERT INTO actor_groups (id, name) VALUES (-24, 'EGI VM Endorsment Dashboard Administrators'), (-25, 'EGI VM Endorsment Dashboard Security Officers') ; SELECT groupid, x.actorid::uuid, NULL AS payload FROM UNNEST(ARRAY[-24, -25]) AS groupid CROSS JOIN ( SELECT guid AS actorid FROM researchers WHERE id IN (520, 551) ) AS x; REFRESH MATERIALIZED VIEW CONCURRENTLY _actor_group_members; REFRESH MATERIALIZED VIEW CONCURRENTLY _actor_group_members2; REFRESH MATERIALIZED VIEW CONCURRENTLY permissions; INSERT INTO version (major,minor,revision,notes) SELECT 8, 23, 5, E'Added two new actor groups for endorsments dashboard' WHERE NOT EXISTS (SELECT * FROM version WHERE major=8 AND minor=23 AND revision=5); COMMIT;
DELETE FROM `script_texts` WHERE `entry` BETWEEN -1309023 AND -1309000; INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES (-1309000,'Let the coils of hate unfurl!',8421,1,0,'venoxis SAY_TRANSFORM'), (-1309001,'Ssserenity..at lassst!',0,1,0,'venoxis SAY_DEATH'), (-1309002,'<NAME>, grant me wings of vengance!',8417,1,0,'jeklik SAY_AGGRO'), (-1309003,'I command you to rain fire down upon these invaders!',0,1,0,'jeklik SAY_RAIN_FIRE'), (-1309004,'Finally ...death. Curse you Hakkar! Curse you!',8422,1,0,'jeklik SAY_DEATH'), (-1309005,'Draw me to your web mistress Shadra. Unleash your venom!',8418,1,0,'marli SAY_AGGRO'), (-1309006,'Shadra, make of me your avatar!',0,1,0,'marli SAY_TRANSFORM'), (-1309007,'Aid me my brood!',0,1,0,'marli SAY_SPIDER_SPAWN'), (-1309008,'Bless you mortal for this release. Hakkar controls me no longer...',8423,1,0,'marli SAY_DEATH'), (-1309009,'Shirvallah, fill me with your RAGE!',8419,1,0,'thekal SAY_AGGRO'), (-1309010,'Hakkar binds me no more! Peace at last!',8424,1,0,'thekal SAY_DEATH'), (-1309011,'Bethekk, your priestess calls upon your might!',8416,1,0,'arlokk SAY_AGGRO'), (-1309012,'Feast on $n, my pretties!',0,1,0,'arlokk SAY_FEAST_PANTHER'), (-1309013,'At last, I am free of the Soulflayer!',8412,1,0,'arlokk SAY_DEATH'), (-1309014,'Welcome to da great show friends! Step right up to die!',8425,1,0,'jindo SAY_AGGRO'), (-1309015,'I\'ll feed your souls to Hakkar himself!',8413,1,0,'mandokir SAY_AGGRO'), (-1309016,'DING!',0,1,0,'mandokir SAY_DING_KILL'), (-1309017,'GRATS!',0,1,0,'mandokir SAY_GRATS_JINDO'), (-1309018,'I\'m keeping my eye on you, $N!',0,1,0,'mandokir SAY_WATCH'), (-1309019,'Don\'t make me angry. You won\'t like it when I\'m angry.',0,1,0,'mandokir SAY_WATCH_WHISPER'), (-1309020,'PRIDE HERALDS THE END OF YOUR WORLD. COME, MORTALS! FACE THE WRATH OF THE SOULFLAYER!',8414,1,0,'hakkar SAY_AGGRO'), (-1309021,'Fleeing will do you no good, mortals!',0,1,0,'hakkar SAY_FLEEING'), (-1309022,'You dare set foot upon Hakkari holy ground? Minions of Hakkar, destroy the infidels!',0,1,0,'hakkar SAY_MINION_DESTROY'), (-1309023,'Minions of Hakkar, hear your God. The sanctity of this temple has been compromised. Invaders encroach upon holy ground! The Altar of Blood must be protected. Kill them all!',0,1,0,'hakkar SAY_PROTECT_ALTAR');
<filename>database/data.sql INSERT INTO `user` (`id`, `first_name`, `last_name`, `email`, `address`, `telephone`, `created`, `updated`, `version`) VALUES (1,'david','gilmour', '<EMAIL>', 'hello st', NULL, '2015-11-02 05:28:02', NULL, 0), (2,'roger','waters','<EMAIL>', 'final cut st', NULL, '2015-11-02 05:28:02', NULL, 0), (3,'john','locke','<EMAIL>', 'enlightment st', NULL, '2015-11-02 05:28:02', NULL, 0), (4,'noam','chumsky','<EMAIL>', 'failed state st', NULL, '2015-11-02 05:28:02', NULL, 0); INSERT INTO `credential` (`id`, `customer_id`, `role`, `sign_in_provider`, `salt`, `password`, `created`, `updated`, `version`) VALUES (1, 1, 'ROLE_USER', NULL , '123qweasd', '$2a$10$yWH3GRxFBuOlVuBQGhjqJe3OyvdCYUEnfBjL514x.vubpVh3vYoAG', '2015-11-02 05:28:02', NULL, 0), (2, 2, 'ROLE_USER', NULL , '123qweasd', '$2a$10$yWH3GRxFBuOlVuBQGhjqJe3OyvdCYUEnfBjL514x.vubpVh3vYoAG', '2015-11-02 05:28:02', NULL, 0), (3, 3, 'ROLE_USER', NULL , '123qweasd', '$2a$10$yWH3GRxFBuOlVuBQGhjqJe3OyvdCYUEnfBjL514x.vubpVh3vYoAG', '2015-11-02 05:28:02', NULL, 0); INSERT INTO `meal` (`id`, `user_id`, `date`, `quantity`, `rating`, `ordered_at`, `created`, `updated`, `version`) VALUES (1,1,'2015-01-05',1,NULL,'2015-01-02 02:27:42', '2015-11-02 05:28:02', NULL, 0 ), (2,1,'2015-01-06',1,NULL,'2015-11-02 02:28:02', '2015-11-02 05:28:02', NULL, 0 ), (3,3,'2015-01-07',1,NULL,'2015-11-02 02:28:02', '2015-11-02 05:28:02', NULL, 0 ); INSERT INTO `account` (`id`, `customer_id`, `payment_amount`, `payment_date`, `account_due`, `created`, `updated`, `version`) VALUES (1, 1, 10, '2014-12-02', 25, '2015-11-02 05:28:02', NULL, 0), (2, 3, 0, null, 30, '2015-11-02 05:28:02', NULL, 0), (3, 2, 10, '2014-12-02', 20, '2015-11-02 05:28:02', NULL, 0);
<filename>data/SQL/202.sp_turnover_monthly_by_division_chart.sql delimiter // DROP PROCEDURE IF EXISTS sp_turnover_monthly_by_division_chart // /* 最近一年間の事業部別、かつ月別売上 */ CREATE PROCEDURE sp_turnover_monthly_by_division_chart( ) BEGIN select v.year , v.month , v.division_id , s.name as division_name , sum(v.turnover_amount) as turnover_amount from v_turnover_monthly_by_organization v join eb_section s on s.id = v.division_id /*right join (select date_format(m1, '%Y') as year , date_format(m1, '%m') as month from ( select (current_date() - INTERVAL 365 DAY) + INTERVAL m MONTH as m1 from (select @rownum:=@rownum+1 as m from (select 1 union select 2 union select 3 union select 4) t1 , (select 1 union select 2 union select 3 union select 4) t2 , (select @rownum:=-1) t0 ) d1 ) d2 where m1 < current_date() order by m1 ) T on T.year = v.year and T.month = v.month*/ where concat(v.year, v.month) >= date_format(date_add(current_date(), interval -1 year), '%Y%m') group by division_id, v.year, v.month order by v.year, v.month ; END
-- DDL generated by Postico 1.5.8 -- Not all database features are supported. Do not use for backup. -- Table Definition ---------------------------------------------- CREATE TABLE events ( id character varying(128) PRIMARY KEY, timestamp timestamp with time zone NOT NULL, client_id character varying(128) NOT NULL REFERENCES organization_clients(client_id), organization_id integer NOT NULL REFERENCES organizations(id) ON DELETE CASCADE, type character varying(40), action character varying(128), source character varying(128) NOT NULL, status character varying(40) NOT NULL, xml_data text, json_data text ); -- Indices ------------------------------------------------------- CREATE UNIQUE INDEX events_pkey ON events(id text_ops); CREATE INDEX events_organization_id_index ON events(organization_id int4_ops); -- Table Definition ---------------------------------------------- CREATE TABLE event_destinations ( id character varying(128) PRIMARY KEY, event_id character varying(128) REFERENCES events(id) ON DELETE CASCADE, destination_name character varying(128), service_name character varying(128), status character varying(128) NOT NULL, timestamp timestamp with time zone DEFAULT CURRENT_TIMESTAMP, blockchain_response text ); -- Indices ------------------------------------------------------- CREATE UNIQUE INDEX event_destinations_pkey ON event_destinations(id text_ops);
-- upgrade catalogue script 2.0.8 to 2.0.9 --CHANGE VARCHARS TO VARCHAR 64 FOR THE IDENTIFIERS NAMES ALTER TABLE sch_chameleon.t_replica_tables ALTER COLUMN v_table_name TYPE character varying(64), ALTER COLUMN v_schema_name TYPE character varying(64); ALTER TABLE sch_chameleon.t_discarded_rows ALTER COLUMN v_table_name TYPE character varying(64), ALTER COLUMN v_schema_name TYPE character varying(64); ALTER TABLE sch_chameleon.t_indexes ALTER COLUMN v_table_name TYPE character varying(64), ALTER COLUMN v_schema_name TYPE character varying(64), ALTER COLUMN v_index_name TYPE character varying(64); ALTER TABLE sch_chameleon.t_pkeys ALTER COLUMN v_table_name TYPE character varying(64), ALTER COLUMN v_schema_name TYPE character varying(64), ALTER COLUMN v_index_name TYPE character varying(64); ALTER TABLE sch_chameleon.t_ukeys ALTER COLUMN v_table_name TYPE character varying(64), ALTER COLUMN v_schema_name TYPE character varying(64), ALTER COLUMN v_index_name TYPE character varying(64); ALTER TABLE sch_chameleon.t_fkeys ALTER COLUMN v_table_name TYPE character varying(64), ALTER COLUMN v_schema_name TYPE character varying(64), ALTER COLUMN v_constraint_name TYPE character varying(64);
\set ON_ERROR_STOP 1 BEGIN; DO $$ DECLARE empty_tag_ids INTEGER[]; BEGIN SELECT array_agg(id) FROM tag WHERE name ~ E'^\\s*$' INTO empty_tag_ids; DELETE FROM area_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM artist_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM event_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM instrument_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM label_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM place_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM recording_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM release_group_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM release_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM series_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM work_tag_raw WHERE tag = any(empty_tag_ids); DELETE FROM area_tag WHERE tag = any(empty_tag_ids); DELETE FROM artist_tag WHERE tag = any(empty_tag_ids); DELETE FROM event_tag WHERE tag = any(empty_tag_ids); DELETE FROM instrument_tag WHERE tag = any(empty_tag_ids); DELETE FROM label_tag WHERE tag = any(empty_tag_ids); DELETE FROM place_tag WHERE tag = any(empty_tag_ids); DELETE FROM recording_tag WHERE tag = any(empty_tag_ids); DELETE FROM release_group_tag WHERE tag = any(empty_tag_ids); DELETE FROM release_tag WHERE tag = any(empty_tag_ids); DELETE FROM series_tag WHERE tag = any(empty_tag_ids); DELETE FROM work_tag WHERE tag = any(empty_tag_ids); END $$; UPDATE tag SET name = regexp_replace(btrim(name), E'\\s{2,}', ' ', 'g') WHERE NOT controlled_for_whitespace(name); ALTER TABLE tag ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''); COMMIT;
-- patch removed as it causes problems where stubs are emtpy, which is permitted -- alter table events modify event_stub varchar(30) not null, add unique index(event_stub); INSERT INTO patch_history SET patch_number = 26;
-- create vclass for created with condition 'int auto_increment unique',insert data to this class,select data,drop class create class xoo ( id int auto_increment unique , title varchar(100)); insert into xoo(title) values ('aaa'); insert into xoo(title) values ('bbb'); insert into xoo(title) values ('ccc'); select * from xoo order by 1; create vclass vxoo ( id int, title varchar(100) ) as select * from xoo; select * from vxoo order by 1; drop vclass vxoo; drop class xoo;
<gh_stars>0 /* leave this v:091018\s.zaglio: help programmer to change code dinamically&sistematically g:utility */ CREATE proc [dbo].[sp__script_review] @old_code sysname=null, @new_code sysname=null, @objs sysname='%' as begin -- replace old g: tag -- sp__script_review '%g:sp__group%''utility'',''%''','%g:utility' -- add g:tag -- sp__script_review '%*/','%g:utility{crlf}*/',@objs='%[_][_]%' -- sp__script_review '%exec%sp__elapsed%''-- SP_SYNC_TABLES:%''', -- '%exec%sp__elapsed%''-- %s:%''',@proc -- sp__script_review '%exec%sp__printf%''-- SP_SYNC_TABLES:%''', -- '%exec%sp__printf%''-- %s:%''',@proc print 'programming aid procedure: to do see content' end--proc
DROP FUNCTION calculate_availability(character varying,character varying,character varying,integer); CREATE OR REPLACE FUNCTION calculate_availability(value_stream_name character varying, machine_id character varying, end_time_string character varying, duration_in_sec Integer) RETURNS real LANGUAGE plpgsql STABLE AS $$ -- value_stream_name: this is the associated value stream on Thing general info page. -- machine_id: this is the Thing name in Thingworx -- end_time_string: the time to check in string with format: YYYYMMDDHH24MISS, for example:20170919235959. assume UTC timezone -- duration_in_sec: the time to look back in second. if you want to look up for 1 minute result, just give 60. 3600 for 1 hour. and 24*3600 for 1 day. declare var_end_time timestamp with time zone; var_start_time timestamp with time zone; var_last_time timestamp with time zone; var_last_value character varying; rec RECORD; prerec RECORD; available_time_in_sec real; begin IF duration_in_sec <=0 then RETURN 0.0; END IF; -- raise notice 'Start from:%', now(); select into var_end_time (to_timestamp(end_time_string,'YYYYMMDDHH24MISS')::timestamp with time zone) ; select into var_start_time (var_end_time - duration_in_sec * interval '1 second'); -- raise notice 'end time:%', var_end_time; -- raise notice 'start time:%', var_start_time; -- get last result right before start time. var_last_value := '1'; -- setup default value. for prerec in select time, property_value from value_stream where entity_id=value_stream_name and source_id=machine_id and property_name='Status' and time <= var_start_time order by time desc limit 1 LOOP var_last_value := prerec.property_value; END LOOP; var_last_time := var_start_time; -- setup start time in loop. available_time_in_sec = 0.0; for rec in select time, property_value from value_stream where entity_id=value_stream_name and source_id=machine_id and property_name='Status' and time <= var_end_time and time > var_start_time order by time LOOP -- RAISE NOTICE '%:% - %:%', var_last_time, var_last_value, rec.time, rec.property_value; if var_last_value = '1' then available_time_in_sec := extract(epoch from rec.time - var_last_time)+ available_time_in_sec; ELSEIF var_last_value = '2' then available_time_in_sec := extract(epoch from rec.time - var_last_time)+ available_time_in_sec; ELSEIF var_last_value = '3' then available_time_in_sec := extract(epoch from rec.time - var_last_time)+ available_time_in_sec; END IF; var_last_time := rec.time; var_last_value := rec.property_value; END LOOP; -- add tail time. if var_last_value = '1' then available_time_in_sec := extract(epoch from var_end_time - var_last_time)+ available_time_in_sec; ELSEIF var_last_value = '2' then available_time_in_sec := extract(epoch from var_end_time - var_last_time)+ available_time_in_sec; ELSEIF var_last_value = '3' then available_time_in_sec := extract(epoch from var_end_time - var_last_time)+ available_time_in_sec; END IF; -- raise notice 'End at:%', now(); RETURN available_time_in_sec/duration_in_sec; end; $$
SELECT name FROM people JOIN stars ON stars.person_id=people.id JOIN movies ON movies.id=stars.movie_id WHERE movies.id IN(SELECT movies.id FROM movies JOIN stars ON stars.movie_id=movies.id JOIN people ON people.id=stars.person_id WHERE people.name='<NAME>' and people.birth=1958) and people.name != '<NAME>';
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Hôte : 127.0.0.1:3306 -- Généré le : mar. 02 juil. 2019 à 19:31 -- Version du serveur : 5.7.26 -- Version de PHP : 7.2.18 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 */; -- -- Base de données : `pweb-ci` -- -- -------------------------------------------------------- -- -- Structure de la table `pw_logs` -- DROP TABLE IF EXISTS `pw_logs`; CREATE TABLE IF NOT EXISTS `pw_logs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) NOT NULL, `login_date` datetime NOT NULL, `ip_address` varchar(255) NOT NULL, `error` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=93 DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `pw_logs` -- INSERT INTO `pw_logs` (`id`, `username`, `login_date`, `ip_address`, `error`) VALUES (92, 'admin', '2019-07-02 20:43:52', '::1', 0), (91, 'admin', '2019-07-02 19:49:49', '::1', 0), (90, 'admin', '2019-07-02 19:49:47', '::1', 3), (89, 'admin', '2019-07-02 19:49:41', '::1', 0), (88, 'admin', '2019-07-02 19:48:15', '::1', 0); -- -------------------------------------------------------- -- -- Structure de la table `pw_pages` -- DROP TABLE IF EXISTS `pw_pages`; CREATE TABLE IF NOT EXISTS `pw_pages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `url` varchar(255) NOT NULL, `title` varchar(255) NOT NULL, `content` text NOT NULL, `created_on` date NOT NULL DEFAULT '2000-01-01', `created_by` int(11) NOT NULL, `last_modified` date NOT NULL DEFAULT '2000-01-01', `modified_by` int(11) NOT NULL, `menu_order` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `pw_pages` -- INSERT INTO `pw_pages` (`id`, `name`, `url`, `title`, `content`, `created_on`, `created_by`, `last_modified`, `modified_by`, `menu_order`) VALUES (1, 'Testpage', 'testpage', 'This is a testpage', '&lt;h1&gt;Lorem Ipsum&lt;/h1&gt;&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque egestas eros est, a iaculis felis convallis eu. Integer vitae nunc ornare, laoreet augue id, vestibulum neque. Sed ipsum mi, tincidunt ut nisi ullamcorper, volutpat malesuada elit. Duis in mattis eros. Vivamus eu dolor magna. Nunc tincidunt enim sit amet vehicula volutpat. Nulla id ipsum feugiat, commodo magna sed, volutpat tortor.&lt;/p&gt;', '2000-01-01', 1, '2000-01-01', 1, 0); -- -------------------------------------------------------- -- -- Structure de la table `pw_settings` -- DROP TABLE IF EXISTS `pw_settings`; CREATE TABLE IF NOT EXISTS `pw_settings` ( `website_title` varchar(255) NOT NULL, `website_subtitle` varchar(255) NOT NULL, `website_keywords` varchar(255) NOT NULL, `website_homepage_id` int(11) NOT NULL, `log_successful_connection_activated` tinyint(1) NOT NULL, `log_failed_attempts_activated` tinyint(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `pw_settings` -- INSERT INTO `pw_settings` (`website_title`, `website_subtitle`, `website_keywords`, `website_homepage_id`, `log_successful_connection_activated`, `log_failed_attempts_activated`) VALUES ('<NAME>', 'Researcher', 'pweb', 0, 1, 1); -- -------------------------------------------------------- -- -- Structure de la table `pw_users` -- DROP TABLE IF EXISTS `pw_users`; CREATE TABLE IF NOT EXISTS `pw_users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `last_login` datetime NOT NULL DEFAULT '2000-01-01 12:00:00', `email` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `pw_users` -- INSERT INTO `pw_users` (`id`, `username`, `password`, `last_login`, `email`) VALUES (1, 'admin', '$2y$12$7ool1jSc/OgwKME5N6CZm.EUYINAa9Z5mQI5hzlTLcYDRN7/ZDdii', '2019-07-02 20:43:52', '<EMAIL>'); 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>src/main/resources/db/migration/V1_12__remove_vedtak_and_vedtak_type_from_klage.sql ALTER TABLE klage DROP COLUMN vedtak; ALTER TABLE klage DROP COLUMN vedtak_type;
declare @days_to_report int set @days_to_report = 365 declare @total_pages decimal set @total_pages = (select sum(total_pages) from tbl_printer_usage_log where usage_date >= DATEADD(DAY,-@days_to_report,getdate()) and usage_allowed= 'Y' and refunded= 'N' and printed = 'Y' ) print @total_pages select printer1_.display_name , sum(printerusa0_.total_pages) as total_pages, (sum(printerusa0_.total_pages) / @total_pages)*100 as ratio, sum(printerusa0_.total_color_pages) as total_color_pages , sum(printerusa0_.total_pages) - sum(printerusa0_.total_color_pages) as total_greyscale_pages, sum(printerusa0_.total_color_pages) / cast(sum(printerusa0_.total_pages) as decimal) * 100 as ratio_color, printer1_.server_name , printer1_.printer_name from tbl_printer_usage_log printerusa0_ inner join tbl_printer printer1_ on printerusa0_.printer_id=printer1_.printer_id inner join tbl_user user2_ on printerusa0_.used_by_user_id=user2_.user_id inner join tbl_account account3_ on printerusa0_.charged_to_account_id=account3_.account_id inner join tbl_account account4_ on printerusa0_.assoc_with_account_id=account4_.account_id where printerusa0_.usage_date >= DATEADD(DAY,-@days_to_report,getdate()) and printerusa0_.usage_allowed= 'Y' and printerusa0_.refunded= 'N' and printerusa0_.printed = 'Y' group by printer1_.display_name , printer1_.server_name , printer1_.printer_name order by lower(printer1_.display_name)
/* SQLyog Community v13.1.2 (64 bit) MySQL - 10.1.38-MariaDB : Database - u934804553_bzn ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!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 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`u934804553_bzn` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `u934804553_bzn`; /*Table structure for table `admin` */ DROP TABLE IF EXISTS `admin`; CREATE TABLE `admin` ( `id` int(10) NOT NULL AUTO_INCREMENT, `email` varchar(50) NOT NULL, `password` varchar(10) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `name` varchar(50) NOT NULL, `first_name` varchar(50) NOT NULL, `last_name` varchar(50) NOT NULL, `username` varchar(50) NOT NULL, `mobile` varchar(50) NOT NULL, `address` text NOT NULL, `city` varchar(50) NOT NULL, `country` varchar(50) NOT NULL, `postal` varchar(10) NOT NULL, `about` text NOT NULL, `profile_pic` varchar(100) NOT NULL, `position` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*Data for the table `admin` */ insert into `admin`(`id`,`email`,`password`,`created_at`,`updated_at`,`deleted_at`,`name`,`first_name`,`last_name`,`username`,`mobile`,`address`,`city`,`country`,`postal`,`about`,`profile_pic`,`position`) values (1,'<EMAIL>','admin','2019-02-14 19:28:00',NULL,NULL,'admin','admin','buzanom','bu<PASSWORD>om','07948402450','416,Sumel-6,Dudheswar Road','Ahmedabad','india','380004','IT Company','admin.jpg','ADMINISTRATOR'); /*Table structure for table `career_contacts` */ DROP TABLE IF EXISTS `career_contacts`; CREATE TABLE `career_contacts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(80) NOT NULL, `email` varchar(50) NOT NULL, `phone` varchar(20) NOT NULL, `address` text NOT NULL, `objective` text NOT NULL, `qualification` varchar(50) NOT NULL, `grade` varchar(10) NOT NULL, `position` varchar(50) NOT NULL, `employeement` varchar(50) DEFAULT NULL, `status` int(1) NOT NULL DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; /*Data for the table `career_contacts` */ insert into `career_contacts`(`id`,`name`,`email`,`phone`,`address`,`objective`,`qualification`,`grade`,`position`,`employeement`,`status`,`created_at`,`updated_at`,`deleted_at`) values (1,'snehal','<EMAIL>','7046828181','new ranip, ahmedabad, gujarat-382480','test','b.e.','72.5','fullstack developer','php developer at virtual height',0,'2019-02-08 14:32:06',NULL,NULL), (2,'snehal','<EMAIL>','7046828181','new ranip, ahmedabad, gujarat-382480','test','b.e.','72.5','fullstack developer','php developer at virtual height',0,'2019-02-08 14:32:43',NULL,NULL), (3,'snehal','<EMAIL>','7046828181','new ranip, ahmedabad, gujarat-382480','test','b.e.','72.5','fullstack developer','php developer at virtual height',0,'2019-02-08 14:35:36',NULL,NULL), (4,'snehal','<EMAIL>','7046828181','new ranip, ahmedabad, gujarat-382480','test','b.e.','72.5','fullstack developer','php developer at virtual height',0,'2019-02-08 14:43:47',NULL,NULL), (5,'snehal','<EMAIL>','7046828181','new ranip, ahmedabad, gujarat-382480','test','b.e.','72.5','fullstack developer',NULL,0,'2019-02-08 14:43:54',NULL,NULL), (6,'Gaurav','<EMAIL>','9409325680','Ahmedabad','fuhysdiufhgk','BE CE','first clas','PHP developer','NA',0,'2019-02-11 05:39:41',NULL,NULL); /*Table structure for table `contact_us` */ DROP TABLE IF EXISTS `contact_us`; CREATE TABLE `contact_us` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(80) NOT NULL, `email` varchar(50) NOT NULL, `subject` varchar(250) NOT NULL, `message` text NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1; /*Data for the table `contact_us` */ insert into `contact_us`(`id`,`name`,`email`,`subject`,`message`,`created_at`,`updated_at`,`deleted_at`) values (1,'snehal','<EMAIL>','new ranip','Test','2019-02-08 02:05:59',NULL,NULL), (2,'snehal','<EMAIL>','new ranip','Test','2019-02-08 02:06:13',NULL,NULL), (3,'snehal','<EMAIL>','new ranip','Test','2019-02-08 02:06:27',NULL,NULL), (4,'snehal','<EMAIL>','new ranip','Test','2019-02-08 02:07:19',NULL,NULL), (5,'snehal','<EMAIL>','new ranip','Test','2019-02-08 02:07:42',NULL,NULL), (6,'snehal','<EMAIL>','new ranip','Test','2019-02-08 02:08:45',NULL,NULL), (7,'test','<EMAIL>','test','tetst','2019-02-08 14:43:03',NULL,NULL), (8,'avsdhgfa','<EMAIL>','aaaadsfd','jfhkjlgwdf','2019-02-11 05:37:34',NULL,NULL), (9,'Gaurav','<EMAIL>','Ahmedabad','jgfdsjhgfjisd','2019-02-11 18:07:20',NULL,NULL); /*Table structure for table `department` */ DROP TABLE IF EXISTS `department`; CREATE TABLE `department` ( `id` int(11) NOT NULL AUTO_INCREMENT, `department` varchar(20) NOT NULL, `parent_department_id` varchar(20) NOT NULL, `status` int(1) NOT NULL DEFAULT '1', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; /*Data for the table `department` */ insert into `department`(`id`,`department`,`parent_department_id`,`status`,`created_at`,`updated_at`,`deleted_at`) values (1,'front_end','3',1,'2019-03-08 18:39:51',NULL,NULL), (2,'back_end','3',1,'2019-03-08 18:39:51',NULL,NULL), (3,'technical','0',1,'2019-03-08 18:39:39',NULL,NULL), (4,'non_trechnical','0',1,'2019-03-08 18:39:39',NULL,NULL), (5,'php','2',1,'2019-03-08 18:40:06',NULL,NULL), (6,'javascript','2',1,'2019-03-08 18:40:07',NULL,NULL), (7,'angularjs','7',1,'2019-03-08 18:41:23',NULL,NULL), (8,'reactjs','7',1,'2019-03-08 18:41:24',NULL,NULL), (9,'react_native','7',1,'2019-03-08 18:41:25',NULL,NULL), (10,'adobe&corel','1',1,'2019-03-08 18:40:17',NULL,NULL), (11,'.net','2',1,'2019-03-08 18:40:18',NULL,NULL), (12,'haskell','11',1,'2019-03-08 18:41:17',NULL,NULL), (13,'android','15',1,'2019-03-08 18:41:15',NULL,NULL), (14,'kotlin','7',1,'2019-03-08 18:41:27',NULL,NULL), (15,'java','2',1,'2019-03-08 18:40:20',NULL,NULL), (16,'html&css&sass&less','1',1,'2019-03-08 18:40:33',NULL,NULL), (17,'laravel','5',1,'2019-03-08 18:41:00',NULL,NULL), (18,'codeigniter','5',1,'2019-03-08 18:41:00',NULL,NULL), (19,'full_stack','3',1,'2019-03-08 18:42:34',NULL,NULL), (20,'min_stack','2',1,'2019-03-08 18:42:39',NULL,NULL); /*Table structure for table `emp_salary` */ DROP TABLE IF EXISTS `emp_salary`; CREATE TABLE `emp_salary` ( `id` int(11) NOT NULL AUTO_INCREMENT, `emp_id` varchar(20) NOT NULL, `salary` varchar(20) NOT NULL, `days` varchar(20) NOT NULL, `final_salary` varchar(20) NOT NULL, `status` int(1) NOT NULL DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*Data for the table `emp_salary` */ /*Table structure for table `emp_track` */ DROP TABLE IF EXISTS `emp_track`; CREATE TABLE `emp_track` ( `id` int(11) NOT NULL AUTO_INCREMENT, `emp_id` varchar(20) NOT NULL, `date` date NOT NULL, `starttime` time NOT NULL, `endtime` time NOT NULL, `faceloop` varchar(200) DEFAULT NULL, `timeleft` time DEFAULT NULL, `status` varchar(1) NOT NULL DEFAULT 'A', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*Data for the table `emp_track` */ insert into `emp_track`(`id`,`emp_id`,`date`,`starttime`,`endtime`,`faceloop`,`timeleft`,`status`,`created_at`,`updated_at`,`deleted_at`) values (1,'1','2019-02-26','08:23:52','00:20:19',NULL,'07:59:33','P','2019-02-26 15:26:35','2019-02-26 09:56:35',NULL); /*Table structure for table `employee` */ DROP TABLE IF EXISTS `employee`; CREATE TABLE `employee` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(100) NOT NULL, `username` varchar(50) NOT NULL, `mobile` varchar(20) NOT NULL, `department_id` varchar(20) NOT NULL, `post_id` varchar(20) NOT NULL, `type` varchar(20) NOT NULL, `career_id` varchar(20) DEFAULT NULL, `offer_id` varchar(20) NOT NULL, `joining_id` varchar(20) NOT NULL, `profile_id` varchar(20) NOT NULL, `level` int(1) NOT NULL DEFAULT '1' COMMENT '0 = Trainee, 1 = fresher, 2 = basic, 3 = intermediate, 4 = expert', `status` int(1) NOT NULL DEFAULT '1', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*Data for the table `employee` */ insert into `employee`(`id`,`name`,`email`,`password`,`username`,`mobile`,`department_id`,`post_id`,`type`,`career_id`,`offer_id`,`joining_id`,`profile_id`,`level`,`status`,`created_at`,`updated_at`,`deleted_at`) values (1,'snehal','<EMAIL>','snehal<PASSWORD>','snehal12','7046828181','3','1','1','1','1','1','1',1,1,'2019-03-08 18:43:19',NULL,NULL); /*Table structure for table `menu` */ DROP TABLE IF EXISTS `menu`; CREATE TABLE `menu` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(20) NOT NULL, `name` varchar(20) NOT NULL, `link` text NOT NULL, `parent_menu_id` varchar(20) NOT NULL, `type` int(1) NOT NULL DEFAULT '1', `status` int(1) NOT NULL DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*Data for the table `menu` */ /*Table structure for table `site_settings` */ DROP TABLE IF EXISTS `site_settings`; CREATE TABLE `site_settings` ( `id` int(11) NOT NULL AUTO_INCREMENT, `logo` varchar(50) NOT NULL, `tagline` varchar(250) NOT NULL, `address1` text NOT NULL, `address2` text, `support_email` varchar(50) NOT NULL, `info_email` varchar(50) NOT NULL, `hr_email` varchar(50) NOT NULL, `lat` varchar(20) NOT NULL, `lang` varchar(20) NOT NULL, `contact1` varchar(20) NOT NULL, `contact2` varchar(20) DEFAULT NULL, `facebook_link` text, `linkedin_link` text, `pinterest_link` text, `twitter_link` text, `googleplus_link` text, `skype_link` text, `github_link` text, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*Data for the table `site_settings` */ insert into `site_settings`(`id`,`logo`,`tagline`,`address1`,`address2`,`support_email`,`info_email`,`hr_email`,`lat`,`lang`,`contact1`,`contact2`,`facebook_link`,`linkedin_link`,`pinterest_link`,`twitter_link`,`googleplus_link`,`skype_link`,`github_link`,`created_at`,`updated_at`,`deleted_at`) values (1,'logo.png','Simply Coded Unique Designs','416, Sumel-6,Dudheswar Road, Ahmedabad, Gujarat-380004',NULL,'<EMAIL>','<EMAIL>','<EMAIL>','23.045893','432.584390','079-48402450',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2019-03-08 14:53:13','2019-03-08 09:23:13',NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
<reponame>JkRuiz/itearcion2 INSERT INTO INGREDIENTES VALUES('Papa' , 'Papas a la francesa', 'French fries'); INSERT INTO INGREDIENTES VALUES('Papa' , 'Papa diferente', 'Different fries'); SELECT * FROM INGREDIENTES;
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: 1172.16.58.3 -- Generation Time: Dec 30, 2021 at 06:09 AM -- Server version: 10.4.19-MariaDB -- PHP Version: 7.3.28 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `db_komunitas` -- -- -------------------------------------------------------- -- -- Table structure for table `tb_user_detail` -- CREATE TABLE `tb_user_detail` ( `id_user_detail` int(11) NOT NULL, `email` varchar(128) NOT NULL, `nama` varchar(100) NOT NULL, `tanggal_lahir` varchar(100) NOT NULL, `jenis_kelamin` varchar(100) NOT NULL, `kota_tempat_tinggal` varchar(200) NOT NULL, `nama_usaha` varchar(200) NOT NULL, `alamat_usaha` text NOT NULL, `kota_lokasi_usaha` text NOT NULL, `tahun_berdiri_usaha` varchar(4) NOT NULL, `no_telepon` varchar(50) NOT NULL, `email_usaha` varchar(128) NOT NULL, `produk_ekspor` text NOT NULL, `jumlah_karyawan` int(11) NOT NULL, `omset_pertahun` int(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tb_user_detail` -- INSERT INTO `tb_user_detail` (`id_user_detail`, `email`, `nama`, `tanggal_lahir`, `jenis_kelamin`, `kota_tempat_tinggal`, `nama_usaha`, `alamat_usaha`, `kota_lokasi_usaha`, `tahun_berdiri_usaha`, `no_telepon`, `email_usaha`, `produk_ekspor`, `jumlah_karyawan`, `omset_pertahun`) VALUES (6, '<EMAIL>', '<NAME>', '2021-12-27', 'Laki-laki', 'Kabupaten Bondowoso (Bondowoso)', 'ZL Ent.', 'R.E. Martadinata', 'Kabupaten Bondowoso (Bondowoso)', '1234', '0123014249', '<EMAIL>', 'Laptop', 123, 124354123); -- -- Indexes for dumped tables -- -- -- Indexes for table `tb_user_detail` -- ALTER TABLE `tb_user_detail` ADD PRIMARY KEY (`id_user_detail`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tb_user_detail` -- ALTER TABLE `tb_user_detail` MODIFY `id_user_detail` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; 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>zutheme/teamilk set @str1 = ''; #select @str1:= CONCAT(@str1,cs.namecat,',') as listcat from (SELECT * FROM `catehasproduct` where idproduct = 68 and idcategory > 0) as c JOIN categories as cs on c.idcategory = cs.idcategory; #SELECT person_id, GROUP_CONCAT(hobbies SEPARATOR ', ') #FROM peoples_hobbies #GROUP BY person_id; select GROUP_CONCAT(cat.namecat SEPARATOR ', ') as listcat from (select cs.idcategory,cs.namecat from (SELECT * FROM `catehasproduct` where idproduct = 68 and idcategory > 0) as c JOIN categories as cs on c.idcategory = cs.idcategory) as cat;
<gh_stars>0 -- Query the Name of any student in STUDENTS who scored higher than Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID. SELECT NAME FROM STUDENTS WHERE MARKS>75 ORDER BY RIGHT(NAME,3) ,ID ASC; SELECT NAME FROM STUDENTS WHERE MARKS>75 ORDER BY SUBSTRING(NAME,-3),ID ASC;
<gh_stars>0 DELETE FROM USER_ADMIN; INSERT INTO USER_ADMIN (USER_ID, USER_NAME, PASSWORD) VALUES (10001, "USER_10001", "<PASSWORD>"); INSERT INTO USER_ADMIN (USER_ID, USER_NAME, PASSWORD) VALUES (10002, "USER_10002", "<PASSWORD>"); INSERT INTO USER_ADMIN (USER_ID, USER_NAME, PASSWORD) VALUES (10003, "USER_10003", "<PASSWORD>"); INSERT INTO USER_ADMIN (USER_ID, USER_NAME, PASSWORD) VALUES (10004, "USER_10004", "<PASSWORD>"); INSERT INTO USER_ADMIN (USER_ID, USER_NAME, PASSWORD) VALUES (10005, "USER_10005", "<PASSWORD>"); INSERT INTO USER_ADMIN (USER_ID, USER_NAME, PASSWORD) VALUES (10006, "USER_10006", "<PASSWORD>"); INSERT INTO USER_ADMIN (USER_ID, USER_NAME, PASSWORD) VALUES (10007, "USER_10007", "<PASSWORD>");
<filename>hey.db.sql<gh_stars>10-100 BEGIN TRANSACTION; CREATE TABLE `tags` ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL UNIQUE ); CREATE TABLE `people` ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL UNIQUE ); CREATE TABLE `events_tags` ( `event_id` INTEGER NOT NULL, `tag_id` INTEGER NOT NULL, PRIMARY KEY(`event_id`,`tag_id`), FOREIGN KEY(`event_id`) REFERENCES events(id), FOREIGN KEY(`tag_id`) REFERENCES tags(id) ); CREATE TABLE `events_people` ( `event_id` INTEGER NOT NULL, `person_id` INTEGER NOT NULL, PRIMARY KEY(`event_id`,`person_id`), FOREIGN KEY(`event_id`) REFERENCES events(id), FOREIGN KEY(`person_id`) REFERENCES people(id) ); CREATE TABLE `events` ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `description` TEXT, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); COMMIT;
<reponame>karlarao/oracle_storage_breakdown<gh_stars>1-10 set feedback off term off head on und off trimspool on echo off lines 4000 colsep ',' arraysize 5000 verify off newpage none COLUMN name NEW_VALUE _instname NOPRINT select lower(instance_name) name from v$instance; COLUMN conname NEW_VALUE _conname NOPRINT select case when a.conname = 'CDB$ROOT' then 'ROOT' when a.conname = 'PDB$SEED' then 'SEED' else a.conname end as conname from (select SYS_CONTEXT('USERENV', 'CON_NAME') conname from dual) a; COLUMN conid NEW_VALUE _conid NOPRINT select SYS_CONTEXT('USERENV', 'CON_ID') conid from dual; spool storage_09_timeseries_ts-&_instname-&_conname-&_conid..csv -- variable section start COLUMN name NEW_VALUE _instname NOPRINT select lower(instance_name) name from v$instance; COLUMN name NEW_VALUE _hostname NOPRINT select lower(host_name) name from v$instance; COL ecr_dbid NEW_V ecr_dbid; SELECT 'get_dbid', TO_CHAR(dbid) ecr_dbid FROM v$database; COL ecr_instance_number NEW_V ecr_instance_number; SELECT 'get_instance_number', TO_CHAR(instance_number) ecr_instance_number FROM v$instance; COL ecr_min_snap_id NEW_V ecr_min_snap_id; SELECT 'get_min_snap_id', TO_CHAR(MIN(snap_id)) ecr_min_snap_id FROM dba_hist_snapshot WHERE dbid = &&ecr_dbid. and to_date(to_char(END_INTERVAL_TIME,'MM/DD/YY HH24:MI:SS'),'MM/DD/YY HH24:MI:SS') > sysdate - 300; -- variable section end WITH ts_per_snap_id AS ( SELECT /*+ MATERIALIZE NO_MERGE */ us.snap_id, TRUNC(CAST(sn.end_interval_time AS DATE), 'HH') + (1/24) end_time, SUM(us.tablespace_size * ts.block_size)/1024/1024/1024 all_tablespaces_gb, SUM(CASE ts.contents WHEN 'PERMANENT' THEN us.tablespace_size * ts.block_size ELSE 0 END)/1024/1024/1024 perm_tablespaces_gb, SUM(CASE ts.contents WHEN 'UNDO' THEN us.tablespace_size * ts.block_size ELSE 0 END)/1024/1024/1024 undo_tablespaces_gb, SUM(CASE ts.contents WHEN 'TEMPORARY' THEN us.tablespace_size * ts.block_size ELSE 0 END)/1024/1024/1024 temp_tablespaces_gb, SUM(us.tablespace_maxsize * ts.block_size)/1024/1024/1024 all_tablespaces_maxgb, SUM(CASE ts.contents WHEN 'PERMANENT' THEN us.tablespace_maxsize * ts.block_size ELSE 0 END)/1024/1024/1024 perm_tablespaces_maxgb, SUM(CASE ts.contents WHEN 'UNDO' THEN us.tablespace_maxsize * ts.block_size ELSE 0 END)/1024/1024/1024 undo_tablespaces_maxgb, SUM(CASE ts.contents WHEN 'TEMPORARY' THEN us.tablespace_maxsize * ts.block_size ELSE 0 END)/1024/1024/1024 temp_tablespaces_maxgb, SUM(us.tablespace_usedsize * ts.block_size)/1024/1024/1024 all_tablespaces_usedgb, SUM(CASE ts.contents WHEN 'PERMANENT' THEN us.tablespace_usedsize * ts.block_size ELSE 0 END)/1024/1024/1024 perm_tablespaces_usedgb, SUM(CASE ts.contents WHEN 'UNDO' THEN us.tablespace_usedsize * ts.block_size ELSE 0 END)/1024/1024/1024 undo_tablespaces_usedgb, SUM(CASE ts.contents WHEN 'TEMPORARY' THEN us.tablespace_usedsize * ts.block_size ELSE 0 END)/1024/1024/1024 temp_tablespaces_usedgb FROM dba_hist_tbspc_space_usage us, dba_hist_snapshot sn, v$tablespace vt, dba_tablespaces ts WHERE us.snap_id >= TO_NUMBER(NVL('&&ecr_min_snap_id.','0')) AND us.dbid = &&ecr_dbid. AND sn.snap_id = us.snap_id AND sn.dbid = us.dbid AND sn.instance_number = &&ecr_instance_number. AND vt.ts# = us.tablespace_id AND ts.tablespace_name = vt.name GROUP BY us.snap_id, sn.end_interval_time ) SELECT trim('&_instname') instname, trim('&ecr_dbid') db_id, trim('&_hostname') hostname, TO_CHAR(end_time, 'MM/DD/YY') end_time, round(MAX(all_tablespaces_gb),2) all_size_gb, round(MAX(perm_tablespaces_gb),2) perm_size_gb, round(MAX(undo_tablespaces_gb),2) undo_size_gb, round(MAX(temp_tablespaces_gb),2) temp_size_gb, round(MAX(all_tablespaces_maxgb),2) all_size_maxgb, round(MAX(perm_tablespaces_maxgb),2) perm_size_maxgb, round(MAX(undo_tablespaces_maxgb),2) undo_size_maxgb, round(MAX(temp_tablespaces_maxgb),2) temp_size_maxgb, round(MAX(all_tablespaces_usedgb),2) all_size_usedgb, round(MAX(perm_tablespaces_usedgb),2) perm_size_usedgb, round(MAX(undo_tablespaces_usedgb),2) undo_size_usedgb, round(MAX(temp_tablespaces_usedgb),2) temp_size_usedgb FROM ts_per_snap_id GROUP BY TO_CHAR(end_time, 'MM/DD/YY') ORDER BY 4 desc / spool off
<gh_stars>1-10 -- AlterIndex ALTER INDEX "profile_user_id_unique" RENAME TO "profile.user_id_unique";
ALTER TABLE items ADD COLUMN condition VARCHAR;
<gh_stars>1-10 /*Solutions to Chapter 9 exercises. ############################################################################### # chapter9_exercsies.sql # # Revision: 1.00 # Date: 7/31/2021 # Author: Alex # # Purpose: Solutions to chapter 9 exercises from "Murach's MySQL", 3rd # edition by <NAME>. # ############################################################################### */ /*Solution to exercise 9.1. Write a SELECT statement that returns these columns from the Invoices table: The invoice_total column A column that uses the ROUND function to return the invoice_total column with 1 decimal digit A column that uses the ROUND function to return the invoice_total column with no decimal digits A column that uses the TRUNCATE function to return the invoice_total column with no decimal digits */ SELECT invoice_total, ROUND(invoice_total, 1), ROUND(invoice_total), TRUNCATE(invoice_total, 0) from invoices; /*Solution to exercise 9.2. Write a SELECT statement that returns these columns from the Date_Sample table in the EX database: The start_date column A column that uses the DATE_FORMAT function to return the start_date column with its month name abbreviated and its month, day, and two-digit year separated by slashes A column that uses the DATE_FORMAT function to return the start_date column with its month and day returned as integers with no leading zeros, a two-digit year, and all date parts separated by slashes A column that uses the DATE_FORMAT function to return the start_date column with only the hours and minutes on a 12-hour clock with an am/pm indicator */ USE ex; SELECT start_date, DATE_FORMAT(start_date, '%b %m/%d/%y'), DATE_FORMAT(start_date, '%c/%e/%y'), DATE_FORMAT(start_date, '%Y-%m-%d %l:%i %p') FROM date_sample; USE ap; /*Solution to exercise 9.3. Write a SELECT statement that returns these columns from the Vendors table: The vendor_name column The vendor_name column in all capital letters The vendor_phone column A column that displays the last four digits of each phone number When you get that working right, add the columns that follow to the result set. This is more difficult because these columns require the use of functions within functions. The vendor_phone column with the parts of the number separated by dots, as in 555.555.5555 A column that displays the second word in each vendor name if there is one and blanks if there isn't */ SELECT vendor_name, UPPER(vendor_name), vendor_phone, RIGHT(vendor_phone, 4), REPLACE(REPLACE(RIGHT(vendor_phone, 13), ') ', '.'), '-', '.') AS dot_number, CASE WHEN REGEXP_LIKE(vendor_name, '^\\S+\\s(\\S.+)\\s\\S+.+$') THEN REGEXP_REPLACE(vendor_name, '^\\S+\\s(\\S+)\\s\\S+.+$', '$1') WHEN REGEXP_LIKE(vendor_name, '^\\S+\\s(\\S+)$') THEN REGEXP_REPLACE(vendor_name, '\\S+\\s(\\S+)$', '$1') ELSE '' END AS second_word FROM vendors; /*Solution to exercise 9.4. Write a SELECT statement that returns these columns from the Invoices table: The invoice_number column The invoice_date column The invoice_date column plus 30 days The payment_date column A column named days_to_pay that shows the number of days between the invoice date and the payment date The number of the invoice date's month The four-digit year of the invoice date When you have this working, add a WHERE clause that retrieves just the invoices for the month of May based on the invoice date, not the number of the invoice month. */ SELECT invoice_number, invoice_date, DATE_ADD(invoice_date, INTERVAL 30 DAY) AS due_date, payment_date, DATEDIFF(payment_date, invoice_date) AS days_to_pay, DATE_FORMAT(invoice_date, '%c') AS invoice_numeric_month, DATE_FORMAT(invoice_date, '%Y') AS invoice_year FROM invoices WHERE MONTH(invoice_date) = 5; /*Solution to exercise 9.5. Write a SELECT statement that returns these columns from the String_Sample table of the EX database: The emp_name column A column that displays each employee's first name A column that displays each employee's last name Use regular expression functions to get the first and last name. If a name contains three parts, everything after the first part should be considered part of the last name. Be sure to provide for last names with hypens and apostrophes. Hint: To include an apostrophe in a pattern, you can code a \ in front of it or you can enclose the pattern in double quotes. */ USE ex; SELECT emp_name, REGEXP_REPLACE(emp_name, '^(\\S+)\\s\\S+.+$', '$1') AS first_name, REGEXP_REPLACE(emp_name, '^(\\S+)\\s(\\S+.+)$', '$2') AS last_name FROM string_sample; USE ap; /*Solution to exercise 9.6. Write a SELECT statement that returns these columns from the Invoice table of the AP database: The invoice_number column The balance due for each invoice with a balance due greater than zero A column that uses the RANK() function to rank the balance due in descending sequence */ SELECT invoice_number, (invoice_total - payment_total - credit_total) AS balance_due, RANK() OVER (ORDER BY (invoice_total - payment_total - credit_total) DESC) AS 'rank' FROM invoices WHERE (invoice_total - payment_total - credit_total) > 0;
/* Formatted on 12-6-2018 5:11:08 PM (QP5 v5.126.903.23003) */ --DROP TABLESPACE "RHODB"; CREATE BIGFILE TABLESPACE RHODB DATAFILE '/u01/app/oracle/oradata/orcl/RHODB01.DBF' SIZE 100 M REUSE AUTOEXTEND ON NEXT 100 M MAXSIZE 33546240 M LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; ALTER DATABASE DEFAULT TABLESPACE RHODB;
<reponame>Kahiko/Growthware CREATE TABLE [ZGWSecurity].[Roles_Security_Entities_Accounts] ( [Roles_Security_Entities_SeqID] INT NOT NULL, [Account_SeqID] INT NOT NULL, [Added_By] INT CONSTRAINT [DF_ZGWSecurity_Roles_Security_Entities_Accounts_Added_By] DEFAULT ((1)) NOT NULL, [Added_Date] DATETIME CONSTRAINT [DF_ZGWSecurity_Roles_Security_Entities_Accounts_ADDED_DATE] DEFAULT (getdate()) NOT NULL, CONSTRAINT [FK_Roles_Security_Entities_Accounts_Accounts] FOREIGN KEY ([Account_SeqID]) REFERENCES [ZGWSecurity].[Accounts] ([Account_SeqID]) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT [FK_Roles_Security_Entities_Accounts_Roles_Security_Entities] FOREIGN KEY ([Roles_Security_Entities_SeqID]) REFERENCES [ZGWSecurity].[Roles_Security_Entities] ([Roles_Security_Entities_SeqID]) ON DELETE CASCADE ON UPDATE CASCADE );
<filename>Master/ThirdParty/x360ce/branches/v4.x/x360ce.Data/dbo/User Defined Types/x360ce_SummariesTableType.sql CREATE TYPE [dbo].[x360ce_SummariesTableType] AS TABLE ( [PadSettingChecksum] UNIQUEIDENTIFIER NULL, [ProductGuid] UNIQUEIDENTIFIER NULL, [ProductName] NVARCHAR (256) NULL, [FileName] NVARCHAR (128) NULL, [FileProductName] NVARCHAR (256) NULL);
<filename>apex/shared_components/lov/TIMEFRAME (4 WEEKS)/TIMEFRAME (4 WEEKS)[lovQuery].sql select disp, val as seconds from table( apex_util.get_timeframe_lov_data ) order by insert_order
DELETE FROM script_texts WHERE entry BETWEEN -1000364 AND -1000362; INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES (-1000362,'Let\'s go $N. I am ready to reach Whitereach Post.',0,0,1,0,'paoka SAY_START'), (-1000363,'Now this looks familiar. If we keep heading east, I think we can... Ahh, Wyvern on the attack!',0,0,1,0,'paoka SAY_WYVERN'), (-1000364,'Thanks a bunch... I can find my way back to Whitereach Post from here. Be sure to talk with <NAME>; perhaps you can keep him from sending me home.',0,0,1,0,'paoka SAY_COMPLETE'); DELETE FROM script_waypoint WHERE entry=10427; INSERT INTO script_waypoint VALUES (10427, 0, -5185.463, -1185.927, 45.951, 0, ''), (10427, 1, -5184.880, -1154.210, 45.035, 0, ''), (10427, 2, -5175.880, -1126.526, 43.701, 0, ''), (10427, 3, -5138.651, -1111.874, 44.024, 0, ''), (10427, 4, -5134.728, -1104.796, 47.365, 0, ''), (10427, 5, -5129.681, -1097.878, 49.449, 2500, ''), (10427, 6, -5125.303, -1080.572, 47.033, 0, ''), (10427, 7, -5146.668, -1053.694, 28.415, 0, ''), (10427, 8, -5147.463, -1027.539, 13.818, 0, ''), (10427, 9, -5139.238, -1018.889, 8.220, 0, ''), (10427, 10, -5121.168, -1013.126, -0.619, 0, ''), (10427, 11, -5091.919, -1014.205, -4.902, 0, ''), (10427, 12, -5069.240, -994.299, -4.631, 0, ''), (10427, 13, -5059.975, -944.112, -5.377, 0, ''), (10427, 14, -5013.546, -906.184, -5.490, 0, ''), (10427, 15, -4992.461, -920.983, -4.980, 5000, 'SAY_WYVERN'), (10427, 16, -4976.355, -1002.997, -5.380, 0, ''), (10427, 17, -4958.478, -1033.185, -5.433, 0, ''), (10427, 18, -4953.353, -1052.211, -10.836, 0, ''), (10427, 19, -4937.447, -1056.351, -22.139, 0, ''), (10427, 20, -4908.455, -1050.433, -33.458, 0, ''), (10427, 21, -4905.530, -1056.885, -33.722, 0, ''), (10427, 22, -4920.830, -1073.284, -45.515, 0, ''), (10427, 23, -4933.368, -1082.700, -50.186, 0, ''), (10427, 24, -4935.313, -1092.353, -52.785, 0, ''), (10427, 25, -4929.553, -1101.268, -50.637, 0, ''), (10427, 26, -4920.679, -1100.028, -51.944, 10000, 'SAY_COMPLETE'), (10427, 27, -4920.679, -1100.028, -51.944, 0, 'quest complete');
-- Copyright (c) 2020, Oracle and/or its affiliates. -- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ -- Coypright (c) 2020, Transaction Processing Performance Council -- TPC-H Query 18 - Large Volume Customer SELECT /*+ JOIN_SUFFIX(l, o, c) set_var(use_secondary_engine=forced) */ C_NAME, C_CUSTKEY, O_ORDERKEY, O_ORDERDATE, O_TOTALPRICE, SUM(L_QUANTITY) FROM CUSTOMER c, ORDERS o, LINEITEM l WHERE O_ORDERKEY IN (SELECT L_ORDERKEY FROM LINEITEM GROUP BY L_ORDERKEY HAVING SUM(L_QUANTITY) > 300) AND C_CUSTKEY = O_CUSTKEY AND O_ORDERKEY = L_ORDERKEY GROUP BY C_NAME , C_CUSTKEY , O_ORDERKEY , O_ORDERDATE , O_TOTALPRICE ORDER BY O_TOTALPRICE DESC , O_ORDERDATE LIMIT 100;
-- -- Copyright (C) 2001, 2002 MIT -- -- this is free software; you can redistribute it and/or modify it under the -- terms of the GNU General Public License as published by the Free Software -- Foundation; either version 2 of the License, or (at your option) any later -- version. -- -- this is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -- details. -- -- -- attachments -- -- @author arjun (<EMAIL>) -- @version $Id: attachments-drop.sql,v 1.3 2015/12/04 14:02:53 cvs Exp $ -- drop table attachments; drop table attachment_root_folders;
<reponame>fivetran/dbt_google_play_source select * from {{ var('stats_crashes_os_version') }}
/* * Copyright (c) 2010-2013 LabKey Corporation * * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 */ SELECT bq.*, cast(CASE WHEN bq.species = 'Marmoset' THEN round(bq.weight*0.15*60, 1) ELSE round(bq.weight*0.2*60, 1) END as numeric) AS MaxBlood, cast(CASE WHEN bq.species = 'Marmoset' THEN round((bq.weight*0.15*60) - bq.BloodLast30, 1) ELSE round((bq.weight*0.2*60) - bq.BloodLast30, 1) END AS numeric) AS AvailBlood FROM ( SELECT b.*, (select species from study.demographics d where d.id = b.id) as species, ( CONVERT ( (SELECT AVG(w.weight) AS _expr FROM study.weight w WHERE w.id=b.id AND w.date=b.lastWeighDate AND w.qcstate.publicdata = true ), double ) ) AS weight FROM ( SELECT bi.* ,timestampadd('SQL_TSI_DAY', -29, bi.date) as minDate ,timestampadd('SQL_TSI_DAY', 29, bi.date) as maxDate ,( CONVERT( (SELECT MAX(w.date) as _expr FROM study.weight w WHERE w.id = bi.id --AND w.date <= bi.date AND CAST(CAST(w.date AS DATE) AS TIMESTAMP) <= bi.date AND w.qcstate.publicdata = true ), timestamp ) ) AS lastWeighDate , ( COALESCE ( (SELECT SUM(coalesce(draws.quantity, 0)) AS _expr FROM study."Blood Draws" draws WHERE draws.id=bi.id AND draws.date >= TIMESTAMPADD('SQL_TSI_DAY', -29, bi.date) AND cast(draws.date as date) <= bi.date AND (draws.qcstate.metadata.DraftData = true OR draws.qcstate.publicdata = true) --when counting backwards, dont include this date --AND (draws.date != bi.date and draws.qcstate.label != bi.status) ), 0 ) ) AS BloodLast30 , ( COALESCE ( (SELECT SUM(coalesce(draws.quantity, 0)) AS _expr FROM study."Blood Draws" draws WHERE draws.id=bi.id AND draws.date <= TIMESTAMPADD('SQL_TSI_DAY', 29, bi.date) AND cast(draws.date as date) >= bi.date --AND draws.date BETWEEN bi.date AND TIMESTAMPADD('SQL_TSI_DAY', 29, bi.date) AND (draws.qcstate.metadata.DraftData = true OR draws.qcstate.publicdata = true) --when counting forwards, dont include this date --AND (draws.date != bi.date and draws.qcstate.label != bi.status) ), 0 ) ) AS BloodNext30 from ( SELECT b.id, --b.id.dataset.demographics.species as species, cast(b.date as date) as date, --b.lsid, --b.qcstate, b.qcstate.label as status, SUM(coalesce(b.quantity, 0)) as quantity FROM study.blood b WHERE cast(b.date as date) >= TIMESTAMPADD('SQL_TSI_DAY', -29, now()) AND (b.qcstate.metadata.DraftData = true OR b.qcstate.publicdata = true) group by b.id, cast(b.date as date), b.qcstate.label UNION ALL SELECT b.id, --b.id.dataset.demographics.species as species, TIMESTAMPADD('SQL_TSI_DAY', 30, cast(cast(b.date as date) as timestamp)) as date, --null as lsid, --null as qcstate, null as status, 0 as quantity FROM study.blood b WHERE cast(b.date as date) >= TIMESTAMPADD('SQL_TSI_DAY', -29, now()) AND (b.qcstate.metadata.DraftData = true OR b.qcstate.publicdata = true) GROUP BY b.id, cast(b.date as date) --add one row per animal, showing todays date UNION ALL SELECT b.id, --b.species, curdate() as date, --null as lsid, --null as qcstate, null as status, 0 as quantity FROM study.demographics b --WHERE b.id.status.status = 'Alive' ) bi ) b ) bq
-- create superuser CREATE USER polar_su SUPERUSER; \c - polar_su; -- create polar_superuser CREATE USER polar_psu POLAR_SUPERUSER; \c - polar_psu; -- create regular user CREATE USER polar_u; \c - polar_u; -- -- regular user create tables and triggers -- \c - polar_u; DROP TABLE IF EXISTS test_table_c3; DROP TABLE IF EXISTS test_table_c2; DROP TABLE IF EXISTS test_table_c1; DROP TABLE IF EXISTS test_table; DROP FUNCTION IF EXISTS test_procedure; CREATE TABLE test_table(id INT, pid INT, name TEXT) PARTITION BY RANGE(id); CREATE TABLE test_table_c1 PARTITION OF test_table FOR VALUES FROM (1) TO (100); CREATE TABLE test_table_c2 PARTITION OF test_table FOR VALUES FROM (100) TO (200); CREATE TABLE test_table_c3 PARTITION OF test_table FOR VALUES FROM (200) TO (300); CREATE OR REPLACE FUNCTION test_procedure() RETURNS TRIGGER AS $$ BEGIN RETURN new; END; $$ LANGUAGE plpgsql; CREATE TRIGGER test_trigger AFTER INSERT OR UPDATE OR DELETE ON test_table FOR EACH ROW EXECUTE PROCEDURE test_procedure(); -- regular user enable/disable triggers, it should fail for system trigger \c - polar_u; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- polar superuser enable/disable triggers, it should succ \c - polar_psu; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- superuser enable/disable triggers, it should succ \c - polar_su; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- -- polar_superuser create tables and triggers -- \c - polar_u; DROP TABLE IF EXISTS test_table_c3; DROP TABLE IF EXISTS test_table_c2; DROP TABLE IF EXISTS test_table_c1; DROP TABLE IF EXISTS test_table; DROP FUNCTION IF EXISTS test_procedure; \c - polar_psu; CREATE TABLE test_table(id INT, pid INT, name TEXT) PARTITION BY RANGE(id); CREATE TABLE test_table_c1 PARTITION OF test_table FOR VALUES FROM (1) TO (100); CREATE TABLE test_table_c2 PARTITION OF test_table FOR VALUES FROM (100) TO (200); CREATE TABLE test_table_c3 PARTITION OF test_table FOR VALUES FROM (200) TO (300); CREATE OR REPLACE FUNCTION test_procedure() RETURNS TRIGGER AS $$ BEGIN RETURN new; END; $$ LANGUAGE plpgsql; CREATE TRIGGER test_trigger AFTER INSERT OR UPDATE OR DELETE ON test_table FOR EACH ROW EXECUTE PROCEDURE test_procedure(); -- regular user enable/disable triggers, it should fail for table's owner check \c - polar_u; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- polar superuser enable/disable triggers, it should succ \c - polar_psu; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- superuser enable/disable triggers, it should succ \c - polar_su; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- -- polar_superuser create tables and triggers -- \c - polar_psu; DROP TABLE IF EXISTS test_table_c3; DROP TABLE IF EXISTS test_table_c2; DROP TABLE IF EXISTS test_table_c1; DROP TABLE IF EXISTS test_table; DROP FUNCTION IF EXISTS test_procedure; \c - polar_su; CREATE TABLE test_table(id INT, pid INT, name TEXT) PARTITION BY RANGE(id); CREATE TABLE test_table_c1 PARTITION OF test_table FOR VALUES FROM (1) TO (100); CREATE TABLE test_table_c2 PARTITION OF test_table FOR VALUES FROM (100) TO (200); CREATE TABLE test_table_c3 PARTITION OF test_table FOR VALUES FROM (200) TO (300); CREATE OR REPLACE FUNCTION test_procedure() RETURNS TRIGGER AS $$ BEGIN RETURN new; END; $$ LANGUAGE plpgsql; CREATE TRIGGER test_trigger AFTER INSERT OR UPDATE OR DELETE ON test_table FOR EACH ROW EXECUTE PROCEDURE test_procedure(); -- regular user enable/disable triggers, it should fail for table's owner check \c - polar_u; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- polar superuser enable/disable triggers, it should fail for table's owner check \c - polar_psu; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- superuser enable/disable triggers, it should succ \c - polar_su; ALTER TABLE test_table ENABLE ALWAYS TRIGGER test_trigger; ALTER TABLE test_table DISABLE TRIGGER test_trigger; ALTER TABLE test_table ENABLE TRIGGER test_trigger; -- -- clean up -- \c - polar_su; DROP TABLE IF EXISTS test_table_c3; DROP TABLE IF EXISTS test_table_c2; DROP TABLE IF EXISTS test_table_c1; DROP TABLE IF EXISTS test_table; DROP FUNCTION IF EXISTS test_procedure; DROP USER polar_psu; DROP USER polar_u;
3733,300,0 2522,36,0 2531,600,0 2534,120,0 14885,285,0 14921,400,0 8187,25,0 562,290,0 575,2400,0 590,1700,0 7895,259,0 628,37,0 638,1600,0 681,75,0 475,3000,0 699,2700,0 797,390,0 711,500,0 2505,700,0 750,94,0 3734,420,0 937,69,0 927,400,0 5055,70,0 3754,64,0 14961,31,0 14528,581,0 491,1300,0 511,5000,0 536,1300,0 556,600,0 565,550,0 14525,37,0 2537,75,0 2542,17,0 2543,400,0 2547,9,0 2549,60,0 14426,196,0 3755,8,0 499,12,0 3999,17,0 525,2900,0 560,47,0 600,210,0 2568,23,0 2554,1530,0 2560,1400,0 2561,2500,0 2912,78,0 2565,570,0 2576,37,0 2583,50,0 2598,32,0 2602,24,0 2603,5,0 2604,41,0 2605,31,0 2606,18,0 2612,1650,0 3727,303,0 2620,297,0 2621,56,0 8193,780,0 3945,8,0 12535,50,0 12532,71,0 3936,13,0 14427,147,0 14428,10,0 507,880,0 495,64,0 12742,440,0 12741,274,0 3834,31,0 538,200,0 2638,33,0 601,100,0 611,4000,0 3815,200,0 14825,200,0 653,45,0 2595,11,0 754,413,0 14435,500,0 786,3300,0 799,24,0 3877,400,0 14494,202,0 11239,1900,0 14826,240,0 14436,110,0 823,100,0 14924,910,0 2646,120,0 2647,16,0 2649,18,0 529,800,0 537,338,0 3960,2610,0 14920,22,0 567,4,0 14910,800,0 12536,700,0 3831,90,0 14512,285,0 603,2800,0 2654,2070,0 2655,90,0 2667,900,0 3873,72,0 614,200,0 607,2640,0 12537,144,0 3965,78,0 582,75,0 2660,31,0 570,1,0 543,1200,0 532,600,0 503,1350,0 3962,2300,0 3892,1020,0 490,39,0 2672,120,0 2673,97,0 14908,9,0 512,1386,0 14430,920,0 3772,2,0 534,6,0 13330,3900,0 587,1200,0 569,61,0 573,50,0 4138,16,0 622,200,0 629,1500,0 642,800,0 649,4900,0 660,700,0 665,400,0 674,630,0 14422,49,0 477,400,0 487,400,0 492,1000,0 505,720,0 531,15,0 624,702,0 656,500,0 2729,120,0 2733,32,0 14513,300,0 671,2720,0 2722,51,0 2724,11,0 2725,16,0 8022,6100,0 2726,110,0 14433,487,0 3747,113,0 677,100,0 684,69,0 14429,1062,0 766,200,0 2744,5,0 2736,300,0 574,1200,0 533,900,0 526,1950,0 14929,601,0 610,1800,0 658,900,0 662,2800,0 668,700,0 724,300,0 2794,9,0 770,34,0 14495,249,0 2797,11,0 3959,35,0 577,2150,0 591,4000,0 2801,25,0 2802,30,0 2804,10,0 2805,400,0 652,700,0 686,23,0 14434,5,0 3852,900,0 14432,480,0 2806,450,0 2808,29,0 3833,67,0 793,44,0 14891,1065,0 14890,660,0 890,4950,0 3866,3300,0 916,31,0 922,29,0 509,48,0 13312,25,0 762,900,0 2856,82,0 980,328,0 2859,40,0 987,1926,0 988,1053,0 992,2500,0 4123,90,0 14370,1590,0 1000,2400,0 12530,200,0 14273,64,0 4087,350,0 2868,500,0 2869,100,0 540,5,0 13505,2318,0 14431,2660,0 547,1400,0 566,900,0 606,75,0 615,22,0 3855,300,0 12543,63,0 12542,25,0 640,51,0 14386,22,0 14387,22,0 14519,82,0 14424,224,0 14423,490,0 14046,1,0 14515,10,0 2876,240,0 2877,80,0 2878,150,0 2778,1500,0 729,900,0 3898,700,0 14492,4600,0 14911,537,0 8185,18,0 8186,7,0 14425,30,0 501,800,0 14221,600,0 14220,400,0 2886,90,0 3925,1,0 13287,60,0 559,90,0 14919,19,0 14917,440,0 579,11,0 2891,900,0 4005,34,0 3933,120,0 14514,136,0 12531,1500,0 14523,140,0 3769,113,0 3957,2,0 2897,55,0 639,2800,0 14374,3100,0 3878,1700,0 651,35,0 2898,14,0 3797,81,0 2901,800,0 685,200,0 2511,1200,0 2540,696,0 2550,750,0 2494,21,0 5218,1530,0 2685,5,0 5220,150,0 7906,22,0 9391,84,0 2669,28,0 5202,41,0 2662,3,0 3828,41,0 4031,4300,0 7939,40,0 946,21,0 12738,130,0 3854,240,0 2498,13,0 2687,23,0 2545,2100,0 2500,1900,0 8140,1200,0 2520,50,0 943,6,0 2506,30,0 2719,300,0 14594,1,0 2338,3,0 4280,4,0 2339,6,0 4347,100,0 4496,47,0 3846,124,0 4075,100,0 4182,200,0 2357,20,0 2358,20,0 2359,20,0 8131,6,0 2374,8,0 2375,5,0 3840,10,0 6513,100,0 12683,24,0 4285,1,0 2388,4000,0 949,30,0 4452,100,0 4233,50,0 12626,200,0 12616,24,0 12953,34,0 13244,4,0 8177,19,0 12587,9,0 12937,36,0 12586,42,0 12941,8,0 6044,600,0 6322,6,0 4463,10,0 4464,5,0 6280,13,0 875,45,0 11537,88,0 14605,24,0 2435,13,0 2436,7,0 4472,7,0 4494,17,0 12701,100,0 904,7,0 12581,1,0 9395,50,0 9394,55,0 8098,39,0 8121,30,0
create extension pg_trgm; create extension btree_gin;
<reponame>steshaw/donkey<gh_stars>1-10 insert into address(id, employee_id, address) values (1, 1, '123 Pleasant Crescent, Rockville')
<reponame>noralebe/bootcamprepo<filename>mysql.sql --Question 1 select employees.emp_no, last_name, first_name, gender, salaries.salary from employees inner join salaries on employees.emp_no=salaries.emp_no; --Question 2 select first_name, last_name, hire from employees where (EXTRACT(year FROM hire)) in (1986); --Question 3 select a.dept_no, a.dept_name, b.emp_no, c.last_name, c.first_name, d.title, d.from_date, d.to_date from departments a, dept_emp b, employees c, titles d where a.dept_no=b.dept_no and b.emp_no=c.emp_no and c.emp_no=d.emp_no and d.title ='Manager'; --Question 4 select b.emp_no, c.last_name, c.first_name, a.dept_name from departments a, dept_emp b, employees c where a.dept_no=b.dept_no and b.emp_no=c.emp_no; --Question 5 select first_name, last_name from employees where first_name = 'Hercules' and last_name LIKE 'B%'; --Question 6 select b.emp_no, c.last_name, c.first_name, a.dept_name from departments a, dept_emp b, employees c where a.dept_no=b.dept_no and b.emp_no=c.emp_no and a.dept_name ='Sales'; --Question 7 select b.emp_no, c.last_name, c.first_name, a.dept_name from departments a, dept_emp b, employees c where a.dept_no=b.dept_no and b.emp_no=c.emp_no and a.dept_name in ('Sales','Development'); --Question 8 select last_name, count(last_name) as "last_name count" from employees group by last_name order by "last_name count" desc;
<filename>non-apex/model/DATA_TABLE/SOK_ORDER_CONTENT.sql REM INSERTING into SOK_ORDER_CONTENT SET DEFINE OFF;
<gh_stars>0 SELECT MAX(count) FROM ( SELECT SUM(A.count * B.count) count FROM ( SELECT 'q' AS docid, 'washington' AS term, 1 AS count UNION SELECT 'q' AS docid, 'taxes' AS term, 1 AS count UNION SELECT 'q' AS docid, 'treasury' as term, 1 AS count ) A, ( SELECT * FROM frequency ) B WHERE A.term = B.term GROUP BY B.docid );
CREATE TABLE IF NOT EXISTS team_match_week_stat( id SERIAL PRIMARY KEY, team_id INTEGER NOT NULL REFERENCES team, match_week_id INTEGER NOT NULL REFERENCES match_week, matches_played INTEGER NOT NULL DEFAULT 0, matches_won INTEGER NOT NULL DEFAULT 0, matches_drawn INTEGER NOT NULL DEFAULT 0, matches_lost INTEGER NOT NULL DEFAULT 0, goals_for INTEGER NOT NULL DEFAULT 0, goals_against INTEGER NOT NULL DEFAULT 0, goal_difference INTEGER NOT NULL DEFAULT 0, points INTEGER NOT NULL DEFAULT 0, form_points INTEGER NOT NULL DEFAULT 0, form_match_points VARCHAR(255) NOT NULL, ranking INTEGER NOT NULL DEFAULT 0, previous_ranking INTEGER NOT NULL DEFAULT 0, home_matches_played INTEGER NOT NULL DEFAULT 0, home_matches_won INTEGER NOT NULL DEFAULT 0, home_matches_drawn INTEGER NOT NULL DEFAULT 0, home_matches_lost INTEGER NOT NULL DEFAULT 0, home_goals_for INTEGER NOT NULL DEFAULT 0, home_goals_against INTEGER NOT NULL DEFAULT 0, home_goal_difference INTEGER NOT NULL DEFAULT 0, home_points INTEGER NOT NULL DEFAULT 0, home_ranking INTEGER NOT NULL DEFAULT 0, away_matches_played INTEGER NOT NULL DEFAULT 0, away_matches_won INTEGER NOT NULL DEFAULT 0, away_matches_drawn INTEGER NOT NULL DEFAULT 0, away_matches_lost INTEGER NOT NULL DEFAULT 0, away_goals_for INTEGER NOT NULL DEFAULT 0, away_goals_against INTEGER NOT NULL DEFAULT 0, away_goal_difference INTEGER NOT NULL DEFAULT 0, away_points INTEGER NOT NULL DEFAULT 0, away_ranking INTEGER NOT NULL DEFAULT 0, created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP WITHOUT TIME ZONE NOT NULL ); ALTER TABLE match_week ADD CONSTRAINT match_week_premier_league_leader_id_fkey FOREIGN KEY (premier_league_leader_id) REFERENCES team_match_week_stat(id);
CREATE TABLE join_reusage_photos ( reusage_id BIGINT REFERENCES reusage (id) ON DELETE CASCADE, photos VARCHAR(255), CONSTRAINT pk_join_reusage_photos PRIMARY KEY (photos) );
<reponame>PhpPlaisio/core<filename>lib/ddl/0100_create_tables.sql /*================================================================================*/ /* DDL SCRIPT */ /*================================================================================*/ /* Title : ABC Framework */ /* FileName : core.ecm */ /* Platform : MySQL 5 */ /* Version : Concept */ /* Date : woensdag 17 maart 2021 */ /*================================================================================*/ /*================================================================================*/ /* CREATE TABLES */ /*================================================================================*/ CREATE TABLE `AUT_CONFIG_CLASS` ( `ccl_id` SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, `ccl_type` VARCHAR(10) NOT NULL, `ccl_class` VARCHAR(128) NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`ccl_id`) ) engine=innodb; /* COMMENT ON COLUMN `AUT_CONFIG_CLASS`.`ccl_type` The PHP type of the parameter value. */ /* COMMENT ON COLUMN `AUT_CONFIG_CLASS`.`ccl_class` The class for showing and modifying the parameter value. */ CREATE TABLE `AUT_CONFIG` ( `cfg_id` SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, `cmp_id` SMALLINT UNSIGNED NOT NULL, `ccl_id` SMALLINT UNSIGNED NOT NULL, `cfg_mandatory` BOOL DEFAULT 1 NOT NULL, `cfg_show_to_company` BOOL DEFAULT 0 NOT NULL, `cfg_modify_by_company` BOOL DEFAULT 0 NOT NULL, `cfg_description` VARCHAR(400) NOT NULL, `cfg_label` VARCHAR(50) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`cfg_id`) ) engine=innodb; /* COMMENT ON COLUMN `AUT_CONFIG`.`cfg_mandatory` If true: this parameter must have a value. */ /* COMMENT ON COLUMN `AUT_CONFIG`.`cfg_show_to_company` If true: this parameter is visible by the administrator of the company. Otherwise this parameter is visible to the system administrator. */ /* COMMENT ON COLUMN `AUT_CONFIG`.`cfg_modify_by_company` If true: the value of this parameter can be modified by the administrator of the company. */ CREATE TABLE `AUT_CONFIG_VALUE` ( `cmp_id` SMALLINT UNSIGNED NOT NULL, `cfg_id` SMALLINT UNSIGNED NOT NULL, `cfg_value` VARCHAR(4000), CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`cmp_id`, `cfg_id`) ) engine=innodb; CREATE TABLE `AUT_FLAG` ( `rfl_id` TINYINT UNSIGNED AUTO_INCREMENT NOT NULL, `rfl_flag` INT UNSIGNED NOT NULL, `rfl_name` VARCHAR(80) NOT NULL, `rfl_function` VARCHAR(3) DEFAULT 'OR' NOT NULL, CONSTRAINT `PK_AUT_FLAG` PRIMARY KEY (`rfl_id`) ); /* COMMENT ON COLUMN `AUT_FLAG`.`rfl_flag` The flag (only a single bit can be set). */ /* COMMENT ON COLUMN `AUT_FLAG`.`rfl_name` The description of this flag. */ /* COMMENT ON COLUMN `AUT_FLAG`.`rfl_function` The bitwise function for aggregating this flag. */ CREATE TABLE `AUT_MODULE` ( `mdl_id` SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, `wrd_id` SMALLINT UNSIGNED NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`mdl_id`) ) engine=innodb; CREATE TABLE `AUT_FUNCTIONALITY` ( `fun_id` SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, `mdl_id` SMALLINT UNSIGNED NOT NULL, `wrd_id` SMALLINT UNSIGNED NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`fun_id`) ) engine=innodb; CREATE TABLE `AUT_MODULE_COMPANY` ( `cmp_id` SMALLINT UNSIGNED NOT NULL, `mdl_id` SMALLINT UNSIGNED NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`cmp_id`, `mdl_id`), CONSTRAINT `SECONDARY` UNIQUE (`mdl_id`, `cmp_id`) ) engine=innodb; CREATE TABLE `AUT_PAGE_TAB` ( `ptb_id` TINYINT UNSIGNED AUTO_INCREMENT NOT NULL, `wrd_id` SMALLINT UNSIGNED NOT NULL, `ptb_label` VARCHAR(30) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`ptb_id`) ) engine=innodb; CREATE TABLE `AUT_PAGE` ( `pag_id` SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, `pag_id_org` SMALLINT UNSIGNED, `ptb_id` TINYINT UNSIGNED, `wrd_id` SMALLINT UNSIGNED NOT NULL, `pag_alias` VARCHAR(32), `pag_class` VARCHAR(128) NOT NULL, `pag_label` VARCHAR(128) CHARACTER SET ascii COLLATE ascii_general_ci, `pag_weight` INT, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`pag_id`) ); /* COMMENT ON COLUMN `AUT_PAGE`.`pag_alias` The URL alias of this page. */ /* COMMENT ON COLUMN `AUT_PAGE`.`pag_class` The PHP class that generates this page. */ /* COMMENT ON COLUMN `AUT_PAGE`.`pag_label` The PHP constant name of this page. */ /* COMMENT ON COLUMN `AUT_PAGE`.`pag_weight` The weight for sorting. */ CREATE TABLE `AUT_PAG_FUN` ( `pag_id` SMALLINT UNSIGNED NOT NULL, `fun_id` SMALLINT UNSIGNED NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`fun_id`, `pag_id`), CONSTRAINT `SECONDARY` UNIQUE (`pag_id`, `fun_id`) ) engine=innodb; CREATE TABLE `AUT_PAGE_COMPANY` ( `pag_id` SMALLINT UNSIGNED NOT NULL, `cmp_id` SMALLINT UNSIGNED NOT NULL, `pag_class` VARCHAR(128) NOT NULL, CONSTRAINT `PK_AUT_PAGE_COMPANY` PRIMARY KEY (`pag_id`, `cmp_id`) ) engine=innodb; CREATE TABLE `AUT_PRO_PAG` ( `pag_id` SMALLINT UNSIGNED NOT NULL, `pro_id` SMALLINT UNSIGNED NOT NULL, CONSTRAINT `PK_AUT_PRO_PAG` PRIMARY KEY (`pro_id`, `pag_id`) ); CREATE TABLE `AUT_ROLE_GROUP` ( `rlg_id` SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, `wrd_id` SMALLINT UNSIGNED NOT NULL, `rlg_weight` SMALLINT UNSIGNED NOT NULL, `rlg_label` VARCHAR(50) CHARACTER SET ascii COLLATE ascii_general_ci, CONSTRAINT `PK_AUT_ROLE_GROUP` PRIMARY KEY (`rlg_id`) ); /* COMMENT ON COLUMN `AUT_ROLE_GROUP`.`wrd_id` The name of the role group. */ /* COMMENT ON COLUMN `AUT_ROLE_GROUP`.`rlg_weight` The weight of the role group for sorting. */ CREATE TABLE `AUT_ROLE` ( `rol_id` SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, `cmp_id` SMALLINT UNSIGNED NOT NULL, `rlg_id` SMALLINT UNSIGNED NOT NULL, `rol_weight` SMALLINT NOT NULL, `rol_name` VARCHAR(32) NOT NULL, `rol_label` VARCHAR(50) CHARACTER SET ascii COLLATE ascii_general_ci, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`rol_id`) ); /* COMMENT ON COLUMN `AUT_ROLE`.`rol_weight` The weight for sorting. */ /* COMMENT ON COLUMN `AUT_ROLE`.`rol_name` The name or description of this role. */ CREATE TABLE `AUT_PRO_ROL` ( `cmp_id` SMALLINT UNSIGNED NOT NULL, `pro_id` SMALLINT UNSIGNED NOT NULL, `rol_id` SMALLINT UNSIGNED NOT NULL, CONSTRAINT `PK_AUT_PRO_ROL` PRIMARY KEY (`pro_id`, `rol_id`) ); CREATE TABLE `AUT_ROL_FLG` ( `rfl_id` TINYINT UNSIGNED NOT NULL, `rol_id` SMALLINT UNSIGNED NOT NULL, CONSTRAINT `PK_AUT_ROL_FLG` PRIMARY KEY (`rfl_id`, `rol_id`) ); CREATE TABLE `AUT_ROL_FUN` ( `cmp_id` SMALLINT UNSIGNED NOT NULL, `fun_id` SMALLINT UNSIGNED NOT NULL, `rol_id` SMALLINT UNSIGNED NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`rol_id`, `fun_id`), CONSTRAINT `SECONDARY` UNIQUE (`fun_id`, `rol_id`) ) engine=innodb; CREATE TABLE `AUT_USR_ROL` ( `cmp_id` SMALLINT UNSIGNED NOT NULL, `usr_id` INTEGER UNSIGNED NOT NULL, `rol_id` SMALLINT UNSIGNED NOT NULL, `aur_date_start` DATE NOT NULL, `aur_date_stop` DATE NOT NULL, CONSTRAINT `PRIMARY_KEY` PRIMARY KEY (`usr_id`, `rol_id`), CONSTRAINT `SECONDAY` UNIQUE (`rol_id`, `usr_id`) ); /*================================================================================*/ /* CREATE INDEXES */ /*================================================================================*/ CREATE INDEX `IX_AUT_CONFIG1` ON `AUT_CONFIG` (`cmp_id`); CREATE INDEX `IX_AUT_CONFIG2` ON `AUT_CONFIG` (`ccl_id`); CREATE INDEX `CFG_ID` ON `AUT_CONFIG_VALUE` (`cfg_id`); CREATE INDEX `IX_AUT_MODULE1` ON `AUT_MODULE` (`wrd_id`); CREATE INDEX `IX_AUT_FUNCTIONALITY1` ON `AUT_FUNCTIONALITY` (`mdl_id`); CREATE INDEX `IX_AUT_FUNCTIONALITY2` ON `AUT_FUNCTIONALITY` (`wrd_id`); CREATE INDEX `IX_AUT_MODULE_COMPANY1` ON `AUT_MODULE_COMPANY` (`mdl_id`); CREATE INDEX `IX_AUT_MODULE_COMPANY2` ON `AUT_MODULE_COMPANY` (`cmp_id`); CREATE INDEX `IX_AUT_PAGE_TAB1` ON `AUT_PAGE_TAB` (`wrd_id`); CREATE INDEX `IX_AUT_PAGE1` ON `AUT_PAGE` (`ptb_id`); CREATE INDEX `IX_AUT_PAGE2` ON `AUT_PAGE` (`pag_id_org`); CREATE INDEX `wrd_id` ON `AUT_PAGE` (`wrd_id`); CREATE INDEX `IX_AUT_PAGE_COMPANY1` ON `AUT_PAGE_COMPANY` (`pag_id`); CREATE INDEX `IX_AUT_PAGE_COMPANY2` ON `AUT_PAGE_COMPANY` (`cmp_id`); CREATE INDEX `IX_AUT_PRO_PAG1` ON `AUT_PRO_PAG` (`pag_id`, `pro_id`); CREATE INDEX `IX_FK_AUT_ROLE_GROUP1` ON `AUT_ROLE_GROUP` (`wrd_id`); CREATE INDEX `cmp_id` ON `AUT_ROLE` (`cmp_id`); CREATE INDEX `IX_FK_AUT_ROLE` ON `AUT_ROLE` (`rlg_id`); CREATE UNIQUE INDEX `IX_AUT_PRO_ROL1` ON `AUT_PRO_ROL` (`rol_id`, `pro_id`); CREATE INDEX `IX_AUT_PRO_ROL3` ON `AUT_PRO_ROL` (`cmp_id`); CREATE UNIQUE INDEX `IX_AUT_ROL_FLG1` ON `AUT_ROL_FLG` (`rol_id`, `rfl_id`); CREATE INDEX `IX_AUT_ROL_FUN3` ON `AUT_ROL_FUN` (`cmp_id`); CREATE INDEX `cmp_id` ON `AUT_USR_ROL` (`cmp_id`); /*================================================================================*/ /* CREATE FOREIGN KEYS */ /*================================================================================*/ ALTER TABLE `AUT_CONFIG` ADD CONSTRAINT `FK_AUT_CONFIG_ABC_AUTH_COMPANY` FOREIGN KEY (`cmp_id`) REFERENCES `ABC_AUTH_COMPANY` (`cmp_id`); ALTER TABLE `AUT_CONFIG` ADD CONSTRAINT `FK_AUT_CONFIG_AUT_CONFIG_CLASS` FOREIGN KEY (`ccl_id`) REFERENCES `AUT_CONFIG_CLASS` (`ccl_id`); ALTER TABLE `AUT_CONFIG_VALUE` ADD CONSTRAINT `AUT_CONFIG_VALUE_ibfk_2` FOREIGN KEY (`cfg_id`) REFERENCES `AUT_CONFIG` (`cfg_id`); ALTER TABLE `AUT_MODULE` ADD CONSTRAINT `FK_AUT_MODULE_ABC_BABEL_WORD` FOREIGN KEY (`wrd_id`) REFERENCES `ABC_BABEL_WORD` (`wrd_id`); ALTER TABLE `AUT_FUNCTIONALITY` ADD CONSTRAINT `FK_AUT_FUNCTIONALITY_ABC_BABEL_WORD` FOREIGN KEY (`wrd_id`) REFERENCES `ABC_BABEL_WORD` (`wrd_id`); ALTER TABLE `AUT_FUNCTIONALITY` ADD CONSTRAINT `FK_AUT_FUNCTIONALITY_AUT_MODULE` FOREIGN KEY (`mdl_id`) REFERENCES `AUT_MODULE` (`mdl_id`); ALTER TABLE `AUT_MODULE_COMPANY` ADD CONSTRAINT `FK_AUT_MODULE_COMPANY_ABC_AUTH_COMPANY` FOREIGN KEY (`cmp_id`) REFERENCES `ABC_AUTH_COMPANY` (`cmp_id`); ALTER TABLE `AUT_MODULE_COMPANY` ADD CONSTRAINT `FK_AUT_MODULE_COMPANY_AUT_MODULE` FOREIGN KEY (`mdl_id`) REFERENCES `AUT_MODULE` (`mdl_id`); ALTER TABLE `AUT_PAGE_TAB` ADD CONSTRAINT `FK_AUT_PAGE_TAB_ABC_BABEL_WORD` FOREIGN KEY (`wrd_id`) REFERENCES `ABC_BABEL_WORD` (`wrd_id`); ALTER TABLE `AUT_PAGE` ADD CONSTRAINT `FK_AUT_PAGE_ABC_BABEL_WORD` FOREIGN KEY (`wrd_id`) REFERENCES `ABC_BABEL_WORD` (`wrd_id`) ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE `AUT_PAGE` ADD CONSTRAINT `FK_AUT_PAGE_AUT_PAGE` FOREIGN KEY (`pag_id_org`) REFERENCES `AUT_PAGE` (`pag_id`); ALTER TABLE `AUT_PAGE` ADD CONSTRAINT `FK_AUT_PAGE_AUT_PAGE_TAB` FOREIGN KEY (`ptb_id`) REFERENCES `AUT_PAGE_TAB` (`ptb_id`); ALTER TABLE `AUT_PAG_FUN` ADD CONSTRAINT `FK_AUT_PAG_FUN_AUT_FUNCTIONALITY` FOREIGN KEY (`fun_id`) REFERENCES `AUT_FUNCTIONALITY` (`fun_id`); ALTER TABLE `AUT_PAG_FUN` ADD CONSTRAINT `FK_AUT_PAG_FUN_AUT_PAGE` FOREIGN KEY (`pag_id`) REFERENCES `AUT_PAGE` (`pag_id`); ALTER TABLE `AUT_PAGE_COMPANY` ADD CONSTRAINT `FK_AUT_PAGE_COMPANY_ABC_AUTH_COMPANY` FOREIGN KEY (`cmp_id`) REFERENCES `ABC_AUTH_COMPANY` (`cmp_id`); ALTER TABLE `AUT_PAGE_COMPANY` ADD CONSTRAINT `FK_AUT_PAGE_COMPANY_AUT_PAGE` FOREIGN KEY (`pag_id`) REFERENCES `AUT_PAGE` (`pag_id`); ALTER TABLE `AUT_PRO_PAG` ADD CONSTRAINT `FK_AUT_PRO_PAG_ABC_AUTH_PROFILE` FOREIGN KEY (`pro_id`) REFERENCES `ABC_AUTH_PROFILE` (`pro_id`) ON DELETE CASCADE; ALTER TABLE `AUT_PRO_PAG` ADD CONSTRAINT `FK_AUT_PRO_PAG_AUT_PAGE` FOREIGN KEY (`pag_id`) REFERENCES `AUT_PAGE` (`pag_id`); ALTER TABLE `AUT_ROLE_GROUP` ADD CONSTRAINT `FK_AUT_ROLE_GROUP_ABC_BABEL_WORD` FOREIGN KEY (`wrd_id`) REFERENCES `ABC_BABEL_WORD` (`wrd_id`); ALTER TABLE `AUT_ROLE` ADD CONSTRAINT `FK_AUT_ROLE_ABC_AUTH_COMPANY` FOREIGN KEY (`cmp_id`) REFERENCES `ABC_AUTH_COMPANY` (`cmp_id`) ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE `AUT_ROLE` ADD CONSTRAINT `FK_AUT_ROLE_AUT_ROLE_GROUP` FOREIGN KEY (`rlg_id`) REFERENCES `AUT_ROLE_GROUP` (`rlg_id`); ALTER TABLE `AUT_PRO_ROL` ADD CONSTRAINT `FK_AUT_PRO_ROL_ABC_AUTH_COMPANY` FOREIGN KEY (`cmp_id`) REFERENCES `ABC_AUTH_COMPANY` (`cmp_id`); ALTER TABLE `AUT_PRO_ROL` ADD CONSTRAINT `FK_AUT_PRO_ROL_ABC_AUTH_PROFILE` FOREIGN KEY (`pro_id`) REFERENCES `ABC_AUTH_PROFILE` (`pro_id`) ON DELETE CASCADE; ALTER TABLE `AUT_PRO_ROL` ADD CONSTRAINT `FK_AUT_PRO_ROL_AUT_ROLE` FOREIGN KEY (`rol_id`) REFERENCES `AUT_ROLE` (`rol_id`); ALTER TABLE `AUT_ROL_FLG` ADD CONSTRAINT `FK_AUT_ROL_FLG_AUT_FLAG` FOREIGN KEY (`rfl_id`) REFERENCES `AUT_FLAG` (`rfl_id`); ALTER TABLE `AUT_ROL_FLG` ADD CONSTRAINT `FK_AUT_ROL_FLG_AUT_ROLE` FOREIGN KEY (`rol_id`) REFERENCES `AUT_ROLE` (`rol_id`); ALTER TABLE `AUT_ROL_FUN` ADD CONSTRAINT `FK_AUT_ROL_FUN_ABC_AUTH_COMPANY` FOREIGN KEY (`cmp_id`) REFERENCES `ABC_AUTH_COMPANY` (`cmp_id`); ALTER TABLE `AUT_ROL_FUN` ADD CONSTRAINT `FK_AUT_ROL_FUN_AUT_FUNCTIONALITY` FOREIGN KEY (`fun_id`) REFERENCES `AUT_FUNCTIONALITY` (`fun_id`); ALTER TABLE `AUT_ROL_FUN` ADD CONSTRAINT `FK_AUT_ROL_FUN_AUT_ROLE` FOREIGN KEY (`rol_id`) REFERENCES `AUT_ROLE` (`rol_id`); ALTER TABLE `AUT_USR_ROL` ADD CONSTRAINT `FK_AUT_USR_ROL_ABC_AUTH_COMPANY` FOREIGN KEY (`cmp_id`) REFERENCES `ABC_AUTH_COMPANY` (`cmp_id`) ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE `AUT_USR_ROL` ADD CONSTRAINT `FK_AUT_USR_ROL_ABC_AUTH_USER` FOREIGN KEY (`usr_id`) REFERENCES `ABC_AUTH_USER` (`usr_id`) ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE `AUT_USR_ROL` ADD CONSTRAINT `AUT_USR_ROL_ibfk_3` FOREIGN KEY (`rol_id`) REFERENCES `AUT_ROLE` (`rol_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
<gh_stars>1-10 CREATE TABLE Subjects ( SubjectID INT PRIMARY KEY IDENTITY, SubjectName VARCHAR(50) NOT NULL ) CREATE TABLE Majors ( MajorID INT PRIMARY KEY IDENTITY, [Name] VARCHAR(50) NOT NULL ) CREATE TABLE Students ( StudentID INT PRIMARY KEY IDENTITY, StudentNumber INT NOT NULL, StudentName VARCHAR(50) NOT NULL, MajorID INT CONSTRAINT FK_Students_Major_ID FOREIGN KEY (MajorID) REFERENCES Majors(MajorID) ) CREATE TABLE Payments ( PaymentsID INT PRIMARY KEY IDENTITY, PaymentDate DATE NOT NULL, PaymentAmount DECIMAL (15, 2) NOT NULL, StudentID INT CONSTRAINT FK_Payments_Student_ID FOREIGN KEY (StudentID) REFERENCES Students(StudentID) ) CREATE TABLE Agenda ( StudentID INT , SubjectID INT, CONSTRAINT FK_Agend_Student_ID FOREIGN KEY (StudentID) REFERENCES Students(StudentID), CONSTRAINT FK_Agend_Subject_ID FOREIGN KEY (SubjectID) REFERENCES Subjects(SubjectID), PRIMARY KEY (StudentID, SubjectID) )
<reponame>mooya/Philips-Hue-Php-control -- -- Tabelstructuur voor tabel `groups` -- CREATE TABLE IF NOT EXISTS `groups` ( `group_id` int(11) NOT NULL AUTO_INCREMENT, `group_name` varchar(255) NOT NULL, `group_order` int(11) NOT NULL, `timestamp` int(11) NOT NULL, PRIMARY KEY (`group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Tabelstructuur voor tabel `group_members` -- CREATE TABLE IF NOT EXISTS `group_members` ( `id` int(11) NOT NULL AUTO_INCREMENT, `group_id` int(11) NOT NULL, `light_id` int(11) NOT NULL, `light_order` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `group_id` (`group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Tabelstructuur voor tabel `scenes` -- CREATE TABLE IF NOT EXISTS `scenes` ( `scene_id` int(11) NOT NULL AUTO_INCREMENT, `page_id` int(11) NOT NULL, `scene_name` varchar(255) NOT NULL, `scene_image` varchar(255) NOT NULL, `scene_order` int(11) NOT NULL, `timestamp` int(11) NOT NULL, PRIMARY KEY (`scene_id`), KEY `page_id` (`page_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Tabelstructuur voor tabel `scene_pages` -- CREATE TABLE IF NOT EXISTS `scene_pages` ( `page_id` int(11) NOT NULL AUTO_INCREMENT, `page_name` varchar(255) NOT NULL, `page_order` int(11) NOT NULL, PRIMARY KEY (`page_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Tabelstructuur voor tabel `scene_settings` -- CREATE TABLE IF NOT EXISTS `scene_settings` ( `id` int(11) NOT NULL AUTO_INCREMENT, `scene_id` int(11) NOT NULL, `light_id` int(11) NOT NULL, `state` set('on','off') NOT NULL, `colormode` set('hs','xy','ct') NOT NULL, `brightness` int(11) NOT NULL, `hue` int(11) NOT NULL, `saturation` int(11) NOT NULL, `color_temp` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `scene_id` (`scene_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
<filename>db/akupuntur_new.sql -- phpMyAdmin SQL Dump -- version 4.7.9 -- https://www.phpmyadmin.net/ -- -- Host: 1172.16.31.10 -- Generation Time: Nov 28, 2020 at 09:37 AM -- Server version: 10.1.31-MariaDB -- PHP Version: 7.2.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: `akupuntur` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `id_admin` int(11) NOT NULL, `id_user` int(11) NOT NULL, `alamat` varchar(50) NOT NULL, `telepon` int(11) NOT NULL, `bank` varchar(30) NOT NULL, `unit_bank` varchar(30) NOT NULL, `no_rekening` int(11) NOT NULL, `profile` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id_admin`, `id_user`, `alamat`, `telepon`, `bank`, `unit_bank`, `no_rekening`, `profile`) VALUES (1, 1, 'Jl. <NAME> Raya A1 F10', 2147483647, 'BCA', 'Sawojajar-Malang', 4567, ''); -- -------------------------------------------------------- -- -- Table structure for table `customer` -- CREATE TABLE `customer` ( `id_customer` int(11) NOT NULL, `id_user` int(11) NOT NULL, `alamat` varchar(50) NOT NULL, `telepon` int(11) NOT NULL, `bank` varchar(30) NOT NULL, `unit_bank` varchar(30) NOT NULL, `no_rekening` int(11) NOT NULL, `profile` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `customer` -- INSERT INTO `customer` (`id_customer`, `id_user`, `alamat`, `telepon`, `bank`, `unit_bank`, `no_rekening`, `profile`) VALUES (6, 8, 'Jl. Hasanudin No 5 Batu', 2147483647, 'BRI', 'Punten-Batu', 12345678, 'download_(1).jpg'); -- -------------------------------------------------------- -- -- Table structure for table `detail_layanan` -- CREATE TABLE `detail_layanan` ( `id_detailLayanan` int(11) NOT NULL, `id_terapis` int(11) NOT NULL, `id_layanan` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `detail_layanan` -- INSERT INTO `detail_layanan` (`id_detailLayanan`, `id_terapis`, `id_layanan`) VALUES (68, 2, 2), (71, 3, 1), (72, 3, 2); -- -------------------------------------------------------- -- -- Table structure for table `detail_transaksi` -- CREATE TABLE `detail_transaksi` ( `id_detail` int(11) NOT NULL, `no_transaksi` int(11) NOT NULL, `id_layanan` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `layanan` -- CREATE TABLE `layanan` ( `id_layanan` int(11) NOT NULL, `jenis` varchar(50) NOT NULL, `nama` varchar(50) NOT NULL, `durasi` varchar(30) NOT NULL, `harga` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `layanan` -- INSERT INTO `layanan` (`id_layanan`, `jenis`, `nama`, `durasi`, `harga`) VALUES (1, 'Akupuntur Tubuh', 'Bekam Badan', '45 menit', 100000), (2, 'Akupuntur Tubuh', 'Lulur Badan', '1 Jam', 60000), (3, 'Perawatan Wajah', 'Facial Bio', '1 jam', 90000); -- -------------------------------------------------------- -- -- Table structure for table `terapis` -- CREATE TABLE `terapis` ( `id_terapis` int(11) NOT NULL, `id_user` int(11) NOT NULL, `alamat` varchar(50) NOT NULL, `telepon` int(11) NOT NULL, `bank` varchar(30) NOT NULL, `unit_bank` varchar(30) NOT NULL, `no_rekening` int(11) NOT NULL, `ktp` varchar(50) NOT NULL, `selfie_ktp` varchar(50) NOT NULL, `profile` varchar(50) NOT NULL, `status` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `terapis` -- INSERT INTO `terapis` (`id_terapis`, `id_user`, `alamat`, `telepon`, `bank`, `unit_bank`, `no_rekening`, `ktp`, `selfie_ktp`, `profile`, `status`) VALUES (2, 9, 'Jl. Hasanudin No 10 Batu', 2147483647, 'Mandiri', 'Ngagglik-Batu', 2147483647, '', '', '', 1), (3, 10, 'Jl. <NAME> Raya A1 F11', 45678, 'BRI', 'Sawojajar-Malang', 4567890, '', '', '', 1); -- -------------------------------------------------------- -- -- Table structure for table `transaksi` -- CREATE TABLE `transaksi` ( `no_transaksi` int(11) NOT NULL, `id_customer` int(11) NOT NULL, `id_terapis` int(11) NOT NULL, `tanggal` date NOT NULL, `total_harga` int(11) NOT NULL, `bukti_pembayaran` varchar(50) NOT NULL, `status_pembayaran` tinyint(1) NOT NULL, `status_pemesanan` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id_user` int(11) NOT NULL, `nama` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `hak_akses` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id_user`, `nama`, `email`, `password`, `hak_akses`) VALUES (1, 'Admin', '<EMAIL>', '<PASSWORD>', '<PASSWORD>'), (8, '<NAME>', '<EMAIL>', '<PASSWORD>alotussa', 'Customer'), (9, '<NAME>', '<EMAIL>', '<PASSWORD>', 'Terapis'), (10, '<NAME>', '<EMAIL>', 'sitibadriah', 'Terapis'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`id_admin`), ADD KEY `IdUser1` (`id_user`); -- -- Indexes for table `customer` -- ALTER TABLE `customer` ADD PRIMARY KEY (`id_customer`), ADD KEY `IdUser3` (`id_user`); -- -- Indexes for table `detail_layanan` -- ALTER TABLE `detail_layanan` ADD PRIMARY KEY (`id_detailLayanan`), ADD KEY `IdLayanan2` (`id_layanan`), ADD KEY `IdTerapis2` (`id_terapis`); -- -- Indexes for table `detail_transaksi` -- ALTER TABLE `detail_transaksi` ADD PRIMARY KEY (`id_detail`), ADD KEY `IdLayanan` (`id_layanan`), ADD KEY `IdTransaksi` (`no_transaksi`); -- -- Indexes for table `layanan` -- ALTER TABLE `layanan` ADD PRIMARY KEY (`id_layanan`); -- -- Indexes for table `terapis` -- ALTER TABLE `terapis` ADD PRIMARY KEY (`id_terapis`), ADD KEY `IdUser2` (`id_user`); -- -- Indexes for table `transaksi` -- ALTER TABLE `transaksi` ADD PRIMARY KEY (`no_transaksi`), ADD KEY `IdCostumer` (`id_customer`), ADD KEY `IdTerapis` (`id_terapis`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id_user`), ADD UNIQUE KEY `email` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin` -- ALTER TABLE `admin` MODIFY `id_admin` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `customer` -- ALTER TABLE `customer` MODIFY `id_customer` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `detail_layanan` -- ALTER TABLE `detail_layanan` MODIFY `id_detailLayanan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=73; -- -- AUTO_INCREMENT for table `detail_transaksi` -- ALTER TABLE `detail_transaksi` MODIFY `id_detail` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `layanan` -- ALTER TABLE `layanan` MODIFY `id_layanan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `terapis` -- ALTER TABLE `terapis` MODIFY `id_terapis` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `transaksi` -- ALTER TABLE `transaksi` MODIFY `no_transaksi` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- Constraints for dumped tables -- -- -- Constraints for table `admin` -- ALTER TABLE `admin` ADD CONSTRAINT `IdUser1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`); -- -- Constraints for table `customer` -- ALTER TABLE `customer` ADD CONSTRAINT `IdUser3` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`); -- -- Constraints for table `detail_layanan` -- ALTER TABLE `detail_layanan` ADD CONSTRAINT `IdLayanan2` FOREIGN KEY (`id_layanan`) REFERENCES `layanan` (`id_layanan`), ADD CONSTRAINT `IdTerapis2` FOREIGN KEY (`id_terapis`) REFERENCES `terapis` (`id_terapis`); -- -- Constraints for table `detail_transaksi` -- ALTER TABLE `detail_transaksi` ADD CONSTRAINT `IdLayanan` FOREIGN KEY (`id_layanan`) REFERENCES `layanan` (`id_layanan`), ADD CONSTRAINT `IdTransaksi` FOREIGN KEY (`no_transaksi`) REFERENCES `transaksi` (`no_transaksi`); -- -- Constraints for table `terapis` -- ALTER TABLE `terapis` ADD CONSTRAINT `IdUser2` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`); -- -- Constraints for table `transaksi` -- ALTER TABLE `transaksi` ADD CONSTRAINT `IdCostumer` FOREIGN KEY (`id_customer`) REFERENCES `customer` (`id_customer`), ADD CONSTRAINT `IdTerapis` FOREIGN KEY (`id_terapis`) REFERENCES `terapis` (`id_terapis`); 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 */;
-- ifs-8314 deleting templates from db, as we now don't use the db for templates update competition_type set template_competition_id = NULL; delete from form_input_validator where form_input_id in ( select fi.id from form_input fi join question q on q.id = fi.question_id where q.competition_id in (select id from competition where template = 1) ); delete from appendix_file_types where form_input_id in ( select fi.id from form_input fi join question q on q.id = fi.question_id where q.competition_id in (select id from competition where template = 1) ); delete from multiple_choice_option where form_input_id in ( select fi.id from form_input fi join question q on q.id = fi.question_id where q.competition_id in (select id from competition where template = 1) ); delete from guidance_row where form_input_id in ( select fi.id from form_input fi join question q on q.id = fi.question_id where q.competition_id in (select id from competition where template = 1) ); SET foreign_key_checks = 0; delete from form_input where question_id in ( select q.id from question q join section s on s.id = q.section_id where s.competition_id in (select id from competition where template = 1) ); delete from form_input_validator where form_input_id not in (select id from form_input); SET foreign_key_checks = 1; delete from question where section_id in ( select id from section where competition_id in (select id from competition where template = 1) ); SET foreign_key_checks = 0; delete from section where competition_id in ( select id from competition where template = 1 ); SET foreign_key_checks = 1; delete from document_config_file_type where document_config_id in ( select id from document_config where competition_id in (select id from competition where template = 1) ); delete from document_config where competition_id in (select id from competition where template = 1); delete from competition_finance_row_types where competition_id in (select id from competition where template = 1); delete from project_stages where competition_id in (select id from competition where template = 1); delete from grant_claim_maximum_competition where competition_id in (select id from competition where template = 1); delete from grant_claim_maximum where id not in (select grant_claim_maximum_id from grant_claim_maximum_competition); SET foreign_key_checks = 0; delete from competition_application_config where id in (select competition_application_config_id from competition where template = 1); delete from competition_assessment_config where id in (select competition_assessment_config_id from competition where template = 1); delete from competition_organisation_config where id in (select competition_organisation_config_id from competition where template = 1); delete from competition where template = 1; SET foreign_key_checks = 1;
<filename>sql/create_submit_tbl.sql WITH m AS ( SELECT channel_id, FORMAT_TIMESTAMP("%F %T", ts, "Asia/Seoul") ts, user_id, parent_user_id, text, -- # TODO : 수정 CASE WHEN due_ts = '2020-11-15 15:00:00' THEN 1 WHEN due_ts = '2020-11-29 15:00:00' THEN 2 WHEN due_ts = '2020-12-13 15:00:00' THEN 3 WHEN due_ts = '2020-12-27 15:00:00' THEN 4 WHEN due_ts = '2021-01-10 15:00:00' THEN 5 WHEN due_ts = '2021-01-24 15:00:00' THEN 6 WHEN due_ts = '2021-02-07 15:00:00' THEN 7 WHEN due_ts = '2021-02-21 15:00:00' THEN 8 WHEN due_ts = '2021-03-07 15:00:00' THEN 9 WHEN due_ts = '2021-03-21 15:00:00' THEN 10 WHEN due_ts = '2021-04-04 15:00:00' THEN 11 WHEN due_ts = '2021-04-18 15:00:00' THEN 12 WHEN due_ts = '2021-05-02 15:00:00' THEN 13 END round, CASE WHEN parent_user_id IS NULL AND ts < due_ts AND reaction.name = 'submit' THEN 'submit' WHEN parent_user_id IS NULL AND ts < due_ts AND reaction.name = 'pass' THEN 'pass' WHEN parent_user_id IS NOT NULL AND ts < due_ts AND reaction.name = 'feedback' THEN 'feedback' END reaction, CASE WHEN reaction.name = 'submit' THEN CONCAT("https://geultto5.slack.com/archives/", channel_id, "/p", UNIX_MICROS(ts), "/") WHEN reaction.name = 'feedback' THEN CONCAT("https://geultto5.slack.com/archives/", channel_id, "/p", UNIX_MICROS(thread_ts), "/") END m_url, REGEXP_EXTRACT_ALL(REGEXP_REPLACE(IF(reaction.name = 'submit', text, null), "\\|.+>", ">"), "<.+>") post_url FROM `geultto_5th_prod.message` , UNNEST(reactions) reaction WHERE reaction.name IN ('pass', 'feedback', 'submit') AND ts < insert_ts ) SELECT u.channel_id, u.user_id, u.channel_name, u.user_name, round, m.ts, m.reaction, m.parent_user_id, m.m_url, m.post_url, m.text FROM `geultto_5th_prod.user` u, UNNEST([1,2,3,4,5,6,7,8,9,10,11,12,13]) round LEFT JOIN m ON u.user_id = m.user_id AND u.channel_id = m.channel_id AND round = m.round ;
-- file:time.sql ln:14 expect:true INSERT INTO TIME_TBL VALUES ('23:59')
INSERT INTO standard_baseline ( hqt_version, season, mgmt_zone, baseline) VALUES(?, ?, ?, ?)
<filename>config/libraries/gointerop_greeting_v0_0_1/gointerop-greeting.cql library "gointerop-greeting" version '0.0.1' using FHIR version '4.0.0' include "FHIRHelpers" version '4.0.0' called FHIRHelpers context Patient define "InPopulation": null define "Recommendation": if "InPopulation" then 'Seja bem vindo!' else null define "Rationale": if "InPopulation" then 'Essa é uma típica notificação de CDS Hooks da GOInterop! Vamos prover apoio à decisão assistencial (prescrição médica, procedimentos, etc) e back-office (faturamento, elegibilidade e recurso de glosa).' else null define "Errors": null
------------------------------------------------------------------------------- -- employee info ------------------------------------------------------------------------------- CREATE TABLE EMPLOYEE_INFO( ID BIGINT NOT NULL, NAME VARCHAR(200), CREATE_TIME DATETIME, STATUS VARCHAR(50), DEPARTMENT VARCHAR(50), COMPANY VARCHAR(50), POSITION VARCHAR(50), TENANT_ID VARCHAR(64), CONSTRAINT PK_EMPLOYEE_INFO PRIMARY KEY(ID) ) ENGINE=INNODB CHARSET=UTF8;
<filename>sql/variant-level-missingness.sql # Compute the ratio no-calls for each variant. # Note: this query does not account for samples for which no record is reported at a given position. SELECT reference_name, start, END, reference_bases, alternate_bases, no_calls, all_calls, (no_calls/all_calls) AS missingness_rate FROM ( SELECT reference_name, start, END, reference_bases, GROUP_CONCAT(alternate_bases) WITHIN RECORD AS alternate_bases, SUM(call.genotype == -1) WITHIN RECORD AS no_calls, COUNT(call.genotype) WITHIN RECORD AS all_calls, FROM [_THE_EXPANDED_TABLE_] # Optionally add clause here to limit the query to a particular # region of the genome. #_WHERE_ ) # Optionally add a clause here to sort and limit the results. #_ORDER_BY_
<reponame>thufv/pspec-sql<gh_stars>1-10 SELECT ca_zip ,ca_state ,SUM(ws_sales_price) FROM web_sales JOIN customer JOIN customer_address JOIN date_dim JOIN item ON i_item_id = item.i_item_id WHERE ws_bill_customer_sk = c_customer_sk AND c_current_addr_sk = ca_address_sk AND ws_item_sk = i_item_sk AND ( SUBSTR(ca_zip, 1, 5) IN ( '85669' ,'86197' ,'88274' ,'83405' ,'86475' ,'85392' ,'85460' ,'80348' ,'81792' ) ) AND ws_sold_date_sk = d_date_sk AND d_qoy = 2 AND d_year = 1999 GROUP BY ca_zip ,ca_state ORDER BY ca_zip ,ca_state;
BEGIN; INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userfriends`; COMMIT;
<reponame>opengauss-mirror/Yat<gh_stars>0 -- @testpoint:插入字符串类型整数 drop table if exists bigint04; create table bigint04 (name bigint); insert into bigint04 values ('14165132'); select * from bigint04; drop table if exists bigint04;
<reponame>opengauss-mirror/Yat -- @testpoint:opengauss关键字over(非保留),自定义数据类型名为explain --关键字explain作为数据类型不带引号,创建成功 drop type if exists over; CREATE TYPE over AS (f1 int, f2 text); select typname from pg_type where typname ='over'; drop type over; --关键字explain作为数据类型加双引号,创建成功 drop type if exists "over"; CREATE TYPE "over" AS (f1 int, f2 text); select typname from pg_type where typname ='over'; drop type "over"; --关键字explain作为数据类型加单引号,合理报错 drop type if exists 'over'; CREATE TYPE 'over' AS (f1 int, f2 text); select * from pg_type where typname ='over'; drop type 'over'; --关键字explain作为数据类型加反引号,合理报错 drop type if exists `over`; CREATE TYPE `over` AS (f1 int, f2 text); select * from pg_type where typname =`over`; drop type `over`;
CREATE TABLE public.items ( "id" int8 NOT NULL, "user_id" int4 NOT NULL, "character_id" int4 NOT NULL, "count" int4 DEFAULT -1, "init_count" int4 DEFAULT -1, "enchant_level" int4 DEFAULT 0, "grade_id" int4 DEFAULT 0, "equip_level" int4 DEFAULT 0, "period" int4 DEFAULT -1, "start_date" int4 DEFAULT 0, "reg_date" int4 DEFAULT 0, "end_date" int4 DEFAULT 0, "equip_state" boolean DEFAULT 'fal', PRIMARY KEY (id) ) WITH ( OIDS = FALSE ); ALTER TABLE public.items OWNER to postgres;
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE PROCEDURE [SQLCop].[test Column collation does not match database default] AS BEGIN -- Written by <NAME> -- February 25, 2012 SET NOCOUNT ON DECLARE @Output VarChar(max) SET @Output = '' SELECT @Output = @Output + C.TABLE_SCHEMA + '.' + C.TABLE_NAME + '.' + C.COLUMN_NAME + Char(13) + Char(10) FROM INFORMATION_SCHEMA.COLUMNS C INNER JOIN INFORMATION_SCHEMA.TABLES T ON C.Table_Name = T.Table_Name WHERE T.Table_Type = 'BASE TABLE' AND COLLATION_NAME <> convert(VarChar(100), DATABASEPROPERTYEX(db_name(), 'Collation')) AND COLUMNPROPERTY(OBJECT_ID(C.TABLE_NAME), COLUMN_NAME, 'IsComputed') = 0 AND C.TABLE_SCHEMA <> 'tSQLt' Order By C.TABLE_SCHEMA, C.TABLE_NAME, C.COLUMN_NAME If @Output > '' Begin Set @Output = Char(13) + Char(10) + 'For more information: ' + 'hhttps://github.com/red-gate/SQLCop/wiki/Column-collation-does-not-match-database-default' + Char(13) + Char(10) + Char(13) + Char(10) + @Output EXEC tSQLt.Fail @Output End END; GO
<gh_stars>0 --scope e:TABLESPACE --input DROP TABLESPACE e; --output NEEDED e:TABLESPACE DROPPED e:TABLESPACE
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1:3306 -- Время создания: Мар 01 2017 г., 14:54 -- Версия сервера: 5.7.16-log -- Версия PHP: 7.1.0 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 */; -- -- База данных: `myservice` -- CREATE DATABASE IF NOT EXISTS `myservice` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE `myservice`; -- -------------------------------------------------------- -- -- Структура таблицы `groups` -- -- Создание: Мар 01 2017 г., 04:46 -- Последнее обновление: Мар 01 2017 г., 11:34 -- DROP TABLE IF EXISTS `groups`; CREATE TABLE IF NOT EXISTS `groups` ( `group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '№ экскурсии', `user_id` int(11) NOT NULL COMMENT 'ID создателя', `name` varchar(100) NOT NULL COMMENT 'Название экскурсии', `description` text NOT NULL COMMENT 'Описание', `conditions` text NOT NULL COMMENT 'Требования к участникам', `date` varchar(30) NOT NULL COMMENT 'Дата проведения', `members` int(11) NOT NULL COMMENT 'Количество участников', `cost` int(11) NOT NULL COMMENT 'Стоимость', PRIMARY KEY (`group_id`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='Экскурсии + закрытые группы'; -- -- Дамп данных таблицы `groups` -- INSERT INTO `groups` (`group_id`, `user_id`, `name`, `description`, `conditions`, `date`, `members`, `cost`) VALUES (1, 2, 'Тестдрайв', 'Привет', '', '2017-03-17', 30, 13000), (2, 2, 'Нету', 'Отсутствует', '', '2019-06-05', 32, 23455), (3, 4, 'qqqqqqqqqqqqq', 'qqqqqqqqqqqqqqqq', 'qqqqqqqqqqqqqqqqqqqqq', '2017-03-17', 33, 333333), (4, 5, 'wwwwwwwww', 'sdf', 'sdf', '2017-03-10', 33, 123); -- -------------------------------------------------------- -- -- Структура таблицы `images` -- -- Создание: Мар 01 2017 г., 03:41 -- Последнее обновление: Мар 01 2017 г., 11:34 -- DROP TABLE IF EXISTS `images`; CREATE TABLE IF NOT EXISTS `images` ( `id` int(11) NOT NULL AUTO_INCREMENT, `group_id` int(11) NOT NULL, `image` varchar(1024) NOT NULL, PRIMARY KEY (`id`), KEY `images_ibfk_1` (`group_id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `images` -- INSERT INTO `images` (`id`, `group_id`, `image`) VALUES (1, 2, '/uploads/87bd49d5570101acbd515e01a5c4129b.jpg'), (2, 2, '/uploads/a56c23bf490f2cd4c2ebb1678f7cdc51.jpg'), (3, 2, '/uploads/c2305e269b1886ea1677f74741c9f53d.jpg'), (4, 4, '/uploads/42deb9dec19d2c05b5f1c5261b11160d.jpg'); -- -------------------------------------------------------- -- -- Структура таблицы `members` -- -- Создание: Мар 01 2017 г., 03:38 -- Последнее обновление: Мар 01 2017 г., 11:46 -- DROP TABLE IF EXISTS `members`; CREATE TABLE IF NOT EXISTS `members` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '№ участника', `group_id` int(11) NOT NULL COMMENT '№ группы', `user_id` int(11) NOT NULL COMMENT '№ пользователя', `status` smallint(2) NOT NULL COMMENT 'Статус', PRIMARY KEY (`id`), KEY `group_id` (`group_id`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='Список кто в какой группе состоит'; -- -- Дамп данных таблицы `members` -- INSERT INTO `members` (`id`, `group_id`, `user_id`, `status`) VALUES (3, 1, 1, 1), (4, 1, 1, 0), (5, 1, 3, 2), (6, 1, 3, 0); -- -------------------------------------------------------- -- -- Структура таблицы `migration` -- -- Создание: Мар 01 2017 г., 02:14 -- Последнее обновление: Мар 01 2017 г., 02:14 -- DROP TABLE IF EXISTS `migration`; CREATE TABLE IF NOT EXISTS `migration` ( `version` varchar(180) NOT NULL, `apply_time` int(11) DEFAULT NULL, PRIMARY KEY (`version`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `migration` -- INSERT INTO `migration` (`version`, `apply_time`) VALUES ('m000000_000000_base', 1488334464), ('m130524_201442_init', 1488334467); -- -------------------------------------------------------- -- -- Структура таблицы `user` -- -- Создание: Мар 01 2017 г., 02:14 -- Последнее обновление: Мар 01 2017 г., 11:34 -- DROP TABLE IF EXISTS `user`; CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `status` smallint(6) NOT NULL DEFAULT '10', `created_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), UNIQUE KEY `email` (`email`), UNIQUE KEY `password_reset_token` (`password_reset_token`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Дамп данных таблицы `user` -- INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES (1, 'admin', 'v1rMmG9sSoOZ4WaMIlkBAEr5WGGQD4-y', '$2y$13$aoM3hVRwMcUZBCczQQTd0e2s0pNIpajFAWpsHXHncbHoevhjS12bG', NULL, '<EMAIL>', 10, 1488336136, 1488336136), (2, 'test2', '9cqnpNxfEhAjDeHPmJNFIUg1QpgNXUGv', '$2y$13$1wbuUWzxXjVX.kBvFh6F5OdIcMtdKY24Mg16HgrsTpzOrYhgVuKw.', NULL, '<EMAIL>', 10, 1488341533, 1488341533), (3, 'qwe', '<PASSWORD>6eCRH1eXBfsi7qcrFx7JiOGzqf8QO', '$2y$13$ezXoLxGlxZUslXJgrd8ckuUMymtg2.nbuZ/pEejB2XKBaNNnfz/Hm', NULL, '<EMAIL>', 10, 1488367153, 1488367153), (4, 'ewq', 'Wj4m1Kj6NHpa0DJsSdTtMwBAan4w-7d2', '$2y$13$9C2mEJpiWr3GDZV07FfhoewcpqhJ0CUVzzDOBMfN6/NAzmd.cGDhq', NULL, '<EMAIL>', 10, 1488367283, 1488367283), (5, 'qqq', 'FBE25a39wmYHv2cq6QHbxkM-BNcdZW7a', <PASSWORD>', NULL, '<EMAIL>', 10, 1488368067, 1488368067); -- -------------------------------------------------------- -- -- Структура таблицы `user_info` -- -- Создание: Мар 01 2017 г., 03:28 -- Последнее обновление: Мар 01 2017 г., 11:34 -- DROP TABLE IF EXISTS `user_info`; CREATE TABLE IF NOT EXISTS `user_info` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL COMMENT 'Ваши ФИО', `genre` tinyint(1) NOT NULL COMMENT 'Ваш пол:', `phone` varchar(12) DEFAULT NULL COMMENT 'Ваш номер телефона', `about` text COMMENT 'О себе', `role` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Роль', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Информация о пользователях'; -- -- Дамп данных таблицы `user_info` -- INSERT INTO `user_info` (`id`, `name`, `genre`, `phone`, `about`, `role`) VALUES (1, 'Admin Adminov Adminovich', 0, '1234325412', 'Привет, чувак =)', 0), (2, 'Test Test Test', 1, '7775521', 'Nobody', 1), (3, 'qweqweqweq', 0, '123', '12312312312312', 0), (4, 'qweqweqwe', 0, '123123', '112e', 1), (5, 'qweqweqweq', 0, '1231', 'asdasdasd', 1); -- -- Ограничения внешнего ключа сохраненных таблиц -- -- -- Ограничения внешнего ключа таблицы `groups` -- ALTER TABLE `groups` ADD CONSTRAINT `groups_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON UPDATE NO ACTION; -- -- Ограничения внешнего ключа таблицы `images` -- ALTER TABLE `images` ADD CONSTRAINT `images_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON UPDATE NO ACTION; -- -- Ограничения внешнего ключа таблицы `members` -- ALTER TABLE `members` ADD CONSTRAINT `members_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON UPDATE NO ACTION, ADD CONSTRAINT `members_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON UPDATE NO ACTION; -- -- Ограничения внешнего ключа таблицы `user_info` -- ALTER TABLE `user_info` ADD CONSTRAINT `user_info_ibfk_1` FOREIGN KEY (`id`) REFERENCES `user` (`id`) ON UPDATE NO ACTION; /*!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 if not exists voting_locations_2019( "region_id" integer, -- Област код "region_name" text, -- Област текст "municipality_id" integer, -- Община код "municipality_name" text, -- Община "municipality_region_code" text, -- Район код "municipality_region_name" text, -- Район "section" text, -- Секция "location_id" integer, -- Населено място код "location_name" text , -- Населено място "address" text, -- Адрес "section_id" text, "google_response" text, -- Резултат от google maps api request "lat" num, "lng" num, "neighborhood" text, "formatted_address" text, "postcode" text ); create table if not exists voting_locations_2019_spring( "region_id" integer, -- Област код "region_name" text, -- Област текст "municipality_id" integer, -- Община код "municipality_name" text, -- Община "municipality_region_code" text, -- Район код "municipality_region_name" text, -- Район "section" text, -- Секция "location_id" integer, -- Населено място код "location_name" text , -- Населено място "address" text, -- Адрес "section_id" text, "google_response" text, -- Резултат от google maps api request "lat" num, "lng" num, "neighborhood" text, "formatted_address" text, "postcode" text ); create table if not exists voting_locations_2017( "region_id" integer, -- Област код "region_name" text, -- Област текст "municipality_id" integer, -- Община код "municipality_name" text, -- Община "municipality_region_code" text, -- Район код "municipality_region_name" text, -- Район "section" text, -- Секция "location_id" integer, -- Населено място код "location_name" text , -- Населено място "address" text, -- Адрес "section_id" text, "google_response" text, -- Резултат от google maps api request "lat" num, "lng" num, "neighborhood" text, "formatted_address" text, "postcode" text ); create table if not exists voting_locations_2016( "region_id" integer, -- Област код "region_name" text, -- Област текст "municipality_id" integer, -- Община код "municipality_name" text, -- Община "municipality_region_code" text, -- Район код "municipality_region_name" text, -- Район "section" text, -- Секция "location_id" integer, -- Населено място код "location_name" text , -- Населено място "address" text, -- Адрес "section_id" text, "google_response" text, -- Резултат от google maps api request "lat" num, "lng" num, "neighborhood" text, "formatted_address" text, "postcode" text ); create table if not exists voting_locations_2015( "region_id" integer, -- Област код "region_name" text, -- Област текст "municipality_id" integer, -- Община код "municipality_name" text, -- Община "municipality_region_code" text, -- Район код "municipality_region_name" text, -- Район "section" text, -- Секция "location_id" integer, -- Населено място код "location_name" text , -- Населено място "address" text, -- Адрес "section_id" text, "google_response" text, -- Резултат от google maps api request "lat" num, "lng" num, "neighborhood" text, "formatted_address" text, "postcode" text ); .mode csv .separator ';' .import ./files/voting_sections_2019.csv voting_locations_2019 .import ./files/voting_sections_2019_spring.csv voting_locations_2019_spring .import ./files/voting_sections_2017.csv voting_locations_2017 .import ./files/voting_sections_2016.csv voting_locations_2016 .import ./files/voting_sections_2015.csv voting_locations_2015 update voting_locations_2019 set section_id=CASE WHEN region_id < 10 THEN '0' || region_id ELSE region_id END || CASE WHEN municipality_id < 10 THEN '0' || municipality_id ELSE municipality_id END || CASE WHEN municipality_region_code = '' THEN '00' ELSE municipality_region_code END || section; update voting_locations_2019_spring set section_id=CASE WHEN region_id < 10 THEN '0' || region_id ELSE region_id END || CASE WHEN municipality_id < 10 THEN '0' || municipality_id ELSE municipality_id END || CASE WHEN municipality_region_code = '' THEN '00' ELSE municipality_region_code END || section; update voting_locations_2017 set section_id=CASE WHEN region_id < 10 THEN '0' || region_id ELSE region_id END || CASE WHEN municipality_id < 10 THEN '0' || municipality_id ELSE municipality_id END || CASE WHEN municipality_region_code = '' THEN '00' ELSE municipality_region_code END || section; update voting_locations_2016 set section_id=CASE WHEN cast(region_id as number) < 10 THEN '0' || region_id ELSE region_id END || CASE WHEN municipality_id < 10 THEN '0' || municipality_id ELSE municipality_id END || CASE WHEN municipality_region_code = '0' THEN '00' ELSE municipality_region_code END || section; update voting_locations_2015 set section_id=CASE WHEN region_id < 10 THEN '0' || region_id ELSE region_id END || CASE WHEN municipality_id < 10 THEN '0' || municipality_id ELSE municipality_id END || CASE WHEN municipality_region_code = '' THEN '00' ELSE municipality_region_code END || section; -- Run ./fill_in_sections_coordinates voting_locations_2019_spring update voting_locations_2019_spring set formatted_address=(select formatted_address from voting_locations_2019_spring where voting_locations_2019.location_id=voting_locations_2019_spring.location_id and voting_locations_2019.address=voting_locations_2016.address) where formatted_address is null; update voting_locations_2019_spring set lat=(select lat from voting_locations_2019_spring where voting_locations_2019.formatted_address=voting_locations_2019_spring.formatted_address) where lat is null; update voting_locations_2019_spring set lng=(select lng from voting_locations_2019 where voting_locations_2019.formatted_address=voting_locations_2019_spring.formatted_address) where lng is null; update voting_locations_2019_spring set neighborhood=(select neighborhood from voting_locations_2019 where voting_locations_2019.formatted_address=voting_locations_2019_spring.formatted_address) where neighborhood is null; update voting_locations_2019_spring set postcode=(select postcode from voting_locations_2019 where voting_locations_2019.formatted_address=voting_locations_2019_spring.formatted_address) where postcode is null; -- Run ./fill_in_sections_coordinates voting_locations_2019_spring update voting_locations_2017 set formatted_address=(select formatted_address from voting_locations_2019_spring where voting_locations_2019_spring.location_id=voting_locations_2017.location_id and voting_locations_2019_spring.address=voting_locations_2016.address) where formatted_address is null; update voting_locations_2017 set lat=(select lat from voting_locations_2017 where voting_locations_2019.formatted_address=voting_locations_2017.formatted_address) where lat is null; update voting_locations_2017 set lng=(select lng from voting_locations_2019 where voting_locations_2019.formatted_address=voting_locations_2017.formatted_address) where lng is null; update voting_locations_2017 set neighborhood=(select neighborhood from voting_locations_2019 where voting_locations_2019.formatted_address=voting_locations_2017.formatted_address) where neighborhood is null; update voting_locations_2017 set postcode=(select postcode from voting_locations_2019 where voting_locations_2019.formatted_address=voting_locations_2017.formatted_address) where postcode is null; -- Run ./fill_in_sections_coordinates voting_locations_2017 update voting_locations_2016 set formatted_address=(select formatted_address from voting_locations_2017 where voting_locations_2017.location_id=voting_locations_2016.location_id and voting_locations_2017.address=voting_locations_2016.address) where formatted_address is null; update voting_locations_2016 set lat=(select lat from voting_locations_2019_spring where voting_locations_2019_spring.formatted_address=voting_locations_2016.formatted_address) where lat is null; update voting_locations_2016 set lng=(select lng from voting_locations_2019_spring where voting_locations_2019_spring.formatted_address=voting_locations_2016.formatted_address) where lng is null; update voting_locations_2016 set neighborhood=(select neighborhood from voting_locations_2019_spring where voting_locations_2019_spring.formatted_address=voting_locations_2016.formatted_address) where neighborhood is null; update voting_locations_2016 set postcode=(select postcode from voting_locations_2019_spring where voting_locations_2019_spring.formatted_address=voting_locations_2016.formatted_address) where postcode is null; -- Run ./fill_in_sections_coordinates voting_locations_2016 update voting_locations_2015 set formatted_address=(select formatted_address from voting_locations_2017 where voting_locations_2017.location_id=voting_locations_2015.location_id and voting_locations_2017.address=voting_locations_2015.address) where formatted_address is null; update voting_locations_2015 set lat=(select lat from voting_locations_2017 where voting_locations_2017.formatted_address=voting_locations_2015.formatted_address) where lat is null; update voting_locations_2015 set lng=(select lng from voting_locations_2017 where voting_locations_2017.formatted_address=voting_locations_2015.formatted_address) where lng is null; update voting_locations_2015 set neighborhood=(select neighborhood from voting_locations_2017 where voting_locations_2017.formatted_address=voting_locations_2015.formatted_address) where neighborhood is null; update voting_locations_2015 set postcode=(select postcode from voting_locations_2017 where voting_locations_2017.formatted_address=voting_locations_2015.formatted_address) where postcode is null; -- Run ./fill_in_sections_coordinates voting_locations_2015
-- phpMyAdmin SQL Dump -- version 5.0.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 20, 2021 at 03:41 PM -- Server version: 10.4.14-MariaDB -- PHP Version: 7.4.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `laravel` -- -- -------------------------------------------------------- -- -- Table structure for table `bookkeepings` -- CREATE TABLE `bookkeepings` ( `id` int(10) UNSIGNED NOT NULL, `file_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `file_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `checkins` -- CREATE TABLE `checkins` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `role` int(11) NOT NULL, `workingtime` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `checkins` -- INSERT INTO `checkins` (`id`, `name`, `email`, `role`, `workingtime`, `created_at`, `updated_at`) VALUES (5, 'Analyst', '<EMAIL>', 2, 2148, '2021-08-14 06:01:09', '2021-08-04 06:01:09'), (6, 'Manager', '<EMAIL>', 3, 1, '2021-08-04 06:02:07', '2021-08-04 06:02:07'), (7, 'Manager', '<EMAIL>', 3, 1, '2021-08-04 06:36:05', '2021-08-04 06:36:05'), (8, '<NAME>', '<EMAIL>', 3, 1, '2021-08-04 07:40:41', '2021-08-04 07:40:41'), (9, '<NAME>', '<EMAIL>', 3, 3, '2021-08-04 07:54:19', '2021-08-04 07:54:19'), (10, '<NAME>', '<EMAIL>', 3, 2, '2021-08-04 07:55:13', '2021-08-04 07:55:13'); -- -------------------------------------------------------- -- -- Table structure for table `events` -- CREATE TABLE `events` ( `id` int(10) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `event_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `client_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `company_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, `start_date` datetime NOT NULL, `end_date` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `events` -- INSERT INTO `events` (`id`, `created_at`, `updated_at`, `event_name`, `client_name`, `company_name`, `email`, `start_date`, `end_date`) VALUES (26, '2021-08-11 02:31:27', '2021-08-11 02:31:27', 'Bookkeeping', '<NAME>', 'W@TRANSPORT', '<EMAIL>', '2021-08-02 10:42:00', '2021-08-05 07:23:00'), (27, '2021-08-11 02:57:43', '2021-08-11 02:57:43', 'Tax service1', 'Gusakova Aan', '@Product Web', '<EMAIL>', '2021-08-04 00:00:00', '2021-08-07 00:00:00'), (28, '2021-08-11 02:59:03', '2021-08-11 02:59:03', 'Payroll service', 'Guwan', 'Tax TIC RK', '<EMAIL>', '2021-08-05 00:00:00', '2021-08-09 00:00:00'), (29, '2021-08-11 03:00:15', '2021-08-11 03:00:15', 'INTI', 'Kliya', 'Onwapeaon', '<EMAIL>', '2021-08-12 00:00:00', '2021-08-14 00:00:00'), (30, '2021-08-11 03:00:46', '2021-08-11 03:00:46', 'www', 'Anastasya', 'INterior Rus', '<EMAIL>', '2021-08-13 00:00:00', '2021-08-16 00:00:00'), (34, '2021-08-11 10:05:24', '2021-08-11 10:05:24', 'INTI', 'Marosky', 'Architecture.com', '<EMAIL>', '2021-08-06 00:00:00', '2021-08-12 00:00:00'), (35, '2021-08-11 10:07:00', '2021-08-11 10:07:00', 'Payroll', 'Gusakova', 'Techinical .<EMAIL>', '<EMAIL>', '2021-08-12 00:00:00', '2021-08-14 00:00:00'), (36, '2021-08-13 05:02:01', '2021-08-13 05:02:01', 'qweqweqwe', 'qweqweqwe', 'qweqweqwe', '<EMAIL>', '2021-08-15 14:05:00', '2021-08-23 13:04:00'), (37, '2021-08-13 05:40:40', '2021-08-13 05:40:40', 'Bookkeeping', 'Anastasya', '<EMAIL>', '<EMAIL>', '2021-08-18 02:42:00', '2021-08-26 01:44:00'); -- -------------------------------------------------------- -- -- Table structure for table `invoices` -- CREATE TABLE `invoices` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `status` int(11) NOT NULL DEFAULT 0, `resulttime` int(11) NOT NULL, `payamount` int(11) NOT NULL, `paidtime` int(11) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- 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 (87, '2014_10_12_000000_create_users_table', 1), (88, '2014_10_12_100000_create_password_resets_table', 1), (89, '2021_07_22_213911_create_revenues_table', 1), (90, '2021_07_22_214113_create_bookkeepings_table', 1), (91, '2021_07_23_010752_create_services_table', 1), (92, '2021_07_26_070212_create_roles_table', 1), (93, '2021_07_26_110623_create_servicequotes_table', 1), (94, '2021_08_03_091154_create_checkin_table', 1), (95, '2021_08_04_020244_create_invoice_table', 1), (96, '2021_08_06_171913_create_events_table', 2), (97, '2021_08_06_184444_create_events_table', 3); -- -------------------------------------------------------- -- -- Table structure for table `notifications` -- CREATE TABLE `notifications` ( `id` int(11) NOT NULL, `type` int(11) NOT NULL, `message` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `is_new` int(11) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `notifications` -- INSERT INTO `notifications` (`id`, `type`, `message`, `created_at`, `is_new`) VALUES (1, 1, 'User ccc has been registered!', '2021-08-02 22:44:21', 0), (2, 1, 'User wewew has been registered!', '2021-08-02 22:47:57', 0), (3, 2, 'Setting has been changed by Admin', '2021-08-11 06:44:25', 0), (4, 2, 'Setting has been changed by Admin', '2021-08-11 06:44:53', 0), (5, 2, 'Setting has been changed by Admin', '2021-08-11 06:45:02', 0), (6, 2, 'Setting has been changed by Admin', '2021-08-11 06:45:12', 0), (7, 2, 'Setting has been changed by Admin', '2021-08-11 06:45:22', 0); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `revenues` -- CREATE TABLE `revenues` ( `id` int(10) UNSIGNED NOT NULL, `f_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `f_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE `roles` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `servicequotes` -- CREATE TABLE `servicequotes` ( `id` int(10) UNSIGNED NOT NULL, `service_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `servicequotes` -- INSERT INTO `servicequotes` (`id`, `service_name`, `price`, `created_at`, `updated_at`) VALUES (1, 'Income Tax Preparation', '$15', '2021-07-26 11:02:12', '2021-07-26 11:02:12'), (2, 'ITIN Process', '$35', '2021-07-26 11:02:32', '2021-04-28 17:23:37'), (3, 'Bookkeeping Services', '$30', '2021-07-26 11:02:46', '2021-07-26 11:02:46'), (4, 'Payroll Services', '$50', '2021-07-26 11:03:03', '2021-07-28 23:37:58'), (5, 'Notary Services', '$100', '2021-07-26 11:03:18', '2021-07-26 11:03:18'), (6, 'Business Consulting', '$80', '2021-07-26 11:03:37', '2021-07-28 23:37:31'); -- -------------------------------------------------------- -- -- Table structure for table `services` -- CREATE TABLE `services` ( `id` int(10) UNSIGNED NOT NULL, `service_id` int(10) UNSIGNED NOT NULL, `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0', `price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `services` -- INSERT INTO `services` (`id`, `service_id`, `status`, `price`, `created_at`, `updated_at`) VALUES (1, 1, '0', '$15', '2021-08-04 07:55:43', '2021-08-04 07:55:43'), (2, 2, '0', '$35', '2021-08-04 07:55:46', '2021-08-04 07:55:46'), (3, 3, '0', '$30', '2021-08-04 07:55:48', '2021-08-04 07:55:48'), (4, 4, '0', '$50', '2021-08-04 07:55:51', '2021-08-04 07:55:51'), (5, 5, '0', '$100', '2021-08-04 07:55:53', '2021-08-04 07:55:53'), (6, 6, '0', '$80', '2021-08-04 07:55:55', '2021-08-04 07:55:55'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `role` int(11) NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `event_color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `email`, `role`, `email_verified_at`, `password`, `event_color`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'Admin', '<EMAIL>', 0, NULL, '$2y$10$UJq5UvcgBZtFHZMpy0jKi.kla.kWu9Sytz8wWBPbKResVhfJcXEEy', '', NULL, NULL, NULL), (2, 'Client', '<EMAIL>', 1, NULL, '$2y$10$5I6vROrKhr.BO9mnuSS4AedLDRy7O1spwauVc5PfYaTzU1CeyJMiC', '', NULL, NULL, NULL), (3, 'Analyst', '<EMAIL>', 2, NULL, '$2y$10$wLYqISgVyrAOR2zxTtHl7umR7qNOA7ZFILA1uZAu1MMLMHUrGy80u', '#6574e6', NULL, NULL, '2021-08-11 06:44:53'), (4, 'Manager', '<EMAIL>', 2, NULL, '$2y$10$3b4dm8v60Qijfzgx4iMek.dww5DCh5XlRVkoObZs8JR/nnEONJSpW', '#d165e6', NULL, NULL, '2021-08-11 06:45:02'), (5, '<NAME>', '<EMAIL>', 2, NULL, '$2y$10$rakA.ND0.zX0Tl3ncyfSkOBG3.WHWWSRmGJhcErRJ7feq0in9MuXa', '#65e4e6', NULL, '2021-08-04 07:40:09', '2021-08-11 06:45:12'), (6, '<NAME>', '<EMAIL>', 2, NULL, '$2y$10$JXAkUHSU6/BuC/J3XsYVv.50vu7SdhEqvrKOpFr0hnMy4W4XfJX5m', '#e4e665', NULL, '2021-08-04 07:53:21', '2021-08-11 06:45:22'), (7, '<NAME>', '<EMAIL>', 3, NULL, '$2y$10$zLFj.zipLzl.VNfc4MTqe.yhoKxh8YDePoG5W9sO..Y3.XW1Lz.zC', '#65e66a', NULL, '2021-08-11 06:42:36', '2021-08-11 06:42:36'); -- -- Indexes for dumped tables -- -- -- Indexes for table `bookkeepings` -- ALTER TABLE `bookkeepings` ADD PRIMARY KEY (`id`); -- -- Indexes for table `checkins` -- ALTER TABLE `checkins` ADD PRIMARY KEY (`id`); -- -- Indexes for table `events` -- ALTER TABLE `events` ADD PRIMARY KEY (`id`); -- -- Indexes for table `invoices` -- ALTER TABLE `invoices` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `notifications` -- ALTER TABLE `notifications` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `revenues` -- ALTER TABLE `revenues` ADD PRIMARY KEY (`id`); -- -- Indexes for table `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id`); -- -- Indexes for table `servicequotes` -- ALTER TABLE `servicequotes` ADD PRIMARY KEY (`id`); -- -- Indexes for table `services` -- ALTER TABLE `services` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `bookkeepings` -- ALTER TABLE `bookkeepings` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `checkins` -- ALTER TABLE `checkins` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `events` -- ALTER TABLE `events` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38; -- -- AUTO_INCREMENT for table `invoices` -- ALTER TABLE `invoices` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=98; -- -- AUTO_INCREMENT for table `notifications` -- ALTER TABLE `notifications` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `revenues` -- ALTER TABLE `revenues` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `roles` -- ALTER TABLE `roles` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `servicequotes` -- ALTER TABLE `servicequotes` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `services` -- ALTER TABLE `services` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; 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>lostfound.sql -- phpMyAdmin SQL Dump -- version 4.8.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 19, 2019 at 04:55 AM -- Server version: 10.1.33-MariaDB -- PHP Version: 7.2.6 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: `lostfound` -- -- -------------------------------------------------------- -- -- Table structure for table `barang` -- CREATE TABLE `barang` ( `id_barang` varchar(100) NOT NULL, `jenis_barang` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `pengambilan` -- CREATE TABLE `pengambilan` ( `id_ambil` varchar(100) NOT NULL, `no_laporan` varchar(100) NOT NULL, `nama_pengambil` varchar(100) NOT NULL, `no_hp` varchar(19) NOT NULL, `foto_pengambil` varchar(100) NOT NULL, `tgl_pengambilan` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `temuan` -- CREATE TABLE `temuan` ( `no_laporan` varchar(100) NOT NULL, `id_barang` varchar(100) NOT NULL, `id_user` varchar(100) NOT NULL, `tgl_temuan` datetime NOT NULL, `lokasi_penemuan` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id_user` varchar(100) NOT NULL, `id_level` tinyint(1) NOT NULL, `nama` varchar(100) NOT NULL, `username` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `is_active` int(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id_user`, `id_level`, `nama`, `username`, `email`, `password`, `is_active`) VALUES ('<PASSWORD>', 1, '<NAME>', 'ican admin', '<EMAIL>', <PASSWORD>$H/E<PASSWORD>I0nz<PASSWORD>UP<PASSWORD>', 1); -- -------------------------------------------------------- -- -- Table structure for table `user_level` -- CREATE TABLE `user_level` ( `id_level` tinyint(1) NOT NULL, `level` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_level` -- INSERT INTO `user_level` (`id_level`, `level`) VALUES (0, 'User'), (1, 'Admin'); -- -------------------------------------------------------- -- -- Table structure for table `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=latin1; -- -- Dumping data for table `user_token` -- INSERT INTO `user_token` (`id`, `email`, `token`, `date_created`) VALUES (2, '<EMAIL>', 'R4bpm4fk+amtAoVNqzaF2Lo1P6OR0QJ1d3a6sc4Mxhk=', 1576691465), (3, '<EMAIL>', '7s7eM07PC/iEARWuoec2uPsE9baOt4aRaiOA2Sfdpqc=', 1576691508); -- -- Indexes for dumped tables -- -- -- Indexes for table `barang` -- ALTER TABLE `barang` ADD PRIMARY KEY (`id_barang`); -- -- Indexes for table `pengambilan` -- ALTER TABLE `pengambilan` ADD PRIMARY KEY (`id_ambil`), ADD KEY `no_laporan` (`no_laporan`); -- -- Indexes for table `temuan` -- ALTER TABLE `temuan` ADD PRIMARY KEY (`no_laporan`), ADD KEY `id_user` (`id_user`), ADD KEY `id_barang` (`id_barang`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id_user`), ADD KEY `id_level` (`id_level`); -- -- Indexes for table `user_level` -- ALTER TABLE `user_level` ADD PRIMARY KEY (`id_level`); -- -- Indexes for table `user_token` -- ALTER TABLE `user_token` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `user_token` -- ALTER TABLE `user_token` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- Constraints for dumped tables -- -- -- Constraints for table `pengambilan` -- ALTER TABLE `pengambilan` ADD CONSTRAINT `pengambilan_ibfk_1` FOREIGN KEY (`no_laporan`) REFERENCES `temuan` (`no_laporan`); -- -- Constraints for table `temuan` -- ALTER TABLE `temuan` ADD CONSTRAINT `temuan_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`), ADD CONSTRAINT `temuan_ibfk_2` FOREIGN KEY (`id_barang`) REFERENCES `barang` (`id_barang`); -- -- Constraints for table `user` -- ALTER TABLE `user` ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`id_level`) REFERENCES `user_level` (`id_level`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
SELECT TOP 5 c.CountryName AS [Country], CASE WHEN p.PeakName IS NULL THEN '(no highest peak)' ELSE p.PeakName END AS [HighestPeakName], CASE WHEN p.Elevation IS NULL THEN 0 ELSE MAX(p.Elevation) END AS [HighestPeakElevation], CASE WHEN m.MountainRange IS NULL THEN '(no mountain)' ELSE m.MountainRange END AS [Mountain] FROM Countries AS c LEFT JOIN MountainsCountries AS mc ON mc.CountryCode = c.CountryCode LEFT JOIN Mountains AS m ON m.Id = mc.MountainId LEFT JOIN Peaks AS p ON m.Id = p.MountainId GROUP BY c.CountryName, p.PeakName, p.Elevation, m.MountainRange ORDER BY c.CountryName, p.PeakName
<gh_stars>1-10 CREATE PROCEDURE [dbo].[GetApprenticeshipStatusSummaries] @employerAccountId BIGINT AS SELECT ale.LegalEntityId, ale.OrganisationType as 'LegalEntityOrganisationType', a.PaymentStatus, COUNT(*) AS 'Count' FROM Apprenticeship a INNER JOIN Commitment c ON a.CommitmentId = c.Id INNER JOIN [AccountLegalEntities] ale on ale.Id = c.AccountLegalEntityId WHERE c.EmployerAccountId = @employerAccountId GROUP BY ale.LegalEntityId, ale.OrganisationType, a.PaymentStatus
INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (107, 1, 'System.X_FREEACS-COM.Comment', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (108, 1, 'System.X_FREEACS-COM.Debug', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (109, 1, 'System.X_FREEACS-COM.DesiredSoftwareVersion', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (110, 1, 'System.X_FREEACS-COM.Device.GUIURL', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (111, 1, 'System.X_FREEACS-COM.Device.PeriodicInterval', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (112, 1, 'System.X_FREEACS-COM.Device.PublicIPAddress', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (113, 1, 'System.X_FREEACS-COM.Device.PublicPort', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (114, 1, 'System.X_FREEACS-COM.Device.PublicProtocol', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (115, 1, 'System.X_FREEACS-COM.Device.SerialNumber', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (116, 1, 'System.X_FREEACS-COM.Device.SoftwareVersion', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (117, 1, 'System.X_FREEACS-COM.Discover', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (118, 1, 'System.X_FREEACS-COM.FirstConnectTms', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (119, 1, 'System.X_FREEACS-COM.IM.Message', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (120, 1, 'System.X_FREEACS-COM.Job.Current', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (121, 1, 'System.X_FREEACS-COM.Job.CurrentKey', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (122, 1, 'System.X_FREEACS-COM.Job.Disruptive', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (123, 1, 'System.X_FREEACS-COM.Job.History', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (124, 1, 'System.X_FREEACS-COM.LastConnectTms', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (125, 1, 'System.X_FREEACS-COM.ProvisioningMode', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (126, 1, 'System.X_FREEACS-COM.Reset', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (127, 1, 'System.X_FREEACS-COM.Restart', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (128, 1, 'System.X_FREEACS-COM.Secret', 'XC'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (129, 1, 'System.X_FREEACS-COM.SecretScheme', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (130, 1, 'System.X_FREEACS-COM.ServiceWindow.Disruptive', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (131, 1, 'System.X_FREEACS-COM.ServiceWindow.Enable', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (132, 1, 'System.X_FREEACS-COM.ServiceWindow.Frequency', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (133, 1, 'System.X_FREEACS-COM.ServiceWindow.Regular', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (134, 1, 'System.X_FREEACS-COM.ServiceWindow.Spread', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (135, 1, 'System.X_FREEACS-COM.SoftwareURL', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (136, 1, 'System.X_FREEACS-COM.TR069Test.Enable', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (137, 1, 'System.X_FREEACS-COM.TR069Test.FactoryResetOnStartup', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (138, 1, 'System.X_FREEACS-COM.TR069Test.Method', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (139, 1, 'System.X_FREEACS-COM.TR069Test.ParamFilter', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (140, 1, 'System.X_FREEACS-COM.TR069Test.Steps', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (141, 1, 'System.X_FREEACS-COM.TR069Test.TagFilter', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (142, 1, 'System.X_FREEACS-COM.Telnet.DesiredScriptVersion', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (143, 1, 'System.X_FREEACS-COM.Telnet.IPAddress', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (144, 1, 'System.X_FREEACS-COM.Telnet.Password', 'XC'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (145, 1, 'System.X_FREEACS-COM.Telnet.Port', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (146, 1, 'System.X_FREEACS-COM.Telnet.Username', 'X'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (147, 1, 'InternetGatewayDevice.DeviceInfo.DeviceLog', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (148, 1, 'InternetGatewayDevice.DeviceInfo.HardwareVersion', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (149, 1, 'InternetGatewayDevice.DeviceInfo.Manufacturer', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (150, 1, 'InternetGatewayDevice.DeviceInfo.ManufacturerOUI', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (151, 1, 'InternetGatewayDevice.DeviceInfo.ProductClass', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (152, 1, 'InternetGatewayDevice.DeviceInfo.ProvisioningCode', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (153, 1, 'InternetGatewayDevice.DeviceInfo.SerialNumber', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (154, 1, 'InternetGatewayDevice.DeviceInfo.SoftwareVersion', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (155, 1, 'InternetGatewayDevice.DeviceInfo.SpecVersion', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (156, 1, 'InternetGatewayDevice.DeviceInfo.UpTime', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (157, 1, 'InternetGatewayDevice.ManagementServer.ConnectionRequestPassword', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (158, 1, 'InternetGatewayDevice.ManagementServer.ConnectionRequestURL', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (159, 1, 'InternetGatewayDevice.ManagementServer.ConnectionRequestUsername', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (160, 1, 'InternetGatewayDevice.ManagementServer.ParameterKey', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (161, 1, 'InternetGatewayDevice.ManagementServer.Password', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (162, 1, 'InternetGatewayDevice.ManagementServer.PeriodicInformEnable', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (163, 1, 'InternetGatewayDevice.ManagementServer.PeriodicInformInterval', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (164, 1, 'InternetGatewayDevice.ManagementServer.PeriodicInformTime', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (165, 1, 'InternetGatewayDevice.ManagementServer.URL', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (166, 1, 'InternetGatewayDevice.ManagementServer.Username', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (167, 1, 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (168, 1, 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (169, 1, 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress', 'R'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (170, 1, 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (171, 1, 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password', 'RW'); INSERT INTO unit_type_param (unit_type_param_id, unit_type_id, name, flags) VALUES (172, 1, 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username', 'RW');
<filename>SQL-Performance-Baseline/CREATEDATABASE.sql USE [master] GO /****** Object: Database [dba_local] Script Date: 12/10/2014 2:12:24 PM ******/ CREATE DATABASE [dba_local] ON PRIMARY ( NAME = N'dba_local', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\dba_local.mdf' , SIZE = 10240MB , MAXSIZE = UNLIMITED, FILEGROWTH = 0) LOG ON ( NAME = N'dba_local_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\dba_local_log.LDF' , SIZE = 1024MB , MAXSIZE = 2048GB , FILEGROWTH = 0) GO ALTER DATABASE [dba_local] SET COMPATIBILITY_LEVEL = 100 GO IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')) begin EXEC [dba_local].[dbo].[sp_fulltext_database] @action = 'enable' end GO ALTER DATABASE [dba_local] SET ANSI_NULL_DEFAULT ON GO ALTER DATABASE [dba_local] SET ANSI_NULLS ON GO ALTER DATABASE [dba_local] SET ANSI_PADDING ON GO ALTER DATABASE [dba_local] SET ANSI_WARNINGS ON GO ALTER DATABASE [dba_local] SET ARITHABORT ON GO ALTER DATABASE [dba_local] SET AUTO_CLOSE OFF GO ALTER DATABASE [dba_local] SET AUTO_CREATE_STATISTICS ON GO ALTER DATABASE [dba_local] SET AUTO_SHRINK OFF GO ALTER DATABASE [dba_local] SET AUTO_UPDATE_STATISTICS ON GO ALTER DATABASE [dba_local] SET CURSOR_CLOSE_ON_COMMIT OFF GO ALTER DATABASE [dba_local] SET CURSOR_DEFAULT GLOBAL GO ALTER DATABASE [dba_local] SET CONCAT_NULL_YIELDS_NULL ON GO ALTER DATABASE [dba_local] SET NUMERIC_ROUNDABORT OFF GO ALTER DATABASE [dba_local] SET QUOTED_IDENTIFIER ON GO ALTER DATABASE [dba_local] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [dba_local] SET DISABLE_BROKER GO ALTER DATABASE [dba_local] SET AUTO_UPDATE_STATISTICS_ASYNC OFF GO ALTER DATABASE [dba_local] SET DATE_CORRELATION_OPTIMIZATION OFF GO ALTER DATABASE [dba_local] SET TRUSTWORTHY OFF GO ALTER DATABASE [dba_local] SET ALLOW_SNAPSHOT_ISOLATION OFF GO ALTER DATABASE [dba_local] SET PARAMETERIZATION SIMPLE GO ALTER DATABASE [dba_local] SET READ_COMMITTED_SNAPSHOT OFF GO ALTER DATABASE [dba_local] SET HONOR_BROKER_PRIORITY OFF GO ALTER DATABASE [dba_local] SET RECOVERY SIMPLE GO ALTER DATABASE [dba_local] SET MULTI_USER GO ALTER DATABASE [dba_local] SET PAGE_VERIFY CHECKSUM GO ALTER DATABASE [dba_local] SET DB_CHAINING OFF GO ALTER DATABASE [dba_local] SET READ_WRITE GO
<reponame>mrudulpolus/kc<gh_stars>0 alter table PROTOCOL_REFERENCE_TYPE add active_flag char(1); update PROTOCOL_REFERENCE_TYPE set active_flag = 'Y';
<reponame>vskurikhin/DayBook-2.0 CREATE SEQUENCE dictionary.setting_seq START 1; CREATE TABLE dictionary.setting ( id BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL, key VARCHAR(1024), value VARCHAR(65536), value_type_id BIGINT, CONSTRAINT FK_5014_dictionary_setting_value_type_id FOREIGN KEY (value_type_id) REFERENCES dictionary.value_type (id) ON DELETE CASCADE ON UPDATE CASCADE, user_name VARCHAR(64), CONSTRAINT FK_9f10_dictionary_setting_security_user_name FOREIGN KEY (user_name) REFERENCES security.user_name (user_name) ON DELETE CASCADE ON UPDATE CASCADE, create_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now(), update_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now(), enabled BOOLEAN DEFAULT true, visible BOOLEAN DEFAULT true, flags INT );
<gh_stars>0 drop table if exists pt.adjustment; drop table if exists pt.chargeback; drop table if exists pt.invoice; drop table if exists pt.payment; drop table if exists pt.refund; alter table pt.shop_meta drop column if exists has_payment_institution_acc_pay_tool;
<gh_stars>0 --"INTEL CONFIDENTIAL" --Copyright 2016 Intel Corporation All Rights Reserved. -- --The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material contains trade secrets and proprietary and confidential information of Intel or its suppliers and licensors. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intel's prior express written permission. -- --No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing. -- Find all customers who viewed items of a given category on the web -- in a given month and year that was followed by an in-store purchase of an item from the same category in the three -- consecutive months. -- Resources --Result -------------------------------------------------------------------- --keep result human readable set hive.exec.compress.output=false; set hive.exec.compress.output; -- This query requires parallel order by for fast and deterministic global ordering of final result set hive.optimize.sampling.orderby=${hiveconf:bigbench.hive.optimize.sampling.orderby}; set hive.optimize.sampling.orderby.number=${hiveconf:bigbench.hive.optimize.sampling.orderby.number}; set hive.optimize.sampling.orderby.percent=${hiveconf:bigbench.hive.optimize.sampling.orderby.percent}; --debug print set hive.optimize.sampling.orderby; set hive.optimize.sampling.orderby.number; set hive.optimize.sampling.orderby.percent; DROP TABLE IF EXISTS ${hiveconf:RESULT_TABLE}; CREATE TABLE ${hiveconf:RESULT_TABLE} ( u_id BIGINT ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS ${env:BIG_BENCH_hive_default_fileformat_result_table} LOCATION '${hiveconf:RESULT_DIR}'; INSERT INTO TABLE ${hiveconf:RESULT_TABLE} SELECT DISTINCT wcs_user_sk -- Find all customers -- TODO check if 37134 is first day of the month FROM ( -- web_clicks viewed items in date range with items from specified categories SELECT wcs_user_sk, wcs_click_date_sk FROM web_clickstreams, item WHERE wcs_click_date_sk BETWEEN 37134 AND (37134 + 30) -- in a given month and year AND i_category IN (${hiveconf:q12_i_category_IN}) -- filter given category AND wcs_item_sk = i_item_sk AND wcs_user_sk IS NOT NULL AND wcs_sales_sk IS NULL --only views, not purchases ) webInRange, ( -- store sales in date range with items from specified categories SELECT ss_customer_sk, ss_sold_date_sk FROM store_sales, item WHERE ss_sold_date_sk BETWEEN 37134 AND (37134 + 90) -- in the three consecutive months. AND i_category IN (${hiveconf:q12_i_category_IN}) -- filter given category AND ss_item_sk = i_item_sk AND ss_customer_sk IS NOT NULL ) storeInRange -- join web and store WHERE wcs_user_sk = ss_customer_sk AND wcs_click_date_sk < ss_sold_date_sk -- buy AFTER viewed on website ORDER BY wcs_user_sk --CLUSTER BY instead of ORDER BY does not work to achieve global ordering. e.g. 2 reducers: first reducer will write keys 0,2,4,6.. into file 000000_0 and reducer 2 will write keys 1,3,5,7,.. into file 000000_1.concatenating these files does not produces a deterministic result if number of reducer changes. --Solution: parallel "order by" as non parallel version only uses a single reducer and we cant use "limit" ;
<gh_stars>0 --DROP TABLE IF EXISTS company_info; CREATE TABLE IF NOT EXISTS company_info ( code VARCHAR(20), company VARCHAR(40), last_update DATE, PRIMARY KEY (code)); --DROP TABLE IF EXISTS daily_price; CREATE TABLE IF NOT EXISTS daily_price ( code VARCHAR(20), date DATE, open BIGINT(20), high BIGINT(20), low BIGINT(20), close BIGINT(20), diff BIGINT(20), volume BIGINT(20), PRIMARY KEY (code, date));