sql
stringlengths
6
1.05M
<filename>migrations/2021-09-20-154714_create_tasks/up.sql -- Your SQL goes here CREATE TABLE IF NOT EXISTS tasks ( id INTEGER NOT NULL PRIMARY KEY, text TEXT NOT NULL, completed INTEGER NOT NULL CHECK (completed IN (0, 1)), created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP )
<gh_stars>0 -- phpMyAdmin SQL Dump -- version 4.8.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 17 Des 2018 pada 11.21 -- Versi server: 10.1.31-MariaDB -- Versi PHP: 7.2.4 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: `crud_cici` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `pegawai` -- CREATE TABLE `pegawai` ( `id` int(3) NOT NULL, `nama` varchar(25) NOT NULL, `dept` varchar(25) NOT NULL, `telp` varchar(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `pegawai` -- INSERT INTO `pegawai` (`id`, `nama`, `dept`, `telp`) VALUES (121, 'Cici', 'HRD', '082345678904'), (122, 'Ghina', 'Marketing', '082116746876'), (123, 'Nurfa', 'Keuangan', '082192345678'), (124, 'Noni', 'HRD', '085241368997'), (125, 'Dinda', 'Merketing', '087465399811'), (126, 'Putri', 'Keuangan', '081245771234'); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `pegawai` -- ALTER TABLE `pegawai` ADD PRIMARY KEY (`id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 06, 2021 at 08:40 AM -- Server version: 10.4.19-MariaDB -- PHP Version: 8.0.6 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: `a_dat` -- -- -------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE `categories` ( `id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `slug` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `categories` -- INSERT INTO `categories` (`id`, `name`, `slug`) VALUES (1, 'Trang chủ', 'https://pubgm.zing.vn/'), (2, 'Tin Tức', 'https://pubgm.zing.vn/tin-tuc/danh-sach.1.html'), (3, 'Media', 'https://pubgm.zing.vn/media'), (4, 'Cẩm nang', 'https://pubgm.zing.vn/cam-nang.html'), (5, 'ESPORTS', 'https://giaidaupubgm.zing.vn/'), (6, 'Tài khoản', '#'); -- -------------------------------------------------------- -- -- Table structure for table `footer` -- CREATE TABLE `footer` ( `id` int(11) NOT NULL, `type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `name` varchar(1500) COLLATE utf8_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `footer` -- INSERT INTO `footer` (`id`, `type`, `name`) VALUES (2, 'cty', '© VNG 2016. Công Ty Cổ Phần VNG'), (3, 'dia_chi', 'Địa chỉ: Lô Z06 đường số 13, khu chế xuất Tân Thuận, Tân Thuận Đông, quận 7, TP. Hồ Chí Minh.'), (4, 'giay_phep', 'Giấy phép phê duyệt nội dung số: 41/QĐ-BTTTT ngày 9/1/2019 do Bộ Thông Tin và Truyền Thông cấp.'), (5, 'lhht', 'Liên hệ hợp tác:<a href=\"tel:099999999\"> 0999999999</a>'), (6, 'dksd', 'Điều Khoản Sử Dụng'); -- -------------------------------------------------------- -- -- Table structure for table `product` -- CREATE TABLE `product` ( `id` int(11) NOT NULL, `product` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL, `ciento` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `product` -- INSERT INTO `product` (`id`, `product`, `ciento`) VALUES (2, '1 Skin Súng Ngon', 14), (3, 'Thêm 10% May Mắn', 13); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `id_product` int(11) NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `type` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'user', `status` tinyint(1) NOT NULL DEFAULT 0, `updated_at` timestamp NULL DEFAULT current_timestamp(), `created_at` timestamp NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `id_product`, `email`, `password`, `type`, `status`, `updated_at`, `created_at`) VALUES (30, 2, '<EMAIL>', <PASSWORD>', 'admin', 0, '2021-05-31 17:12:07', '2021-05-31 17:12:07'); -- -- Indexes for dumped tables -- -- -- Indexes for table `categories` -- ALTER TABLE `categories` ADD PRIMARY KEY (`id`); -- -- Indexes for table `footer` -- ALTER TABLE `footer` ADD PRIMARY KEY (`id`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD KEY `id_product` (`id_product`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `categories` -- ALTER TABLE `categories` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `footer` -- ALTER TABLE `footer` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `product` -- ALTER TABLE `product` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31; -- -- Constraints for dumped tables -- -- -- Constraints for table `users` -- ALTER TABLE `users` ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`id_product`) REFERENCES `product` (`id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 CREATE USER [AppAuditUser] WITH PASSWORD = N'$(<PASSWORD>)'; GO GRANT CONNECT TO [AppAuditUser] GO
<reponame>Terry0532/burger<filename>db/seeds.sql<gh_stars>0 INSERT INTO burger (burger_name, devoured) VALUES ("Hot 'n Spicy McChicken Sandwich", 0), ("Astro Burger", 0), ("Zinger Burger", 0);
DROP TABLESPACE booktest INCLUDING CONTENTS AND DATAFILES; DROP USER booktest; CREATE TABLESPACE booktest NOLOGGING DATAFILE '/opt/oracle/oradata/ORASID/booktest.dbf' SIZE 100M AUTOEXTEND ON; CREATE USER booktest IDENTIFIED BY booktest DEFAULT TABLESPACE booktest; GRANT CONNECT, CREATE SESSION, CREATE TABLE, CREATE VIEW, CREATE SEQUENCE, CREATE PROCEDURE, CREATE TRIGGER, UNLIMITED TABLESPACE, SELECT ANY DICTIONARY TO booktest;
CREATE TABLE itemcategories ( id INT4 NOT NULL PRIMARY KEY, category VARCHAR(50) NOT NULL, description VARCHAR(100), validfrom TIMESTAMP WITH TIME ZONE, validto TIMESTAMP WITH TIME ZONE, updatedby VARCHAR(60) NULL ); -- Table comment COMMENT ON TABLE itemcategories IS '{"label": "Item Categories", "description": "Categories used to identify items seized at the border.", "owner": "<EMAIL>", "schemalastupdated": "03/12/2020", "dataversion": 1}'; -- Column comment COMMENT ON COLUMN itemcategories.id IS '{"label": "Identifier", "description": "Unique identifying column.", "summaryview": "false"}'; COMMENT ON COLUMN itemcategories.category IS '{"label": "Category", "businesskey": "true", "description": "Title of the item category.", "businesskey": "true", "summaryview": "false"}'; COMMENT ON COLUMN itemcategories.description IS '{"label": "Description", "description": "A short description of the item category.", "summaryview": "false"}'; COMMENT ON COLUMN itemcategories.validfrom IS '{"label": "Valid from date", "description": "Item valid from date.", "summaryview" : "false"}'; COMMENT ON COLUMN itemcategories.validto IS '{"label": "Valid to date", "description": "Item valid to date.", "summaryview" : "false"}'; COMMENT ON COLUMN itemcategories.updatedby IS '{"label": "Updated By", "description": "Record updated by", "summaryview": "false"}'; -- GRANTs GRANT SELECT,INSERT,UPDATE ON itemcategories TO ${serviceuser}; GRANT SELECT ON itemcategories TO ${readonlyuser};
<reponame>pradeepkumarcm-egov/DIGIT-Dev Insert into EG_ACTION (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, version, createdby, createddate, lastmodifiedby, lastmodifieddate, application) values (nextval('seq_eg_action'),'EstimateBudgetDetailsByFund','/voucher/common-ajaxLoadEstimateBudgetDetailsByFundId.action',null, (select id from eg_module where name='Budget Reports'), null,null,'false','EGF',0,1,current_date,1,current_date, (select id from eg_module where contextroot='egf' and parentmodule is null)); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='Super User'),(select id from eg_action where name='EstimateBudgetDetailsByFund')); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='ERP Report Viewer'),(select id from eg_action where name='EstimateBudgetDetailsByFund')); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='Financial Report Viewer'),(select id from eg_action where name='EstimateBudgetDetailsByFund')); Insert into EG_ACTION (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, version, createdby, createddate, lastmodifiedby, lastmodifieddate, application) values (nextval('seq_eg_action'),'EstimateBudgetDetailsByDept','/voucher/common-ajaxLoadEstimateBudgetDetailsByDepartmentId.action',null, (select id from eg_module where name='Budget Reports'), null,null,'false','EGF',0,1,current_date,1,current_date, (select id from eg_module where contextroot='egf' and parentmodule is null)); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='Super User'),(select id from eg_action where name='EstimateBudgetDetailsByDept')); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='ERP Report Viewer'),(select id from eg_action where name='EstimateBudgetDetailsByDept')); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='Financial Report Viewer'),(select id from eg_action where name='EstimateBudgetDetailsByDept')); Insert into EG_ACTION (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, version, createdby, createddate, lastmodifiedby, lastmodifieddate, application) values (nextval('seq_eg_action'),'EstimateBudgetDetailsByFunc','/voucher/common-ajaxLoadEstimateBudgetDetailsByFuncId.action',null, (select id from eg_module where name='Budget Reports'), null,null,'false','EGF',0,1,current_date,1,current_date, (select id from eg_module where contextroot='egf' and parentmodule is null)); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='Super User'),(select id from eg_action where name='EstimateBudgetDetailsByFunc')); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='ERP Report Viewer'),(select id from eg_action where name='EstimateBudgetDetailsByFunc')); INSERT INTO eg_roleaction (roleid, actionid) VALUES ( (select id from eg_role where name='Financial Report Viewer'),(select id from eg_action where name='EstimateBudgetDetailsByFunc'));
-- ================================================ -- Procedure to deal with user registration -- ================================================ USE [#INVEST] SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [Register] @name varchar(30), @lastname varchar(30), @email varchar(30), @cel varchar(30), @cpf varchar(30), @login varchar(30), @password varchar(30) AS BEGIN SET NOCOUNT ON; INSERT INTO Users VALUES (@name, @lastname, @email, @cel, @cpf, @login, @password); SELECT * FROM Users WHERE name = @name and lastname = @lastname and email = @email and cel = @cel and cpf = @cpf and login = @login and password = <PASSWORD>; END GO
-- ============================================= -- Author: -- Create date: -- Description: -- Directions for use: -- Replace YourSchemaName with the schema for your stage table. -- YourStageTableName with the name of your staging table. -- Drop your columns in row 16. -- Replace DatabaseName with the name of the source system. -- ============================================= USE ODS DROP TABLE IF EXISTS YourSchemaName.YourStageTableNameData GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE YourSchemaName.YourStageTableNameData( [ETLKey] [uniqueidentifier] NOT NULL, --your columns here. [UniqueDims] [varbinary](35) NULL, [UniqueRows] [varbinary](16) NULL, [SourceSystem] [nvarchar](255) NULL, [Cleansed] [bit] NULL, [ErrorRecord] [bit] NULL, [ErrorReason] [nvarchar](255) NULL, [Processed] [bit] NULL, [RunDate] [datetime] NULL, CONSTRAINT [PK_YourStageTableNameData] PRIMARY KEY CLUSTERED ( [ETLKey] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [YourSchemaName].[YourStageTableNameData] ADD CONSTRAINT [DF_YourStageTableNameData_ETLKey] DEFAULT (newid()) FOR [ETLKey] GO ALTER TABLE [YourSchemaName].[YourStageTableNameData] ADD CONSTRAINT [DF_YourStageTableNameData_SourceSystem] DEFAULT (N'DatabaseName') FOR [SourceSystem] GO ALTER TABLE [YourSchemaName].[YourStageTableNameData] ADD CONSTRAINT [DF_YourStageTableNameData_Cleansed] DEFAULT ((0)) FOR [Cleansed] GO ALTER TABLE [YourSchemaName].[YourStageTableNameData] ADD CONSTRAINT [DF_YourStageTableNameData_ErrorRecord] DEFAULT ((0)) FOR [ErrorRecord] GO ALTER TABLE [YourSchemaName].[YourStageTableNameData] ADD CONSTRAINT [DF_YourStageTableNameData_Processed] DEFAULT ((0)) FOR [Processed] GO ALTER TABLE [YourSchemaName].[YourStageTableNameData] ADD CONSTRAINT [DF_YourStageTableNameData_RunDate] DEFAULT (getdate()) FOR [RunDate] GO
-- wal.test -- -- execsql { INSERT INTO t2 SELECT blob(400), blob(400) FROM t2 } INSERT INTO t2 SELECT blob(400), blob(400) FROM t2
-- randexpr1.test -- -- db eval {SELECT ~~coalesce((select t1.a from t1 where case f*+e when ~11-coalesce((select max(t1.f) from t1 where t1.f>b),~case when b between 17 and e | coalesce((select max(a) from t1 where (f in (t1.b,f,a))),13) then f when -d<=d then t1.e else e end+13)+13 then d else d end+t1.f=d),b)+b FROM t1 WHERE b=b} SELECT ~~coalesce((select t1.a from t1 where case f*+e when ~11-coalesce((select max(t1.f) from t1 where t1.f>b),~case when b between 17 and e | coalesce((select max(a) from t1 where (f in (t1.b,f,a))),13) then f when -d<=d then t1.e else e end+13)+13 then d else d end+t1.f=d),b)+b FROM t1 WHERE b=b
<reponame>Shuttl-Tech/antlr_psql -- file:vacuum.sql ln:37 expect:true DELETE FROM vactst WHERE i != 0
<filename>src/test/resources/sql/select/37da1b87.sql<gh_stars>10-100 -- file:xml.sql ln:144 expect:true SELECT xmlpi(name "123")
INSERT INTO stock_price VALUES ('ukb1l',0,7,0.87,0.88,0.88,0.86,0.88,0.86,0.86,0.86,132,144662,125209.94),('ukb1l',1,1,0.85,0.86,0.87,0.84,0.86,0.86,0.86,0.86,150,187431,160060.53),('ukb1l',2,2,0.85,0.86,0.86,0.85,0.86,0.85,0.85,0.85,87,108633,92485.45),('ukb1l',3,3,0.85,0.85,0.86,0.85,0.85,0.85,0.85,0.85,122,316482,270207.03),('ukb1l',4,4,0.86,0.86,0.87,0.85,0.85,0.86,0.86,0.87,159,238629,204775.57),('ukb1l',5,7,0.9,0.86,0.91,0.86,0.86,0.91,0.91,0.91,295,334714,300178.47),('ukb1l',6,1,0.91,0.92,0.93,0.89,0.91,0.89,0.89,0.89,392,448434,407497.12),('ukb1l',7,2,0.89,0.89,0.89,0.88,0.89,0.88,0.88,0.88,117,107679,95430.21),('ukb1l',8,3,0.88,0.89,0.89,0.88,0.88,0.89,0.88,0.89,84,103807,91719.15),('ukb1l',9,4,0.89,0.89,0.9,0.87,0.89,0.9,0.9,0.91,166,259188,230723.36),('ukb1l',10,4,0.9,0.9,0.91,0.89,0.9,0.9,0.9,0.9,88,156249,140687.38),('ukb1l',11,5,0.91,0.9,0.91,0.9,0.9,0.91,0.9,0.91,23,28750,26135.63),('ukb1l',12,6,0.91,0.92,0.92,0.89,0.91,0.89,0.89,0.89,113,263658,238652.86),('ukb1l',13,7,0.89,0.89,0.9,0.88,0.89,0.89,0.89,0.89,96,140251,124882.25),('ukb1l',14,1,0.9,0.9,0.91,0.89,0.89,0.89,0.89,0.9,142,280873,252418.32),('ukb1l',15,4,0.88,0.88,0.89,0.87,0.89,0.88,0.88,0.88,111,122313,107706.67),('ukb1l',16,5,0.87,0.87,0.88,0.86,0.88,0.87,0.86,0.87,143,179319,155877.72),('ukb1l',17,6,0.86,0.86,0.87,0.85,0.87,0.87,0.87,0.87,133,130058,112309.94),('ukb1l',18,7,0.86,0.87,0.87,0.85,0.87,0.87,0.86,0.87,94,125727,108741.42),('ukb1l',19,1,0.86,0.87,0.87,0.86,0.87,0.87,0.86,0.87,36,24141,20851.51),('ukb1l',20,4,0.87,0.87,0.88,0.87,0.87,0.87,0.87,0.87,57,58632,51214.83),('ukb1l',21,5,0.87,0.87,0.87,0.86,0.87,0.87,0.87,0.87,50,293797,252791.16),('ukb1l',22,6,0.86,0.87,0.87,0.86,0.87,0.87,0.87,0.87,71,99994,86374.08),('ukb1l',23,7,0.86,0.87,0.87,0.86,0.87,0.86,0.86,0.86,77,66014,56718.47),('ukb1l',24,1,0.86,0.86,0.86,0.85,0.86,0.86,0.86,0.86,49,97757,83700.5),('ukb1l',25,6,0.85,0.86,0.86,0.85,0.86,0.85,0.85,0.85,68,76987,65716.05),('ukb1l',26,7,0.84,0.85,0.85,0.83,0.85,0.85,0.84,0.85,169,228386,191661.8),('ukb1l',27,1,0.84,0.84,0.84,0.83,0.85,0.84,0.83,0.84,120,169004,141424.45),('ukb1l',28,4,0.83,0.84,0.84,0.82,0.84,0.82,0.82,0.82,112,156816,130192.75),('ukb1l',29,3,0.81,0.82,0.82,0.8,0.82,0.8,0.8,0.81,253,348642,281519.81),('ukb1l',30,4,0.8,0.8,0.8,0.79,0.8,0.8,0.8,0.8,178,249977,199326.01),('ukb1l',31,5,0.79,0.8,0.8,0.78,0.8,0.79,0.79,0.79,155,247020,195044.65),('ukb1l',32,6,0.79,0.78,0.82,0.77,0.79,0.81,0.81,0.81,301,480740,381489.17),('ukb1l',33,2,0.0,0.81,0.0,0.0,0.81,0.81,0.0,0.0,0,0,0.0),('ukb1l',34,3,0.8,0.81,0.81,0.79,0.81,0.79,0.79,0.8,140,169790,135927.89),('ukb1l',35,4,0.79,0.8,0.8,0.79,0.79,0.79,0.79,0.79,99,88877,70260.11),('ukb1l',36,5,0.78,0.8,0.8,0.78,0.79,0.78,0.78,0.78,114,148387,116176.33),('ukb1l',37,6,0.8,0.8,0.81,0.79,0.78,0.79,0.79,0.79,205,320123,256311.72),('ukb1l',38,2,0.8,0.79,0.81,0.79,0.79,0.81,0.8,0.8,120,217051,172797.04),('ukb1l',39,3,0.8,0.81,0.81,0.79,0.81,0.79,0.79,0.8,114,150320,120210.64),('ukb1l',40,4,0.79,0.8,0.8,0.79,0.79,0.8,0.79,0.8,52,72479,57594.23),('ukb1l',41,5,0.8,0.8,0.81,0.8,0.8,0.8,0.8,0.81,85,174583,140305.0),('ukb1l',42,6,0.8,0.8,0.81,0.79,0.8,0.8,0.8,0.8,63,107987,86362.96),('ukb1l',43,2,0.78,0.8,0.8,0.77,0.8,0.77,0.77,0.77,167,349829,272716.08),('ukb1l',44,3,0.76,0.77,0.77,0.75,0.77,0.75,0.75,0.75,211,248921,188005.57),('ukb1l',45,4,0.74,0.75,0.75,0.74,0.75,0.74,0.74,0.75,291,718476,531707.16),('ukb1l',46,5,0.77,0.75,0.78,0.75,0.74,0.78,0.78,0.78,234,293775,225054.58),('ukb1l',47,6,0.77,0.78,0.78,0.76,0.78,0.77,0.77,0.77,152,207811,159737.2),('ukb1l',48,2,0.77,0.76,0.79,0.75,0.77,0.77,0.77,0.77,185,289037,223680.36),('ukb1l',49,3,0.76,0.78,0.78,0.76,0.77,0.76,0.76,0.76,106,174558,132637.91),('ukb1l',50,4,0.78,0.76,0.78,0.76,0.76,0.78,0.77,0.78,128,224167,174019.37),('ukb1l',51,5,0.78,0.78,0.79,0.77,0.78,0.78,0.78,0.78,73,62783,48917.79),('ukb1l',52,3,0.78,0.78,0.78,0.77,0.78,0.78,0.78,0.78,31,39948,30998.08),('ukb1l',53,6,0.78,0.78,0.79,0.78,0.78,0.78,0.78,0.78,65,88744,69465.12),('ukb1l',54,7,0.78,0.78,0.79,0.77,0.78,0.78,0.77,0.78,105,104521,81007.22),('ukb1l',55,1,0.78,0.78,0.79,0.78,0.78,0.78,0.78,0.78,85,103932,81091.12),('ukb1l',56,2,0.78,0.78,0.79,0.78,0.78,0.78,0.78,0.78,85,134193,104877.64),('ukb1l',57,3,0.78,0.78,0.78,0.77,0.78,0.77,0.77,0.78,92,129388,100332.14),('ukb1l',58,6,0.78,0.77,0.79,0.77,0.77,0.79,0.78,0.79,97,111587,86813.48),('ukb1l',59,7,0.81,0.79,0.82,0.79,0.79,0.81,0.81,0.82,279,485517,393219.83),('ukb1l',60,1,0.82,0.82,0.83,0.81,0.81,0.81,0.81,0.82,107,156037,127640.43),('ukb1l',61,2,0.8,0.81,0.81,0.79,0.81,0.8,0.79,0.8,83,92157,73471.04),('ukb1l',62,3,0.0,0.8,0.0,0.0,0.8,0.8,0.0,0.0,0,0,0.0),('ukb1l',63,6,0.8,0.8,0.8,0.79,0.8,0.8,0.79,0.8,38,37845,30125.57),('ukb1l',64,7,0.81,0.8,0.81,0.79,0.8,0.81,0.81,0.81,95,144661,116870.4),('ukb1l',65,1,0.82,0.81,0.83,0.81,0.81,0.83,0.83,0.83,115,174486,143582.94),('ukb1l',66,2,0.84,0.84,0.85,0.83,0.83,0.85,0.85,0.85,227,344063,290600.18),('ukb1l',67,3,0.86,0.86,0.87,0.85,0.85,0.87,0.87,0.87,247,347744,300701.59),('ukb1l',68,6,0.86,0.87,0.88,0.84,0.87,0.84,0.84,0.84,258,475292,407988.74),('ukb1l',69,7,0.84,0.84,0.85,0.83,0.84,0.85,0.85,0.85,142,228081,191411.61),('ukb1l',70,1,0.83,0.84,0.84,0.82,0.85,0.82,0.82,0.83,118,166570,138047.47),('ukb1l',71,2,0.82,0.82,0.83,0.81,0.82,0.81,0.81,0.82,110,174970,143823.68),('ukb1l',72,3,0.83,0.83,0.84,0.81,0.81,0.84,0.83,0.84,83,168601,140340.37),('ukb1l',73,3,0.83,0.83,0.84,0.83,0.84,0.84,0.83,0.84,74,74110,61824.79),('ukb1l',74,4,0.84,0.84,0.84,0.83,0.84,0.84,0.83,0.84,60,110517,92327.38),('ukb1l',75,5,0.83,0.84,0.84,0.83,0.84,0.83,0.83,0.84,57,42127,35141.02),('ukb1l',76,6,0.82,0.83,0.83,0.81,0.83,0.81,0.81,0.81,163,209665,172538.44),('ukb1l',77,7,0.8,0.81,0.81,0.79,0.81,0.79,0.79,0.79,194,235017,187495.83),('ukb1l',78,3,0.81,0.8,0.82,0.8,0.79,0.81,0.81,0.81,162,306924,247989.67),('ukb1l',79,4,0.8,0.81,0.81,0.8,0.81,0.8,0.8,0.8,55,68259,54905.0),('ukb1l',80,5,0.79,0.8,0.8,0.79,0.8,0.8,0.79,0.8,99,126915,100635.88),('ukb1l',81,6,0.79,0.8,0.8,0.78,0.8,0.78,0.78,0.78,104,126287,99940.44),('ukb1l',82,7,0.78,0.78,0.79,0.77,0.78,0.78,0.78,0.78,126,195853,153156.07),('ukb1l',83,3,0.75,0.76,0.77,0.74,0.78,0.74,0.74,0.75,291,564773,425090.6),('ukb1l',84,4,0.72,0.74,0.74,0.71,0.74,0.72,0.72,0.72,471,737801,532717.89),('ukb1l',85,5,0.72,0.73,0.74,0.71,0.72,0.71,0.71,0.71,262,362180,261259.96),('ukb1l',86,6,0.65,0.68,0.68,0.63,0.71,0.64,0.64,0.64,667,1282876,831613.35),('ukb1l',87,7,0.66,0.67,0.68,0.65,0.64,0.65,0.65,0.65,484,1266319,837959.17),('ukb1l',88,3,0.66,0.66,0.68,0.64,0.65,0.64,0.64,0.64,311,677083,443907.74),('ukb1l',89,4,0.58,0.62,0.62,0.56,0.64,0.57,0.57,0.57,732,1467505,859483.95),('ukb1l',90,5,0.58,0.58,0.59,0.56,0.57,0.57,0.57,0.57,482,978277,562969.61),('ukb1l',91,6,0.57,0.58,0.59,0.56,0.57,0.57,0.57,0.57,238,402451,230434.24),('ukb1l',92,7,0.55,0.57,0.57,0.54,0.57,0.54,0.54,0.54,260,442404,245327.38),('ukb1l',93,3,0.47,0.54,0.54,0.46,0.54,0.47,0.47,0.47,665,1296955,611121.39),('ukb1l',94,4,0.44,0.41,0.46,0.41,0.47,0.44,0.44,0.45,504,854440,374919.53),('ukb1l',95,3,0.47,0.47,0.49,0.46,0.44,0.47,0.46,0.47,308,587736,275601.18),('ukb1l',96,4,0.46,0.47,0.47,0.45,0.47,0.46,0.46,0.46,319,529591,244958.22),('ukb1l',97,5,0.45,0.45,0.45,0.44,0.46,0.45,0.45,0.45,204,327561,146643.74),('ukb1l',98,1,0.4,0.42,0.43,0.39,0.45,0.39,0.0,0.39,514,815419,328123.79),('ukb1l',99,2,0.34,0.36,0.37,0.33,0.39,0.34,0.34,0.34,640,1145884,392803.13),('ukb1l',100,3,0.29,0.29,0.32,0.29,0.34,0.29,0.29,0.29,755,2041445,599517.9),('ukb1l',101,4,0.32,0.31,0.33,0.31,0.29,0.33,0.33,0.0,326,818851,265776.32),('ukb1l',102,5,0.32,0.3,0.35,0.3,0.33,0.33,0.33,0.34,698,1948020,620660.56),('ukb1l',103,1,0.38,0.37,0.38,0.36,0.33,0.38,0.38,0.0,256,632074,239170.33),('ukb1l',104,2,0.44,0.44,0.44,0.44,0.38,0.44,0.44,0.0,144,449772,196697.09),('ukb1l',105,3,0.43,0.44,0.45,0.4,0.44,0.43,0.42,0.43,565,1149290,490901.37),('ukb1l',106,4,0.37,0.36,0.39,0.36,0.43,0.37,0.37,0.37,600,1363492,511137.75),('ukb1l',107,5,0.39,0.41,0.41,0.36,0.37,0.38,0.37,0.38,337,703382,273097.9),('ukb1l',108,1,0.38,0.39,0.39,0.37,0.38,0.39,0.38,0.39,191,482102,183980.78),('ukb1l',109,2,0.39,0.39,0.4,0.39,0.39,0.39,0.39,0.39,168,292049,113849.87),('ukb1l',110,3,0.37,0.37,0.37,0.36,0.39,0.36,0.36,0.36,176,339355,124359.53),('ukb1l',111,4,0.35,0.34,0.36,0.32,0.36,0.34,0.34,0.34,315,790111,273520.45),('ukb1l',112,5,0.32,0.34,0.34,0.32,0.34,0.32,0.32,0.32,279,655341,211494.54),('ukb1l',113,1,0.3,0.31,0.32,0.3,0.32,0.3,0.3,0.3,242,472917,142671.38),('ukb1l',114,2,0.32,0.32,0.33,0.31,0.3,0.32,0.31,0.32,262,1073940,340340.55),('ukb1l',115,3,0.33,0.34,0.34,0.33,0.32,0.34,0.34,0.34,244,462679,154238.77),('ukb1l',116,4,0.33,0.34,0.35,0.32,0.34,0.32,0.32,0.32,263,798077,263064.07),('ukb1l',117,5,0.32,0.32,0.33,0.31,0.32,0.32,0.32,0.32,149,370471,117409.06),('ukb1l',118,5,0.0,0.32,0.0,0.0,0.32,0.32,0.0,0.0,0,0,0.0),('ukb1l',119,6,0.33,0.32,0.34,0.31,0.32,0.34,0.34,0.34,237,989949,322085.81),('ukb1l',120,7,0.34,0.35,0.36,0.33,0.34,0.34,0.34,0.34,455,2327560,789787.12),('ukb1l',121,1,0.32,0.32,0.32,0.31,0.34,0.32,0.32,0.32,285,883556,281556.75),('ukb1l',122,2,0.32,0.32,0.32,0.31,0.32,0.32,0.31,0.32,193,1088048,344412.11),('ukb1l',123,5,0.3,0.3,0.3,0.29,0.32,0.3,0.3,0.3,359,905496,270395.56),('ukb1l',124,6,0.28,0.3,0.3,0.27,0.3,0.27,0.27,0.27,767,2647640,733391.62),('ukb1l',125,7,0.24,0.26,0.27,0.23,0.27,0.23,0.0,0.23,764,3164402,758358.01),('ukb1l',126,1,0.21,0.22,0.23,0.2,0.23,0.21,0.2,0.21,822,3628797,762400.23),('ukb1l',127,2,0.2,0.22,0.22,0.19,0.21,0.19,0.19,0.19,607,2300012,456092.59),('ukb1l',128,5,0.19,0.19,0.2,0.18,0.19,0.18,0.18,0.18,421,2090035,400044.26),('ukb1l',129,6,0.16,0.17,0.18,0.15,0.18,0.15,0.15,0.15,422,1616503,251683.17),('ukb1l',130,7,0.17,0.16,0.17,0.15,0.15,0.17,0.17,0.0,368,1458087,245686.9)
CREATE INDEX "IX_GEOGAUTHREC_WATERFEATURE" ON "GEOG_AUTH_REC" ("WATER_FEATURE")
<filename>target/scala-2.11/classes/evolutions/default/1.sql # Countries schema # !Ups CREATE TABLE person ( id int(20) AUTO_INCREMENT, name varchar(255), lastName varchar(255), phone1 varchar(255), phone2 varchar(255), PRIMARY KEY (id) ); # !Downs DROP TABLE person
<filename>kobby-maven-example-cinema-server/src/main/resources/db/migration/V0001__init.sql create table country ( id identity not null primary key, name varchar not null ); create table film ( id identity not null primary key, country_id bigint not null, title varchar not null, genre enum ('DRAMA', 'COMEDY', 'THRILLER', 'HORROR') not null, tags array not null, constraint fk_film_country foreign key (country_id) references country (id) on delete cascade ); create table actor ( id identity not null primary key, country_id bigint not null, first_name varchar not null, last_name varchar null, birthday date not null, gender enum ('MALE', 'FEMALE') not null, tags array not null, constraint fk_actor_country foreign key (country_id) references country (id) on delete cascade ); create table film_actor ( film_id bigint not null, actor_id bigint not null, constraint pk_film_actor primary key (film_id, actor_id), constraint fk_film_actor_film foreign key (film_id) references film (id) on delete cascade, constraint fk_film_actor_actor foreign key (actor_id) references actor (id) on delete cascade ); insert into country(id, name) values (0, 'Argentina'), (1, 'Australia'), (2, 'Austria'), (3, 'Belgium'), (4, 'Brazil'), (5, 'Canada'), (6, 'Finland'), (7, 'France'), (8, 'Germany'), (9, 'Italy'), (10, 'Japan'), (11, 'New Zealand'), (12, 'Norway'), (13, 'Portugal'), (14, 'Russia'), (15, 'Spain'), (16, 'Sweden'), (17, 'United Kingdom'), (18, 'USA'); insert into film(id, country_id, title, genre, tags) values (0, 7, 'Amelie', 'COMEDY', ('best', 'audrey')), (1, 7, 'A Very Long Engagement', 'DRAMA', ('audrey')), (2, 7, 'Hunting and Gathering', 'DRAMA', ('audrey')), (3, 7, 'Priceless', 'COMEDY', ('audrey')), (4, 17, 'House', 'COMEDY', ('best', 'house')), (5, 17, 'Peter''s Friends', 'COMEDY', ('house')), (6, 17, 'Street Kings', 'THRILLER', ('house')), (7, 17, 'Mr. Pip', 'DRAMA', ('house')), (8, 18, 'Ocean''s Eleven', 'THRILLER', ('best', 'julia', 'clooney')), (9, 18, 'Stepmom', 'DRAMA', ('julia')), (10, 18, 'Pretty Woman', 'COMEDY', ('julia')), (11, 18, 'From <NAME> Dawn', 'THRILLER', ('clooney')); insert into actor(id, country_id, first_name, last_name, birthday, gender, tags) values (0, 7, 'Audrey', 'Tautou', '1976-08-09', 'FEMALE', ('best', 'audrey')), (1, 7, 'Mathieu', 'Kassovitz', '1967-08-03', 'MALE', ()), (2, 7, 'Jamel', 'Debbouze', '1975-06-18', 'MALE', ('best')), (3, 7, 'Dominique', 'Pinon', '1955-03-04', 'MALE', ()), (4, 7, 'Gaspard', 'Ulliel', '1984-11-25', 'MALE', ()), (5, 7, 'Guillaume', 'Canet', '1973-04-10', 'MALE', ()), (6, 7, 'Gad', 'Elmaleh', '1971-04-19', 'MALE', ()), (7, 17, 'Hugh', 'Laurie', '1959-06-11', 'MALE', ('best', 'house')), (8, 17, 'Stephen', 'Fry', '1957-08-24', 'MALE', ('best')), (9, 18, 'Keanu', 'Reeves', '1964-09-02', 'MALE', ()), (10, 18, 'Julia', 'Roberts', '1967-10-28', 'FEMALE', ('best', 'julia')), (11, 18, 'George', 'Clooney', '1967-10-28', 'MALE', ('best', 'clooney')), (12, 18, 'Brad', 'Pitt', '1963-12-18', 'MALE', ()), (13, 18, 'Susan', 'Sarandon', '1946-10-04', 'FEMALE', ()), (14, 18, 'Richard', 'Gere', '1949-08-31', 'MALE', ()), (15, 18, 'Salma', 'Hayek', '1966-09-02', 'FEMALE', ()); insert into film_actor(film_id, actor_id) values (0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 3), (1, 4), (2, 0), (2, 5), (3, 0), (3, 6), (4, 7), (5, 7), (5, 8), (6, 7), (6, 9), (7, 7), (8, 10), (8, 11), (8, 12), (9, 10), (9, 13), (10, 10), (10, 14), (11, 11), (11, 15);
<reponame>mastapegs/ji-cloud<filename>backend/api/migrations/20210223233336_updated-at-trigger.sql create function set_updated_at() returns trigger language plpgsql as $$ begin new.updated_at = now(); return new; end; $$; create function trigger_updated_at(tbl regclass) returns void language plpgsql as $$ begin -- https://stackoverflow.com/a/10711349 execute format('create trigger set_updated_at before update on %s for each row when (old is distinct from new) execute function set_updated_at();', tbl); end; $$; select trigger_updated_at('locale_entry');
<filename>openGaussBase/testcase/GUC/CLIENTCONNECTION/Opengauss_Function_Guc_ClientConnection_Case0015.sql -- @testpoint: 将pg_catalog模式加入search_path设为搜素路径最后位置,有告警;建表,合理报错 --step1:查看默认搜索路径;expect:成功 show search_path; --step2:设置搜索路径,系统路径在后;expect:成功 set search_path to "$user",publi,pg_catalog; --step3:查看;expect:设置成功 show search_path; --step4:创建表;expect:合理报错 drop table if exists t_clientconnection_0015; create table t_clientconnection_0015(id int); --step5:恢复默认;expect:成功 set search_path to "$user",public; show search_path;
<reponame>kar-tamalika1412/legal_desk -- phpMyAdmin SQL Dump -- version 4.9.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Mar 10, 2020 at 06:50 PM -- Server version: 10.4.6-MariaDB -- PHP Version: 7.1.31 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `ci_test` -- -- -------------------------------------------------------- -- -- Table structure for table `articles` -- CREATE TABLE `articles` ( `id` int(20) NOT NULL, `user_id` int(10) UNSIGNED NOT NULL, `title` varchar(255) NOT NULL, `body` text NOT NULL, `created_at` varchar(255) NOT NULL, `image_path` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `articles` -- INSERT INTO `articles` (`id`, `user_id`, `title`, `body`, `created_at`, `image_path`) VALUES (1, 1, 'Test Article', 'Test Article', '2020-03-07 13:48:05', ''), (44, 2, 'Test1', '1', '2020-03-07 10:37:12am', ''), (45, 2, 'Test2', '2', '2020-03-07 10:37:20am', ''), (46, 2, 'Gym', ' How will my life be different if I go to the gym everyday?\r\n\r\nI haven\'t missed a single workout in past 1.5+ year (only if I have to go outside the city due to work).\r\n\r\nOct-2016\r\n\r\nI don\'t like the reflection of myself- lanky, lost in the world, lost in the world that I have created around myself.\r\n\r\nEven when I was settled, I wasn\'t happy, mornings were tough. I have always been a bit conscious about my surroundings and I see the world in a different way. This has led to the feeling of isolation from my surroundings even when everything around me was good.\r\n\r\nI met psychiatrist, he convinced me do some sort of exercises and it made some sense to me as well.\r\n\r\n“If I am working out, I will not be living in my own world, I don’t have to deal with the morning”- That was my thought.\r\n\r\nI started with running, 3 km then 5 km then cycling sometimes 40 km sometimes even more. Running was good but it was not rewarding. I could not go below 27 minutes for 5 km, I tried, I failed. It teaches you lesson. It was exhausting. It was painful. The only thing that gave me relief was the sweat, mind usually went into meditation mode, it did not care about the world. But as soon as I reached home, reality again hit me on the face.\r\n\r\nI need more sweat, more rewarding things, this led me to the gym.\r\n\r\nWeights were demanding, so was I. They need someone to lift them, so did my self esteem. It was a relation, a love and respect for each other.\r\n\r\nFast forward 2018:\r\n\r\n 5.30 am- Wake up, get the coffee going on the side, take pre- workout essentials.\r\n 6:15 am- Its Saturday. When most people are enjoying the Weekend morning, its time to hit the legs.\r\n 7.45 am- Stuff up all the gym clothing,bottles in bag, heads towards home.\r\n 7.55 am- Breakfast is on the stove, chia seeds are ready, need to prepare the almonds, eggs are in egg boiler. Time is running out for office.\r\n 8:05 am- Apple and peanuts for evening snacks, goes into the office bag. One more thing done. Need to set the curd of dinner. Done..!!\r\n 8:20 am- Shower is done, time to eat the breakfast.\r\n 8.30 am- Breakfast done, time to peel the eggs. Outside home, office vehicle is honking now, rushes through the egg, put them in container, will eat around 11 am in office. Packs the bag and leave for office.\r\n\r\nThis is how every morning looks like. No time for mind to wonder around, no time for sit and think about future, the mistakes of past, regrets and wondering about the meaning of life.\r\n\r\nMind still tries to run away with the past and future but present is quite strict, it doesn’t like when he try to console the past or build dreams with future.', '2020-03-07 11:22:56am', ''), (47, 2, 'Test for space', 'his\r\n\r\n\r\n\r\n\r\n\r\nspace \r\n\r\n\r\n\r\nhi', '2020-03-07 11:29:34am', ''), (48, 2, 'Test Article Title', 'test', '2020-03-09 10:17:28am', ''), (49, 2, 'Test Final', 'Final', '2020-03-09 04:37:51pm', 'http://[::1]/ci/uploads/PHOTO8.jpg'), (50, 2, 'Test Article Title', '<b>HI I am bold</b>', '2020-03-10 04:28:56am', 'http://[::1]/ci/uploads/PHOTO9.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `uname` varchar(100) NOT NULL, `pword` varchar(255) NOT NULL, `fname` varchar(100) NOT NULL, `lname` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `uname`, `pword`, `fname`, `lname`) VALUES (1, 'goransh', 'goransh', 'Goransh', 'Bhatia'), (2, 'Richa92', 'Richa@1992', 'Richa', 'Pathak'), (3, 'Manju20', 'Manju@2020', 'Manju', 'Bhatia'); -- -- Indexes for dumped tables -- -- -- Indexes for table `articles` -- ALTER TABLE `articles` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `articles` -- ALTER TABLE `articles` MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 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 */;
USE Ratemanagement3; /* Lock wait timeout - 1wordtec and other env */ DROP PROCEDURE IF EXISTS `prc_UpdateMysqlPID`; DELIMITER // CREATE PROCEDURE `prc_UpdateMysqlPID`( IN `p_processId` VARCHAR(200) ) BEGIN DECLARE MysqlPID VARCHAR(200); -- SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SELECT CONNECTION_ID() into MysqlPID; UPDATE tblCronJob SET MysqlPID=MysqlPID WHERE ProcessID=p_processId; COMMIT; -- SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; END// DELIMITER ; /* END- Lock wait timeout - 1wordtec and other env */ /* Tickets Changes */ DROP PROCEDURE prc_GetSystemTicket; DELIMITER // CREATE PROCEDURE `prc_GetSystemTicket`( IN `p_CompanyID` int, IN `p_Search` VARCHAR(100), IN `P_Status` VARCHAR(100), IN `P_Priority` VARCHAR(100), IN `P_Group` VARCHAR(100), IN `P_Agent` VARCHAR(100), IN `P_DueBy` VARCHAR(50), IN `P_CurrentDate` DATETIME, IN `p_PageNumber` INT, IN `p_RowspPage` INT, IN `p_lSortCol` VARCHAR(50), IN `p_SortOrder` VARCHAR(5), IN `p_isExport` INT, IN `p_StartDate` DATETIME, IN `p_EndDate` DATETIME, IN `p_is_StartDate` INT, IN `p_is_EndDate` INT, IN `p_Requester` VARCHAR(255), IN `p_LastReply` INT ) BEGIN DECLARE v_OffSet_ int; DECLARE v_Round_ int; DECLARE v_Groups_ varchar(200); SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET v_OffSet_ = (p_PageNumber * p_RowspPage) - p_RowspPage; IF p_isExport = 0 THEN SELECT T.TicketID, T.Subject, CASE WHEN T.AccountID>0 THEN (SELECT CONCAT(IFNULL(TAA.AccountName,''),' (',T.Requester,')') FROM tblAccount TAA WHERE TAA.AccountID = T.AccountID ) WHEN T.ContactID>0 THEN (select CONCAT(IFNULL(TCCC.FirstName,''),' ',IFNULL(TCCC.LastName,''),' (',T.Requester,')') FROM tblContact TCCC WHERE TCCC.ContactID = T.ContactID) WHEN T.UserID>0 THEN (select CONCAT(IFNULL(TUU.FirstName,''),' ',IFNULL(TUU.LastName,''),' (',T.Requester,')') FROM tblUser TUU WHERE TUU.UserID = T.UserID ) ELSE CONCAT(T.RequesterName,' (',T.Requester,')') END AS Requester, T.Requester as RequesterEmail, TFV.FieldValueAgent as TicketStatus, TP.PriorityValue, concat(TU.FirstName,' ',TU.LastName) as Agent, TG.GroupName, T.created_at, (select tc.created_at from AccountEmailLog tc where tc.TicketID = T.TicketID and tc.EmailCall =1 and tc.EmailParent>0 order by tc.AccountEmailLogID desc limit 1) as CustomerResponse, (select tc.created_at from AccountEmailLog tc where tc.TicketID = T.TicketID and tc.EmailCall =0 order by tc.AccountEmailLogID desc limit 1) as AgentResponse, (select TAC.AccountID from tblAccount TAC where TAC.Email = T.Requester or TAC.BillingEmail =T.Requester limit 1) as ACCOUNTID, T.`Read` as `Read`, T.TicketSlaID, T.DueDate, T.updated_at, T.Status, T.AgentRepliedDate, T.CustomerRepliedDate FROM tblTickets T LEFT JOIN tblTicketfieldsValues TFV ON TFV.ValuesID = T.Status LEFT JOIN tblTicketPriority TP ON TP.PriorityID = T.Priority LEFT JOIN tblUser TU ON TU.UserID = T.Agent LEFT JOIN tblTicketGroups TG ON TG.GroupID = T.`Group` WHERE T.CompanyID = p_CompanyID AND (p_Search = '' OR ( p_Search != '' AND (T.Subject like Concat('%',p_Search,'%') OR T.Description like Concat('%',p_Search,'%') OR T.Requester like Concat('%',p_Search,'%') OR T.RequesterName like Concat('%',p_Search,'%') ) OR (T.TicketID in ( select ael.TicketID from AccountEmailLog ael where ael.CompanyID = p_CompanyID AND (ael.Subject like Concat('%',p_Search,'%') OR ael.Emailfrom like Concat('%',p_Search,'%') OR ael.EmailfromName like Concat('%',p_Search,'%') OR ael.Message like Concat('%',p_Search,'%') ) ) ) ) ) AND (P_Status = '' OR find_in_set(T.`Status`,P_Status)) AND (P_Priority = '' OR find_in_set(T.`Priority`,P_Priority)) AND (P_Group = '' OR find_in_set(T.`Group`,P_Group)) AND (P_Agent = '' OR find_in_set(T.`Agent`,P_Agent)) AND (p_Requester = '' OR find_in_set(T.`Requester`,p_Requester)) AND (p_is_StartDate = 0 OR ( p_is_StartDate != 0 AND DATE(T.created_at) >= p_StartDate)) AND (p_is_EndDate = 0 OR ( p_is_EndDate != 0 AND DATE(T.created_at) <= p_EndDate)) AND ( P_DueBy = '' OR ( P_DueBy != '' AND ( (find_in_set('Today',P_DueBy) AND DATE(T.DueDate) = DATE(P_CurrentDate)) OR (find_in_set('Tomorrow',P_DueBy) AND DATE(T.DueDate) = DATE(DATE_ADD(P_CurrentDate, INTERVAL 1 Day))) OR (find_in_set('Next_8_hours',P_DueBy) AND T.DueDate BETWEEN P_CurrentDate AND DATE_ADD(P_CurrentDate, INTERVAL 8 Hour)) OR (find_in_set('Overdue',P_DueBy) AND P_CurrentDate >= T.DueDate ) ) ) ) AND ( p_LastReply = 0 OR CASE WHEN T.AgentRepliedDate is not null AND T.CustomerRepliedDate is not null THEN CASE WHEN p_LastReply = 7 THEN DATE(T.AgentRepliedDate) <= DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate > T.CustomerRepliedDate THEN DATE(T.AgentRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate < T.CustomerRepliedDate THEN DATE(T.CustomerRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) END WHEN T.AgentRepliedDate is null OR T.CustomerRepliedDate is null THEN CASE WHEN p_LastReply = 7 THEN DATE(T.AgentRepliedDate) <= DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.CustomerRepliedDate is null AND (T.AgentRepliedDate is not null) THEN DATE(T.AgentRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate is null AND (T.CustomerRepliedDate is not null) THEN DATE(T.CustomerRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) END END ) ORDER BY CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'SubjectASC') THEN T.Subject END ASC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'SubjectDESC') THEN T.Subject END DESC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'StatusASC') THEN TicketStatus END ASC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'StatusDESC') THEN TicketStatus END DESC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'AgentASC') THEN TU.FirstName END ASC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'AgentDESC') THEN TU.FirstName END DESC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'created_atASC') THEN T.created_at END ASC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'created_atDESC') THEN T.created_at END DESC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'updated_atASC') THEN T.updated_at END ASC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'updated_atDESC') THEN T.updated_at END DESC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'RequesterASC') THEN T.Requester END ASC, CASE WHEN (CONCAT(p_lSortCol,p_SortOrder) = 'RequesterDESC') THEN T.Requester END DESC LIMIT p_RowspPage OFFSET v_OffSet_; SELECT COUNT(*) AS totalcount FROM tblTickets T LEFT JOIN tblTicketfieldsValues TFV ON TFV.ValuesID = T.Status LEFT JOIN tblTicketPriority TP ON TP.PriorityID = T.Priority LEFT JOIN tblUser TU ON TU.UserID = T.Agent LEFT JOIN tblTicketGroups TG ON TG.GroupID = T.`Group` WHERE T.CompanyID = p_CompanyID AND (p_Search = '' OR ( p_Search != '' AND (T.Subject like Concat('%',p_Search,'%') OR T.Description like Concat('%',p_Search,'%') OR T.Requester like Concat('%',p_Search,'%') OR T.RequesterName like Concat('%',p_Search,'%') ) OR (T.TicketID in ( select ael.TicketID from AccountEmailLog ael where ael.CompanyID = p_CompanyID AND (ael.Subject like Concat('%',p_Search,'%') OR ael.Emailfrom like Concat('%',p_Search,'%') OR ael.EmailfromName like Concat('%',p_Search,'%') OR ael.Message like Concat('%',p_Search,'%') ) ) ) ) ) AND (P_Status = '' OR find_in_set(T.`Status`,P_Status)) AND (P_Priority = '' OR find_in_set(T.`Priority`,P_Priority)) AND (P_Group = '' OR find_in_set(T.`Group`,P_Group)) AND (P_Agent = '' OR find_in_set(T.`Agent`,P_Agent)) AND (p_Requester = '' OR find_in_set(T.`Requester`,p_Requester)) AND (p_is_StartDate = 0 OR ( p_is_StartDate != 0 AND DATE(T.created_at) >= p_StartDate)) AND (p_is_EndDate = 0 OR ( p_is_EndDate != 0 AND DATE(T.created_at) <= p_EndDate)) AND ((P_DueBy = '' OR (find_in_set('Today',P_DueBy) AND DATE(T.DueDate) = DATE(P_CurrentDate))) OR (find_in_set('Tomorrow',P_DueBy) AND DATE(T.DueDate) = DATE(DATE_ADD(P_CurrentDate, INTERVAL 1 Day))) OR (find_in_set('Next_8_hours',P_DueBy) AND T.DueDate BETWEEN P_CurrentDate AND DATE_ADD(P_CurrentDate, INTERVAL 8 Hour)) OR (find_in_set('Overdue',P_DueBy) AND P_CurrentDate >= T.DueDate)) AND ( p_LastReply = 0 OR CASE WHEN T.AgentRepliedDate is not null AND T.CustomerRepliedDate is not null THEN CASE WHEN p_LastReply = 7 THEN DATE(T.AgentRepliedDate) <= DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate > T.CustomerRepliedDate THEN DATE(T.AgentRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate < T.CustomerRepliedDate THEN DATE(T.CustomerRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) END WHEN T.AgentRepliedDate is null OR T.CustomerRepliedDate is null THEN CASE WHEN p_LastReply = 7 THEN DATE(T.AgentRepliedDate) <= DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.CustomerRepliedDate is null AND (T.AgentRepliedDate is not null) THEN DATE(T.AgentRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate is null AND (T.CustomerRepliedDate is not null) THEN DATE(T.CustomerRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) END END ); SELECT DISTINCT(TG.GroupID), TG.GroupName FROM tblTickets T LEFT JOIN tblTicketfieldsValues TFV ON TFV.ValuesID = T.Status LEFT JOIN tblTicketPriority TP ON TP.PriorityID = T.Priority LEFT JOIN tblUser TU ON TU.UserID = T.Agent LEFT JOIN tblTicketGroups TG ON TG.GroupID = T.`Group` WHERE T.CompanyID = p_CompanyID AND (p_Search = '' OR ( p_Search != '' AND (T.Subject like Concat('%',p_Search,'%') OR T.Description like Concat('%',p_Search,'%') OR T.Requester like Concat('%',p_Search,'%') OR T.RequesterName like Concat('%',p_Search,'%') ) OR (T.TicketID in ( select ael.TicketID from AccountEmailLog ael where ael.CompanyID = p_CompanyID AND (ael.Subject like Concat('%',p_Search,'%') OR ael.Emailfrom like Concat('%',p_Search,'%') OR ael.EmailfromName like Concat('%',p_Search,'%') OR ael.Message like Concat('%',p_Search,'%') ) ) ) ) ) AND (P_Status = '' OR find_in_set(T.`Status`,P_Status)) AND (P_Priority = '' OR find_in_set(T.`Priority`,P_Priority)) AND (P_Group = '' OR find_in_set(T.`Group`,P_Group)) AND (P_Agent = '' OR find_in_set(T.`Agent`,P_Agent)) AND (p_Requester = '' OR find_in_set(T.`Requester`,p_Requester)) AND (p_is_StartDate = 0 OR ( p_is_StartDate != 0 AND DATE(T.created_at) >= p_StartDate)) AND (p_is_EndDate = 0 OR ( p_is_EndDate != 0 AND DATE(T.created_at) <= p_EndDate)) AND ((P_DueBy = '' OR (find_in_set('Today',P_DueBy) AND DATE(T.DueDate) = DATE(P_CurrentDate))) OR (find_in_set('Tomorrow',P_DueBy) AND DATE(T.DueDate) = DATE(DATE_ADD(P_CurrentDate, INTERVAL 1 Day))) OR (find_in_set('Next_8_hours',P_DueBy) AND T.DueDate BETWEEN P_CurrentDate AND DATE_ADD(P_CurrentDate, INTERVAL 8 Hour)) OR (find_in_set('Overdue',P_DueBy) AND P_CurrentDate >= T.DueDate ) ) AND ( p_LastReply = 0 OR CASE WHEN T.AgentRepliedDate is not null AND T.CustomerRepliedDate is not null THEN CASE WHEN p_LastReply = 7 THEN DATE(T.AgentRepliedDate) <= DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate > T.CustomerRepliedDate THEN DATE(T.AgentRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate < T.CustomerRepliedDate THEN DATE(T.CustomerRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) END WHEN T.AgentRepliedDate is null OR T.CustomerRepliedDate is null THEN CASE WHEN p_LastReply = 7 THEN DATE(T.AgentRepliedDate) <= DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.CustomerRepliedDate is null AND (T.AgentRepliedDate is not null) THEN DATE(T.AgentRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate is null AND (T.CustomerRepliedDate is not null) THEN DATE(T.CustomerRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) END END ); END IF; IF p_isExport = 1 THEN SELECT T.TicketID, T.Subject, T.Requester, T.RequesterCC as 'CC', TFV.FieldValueAgent as 'Status', TP.PriorityValue as 'Priority', concat(TU.FirstName,' ',TU.LastName) as Agent, T.created_at as 'Date Created', TG.GroupName as 'Group' FROM tblTickets T LEFT JOIN tblTicketfieldsValues TFV ON TFV.ValuesID = T.Status LEFT JOIN tblTicketPriority TP ON TP.PriorityID = T.Priority LEFT JOIN tblUser TU ON TU.UserID = T.Agent LEFT JOIN tblTicketGroups TG ON TG.GroupID = T.`Group` LEFT JOIN tblContact TCC ON TCC.Email = T.`Requester` WHERE T.CompanyID = p_CompanyID AND (p_Search = '' OR ( p_Search != '' AND (T.Subject like Concat('%',p_Search,'%') OR T.Description like Concat('%',p_Search,'%') OR T.Requester like Concat('%',p_Search,'%') OR T.RequesterName like Concat('%',p_Search,'%') ) OR (T.TicketID in ( select ael.TicketID from AccountEmailLog ael where ael.CompanyID = p_CompanyID AND (ael.Subject like Concat('%',p_Search,'%') OR ael.Emailfrom like Concat('%',p_Search,'%') OR ael.EmailfromName like Concat('%',p_Search,'%') OR ael.Message like Concat('%',p_Search,'%') ) ) ) ) ) AND (P_Status = '' OR find_in_set(T.`Status`,P_Status)) AND (P_Priority = '' OR find_in_set(T.`Priority`,P_Priority)) AND (P_Group = '' OR find_in_set(T.`Group`,P_Group)) AND (P_Agent = '' OR find_in_set(T.`Agent`,P_Agent)) AND (p_Requester = '' OR find_in_set(T.`Requester`,p_Requester)) AND (p_is_StartDate = 0 OR ( p_is_StartDate != 0 AND DATE(T.created_at) >= p_StartDate)) AND (p_is_EndDate = 0 OR ( p_is_EndDate != 0 AND DATE(T.created_at) <= p_EndDate)) AND ((P_DueBy = '' OR (find_in_set('Today',P_DueBy) AND DATE(T.DueDate) = DATE(P_CurrentDate))) OR (find_in_set('Tomorrow',P_DueBy) AND DATE(T.DueDate) = DATE(DATE_ADD(P_CurrentDate, INTERVAL 1 Day))) OR (find_in_set('Next_8_hours',P_DueBy) AND T.DueDate BETWEEN P_CurrentDate AND DATE_ADD(P_CurrentDate, INTERVAL 8 Hour)) OR (find_in_set('Overdue',P_DueBy) AND P_CurrentDate >= T.DueDate )) AND ( p_LastReply = 0 OR CASE WHEN T.AgentRepliedDate is not null AND T.CustomerRepliedDate is not null THEN CASE WHEN p_LastReply = 7 THEN DATE(T.AgentRepliedDate) <= DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate > T.CustomerRepliedDate THEN DATE(T.AgentRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate < T.CustomerRepliedDate THEN DATE(T.CustomerRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) END WHEN T.AgentRepliedDate is null OR T.CustomerRepliedDate is null THEN CASE WHEN p_LastReply = 7 THEN DATE(T.AgentRepliedDate) <= DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.CustomerRepliedDate is null AND (T.AgentRepliedDate is not null) THEN DATE(T.AgentRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) WHEN T.AgentRepliedDate is null AND (T.CustomerRepliedDate is not null) THEN DATE(T.CustomerRepliedDate) = DATE_ADD(CURDATE(), INTERVAL CONCAT("-",p_LastReply) DAY) END END ); END IF; SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; END// DELIMITER ; /* ----------- Billing --------- */ USE NeonBillingDev; DROP PROCEDURE IF EXISTS `prc_getInvoiceUsage`; DELIMITER // CREATE PROCEDURE `prc_getInvoiceUsage`( IN `p_CompanyID` INT, IN `p_AccountID` INT, IN `p_ServiceID` INT, IN `p_GatewayID` INT, IN `p_StartDate` DATETIME, IN `p_EndDate` DATETIME, IN `p_ShowZeroCall` INT ) BEGIN DECLARE v_InvoiceCount_ INT; DECLARE v_BillingTime_ INT; DECLARE v_CDRType_ INT; DECLARE v_AvgRound_ INT; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SELECT fnGetBillingTime(p_GatewayID,p_AccountID) INTO v_BillingTime_; CALL fnServiceUsageDetail(p_CompanyID,p_AccountID,p_GatewayID,p_ServiceID,p_StartDate,p_EndDate,v_BillingTime_); SELECT it.CDRType,b.RoundChargesCDR INTO v_CDRType_, v_AvgRound_ FROM NeonRMDev.tblAccountBilling ab INNER JOIN NeonRMDev.tblBillingClass b ON b.BillingClassID = ab.BillingClassID INNER JOIN tblInvoiceTemplate it ON it.InvoiceTemplateID = b.InvoiceTemplateID WHERE ab.AccountID = p_AccountID AND ab.ServiceID = p_ServiceID LIMIT 1; IF( v_CDRType_ = 2) THEN DROP TEMPORARY TABLE IF EXISTS tmp_tblSummaryUsageDetails_; CREATE TEMPORARY TABLE IF NOT EXISTS tmp_tblSummaryUsageDetails_( AccountID int, area_prefix varchar(50), trunk varchar(50), UsageDetailID int, duration int, billed_duration int, cost decimal(18,6), ServiceID INT, AvgRate decimal(18,6) ); INSERT INTO tmp_tblSummaryUsageDetails_ SELECT AccountID, area_prefix, trunk, UsageDetailID, duration, billed_duration, cost, ServiceID, ROUND((uh.cost/uh.billed_duration)*60.0,v_AvgRound_) as AvgRate FROM tmp_tblUsageDetails_ uh; SELECT area_prefix AS AreaPrefix, Trunk, (SELECT Country FROM NeonRMDev.tblRate r INNER JOIN NeonRMDev.tblCountry c ON c.CountryID = r.CountryID WHERE r.Code = ud.area_prefix limit 1) AS Country, (SELECT Description FROM NeonRMDev.tblRate r WHERE r.Code = ud.area_prefix limit 1 ) AS Description, COUNT(UsageDetailID) AS NoOfCalls, CONCAT( FLOOR(SUM(duration ) / 60), ':' , SUM(duration ) % 60) AS Duration, CONCAT( FLOOR(SUM(billed_duration ) / 60),':' , SUM(billed_duration ) % 60) AS BillDuration, SUM(cost) AS ChargedAmount, SUM(duration ) as DurationInSec, SUM(billed_duration ) as BillDurationInSec, ud.ServiceID, ud.AvgRate as AvgRatePerMin FROM tmp_tblSummaryUsageDetails_ ud GROUP BY ud.area_prefix,ud.Trunk,ud.AccountID,ud.ServiceID,ud.AvgRate; ELSE SELECT trunk AS Trunk, area_prefix AS Prefix, CONCAT("'",cli) AS CLI, CONCAT("'",cld) AS CLD, (SELECT Country FROM NeonRMDev.tblRate r INNER JOIN NeonRMDev.tblCountry c ON c.CountryID = r.CountryID WHERE r.Code = ud.area_prefix limit 1) AS Country, (SELECT Description FROM NeonRMDev.tblRate r INNER JOIN NeonRMDev.tblCountry c ON c.CountryID = r.CountryID WHERE r.Code = ud.area_prefix limit 1) AS Description, CASE WHEN is_inbound=1 then 'Incoming' ELSE 'Outgoing' END as CallType, connect_time AS ConnectTime, disconnect_time AS DisconnectTime, billed_duration AS BillDuration, SEC_TO_TIME(billed_duration) AS BillDurationMinutes, cost AS ChargedAmount, ServiceID FROM tmp_tblUsageDetails_ ud WHERE ((p_ShowZeroCall =0 AND ud.cost >0 ) OR (p_ShowZeroCall =1 AND ud.cost >= 0)) ORDER BY connect_time ASC; END IF; SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; END// DELIMITER ; /*New Add RatePrefix in Account- Bulk Ratesheet Email - VOS Change*/ INSERT INTO `tblCompanyConfiguration` (`CompanyID`, `Key`, `Value`) VALUES (1, 'VOS_RATEPREFIX_RATESHEET', '0'); DROP PROCEDURE IF EXISTS `prc_WSGenerateRateSheet`; DELIMITER // CREATE PROCEDURE `prc_WSGenerateRateSheet`( IN `p_CustomerID` INT, IN `p_Trunk` VARCHAR(100), IN `p_TimezonesID` INT, IN `p_RatePrefix` VARCHAR(255) ) BEGIN DECLARE v_trunkDescription_ VARCHAR(50); DECLARE v_lastRateSheetID_ INT ; DECLARE v_IncludePrefix_ TINYINT; DECLARE v_Prefix_ VARCHAR(50); DECLARE v_codedeckid_ INT; DECLARE v_ratetableid_ INT; DECLARE v_RateTableAssignDate_ DATETIME; DECLARE v_NewA2ZAssign_ INT; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SELECT trunk INTO v_trunkDescription_ FROM tblTrunk WHERE TrunkID = p_Trunk; DROP TEMPORARY TABLE IF EXISTS tmp_RateSheetRate_; CREATE TEMPORARY TABLE tmp_RateSheetRate_( RateID INT, Destination VARCHAR(200), Codes VARCHAR(50), Interval1 INT, IntervalN INT, Rate DECIMAL(18, 6), `level` VARCHAR(50), `change` VARCHAR(50), EffectiveDate DATE, EndDate DATE, INDEX tmp_RateSheetRate_RateID (`RateID`) ); DROP TEMPORARY TABLE IF EXISTS tmp_CustomerRates_; CREATE TEMPORARY TABLE tmp_CustomerRates_ ( RateID INT, Interval1 INT, IntervalN INT, Rate DECIMAL(18, 6), EffectiveDate DATE, EndDate DATE, LastModifiedDate DATETIME, INDEX tmp_CustomerRates_RateId (`RateID`) ); DROP TEMPORARY TABLE IF EXISTS tmp_RateTableRate_; CREATE TEMPORARY TABLE tmp_RateTableRate_ ( RateID INT, Interval1 INT, IntervalN INT, Rate DECIMAL(18, 6), EffectiveDate DATE, EndDate DATE, updated_at DATETIME, INDEX tmp_RateTableRate_RateId (`RateID`) ); DROP TEMPORARY TABLE IF EXISTS tmp_RateSheetDetail_; CREATE TEMPORARY TABLE tmp_RateSheetDetail_ ( ratesheetdetailsid int, RateID int , RateSheetID int, Destination varchar(200), Code varchar(50), Rate DECIMAL(18, 6), `change` varchar(50), EffectiveDate Date, EndDate DATE, INDEX tmp_RateSheetDetail_RateId (`RateID`,`RateSheetID`) ); SELECT RateSheetID INTO v_lastRateSheetID_ FROM tblRateSheet WHERE CustomerID = p_CustomerID AND level = v_trunkDescription_ AND TimezonesID = p_TimezonesID ORDER BY RateSheetID DESC LIMIT 1 ; SELECT includeprefix INTO v_IncludePrefix_ FROM tblCustomerTrunk WHERE AccountID = p_CustomerID AND TrunkID = p_Trunk; SELECT prefix INTO v_Prefix_ FROM tblCustomerTrunk WHERE AccountID = p_CustomerID AND TrunkID = p_Trunk; SELECT CodeDeckId, RateTableID, RateTableAssignDate INTO v_codedeckid_, v_ratetableid_, v_RateTableAssignDate_ FROM tblCustomerTrunk WHERE tblCustomerTrunk.TrunkID = p_Trunk AND tblCustomerTrunk.AccountID = p_CustomerID AND tblCustomerTrunk.Status = 1; INSERT INTO tmp_CustomerRates_ SELECT tblCustomerRate.RateID, tblCustomerRate.Interval1, tblCustomerRate.IntervalN, tblCustomerRate.Rate, effectivedate, tblCustomerRate.EndDate, lastmodifieddate FROM tblAccount JOIN tblCustomerRate ON tblAccount.AccountID = tblCustomerRate.CustomerID JOIN tblRate ON tblRate.RateId = tblCustomerRate.RateId AND tblRate.CodeDeckId = v_codedeckid_ WHERE tblAccount.AccountID = p_CustomerID AND tblCustomerRate.TrunkID = p_Trunk AND tblCustomerRate.TimezonesID = p_TimezonesID AND (p_RatePrefix='' OR FIND_IN_SET(tblCustomerRate.RatePrefix,p_RatePrefix)) ORDER BY tblCustomerRate.CustomerID,tblCustomerRate.TrunkID,tblCustomerRate.TimezonesID,tblCustomerRate.RateID,tblCustomerRate.EffectiveDate DESC; DROP TEMPORARY TABLE IF EXISTS tmp_CustomerRates4_; DROP TEMPORARY TABLE IF EXISTS tmp_CustomerRates2_; CREATE TEMPORARY TABLE IF NOT EXISTS tmp_CustomerRates4_ as (select * from tmp_CustomerRates_); DELETE n1 FROM tmp_CustomerRates_ n1, tmp_CustomerRates4_ n2 WHERE n1.EffectiveDate < n2.EffectiveDate AND n1.RateId = n2.RateId; CREATE TEMPORARY TABLE IF NOT EXISTS tmp_CustomerRates2_ as (select * from tmp_CustomerRates_); INSERT INTO tmp_RateTableRate_ SELECT tblRateTableRate.RateID, tblRateTableRate.Interval1, tblRateTableRate.IntervalN, tblRateTableRate.Rate, tblRateTableRate.EffectiveDate, tblRateTableRate.EndDate, tblRateTableRate.updated_at FROM tblAccount JOIN tblCustomerTrunk ON tblCustomerTrunk.AccountID = tblAccount.AccountID JOIN tblRateTable ON tblCustomerTrunk.ratetableid = tblRateTable.ratetableid JOIN tblRateTableRate ON tblRateTableRate.ratetableid = tblRateTable.ratetableid LEFT JOIN tmp_CustomerRates_ trc1 ON trc1.RateID = tblRateTableRate.RateID WHERE tblAccount.AccountID = p_CustomerID AND tblRateTableRate.TimezonesID = p_TimezonesID AND tblCustomerTrunk.TrunkID = p_Trunk AND (( tblRateTableRate.EffectiveDate <= Now() AND ( ( trc1.RateID IS NULL ) OR ( trc1.RateID IS NOT NULL AND tblRateTableRate.ratetablerateid IS NULL ) ) ) OR ( tblRateTableRate.EffectiveDate > Now() AND ( ( trc1.RateID IS NULL ) OR ( trc1.RateID IS NOT NULL AND tblRateTableRate.EffectiveDate < (SELECT IFNULL(MIN(crr.EffectiveDate), tblRateTableRate.EffectiveDate) FROM tmp_CustomerRates2_ crr WHERE crr.RateID = tblRateTableRate.RateID ) ) ) ) ) ORDER BY tblRateTableRate.RateID,tblRateTableRate.EffectiveDate desc; DROP TEMPORARY TABLE IF EXISTS tmp_RateTableRate4_; CREATE TEMPORARY TABLE IF NOT EXISTS tmp_RateTableRate4_ as (select * from tmp_RateTableRate_); DELETE n1 FROM tmp_RateTableRate_ n1, tmp_RateTableRate4_ n2 WHERE n1.EffectiveDate < n2.EffectiveDate AND n1.RateId = n2.RateId; INSERt INTO tmp_RateSheetDetail_ SELECT ratesheetdetailsid, RateID, RateSheetID, Destination, Code, Rate, `change`, effectivedate, EndDate FROM tblRateSheetDetails WHERE RateSheetID = v_lastRateSheetID_ ORDER BY RateID,effectivedate desc; DROP TEMPORARY TABLE IF EXISTS tmp_RateSheetDetail4_; CREATE TEMPORARY TABLE IF NOT EXISTS tmp_RateSheetDetail4_ as (select * from tmp_RateSheetDetail_); DELETE n1 FROM tmp_RateSheetDetail_ n1, tmp_RateSheetDetail4_ n2 WHERE n1.EffectiveDate < n2.EffectiveDate AND n1.RateId = n2.RateId; DROP TABLE IF EXISTS tmp_CloneRateSheetDetail_ ; CREATE TEMPORARY TABLE tmp_CloneRateSheetDetail_ LIKE tmp_RateSheetDetail_; INSERT tmp_CloneRateSheetDetail_ SELECT * FROM tmp_RateSheetDetail_; INSERT INTO tmp_RateSheetRate_ SELECT tbl.RateID, description, Code, tbl.Interval1, tbl.IntervalN, tbl.Rate, v_trunkDescription_, 'NEW' as `change`, tbl.EffectiveDate, tbl.EndDate FROM ( SELECT rt.RateID, rt.Interval1, rt.IntervalN, rt.Rate, rt.EffectiveDate, rt.EndDate FROM tmp_RateTableRate_ rt LEFT JOIN tblRateSheet ON tblRateSheet.RateSheetID = v_lastRateSheetID_ LEFT JOIN tmp_RateSheetDetail_ as rsd ON rsd.RateID = rt.RateID AND rsd.RateSheetID = v_lastRateSheetID_ WHERE rsd.ratesheetdetailsid IS NULL UNION SELECT trc2.RateID, trc2.Interval1, trc2.IntervalN, trc2.Rate, trc2.EffectiveDate, trc2.EndDate FROM tmp_CustomerRates_ trc2 LEFT JOIN tblRateSheet ON tblRateSheet.RateSheetID = v_lastRateSheetID_ LEFT JOIN tmp_CloneRateSheetDetail_ as rsd2 ON rsd2.RateID = trc2.RateID AND rsd2.RateSheetID = v_lastRateSheetID_ WHERE rsd2.ratesheetdetailsid IS NULL ) AS tbl INNER JOIN tblRate ON tbl.RateID = tblRate.RateID; INSERT INTO tmp_RateSheetRate_ SELECT tbl.RateID, description, Code, tbl.Interval1, tbl.IntervalN, tbl.Rate, v_trunkDescription_, tbl.`change`, tbl.EffectiveDate, tbl.EndDate FROM (SELECT rt.RateID, description, tblRate.Code, rt.Interval1, rt.IntervalN, rt.Rate, rsd5.Rate AS rate2, rt.EffectiveDate, rt.EndDate, CASE WHEN rsd5.Rate > rt.Rate AND rsd5.Destination != description THEN 'NAME CHANGE & DECREASE' ELSE CASE WHEN rsd5.Rate > rt.Rate AND rt.EffectiveDate <= Now() THEN 'DECREASE' ELSE CASE WHEN ( rsd5.Rate > rt.Rate AND rt.EffectiveDate > Now() ) THEN 'PENDING DECREASE' ELSE CASE WHEN ( rsd5.Rate < rt.Rate AND rt.EffectiveDate <= Now() ) THEN 'INCREASE' ELSE CASE WHEN ( rsd5.Rate < rt.Rate AND rt.EffectiveDate > Now() ) THEN 'PENDING INCREASE' ELSE CASE WHEN rsd5.Destination != description THEN 'NAME CHANGE' ELSE 'NO CHANGE' END END END END END END as `Change` FROM tblRate INNER JOIN tmp_RateTableRate_ rt ON rt.RateID = tblRate.RateID INNER JOIN tblRateSheet ON tblRateSheet.RateSheetID = v_lastRateSheetID_ INNER JOIN tmp_RateSheetDetail_ as rsd5 ON rsd5.RateID = rt.RateID AND rsd5.RateSheetID = v_lastRateSheetID_ UNION SELECT trc4.RateID, description, tblRate.Code, trc4.Interval1, trc4.IntervalN, trc4.Rate, rsd6.Rate AS rate2, trc4.EffectiveDate, trc4.EndDate, CASE WHEN rsd6.Rate > trc4.Rate AND rsd6.Destination != description THEN 'NAME CHANGE & DECREASE' ELSE CASE WHEN rsd6.Rate > trc4.Rate AND trc4.EffectiveDate <= Now() THEN 'DECREASE' ELSE CASE WHEN ( rsd6.Rate > trc4.Rate AND trc4.EffectiveDate > Now() ) THEN 'PENDING DECREASE' ELSE CASE WHEN ( rsd6.Rate < trc4.Rate AND trc4.EffectiveDate <= Now() ) THEN 'INCREASE' ELSE CASE WHEN ( rsd6.Rate < trc4.Rate AND trc4.EffectiveDate > Now() ) THEN 'PENDING INCREASE' ELSE CASE WHEN rsd6.Destination != description THEN 'NAME CHANGE' ELSE 'NO CHANGE' END END END END END END as `Change` FROM tblRate INNER JOIN tmp_CustomerRates_ trc4 ON trc4.RateID = tblRate.RateID INNER JOIN tblRateSheet ON tblRateSheet.RateSheetID = v_lastRateSheetID_ INNER JOIN tmp_CloneRateSheetDetail_ as rsd6 ON rsd6.RateID = trc4.RateID AND rsd6.RateSheetID = v_lastRateSheetID_ ) AS tbl ; INSERT INTO tmp_RateSheetRate_ SELECT tblRateSheetDetails.RateID, tblRateSheetDetails.Destination, tblRateSheetDetails.Code, tblRateSheetDetails.Interval1, tblRateSheetDetails.IntervalN, tblRateSheetDetails.Rate, v_trunkDescription_, 'DELETE', tblRateSheetDetails.EffectiveDate, tblRateSheetDetails.EndDate FROM tblRate INNER JOIN tblRateSheetDetails ON tblRate.RateID = tblRateSheetDetails.RateID AND tblRateSheetDetails.RateSheetID = v_lastRateSheetID_ LEFT JOIN (SELECT DISTINCT RateID, effectivedate FROM tmp_RateTableRate_ UNION SELECT DISTINCT RateID, effectivedate FROM tmp_CustomerRates_) AS TBL ON TBL.RateID = tblRateSheetDetails.RateID WHERE `change` != 'DELETE' AND TBL.RateID IS NULL ; DROP TEMPORARY TABLE IF EXISTS tmp_RateSheetRate4_; CREATE TEMPORARY TABLE IF NOT EXISTS tmp_RateSheetRate4_ as (select * from tmp_RateSheetRate_); DELETE n1 FROM tmp_RateSheetRate_ n1, tmp_RateSheetRate4_ n2 WHERE n1.EffectiveDate < n2.EffectiveDate AND n1.RateId = n2.RateId; IF v_IncludePrefix_ = 1 THEN SELECT rsr.RateID AS rateid, rsr.Interval1 AS interval1, rsr.IntervalN AS intervaln, rsr.Destination AS destination, rsr.Codes AS codes, v_Prefix_ AS `tech prefix`, CONCAT(rsr.Interval1,'/',rsr.IntervalN) AS `interval`, FORMAT(rsr.Rate,6) AS `rate per minute (usd)`, rsr.`level`, rsr.`change`, rsr.EffectiveDate AS `effective date`, rsr.EndDate AS `end date` FROM tmp_RateSheetRate_ rsr ORDER BY rsr.Destination,rsr.Codes desc; ELSE SELECT rsr.RateID AS rateid , rsr.Interval1 AS interval1, rsr.IntervalN AS intervaln, rsr.Destination AS destination, rsr.Codes AS codes, CONCAT(rsr.Interval1,'/',rsr.IntervalN) AS `interval`, FORMAT(rsr.Rate, 6) AS `rate per minute (usd)`, rsr.`level`, rsr.`change`, rsr.EffectiveDate AS `effective date`, rsr.EndDate AS `end date` FROM tmp_RateSheetRate_ rsr ORDER BY rsr.Destination,rsr.Codes DESC; END IF; SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; END// DELIMITER ;
<gh_stars>0 -- SQLite -- -- Creación de la BD s_asistencia -- -- Creación de tablas catalogo -- CREATE TABLE ct_estado( id_estado INTEGER PRIMARY KEY, descripcion VARCHAR(50) ); CREATE TABLE ct_carrera( clave_carrera CHAR(5) PRIMARY KEY, descripcion VARCHAR(50) ); CREATE TABLE ct_materia( id_materia INTEGER PRIMARY KEY AUTOINCREMENT, nombre VARCHAR(50), creditos INTEGER ); -- -- Creación de tablas -- CREATE TABLE dt_profesor( clave_empleado NUMERIC(10) PRIMARY KEY, nombre VARCHAR(50), apellidos VARCHAR(100), id_estado INTEGER, CONSTRAINT fk_estado_prof FOREIGN KEY(id_estado) REFERENCES ct_estado(id_estado) ); CREATE TABLE dt_alumno( matricula NUMERIC(11) PRIMARY KEY, nombre varchar(50), apellidos varchar(100), id_estado INTEGER, clave_carrera CHAR(5), CONSTRAINT fk_estado_alum FOREIGN KEY(id_estado) REFERENCES ct_estado(id_estado), CONSTRAINT fk_carrera_alum FOREIGN KEY(clave_carrera) REFERENCES ct_carrera(clave_carrera) ); -- -- Creación de tablas intermedias -- CREATE TABLE dt_carrera_materia( clave_carrera CHAR(5), id_materia INTEGER, CONSTRAINT UC_car_mat UNIQUE (clave_carrera,id_materia), CONSTRAINT fk_carrera_clave FOREIGN KEY (clave_carrera) REFERENCES ct_carrera(clave_carrera), CONSTRAINT fk_carrera_materia FOREIGN KEY (id_materia) REFERENCES ct_materia(id_materia) ); CREATE TABLE dt_materia_profesor( id_mat_prof INTEGER PRIMARY KEY AUTOINCREMENT, id_materia INTEGER, clave_empleado NUMERIC(10), CONSTRAINT UC_materia_prof UNIQUE(id_materia,clave_empleado), CONSTRAINT fk_materia_prof FOREIGN KEY(id_materia) REFERENCES ct_materia(id_materia), CONSTRAINT fk_materia_prof_cve FOREIGN KEY(clave_empleado) REFERENCES dt_profesor(clave_empleado) ); CREATE TABLE dt_clase_horario( id_clase_horario INTEGER PRIMARY KEY AUTOINCREMENT, id_mat_prof INTEGER, lun_ini TIME, lun_fin TIME, mar_ini TIME, mar_fin TIME, mie_ini TIME, mie_fin TIME, jue_ini TIME, jue_fin TIME, vie_ini TIME, vie_fin TIME, sab_ini TIME, sab_fin TIME, id_estado INTEGER, CONSTRAINT fk_cls_hor_mat_prof FOREIGN KEY(id_mat_prof) REFERENCES dt_materia_profesor(id_mat_prof), CONSTRAINT fk_estado_clase_horario FOREIGN KEY(id_estado) REFERENCES ct_estado(id_estado) ); CREATE TABLE dt_alum_clase_horario( id_alum_clas_hor INTEGER PRIMARY KEY AUTOINCREMENT, matricula NUMERIC(11), id_clase_horario INTEGER, id_estado INTEGER, CONSTRAINT fk_alum_horario FOREIGN KEY(matricula) REFERENCES dt_alumno(matricula) ON DELETE CASCADE, CONSTRAINT fk_alum_clas_horario FOREIGN KEY(id_clase_horario) REFERENCES dt_clase_horario(id_clase_horario), CONSTRAINT fk_estado_hor_alumn FOREIGN KEY(id_estado) REFERENCES ct_estado(id_estado) ); CREATE TABLE dt_asistencia( no_asistencia INTEGER PRIMARY KEY AUTOINCREMENT, id_alum_clas_hor INTEGER, matricula NUMERIC(11), fecha DATE, hora_entrada TIME, hora_salida TIME, puntualidad NUMERIC(1), CONSTRAINT fk_asist_alum_horario FOREIGN KEY(id_alum_clas_hor) REFERENCES dt_alum_clase_horario(id_alum_clas_hor), CONSTRAINT fk_asist_alum_matricula FOREIGN KEY(matricula) REFERENCES dt_alumno(matricula) ON DELETE CASCADE ); -- -- volcado de datos para la tabla 'ct_estado' -- INSERT INTO ct_estado VALUES (1,'Activo'); INSERT INTO ct_estado VALUES (2,'Inactivo'); -- -- volcado de datos para la tabla 'ct_estado' -- INSERT INTO ct_carrera VALUES ('INFO','Informática'); INSERT INTO ct_carrera VALUES ('SIST','Sistemas computacionales'); INSERT INTO ct_carrera VALUES ('CONTA','Contaduria'); INSERT INTO ct_carrera VALUES ('GESTE','Gestión empresarial'); INSERT INTO ct_carrera VALUES ('QUIM','Química'); INSERT INTO ct_carrera VALUES ('BQUIM','Bioquímica'); INSERT INTO ct_carrera VALUES ('AERO','Aeronáutica'); -- -- volcado de datos para la tabla 'ct_materia' -- INSERT INTO ct_materia (nombre,creditos) VALUES ('Fundamentos de programación',5); INSERT INTO ct_materia (nombre,creditos) VALUES ('Programamación orienteda a objetos',5); INSERT INTO ct_materia (nombre,creditos) VALUES ('Fundamentos de base de datos',4); INSERT INTO ct_materia (nombre,creditos) VALUES ('Algebra lineal',5); INSERT INTO ct_materia (nombre,creditos) VALUES ('Fundamentos de redes',4); INSERT INTO ct_materia (nombre,creditos) VALUES ('Administración',3); -- -- Volcado de datos para la tabla 'dt_profesor' -- INSERT INTO dt_profesor VALUES(6789512,'Jill', 'Valentine',1); INSERT INTO dt_profesor VALUES(8964481,'Chris', 'Redfield',1); INSERT INTO dt_profesor VALUES(5964412,'Albert', 'Wesker',1); INSERT INTO dt_profesor VALUES(1291564,'Claudia', 'Morán',1); INSERT INTO dt_profesor VALUES(2015544,'José', 'Limón',1); -- -- Volcado de datos para la tabla 'dt_alumno' -- INSERT INTO dt_alumno VALUES (201450484,'<NAME>.', 'Mondragón',1,'INFO'); INSERT INTO dt_alumno VALUES (201459920,'Daniel', 'Peréz',1,'SIST'); INSERT INTO dt_alumno VALUES (201455699,'Alexa', 'Reyes',1,'BQUIM'); INSERT INTO dt_alumno VALUES (201446462,'Nancy', 'Zepeda',1,'GESTE'); INSERT INTO dt_alumno VALUES (201445897,'Juan', 'Sanachez',1,'AERO');
<filename>ass/ass2/ass2.sql -- COMP3311 19T3 Assignment 2 -- Written by <<<NAME>, z5163479>> --Global Helper: -- Movies View create or replace view Movies as select * from titles where format = 'movie'; -- Q1 Which movies are more than 6 hours long? create or replace view Q1(title) as select main_title from Movies where runtime > 360; ; -- Q2 What different formats are there in Titles, and how many of each? create or replace view Q2(format, ntitles) as select format, count(*) from titles group by format; ; -- Q3 What are the top 10 movies that received more than 1000 votes? create or replace view Q3(title, rating, nvotes) as select main_title,rating, nvotes from Movies where nvotes > 1000 order by rating desc, main_title limit 10 ; -- Q4 What are the top-rating TV series and how many episodes did each have? --helper: -- view for TV series create or replace view TVSeries as select * from titles where format = 'tvSeries' or format = 'tvMiniSeries'; create or replace view Q4(title, nepisodes) as select t.main_title, count(e.episode) from tvseries t join episodes e on t.id = e.parent_id where t.rating = (select max(rating) from tvseries) group by t.main_title order by t.main_title; ; -- Q5 Which movie was released in the most languages? -- title with its number of relases language view create or replace view NLanguages(title_id, nlanguages) as select a.title_id, count(distinct a.language) from aliases a join movies m on m.id = a.title_id where a.language is not null group by a.title_id; create or replace view Q5(title, nlanguages) as select m.main_title, n.nlanguages from movies m join NLanguages n on n.title_id = m.id where n.nlanguages = (select max(nlanguages) from NLanguages) ; -- Q6 Which actor has the highest average rating in movies that they're known for? -- view: actors create or replace view Actors as select * from worked_as where work_role = 'actor' ; --view:name_id, number of movies involves, average rating create or replace view ActorRating(name_id, num_movies, avg_rating) as select k.name_id, count(k.*), avg(m.rating) from known_for k join movies m on m.id = k.title_id where m.rating is not null group by k.name_id having count(k.*) >= 2 ; --help view: max avg rating name_id create or replace view TopActors(name_id) as select name_id from Actorrating where avg_rating = (select max(avg_rating) from ActorRating where name_id in (select name_id from Actors)) ; create or replace view Q6(name) as select name from names where id in (select * from topactors); ; -- Q7 For each movie with more than 3 genres, show the movie title and a comma-separated list of the genres -- view, title that have more than 3 genres create or replace view Title3Genres(title_id, genres) as select title_id , string_agg(genre,',' order by genre) from title_genres group by title_id having count(*) > 3 ; create or replace view Q7(title,genres) as select m.main_title, t.genres from Title3Genres t join movies m on m.id = t.title_id; ; -- Q8 Get the names of all people who had both actor and crew roles on the same movie -- view:both role in titles; create or replace view BothRole(name, title_id) as select distinct n.name,a.title_id from names n join actor_roles a on a.name_id = n.id join crew_roles c on a.title_id = c.title_id and n.id=c.name_id ; create or replace view Q8(name) as select distinct name from bothrole b join movies m on m.id = b.title_id ; -- Q9 Who was the youngest person to have an acting role in a movie, and how old were they when the movie started? -- view for actor with theri id and acting age create or replace view ActingAge as select a.name_id, min(m.start_year - n.birth_year) as age from actor_roles a join movies m on m.id=a.title_id join names n on a.name_id = n.id group by a.name_id ; create or replace view Q9(name,age) as select n.name,a.age from names n join actingage a on a.name_id = n.id where a.age = (select min(age) from actingage) ; -- Q10 Write a PLpgSQL function that, given part of a title, shows the full title and the total size of the cast and crew create type MyTitle as (id integer, main_title text); create or replace function Q10(partial_title text) returns setof text as $$ declare title MyTitle; _count integer; begin -- find all the title that match the 'partial_title' -- then loop through each title -> to find the total size of crew and cast for title in ( select t.id,t.main_title from titles t join principals a on t.id = a.title_id where t.main_title ilike ('%'|| partial_title ||'%') union select t.id,t.main_title from titles t join actor_roles a on t.id = a.title_id where t.main_title ilike ('%'|| partial_title ||'%') union select t.id,t.main_title from titles t join crew_roles c on t.id = c.title_id where t.main_title ilike ('%'|| partial_title ||'%')) loop select count(*) into _count from (select name_id from actor_roles where title_id = title.id union select name_id from principals where title_id = title.id union select name_id from crew_roles where title_id = title.id ) as foo; return next format('%s has %s cast and crew', title.main_title, _count); end loop; if title is null then return next format('No matching titles'); end if; end; $$ language plpgsql;
<reponame>sagalpreet/Academic-Portal -- TABLES create role student; create role instructor; create role advisor; create role dean_acad with login password '<PASSWORD>'; revoke all on all tables in schema public from public; grant references on all tables in schema public to public; revoke all on all functions in schema public from public; revoke all on all procedures in schema public from public; grant select, references on table department, slot, batch, course, student, instructor, advisor, offering, prereq, registration_status to student, instructor, advisor; grant all on table department, slot, batch, course, student, instructor, advisor, prereq, registration_status to dean_acad; grant insert on table offering to instructor; grant select on table offering to dean_acad; grant select, update on table registration_status, d_ticket to dean_acad; grant pg_read_server_files to instructor; grant usage on sequence offering_id_seq to instructor; -- PROCEDURES grant execute on procedure enroll_credit to student; grant execute on procedure enroll_audit to student; grant execute on procedure drop_offering to student; grant execute on procedure withdraw_offering to student; grant execute on procedure generate_ticket to student; grant execute on procedure ticket_verdict_i to instructor; grant execute on procedure ticket_verdict_b to advisor; grant execute on procedure ticket_verdict_d to dean_acad; grant execute on procedure add_offering to instructor; grant execute on procedure add_constraints to instructor; grant execute on procedure start_add to dean_acad; grant execute on procedure stop_add to dean_acad; grant execute on procedure start_withdraw to dean_acad; grant execute on procedure stop_withdraw to dean_acad; grant execute on procedure update_credit_grades to instructor; grant execute on procedure update_audit_grades to instructor; grant execute on procedure generate_transcript to dean_acad; -- HELPER FUNCTIONS grant execute on function get_id, grade_to_number to student, instructor, advisor, dean_acad; grant execute on function get_current_sem, get_current_year to student, instructor, advisor, dean_acad; grant execute on function is_offering_offered_in_current_sem_and_year to student, instructor, advisor, dean_acad; grant execute on function is_add_open, is_withdraw_open to student, instructor, advisor, dean_acad; grant execute on function is_slot_conflicting_for_instructor to instructor; grant execute on function get_cgpa, get_sgpa to dean_acad, student; -- TRIGGER FUNCTIONS revoke all on function add_offering_trigger_function from public; revoke all on function add_student_trigger_function from public; revoke all on function add_instructor_trigger_function from public; revoke all on function add_advisor_trigger_function from public; revoke all on function d_ticket_verdict_func from public;
USE nominal_dev; -- EMPLOYEE INSERT INTO nominal_dev.employee (passport,naf) VALUES ("99999999R","") ,('53559315C',"") ,('45399445K',"") ,('83377533A',"") ,('73129711S',"") ,('84111929D',"") ,('81244291B',"") ,('41353917D',"") ,('16538499G',"") ,('53823675H',"") ,('18938831X',""); INSERT INTO nominal_dev.employee_information (employee,name,name_2,lastname,lastname_2,active,apportion) VALUES (1,"Manolo","","Martinez","Cabrera",1,0) ,(2,"Manolo","","Martinez","Cabrera",1,0) ,(3,"Manolo","","Martinez","Cabrera",1,0) ,(4,"Manolo","","Martinez","Cabrera",1,0) ,(5,"Manolo","","Martinez","Cabrera",1,0) ,(6,"Manolo","","Martinez","Cabrera",1,0) ,(7,"Manolo","","Martinez","Cabrera",1,0) ,(8,"Manolo","","Martinez","Cabrera",1,0) ,(9,"Manolo","","Martinez","Cabrera",1,0) ,(10,"Manolo","","Martinez","Cabrera",1,0); INSERT INTO nominal_dev.employee_contact (employee,email_address,street_address,phone_number) VALUES (1,"<EMAIL>","<NAME>, 23","634952395") ,(2,"<EMAIL>","<NAME>, 23","634952395") ,(3,"<EMAIL>","<NAME>, 23","634952395") ,(4,"<EMAIL>","<NAME>, 23","634952395") ,(5,"<EMAIL>","<NAME>, 23","634952395") ,(6,"<EMAIL>","<NAME>, 23","634952395") ,(7,"<EMAIL>","<NAME>, 23","634952395") ,(8,"<EMAIL>","<NAME>, 23","634952395") ,(9,"<EMAIL>","<NAME>, 23","634952395") ,(10,"<EMAIL>","<NAME>, 23","634952395"); INSERT INTO nominal_dev.employee_contract (employee,category,irpf,hourly,hired_hours) VALUES (1,5,12.50,0,25) ,(2,12,12.50,0,25) ,(3,56,12.50,0,25) ,(4,23,12.50,0,40) ,(5,54,12.50,0,25) ,(6,78,16.00,0,25) ,(7,34,12.00,0,40) ,(8,34,12.00,0,40) ,(9,10,12.00,0,40) ,(10,95,12.00,0,40); INSERT INTO nominal_dev.employee_schedule (employee,nocturnal,turnicity,complementary_hours) VALUES (1,0,0,0) ,(2,0,0,0) ,(3,0,0,0) ,(4,0,0,0) ,(5,0,0,0) ,(6,0,0,0) ,(7,0,0,0) ,(8,0,0,0) ,(9,0,0,0) ,(10,0,0,0); INSERT INTO nominal_dev.company_employee (company,employee,join_date) VALUES (1,1,DATE('2021-02-03')) ,(3,2,DATE('2013-02-03')) ,(2,3,DATE('2017-02-03')) ,(1,4,DATE('2010-02-03')) ,(2,5,DATE('2010-06-03')) ,(4,6,DATE('2013-06-03')) ,(5,7,DATE('2016-06-03')) ,(4,8,DATE('2020-06-03')) ,(2,9,DATE('2020-06-03')) ,(1,10,DATE('2014-06-03')); CREATE TRIGGER employee_contact AFTER INSERT ON nominal_dev.employee_contact FOR EACH ROW BEGIN UPDATE nominal_dev.employee SET last_update = NOW() WHERE id = NEW.employee; END CREATE TRIGGER employee_information AFTER INSERT ON nominal_dev.employee_information FOR EACH ROW BEGIN UPDATE nominal_dev.employee SET last_update = NOW() WHERE id = NEW.employee; END CREATE TRIGGER employee_contract AFTER INSERT ON nominal_dev.employee_contract FOR EACH ROW BEGIN UPDATE nominal_dev.employee SET last_update = NOW() WHERE id = NEW.employee; END
<reponame>Sun42/easytrip -- Revert easytrip:init-schema from pg BEGIN; DROP TABLE "travelogue" CASCADE; DROP TABLE "activity" CASCADE; DROP TABLE "user" CASCADE; DROP TABLE "category" CASCADE; COMMIT;
USE [ANTERO] GO /****** Object: View [sa].[v_amos_oiva_tutkintokielet] Script Date: 7.3.2022 11:25:58 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER VIEW [sa].[v_amos_oiva_tutkintokielet] AS WITH luvat as ( SELECT l.jarjestajaYtunnus ,alkupvm_tod = l.alkupvm ,alkupvm = cast(case when l2.loppupvm is null then dateadd(yy, datediff(yy, 0, l.alkupvm), 0) else l.alkupvm end as date) ,loppupvm = cast(coalesce(l.loppupvm,'9999-12-31') as date) ,lupa_id = l.lupaId ,q.tutkinto_koodi ,q.tutkintokieli_koodi ,m.id ,rivi_nro = rank() over (partition by l.jarjestajaYtunnus, l.alkupvm order by (case when m.id is null then 0 else 1 end) desc, l.paatospvm desc) FROM ( select lupaId ,tutkinto_koodi=m.koodiarvo ,tutkintokieli_koodi=am.koodiarvo from sa.sa_oiva_maaraykset m join sa.sa_oiva_alimaaraykset am on am.maaraysId = m.maaraysId and am.koodisto='kieli' where m.koodisto='koulutus' ) q left join sa.sa_oiva_luvat l on l.lupaId = q.lupaId --epäjatkuvuuskohtien tarkistus. jos ei löydy yhtään riviä niin luvan alkupvm:ksi muutetaan vuoden eka päivä. left join sa.sa_oiva_luvat l2 on l2.jarjestajaYtunnus = l.jarjestajaYtunnus and datediff(day,l2.loppupvm,l.alkupvm)=1 left join sa.sa_oiva_maaraykset m on m.lupaId = l.lupaId and m.koodisto='koulutussektori' and m.koodiarvo='3' WHERE coalesce(l.loppupvm,'9999-12-31') > l.alkupvm and l.koulutustyyppi is null ) SELECT jarjestajaYtunnus ,jarjestaja_nimi = coalesce(nimi_ennen_fuusiota,nimi_amos_spl) ,alkupvm ,loppupvm ,tutkintokoodi ,tutkinto_nimi = koulutusluokitus_fi ,kieli1 = [1] ,kieli2 = [2] ,kieli3 = [3] ,siirtymapaattyy --INTO [ANTERO].[sa].[sa_amos_oiva_tutkinto_kielet] FROM ( SELECT distinct jarjestajaYtunnus ,alkupvm ,loppupvm ,tutkintokoodi ,tutkintokieli_koodi = upper(tutkintokieli_koodi) ,rnk_tutkintokieli = rank() over (partition by jarjestajaYtunnus, alkupvm, tutkintokoodi order by tutkintokieli_koodi) ,siirtymapaattyy = case when loppupvm = max(loppupvm) over (partition by jarjestajaYtunnus,tutkintokoodi) and loppupvm < siirtymapaattyy /*and generoitu = max(generoitu) over (partition by jarjestajaYtunnus,tutkintokoodi)*/ then siirtymapaattyy end ,rank_jarj = rank() over (partition by jarjestajaYtunnus, tutkintokoodi, loppupvm order by alkupvm) FROM ( --todelliset lupatiedot SELECT l.jarjestajaYtunnus ,l.alkupvm_tod ,l.alkupvm ,l.loppupvm ,tutkintokoodi = tutkinto_koodi ,tutkintokieli_koodi ,generoitu = 0 FROM luvat l WHERE l.rivi_nro=1 UNION --fuusioituneelle järjestäjälle luodaan lupatiedot ajalle ennen voimaantuloa koska Koskessa voi olla uudelle järjestäjälle merkittyjä opiskeluoikeuksia, joista puuttuu organisaatiohistoria-tieto SELECT distinct l1.jarjestajaYtunnus ,l2.alkupvm_tod ,alkupvm = cast(dateadd(yy, datediff(yy, 0, l2.loppupvm)-1, 0) as date) ,l2.loppupvm ,l2.tutkinto_koodi ,l2.tutkintokieli_koodi ,generoitu = 0 FROM luvat l1 left join dw.d_amos_spl_jarjestaja_linkki a on a.ytunnus_amos_spl = l1.jarjestajaYtunnus left join luvat l2 on l2.jarjestajaYtunnus = a.ytunnus_avain and l2.alkupvm < l1.alkupvm and datediff(day, l2.loppupvm, l1.alkupvm) = 1 WHERE l1.rivi_nro=1 and a.ytunnus_avain != a.ytunnus_amos_spl and datediff(day,dateadd(day,-1,a.voimaan_alkaen),l1.alkupvm)=1 ) Q1 CROSS APPLY (select siirtymapaattyy from [dbo].[hae_tutkinnon_nimet] (Q1.alkupvm,Q1.loppupvm,Q1.tutkintokoodi)) s WHERE not (Q1.generoitu = 1 and s.siirtymapaattyy is null) and not (s.siirtymapaattyy is not null and alkupvm > s.siirtymapaattyy) ) Q2 LEFT JOIN dw.d_amos_spl_jarjestaja_linkki jl on jl.ytunnus_avain=Q2.jarjestajaYtunnus PIVOT ( min(tutkintokieli_koodi) for rnk_tutkintokieli in ([1],[2],[3],[4],[5]) ) pvt LEFT JOIN dw.d_koulutusluokitus kl on kl.koulutusluokitus_koodi=tutkintokoodi WHERE rank_jarj = 1
<reponame>CocktailsGuru/server<filename>src/main/resources/db/migration/V9__Remove_empty_ingredient_columns.sql<gh_stars>1-10 ALTER TABLE `cocktail_dev`.`coctail_ingred_alco` DROP COLUMN `flags`, DROP COLUMN `numKcal`, DROP COLUMN `dataCol`, DROP COLUMN `tasteFK`, DROP COLUMN `websiteUrl`, DROP COLUMN `videoUrl`, DROP COLUMN `nameModif`; ALTER TABLE `cocktail_dev`.`coctail_ingred_alco_non` DROP COLUMN `flags`, DROP COLUMN `dataCol`, DROP COLUMN `numKcal`, DROP COLUMN `tasteFK`, DROP COLUMN `websiteUrl`, DROP COLUMN `videoUrl`, DROP COLUMN `preparation`, DROP COLUMN `nameModif`;
<reponame>patzerr/database-schema-visualization CREATE TABLE `user` ( `id` int(10) unsigned not null, `email` varchar(64) collate latin1_general_ci not null, `password` varchar(32) collate latin1_general_ci not null, `nick` varchar(16) collate latin1_general_ci default null, `status` enum('enabled','disabled') collate latin1_general_ci default null, `admin` bit(1) default null, `geom` geometry not null, `created_at` datetime default null, `updated_at` datetime default current_timestamp on update current_timestamp, primary key (`id`), unique key `iu_email_password` (`nick`), unique key `iuh_email_password` (`nick`) using hash, unique key `iub_email_password` (`nick`) using btree, key `i_password` (`password`), key `ih_password` (`password`) using hash, key `ib_password` (`password`) using btree, fulltext key `if_email_password` (`email`,`password`) ) engine=InnoDB default charset=latin1 collate=latin1_general_ci;
<gh_stars>1-10 -- Finland BEGIN; UPDATE dim_calendar SET hol_fi = FALSE ; -- 1 January New Year's Day Uudenvuodenpäivä Nyårsdagen UPDATE dim_calendar SET hol_fi = TRUE WHERE EXTRACT( DAY FROM calendar_date) = 1 AND EXTRACT( MONTH FROM calendar_date) = 1 ; -- 6 January Epiphany Loppiainen Trettondedagen UPDATE dim_calendar SET hol_fi = TRUE WHERE EXTRACT( DAY FROM calendar_date) = 6 AND EXTRACT( MONTH FROM calendar_date) = 1 AND NOT EXTRACT (YEAR FROM calendar_date) BETWEEN 1973 AND 2001 ; -- Epiphany to the Saturday following 5 January BETWEEN 1973 AND 2001 WITH cte AS ( SELECT EXTRACT(YEAR FROM dc2.calendar_date) AS yr, MIN(calendar_date) AS first_sat_5_jan FROM dim_calendar AS dc2 WHERE EXTRACT(MONTH FROM calendar_date) = 1 AND EXTRACT(DOW FROM calendar_date) = 6 AND EXTRACT(YEAR FROM dc2.calendar_date) BETWEEN 1973 AND 2001 GROUP BY EXTRACT(YEAR FROM dc2.calendar_date) ) UPDATE dim_calendar SET hol_fi = TRUE FROM cte WHERE dim_calendar.calendar_date = cte.first_sat_5_jan ; -- Moveable Friday Good Friday Pitkäperjantai Långfredagen The Friday before Easter Sunday UPDATE dim_calendar SET hol_fi = TRUE WHERE calc_western_good_fri = TRUE ; -- Moveable Sunday Easter Sunday Pääsiäispäivä Påskdagen -- Easter Sunday – date variable UPDATE dim_calendar SET hol_fi = TRUE WHERE calc_western_easter_sun = TRUE ; -- Moveable Monday Easter Monday 2. pääsiäispäivä Andra påskdagen The day after Easter Sunday UPDATE dim_calendar SET hol_fi = TRUE WHERE calc_western_easter_mon = TRUE ; -- 1 May May Day Vappu Första maj See Walpurgis Night UPDATE dim_calendar SET hol_fi = TRUE WHERE EXTRACT( DAY FROM calendar_date) = 1 AND EXTRACT( MONTH FROM calendar_date) = 5 ; -- Moveable Thursday Ascension Day Helatorstai Kristi himmelfärds dag 39 days after Easter Sunday UPDATE dim_calendar SET hol_fi = TRUE WHERE calc_western_ascension_thu = TRUE AND NOT EXTRACT (YEAR FROM calendar_date) BETWEEN 1973 AND 2001 ; -- Ascension Day to the Saturday before the traditional Thursday WITH cte AS ( SELECT ( calendar_date + INTERVAL '33 DAYS' ) AS easter_mon_plus_33 FROM dim_calendar WHERE calc_western_easter_mon = TRUE AND EXTRACT( YEAR FROM calendar_date) BETWEEN 1973 AND 2001 ) UPDATE dim_calendar SET hol_fi = TRUE FROM cte WHERE dim_calendar.calendar_date = cte.easter_mon_plus_33 ; -- Moveable Sunday Pentecost Helluntaipäivä Pingst 49 days after Easter Sunday UPDATE dim_calendar SET hol_fi = TRUE WHERE calc_western_whit_sun = TRUE ; -- Friday between 19 June and 25 June Midsummer Eve Juhannusaatto Midsommarafton Non-official -- Non-business day in the Annual Holidays Act (162/2005) - holiday in some collective labor agreements UPDATE dim_calendar SET hol_fi = TRUE WHERE EXTRACT( DAY FROM calendar_date) BETWEEN 19 AND 25 AND EXTRACT( MONTH FROM calendar_date) = 6 AND EXTRACT( YEAR FROM calendar_date) >= 1955 -- Defacto holiday before 1995 AND EXTRACT( DOW FROM calendar_date) = 5 -- Fri ; -- Saturday between 20 June and 26 June Midsummer Day Juhannuspäivä Midsommardagen Moved from 24 June UPDATE dim_calendar SET hol_fi = TRUE WHERE EXTRACT( DAY FROM calendar_date) BETWEEN 20 AND 26 AND EXTRACT( MONTH FROM calendar_date) = 6 AND EXTRACT( YEAR FROM calendar_date) >= 1955 -- Defacto holiday before 1995 AND EXTRACT( DOW FROM calendar_date) = 6 -- Sat ; -- Saturday between 31 October and 6 November All Saints' Day Pyhäinpäivä Alla helgons dag Moved from 1 November UPDATE dim_calendar SET hol_fi = TRUE WHERE ( (EXTRACT( DAY FROM calendar_date) = 31 AND EXTRACT( MONTH FROM calendar_date) = 10) OR (EXTRACT( DAY FROM calendar_date) BETWEEN 1 AND 6 AND EXTRACT( MONTH FROM calendar_date) = 11) ) AND EXTRACT( YEAR FROM calendar_date) >= 1955 AND EXTRACT( DOW FROM calendar_date) = 6 -- Sat ; -- 6 December Independence Day Itsenäisyyspäivä Självständighetsdagen UPDATE dim_calendar SET hol_fi = TRUE WHERE EXTRACT( DAY FROM calendar_date) = 6 AND EXTRACT( MONTH FROM calendar_date) = 12 ; -- 24 December <NAME>ve Jouluaatto Julafton -- Non-official – Non-business day in the Annual Holidays Act (162/2005) - holiday in some collective labor agreements UPDATE dim_calendar SET hol_fi = TRUE WHERE calc_western_christmas_eve = TRUE -- AND EXTRACT( YEAR FROM calendar_date) >= 2005 -- Defacto holiday before 1995 ; -- 25 December Christmas Day Joulupäivä Juldagen UPDATE dim_calendar SET hol_fi = TRUE WHERE calc_western_christmas = TRUE ; -- 26 December St Stephen's Day 2. joulupäivä or tapaninpäivä Annandag jul UPDATE dim_calendar SET hol_fi = TRUE WHERE EXTRACT( DAY FROM calendar_date) = 26 AND EXTRACT( MONTH FROM calendar_date) = 12 ; COMMIT;
/* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50727 Source Host : localhost:3306 Source Schema : seckill Target Server Type : MySQL Target Server Version : 50727 File Encoding : 65001 Date: 06/08/2020 09:21:40 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for item -- ---------------------------- DROP TABLE IF EXISTS `item`; CREATE TABLE `item` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(50) DEFAULT NULL COMMENT '商品名称', `price` decimal(10,2) DEFAULT NULL COMMENT '商品价格', `description` varchar(255) DEFAULT NULL COMMENT '描述信息', `sales` int(255) DEFAULT NULL COMMENT '销量', `imgurl` varchar(255) DEFAULT NULL COMMENT '图片信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of item -- ---------------------------- BEGIN; INSERT INTO `item` VALUES (1, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (2, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (3, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (4, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (5, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (6, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (7, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (8, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (9, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (10, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (11, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (12, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (13, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (14, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (15, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (16, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (17, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (18, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (19, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (20, 'demoData', 1.00, 'demoData', 1, 'demoData'); INSERT INTO `item` VALUES (21, '苹果', 1.00, '好吃的苹果', 1, 'demoData'); INSERT INTO `item` VALUES (22, '西瓜', 1.00, '好吃的西瓜', 1, 'demoData'); INSERT INTO `item` VALUES (23, 'xxx', 1.00, 'demoData', 1, 'demoData'); COMMIT; -- ---------------------------- -- Table structure for item_stock -- ---------------------------- DROP TABLE IF EXISTS `item_stock`; CREATE TABLE `item_stock` ( `id` int(11) NOT NULL AUTO_INCREMENT, `item_id` int(11) NOT NULL, `stock` int(255) NOT NULL COMMENT '库存', PRIMARY KEY (`id`), UNIQUE KEY `un_itemId` (`item_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of item_stock -- ---------------------------- BEGIN; INSERT INTO `item_stock` VALUES (1, 1, 1); INSERT INTO `item_stock` VALUES (2, 2, 1); INSERT INTO `item_stock` VALUES (3, 3, 1); INSERT INTO `item_stock` VALUES (4, 4, 1); INSERT INTO `item_stock` VALUES (5, 5, 1); INSERT INTO `item_stock` VALUES (6, 6, 1); INSERT INTO `item_stock` VALUES (7, 7, 1); INSERT INTO `item_stock` VALUES (8, 8, 1); INSERT INTO `item_stock` VALUES (9, 9, 1); INSERT INTO `item_stock` VALUES (10, 10, 1); INSERT INTO `item_stock` VALUES (11, 11, 1); INSERT INTO `item_stock` VALUES (12, 12, 1); INSERT INTO `item_stock` VALUES (13, 13, 1); INSERT INTO `item_stock` VALUES (14, 14, 1); INSERT INTO `item_stock` VALUES (15, 15, 1); INSERT INTO `item_stock` VALUES (16, 16, 1); INSERT INTO `item_stock` VALUES (17, 17, 1); INSERT INTO `item_stock` VALUES (18, 18, 1); INSERT INTO `item_stock` VALUES (19, 19, 1); INSERT INTO `item_stock` VALUES (20, 20, 1); INSERT INTO `item_stock` VALUES (21, 21, 50); INSERT INTO `item_stock` VALUES (22, 22, 2000); INSERT INTO `item_stock` VALUES (23, 23, 1); COMMIT; -- ---------------------------- -- Table structure for order -- ---------------------------- DROP TABLE IF EXISTS `order`; CREATE TABLE `order` ( `id` varchar(50) NOT NULL COMMENT '订单ID', `user_id` int(11) DEFAULT NULL COMMENT '下单用户', `item_id` int(11) DEFAULT NULL COMMENT '商品ID', `item_price` decimal(10,2) DEFAULT NULL COMMENT '商品价格', `amount` int(10) DEFAULT NULL COMMENT '下单数量', `order_price` decimal(20,0) DEFAULT NULL COMMENT '下单总金额', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of order -- ---------------------------- BEGIN; INSERT INTO `order` VALUES ('2020-08-06000000007', 7, 21, 1.00, 600, 600); INSERT INTO `order` VALUES ('2020-08-06000000017', 7, 21, 1.00, 300, 300); INSERT INTO `order` VALUES ('2020-08-06000000027', 7, 21, 1.00, 50, 50); COMMIT; -- ---------------------------- -- Table structure for sequence_info -- ---------------------------- DROP TABLE IF EXISTS `sequence_info`; CREATE TABLE `sequence_info` ( `table_name` varchar(30) NOT NULL, `current_value` int(10) DEFAULT '0', `step` int(10) DEFAULT '1', PRIMARY KEY (`table_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of sequence_info -- ---------------------------- BEGIN; INSERT INTO `sequence_info` VALUES ('order', 3, 1); COMMIT; -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, `gender` tinyint(255) DEFAULT NULL COMMENT '1 男 2 女 9 不详', `age` smallint(6) DEFAULT NULL COMMENT '年龄', `phone` varchar(11) DEFAULT NULL COMMENT '电话', `register_mode` varchar(50) DEFAULT NULL COMMENT '注册方式', `third_party_id` varchar(64) DEFAULT NULL COMMENT '第三方验证信息', PRIMARY KEY (`id`), UNIQUE KEY `idx_unique` (`phone`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user -- ---------------------------- BEGIN; INSERT INTO `user` VALUES (1, 'demoData', 1, 1, 'demoData4', 'demoData', 'demoData'); INSERT INTO `user` VALUES (2, 'demoData', 1, 1, 'demoData', 'demoData', 'demoData'); INSERT INTO `user` VALUES (3, 'demoData', 1, 1, 'demoData2', 'demoData', 'demoData'); INSERT INTO `user` VALUES (4, 'demoData', 1, 1, 'demoData3', 'demoData', 'demoData'); INSERT INTO `user` VALUES (6, 'demoData', 1, 1, 'demoData5', 'demoData', 'demoData'); INSERT INTO `user` VALUES (7, '刘文强', 1, 1, '18162385747', NULL, NULL); COMMIT; -- ---------------------------- -- Table structure for user_password -- ---------------------------- DROP TABLE IF EXISTS `user_password`; CREATE TABLE `user_password` ( `id` int(11) NOT NULL AUTO_INCREMENT, `encrpt_password` varchar(255) DEFAULT NULL, `user_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`,`user_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user_password -- ---------------------------- BEGIN; INSERT INTO `user_password` VALUES (1, '<PASSWORD>', 1); INSERT INTO `user_password` VALUES (2, '<PASSWORD>', 2); INSERT INTO `user_password` VALUES (3, '<PASSWORD>', 3); INSERT INTO `user_password` VALUES (4, '<PASSWORD>', 4); INSERT INTO `user_password` VALUES (5, '<PASSWORD>', 6); INSERT INTO `user_password` VALUES (6, '<PASSWORD>', 7); COMMIT; SET FOREIGN_KEY_CHECKS = 1;
<reponame>mirrormind/mo-test-eam<gh_stars>1-10 -- This is dangerous and not compliant with JDBC specs, should be changed in the future DROP TABLE IF EXISTS games; CREATE TABLE games ( P_gameId int PRIMARY KEY NOT NULL AUTO_INCREMENT UNIQUE, gameName VARCHAR(15), companyName VARCHAR(15), downloadLink VARCHAR(50), description VARCHAR(300) );
select * from {{ var('admin') }}
select * from {sc}.concept
DROP TABLE PARTY_DIM_ROOT;
-- Licensed to the Apache Software Foundation (ASF) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- The ASF licenses this file to You 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. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[xa_access_audit]( [id] [bigint] IDENTITY(1,1) NOT NULL, [create_time] [datetime2] DEFAULT NULL NULL, [update_time] [datetime2] DEFAULT NULL NULL, [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [audit_type] [int] DEFAULT 0 NOT NULL, [access_result] [int] DEFAULT 0 NULL, [access_type] [varchar](255) DEFAULT NULL NULL, [acl_enforcer] [varchar](255) DEFAULT NULL NULL, [agent_id] [varchar](255) DEFAULT NULL NULL, [client_ip] [varchar](255) DEFAULT NULL NULL, [client_type] [varchar](255) DEFAULT NULL NULL, [policy_id] [bigint] DEFAULT 0 NULL, [repo_name] [varchar](255) DEFAULT NULL NULL, [repo_type] [int] DEFAULT 0 NULL, [result_reason] [varchar](255) DEFAULT NULL NULL, [session_id] [varchar](255) DEFAULT NULL NULL, [event_time] [datetime2] DEFAULT NULL NULL, [request_user] [varchar](255) DEFAULT NULL NULL, [action] [varchar](2000) DEFAULT NULL NULL, [request_data] [varchar](4000) DEFAULT NULL NULL, [resource_path] [varchar](4000) DEFAULT NULL NULL, [resource_type] [varchar](255) DEFAULT NULL NULL, [seq_num] [bigint] DEFAULT 0 NULL, [event_count] [bigint] DEFAULT 1 NULL, [event_dur_ms] [bigint] DEFAULT 1 NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [xa_access_audit_cr_time] ON [xa_access_audit] ( [create_time] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [xa_access_audit_event_time] ON [xa_access_audit] ( [event_time] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [xa_access_audit_added_by_id] ON [xa_access_audit] ( [added_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [xa_access_audit_upd_by_id] ON [xa_access_audit] ( [upd_by_id] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [xa_access_audit_up_time] ON [xa_access_audit] ( [update_time] ASC ) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] exit
<filename>_protected/common/modules/borrowreturn/std_position.sql -- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Sep 02, 2016 at 02:58 AM -- Server version: 10.1.13-MariaDB -- PHP Version: 5.6.23 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: `yii2advanced` -- -- -------------------------------------------------------- -- -- Table structure for table `std_position` -- CREATE TABLE `std_position` ( `id` int(11) NOT NULL COMMENT 'ID', `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'ตำแหน่งของสังกัด', `detail` text COLLATE utf8_unicode_ci COMMENT 'รายละเอียด' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Indexes for dumped tables -- -- -- Indexes for table `std_position` -- ALTER TABLE `std_position` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `std_position` -- ALTER TABLE `std_position` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID'; /*!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 */;
----------------------------------------------------------------------- -- -- Copyright (C) 2021 CARTO -- ----------------------------------------------------------------------- CREATE OR REPLACE FUNCTION @@SF_DATABASEID@@.@@SF_SCHEMA_QUADKEY@@._SIBLING (quadint STRING, direction STRING) RETURNS STRING LANGUAGE JAVASCRIPT AS $$ @@LIBRARY_FILE_CONTENT@@ if(!QUADINT || !DIRECTION) { throw new Error('NULL argument passed to UDF'); } return sibling(QUADINT, DIRECTION).toString(); $$; CREATE OR REPLACE SECURE FUNCTION @@SF_DATABASEID@@.@@SF_SCHEMA_QUADKEY@@.SIBLING (quadint BIGINT, direction STRING) RETURNS BIGINT AS $$ CAST(@@SF_DATABASEID@@.@@SF_SCHEMA_QUADKEY@@._SIBLING(CAST(QUADINT AS STRING),DIRECTION) AS BIGINT) $$;
<gh_stars>0 SET foreign_key_checks = 0; DROP TABLE IF EXISTS `music_device`; DROP TABLE IF EXISTS `music_store`; DROP TABLE IF EXISTS `music_library`; DROP TABLE IF EXISTS `music_arrange`; DROP TABLE IF EXISTS `music_arrange_device`; DROP TABLE IF EXISTS `music_arrange_item`; -- ---------------------------- -- 音乐设备表 -- ---------------------------- CREATE TABLE `music_device` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `deviceNo` VARCHAR(10) NOT NULL UNIQUE, `deviceName` VARCHAR(32) NOT NULL, `mac` VARCHAR(32) NOT NULL UNIQUE, `storeNo` VARCHAR(20) NOT NULL, `onlineStatus` TINYINT(1) NOT NULL, `registerStatus` TINYINT(1) NOT NULL, `storageCard` VARCHAR(10), `appVersion` VARCHAR(30), `deviceSound` VARCHAR(20), `lastMsgTime` DATETIME, `createTime` DATETIME DEFAULT CURRENT_TIMESTAMP, `updateTime` DATETIME, PRIMARY KEY (`id`) ) ENGINE = INNODB DEFAULT CHARSET = utf8; -- ---------------------------- -- 音乐门店表 -- ---------------------------- CREATE TABLE `music_store` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `storeNo` VARCHAR(20) NOT NULL UNIQUE, `storeName` VARCHAR(32) NOT NULL, `customerName` VARCHAR(20) NOT NULL, `address` VARCHAR(64), `createTime` DATETIME DEFAULT CURRENT_TIMESTAMP, `updateTime` DATETIME, PRIMARY KEY (`id`) ) ENGINE = INNODB DEFAULT CHARSET = utf8; -- ---------------------------- -- 音乐库表 -- ---------------------------- CREATE TABLE `music_library` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `musicNo` VARCHAR(20) NOT NULL UNIQUE, `musicName` VARCHAR(64) NOT NULL, `musicSize` BIGINT(20) NOT NULL, `musicUrl` VARCHAR(60) NOT NULL, `playTime` INT(20) NOT NULL, `md5` VARCHAR(32) NOT NULL, `createTime` DATETIME DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE = INNODB DEFAULT CHARSET = utf8; -- ---------------------------- -- 音乐播期表 -- ---------------------------- CREATE TABLE `music_arrange` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `arrangeNo` VARCHAR(20) NOT NULL UNIQUE, `arrangeName` VARCHAR(64) NOT NULL, `customerName` VARCHAR(32) NOT NULL, `beginDate` DATE, `endDate` DATE, `beginTime` VARCHAR(10) NOT NULL, `endTime` VARCHAR(10) NOT NULL, `arrangeLevel` TINYINT(1) NOT NULL, `createTime` DATETIME DEFAULT CURRENT_TIMESTAMP, `updateTime` DATETIME, PRIMARY KEY (`id`) ) ENGINE = INNODB DEFAULT CHARSET = utf8; -- ---------------------------- -- 音乐播控表 -- ---------------------------- CREATE TABLE `music_arrange_device` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `storeNo` VARCHAR(10) NOT NULL, `deviceNo` VARCHAR(20) NOT NULL, `progress` INT(10), `pubStatus` TINYINT(1) NOT NULL DEFAULT 0, `arrangeStatus` TINYINT(1) NOT NULL DEFAULT 0, `arrangeNo` VARCHAR(20) NOT NULL, `arrangeName` VARCHAR(64) NOT NULL, `beginDate` DATE, `endDate` DATE, `beginTime` VARCHAR(10) NOT NULL, `endTime` VARCHAR(10) NOT NULL, `arrangeLevel` TINYINT(1) NOT NULL, `createTime` DATETIME DEFAULT CURRENT_TIMESTAMP, `updateTime` DATETIME, CONSTRAINT uk_music_arrange_device UNIQUE (deviceNo, arrangeNo), PRIMARY KEY (`id`) ) ENGINE = INNODB DEFAULT CHARSET = utf8; -- ---------------------------- -- 音乐播期子表 -- ---------------------------- CREATE TABLE `music_arrange_item` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `arrangeNo` VARCHAR(20) NOT NULL , `musicNo` VARCHAR(20) NOT NULL, CONSTRAINT uk_music_arrange_item UNIQUE (musicNo, arrangeNo), PRIMARY KEY (`id`), FOREIGN KEY (musicNo) REFERENCES music_library (musicNo) on update cascade on delete cascade, FOREIGN KEY (arrangeNo) REFERENCES music_arrange (arrangeNo) on update cascade on delete cascade ) ENGINE = INNODB DEFAULT CHARSET = utf8;
-- This file should undo anything in `up.sql` ALTER TABLE users RENAME COLUMN password_hash to password; ALTER TABLE users RENAME COLUMN preferred_name to name;
USE [SAI_Work2] GO /****** Object: UserDefinedFunction [dbo].[StatusReturn] Script Date: 11/27/2017 3:53:43 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FUNCTION [dbo].[StatusReturn](@partnerid bigint,@itemid bigint) RETURNS VARCHAR(250) AS BEGIN DECLARE @status VARCHAR(250) SET @status = @partnerid /* SET @Work = REPLACE(@Work, 'www.', '') SET @Work = REPLACE(@Work, '.com', '') */ RETURN @status END GO
ALTER TABLE dev_deo_egov.gedo_tipodocumento ADD RESULTADO CHAR(1) NOT NULL DEFAULT 0;
<gh_stars>0 SELECT TOP 5 c.CountryName, ( SELECT TOP 1 p.Elevation FROM Peaks AS p INNER JOIN MountainsCountries AS mc ON mc.MountainId = p.MountainId WHERE mc.CountryCode = (SELECT TOP 1 CountryCode FROM Countries WHERE CountryName = c.CountryName) ORDER BY p.Elevation DESC ) AS HighestPeakElevation, ( SELECT TOP 1 r.Length FROM Rivers as r INNER JOIN CountriesRivers AS cr ON cr.RiverId = r.id WHERE cr.CountryCode = (SELECT TOP 1 CountryCode FROM Countries WHERE CountryName = c.CountryName) ORDER BY r.Length DESC ) AS LongestRiverLength FROM Countries as c ORDER BY HighestPeakElevation DESC, LongestRiverLength DESC, c.CountryName
<gh_stars>0 -- phpMyAdmin SQL Dump -- version 4.7.9 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 -- Generation Time: Mar 06, 2019 at 02:27 AM -- Server version: 5.7.21 -- PHP Version: 7.2.4 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: `dbwtb` -- -- -------------------------------------------------------- -- -- Table structure for table `tabel_ads` -- DROP TABLE IF EXISTS `tabel_ads`; CREATE TABLE IF NOT EXISTS `tabel_ads` ( `idAds` varchar(50) NOT NULL, `title` varchar(100) DEFAULT NULL, `description` text, `url` text, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tabel_ads` -- INSERT INTO `tabel_ads` (`idAds`, `title`, `description`, `url`, `createdAt`) VALUES ('1', 'Yasser ads', 'An advert about codeigniter PHP code.\r\n ', 'http://www.codeignter.com', '2019-01-14 05:07:32'), ('19ed6e6471fe4509896ce79e8d85770d', 'yasser final', 'this time it will work isa gooood ', 'http://www.google.com', '2019-01-30 04:01:37'), ('1f732fde145c436aba4b2760eb14f862', 'yasser', 'New advertisement about codeIgniter\r\n', 'http://www.codeignter.com', '2019-02-01 09:31:32'), ('8c55f71d94e444bea231088e39440a61', 'New ads', 'New advertisement about laravel', 'http://www.google.com', '2019-02-07 06:16:12'), ('2091e26bedbc49c6899e3a98780be77f', 'yasser', 'adsafdsfd gfhgfjhgjh jkhkjkl', 'http://www.codeignter.com', '2019-03-04 18:48:16'); -- -------------------------------------------------------- -- -- Table structure for table `tabel_notification` -- DROP TABLE IF EXISTS `tabel_notification`; CREATE TABLE IF NOT EXISTS `tabel_notification` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idPosting` varchar(50) NOT NULL, `idUser` varchar(50) NOT NULL, `status` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idPosting` (`idPosting`), KEY `idUser` (`idUser`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; -- -- Dumping data for table `tabel_notification` -- INSERT INTO `tabel_notification` (`id`, `idPosting`, `idUser`, `status`) VALUES (8, '6d09d9e1c6134e3e9bae64c01e5595bb', '58c30fe3bdfe446db3d51b38cc8953bd', 1), (9, 'c6f631493850452597dfca41e0cdc55e', '58c30fe3bdfe446db3d51b38cc8953bd', 1), (10, 'c6f631493850452597dfca41e0cdc55e', 'USR-451BF190-8A26-587E-A3B8-9DCA52349B23', 0), (11, 'bc9355b26e4543cdaaf9a37a716e409b', 'useridyasser', 1), (12, '97d0758c09ee49c28cc5f398b951ab1e', '58c30fe3bdfe446db3d51b38cc8953bd', 1), (13, '97d0758c09ee49c28cc5f398b951ab1e', 'USR-451BF190-8A26-587E-A3B8-9DCA52349B23', 0); -- -------------------------------------------------------- -- -- Table structure for table `tabel_offer` -- DROP TABLE IF EXISTS `tabel_offer`; CREATE TABLE IF NOT EXISTS `tabel_offer` ( `idOffer` varchar(100) NOT NULL, `idUser` varchar(100) NOT NULL, `idPosting` varchar(100) NOT NULL, `message` text, `accepted` tinyint(1) NOT NULL DEFAULT '0', `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `readAt` timestamp NULL DEFAULT NULL, PRIMARY KEY (`idOffer`), KEY `idUser` (`idUser`), KEY `idPosting` (`idPosting`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tabel_offer` -- INSERT INTO `tabel_offer` (`idOffer`, `idUser`, `idPosting`, `message`, `accepted`, `createdAt`, `readAt`) VALUES ('3f724379fd22455798a7c1c83d496cdf', '58c30fe3bdfe446db3d51b38cc8953bd', '6d09d9e1c6134e3e9bae64c01e5595bb', 'this is my offer for it\'s a good one', 1, '2019-03-04 20:31:36', '2019-03-04 20:32:24'), ('6a678fb5c90441e399dc1b26a9fd9714', '<KEY>', '0d3a775ab00a4b7ea28234f3159eaf75', 'test message', 0, '2019-03-05 09:21:39', '2019-03-05 09:22:28'), ('8c65862298764e70aaa2c32ebef25d54', '58c30fe3bdfe446db3d51b38cc8953bd', '0d3a775ab00a4b7ea28234f3159eaf75', 'I have an offer ', 0, '2019-03-05 07:45:45', '2019-03-05 07:47:24'), ('a38a11ba054f4dd7a658fdc85fe9554e', '58c30fe3bdfe446db3d51b38cc8953bd', 'c6f631493850452597dfca41e0cdc55e', 'test', 0, '2019-03-05 09:14:39', NULL), ('c22a10917b6648cdb57c72d05c3b817a', '58c30fe3bdfe446db3d51b38cc8953bd', 'c6f631493850452597dfca41e0cdc55e', 'Test', 0, '2019-03-05 09:56:25', NULL), ('f508b9387336429c957dd5d2bd3f0125', '58c30fe3bdfe446db3d51b38cc8953bd', '0d3a775ab00a4b7ea28234f3159eaf75', 'message', 0, '2019-03-05 09:12:42', '2019-03-05 09:13:21'); -- -------------------------------------------------------- -- -- Table structure for table `tabel_payment` -- DROP TABLE IF EXISTS `tabel_payment`; CREATE TABLE IF NOT EXISTS `tabel_payment` ( `idPayment` varchar(100) NOT NULL, `idUser` varchar(100) NOT NULL, `photo` text NOT NULL, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `level` enum('Silver','Gold','Platinum') NOT NULL, `verifDate` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, `verification` tinyint(1) NOT NULL DEFAULT '0', `verifMessage` text, PRIMARY KEY (`idPayment`), KEY `idUser` (`idUser`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `tabel_posting` -- DROP TABLE IF EXISTS `tabel_posting`; CREATE TABLE IF NOT EXISTS `tabel_posting` ( `idPosting` varchar(100) NOT NULL, `idUser` varchar(100) NOT NULL, `title` text NOT NULL, `description` text NOT NULL, `minimumBudget` int(11) NOT NULL, `maximumBudget` int(11) NOT NULL, `verification` tinyint(1) NOT NULL DEFAULT '0', `postingDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `verifMessage` text, `productCategory` enum('Rumah','Ruko','Tanah','Apartemen','Vila','Office','Pabrik','Gudang') NOT NULL, `requestCategory` enum('Beli','Sewa') NOT NULL, `location` varchar(100) NOT NULL, `promotedAt` timestamp NULL DEFAULT NULL, `verifDate` timestamp NULL DEFAULT NULL, `views` int(11) NOT NULL DEFAULT '0', `sponsorTime` smallint(6) NOT NULL DEFAULT '0', `sponsorDate` date DEFAULT NULL, `complete` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`idPosting`), KEY `idUser` (`idUser`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tabel_posting` -- INSERT INTO `tabel_posting` (`idPosting`, `idUser`, `title`, `description`, `minimumBudget`, `maximumBudget`, `verification`, `postingDate`, `verifMessage`, `productCategory`, `requestCategory`, `location`, `promotedAt`, `verifDate`, `views`, `sponsorTime`, `sponsorDate`, `complete`) VALUES ('062571f61dba4581bb065923e22a5451', 'useridyasser', 'two post', 'the searching test is going here', 20000000, 30000000, 1, '2019-03-05 20:25:22', 'ok', 'Rumah', 'Beli', 'Bangka Belitung', '2019-03-05 18:25:22', '2019-03-05 18:25:45', 5, 0, NULL, 0), ('0d3a775ab00a4b7ea28234f3159eaf75', 'useridyasser', 'New Free Wifi Office', 'In a good location between toll and city.', 20000, 20000000, 1, '2019-03-05 09:38:30', 'ok', 'Office', 'Beli', 'Sulawesi Tengah', '2019-03-05 07:38:30', '2019-03-05 08:07:30', 50, 0, NULL, 0), ('6d09d9e1c6134e3e9bae64c01e5595bb', 'useridyasser', 'First post', 'this is the first post for the user Panel', 2000000, 3000000, 1, '2019-03-04 22:22:01', 'Ok', 'Rumah', 'Beli', 'Bali', '2019-03-04 20:22:01', '2019-03-04 20:22:39', 4, 0, NULL, 1), ('97d0758c09ee49c28cc5f398b951ab1e', 'useridyasser', 'five post', 'this is the fifth post mmmmmm', 2000000, 300000000, 1, '2019-03-06 02:24:51', 'ok', 'Rumah', 'Beli', 'Bali', '2019-03-06 00:24:51', '2019-03-06 00:25:32', 2, 0, NULL, 0), ('bc9355b26e4543cdaaf9a37a716e409b', '58c30fe3bdfe446db3d51b38cc8953bd', 'Penyewaan Kantor', 'Penyewaan Kantor di Kalimantan Tengah', 200000000, 300000000, 0, '2019-03-05 11:29:28', NULL, 'Office', 'Sewa', 'Kalimantan Tengah', '2019-03-05 09:29:28', NULL, 2, 0, NULL, 0), ('c6f631493850452597dfca41e0cdc55e', 'useridyasser', 'second one', 'this is the second one for soponsor', 200000000, 300000000, 1, '2019-03-04 23:14:59', 'ok', 'Rumah', 'Sewa', 'Bali', '2019-03-04 21:14:59', '2019-03-04 21:15:36', 20, 4, '2019-03-04', 0); -- -------------------------------------------------------- -- -- Table structure for table `tabel_user` -- DROP TABLE IF EXISTS `tabel_user`; CREATE TABLE IF NOT EXISTS `tabel_user` ( `idUser` varchar(100) NOT NULL, `name` varchar(100) NOT NULL, `address` text NOT NULL, `phoneNumber` varchar(20) NOT NULL, `email` varchar(100) NOT NULL, `location` varchar(20) NOT NULL, `password` varchar(50) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `status` tinyint(1) NOT NULL DEFAULT '1', `level` varchar(45) NOT NULL, `subscribes` text, PRIMARY KEY (`idUser`), UNIQUE KEY `email` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tabel_user` -- INSERT INTO `tabel_user` (`idUser`, `name`, `address`, `phoneNumber`, `email`, `location`, `password`, `createdAt`, `status`, `level`, `subscribes`) VALUES ('5<PASSWORD>', 'bhagaskara', 'Jl Kemuning', '085769009084', '<EMAIL>', 'Palembang', '<PASSWORD>', '2019-03-04 11:01:17', 1, 'User-y583s682r-262B-5EB7-B609-E89FC7DC9699', 'Bali-DKI Jakarta-DI Yogyakarta-Gorontalo-Kalimantan Selatan-'), ('useridyasser', 'yasser', 'Mansours', '', '<EMAIL>', 'Banten', '<PASSWORD>', '2019-01-13 18:41:12', 1, 'Admin-y583s682r-5889-5791-AE8F-347F25FC0172', 'Kalimantan Barat-Kalimantan Tengah-'), ('USR-451BF190-8A26-587E-A3B8-9DCA52349B23', 'bhagaskara123', 'Jl. Kemuning', '085769009084', '<EMAIL>', 'Sumatera Selatan', '25d55ad283aa400af464c76d713c07ad', '2019-01-06 04:44:52', 1, 'User-y583s682r-262B-5EB7-B609-E89FC7DC9699', 'Bali-Jambi-'); -- -------------------------------------------------------- -- -- Table structure for table `version` -- DROP TABLE IF EXISTS `version`; CREATE TABLE IF NOT EXISTS `version` ( `version_app` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `version` -- INSERT INTO `version` (`version_app`) VALUES ('1.0.0'); -- -- Constraints for dumped tables -- -- -- Constraints for table `tabel_notification` -- ALTER TABLE `tabel_notification` ADD CONSTRAINT `tabel_notification_ibfk_1` FOREIGN KEY (`idPosting`) REFERENCES `tabel_posting` (`idPosting`), ADD CONSTRAINT `tabel_notification_ibfk_2` FOREIGN KEY (`idUser`) REFERENCES `tabel_user` (`idUser`); -- -- Constraints for table `tabel_offer` -- ALTER TABLE `tabel_offer` ADD CONSTRAINT `tabel_offer_ibfk_1` FOREIGN KEY (`idUser`) REFERENCES `tabel_user` (`idUser`), ADD CONSTRAINT `tabel_offer_ibfk_2` FOREIGN KEY (`idPosting`) REFERENCES `tabel_posting` (`idPosting`); -- -- Constraints for table `tabel_payment` -- ALTER TABLE `tabel_payment` ADD CONSTRAINT `tabel_payment_ibfk_1` FOREIGN KEY (`idUser`) REFERENCES `tabel_user` (`idUser`); -- -- Constraints for table `tabel_posting` -- ALTER TABLE `tabel_posting` ADD CONSTRAINT `tabel_posting_ibfk_1` FOREIGN KEY (`idUser`) REFERENCES `tabel_user` (`idUser`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE PROCEDURE add_role_to_user @user_id INT, @role_name VARCHAR(32) AS BEGIN IF((SELECT COUNT(name) FROM roles WHERE name = @role_name) != 1) THROW 50032, 'Role with such name doesnt exist', 1 IF((SELECT COUNT(user_id) FROM users_roles WHERE role_name = @role_name AND user_id = @user_id) != 0) THROW 50033, 'User already has such role', 1 DECLARE @my_table table(user_id INT) INSERT users_roles (user_id, role_name) OUTPUT INSERTED.user_id INTO @my_table VALUES(@user_id, @role_name) IF((SELECT COUNT(user_id) FROM @my_table) != 0) THROW 50034, 'Failed to add such role to an user', 1 END
<filename>LAPR3FinalProject/Database/LAPR3_PROCADDINVOICE.sql create or replace PROCEDURE procAddInvoiceLine(p_id_rental invoice_line.id_rental%type) IS v_id_vehicle INTEGER; v_rental_duration INTEGER; v_rental_cost INTEGER; v_rental_end_date_hour DATE; v_rental_earned_points INTEGER; BEGIN SELECT id_vehicle, rental_duration, rental_cost, rental_end_date_hour, earned_points INTO v_id_vehicle, v_rental_duration, v_rental_cost, v_rental_end_date_hour, v_rental_earned_points FROM rental WHERE id_rental = p_id_rental; INSERT INTO invoice_line VALUES (p_id_rental, NULL, v_id_vehicle, v_rental_duration, v_rental_cost, v_rental_end_date_hour, v_rental_earned_points); END; /
<filename>HW07IntroToSQL/07.SelectAllFullNamesFromEmployees.sql --7. Write a SQL to find the full name of each employee SELECT FirstName +' '+ LastName AS FullName FROM dbo.Employees
SELECT id, title, boardId, maxItems, parentId, position, type FROM main.Containers WHERE id = :id
INSERT INTO pos_itemtemp VALUES("IATT200005140","193010","191001","192001","40000","1","40000","0","40000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193010"), ("IATT200005140","193054","191002","192010","20000","1","20000","0","20000","1","1","2","IAT0502200910","NHO2018000007","PAID","","193054"), ("IATT200005141","193082","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193082"), ("IATT200005141","193230","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193230"), ("IATT200005141","193046","191002","192010","10000","1","10000","0","10000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193046"), ("IATT200005142","193085","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193085"), ("IATT200005142","193236","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","pedas sedang","193236"), ("IATT200005142","193027","191001","192003","43000","1","43000","0","43000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193027"), ("IATT200005142","193047","191002","192010","10000","1","10000","0","10000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193047"), ("IATT200005142","193055","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193055"), ("IATT200005143","193082","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193082"), ("IATT200005143","193235","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193235"), ("IATT200005143","193049","191002","192010","10000","1","10000","0","10000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193049"), ("IATT200005143","193049","191002","192010","10000","1","10000","0","10000","2","1","1","IAT0502200910","NHO2018000007","PAID","","193049"), ("IATT200005144","193082","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193082"), ("IATT200005144","193230","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193230"), ("IATT200005144","193046","191002","192010","10000","1","10000","0","10000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193046"), ("IATT200005145","193084","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","level 2","PEDAS"), ("IATT200005145","193230","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193230"), ("IATT200005145","193056","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193056"), ("IATT200005145","193055","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193055"), ("IATT200005146","193082","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193082"), ("IATT200005146","193230","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193230"), ("IATT200005146","193056","191002","192010","17000","1","17000","0","17000","1","1","2","IAT0502200910","NHO2018000007","PAID","","193056"), ("IATT200005147","193029","191001","192004","27000","1","27000","0","27000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193029"), ("IATT200005147","193054","191002","192010","20000","1","20000","0","20000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193054"), ("IATT200005148","193155","191001","192015","35454","1","35454","0","35454","1","1","1","IAT0502200910","NHO2018000007","PAID","","193155"), ("IATT200005148","193136","191001","192015","43727","1","43727","0","43727","1","1","1","IAT0502200910","NHO2018000007","PAID","","193136"), ("IATT200005149","193024","191001","192003","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193024"), ("IATT200005149","193054","191002","192010","20000","1","20000","0","20000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193054"), ("IATT200005150","193084","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","PEDAS"), ("IATT200005150","193233","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193233"), ("IATT200005150","193054","191002","192010","20000","1","20000","0","20000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193054"), ("IATT200005150","193055","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193055"), ("IATT200005149","193048","191002","192010","8000","1","8000","0","8000","1","1","2","IAT0502200910","NHO2018000007","PAID","","193048"), ("IATT200005144","193118","191001","192012","20000","1","20000","0","20000","1","1","2","IAT0502200910","NHO2018000007","PAID","","193118"), ("IATT200005150","193070","191001","192012","13000","1","13000","0","13000","1","1","2","IAT0502200910","NHO2018000007","PAID","","193070"), ("IATT200005151","193007","191001","192001","37000","1","37000","0","37000","1","1","1","IAT0502200910","NHO2018000007","PAID","","PEDAS"), ("IATT200005151","193047","191002","192010","10000","1","10000","0","10000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193047"), ("IATT200005152","193084","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","LVL 1","PEDAS"), ("IATT200005152","193235","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193235"), ("IATT200005152","193049","191002","192010","10000","1","10000","0","10000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193049"), ("IATT200005152","193055","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193055"), ("IATT200005152","193071","191001","192012","18000","1","18000","0","18000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193071"), ("IATT200005153","193096","191001","192008","50000","1","50000","0","50000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193096"), ("IATT200005153","193016","191001","192002","37000","1","37000","0","37000","1","1","1","IAT0502200910","NHO2018000007","PAID","","PEDAS"), ("IATT200005153","193048","191002","192010","8000","1","8000","0","8000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193048"), ("IATT200005153","193048","191002","192010","8000","1","8000","0","8000","2","1","1","IAT0502200910","NHO2018000007","PAID","","193048"), ("IATT200005154","193084","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","PEDAS"), ("IATT200005154","193237","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193237"), ("IATT200005154","193056","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193056"), ("IATT200005155","193084","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","PEDAS"), ("IATT200005155","193232","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193232"), ("IATT200005155","193054","191002","192010","20000","1","20000","0","20000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193054"), ("IATT200005157","193083","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193083"), ("IATT200005157","193232","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193232"), ("IATT200005157","193069","191001","192012","13000","1","13000","0","13000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193069"), ("IATT200005158","193082","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193082"), ("IATT200005158","193236","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193236"), ("IATT200005158","193118","191001","192012","20000","1","20000","0","20000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193118"), ("IATT200005158","193050","191002","192010","20000","1","20000","0","20000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193050"), ("IATT200005158","193051","191002","192010","20000","1","20000","0","20000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193051"), ("IATT200005159","193082","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193082"), ("IATT200005160","193069","191001","192012","13000","1","13000","0","13000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193069"), ("IATT200005160","193056","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193056"), ("IATT200005161","193050","191002","192010","20000","1","20000","0","20000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193050"), ("IATT200005162","193084","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","PEDAS"), ("IATT200005162","193237","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193237"), ("IATT200005162","193056","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193056"), ("IATT200005163","193077","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193077"), ("IATT200005163","193232","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193232"), ("IATT200005163","193055","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193055"), ("IATT200005163","193056","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193056"), ("IATT200005159","193233","191001","192011","0","1","0","0","0","1","1","2","IAT0502200910","NHO2018000007","PAID","jngn d buat sudah keluar","193233"), ("IATT200005164","193078","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","","PEDAS"), ("IATT200005164","193078","191001","192001","30000","1","30000","0","30000","2","1","1","IAT0502200910","NHO2018000007","PAID","","PEDAS"), ("IATT200005165","193084","191001","192001","30000","1","30000","0","30000","1","1","1","IAT0502200910","NHO2018000007","PAID","pedes sedeng","PEDAS"), ("IATT200005165","193233","191001","192011","0","1","0","0","0","1","1","1","IAT0502200910","NHO2018000007","PAID","","193233"), ("IATT200005165","193071","191001","192012","18000","1","18000","0","18000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193071"), ("IATT200005165","193055","191002","192010","17000","1","17000","0","17000","1","1","1","IAT0502200910","NHO2018000007","PAID","","193055"); INSERT INTO pos_salestemp VALUES("IATT200005140","","1","60000","0","6000","0","66000","66000","05/02/2020","12:30","2020-02-05","15:26:57","ISU000004","tbl0012","CLOSED","1","","IATR200005001","","","","","IAT0502200910","NHO2018000007"), ("IATT200005141","","2","40000","0","4000","0","44000","50000","05/02/2020","14:11","2020-02-05","14:37:38","ISU000004","tbl0005","CLOSED","1","","IATR200005000","","","","","IAT0502200910","NHO2018000007"), ("IATT200005142","","3","100000","0","10000","0","110000","110000","05/02/2020","15:47","2020-02-05","16:25:36","ISU000004","tbl0012","CLOSED","1","","IATR200005002","","","","","IAT0502200910","NHO2018000007"), ("IATT200005143","","2","50000","0","5000","0","55000","55000","05/02/2020","16:18","2020-02-05","17:07:41","ISU000006","tbl0010","CLOSED","1","","IATR200005003","","","","","IAT0502200910","NHO2018000007"), ("IATT200005144","","0","60000","0","6000","0","66000","100000","05/02/2020","17:04","2020-02-05","20:08:07","ISU000004","tbl0012","CLOSED","1","","IATR200005014","","","","","IAT0502200910","NHO2018000007"), ("IATT200005145","","2","64000","0","6400","0","70400","70400","05/02/2020","17:10","2020-02-05","18:29:02","ISU000004","tbl0011","CLOSED","1","","IATR200005007","","","","","IAT0502200910","NHO2018000007"), ("IATT200005146","","0","47000","0","4700","0","51700","51700","05/02/2020","17:35","2020-02-05","18:05:05","ISU000004","tbl0010","CLOSED","1","","IATR200005005","","","","","IAT0502200910","NHO2018000007"), ("IATT200005147","","1","47000","0","4700","0","51700","101700","05/02/2020","17:37","2020-02-05","18:27:57","ISU000004","tbl0023","CLOSED","1","","IATR200005006","","","","","IAT0502200910","NHO2018000007"), ("IATT200005148","","1","79181","0","7919","0","87100","87100","05/02/2020","17:52","2020-02-05","17:54:07","ISU000004","takeaway","CLOSED","1","","IATR200005004","","","","","IAT0502200910","NHO2018000007"), ("IATT200005149","","1","58000","0","5800","0","63800","100000","05/02/2020","18:31","2020-02-05","19:07:42","ISU000004","tbl0004","CLOSED","1","","IATR200005008","","","","","IAT0502200910","NHO2018000007"), ("IATT200005150","NHM2020000142 CLARA","2","80000","0","8000","0","88000","88000","05/02/2020","18:34","2020-02-05","19:38:50","ISU000004","tbl0010","CLOSED","1","","IATR200005010","","","","","IAT0502200910","NHO2018000007"), ("IATT200005151","","1","47000","0","4700","0","51700","60000","05/02/2020","18:57","2020-02-05","19:31:59","ISU000004","tbl0011","CLOSED","1","","IATR200005009","","","","","IAT0502200910","NHO2018000007"), ("IATT200005152","NHM2020000145 Retno Palupi","2","75000","0","7500","0","82500","82500","05/02/2020","19:09","2020-02-05","21:15:17","ISU000004","tbl0014","CLOSED","1","","IATR200005023","","","","","IAT0502200910","NHO2018000007"), ("IATT200005153","","2","103000","0","10300","0","113300","113300","05/02/2020","19:11","2020-02-05","20:09:38","ISU000004","tbl0023","CLOSED","1","","IATR200005015","","","","","IAT0502200910","NHO2018000007"), ("IATT200005154","","1","47000","0","4700","0","51700","100000","05/02/2020","19:17","2020-02-05","21:10:20","ISU000004","tbl0020","CLOSED","1","","IATR200005021","","","","","IAT0502200910","NHO2018000007"), ("IATT200005155","NHM2020000138 Sasmi Ariesti M","2","50000","0","5000","0","55000","100000","05/02/2020","19:18","2020-02-05","21:11:49","ISU000004","tbl0022","CLOSED","1","","IATR200005022","","","","","IAT0502200910","NHO2018000007"), ("IATT200005156","","1","0","0","0","0","0","0","05/02/2020","19:30","05/02/2020","19:30:45","ISU000004","tbl0021","CANCELED","1","PERMINTAAN CUSTOMER","","","","","","IAT0502200910","NHO2018000007"), ("IATT200005157","NHM2020000139 Dorisma","2","43000","0","4300","0","47300","47300","05/02/2020","19:30","2020-02-05","21:07:49","ISU000004","tbl0021","CLOSED","1","","IATR200005019","","","","","IAT0502200910","NHO2018000007"), ("IATT200005158","","0","90000","0","9000","0","99000","99000","05/02/2020","19:33","2020-02-05","20:07:47","ISU000004","tbl0005","CLOSED","1","","IATR200005013","","","","","IAT0502200910","NHO2018000007"), ("IATT200005159","","2","30000","0","3000","0","33000","33000","05/02/2020","19:47","2020-02-05","20:05:38","ISU000004","tbl0010","CLOSED","1","","IATR200005011","","","","","IAT0502200910","NHO2018000007"), ("IATT200005160","","1","30000","0","3000","0","33000","33000","05/02/2020","19:48","2020-02-05","20:06:19","ISU000004","tbl0009","CLOSED","1","","IATR200005012","","","","","IAT0502200910","NHO2018000007"), ("IATT200005161","","1","20000","0","2000","0","22000","22000","05/02/2020","19:49","2020-02-05","20:21:14","ISU000004","tbl0001","CLOSED","1","","IATR200005017","","","","","IAT0502200910","NHO2018000007"), ("IATT200005162","NHM2020000143 Irfan fajar","2","47000","0","4700","0","51700","100000","05/02/2020","19:49","2020-02-05","20:10:21","ISU000004","tbl0018","CLOSED","1","","IATR200005016","","","","","IAT0502200910","NHO2018000007"), ("IATT200005163","NHM2020000144 <NAME>","2","64000","0","6400","0","70400","70400","05/02/2020","19:54","2020-02-05","21:09:26","ISU000004","tbl0019","CLOSED","1","","IATR200005020","","","","","IAT0502200910","NHO2018000007"), ("IATT200005164","","1","60000","0","6000","0","66000","100000","05/02/2020","20:57","2020-02-05","20:59:12","ISU000004","tbl0005","CLOSED","1","","IATR200005018","","","","","IAT0502200910","NHO2018000007"), ("IATT200005165","NHM2020000146 Milkha abigael","2","65000","0","6500","0","71500","71500","05/02/2020","21:31","2020-02-05","21:36:07","ISU000004","tbl0012","CLOSED","1","","IATR200005024","","","","","IAT0502200910","NHO2018000007"); INSERT INTO item_void VALUES("IATT200005159","IAT0502200910","NHO2018000007","193079","193079","1","30000","Before Send","Komplen Customer"); INSERT INTO pos_paymenttemp VALUES("IATT200005141","CASH","CASH","44000","50000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005140","CASH","OVO","66000","66000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005142","CASH","CASH","110000","110000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005143","CASH","CASH","55000","55000","ISU000006","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005148","CASH","GOPAY","87100","87100","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005146","CARD","DEBIT BCA","51700","51700","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005147","CASH","CASH","51700","101700","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005145","CASH","CASH","70400","70400","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005149","CASH","CASH","63800","100000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005151","CASH","CASH","51700","60000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005150","CARD","DEBIT BCA","88000","88000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005159","CARD","MASTER","33000","33000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005160","CASH","OVO","33000","33000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005158","CARD","DEBIT BCA","99000","99000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005144","CASH","CASH","66000","100000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005153","CARD","DEBIT BCA","113300","113300","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005162","CASH","CASH","51700","100000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005161","CASH","OVO","22000","22000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005164","CASH","CASH","66000","100000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005157","CARD","DEBIT BCA","47300","47300","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005163","CARD","DEBIT BCA","70400","70400","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005154","CASH","CASH","51700","100000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005155","CASH","CASH","55000","100000","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005152","CARD","MASTER","82500","82500","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007"), ("IATT200005165","CARD","VISA","71500","71500","ISU000004","2020-02-05","","1","","CLOSED","IAT0502200910","NHO2018000007");
CREATE TABLE IF NOT EXISTS sso.users ( id bigserial NOT NULL, union_id uuid NOT NULL, created_time timestamp with time zone NOT NULL DEFAULT now(), updated_time timestamp with time zone, removed_time timestamp with time zone, status integer NOT NULL DEFAULT 0, CONSTRAINT users_pkey PRIMARY KEY (id), CONSTRAINT users_union_id_key UNIQUE (union_id) ) WITH ( OIDS=FALSE );
CREATE TABLE jto_users ( id SERIAL PRIMARY KEY, admin boolean DEFAULT FALSE, user_name TEXT NOT NULL UNIQUE, full_name TEXT NOT NULL, password TEXT NOT NULL, email TEXT NOT NULL UNIQUE, date_created TIMESTAMP NOT NULL DEFAULT now(), date_modified TIMESTAMP ); ALTER TABLE jto_cards ADD COLUMN user_id INTEGER REFERENCES jto_users(id) ON DELETE SET NULL;
SELECT [Name] FROM Towns WHERE LEN([Name]) BETWEEN 5 AND 6 ORDER BY [Name]
CREATE TABLE `table` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(45) NOT NULL, PRIMARY KEY (`id`) ); ALTER TABLE `table` ADD UNIQUE INDEX `email_UNIQUE` (`email`);
UPDATE Reports SET CloseDate = GETDATE() WHERE CloseDate IS NULL
<reponame>Shuttl-Tech/antlr_psql<gh_stars>10-100 -- file:numeric_big.sql ln:455 expect:true INSERT INTO num_exp_ln VALUES (5,'20.296713391219923821414834924710998522858242536565236229645868008008504475111229451635162536658197320282791428572861452713483981402773630985812066048575864982038046409484905688236579134672910905547858248343712686247795669280482288748331949478864729205285910525962001251260319741279139167559906461672936902355959755164523720443059989357054368460911050707727029320725144824995614445423492687177126412520389766864793826362309254124276325522276592246655562770110024099522184080118637524912964002223613671995639705240767929562023556724031894855094820328152633412077228479168557819219970917880393852962560319397442566813746504969336443969816954424715197797253670026862362130664772772977978222813915593329422557592316429203293264572088112274848838446633519530653849595288125585730314673691986554304725866754516304420665')
/* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50627 Source Host : localhost Source Database : telegram Target Server Type : MySQL Target Server Version : 50627 File Encoding : utf-8 Date: 05/16/2018 20:45:55 PM */ SET NAMES utf8; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for `user_tokenman_log` -- ---------------------------- DROP TABLE IF EXISTS `user_tokenman_log`; CREATE TABLE `user_tokenman_log` ( `chat_bot_id` int(10) NOT NULL COMMENT '机器人ID', `id` int(11) NOT NULL AUTO_INCREMENT, `created_at` int(10) NOT NULL COMMENT '创建时间', `from_id` int(11) NOT NULL COMMENT '发送用户ID', `first_name` varchar(255) NOT NULL, `from_username` varchar(255) NOT NULL COMMENT '发送用户名字', `last_name` varchar(255) NOT NULL, `ip` varchar(255) NOT NULL, `agent` varchar(300) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; ALTER TABLE group_activity ADD activate_type TINYINT(2) NOT NULL DEFAULT 0 COMMENT '激活类型'; ALTER TABLE group_activity ADD activity_tinyurl varchar(255) NOT NULL DEFAULT '' COMMENT '邀请地址配置'; ALTER TABLE chat_bot ADD new_member_switch TINYINT(2) NOT NULL DEFAULT 0 COMMENT '新加入用户消息开关'; ALTER TABLE chat_bot ADD left_member_switch TINYINT(2) NOT NULL DEFAULT 0 COMMENT '踢出用户消息开关';
<reponame>ramonperezVRB/WikiVote -- Store the metadata for article to be reviewed CREATE TABLE /*_*/pagetriage_page_tags ( ptrpt_page_id int unsigned NOT NULL, ptrpt_tag_id int unsigned NOT NULL, ptrpt_value varbinary(255) NOT NULL ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/ptrpt_page_tag_id ON /*_*/pagetriage_page_tags (ptrpt_page_id,ptrpt_tag_id); CREATE INDEX /*i*/ptrpt_tag_id_value ON /*_*/pagetriage_page_tags (ptrpt_tag_id,ptrpt_value);
<reponame>dnkansah-tieku/IronHack_midBootCamp_project<filename>mid_bootCamp_sql.sql ######################## SQL SOLUTIONS - GROUP 6 ######################## create database house_price_regression; use house_price_regression; CREATE TABLE house_price_data ( `id` varchar(24) NOT NULL, `date` int DEFAULT NULL, `bedrooms` int(4) DEFAULT NULL, `bathrooms` float DEFAULT NULL, `sqft_living` float DEFAULT NULL, `sqft_lot` float DEFAULT NULL, `floors` int(4) DEFAULT NULL, `waterfront` int(4) DEFAULT NULL, `view` int(4) DEFAULT NULL, `condition` int(4) DEFAULT NULL, `grade` int(4) DEFAULT NULL, `sqft_above` float DEFAULT NULL, `sqft_basement` float DEFAULT NULL, `yr_built` int(11) DEFAULT NULL, `yr_renovated` int(11) DEFAULT NULL, `zip_code` int(11) DEFAULT NULL, `lat` float DEFAULT NULL, `lon` float DEFAULT NULL, `sqft_living15` float DEFAULT NULL, `sqft_lot15` float DEFAULT NULL, `price` float DEFAULT NULL -- CONSTRAINT PRIMARY KEY (`id`) -- constraint keyword is optional but its a good practice ); SHOW VARIABLES LIKE 'local_infile'; SET GLOBAL local_infile = 1; load data local infile '/Users/<NAME>//Desktop/BootCamp/Labs/Unit_5/New_files/regression_data.csv' into table house_price_data fields terminated BY ','; -- 4. Select all the data from table house_price_data to check if the data was imported correctly SELECT * FROM house_price_data; -- 5. Use the alter table command to drop the column date from the database, as we would not use it in the analysis with SQL. Select all the data from the table to verify if the command worked. -- Limit your returned results to 10. alter table house_price_data drop column `date`; -- 6. Use sql query to find how many rows of data you have. SELECT COUNT(*) as 'Number of Records' FROM house_price_data; /* 7. Now we will try to find the unique values in some of the categorical columns: 1. What are the unique values in the column bedrooms? 2. What are the unique values in the column bathrooms? 3. What are the unique values in the column floors? 4. What are the unique values in the column condition? 5. What are the unique values in the column grade? */ -- 7.1 SELECT DISTINCT bedrooms FROM house_price_data; -- 7.2 SELECT DISTINCT bathrooms FROM house_price_data; -- 7.3 SELECT DISTINCT floors FROM house_price_data; -- 7.4 SELECT DISTINCT house_price_data.condition FROM house_price_data; -- 7.5 SELECT DISTINCT grade FROM house_price_data; -- 8. Arrange the data in a decreasing order by the price of the house. Return only the IDs of the top 10 most expensive houses in your data. SELECT id FROM house_price_data ORDER BY price DESC LIMIT 10; -- 9. What is the average price of all the properties in your data? SELECT ROUND(AVG(price), 2) AS 'AveragePrice' FROM house_price_data; /*10. In this exercise we will use simple group by to check the properties of some of the categorical variables in our data 10.1 What is the average price of the houses grouped by bedrooms? The returned result should have only two columns, bedrooms and Average of the prices. Use an alias to change the name of the second column. 10.2 What is the average sqft_living of the houses grouped by bedrooms? The returned result should have only two columns, bedrooms and Average of the sqft_living. Use an alias to change the name of the second column 10.3 What is the average price of the houses with a waterfront and without a waterfront? The returned result should have only two columns, waterfront and Average of the prices. Use an alias to change the name of the second column. 10.4 Is there any correlation between the columns condition and grade? You can analyse this by grouping the data by one of the variables and then aggregating the results of the other column. Visually check if there is a positive correlation or negative correlation or no correlation between the variables. */ -- 10.1 SELECT bedrooms as Bedrooms, ROUND(AVG(price), 2) AS Average_Price FROM house_price_data GROUP BY bedrooms; -- 10.2 SELECT bedrooms as Bedrooms, round(AVG(sqft_living15),2) as Average_sqft_living FROM house_price_data GROUP BY bedrooms; -- 10.3 SELECT DISTINCT waterfront AS Waterfront, ROUND(AVG(price), 3) AS Average_Price FROM house_price_data GROUP BY waterfront; -- 10.4 SELECT house_price_data.condition AS 'Condition', grade AS Grade FROM house_price_data GROUP BY house_price_data.condition ORDER BY house_price_data.condition DESC; -- 11. One of the customers is only interested in the following houses: -- ○ Number of bedrooms either 3 or 4 -- ○ Bathrooms more than 3 -- ○ One Floor -- ○ No waterfront -- ○ Condition should be 3 at least -- ○ Grade should be 5 at least -- ○ Price less than 300000 -- For the rest of the things, they are not too concerned. Write a simple query to find what are the options available for them? SELECT * FROM house_price_data WHERE (bedrooms = 3 OR bedrooms = 4) AND (bathrooms > 3 AND floors = 1 AND waterfront = 0 AND house_price_data.condition >= 3 AND grade >= 5) AND price < 600000; -- 12. Your manager wants to find out the list of properties whose prices are twice more than the average of all the properties in the database. -- Write a query to show them the list of such properties. You might need to use a sub query for this problem. select * from house_price_data where price > ( select avg(price) * 2 from house_price_data ); -- 13. Since this is something that the senior management is regularly interested in, create a view of the same query. CREATE OR REPLACE VIEW twice_more_than_the_average AS SELECT * FROM house_price_data WHERE price > (SELECT AVG(price) * 2 FROM house_price_data); select * from house_price_twice_average; -- 14. Most customers are interested in properties with three or four bedrooms. -- What is the difference in average prices of the properties with three and four bedrooms? select round(max(avg_price) - min(avg_price),2) as 'Differnce in Avg. Price' from ( select bedrooms, round(avg(price),2) as avg_price from house_price_data where bedrooms = 3 or bedrooms = 4 group by bedrooms )sub; -- 15. What are the different locations where properties are available in your database? (distinct zip codes) SELECT DISTINCT `zip_code` FROM house_price_data; -- 16. Show the list of all the properties that were renovated SELECT * FROM house_price_data WHERE yr_renovated != 0; -- 17. Provide the details of the property that is the 11th most expensive property in your database. with rank_price AS ( SELECT *, rank() over (ORDER BY price DESC) as 'Rank' from house_price_data ) SELECT * FROM rank_price LIMIT 10,1; -- Side note: comparing sqrt_living and sqrt_lot with sqrt_living15 and sqrt_lot15 and differences in size, -- it could be the case that a lot of the houses were extended in a way without being reported as renovated. -- But realistically this is renovation if the space is different SELECT id, sqft_living, sqft_living15 FROM house_price_data WHERE NOT sqft_living = sqft_living15 ORDER BY id ASC;
CREATE TABLE IF NOT EXISTS sale ( id SERIAL PRIMARY KEY, total NUMERIC(19, 2) NOT NULL, cashback NUMERIC(19, 2) NOT NULL, create_at TIMESTAMP DEFAULT now() ); CREATE TABLE IF NOT EXISTS product ( id SERIAL PRIMARY KEY, description VARCHAR(500) NOT NULL, price NUMERIC(19, 2) NOT NULL, cashback NUMERIC(19, 2) NOT NULL, sale_id INTEGER REFERENCES sale(id), create_at TIMESTAMP DEFAULT now() );
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 17, 2019 at 06:54 AM -- Server version: 10.1.28-MariaDB -- PHP Version: 5.6.32 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: `nuraj_cloud_db` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_courier` -- CREATE TABLE `tbl_courier` ( `cid` int(10) NOT NULL, `cons_no` varchar(20) NOT NULL, `ship_name` varchar(100) NOT NULL, `phone` varchar(12) NOT NULL, `s_add` varchar(200) NOT NULL, `rev_name` varchar(100) NOT NULL, `r_phone` varchar(12) NOT NULL, `r_add` varchar(200) NOT NULL, `type` varchar(40) NOT NULL, `weight` double NOT NULL, `invice_no` varchar(20) NOT NULL, `qty` int(10) NOT NULL, `book_mode` varchar(20) NOT NULL, `freight` double NOT NULL, `mode` varchar(20) NOT NULL, `pick_date` varchar(20) NOT NULL, `pick_time` varchar(10) NOT NULL, `status` varchar(20) NOT NULL, `comments` varchar(250) NOT NULL, `book_date` date NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_courier` -- INSERT INTO `tbl_courier` (`cid`, `cons_no`, `ship_name`, `phone`, `s_add`, `rev_name`, `r_phone`, `r_add`, `type`, `weight`, `invice_no`, `qty`, `book_mode`, `freight`, `mode`, `pick_date`, `pick_time`, `status`, `comments`, `book_date`) VALUES (7, '4401', 'Anukul kc', '987487546', 'Pokhara', 'Asok Malla', '9874354566', 'Kathmandu', 'Sentiments', 2, '221', 1, 'Paid', 1, 'Air', '26/08/2019', '12:00 pm', 'Delivered', 'Receiver can get after 12 ', '2019-08-13'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_courier_officers` -- CREATE TABLE `tbl_courier_officers` ( `cid` int(10) NOT NULL, `officer_name` varchar(40) NOT NULL, `off_pwd` varchar(40) NOT NULL, `address` varchar(250) NOT NULL, `email` varchar(100) NOT NULL, `ph_no` varchar(12) NOT NULL, `office` varchar(100) NOT NULL, `reg_date` datetime NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_courier_officers` -- INSERT INTO `tbl_courier_officers` (`cid`, `officer_name`, `off_pwd`, `address`, `email`, `ph_no`, `office`, `reg_date`) VALUES (5, 'ranjit', 'ranjit', 'Pokhara, Nepal', '<EMAIL>', '9876437455', 'Pokhara Maersk Line', '2019-08-13 09:23:03'), (4, '<NAME>', 'uday123', 'Bara, Nepal', '<EMAIL>', '98764655', 'KTM Maersk Line', '2019-08-13 09:04:46'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_courier_track` -- CREATE TABLE `tbl_courier_track` ( `id` int(10) NOT NULL, `cid` int(10) NOT NULL, `cons_no` varchar(20) NOT NULL, `current_city` varchar(100) NOT NULL, `status` varchar(30) NOT NULL, `comments` varchar(255) NOT NULL, `bk_time` datetime NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_courier_track` -- INSERT INTO `tbl_courier_track` (`id`, `cid`, `cons_no`, `current_city`, `status`, `comments`, `bk_time`) VALUES (6, 7, '4401', 'Kathmandu Maersk Line', 'Landed', 'just landed, it will take more than hours.', '2019-08-13 09:29:29'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_offices` -- CREATE TABLE `tbl_offices` ( `id` int(10) NOT NULL, `off_name` varchar(100) NOT NULL, `address` varchar(230) NOT NULL, `city` varchar(100) NOT NULL, `ph_no` varchar(20) NOT NULL, `office_time` varchar(100) NOT NULL, `contact_person` varchar(100) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_offices` -- INSERT INTO `tbl_offices` (`id`, `off_name`, `address`, `city`, `ph_no`, `office_time`, `contact_person`) VALUES (6, 'Bhaktapur Maersk Line', 'Bhaktapur, Nepal', 'Bhaktapur', '9876465873', '8:00 AM - 7 : 00 PM', 'bhuwan'), (5, 'Pokhara Maersk Line', 'Pokhara, Nepal', 'Pokhara', '988746454', '9:00 AM - 9 : 00 PM', 'Ranjit'), (4, 'Kathmandu Maersk Line', 'Kathmandu, Nepal', 'Kathmandu', '987626473', '8:00 AM - 8 : 00 PM', 'Uday'); -- -- Indexes for dumped tables -- -- -- Indexes for table `tbl_courier` -- ALTER TABLE `tbl_courier` ADD PRIMARY KEY (`cid`); -- -- Indexes for table `tbl_courier_officers` -- ALTER TABLE `tbl_courier_officers` ADD PRIMARY KEY (`cid`); -- -- Indexes for table `tbl_courier_track` -- ALTER TABLE `tbl_courier_track` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_offices` -- ALTER TABLE `tbl_offices` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tbl_courier` -- ALTER TABLE `tbl_courier` MODIFY `cid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `tbl_courier_officers` -- ALTER TABLE `tbl_courier_officers` MODIFY `cid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `tbl_courier_track` -- ALTER TABLE `tbl_courier_track` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `tbl_offices` -- ALTER TABLE `tbl_offices` MODIFY `id` int(10) 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>device42/DOQL_scripts_examples /* AWS Migration factory Template - 06_17_20 */ /* Inline view of Target CTE (inline views) to streamline the process - Feedback - 6/23 1. The server_name column The server name is not unique, there are a few duplicated server names, we cannot import duplicated servers to the migration factory Some server names doesn't seems to be a real hostname for that machine 2. The server_os column Windows or Linux should be lower case: windows, linux 3. The server_fqdn column A lot of servers do not have a server_fqdn column, so I filled these up with sample data New Add - 9/9/20 1. Add CRE info included in the 16.16 release Updated - 4/15/21 - Chnged view_device_v1 to view_device_v2 */ With target_device as ( Select Distinct d.device_pk ,d.type ,d.sub_type ,d.virtual_subtype ,lower(d.name) "Device Name" ,CASE When split_part(d.name,'.',2) is Null THEN Null ELSE substring(lower(d.name) from '\.(.*)$') End "Domain" /* Normalize - Grp the OS's */ ,CASE When position('windows' IN lower(d.os_name)) > 0 or position('microsoft' IN lower(d.os_name)) > 0 Then 'Windows' When position('linux' IN lower(d.os_name)) > 0 or position('centos' IN lower(d.os_name)) > 0 or position('redhat' IN lower(d.os_name)) > 0 or /* Redhat */ position('ubuntu' IN lower(d.os_name)) > 0 or position('suse' IN lower(d.os_name)) > 0 or position('debian' IN lower(d.os_name)) > 0 or position('sles' IN lower(d.os_name)) > 0 Then 'Linux' When position('freebsd' IN lower(d.os_name)) > 0 or position('aix' IN lower(d.os_name)) > 0 or position('hp' IN lower(d.os_name)) > 0 or position('sunos' IN lower(d.os_name)) > 0 or position('solaris' IN lower(d.os_name)) > 0 Then 'Unix' When position('400' IN lower(d.os_name)) > 0 Then 'OS400' When position('z/os' IN lower(d.os_name)) > 0 Then 'z/OS' When (position('ios' IN lower(d.os_name)) > 0 and Not network_device) or position('mac' IN lower(d.os_name)) > 0 Then 'Apple' When position('esx' IN lower(d.os_name)) > 0 or position('vmware' IN lower(d.os_name)) > 0 Then 'ESX' When position('xen' IN lower(d.os_name)) > 0 Then 'XEN' When position('virtbox' IN lower(d.os_name)) > 0 Then 'VM' Else Null End AS "OS Group" ,d.os_name ,d.os_version ,d.service_level "Service_Level" From view_device_v2 d Where Not d.network_device and (lower(d.sub_type) NOT IN ('ups','pdu','crac','tap','scrambler','encoder','access point','ats','multiplexer','network printer') or lower(d.sub_type) IN ('','laptop','workstation','server board','branch circuit power meter') or d.sub_type is NULL) and position('container' IN lower(d.virtual_subtype)) = 0 ), /* Build FQDN with DNSzone via IP */ target_dnsname as ( Select Distinct td.device_pk ,ip.ip_address ,td."Device Name" dname ,dz.name dzname ,concat(lower(td."Device Name"),'.', lower(dz.name))fqdn_dns From view_ipaddress_v1 ip join target_device td on td.device_pk = ip.device_fk join view_subnet_v1 sn on sn.subnet_pk = ip.subnet_fk join view_dnszone_v1 dz on dz.vrfgroup_fk = sn.vrfgroup_fk ), /* Build FQDN with DNSzone via DNSrecord */ target_dnsname_dnsrecord as ( Select Distinct td.device_pk ,td."Device Name" dname ,dz.name dzname ,concat(lower(td."Device Name"),'.', lower(dz.name))fqdn_dns From target_device td join view_dnsrecords_v1 dns on dns.name = td."Device Name" join view_dnszone_v1 dz on dz.dnszone_pk = dns.dnszone_fk ), /* Figure out the FQDN candidates from aliases and device name */ target_device_FQDN as ( Select Distinct ctd.device_pk ,CASE When position('.' IN ctd."Device Name") > 0 THEN ctd."Device Name" ELSE Null End as "dname" ,CASE When position('.' IN da.alias_name) > 0 THEN da.alias_name ELSE Null End as "aa_dname" ,CASE When position('.' IN dna.alias_name) > 0 THEN dna.alias_name ELSE Null End as "na_dname" From target_device ctd Left join view_devicealias_v1 da on da.device_fk = ctd.device_pk Left join view_devicenonauthoritativealias_v1 dna on dna.device_fk = ctd.device_pk ), /* Figure out the Business Apps for each device */ target_business_app as ( Select Distinct td.device_pk ,ba.name From target_device td Left join view_businessapplicationelement_v1 bae on bae.device_fk = td.device_pk Left join view_businessapplication_v1 ba on ba.businessapplication_pk = bae.businessapplication_fk ), /* Get the RU CRE data */ target_cre_data_ru as ( SELECT cre.device_fk ,cre.tenancy ,cre.recommendation_type ,cre.recommended_instance From view_credata_v2 cre Where lower(cre.vendor) IN ('aws') and lower(cre.recommendation_type) = 'ru' ), /* Get the Regular CRE data */ target_cre_data_reg as ( SELECT cre.device_fk ,cre.tenancy ,cre.recommendation_type ,cre.recommended_instance From view_credata_v2 cre Where lower(cre.vendor) IN ('aws') and lower(cre.recommendation_type) = 'regular' ) /* */ /* Pull all the data together */ Select Distinct lower((Select array_to_string(array( Select distinct tba.name From target_business_app tba Where tba.device_pk = td.device_pk), ' | '))) app_name ,td.device_pk ,lower(td."Device Name") server_name ,lower(td."OS Group") server_os ,CASE When td."OS Group" = 'Windows' Then td.os_name Else Concat(td.os_name, ' ', td.os_version) End server_os_version ,coalesce(tdf."dname", tdsnr.fqdn_dns, tdsn.fqdn_dns, tdf."aa_dname", tdf."na_dname") server_fqdn ,lower(td."Service_Level") server_environment ,td.type, td.sub_type ,td.virtual_subtype ,ru.tenancy ru_tenancy ,ru.recommendation_type ru_recommendation_type ,ru.recommended_instance ru_recommended_instance ,reg.tenancy reg_tenancy ,reg.recommendation_type reg_recommendation_type ,reg.recommended_instance reg_recommended_instance ,Case When ru.recommended_instance is Null Then reg.tenancy Else ru.tenancy End tenancy_sl ,Case When ru.recommended_instance is Null Then reg.recommendation_type Else ru.recommendation_type End recommendation_type_sl ,Case When ru.recommended_instance is Null Then reg.recommended_instance Else ru.recommended_instance End recommended_instance_sl From target_device td Left join target_device_FQDN tdf on tdf.device_pk = td.device_pk Left join target_dnsname tdsn on tdsn.device_pk = td.device_pk Left join target_dnsname_dnsrecord tdsnr on tdsnr.device_pk = td.device_pk Left Join target_cre_data_ru ru on ru.device_fk = td.device_pk Left Join target_cre_data_reg reg on reg.device_fk = td.device_pk Where td."OS Group" is NOT Null and td."OS Group" IN ('Windows', 'Linux')
/* Copyright 2019 Google LLC 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 https://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. */ SELECT `caramel-howl-182418.LTV_Classification.Users_Calculated`.User_ID, `caramel-howl-182418.LTV_Classification.Aggregated_GA360`.timeOnScreen, `caramel-howl-182418.LTV_Classification.Aggregated_GA360`.UniqueScreenViews, `caramel-howl-182418.LTV_Classification.Users_Calculated`.Loyalty_Program, `caramel-howl-182418.LTV_Classification.Users_Calculated`.Age, `caramel-howl-182418.LTV_Classification.Users_Calculated`.Country_Code, `caramel-howl-182418.LTV_Classification.ScreenResolutionMode`.screenResolution, `caramel-howl-182418.LTV_Classification.Users_Calculated`.Normalized_Loyalty_Program, `caramel-howl-182418.LTV_Classification.Users_Calculated`.Class FROM `caramel-howl-182418.LTV_Classification.Aggregated_GA360`, `caramel-howl-182418.LTV_Classification.Users_Calculated`, `caramel-howl-182418.LTV_Classification.Accounts`, `caramel-howl-182418.LTV_Classification.ScreenResolutionMode` WHERE `caramel-howl-182418.LTV_Classification.Aggregated_GA360`.User_ID = `caramel-howl-182418.LTV_Classification.Users_Calculated`.User_ID AND `caramel-howl-182418.LTV_Classification.Accounts`.Account_Number = `caramel-howl-182418.LTV_Classification.Users_Calculated`.Account_ID AND `caramel-howl-182418.LTV_Classification.Aggregated_GA360`.User_ID = `caramel-howl-182418.LTV_Classification.ScreenResolutionMode`.User_ID
update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'common.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'entitylink.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'identitylink.schema.version'; alter table ACT_RU_JOB add ELEMENT_ID_ NVARCHAR2(255); alter table ACT_RU_JOB add ELEMENT_NAME_ NVARCHAR2(255); alter table ACT_RU_TIMER_JOB add ELEMENT_ID_ NVARCHAR2(255); alter table ACT_RU_TIMER_JOB add ELEMENT_NAME_ NVARCHAR2(255); alter table ACT_RU_SUSPENDED_JOB add ELEMENT_ID_ NVARCHAR2(255); alter table ACT_RU_SUSPENDED_JOB add ELEMENT_NAME_ NVARCHAR2(255); alter table ACT_RU_DEADLETTER_JOB add ELEMENT_ID_ NVARCHAR2(255); alter table ACT_RU_DEADLETTER_JOB add ELEMENT_NAME_ NVARCHAR2(255); update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'job.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'task.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'variable.schema.version'; alter table ACT_RU_EVENT_SUBSCR add SUB_SCOPE_ID_ NVARCHAR2(64); alter table ACT_RU_EVENT_SUBSCR add SCOPE_ID_ NVARCHAR2(64); alter table ACT_RU_EVENT_SUBSCR add SCOPE_DEFINITION_ID_ NVARCHAR2(64); alter table ACT_RU_EVENT_SUBSCR add SCOPE_TYPE_ NVARCHAR2(64); insert into ACT_GE_PROPERTY values ('eventsubscription.schema.version', '6.5.0.0', 1); update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'eventsubscription.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'schema.version'; update ACT_ID_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'schema.version'; UPDATE ACT_APP_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = to_timestamp('2019-06-02 18:34:28.479', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0; UPDATE ACT_APP_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1; UPDATE ACT_CMMN_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = to_timestamp('2019-06-02 18:34:29.887', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0; UPDATE ACT_CMMN_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1; UPDATE ACT_DMN_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = to_timestamp('2019-06-02 18:34:30.824', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0; UPDATE ACT_DMN_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1; UPDATE ACT_FO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = to_timestamp('2019-06-02 18:34:31.598', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0; UPDATE ACT_FO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1; UPDATE ACT_CO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = to_timestamp('2019-06-02 18:34:32.396', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0; UPDATE ACT_CO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;
-- @testpoint:opengauss关键字freeze(保留),作为模式名 --关键字不带引号-合理报错 drop schema if exists freeze; create schema freeze; --关键字带双引号-成功 drop schema if exists "freeze"; create schema "freeze"; --清理环境 drop schema "freeze"; --关键字带单引号-合理报错 drop schema if exists 'freeze'; create schema 'freeze'; --关键字带反引号-合理报错 drop schema if exists `freeze`; create schema `freeze`;
<gh_stars>0 -- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Mar 09, 2019 at 08:28 PM -- Server version: 10.1.28-MariaDB -- PHP Version: 7.0.30 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: `ecommerce` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `id` int(5) DEFAULT NULL, `username` varchar(25) NOT NULL, `userid` int(20) NOT NULL, `password` varchar(20) NOT NULL, `email` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `username`, `userid`, `password`, `email`) VALUES (NULL, 'jui', 6789, '6789', '<EMAIL>'), (NULL, 'nandita', 12345, '12345', '<EMAIL>'); -- -------------------------------------------------------- -- -- Table structure for table `cart` -- CREATE TABLE `cart` ( `cart_id` int(11) NOT NULL, `productid` int(25) NOT NULL, `productname` varchar(25) NOT NULL, `price` int(15) NOT NULL, `picture` text, `quantity` int(20) NOT NULL, `customerid` int(11) NOT NULL, `total_price` int(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `cart` -- INSERT INTO `cart` (`cart_id`, `productid`, `productname`, `price`, `picture`, `quantity`, `customerid`, `total_price`) VALUES (3, 2, 'N97', 87000, NULL, 2, 6, 174000), (4, 1, 'S9+', 98000, NULL, 1, 6, 98000); -- -------------------------------------------------------- -- -- Table structure for table `catagory` -- CREATE TABLE `catagory` ( `id` int(100) NOT NULL, `cat_name` varchar(500) NOT NULL, `created_at` date NOT NULL, `updated_at` date NOT NULL, `isDelete` varchar(500) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `catagory` -- INSERT INTO `catagory` (`id`, `cat_name`, `created_at`, `updated_at`, `isDelete`) VALUES (1, 'Electronics And Home Appliens', '2018-12-16', '2018-12-16', 'false'), (2, 'Domestic Animals', '2018-12-16', '2018-12-16', 'false'), (3, 'electronics', '2018-12-17', '2018-12-17', 'false'), (4, 'leather', '2018-12-17', '2018-12-17', 'false'); -- -------------------------------------------------------- -- -- Table structure for table `customer` -- CREATE TABLE `customer` ( `id` int(100) NOT NULL, `firstname` varchar(20) NOT NULL, `lastname` varchar(20) NOT NULL, `email` varchar(50) NOT NULL, `mobile` int(14) NOT NULL, `password` varchar(50) NOT NULL, `address` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `customer` -- INSERT INTO `customer` (`id`, `firstname`, `lastname`, `email`, `mobile`, `password`, `address`) VALUES (1, 'shikha', 'mandal', '<EMAIL>', 1681561256, '12345', 'uttara dhaka'), (3, 'nandita', 'mandal', '<EMAIL>', 1681561256, '<PASSWORD>', 'uttara dhaka'), (4, 'abcdef', 'abcdef', '<EMAIL>', 1914211386, '123456', 'dhaka'), (5, 'qwert', 'qwert', '<EMAIL>', 1914211386, '123456', 'bangladesh'), (6, 'yuiop', 'rtyuio', '<EMAIL>', 1500000000, '678905', 'bangladesh'), (7, 'shuvro', 'narayan', '<EMAIL>', 1750148346, 'myid291994', 'numtila'); -- -------------------------------------------------------- -- -- Table structure for table `employes` -- CREATE TABLE `employes` ( `id` int(5) NOT NULL, `firstname` varchar(25) NOT NULL, `lastname` varchar(25) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(20) NOT NULL, `userid` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `employes` -- INSERT INTO `employes` (`id`, `firstname`, `lastname`, `email`, `password`, `userid`) VALUES (3, 'samia', 'afroz', '<EMAIL>', '1234', '456784'), (4, 'abcdef', 'mandal', '<EMAIL>', '1234567', '333333'); -- -------------------------------------------------------- -- -- Table structure for table `manufacturer` -- CREATE TABLE `manufacturer` ( `man_id` int(100) NOT NULL, `man_name` varchar(500) NOT NULL, `created_at` date DEFAULT NULL, `updated_at` date DEFAULT NULL, `isDelete` varchar(100) NOT NULL, `sub_cat_id` int(100) NOT NULL, `made_in` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `manufacturer` -- INSERT INTO `manufacturer` (`man_id`, `man_name`, `created_at`, `updated_at`, `isDelete`, `sub_cat_id`, `made_in`) VALUES (1, 'Samsung', '2018-12-16', '2018-12-16', 'false', 1, 'South Korea'), (2, 'Bengal Meat', '2018-12-16', '2018-12-16', 'false', 2, 'Bangladesh'), (3, 'bata', '2018-12-17', '2018-12-17', 'false', 1, 'Bangladesh'); -- -------------------------------------------------------- -- -- Table structure for table `order` -- CREATE TABLE `order` ( `id` int(11) NOT NULL, `cart_id` int(50) DEFAULT NULL, `productid` int(50) DEFAULT NULL, `productname` varchar(50) DEFAULT NULL, `price` int(50) DEFAULT NULL, `picture` text, `quantity` int(11) DEFAULT NULL, `customerid` int(11) DEFAULT NULL, `total_price` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `order` -- INSERT INTO `order` (`id`, `cart_id`, `productid`, `productname`, `price`, `picture`, `quantity`, `customerid`, `total_price`) VALUES (1, 4, 5, 'paco f1', 100, NULL, 3, NULL, 300), (2, 6, 3, 'Galaxy S9+', 2, NULL, 1, NULL, 2), (3, 3, 5, 'paco f1', 100, NULL, 2, NULL, 200), (4, 3, 2, 'N97', 87000, NULL, 2, 6, 174000), (5, 4, 1, 'S9+', 98000, NULL, 1, 6, 98000), (6, 3, 2, 'N97', 87000, NULL, 2, 6, 174000), (7, 4, 1, 'S9+', 98000, NULL, 1, 6, 98000), (8, 2, 1, 'S9+', 98000, NULL, 2, 1, 196000), (9, 5, 1, 'S9+', 98000, NULL, 3, 1, 294000), (10, 6, 2, 'N97', 87000, NULL, 1, 1, 87000), (11, 6, 2, 'N97', 87000, NULL, 2, 7, 174000), (12, 7, 3, 'paco f1', 100, NULL, 3, 7, 300), (13, 8, 4, 'mk', 200, NULL, 1, 7, 200); -- -------------------------------------------------------- -- -- Table structure for table `product` -- CREATE TABLE `product` ( `pro_id` int(100) NOT NULL, `pro_name` varchar(500) NOT NULL, `cat_id` int(100) NOT NULL, `sub_cat_id` int(100) NOT NULL, `man_id` int(100) DEFAULT NULL, `created_at` date NOT NULL, `updated_at` date NOT NULL, `isDelete` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `product` -- INSERT INTO `product` (`pro_id`, `pro_name`, `cat_id`, `sub_cat_id`, `man_id`, `created_at`, `updated_at`, `isDelete`) VALUES (1, 'S9+', 1, 1, 1, '2018-12-16', '2018-12-16', 'false'), (2, 'paco f1', 1, 1, 1, '2018-12-17', '2018-12-17', 'true'), (3, 'MK', 1, 1, 3, '2018-12-17', '2018-12-17', 'false'); -- -------------------------------------------------------- -- -- Table structure for table `product_details` -- CREATE TABLE `product_details` ( `pro_det_id` int(100) NOT NULL, `p_id` int(100) NOT NULL, `product_name` varchar(500) NOT NULL, `supp_id` int(100) DEFAULT NULL, `price` double DEFAULT NULL, `quantity` int(100) NOT NULL, `picture` varchar(500) DEFAULT NULL, `discount` double DEFAULT NULL, `writing` varchar(500) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `product_details` -- INSERT INTO `product_details` (`pro_det_id`, `p_id`, `product_name`, `supp_id`, `price`, `quantity`, `picture`, `discount`, `writing`) VALUES (1, 1, 'S9+', 1, 98000, 50, 'uploads\\images\\3ezwo2agjftokb10r3jwec7m857z1v.jpg', 0, 'Flagship phone'), (2, 1, 'N97', 1, 87000, 50, 'uploads\\images\\0iy6nomuovobak31dwuthpz0trhkgq.jpg', 5, 'sdgdf bdrfrth bvv'), (3, 2, 'paco f1', 1, 100, 55, 'uploads\\images\\nnedtmxzvl2x3dxczrwzvots0iix7w.png', 5, 'ygu'), (4, 4, 'mk', NULL, NULL, 40, NULL, NULL, 'high '); -- -------------------------------------------------------- -- -- Table structure for table `register` -- CREATE TABLE `register` ( `id` int(100) NOT NULL, `username` varchar(500) NOT NULL, `email` varchar(500) NOT NULL, `password` varchar(500) NOT NULL, `type` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `sub_catagory` -- CREATE TABLE `sub_catagory` ( `sub_cat_id` int(100) NOT NULL, `sub_cat_name` varchar(500) NOT NULL, `cat_id` int(100) NOT NULL, `created_by` varchar(500) DEFAULT NULL, `created_at` date DEFAULT NULL, `updated_at` date DEFAULT NULL, `isDelete` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `sub_catagory` -- INSERT INTO `sub_catagory` (`sub_cat_id`, `sub_cat_name`, `cat_id`, `created_by`, `created_at`, `updated_at`, `isDelete`) VALUES (1, 'Mobile', 1, 'session', '2018-12-16', '2018-12-16', 'false'), (2, 'Cow', 2, '<EMAIL>', '2018-12-16', '2018-12-16', 'false'), (3, 'beg', 4, '<EMAIL>', '2018-12-17', '2018-12-17', 'false'); -- -------------------------------------------------------- -- -- Table structure for table `supplier` -- CREATE TABLE `supplier` ( `supp_id` int(100) NOT NULL, `supp_name` varchar(500) NOT NULL, `created_at` date NOT NULL, `updated_at` date NOT NULL, `isDelete` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `supplier` -- INSERT INTO `supplier` (`supp_id`, `supp_name`, `created_at`, `updated_at`, `isDelete`) VALUES (1, 'Samsung Plaza', '2018-12-16', '2018-12-16', 'false'), (2, 'Agora Shop', '2018-12-16', '2018-12-16', 'false'), (3, 'bata shop', '2018-12-17', '2018-12-17', 'false'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`userid`); -- -- Indexes for table `cart` -- ALTER TABLE `cart` ADD PRIMARY KEY (`cart_id`); -- -- Indexes for table `catagory` -- ALTER TABLE `catagory` ADD PRIMARY KEY (`id`); -- -- Indexes for table `customer` -- ALTER TABLE `customer` ADD PRIMARY KEY (`id`); -- -- Indexes for table `employes` -- ALTER TABLE `employes` ADD PRIMARY KEY (`id`); -- -- Indexes for table `manufacturer` -- ALTER TABLE `manufacturer` ADD PRIMARY KEY (`man_id`); -- -- Indexes for table `order` -- ALTER TABLE `order` ADD PRIMARY KEY (`id`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`pro_id`); -- -- Indexes for table `product_details` -- ALTER TABLE `product_details` ADD PRIMARY KEY (`pro_det_id`); -- -- Indexes for table `register` -- ALTER TABLE `register` ADD PRIMARY KEY (`id`); -- -- Indexes for table `sub_catagory` -- ALTER TABLE `sub_catagory` ADD PRIMARY KEY (`sub_cat_id`); -- -- Indexes for table `supplier` -- ALTER TABLE `supplier` ADD PRIMARY KEY (`supp_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin` -- ALTER TABLE `admin` MODIFY `userid` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12346; -- -- AUTO_INCREMENT for table `cart` -- ALTER TABLE `cart` MODIFY `cart_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `catagory` -- ALTER TABLE `catagory` MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `customer` -- ALTER TABLE `customer` MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `employes` -- ALTER TABLE `employes` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `manufacturer` -- ALTER TABLE `manufacturer` MODIFY `man_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `order` -- ALTER TABLE `order` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `product` -- ALTER TABLE `product` MODIFY `pro_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `product_details` -- ALTER TABLE `product_details` MODIFY `pro_det_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `register` -- ALTER TABLE `register` MODIFY `id` int(100) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `sub_catagory` -- ALTER TABLE `sub_catagory` MODIFY `sub_cat_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `supplier` -- ALTER TABLE `supplier` MODIFY `supp_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 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 */;
-- Список всех боевых машин, количесвто которых на складе больше 20 (по убыванию количества) SELECT Name, Quantity_In_Stock FROM O1_Car WHERE Quantity_In_Stock > 20 ORDER BY Quantity_In_Stock DESC -- Все покупатели с непустым адресом SELECT Name FROM O1_Customer WHERE Encrypted_Address IS NOT NULL AND Encrypted_Address != '' -- Все покупатели у которых в имени есть 'John' SELECT * FROM O1_Customer WHERE Name LIKE 'John%'; -- Продавцы, у которых есть сделка со стоимостью боевой машины от 50000 до 150000 $ SELECT DISTINCT O1_Seller_ID FROM O1_Deal WHERE O1_Car_Price BETWEEN 50000 AND 150000 ORDER BY O1_Seller_ID -- Количество всех типов танков на складе (поименно) SELECT Name, Quantity_In_Stock FROM O1_Car WHERE Type IN ('Light Tank', 'Main Battle Tank'); -- Количество всех сделок SELECT COUNT (O1_Deal_ID) FROM O1_Deal
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Oct 13, 2020 at 12:55 PM -- Server version: 10.1.40-MariaDB -- PHP Version: 7.3.5 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `db_kepegawaian` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `id_admin` int(2) NOT NULL, `username` varchar(20) NOT NULL, `password` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id_admin`, `username`, `password`) VALUES (1, 'admin', '<PASSWORD>'); -- -------------------------------------------------------- -- -- Table structure for table `kompetensi_bidang` -- CREATE TABLE `kompetensi_bidang` ( `id_kompetensi` int(5) NOT NULL, `id_pegawai` int(5) NOT NULL, `kompetensi` varchar(50) NOT NULL, `keterangan` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `kompetensi_bidang` -- INSERT INTO `kompetensi_bidang` (`id_kompetensi`, `id_pegawai`, `kompetensi`, `keterangan`) VALUES (23, 1, 'Sertifikat MOT', ''), (24, 1, 'Sertifikat TOC', ''), (25, 4, 'Kompetensi IT', ''); -- -------------------------------------------------------- -- -- Table structure for table `pns_local` -- CREATE TABLE `pns_local` ( `id_pegawai` int(5) NOT NULL, `status` enum('p','n') NOT NULL, `nip` varchar(18) DEFAULT NULL, `nama` varchar(50) NOT NULL, `jk` varchar(50) NOT NULL, `agama` varchar(50) NOT NULL, `tempat_lahir` varchar(50) NOT NULL, `tanggal_lahir` date DEFAULT NULL, `alamat` text NOT NULL, `pend_terakhir` varchar(50) NOT NULL, `jurusan` varchar(40) NOT NULL, `no_telp` varchar(15) NOT NULL, `email` varchar(80) NOT NULL, `pangkat` varchar(50) DEFAULT NULL, `jabatan` varchar(45) NOT NULL, `unit_kerja_pegawai` int(3) DEFAULT NULL, `sub_pegawai` int(3) DEFAULT NULL, `jenis_jabatan` varchar(255) NOT NULL, `tanggal_mulai_kerja` date NOT NULL, `pensiun` int(3) NOT NULL, `status_kerja` int(1) NOT NULL DEFAULT '1', `keterangan_status_kerja` varchar(250) NOT NULL, `tanggal_selesai_kerja` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `pns_local` -- INSERT INTO `pns_local` (`id_pegawai`, `status`, `nip`, `nama`, `jk`, `agama`, `tempat_lahir`, `tanggal_lahir`, `alamat`, `pend_terakhir`, `jurusan`, `no_telp`, `email`, `pangkat`, `jabatan`, `unit_kerja_pegawai`, `sub_pegawai`, `jenis_jabatan`, `tanggal_mulai_kerja`, `pensiun`, `status_kerja`, `keterangan_status_kerja`, `tanggal_selesai_kerja`) VALUES (1, 'p', '196212242005011017', '<NAME>,SE', 'Laki-laki', 'Islam', 'JAKARTA', '1976-02-24', 'JL. PEMUDA KOTA SEMARANG', 'S1', 'EKONOMI', '0812290829', '<EMAIL>', 'Penata Muda (III/A)', 'umum', 3, 3, 'Administrasi', '0000-00-00', 58, 1, '', '0000-00-00'), (2, 'p', '197105262009091034', 'Sukiman', 'Laki-laki', 'Kristen', 'SEMARANG', '1961-05-06', 'BANYUBIRU KAB. SEMARANG', 'SMA/K', '', '', '', 'Pengatur Tingkat I (II/D)', 'umum', 4, 4, 'Kepala Sub Bidang I A', '0000-00-00', 58, 1, '', '0000-00-00'), (3, 'p', '196612032010041044', 'Mirna,S.H', 'Perempuan', 'Kristen', 'PALEMBANG', '1961-04-03', 'SLEMAN YOGYAKARTA', 'S1', 'HUKUM', '08783102227', '<EMAIL>', 'Pengatur Tingkat I (II/D)', 'umum', 3, 1, 'Pengadministrasi umum', '0000-00-00', 58, 1, '', '0000-00-00'), (4, 'n', '', 'Kamiran,S.H', 'Laki-laki', 'Islam', 'PURWOREJO ', '1961-04-12', 'JL. PEMUDA KOTA SEMARANG', 'S1', ' HUKUM', '08179526597', '', '', 'non', 3, 3, 'Administrasi', '0000-00-00', 0, 1, '', '0000-00-00'), (5, 'p', '198505191999031094', '<NAME>', 'Perempuan', 'Islam', 'KLATEN', '1965-05-15', 'BANYUMANIK SEMARANG', 'S1', 'HUKUM', '081392629709', '', 'Penata Tingkat I (III/D)', 'umum', 4, 5, 'Pengelola Data', '0000-00-00', 58, 0, 'Pensiun', '0000-00-00'), (6, 'p', '196011191999031079', 'Heru,S.H', 'Laki-laki', 'Islam', 'TEGAL', '1965-12-29', '<NAME> ', 'S1', 'H<NAME>', '08586537710', '', 'Penata Tingkat I (III/D)', 'umum', 4, 5, 'Pengelola Data', '0000-00-00', 58, 0, 'Mutasi ke Pemkot', '0000-00-00'), (7, 'n', '', 'T<NAME>,SE.', 'Laki-laki', 'Islam', 'BLORA', '1985-07-10', 'SAMBONG KAB BLORA', 'S1', 'Ekonomi Pembangunan', '08139034008', '<EMAIL>', '', 'non', 3, 1, 'Administrasi', '2015-01-02', 0, 0, 'Lainnya', '0000-00-00'), (8, 'n', '', 'Rahima', 'Perempuan', 'Islam', 'PATI', '1987-07-31', 'SLEMAN YOGYAKARTA', 'SMA/K', 'IPS', '', '', '', 'non', 3, 3, 'Front Office', '2019-01-02', 0, 1, '', '0000-00-00'); -- -------------------------------------------------------- -- -- Table structure for table `riwayat_unit_kerja` -- CREATE TABLE `riwayat_unit_kerja` ( `id_riwayat_unit_kerja` int(11) NOT NULL, `id_pegawai` int(5) NOT NULL, `unit_kerja` varchar(100) NOT NULL, `sub_unit_kerja` varchar(100) NOT NULL, `tanggal_mulai` date NOT NULL, `tanggal_selesai` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `riwayat_unit_kerja` -- INSERT INTO `riwayat_unit_kerja` (`id_riwayat_unit_kerja`, `id_pegawai`, `unit_kerja`, `sub_unit_kerja`, `tanggal_mulai`, `tanggal_selesai`) VALUES (1, 6, 'Sekretariat WI', 'Administrasi', '2019-05-28', '2019-06-20'); -- -------------------------------------------------------- -- -- Table structure for table `sub_unit_kerja` -- CREATE TABLE `sub_unit_kerja` ( `id_sub_unit` int(3) NOT NULL, `id_unit` int(3) NOT NULL, `keterangan` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `sub_unit_kerja` -- INSERT INTO `sub_unit_kerja` (`id_sub_unit`, `id_unit`, `keterangan`) VALUES (1, 3, 'Sub Program'), (3, 3, 'Sub Kepegawaian'), (4, 4, 'Sub Bidang I A'), (5, 4, 'Sub Bidang I B'), (6, 4, 'Sub Bidang I C'), (7, 5, 'Sub Bidang II A'), (8, 5, 'Sub Bidang II B'); -- -------------------------------------------------------- -- -- Table structure for table `unit_kerja` -- CREATE TABLE `unit_kerja` ( `id_unit` int(3) NOT NULL, `nama_unit` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `unit_kerja` -- INSERT INTO `unit_kerja` (`id_unit`, `nama_unit`) VALUES (3, 'Sekretariat'), (4, 'Bidang I '), (5, 'Bidang II'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`id_admin`); -- -- Indexes for table `kompetensi_bidang` -- ALTER TABLE `kompetensi_bidang` ADD PRIMARY KEY (`id_kompetensi`); -- -- Indexes for table `pns_local` -- ALTER TABLE `pns_local` ADD PRIMARY KEY (`id_pegawai`); -- -- Indexes for table `riwayat_unit_kerja` -- ALTER TABLE `riwayat_unit_kerja` ADD PRIMARY KEY (`id_riwayat_unit_kerja`); -- -- Indexes for table `sub_unit_kerja` -- ALTER TABLE `sub_unit_kerja` ADD PRIMARY KEY (`id_sub_unit`); -- -- Indexes for table `unit_kerja` -- ALTER TABLE `unit_kerja` ADD PRIMARY KEY (`id_unit`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin` -- ALTER TABLE `admin` MODIFY `id_admin` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `kompetensi_bidang` -- ALTER TABLE `kompetensi_bidang` MODIFY `id_kompetensi` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26; -- -- AUTO_INCREMENT for table `pns_local` -- ALTER TABLE `pns_local` MODIFY `id_pegawai` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=388; -- -- AUTO_INCREMENT for table `riwayat_unit_kerja` -- ALTER TABLE `riwayat_unit_kerja` MODIFY `id_riwayat_unit_kerja` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `sub_unit_kerja` -- ALTER TABLE `sub_unit_kerja` MODIFY `id_sub_unit` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- AUTO_INCREMENT for table `unit_kerja` -- ALTER TABLE `unit_kerja` MODIFY `id_unit` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; 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>simonchelbc/Occurrences SELECT 'CASED FORMS' AS section; SELECT * FROM words WHERE lemma='neolithic'; SELECT * FROM words INNER JOIN casedwords USING (wordid) WHERE lemma='neolithic'; SELECT * FROM words INNER JOIN casedwords USING (wordid) WHERE lemma='shakespeare'; SELECT * FROM words INNER JOIN casedwords USING (wordid) WHERE cased='shaKEspeare'; SELECT * FROM words INNER JOIN casedwords USING (wordid) WHERE cased='Shakespeare'; SELECT * FROM words INNER JOIN casedwords USING (wordid) WHERE lemma='am'; SELECT * FROM words LEFT JOIN casedwords USING (wordid) WHERE lemma='abolition'; SELECT cased,definition FROM senses INNER JOIN casedwords USING (wordid,casedwordid) INNER JOIN synsets USING (synsetid) WHERE cased='Jackson'; SELECT cased,definition FROM senses INNER JOIN casedwords USING (wordid,casedwordid) INNER JOIN synsets USING (synsetid) WHERE cased='C'; SELECT lemma,cased,SUBSTRING(definition FROM 1 FOR 64) FROM senses INNER JOIN words USING (wordid) LEFT JOIN casedwords USING (wordid,casedwordid) INNER JOIN synsets USING (synsetid) WHERE lemma='C'; SELECT 'lemma having several cased forms' AS comment; SELECT wordid,COUNT(casedwordid) AS N,GROUP_CONCAT(cased) FROM casedwords GROUP BY wordid HAVING N > 1 ORDER BY N DESC; SELECT 'senses having a cased form' AS comment; SELECT COUNT(*) FROM senses WHERE NOT ISNULL(casedwordid); SELECT 'words having a cased form' AS comment; SELECT COUNT(*) FROM words INNER JOIN casedwords USING (wordid);
<filename>oracleDB12cSQL/instructorAssets/chapter-10-part-3.sql --------part one cross join----------------- --1 cartesian product in 1999 format SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, DEPARTMENTS.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES cross join DEPARTMENTS ORDER BY EMPLOYEE_ID; --2 cartesian product in old format ( 1 and 2 are same ) SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, DEPARTMENTS.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES, DEPARTMENTS ORDER BY EMPLOYEE_ID; ------------------------------------------------------------------- ------- part two natural join --------------------- --3 natural join between DEPARTMENTS and LOCATIONS SELECT DEPARTMENTS.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME, LOCATION_ID, --note you can not prefix table name in the match column LOCATIONS.city FROM DEPARTMENTS NATURAL JOIN LOCATIONS --4 you can make natural join using old format as equijoun ( 3 and 4 same) SELECT DEPARTMENTS.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME, DEPARTMENTS.LOCATION_ID, --here you should put the prefix LOCATIONS.city FROM DEPARTMENTS, LOCATIONS WHERE DEPARTMENTS.LOCATION_ID=LOCATIONS.LOCATION_ID; --IF YOU TRY TO MAKE NATURAL JOIN BETWEEN EMPLOYEES AND DEPARTMENTS, THIS IS WRONG --because it will join 2 columns DEPARTMENT_ID and MANAGER_ID --5 use where in additional condition in NATURAL JOIN, then and if required SELECT DEPARTMENTS.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME, LOCATION_ID, --note you can not prefix table name in the match column LOCATIONS.city FROM DEPARTMENTS NATURAL JOIN LOCATIONS where DEPARTMENTS.DEPARTMENT_ID>20 --use where then and ------------------------------------------------------------------------------------ ---------- part three retriving records with USING-------------------- --6 SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, DEPARTMENT_ID, --note you can not prefix table name in the match column DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES join DEPARTMENTS USING(DEPARTMENT_ID) -- only one column can be used ORDER BY EMPLOYEE_ID; --7 you can do query 6 with equijoin as follow SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES, DEPARTMENTS WHERE EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID ORDER BY EMPLOYEE_ID; ---------------------------------------------------- -- Part four creaing join with the ON clause, this is better than natural join and using---- --8 on SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, DEPARTMENTS.DEPARTMENT_ID, ---here prefix should be use DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES join DEPARTMENTS ON (EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID) -----where EMPLOYEE_ID=100 ORDER BY EMPLOYEE_ID; --9 you can wirte query 8 as follow SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES, DEPARTMENTS WHERE EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID ORDER BY EMPLOYEE_ID; --also we can use on for nonequijoin SELECT EMP.EMPLOYEE_ID, EMP.FIRST_NAME, EMP.SALARY, grades.grade_level FROM EMPLOYEES EMP join JOB_GRADES GRADES ON EMP.SALARY BETWEEN GRADES.LOWEST_SAL AND GRADES.HIGHEST_SAL SELECT EMP.EMPLOYEE_ID, EMP.FIRST_NAME, EMP.SALARY, grades.grade_level FROM EMPLOYEES EMP , JOB_GRADES GRADES where EMP.salary between GRADES.lowest_sal and grades.highest_sal --also you can make self join by ( ON ) SELECT worker.EMPLOYEE_ID, WORKER.FIRST_NAME, WORKER.MANAGER_ID, manager.first_name FROM EMPLOYEES WORKER join EMPLOYEES MANAGER on( WORKER.MANAGER_ID=MANAGER.EMPLOYEE_ID); SELECT worker.EMPLOYEE_ID, WORKER.FIRST_NAME, WORKER.MANAGER_ID, manager.first_name FROM EMPLOYEES WORKER, EMPLOYEES MANAGER WHERE WORKER.MANAGER_ID=MANAGER.EMPLOYEE_ID; --10 join 3 tables SELECT EMP.EMPLOYEE_ID , EMP.FIRST_NAME, emp.DEPARTMENT_ID, DEPT.DEPARTMENT_NAME, DEPT.location_id, loc.city FROM EMPLOYEES EMP join DEPARTMENTS DEPT on (EMP.DEPARTMENT_ID=DEPT.DEPARTMENT_ID ) JOIN LOCATIONS LOC on ( DEPT.LOCATION_ID=LOC.LOCATION_ID) ORDER BY EMPLOYEE_ID; --11 you can do query 10 as follow SELECT EMP.EMPLOYEE_ID , EMP.FIRST_NAME, emp.DEPARTMENT_ID, DEPT.DEPARTMENT_NAME, DEPT.location_id, loc.city FROM EMPLOYEES EMP , DEPARTMENTS DEPT, locations loc WHERE EMP.DEPARTMENT_ID=DEPT.DEPARTMENT_ID AND DEPT.LOCATION_ID=LOC.LOCATION_ID ORDER BY EMPLOYEE_ID; ---------------------------------------------------------------------------------------------------- ----------part five left outer join ------------ --12 left outer join SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES left OUTER JOIN DEPARTMENTS on( EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID) ORDER BY EMPLOYEE_ID; --13 you can write query 12 as follow SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES, DEPARTMENTS WHERE EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID(+) ORDER BY EMPLOYEE_ID; -------------------------------- ---------part six right outer join----------------------- --14 right outer join SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES right OUTER JOIN DEPARTMENTS ON( EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID) ORDER BY EMPLOYEE_ID; --15 you can write query 14 as follow SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES, DEPARTMENTS WHERE EMPLOYEES.DEPARTMENT_ID(+)=DEPARTMENTS.DEPARTMENT_ID ORDER BY EMPLOYEE_ID; ---------------------------------------------------- ----------part seven full outer join --------------------------- -- 16 full outer join SELECT EMPLOYEES.EMPLOYEE_ID , EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME FROM EMPLOYEES FULL OUTER JOIN DEPARTMENTS ON( EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID) ORDER BY EMPLOYEE_ID;
<reponame>mustafaDev09/laravel-Artist -- Adminer 4.6.3 MySQL dump SET NAMES utf8; SET time_zone = '+00:00'; SET foreign_key_checks = 0; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; SET NAMES utf8mb4; DROP TABLE IF EXISTS `agent_purchase_yantras`; CREATE TABLE `agent_purchase_yantras` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `agent_id` int(10) unsigned DEFAULT NULL, `client_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `program_type` enum('program','jodi_program','triple_program') COLLATE utf8mb4_unicode_ci DEFAULT NULL, `betting_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `today_date` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `draw_time` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `diff_draw_time` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `total_amount` bigint(20) DEFAULT NULL, `multiply_amount` bigint(20) DEFAULT NULL, `opening_bal` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `closeing_bal` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `is_print` tinyint(1) NOT NULL DEFAULT '0', `reprint_draw_time` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `is_client_ticket_scan` tinyint(1) NOT NULL DEFAULT '0', `client_win_taken_coin` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `taken_opening_bal` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `taken_closeing_bal` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `yantra_array` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `jackpot` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `agent_purchase_yantras_agent_id_foreign` (`agent_id`), CONSTRAINT `agent_purchase_yantras_agent_id_foreign` FOREIGN KEY (`agent_id`) REFERENCES `agent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; INSERT INTO `agent_purchase_yantras` (`id`, `agent_id`, `client_id`, `program_type`, `betting_type`, `today_date`, `draw_time`, `diff_draw_time`, `total_amount`, `multiply_amount`, `opening_bal`, `closeing_bal`, `is_print`, `reprint_draw_time`, `is_client_ticket_scan`, `client_win_taken_coin`, `taken_opening_bal`, `taken_closeing_bal`, `yantra_array`, `jackpot`, `created_at`, `updated_at`, `deleted_at`) VALUES (477, 16, '50', 'jodi_program', 'single', '2021-11-27', '01:15-01:45PM', '01:30-01:45PM', 10, 110, '3816.6', '3706.6', 1, '01:15-01:30PM', 1, '7', '3684.6', '4384.6', '{\"yantra\":\"{\\\"20\\\":1,\\\"21\\\":1,\\\"22\\\":1,\\\"23\\\":1,\\\"24\\\":1,\\\"25\\\":1,\\\"26\\\":1,\\\"27\\\":1,\\\"28\\\":1,\\\"29\\\":1}\",\"ip\":\"172.16.58.3\"}', NULL, '2021-11-27 07:48:11', '2021-11-27 08:26:41', NULL), (478, 16, '50', 'jodi_program', 'single', '2021-11-27', '01:15-01:45PM', '01:30-01:45PM', 1, 11, '3706.6', '3695.6', 1, '01:15-01:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"30\\\":1}\",\"ip\":\"172.16.58.3\"}', NULL, '2021-11-27 07:50:00', '2021-11-27 07:50:00', NULL), (479, 16, '50', 'triple_program', 'single', '2021-11-27', '01:15-02:00PM', '01:45-02:00PM', 1, 11, '3695.6', '3684.6', 1, '01:15-01:30PM', 1, '14', '4384.6', '5784.6', '{\"yantra\":\"{\\\"120\\\":1}\",\"ip\":\"172.16.58.3\"}', NULL, '2021-11-27 07:58:51', '2021-11-27 08:37:40', NULL), (480, 12, '29', 'program', 'single', '2021-11-27', '05:00-05:15PM', '05:00-05:15PM', 10, 110, '61901', '61791', 1, '05:00-05:15PM', 1, '1', '61692', '61892', '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":1,\\\"Vastu\\\":1,\\\"Planet\\\":1,\\\"Love\\\":1,\\\"Tara\\\":1,\\\"Grah\\\":1,\\\"Matsya\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-27 11:40:17', '2021-11-27 11:48:01', NULL), (481, 12, '29', 'program', 'single', '2021-11-27', '05:00-05:15PM', '05:00-05:15PM', 9, 99, '61791', '61692', 1, '05:00-05:15PM', 1, '1', '61692', '61892', '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Sudarshan\\\":1,\\\"Vastu\\\":1,\\\"Planet\\\":1,\\\"Love\\\":1,\\\"Tara\\\":1,\\\"Grah\\\":1,\\\"Matsya\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-27 11:40:32', '2021-11-27 11:48:01', NULL), (482, 12, '29', 'program', 'single', '2021-11-27', '05:15-05:30PM', '05:15-05:30PM', 9, 99, '61892', '61793', 1, '05:15-05:30PM', 1, '1', '61833', '62033', '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Vastu\\\":1,\\\"Planet\\\":1,\\\"Love\\\":1,\\\"Tara\\\":1,\\\"Grah\\\":1,\\\"Matsya\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-27 11:53:09', '2021-11-27 12:02:00', NULL), (483, 12, '29', 'program', 'single', '2021-11-27', '05:15-05:30PM', '05:15-05:30PM', 10, 110, '61793', '61683', 1, '05:15-05:30PM', 1, '1', '61833', '62033', '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":1,\\\"Vastu\\\":1,\\\"Planet\\\":1,\\\"Love\\\":1,\\\"Tara\\\":1,\\\"Grah\\\":1,\\\"Matsya\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-27 11:53:20', '2021-11-27 12:02:00', NULL), (484, 16, '50', 'jodi_program', 'single', '2021-11-27', '06:45-07:15PM', '07:00-07:15PM', 1, 11, '3794.4', '3772.4', 1, '06:45-07:00PM', 1, '7', '3772.4', '5872.4', '{\"yantra\":\"{\\\"60\\\":1}\",\"ip\":\"172.16.58.3\"}', NULL, '2021-11-27 13:19:47', '2021-11-27 14:08:57', NULL), (485, 16, '50', 'triple_program', 'single', '2021-11-27', '06:45-07:30PM', '07:15-07:30PM', 1, 11, '3794.4', '3772.4', 1, '06:45-07:00PM', 1, '14', '3772.4', '5872.4', '{\"yantra\":\"{\\\"160\\\":1}\",\"ip\":\"172.16.58.3\"}', NULL, '2021-11-27 13:19:47', '2021-11-27 14:08:57', NULL), (486, 12, '29', 'triple_program', 'single', '2021-11-29', '03:30-04:15PM', '04:00-04:15PM', 65, 715, '62033', '61318', 1, '03:30-03:45PM', 1, '34', '61318', '64718', '{\"yantra\":\"{\\\"116\\\":1,\\\"126\\\":2,\\\"136\\\":1,\\\"146\\\":1,\\\"156\\\":1,\\\"160\\\":1,\\\"166\\\":1,\\\"167\\\":1,\\\"168\\\":1,\\\"169\\\":1,\\\"226\\\":2,\\\"236\\\":2,\\\"246\\\":2,\\\"256\\\":2,\\\"260\\\":2,\\\"266\\\":2,\\\"267\\\":2,\\\"268\\\":2,\\\"269\\\":2,\\\"336\\\":1,\\\"346\\\":1,\\\"356\\\":1,\\\"360\\\":1,\\\"366\\\":1,\\\"3', NULL, '2021-11-29 10:10:03', '2021-11-29 10:46:57', NULL), (487, 12, '29', 'triple_program', 'single', '2021-11-29', '04:15-05:00PM', '04:45-05:00PM', 13, 143, '64718', '64575', 1, '04:15-04:30PM', 1, '360', '64575', '100575', '{\"yantra\":\"{\\\"100\\\":1,\\\"119\\\":1,\\\"155\\\":1,\\\"227\\\":1,\\\"335\\\":1,\\\"344\\\":1,\\\"399\\\":1,\\\"588\\\":1,\\\"669\\\":1,\\\"777\\\":4}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-29 10:53:35', '2021-11-29 11:35:03', NULL), (488, 12, '29', 'triple_program', 'single', '2021-11-29', '05:15-06:00PM', '05:45-06:00PM', 21, 231, '100575', '100344', 1, '05:15-05:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"117\\\":2,\\\"144\\\":2,\\\"199\\\":2,\\\"225\\\":2,\\\"333\\\":3,\\\"388\\\":2,\\\"559\\\":2,\\\"577\\\":2,\\\"667\\\":2,\\\"900\\\":2}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-29 11:45:39', '2021-11-29 11:45:39', NULL), (489, 12, '29', 'triple_program', 'single', '2021-11-29', '06:00-06:45PM', '06:30-06:45PM', 252, 2772, '100314', '97542', 1, '06:00-06:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"120\\\":3,\\\"123\\\":3,\\\"125\\\":3,\\\"126\\\":3,\\\"127\\\":3,\\\"128\\\":3,\\\"129\\\":3,\\\"130\\\":3,\\\"135\\\":3,\\\"136\\\":3,\\\"137\\\":3,\\\"138\\\":3,\\\"139\\\":3,\\\"150\\\":3,\\\"156\\\":3,\\\"157\\\":3,\\\"158\\\":3,\\\"159\\\":3,\\\"160\\\":3,\\\"167\\\":3,\\\"168\\\":3,\\\"169\\\":3,\\\"170\\\":3,\\\"178\\\":3,\\\"1', NULL, '2021-11-29 12:37:36', '2021-11-29 12:37:36', NULL), (490, 12, '29', 'triple_program', 'single', '2021-11-29', '06:00-06:45PM', '06:30-06:45PM', 1, 11, '97542', '97531', 1, '06:00-06:15PM', 1, '50', '97531', '102531', '{\"yantra\":\"{\\\"444\\\":1}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-29 12:39:16', '2021-11-29 13:16:14', NULL), (491, 12, '29', 'program', 'single', '2021-11-29', '06:45-07:00PM', '06:45-07:00PM', 2, 22, '102531', '102509', 1, '06:45-07:00PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Tara\\\":1,\\\"Matsya\\\":1}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-29 13:24:06', '2021-11-29 13:24:06', NULL), (492, 12, '29', 'jodi_program', 'single', '2021-11-29', '06:45-07:15PM', '07:00-07:15PM', 2, 22, '102509', '102487', 1, '06:45-07:00PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"78\\\":1,\\\"79\\\":1}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-29 13:24:25', '2021-11-29 13:24:25', NULL), (493, 12, '29', 'triple_program', 'single', '2021-11-29', '06:45-07:30PM', '07:15-07:30PM', 1, 11, '102487', '102476', 1, '06:45-07:00PM', 1, '10', '102476', '103476', '{\"yantra\":\"{\\\"378\\\":1}\",\"ip\":\"192.168.127.12\"}', NULL, '2021-11-29 13:26:40', '2021-11-29 14:01:03', NULL), (494, 16, '50', 'jodi_program', 'single', '2021-11-29', '08:00-08:30PM', '08:15-08:30PM', 1, 11, '14841.3', '14830.3', 1, '08:00-08:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"10\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-29 14:40:05', '2021-11-29 14:40:05', NULL), (495, 4, '18', 'program', 'single', '2021-11-29', '08:00-08:15PM', '08:00-08:15PM', 1, 11, '9983.00', '9972', 1, '08:00-08:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Vashikaran\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-29 14:42:41', '2021-11-29 14:42:41', NULL), (496, 4, '18', 'jodi_program', 'single', '2021-11-29', '08:00-08:30PM', '08:15-08:30PM', 1, 11, '9972', '9961', 1, '08:00-08:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"29\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-29 14:43:16', '2021-11-29 14:43:16', NULL), (497, 16, '50', 'jodi_program', 'single', '2021-11-29', '08:00-08:30PM', '08:15-08:30PM', 1, 11, '14830.3', '14819.3', 1, '08:00-08:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"30\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-29 14:44:45', '2021-11-29 14:44:45', NULL), (498, 42, NULL, 'program', 'multiple', '2021-11-30', '11:00-11:15AM', NULL, 10, 110, NULL, NULL, 1, '11:00-11:15AM', 0, NULL, NULL, NULL, '{\"browser\":\"Firefox\",\"platform\":\"Windows\",\"is_mob\":false,\"ip\":\"172.16.58.3\"}', NULL, '2021-11-30 05:43:41', '2021-11-30 05:43:41', NULL), (499, 33, '65', 'jodi_program', 'single', '2021-11-30', '12:30-01:00PM', '12:45-01:00PM', 1, 11, '1463', '1452', 1, '12:30-12:45PM', 1, '9', '1441', '2441', '{\"yantra\":\"{\\\"10\\\":1}\",\"ip\":\"172.16.31.10\"}', NULL, '2021-11-30 07:13:06', '2021-11-30 07:30:24', NULL), (500, 33, '65', 'program', 'single', '2021-11-30', '12:45-01:00PM', '12:45-01:00PM', 1, 11, '1452', '1441', 1, '12:45-01:00PM', 1, '1', '1441', '2441', '{\"yantra\":\"{\\\"Meditation\\\":1}\",\"ip\":\"43.241.145.82\"}', NULL, '2021-11-30 07:25:22', '2021-11-30 07:30:24', NULL), (501, 42, '82', 'program', 'single', '2021-11-30', '01:00-01:15PM', '01:00-01:15PM', 1, 11, '500.00', '489', 1, '01:00-01:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Vashikaran\\\":1}\",\"ip\":\"172.16.31.10\"}', NULL, '2021-11-30 07:41:31', '2021-11-30 07:41:31', NULL), (502, 42, '82', 'jodi_program', 'single', '2021-11-30', '01:15-01:45PM', '01:30-01:45PM', 1, 11, '489', '478', 1, '01:15-01:30PM', 1, '36', '467', '4267', '{\"yantra\":\"{\\\"88\\\":1}\",\"ip\":\"172.16.31.10\"}', NULL, '2021-11-30 07:55:42', '2021-11-30 08:15:51', NULL), (503, 42, '82', 'program', 'single', '2021-11-30', '01:30-01:45PM', '01:30-01:45PM', 1, 11, '478', '467', 1, '01:30-01:45PM', 1, '2', '467', '4267', '{\"yantra\":\"{\\\"Grah\\\":1}\",\"ip\":\"172.16.31.10\"}', NULL, '2021-11-30 08:01:47', '2021-11-30 08:15:51', NULL), (504, 42, '82', 'jodi_program', 'single', '2021-11-30', '01:45-02:15PM', '02:00-02:15PM', 2, 22, '4267', '4245', 1, '01:45-02:00PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"40\\\":2}\",\"ip\":\"172.16.31.10\"}', NULL, '2021-11-30 08:28:44', '2021-11-30 08:28:44', NULL), (505, 42, '82', 'triple_program', 'single', '2021-11-30', '03:00-03:45PM', '03:30-03:45PM', 1, 11, '4245', '4234', 1, '03:00-03:15PM', 1, '17', '4212', '5912', '{\"yantra\":\"{\\\"128\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-30 09:44:01', '2021-11-30 10:16:47', NULL), (506, 42, '82', 'triple_program', 'single', '2021-11-30', '03:15-04:00PM', '03:45-04:00PM', 1, 11, '4234', '4223', 1, '03:15-03:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"155\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-30 09:51:12', '2021-11-30 09:51:12', NULL), (507, 42, '82', 'triple_program', 'single', '2021-11-30', '03:15-04:00PM', '03:45-04:00PM', 1, 11, '4223', '4212', 1, '03:15-03:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"777\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-30 09:52:34', '2021-11-30 09:52:34', NULL), (508, 12, '29', 'jodi_program', 'single', '2021-11-30', '03:30-04:00PM', '03:45-04:00PM', 2, 22, '103476', '103454', 1, '03:30-03:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"21\\\":1,\\\"22\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-11-30 10:02:57', '2021-11-30 10:02:57', NULL), (509, 12, '29', 'triple_program', 'single', '2021-11-30', '03:30-04:15PM', '04:00-04:15PM', 1, 11, '103454', '103443', 1, '03:30-03:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"129\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-11-30 10:03:13', '2021-11-30 10:03:13', NULL), (510, 12, '29', 'jodi_program', 'single', '2021-11-30', '03:30-04:00PM', '03:45-04:00PM', 1, 11, '103443', '103432', 1, '03:30-03:45PM', 1, '5', '103432', '103932', '{\"yantra\":\"{\\\"82\\\":1}\",\"ip\":\"1.38.181.3\"}', NULL, '2021-11-30 10:05:42', '2021-11-30 10:31:49', NULL), (511, 12, '29', 'triple_program', 'single', '2021-11-30', '04:00-04:45PM', '04:30-04:45PM', 2, 22, '103932', '103910', 1, '04:00-04:15PM', 1, '40', '103910', '107910', '{\"yantra\":\"{\\\"228\\\":2}\",\"ip\":\"1.38.181.3\"}', NULL, '2021-11-30 10:37:45', '2021-11-30 11:20:50', NULL), (512, 42, '82', 'triple_program', 'single', '2021-11-30', '04:15-05:00PM', '04:45-05:00PM', 3, 33, '5912', '5879', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"140\\\":1,\\\"177\\\":1,\\\"555\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-30 10:46:44', '2021-11-30 10:46:44', NULL), (513, 42, '82', 'jodi_program', 'single', '2021-11-30', '04:15-04:45PM', '04:30-04:45PM', 1, 11, '5879', '5868', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"21\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-30 10:54:00', '2021-11-30 10:54:00', NULL), (514, 42, '82', 'jodi_program', 'single', '2021-11-30', '04:15-04:45PM', '04:30-04:45PM', 1, 11, '5868', '5857', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"21\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-30 10:54:47', '2021-11-30 10:54:47', NULL), (515, 42, '82', 'jodi_program', 'single', '2021-11-30', '05:15-05:45PM', '05:30-05:45PM', 1, 11, '5857', '5846', 1, '05:15-05:30PM', 1, '36', '5846', '9446', '{\"yantra\":\"{\\\"21\\\":1}\",\"ip\":\"192.168.3.11\"}', NULL, '2021-11-30 11:46:07', '2021-11-30 12:15:12', NULL), (516, 12, '29', 'triple_program', 'single', '2021-11-30', '05:15-06:00PM', '05:45-06:00PM', 10, 110, '107910', '107800', 1, '05:15-05:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"115\\\":1,\\\"125\\\":1,\\\"135\\\":1,\\\"145\\\":1,\\\"150\\\":1,\\\"155\\\":1,\\\"156\\\":1,\\\"157\\\":1,\\\"158\\\":1,\\\"159\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-11-30 11:57:39', '2021-11-30 11:57:39', NULL), (517, 12, '29', 'triple_program', 'single', '2021-11-30', '05:45-06:30PM', '06:15-06:30PM', 2, 22, '107800', '107778', 1, '05:45-06:00PM', 1, '60', '107778', '113778', '{\"yantra\":\"{\\\"111\\\":2}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-11-30 12:22:51', '2021-11-30 13:00:23', NULL), (518, 12, '29', 'triple_program', 'single', '2021-12-01', '04:00-04:45PM', '04:30-04:45PM', 2, 22, '113298', '113276', 1, '04:00-04:15PM', 1, '60', '139077', '145977', '{\"yantra\":\"{\\\"333\\\":2}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-12-01 10:30:34', '2021-12-01 08:18:18', NULL), (519, 12, '29', 'program', 'single', '2021-12-01', '04:45-05:00PM', '04:45-05:00PM', 1, 11, '119276', '119265', 1, '04:45-05:00PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Vashikaran\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-12-01 11:26:44', '2021-12-01 11:26:44', NULL), (520, 12, '29', 'triple_program', 'single', '2021-12-01', '04:45-05:30PM', '05:15-05:30PM', 3, 33, '119265', '119232', 1, '04:45-05:00PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"390\\\":1,\\\"444\\\":1,\\\"688\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-12-01 11:28:40', '2021-12-01 11:28:40', NULL), (521, 12, '29', 'jodi_program', 'single', '2021-12-01', '05:00-05:30PM', '05:15-05:30PM', 1, 11, '119232', '119221', 1, '05:00-05:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"76\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-12-01 11:42:28', '2021-12-01 11:42:28', NULL), (522, 12, '29', 'triple_program', 'single', '2021-12-01', '05:00-05:45PM', '05:30-05:45PM', 1, 11, '119221', '119210', 1, '05:00-05:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"467\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-12-01 11:42:48', '2021-12-01 11:42:48', NULL), (523, 12, '29', 'jodi_program', 'single', '2021-12-01', '05:15-05:45PM', '05:30-05:45PM', 1, 11, '119210', '119199', 1, '05:15-05:30PM', 1, '9', '139077', '145977', '{\"yantra\":\"{\\\"62\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-12-01 11:50:21', '2021-12-01 08:18:18', NULL), (524, 12, '29', 'triple_program', 'single', '2021-12-01', '05:15-06:00PM', '05:45-06:00PM', 1, 11, '119199', '119188', 1, '05:15-05:30PM', 1, '10', '119188', '121088', '{\"yantra\":\"{\\\"268\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-12-01 11:50:46', '2021-12-01 12:36:03', NULL), (525, 12, '29', 'triple_program', 'single', '2021-12-01', '06:00-06:45PM', '06:30-06:45PM', 1, 11, '121088', '121077', 1, '06:00-06:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"366\\\":1}\",\"ip\":\"172.16.17.32\"}', NULL, '2021-12-01 12:40:46', '2021-12-01 12:40:46', NULL), (526, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145977', '145757', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:08:23', '2021-12-02 05:08:23', NULL), (527, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145977', '145757', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:09:05', '2021-12-02 05:09:05', NULL), (528, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145977', '145757', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:09:25', '2021-12-02 05:09:25', NULL), (529, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145977', '145757', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:09:31', '2021-12-02 05:09:31', NULL), (530, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145977', '145757', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:09:41', '2021-12-02 05:09:41', NULL), (531, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145977', '145757', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:09:51', '2021-12-02 05:09:51', NULL), (532, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145977', '145757', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:10:05', '2021-12-02 05:10:05', NULL), (533, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145757', '145537', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:10:58', '2021-12-02 05:10:58', NULL), (534, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145757', '145537', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:11:08', '2021-12-02 05:11:08', NULL), (535, 12, '29', 'program', 'single', '2021-12-02', '04:00-04:15PM', '04:00-04:15PM', 20, 220, '145757', '145537', 1, '04:00-04:15PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:11:22', '2021-12-02 05:11:22', NULL), (536, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145757', '145537', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:15:34', '2021-12-02 05:15:34', NULL), (537, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145757', '145537', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:15:45', '2021-12-02 05:15:45', NULL), (538, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145537', '145317', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:15:50', '2021-12-02 05:15:50', NULL), (539, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145317', '145097', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:16:37', '2021-12-02 05:16:37', NULL), (540, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145317', '145097', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:16:39', '2021-12-02 05:16:39', NULL), (541, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145317', '145097', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:16:49', '2021-12-02 05:16:49', NULL), (542, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145317', '145097', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:17:52', '2021-12-02 05:17:52', NULL), (543, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145317', '145097', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:18:08', '2021-12-02 05:18:08', NULL), (544, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145317', '145097', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:18:52', '2021-12-02 05:18:52', NULL), (545, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '145097', '144877', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:19:35', '2021-12-02 05:19:35', NULL), (546, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '144877', '144657', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:19:50', '2021-12-02 05:19:50', NULL), (547, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '144657', '144437', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:20:17', '2021-12-02 05:20:17', NULL), (548, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '144657', '144437', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:20:45', '2021-12-02 05:20:45', NULL), (549, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '144657', '144437', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:21:25', '2021-12-02 05:21:25', NULL), (550, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '144437', '144217', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:21:34', '2021-12-02 05:21:34', NULL), (551, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '144217', '143997', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:22:43', '2021-12-02 05:22:43', NULL), (552, 12, '29', 'program', 'single', '2021-12-02', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '143997', '143777', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:23:11', '2021-12-02 05:23:11', NULL), (553, 12, '29', 'program', 'single', '2021-12-02', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '143777', '143557', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:34:14', '2021-12-02 05:34:14', NULL), (554, 12, '29', 'program', 'single', '2021-12-02', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '143777', '143557', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:34:21', '2021-12-02 05:34:21', NULL), (555, 12, '29', 'program', 'single', '2021-12-02', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '143777', '143557', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:34:41', '2021-12-02 05:34:41', NULL), (556, 12, '29', 'program', 'single', '2021-12-02', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '143777', '143557', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:35:06', '2021-12-02 05:35:06', NULL), (557, 12, '29', 'program', 'single', '2021-12-02', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '143777', '143557', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-02 05:35:53', '2021-12-02 05:35:53', NULL), (558, 12, '29', 'program', 'single', '2021-12-03', '12:30-12:45PM', '12:30-12:45PM', 20, 220, '217957', '217737', 1, '12:30-12:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-03 01:35:15', '2021-12-03 01:35:15', NULL), (559, 12, '29', 'program', 'single', '2021-12-03', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '248704', '248484', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-03 05:35:32', '2021-12-03 05:35:32', NULL), (560, 12, '29', 'program', 'single', '2021-12-03', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '248704', '248484', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-03 05:35:58', '2021-12-03 05:35:58', NULL), (561, 12, '29', 'program', 'single', '2021-12-03', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '248484', '248264', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-03 05:36:03', '2021-12-03 05:36:03', NULL), (562, 12, '29', 'program', 'single', '2021-12-03', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '248264', '248044', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-03 05:36:14', '2021-12-03 05:36:14', NULL), (563, 12, '29', 'program', 'single', '2021-12-03', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '248264', '248044', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-03 05:37:44', '2021-12-03 05:37:44', NULL), (564, 12, '29', 'program', 'single', '2021-12-03', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '248264', '248044', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-03 05:38:03', '2021-12-03 05:38:03', NULL), (565, 12, '29', 'program', 'single', '2021-12-03', '04:30-04:45PM', '04:30-04:45PM', 20, 220, '248264', '248044', 1, '04:30-04:45PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-03 05:38:24', '2021-12-03 05:38:24', NULL), (566, 12, '29', 'program', 'single', '2021-12-04', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '248011', '247791', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-04 05:25:28', '2021-12-04 05:25:28', NULL), (567, 12, '29', 'program', 'single', '2021-12-04', '04:15-04:30PM', '04:15-04:30PM', 20, 220, '248011', '247791', 1, '04:15-04:30PM', 0, NULL, NULL, NULL, '{\"yantra\":\"{\\\"Shree\\\":1,\\\"Vashikaran\\\":1,\\\"Sudarshan\\\":2,\\\"Vastu\\\":3,\\\"Planet\\\":3,\\\"Love\\\":4,\\\"Tara\\\":4,\\\"Grah\\\":1,\\\"Meditation\\\":1}\",\"ip\":\"UNKNOWN\"}', NULL, '2021-12-04 05:26:28', '2021-12-04 05:26:28', NULL); -- 2021-12-11 09:27:37
-- ======================================================= -- Create Stored Procedure Template for Azure SQL Database -- ======================================================= SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author, , Name> -- Create Date: <Create Date, , > -- Description: <Description, , > -- ============================================= CREATE PROCEDURE dfc_GetRegionSubRegionByPostcode ( @Postcode nvarchar(50) ) AS BEGIN SELECT R.GOR10NM AS [Region] ,SR.LAD18NM AS [SubRegion] FROM [ONSPD].[ONSPD_NOV_2018_UK] P JOIN [ONSPD].[ONSPD_Region] R ON P.rgn = R.GOR10CD JOIN [ONSPD].[ONSPD_LA_UA] SR on SR.LAD18CD = P.oslaua WHERE P.pcd = @Postcode END GO
<filename>data/db/217-drop.sql DROP TABLE `user_language`; DROP TABLE `feed`; DROP TABLE `sub_thread`; DROP TABLE `thread_message`; DROP TABLE `thread`; DROP TABLE `mail`; INSERT IGNORE INTO `permission` (`libelle`) VALUES ('message.send'); INSERT IGNORE INTO `role_permission` (`role_id`, `permission_id`) VALUES (2, (SELECT `id` FROM `permission` WHERE `libelle`= 'message.send')); INSERT IGNORE INTO `permission` (`libelle`) VALUES ('conversation.getIdByUser'); INSERT IGNORE INTO `role_permission` (`role_id`, `permission_id`) VALUES (2, (SELECT `id` FROM `permission` WHERE `libelle`= 'conversation.getIdByUser')); INSERT IGNORE INTO `permission` (`libelle`) VALUES ('conversation.get'); INSERT IGNORE INTO `role_permission` (`role_id`, `permission_id`) VALUES (2, (SELECT `id` FROM `permission` WHERE `libelle`= 'conversation.get')); INSERT IGNORE INTO `permission` (`libelle`) VALUES ('conversation.getListId'); INSERT IGNORE INTO `role_permission` (`role_id`, `permission_id`) VALUES (2, (SELECT `id` FROM `permission` WHERE `libelle`= 'conversation.getListId'));
<reponame>smlblbn/soccerscorer<gh_stars>1-10 // wto eleminated string attribute sql Select Match.id, Country.name, League.name, Match.B365A, Match.B365D, Match.B365H, Match.BSA, Match.BSD, Match.BSH, Match.BWA, Match.BWD, Match.BWH, Match.GBA, Match.GBD, Match.GBH, Match.IWA, Match.IWD, Match.IWH, Match.LBA, Match.LBD, Match.LBH, Match.PSA, Match.PSD, Match.PSH, Match.SJA, Match.SJD, Match.SJH, Match.VCA, Match.VCD, Match.VCH, Match.WHA, Match.WHD, Match.WHH, Team_Attributes.buildUpPlayDribbling, Team_Attributes.buildUpPlayDribblingClass, Team_Attributes.buildUpPlayPassing, Team_Attributes.buildUpPlayPassingClass, Team_Attributes.buildUpPlayPositioningClass, Team_Attributes.buildUpPlaySpeed, Team_Attributes.buildUpPlaySpeedClass, Team_Attributes.chanceCreationCrossing, Team_Attributes.chanceCreationCrossingClass, Team_Attributes.chanceCreationPassing, Team_Attributes.chanceCreationPassingClass, Team_Attributes.chanceCreationPositioningClass, Team_Attributes.chanceCreationShooting, Team_Attributes.chanceCreationShootingClass, Team_Attributes.defenceAggression, Team_Attributes.defenceAggressionClass, Team_Attributes.defenceDefenderLineClass, Team_Attributes.defencePressure, Team_Attributes.defencePressureClass, Team_Attributes.defenceTeamWidth, Team_Attributes.defenceTeamWidthClass, t.buildUpPlayDribbling, t.buildUpPlayDribblingClass, t.buildUpPlayPassing, t.buildUpPlayPassingClass, t.buildUpPlayPositioningClass, t.buildUpPlaySpeed, t.buildUpPlaySpeedClass, t.chanceCreationCrossing, t.chanceCreationCrossingClass, t.chanceCreationPassing, t.chanceCreationPassingClass, t.chanceCreationPositioningClass, t.chanceCreationShooting, t.chanceCreationShootingClass, t.defenceAggression, t.defenceAggressionClass, t.defenceDefenderLineClass, t.defencePressure, t.defencePressureClass, t.defenceTeamWidth, t.defenceTeamWidthClass, Match.home_team_goal, Match.away_team_goal FROM Match INNER JOIN Country ON Match.country_id=Country.id INNER JOIN League ON Country.id=League.country_id INNER JOIN Team_Attributes ON Match.home_team_api_id=Team_Attributes.team_api_id AND Match.date > Team_Attributes.date INNER JOIN Team_Attributes as t ON Match.away_team_api_id=t.team_api_id AND Match.date > t.date GROUP BY Match.id // one league sql Select Match.B365A, Match.B365D, Match.B365H, Match.BWA, Match.BWD, Match.BWH, Match.IWA, Match.IWD, Match.IWH, Match.LBA, Match.LBD, Match.LBH, Match.VCA, Match.VCD, Match.VCH, Match.WHA, Match.WHD, Match.WHH, Team_Attributes.buildUpPlayPassing, Team_Attributes.buildUpPlaySpeed, Team_Attributes.chanceCreationCrossing, Team_Attributes.chanceCreationPassing, Team_Attributes.chanceCreationShooting, Team_Attributes.defenceAggression, Team_Attributes.defencePressure, Team_Attributes.defenceTeamWidth, t.buildUpPlayPassing, t.buildUpPlaySpeed, t.chanceCreationCrossing, t.chanceCreationPassing, t.chanceCreationShooting, t.defenceAggression, t.defencePressure, t.defenceTeamWidth, Match.home_team_goal, Match.away_team_goal FROM Match INNER JOIN Country ON Match.country_id=Country.id INNER JOIN League ON Country.id=League.country_id INNER JOIN Team_Attributes ON Match.home_team_api_id=Team_Attributes.team_api_id AND Match.date > Team_Attributes.date INNER JOIN Team_Attributes as t ON Match.away_team_api_id=t.team_api_id AND Match.date > t.date WHERE League.name=="England Premier League" GROUP BY Match.id // full veri sql Select Match.B365A, Match.B365D, Match.B365H, Match.BWA, Match.BWD, Match.BWH, Match.IWA, Match.IWD, Match.IWH, Match.LBA, Match.LBD, Match.LBH, Match.VCA, Match.VCD, Match.VCH, Match.WHA, Match.WHD, Match.WHH, Team_Attributes.buildUpPlayPassing, Team_Attributes.buildUpPlaySpeed, Team_Attributes.chanceCreationCrossing, Team_Attributes.chanceCreationPassing, Team_Attributes.chanceCreationShooting, Team_Attributes.defenceAggression, Team_Attributes.defencePressure, Team_Attributes.defenceTeamWidth, t.buildUpPlayPassing, t.buildUpPlaySpeed, t.chanceCreationCrossing, t.chanceCreationPassing, t.chanceCreationShooting, t.defenceAggression, t.defencePressure, t.defenceTeamWidth, Match.home_team_goal, Match.away_team_goal FROM Match INNER JOIN Country ON Match.country_id=Country.id INNER JOIN League ON Country.id=League.country_id INNER JOIN Team_Attributes ON Match.home_team_api_id=Team_Attributes.team_api_id AND Match.date > Team_Attributes.date INNER JOIN Team_Attributes as t ON Match.away_team_api_id=t.team_api_id AND Match.date > t.date WHERE League.name!="Poland Ekstraklasa" AND League.name!="Switzerland Super League" GROUP BY Match.id
update eg_wf_matrix set nextdesignation = REPLACE(nextdesignation, 'Superintendent Engineer', 'Superintending Engineer') where objecttype='WaterConnectionDetails' and nextdesignation like '%Superintendent Engineer%'; update eg_wf_matrix set currentdesignation = REPLACE(currentdesignation, 'Superintendent Engineer', 'Superintending Engineer') where objecttype='WaterConnectionDetails' and currentdesignation like '%Superintendent Engineer%'; update eg_wf_matrix set currentdesignation = REPLACE(currentdesignation, 'Superintendent engineer', 'Superintending Engineer') where objecttype='WaterConnectionDetails' and currentdesignation like '%Superintendent engineer%'; update eg_wf_matrix set nextstate='Application Approval Pending', validactions='Approve,Forward,Preview,Sign' where currentdesignation='Superintending Engineer' and currentstate='Application Approval Pending' and objecttype='WaterConnectionDetails';
<gh_stars>1-10 WITH gemeinden_ref AS ( SELECT geometrie, bfs_nummer, hoheitsgebietsname AS gemeindename FROM agi_swissboundaries3d_pub.swissboundaries3d_hoheitsgebiet WHERE kanton = 'Bern' OR kanton = 'Basel-Landschaft' OR kanton = 'Aargau' OR kanton = 'Jura' UNION ALL SELECT geometrie, bfs_gemeindenummer AS bfs_nummer, gemeindename FROM agi_hoheitsgrenzen_pub.hoheitsgrenzen_gemeindegrenze ) SELECT aggloprogramm.aname AS aggloprogramm, aggloprogramm.agglo_nu AS agglomerationsprogramm_nummer, gemeinde.aname AS gemeinde, gemeinde.bfs_nr, gemeinde.kanton, gemeinde.land, gemeinden_ref.geometrie FROM arp_agglomerationsprogramme.agglomrtnsprgrmme_agglomerationsprogramm AS aggloprogramm JOIN arp_agglomerationsprogramme.agglomrtnsprgrmme_massnahme AS massnahme ON aggloprogramm.t_id = massnahme.agglo_programm JOIN arp_agglomerationsprogramme.agglomrtnsprgrmme_gemeinde_massnahme AS gemeinde_massnahme ON massnahme.t_id = gemeinde_massnahme.massnahme JOIN arp_agglomerationsprogramme.agglomrtnsprgrmme_gemeinde AS gemeinde ON gemeinde_massnahme.gemeinde_name = gemeinde.t_id JOIN gemeinden_ref ON gemeinde.bfs_nr = gemeinden_ref.bfs_nummer GROUP BY aggloprogramm.aname, aggloprogramm.agglo_nu, gemeinde.t_id, gemeinden_ref.geometrie ;
<reponame>aliostad/deep-learning-lang-detection -- Z SQL Method -- /article17/habitatsummary/sql_methods/select_comments_read_number <params>region habitat user ms reader</params> SELECT habitat_comments_read.reader_user_id FROM habitat_comments INNER JOIN habitat_comments_read ON (habitat_comments.id = habitat_comments_read.id_comment) WHERE <dtml-sqltest region type=string> AND <dtml-sqltest habitat type=string> AND <dtml-sqltest user type=string> AND <dtml-sqltest name="ms" column="MS" type=string> AND <dtml-sqltest name="reader" column="reader_user_id" type=string>
/* Source: https://github.com/reubensultana/DBAScripts/blob/master/Databases/GetInfo-DatabaseConfigAsXML.sql */ /* Get information about database propertied and database objects, principals, permisions, etc. */ SET NOCOUNT ON; SELECT DB_NAME() AS [database_name], -- databases CONVERT(xml, ( SELECT * FROM sys.databases WHERE database_id = DB_ID() FOR XML PATH, ROOT('databases'), ELEMENTS XSINIL ), 2), -- database_files CONVERT(xml, ( SELECT * FROM sys.database_files FOR XML PATH, ROOT('database_files'), ELEMENTS XSINIL ), 2), -- filegroups CONVERT(xml, ( SELECT * FROM sys.data_spaces FOR XML PATH, ROOT('filegroups'), ELEMENTS XSINIL ), 2), -- database_principals CONVERT(xml, ( SELECT * FROM sys.database_principals WHERE (principal_id > 4) AND (principal_id NOT BETWEEN 16384 AND 16393) FOR XML PATH, ROOT('database_principals'), ELEMENTS XSINIL ), 2), -- schemas CONVERT(xml, ( SELECT * FROM sys.schemas WHERE (principal_id > 4) AND (principal_id NOT BETWEEN 16384 AND 16393) FOR XML PATH, ROOT('schemas'), ELEMENTS XSINIL ), 2), -- database_permissions CONVERT(xml, ( SELECT * FROM sys.database_permissions WHERE (grantee_principal_id > 4) AND (grantee_principal_id NOT BETWEEN 16384 AND 16393) FOR XML PATH, ROOT('database_permissions'), ELEMENTS XSINIL ), 2), -- tables CONVERT(xml, ( SELECT * FROM sys.tables WHERE object_id > 100 FOR XML PATH, ROOT('tables'), ELEMENTS XSINIL ), 2), -- views CONVERT(xml, ( SELECT * FROM sys.views WHERE object_id > 100 FOR XML PATH, ROOT('views'), ELEMENTS XSINIL ), 2), -- columns CONVERT(xml, ( SELECT * FROM sys.columns WHERE object_id > 100 FOR XML PATH, ROOT('columns'), ELEMENTS XSINIL ), 2), -- identity_columns CONVERT(xml, ( SELECT * FROM sys.identity_columns WHERE object_id > 100 FOR XML PATH, ROOT('identity_columns'), ELEMENTS XSINIL ), 2), -- computed_columns CONVERT(xml, ( SELECT * FROM sys.computed_columns WHERE object_id > 100 FOR XML PATH, ROOT('computed_columns'), ELEMENTS XSINIL ), 2), -- default_constraints CONVERT(xml, ( SELECT * FROM sys.default_constraints WHERE object_id > 100 FOR XML PATH, ROOT('default_constraints'), ELEMENTS XSINIL ), 2), -- check_constraints CONVERT(xml, ( SELECT * FROM sys.check_constraints WHERE object_id > 100 FOR XML PATH, ROOT('check_constraints'), ELEMENTS XSINIL ), 2), -- key_constraints CONVERT(xml, ( SELECT * FROM sys.key_constraints WHERE parent_object_id > 100 FOR XML PATH, ROOT('key_constraints'), ELEMENTS XSINIL ), 2), -- foreign_keys CONVERT(xml, ( SELECT * FROM sys.foreign_keys WHERE parent_object_id > 100 FOR XML PATH, ROOT('foreign_keys'), ELEMENTS XSINIL ), 2), -- foreign_key_columns CONVERT(xml, ( SELECT * FROM sys.foreign_key_columns WHERE parent_object_id > 100 FOR XML PATH, ROOT('foreign_key_columns'), ELEMENTS XSINIL ), 2), -- sequences CONVERT(xml, ( SELECT * FROM sys.sequences WHERE object_id > 100 FOR XML PATH, ROOT('sequences'), ELEMENTS XSINIL ), 2), -- indexes CONVERT(xml, ( SELECT * FROM sys.indexes WHERE object_id > 100 FOR XML PATH, ROOT('indexes'), ELEMENTS XSINIL ), 2), -- index_columns CONVERT(xml, ( SELECT * FROM sys.index_columns WHERE object_id > 100 FOR XML PATH, ROOT('index_columns'), ELEMENTS XSINIL ), 2), -- stats CONVERT(xml, ( SELECT * FROM sys.stats WHERE object_id > 100 FOR XML PATH, ROOT('stats'), ELEMENTS XSINIL ), 2), -- synonyms CONVERT(xml, ( SELECT * FROM sys.synonyms FOR XML PATH, ROOT('synonyms'), ELEMENTS XSINIL ), 2), -- procedures CONVERT(xml, ( SELECT * FROM sys.procedures FOR XML PATH, ROOT('procedures'), ELEMENTS XSINIL ), 2), -- functions CONVERT(xml, ( SELECT * FROM sys.objects WHERE object_id > 100 AND type IN ('FN', 'TF', 'IF') FOR XML PATH, ROOT('functions'), ELEMENTS XSINIL ), 2), -- parameters CONVERT(xml, ( SELECT * FROM sys.parameters FOR XML PATH, ROOT('parameters'), ELEMENTS XSINIL ), 2), -- triggers CONVERT(xml, ( SELECT * FROM sys.triggers WHERE parent_id > 100 FOR XML PATH, ROOT('triggers'), ELEMENTS XSINIL ), 2), -- table_types CONVERT(xml, ( SELECT * FROM sys.table_types FOR XML PATH, ROOT('table_types'), ELEMENTS XSINIL ), 2), -- assembly_modules CONVERT(xml, ( SELECT * FROM sys.assembly_modules FOR XML PATH, ROOT('assembly_modules'), ELEMENTS XSINIL ), 2), -- sql_modules CONVERT(xml, ( SELECT * FROM sys.sql_modules FOR XML PATH, ROOT('sql_modules'), ELEMENTS XSINIL ), 2), -- partitions CONVERT(xml, ( SELECT * FROM sys.partitions WHERE object_id > 100 FOR XML PATH, ROOT('partitions'), ELEMENTS XSINIL ), 2), -- partition_functions CONVERT(xml, ( SELECT * FROM sys.partition_functions FOR XML PATH, ROOT('partition_functions'), ELEMENTS XSINIL ), 2), -- partition_schemes CONVERT(xml, ( SELECT * FROM sys.partition_schemes FOR XML PATH, ROOT('partition_schemes'), ELEMENTS XSINIL ), 2), -- when this audit was run CURRENT_TIMESTAMP AS [current_timestamp] FOR XML PATH('database'), ROOT('databaseinfo'), ELEMENTS XSINIL;
<reponame>jdkoren/sqlite-parser -- collate3.test -- -- execsql { -- CREATE TABLE collate3t1(c1 COLLATE string_compare, c2); -- } CREATE TABLE collate3t1(c1 COLLATE string_compare, c2);
-- file:triggers.sql ln:1693 expect:true drop trigger child2_update_trig on child2
<gh_stars>100-1000 IF OBJECT_ID('[dbo].[Carts]', 'U') IS NOT NULL DROP TABLE [dbo].[Carts] GO CREATE TABLE [dbo].[Carts] ( [Id] [uniqueidentifier] NOT NULL, [DepartingFlight] [int] NULL, [ReturningFlight] [int] NULL, [CarReservation] [int] NULL, [CarReservationDuration] [FLOAT] NULL, [HotelReservation] [int] NULL, [HotelReservationDuration] [int] NULL, CONSTRAINT [PK_Carts] PRIMARY KEY CLUSTERED ([Id] ASC), CONSTRAINT [FK_Carts_DepartingFlight] FOREIGN KEY (DepartingFlight) REFERENCES [dbo].[Flights] (Id), CONSTRAINT [FK_Carts_ReturningFlight] FOREIGN KEY (ReturningFlight) REFERENCES [dbo].[Flights] (Id), CONSTRAINT [FK_Carts_CarReservation] FOREIGN KEY (CarReservation) REFERENCES [dbo].[Cars] (Id), CONSTRAINT [FK_Carts_HotelReservation] FOREIGN KEY (HotelReservation) REFERENCES [dbo].[Hotels] (Id) ); GO IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE SPECIFIC_SCHEMA = N'dbo' AND SPECIFIC_NAME = N'GetCartById' ) DROP PROCEDURE dbo.GetCartById GO CREATE PROCEDURE dbo.GetCartById @Id UNIQUEIDENTIFIER AS SET NOCOUNT ON SELECT Lower(Replace(Convert(varchar(36), [Id]),'-', '')) as Id, [DepartingFlight], [ReturningFlight], [CarReservation], [CarReservationDuration], [HotelReservation], [HotelReservationDuration] FROM Carts WHERE Id = @Id GO IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE SPECIFIC_SCHEMA = N'dbo' AND SPECIFIC_NAME = N'DeleteCart' ) DROP PROCEDURE dbo.DeleteCart GO CREATE PROCEDURE dbo.DeleteCart @Id UNIQUEIDENTIFIER AS SET NOCOUNT ON DELETE FROM Carts WHERE Id = @Id GO IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE SPECIFIC_SCHEMA = N'dbo' AND SPECIFIC_NAME = N'UpsertCartFlights' ) DROP PROCEDURE dbo.UpsertCartFlights GO CREATE PROCEDURE dbo.UpsertCartFlights @Id UNIQUEIDENTIFIER, @DepartingFlight [int] null, @ReturningFlight [int] null AS SET NOCOUNT ON MERGE CARTS AS target USING (SELECT @Id, @DepartingFlight, @ReturningFlight) AS source (Id, DepartingFlight, ReturningFlight) ON (target.Id = source.Id) WHEN MATCHED THEN UPDATE SET DepartingFlight = source.DepartingFlight, ReturningFlight = source.ReturningFlight WHEN NOT MATCHED THEN INSERT (Id, DepartingFlight, ReturningFlight) VALUES (source.Id, source.DepartingFlight, source.ReturningFlight); GO IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE SPECIFIC_SCHEMA = N'dbo' AND SPECIFIC_NAME = N'UpsertCartCar' ) DROP PROCEDURE dbo.UpsertCartCar GO CREATE PROCEDURE dbo.UpsertCartCar @Id UNIQUEIDENTIFIER, @CarReservation [int] null, @CarReservationDuration [FLOAT] null AS SET NOCOUNT ON MERGE CARTS AS target USING (SELECT @Id, @CarReservation, @CarReservationDuration) AS source (Id, CarReservation, CarReservationDuration) ON (target.Id = source.Id) WHEN MATCHED THEN UPDATE SET CarReservation = source.CarReservation, CarReservationDuration = source.CarReservationDuration WHEN NOT MATCHED THEN INSERT (Id, CarReservation, CarReservationDuration) VALUES (source.Id, source.CarReservation, source.CarReservationDuration); GO IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE SPECIFIC_SCHEMA = N'dbo' AND SPECIFIC_NAME = N'UpsertCartHotel' ) DROP PROCEDURE dbo.UpsertCartHotel GO CREATE PROCEDURE dbo.UpsertCartHotel @Id UNIQUEIDENTIFIER, @HotelReservation [int] null, @HotelReservationDuration [int] null AS SET NOCOUNT ON MERGE CARTS AS target USING (SELECT @Id, @HotelReservation, @HotelReservationDuration) AS source (Id, HotelReservation, HotelReservationDuration) ON (target.Id = source.Id) WHEN MATCHED THEN UPDATE SET HotelReservation = source.HotelReservation, HotelReservationDuration = source.HotelReservationDuration WHEN NOT MATCHED THEN INSERT (Id, HotelReservation, HotelReservationDuration) VALUES (source.Id, source.HotelReservation, source.HotelReservationDuration); GO
--------------------------------------------------------------------------------- -- pg_dbms_errlog extension for PostgreSQL -- Emulate DBMS_ERRLOG Oracle module but in a simplistic way. --------------------------------------------------------------------------------- -- complain if script is sourced in psql, rather than via CREATE EXTENSION \echo Use "CREATE EXTENSION pg_dbms_errlog" to load this file. \quit -- check the functions bodies as creation time, enabled by default SET LOCAL check_function_bodies = on ; -- make sure of client encofing SET LOCAL client_encoding = 'UTF8'; CREATE OR REPLACE FUNCTION @extschema@.unregister_errlog_table() RETURNS event_trigger AS $$ DECLARE sql_unregister_table text; relinfo RECORD; BEGIN IF tg_tag = 'DROP TABLE' OR tg_tag = 'DROP SCHEMA' THEN FOR relinfo IN SELECT * FROM pg_catalog.pg_event_trigger_dropped_objects() WHERE object_type IN ('table', 'view') LOOP sql_unregister_table := 'DELETE FROM @extschema@.register_errlog_tables WHERE reldml ='||relinfo.objid||' OR relerrlog = '||relinfo.objid; EXECUTE sql_unregister_table; END LOOP; END IF; END; $$ LANGUAGE plpgsql; CREATE EVENT TRIGGER ddl_drop_errlog_table ON sql_drop EXECUTE PROCEDURE @extschema@.unregister_errlog_table();
# from pre 2.0 to 2.0 ALTER TABLE security_report ALTER COLUMN description TYPE TEXT; ALTER TABLE ui_report ADD COLUMN uid VARCHAR(128) NOT NULL; ALTER TABLE ui_result DROP COLUMN report_id; ALTER TABLE ui_result ADD COLUMN report_uid VARCHAR(128); ALTER TABLE api_report ADD COLUMN status VARCHAR(128); ALTER TABLE performance_tests ADD COLUMN git JSON; ALTER TABLE ui_report ADD COLUMN browser_version VARCHAR(128); # ALTER TABLE api_report ADD COLUMN test_uid VARCHAR(128); ALTER TABLE ui_result ADD COLUMN name VARCHAR(256);
if exists (SELECT * FROM sysobjects WHERE name = 'cayenne_tst_upd_proc2') BEGIN DROP PROCEDURE cayenne_tst_upd_proc2 END
<reponame>AsciiShell/DB_course<gh_stars>1-10 use airport; SELECT * FROM flight WHERE airport_in = airport_out AND date_out >= NOW() - 30; SELECT * FROM planes WHERE business_class > 0 AND (model = 'Boeing 737' OR model = 'Boeing 747'); SELECT * FROM planes WHERE first_class IS NOT NULL AND business_class IS NOT NULL AND model LIKE 'Airbus%'; SELECT * FROM tickets WHERE class_type IN ('First class', 'Business class') AND passenger_id IS NULL; SELECT * FROM flight WHERE MONTH(date_out) = 3 AND YEAR(date_out) = YEAR(NOW()) AND airport_out = 'SVO' ORDER BY date_out; SELECT * FROM flight WHERE date_out BETWEEN '2018-03-01' AND '2018-03-31' AND airport_out = 'SVO' ORDER BY date_out; SELECT * FROM passengers WHERE doc_type = 'Паспорт' AND born >= NOW() - 14 * 365;
DROP TABLE IF EXISTS goma_numeric_types; CREATE TABLE goma_numeric_types ( id BIGINT PRIMARY KEY, bool_columns BOOL NOT NULL, smallint_columns SMALLINT NOT NULL, int_columns INT NOT NULL, integer_columns INTEGER NOT NULL, serial_columns SERIAL NOT NULL, decimal_columns DECIMAL NOT NULL, numeric_columns NUMERIC NOT NULL, float_columns FLOAT NOT NULL );
<reponame>EvanDylan/unicorn CREATE TABLE `record` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `flag` bigint(20) NOT NULL, `application_name` varchar(128) DEFAULT '', `name` varchar(128) NOT NULL, `key` varchar(128) NOT NULL, `class_name` varchar(256) DEFAULT '', `response` blob, `created_time` datetime(3) NOT NULL, `expired_time` datetime(3) NOT NULL, PRIMARY KEY (`id`), KEY `domain_value_index` (`application_name`, `name`, `key`, `expired_time`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 8 DEFAULT CHARSET = utf8mb4;
CREATE DATABASE IF NOT EXISTS phpunittest;
{{ config(materialized='table', properties={ "format": "'PARQUET'", "partitioned_by":"ARRAY['year']", }) }} with source_data as ( select marketplace , customer_id , review_id , product_id , product_parent , product_title , star_rating , helpful_votes , total_votes , vine , verified_purchase , review_headline , review_body , review_date ,product_category, "year" from s3.nessie_system_testing.amazon_reviews_parquet_internal where year > 1980 ) select * from source_data
/* Navicat Premium Data Transfer Source Server : 0.0.0.0 Source Server Type : MySQL Source Server Version : 50718 Source Host : 0.0.0.0:0 Source Schema : wuyou-robot-test Target Server Type : MySQL Target Server Version : 50718 File Encoding : 65001 Date: 07/05/2022 19:39:43 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for bot_send_message -- ---------------------------- DROP TABLE IF EXISTS `bot_send_message`; CREATE TABLE `bot_send_message` ( `id` int(11) NOT NULL AUTO_INCREMENT, `flag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'flag', `message` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '消息内容', `bot_code` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '发送消息的bot账号', `target_code` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '目标账号,群号或者QQ号', `is_sent` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已发送', `send_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '发送类型,群或者私聊', `send_time` datetime(0) NOT NULL COMMENT '发送时间', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 765 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for group_boot_state -- ---------------------------- DROP TABLE IF EXISTS `group_boot_state`; CREATE TABLE `group_boot_state` ( `id` int(11) NOT NULL AUTO_INCREMENT, `group_code` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '群号', `state` tinyint(1) NULL DEFAULT NULL COMMENT '开关机状态', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for message -- ---------------------------- DROP TABLE IF EXISTS `message`; CREATE TABLE `message` ( `id` int(11) NOT NULL AUTO_INCREMENT, `message_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '消息id', `account_code` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '发送消息的人的QQ号', `group_code` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发送消息的群号', `flag` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '消息的flag', `type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '消息类型', `message_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '消息文本(不包含猫猫码)', `message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '消息内容', `send_time` datetime(0) NOT NULL COMMENT '发送时间', `is_recall` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已撤回', `recall_time` datetime(0) NULL DEFAULT NULL COMMENT '撤回的时间', `recall_account_code` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '撤回消息账号', PRIMARY KEY (`id`) USING BTREE, INDEX `account_code`(`account_code`) USING BTREE, INDEX `group_code`(`group_code`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 16262 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '消息表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for music_info -- ---------------------------- DROP TABLE IF EXISTS `music_info`; CREATE TABLE `music_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mid` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '音乐id', `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '标题', `subtitle` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '子标题', `artist` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '艺术家', `album` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '专辑', `preview_url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '封面链接', `jump_url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '跳转链接', `file_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '文件名', `pay_play` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否要付费播放', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `music_info_mid_uindex`(`mid`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1293 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '音乐信息' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for sentence -- ---------------------------- DROP TABLE IF EXISTS `sentence`; CREATE TABLE `sentence` ( `id` int(11) NOT NULL AUTO_INCREMENT, `text` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '内容', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `sentence_id_uindex`(`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '戳一戳的句子' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1;
--pass out-of-range data of timestampltz/datetimeltz type to the parameter --2. [error] out-of-range argument: timestampltz type select second(timestampltz'23:00:00 13/01'); select second(timestampltz'04:14:07 1/19/2038'); select second(timestampltz'03:15:07 1/19/2038'); select second(timestampltz'03:14:08 1/19/2038'); select second(timestampltz'03:14:07 2/19/2038'); select second(timestampltz'03:14:07 1/20/2038'); select second(timestampltz'03:14:07 1/19/2039'); --?? select second(timestampltz'03:14:07 PM 1/19/2038'); select second(timestampltz'0:0:0 PM 1969-01-01'); select second(timestampltz'11:03:22 PM 1864-01-23'); select second(timestampltz'2300-12-12 22:02:33'); select second(timestampltz'2020-23-11 03:14:66 pm'); select second(timestampltz'1970-10-101 0:0'); select second(timestampltz'1999/12/11 3:14:7 am'); select second(timestampltz'2010-4-31 3:14:7 am'); --3. [error] out-of-range argument: datetimeltz type select second(datetimeltz'2010-10 10:10:100.00 am'); select second(datetimeltz'24:59:59.999 12/31/9999'); select second(datetimeltz'23:60:59.999 12/31/9999'); select second(datetimeltz'23:59:60.999 12/31/9999'); select second(datetimeltz'23:59:59.999 13/31/9999'); select second(datetimeltz'23:59:59.999 12/32/9999'); select second(datetimeltz'23:59:59.999 12/31/10000'); select second(datetimeltz'20:33:61.111 1990-10-19 '); select second(datetimeltz'2/31/2022 10:20:30.400'); select second(datetimeltz'0-12-12 23:59:59:999');
<gh_stars>0 -- @testpoint: opengauss关键字message_text(非保留),作为存储过程名,部分测试点合理报错 --关键字不带引号-成功 drop procedure if exists message_text; create procedure message_text( section number(6), salary_sum out number(8,2), staffs_count out integer) is begin select sum(salary), count(*) into salary_sum, staffs_count from staffs where section_id = section; end; / --关键字带双引号-成功 drop procedure if exists "message_text"; create procedure "message_text"( section number(6), salary_sum out number(8,2), staffs_count out integer) is begin select sum(salary), count(*) into salary_sum, staffs_count from staffs where section_id = section; end; / --关键字带单引号-合理报错 drop procedure if exists 'message_text'; create procedure 'message_text'( section number(6), salary_sum out number(8,2), staffs_count out integer) is begin select sum(salary), count(*) into salary_sum, staffs_count from staffs where section_id = section; end; / --关键字带反引号-合理报错 drop procedure if exists `message_text`; create procedure `message_text`( section number(6), salary_sum out number(8,2), staffs_count out integer) is begin select sum(salary), count(*) into salary_sum, staffs_count from staffs where section_id = section; end; / --清理环境 drop procedure if exists message_text; drop procedure if exists "message_text";
<filename>mysql-curso/comandos-exemplos/produtos exe.sql create database `produtos` default character set `utf8` default collate `utf8_general_ci`; use `produtos`; CREATE TABLE `jogos` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(40) NOT NULL, `fabricante` VARCHAR(20) NOT NULL, `ano` DATE NOT NULL, gênero VARCHAR(10) NOT NULL, preço DECIMAL(5 , 3 ), plataforma ENUM('PC', 'PS4', 'XBOX'), estoque TINYINT(4), PRIMARY KEY (id) ) DEFAULT CHARSET=UTF8;
/* Trigger para actualizar el estado de la partida en el tablero. */ CREATE or replace trigger t_partida_activa AFTER insert ON partidas BEGIN declare partida partidas.id_partida%type; partida_vigente partidas.id_partida%type; begin -- se cargan el puntero con el id de la partida recien creada select coalesce(max(id_partida),0) into partida from partidas; -- se carga el puntero del id de la partida vigente select id_partida into partida_vigente from partida_activa; -- se elimina el registro existente y se carga un nuevo registro con la partida vigente delete partida_activa; insert into partida_activa (id_partida) values (partida); exception when NO_DATA_FOUND then -- se realiza la actualización del movimiento insert into partida_activa values (partida); end; END; /
<gh_stars>0 INSERT INTO subscription_status_info (prefix, status) VALUES ('premium', 'PREMIUM'), ('advanced', 'ADVANCED'), ('standard', 'STANDARD'); INSERT INTO users (created_at, created_by, login, name, age, phone, rating, gender, registered_at, status, uuid) VALUES ('2017-04-18', '<EMAIL>', '<EMAIL>', 'user1', 25, '+79211234567', 1.00, 'MALE', '2017-04-18', 'UNVERIFIED', 'fb063f4f-9ad0-43b3-8d65-dc1e4e46c04a'), ('2017-04-30', '<EMAIL>', '<EMAIL>', 'user2', 26, '+79211234567', 1.00, 'MALE', '2017-04-30', 'ACTIVE', 'fb063f4f-9ad0-43b3-8d65-dc1e4e46c04b'), ('2017-01-30', '<EMAIL>', '<EMAIL>', 'user3', 27, '+79211234567', 1.00, 'MALE', '2017-01-30', 'BLOCKED', 'fb063f4f-9ad0-43b3-8d65-dc1e4e46c04c'); INSERT INTO subscriptions (created_at, created_by, name, expired_at, subscription_status_id) VALUES ('2018-12-12', 'admin', 'subscription1', '2018-12-12', 1), ('2018-11-12', 'admin', 'subscription2', '2018-11-12', 2), ('2018-10-12', 'admin', 'subscription3', '2018-10-12', 3); INSERT INTO user_sub_orders (created_at, created_by, user_id, subscription_id, subscribed_at, expired_at) SELECT '2017-12-12' AS createdAt, u.login, u.user_id, s.subscription_id, '2017-12-12' AS subscribedAt, '2018-05-12' AS expiredAt FROM users u, subscriptions s WHERE u.login = '<EMAIL>' AND s.name = 'subscription1'; INSERT INTO user_sub_orders (created_at, created_by, user_id, subscription_id, subscribed_at, expired_at) SELECT '2017-09-12' AS createdAt, u.login, u.user_id, s.subscription_id, '2017-09-12' AS subscribedAt, '2018-09-12' AS expiredAt FROM users u, subscriptions s WHERE u.login = '<EMAIL>' AND s.name = 'subscription2'; INSERT INTO user_sub_orders (created_at, created_by, user_id, subscription_id, subscribed_at, expired_at) SELECT '2017-08-30' AS createdAt, u.login, u.user_id, s.subscription_id, '2017-08-30' AS subscribedAt, '2017-08-30' AS expiredAt FROM users u, subscriptions s WHERE u.login = '<EMAIL>' AND s.name = 'subscription3'; INSERT INTO user_sub_orders (created_at, created_by, user_id, subscription_id, subscribed_at, expired_at) SELECT '2017-10-25' AS createdAt, u.login, u.user_id, s.subscription_id, '2017-10-25' AS subscribedAt, '2018-04-25' AS expiredAt FROM users u, subscriptions s WHERE u.login = '<EMAIL>' AND s.name = 'subscription2';
<gh_stars>0 /* Navicat Premium Data Transfer Source Server : say local Source Server Type : MySQL Source Server Version : 50722 Source Host : localhost:3306 Source Schema : naive_bayes Target Server Type : MySQL Target Server Version : 50722 File Encoding : 65001 Date: 28/06/2018 14:44:07 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for category -- ---------------------------- DROP TABLE IF EXISTS `category`; CREATE TABLE `category` ( `id` int(6) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of category -- ---------------------------- BEGIN; INSERT INTO `category` VALUES (1, 'Neuroticism (N)', '2018-06-22 07:29:33'); INSERT INTO `category` VALUES (2, 'Extraversion (E)', '2018-06-22 07:30:07'); INSERT INTO `category` VALUES (3, 'Agreeableness (A)', '2018-06-22 07:30:44'); INSERT INTO `category` VALUES (4, 'Openness (O)', '2018-06-22 07:32:00'); INSERT INTO `category` VALUES (5, 'Conscientiousness (C)', '2018-06-22 07:32:39'); COMMIT; -- ---------------------------- -- Table structure for history -- ---------------------------- DROP TABLE IF EXISTS `history`; CREATE TABLE `history` ( `id` int(6) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, `result` longtext NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of history -- ---------------------------- BEGIN; INSERT INTO `history` VALUES (2, 'ssa_augusta', '{\"data\":[{\"name\":\"Neuroticism (N)\",\"prob\":0.2777777777777778,\"n\":10,\"Xi_Y\":0,\"bayes\":0},{\"name\":\"Extraversion (E)\",\"prob\":0.19444444444444445,\"n\":7,\"Xi_Y\":0,\"bayes\":0},{\"name\":\"Agreeableness (A)\",\"prob\":0.1388888888888889,\"n\":5,\"Xi_Y\":0,\"bayes\":0},{\"name\":\"Openness (O)\",\"prob\":0.3055555555555556,\"n\":11,\"Xi_Y\":0.18181818181818182,\"bayes\":0.05555555555555556},{\"name\":\"Conscientiousness (C)\",\"prob\":0.08333333333333333,\"n\":3,\"Xi_Y\":0,\"bayes\":0}],\"n\":36}', '2018-06-28 06:10:26'); INSERT INTO `history` VALUES (4, 'onecak', '{\"data\":[{\"name\":\"Neuroticism (N)\",\"prob\":0.2777777777777778,\"n\":10,\"Xi_Y\":2.4,\"bayes\":0.6666666666666666},{\"name\":\"Extraversion (E)\",\"prob\":0.19444444444444445,\"n\":7,\"Xi_Y\":1.1428571428571428,\"bayes\":0.2222222222222222},{\"name\":\"Agreeableness (A)\",\"prob\":0.1388888888888889,\"n\":5,\"Xi_Y\":4,\"bayes\":0.5555555555555556},{\"name\":\"Openness (O)\",\"prob\":0.3055555555555556,\"n\":11,\"Xi_Y\":1.6363636363636365,\"bayes\":0.5000000000000001},{\"name\":\"Conscientiousness (C)\",\"prob\":0.08333333333333333,\"n\":3,\"Xi_Y\":2.6666666666666665,\"bayes\":0.2222222222222222}],\"n\":36}', '2018-06-28 06:45:48'); INSERT INTO `history` VALUES (5, 'af_harismawan', '{\"data\":[{\"name\":\"Neuroticism (N)\",\"prob\":0.2777777777777778,\"n\":10,\"Xi_Y\":0.1,\"bayes\":0.02777777777777778},{\"name\":\"Extraversion (E)\",\"prob\":0.19444444444444445,\"n\":7,\"Xi_Y\":1,\"bayes\":0.19444444444444445},{\"name\":\"Agreeableness (A)\",\"prob\":0.1388888888888889,\"n\":5,\"Xi_Y\":1.2,\"bayes\":0.16666666666666666},{\"name\":\"Openness (O)\",\"prob\":0.3055555555555556,\"n\":11,\"Xi_Y\":0.18181818181818182,\"bayes\":0.05555555555555556},{\"name\":\"Conscientiousness (C)\",\"prob\":0.08333333333333333,\"n\":3,\"Xi_Y\":0,\"bayes\":0}],\"n\":36}', '2018-06-28 06:54:36'); COMMIT; -- ---------------------------- -- Table structure for subcategory -- ---------------------------- DROP TABLE IF EXISTS `subcategory`; CREATE TABLE `subcategory` ( `id` int(6) unsigned NOT NULL AUTO_INCREMENT, `categoryID` int(10) unsigned DEFAULT NULL, `name` varchar(30) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `categoryID` (`categoryID`), CONSTRAINT `subcategory_ibfk_1` FOREIGN KEY (`categoryID`) REFERENCES `category` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of subcategory -- ---------------------------- BEGIN; INSERT INTO `subcategory` VALUES (1, 1, 'marah', '2018-06-22 16:32:54'); INSERT INTO `subcategory` VALUES (2, 1, 'bangsat', '2018-06-22 09:44:11'); INSERT INTO `subcategory` VALUES (3, 1, 'kesal', '2018-06-22 09:46:07'); INSERT INTO `subcategory` VALUES (4, 1, 'emosi', '2018-06-22 09:47:36'); INSERT INTO `subcategory` VALUES (5, 1, 'cemburu', '2018-06-22 09:52:43'); INSERT INTO `subcategory` VALUES (6, 1, 'benci', '2018-06-22 09:52:59'); INSERT INTO `subcategory` VALUES (7, 1, 'tegang', '2018-06-22 09:53:06'); INSERT INTO `subcategory` VALUES (8, 1, 'gugup', '2018-06-22 09:53:12'); INSERT INTO `subcategory` VALUES (9, 1, 'gopoh', '2018-06-22 09:53:23'); INSERT INTO `subcategory` VALUES (10, 1, 'takut', '2018-06-22 09:53:29'); INSERT INTO `subcategory` VALUES (11, 2, 'peduli', '2018-06-22 09:53:49'); INSERT INTO `subcategory` VALUES (12, 2, 'suka', '2018-06-22 09:53:55'); INSERT INTO `subcategory` VALUES (13, 2, 'senang', '2018-06-22 09:54:04'); INSERT INTO `subcategory` VALUES (14, 2, 'bahagia', '2018-06-22 09:54:12'); INSERT INTO `subcategory` VALUES (15, 2, 'motivasi', '2018-06-22 10:08:42'); INSERT INTO `subcategory` VALUES (16, 2, 'simpati', '2018-06-22 10:08:54'); INSERT INTO `subcategory` VALUES (17, 2, 'semangat', '2018-06-22 10:09:16'); INSERT INTO `subcategory` VALUES (18, 3, 'sabar', '2018-06-22 10:09:59'); INSERT INTO `subcategory` VALUES (19, 3, 'sayang', '2018-06-22 10:10:05'); INSERT INTO `subcategory` VALUES (20, 3, 'cinta', '2018-06-22 10:10:11'); INSERT INTO `subcategory` VALUES (21, 3, 'kangen', '2018-06-22 10:10:16'); INSERT INTO `subcategory` VALUES (22, 3, 'kasih', '2018-06-22 10:10:22'); INSERT INTO `subcategory` VALUES (23, 4, 'cita-cita', '2018-06-22 10:10:40'); INSERT INTO `subcategory` VALUES (24, 4, 'mimpi', '2018-06-22 10:10:47'); INSERT INTO `subcategory` VALUES (25, 4, 'khayal', '2018-06-22 10:10:53'); INSERT INTO `subcategory` VALUES (26, 4, 'andai', '2018-06-22 10:11:07'); INSERT INTO `subcategory` VALUES (27, 4, 'coba', '2018-06-22 10:11:12'); INSERT INTO `subcategory` VALUES (28, 4, 'ingin', '2018-06-22 10:11:18'); INSERT INTO `subcategory` VALUES (29, 4, 'maaf', '2018-06-22 10:11:26'); INSERT INTO `subcategory` VALUES (30, 4, 'sabar', '2018-06-22 10:11:34'); INSERT INTO `subcategory` VALUES (31, 4, 'yakin', '2018-06-22 10:11:45'); INSERT INTO `subcategory` VALUES (32, 4, 'doa', '2018-06-22 10:11:50'); INSERT INTO `subcategory` VALUES (33, 4, 'syukur', '2018-06-22 10:11:56'); INSERT INTO `subcategory` VALUES (34, 5, 'ambisi', '2018-06-22 10:12:14'); INSERT INTO `subcategory` VALUES (35, 5, 'usaha', '2018-06-22 10:12:19'); INSERT INTO `subcategory` VALUES (36, 5, 'waktu', '2018-06-22 10:12:26'); COMMIT; SET FOREIGN_KEY_CHECKS = 1;
<reponame>LilDad/relation_database INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10248,11,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10248,42,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10248,72,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10249,14,9); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10249,51,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10250,41,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10250,51,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10250,65,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10251,22,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10251,57,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10251,65,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10252,20,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10252,33,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10252,60,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10253,31,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10253,39,42); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10253,49,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10254,24,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10254,55,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10254,74,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10255,2,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10255,16,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10255,36,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10255,59,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10256,53,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10256,77,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10257,27,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10257,39,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10257,77,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10258,2,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10258,5,65); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10258,32,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10259,21,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10259,37,1); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10260,41,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10260,57,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10260,62,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10260,70,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10261,21,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10261,35,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10262,5,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10262,7,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10262,56,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10263,16,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10263,24,28); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10263,30,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10263,74,36); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10264,2,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10264,41,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10265,17,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10265,70,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10266,12,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10267,40,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10267,59,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10267,76,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10268,29,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10268,72,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10269,33,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10269,72,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10270,36,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10270,43,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10271,33,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10272,20,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10272,31,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10272,72,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10273,10,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10273,31,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10273,33,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10273,40,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10273,76,33); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10274,71,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10274,72,7); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10275,24,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10275,59,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10276,10,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10276,13,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10277,28,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10277,62,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10278,44,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10278,59,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10278,63,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10278,73,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10279,17,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10280,24,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10280,55,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10280,75,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10281,19,1); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10281,24,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10281,35,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10282,30,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10282,57,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10283,15,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10283,19,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10283,60,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10283,72,3); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10284,27,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10284,44,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10284,60,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10284,67,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10285,1,45); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10285,40,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10285,53,36); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10286,35,100); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10286,62,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10287,16,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10287,34,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10287,46,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10288,54,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10288,68,3); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10289,3,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10289,64,9); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10290,5,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10290,29,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10290,49,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10290,77,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10291,13,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10291,44,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10291,51,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10292,20,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10293,18,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10293,24,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10293,63,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10293,75,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10294,1,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10294,17,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10294,43,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10294,60,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10294,75,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10295,56,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10296,11,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10296,16,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10296,69,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10297,39,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10297,72,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10298,2,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10298,36,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10298,59,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10298,62,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10299,19,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10299,70,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10300,66,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10300,68,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10301,40,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10301,56,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10302,17,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10302,28,28); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10302,43,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10303,40,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10303,65,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10303,68,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10304,49,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10304,59,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10304,71,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10305,18,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10305,29,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10305,39,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10306,30,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10306,53,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10306,54,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10307,62,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10307,68,3); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10308,69,1); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10308,70,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10309,4,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10309,6,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10309,42,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10309,43,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10309,71,3); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10310,16,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10310,62,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10311,42,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10311,69,7); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10312,28,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10312,43,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10312,53,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10312,75,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10313,36,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10314,32,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10314,58,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10314,62,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10315,34,14); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10315,70,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10316,41,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10316,62,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10317,1,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10318,41,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10318,76,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10319,17,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10319,28,14); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10319,76,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10320,71,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10321,35,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10322,52,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10323,15,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10323,25,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10323,39,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10324,16,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10324,35,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10324,46,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10324,59,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10324,63,80); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10325,6,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10325,13,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10325,14,9); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10325,31,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10325,72,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10326,4,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10326,57,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10326,75,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10327,2,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10327,11,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10327,30,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10327,58,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10328,59,9); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10328,65,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10328,68,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10329,19,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10329,30,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10329,38,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10329,56,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10330,26,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10330,72,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10331,54,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10332,18,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10332,42,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10332,47,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10333,14,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10333,21,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10333,71,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10334,52,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10334,68,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10335,2,7); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10335,31,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10335,32,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10335,51,48); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10336,4,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10337,23,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10337,26,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10337,36,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10337,37,28); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10337,72,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10338,17,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10338,30,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10339,4,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10339,17,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10339,62,28); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10340,18,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10340,41,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10340,43,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10341,33,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10341,59,9); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10342,2,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10342,31,56); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10342,36,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10342,55,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10343,64,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10343,68,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10343,76,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10344,4,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10344,8,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10345,8,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10345,19,80); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10345,42,9); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10346,17,36); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10346,56,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10347,25,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10347,39,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10347,40,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10347,75,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10348,1,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10348,23,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10349,54,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10350,50,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10350,69,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10351,38,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10351,41,13); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10351,44,77); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10351,65,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10352,24,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10352,54,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10353,11,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10353,38,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10354,1,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10354,29,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10355,24,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10355,57,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10356,31,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10356,55,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10356,69,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10357,10,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10357,26,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10357,60,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10358,24,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10358,34,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10358,36,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10359,16,56); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10359,31,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10359,60,80); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10360,28,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10360,29,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10360,38,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10360,49,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10360,54,28); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10361,39,54); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10361,60,55); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10362,25,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10362,51,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10362,54,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10363,31,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10363,75,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10363,76,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10364,69,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10364,71,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10365,11,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10366,65,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10366,77,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10367,34,36); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10367,54,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10367,65,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10367,77,7); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10368,21,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10368,28,13); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10368,57,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10368,64,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10369,29,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10369,56,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10370,1,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10370,64,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10370,74,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10371,36,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10372,20,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10372,38,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10372,60,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10372,72,42); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10373,58,80); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10373,71,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10374,31,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10374,58,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10375,14,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10375,54,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10376,31,42); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10377,28,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10377,39,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10378,71,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10379,41,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10379,63,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10379,65,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10380,30,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10380,53,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10380,60,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10380,70,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10381,74,14); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10382,5,32); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10382,18,9); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10382,29,14); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10382,33,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10382,74,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10383,13,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10383,50,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10383,56,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10384,20,28); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10384,60,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10385,7,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10385,60,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10385,68,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10386,24,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10386,34,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10387,24,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10387,28,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10387,59,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10387,71,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10388,45,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10388,52,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10388,53,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10389,10,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10389,55,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10389,62,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10389,70,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10390,31,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10390,35,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10390,46,45); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10390,72,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10391,13,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10392,69,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10393,2,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10393,14,42); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10393,25,7); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10393,26,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10393,31,32); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10394,13,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10394,62,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10395,46,28); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10395,53,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10395,69,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10396,23,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10396,71,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10396,72,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10397,21,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10397,51,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10398,35,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10398,55,120); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10399,68,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10399,71,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10399,76,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10399,77,14); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10400,29,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10400,35,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10400,49,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10401,30,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10401,56,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10401,65,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10401,71,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10402,23,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10402,63,65); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10403,16,21); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10403,48,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10404,26,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10404,42,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10404,49,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10405,3,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10406,1,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10406,21,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10406,28,42); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10406,36,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10406,40,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10407,11,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10407,69,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10407,71,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10408,37,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10408,54,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10408,62,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10409,14,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10409,21,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10410,33,49); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10410,59,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10411,41,25); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10411,44,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10411,59,9); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10412,14,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10413,1,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10413,62,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10413,76,14); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10414,19,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10414,33,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10415,17,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10415,33,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10416,19,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10416,53,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10416,57,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10417,38,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10417,46,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10417,68,36); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10417,77,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10418,2,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10418,47,55); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10418,61,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10418,74,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10419,60,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10419,69,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10420,9,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10420,13,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10420,70,8); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10420,73,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10421,19,4); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10421,26,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10421,53,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10421,77,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10422,26,2); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10423,31,14); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10423,59,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10424,35,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10424,38,49); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10424,68,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10425,55,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10425,76,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10426,56,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10426,64,7); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10427,14,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10428,46,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10429,50,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10429,63,35); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10430,17,45); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10430,21,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10430,56,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10430,59,70); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10431,17,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10431,40,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10431,47,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10432,26,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10432,54,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10433,56,28); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10434,11,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10434,76,18); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10435,2,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10435,22,12); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10435,72,10); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10436,46,5); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10436,56,40); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10436,64,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10436,75,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10437,53,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10438,19,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10438,34,20); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10438,57,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10439,12,15); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10439,16,16); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10439,64,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10439,74,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10440,2,45); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10440,16,49); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10440,29,24); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10440,61,90); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10441,27,50); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10442,11,30); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10442,54,80); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10442,66,60); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10443,11,6); INSERT INTO OrderDetails(OrderID,ProductID,Quantity) VALUES (10443,28,12);
CREATE INDEX planet_osm_point_geom_min_zoom_15_index ON planet_osm_point USING gist(way) WHERE mz_building_min_zoom < 15 OR mz_earth_min_zoom < 15 OR mz_places_min_zoom < 15 OR mz_poi_min_zoom < 15 OR mz_water_min_zoom < 15;
<gh_stars>0 DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM photo.gps_altitude_ref) THEN INSERT INTO photo.gps_altitude_ref (id, name) VALUES (0, 'Above Sea Level'); INSERT INTO photo.gps_altitude_ref (id, name) VALUES (1, 'Below Sea Level'); END IF; END $$
<gh_stars>1-10 PRAGMA foreign_keys = false; PRAGMA ignore_check_constraints = true; -- ---------------------------- -- Update user table. SQLite has limited support for ALTER TABLE, so just create a new table and copy the data -- ---------------------------- DROP TABLE IF EXISTS "users_temp"; CREATE TABLE "users_temp" ( "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "login" text NOT NULL UNIQUE, "password" text, "permissions" text, "activated" integer NOT NULL DEFAULT 0, "activation_code" text, "activated_at" text, "last_login" text, "persist_code" text, "reset_password_code" text, "name" text, "created_at" integer NOT NULL DEFAULT 0, "updated_at" integer NOT NULL DEFAULT 0 ); CREATE UNIQUE INDEX IF NOT EXISTS "users_login_unique" ON "users_temp" ( "login" ); CREATE INDEX IF NOT EXISTS "users_activation_code_index" ON "users_temp" ( "activation_code" ); CREATE INDEX IF NOT EXISTS "users_reset_password_code_index" ON "users_temp" ( "reset_password_code" ); INSERT INTO "users_temp"("id", "login", "password", "permissions", "activated", "activation_code", "activated_at", "last_login", "persist_code", "reset_password_code", "name", "created_at", "updated_at") SELECT "id", "email", "password", "permissions", "activated", "activation_code", "activated_at", "last_login", "persist_code", "reset_password_code", "first_name" || ' ' || "last_name", "created_at", "updated_at" FROM "users"; DROP TABLE IF EXISTS "users"; ALTER TABLE "users_temp" RENAME TO "users"; -- ---------------------------- -- Add email to user config -- ---------------------------- ALTER TABLE "user_configuration" ADD COLUMN "email" text; PRAGMA foreign_keys = true; PRAGMA ignore_check_constraints = false;