text
stringlengths
6
9.38M
-- phpMyAdmin SQL Dump -- version 4.4.14 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Erstellungszeit: 15. Sep 2015 um 16:03 -- Server-Version: 5.6.26 -- PHP-Version: 5.6.12 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 */; -- -- Datenbank: `web173_db4` -- -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `validationmails` -- CREATE TABLE IF NOT EXISTS `validationmails` ( `idValidationMail` int(11) NOT NULL, `email` varchar(45) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indizes der exportierten Tabellen -- -- -- Indizes für die Tabelle `validationmails` -- ALTER TABLE `validationmails` ADD PRIMARY KEY (`idValidationMail`); -- -- AUTO_INCREMENT für exportierte Tabellen -- -- -- AUTO_INCREMENT für Tabelle `validationmails` -- ALTER TABLE `validationmails` MODIFY `idValidationMail` int(11) NOT NULL AUTO_INCREMENT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- Verify what name you are giving this table and ensure that it corrolates to what the app will unerstand DROP TABLE IF EXISTS pets; CREATE TABLE pets ( id INTEGER PRIMARY KEY, name TEXT, type TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE TRIGGER timestamp_update BEFORE UPDATE ON pets BEGIN UPDATE pets SET updated_at = CURRENT_TIMESTAMP WHERE id = new.id; END;
CREATE TABLE USERS(id int, name text, last_name text); CREATE TABLE CONTACTS(name text, last_name text, telephone, email);
with prev as ( select distinct user_id from gha_pull_requests where created_at < '{{from}}' ) select 'new_contrib;All;contrib,prs' as name, round(count(distinct user_id) / {{n}}, 2) as contributors, round(count(distinct id) / {{n}}, 2) as prs from gha_pull_requests where created_at >= '{{from}}' and created_at < '{{to}}' and user_id not in (select user_id from prev) union select sub.name, round(count(distinct sub.user_id) / {{n}}, 2) as contributors, round(count(distinct sub.id) / {{n}}, 2) as prs from ( select 'new_contrib;' || pr.dup_repo_name || ';contrib,prs' as name, pr.user_id, pr.id from gha_pull_requests pr where pr.created_at >= '{{from}}' and pr.created_at < '{{to}}' and pr.user_id not in (select user_id from prev) and pr.dup_repo_name in (select repo_name from trepos) ) sub group by sub.name order by prs desc, name asc ;
CREATE TABLE tx_games_domain_model_game ( name varchar(255) DEFAULT '' NOT NULL, publishing_date date DEFAULT NULL, price double(11,2) DEFAULT '0.00' NOT NULL, description text, link_to_steam varchar(255) DEFAULT '' NOT NULL, official_website varchar(255) DEFAULT '' NOT NULL, artwork int(11) unsigned NOT NULL default '0', screenshots int(11) unsigned DEFAULT '0' NOT NULL, score int(11) DEFAULT '0' NOT NULL, multiplayer smallint(5) unsigned DEFAULT '0' NOT NULL, cpu varchar(255) DEFAULT '' NOT NULL, gpu varchar(255) DEFAULT '' NOT NULL, ram varchar(255) DEFAULT '' NOT NULL, diskspace double(11,2) DEFAULT '0.00' NOT NULL, os varchar(255) DEFAULT '' NOT NULL, genre int(11) unsigned DEFAULT '0', characters text NOT NULL, publisher int(11) unsigned DEFAULT '0', usk int(11) unsigned DEFAULT '0' ); CREATE TABLE tx_games_domain_model_character ( name varchar(255) DEFAULT '' NOT NULL, photo int(11) unsigned NOT NULL default '0' ); CREATE TABLE tx_games_domain_model_genre ( name varchar(255) DEFAULT '' NOT NULL, description text ); CREATE TABLE tx_games_domain_model_publisher ( name varchar(255) DEFAULT '' NOT NULL, website varchar(255) DEFAULT '' NOT NULL, logo int(11) unsigned NOT NULL default '0' ); CREATE TABLE tx_games_domain_model_usk ( age int(11) DEFAULT '0' NOT NULL );
CREATE procedure sp_acc_update_group ( @GROUPID int, @ACCOUNTTYPE int, @PARENTGROUP int, @ACTIVE INT) AS UPDATE AccountGroup SET AccountType = @ACCOUNTTYPE, ParentGroup = @PARENTGROUP, Active = @ACTIVE, LastModifiedDate=getdate() WHERE GroupID = @GROUPID
alter table eleicao.bem drop column DS_BEM_CANDIDATO; alter table eleicao.bem add column DS_BEM_CANDIDATO character varying (3000);
set hive.execution.engine=spark; drop table if exists dws.tmp_fact_work_measure; create table if not exists dws.tmp_fact_work_measure ( apply_no string comment "订单号" , apply_time timestamp comment "申请时间" , product_name string comment "产品名称" , product_id string comment "产品id" , branch_id string comment "分公司id" , product_version string , start_time timestamp comment '开始时间' , end_time timestamp comment '结束时间' , jingban_user string comment '经办人' , jingban_user_id string comment '经办人id' , jiedian_key string comment '节点id' , jiedian_name string comment '节点名称' , sales_branch_id string comment '渠道经理部门id' , branch_name string comment '分公司名称' , department_name string comment '渠道经理部门' ); with tmp_all_data as ( select bao.apply_no ,bao.apply_time ,bao.product_name ,bao.product_id ,bao.branch_id ,bao.product_version ,bomr.create_time start_time ,bomr.handle_time end_time ,bomr.handle_user_name jingban_user ,bomr.handle_user_id jingban_user_id ,bomr.matter_key jiedian_key ,bomr.matter_name jiedian_name ,bao.sales_branch_id from ods.ods_bpms_biz_apply_order_common bao join ods.ods_bpms_biz_order_matter_record bomr on bao.apply_no = bomr.apply_no where bomr.handle_time is not null and bomr.matter_name in ("面签" ,"办理公证" ,"申请贷款" ,"预约赎楼" ,"同贷信息登记" ,"同贷登记" ,"赎楼登记","领取注销资料","注销抵押","注销抵押_郑州","要件托管","账户测试" ,"过户递件","过户递件_郑州","过户出件","过户出件_郑州","抵押递件","抵押递件_郑州" ,"抵押出件", "抵押出件_郑州","查档","下户调查","贷款上报终审" ,"资料齐全","放款登记","房产评估","查房") union all select bao.apply_no ,bao.apply_time ,bao.product_name ,bao.product_id ,bao.branch_id ,bao.product_version ,bof.create_time start_time ,bof.handle_time end_time ,bof.handle_user_name jingban_user ,bof.handle_user_id jingban_user_id ,bof.flow_type jiedian_key ,nvl(c.NAME_, d.NAME_) jiedian_name ,bao.sales_branch_id from ods.ods_bpms_biz_apply_order_common bao join ods.ods_bpms_biz_order_flow bof on bao.apply_no = bof.apply_no left join ods.ods_bpms_sys_dic c on bof.flow_type = c.KEY_ and c.TYPE_ID_="10000030350009" left join ods.ods_bpms_sys_dic d on bof.flow_type = d.KEY_ and d.TYPE_ID_="10000033420071" where bof.handle_time is not null and nvl(c.NAME_, d.NAME_) in ("面签" ,"办理公证" ,"申请贷款" ,"预约赎楼" ,"同贷信息登记" ,"同贷登记" ,"赎楼登记","领取注销资料","注销抵押","注销抵押_郑州","要件托管","账户测试" ,"过户递件","过户递件_郑州","过户出件","过户出件_郑州","抵押递件","抵押递件_郑州" ,"抵押出件", "抵押出件_郑州","查档","下户调查","贷款上报终审" ,"资料齐全","放款登记","房产评估","查房") union all select bao.apply_no ,bao.apply_time ,bao.product_name ,bao.product_id ,bao.branch_id ,bao.product_version ,bco.CREATE_TIME_ start_time ,bco.COMPLETE_TIME_ end_time ,bco.AUDITOR_NAME_ jingban_user ,bco.AUDITOR_ jingban_user_id ,bco.TASK_KEY_ jiedian_key ,bco.TASK_NAME_ jiedian_name ,bao.sales_branch_id from ods.ods_bpms_biz_apply_order_common bao join ods.ods_bpms_bpm_check_opinion bco on bao.flow_instance_id = bco.PROC_INST_ID_ where bco.COMPLETE_TIME_ is not null and bco.STATUS_ not in ("end", "manual_end") and bco.TASK_NAME_ in ("面签" ,"办理公证" ,"申请贷款" ,"预约赎楼" ,"同贷信息登记" ,"同贷登记" ,"赎楼登记","领取注销资料","注销抵押","注销抵押_郑州","要件托管","账户测试" ,"过户递件","过户递件_郑州","过户出件","过户出件_郑州","抵押递件","抵押递件_郑州" ,"抵押出件", "抵押出件_郑州","查档","下户调查","贷款上报终审" ,"资料齐全","放款登记","房产评估","查房") union all -- 获取节点中的嵌套节点 select bao.apply_no ,bao.apply_time ,bao.product_name ,bao.product_id ,bao.branch_id ,bao.product_version ,bco.CREATE_TIME_ start_time ,bco.COMPLETE_TIME_ end_time ,bco.AUDITOR_NAME_ jingban_user ,bco.AUDITOR_ jingban_user_id ,bco.TASK_KEY_ jiedian_key ,bco.TASK_NAME_ jiedian_name ,bao.sales_branch_id from ods.ods_bpms_biz_apply_order_common bao join ods.ods_bpms_bpm_check_opinion bco on bao.flow_instance_id = bco.SUP_INST_ID_ where bco.COMPLETE_TIME_ is not null and bco.STATUS_ not in ("end", "manual_end") and bco.TASK_NAME_ in ("面签" ,"办理公证" ,"申请贷款" ,"预约赎楼" ,"同贷信息登记" ,"同贷登记" ,"赎楼登记","领取注销资料","注销抵押","注销抵押_郑州","要件托管","账户测试" ,"过户递件","过户递件_郑州","过户出件","过户出件_郑州","抵押递件","抵押递件_郑州" ,"抵押出件", "抵押出件_郑州","查档","下户调查","贷款上报终审" ,"资料齐全","放款登记","房产评估","查房") ) insert overwrite table dws.tmp_fact_work_measure select a.apply_no, a.apply_time, a.product_name, a.product_id, a.branch_id, a.product_version ,a.start_time, a.end_time, a.jingban_user, a.jingban_user_id, a.jiedian_key, a.jiedian_name ,a.sales_branch_id, a.branch_name, a.department_name from( select a.apply_no, a.apply_time, a.product_name, a.product_id, a.branch_id, a.product_version ,a.start_time, a.end_time, a.jingban_user, a.jingban_user_id, a.jiedian_key, a.jiedian_name ,a.sales_branch_id , b.name_ branch_name, c.name_ department_name ,row_number() over(PARTITION BY a.apply_no, a.jiedian_name, date_format(a.start_time, 'yyyy-MM-dd HH:mm') ORDER BY a.start_time) rn from tmp_all_data a left join ods.ods_bpms_sys_org b on a.branch_id = b.code_ left join ods.ods_bpms_sys_org c on a.sales_branch_id = c.code_ ) as a where rn = 1
drop table if exists task drop table if exists tweet create table task ( taskId binary(20) not null, taskTitle varchar(255) not null, taskStartDate datetime null, taskDueDate datetime null, taskStatus varchar(64) not null, taskPriority varchar(64)not null, taskDescription varchar(256) null, primary key (taskId) ); create table tweet ( tweetId binary (16), tweetProfiled varchar(128), tweetContent varchar(128), tweetDate binary (64), tweetProfileAtHandle varchar(128), primary key (tweetId) );
CREATE Procedure sp_get_All_STK_REQ_Abstract_nofilter (@STK_REQ_FromDate Datetime,@STK_REQ_ToDate datetime) as Select warehouse.WareHouse_Name, Stock_Request_Abstract.stock_req_number, Stock_Request_Abstract.Stock_Req_Date, Stock_Request_Abstract.RequiredDate, status, Stock_Request_Abstract.DocumentID, Stock_Request_Abstract.[Value] from Stock_Request_Abstract, warehouse where warehouse.warehouseid = Stock_Request_Abstract.WareHouseID and (Stock_Request_Abstract.Stock_Req_Date between @STK_REQ_FromDate and @STK_REQ_ToDate) order by warehouse.WareHouse_Name, Stock_Request_Abstract.Stock_Req_Number
create database db_shiro; use db_shiro; create table users( id int auto_increment primary key, userName varchar(10), password varchar(20) ); select * from users; insert into users(id,userName,password) values(1,'wby','123');
/* Warnings: - You are about to drop the column `date` on the `Portfolio` table. All the data in the column will be lost. */ -- AlterTable ALTER TABLE "Investment" ADD COLUMN "date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; -- AlterTable ALTER TABLE "Portfolio" DROP COLUMN "date"; -- AlterTable ALTER TABLE "PortfolioValue" ADD COLUMN "date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; -- CreateTable CREATE TABLE "InvestmentValue" ( "id" SERIAL NOT NULL, "value" DOUBLE PRECISION NOT NULL, "date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "investmentId" INTEGER NOT NULL, PRIMARY KEY ("id") ); -- CreateIndex CREATE UNIQUE INDEX "InvestmentValue_investmentId_unique" ON "InvestmentValue"("investmentId"); -- AddForeignKey ALTER TABLE "InvestmentValue" ADD FOREIGN KEY ("investmentId") REFERENCES "Investment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
delete from perbooks where id = $1; delete from perposts where book_id = $1
create or replace view v_cg030_mx as ( select a."CZDE551",a."DE011",a."DE022",a."DE062",a."DE042",a."JSDE955",a."CZDE386",a."JSDE218",a."JSDE219",a."DE181",a."CZDE901",a."CZDE902",a."CZDE903",a."CZDE904",a."CZDE094",a."JSDE940",nvl(b.syje,0) as syje,(a.de181 - nvl(b.syje,0)) as kyje from cg030 a,(select czde551,sum(de181) as syje from cg031 group by czde551) b where a.czde551 = b.czde551(+));
-- 2016年7月20日 yaolu 特殊订单退款明细 begin -- @repeat{SELECT COUNT(*) FROM functionreg where ID=260} insert into functionreg(ID,packagename,name,functionkey,functiondescribe,parameterdescribe,createtime,createby,updatetime,updateby,instruction) values(260,'QuerySpecialorderinfo.bpl','特殊订单退款明细','{36FB9648-F3AF-47F9-BCCF-40934CF36924}','特殊订单退款明细','',sysdate,1158013,sysdate,1158013,null); @repeat{SELECT COUNT(*) FROM menu where ID=260} insert into menu(ID,name,functionregid,grade,orderno,parentid,parameter,createtime,createby,updatetime,updateby,clicknum,clazz,url,icon,systype,menutype) values(260,'特殊订单退款明细',260,3,10.01,31,'',sysdate,1158013,sysdate,1158013,0,'','','',0,1); --end-- --BEGIN 遥路 添加异常订单表 为网站的特殊订单 存数据 2016年7月21日 @repeat{select count(*) from user_tables where table_name=upper('SPECIALORDERINFO') } CREATE TABLE SPECIALORDERINFO ( id NUMBER(10) NOT NULL , orderno VARCHAR2(40 BYTE) NOT NULL , buscode VARCHAR2(20 BYTE) NOT NULL , busname VARCHAR2(40 BYTE) NOT NULL , orderdate DATE NOT NULL , departdate DATE NOT NULL , price NUMBER(10,2) NOT NULL , insurefee NUMBER(10,2) NULL , status NUMBER(1) NOT NULL , returnfee NUMBER(10,2) NULL , returncause VARCHAR2(40 BYTE) NULL , returnperson VARCHAR2(20 BYTE) NULL , returntime DATE NULL , createtime DATE NULL , remark VARCHAR2(100 BYTE) NULL ); COMMENT ON COLUMN SPECIALORDERINFO.orderno IS '订单号'; COMMENT ON COLUMN SPECIALORDERINFO.buscode IS '车站编码'; COMMENT ON COLUMN SPECIALORDERINFO.busname IS '车站名称'; COMMENT ON COLUMN SPECIALORDERINFO.orderdate IS '订单时间'; COMMENT ON COLUMN SPECIALORDERINFO.departdate IS '发车日期'; COMMENT ON COLUMN SPECIALORDERINFO.price IS '票价'; COMMENT ON COLUMN SPECIALORDERINFO.insurefee IS '保险金额'; COMMENT ON COLUMN SPECIALORDERINFO.status IS '车票状态0:正常 1:已退票 2:已废票 3:已检票' ; COMMENT ON COLUMN SPECIALORDERINFO.returnfee IS '退票费'; COMMENT ON COLUMN SPECIALORDERINFO.returncause IS '退票原因'; COMMENT ON COLUMN SPECIALORDERINFO.returnperson IS '退票人'; COMMENT ON COLUMN SPECIALORDERINFO.returntime IS '退票时间'; COMMENT ON COLUMN SPECIALORDERINFO.remark IS '备注'; @repeat{select count(*) from user_constraints t where t.table_name = 'SPECIALORDERINFO' and t.constraint_type = 'P' } alter table SPECIALORDERINFO add constraint PK_SPECIALORDERINFOID primary key (ID); @repeat{select count(*) from user_sequences where sequence_name = 'SEQ_SPECIALORDERINFO'} create sequence SEQ_SPECIALORDERINFO minvalue 1 maxvalue 9999999999999 start with 21 increment by 1 cache 20; @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('SPECIALORDERINFO') AND COLUMN_NAME = upper('returncause')} alter table specialorderinfo modify (returncause VARCHAR2(600 BYTE)); --END @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('SPECIALORDERINFO') AND COLUMN_NAME = upper('sellorgcode')} alter table SPECIALORDERINFO add sellorgcode VARCHAR2(40); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('SPECIALORDERINFO') AND COLUMN_NAME = upper('sellorgname')} alter table SPECIALORDERINFO add sellorgname VARCHAR2(100); -- Add comments to the columns comment on column SPECIALORDERINFO.sellorgcode is '代售机构编码'; comment on column SPECIALORDERINFO.sellorgname is '代售机构名称'; @repeat{select count(1) from user_indexes t where t.table_name = 'TICKETSELL' and t.index_name = 'IDX_TSCERTIFICATETYPNO' } create index IDX_TScertificatetypno on TICKETSELL (certificatetypename, certificateno); @repeat{select count(*) from user_tables where table_name=upper('TICKETOUTLETSTYPEPRICE') } create table TICKETOUTLETSTYPEPRICE ( ID NUMBER(10) not null, TICKETOUTLETSID NUMBER(10) not null, ROUTEID NUMBER(10) not null, SCHEDULEID NUMBER(10) not null, FULLPRICEFORMULA VARCHAR2(200) not null, HALFPRICEFORMULA VARCHAR2(200) not null, STUDENTPRICEFORMULA VARCHAR2(200) not null, STARTDATE DATE not null, ENDDATE DATE not null, CREATETIME DATE default SYSDATE, CREATEBY NUMBER(10), UPDATETIME DATE default SYSDATE, UPDATEBY NUMBER(10) ); -- Add comments to the table comment on table TICKETOUTLETSTYPEPRICE is '售票点票种差额'; -- Add comments to the columns comment on column TICKETOUTLETSTYPEPRICE.TICKETOUTLETSID is '售票点ID'; comment on column TICKETOUTLETSTYPEPRICE.ROUTEID is '线路ID'; comment on column TICKETOUTLETSTYPEPRICE.SCHEDULEID is '班次ID'; comment on column TICKETOUTLETSTYPEPRICE.FULLPRICEFORMULA is '全票差额公式'; comment on column TICKETOUTLETSTYPEPRICE.HALFPRICEFORMULA is '半票差额公式'; comment on column TICKETOUTLETSTYPEPRICE.STUDENTPRICEFORMULA is '学生票差额公式'; comment on column TICKETOUTLETSTYPEPRICE.STARTDATE is '开始时间'; comment on column TICKETOUTLETSTYPEPRICE.ENDDATE is '结束时间'; @repeat{select count(*) from user_constraints t where t.table_name = 'TICKETOUTLETSTYPEPRICE' and t.constraint_type = 'P' } alter table TICKETOUTLETSTYPEPRICE add constraint PK_TICKETOUTLETSTYPEPRICE primary key (ID); @repeat{select count(1) from user_indexes t where t.table_name = 'TICKETOUTLETSTYPEPRICE' and t.index_name = 'IDX_TIME1' } create unique index IDX_TIME1 on TICKETOUTLETSTYPEPRICE (TICKETOUTLETSID, ROUTEID, SCHEDULEID, STARTDATE, ENDDATE); --begin zhaohuaihu 20170824 #11365 车辆安检记录增加通知单重打次数字段 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('SECURITYCHECK') AND COLUMN_NAME = upper('reprinttimes')} alter table SECURITYCHECK add reprinttimes NUMBER(5) default 0 not null; comment on column SECURITYCHECK.reprinttimes is '车辆安检通知单重打次数,默认为重打0次'; --end --begin 2017-08-31 zhangqingfeng 电子支付退票业务修改 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('ticketturnoverdetail') AND COLUMN_NAME = upper('chargesweb')} alter table ticketturnoverdetail add chargesweb NUMBER(15,2) default 0; @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('ticketturnoverdetail') AND COLUMN_NAME = upper('returnamountweb')} alter table ticketturnoverdetail add returnamountweb NUMBER(15,2) default 0; comment on column TICKETTURNOVERDETAIL.chargesweb is '网售原路返还手续费'; comment on column TICKETTURNOVERDETAIL.returnamountweb is '网售原路返还退票金额'; --end 2017-08-31 zhangqingfeng @repeat{select count(1) from user_indexes t where t.table_name = 'TICKETMIXCHECK' and upper(t.index_name) = upper('idx_ticketmix2') } create index idx_ticketmix2 on TICKETMIXCHECK (ticketsellid, isactive); --begin 2017-10-17 zhaohh 售票缴款明细增加字段,记录改签、补票凭证打印张数 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('TICKETTURNOVERDETAIL') AND COLUMN_NAME = upper('TICKETPRINTNUM')} alter table TICKETTURNOVERDETAIL add TICKETPRINTNUM NUMBER(9) default 0 not null; comment on column TICKETTURNOVERDETAIL.TICKETPRINTNUM is '售票、改签、补票等打印物理票张数:包含车票数、改签凭证数、补票凭证数'; @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('TICKETTURNOVERDETAIL') AND COLUMN_NAME = upper('CHANGEPRINTNUM')} alter table TICKETTURNOVERDETAIL add CHANGEPRINTNUM NUMBER(9) default 0 not null; comment on column TICKETTURNOVERDETAIL.CHANGEPRINTNUM is '改签凭证打印张数'; @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('TICKETTURNOVERDETAIL') AND COLUMN_NAME = upper('SUPPLEMENTPRINTNUM')} alter table TICKETTURNOVERDETAIL add SUPPLEMENTPRINTNUM NUMBER(9) default 0 not null; comment on column TICKETTURNOVERDETAIL.SUPPLEMENTPRINTNUM is '补票凭证打印张数'; --end 2017-10-17 zhaohh --add by zhangxibao 行包表(pack)中增加托运人证件类型字段 start 2017-10-23 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('pack') AND COLUMN_NAME = upper('sendercertificatetype')} alter table pack add sendercertificatetype varchar2(10); comment on column PACK.SENDERCERTIFICATETYPE is '托运人证件类型:0:身份证,1:学生证,2:军官证,3:教师证 取数据字典'; --add by zhangxibao end --add by zhangxibao 行包表(pack)中增加托运人证件类型字段 start 2017-10-23 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('pack') AND COLUMN_NAME = upper('sendercertificateno')} alter table pack add sendercertificateno varchar2(30); comment on column PACK.SENDERCERTIFICATENO is '托运人证件号码'; --add by zhangxibao end --孙越 2017年10月26日 14:42:34 vehicle 增加字段 -- @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('VEHICLE') AND COLUMN_NAME = upper('businesscertificateno')} alter table VEHICLE add businesscertificateno VARCHAR2(30); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('VEHICLE') AND COLUMN_NAME = upper('businesscertificatestartdate')} alter table VEHICLE add businesscertificatestartdate date; @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('VEHICLE') AND COLUMN_NAME = upper('businesscertificateenddate')} alter table VEHICLE add businesscertificateenddate date; comment on column VEHICLE.businesscertificateno is '经营许可证号'; comment on column VEHICLE.businesscertificatestartdate is '经营许可证有效期开始日期'; comment on column VEHICLE.businesscertificateenddate is '经营许可证有效期截止日期'; --end-- --add by zhangxibao 路单打印表(roadbillprint)中增加路单编号字段 start 2017-11-1 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('ROADBILLPRINT') AND COLUMN_NAME = upper('waybillnumber')} alter table roadbillprint add waybillnumber number(10); comment on column ROADBILLPRINT.waybillnumber is '路单编号'; --add by zhangxibao end -- Create sequence zhangxibao 建序列,用于路单编号的取值 start 2017-11-1 @repeat{select count(*) from user_sequences t where upper(t.sequence_name)='SEQ_ROADBILLPRINT'} create sequence SEQ_ROADBILLPRINT minvalue 1 maxvalue 9999999999 start with 1 increment by 1 cache 20; --end --add by zhangxibao 驾驶员表(driver)中增加 全拼 字段 start 2017-11-2 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('DRIVER') AND COLUMN_NAME = upper('quanpin')} alter table driver add quanpin VARCHAR2(50); comment on column DRIVER.quanpin is '全拼'; --add by zhangxibao end --add by zhangxibao 车辆违规管理表(vehicleviolation)中增加 “结算单ID” 字段 start 2017-11-2 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('VEHICLEVIOLATION') AND COLUMN_NAME = upper('departinvoicesid')} alter table VEHICLEVIOLATION add departinvoicesid NUMBER(10); comment on column VEHICLEVIOLATION.departinvoicesid is '结算单ID'; --add by zhangxibao end --add by zhangxibao 车辆违规管理表(vehicleviolation)中增加 “现金罚款” 字段 start 2017-11-6 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('VEHICLEVIOLATION') AND COLUMN_NAME = upper('iscash')} alter table VEHICLEVIOLATION add iscash VARCHAR2(1); comment on column VEHICLEVIOLATION.iscash is '现金罚款0:非现金1:现金'; --add by zhangxibao end update vehicle t set t.nextmaintaindistance=0 where t.nextmaintaindistance is null; -- Add/modify columns @repeat{select count(*) from user_tab_cols t where table_name=upper('VEHICLE') and t.COLUMN_NAME=upper('nextmaintaindistance') and t.NULLABLE='N'} alter table VEHICLE modify nextmaintaindistance not null; @repeat{select count(*) from user_tab_cols t where t.TABLE_NAME = upper('OPERATIONLOG') and t.COLUMN_NAME = upper('content') and t.NULLABLE = 'Y'} alter table OPERATIONLOG modify content null; --begin 2017年12月21日19:53:15 zhangxibao 客户表新加冗余字段,用于查询 @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('departstationname') } alter table CUSTOMER add departstationname VARCHAR2(20); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('reachstationname') } alter table CUSTOMER add reachstationname VARCHAR2(20); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('endstationname') } alter table CUSTOMER add endstationname VARCHAR2(20); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('schcode') } alter table CUSTOMER add schcode VARCHAR2(10); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('planvehicleno') } alter table CUSTOMER add planvehicleno VARCHAR2(20); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('ticketno') } alter table CUSTOMER add ticketno VARCHAR2(20); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('departdate') } alter table CUSTOMER add departdate Date; @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('departtime') } alter table CUSTOMER add departtime CHAR(5); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('ticketstatus') } alter table CUSTOMER add ticketstatus VARCHAR2(10); @repeat{SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('CUSTOMER') AND COLUMN_NAME = upper('seatno') } alter table CUSTOMER add seatno NUMBER(4); -- Add comments to the columns comment on column CUSTOMER.departstationname is '发车站'; comment on column CUSTOMER.reachstationname is '到达站'; comment on column CUSTOMER.endstationname is '终点站'; comment on column CUSTOMER.schcode is '班次'; comment on column CUSTOMER.planvehicleno is '车牌号码'; comment on column CUSTOMER.ticketno is '票号'; comment on column CUSTOMER.departdate is '发车日期'; comment on column CUSTOMER.departtime is '发车时间'; comment on column CUSTOMER.ticketstatus is '车票状态:0-正常,1-退票,2-废票 取数据字典'; comment on column CUSTOMER.seatno is '座位号'; --end 2017年12月21日19:53:15 zhangxibao 客户表新加冗余字段,用于查询 --begin 2018年2月1日15:34:03 zhangxibao 修改pack表中表字段的长度 @repeat{select count(*)-1 from user_tab_cols t where table_name=upper('PACK') and t.COLUMN_NAME=upper('sendercertificatetype')} alter table PACK modify sendercertificatetype VARCHAR2(30); --end --增加保险售票时间索引 @repeat{select count(*) from dba_indexes t where upper(t.index_name)=upper('IDX_INSELLTIME')} create index idx_inselltime on INSURANCE (SELLTIME, SELLBY) tablespace TS_DEPARTINVOICES storage ( initial 64K minextents 1 maxextents unlimited ); @repeat{select count(*) from user_tables where table_name=upper('SEATRESERVEORDER') } create table SEATRESERVEORDER ( id NUMBER(10) not null, orderno VARCHAR2(20) not null, seatreserveid NUMBER(10) not null, status NUMBER(1) default 0 not null, createtime DATE default SYSDATE not null, createby NUMBER(10) default 0 not null, updatetime DATE default SYSDATE not null, updateby NUMBER(10) default 0 not null ); -- Add comments to the columns comment on column SEATRESERVEORDER.orderno is '订单号'; comment on column SEATRESERVEORDER.seatreserveid is '座位预留表ID'; comment on column SEATRESERVEORDER.status is '0为正常,1为删除'; -- Create/Recreate indexes @repeat{select count(*) from dba_indexes t where upper(t.index_name)=upper('IDX_SEATRESERVEORDER')} create unique index IDX_SEATRESERVEORDER on SEATRESERVEORDER (ORDERNO, SEATRESERVEID); @repeat{select count(*) from user_constraints t where t.table_name = 'SEATRESERVEORDER' and t.constraint_type = 'P' } alter table SEATRESERVEORDER add constraint PK_SEATRESERVEORDER primary key (ID); --begin 20180416 zhaohh 修改顾客表中红名单字段不允许为空 @repeat{select count(*) - 1 from user_tab_cols t where table_name=upper('customer') and t.COLUMN_NAME=upper('isred')} update customer t set t.isred = 0 where t.isred is null; @repeat{select count(*) - 1 from dba_tab_columns t where t.TABLE_NAME ='CUSTOMER' AND T.COLUMN_NAME = 'ISRED' AND T.NULLABLE = 'Y'} alter table CUSTOMER modify ISRED default 0 not null; --end --begin 20180418 zqf 修改结算单字段精确度 @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('packmoney') } alter table balance modify packmoney number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('ticketincome') } alter table balance modify ticketincome number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('additionfee') } alter table balance modify additionfee number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('divide') } alter table balance modify divide number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('packprice') } alter table balance modify packprice number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('rentmoney') } alter table balance modify rentmoney number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('rentprice') } alter table balance modify rentprice number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('debit') } alter table balance modify debit number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('backmoney') } alter table balance modify backmoney number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('bysj') } alter table balance modify bysj number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('syqj') } alter table balance modify syqj number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('goodsagent') } alter table balance modify goodsagent number(12,2); @repeat{SELECT 1-COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME = upper('balance') AND COLUMN_NAME = upper('packamount') } alter table balance modify packamount number(12,2); --end
/* Name: Development Views Last 7 Days Data source: 4 Created By: Admin Last Update At: 2015-09-11T14:14:23.724971+00:00 */ SELECT nvl(DATE,P.PreviousWeekDATE) AS DATE, views, visits, visitors, ViewsPreviousWeek, VisitsPreviousWeek, VisitorsPreviousWeek, DAY(nvl(DATE,P.PreviousWeekDATE)) AS DAY, MONTH(nvl(DATE,P.PreviousWeekDATE)) AS MONTH, YEAR(nvl(DATE,P.PreviousWeekDATE)) AS YEAR FROM (SELECT string(STRFTIME_UTC_USEC(DATE(date_time), "%m/%d/%Y")) AS DATE, COUNT(visit_num) AS Views, COUNT(DISTINCT post_visid_high + "-" + post_visid_low + "-" + visit_num) Visits, COUNT(DISTINCT post_visid_high + "-" + post_visid_low) Visitors FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal, "((year(MSEC_TO_TIMESTAMP(creation_time)) = year(DATE(CURRENT_DATE())) AND month(MSEC_TO_TIMESTAMP(creation_time)) <= month(DATE(CURRENT_DATE()))) OR (month(MSEC_TO_TIMESTAMP(creation_time)) > (month(CURRENT_DATE())) AND year(MSEC_TO_TIMESTAMP(creation_time)) < year(DATE(CURRENT_DATE()))))")) WHERE post_page_event = "0" /*Page View Calls*/ AND DATE(date_time) >= DATE(DATE_ADD(CURRENT_DATE(),-8,"Day")) AND DATE(date_time) < DATE(CURRENT_DATE()) AND post_prop19 = 'development' /* Counting development */ GROUP BY DATE ORDER BY DATE) C FULL OUTER JOIN EACH (SELECT string(STRFTIME_UTC_USEC(date(DATE_ADD(date_time,+7,"Day")), "%m/%d/%Y")) AS PreviousWeekDATE, COUNT(visit_num) AS ViewsPreviousWeek, COUNT(DISTINCT post_visid_high + "-" + post_visid_low + "-" + visit_num) VisitsPreviousWeek, COUNT(DISTINCT post_visid_high + "-" + post_visid_low) VisitorsPreviousWeek FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal, " ((year(MSEC_TO_TIMESTAMP(creation_time)) = year(DATE(CURRENT_DATE())) AND month(MSEC_TO_TIMESTAMP(creation_time)) <= month(DATE(CURRENT_DATE()))) OR (month(MSEC_TO_TIMESTAMP(creation_time)) > (month(CURRENT_DATE())) AND year(MSEC_TO_TIMESTAMP(creation_time)) < year(DATE(CURRENT_DATE()))))")) WHERE post_page_event = "0" /*Page View Calls*/ AND DATE(date_time) >= DATE(DATE_ADD(CURRENT_DATE(),-15,"Day")) AND DATE(date_time) <= DATE(DATE_ADD(CURRENT_DATE(),-8,"Day")) AND post_prop19 = 'development' /* Counting development */ GROUP BY PreviousWeekDATE ORDER BY PreviousWeekDATE) P ON c.DATE = P.PreviousWeekDATE ORDER BY YEAR ASC, MONTH ASC, DAY ASC
SET SCHEMA BOOKMARK_MANAGER; -- todo: create indincies for queries optimization -- CREATE UNIQUE INDEX IF NOT EXISTS IX_AUTH_USERNAME ON AUTHORITIES(USERNAME,AUTHORITY);
-- 1. 부서 테이블과 사원 테이블에서 사번, 사원명, 부서코드, 부서명을 검색하시오. (사원명 오름차순 정렬할 것) --oracle select e.empno 사번, e.ename 사원명, e.deptno 부서코드, d.dname 부서명 from emp e, dept d where e.deptno = d.deptno order by 사원명; --ansi select e.empno 사번, e.ename 사원명, e.deptno 부서코드, d.dname 부서명 from emp e join dept d on e.deptno=d.deptno order by 사원명; -- 2.부서 테이블과 사원테이블에서 사번, 사원명 , 급여 , 부서명을 검색하시오. -- 단, 급여가 2000 이상인 사원에 대하여 급여기준으로 내림차순 정렬할 것. --oracle select e.deptno 사번, e.ename 사원명, e.sal 급여, d.dname 부서명 from emp e, dept d where e.deptno = d.deptno and e.sal >= 2000 order by e.sal desc; --ansi select e.deptno 사번, e.ename 사원명, e.sal 급여, d.dname 부서명 from emp e join dept d on e.deptno = d.deptno and e.sal >= 2000 order by e.sal desc; -- 3.부서 테이블과 사원 테이블에서 사번, 사원명, 업무, 급여 , 부서명을 검색하시오. -- 단, 업무가 Manager이며 급여가 2500 이상인 사원에 대하여 사번을 기준으로 오름차순 정렬할 것. --oracle select e.empno 사번,e.ename 사원명, e.job 업무, e.sal 급여, d.dname 부서명 from emp e, dept d where e.deptno =d.deptno and e.sal >= 2500 and e.job='MANAGER' order by e.empno asc; --ansi select e.empno 사번,e.ename 사원명, e.job 업무, e.sal 급여, d.dname 부서명 from emp e join dept d on e.deptno =d.deptno and e.sal >= 2500 and e.job='MANAGER' order by e.empno asc; -- 4.사원 테이블과 급여 등급 테이블에서 사번, 사원명, 급여, 등급을 검색하시오. -- 단, 등급은 급여가 하한값과 상한값 범위에 포함되고 등급이 4이며 급여를 기준으로 내림차순정렬할 것. --oracle select e.empno 사번, e.ename 사원명, e.sal 급여, g.grade 등급 from emp e, salgrade g where e.sal >= g.losal and e.sal <= g.hisal and g.grade = 4 order by e.sal desc; --ansi select e.empno 사번, e.ename 사원명, e.sal 급여, g.grade 등급 from emp e join salgrade g on e.sal >= g.losal and e.sal <= g.hisal and g.grade = 4 order by e.sal desc; -- 5.부서 테이블, 사원 테이블, 급여등급 테이블에서 사번, 사원명, 부서명, 급여 , 등급을 검색하시오. -- 단, 등급은 급여가 하한값과 상한값 범위에 포함되며 등급을 기준으로 내림차순 정렬할 것. --oracle select e.empno 사번, e.ename 사원명, d.dname 부서명, e.sal 급여, g.grade 등급 from emp e, dept d, salgrade g where e.deptno=d.deptno and e.sal >= g.losal and e.sal <= g.hisal order by e.sal desc; --ansi select e.empno 사번, e.ename 사원명, d.dname 부서명, e.sal 급여, g.grade 등급 from emp e join dept d on e.deptno=d.deptno join salgrade g on e.sal >= g.losal and e.sal <= g.hisal order by e.sal desc; -- 6.사원 테이블에서 사원명과 해당 사원의 관리자명을 검색하시오. --oracle select e.ename 사원명, m.ename 관리자명 from emp e, emp m where e.mgr = m.empno; --ansi select e.ename 사원명, m.ename 관리자명 from emp e join emp m on e.mgr = m.empno; -- 7.사원 테이블에서 사원명, 해당 사원의 관리자명, 해당 사원의 관리자의 관리자명을 검색하시오. --oracle select e.ename 사원명, m1.ename 관리자명, m2.ename 관리자의관리자명 from emp e, emp m1, emp m2 where e.mgr = m1.empno and m1.mgr = m2.empno; --ansi select e.ename 사원명, m1.ename 관리자명, m2.ename 관리자의관리자명 from emp e join emp m1 on e.mgr = m1.empno join emp m2 on m1.mgr = m2.empno; -- 8.7번 결과에서 상위 관리자가 없는 모든 사원의 이름도 사원명에 출력되도록 수정하시오. --oracle select e.ename 사원명, m1.ename 관리자명, m2.ename 관리자의관리자명 from emp e, emp m1, emp m2 where e.mgr = m1.empno(+) and m1.mgr = m2.empno(+); --ansi select e.ename 사원명, m1.ename 관리자명, m2.ename 관리자의관리자명 from emp e left outer join emp m1 on e.mgr = m1.empno left outer join emp m2 on m1.mgr = m2.empno;
--清除所有表 select 'drop table '||TABLE_NAME ||';' from INFORMATION_SCHEMA.TABLES t where t.TABLE_CATALOG ='TEST' and t.TABLE_SCHEMA = 'PUBLIC';
DELIMITER $$ CREATE OR REPLACE PROCEDURE `add_to_cart`(`email` VARCHAR (100) ,`product_id` int(10),`quantity` int(10)) BEGIN DECLARE id int; set AUTOCOMMIT = 0; SELECT customer_id into id from Customer where Customer.email=email; INSERT INTO `Cart` (`customer_id`,`product_id`,`quantity`) VALUES (id,product_id,quantity); commit; END$$ DELIMITER $$ CREATE OR REPLACE PROCEDURE `create_order`(`email` VARCHAR (100) ,`route_id` int(10),`address` varchar(1000)) BEGIN DECLARE id int; set AUTOCOMMIT = 0; SELECT customer_id into id from Customer where Customer.email=email; INSERT INTO `Order` (`customer_id`,`route_id`,`state`,`date_and_time_of_placement`,`delivery_address`,`price`,`capacity`) VALUES (id,route_id,'Not Assigned',now(),address,quant_price(email),quant_capacity(email)); INSERT INTO `Order_Addition` (order_id,product_id,quantity) SELECT get_max_order_id(id),Cart.product_id,Cart.quantity from `Cart`where Cart.customer_id=id; DELETE from `Cart` where customer_id=id; commit; END$$ -- get list of orders corresponding to his store DELIMITER // CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `view_orders`(email VARCHAR(100)) BEGIN select * from `order` join `route` using (route_id) natural left outer join `order_schedule` where store_id in (select `store_id` from store_manager where `email` = email); END // -- check user existense and if exist return pw and type DELIMITER // CREATE OR REPLACE PROCEDURE User( IN email VARCHAR(100)) BEGIN IF EXISTS (SELECT user.email FROM user WHERE user.email = email) THEN SELECT password,type FROM user WHERE user.email = email; ELSE SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'No such User in the database'; END IF; END // DELIMITER $$ CREATE OR REPLACE PROCEDURE getMenu() BEGIN SELECT * FROM Product; END $$ DELIMITER $$ CREATE OR REPLACE PROCEDURE getcart(email VARCHAR (100)) BEGIN SELECT Cart.product_id, Product.product_name, Product.unit_price, Cart.quantity FROM Cart LEFT JOIN Product on Product.product_id= Cart.product_id where Cart.customer_id in (select customer_id from Customer where Customer.email=email); END $$ DELIMITER $$ CREATE OR REPLACE PROCEDURE totalPrice(email VARCHAR (100)) BEGIN select sum(Product.unit_price*Cart.quantity) as total_price from Cart left join Product on Cart.product_id=Product.product_id where Cart.customer_id in (select customer_id from Customer where Customer.email=email); END $$ DELIMITER $$ CREATE OR REPLACE PROCEDURE removeCartItem(email VARCHAR (100),product int(10)) BEGIN DELETE FROM Cart where Cart.customer_id in (select customer_id from Customer where Customer.email=email) and Cart.product_id= product LIMIT 1; END $$ DELIMITER $$ CREATE OR REPLACE PROCEDURE getRoutes() BEGIN SELECT route_id,route_name FROM `Route`;END $$ DELIMITER $$ CREATE OR REPLACE PROCEDURE getcustomer_order_report() BEGIN SELECT Order.state,Order.order_id,Order.customer_id,substring(Order.date_and_time_of_placement,1,10) as date_of_placement,Order.route_id,Order.price,order.capacity,Order_Addition.product_id,Order_Addition.quantity FROM `Order`,`Order_Addition` where Order.order_id=Order_Addition.order_id ORDER BY Order.state;END $$ DELIMITER $$ CREATE OR REPLACE PROCEDURE items_with_most_orders() BEGIN SELECT Product.product_name,Order_Addition.product_id,count(Order_Addition.product_id) as number_of_orders from Product,Order_Addition WHERE Product.product_id=Order_Addition.product_id group by Order_Addition.product_id ORDER by number_of_orders desc limit 10;END $$ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `assignOrders`(IN `id` INT(10), IN `train_name` VARCHAR(30), IN `time_schedule` DATETIME) BEGIN INSERT INTO order_assign VALUES(id,train_name,time_schedule); UPDATE `order` set state='Assigned to Train' WHERE order_id=id; UPDATE railway_schedule SET available_capacity = available_capacity - (SELECT capacity FROM `order` WHERE order_id = id) WHERE `railway_schedule`.`train_name` = train_name AND `railway_schedule`.`time_schedule` = time_schedule; END$$ DELIMITER ; DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `viewOrdersList`() DETERMINISTIC BEGIN SELECT order_id, route_id, date_and_time_of_placement, delivery_address, state FROM `order`; END$$ DELIMITER ; DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `viewTrain`() DETERMINISTIC BEGIN SELECT * FROM `railway_schedule`; END$$ DELIMITER ; DELIMITER $$ CREATE OR REPLACE PROCEDURE get_confirmed_orders(email VARCHAR (100)) BEGIN select `Order`.order_id, substring(Order.date_and_time_of_placement,1,10) as date_of_placement,substring(Order.date_and_time_of_placement,12,8) as time_of_placement, Order.route_id,Order.price,Product.product_name,Order_Addition.quantity FROM `Order` left join Order_Addition using(order_id) left join Product using(product_id) where Order.customer_id in (select Customer.customer_id from Customer where Customer.email=email) ORDER BY date_of_placement desc,time_of_placement desc; END $$ DELIMITER ; DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `viewQuarterlySalesReport`() DETERMINISTIC BEGIN CREATE OR REPLACE VIEW quarterly_sales_report AS (select `product`.`product_id` AS `product_id`,`product`.`product_name` AS `product_name`, (`order_addition`.`quantity`*`product`.`unit_price`) AS `total`,QUARTER(`order`.`date_and_time_of_placement`) AS `date_and_time_of_placement`,`product`.`unit_price` AS `unit_price` from ((`product` natural join `order_addition`) natural join `order`)); CREATE OR REPLACE VIEW `quarter_sales` AS (select `quarterly_sales_report`.`product_id` AS `product_id`, `quarterly_sales_report`.`product_name` AS `product_name`,sum(`quarterly_sales_report`.`total`) AS `sales`,`quarterly_sales_report`.`date_and_time_of_placement` AS `quarter` from `quarterly_sales_report` group by `quarterly_sales_report`.`product_id`,`quarterly_sales_report`.`date_and_time_of_placement`); CREATE OR REPLACE VIEW quarter1 AS SELECT * FROM quarter_sales WHERE quarter = 1; CREATE OR REPLACE VIEW quarter2 AS SELECT * FROM quarter_sales WHERE quarter = 2; CREATE OR REPLACE VIEW quarter3 AS SELECT * FROM quarter_sales WHERE quarter = 3; CREATE OR REPLACE VIEW quarter4 AS SELECT * FROM quarter_sales WHERE quarter = 4; SELECT DISTINCT qurater_sales.product_id,qurater_sales.product_name,IFNULL(quarter1.sales,0) AS quarter1 ,IFNULL(quarter2.sales,0) AS quarter2, IFNULL(quarter3.sales,0) AS quarter3, IFNULL(quarter4.sales,0) AS quarter4 FROM qurater_sales LEFT JOIN quarter1 USING (product_id) LEFT JOIN quarter2 USING (product_id) LEFT JOIN quarter3 USING (product_id) LEFT JOIN quarter4 USING (product_id); END$$ DELIMITER ;
CREATE TABLE PUBLIC.host_info ( id SERIAL NOT NULL, hostname varchar NOT NULL, cpu_number INT2 NOT NULL, cpu_architecture VARCHAR NOT NULL, cpu_model VARCHAR NOT NULL, cpu_mhz FLOAT8 NOT NULL, l2_cache INT4 NOT NULL, "timestamp" TIMESTAMP NOT NULL, total_mem INT4 NULL, CONSTRAINT HOST_INFO_PK primary key (id), CONSTRAINT host_info_un UNIQUE(hostname) ); CREATE TABLE PUBLIC.host_usage ( "timestamp" TIMESTAMP NOT NULL, host_id SERIAL NOT NULL, memory_free INT4 NOT NULL, cpu_idel INT2 NOT NULL, cpu_kernel INT2 NOT NULL, disk_io INT4 NOT NULL, disk_available INT4 NOT NULL, CONSTRAINT host_usage_host_info_fk FOREIGN KEY(host_id) REFERENCES host_info(id) );
SELECT count(c.`uuid`) AS size FROM `clients` c WHERE c.`user` = ?;
CREATE Procedure Spr_Purchase_Batch_Movement (@Manufacturer nvarchar(255), @Hierarchy nvarchar(255), @Category nvarchar(255), @ProductCode nvarchar(255), @ProductName nvarchar(255), @BatchNumber nvarchar(255), @FromDate DateTime, @ToDate DateTime) As Create Table #tempCategory(CategoryID Int, Status Int) Exec GetLeafCategories @Hierarchy, @Category Select Distinct CategoryID InTo #temcat From #tempCategory Select i.Product_Code, "Item Code" = i.Product_Code, "Item Name" = i.ProductName, "Tot Qty" = IsNull([Purchase], 0) - IsNull([Purchase Return], 0), "UOM1" = Case When IsNull(i.UOM1, 0) < 1 or IsNull(i.UOM1_Conversion, 0) < 1 Then ' ' Else Cast(((IsNull([Purchase], 0) - IsNull([Purchase Return], 0)) / i.UOM1_Conversion) As nvarchar) + ' ' + (Select UOM.[Description] From Items, UOM Where UOM1 = UOM.UOM And Product_Code = i.Product_code) End, "UOM2" = Case When IsNull(i.UOM2, 0) < 1 or IsNull(i.UOM2_Conversion, 0) < 1 Then ' ' Else Cast(((IsNull([Purchase], 0) - IsNull([Purchase Return], 0)) / i.UOM2_Conversion) As nvarchar) + ' ' + (Select UOM.[Description] From Items, UOM Where UOM2 = UOM.UOM And Product_Code = i.Product_code)End, "Reporting Unit" = Case When IsNull(i.ReportingUOM, 0) < 1 or IsNull(i.ReportingUnit, 0) < 1 Then ' ' Else Cast( ((IsNull([Purchase], 0) - IsNull([Purchase Return], 0)) / i.ReportingUnit) As nvarchar) + ' ' + (Select UOM.[Description] From Items, UOM Where ReportingUOM = UOM.UOM And Product_Code = i.Product_code) End, "Conversion Factor" = Case When IsNull(i.ConversionFactor, 0) < 1 or IsNull(i.ConversionUnit, 0) < 1 Then ' ' Else Cast(((IsNull([Purchase], 0) - IsNull([Purchase Return], 0)) * i.ConversionFactor) As nvarchar) + ' ' + (Select ConversionTable.ConversionUnit From Items, ConversionTable Where Items.ConversionUnit = ConversionID And Product_Code = i.Product_Code) End, "Count Of GRN" = (Select Count(GRNAbstract.GRNID) From GRNAbstract, GRNDetail Where GRNAbstract.GRNID = GRNDetail.GRNID And Product_Code = i.Product_Code And GRNDate Between @FromDate And @ToDate) From ( Select "Item Code" = i.Product_Code, "Purchase" = (Select Sum(IsNull(QuantityReceived, 0) + IsNull(FreeQty ,0)) From GRNAbstract, GRNDetail Where GRNAbstract.GRNID = GRNDetail.GRNID And GRNDate Between @FromDate And @ToDate And Product_code = i.Product_Code And IsNull(GRNStatus, 0) & 96 = 0), "Purchase Return" = (Select Sum(IsNull(Quantity, 0)) From AdjustmentReturnAbstract, AdjustmentReturnDetail Where AdjustmentReturnAbstract.AdjustmentID = AdjustmentReturnDetail.AdjustmentID And AdjustmentDate Between @FromDate And @ToDate And Product_code = i.Product_Code And IsNull(Status, 0) & 192 = 0) From Items i, Batch_Products bp Where i.Product_Code = bp.Product_Code And i.Product_Code Like @ProductCode And ProductName Like @ProductName And bp.Batch_Number Like @BatchNumber Group By i.Product_Code) qty, Items i, Manufacturer ma, #temcat Where qty.[Item Code] = i.Product_Code And i.ManufacturerID = ma.ManufacturerID And i.CategoryID = #temcat.CategoryID And ma.Manufacturer_Name Like @Manufacturer Drop Table #tempCategory Drop Table #temcat
-- schema_ddl.sql @clears col cuser new_value Username noprint prompt prompt User to duplicate? : prompt set feed off term off select upper('&&1') cuser from dual; set feed on term on @clear_for_spool set linesize 1000 set long 10000 col sqlfile new_value sqlfile noprint col mydb noprint new_value mydb set term off select lower(name) mydb from v$database; set term on select '_gen_' || lower('&&Username') || '_' || '&&mydb' sqlfile from dual; -- dbms_metadata setup begin dbms_metadata.set_transform_param(dbms_metadata.session_transform,'PRETTY',TRUE); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SQLTERMINATOR',TRUE); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SEGMENT_ATTRIBUTES',TRUE); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'STORAGE', TRUE); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'TABLESPACE',TRUE); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SPECIFICATION',TRUE); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'BODY',TRUE); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'CONSTRAINTS',TRUE); end; / spool &&sqlfile..sql prompt set echo on prompt spool &&sqlfile..log select (case when ((select count(*) from dba_users where username = '&&Username') > 0) then dbms_metadata.get_ddl ('USER', '&&Username') else to_clob (' -- Note: User not found!') end ) Extracted_DDL from dual UNION ALL select (case when ((select count(*) from dba_ts_quotas where username = '&&Username') > 0) then dbms_metadata.get_granted_ddl( 'TABLESPACE_QUOTA', '&&Username') else to_clob (' -- Note: No TS Quotas found!') end ) from dual UNION ALL select (case when ((select count(*) from dba_role_privs where grantee = '&&Username') > 0) then dbms_metadata.get_granted_ddl ('ROLE_GRANT', '&&Username') else to_clob (' -- Note: No granted Roles found!') end ) from dual UNION ALL select (case when ((select count(*) from dba_sys_privs where grantee = '&&Username') > 0) then dbms_metadata.get_granted_ddl ('SYSTEM_GRANT', '&&Username') else to_clob (' -- Note: No System Privileges found!') end ) from dual UNION ALL select (case when ((select count(*) from dba_tab_privs where grantee = '&&Username') > 0) then dbms_metadata.get_granted_ddl ('OBJECT_GRANT', '&&Username') else to_clob (' -- Note: No Object Privileges found!') end ) from dual / prompt spool off prompt set echo off spool off @clears undef 1 prompt prompt =========================================================================== prompt == &&sqlfile..sql contains DDL for user &&username prompt =========================================================================== prompt undef 1
DROP TABLE EAADMIN.CONFIG_RECORD; ------------------------------------------------ -- DDL Statements for Table "EAADMIN "."CONFIG_RECORD" ------------------------------------------------ CREATE TABLE "EAADMIN "."CONFIG_RECORD" ( "ID" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +1 INCREMENT BY +1 MINVALUE +1 MAXVALUE +9223372036854775807 NO CYCLE CACHE 20 NO ORDER ) , "NAME" VARCHAR(255) NOT NULL, "SERIAL_NUMBER" VARCHAR(128), "SOFTWARE_LPAR_ID" BIGINT , "VCPU" INTEGER, "VMWARE_CLUSTER" VARCHAR(255), "VM_CAN_MIGRATE" SMALLINT, "HYPER_THREADING" SMALLINT, "BANK_ACCOUNT_ID" BIGINT NOT NULL, "COMPUTER_ID" VARCHAR(255) NOT NULL, "ACTION" VARCHAR(32) ) IN "SOFTWARELPAR" INDEX IN "INDEX1" ; -- DDL Statements for Indexes on Table "EAADMIN "."CONFIG_RECORD" CREATE UNIQUE INDEX "EAADMIN "."IF1CONFIGIDRECORD" ON "EAADMIN "."CONFIG_RECORD" ("BANK_ACCOUNT_ID" ASC, "COMPUTER_ID" ASC) COMPRESS NO ALLOW REVERSE SCANS; -- DDL Statements for Indexes on Table "EAADMIN "."CONFIG_RECORD" CREATE INDEX "EAADMIN "."IF2CONFIGIDRECORD" ON "EAADMIN "."CONFIG_RECORD" ("BANK_ACCOUNT_ID" ASC, "ACTION" ASC) COMPRESS NO ALLOW REVERSE SCANS; -- DDL Statements for Indexes on Table "EAADMIN "."CONFIG_RECORD" CREATE UNIQUE INDEX "EAADMIN "."IN01CFREIDPK" ON "EAADMIN "."CONFIG_RECORD" ("ID" ASC) COMPRESS NO ALLOW REVERSE SCANS; -- DDL Statements for Primary Key on Table "EAADMIN "."CONFIG_RECORD" ALTER TABLE "EAADMIN "."CONFIG_RECORD" ADD CONSTRAINT "CT01CFREIDPK" PRIMARY KEY ("ID"); -- DDL Statements for unique constraint on Table "EAADMIN "."CONFIG_RECORD" ALTER TABLE "EAADMIN "."CONFIG_RECORD" ADD CONSTRAINT "UNI01CFREIDPK" UNIQUE(COMPUTER_ID, BANK_ACCOUNT_ID); -- DDL Statements for Aliases based on Table "EAADMIN "."CONFIG_RECORD" CREATE ALIAS "STAGING "."CONFIG_RECORD" FOR TABLE "EAADMIN "."CONFIG_RECORD"; -------------------------------------------- -- Authorization Statements on Tables/Views -------------------------------------------- GRANT DELETE ON TABLE "EAADMIN "."CONFIG_RECORD" TO USER "EAADMIN " ; GRANT INSERT ON TABLE "EAADMIN "."CONFIG_RECORD" TO USER "EAADMIN " ; GRANT SELECT ON TABLE "EAADMIN "."CONFIG_RECORD" TO USER "EAADMIN " ; GRANT UPDATE ON TABLE "EAADMIN "."CONFIG_RECORD" TO USER "EAADMIN " ;
CREATE OR REPLACE PROCEDURE wxhp_obj_backup AS v date:=sysdate; BEGIN delete from wxh_OBJ_BACKUP where version < v - 100; INSERT INTO wxh_OBJ_BACKUP (Owner, NAME, TYPE, Status, Sts, Line, Text, Version, Viewtext) SELECT u.name AS owner ,o.name ,decode(o.type#, 7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE', 11, 'PACKAGE BODY', 12, 'TRIGGER', 13, 'TYPE', 14, 'TYPE BODY', 'UNDEFINED') AS TYPE ,o.status ,decode(o.status, 0, 'N/A', 1, 'VALID', 'INVALID') AS STS ,s.line ,s.source TEXT ,v ,NULL FROM sys.obj$ o, sys.source$ s, sys.user$ u WHERE o.obj# = s.obj# AND o.owner# = u.user# AND u.user# = SYS_CONTEXT('USERENV', 'CURRENT_USERID') --=SYS_CONTEXT('USERENV','CURRENT_USER') current_user, --SYS_CONTEXT('USERENV','CURRENT_USERID') current_userid AND (o.type# IN (7, 8, 9, 11, 12, 14) OR (o.type# = 13 AND o.subname IS NULL)) AND o.name NOT LIKE 'ZK\_%' ESCAPE '\' AND o.name NOT LIKE 'ZHANGKE\_%' ESCAPE '\' AND o.name NOT LIKE 'WP\_%' ESCAPE '\' AND o.name NOT LIKE 'DW%' AND o.name NOT LIKE 'CJY\_%' ESCAPE '\' AND o.name NOT LIKE 'INSERT\_%' ESCAPE '\' AND o.name NOT LIKE 'JSON%' AND o.name NOT LIKE 'GETHZPY%' ORDER BY o.name, s.line, s.source; DBMS_OUTPUT.PUT_LINE('insertes=' || SQL%ROWCOUNT || ' from dba_source'); --v:=sysdate; INSERT INTO wxh_OBJ_BACKUP (Owner, NAME, TYPE, Line, Version, Viewtext) SELECT u.name AS owner, o.name, 'VIEW', v.textlength ³€ΆΘ, v, to_lob(v.text) FROM sys.obj$ o, sys.view$ v, sys.user$ u, sys.typed_view$ t WHERE o.obj# = v.obj# AND o.obj# = t.obj#(+) AND o.owner# = u.user# AND u.user# = SYS_CONTEXT('USERENV', 'CURRENT_USERID'); DBMS_OUTPUT.PUT_LINE('insertes=' || SQL%ROWCOUNT || ' from sys.view$'); COMMIT; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(SQLERRM); ROLLBACK; END; /
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jan 19, 2021 at 06:55 PM -- Server version: 10.4.17-MariaDB -- PHP Version: 8.0.0 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: `lab_fuu` -- -- -------------------------------------------------------- -- -- Table structure for table `home` -- CREATE TABLE `home` ( `homepage_no` int(11) NOT NULL, `file_name` varchar(99) NOT NULL, `manager_name` varchar(50) NOT NULL, `status` varchar(10) DEFAULT 'pending', `time` datetime DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `home` -- INSERT INTO `home` (`homepage_no`, `file_name`, `manager_name`, `status`, `time`) VALUES (4, 'Chicken 2, Burger 1 ', 'naim', 'complete', '2021-01-13 01:37:19'), (5, 'Pizza 1 ', 'naim', 'pending', '2021-01-13 09:48:48'), (7, 'Khichuri 1', 'rasedul', 'pending', '2021-01-19 12:58:54'), (8, 'Burger', 'rasedul', 'complete', '2021-01-19 23:46:39'), (9, 'French Fries', 'rasedul', 'pending', '2021-01-19 23:46:39'), (10, 'Tea', 'rasedul', 'pending', '2021-01-19 23:46:39'), (11, 'Fried Rice', 'naim', 'pending', '2021-01-19 23:48:18'), (12, 'Duck Platter', 'naim', 'rejected', '2021-01-19 23:48:18'); -- -------------------------------------------------------- -- -- Table structure for table `login` -- CREATE TABLE `login` ( `login_no` int(11) NOT NULL, `name` varchar(50) NOT NULL, `email` varchar(100) NOT NULL, `phone` varchar(16) DEFAULT NULL, `password` varchar(32) NOT NULL, `position` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `login` -- INSERT INTO `login` (`login_no`, `name`, `email`, `phone`, `password`, `position`) VALUES (1, 'rasedul', 'a@a.co', '8801735', '81dc9bdb52d04dc20036dbd8313ed055', 'admin'), (2, 'naim', 'n@n.com', '01525', 'e2fc714c4727ee9395f324cd2e7f331f', 'manager'), (5, 'rs', 'r@s.co', '01712345', 'e2fc714c4727ee9395f324cd2e7f331f', 'chef'), (7, 'sr', 'rasedulsaju@live.com', '017357', 'e2fc714c4727ee9395f324cd2e7f331f', 'manager'); -- -------------------------------------------------------- -- -- Table structure for table `raw_material` -- CREATE TABLE `raw_material` ( `raw_no` int(11) NOT NULL, `market_name` varchar(250) NOT NULL, `cost` int(10) NOT NULL, `market_time` datetime DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `raw_material` -- INSERT INTO `raw_material` (`raw_no`, `market_name`, `cost`, `market_time`) VALUES (1, 'Tomato', 150, '2021-01-19 23:47:38'), (2, 'Cheese', 50, '2021-01-19 23:47:38'), (3, 'Baan', 50, '2021-01-19 23:47:38'); -- -- Indexes for dumped tables -- -- -- Indexes for table `home` -- ALTER TABLE `home` ADD PRIMARY KEY (`homepage_no`); -- -- Indexes for table `login` -- ALTER TABLE `login` ADD PRIMARY KEY (`login_no`), ADD UNIQUE KEY `name` (`name`), ADD UNIQUE KEY `email` (`email`); -- -- Indexes for table `raw_material` -- ALTER TABLE `raw_material` ADD PRIMARY KEY (`raw_no`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `home` -- ALTER TABLE `home` MODIFY `homepage_no` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `login` -- ALTER TABLE `login` MODIFY `login_no` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `raw_material` -- ALTER TABLE `raw_material` MODIFY `raw_no` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
select 'glacier' as type, '100m' as distance, contourlines.elev, ST_Intersection(contourlines.wkb_geometry, planet_osm_polygon.way) as geom from contourlines, planet_osm_polygon where planet_osm_polygon.natural in ('glacier') and mod(cast(contourlines.elev as integer), 100) = 0 and ST_Intersects(planet_osm_polygon.way, contourlines.wkb_geometry)
-- CREATE OR ALTER FUNCTION uDefFunc.GetProductByYear( -- @model_year INT -- ) -- RETURNS TABLE AS -- RETURN -- SELECT -- product_name, -- list_price -- FROM -- production.products -- WHERE -- model_year = @model_year -- ; -- SELECT * -- FROM uDefFunc.GetProductByYear(2018) -- ;
CREATE TABLE Product ( ProductId VARCHAR(8) NOT NULL, ModelId VARCHAR(20), Price DECIMAL(5,2), CONSTRAINT pk_product PRIMARY KEY (ProductId,ModelId), CONSTRAINT fk_product_type FOREIGN KEY (ProductId) REFERENCES ProductType );
/*!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 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE TABLE `categories` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `parent_id` bigint unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `categories_parent_id_foreign` (`parent_id`), CONSTRAINT `categories_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE `migrations` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE `products` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `harga` int unsigned NOT NULL DEFAULT '0', `user_id` bigint unsigned NOT NULL, PRIMARY KEY (`id`), KEY `products_user_id_foreign` (`user_id`), CONSTRAINT `products_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE `users` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `uid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; INSERT INTO `categories` (`id`, `name`, `parent_id`) VALUES (1, 'Umum', NULL); INSERT INTO `categories` (`id`, `name`, `parent_id`) VALUES (2, 'Handphone dan Aksesoris', NULL); INSERT INTO `categories` (`id`, `name`, `parent_id`) VALUES (3, 'Baju dan Aksesoris', NULL); INSERT INTO `categories` (`id`, `name`, `parent_id`) VALUES (4, 'Makanan dan Minuman', NULL), (5, 'Motor', NULL), (6, 'Aksesoris', 2), (7, 'Casing', 2), (8, 'Samsung', 2), (9, 'Kering', 4), (10, 'Basah', 5), (11, 'Honda', 5), (12, 'Yamaha', 5), (13, 'Suzuki', 5), (14, 'Fashion Pria', 3), (15, 'Fashion Wanita', 3); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (13, '2020_12_27_054830_create_users_table', 1); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (14, '2020_12_27_055056_create_products_table', 1); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (15, '2020_12_27_055925_add_relationship_fields_to_products_table', 1); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (16, '2020_12_27_064909_create_categories_table', 1), (17, '2020_12_27_065256_add_relationship_fields_to_categories_table', 1); INSERT INTO `products` (`id`, `name`, `harga`, `user_id`) VALUES (1, 'Bakso aci telur puyuh', 95000, 1); INSERT INTO `products` (`id`, `name`, `harga`, `user_id`) VALUES (2, 'Es Teler', 34000, 2); INSERT INTO `products` (`id`, `name`, `harga`, `user_id`) VALUES (3, 'Rice bowl ayam suwir scrambl', 12000, 3); INSERT INTO `products` (`id`, `name`, `harga`, `user_id`) VALUES (4, 'Puding Strawberry', 19000, 4), (5, 'roti korea', 50000, 5), (6, 'RED Jelly', 13000, 6), (7, 'Biji Salak', 35000, 7), (8, 'Huawei', 23000, 8), (9, 'soto', 15000, 9), (10, 'Ciki', 25000, 10), (11, 'Donken frozen', 24000, 11), (12, 'Bebek goreng', 35000, 12), (13, 'Pudding Strawberry', 55000, 13), (14, 'Iphone 7', 60000, 14), (15, 'Seprei Home Made Anti Luntur', 85000, 15); INSERT INTO `users` (`id`, `uid`, `email`) VALUES (1, 'USEM000000001', 'John Stone'); INSERT INTO `users` (`id`, `uid`, `email`) VALUES (2, 'USEM000000002', 'Ponnappa Priya'); INSERT INTO `users` (`id`, `uid`, `email`) VALUES (3, 'USEM000000003', 'Mia Wong'); INSERT INTO `users` (`id`, `uid`, `email`) VALUES (4, 'USEM000000004', 'Peter Stanbridge'), (5, 'USEM000000005', 'Natalie Lee-Walsh'), (6, 'USEM000000006', 'Ang Li'), (7, 'USEM000000007', 'Nguta Ithya'), (8, 'USEM000000008', 'Tamzyn French'), (9, 'USEM000000009', 'Salome Simoes'), (10, 'USEM0000000010', 'Trevor Virtue'), (11, 'USEM0000000011', 'Tarryn Campbell-Gillies'), (12, 'USEM0000000012', 'Eugenia Anders'), (13, 'USEM0000000013', 'Andrew Kazantzis'), (14, 'USEM0000000014', 'Verona Blair'), (15, 'USEM0000000015', 'Jane Meldrum'); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
create table viewings ( id bigint not null auto_increment primary key, user_id bigint not null, show_id bigint not null, episode_id bigint not null, updated_at DATETIME not null, timecode int not null, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, FOREIGN KEY (show_id) REFERENCES shows(id) ON DELETE CASCADE, FOREIGN KEY (episode_id) REFERENCES episodes(id) ON DELETE CASCADE )
CREATE DEFINER=`administrator`@`localhost` FUNCTION `is_active`(DID INT) RETURNS tinyint(1) BEGIN -- Check if deal is active, returning 1 if true or 0 if false. -- Select Deal Type then check if active based on whether deal is recurring or limited. SELECT bdv.deal_type into @type FROM business_deals_view bdv WHERE bdv.deal_id = DID LIMIT 1; SET @is_active = 0; IF @type = 'Recurring' THEN SET @weekday = DAYNAME(CURRENT_DATE()); SELECT bdv.deal_start_time, bdv.deal_end_time into @start, @end FROM business_deals_view bdv WHERE bdv.deal_id = DID AND bdv.deal_weekday = @weekday; IF (CURRENT_TIME() BETWEEN @start and @end) THEN SET @is_active = 1; ELSE SET @is_active = 0; END IF; ELSEIF @type = 'Limited' THEN SET @is_active = 0; SELECT bdv.deal_start_date, bdv.deal_end_date into @startDate, @endDate FROM business_deals_view bdv WHERE bdv.deal_id = DID; IF (CURRENT_TIMESTAMP() BETWEEN @startDate and @endDate) THEN SET @is_active = 1; ELSE SET @is_active = 0; END IF; ELSE SET @is_active = 0; END IF; RETURN @is_active; END
CREATE TABLE configuration ( key STRING UNIQUE NOT NULL, value STRING NOT NULL); CREATE TABLE workers ( worker_id INTEGER PRIMARY KEY ASC, host_port STRING NOT NULL); CREATE TABLE alive_workers ( worker_id INTEGER PRIMARY KEY ASC REFERENCES workers(worker_id)); CREATE TABLE masters ( master_id INTEGER PRIMARY KEY ASC, host_port STRING NOT NULL); CREATE TABLE relations ( user_name STRING NOT NULL, program_name STRING NOT NULL, relation_name STRING NOT NULL, PRIMARY KEY (user_name,program_name,relation_name)); CREATE TABLE relation_schema ( user_name STRING NOT NULL, program_name STRING NOT NULL, relation_name STRING NOT NULL, col_index INTEGER NOT NULL, col_name STRING, col_type STRING NOT NULL, FOREIGN KEY (user_name,program_name,relation_name) REFERENCES relations); CREATE TABLE stored_relations ( stored_relation_id INTEGER PRIMARY KEY ASC, user_name STRING NOT NULL, program_name STRING NOT NULL, relation_name STRING NOT NULL, num_shards INTEGER NOT NULL, how_partitioned STRING NOT NULL, FOREIGN KEY (user_name,program_name,relation_name) REFERENCES relations); CREATE TABLE shards ( stored_relation_id INTEGER NOT NULL REFERENCES stored_relations(stored_relation_id), shard_index INTEGER NOT NULL, worker_id INTEGER NOT NULL REFERENCES workers(worker_id)); CREATE TABLE queries ( query_id INTEGER NOT NULL PRIMARY KEY ASC, raw_query TEXT NOT NULL, logical_ra TEXT NOT NULL);
{{ config( materialized='incremental', unique_key='c_custkey', tags=['rpt', 'dim'] ) }} select c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment, n_name, r_name from {{ ref('stg_customers') }}
--begin addby daijiy 2016-8-12 增加ic卡报班路单打印数据源 @repeat{SELECT count(*) FROM printtemplatetypeitem where id = 337041490} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (337041490, 6, '发车日期', '2', 'departdate', 0); --end @repeat{SELECT count(*) FROM Digitaldictionary where id = 6100} insert into Digitaldictionary (ID, NAME, DESCRIBE, TABLENAME, COLUMNNAME, ISCANEDIT, UPDATETIME, UPDATEBY, ISCANADD) values (6100, '检票日志中检票类型', '0:条码检票、1:全检、2:补检、3:混检、4:连检、5:实名制检票、6:条码实名制检票。其中直接扫描票号进行检票的记录为0,直接刷身份证或输入证件号检票的记录为5,先扫描票号查询出车票和证件信息的记录为6', 'checkticketlog', 'checktype', 0, sysdate, 1158013, 0); @repeat{SELECT count(*) FROM Digitaldictionary where id = 6101} insert into Digitaldictionary (ID, NAME, DESCRIBE, TABLENAME, COLUMNNAME, ISCANEDIT, UPDATETIME, UPDATEBY, ISCANADD) values (6101, '检票日志中操作类型', '0:检票,1退检。', 'checkticketlog', 'operationtype', 0, sysdate, 1158013, 0); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090522} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090522, 6101, 0, '0', '检票', '', sysdate, 1158013, sysdate, 1158013); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090523} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090523, 6101, 1, '1', '退检', '', sysdate, 1158013, sysdate, 1158013); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090515} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090515, 6100, 0, '0', '条码检票', '', sysdate, 1158013, sysdate, 1158013); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090516} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090516, 6100, 1, '1', '全检', '', sysdate, 1158013, sysdate, 1158013); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090517} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090517, 6100, 2, '2', '补检', '', sysdate, 1158013, sysdate, 1158013); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090518} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090518, 6100, 3, '3', '混检', '', sysdate, 1158013, sysdate, 1158013); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090519} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090519, 6100, 4, '4', '连检', '', sysdate, 1158013, sysdate, 1158013); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090520} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090520, 6100, 5, '5', '实名制检票', '', sysdate, 1158013, sysdate, 1158013); @repeat{SELECT count(*) FROM Digitaldictionarydetail where id = 63090521} insert into Digitaldictionarydetail (ID, DIGITALDICTIONARYID, ORDERNO, CODE, VALUE, DESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (63090521, 6100, 6, '6', '条码实名制检票', '', sysdate, 1158013, sysdate, 1158013); --begin 孙越 2016年8月18日 14:12:38 插入菜单 -- @repeat{SELECT count(*) FROM functionreg where id = 16081801} insert into functionreg (ID, PACKAGENAME, NAME, FUNCTIONKEY, FUNCTIONDESCRIBE, PARAMETERDESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY, INSTRUCTION) values (16081801, 'QryCheckLog.bpl', '检票日志查询', '{4FEDACCB-2F4F-4C7A-A1E7-B1EFE14D6AA2}', '检票日志查询', '', sysdate, 0,sysdate, 0, ''); @repeat{SELECT count(*) FROM menu where id = 16081801} insert into menu (ID, NAME, FUNCTIONREGID, GRADE, ORDERNO, PARENTID, PARAMETER, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY, CLICKNUM, CLAZZ, URL, ICON, SYSTYPE, MENUTYPE) values (16081801, '检票日志查询', 16081801, 2, 8.99, 9, null, sysdate, 0,sysdate, 0, 0, null, null, null, '0', '1'); --end-- --begin 孙越 2016年8月19日 14:50 添加参数6021 -- @repeat{SELECT count(*) FROM parameter where code = '6021'} insert into parameter (id,type,code,value,isvisible,iseditable,remark,updatetime,updateby,unit) values(16081901,'60','6021','0',1,1,'安检合格通知单打印模板,0安检合格通知单模板,1包含安检项目明细的固定模板,默认为0',sysdate,0,'是否'); --end-- --begin 赵明亮2016年9月5日 将资金结算中的修改进行分配权限 @repeat{SELECT count(*) FROM functionpermissionreg where PERMISSIONKEY='{F0727407-582C-4ED7-885A-64ADBF3226FE}'} insert into functionpermissionreg (ID, FUNCTIONREGID, PERMISSIONNAME, PERMISSIONKEY, PERMISSIONDESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values ('145332', '59', '修改', '{F0727407-582C-4ED7-885A-64ADBF3226FE}', '修改', sysdate, 0,sysdate, 0); --end --begin zhaohh 2016-09-04 打印结算单时是否打印车票明细 @repeat{SELECT count(*) FROM parameter where code = '3088'} insert into parameter (ID, TYPE, CODE, VALUE, ISVISIBLE, ISEDITABLE, REMARK, UPDATETIME, UPDATEBY, UNIT) values (3088, '30', '3088', '0', 1, 1, '打印结算单时是否打印车票明细,0不打印(即模板打印),1打印(即AcReport打印);默认为0', SYSDATE, 0, '是否'); --end zhaohh 2016-09-04 打印结算单时是否打印车票明细 --begin孙越 2016年9月5日 14:43:51 补脚本 @repeat{SELECT count(*) FROM digitaldictionary where id= 4 } insert into digitaldictionary (ID, NAME, DESCRIBE, TABLENAME, COLUMNNAME, ISCANEDIT, UPDATETIME, UPDATEBY) values (4, '打印模板类型项目数据类型', '打印模板类型项目数据类型,如:项目数据类型(0普通、1数值、2日期、3纯数字)', 'printtemplatetypeitem', 'itemtype', 0, to_date('21-02-2011 10:37:01', 'dd-mm-yyyy hh24:mi:ss'), 1031532); --end -- --begin 增加参数3039 by maxiao @repeat{SELECT count(*) FROM parameter where code = '3039'} insert into parameter (ID, TYPE, CODE, VALUE, ISVISIBLE, ISEDITABLE, REMARK, UPDATETIME, UPDATEBY, UNIT) values (3039, '30', '3039', '0', 1, 1, '综合检票中,发班前是否验证驾驶员身份,0不验证,1验证,默认0', sysdate, 0, '是否'); --end --begin 马潇 2016年8月30日14:29:51 --增加ic卡报班权限控制 @repeat{SELECT count(*) FROM functionpermissionreg where id = 229} insert into functionpermissionreg (ID, FUNCTIONREGID, PERMISSIONNAME, PERMISSIONKEY, PERMISSIONDESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (229, 53, '手动输入驾驶证号', '{52A064A5-6232-41CE-A850-6DFE0DACE25C}', '报班时,是否可手动输入驾驶证号进行报班', sysdate, 0,sysdate, 0); --增加参数2046 @repeat{SELECT count(*) FROM parameter where id = 2046} insert into parameter (ID, TYPE, CODE, VALUE, ISVISIBLE, ISEDITABLE, REMARK, UPDATETIME, UPDATEBY, UNIT) values (2046, '00', '2046', '0', 1, 1, '脱班的定义,0车辆当天有营运计划但未发班,1车辆过发车时间未报班,默认为0', sysdate, 0, '是否'); --增加参数2047 @repeat{SELECT count(*) FROM parameter where id = 2047} insert into parameter (ID, TYPE, CODE, VALUE, ISVISIBLE, ISEDITABLE, REMARK, UPDATETIME, UPDATEBY, UNIT) values (2047, '00', '2047', '0', 1, 1, '晚点的定义,0车辆过发车时间报班,1车辆过发车时间发班,默认为0', sysdate, 0, '是否'); --end --begin zhaohh 2016-09-08 结算单打印增加数据源 @repeat{SELECT count(*)-1 FROM parameter t where t.code = '3088'} update parameter t set t.remark = '打印结算单时是否打印车票明细,0不打印(即模板打印),1打印(即AcReport打印),2打印(结算单模板打印车票明细),默认为0', t.unit = '' where t.code = '3088'; @repeat{SELECT count(*) FROM printtemplatetypeitem where id = 90601} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (90601, 4, '车牌颜色', '0', 'vehiclecolor', 0); @repeat{SELECT count(*) FROM printtemplatetypeitem where id = 90602} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (90602, 4, '补票人数', '0', 'bupiaonum', 0); @repeat{SELECT count(*) FROM printtemplatetypeitem where id = 90701} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (90701, 4, '座号_明细', '0', 'seatno_detail', 1); @repeat{SELECT count(*) FROM printtemplatetypeitem where id = 90702} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (90702, 4, '票号_明细', '0', 'ticketno_detail', 1); @repeat{SELECT count(*) FROM printtemplatetypeitem where id = 90703} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (90703, 4, '到达站_明细', '0', 'reachstationname_detail', 1); @repeat{SELECT count(*) FROM printtemplatetypeitem where id = 90704} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (90704, 4, '票价_明细', '0', 'price_detail', 1); @repeat{SELECT count(*) FROM printtemplatetypeitem where id = 90705} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (90705, 4, '售票员_明细', '0', 'seller_detail', 1); --end zhaohh 2016-09-08 结算单打印增加数据源\ --begin jyr 2016-9-20 16:17:24 车票增加打印项所属区域 @repeat{SELECT count(*) FROM printtemplatetypeitem t where t.id = '2981641'} insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (2981641, 1, '所属区域', '0', 'departstationdis', 0); --end --begin 2016-09-20 zhaohuaihu 给Ticketsell增加顾客姓名等冗余字段的Job @repeat{SELECT COUNT(*) FROM jobconfig where id=822 } insert into jobconfig (ID, ORGID, JOBNAME, FULLCLASSNAME, PARAMETERS, INTERVALTYPE, INTERVALS, STARTTIME, ENDTIME, LASTRUNTIME, REMARKS, ISACTIVE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY, TYPE) values (822, 1158012, 'UpdateTicketsellJob', 'cn.nova.bus.job.UpdateTicketsellJob', 'null', 4, 1, '00:00', '23:59', to_date('2016-08-20','yyyy-mm-dd'), '给Ticketsell增加顾客姓名等冗余字段的Job', 1, sysdate, 0, sysdate, 0, 1); --end 2016-09-20 zhaohuaihu --增加结算通知单车属单位数据源 @repeat{SELECT COUNT(*) FROM printtemplatetypeitem where id=337042490 } insert into printtemplatetypeitem (ID, PRINTTEMPLATETYPEID, ITEMNAME, ITEMTYPE, ITEMCODE, ISLIST) values (337042490, 3, '车属单位全称', '0', 'vehicleunitname', 0); --end --begin 2016-09-21 zhaohuaihu 综合检票增加启用IC卡权限控制 @repeat{SELECT COUNT(*) FROM functionpermissionreg where id=6918 } insert into functionpermissionreg (ID, FUNCTIONREGID, PERMISSIONNAME, PERMISSIONKEY, PERMISSIONDESCRIBE, CREATETIME, CREATEBY, UPDATETIME, UPDATEBY) values (6918, 54, '综合检票启用IC卡', '{A1330B4C-BA8C-48AC-AA15-4CC4CBE40D36}', '综合检票启用IC卡权限控制', sysdate, 0, sysdate, 0); --end 2016-09-21 zhaohuaihu --begin 2016-09-21 zhaomingliang 增加参数1115,退票时能退N天前未检车票,0表示当天 @repeat{SELECT COUNT(*) from parameter WHERE ID=1115 } insert into parameter(ID,TYPE,code,value,isvisible,iseditable,remark,updatetime,updateby,unit) values(1115,'11','1115','0',1,1,'退票时能退N天前未检车票,0表示当天,N的值大于等于零',sysdate,0,'天'); --end --begin jyr 2016年9月22日15:03:01 0020参数改为可见 可编辑 @repeat{SELECT count(*)-1 FROM parameter t where t.code = '0020'} update parameter p set p.isvisible = 1 ,p.iseditable = 1 where p.code = '0020'; --end --BEGIN 遥路 票据类型的保险单改成保险票 2016年9月22日 update Billtype B set B.NAME='保险票' where B.Name = '保险单'; update Billtype B set B.PRINTNAME='保险票' where B.PRINTNAME = '保险单'; --END
DELETE FROM "special_movie" WHERE movie_id = ?;
-- Adminer 4.2.5 MySQL dump SET NAMES utf8; SET time_zone = '+00:00'; SET foreign_key_checks = 0; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; DROP TABLE IF EXISTS `chemin`; CREATE TABLE `chemin` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_dest_finale` int(11) NOT NULL, `id_lieu1` int(11) NOT NULL, `id_lieu2` int(11) NOT NULL, `id_lieu3` int(11) NOT NULL, `id_lieu4` int(11) NOT NULL, `id_lieu5` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `id_dest_finale` (`id_dest_finale`), KEY `id_lieu1` (`id_lieu1`), KEY `id_lieu2` (`id_lieu2`), KEY `id_lieu3` (`id_lieu3`), KEY `id_lieu4` (`id_lieu4`), KEY `id_lieu5` (`id_lieu5`), CONSTRAINT `chemin_ibfk_1` FOREIGN KEY (`id_dest_finale`) REFERENCES `lieu` (`id`), CONSTRAINT `chemin_ibfk_2` FOREIGN KEY (`id_lieu1`) REFERENCES `lieu` (`id`), CONSTRAINT `chemin_ibfk_3` FOREIGN KEY (`id_lieu2`) REFERENCES `lieu` (`id`), CONSTRAINT `chemin_ibfk_4` FOREIGN KEY (`id_lieu3`) REFERENCES `lieu` (`id`), CONSTRAINT `chemin_ibfk_5` FOREIGN KEY (`id_lieu4`) REFERENCES `lieu` (`id`), CONSTRAINT `chemin_ibfk_6` FOREIGN KEY (`id_lieu5`) REFERENCES `lieu` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `chemin` (`id`, `id_dest_finale`, `id_lieu1`, `id_lieu2`, `id_lieu3`, `id_lieu4`, `id_lieu5`) VALUES (87, 1, 2, 6, 5, 4, 3), (88, 1, 6, 4, 2, 5, 3), (89, 1, 1, 4, 6, 5, 2); DROP TABLE IF EXISTS `lieu`; CREATE TABLE `lieu` ( `nom_lieu` varchar(150) NOT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, `coord_x` float NOT NULL, `coord_y` float NOT NULL, `indication` varchar(150) NOT NULL, `description` varchar(200) NOT NULL, `image` varchar(200) NOT NULL, `indice1` varchar(150) NOT NULL, `indice2` varchar(150) NOT NULL, `indice3` varchar(150) NOT NULL, `indice4` varchar(150) NOT NULL, `indice5` varchar(150) NOT NULL, `dest_finale` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `lieu` (`nom_lieu`, `id`, `coord_x`, `coord_y`, `indication`, `description`, `image`, `indice1`, `indice2`, `indice3`, `indice4`, `indice5`, `dest_finale`) VALUES ('Paris', 1, 47.245, 2.654, 'test_indication', 'test_descr', '', 'test indice1', 'test indice 2', 'test indice 3', 'test indice 4', 'test indice 5', 1), ('Colmar', 2, 87, 122, 'azaz', 'lkn', '', 'lkn', 'nki', 'tdc', 'fty', 'rtcfg', 1), ('Strasbourg', 3, 87, 45, 'qsd', 'zer', '', 'zeg', 'ytj', 'ar', 'azr', 'tra', 1), ('Nancy', 4, 875, 561, 'kjb', 'kln', 'mlkn', 'igu', 'khjb', 'iug', 'rc', 'iuy', 0), ('Lyon', 5, 32, 97, 'dfvb', 'tghj', 'vbn', 'vbn', 'fgh', 'tyu', 'aze', 'xcv', 0), ('Marseille', 6, 875, 654, 'fgh', 'rty', 'dcvb', 'zert', 'efgh', 'xcvb', 'sdfg', 'rtgyh', 0); DROP TABLE IF EXISTS `partie`; CREATE TABLE `partie` ( `id` int(11) NOT NULL AUTO_INCREMENT, `token` varchar(255) NOT NULL, `distanceDF` float NOT NULL, `score` int(11) NOT NULL, `id_chemin` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `id_chemin` (`id_chemin`), CONSTRAINT `partie_ibfk_1` FOREIGN KEY (`id_chemin`) REFERENCES `chemin` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `partie` (`id`, `token`, `distanceDF`, `score`, `id_chemin`) VALUES (64, '6ogdeqt586mxjw8lg9rh9hcdjacfz6zw', 100, 0, 87), (65, '9vmnid8swmksczjjbfb5b4o1dtsc9s9a', 100, 0, 88), (66, 'ytu8ml2dgdu4qfqk3tr6jpqbp52mx9kv', 100, 0, 89); DROP TABLE IF EXISTS `utilisateur`; CREATE TABLE `utilisateur` ( `id_utilisateur` int(11) NOT NULL AUTO_INCREMENT, `nom` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `nv_droit` int(11) NOT NULL, PRIMARY KEY (`id_utilisateur`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- 2017-02-08 10:20:31
/* DESCRIPTION: 1. Fill spatial boundry NULLs in GEO_devdb through spatial join and create SPATIAL_devdb. Note that SPATIAL_devdb is the consolidated table for all spatial attributes _GEO_devdb -> GEO_devdb GEO_devdb --Spatial Joins--> SPATIAL_devdb INPUTS: GEO_devdb OUTPUTS: SPATIAL_devdb ( same schema as GEO_devdb ) */ DROP TABLE IF EXISTS DRAFT_spatial CASCADE; CREATE TABLE DRAFT_spatial AS ( SELECT distinct a.uid, -- geo_bbl (CASE WHEN a.geo_bbl IS NULL OR a.geo_bbl ~ '^0' OR a.geo_bbl = '' OR a.mode = 'tpad' THEN get_bbl(geom) ELSE a.geo_bbl END) as geo_bbl, -- geo_bin (CASE WHEN (CASE WHEN a.geo_bbl IS NULL OR a.geo_bbl ~ '^0' OR a.geo_bbl = '' OR a.mode = 'tpad' THEN get_bbl(geom) ELSE a.geo_bbl END) = get_base_bbl(geom) AND (a.geo_bin IS NULL OR a.geo_bin = '' OR a.geo_bin::NUMERIC%1000000=0) OR a.mode = 'tpad' AND get_base_bbl(geom) IS NOT NULL THEN get_bin(geom) ELSE a.geo_bin END) as geo_bin, a.geo_address_numbr, a.geo_address_street, a.geo_address, -- geo_zipcode (CASE WHEN a.geo_zipcode IS NULL OR a.geo_zipcode = '' OR a.mode = 'tpad' THEN get_zipcode(geom) ELSE a.geo_zipcode END) as geo_zipcode, -- geo_boro (CASE WHEN a.geo_boro IS NULL OR a.geo_boro = '0' OR a.mode = 'tpad' THEN get_boro(geom)::text ELSE a.geo_boro END) as geo_boro, -- geo_cb2010 (CASE WHEN a.geo_cb2010 IS NULL OR a.geo_cb2010 = '' OR a.geo_ct2010 = '000000' OR a.mode = 'tpad' THEN get_cb2010(geom) ELSE a.geo_cb2010 END) as _geo_cb2010, -- geo_ct2010 (CASE WHEN a.geo_ct2010 IS NULL OR a.geo_ct2010 = '' OR a.geo_ct2010 = '000000' OR a.mode = 'tpad' THEN get_ct2010(geom) ELSE a.geo_ct2010 END) as _geo_ct2010, -- geo_cb2010 (CASE WHEN a.geo_cb2020 IS NULL OR a.geo_cb2020 = '' OR a.geo_ct2020 = '000000' OR a.mode = 'tpad' THEN get_cb2020(geom) ELSE a.geo_cb2020 END) as _geo_cb2020, -- geo_ct2010 (CASE WHEN a.geo_ct2020 IS NULL OR a.geo_ct2020 = '' OR a.geo_ct2020 = '000000' OR a.mode = 'tpad' THEN get_ct2020(geom) ELSE a.geo_ct2020 END) as _geo_ct2020, -- geo_csd (CASE WHEN a.geo_csd IS NULL OR a.geo_csd = '' OR a.mode = 'tpad' THEN get_csd(geom) ELSE a.geo_csd END) as geo_csd, -- geo_cd (CASE WHEN a.geo_cd IS NULL OR a.geo_cd = '' OR a.mode = 'tpad' THEN get_cd(geom) ELSE a.geo_cd END) as geo_cd, -- geo_council (CASE WHEN a.geo_council IS NULL OR a.geo_council = '' OR a.mode = 'tpad' THEN get_council(geom) ELSE a.geo_council END) as geo_council, -- geo_policeprct (CASE WHEN a.geo_policeprct IS NULL OR a.geo_policeprct = '' OR a.mode = 'tpad' THEN get_policeprct(geom) ELSE a.geo_policeprct END) as geo_policeprct, -- geo_firedivision (CASE WHEN a.geo_firedivision IS NULL OR a.geo_firedivision = '' OR a.mode = 'tpad' THEN get_firedivision(geom) ELSE a.geo_firedivision END) as geo_firedivision, -- geo_firebattalion (CASE WHEN a.geo_firebattalion IS NULL OR a.geo_firebattalion = '' OR a.mode = 'tpad' THEN get_firebattalion(geom) ELSE a.geo_firebattalion END) as geo_firebattalion, -- geo_firecompany (CASE WHEN a.geo_firecompany IS NULL OR a.geo_firecompany = '' OR a.mode = 'tpad' THEN get_firecompany(geom) ELSE a.geo_firecompany END) as geo_firecompany, get_schoolelmntry(geom) as geo_schoolelmntry, get_schoolmiddle(geom) as geo_schoolmiddle, get_schoolsubdist(geom) as geo_schoolsubdist, a.geo_latitude, a.geo_longitude, a.latitude, a.longitude, a.geom, geomsource FROM GEO_devdb a ); DROP INDEX IF EXISTS DRAFT_spatial_uid_idx; CREATE INDEX DRAFT_spatial_uid_idx ON DRAFT_spatial(uid); DROP TABLE IF EXISTS CENSUS_TRACT_BLOCK CASCADE; CREATE TABLE CENSUS_TRACT_BLOCK AS ( SELECT distinct uid, (CASE WHEN DRAFT_spatial.geo_boro = '1' THEN '36061' WHEN DRAFT_spatial.geo_boro = '2' THEN '36005' WHEN DRAFT_spatial.geo_boro = '3' THEN '36047' WHEN DRAFT_spatial.geo_boro = '4' THEN '36081' WHEN DRAFT_spatial.geo_boro = '5' THEN '36085' END) as fips, geo_boro||_geo_ct2010||_geo_cb2010 as bctcb2010, geo_boro||_geo_ct2020||_geo_cb2020 as bctcb2020, geo_boro||_geo_ct2010 as bct2010, geo_boro||_geo_ct2020 as bct2020 FROM DRAFT_spatial ); DROP INDEX IF EXISTS CENSUS_TRACT_BLOCK_uid_idx; DROP INDEX IF EXISTS dcp_ct2020_boroct2020_idx; DROP INDEX IF EXISTS dcp_ct2010_boroct2010_idx; DROP INDEX IF EXISTS lookup_geo_bct2010_idx; CREATE INDEX CENSUS_TRACT_BLOCK_uid_idx ON CENSUS_TRACT_BLOCK(uid); CREATE INDEX dcp_ct2020_boroct2020_idx ON dcp_ct2020(boroct2020); CREATE INDEX dcp_ct2010_boroct2010_idx ON dcp_ct2010(boroct2010); CREATE INDEX lookup_geo_bct2010_idx ON lookup_geo(bct2010); DROP TABLE IF EXISTS SPATIAL_devdb; SELECT DRAFT_spatial.uid, DRAFT_spatial.geo_bbl, DRAFT_spatial.geo_bin, DRAFT_spatial.geo_address_numbr, DRAFT_spatial.geo_address_street, DRAFT_spatial.geo_address, DRAFT_spatial.geo_zipcode, DRAFT_spatial.geo_boro, DRAFT_spatial.geo_csd, DRAFT_spatial.geo_cd, DRAFT_spatial.geo_council, DRAFT_spatial.geo_policeprct, DRAFT_spatial.geo_firedivision, DRAFT_spatial.geo_firebattalion, DRAFT_spatial.geo_firecompany, DRAFT_spatial.geo_schoolelmntry, DRAFT_spatial.geo_schoolmiddle, DRAFT_spatial.geo_schoolsubdist, DRAFT_spatial.geo_latitude, DRAFT_spatial.geo_longitude, DRAFT_spatial.latitude, DRAFT_spatial.longitude, DRAFT_spatial.geom, DRAFT_spatial.geomsource, CENSUS_TRACT_BLOCK.fips||DRAFT_spatial._geo_ct2010||DRAFT_spatial._geo_cb2010 as geo_cb2010, CENSUS_TRACT_BLOCK.fips||DRAFT_spatial._geo_ct2010 as geo_ct2010, CENSUS_TRACT_BLOCK.bctcb2010, CENSUS_TRACT_BLOCK.bct2010, CENSUS_TRACT_BLOCK.fips||DRAFT_spatial._geo_ct2020||DRAFT_spatial._geo_cb2020 as geo_cb2020, CENSUS_TRACT_BLOCK.fips||DRAFT_spatial._geo_ct2020 as geo_ct2020, CENSUS_TRACT_BLOCK.bctcb2020, CENSUS_TRACT_BLOCK.bct2020, dcp_ct2010.ntacode as geo_nta2010, dcp_ct2010.ntaname as geo_ntaname2010, dcp_ct2020.nta2020 as geo_nta2020, dcp_ct2020.ntaname as geo_ntaname2020, dcp_ct2020.cdta2020 as geo_cdta2020, dcp_ct2020.cdtaname as geo_cdtaname2020 INTO SPATIAL_devdb FROM DRAFT_spatial LEFT JOIN CENSUS_TRACT_BLOCK ON DRAFT_spatial.uid = CENSUS_TRACT_BLOCK.uid LEFT JOIN dcp_ct2010 ON CENSUS_TRACT_BLOCK.bct2010 = boroct2010 LEFT JOIN dcp_ct2020 ON CENSUS_TRACT_BLOCK.bct2020 = boroct2020; DROP TABLE IF EXISTS DRAFT_spatial CASCADE; DROP TABLE IF EXISTS CENSUS_TRACT_BLOCK CASCADE;
create or replace procedure PROC_Complain_Relation_WO as /* i_count integer;*/ cursor c_records is select id, max(code) code, max(complain_wo_isover) complain_wo_isover, max(is_timeout) is_timeout, max(complain_woatt_isupload) complain_woatt_isupload, decode(sign(sum(case when ta_id is not null then 1 else 0 end)),1,'是','否') as baseinfo_work_change, decode(sign(sum(case when ne_id is not null then 1 else 0 end)),1,'是','否') as para_work_change, case when sign(sum(case when ne_id is not null then 1 else 0 end)) = 0 and sign(sum(case when ta_id is not null then 1 else 0 end)) = 0 then '否' else '是' end as work_change from (select distinct a.id, b.code, decode(b.wo_status, 4, '是', '否') as complain_wo_isover, case when b.wo_status in (60, 4, 2) and (b.wo_dispatch_datetime + b.finish_max_days - a.observate_days - nvl(woe2.run_begin_time, sysdate) >= 0) then '否' when b.wo_status not in (60, 4, 2) and (nvl(b.wo_dispatch_datetime, sysdate) + b.finish_max_days - a.observate_days - nvl(woe2.run_begin_time, sysdate) >= 0) then '否' else '是' end as is_timeout, decode(att.id, null, '否', '是') complain_woatt_isupload, ta.int_id ta_id , para.ne_id ne_id from tap_wo a left join tap_wo_baseinfo b on a.id = b.id left join tap_wo_event woe2 on b.flow_id = woe2.flow_id and woe2.event_name = 'Reply' left join tap_attachment att on b.id = att.related_id left join tap_audit ta on a.handle_ne_id = ta.related_id and auditstatus = '通过' and ta.audittime >= b.wo_dispatch_datetime - 15 and ta.audittime <= b.wo_dispatch_datetime + 15 left join c_para_modify para on a.handle_ne_id = para.ne_id and para.new_time >= b.wo_dispatch_datetime - 15 and para.new_time <= b.wo_dispatch_datetime + 15) GROUP BY id; begin delete from tap_wo_ne_change; commit; for c_row in c_records loop begin /* select count(1) into i_count from tap_wo_ne_change where id = c_row.id; */ /* update tap_wo_ne_change set code = c_row.code, complain_wo_isover = c_row.complain_wo_isover, is_timeout = c_row.is_timeout, complain_woatt_isupload = c_row.complain_woatt_isupload, baseinfo_work_change = c_row.baseinfo_work_change, para_work_change = c_row.para_work_change, work_change = c_row.para_work_change where id = c_row.id;*/ /* else*/ insert into tap_wo_ne_change (id, code, complain_wo_isover, is_timeout, complain_woatt_isupload, baseinfo_work_change, para_work_change, work_change) values (c_row.id, c_row.code, c_row.complain_wo_isover, c_row.is_timeout, c_row.complain_woatt_isupload, c_row.baseinfo_work_change, c_row.para_work_change, c_row.work_change); commit; /* exception when others then dbms_output.put_line('投诉归档数据更新失败');*/ /* end if;*/ end; end loop; end;
USE TSQL2012; /* ==CROSS JOINS== Consider an example from the TSQL2012 sample database. This database contains a table called dbo.Nums that has a column called n with a sequence of integers from 1 on. Your task is to use the Nums table to generate a result with a row for each weekday (1 through 7) and shift number (1 through 3), assuming there are three shifts a day. The result can later be used as the basis for building information about activities in the different shifts in the different days. With seven days in the week and three shifts every day, the result should have 21 rows.*/ SELECT WEEKDAYS.n AS WEEKDAY, SHIFTDAYS.n AS SHIFDAY FROM dbo.Nums AS WEEKDAYS CROSS JOIN dbo.Nums AS SHIFTDAYS WHERE WEEKDAYS.n <= 7 AND SHIFTDAYS.n <= 3 ORDER BY WEEKDAY, SHIFDAY; /* ==OUTER JOIN== As an example, the following query returns suppliers from Japan and the products they supply, including suppliers from Japan that donít have related products.*/ SELECT s.country+' '+s.companyname AS Supplier, p.productname AS ProductName FROM Production.Suppliers s LEFT JOIN Production.Products p ON p.supplierid = s.supplierid WHERE s.country = N'JAPAN' /* ==Multiply joins As an example, suppose that you wanted to return all suppliers from Japan, and matching products where relevant. For this, you need an outer join between Production.Suppliers and Production.Products, preserving Suppliers. But you also want to include product category information, so you add an inner join to Production.Categories,*/ SELECT s.country AS SupliersCountry, s.companyname AS Suplier, p.productname AS ProductName, p.unitprice AS Price, c.categoryname AS Category FROM Production.Suppliers s LEFT JOIN(Production.Products p JOIN Production.Categories c ON c.categoryid = p.categoryid) ON s.supplierid = p.supplierid WHERE s.country = N'Japan';
CREATE OR REPLACE FUNCTION compareTime ( first_c_id VARCHAR, first_c_id_no NUMBER, second_c_id VARCHAR, second_c_id_no NUMBER ) RETURN NUMBER IS overlap NUMBER; first_day NUMBER; second_day NUMBER; first_start_time NUMBER; first_end_time NUMBER; second_start_time NUMBER; second_end_time NUMBER; BEGIN SELECT c_day, c_stime, c_etime INTO first_day, first_start_time, first_end_time FROM teach WHERE first_c_id = c_id AND first_c_id_no = c_id_no; SELECT c_day, c_stime, c_etime INTO second_day, second_start_time, second_end_time FROM teach WHERE second_c_id = c_id AND second_c_id_no = c_id_no; overlap := 1; IF (first_day = second_day) THEN IF(first_start_time > second_start_time) THEN IF(first_start_time > second_end_time) THEN overlap := 0; ELSIF(first_start_time = second_end_time) THEN overlap := 0; END IF; END IF; IF(first_end_time < second_start_time) THEN IF(first_end_time < second_end_time) THEN overlap := 0; ELSIF(first_end_time = second_end_time) THEN overlap := 0; END IF; END IF; ELSE overlap := 0; END IF; COMMIT; RETURN overlap; END; /
DROP TABLE IF EXISTS corrections_reference; WITH applied AS ( SELECT a.job_number, a.field, a.old_value, a.new_value, a.reason, a.edited_date, a.editor, b.pre_corr_value, 1 as corr_applied FROM _manual_corrections a INNER JOIN corrections_applied b ON a.job_number = b.job_number AND a.field = b.field AND (a.old_value = b.old_value OR (a.old_value IS NULL AND b.old_value IS NULL)) AND (a.new_value = b.new_value OR (a.new_value IS NULL AND b.new_value IS NULL)) ), not_applied AS ( SELECT a.job_number, a.field, a.old_value, a.new_value, a.reason, a.edited_date, a.editor, b.pre_corr_value, 0 as corr_applied FROM _manual_corrections a INNER JOIN corrections_not_applied b ON a.job_number = b.job_number AND a.field = b.field AND (a.old_value = b.old_value OR (a.old_value IS NULL AND b.old_value IS NULL)) AND (a.new_value = b.new_value OR (a.new_value IS NULL AND b.new_value IS NULL)) ) SELECT NOW() as build_dt, a.job_number, a.field, a.old_value, a.new_value, a.reason, a.edited_date, a.editor, b.pre_corr_value, b.corr_applied, (a.job_number IN (SELECT job_number FROM FINAL_devdb))::integer as job_in_devdb INTO corrections_reference FROM _manual_corrections a LEFT JOIN (SELECT * FROM applied UNION SELECT * FROM not_applied) b ON a.job_number = b.job_number AND a.field = b.field AND (a.old_value = b.old_value OR (a.old_value IS NULL AND b.old_value IS NULL)) AND (a.new_value = b.new_value OR (a.new_value IS NULL AND b.new_value IS NULL)) ;
DROP TABLE IF EXISTS ClinicalImpressionFinding; DROP TABLE IF EXISTS ClinicalImpressionFinding_HT; DROP TABLE IF EXISTS ClinicalImpressionInvestigation; DROP TABLE IF EXISTS ClinicalImpressionInvestigation_HTItem; DROP TABLE IF EXISTS ClinicalImpressionInvestigation_HT; DROP TABLE IF EXISTS ClinicalImpressionNote; DROP TABLE IF EXISTS ClinicalImpressionSupportingInfo; DROP TABLE IF EXISTS ClinicalImpressionPrognosisReference; DROP TABLE IF EXISTS ClinicalImpressionPrognosisCodeableConcept; DROP TABLE IF EXISTS ClinicalImpressionProblem; DROP TABLE IF EXISTS ClinicalImpression;
insert into pais(id,nome,nascionalidade) values(1,'Brasil','Brasileiro');
USE psdb; SELECT * FROM psdb.employees WHERE psdb.employees.first_name="Yinghua" or first_name="Elvis";
With test_scores as( --Explore 2015 Select e.student_id, Cast('4/1/2015' as Date) as testdate, '2014-15' as ayear, 'Explore' as test, 'Composite' as subject, e."explore_2015_composite_scaleScore" as score From national_assessments.explore_2015_complocal e Union Select e.student_id, Cast('4/1/2015' as Date), '2014-15', 'Explore', 'English', e."explore_2015_english_scaleScore" From national_assessments.explore_2015_english e Union Select e.student_id, Cast('4/1/2015' as Date), '2014-15', 'Explore', 'Reading', e."explore_2015_reading_scaleScore" From national_assessments.explore_2015_reading e Union Select e.student_id, Cast('4/1/2015' as Date), '2014-15', 'Explore', 'Math', e."explore_2015_math_scaleScore" From national_assessments.explore_2015_math e Union Select e.student_id, Cast('4/1/2015' as Date), '2014-15', 'Explore', 'Science', e."explore_2015_sci_scaleScore" From national_assessments.explore_2015_sci e Union --Plan Select p.student_id, Cast('4/1/2015' as Date), '2014-15', 'Plan', 'Composite', p."plan_2015_composite_scaleScore" From national_assessments.plan_2015_complocal p Union Select p.student_id, Cast('4/1/2015' as Date), '2014-15', 'Plan', 'English', p."plan_2015_english_scaleScore" From national_assessments.plan_2015_english p Union Select p.student_id, Cast('4/1/2015' as Date), '2014-15', 'Plan', 'Reading', p."plan_2015_reading_scaleScore" From national_assessments.plan_2015_reading p Union Select p.student_id, Cast('4/1/2015' as Date), '2014-15', 'Plan', 'Math', p."plan_2015_math_scaleScore" From national_assessments.plan_2015_math p Union Select p.student_id, Cast('4/1/2015' as Date), '2014-15', 'Plan', 'Science', p."plan_2015_sci_scaleScore" From national_assessments.plan_2015_sci p Union --ACT 2015 Select act_15.student_id, Cast('4/1/2015' as Date) as testdate, '2014-15' as ayear, 'ACT' as test, 'Composite' as Subject, act_15."act_2015_composite_scaleScore" as Score From national_assessments.act_2015_scores act_15 Union Select act_15.student_id, Cast('4/1/2015' as Date) as testdate, '2014-15' as ayear, 'ACT' as test, 'English' as Subject, act_15."act_2015_english_scaleScore" as Score From national_assessments.act_2015_scores act_15 Union Select act_15.student_id, Cast('4/1/2015' as Date) as testdate, '2014-15' as ayear, 'ACT' as test, 'Math' as Subject, act_15."act_2015_math_scaleScore" as Score From national_assessments.act_2015_scores act_15 Union Select act_15.student_id, Cast('4/1/2015' as Date) as testdate, '2014-15' as ayear, 'ACT' as test, 'Reading' as Subject, act_15."act_2015_reading_scaleScore" as Score From national_assessments.act_2015_scores act_15 Union Select act_15.student_id, Cast('4/1/2015' as Date) as testdate, '2014-15' as ayear, 'ACT' as test, 'Science' as Subject, act_15."act_2015_sci_scaleScore" as Score From national_assessments.act_2015_scores act_15 ) Select st.local_site_id, gl.short_name as grade, s.student_id, s.last_name||', '||s.first_name as student_name, ts.testdate, ts.ayear, ts.test, ts.subject, ts.score From test_scores ts Inner Join public.students s on s.student_id = ts.student_id Inner Join public.student_session_aff enr on enr.student_id = ts.student_id Inner Join grade_levels gl on gl.grade_level_id = enr.grade_level_id Inner Join public.sessions sesh on sesh.session_id = enr.session_id Inner Join public.sites st on st.site_id = sesh.site_id Where enr.entry_date <= ts.testdate and enr.leave_date >= ts.testdate
# Oefening 3 Oplossingen: # Toon de naam van de landen uit centraal Afrika waar de leeftijdsverwachting > 60 SELECT `Name` FROM `country` WHERE `Region` = "Central Africa" AND `LifeExpectancy` > 60 (1) # Toon de naam, district en populatie van alle steden uit Nederland waar de populatie >= 200000 SELECT `Name`, `District`, `Population` FROM `city` WHERE `CountryCode` = "NLD" AND `Population` >= 200000 (5) # Toon de naam en staatshoofd van alle landen waar de oppervlakte > 100000 of < 1000 SELECT `Name`, `HeadOfState` FROM `country` WHERE `SurfaceArea` > 100000 OR `SurfaceArea` < 1000 (163) # Toon de unieke districten van alle steden die beginnen met de letter a en waar de populatie < 200000 of > 500000 SELECT DISTINCT `District` FROM `city` WHERE `Name` LIKE 'a%' AND (`Population` < 200000 OR `Population` > 500000) (148) SELECT DISTINCT `District` FROM `city` WHERE `Name` LIKE 'a%' AND `Population` NOT BETWEEN 200000 AND 500000 (148) # Toon de naam en district van alle steden uit Zimbabwe waar de populatie kleiner is dan 100000 # Eerst in tabel Country de code zoeken: SELECT * FROM `country` WHERE `Name` = "Zimbabwe" # nu weten we dat de code ZWE is van Zimbabwe SELECT `Name`,`District` FROM `city` WHERE `CountryCode` = "ZWE" AND `Population` < 100000 (0) # Toon de naam van alle steden met landcode gelijk aan DSA, ASM, AND of AGO en waar de populatie tussen 100000 en 200000 ligt SELECT `Name` FROM `city` WHERE `CountryCode` IN ("DSA","ASM","AND","AGO") AND `Population` BETWEEN 100000 AND 200000 (4) # Toon de naam van alle steden waar de landcode niet gelijk is aan NLD en waar de populatie < 100000 of > 1000000 SELECT `Name` FROM `city` WHERE `CountryCode` <> "NLD" AND (`Population` < 100000 OR `Population` > 1000000) (751) SELECT `Name` FROM `city` WHERE `CountryCode` != "NLD" AND `Population` NOT BETWEEN 100000 AND 1000000 (751) # Toon de naam en populatie van alle steden waar de landcode gelijk is ARM, BGR, COG of DNK en waar het district de letter f bevat SELECT `Name`,`Population` FROM `city` WHERE `CountryCode` IN ("ARM","BGR","COG","DNK") AND `District` LIKE "%f%" (3) # Toon de naam van alle steden waar de letter a niet in voorkomt SELECT `Name` FROM `city` WHERE `Name` NOT LIKE "%a%" (1,044) # Toon de naam van alle landen die beginnen met de letter f en waar de onafhankelijkheid vóór 1945 is gevierd SELECT `Name` FROM `country` WHERE `Name` LIKE "f%" AND `IndepYear` < 1945 (2) # Toon de naam van alle talen die niet eindigen met de letter n SELECT `Language` FROM `countrylanguage` WHERE `Language` NOT LIKE "%n" (811) # Toon de naam van alle steden waar de landcode niet gelijk is USA, # waar het district niet de letter e bevat en waar de populatie > 200000 SELECT `Name` FROM `city` WHERE `CountryCode` <> "USA" AND `District` NOT LIKE "%e%" AND `Population` > 200000 (928)
create table hibernate_sequence ( next_val bigint null ) engine = MyISAM; INSERT INTO immo.hibernate_sequence (next_val) VALUES (6); create table File ( id bigint auto_increment primary key, date datetime null, path varchar(255) null ) engine = MyISAM; create table Address ( id bigint auto_increment primary key, city varchar(255) null, country varchar(255) null, street varchar(255) null, zipCode varchar(255) null ) engine = MyISAM; INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (1, 'Düsseldorf', 'Deutschland', 'Maxmustermannstraße.1', '40627'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (2, 'Düsseldorf', 'Deutschland', 'Maxmustermannstraße.1', '40627'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (3, '', '', '', ''); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (4, '', '', '', ''); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (5, 'Düsseldorf', 'Deutschland', 'Maxmustermannstraße.1', '40627'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (6, 'Düsseldorf', 'Deutschland', 'Maxmustermannstraße.1', '40627'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (7, 'Düsseldorf', 'Deutschland', 'Rheinstraße. 666', '40112'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (8, 'Düsseldorf', 'Deutschland', 'Teststraße.1', '46289'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (9, 'Düsseldorf', 'Deutschland', 'Aachener Str.5', '40223'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (10, 'Düsseldorf', 'Deutschland', 'Aachener Str.6', '40223'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (11, 'Düsseldorf', 'Deutschland', 'Aachener Str.5', '40223'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (12, 'Düsseldorf', 'Deutschland', 'Aachener Str.5', '40223'); INSERT INTO immo.Address (id, city, country, street, zipCode) VALUES (13, 'Düsseldorf', 'Deutschland', 'Aachener Str.7', '40223'); create table BankAccount ( id bigint auto_increment primary key, accountOwner varchar(255) null, bic varchar(255) null, creditInstitution varchar(255) null, iban varchar(255) null ) engine = MyISAM; INSERT INTO immo.BankAccount (id, accountOwner, bic, creditInstitution, iban) VALUES (1, 'Max Mustermann', 'COBADEFFXXX', 'Commerzbank AG', 'DE1234'); INSERT INTO immo.BankAccount (id, accountOwner, bic, creditInstitution, iban) VALUES (2, 'Musterfrau Muster', 'DUSSDEDD', 'Stadtsparkasse Düsseldorf', 'DE4321'); INSERT INTO immo.BankAccount (id, accountOwner, bic, creditInstitution, iban) VALUES (3, 'Gustav Günther', 'GUDEXXX', 'Gustav Bank', 'DE124332'); create table Role ( id bigint auto_increment primary key, roleType int null ) engine = MyISAM; INSERT INTO immo.Role (id, roleType) VALUES (1, 1); INSERT INTO immo.Role (id, roleType) VALUES (2, 0); create table Person ( id bigint not null primary key, email varchar(255) null, firstName varchar(255) null, lastName varchar(255) null, phoneNumberLandline varchar(255) null, phoneNumberMobile varchar(255) null, title varchar(255) null, address_id bigint null ) engine = MyISAM; create index FK6i7nduc8blbwp1dbfwavvnvvx on Person (address_id); create table User ( id bigint not null primary key, email varchar(255) null, firstName varchar(255) null, lastName varchar(255) null, phoneNumberLandline varchar(255) null, phoneNumberMobile varchar(255) null, title varchar(255) null, address_id bigint null, password varchar(255) null, username varchar(255) null, role_id bigint null ) engine = MyISAM; create index FK84qlpfci484r1luck11eno6ec on User (role_id); create index FK_25yqck53dyy0k1q261ncjxmw3 on User (address_id); INSERT INTO immo.User (id, email, firstName, lastName, phoneNumberLandline, phoneNumberMobile, title, address_id, password, username, role_id) VALUES (2, 'user.user@user.com', 'User', 'user', '+49User', 'User', 'User', null, 'user', 'User', 1); INSERT INTO immo.User (id, email, firstName, lastName, phoneNumberLandline, phoneNumberMobile, title, address_id, password, username, role_id) VALUES (4, 'mitarbeiter.mitarbeit@immo.de', 'Mitarbeiter', 'Mitarbeit', '+49Immo', '+49Privat', 'Herr', null, 'mitarbeit', 'Mitarbeiter', 1); create table Document ( id bigint auto_increment primary key, fileName varchar(255) null ) engine = MyISAM; INSERT INTO immo.Document (id, fileName) VALUES (1, 'Gustav Günther Auszugserklärung'); create table Document_File ( Document_id bigint not null, versionList_id bigint not null, constraint UK_3x31803b93a17816i2r0pa170 unique (versionList_id) ) engine = MyISAM; create index FKovhhmkiwom3r89x9x8on1dgnk on Document_File (Document_id); create table Tenant ( id bigint not null primary key, email varchar(255) null, firstName varchar(255) null, lastName varchar(255) null, phoneNumberLandline varchar(255) null, phoneNumberMobile varchar(255) null, title varchar(255) null, address_id bigint null, contactOnly bit not null, getTenancyEnd datetime null, tenancyStart datetime null, bankAccount_id bigint null, oldAddress_id bigint null ) engine = MyISAM; create index FK56mntgb3onaq95mjyf20x2a6a on Tenant (oldAddress_id); create index FK_oyfy3aayoot36euwatubtlmff on Tenant (address_id); create index FKfo8vajj4w70k0wmneywhxbuhu on Tenant (bankAccount_id); INSERT INTO immo.Tenant (id, email, firstName, lastName, phoneNumberLandline, phoneNumberMobile, title, address_id, contactOnly, getTenancyEnd, tenancyStart, bankAccount_id, oldAddress_id) VALUES (1, 'max.mustermann@gmx.de', 'Max', 'Mustermann', '+49123456789', '+49987654321', 'Herr', null, false, '2019-06-08 00:00:00', '2018-06-16 00:00:00', 1, 4); INSERT INTO immo.Tenant (id, email, firstName, lastName, phoneNumberLandline, phoneNumberMobile, title, address_id, contactOnly, getTenancyEnd, tenancyStart, bankAccount_id, oldAddress_id) VALUES (3, 'musterfrau.muster@gmx.de', 'Musterfrau', 'Muster', '+4900000000', '+4099999999', 'Frau', null, false, '2021-06-20 00:00:00', '2018-06-16 00:00:00', 2, 6); INSERT INTO immo.Tenant (id, email, firstName, lastName, phoneNumberLandline, phoneNumberMobile, title, address_id, contactOnly, getTenancyEnd, tenancyStart, bankAccount_id, oldAddress_id) VALUES (5, 'gustav.günther@webmail.de', 'Gustav', 'Günther', '+4900000000', '+4999999999', 'Herr', null, false, '2026-06-21 00:00:00', '2008-06-06 00:00:00', 3, null); create table RentalObject ( id bigint auto_increment primary key, additionalCosts int not null, commercial bit not null, livingSpace int not null, notes varchar(255) null, objectDescription varchar(255) null, objectNumber varchar(255) null, rentalType int null, squareMeterPrice int not null, address_id bigint null, tenant_id bigint null ) engine = MyISAM; create index FK5beroxdt5yeqkp28qw433wqp4 on RentalObject (address_id); create index FK6s7f9icxuqp2fmcl3to9om793 on RentalObject (tenant_id); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (1, 300, false, 45, 'Immobilie in der Düsseldorfer Innenstadt', 'Schöne Lage in der Düsseldorfer Stadt', '1', 0, 16, 1, 1); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (2, 5, false, 20, '', 'Parkplatz für Objekt Nummer 1', '2', 2, 20, 5, 1); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (3, 400, false, 86, null, 'Schönes Objekt in der Nähe von der Rheinstraße', '3', 0, 20, 7, 3); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (4, 23, true, 45, 'Immobilie in der Düsseldorfer Innenstadt', 'Kommerzielle Fläche für Großunternehmen', '5', 1, 34, 8, null); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (5, 534, false, 45, 'Immobilie in der Düsseldorfer Innenstadt', 'Erdgeschoss Wohnung in Bilk', '6', 0, 16, 9, 5); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (6, 235, false, 45, 'Immobilie in der Düsseldorfer Innenstadt', 'Schöne Lage in der Düsseldorfer Stadt', '7', 0, 16, 10, 5); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (7, 71, false, 45, 'Immobilie in der Düsseldorfer Innenstadt', 'Schöne Lage in der Düsseldorfer Stadt', '8', 0, 16, 11, 5); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (8, 123, false, 45, 'Immobilie in der Düsseldorfer Innenstadt', 'Wohnung im Dachgeschoss am Rande von Düsseldorf', '9', 0, 16, 12, null); INSERT INTO immo.RentalObject (id, additionalCosts, commercial, livingSpace, notes, objectDescription, objectNumber, rentalType, squareMeterPrice, address_id, tenant_id) VALUES (9, 22, false, 45, 'Immobilie in der Düsseldorfer Innenstadt', 'Schöne Lage in der Düsseldorfer Stadt', '10', 0, 16, 13, null); create table Document_RentalObject ( Document_id bigint not null, relatedRentalObjects_id bigint not null ) engine = MyISAM; create index FK3haew52wx6ervvi695p8ygknh on Document_RentalObject (relatedRentalObjects_id); create index FKiehapewit51a19liwfw2h3wkx on Document_RentalObject (Document_id); INSERT INTO immo.Document_RentalObject (Document_id, relatedRentalObjects_id) VALUES (1, 5); INSERT INTO immo.Document_RentalObject (Document_id, relatedRentalObjects_id) VALUES (1, 6); INSERT INTO immo.Document_RentalObject (Document_id, relatedRentalObjects_id) VALUES (1, 7); create table Document_Tenant ( Document_id bigint not null, relatedTenants_id bigint not null ) engine = MyISAM; create index FK35js249p80691osob7so26x87 on Document_Tenant (relatedTenants_id); create index FKcl36bmr7iq9r56q3dsgm0i0j5 on Document_Tenant (Document_id); INSERT INTO immo.Document_Tenant (Document_id, relatedTenants_id) VALUES (1, 5); create table RentalObject_Document ( RentalObject_id bigint not null, documents_id bigint not null ) engine = MyISAM; create index FK7602q9xom9pw8jy413f7vkmx0 on RentalObject_Document (RentalObject_id); create index FKq4pj33j5i7d1wwa22ywix2bnj on RentalObject_Document (documents_id); INSERT INTO immo.RentalObject_Document (RentalObject_id, documents_id) VALUES (6, 1); INSERT INTO immo.RentalObject_Document (RentalObject_id, documents_id) VALUES (5, 1); INSERT INTO immo.RentalObject_Document (RentalObject_id, documents_id) VALUES (7, 1); create table RentalObject_RentalObject ( RentalObject_id bigint not null, subObjects_id bigint not null, constraint UK_p4kox6fyrelv47paxmb1lt7in unique (subObjects_id) ) engine = MyISAM; create table Tenant_Document ( Tenant_id bigint not null, documents_id bigint not null ) engine = MyISAM; create index FKgrw3x1idmty8ytvpsak7rjhv4 on Tenant_Document (documents_id); create index FKjomdsa05t9os3oc9kk6jd1ge1 on Tenant_Document (Tenant_id); INSERT INTO immo.Tenant_Document (Tenant_id, documents_id) VALUES (5, 1); create index FKg7jpniuw1py8b23rd4sejr15g on RentalObject_RentalObject (RentalObject_id); INSERT INTO immo.RentalObject_RentalObject (RentalObject_id, subObjects_id) VALUES (1, 2); create table RentalObject_Tenant ( RentalObject_id bigint not null, contacts_id bigint not null ) engine = MyISAM; create index FKc52elncdqobu9jmtw20k2m6kb on RentalObject_Tenant (contacts_id); create index FKt0vn6xypfqcym0a8apoq12e02 on RentalObject_Tenant (RentalObject_id); create table Invoice ( id bigint auto_increment primary key, date datetime null, settled bit not null, recipient_id bigint null ) engine = MyISAM; INSERT INTO immo.Invoice (id, date, settled, recipient_id) VALUES (1, '2021-06-11 00:00:00', false, 1); INSERT INTO immo.Invoice (id, date, settled, recipient_id) VALUES (2, '2021-06-11 00:00:00', false, 3); INSERT INTO immo.Invoice (id, date, settled, recipient_id) VALUES (3, '2021-06-11 00:00:00', false, 5); create table RentalObject_Invoice ( RentalObject_id bigint not null, invoices_id bigint not null, constraint UK_idhn1g6t7rhqwmfmu1l8loq40 unique (invoices_id) ) engine = MyISAM; create index FKeqs46cvgsv74a1x5g0rfg1e0f on RentalObject_Invoice (RentalObject_id); create table Item ( id bigint auto_increment primary key, comment varchar(255) null, value int not null ) engine = MyISAM; INSERT INTO immo.Item (id, comment, value) VALUES (1, 'Miete', 1020); INSERT INTO immo.Item (id, comment, value) VALUES (2, 'Miete Wohnung', 1020); INSERT INTO immo.Item (id, comment, value) VALUES (3, 'Miete Wohnung', 1020); INSERT INTO immo.Item (id, comment, value) VALUES (4, 'Miete Parkplatz', 405); INSERT INTO immo.Item (id, comment, value) VALUES (5, 'Miete Wohnung', 1200); INSERT INTO immo.Item (id, comment, value) VALUES (6, 'Miete Wohnung', 2120); INSERT INTO immo.Item (id, comment, value) VALUES (7, 'Miete Wohnung 1', 1429); INSERT INTO immo.Item (id, comment, value) VALUES (8, 'Miete Wohnung 2', 2153); INSERT INTO immo.Item (id, comment, value) VALUES (9, 'Miete Wohnung 3', 2233); create table Invoice_Item ( Invoice_id bigint not null, itemList_id bigint not null, constraint UK_px5ld0gfcdxwcwrthjv33on20 unique (itemList_id) ) engine = MyISAM; create index FKnb9y5vjcd7hnmqmawg7y04g8 on Invoice_Item (Invoice_id); INSERT INTO immo.Invoice_Item (Invoice_id, itemList_id) VALUES (1, 4); INSERT INTO immo.Invoice_Item (Invoice_id, itemList_id) VALUES (1, 2); INSERT INTO immo.Invoice_Item (Invoice_id, itemList_id) VALUES (2, 6); INSERT INTO immo.Invoice_Item (Invoice_id, itemList_id) VALUES (3, 8); INSERT INTO immo.Invoice_Item (Invoice_id, itemList_id) VALUES (3, 7); INSERT INTO immo.Invoice_Item (Invoice_id, itemList_id) VALUES (3, 9); create table PaymentReceived ( id bigint auto_increment primary key, amount int not null, date datetime null, rentalObject_id bigint null, tenant_id bigint null ) engine = MyISAM; create index FKbgqv49nfmphcg5lmxp79ofgme on PaymentReceived (tenant_id); create index FKjttigodpwtyj0uaf9aqgax7q2 on PaymentReceived (rentalObject_id); INSERT INTO immo.PaymentReceived (id, amount, date, rentalObject_id, tenant_id) VALUES (1, 1020, '2021-05-11 00:00:00', 1, 1); INSERT INTO immo.PaymentReceived (id, amount, date, rentalObject_id, tenant_id) VALUES (2, 405, '2021-05-11 00:00:00', 2, 1); INSERT INTO immo.PaymentReceived (id, amount, date, rentalObject_id, tenant_id) VALUES (3, 5000, '2021-04-11 00:00:00', 3, 3);
-- phpMyAdmin SQL Dump -- version 2.6.4-pl3 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jan 09, 2007 at 01:17 PM -- Server version: 5.0.15 -- PHP Version: 5.1.6 -- -- Database: `environments` -- -- -------------------------------------------------------- -- -- Table structure for table `application` -- CREATE TABLE `application` ( `APP_ID` int(11) NOT NULL auto_increment, `NAME` varchar(30) NOT NULL, PRIMARY KEY (`APP_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -- Dumping data for table `application` -- INSERT INTO `application` VALUES (1, 'TIERS App'); INSERT INTO `application` VALUES (2, 'Self Service Portal'); INSERT INTO `application` VALUES (3, 'State Portal'); INSERT INTO `application` VALUES (4, 'TIERS App (MRS)'); INSERT INTO `application` VALUES (5, 'TIERS Batch'); INSERT INTO `application` VALUES (6, 'MAXeIE'); INSERT INTO `application` VALUES (7, 'MAXeCHIP'); -- -------------------------------------------------------- -- -- Table structure for table `batch` -- CREATE TABLE `batch` ( `ENV_ID` int(11) NOT NULL, `BOX` varchar(10) NOT NULL, `PATH` varchar(15) NOT NULL, `MQ_ID` varchar(15) NOT NULL, `DB_ID` varchar(10) NOT NULL, `DATE_START` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `DATE_END` timestamp NULL default NULL, PRIMARY KEY (`BOX`,`PATH`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `batch` -- INSERT INTO `batch` VALUES (6, 'iedadu002', '/TIERS/AGING01', 'MIG_QM3', '218', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (7, 'iedadu002', '/TIERS/AGING02', 'TIERS.QM1', '219', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (4, 'iedadu002', '/TIERS/APT01', 'TIERS.QM15', '640', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (5, 'iedadu002', '/TIERS/APT02', 'TIERS.QM17', '630', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (8, 'iedadu004', '/TIERS/AGING03', 'TIERS.QM4', '229', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (1, 'iedadu004', '/TIERS/AST01', 'TIERS.QM6', '210', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (2, 'iedadu004', '/TIERS/AST02', 'TIERS.QM9', '240', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (3, 'iedadu004', '/TIERS/AST03', 'TIERS.QM10', '611', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (9, 'iedadu004', '/TIERS/MISC01', 'TIERS.QM2', '230', '2006-12-28 13:08:23', NULL); INSERT INTO `batch` VALUES (10, 'iedadu004', '/TIERS/MISC02', 'TIERS.QM3', '220', '2006-12-28 13:08:23', NULL); -- -------------------------------------------------------- -- -- Table structure for table `environment` -- CREATE TABLE `environment` ( `ENV_ID` int(11) NOT NULL auto_increment, `NAME` varchar(30) NOT NULL, PRIMARY KEY (`ENV_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ; -- -- Dumping data for table `environment` -- INSERT INTO `environment` VALUES (1, 'AST01'); INSERT INTO `environment` VALUES (2, 'AST02'); INSERT INTO `environment` VALUES (3, 'AST03'); INSERT INTO `environment` VALUES (4, 'APT01'); INSERT INTO `environment` VALUES (5, 'APT02'); INSERT INTO `environment` VALUES (6, 'AGING01'); INSERT INTO `environment` VALUES (7, 'AGING02'); INSERT INTO `environment` VALUES (8, 'AGING03'); INSERT INTO `environment` VALUES (9, 'MISC01'); INSERT INTO `environment` VALUES (10, 'MISC02'); INSERT INTO `environment` VALUES (11, 'IPT'); INSERT INTO `environment` VALUES (12, 'PROD FIX'); INSERT INTO `environment` VALUES (13, 'GENX'); INSERT INTO `environment` VALUES (15, 'CONV01'); INSERT INTO `environment` VALUES (16, 'CONV02'); INSERT INTO `environment` VALUES (17, 'COLA'); INSERT INTO `environment` VALUES (18, 'DAR'); INSERT INTO `environment` VALUES (19, 'PSR'); INSERT INTO `environment` VALUES (20, 'PERF TUNE'); INSERT INTO `environment` VALUES (21, 'PERF LAST'); -- -------------------------------------------------------- -- -- Table structure for table `mq` -- CREATE TABLE `mq` ( `MQ_ID` varchar(15) NOT NULL, `HOST` varchar(15) NOT NULL, `PORT` int(11) NOT NULL, `MGW` varchar(20) NOT NULL, `CHANNEL` varchar(20) NOT NULL, `DATE_START` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `DATE_END` timestamp NULL default NULL, PRIMARY KEY (`MQ_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `mq` -- INSERT INTO `mq` VALUES ('MIG_QM3', 'ietawu003', 1417, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM1', 'iedaau006', 1425, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM10', 'iedaau006', 1424, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM15', 'iedaau006', 1429, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM17', 'iedaau006', 1431, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM2', 'iedaau006', 1416, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM3', 'iedaau006', 1417, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM4 ', 'iedaau006', 1418, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM6', 'iedaau006', 1420, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); INSERT INTO `mq` VALUES ('TIERS.QM9', 'iedaau006', 1423, 'GATEWAYS.SVRCONN.CHL', 'TIERS.SVRCONN.CHL', '2006-11-20 00:00:00', NULL); -- -------------------------------------------------------- -- -- Table structure for table `ws_application` -- CREATE TABLE `ws_application` ( `ENV_ID` int(11) NOT NULL, `APP_ID` int(11) NOT NULL, `WS_APP_NAME` varchar(15) NOT NULL, `CLUSTER` varchar(15) NOT NULL, `WS_CELL_NAME` varchar(20) NOT NULL, `DNS` varchar(15) NOT NULL, `MQ_ID` varchar(15) NOT NULL, `DB_ID` varchar(10) NOT NULL, `DATE_START` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `DATE_END` timestamp NULL default NULL, PRIMARY KEY (`WS_APP_NAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ws_application` -- INSERT INTO `ws_application` VALUES (11, 0, 'stage3tiersIPT', 'ipt-cluster', 'tiers_ipt_Network', 'tiers-ipt', 'TIERS.QM2', '650', '2006-12-29 11:42:34', NULL); INSERT INTO `ws_application` VALUES (6, 0, 'tiersaging01', 'aging01-cluster', 'tiers_aging_Network', 'tiers-aging01', 'MIG_QM3', '218', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (7, 0, 'tiersaging02', 'aging02-cluster', 'tiers_aging_Network', 'tiers-aging02', 'TIERS.QM1', '219', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (8, 0, 'tiersaging03', 'aging03-cluster', 'tiers_aging_Network', 'tiers-aging03', 'TIERS.QM4', '229', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (4, 0, 'tiersapt01', 'apt01-cluster', 'tiers_apt_Network', 'tiers-apt01', 'TIERS.QM15', '230', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (5, 0, 'tiersapt02', 'apt02-cluster', 'tiers_apt_Network', 'tiers-apt02', 'TIERS.QM17', '220', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (1, 0, 'tiersast01', 'ast01-cluster', 'tiers_ast_Network', 'tiers-ast01', 'TIERS.QM6', '210', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (2, 0, 'tiersast02', 'ast02-cluster', 'tiers_ast_Network', 'tiers-ast02', 'TIERS.QM9', '240', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (3, 0, 'tiersast03', 'ast03-cluster', 'tiers_ast_Network', 'tiers-ast03', 'TIERS.QM10', '611', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (9, 0, 'tiersmisc01', 'misc01-cluster', 'tiers_misc_Network', 'tiers-misc01', 'TIERS.QM2', '630', '2006-12-28 13:07:40', NULL); INSERT INTO `ws_application` VALUES (10, 0, 'tiersmisc02', 'misc02-cluster', 'tiers_misc_Network', 'tiers-misc02', 'TIERS.QM3', '640', '2006-12-28 13:07:40', NULL); -- -------------------------------------------------------- -- -- Table structure for table `ws_appserver` -- CREATE TABLE `ws_appserver` ( `SERVER_NAME` varchar(20) NOT NULL, `NODE` varchar(9) NOT NULL, `PORT` int(11) NOT NULL, `WS_APP_NAME` varchar(15) NOT NULL, `DATE_START` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `DATE_END` timestamp NULL default NULL, PRIMARY KEY (`SERVER_NAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ws_appserver` -- INSERT INTO `ws_appserver` VALUES ('aging01-server2', 'iedaau002', 15414, 'tiersaging01', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('aging02-server2', 'iedaau002', 15428, 'tiersaging02', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('aging03-server2', 'iedaau002', 15421, 'tiersaging03', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('apt01-server2', 'iedaau002', 12514, 'tiersapt01', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('apt02-server2', 'iedaau002', 12528, 'tiersapt02', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('ast01-server2', 'iedaau002', 15514, 'tiersast01', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('ast02-server2', 'iedaau002', 15528, 'tiersast02', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('ast03-server2', 'iedaau002', 15542, 'tiersast03', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('ipt-server2', 'iedaau002', 10211, 'stage3tiersIPT', '2006-12-29 11:42:34', NULL); INSERT INTO `ws_appserver` VALUES ('misc01-server2', 'iedaau002', 15314, 'tiersmisc01', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('misc02-server2', 'iedaau002', 15328, 'tiersmisc02', '2006-12-05 13:08:03', NULL); INSERT INTO `ws_appserver` VALUES ('pf01-server2', 'iedaau002', 15414, 'tiersprodfix', '2007-01-02 16:02:04', NULL); INSERT INTO `ws_appserver` VALUES ('psrserver', 'psrnode', 666, 'psrapp', '2007-01-03 13:49:37', NULL); -- -------------------------------------------------------- -- -- Table structure for table `ws_cell` -- CREATE TABLE `ws_cell` ( `WS_CELL_NAME` varchar(30) NOT NULL, `ADMIN_HTTP` varchar(50) NOT NULL, PRIMARY KEY (`WS_CELL_NAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ws_cell` -- INSERT INTO `ws_cell` VALUES ('tiers_aging_Network', 'https://iedaau018:14204/admin/'); INSERT INTO `ws_cell` VALUES ('tiers_apt_Network', 'https://iedaau018:10504/admin/logon.jsp'); INSERT INTO `ws_cell` VALUES ('tiers_ast_Network', 'http://iedaau018:14503/admin/secure/logon.do'); INSERT INTO `ws_cell` VALUES ('tiers_conv_Network', 'http://iedaau018:14003/admin'); INSERT INTO `ws_cell` VALUES ('tiers_dar_Network', 'http://iedaau018:10903/admin'); INSERT INTO `ws_cell` VALUES ('tiers_dr_Network', 'http://iedaau018:10603/admin'); INSERT INTO `ws_cell` VALUES ('tiers_genx_Network', 'http://iedaau018:10803/admin'); INSERT INTO `ws_cell` VALUES ('tiers_ipt_Network', 'http://iedaau018:10203/admin'); INSERT INTO `ws_cell` VALUES ('tiers_last_Network', 'http://iedaau018:14103/admin'); INSERT INTO `ws_cell` VALUES ('tiers_misc_Network', 'http://iedaau018:14303/admin/'); INSERT INTO `ws_cell` VALUES ('tiers_prodfix_Network', 'http://iedaau018:10703/admin'); INSERT INTO `ws_cell` VALUES ('tiers_training_Network', 'http://ietsau001:11003/admin'); INSERT INTO `ws_cell` VALUES ('tiers_trainpractice_Network', 'http://ietsau001:11103/admin');
select distinct get_json_object(value,'$.type') from dw_mobdb.factmbtracelog_hybrid where d = '2018-06-06' --计算uv count(DISTINCT newvalue.data['env_clientcode']) AS visitNumber --操作搜索功能的用户 select a.d,count(DISTINCT newvalue.data['env_clientcode']) AS visitNumber from dw_mobdb.factmbtracelog_hybrid a where key in ('c_bnb_inn_searching_list_app','c_bnb_inn_searching_list_h5') and a.d >= '20180528' and a.d <= '20180612' group by a.d --点选的用户 select a.d,count(DISTINCT newvalue.data['env_clientcode']) AS visitNumber from dw_mobdb.factmbtracelog_hybrid a where key in ('c_bnb_inn_searching_list_app','c_bnb_inn_searching_list_h5') and get_json_object(value,'$.type') in ('product','businessZone','landMark','district') and a.d >= '20180528' and a.d <= '20180612' group by a.d --报表20180611_suggestion点击量统计报表_杨亚新 select a.d,a.type,a.uv,a.pv,a.uv/b.uv from (select 1 as t,d,get_json_object(value,'$.type') as type,count(DISTINCT newvalue.data['env_clientcode']) as uv,count(*) as pv from dw_mobdb.factmbtracelog_hybrid a where key in ('c_bnb_inn_searching_list_app') and get_json_object(value,'$.type') in ('product','businessZone','landMark','district','keywords','cancel') and a.d = '2018-06-12' group by 1,d,get_json_object(value,'$.type')) a inner join (select 1 as t,d,count(DISTINCT newvalue.data['env_clientcode']) AS uv from dw_mobdb.factmbtracelog_hybrid a where key in ('c_bnb_inn_searching_list_app') and d = '2018-06-12' group by 1,d) b on a.t = b.t
<!DOCTYPE html> <html lang="en" class=" is-copy-enabled emoji-size-boost is-u2f-enabled"> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#"> <meta charset='utf-8'> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-20333bf524e9cb08f9230d0340d7d355b7d90ab76adc88d9374924113fa93dd0.css" integrity="sha256-IDM79STpywj5Iw0DQNfTVbfZCrdq3IjZN0kkET+pPdA=" media="all" rel="stylesheet" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-a1333082f449e26bcb2762f36d7c449652b67d17e60997dab555b3050b618193.css" integrity="sha256-oTMwgvRJ4mvLJ2LzbXxEllK2fRfmCZfatVWzBQthgZM=" media="all" rel="stylesheet" /> <link as="script" href="https://assets-cdn.github.com/assets/frameworks-e677f2022a5d36e8f5ad35d0fcb01f83f1cdb613eda0449f533197693bcc6bda.js" rel="preload" /> <link as="script" href="https://assets-cdn.github.com/assets/github-6cd1d29bddd4e9715e00006a56a7792e3358fceb186db25f63fea410e747cfaa.js" rel="preload" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Language" content="en"> <meta name="viewport" content="width=1020"> <meta content="origin-when-cross-origin" name="referrer" /> <title>Database_Systems/schema.todo.sql at master · jasonlingo/Database_Systems</title> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <link rel="apple-touch-icon" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"> <meta property="fb:app_id" content="1401488693436528"> <meta content="https://avatars3.githubusercontent.com/u/7754836?v=3&amp;s=400" name="twitter:image:src" /><meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="jasonlingo/Database_Systems" name="twitter:title" /><meta content="Contribute to Database_Systems development by creating an account on GitHub." name="twitter:description" /> <meta content="https://avatars3.githubusercontent.com/u/7754836?v=3&amp;s=400" property="og:image" /><meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="jasonlingo/Database_Systems" property="og:title" /><meta content="https://github.com/jasonlingo/Database_Systems" property="og:url" /><meta content="Contribute to Database_Systems development by creating an account on GitHub." property="og:description" /> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="assets" href="https://assets-cdn.github.com/"> <link rel="web-socket" href="wss://live.github.com/_sockets/Nzc1NDgzNjpmNTVkNjc5M2Y3ODllNjVmODc2NWYxYjFkMWI4Y2E4ZDowOWFjYjY0MmFjNjQwY2U4OTA2NmZhNzE1MjhhYmYxMjI5MTdjZTVlNzdmOTAwNTk0YmUyNWFhNTg4ZmZlN2Mx--532a072f779b4db0e93b3b1cfe4c11b1abd16342"> <meta name="pjax-timeout" content="1000"> <link rel="sudo-modal" href="/sessions/sudo_modal"> <meta name="msapplication-TileImage" content="/windows-tile.png"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="selected-link" value="repo_source" data-pjax-transient> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-analytics" content="UA-3769691-2"> <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="A281FB56:2E2A:91AEF23:56E0CA0C" name="octolytics-dimension-request_id" /><meta content="7754836" name="octolytics-actor-id" /><meta content="jasonlingo" name="octolytics-actor-login" /><meta content="95caa2a2acbd55b179649bef187098cfbbada80c226b1a7299821b7b50e0eb71" name="octolytics-actor-hash" /> <meta content="/&lt;user-name&gt;/&lt;repo-name&gt;/blob/show" data-pjax-transient="true" name="analytics-location" /> <meta class="js-ga-set" name="dimension1" content="Logged In"> <meta name="hostname" content="github.com"> <meta name="user-login" content="jasonlingo"> <meta name="expected-hostname" content="github.com"> <meta name="js-proxy-site-detection-payload" content="YzJjMDQzMDM5ODhiMzA4OWJiZjg5NzM0YjM1YzEzZjk0YTA5YjI3MDE2YjljNjA3NTkxOWZhYzU0NGJmZjQ3M3x7InJlbW90ZV9hZGRyZXNzIjoiMTYyLjEyOS4yNTEuODYiLCJyZXF1ZXN0X2lkIjoiQTI4MUZCNTY6MkUyQTo5MUFFRjIzOjU2RTBDQTBDIn0="> <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#4078c0"> <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico"> <meta content="81bb94e0692cb6a523245ab8f97548e76c6fbe75" name="form-nonce" /> <meta http-equiv="x-pjax-version" content="f02dced1471bb21a7cd8c93c98b3b957"> <meta name="description" content="Contribute to Database_Systems development by creating an account on GitHub."> <meta name="go-import" content="github.com/jasonlingo/Database_Systems git https://github.com/jasonlingo/Database_Systems.git"> <meta content="7754836" name="octolytics-dimension-user_id" /><meta content="jasonlingo" name="octolytics-dimension-user_login" /><meta content="50884222" name="octolytics-dimension-repository_id" /><meta content="jasonlingo/Database_Systems" name="octolytics-dimension-repository_nwo" /><meta content="false" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="50884222" name="octolytics-dimension-repository_network_root_id" /><meta content="jasonlingo/Database_Systems" name="octolytics-dimension-repository_network_root_nwo" /> <link href="https://github.com/jasonlingo/Database_Systems/commits/master.atom?token=AHZUVE-PH_wTSQefobSPl498xf4x5h5Yks607KsRwA%3D%3D" rel="alternate" title="Recent Commits to Database_Systems:master" type="application/atom+xml"> <link rel="canonical" href="https://github.com/jasonlingo/Database_Systems/blob/master/handout/dbsys_hw0/sql/schema.todo.sql" data-pjax-transient> </head> <body class="logged_in env-production macintosh vis-private page-blob"> <a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a> <div class="header header-logged-in true" role="banner"> <div class="container clearfix"> <a class="header-logo-invertocat" href="https://github.com/" data-hotkey="g d" aria-label="Homepage" data-ga-click="Header, go to dashboard, icon:logo"> <svg aria-hidden="true" class="octicon octicon-mark-github" height="28" role="img" version="1.1" viewBox="0 0 16 16" width="28"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 0.4 0.07 0.55-0.17 0.55-0.38 0-0.19-0.01-0.82-0.01-1.49-2.01 0.37-2.53-0.49-2.69-0.94-0.09-0.23-0.48-0.94-0.82-1.13-0.28-0.15-0.68-0.52-0.01-0.53 0.63-0.01 1.08 0.58 1.23 0.82 0.72 1.21 1.87 0.87 2.33 0.66 0.07-0.52 0.28-0.87 0.51-1.07-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.59 0.82-2.15-0.08-0.2-0.36-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82 0.64-0.18 1.32-0.27 2-0.27 0.68 0 1.36 0.09 2 0.27 1.53-1.04 2.2-0.82 2.2-0.82 0.44 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.82 1.27 0.82 2.15 0 3.07-1.87 3.75-3.65 3.95 0.29 0.25 0.54 0.73 0.54 1.48 0 1.07-0.01 1.93-0.01 2.2 0 0.21 0.15 0.46 0.55 0.38C13.71 14.53 16 11.53 16 8 16 3.58 12.42 0 8 0z"></path></svg> </a> <div class="site-search repo-scope js-site-search" role="search"> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/jasonlingo/Database_Systems/search" class="js-site-search-form" data-global-search-url="/search" data-repo-search-url="/jasonlingo/Database_Systems/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <label class="js-chromeless-input-container form-control"> <div class="scope-badge">This repository</div> <input type="text" class="js-site-search-focus js-site-search-field is-clearable chromeless-input" data-hotkey="s" name="q" placeholder="Search" aria-label="Search this repository" data-global-scope-placeholder="Search GitHub" data-repo-scope-placeholder="Search" tabindex="1" autocapitalize="off"> </label> </form> </div> <ul class="header-nav left" role="navigation"> <li class="header-nav-item"> <a href="/pulls" class="js-selected-navigation-item header-nav-link" data-ga-click="Header, click, Nav menu - item:pulls context:user" data-hotkey="g p" data-selected-links="/pulls /pulls/assigned /pulls/mentioned /pulls"> Pull requests </a> </li> <li class="header-nav-item"> <a href="/issues" class="js-selected-navigation-item header-nav-link" data-ga-click="Header, click, Nav menu - item:issues context:user" data-hotkey="g i" data-selected-links="/issues /issues/assigned /issues/mentioned /issues"> Issues </a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="https://gist.github.com/" data-ga-click="Header, go to gist, text:gist">Gist</a> </li> </ul> <ul class="header-nav user-nav right" id="user-links"> <li class="header-nav-item"> <span class="js-socket-channel js-updatable-content" data-channel="notification-changed:jasonlingo" data-url="/notifications/header"> <a href="/notifications" aria-label="You have no unread notifications" class="header-nav-link notification-indicator tooltipped tooltipped-s" data-ga-click="Header, go to notifications, icon:read" data-hotkey="g n"> <span class="mail-status all-read"></span> <svg aria-hidden="true" class="octicon octicon-bell" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14"><path d="M14 12v1H0v-1l0.73-0.58c0.77-0.77 0.81-2.55 1.19-4.42 0.77-3.77 4.08-5 4.08-5 0-0.55 0.45-1 1-1s1 0.45 1 1c0 0 3.39 1.23 4.16 5 0.38 1.88 0.42 3.66 1.19 4.42l0.66 0.58z m-7 4c1.11 0 2-0.89 2-2H5c0 1.11 0.89 2 2 2z"></path></svg> </a> </span> </li> <li class="header-nav-item dropdown js-menu-container"> <a class="header-nav-link tooltipped tooltipped-s js-menu-target" href="/new" aria-label="Create new…" data-ga-click="Header, create new, icon:add"> <svg aria-hidden="true" class="octicon octicon-plus left" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 9H7v5H5V9H0V7h5V2h2v5h5v2z"></path></svg> <span class="dropdown-caret"></span> </a> <div class="dropdown-menu-content js-menu-content"> <ul class="dropdown-menu dropdown-menu-sw"> <a class="dropdown-item" href="/new" data-ga-click="Header, create new repository"> New repository </a> <a class="dropdown-item" href="/organizations/new" data-ga-click="Header, create new organization"> New organization </a> <div class="dropdown-divider"></div> <div class="dropdown-header"> <span title="jasonlingo/Database_Systems">This repository</span> </div> <a class="dropdown-item" href="/jasonlingo/Database_Systems/issues/new" data-ga-click="Header, create new issue"> New issue </a> <a class="dropdown-item" href="/jasonlingo/Database_Systems/settings/collaboration" data-ga-click="Header, create new collaborator"> New collaborator </a> </ul> </div> </li> <li class="header-nav-item dropdown js-menu-container"> <a class="header-nav-link name tooltipped tooltipped-sw js-menu-target" href="/jasonlingo" aria-label="View profile and more" data-ga-click="Header, show menu, icon:avatar"> <img alt="@jasonlingo" class="avatar" height="20" src="https://avatars3.githubusercontent.com/u/7754836?v=3&amp;s=40" width="20" /> <span class="dropdown-caret"></span> </a> <div class="dropdown-menu-content js-menu-content"> <div class="dropdown-menu dropdown-menu-sw"> <div class=" dropdown-header header-nav-current-user css-truncate"> Signed in as <strong class="css-truncate-target">jasonlingo</strong> </div> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/jasonlingo" data-ga-click="Header, go to profile, text:your profile"> Your profile </a> <a class="dropdown-item" href="/stars" data-ga-click="Header, go to starred repos, text:your stars"> Your stars </a> <a class="dropdown-item" href="/explore" data-ga-click="Header, go to explore, text:explore"> Explore </a> <a class="dropdown-item" href="/integrations" data-ga-click="Header, go to integrations, text:integrations"> Integrations </a> <a class="dropdown-item" href="https://help.github.com" data-ga-click="Header, go to help, text:help"> Help </a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/settings/profile" data-ga-click="Header, go to settings, icon:settings"> Settings </a> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/logout" class="logout-form" data-form-nonce="81bb94e0692cb6a523245ab8f97548e76c6fbe75" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="jM1g1H0tiSy7otlMRI83afzpbW4KloYtEldJ7dgI3d0tY+U//efAMYs0M0QNB2Klmup6sKHkQvAteuzpPzbf5g==" /></div> <button class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout"> Sign out </button> </form> </div> </div> </li> </ul> </div> </div> <div id="start-of-content" class="accessibility-aid"></div> <div id="js-flash-container"> </div> <div role="main" class="main-content"> <div itemscope itemtype="http://schema.org/SoftwareSourceCode"> <div id="js-repo-pjax-container" class="context-loader-container js-repo-nav-next" data-pjax-container> <div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav"> <div class="container repohead-details-container"> <ul class="pagehead-actions"> <li> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-form-nonce="81bb94e0692cb6a523245ab8f97548e76c6fbe75" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="68BgBHnaxG73LaF7XiVYTTo2hQx6iKvwXB55TBGRyguhrdJV8YXgCNxR/rOT0OQnlZ5Q9mWb+Ar1W2w7/IdDYA==" /></div> <input id="repository_id" name="repository_id" type="hidden" value="50884222" /> <div class="select-menu js-menu-container js-select-menu"> <a href="/jasonlingo/Database_Systems/subscription" class="btn btn-sm btn-with-count select-menu-button js-menu-target" role="button" tabindex="0" aria-haspopup="true" data-ga-click="Repository, click Watch settings, action:blob#show"> <span class="js-select-button"> <svg aria-hidden="true" class="octicon octicon-eye" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6c4.94 0 7.94-6 7.94-6S13 2 8.06 2z m-0.06 10c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4z m2-4c0 1.11-0.89 2-2 2s-2-0.89-2-2 0.89-2 2-2 2 0.89 2 2z"></path></svg> Unwatch </span> </a> <a class="social-count js-social-count" href="/jasonlingo/Database_Systems/watchers"> 2 </a> <div class="select-menu-modal-holder"> <div class="select-menu-modal subscription-menu-modal js-menu-content" aria-hidden="true"> <div class="select-menu-header"> <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M7.48 8l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75-1.48-1.48 3.75-3.75L0.77 4.25l1.48-1.48 3.75 3.75 3.75-3.75 1.48 1.48-3.75 3.75z"></path></svg> <span class="select-menu-title">Notifications</span> </div> <div class="select-menu-list js-navigation-container" role="menu"> <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <div class="select-menu-item-text"> <input id="do_included" name="do" type="radio" value="included" /> <span class="select-menu-item-heading">Not watching</span> <span class="description">Be notified when participating or @mentioned.</span> <span class="js-select-button-text hidden-select-button-text"> <svg aria-hidden="true" class="octicon octicon-eye" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6c4.94 0 7.94-6 7.94-6S13 2 8.06 2z m-0.06 10c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4z m2-4c0 1.11-0.89 2-2 2s-2-0.89-2-2 0.89-2 2-2 2 0.89 2 2z"></path></svg> Watch </span> </div> </div> <div class="select-menu-item js-navigation-item selected" role="menuitem" tabindex="0"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <div class="select-menu-item-text"> <input checked="checked" id="do_subscribed" name="do" type="radio" value="subscribed" /> <span class="select-menu-item-heading">Watching</span> <span class="description">Be notified of all conversations.</span> <span class="js-select-button-text hidden-select-button-text"> <svg aria-hidden="true" class="octicon octicon-eye" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6c4.94 0 7.94-6 7.94-6S13 2 8.06 2z m-0.06 10c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4z m2-4c0 1.11-0.89 2-2 2s-2-0.89-2-2 0.89-2 2-2 2 0.89 2 2z"></path></svg> Unwatch </span> </div> </div> <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <div class="select-menu-item-text"> <input id="do_ignore" name="do" type="radio" value="ignore" /> <span class="select-menu-item-heading">Ignoring</span> <span class="description">Never be notified.</span> <span class="js-select-button-text hidden-select-button-text"> <svg aria-hidden="true" class="octicon octicon-mute" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8 2.81v10.38c0 0.67-0.81 1-1.28 0.53L3 10H1c-0.55 0-1-0.45-1-1V7c0-0.55 0.45-1 1-1h2l3.72-3.72c0.47-0.47 1.28-0.14 1.28 0.53z m7.53 3.22l-1.06-1.06-1.97 1.97-1.97-1.97-1.06 1.06 1.97 1.97-1.97 1.97 1.06 1.06 1.97-1.97 1.97 1.97 1.06-1.06-1.97-1.97 1.97-1.97z"></path></svg> Stop ignoring </span> </div> </div> </div> </div> </div> </div> </form> </li> <li> <div class="js-toggler-container js-social-container starring-container "> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/jasonlingo/Database_Systems/unstar" class="js-toggler-form starred" data-form-nonce="81bb94e0692cb6a523245ab8f97548e76c6fbe75" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="sENeHziNfrNvghMuRs/5+kNyPIvFO9UhcE3kBEc3d3426pVKfjAhl0QHQVnnIWphoEh9VjXEWFaZfxm5zBdFVQ==" /></div> <button class="btn btn-sm btn-with-count js-toggler-target" aria-label="Unstar this repository" title="Unstar jasonlingo/Database_Systems" data-ga-click="Repository, click unstar button, action:blob#show; text:Unstar"> <svg aria-hidden="true" class="octicon octicon-star" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14"><path d="M14 6l-4.9-0.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14l4.33-2.33 4.33 2.33L10.4 9.26 14 6z"></path></svg> Unstar </button> <a class="social-count js-social-count" href="/jasonlingo/Database_Systems/stargazers"> 0 </a> </form> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/jasonlingo/Database_Systems/star" class="js-toggler-form unstarred" data-form-nonce="81bb94e0692cb6a523245ab8f97548e76c6fbe75" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="PhsZTJCsVFKniHdRyRbJ3YmN01K9CXz8kuRZbRBJKpLX+lqxUEq7SY0AI3e8y8FiEoamnP6MCVNR+LHSshyn7g==" /></div> <button class="btn btn-sm btn-with-count js-toggler-target" aria-label="Star this repository" title="Star jasonlingo/Database_Systems" data-ga-click="Repository, click star button, action:blob#show; text:Star"> <svg aria-hidden="true" class="octicon octicon-star" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14"><path d="M14 6l-4.9-0.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14l4.33-2.33 4.33 2.33L10.4 9.26 14 6z"></path></svg> Star </button> <a class="social-count js-social-count" href="/jasonlingo/Database_Systems/stargazers"> 0 </a> </form> </div> </li> <li> <a href="#fork-destination-box" class="btn btn-sm btn-with-count" title="Fork your own copy of jasonlingo/Database_Systems to your account" aria-label="Fork your own copy of jasonlingo/Database_Systems to your account" rel="facebox" data-ga-click="Repository, show fork modal, action:blob#show; text:Fork"> <svg aria-hidden="true" class="octicon octicon-repo-forked" height="16" role="img" version="1.1" viewBox="0 0 10 16" width="10"><path d="M8 1c-1.11 0-2 0.89-2 2 0 0.73 0.41 1.38 1 1.72v1.28L5 8 3 6v-1.28c0.59-0.34 1-0.98 1-1.72 0-1.11-0.89-2-2-2S0 1.89 0 3c0 0.73 0.41 1.38 1 1.72v1.78l3 3v1.78c-0.59 0.34-1 0.98-1 1.72 0 1.11 0.89 2 2 2s2-0.89 2-2c0-0.73-0.41-1.38-1-1.72V9.5l3-3V4.72c0.59-0.34 1-0.98 1-1.72 0-1.11-0.89-2-2-2zM2 4.2c-0.66 0-1.2-0.55-1.2-1.2s0.55-1.2 1.2-1.2 1.2 0.55 1.2 1.2-0.55 1.2-1.2 1.2z m3 10c-0.66 0-1.2-0.55-1.2-1.2s0.55-1.2 1.2-1.2 1.2 0.55 1.2 1.2-0.55 1.2-1.2 1.2z m3-10c-0.66 0-1.2-0.55-1.2-1.2s0.55-1.2 1.2-1.2 1.2 0.55 1.2 1.2-0.55 1.2-1.2 1.2z"></path></svg> Fork </a> <div id="fork-destination-box" style="display: none;"> <h2 class="facebox-header" data-facebox-id="facebox-header">Where should we fork this repository?</h2> <include-fragment src="" class="js-fork-select-fragment fork-select-fragment" data-url="/jasonlingo/Database_Systems/fork?fragment=1"> <img alt="Loading" height="64" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-128.gif" width="64" /> </include-fragment> </div> <a href="/jasonlingo/Database_Systems/network" class="social-count"> 0 </a> </li> </ul> <h1 class="entry-title private "> <svg aria-hidden="true" class="octicon octicon-lock" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M4 13h-1v-1h1v1z m8-6v7c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V7c0-0.55 0.45-1 1-1h1V4C2 1.8 3.8 0 6 0s4 1.8 4 4v2h1c0.55 0 1 0.45 1 1z m-8.2-1h4.41V4c0-1.22-0.98-2.2-2.2-2.2s-2.2 0.98-2.2 2.2v2z m7.2 1H2v7h9V7z m-7 1h-1v1h1v-1z m0 2h-1v1h1v-1z"></path></svg> <span class="author" itemprop="author"><a href="/jasonlingo" class="url fn" rel="author">jasonlingo</a></span><!-- --><span class="path-divider">/</span><!-- --><strong itemprop="name"><a href="/jasonlingo/Database_Systems" data-pjax="#js-repo-pjax-container">Database_Systems</a></strong> <span class="repo-private-label">private</span> <span class="page-context-loader"> <img alt="" height="16" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif" width="16" /> </span> </h1> </div> <div class="container"> <nav class="reponav js-repo-nav js-sidenav-container-pjax js-octicon-loaders" itemscope itemtype="http://schema.org/BreadcrumbList" role="navigation" data-pjax="#js-repo-pjax-container"> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/jasonlingo/Database_Systems" aria-selected="true" class="js-selected-navigation-item selected reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /jasonlingo/Database_Systems" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-code" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14"><path d="M9.5 3l-1.5 1.5 3.5 3.5L8 11.5l1.5 1.5 4.5-5L9.5 3zM4.5 3L0 8l4.5 5 1.5-1.5L2.5 8l3.5-3.5L4.5 3z"></path></svg> <span itemprop="name">Code</span> <meta itemprop="position" content="1"> </a> </span> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/jasonlingo/Database_Systems/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /jasonlingo/Database_Systems/issues" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14"><path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7S10.14 13.7 7 13.7 1.3 11.14 1.3 8s2.56-5.7 5.7-5.7m0-1.3C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7S10.86 1 7 1z m1 3H6v5h2V4z m0 6H6v2h2V10z"></path></svg> <span itemprop="name">Issues</span> <span class="counter">0</span> <meta itemprop="position" content="2"> </a> </span> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/jasonlingo/Database_Systems/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /jasonlingo/Database_Systems/pulls" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-git-pull-request" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M11 11.28c0-1.73 0-6.28 0-6.28-0.03-0.78-0.34-1.47-0.94-2.06s-1.28-0.91-2.06-0.94c0 0-1.02 0-1 0V0L4 3l3 3V4h1c0.27 0.02 0.48 0.11 0.69 0.31s0.3 0.42 0.31 0.69v6.28c-0.59 0.34-1 0.98-1 1.72 0 1.11 0.89 2 2 2s2-0.89 2-2c0-0.73-0.41-1.38-1-1.72z m-1 2.92c-0.66 0-1.2-0.55-1.2-1.2s0.55-1.2 1.2-1.2 1.2 0.55 1.2 1.2-0.55 1.2-1.2 1.2zM4 3c0-1.11-0.89-2-2-2S0 1.89 0 3c0 0.73 0.41 1.38 1 1.72 0 1.55 0 5.56 0 6.56-0.59 0.34-1 0.98-1 1.72 0 1.11 0.89 2 2 2s2-0.89 2-2c0-0.73-0.41-1.38-1-1.72V4.72c0.59-0.34 1-0.98 1-1.72z m-0.8 10c0 0.66-0.55 1.2-1.2 1.2s-1.2-0.55-1.2-1.2 0.55-1.2 1.2-1.2 1.2 0.55 1.2 1.2z m-1.2-8.8c-0.66 0-1.2-0.55-1.2-1.2s0.55-1.2 1.2-1.2 1.2 0.55 1.2 1.2-0.55 1.2-1.2 1.2z"></path></svg> <span itemprop="name">Pull requests</span> <span class="counter">0</span> <meta itemprop="position" content="3"> </a> </span> <a href="/jasonlingo/Database_Systems/wiki" class="js-selected-navigation-item reponav-item" data-hotkey="g w" data-selected-links="repo_wiki /jasonlingo/Database_Systems/wiki"> <svg aria-hidden="true" class="octicon octicon-book" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M2 5h4v1H2v-1z m0 3h4v-1H2v1z m0 2h4v-1H2v1z m11-5H9v1h4v-1z m0 2H9v1h4v-1z m0 2H9v1h4v-1z m2-6v9c0 0.55-0.45 1-1 1H8.5l-1 1-1-1H1c-0.55 0-1-0.45-1-1V3c0-0.55 0.45-1 1-1h5.5l1 1 1-1h5.5c0.55 0 1 0.45 1 1z m-8 0.5l-0.5-0.5H1v9h6V3.5z m7-0.5H8.5l-0.5 0.5v8.5h6V3z"></path></svg> Wiki </a> <a href="/jasonlingo/Database_Systems/pulse" class="js-selected-navigation-item reponav-item" data-selected-links="pulse /jasonlingo/Database_Systems/pulse"> <svg aria-hidden="true" class="octicon octicon-pulse" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14"><path d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0V10h3.6L4.5 8.2l0.9 5.4L9 8.5l1.6 1.5H14V8H11.5z"></path></svg> Pulse </a> <a href="/jasonlingo/Database_Systems/graphs" class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors /jasonlingo/Database_Systems/graphs"> <svg aria-hidden="true" class="octicon octicon-graph" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M16 14v1H0V0h1v14h15z m-11-1H3V8h2v5z m4 0H7V3h2v10z m4 0H11V6h2v7z"></path></svg> Graphs </a> <a href="/jasonlingo/Database_Systems/settings" class="js-selected-navigation-item reponav-item" data-selected-links="repo_settings repo_branch_settings hooks /jasonlingo/Database_Systems/settings"> <svg aria-hidden="true" class="octicon octicon-gear" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14"><path d="M14 8.77V7.17l-1.94-0.64-0.45-1.09 0.88-1.84-1.13-1.13-1.81 0.91-1.09-0.45-0.69-1.92H6.17l-0.63 1.94-1.11 0.45-1.84-0.88-1.13 1.13 0.91 1.81-0.45 1.09L0 7.23v1.59l1.94 0.64 0.45 1.09-0.88 1.84 1.13 1.13 1.81-0.91 1.09 0.45 0.69 1.92h1.59l0.63-1.94 1.11-0.45 1.84 0.88 1.13-1.13-0.92-1.81 0.47-1.09 1.92-0.69zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"></path></svg> Settings </a> </nav> </div> </div> <div class="container new-discussion-timeline experiment-repo-nav"> <div class="repository-content"> <a href="/jasonlingo/Database_Systems/blob/c4461a93538985080ff40dfe861cf74cbdd4d958/handout/dbsys_hw0/sql/schema.todo.sql" class="hidden js-permalink-shortcut" data-hotkey="y">Permalink</a> <!-- blob contrib key: blob_contributors:v21:cc26f0236644367a10055e77360110b4 --> <div class="file-navigation js-zeroclipboard-container"> <div class="select-menu js-menu-container js-select-menu left"> <button class="btn btn-sm select-menu-button js-menu-target css-truncate" data-hotkey="w" title="master" type="button" aria-label="Switch branches or tags" tabindex="0" aria-haspopup="true"> <i>Branch:</i> <span class="js-select-button css-truncate-target">master</span> </button> <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax aria-hidden="true"> <div class="select-menu-modal"> <div class="select-menu-header"> <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M7.48 8l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75-1.48-1.48 3.75-3.75L0.77 4.25l1.48-1.48 3.75 3.75 3.75-3.75 1.48 1.48-3.75 3.75z"></path></svg> <span class="select-menu-title">Switch branches/tags</span> </div> <div class="select-menu-filters"> <div class="select-menu-text-filter"> <input type="text" aria-label="Find or create a branch…" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Find or create a branch…"> </div> <div class="select-menu-tabs"> <ul> <li class="select-menu-tab"> <a href="#" data-tab-filter="branches" data-filter-placeholder="Find or create a branch…" class="js-select-menu-tab" role="tab">Branches</a> </li> <li class="select-menu-tab"> <a href="#" data-tab-filter="tags" data-filter-placeholder="Find a tag…" class="js-select-menu-tab" role="tab">Tags</a> </li> </ul> </div> </div> <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches" role="menu"> <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring"> <a class="select-menu-item js-navigation-item js-navigation-open " href="/jasonlingo/Database_Systems/blob/HW/handout/dbsys_hw0/sql/schema.todo.sql" data-name="HW" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text" title="HW"> HW </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/jasonlingo/Database_Systems/blob/HW2/handout/dbsys_hw0/sql/schema.todo.sql" data-name="HW2" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text" title="HW2"> HW2 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/jasonlingo/Database_Systems/blob/hw1_submit/handout/dbsys_hw0/sql/schema.todo.sql" data-name="hw1_submit" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text" title="hw1_submit"> hw1_submit </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/jasonlingo/Database_Systems/blob/hw1/handout/dbsys_hw0/sql/schema.todo.sql" data-name="hw1" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text" title="hw1"> hw1 </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/jasonlingo/Database_Systems/blob/jinyi/handout/dbsys_hw0/sql/schema.todo.sql" data-name="jinyi" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text" title="jinyi"> jinyi </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open selected" href="/jasonlingo/Database_Systems/blob/master/handout/dbsys_hw0/sql/schema.todo.sql" data-name="master" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5L4 13 0 9l1.5-1.5 2.5 2.5 6.5-6.5 1.5 1.5z"></path></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text" title="master"> master </span> </a> </div> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/jasonlingo/Database_Systems/branches" class="js-create-branch select-menu-item select-menu-new-item-form js-navigation-item js-new-item-form" data-form-nonce="81bb94e0692cb6a523245ab8f97548e76c6fbe75" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="xK5ohAgOWxg0v5P0Vk+PVRAoCuyuD70CsyhL3+EfjJOvhWK7BuDDKsswGQCZHNiGVFyYFhR3GgIWxu43Mk6WIQ==" /></div> <svg aria-hidden="true" class="octicon octicon-git-branch select-menu-item-icon" height="16" role="img" version="1.1" viewBox="0 0 10 16" width="10"><path d="M10 5c0-1.11-0.89-2-2-2s-2 0.89-2 2c0 0.73 0.41 1.38 1 1.72v0.3c-0.02 0.52-0.23 0.98-0.63 1.38s-0.86 0.61-1.38 0.63c-0.83 0.02-1.48 0.16-2 0.45V4.72c0.59-0.34 1-0.98 1-1.72 0-1.11-0.89-2-2-2S0 1.89 0 3c0 0.73 0.41 1.38 1 1.72v6.56C0.41 11.63 0 12.27 0 13c0 1.11 0.89 2 2 2s2-0.89 2-2c0-0.53-0.2-1-0.53-1.36 0.09-0.06 0.48-0.41 0.59-0.47 0.25-0.11 0.56-0.17 0.94-0.17 1.05-0.05 1.95-0.45 2.75-1.25s1.2-1.98 1.25-3.02h-0.02c0.61-0.36 1.02-1 1.02-1.73zM2 1.8c0.66 0 1.2 0.55 1.2 1.2s-0.55 1.2-1.2 1.2-1.2-0.55-1.2-1.2 0.55-1.2 1.2-1.2z m0 12.41c-0.66 0-1.2-0.55-1.2-1.2s0.55-1.2 1.2-1.2 1.2 0.55 1.2 1.2-0.55 1.2-1.2 1.2z m6-8c-0.66 0-1.2-0.55-1.2-1.2s0.55-1.2 1.2-1.2 1.2 0.55 1.2 1.2-0.55 1.2-1.2 1.2z"></path></svg> <div class="select-menu-item-text"> <span class="select-menu-item-heading">Create branch: <span class="js-new-item-name"></span></span> <span class="description">from ‘master’</span> </div> <input type="hidden" name="name" id="name" class="js-new-item-value"> <input type="hidden" name="branch" id="branch" value="master"> <input type="hidden" name="path" id="path" value="handout/dbsys_hw0/sql/schema.todo.sql"> </form> </div> <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags"> <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring"> </div> <div class="select-menu-no-results">Nothing to show</div> </div> </div> </div> </div> <div class="btn-group right"> <a href="/jasonlingo/Database_Systems/find/master" class="js-show-file-finder btn btn-sm" data-pjax data-hotkey="t"> Find file </a> <button aria-label="Copy file path to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button">Copy path</button> </div> <div class="breadcrumb js-zeroclipboard-target"> <span class="repo-root js-repo-root"><span class="js-path-segment"><a href="/jasonlingo/Database_Systems"><span>Database_Systems</span></a></span></span><span class="separator">/</span><span class="js-path-segment"><a href="/jasonlingo/Database_Systems/tree/master/handout"><span>handout</span></a></span><span class="separator">/</span><span class="js-path-segment"><a href="/jasonlingo/Database_Systems/tree/master/handout/dbsys_hw0"><span>dbsys_hw0</span></a></span><span class="separator">/</span><span class="js-path-segment"><a href="/jasonlingo/Database_Systems/tree/master/handout/dbsys_hw0/sql"><span>sql</span></a></span><span class="separator">/</span><strong class="final-path">schema.todo.sql</strong> </div> </div> <div class="commit-tease"> <span class="right"> <a class="commit-tease-sha" href="/jasonlingo/Database_Systems/commit/2ef415a51e09d1e129dab9bd24f6d73702ea2494" data-pjax> 2ef415a </a> <time datetime="2016-02-02T01:27:26Z" is="relative-time">Feb 1, 2016</time> </span> <div> <img alt="@jasonlingo" class="avatar" height="20" src="https://avatars3.githubusercontent.com/u/7754836?v=3&amp;s=40" width="20" /> <a href="/jasonlingo" class="user-mention" rel="author">jasonlingo</a> <a href="/jasonlingo/Database_Systems/commit/2ef415a51e09d1e129dab9bd24f6d73702ea2494" class="message" data-pjax="true" title="first commit">first commit</a> </div> <div class="commit-tease-contributors"> <button type="button" class="btn-link muted-link contributors-toggle" data-facebox="#blob_contributors_box"> <strong>1</strong> contributor </button> </div> <div id="blob_contributors_box" style="display:none"> <h2 class="facebox-header" data-facebox-id="facebox-header">Users who have contributed to this file</h2> <ul class="facebox-user-list" data-facebox-id="facebox-description"> <li class="facebox-user-list-item"> <img alt="@jasonlingo" height="24" src="https://avatars1.githubusercontent.com/u/7754836?v=3&amp;s=48" width="24" /> <a href="/jasonlingo">jasonlingo</a> </li> </ul> </div> </div> <div class="file"> <div class="file-header"> <div class="file-actions"> <div class="btn-group"> <a href="/jasonlingo/Database_Systems/raw/master/handout/dbsys_hw0/sql/schema.todo.sql" class="btn btn-sm " id="raw-url">Raw</a> <a href="/jasonlingo/Database_Systems/blame/master/handout/dbsys_hw0/sql/schema.todo.sql" class="btn btn-sm js-update-url-with-hash">Blame</a> <a href="/jasonlingo/Database_Systems/commits/master/handout/dbsys_hw0/sql/schema.todo.sql" class="btn btn-sm " rel="nofollow">History</a> </div> <a class="btn-octicon tooltipped tooltipped-nw" href="github-mac://openRepo/https://github.com/jasonlingo/Database_Systems?branch=master&amp;filepath=handout%2Fdbsys_hw0%2Fsql%2Fschema.todo.sql" aria-label="Open this file in GitHub Desktop" data-ga-click="Repository, open with desktop, type:mac"> <svg aria-hidden="true" class="octicon octicon-device-desktop" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M15 2H1c-0.55 0-1 0.45-1 1v9c0 0.55 0.45 1 1 1h5.34c-0.25 0.61-0.86 1.39-2.34 2h8c-1.48-0.61-2.09-1.39-2.34-2h5.34c0.55 0 1-0.45 1-1V3c0-0.55-0.45-1-1-1z m0 9H1V3h14v8z"></path></svg> </a> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/jasonlingo/Database_Systems/edit/master/handout/dbsys_hw0/sql/schema.todo.sql" class="inline-form js-update-url-with-hash" data-form-nonce="81bb94e0692cb6a523245ab8f97548e76c6fbe75" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="6BysREnlMGStMb4slJ578QqEyqUAStP28S/ziuVS309jVvbHFx8UY0YiwdQ6aVtehAP+qBn9cpNB0gmg+pZZQQ==" /></div> <button class="btn-octicon tooltipped tooltipped-nw" type="submit" aria-label="Edit this file" data-hotkey="e" data-disable-with> <svg aria-hidden="true" class="octicon octicon-pencil" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14"><path d="M0 12v3h3l8-8-3-3L0 12z m3 2H1V12h1v1h1v1z m10.3-9.3l-1.3 1.3-3-3 1.3-1.3c0.39-0.39 1.02-0.39 1.41 0l1.59 1.59c0.39 0.39 0.39 1.02 0 1.41z"></path></svg> </button> </form> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/jasonlingo/Database_Systems/delete/master/handout/dbsys_hw0/sql/schema.todo.sql" class="inline-form" data-form-nonce="81bb94e0692cb6a523245ab8f97548e76c6fbe75" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="K0LqGu19bGCCznTAB+a9LwSNo9cQoDsFMzXEIsn0MQZ35cW15vlG16NzVSRDF6sEMssX+mtr39uQUWWDWjmCyg==" /></div> <button class="btn-octicon btn-octicon-danger tooltipped tooltipped-nw" type="submit" aria-label="Delete this file" data-disable-with> <svg aria-hidden="true" class="octicon octicon-trashcan" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M10 2H8c0-0.55-0.45-1-1-1H4c-0.55 0-1 0.45-1 1H1c-0.55 0-1 0.45-1 1v1c0 0.55 0.45 1 1 1v9c0 0.55 0.45 1 1 1h7c0.55 0 1-0.45 1-1V5c0.55 0 1-0.45 1-1v-1c0-0.55-0.45-1-1-1z m-1 12H2V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9z m1-10H1v-1h9v1z"></path></svg> </button> </form> </div> <div class="file-info"> 102 lines (91 sloc) <span class="file-info-divider"></span> 2.34 KB </div> </div> <div itemprop="text" class="blob-wrapper data type-sql"> <table class="highlight tab-size js-file-line-container" data-tab-size="8"> <tr> <td id="L1" class="blob-num js-line-number" data-line-number="1"></td> <td id="LC1" class="blob-code blob-code-inner js-file-line"><span class="pl-c">-- This script creates each of the TPCH tables using the SQL &#39;create table&#39; command.</span></td> </tr> <tr> <td id="L2" class="blob-num js-line-number" data-line-number="2"></td> <td id="LC2" class="blob-code blob-code-inner js-file-line"><span class="pl-k">drop</span> <span class="pl-k">table</span> if exists part;</td> </tr> <tr> <td id="L3" class="blob-num js-line-number" data-line-number="3"></td> <td id="LC3" class="blob-code blob-code-inner js-file-line"><span class="pl-k">drop</span> <span class="pl-k">table</span> if exists supplier;</td> </tr> <tr> <td id="L4" class="blob-num js-line-number" data-line-number="4"></td> <td id="LC4" class="blob-code blob-code-inner js-file-line"><span class="pl-k">drop</span> <span class="pl-k">table</span> if exists partsupp;</td> </tr> <tr> <td id="L5" class="blob-num js-line-number" data-line-number="5"></td> <td id="LC5" class="blob-code blob-code-inner js-file-line"><span class="pl-k">drop</span> <span class="pl-k">table</span> if exists customer;</td> </tr> <tr> <td id="L6" class="blob-num js-line-number" data-line-number="6"></td> <td id="LC6" class="blob-code blob-code-inner js-file-line"><span class="pl-k">drop</span> <span class="pl-k">table</span> if exists orders;</td> </tr> <tr> <td id="L7" class="blob-num js-line-number" data-line-number="7"></td> <td id="LC7" class="blob-code blob-code-inner js-file-line"><span class="pl-k">drop</span> <span class="pl-k">table</span> if exists lineitem;</td> </tr> <tr> <td id="L8" class="blob-num js-line-number" data-line-number="8"></td> <td id="LC8" class="blob-code blob-code-inner js-file-line"><span class="pl-k">drop</span> <span class="pl-k">table</span> if exists nation;</td> </tr> <tr> <td id="L9" class="blob-num js-line-number" data-line-number="9"></td> <td id="LC9" class="blob-code blob-code-inner js-file-line"><span class="pl-k">drop</span> <span class="pl-k">table</span> if exists region;</td> </tr> <tr> <td id="L10" class="blob-num js-line-number" data-line-number="10"></td> <td id="LC10" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L11" class="blob-num js-line-number" data-line-number="11"></td> <td id="LC11" class="blob-code blob-code-inner js-file-line"><span class="pl-c">-- Notes:</span></td> </tr> <tr> <td id="L12" class="blob-num js-line-number" data-line-number="12"></td> <td id="LC12" class="blob-code blob-code-inner js-file-line"><span class="pl-c">-- 1) Use all lowercase letters for table and column identifiers.</span></td> </tr> <tr> <td id="L13" class="blob-num js-line-number" data-line-number="13"></td> <td id="LC13" class="blob-code blob-code-inner js-file-line"><span class="pl-c">-- 2) Use only INTEGER/REAL/TEXT datatypes. Use TEXT for dates.</span></td> </tr> <tr> <td id="L14" class="blob-num js-line-number" data-line-number="14"></td> <td id="LC14" class="blob-code blob-code-inner js-file-line"><span class="pl-c">-- 3) Do not specify any integrity contraints (e.g., PRIMARY KEY, FOREIGN KEY).</span></td> </tr> <tr> <td id="L15" class="blob-num js-line-number" data-line-number="15"></td> <td id="LC15" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L16" class="blob-num js-line-number" data-line-number="16"></td> <td id="LC16" class="blob-code blob-code-inner js-file-line"><span class="pl-c">-- Students should fill in the followins statements:</span></td> </tr> <tr> <td id="L17" class="blob-num js-line-number" data-line-number="17"></td> <td id="LC17" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L18" class="blob-num js-line-number" data-line-number="18"></td> <td id="LC18" class="blob-code blob-code-inner js-file-line"><span class="pl-k">create</span> <span class="pl-k">table</span> <span class="pl-en">part</span> (</td> </tr> <tr> <td id="L19" class="blob-num js-line-number" data-line-number="19"></td> <td id="LC19" class="blob-code blob-code-inner js-file-line"> p_partkey <span class="pl-k">INT</span>, </td> </tr> <tr> <td id="L20" class="blob-num js-line-number" data-line-number="20"></td> <td id="LC20" class="blob-code blob-code-inner js-file-line"> p_name <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L21" class="blob-num js-line-number" data-line-number="21"></td> <td id="LC21" class="blob-code blob-code-inner js-file-line"> p_mfgr <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L22" class="blob-num js-line-number" data-line-number="22"></td> <td id="LC22" class="blob-code blob-code-inner js-file-line"> p_brand <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L23" class="blob-num js-line-number" data-line-number="23"></td> <td id="LC23" class="blob-code blob-code-inner js-file-line"> p_type <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L24" class="blob-num js-line-number" data-line-number="24"></td> <td id="LC24" class="blob-code blob-code-inner js-file-line"> p_size <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L25" class="blob-num js-line-number" data-line-number="25"></td> <td id="LC25" class="blob-code blob-code-inner js-file-line"> p_container <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L26" class="blob-num js-line-number" data-line-number="26"></td> <td id="LC26" class="blob-code blob-code-inner js-file-line"> p_retailprice <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L27" class="blob-num js-line-number" data-line-number="27"></td> <td id="LC27" class="blob-code blob-code-inner js-file-line"> p_comment <span class="pl-k">TEXT</span></td> </tr> <tr> <td id="L28" class="blob-num js-line-number" data-line-number="28"></td> <td id="LC28" class="blob-code blob-code-inner js-file-line">);</td> </tr> <tr> <td id="L29" class="blob-num js-line-number" data-line-number="29"></td> <td id="LC29" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L30" class="blob-num js-line-number" data-line-number="30"></td> <td id="LC30" class="blob-code blob-code-inner js-file-line"><span class="pl-k">create</span> <span class="pl-k">table</span> <span class="pl-en">supplier</span> (</td> </tr> <tr> <td id="L31" class="blob-num js-line-number" data-line-number="31"></td> <td id="LC31" class="blob-code blob-code-inner js-file-line"> s_suppkey <span class="pl-k">INT</span>, </td> </tr> <tr> <td id="L32" class="blob-num js-line-number" data-line-number="32"></td> <td id="LC32" class="blob-code blob-code-inner js-file-line"> s_name <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L33" class="blob-num js-line-number" data-line-number="33"></td> <td id="LC33" class="blob-code blob-code-inner js-file-line"> s_address <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L34" class="blob-num js-line-number" data-line-number="34"></td> <td id="LC34" class="blob-code blob-code-inner js-file-line"> s_nationkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L35" class="blob-num js-line-number" data-line-number="35"></td> <td id="LC35" class="blob-code blob-code-inner js-file-line"> s_phone <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L36" class="blob-num js-line-number" data-line-number="36"></td> <td id="LC36" class="blob-code blob-code-inner js-file-line"> s_acctbal <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L37" class="blob-num js-line-number" data-line-number="37"></td> <td id="LC37" class="blob-code blob-code-inner js-file-line"> s_comment <span class="pl-k">TEXT</span></td> </tr> <tr> <td id="L38" class="blob-num js-line-number" data-line-number="38"></td> <td id="LC38" class="blob-code blob-code-inner js-file-line">);</td> </tr> <tr> <td id="L39" class="blob-num js-line-number" data-line-number="39"></td> <td id="LC39" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L40" class="blob-num js-line-number" data-line-number="40"></td> <td id="LC40" class="blob-code blob-code-inner js-file-line"><span class="pl-k">create</span> <span class="pl-k">table</span> <span class="pl-en">partsupp</span> (</td> </tr> <tr> <td id="L41" class="blob-num js-line-number" data-line-number="41"></td> <td id="LC41" class="blob-code blob-code-inner js-file-line"> ps_partkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L42" class="blob-num js-line-number" data-line-number="42"></td> <td id="LC42" class="blob-code blob-code-inner js-file-line"> ps_suppkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L43" class="blob-num js-line-number" data-line-number="43"></td> <td id="LC43" class="blob-code blob-code-inner js-file-line"> ps_availqty <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L44" class="blob-num js-line-number" data-line-number="44"></td> <td id="LC44" class="blob-code blob-code-inner js-file-line"> ps_supplycost <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L45" class="blob-num js-line-number" data-line-number="45"></td> <td id="LC45" class="blob-code blob-code-inner js-file-line"> ps_comment <span class="pl-k">TEXT</span></td> </tr> <tr> <td id="L46" class="blob-num js-line-number" data-line-number="46"></td> <td id="LC46" class="blob-code blob-code-inner js-file-line">);</td> </tr> <tr> <td id="L47" class="blob-num js-line-number" data-line-number="47"></td> <td id="LC47" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L48" class="blob-num js-line-number" data-line-number="48"></td> <td id="LC48" class="blob-code blob-code-inner js-file-line"><span class="pl-k">create</span> <span class="pl-k">table</span> <span class="pl-en">customer</span> (</td> </tr> <tr> <td id="L49" class="blob-num js-line-number" data-line-number="49"></td> <td id="LC49" class="blob-code blob-code-inner js-file-line"> c_custkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L50" class="blob-num js-line-number" data-line-number="50"></td> <td id="LC50" class="blob-code blob-code-inner js-file-line"> c_name <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L51" class="blob-num js-line-number" data-line-number="51"></td> <td id="LC51" class="blob-code blob-code-inner js-file-line"> c_address <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L52" class="blob-num js-line-number" data-line-number="52"></td> <td id="LC52" class="blob-code blob-code-inner js-file-line"> c_nationkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L53" class="blob-num js-line-number" data-line-number="53"></td> <td id="LC53" class="blob-code blob-code-inner js-file-line"> c_phone <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L54" class="blob-num js-line-number" data-line-number="54"></td> <td id="LC54" class="blob-code blob-code-inner js-file-line"> c_acctbal <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L55" class="blob-num js-line-number" data-line-number="55"></td> <td id="LC55" class="blob-code blob-code-inner js-file-line"> c_mktsegment <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L56" class="blob-num js-line-number" data-line-number="56"></td> <td id="LC56" class="blob-code blob-code-inner js-file-line"> c_comment <span class="pl-k">TEXT</span></td> </tr> <tr> <td id="L57" class="blob-num js-line-number" data-line-number="57"></td> <td id="LC57" class="blob-code blob-code-inner js-file-line">);</td> </tr> <tr> <td id="L58" class="blob-num js-line-number" data-line-number="58"></td> <td id="LC58" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L59" class="blob-num js-line-number" data-line-number="59"></td> <td id="LC59" class="blob-code blob-code-inner js-file-line"><span class="pl-k">create</span> <span class="pl-k">table</span> <span class="pl-en">orders</span> (</td> </tr> <tr> <td id="L60" class="blob-num js-line-number" data-line-number="60"></td> <td id="LC60" class="blob-code blob-code-inner js-file-line"> o_orderkey <span class="pl-k">INT</span>, </td> </tr> <tr> <td id="L61" class="blob-num js-line-number" data-line-number="61"></td> <td id="LC61" class="blob-code blob-code-inner js-file-line"> o_custkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L62" class="blob-num js-line-number" data-line-number="62"></td> <td id="LC62" class="blob-code blob-code-inner js-file-line"> o_orderstatus <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L63" class="blob-num js-line-number" data-line-number="63"></td> <td id="LC63" class="blob-code blob-code-inner js-file-line"> o_totalprice <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L64" class="blob-num js-line-number" data-line-number="64"></td> <td id="LC64" class="blob-code blob-code-inner js-file-line"> o_orderdate <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L65" class="blob-num js-line-number" data-line-number="65"></td> <td id="LC65" class="blob-code blob-code-inner js-file-line"> o_orderpriority <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L66" class="blob-num js-line-number" data-line-number="66"></td> <td id="LC66" class="blob-code blob-code-inner js-file-line"> o_clerk <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L67" class="blob-num js-line-number" data-line-number="67"></td> <td id="LC67" class="blob-code blob-code-inner js-file-line"> o_shippriority <span class="pl-k">INT</span>, </td> </tr> <tr> <td id="L68" class="blob-num js-line-number" data-line-number="68"></td> <td id="LC68" class="blob-code blob-code-inner js-file-line"> o_comment <span class="pl-k">TEXT</span></td> </tr> <tr> <td id="L69" class="blob-num js-line-number" data-line-number="69"></td> <td id="LC69" class="blob-code blob-code-inner js-file-line">);</td> </tr> <tr> <td id="L70" class="blob-num js-line-number" data-line-number="70"></td> <td id="LC70" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L71" class="blob-num js-line-number" data-line-number="71"></td> <td id="LC71" class="blob-code blob-code-inner js-file-line"><span class="pl-k">create</span> <span class="pl-k">table</span> <span class="pl-en">lineitem</span> (</td> </tr> <tr> <td id="L72" class="blob-num js-line-number" data-line-number="72"></td> <td id="LC72" class="blob-code blob-code-inner js-file-line"> l_orderkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L73" class="blob-num js-line-number" data-line-number="73"></td> <td id="LC73" class="blob-code blob-code-inner js-file-line"> l_partkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L74" class="blob-num js-line-number" data-line-number="74"></td> <td id="LC74" class="blob-code blob-code-inner js-file-line"> l_suppkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L75" class="blob-num js-line-number" data-line-number="75"></td> <td id="LC75" class="blob-code blob-code-inner js-file-line"> l_linenumber <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L76" class="blob-num js-line-number" data-line-number="76"></td> <td id="LC76" class="blob-code blob-code-inner js-file-line"> l_quantity <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L77" class="blob-num js-line-number" data-line-number="77"></td> <td id="LC77" class="blob-code blob-code-inner js-file-line"> l_extendedprice <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L78" class="blob-num js-line-number" data-line-number="78"></td> <td id="LC78" class="blob-code blob-code-inner js-file-line"> l_discount <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L79" class="blob-num js-line-number" data-line-number="79"></td> <td id="LC79" class="blob-code blob-code-inner js-file-line"> l_tax <span class="pl-k">REAL</span>,</td> </tr> <tr> <td id="L80" class="blob-num js-line-number" data-line-number="80"></td> <td id="LC80" class="blob-code blob-code-inner js-file-line"> l_returnflag <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L81" class="blob-num js-line-number" data-line-number="81"></td> <td id="LC81" class="blob-code blob-code-inner js-file-line"> l_linestatus <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L82" class="blob-num js-line-number" data-line-number="82"></td> <td id="LC82" class="blob-code blob-code-inner js-file-line"> l_shipdate <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L83" class="blob-num js-line-number" data-line-number="83"></td> <td id="LC83" class="blob-code blob-code-inner js-file-line"> l_commitdate <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L84" class="blob-num js-line-number" data-line-number="84"></td> <td id="LC84" class="blob-code blob-code-inner js-file-line"> l_receiptdate <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L85" class="blob-num js-line-number" data-line-number="85"></td> <td id="LC85" class="blob-code blob-code-inner js-file-line"> l_shipinstrust <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L86" class="blob-num js-line-number" data-line-number="86"></td> <td id="LC86" class="blob-code blob-code-inner js-file-line"> l_shipmode <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L87" class="blob-num js-line-number" data-line-number="87"></td> <td id="LC87" class="blob-code blob-code-inner js-file-line"> l_comment <span class="pl-k">TEXT</span></td> </tr> <tr> <td id="L88" class="blob-num js-line-number" data-line-number="88"></td> <td id="LC88" class="blob-code blob-code-inner js-file-line">);</td> </tr> <tr> <td id="L89" class="blob-num js-line-number" data-line-number="89"></td> <td id="LC89" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L90" class="blob-num js-line-number" data-line-number="90"></td> <td id="LC90" class="blob-code blob-code-inner js-file-line"><span class="pl-k">create</span> <span class="pl-k">table</span> <span class="pl-en">nation</span> (</td> </tr> <tr> <td id="L91" class="blob-num js-line-number" data-line-number="91"></td> <td id="LC91" class="blob-code blob-code-inner js-file-line"> n_nationkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L92" class="blob-num js-line-number" data-line-number="92"></td> <td id="LC92" class="blob-code blob-code-inner js-file-line"> n_name <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L93" class="blob-num js-line-number" data-line-number="93"></td> <td id="LC93" class="blob-code blob-code-inner js-file-line"> n_regionkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L94" class="blob-num js-line-number" data-line-number="94"></td> <td id="LC94" class="blob-code blob-code-inner js-file-line"> n_comment <span class="pl-k">TEXT</span></td> </tr> <tr> <td id="L95" class="blob-num js-line-number" data-line-number="95"></td> <td id="LC95" class="blob-code blob-code-inner js-file-line">);</td> </tr> <tr> <td id="L96" class="blob-num js-line-number" data-line-number="96"></td> <td id="LC96" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L97" class="blob-num js-line-number" data-line-number="97"></td> <td id="LC97" class="blob-code blob-code-inner js-file-line"><span class="pl-k">create</span> <span class="pl-k">table</span> <span class="pl-en">region</span> (</td> </tr> <tr> <td id="L98" class="blob-num js-line-number" data-line-number="98"></td> <td id="LC98" class="blob-code blob-code-inner js-file-line"> r_regionkey <span class="pl-k">INT</span>,</td> </tr> <tr> <td id="L99" class="blob-num js-line-number" data-line-number="99"></td> <td id="LC99" class="blob-code blob-code-inner js-file-line"> r_name <span class="pl-k">TEXT</span>,</td> </tr> <tr> <td id="L100" class="blob-num js-line-number" data-line-number="100"></td> <td id="LC100" class="blob-code blob-code-inner js-file-line"> r_comment <span class="pl-k">TEXT</span></td> </tr> <tr> <td id="L101" class="blob-num js-line-number" data-line-number="101"></td> <td id="LC101" class="blob-code blob-code-inner js-file-line">);</td> </tr> </table> </div> </div> <button type="button" data-facebox="#jump-to-line" data-facebox-class="linejump" data-hotkey="l" class="hidden">Jump to Line</button> <div id="jump-to-line" style="display:none"> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="" class="js-jump-to-line-form" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <input class="linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;" aria-label="Jump to line" autofocus> <button type="submit" class="btn">Go</button> </form></div> </div> <div class="modal-backdrop"></div> </div> </div> </div> </div> <div class="container site-footer-container"> <div class="site-footer" role="contentinfo"> <ul class="site-footer-links right"> <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li> <li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li> <li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li> <li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li> <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li> <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li> <li><a href="https://github.com/pricing" data-ga-click="Footer, go to pricing, text:pricing">Pricing</a></li> </ul> <a href="https://github.com" aria-label="Homepage" class="site-footer-mark"> <svg aria-hidden="true" class="octicon octicon-mark-github" height="24" role="img" title="GitHub " version="1.1" viewBox="0 0 16 16" width="24"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 0.4 0.07 0.55-0.17 0.55-0.38 0-0.19-0.01-0.82-0.01-1.49-2.01 0.37-2.53-0.49-2.69-0.94-0.09-0.23-0.48-0.94-0.82-1.13-0.28-0.15-0.68-0.52-0.01-0.53 0.63-0.01 1.08 0.58 1.23 0.82 0.72 1.21 1.87 0.87 2.33 0.66 0.07-0.52 0.28-0.87 0.51-1.07-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.59 0.82-2.15-0.08-0.2-0.36-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82 0.64-0.18 1.32-0.27 2-0.27 0.68 0 1.36 0.09 2 0.27 1.53-1.04 2.2-0.82 2.2-0.82 0.44 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.82 1.27 0.82 2.15 0 3.07-1.87 3.75-3.65 3.95 0.29 0.25 0.54 0.73 0.54 1.48 0 1.07-0.01 1.93-0.01 2.2 0 0.21 0.15 0.46 0.55 0.38C13.71 14.53 16 11.53 16 8 16 3.58 12.42 0 8 0z"></path></svg> </a> <ul class="site-footer-links"> <li>&copy; 2016 <span title="0.09947s from github-fe144-cp1-prd.iad.github.net">GitHub</span>, Inc.</li> <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li> <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li> <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li> <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact</a></li> <li><a href="https://help.github.com" data-ga-click="Footer, go to help, text:help">Help</a></li> </ul> </div> </div> <div id="ajax-error-message" class="ajax-error-message flash flash-error"> <svg aria-hidden="true" class="octicon octicon-alert" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M15.72 12.5l-6.85-11.98C8.69 0.21 8.36 0.02 8 0.02s-0.69 0.19-0.87 0.5l-6.85 11.98c-0.18 0.31-0.18 0.69 0 1C0.47 13.81 0.8 14 1.15 14h13.7c0.36 0 0.69-0.19 0.86-0.5S15.89 12.81 15.72 12.5zM9 12H7V10h2V12zM9 9H7V5h2V9z"></path></svg> <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" class="octicon octicon-x" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M7.48 8l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75-1.48-1.48 3.75-3.75L0.77 4.25l1.48-1.48 3.75 3.75 3.75-3.75 1.48 1.48-3.75 3.75z"></path></svg> </button> Something went wrong with that request. Please try again. </div> <script crossorigin="anonymous" integrity="sha256-5nfyAipdNuj1rTXQ/LAfg/HNthPtoESfUzGXaTvMa9o=" src="https://assets-cdn.github.com/assets/frameworks-e677f2022a5d36e8f5ad35d0fcb01f83f1cdb613eda0449f533197693bcc6bda.js"></script> <script async="async" crossorigin="anonymous" integrity="sha256-bNHSm93U6XFeAABqVqd5LjNY/OsYbbJfY/6kEOdHz6o=" src="https://assets-cdn.github.com/assets/github-6cd1d29bddd4e9715e00006a56a7792e3358fceb186db25f63fea410e747cfaa.js"></script> <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner hidden"> <svg aria-hidden="true" class="octicon octicon-alert" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M15.72 12.5l-6.85-11.98C8.69 0.21 8.36 0.02 8 0.02s-0.69 0.19-0.87 0.5l-6.85 11.98c-0.18 0.31-0.18 0.69 0 1C0.47 13.81 0.8 14 1.15 14h13.7c0.36 0 0.69-0.19 0.86-0.5S15.89 12.81 15.72 12.5zM9 12H7V10h2V12zM9 9H7V5h2V9z"></path></svg> <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span> <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span> </div> <div class="facebox" id="facebox" style="display:none;"> <div class="facebox-popup"> <div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description"> </div> <button type="button" class="facebox-close js-facebox-close" aria-label="Close modal"> <svg aria-hidden="true" class="octicon octicon-x" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M7.48 8l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75-1.48-1.48 3.75-3.75L0.77 4.25l1.48-1.48 3.75 3.75 3.75-3.75 1.48 1.48-3.75 3.75z"></path></svg> </button> </div> </div> </body> </html>
DROP TABLE IF EXISTS coffee_tea; CREATE TABLE coffee_tea (value SMALLINT PRIMARY KEY, property VARCHAR (20) NOT NULL); INSERT INTO coffee_tea (value, property) VALUES (1, 'Coffee'); INSERT INTO coffee_tea (value, property) VALUES (2, 'Tea');
INSERT INTO planets (name, mass, distance, diameter) VALUES ("Earth" , 1, 149597870, 12756), ("Venus" , 0.9, 108208930, 12104), ("Mars", 0.1, 227936640, 6794), ("Mercurius", 0.1, 57910000, 4880);
SET search_path TO tempdb; create table Data ( RecordNumber varchar(5) not null unique, InternalMemo multiocc null, Comments text null, RecNum varchar(7) not null check(left(RecNum, 3) = 'WRN') unique, Org1 varchar(100) null, Org2 varchar(70) null, Org3 varchar(70) null, Org4 varchar(70) null, Org5 varchar(70) null, AltOrg multiocc null, FormerOrg multiocc null, XRef multiocc null, StreetBuilding varchar(90) null, StreetAddress varchar(90) null, StreetCity varchar(40) null, MailCareOf varchar(60) null, Building varchar(90) null, Address varchar(90) null, City varchar(40) null, Province varchar(25) null, PostalCode varchar(7) null, Accessibility multiocc null, Location varchar(60) null, Intersection varchar(60) null, OfficePhone multiocc null, Fax multiocc null, EMail multiocc null, WWW varchar(255) null, AfterHoursPhone multiocc null, CrisisPhone multiocc null, TDDPhone multiocc null, Data varchar(30) null, Description multiocc null, PubDescription text null, GeneralInfo text null, BND multiocc null, OtherResource text null, Fees text null, Hours text null, Dates text null, AreaServed multiocc null, Eligibility text null, Application multiocc null, Languages multiocc null, Contact1 varchar(60) null, Contact1Title varchar(120) null, Contact1Org varchar(90) null, Contact1Phone multiocc null, Contact2 varchar(60) null, Contact2Title varchar(120) null, PrintedMaterial multiocc null, Contact2Org varchar(90) null, Contact2Phone multiocc null, Contact3 varchar(60) null, Contact3Title varchar(120) null, Contact3Org varchar(90) null, Contact3Phone multiocc null, Contact4 varchar(60) null, Contact4Title varchar(120) null, Contact4Org varchar(90) null, Contact4Phone multiocc null, DateEstablished varchar(60) null, Elections varchar(120) null, Funding multiocc null, DDCode varchar(10) null, LevelOfService varchar(60) null, Subject multiocc null, UsedFor multiocc null, Blue multiocc null, SeeAlso multiocc null, LocalSubjects multiocc null, TypeOfRecord varchar(2) null, QualityLevel varchar(20) null, ToBeDeleted varchar(20) null, Distribution multiocc null, Pub multiocc null, SourceOfInfo varchar(60) null, SourceTitle varchar(60) null, SourceOrg varchar(60) null, SourceBuilding varchar(30) null, SourceAddress varchar(60) null, SourceCity varchar(30) null, SourceProvince varchar(2) null, SourcePostalCode varchar(7) null, SourcePhone multiocc null, CollectedBy varchar(40) null, DateCollected varchar(10) null, CreatedBy varchar(40) null, UpdatedBy varchar(40) null, UpdateDate varchar(10) null, UpdateSchedule varchar(10) null, HistoryOfUpdate varchar(10) null, LastModified multiocc null, org1_sort varchar(100) null, id serial primary key, org_name_id integer not null ); -- skipping WebConnection -- skipping WebDocumentType -- skipping WebSynchronize -- skipping WebTemplate -- skipping WebData -- skipping WebVersion create table thes ( id serial primary key, term varchar(60) not null, note text not null, action varchar(6) null, cat_id integer null, sort varchar(6) null ); create table thes_cat ( id serial primary key, category varchar(30) not null ); create table thes_tree ( id serial primary key, term text not null, parent_id integer null, cat_id integer not null ); -- skipping thes_data -- skipping StaffBook -- skipping staff_calendar -- skipping staff_group -- skipping staff_hours create table city ( id serial primary key, city varchar(20) not null ); create table pub ( id serial primary key, code varchar(20) not null unique, title varchar(50) not null, isdefault boolean not null default false, lastUpdated timestamp null, note text null ); create table thes_related ( thes_id integer not null, related_id integer not null, primary key (thes_id, related_id) ); -- skipping blue_entry create table thes_reject ( thes_id integer not null, accept_id integer not null ); -- skipping thes_blue_entry -- skipping thes_blue -- skipping old_blue_entry -- skipping thes_blue_related -- skipping xref -- skipping defunct create table tlkpAddressType ( ID serial primary key, Name varchar(50) not null ); create table tblAddress ( ID serial primary key, AddressTypeID integer not null, InCareOf varchar(60) null, Building varchar(50) null, Address varchar(50) null, City varchar(50) not null, Province varchar(2) null default 'ON', PostalCode varchar(7) null check(postalcode ~* '[a-z][0-9][a-z] [0-9][a-z][0-9]'), Intersection varchar(255) null, unit varchar(10) null, unitValue varchar(10) null, streetNumber varchar(10) null, streetSuffix varchar(10) null, streetDirection varchar(2) null, unitExtra varchar(25) null, deliveryNumber varchar(10) null, deliveryStation varchar(30) null, deliveryMode varchar(20) null, busRoute varchar(50) null, utm_x integer null, utm_y integer null, ismappable boolean null, latitude decimal(11,9) null, longitude decimal(11,9) null, check( (utm_x is null and utm_y is null) or (utm_x is not null and utm_y is not null) or (latitude is null and longitude is null) or (latitude is not null and longitude is not null) ) ); create table tlkpAccessibility ( ID serial primary key, Name varchar(100) not null ); create table trelAddressAccessibility ( AddressID serial primary key, AccessibilityID integer not null ); create table tlkpCommType ( ID serial primary key, Name varchar(50) not null unique ); create table tblComm ( ID serial primary key, CommTypeID integer not null, Value varchar(255) not null, Comment text null, check( (commtypeid in (1, 2, 3, 5, 6) and value ~* '[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]') or (commtypeid = 2 and value = '911') or (commtypeid = 4 and value like '_%@%.%') or (commtypeid = 7 and value like '%.__%') or commtypeid > 7 ) ); create table tblContact ( ID serial primary key, Name varchar(60) null, Title varchar(120) null, Org varchar(90) null, Comm text null, ContactType integer null default 0 ); create table tblService ( ID serial primary key, Description text null, Eligibility text null, Info text null, Fees text null, Hours text null, Dates text null, Application text null, updated timestamp null, ciocDescription text null, ciocEligibility text null, ciocApplication text null ); create table tlkpLanguage ( ID serial primary key, Name text not null ); create table trelServiceLanguage ( ServiceID integer not null, LanguageID integer not null, primary key (ServiceID, LanguageID) ); create table tlkpArea ( ID serial primary key, Name text not null ); create table trelServiceArea ( ServiceID integer not null, AreaID integer not null, primary key (ServiceID, AreaID) ); -- skipping Level integer null COMPUTE ((length(sort_key)-1)/5): no COMPUTE -- skipping Name varchar(100) not null check(length(name) > 0): bad data create table tblOrgName ( ID serial primary key, OrgNameTypeID integer not null, Name varchar(100) not null, ParentID integer null, Level integer null, Sort varchar(100) null, sort_key varchar(100) null, added timestamp null default current_timestamp ); create table tlkpOrgNameType ( ID serial primary key, Type varchar(20) not null ); -- skipping meta_word -- skipping meta_column -- skipping org_notes -- skipping meta_index -- skipping meta_group -- skipping meta_column_group create table org_names ( id serial primary key, org_id integer not null, org_name_id integer not null, added timestamp null default current_timestamp, unique(org_id, org_name_id) ); -- skipping meta_index_thes create table org ( id serial primary key, org_name_id integer not null, update_note text null, cic_id varchar(7) not null unique, updated timestamp null default current_timestamp, service_level varchar(60) not null, created timestamp not null default current_timestamp, isactive boolean not null default true, iscomplete boolean not null default false, modified timestamp null, established varchar(4) null check(established ~* '[1-2][0-9][0-9][0-9]'), bn varchar(15) null check(bn ~* '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]RR[0-9][0-9][0-9][0-9]'), deleted timestamp null ); -- skipping org_mod -- skipping org_meta -- skipping settle_thes -- skipping settle_org create table org_comm_rel ( id serial primary key, org_id integer not null, comm_id integer not null, added timestamp not null default current_timestamp, note text null ); create table org_address_rel ( id serial primary key, org_id integer not null, address_id integer not null, added timestamp not null default current_timestamp, note varchar(100) null, label varchar(50) null ); create table org_contact_rel ( id serial primary key, org_id integer not null, contact_id integer not null, added timestamp not null default current_timestamp, note text null ); create table org_rel_del ( id serial primary key, org_id integer not null, rel_id integer not null, added timestamp not null, note text null, deleted timestamp not null, table_id integer not null ); create table org_service_rel ( id serial primary key, org_id integer not null, service_id integer not null, added timestamp not null default current_timestamp, note text null ); create table org_del ( id serial primary key, org_name_id integer not null, update_note text null, cic_id varchar(7) not null unique, updated timestamp null, service_level varchar(60) null ); create table pub_org ( id serial primary key, pub_id integer not null, org_id integer not null, added timestamp not null default current_timestamp, org_contact_id integer null, deleted timestamp null, isActive boolean not null default true, xml text null, unique(pub_id, org_id) ); create table thes_original ( id serial primary key, de varchar(100) not null unique, use varchar(100) null, woo varchar(1) null, eq varchar(100) null, uf text null, sn text null, bt varchar(100) null, nt text null, rt varchar(150) null, ca varchar(50) null, input varchar(50) null, act varchar(10) not null, msg varchar(50) null, cr varchar(50) null, up varchar(50) null, sort varchar(100) null, comments text null ); -- skipping res_type -- skipping res_loc -- skipping res -- skipping res_order -- skipping org_res_rel -- skipping pub_list -- skipping temp_name_1 -- skipping temp_name_2 -- skipping temp_name_3 create table thes_rel ( id serial primary key, thes_id integer not null, rel_id integer not null, rel_type varchar(2) not null, ca integer null, sort_key varchar(100) null, comments text null ); -- skipping temp_insert -- skipping temp_insert_rel create table org_thes ( id serial primary key, org_id integer not null, thes_id integer not null, official_id integer not null, unique(org_id, thes_id, official_id) ); -- skipping temp_thes create table pub_entry ( id serial primary key, pub_org_id integer not null, entry integer not null, pub_year integer not null check(pub_year between 2000 and 2050), unique(pub_org_id, pub_year) ); create table area ( id serial primary key, name varchar(255) not null, locatedIn integer null, alt varchar(255) null, unique(name, locatedin) ); -- skipping org_parent_child -- skipping parent_child_hours -- skipping taxonomy_original create table taxonomy ( id serial primary key, name varchar(100) not null, code varchar(19) null unique, isPreferred boolean not null, definition text null, created date null, modified date null, parentId integer null, cicModified timestamp null ); -- skipping taxonomy_original -- skipping taxtree create table taxRel ( id serial primary key, taxID integer not null, relID integer not null, relType varchar(2) not null, unique(taxid, relid) ); -- skipping org_tax -- skipping tempSuffix -- skipping addressSuffix -- skipping addressUnit -- skipping cura -- skipping curaTarget -- skipping curaTargets -- skipping curaCategory -- skipping curaCategories -- skipping curaCatchment -- skipping curaAvailability -- skipping tblProject -- skipping trelBroadcastProject -- skipping tlkpBroadcastType -- skipping tblBroadcast -- skipping trelBroadcastRec -- skipping tlkpBroadcastStatus create table locations ( id serial primary key, officialName varchar(100) not null, locatedIn integer null, sortAs varchar(100) null, displayAs varchar(100) null ); -- skipping log_level -- skipping log_source -- skipping log_contact -- skipping log_age -- skipping log_enq -- skipping log_area_call -- skipping log_area_need -- skipping log_enq_mode -- skipping staff -- skipping DocInfo -- skipping NAMESDATA -- skipping PAGESDATA -- skipping SortHeadings -- skipping SUBJECTDATA -- skipping subjects -- skipping TESTXML -- skipping XMLContent -- skipping log_result -- skipping log_need -- skipping log_resource -- skipping tempCIT create table pubGroupName ( id serial primary key, groupName varchar(50) not null ); create table pubGroup ( id serial primary key, pubId integer not null, groupId integer not null, unique(pubId, groupId) ); -- skipping tempGeo create table orgNotes ( id serial primary key, orgId integer not null, noteType integer not null, note text not null, added timestamp not null default current_timestamp, modified timestamp null, isactive boolean not null default true, ispublic boolean not null default true, alertDate date null ); create table orgNoteTypes ( id serial primary key, value varchar(30) not null ); create table pubThes ( id serial primary key, pubId integer not null, thesId integer not null, isactive boolean not null default true, unique(pubid, thesid) ); -- skipping tempUTM -- skipping orgmod -- skipping orgmodcolumns -- skipping og create table taxGroups ( id serial primary key, taxGroup integer not null, taxID integer not null, isActive boolean not null, hasChildren boolean not null, added timestamp null default current_timestamp, isLocal boolean not null default false, modified timestamp null, unique(taxgroup, taxid) ); create table temptaxgroup ( groupid integer not null, taxcode varchar(13) not null ); create table taxChanges ( changeType integer not null, oldCode varchar(13) not null, newCode varchar(13) not null, oldName varchar(60) not null, newName varchar(60) not null, dateUS varchar(10) not null ); -- skipping tempContactComm -- skipping taxgroup create table orgUpdated ( id serial primary key, orgid integer not null, updated timestamp not null, unique(orgid, updated) ); -- skipping temp211 -- skipping postalCodes -- skipping sqlXml create table taxLink ( id serial primary key, linkId integer not null, taxId integer not null, unique(linkId, taxId) ); create table orgTaxLink ( id serial primary key, orgId integer not null, linkId integer not null, added timestamp null default current_timestamp, unique(orgId, linkId) ); create table taxLinkNote ( id serial primary key, note text not null ); -- skipping taxStartTemp -- skipping taxTemp create table cioc ( id serial primary key, pid integer not null, ptype integer not null, xid integer not null, unique(xid, ptype, pid) ); create table ciocExport ( id serial primary key, updated timestamp null, notes text not null ); -- skipping tempNO create table taxRelTemp ( id serial primary key, taxCode varchar(19) not null, relCode varchar(19) not null, relType varchar(2) not null ); -- skipping taxTempOldCode -- skipping taxonomy_copy -- skipping funding create table tempTaxNames ( code varchar(19) not null, name varchar(100) not null, isPreferred boolean not null, release text null ); create table tempTaxAlso ( code varchar(19) not null, see varchar(19) not null, release text null ); create table tempTaxOld ( code varchar(19) not null, old varchar(19) not null, release text null ); create table tempTaxDetails ( code varchar(19) not null, definition text not null, created date not null, modified date not null, release text null ); -- skipping isql -- skipping org_location -- skipping org_locations create table pubTax ( id serial primary key, pubId integer not null, taxId integer not null, added timestamp not null default current_timestamp, unique(pubid, taxid) ); create table ic_agencies ( id serial primary key, orgid integer not null unique, CND varchar(8) null, name_1 varchar(100) null, name_level_1 integer null, name_2 varchar(100) null, name_level_2 integer null ); create table ic_agency_sites ( id serial primary key, agencyid integer not null, siteid integer not null, CND varchar(8) null, site_name varchar(200) null, -- changed from null site_name_level integer null, site_name_other varchar(3) null, unique(agencyid, siteid) ); create table ic_site_services ( id serial primary key, siteid integer not null, serviceid integer not null, service_name_1 varchar(200) null, service_name_2 varchar(200) null, unique(siteid, serviceid) ); create table pub_tree ( id integer not null, parent integer not null, -- why not a foreign key? pub integer not null, note text null, depth integer not null, primary key (id, parent) ); create table site ( id serial primary key, org_address_id integer not null unique, context_id integer not null default 1, code varchar(20) null ); create table org_tree ( id serial primary key, org_id integer not null, super_id integer not null ); create table org_site ( id serial primary key, org_id integer not null, site_id integer not null, name varchar(100) null, note text null, label varchar(100) null, type integer not null default 3, unique(org_id, site_id, label) ); create table org_site_name ( id serial primary key, org_site_id integer not null, org_names_id integer not null ); create table org_thes_pub ( id serial primary key, org_thes_id integer not null, pub_id integer not null, is_active boolean not null default true, unique(org_thes_id, pub_id) ); create table tempTaxActive ( code varchar(25) not null unique ); create table tempCCAC ( ext varchar(10) not null, id varchar(10) not null, name varchar(200) not null ); create table contact_comm ( id serial primary key, contact_id integer not null, comm_id integer not null, type integer null, note varchar(50) null, added timestamp not null default current_timestamp ); create table external ( id serial primary key, name varchar(50) not null, field varchar(50) not null, cic varchar(50) not null, note text not null ); create table external_data ( id serial primary key, external_type integer not null, cic_id integer not null, data text not null, external_id varchar(50) not null );
-- A list of people with the same name and zip, but different occupations. Many of these are probably matches. SELECT DISTINCT source.name, source.zip, source.employer, source.occupation, target.employer, target.occupation FROM fec_contribution AS source LEFT JOIN fec_contribution AS target ON ( source.name = target.name AND source.zip = target.zip AND ( source.employer != target.employer OR source.occupation != target.occupation ) ) -- Single doners don't count WHERE target.committee_id IS NOT NULL AND source.employer IS NOT NULL AND source.occupation IS NOT NULL AND target.employer IS NOT NULL AND target.occupation IS NOT NULL;
DROP TABLE userinfo; CREATE TABLE userinfo (userId varchar2(12) PRIMARY KEY,password varchar2(12) NOT NULL,name varchar2(20) NOT NULL,email varchar2(50)); INSERT INTO userinfo VALUES('guard', 'guard', '김경호', 'guard@naver.com');
DROP TABLE DEPLOY_TARGET; DB NAME :deploy CREATE TABLE DEPLOY_TARGET ( SEQ INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT , HOST_NAME VARCHAR2(50) NOT NULL, IP_ADDR VARCHAR2(50) NOT NULL, LISTEN_PORT INTEGER NOT NULL, DEPLOY_TYPE VARCHAR2(50) NOT NULL, USE_YN VARCHAR2(2), CONSTRAINT UN_DEPLOY_TARGET unique (HOST_NAME, IP_ADDR, DEPLOY_TYPE), CONSTRAINT DEPLOY_TYPE_FK foreign key (DEPLOY_TYPE) references DEPLOY_TYPE(DEPLOY_TYPE) ) CREATE TABLE DEPLOY_COMMAND ( SEQ INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT , HOST_NAME VARCHAR2(50) NOT NULL, IP_ADDR VARCHAR2(50) NOT NULL, COMMAND VARCHAR2(50) NOT NULL, SHELL_COMMAND VARCHAR2(50), SHELL_NAME VARCHAR2(50), SHELL_PARAMS VARCHAR2(50), USE_YN VARCHAR2(2), CONSTRAINT UN_DEPLOY_COMMAND unique (HOST_NAME, IP_ADDR, COMMAND) ) CREATE TABLE DEPLOY_TYPE ( SEQ INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT , DEPLOY_TYPE VARCHAR2(50) NOT NULL, CONSTRAINT UN_DEPLOY_TYPE unique (DEPLOY_TYPE) ) INSERT INTO DEPLOY_TYPE VALUES(null, 'WAS'); INSERT INTO DEPLOY_TYPE VALUES(null, 'WEB'); INSERT INTO DEPLOY_TYPE VALUES(null, 'OZ'); INSERT INTO DEPLOY_TYPE VALUES(null, 'BIZACTOR'); INSERT INTO DEPLOY_TYPE VALUES(null, 'BATCH'); INSERT INTO DEPLOY_TARGET VALUES(null, 'PORTAL-WAS', '10.255.84.235', 8080, 'WAS', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'PORTAL-WAS', '10.255.84.235', 8080, 'BIZACTOR', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'PORTAL-WAS', '10.255.84.235', 8080, 'OZ', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'PORTAL-WEB', '10.255.84.234', 8080, 'WEB', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'PORTAL-WAS', '10.255.84.232', 8080, 'WAS', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'PORTAL-WAS', '10.255.84.232', 8080, 'BIZACTOR', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'PORTAL-WAS', '10.255.84.232', 8080, 'OZ', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'PORTAL-WEB', '10.255.84.231', 8080, 'WEB', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'IBM-WAS', '10.255.84.230', 8080, 'WAS', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'IBM-WAS', '10.255.84.230', 8080, 'BIZACTOR', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'IBM-WAS', '10.255.84.230', 8080, 'OZ', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'IBM-WEB', '10.255.84.229', 8080, 'WEB', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'IBM-WAS', '10.255.84.228', 8080, 'WAS', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'IBM-WAS', '10.255.84.228', 8080, 'BIZACTOR', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'IBM-WAS', '10.255.84.228', 8080, 'OZ', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'IBM-WEB', '10.255.84.227', 8080, 'WEB', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'DSC-WAS', '10.255.84.226', 8080, 'WAS', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'DSC-WAS', '10.255.84.226', 8080, 'WAS', 'Y'); INSERT INTO DEPLOY_TARGET VALUES(null, 'BATCH', '10.255.84.225', 8080, 'BATCH', 'Y'); INSERT INTO DEPLOY_COMMAND VALUES(null, 'PORTAL-WAS', '10.255.84.235', 'start', 'sh', '/engn001/sehati/portal/tomcat/bin/startPortalSvr.sh', '', 'Y'); INSERT INTO DEPLOY_COMMAND VALUES(null, 'PORTAL-WAS', '10.255.84.235', 'stop', 'sh', '/engn001/sehati/portal/tomcat/bin/stopPortalSvr.sh', '', 'Y'); INSERT INTO DEPLOY_COMMAND VALUES(null, 'PORTAL-WAS', '192.168.11.93', 'deploy', 'java -cp d:/temp', 'ShellTest', '', 'Y');
--Author:Markus Baciu(C18350801) --Description: Inserts for all tables with weak entries entered as well describe class; insert into class values(56747,30); insert into class values(57890,25); insert into class(classid) values(57643); insert into class(classid) values(56378); describe student; insert into student values('c1745','12 dublin street dublin','ShaneBurke',56747); insert into student(studentid,studentname,class_classid) values('c6574','LukasMind',57643); insert into student values('c3654','13 wexford street', 'SultanSine',56378); insert into student values('d1812','27 trinity road','MatthewEnd',57890); describe question; insert into question values(01,'MCQ','d',5); insert into question values(02,'short text','the answer',10); insert into question values(03,'short text','answer 2',5); insert into question values(04,'short text','answer 3',10); insert into question values(05,'mcq','a',5); describe exam; insert into exam values(54321,'winter',sysdate,1200,0200,'t','f','f',01); insert into exam (examid,examsession,examdate,starttime,examduration,compulsory,question_questionno) values(56475,'summer',sysdate - 10,1300,0130,'f',05); insert into exam (examid,examsession,examdate,starttime,examduration,compulsory,question_questionno) values(76785,'summer',sysdate,1400,0200,'f',04); describe subject; insert into subject values('geo01','geography',56475); insert into subject values('his01','history',54321); insert into subject values('mat01','maths',76785); describe teacher; insert into teacher values(67586,'Mr.Lancaster','geo01',57643); insert into teacher values(57486,'Ms.Reilly','geo01',56378); insert into teacher values(56585,'Mr.Bean','mat01',57890); commit;
-- USER is a reserved keyword with Postgres -- You must use double quotes in every query that user is in: -- ex. SELECT * FROM "user"; -- Otherwise you will have errors! -- CREATE TABLE "user" ( -- "id" SERIAL PRIMARY KEY, -- "username" VARCHAR (80) UNIQUE NOT NULL, -- "password" VARCHAR (1000) NOT NULL -- ); CREATE TABLE "user_event" ( "id" serial NOT NULL, "user_id" int NOT NULL, "group_id" int NOT NULL, "event_id" int NOT NULL, "check_in" TIMESTAMP, "check_out" TIMESTAMP, "total_time" interval NOT NULL DEFAULT '0', CONSTRAINT "user_event_pk" PRIMARY KEY ("id") ) WITH ( OIDS=FALSE ); CREATE TABLE "user" ( "id" serial NOT NULL, "category" varchar(255) NOT NULL DEFAULT 'SO College', "first_name" varchar(255) NOT NULL, "last_name" varchar(255) NOT NULL, "email" varchar(255) NOT NULL UNIQUE, "phone_number" varchar(255) NOT NULL, "address" varchar(255) NOT NULL, "city" varchar(255) NOT NULL, "state" varchar(255) NOT NULL, "zip" int NOT NULL, "dob" DATE NOT NULL, "involved_w_sond_since" DATE, "college_id" int NOT NULL, "password" varchar(255), "access_level" int NOT NULL DEFAULT '1', "archived" BOOLEAN NOT NULL DEFAULT 'FALSE', CONSTRAINT "user_pk" PRIMARY KEY ("id") ) WITH ( OIDS=FALSE ); CREATE TABLE "event" ( "id" serial NOT NULL, "name" varchar(255) NOT NULL, "description" varchar(255) NOT NULL, "special_inst" varchar(255), "location" varchar(255) NOT NULL, "date" DATE, "pic_url" varchar(2550), "time" varchar(255), "archived" BOOLEAN NOT NULL DEFAULT 'FALSE', CONSTRAINT "event_pk" PRIMARY KEY ("id") ) WITH ( OIDS=FALSE ); CREATE TABLE "affiliation" ( "id" serial NOT NULL, "college_name" varchar(255) NOT NULL, "inactive" BOOLEAN NOT NULL DEFAULT 'FALSE', CONSTRAINT "affiliation_pk" PRIMARY KEY ("id") ) WITH ( OIDS=FALSE ); CREATE TABLE "user_group" ( "id" serial NOT NULL, "user_id" int NOT NULL, "group_id" int NOT NULL, CONSTRAINT "user_group_pk" PRIMARY KEY ("id") ) WITH ( OIDS=FALSE ); ALTER TABLE "user_event" ADD CONSTRAINT "user_event_fk0" FOREIGN KEY ("user_id") REFERENCES "user"("id"); ALTER TABLE "user_event" ADD CONSTRAINT "user_event_fk1" FOREIGN KEY ("event_id") REFERENCES "event"("id"); ALTER TABLE "user" ADD CONSTRAINT "user_fk0" FOREIGN KEY ("college_id") REFERENCES "affiliation"("id"); ALTER TABLE "user_group" ADD CONSTRAINT "user_group_fk0" FOREIGN KEY ("user_id") REFERENCES "user"("id"); ALTER TABLE "user_group" ADD CONSTRAINT "user_group_fk1" FOREIGN KEY ("group_id") REFERENCES "affiliation"("id"); -- Create Starting Affiliatons INSERT INTO "affiliation" ("college_name") VALUES ('NDSU'); INSERT INTO "affiliation" ("college_name") VALUES ('MSU'); INSERT INTO "affiliation" ("college_name") VALUES ('U Mary'); INSERT INTO "affiliation" ("college_name") VALUES ('UND'); INSERT INTO "affiliation" ("college_name") VALUES ('VCSU'); -- Create Starting Events INSERT INTO "event" ("name" , "description" , "special_inst" , "location" , "date" , "pic_url", "time") VALUES ('Fargo Polar Plunge' , 'Jump in some cold cold water for a good good cause' , 'BYOT (Bring Your Own Towel)' , 'Delta Hotels Fargo' , '20210410' , 'https://cdn.firespring.com/images/078a2188-221f-4876-8a49-eaea25b20932.png', '9:00'); INSERT INTO "event" ("name" , "description" , "special_inst" , "location" , "date" , "pic_url", "time") VALUES ('NDSU Bi - Weekly Meeting' , 'We will be meeting to discuss things and such' , 'Bring Snacks to Share' , 'Bergum Hall' , '20210823' , 'https://news.prairiepublic.org/sites/ndpr/files/201906/NDSO.jpg', '16:00');
SELECT T1.MERCH_KEY, T1.FLAG_ONLINE, T1.hierarchy_cd FROM cartaocontinente.dim_merchant_hierarchy T1; /* Retiramos as colunas: t1.merch_cd t1.merch_dsc t1.payment_service t1.hierarchy_dsc */
UPDATE ips INNER JOIN country ON ips.iso = country.iso SET ips.countryid = country.countryid; -- update UPDATE `account_transactions` SET `created` = UNIX_TIMESTAMP(`transaction_datetime`) WHERE created IS NULL; -- convert unix to datetime = FROM_UNIXTIME
SET @startDate = '2015-08-01 00:00:00'; SET @endDate = '2015-09-01 00:00:00'; # Clients who ordered in 2014 - 2015 # SELECT # c.id 'Client No' # , c.client_name 'Client Name' # , b.bill_name 'Billing Name' # , CONCAT_WS(' ', b.bill_address1, b.bill_address2, b.bill_city, b.bill_state, b.bill_zipcode) 'Billing Address' # , DATE(x.date) 'Last Order Placed' # , DATE(c.date_added) 'Date Added' # , CONCAT_WS(' ', d.firstname, d.lastname) 'Contact' # , u.id 'Contact ID' # , u.email 'Contact Email' # , c.phone 'Company Phone' # , DATE(u.register_date) 'Contact Register Date' # FROM # ( # SELECT # t.clientid # , MAX(o.ordereddate) 'date' # FROM orders o # JOIN client_transactions t ON t.orderid = o.id AND t.type = 'COMPLETED' # WHERE o.companyid = 1 # AND o.order_status = 7 # AND t.dts >= @startDate AND t.dts < @endDate # GROUP BY 1 # ) x # JOIN clients c ON c.id = x.clientid # JOIN clients_accounting_pref b ON b.clientid = c.id # JOIN user_data_client d ON d.clientid = c.id # JOIN user u ON u.id = d.userid AND u.active = 'Y' AND u.user_type = 3 # Client # ORDER BY x.date, c.client_name, u.register_date; SELECT c.client_name 'Client' , ot.descrip 'Product/Service' , s.descrip 'Status' , DATE(o.ordereddate) 'Date' , COUNT(*) 'Orders' FROM orders o JOIN order_status s ON s.id = o.order_status JOIN order_types ot ON ot.id = o.order_type JOIN user_data_client u ON u.userid = o.orderbyid JOIN clients c ON c.id = u.clientid WHERE o.companyid = 1 AND o.ordereddate >= @startDate AND o.ordereddate < @endDate GROUP BY 1, 2, 3, 4; SELECT o.ordereddate , p.accepteddate , ot.descrip , p.part_label , pt.descrip , CASE WHEN p.accepteddate = '0000-00-00 00:00:00' THEN NULL ELSE ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) END 'Placement Delay (Hours)' , o.order_status FROM orders o LEFT JOIN order_parts p ON p.orderid = o.id LEFT JOIN order_types ot ON ot.id = o.order_type LEFT JOIN part_types pt ON pt.id = p.part_type AND pt.id NOT IN (2, 3, 4) WHERE o.companyid = 1 AND o.ordereddate >= @startDate AND o.ordereddate < @endDate; SELECT ot.descrip 'Product/Service' , s.descrip 'Status' , COUNT(*) 'Orders' FROM orders o JOIN order_parts p ON p.orderid = o.id AND p.part_type NOT IN (2, 3, 4) JOIN order_status s ON s.id = o.order_status JOIN order_types ot ON ot.id = o.order_type WHERE o.companyid = 1 AND o.ordereddate >= @startDate AND o.ordereddate < @endDate GROUP BY 1, 2; SELECT o.id 'Order No' , ot.descrip 'Product/Service' , s.descrip 'Status' , o.ordereddate 'Order Date' , p.accepteddate 'Accepted Date' , ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) 'Placement Delay (Hours)' , p.part_label 'Label' , p.acceptedby 'Vendor No' , CONCAT_WS(' ', TRIM(v.firstname), TRIM(v.lastname)) 'Vendor Name' , p.vendorfee 'Vendor Fee' FROM orders o JOIN order_parts p ON p.orderid = o.id AND p.part_type NOT IN (2, 3, 4) JOIN order_status s ON s.id = o.order_status JOIN order_types ot ON ot.id = o.order_type JOIN user_data_vendor v ON v.userid = p.acceptedby WHERE o.companyid = 1 AND o.ordereddate >= @endDate ORDER BY o.id, p.part_label; SELECT o.id , ot.descrip 'Product/Service' , s.descrip 'Status' , o.ordereddate 'Order Date' , p.accepteddate 'Accepted Date' , ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) 'Placement Delay (Hours)' , CONCAT_WS(' ', TRIM(v.firstname), TRIM(v.lastname)) 'vendor' , p.vendorfee 'fee' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'A' JOIN order_status s ON s.id = o.order_status JOIN order_types ot ON ot.id = o.order_type JOIN user_data_vendor v ON v.userid = p.acceptedby WHERE o.companyid = 1 AND ot.id <> 45 # Trip Fee AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND o.ordereddate >= @endDate; SELECT o.id 'Order No' , ot.descrip 'Product' , o.ordereddate 'Order Date' , p.accepteddate 'Accepted Date' , CASE WHEN p.accepteddate = '0000-00-00 00:00:00' THEN ROUND(TIME_TO_SEC(TIMEDIFF(NOW(), o.ordereddate)) / 3600, 2) ELSE ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) END 'Placement Delay (Hours)' , CASE WHEN p.accepteddate = '0000-00-00 00:00:00' THEN ROUND(TIME_TO_SEC(TIMEDIFF(NOW(), o.ordereddate)) / 86400, 2) ELSE ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 86400, 2) END 'Placement Delay (Days)' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'A' JOIN order_types ot ON ot.id = o.order_type WHERE o.companyid = 1 AND o.order_type <> 45 # Trip Fee AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND o.ordereddate >= @endDate ORDER BY p.accepteddate DESC; # SET time_zone='US/Pacific'; SET @now = CONVERT_TZ(NOW(), 'UTC', 'US/Pacific'); SELECT @now; SELECT c.client_name 'Client Name' , o.id 'Order No' , s.descrip 'Status' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , o.ordereddate 'Order Date' , @now 'US/Pacific Time (Now)' , ROUND(TIME_TO_SEC(TIMEDIFF(@now, o.ordereddate)) / 3600, 2) 'Placement Delay (Hours)' , ROUND(TIME_TO_SEC(TIMEDIFF(@now, o.ordereddate)) / 86400, 2) 'Placement Delay (Days)' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'A' JOIN order_types ot ON ot.id = o.order_type JOIN order_status s ON s.id = o.order_status JOIN user_data_client u ON u.userid = o.orderbyid JOIN clients c ON c.id = u.clientid WHERE o.companyid = 1 AND ot.id <> 45 # Trip Fee AND s.id NOT IN (10, 12) # Order Canceled AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.accepteddate = '0000-00-00 00:00:00' AND o.ordereddate >= '2015-01-01 00:00:00' ORDER BY o.ordereddate, o.id; SELECT o.id 'Order No' , DATE(o.ordereddate) 'Order Date' , x.client_name 'Client Name' , s.descrip 'Order Status' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , IFNULL(a.status, '') 'Part A' , a.accepteddate , IFNULL(a.delay, '') 'Acceptance Delay (hours)' , IFNULL(ROUND(a.delay / 24, 2), '') 'Delay (days)' , IFNULL(b.status, '') 'Part B' , IFNULL(b.delay, '') 'Acceptance Delay (hours)' , IFNULL(ROUND(b.delay / 24, 2), '') 'Delay (days)' , IFNULL(c.status, '') 'Part C' , IFNULL(c.delay, '') 'Acceptance Delay (hours)' , IFNULL(ROUND(b.delay / 24, 2), '') 'Delay (days)' FROM orders o JOIN order_types ot ON ot.id = o.order_type JOIN order_status s ON s.id = o.order_status # Completed, Canceled, Duplicate AND s.id NOT IN (7, 10, 12) JOIN user_data_client u ON u.userid = o.orderbyid JOIN clients x ON x.id = u.clientid LEFT JOIN ( SELECT o.id , p.accepteddate , s.descrip 'status' , ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) 'delay' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.part_label = 'A' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND o.ordereddate >= '2015-01-01 00:00:00' ) a ON a.id = o.id LEFT JOIN ( SELECT o.id , s.descrip 'status' , ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) 'delay' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.part_label = 'B' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND o.ordereddate >= '2015-01-01 00:00:00' ) b ON b.id = a.id LEFT JOIN ( SELECT o.id , s.descrip 'status' , ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) 'delay' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.part_label = 'C' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND o.ordereddate >= '2015-01-01 00:00:00' ) c ON c.id = a.id WHERE o.companyid = 1 AND o.ordereddate >= '2015-01-01 00:00:00' ORDER BY o.order_status, o.ordereddate; SELECT o.id 'Order No' # , DATE(o.ordereddate) 'Order Date' # , x.client_name 'Client Name' , s.descrip 'Order Status' # , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , IFNULL(a.status, '') 'Part A' , IFNULL(b.status, '') 'Part B' , IFNULL(c.status, '') 'Part C' FROM orders o JOIN order_types ot ON ot.id = o.order_type JOIN order_status s ON s.id = o.order_status # Completed, Canceled, Reconsideration AND s.id IN (7, 10, 14) JOIN user_data_client u ON u.userid = o.orderbyid JOIN clients x ON x.id = u.clientid LEFT JOIN ( SELECT o.id , p.accepteddate , s.descrip 'status' , ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) 'delay' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.part_label = 'A' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND o.ordereddate >= '2015-01-01 00:00:00' ) a ON a.id = o.id LEFT JOIN ( SELECT o.id , s.descrip 'status' , ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) 'delay' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.part_label = 'B' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND o.ordereddate >= '2015-01-01 00:00:00' ) b ON b.id = a.id LEFT JOIN ( SELECT o.id , s.descrip 'status' , ROUND(TIME_TO_SEC(TIMEDIFF(p.accepteddate, o.ordereddate)) / 3600, 2) 'delay' FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.part_label = 'C' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND o.ordereddate >= '2015-01-01 00:00:00' ) c ON c.id = a.id WHERE o.companyid = 1 AND o.ordereddate >= '2015-01-01 00:00:00' ORDER BY o.order_status, o.ordereddate; SELECT * FROM order_parts p WHERE p.orderid = 140912; SELECT * FROM part_types; SELECT o.id , ot.descrip 'Product' , s.descrip 'Status' , o.ordereddate , a.accepteddate , b.accepteddate , c.accepteddate FROM orders o JOIN order_status s ON s.id = o.order_status JOIN order_types ot ON ot.id = o.order_type LEFT JOIN order_parts a ON a.orderid = o.id AND a.part_label = 'A' AND a.part_type NOT IN (2, 3, 4) LEFT JOIN order_parts b ON b.orderid = o.id AND b.part_label = 'B' AND b.part_type NOT IN (2, 3, 4) LEFT JOIN order_parts c ON c.orderid = o.id AND c.part_label = 'C' AND c.part_type NOT IN (2, 3, 4) WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) AND o.ordereddate >= '2015-01-01 00:00:00' ORDER BY o.ordereddate; SELECT o.id 'Order No' , ot.descrip 'Product' , s.descrip 'Order Status' , a.status FROM orders o JOIN order_types ot ON ot.id = o.order_type JOIN order_status s ON s.id = o.order_status LEFT JOIN ( SELECT o.id , s.descrip 'status' FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND p.part_label = 'A' AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND o.ordereddate >= '2015-09-01 00:00:00' ) a ON a.id = o.id WHERE o.companyid = 1 AND o.ordereddate >= '2015-09-01 00:00:00'; SELECT s.id 'Status ID' , s.descrip 'Status' , COUNT(*) 'Orders' FROM orders o JOIN order_status s ON s.id = o.order_status WHERE o.companyid = 1 AND o.ordereddate >= '2015-09-01 00:00:00' GROUP BY 1, 2; # SELECT # s.descrip # , sa.descrip # , sb.descrip # , sc.descrip # , COUNT(*) # FROM orders o # JOIN order_status s ON s.id = o.order_status # LEFT JOIN order_parts pa ON o.id = pa.orderid AND pa.part_label = 'A' # JOIN order_status sa ON sa.id = pa.order_status # LEFT JOIN order_parts pb ON o.id = pb.orderid AND pb.part_label = 'B' # JOIN order_status sb ON sb.id = pb.order_status # LEFT JOIN order_parts pc ON o.id = pc.orderid AND pc.part_label = 'C' # JOIN order_status sc ON sc.id = pc.order_status # WHERE o.companyid = 1 # AND o.ordereddate >= '2015-09-01 00:00:00' # GROUP BY 1, 2, 3, 4; SET time_zone = 'US/Pacific'; SET @startDate = '2015-01-01 00:00:00'; SELECT NOW() 'Timestamp' , o.id 'Order No' , DATE(o.ordereddate) 'Order Date' , x.client_name 'Client Name' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , s.descrip 'Order Status' , IFNULL(a.part_status, '') 'Part A' , a.accepteddate 'Accepted Date' , a.start_dts 'Start Date' , IFNULL(ROUND(a.delay / 86400, 2), '') 'Start Delay (days)' , IFNULL(ROUND(a.delta / 86400, 2), '') 'Vendor Delay (days)' , IFNULL(b.part_status, '') 'Part B' , b.accepteddate 'Accepted Date' , b.start_dts 'Start Date' , IFNULL(ROUND(b.delay / 86400, 2), '') 'Start Delay (days)' , IFNULL(ROUND(b.delta / 86400, 2), '') 'Vendor Delay (days)' , IFNULL(c.part_status, '') 'Part C' , c.accepteddate 'Accepted Date' , c.start_dts 'Start Date' , IFNULL(ROUND(c.delay / 86400, 2), '') 'Start Delay (days)' , IFNULL(ROUND(c.delta / 86400, 2), '') 'Vendor Delay (days)' FROM orders o JOIN order_types ot ON ot.id = o.order_type JOIN order_status s ON s.id = o.order_status JOIN user_data_client u ON u.userid = o.orderbyid JOIN clients x ON x.id = u.clientid JOIN ( SELECT o.id , s.descrip 'part_status' , IF(p.start_dts = '0000-00-00 00:00:00', (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(o.ordereddate)), (UNIX_TIMESTAMP(p.start_dts) - UNIX_TIMESTAMP(o.ordereddate))) 'delay' , IF(p.start_dts = '0000-00-00 00:00:00', 0, (UNIX_TIMESTAMP(p.start_dts) - UNIX_TIMESTAMP(p.accepteddate))) 'delta' , p.start_dts , p.accepteddate FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'A' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND o.ordereddate >= @startDate ) a ON a.id = o.id LEFT JOIN ( SELECT o.id , s.descrip 'part_status' , IF(p.start_dts = '0000-00-00 00:00:00', (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(o.ordereddate)), (UNIX_TIMESTAMP(p.start_dts) - UNIX_TIMESTAMP(o.ordereddate))) 'delay' , IF(p.start_dts = '0000-00-00 00:00:00', 0, (UNIX_TIMESTAMP(p.start_dts) - UNIX_TIMESTAMP(p.accepteddate))) 'delta' , p.start_dts , p.accepteddate FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'B' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND p.part_type NOT IN (2, 3) # Exterior, Interior AND o.ordereddate >= @startDate ) b ON b.id = o.id LEFT JOIN ( SELECT o.id , s.descrip 'part_status' , IF(p.start_dts = '0000-00-00 00:00:00', (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(o.ordereddate)), (UNIX_TIMESTAMP(p.start_dts) - UNIX_TIMESTAMP(o.ordereddate))) 'delay' , IF(p.start_dts = '0000-00-00 00:00:00', 0, (UNIX_TIMESTAMP(p.start_dts) - UNIX_TIMESTAMP(p.accepteddate))) 'delta' , p.start_dts , p.accepteddate FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'C' JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND p.part_type NOT IN (2, 3) # Exterior, Interior AND o.ordereddate >= @startDate ) c ON c.id = o.id WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND o.order_type <> 45 # Trip Fee AND o.ordereddate >= @startDate ORDER BY o.order_status, o.ordereddate; # Internal Delays (The order part has not been placed with a vendor) SELECT NOW() 'Timestamp' , o.id 'Order No' , o.ordereddate 'Order Date' , c.client_name 'Client Name' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , os.descrip 'Order Status' , ps.descrip 'Part Status' , p.part_label 'Label' , IFNULL(ROUND((UNIX_TIMESTAMP() - UNIX_TIMESTAMP(o.ordereddate)) / 86400, 2), '') 'Acceptance Delay (days)' FROM orders o JOIN order_parts p ON o.id = p.orderid JOIN order_types ot ON ot.id = o.order_type JOIN order_status os ON os.id = o.order_status JOIN order_status ps ON ps.id = p.order_status JOIN user_data_client u ON u.userid = o.orderbyid JOIN clients c ON c.id = u.clientid WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND p.order_status <> 10 # Canceled AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.accepteddate = '0000-00-00 00:00:00' AND o.ordereddate >= @startDate ORDER BY o.ordereddate, p.part_label; # External Delays (The vendor has not started) SELECT NOW() 'Timestamp' , o.id 'Order No' , o.ordereddate 'Order Date' , c.client_name 'Client Name' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , os.descrip 'Order Status' , ps.descrip 'Part Status' , p.part_label 'Label' , IFNULL( ROUND((UNIX_TIMESTAMP(p.accepteddate) - UNIX_TIMESTAMP(o.ordereddate)) / 86400, 2), '') 'Acceptance Delay (days)' , IFNULL(ROUND((UNIX_TIMESTAMP() - UNIX_TIMESTAMP(o.ordereddate)) / 86400, 2), '') 'Start Delay (days)' , p.acceptedby 'Vendor No' , CONCAT_WS(' ', TRIM(v.firstname), TRIM(v.lastname)) 'Vendor Name' FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_types ot ON ot.id = o.order_type JOIN order_status os ON os.id = o.order_status JOIN order_status ps ON ps.id = p.order_status JOIN user_data_vendor v ON v.userid = p.acceptedby JOIN user_data_client u ON u.userid = o.orderbyid JOIN clients c ON c.id = u.clientid WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND p.order_status <> 10 # Canceled AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.accepteddate > '0000-00-00 00:00:00' AND p.start_dts = '0000-00-00 00:00:00' AND o.ordereddate >= @startDate ORDER BY o.ordereddate, p.part_label; # External Delays (The order has been started, but has not yet completed) SELECT NOW() 'Timestamp' , o.id 'Order No' , o.ordereddate 'Order Date' , c.client_name 'Client Name' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , os.descrip 'Order Status' , ps.descrip 'Part Status' , p.part_label 'Label' , IFNULL( ROUND((UNIX_TIMESTAMP(p.accepteddate) - UNIX_TIMESTAMP(o.ordereddate)) / 86400, 2), '') 'Acceptance Delay (days)' , IFNULL(ROUND((UNIX_TIMESTAMP(p.start_dts) - UNIX_TIMESTAMP(p.accepteddate)) / 86400, 2), '') 'Start Delay (days)' , IFNULL(ROUND((UNIX_TIMESTAMP() - UNIX_TIMESTAMP(o.ordereddate)) / 86400, 2), '') 'Full Delay (days)' , p.acceptedby 'Vendor No' , CONCAT_WS(' ', TRIM(v.firstname), TRIM(v.lastname)) 'Vendor Name' FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_types ot ON ot.id = o.order_type JOIN order_status os ON os.id = o.order_status JOIN order_status ps ON ps.id = p.order_status JOIN user_data_vendor v ON v.userid = p.acceptedby JOIN user_data_client u ON u.userid = o.orderbyid JOIN clients c ON c.id = u.clientid WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND p.order_status <> 10 # Canceled AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND p.start_dts > '0000-00-00 00:00:00' AND o.ordereddate >= @startDate ORDER BY o.ordereddate, p.part_label; # 149142 # CREATE TEMPORARY TABLE a AS SELECT a.id , a.part_label , a.start_dts , b.inspection_dts FROM ( SELECT o.id , p.part_label , p.start_dts FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'A' AND p.part_type NOT IN (2, 3) # Exterior, Interior WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND p.order_status <> 10 # Canceled AND p.accepteddate > '0000-00-00 00:00:00' AND o.ordereddate >= @startDate ) a LEFT JOIN ( SELECT o.id , p.inspection_dts FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'A' AND p.part_type IN (2, 3) # Exterior, Interior WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND p.order_status <> 10 # Canceled AND p.accepteddate > '0000-00-00 00:00:00' AND o.ordereddate >= @startDate ) b ON b.id = a.id; SELECT x.id , x.part_label , x.start_dts , y.inspection_dts FROM orders o LEFT JOIN order_parts x ON x.orderid = o.id AND x.part_label = 'A' AND x.part_type NOT IN (2, 3, 4) # Exterior, Interior AND x.order_status <> 10 AND x.accepteddate > '0000-00-00 00:00:00' LEFT JOIN order_parts y ON y.orderid = o.id AND y.part_label = 'A' AND y.part_type IN (2, 3) # Exterior, Interior AND y.order_status <> 10 AND y.accepteddate > '0000-00-00 00:00:00' WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND o.ordereddate >= @startDate; # DROP TEMPORARY TABLE IF EXISTS a; SELECT part_type , COUNT(*) FROM orders o JOIN order_parts p ON o.id = p.orderid AND p.part_label = 'A' WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND p.order_status <> 10 # Canceled AND p.accepteddate > '0000-00-00 00:00:00' AND o.ordereddate >= @startDate GROUP BY 1; SELECT s.descrip , COUNT(*) FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_status s ON s.id = p.order_status WHERE o.companyid = 1 AND o.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND p.accepteddate = '0000-00-00 00:00:00' AND o.ordereddate >= @startDate GROUP BY 1; SELECT s.descrip , COUNT(*) FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_status s ON s.id = o.order_status WHERE o.companyid = 1 AND p.order_status NOT IN (7, 10, 12) # Completed, Canceled, Duplicate AND p.accepteddate = '0000-00-00 00:00:00' AND o.ordereddate >= @startDate GROUP BY 1; SELECT p.part_label , COUNT(*) FROM orders o JOIN order_parts p ON p.orderid = o.id WHERE o.companyid = 1 AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND o.order_type <> 45 # Trip Fee AND o.ordereddate >= @startDate GROUP BY 1; SELECT o.id FROM orders o JOIN order_parts p ON p.orderid = o.id AND p.part_label = 'B' WHERE o.companyid = 1 AND p.part_type NOT IN (2, 3) # Exterior, Interior, AVM AND o.ordereddate >= @startDate; # SELECT # NOW() # # , UTC_TIMESTAMP() # # , FROM_UNIXTIME(UNIX_TIMESTAMP()) # , CONVERT_TZ(NOW(), 'UTC', 'US/Pacific') # ; # 289633 SELECT YEAR(o.ordereddate) , COUNT(*) FROM orders o JOIN order_parts p ON p.orderid = o.id WHERE o.companyid = 1 GROUP BY 1; SELECT p.part_type , pt.descrip , COUNT(*) FROM orders o JOIN order_parts p ON o.id = p.orderid JOIN part_types pt ON pt.id = p.part_type GROUP BY 1, 2; SELECT * FROM part_types; # # SELECT * # FROM order_status SELECT * FROM order_types; SELECT c.companyname 'Company' , ot.descrip 'Product' , d.part_label 'Label' , d.fee 'Default Vendor Fee' FROM default_vendor_fee d JOIN order_types ot ON ot.id = d.order_type JOIN companies c ON c.id = d.companyid WHERE d.companyid IN (1, 2) ORDER BY 1, 2, 3; SET @fromDate = '2015-08-01'; SET @toDate = '2015-08-31'; SELECT `orders`.`ordereddate` , (CASE WHEN clients_v_transactions.id IS NULL THEN clients_v_order.client_name ELSE clients_v_transactions.client_name END) AS `client_name` , `orders`.`loanreference` , `orders`.`id` , `orders`.`propertyaddress` , `orders`.`propertyaddress2` , `orders`.`propertycity` , `PostalCodes`.`County` AS propertycounty , `orders`.`propertystate` , `orders`.`propertyzipcode` , `order_types`.`descrip` , `orders`.`invoiceamount` , vendor_fee_totals.total , `client_transactions`.`dts` , `orders`.`bulk_project_name` , (CASE WHEN `orders`.`partner_reference_num` IS NULL THEN `orders`.`client_reference_num` ELSE `orders`.`partner_reference_num` END) AS `client_reference_num` , (CASE WHEN admin_v_transactions.userid IS NULL THEN GROUP_CONCAT(CONCAT(admin_v_order.firstname, " ", admin_v_order.lastname)) ELSE GROUP_CONCAT(CONCAT(admin_v_order.firstname, " ", admin_v_order.lastname)) END) AS salesperson , `order_status`.descrip AS order_status FROM `orders` INNER JOIN `order_types` ON (`orders`.`order_type` = `order_types`.`id`) INNER JOIN `order_status` ON orders.order_status = `order_status`.`id` LEFT JOIN `client_transactions` ON (`orders`.`id` = `client_transactions`.`orderid` AND `type` = "COMPLETED") LEFT JOIN `clients` AS clients_v_transactions ON (`client_transactions`.`clientid` = `clients_v_transactions`.`id`) LEFT JOIN `user_data_client` ON orders.`orderbyid` = user_data_client.`userid` LEFT JOIN `clients` AS clients_v_order ON clients_v_order.id = user_data_client.clientid LEFT JOIN PostalCodes ON (orders.propertyzipcode = PostalCodes.ZIPCode) LEFT JOIN ( SELECT `orderid` , MAX(order_parts.`effective_date`) AS effective_date , SUM(`order_parts`.`vendorfee`) AS total FROM `order_parts` GROUP BY `orderid` ) AS vendor_fee_totals ON (`orders`.`id` = vendor_fee_totals.orderid) LEFT JOIN `clients_sales_persons` AS sales_persons_v_transactions ON (clients_v_transactions.id = sales_persons_v_transactions.clientid AND sales_persons_v_transactions.`commission` > 0) LEFT JOIN `clients_sales_persons` AS sales_persons_v_order ON (clients_v_order.id = sales_persons_v_order.clientid AND sales_persons_v_order.`commission` > 0) LEFT JOIN user_data_admin AS admin_v_transactions ON (sales_persons_v_transactions.adminid = admin_v_transactions.userid) LEFT JOIN user_data_admin AS admin_v_order ON (sales_persons_v_order.adminid = admin_v_order.userid) WHERE (CASE WHEN `client_transactions`.`id` IS NULL THEN vendor_fee_totals.`effective_date` >= CONCAT(@fromDate, " 00:00:00") AND vendor_fee_totals.`effective_date` <= CONCAT(@toDate, " 23:59:59") ELSE `client_transactions`.`dts` >= CONCAT(@fromDate, " 00:00:00") AND `client_transactions`.`dts` <= CONCAT(@toDate, " 23:59:59") END) AND orders.order_status IN (7, 10, 14) AND orders.companyid = 1 GROUP BY orders.id; SELECT COUNT(*) FROM orders o JOIN client_transactions t ON t.orderid = o.id AND t.type = 'COMPLETED' WHERE o.companyid = 1 AND o.order_status IN (7, 10, 14) # Completed, Canceled, Reconsideration AND t.dts >= '2015-08-01 00:00:00' AND t.dts <= '2015-08-31 23:59:59'; SELECT o.id , SUM(p.vendorfee) AS total FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN client_transactions t ON t.orderid = o.id AND t.type = 'COMPLETED' WHERE o.companyid = 1 AND o.order_status IN (7, 10, 14) # Completed, Canceled, Reconsideration AND t.dts >= '2015-08-01 00:00:00' AND t.dts <= '2015-08-31 23:59:59' GROUP BY o.id; SELECT o.id 'Order No' , ot.descrip 'Product' , s.descrip 'Order Status' , x.effective_date , p.order_status , p.vendorfee , o.invoiceamount FROM ( SELECT o.id , MAX(p.effective_date) 'effective_date' FROM orders o JOIN order_parts p ON p.orderid = o.id LEFT JOIN client_transactions t ON t.orderid = o.id AND t.type = 'COMPLETED' WHERE o.companyid = 1 AND o.order_status IN (7, 10, 14) # Completed, Canceled, Reconsideration AND p.effective_date >= '2015-08-01 00:00:00' AND p.effective_date <= '2015-08-31 23:59:59' AND t.dts IS NULL GROUP BY 1 ) x JOIN orders o ON o.id = x.id JOIN order_parts p ON p.orderid = x.id JOIN order_status s ON s.id = o.order_status JOIN order_types ot ON ot.id = o.order_type; SELECT * FROM order_status; SELECT p.order_status , SUM(p.vendorfee) FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN client_transactions t ON t.orderid = o.id AND t.type = 'COMPLETED' WHERE o.companyid = 1 AND o.order_type = 45 GROUP BY 1; SELECT o.order_status , p.order_status , ot.descrip , SUM(p.vendorfee) FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_types ot ON ot.id = o.order_type LEFT JOIN client_transactions t ON t.orderid = o.id WHERE o.companyid = 1 AND o.order_status IN (7, 10, 14) # Completed, Canceled, Reconsideration # AND p.order_status = 10 AND o.ordereddate >= '2015-01-01 00:00:00' AND p.vendorfee > 0 AND t.dts IS NULL GROUP BY 1, 2, 3; SELECT o.id , o.ordereddate , ot.descrip , o.order_status , p.order_status , p.vendorfee FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_types ot ON ot.id = o.order_type LEFT JOIN client_transactions t ON t.orderid = o.id WHERE o.companyid = 1 AND o.order_status IN (7, 10, 14) # Completed, Canceled, Reconsideration AND p.order_status = 3 AND o.ordereddate >= '2015-01-01 00:00:00' # AND p.vendorfee > 0 AND t.dts IS NULL; # V2 Gear Orders SELECT x.companyname 'Company' , o.id 'Order No' , DATE(o.ordereddate) 'Order Date' , NULL 'Completion Date' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , c.id 'Client No' , c.client_name 'Client Name' , s.descrip 'Order Status' , o.invoiceamount 'Invoice Amount' FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_types ot ON ot.id = o.order_type JOIN order_status s ON s.id = o.order_status JOIN companies x ON x.id = o.companyid JOIN user_data_client u ON u.userid = o.orderbyid LEFT JOIN clients c ON c.id = u.clientid LEFT JOIN client_transactions t ON t.orderid = o.id AND t.type = 'COMPLETED' WHERE o.companyid IN (1, 2) AND t.dts IS NULL AND p.part_type = 12 # GEAR AP UNION SELECT x.companyname 'Company' , o.id 'Order No' , DATE(o.ordereddate) 'Order Date' , DATE(t.dts) 'Completion Date' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product' , c.id 'Client No' , c.client_name 'Client Name' , s.descrip 'Order Status' , t.amount 'Invoice Amount' FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN order_types ot ON ot.id = o.order_type JOIN order_status s ON s.id = o.order_status JOIN companies x ON x.id = o.companyid JOIN client_transactions t ON t.orderid = o.id AND t.type = 'COMPLETED' LEFT JOIN clients AS c ON c.id = t.clientid WHERE o.companyid IN (1, 2) AND p.part_type = 12 # GEAR AP ORDER BY 1, 3; SELECT * FROM clients c WHERE c.client_name LIKE 'NV%'; SELECT o.id 'Order No' , o.companyid , o.order_status , DATE(o.ordereddate) 'Order Date' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' FROM orders o JOIN user_data_client u ON u.userid = o.orderbyid LEFT JOIN clients c ON c.id = u.clientid WHERE c.id = 191; SELECT s.id 'Statement No.' , s.statement_date 'Statement Date' , c.id 'Client No' , c.client_name 'Client Name' , o.borrowername 'Borrower Name' , o.id 'Order No.' , DATE(t.dts) 'Completion Date' , CONCAT_WS(' ', o.propertyaddress, o.propertycity, o.propertystate, o.propertyzipcode) 'Property Address' , ot.descrip 'Product/Service' , o.invoiceamount 'Invoice Amount' FROM clients_statement AS s, client_transactions AS t JOIN orders AS o ON o.id = t.orderid JOIN order_types AS ot ON ot.id = o.order_type LEFT JOIN clients AS c ON c.id = t.clientid WHERE FIND_IN_SET(t.id, s.transactions) AND o.companyid = 2 # Axis AND o.order_status IN (7, 14) # Completed, Reconsideration AND ot.id NOT IN (17, 21) # 1004 Full URAR, 2055 Exterior-Only AND t.type = 'COMPLETED' AND t.clientid <> 90 # Specialized Asset Management LLC AND t.dts >= '2015-01-01 00:00:00' ORDER BY s.id, t.dts; SELECT s.statement_date 'Statement Date' , c.client_name 'Client Name' , SUM(o.invoiceamount) 'Invoice Amount' FROM clients_statement AS s, client_transactions AS t JOIN orders AS o ON o.id = t.orderid JOIN order_types AS ot ON ot.id = o.order_type LEFT JOIN clients AS c ON c.id = t.clientid WHERE FIND_IN_SET(t.id, s.transactions) AND o.companyid = 2 # Axis AND o.order_status IN (7, 14) # Completed, Reconsideration AND ot.id NOT IN (17, 21) # 1004 Full URAR, 2055 Exterior-Only AND t.type = 'COMPLETED' AND t.clientid <> 90 # Specialized Asset Management LLC AND t.dts >= '2015-01-01 00:00:00' GROUP BY 1, 2; SELECT CONCAT_WS(' ', TRIM(v.firstname), TRIM(v.lastname)) 'Vendor Name' , COUNT(*) FROM orders o JOIN order_parts p ON p.orderid = o.id JOIN client_transactions t ON t.orderid = o.id AND t.type = 'COMPLETED' JOIN user_data_vendor v ON v.userid = p.acceptedby WHERE o.companyid = 1 AND o.order_status IN (7, 14) # Completed, Reconsideration AND p.order_status = 7 AND p.part_type NOT IN (2, 3, 4) # Exterior, Interior, AVM AND t.dts >= '2015-08-01 00:00:00' AND t.dts < '2015-09-01 00:00:00' GROUP BY 1;
DROP DATABASE IF EXISTS chat; CREATE DATABASE chat; USE chat; CREATE TABLE users ( /* Describe your table here.*/ id int NOT NULL AUTO_INCREMENT, username varchar(30), PRIMARY KEY(id) ); /* Create other tables and define schemas for them here! */ CREATE TABLE rooms ( /* Describe your table here.*/ id int NOT NULL AUTO_INCREMENT, roomname varchar(30), PRIMARY KEY(id) ); CREATE TABLE messages ( /* Describe your table here.*/ id int NOT NULL AUTO_INCREMENT, text varchar(30), user_id int, room_id int, FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (room_id) REFERENCES rooms(id), PRIMARY KEY(id) ); INSERT INTO users (username) VALUES ('John'), ('Ali'); INSERT INTO rooms (roomname) VALUES ('lobby'), ('sport'); INSERT INTO messages (text, user_id, room_id) VALUES ('Hi there', 1 , 1), ('Second message!!', 2 , 2); /* Execute this file from the command line by typing: * mysql -u root < server/schema.sql * to create the database and the tables.*/
-- phpMyAdmin SQL Dump -- version 4.7.7 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1:3306 -- Время создания: Ноя 04 2020 г., 16:10 -- Версия сервера: 5.6.38 -- Версия PHP: 5.5.38 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 */; -- -- База данных: `instagram` -- -- -------------------------------------------------------- -- -- Структура таблицы `posts` -- CREATE TABLE `posts` ( `id` int(10) NOT NULL, `text` varchar(300) NOT NULL, `img` varchar(30) NOT NULL, `user` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `posts` -- INSERT INTO `posts` (`id`, `text`, `img`, `user`) VALUES (1, 'это был замечательный Новый Год!', 'newyear.mp4', '52hwoa9q'), (2, 'Ура!!!! Экзамены отменили! Всем добра и красного аттестата!!', 'exams.mp4', '52hwoa9q'), (3, 'Спустя полтора года вновь встретились. Самые дружные и самые лучшие', 'Sulustar.mp4', '52hwoa9q'); -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `posts` -- ALTER TABLE `posts` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `posts` -- ALTER TABLE `posts` MODIFY `id` int(10) 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 */;
with TTIME_T1_ONLY as ( select distinct t.EMPLOYEEID, t.SWIPEDATE, t.WORKAREA,t.WF_STATUS from TTIMETEMP t where t.SWIPEDATE between '2013-12-01' and '2013-12-31' and t.SWIPETYPE = '1' AND T.WF_STATUS <> '9' --AND ((select count(workarea) from APPEND_MONEY_WORKAREA) = 0 or t.WORKAREA IN (SELECT WORKAREA FROM APPEND_MONEY_WORKAREA)) and not exists ( select TT.EMPLOYEEID from TTIMETEMP tt where tt.SWIPEDATE between '2013-12-01' and '2013-12-31' and tt.SWIPEDATE = t.SWIPEDATE AND tt.EMPLOYEEID=T.EMPLOYEEID and tt.SWIPETYPE = '4' AND tt.WF_STATUS <> '9' ) ) , TTIME_T1_OVER_T4 as ( select distinct t.EMPLOYEEID, t.SWIPEDATE, t.WORKAREA,t.WF_STATUS from TTIMETEMP t where t.SWIPEDATE between '2013-12-01' and '2013-12-31' and t.SWIPETYPE = '1' AND T.WF_STATUS <> '9' -- AND ((select count(workarea) from APPEND_MONEY_WORKAREA) = 0 or t.WORKAREA IN (SELECT WORKAREA FROM APPEND_MONEY_WORKAREA)) and exists ( select TT.EMPLOYEEID from TTIMETEMP tt where tt.SWIPEDATE between '2013-12-01' and '2013-12-31' and tt.SWIPEDATE = t.SWIPEDATE AND tt.EMPLOYEEID=T.EMPLOYEEID and tt.SWIPETYPE = '4' AND tt.WF_STATUS <> '9' ) and t.SWIPETIME > ( select MAX(TT.SWIPETIME) from TTIMETEMP tt where tt.SWIPEDATE between '2013-12-01' and '2013-12-31' and tt.SWIPEDATE = t.SWIPEDATE AND tt.EMPLOYEEID=T.EMPLOYEEID and tt.SWIPETYPE = '4' AND tt.WF_STATUS <> '9' ) ) , TTIME_T4_ONLY as ( select distinct t.EMPLOYEEID, t.SWIPEDATE, t.WORKAREA,t.WF_STATUS from TTIMETEMP t where t.SWIPEDATE between '2013-12-02' and '2014-01-01' and t.SWIPETYPE = '4' AND T.WF_STATUS <> '9' --AND ((select count(workarea) from APPEND_MONEY_WORKAREA) = 0 or t.WORKAREA IN (SELECT WORKAREA FROM APPEND_MONEY_WORKAREA)) and not exists (select tt.EMPLOYEEID from TTIMETEMP tt where tt.SWIPEDATE between '2013-12-02' and '2014-01-01' and tt.SWIPEDATE = t.SWIPEDATE AND tt.EMPLOYEEID=T.EMPLOYEEID and tt.SWIPETYPE = '1' AND tt.WF_STATUS <> '9' ) ) , TTIME_T4_UNDER_T1 as ( select distinct t.EMPLOYEEID, t.SWIPEDATE, t.WORKAREA,t.WF_STATUS from TTIMETEMP t where t.SWIPEDATE between '2013-12-02' and '2014-01-01' and t.SWIPETYPE = '4' AND T.WF_STATUS <> '9' --AND ((select count(workarea) from APPEND_MONEY_WORKAREA) = 0 or t.WORKAREA IN (SELECT WORKAREA FROM APPEND_MONEY_WORKAREA)) and exists (select tt.EMPLOYEEID from TTIMETEMP tt where tt.SWIPEDATE between '2013-12-02' and '2014-01-01' and tt.SWIPEDATE = t.SWIPEDATE AND tt.EMPLOYEEID=T.EMPLOYEEID and tt.SWIPETYPE = '1' AND tt.WF_STATUS <> '9' ) and t.SWIPETIME < ( select MIN(TT.SWIPETIME) from TTIMETEMP tt where tt.SWIPEDATE between '2013-12-02' and '2014-01-01' and tt.SWIPEDATE = t.SWIPEDATE AND tt.EMPLOYEEID=T.EMPLOYEEID and tt.SWIPETYPE = '1' AND tt.WF_STATUS <> '9' ) ) , TTIME_T1 AS ( SELECT * FROM TTIME_T1_ONLY UNION ALL SELECT * FROM TTIME_T1_OVER_T4 ) , TTIME_T4 AS ( SELECT * FROM TTIME_T4_ONLY UNION ALL SELECT * FROM TTIME_T4_UNDER_T1 ) , TA_ALL AS ( SELECT distinct t1.EMPLOYEEID , t1.SWIPEDATE as DATEID , t1.WORKAREA FROM TTIME_T1 T1, TTIME_T4 T4 WHERE T1.EMPLOYEEID=T4.EMPLOYEEID AND cast(T4.SWIPEDATE AS DATE) = DATEADD (DAY , 1 , cast(T1.SWIPEDATE AS DATE) ) AND T1.WF_STATUS <> '9' AND T4.WF_STATUS <> '9' union all select distinct t.EMPLOYEEID , t.SWIPEDATE , t.WORKAREA from TTIMETEMP t , TTIMETEMP t4 where t.SWIPEDATE = t4.SWIPEDATE and t.EMPLOYEEID = t4.EMPLOYEEID and t.SWIPETYPE = '1' and t4.SWIPETYPE = '4' and t.WF_STATUS <> '9' and t4.WF_STATUS <> '9' and t.SWIPETIME < t4.SWIPETIME ) , LD_ALL AS ( select tt.EMPLOYEEID, tt.DATEID, tt.WORKAREA from TTIME_CURRENT1 tt where tt.DATEID between '2013-12-01' and '2013-12-31' and ( tt.C_TM_BG <> '0.00' or tt.C_TM_EN <> '0.00') --AND ((select count(workarea) from APPEND_MONEY_WORKAREA) = 0 or tt.WORKAREA IN (SELECT WORKAREA FROM APPEND_MONEY_WORKAREA)) ) , TA_LD_ALL AS ( SELECT ld.EMPLOYEEID,ld.DATEID,ld.WORKAREA FROM LD_ALL ld , TA_ALL ta where ld.EMPLOYEEID=ta.EMPLOYEEID and ld.DATEID=ta.DATEID ) select alldate.EMPLOYEEID,alldate.DATEID , alldate.WORKAREA, m.FNAME+' '+ m.LNAME as emp_name , wk.TDESC as store_name ,wk.WORK_EMAIL as store_mail , m_ac.FNAME+' '+ m_ac.LNAME as ac_name , m_ac.EMAIL as ac_mail from TA_LD_ALL alldate left outer join MEMPLOYEE m on m.EMPLOYEEID = alldate.EMPLOYEEID left outer join mworkarea wk on wk.WORKAREAID = alldate.WORKAREA left outer join MEMPLOYEE m_ac on m_ac.EMPLOYEEID = wk.RESPORSIBLE2 where exists (select 1 from TTIME_CURRENT t where t.EMPLOYEEID=alldate.EMPLOYEEID and t.DATEID=alldate.DATEID and t.HOUR_D = '0.00' and LV = '0.00' ) ORDER BY alldate.WORKAREA, alldate.EMPLOYEEID, alldate.DATEID
DELETE from casev2.event where id in ('f71f8908-38b4-4f60-b87b-d3a0ea5cfb70','58e94664-a3ea-4b06-b292-613f99f32630'); DELETE from casev2.uac_qid_link where id in ('ba168af7-ee3b-40f8-8b5e-16c53ce7ee50','39325386-0ea4-4c2a-80ed-59c19fa298d5');
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 01-09-2017 a las 00:01:17 -- Versión del servidor: 10.1.21-MariaDB -- Versión de PHP: 5.6.30 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `bd_d-soft` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `categorias` -- CREATE TABLE `categorias` ( `id` int(100) NOT NULL, `nombre` varchar(100) NOT NULL, `codigo` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `categorias` -- INSERT INTO `categorias` (`id`, `nombre`, `codigo`) VALUES (24, 'Semillitas', 'se'), (26, 'Expo-Ingenieria', 'ei'), (27, 'Expo-Joven', 'ej'), (28, 'Feria Cientifica', 'fc'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `desgloce_puntos` -- CREATE TABLE `desgloce_puntos` ( `idP` int(255) NOT NULL, `idJuez` int(255) NOT NULL, `puntos` int(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `identificador` -- CREATE TABLE `identificador` ( `Id` int(100) NOT NULL, `categoria` int(50) NOT NULL, `Descripcion` varchar(100) NOT NULL, `Puntos` int(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `identificador` -- INSERT INTO `identificador` (`Id`, `categoria`, `Descripcion`, `Puntos`) VALUES (1, 26, 'Planteamiento del problema', 10), (2, 26, 'Justificación del proyecto', 18), (3, 26, 'Originalidad y creatividad del proyecto', 10), (4, 26, 'Fundamento teórico', 12), (5, 26, 'Metodología', 18), (6, 26, 'Discusión,interpretación y análisis', 16), (7, 26, 'Presentación e interacción del proyecto', 12), (8, 26, 'Presentación documentación adicional del proyecto', 4), (9, 27, 'Innovación e impacto', 25), (10, 27, 'Modelo de Negocio (CANVAS)', 30), (11, 27, 'Plan de mercado', 25), (12, 27, 'Análisis técnico', 30), (13, 27, 'Análisis económico y financiero', 25), (14, 27, 'Atención al cliente', 20), (15, 27, 'Espíritu emprendedor', 20); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `persona` -- CREATE TABLE `persona` ( `cedula` varchar(30) NOT NULL, `password` varchar(255) NOT NULL, `nombre` varchar(50) NOT NULL, `correo` varchar(100) NOT NULL, `tipoUsuario` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `persona` -- INSERT INTO `persona` (`cedula`, `password`, `nombre`, `correo`, `tipoUsuario`) VALUES ('1', '44388d729a8625439cbc027789167c1c', 'Gabriela', 'gaby@gmail.com', 2), ('321', 'bcfa46440609c8d27740964e2bd42295', 'Juan Perez Perez', 'juanperez@gmail.com', 1), ('80', 'fea62758abad18f2b5cc3fec130ec2b4', 'armando', 'desarrolloctpc@gmail.com', 1), ('5', '7b852820e86a27a38e643326d131e2e1', 'Mario', 'mario@gmail.com', 2); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `preguntas` -- CREATE TABLE `preguntas` ( `id` int(255) NOT NULL, `idIdentificador` int(100) NOT NULL, `codigo` varchar(15) NOT NULL, `descripcion` varchar(255) NOT NULL, `categoria` varchar(50) NOT NULL, `valorPregunta` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `preguntas` -- INSERT INTO `preguntas` (`id`, `idIdentificador`, `codigo`, `descripcion`, `categoria`, `valorPregunta`) VALUES (17, 1, '26', 'Evidencia fase previa o de exploración para plantear el problema.', '26', 2), (18, 1, '26', 'Claridad en la definición del problema.', '26', 2), (19, 1, '26', 'El estudiante identifica el impacto del proyecto.', '26', 2), (20, 1, '26', 'Los objetivos están bien definidos.', '26', 2), (21, 1, '26', 'Definición de los criterios que fundamente la solución propuesta.', '26', 2), (22, 2, '26', 'El proyecto responde a una necesidad evidente.', '26', 3), (23, 2, '26', 'Se identifican los grupos beneficiados.', '26', 3), (24, 2, '26', 'El proyecto es factible de ser realizado.', '26', 3), (25, 2, '26', 'Es aplicable y tiene un buen nivel de uso potencial.', '26', 3), (26, 2, '26', 'Realiza un aporte en el campo de estudio.', '26', 3), (27, 2, '26', 'Identifica el impacto potencial en el campo de la ciencia, sociedad, economía o el ambiente.', '26', 3), (28, 3, '26', 'Demuestran que el desarrollo es de elaboración propia', '26', 2), (29, 3, '26', 'El proyecto es una innovación y lo demuestra.', '26', 2), (30, 3, '26', 'Muestra actualidad tecnológica ó nuevo conocimiento científico o técnico.', '26', 2), (31, 3, '26', 'Identificación de una solución ', '26', 2), (32, 3, '26', 'Desarrollo de un prototipo/modelo/producto', '26', 2), (33, 4, '26', 'Demuestra apropiación (familiaridad y capacidad de manejo) de los contenidos que fundamentan el proyecto', '26', 2), (34, 4, '26', 'Define los conceptos que utiliza de manera clara y precisa.', '26', 2), (35, 4, '26', 'Presenta una síntesis apropiada de lo que se conoce del tema en estudio.', '26', 2), (36, 4, '26', 'Presenta diseños y esquemas claros y correctos.', '26', 2), (37, 4, '26', 'Fundamenta todas las demostraciones y cálculos necesarios.', '26', 2), (38, 4, '26', 'Muestra documentación de apoyo (referencias información extraída)', '26', 2), (39, 5, '26', 'Selección de instrumentos (modelos, programas de computación, equipos y otros) y métodos adecuados.', '26', 3), (40, 5, '26', 'Describe la metodología utilizada para la obtención de posibles soluciones.', '26', 3), (41, 5, '26', 'Cumplimiento de las etapas planificadas en el diseño del proyecto.', '26', 3), (42, 5, '26', 'Hace un óptimo uso de los recursos.', '26', 3), (43, 5, '26', 'Describe las metodologías de evaluación y perfeccionamiento.', '26', 3), (44, 5, '26', 'Identifica posibles puntos de riesgo.', '26', 3), (45, 6, '26', ' Coherencia de los objetivos con los resultados obtenidos.', '26', 2), (46, 6, '26', 'Realiza análisis de los resultados.', '26', 2), (47, 6, '26', 'Los resultados (o el producto) tienen aplicación o utilidad en la vida real.', '26', 2), (48, 6, '26', 'Congruencia de los datos, tablas, diagramas y gráficos con el tema investigado.', '26', 2), (49, 6, '26', 'Sugiere posibles aplicaciones del desarrollo obtenido. (Innovación)', '26', 2), (50, 6, '26', 'Coherencia de los diseños y esquemas con respecto al prototipo/modelo/producto presentado.', '26', 2), (51, 6, '26', 'Prototipo/modelo/producto ha sido probado en varias condiciones/ensayos.', '26', 2), (52, 6, '26', 'Prototipo/modelo/producto demuestra conocimientos de ingeniería y coherencia.', '26', 2), (53, 7, '26', 'El cartel apoya la comunicación en forma fluida.', '26', 2), (54, 7, '26', 'El material expuesto tiene relación con el trabajo de investigación.', '26', 2), (55, 7, '26', 'Claridad de las ideas durante la presentación.', '26', 2), (56, 7, '26', 'Presenta una organización lógica de las ideas (contenido claro y específico)', '26', 2), (57, 7, '26', 'Capacidad de síntesis para llevar a cabo la comunicación.', '26', 2), (58, 7, '26', 'La presentación refleja el esfuerzo coordinado de todos los miembros.', '26', 2), (59, 8, '26', 'Exhibe en su stand la bitácora debidamente llena.', '26', 1), (60, 8, '26', 'Se muestra las fechas en las que realizó experimentos.', '26', 1), (61, 8, '26', 'Se anotan mediciones, diagramas, figuras, cuadros, dibujos', '26', 1), (62, 8, '26', 'Se evidencia la aplicación de algún tipo de estadística, sumas, porcentajes; entre otros', '26', 1), (63, 9, '27', 'PROPUESTA NUEVA O RENOVADA: El producto o servicio se muestra como una propuesta nueva o renovada del mercado en el que participa.', '27', 5), (64, 9, '27', 'METODOS DE PRODUCCIÓN: Los métodos de producción presentados se muestran novedosos comparados con lo que hay en el área de acción del proyecto', '27', 5), (65, 9, '27', 'COMERCIALIZACION: Las formas de comercializar los productos o servicios son creativas e impactan positivamente su estancia en el mercado.', '27', 5), (66, 9, '27', 'PROPUESTA ADMINISTRATIVA: La gestión y la organización del trabajo propone una reforma a lo que se conoce en la actualidad.', '27', 5), (67, 9, '27', 'DIFERENCIACION: La idea en su totalidad se acompaña de un componente de creatividad e innovación que la hace ver diferente a otros proyectos ', '27', 5), (68, 10, '27', 'PROPUESTA DE VALOR: Establece la diferenciación de su producto (bien o servicio) señalando el valor implícito y beneficios específicos del mismo, para atender a un conjunto de necesidades y deseos de la demanda.', '27', 5), (69, 10, '27', 'SEGMENTO DE CLIENTES: Establece el(los) segmento(s) de clientes a quienes estará enfocado su negocio, describiendo en detalle el perfil de los clientes del grupo meta.', '27', 5), (70, 10, '27', 'RELACIÓN CON CLIENTES Y CANALES: Especifica las características del tipo de relación que quiere mantener con sus clientes, puntualizando los canales mediante los cuales dará a conocer y hará llegar su propuesta de valor a los clientes.', '27', 5), (71, 10, '27', 'ACTIVIDADES Y RECURSOS CLAVE: Puntualiza y describe las actividades y recursos necesarios para la producción y distribución del bien o prestación del servicio.', '27', 5), (72, 10, '27', 'ALIANZAS CLAVE: Identifica los proveedores, socios estratégicos e instituciones de apoyo necesarios para desarrollar, potenciar y mejorar el modelo de negocio propuesto.', '27', 5), (73, 10, '27', 'ESTRUCTURA DE COSTOS E INGRESOS: Resume los costos más importantes involucrados en su modelo de negocio y necesarios para crear su propuesta de valor, así como el flujo de dinero que se recibirá por la venta de bienes o prestación del servicio.', '27', 5), (74, 11, '27', 'DESCRIPCION DE PRODUCTO: Se hace una descripción pormenorizada del producto o servicio indicando aspectos de: color, precio, empaque, tamaño, ciclo de vida.', '27', 5), (75, 11, '27', 'JUSTIFICACIÓN DE LA DEMANDA: Justifica con datos reales la demanda del mercado, utilizando para ello encuestas o estudios publicados sobre la actividad; determina un segmento de mercado y caracteriza a su consumidor.', '27', 5), (76, 11, '27', 'COMPETENCIA: Hace un análisis de las fortalezas y debilidades de la competencia en comparación con su propuesta y la forma de poder aprovecharlas, determina por medio de datos concretos las cantidades de producto que se ofrecen en el mercado.', '27', 5), (77, 11, '27', 'PROMOCIÓN, COMERCIALIZACIÓN Y DISTRIBUCIÓN: Presenta un programa de promoción y publicidad, y establece un costo que se refleja en el análisis financiero. Definición de las formas en que se venderá el bien o servicio (¿quién lo venderá, dónde se venderá?)', '27', 5), (78, 11, '27', 'PRECIO: Establece un precio para el producto y su comportamiento en las diferentes épocas del año, describe claramente la forma en que fue fijado a partir de los factores considerados para tal fin.', '27', 5), (79, 12, '27', 'PROCESOS: Nivel de descripción de los procedimientos a seguir para producir el bien o facilitar el servicio.', '27', 5), (80, 12, '27', 'PRODUCCIÓN: Nivel de determinación de las cantidades a producir del producto o a prestar del servicio (por mes, por año, etc.)', '27', 5), (81, 12, '27', 'PROVEEDURÍA: Nivel de determinación de los proveedores y las cantidades de insumos necesarias para producir y comercializar el producto o servicio', '27', 5), (82, 12, '27', 'RECURSOS: Nivel de definición de los recursos requeridos para el proyecto (edificios, maquinaria, equipo, mobiliario, humanos, materia prima, etc.)', '27', 5), (83, 12, '27', 'PERSONAL: Nivel de definición de la cantidad de personal que requiere el proyecto y las características del mismo.', '27', 5), (84, 12, '27', 'ORGANIZACIÓN: Nivel de definición de puestos, departamentos o unidades que se requieren para la operación administrativa y productiva del proyecto.', '27', 5), (85, 13, '27', 'INGRESOS: Describe y fundamenta de manera mensual y anual cuales serían los ingresos del proyecto.', '27', 5), (86, 13, '27', 'COSTOS Y GASTOS: Describe detalladamente con precio y cantidades cuales serían los egresos del proyecto.', '27', 5), (87, 13, '27', 'FINANCIAMIENTO: Determina la forma en la cual será financiada la propuesta, ya sea con recursos propios o entidades financieras, y lo refleja en su flujo de caja.', '27', 5), (88, 13, '27', 'INDICADORES FINANCIEROS: Presentación de indicadores financieros (al menos Relación Beneficio Costo [B/C], Tasa Interna de Retorno [TIR] y Valor Actual Neto [VAN]) a partir del flujo de caja proyectado y supuestos debidamente establecidos.', '27', 5), (89, 13, '27', 'RENTABILIDAD: Muestra aspectos de impacto económico a nivel regional o nacional, generando ingresos para los proponentes que justifique la inversión tanto en valores absolutos como relativos.', '27', 5), (90, 14, '27', 'Trato amable, respetuoso y cortés a los visitantes, diferenciado y propio de la propuesta de negocios.', '27', 5), (91, 14, '27', 'Se permite la accesibilidad al producto y a la información, brindando material técnico, promocional y de contacto pertinente y de calidad.', '27', 5), (92, 14, '27', 'Atentos a la llegada y atención del público, se presentan de forma natural y oportuna, a la vez que procuran conocer e identificar al visitante.', '27', 5), (93, 14, '27', 'Muestran el producto con agrado, esmero y entusiasmo (actitud positiva), demostrando un claro dominio de la temática y su evidente participación en la preparación del proyecto. además reciben las recomendaciones de forma proactiva y respetuosa.', '27', 5), (94, 15, '27', 'Manifiesta necesidad de logro, independencia y de construcción de la propuesta, así como interés, gusto y pasión por lo que hace.', '27', 5), (95, 15, '27', 'Manifiesta confianza y optimismo en sus capacidades y posibilidades de éxito, a la vez que considera y calcula factores de riesgo, e imagina, genera y propone ideas y soluciones originales, creativas y fundamentadas.', '27', 5), (96, 15, '27', 'Manifiesta una visión clara de su proyecto, apoyada por ideas concretas, logrando evidenciar una capacidad de persuasión que se basa en su motivación, impulso, preparación (conocimiento) y habilidad.', '27', 5), (97, 15, '27', 'Alta capacidad de comunicación, y disposición a recibir y solicitar consejo o ayuda, por lo que reacciona con tolerancia, flexibilidad y respeto hacia las ideas y puntos de vista de otros.', '27', 5), (98, 15, '27', 'Capacidad de síntesis para llevar a cabo la comunicación.', '27', 5), (99, 15, '27', 'La presentación refleja el esfuerzo coordinado de todos los miembros.', '27', 5); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `proyecto` -- CREATE TABLE `proyecto` ( `id` int(10) NOT NULL, `nombre` varchar(30) NOT NULL, `descripcion` varchar(250) NOT NULL, `integrantes` varchar(150) NOT NULL, `categoria` varchar(40) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `proyecto` -- INSERT INTO `proyecto` (`id`, `nombre`, `descripcion`, `integrantes`, `categoria`) VALUES (1, 'Safer Inc', 'Red Social Amigable con el Medio Ambiente', 'Kevin Z, Enrique R', 'Expo-Ingenieria'), (2, 'Defender', 'Defender', 'Helio y Juan', 'Semillitas'), (3, 'CalisFit', 'Calistenia', 'Steven y Byron', 'Expo-Joven'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuario` -- CREATE TABLE `usuario` ( `nombreUsuario` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `nombre` varchar(50) NOT NULL, `tipoUsuario` int(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `usuario` -- INSERT INTO `usuario` (`nombreUsuario`, `password`, `nombre`, `tipoUsuario`) VALUES ('juan', 'd0ad533973bbe3124eee856b3ecbf545', 'Juan Perez Perez', 1), ('superUser', 'd0ad533973bbe3124eee856b3ecbf545', 'Armando', 2); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `categorias` -- ALTER TABLE `categorias` ADD PRIMARY KEY (`id`); -- -- Indices de la tabla `identificador` -- ALTER TABLE `identificador` ADD PRIMARY KEY (`Id`); -- -- Indices de la tabla `preguntas` -- ALTER TABLE `preguntas` ADD PRIMARY KEY (`id`); -- -- Indices de la tabla `proyecto` -- ALTER TABLE `proyecto` ADD PRIMARY KEY (`id`); -- -- Indices de la tabla `usuario` -- ALTER TABLE `usuario` ADD PRIMARY KEY (`nombreUsuario`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `categorias` -- ALTER TABLE `categorias` MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; -- -- AUTO_INCREMENT de la tabla `identificador` -- ALTER TABLE `identificador` MODIFY `Id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- AUTO_INCREMENT de la tabla `preguntas` -- ALTER TABLE `preguntas` MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100; -- -- AUTO_INCREMENT de la tabla `proyecto` -- ALTER TABLE `proyecto` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; /*!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 */;
spool UndoExts.out ttitle off set pages 999 set lines 150 set verify off set termout off set trimout on set trimspool on REM REM ------------------------------------------------------------------------ REM REM ----------------------------------------------------------------- REM REM REM REPORTING UNDO EXTENTS INFORMATION: REM REM ----------------------------------------------------------------- REM REM Undo Extents breakdown information REM ttitle center "Rollback Segments Breakdown" skip 2 col status format a20 col cnt format 999,999,999 head "How Many?" select status, count(*) cnt from dba_rollback_segs group by status / ttitle center "Undo Extents" skip 2 col segment_name format a30 heading "Name" col "ACT BYTES" format 999,999,999,999 head "Active|Extents" col "UNEXP BYTES" format 999,999,999,999 head "Unxpired|Extents" col "EXP BYTES" format 999,999,999,999 head "Expired|Extents" select segment_name, nvl(sum(act),0) "ACT BYTES", nvl(sum(unexp),0) "UNEXP BYTES", nvl(sum(exp),0) "EXP BYTES" from ( select segment_name, nvl(sum(bytes),0) act,00 unexp, 00 exp from DBA_UNDO_EXTENTS where status='ACTIVE' group by segment_name union select segment_name, 00 act, nvl(sum(bytes),0) unexp, 00 exp from DBA_UNDO_EXTENTS where status='UNEXPIRED' group by segment_name union select segment_name, 00 act, 00 unexp, nvl(sum(bytes),0) exp from DBA_UNDO_EXTENTS where status='EXPIRED' group by segment_name ) group by segment_name; ttitle center "Undo Extents Statistics" skip 2 col size format 999,999,999,999 heading "Size" col "HOW MANY" format 999,999,999 heading "How Many?" col st heading a12 heading "Status" select distinct status st, count(*) "HOW MANY", sum(bytes) "SIZE" from dba_undo_extents group by status / col segment_name format a30 heading "Name" col TABLESPACE_NAME for a20 col BYTES for 999,999,999,999 col BLOCKS for 999,999,999 col status for a15 heading "Status" col segment_name heading "Segment" col extent_id heading "ID" select SEGMENT_NAME, TABLESPACE_NAME, EXTENT_ID, FILE_ID, BLOCK_ID, BYTES, BLOCKS, STATUS from dba_undo_extents order by 1,3,4,5 / REM REM ----------------------------------------------------------------- REM REM Undo Extents Contention breakdown REM Take out column TUNED_UNDORETENTION if customer REM prior to 10.2.x REM REM The time frame can be adjusted with this query REM By default using around 4 hour window of time REM REM Ex. REM Using sysdate-.04 looking at the last hour REM Using sysdate-.16 looking at the last 4 hours REM Using sysdate-.32 looking at the last 8 hours REM Using sysdate-1 looking at the last 24 hours REM set linesize 140 ttitle center "Undo Extents Error Conditions (Default - Last 4 Hours)" skip 2 col UNXPSTEALCNT format 999,999,999 heading "# Unexpired|Stolen" col EXPSTEALCNT format 999,999,999 heading "# Expired|Reused" col SSOLDERRCNT format 999,999,999 heading "ORA-1555|Error" col NOSPACEERRCNT format 999,999,999 heading "Out-Of-space|Error" col MAXQUERYLEN format 999,999,999 heading "Max Query|Length" col TUNED_UNDORETENTION format 999,999,999 heading "Auto-Ajusted|Undo Retention" col hours format 999,999 heading "Tuned|(HRs)" select inst_id, to_char(begin_time,'MM/DD/YYYY HH24:MI') begin_time, UNXPSTEALCNT, EXPSTEALCNT , SSOLDERRCNT, NOSPACEERRCNT, MAXQUERYLEN, TUNED_UNDORETENTION, TUNED_UNDORETENTION/60/60 hours from gv$undostat where begin_time between (sysdate-.16) and sysdate order by inst_id, begin_time / spool off set termout on set trimout off set trimspool off
-- drop if exists CREATE DATABASE dt8czq68kv5bxqhk; USE dt8czq68kv5bxqhk; CREATE TABLE burgers ( id int NOT NULL AUTO_INCREMENT, burger_name varchar(255) NOT NULL, devoured BOOLEAN DEFAULT false, createdAt timestamp default current_timestamp NOT NULL, PRIMARY KEY (id) );
SELECT piskunova_gruppa.name, COUNT(*) FROM piskunova_gruppa INNER JOIN piskunova_graduate ON piskunova_gruppa.gruppa_id=piskunova_graduate.gruppa_id GROUP BY piskunova_gruppa.gruppa_id
/* Navicat MySQL Data Transfer Source Server : localhost Source Server Version : 50635 Source Host : localhost:3306 Source Database : test Target Server Type : MYSQL Target Server Version : 50635 File Encoding : 65001 Date: 2019-04-10 17:18:07 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `test_user` -- ---------------------------- DROP TABLE IF EXISTS `test_user`; CREATE TABLE `test_user` ( `user_id` int(10) unsigned NOT NULL DEFAULT '0', `username` char(50) DEFAULT NULL, `password` char(50) DEFAULT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of test_user -- ---------------------------- INSERT INTO `test_user` VALUES ('0', null, null); INSERT INTO `test_user` VALUES ('1', '1', '1'); INSERT INTO `test_user` VALUES ('2', '2', '2'); INSERT INTO `test_user` VALUES ('3', '3', '3');
select rownum id, column_value varchar2_data from ( table( sys.odcivarchar2list(
/* Name: Number of actions by entry mod code... Data source: 4 Created By: Admin Last Update At: 2016-03-17T19:12:41.828898+00:00 */ SELECT v.mod_code AS mod_code, count(*) AS Number_of_leads, FROM (SELECT * FROM ( SELECT LOWER(CASE WHEN post_prop10 = '' THEN 'no mod code' ELSE post_prop10 END) As mod_code, /*LOWER(ref_domain) AS Referrer_domain,*/ visit_page_num, visid_high, post_prop10, visid_low, visit_num FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')))v JOIN (SELECT LOWER(CASE WHEN post_prop10 = '' THEN 'no mod code' ELSE post_prop10 END) As mod_code, visid_high, visid_low, visit_num, post_prop10, visit_page_num FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') AND (post_prop13 = 'LeadSubmited') /*AND post_prop19 = 'home'*/ ) AS det ON det.visid_high = v.visid_high AND det.visid_low = v.visid_low AND det.visit_num = v.visit_num) WHERE v.visit_page_num = '1' GROUP BY mod_code, ORDER BY Number_of_leads DESC
-- phpMyAdmin SQL Dump -- version 4.8.0.1 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Aug 15, 2018 at 10:57 PM -- Server version: 10.1.32-MariaDB -- PHP Version: 7.1.17 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: `tracsales` -- -- -------------------------------------------------------- -- -- Table structure for table `capital` -- CREATE TABLE `capital` ( `id` int(11) NOT NULL, `amount` varchar(200) NOT NULL, `dated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `capital` -- INSERT INTO `capital` (`id`, `amount`, `dated_on`) VALUES (4, '400000', '0000-00-00 00:00:00'), (5, '330000.0', '2018-06-24 16:31:22'), (6, '674444.0', '2018-06-24 16:48:40'), (7, '694444.0', '2018-06-24 16:48:56'), (8, '794444.0', '2018-06-24 16:49:21'), (9, '1794444.0', '2018-06-24 21:24:09'), (10, '1804444.0', '2018-06-24 22:13:29'), (11, '3026666.0', '2018-06-25 00:24:54'), (12, '4026666.0', '2018-06-25 13:03:53'), (13, '6359999.0', '2018-06-25 13:17:40'), (14, '4359999.0', '2018-06-25 15:00:06'), (15, '4369999.0', '2018-06-25 16:34:13'), (16, '4382120.0', '2018-06-25 18:25:42'); -- -------------------------------------------------------- -- -- Table structure for table `expense` -- CREATE TABLE `expense` ( `id` int(11) NOT NULL, `description` varchar(1000) NOT NULL, `amount` varchar(200) NOT NULL, `dated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `expense` -- INSERT INTO `expense` (`id`, `description`, `amount`, `dated_on`) VALUES (1, 'Lunch For John', '2000', '2018-06-24 23:21:27'), (2, 'Natural Food', '200', '2018-06-25 00:33:42'), (3, 'Cooking Stick ', '100', '2018-06-25 00:34:05'), (4, 'Get Chapo', '20', '2018-06-25 04:46:51'), (5, '', '', '2018-06-25 06:30:52'), (6, '', '', '2018-06-25 16:49:01'), (7, 'BY food', '4000', '2018-08-15 22:56:28'); -- -------------------------------------------------------- -- -- Table structure for table `purchase` -- CREATE TABLE `purchase` ( `id` int(11) NOT NULL, `name` varchar(200) NOT NULL, `nationalid` varchar(200) NOT NULL, `weight` varchar(100) NOT NULL, `customer` varchar(20) NOT NULL, `cerial_type` varchar(100) NOT NULL, `cost` varchar(200) NOT NULL, `purchased_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `purchase` -- INSERT INTO `purchase` (`id`, `name`, `nationalid`, `weight`, `customer`, `cerial_type`, `cost`, `purchased_on`) VALUES (10, 'Ommabia Kefa', '323232', '40000.0', 'Broker', '', '1200000.0', '2018-06-24 13:20:20'), (11, 'Mark Brian', '423232', '3000.0', 'Regular', 'beans', '90000.0', '2018-06-24 13:22:24'), (12, 'omkambia', '787878', '4000.0', 'Regular', '', '120000.0', '2018-06-24 15:49:28'), (13, 'Kevo Meru', '23232323', '3400.0', 'Regular', '', '102000.0', '2018-06-24 21:24:37'), (14, 'Manu', '1111212', '1000.0', 'Regular', '', '30000.0', '2018-06-25 00:23:48'), (15, 'Jkada', '2312', '1212.0', 'Broker', '', '36360.0', '2018-06-25 00:24:12'), (16, 'Jkada', '2312', '1212.0', 'Broker', '', '36360.0', '2018-06-25 00:24:25'), (17, 'Manu', '1111212', '1000.0', 'Regular', '', '30000.0', '2018-06-25 00:24:27'), (18, 'Jkada', '2312', '1212.0', 'Broker', '', '36360.0', '2018-06-25 00:24:29'), (19, 'Manu', '1111212', '1000.0', 'Regular', '', '30000.0', '2018-06-25 00:24:30'), (20, 'Jkada', '2312', '1212.0', 'Broker', '', '36360.0', '2018-06-25 00:24:33'), (21, 'Manu', '1111212', '1000.0', 'Regular', '', '30000.0', '2018-06-25 00:24:34'), (22, 'Manu', '1111212', '1000.0', 'Regular', '', '30000.0', '2018-06-25 00:24:34'), (23, 'Manu', '1111212', '1000.0', 'Regular', '', '30000.0', '2018-06-25 00:24:34'), (24, 'Manu', '1111212', '1000.0', 'Regular', '', '30000.0', '2018-06-25 00:24:35'), (25, 'Deno Chirchir', '121312312', '1000.0', 'Regular', '', '30000.0', '2018-06-25 15:00:54'), (26, 'Omannaaa', '1321', '20000.0', 'Regular', '', '600000.0', '2018-06-25 16:34:31'), (27, 'omambia', '3212123', '23.0', 'Regular', 'beans', '690.0', '2018-07-30 19:47:08'), (28, 'Kenya Kenya ', '3232423', '45.0', 'Broker', 'beans', '1350.0', '2018-07-30 19:47:23'), (29, 'Mark O.Brian', '221331', '100.0', 'Regular', 'beans', '3000.0', '2018-07-30 19:47:42'), (30, 'Clare LImo', '4232231232', '3434.0', 'Broker', 'beans', '103020.0', '2018-07-30 19:48:00'), (31, 'Clare LImo', '4232231232', '3434.0', 'Broker', 'beans', '103020.0', '2018-07-30 19:48:05'), (32, 'omama', '1213', '23.0', 'Regular', 'millet', '690.0', '2018-07-30 20:23:36'), (33, 'wqweower', '121312', '129.0', 'Broker', 'millet', '3870.0', '2018-07-30 20:23:46'), (34, 'Omadsad', '2212131', '121.0', 'Regular', 'wheat', '3630.0', '2018-07-30 20:25:10'), (35, 'Kenua42', '24322', '199.0', 'Broker', 'wheat', '5970.0', '2018-07-30 20:25:27'), (36, 'omada', 'adads', '121.0', 'Regular', 'greenGrams', '3630.0', '2018-07-30 20:36:47'), (37, 'Omambia', '311131', '12.0', 'Regular', 'maize', '360.0', '2018-08-15 22:44:52'), (38, 'Omambia', '311131', '12.0', 'Regular', 'maize', '360.0', '2018-08-15 22:44:55'), (39, 'Omambia', '311131', '12.0', 'Regular', 'maize', '360.0', '2018-08-15 22:44:56'), (40, 'Kenya One', '311131', '100.0', 'Regular', 'maize', '3000.0', '2018-08-15 22:45:16'), (41, 'Clare Limo', '31231', '123.0', 'Broker', 'maize', '3690.0', '2018-08-15 22:45:29'), (42, 'Beans One ', '1231', '124.0', 'Regular', 'beans', '3720.0', '2018-08-15 22:46:02'), (43, 'Kepkemoi Dennis', '423121', '230.0', 'Broker', 'beans', '6900.0', '2018-08-15 22:46:29'), (44, 'Clare Limo', '1000823', '123.0', 'Regular', 'greenGrams', '3690.0', '2018-08-15 22:47:47'), (45, 'Clare Friends', '1231312', '230.0', 'Broker', 'greenGrams', '6900.0', '2018-08-15 22:48:16'), (46, 'ADd One ONe', '12132', '200.0', 'Regular', 'millet', '6000.0', '2018-08-15 22:48:45'), (47, 'ONe ONe', '321211', '300.0', 'Broker', 'millet', '9000.0', '2018-08-15 22:49:00'), (48, 'Wwew', '132121', '300.0', 'Regular', 'wheat', '9000.0', '2018-08-15 22:49:23'), (49, '121321', '1213', '1212.0', 'Broker', 'wheat', '36360.0', '2018-08-15 22:49:32'); -- -------------------------------------------------------- -- -- Table structure for table `sales` -- CREATE TABLE `sales` ( `id` int(11) NOT NULL, `name` varchar(200) NOT NULL, `weight` varchar(200) NOT NULL, `type` varchar(200) NOT NULL, `cost` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `sales` -- INSERT INTO `sales` (`id`, `name`, `weight`, `type`, `cost`) VALUES (5, 'Clare Limo', '1000.0', 'beans', '40000.0'), (6, 'Clare Limo', '1000.0', 'maize', '40000.0'), (7, 'Clare Limo', '1000.0', 'millet', '40000.0'), (8, 'clare Me ', '232.0', 'wheat', '9280.0'), (9, 'clare Me ', '232.0', 'green', '9280.0'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `name` varchar(200) NOT NULL, `nationalid` varchar(12) NOT NULL, `username` varchar(40) NOT NULL, `email` varchar(200) NOT NULL, `password` varchar(200) NOT NULL, `is_admin` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `name`, `nationalid`, `username`, `email`, `password`, `is_admin`) VALUES (1, 'OMambia', '312121', 'pyther', 'omambia@brug.africa', '12345', 1), (2, 'OMambia', '312121', 'pyther', 'omambia@brug.africa', '12345', 0), (3, 'OMambia', '312121', 'pyther', 'omambia@brug.africa', '12345', 0), (4, 'OMambia', '312121', 'pyther', 'omambia@brug.africa', '12345', 0), (5, 'Joshua Omambia', '32134221', 'joshua', 'jomambia@gmail.com', '1234', 0), (6, 'Ouma Kenya', '321213131', 'Uname', 'uname@gmail.com', '1234', 0), (7, 'Clare LImo ', '312121', 'limclare', 'limoclare@gmail.com', '12123', 0), (8, 'Nderitu Dennis', '23233', 'dknderitu', 'dknderitu@kenya.com', 'kenya.com', 0), (9, 'Kemunto ', '231231', 'userna', 'kemu@gmail.com', '1232', 0), (10, 'ChirChir Deno', '12131213', 'denno', 'denno@gmail.com', '12345', 0), (11, 'ManotiK ', '343232212', 'manoti', 'geomanoti@gmail.com', 'manoti', 0), (12, 'mairura', '26553141', 'mairura', 'mairura@gma.com', '12233', 0), (13, 'Omambia Dauglous', '1231312', 'pytherKe', 'omambia@gmail.com', '12345', 0); -- -- Indexes for dumped tables -- -- -- Indexes for table `capital` -- ALTER TABLE `capital` ADD PRIMARY KEY (`id`); -- -- Indexes for table `expense` -- ALTER TABLE `expense` ADD PRIMARY KEY (`id`); -- -- Indexes for table `purchase` -- ALTER TABLE `purchase` ADD PRIMARY KEY (`id`); -- -- Indexes for table `sales` -- ALTER TABLE `sales` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `capital` -- ALTER TABLE `capital` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT for table `expense` -- ALTER TABLE `expense` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `purchase` -- ALTER TABLE `purchase` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50; -- -- AUTO_INCREMENT for table `sales` -- ALTER TABLE `sales` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; 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 */;
BEGIN TRANSACTION; CREATE TABLE Employees(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, FName TEXT NOT NULL, LName TEXT NOT NULL,Age INTEGER NOT NULL, Address TEXT, Salary REAL, HireDate TEXT, 'Image' BLOG DEFAULT NULL); INSERT INTO "Employees" VALUES(1,'Derek','Banas',41,'121 Main St',50000.0,'2021-09-25',NULL); DELETE FROM "sqlite_sequence"; INSERT INTO "sqlite_sequence" VALUES('Employees',1); COMMIT;
WITH all_issues AS ( SELECT * FROM issues ) SELECT * FROM all_issues WHERE repo_id = 2;
@@autotask_sql_setup select window_name , enabled , next_start_date at time zone sessiontimezone next_start_date , active --, next_start_date , repeat_interval , duration from dba_scheduler_windows where enabled = 'TRUE' order by next_start_date /
DROP PROCEDURE IF EXISTS Test_PatientSearch; DELIMITER @@ CREATE PROCEDURE Test_PatientSearch (IN province VARCHAR(20), IN city VARCHAR(20), OUT num_matches INT) BEGIN /* returns in num_matches the total number of patients in the given province and city */ SELECT count(distinct PatientData.p_alias) INTO num_matches FROM PatientData WHERE home_address_province = province AND home_address_city = city; END @@ DELIMITER; ---Test Procedure--- --CALL Test_PatientSearch("Ontario", "Waterloo",@num_matches); --SELECT @num_matches;
SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello; SELECT * FROM hello;
-- ## json functions: -- select json_extract(json_text, '$.class.students[0]') as first_student -- from unnest([ -- '{"class" : {"students" : [{"name" : "Jane"}]}}', -- '{"class" : {"students" : []}}', -- '{"class" : {"students" : [{"name" : "John"}, {"name": "Jamie"}]}}' -- ]) as json_text; -- +-----------------+ -- | first_student | -- +-----------------+ -- | {"name":"Jane"} | -- | NULL | -- | {"name":"John"} | -- +-----------------+
insert into management_system.studentcourse (Student_email,course_id) values ('ljiroudek8@sitemeter.com',1); insert into management_system.studentcourse (Student_email,course_id) values ('tattwool4@biglobe.ne.jp',2); insert into management_system.studentcourse (Student_email,course_id) values ('htaffley6@columbia.edu',3);
/* Write SINGLE-ROW and MULTIPLE-ROW SUBQUERIES ============================================ IN ---------- Compares a subject value to a set of values. Returns TRUE if the subject value equals any of the values in the set. Returns FALSE if the subquery returns no rows. ANY, SOME ---------- Used in combination with single-row comparison conditions (such as = or >) to compare a subject value with a multirow subquery. Returns TRUE if the subject value finds a match consistent with the comparison operator in any of the rows returned by the subquery. Returns FALSE if the subquery returns no rows. ALL --------- Used in combination with single-row comparison conditions to compare a subject value with a multirow subquery. Returns TRUE if the subject value finds a match consistent with the comparison operator in all of the rows returned by the subquery. Returns TRUE if the subquery returns no rows. Example: Find all products with a price that’s greater than all of the products in the ‘Luxury’ category: SELECT * FROM PRODUCTS WHERE PRICE > ALL (SELECT PRICE FROM PRODUCTS WHERE CATEGORY = ‘Luxury’); Operator comparisons -------------------- IN - Equal to any member in the list ANY - Compare value to **each** value returned by the subquery ALL - Compare value to **EVERY** value returned by the subquery <ANY() - less than maximum >ANY() - more than minimum =ANY() - equivalent to IN() >ALL() - more than the maximum <ALL() - less than the minimum */ select * from product_information where list_price > ALL (select list_price from product_information where category_id = 32);
alter table MARKET_PRICE_HISTORY alter column PRICE_CHANGE_DATE rename to PRICE_CHANGE_DATE__U35922 ^ alter table MARKET_PRICE_HISTORY add column PRICE_CHANGE_DATE timestamp ;
-- 1327. 列出指定时间段内所有的下单产品 -- 表: Products -- -- +------------------+---------+ -- | Column Name | Type | -- +------------------+---------+ -- | product_id | int | -- | product_name | varchar | -- | product_category | varchar | -- +------------------+---------+ -- product_id 是该表主键。 -- 该表包含该公司产品的数据。 -- 表: Orders -- -- +---------------+---------+ -- | Column Name | Type | -- +---------------+---------+ -- | product_id | int | -- | order_date | date | -- | unit | int | -- +---------------+---------+ -- 该表无主键,可能包含重复行。 -- product_id 是表单 Products 的外键。 -- unit 是在日期 order_date 内下单产品的数目。 --   -- -- 写一个 SQL 语句,要求获取在 2020 年 2 月份下单的数量不少于 100 的产品的名字和数目。 -- -- 返回结果表单的顺序无要求。 -- --   -- -- 查询结果的格式如下: -- -- Products 表: -- +-------------+-----------------------+------------------+ -- | product_id | product_name | product_category | -- +-------------+-----------------------+------------------+ -- | 1 | Leetcode Solutions | Book | -- | 2 | Jewels of Stringology | Book | -- | 3 | HP | Laptop | -- | 4 | Lenovo | Laptop | -- | 5 | Leetcode Kit | T-shirt | -- +-------------+-----------------------+------------------+ -- -- Orders 表: -- +--------------+--------------+----------+ -- | product_id | order_date | unit | -- +--------------+--------------+----------+ -- | 1 | 2020-02-05 | 60 | -- | 1 | 2020-02-10 | 70 | -- | 2 | 2020-01-18 | 30 | -- | 2 | 2020-02-11 | 80 | -- | 3 | 2020-02-17 | 2 | -- | 3 | 2020-02-24 | 3 | -- | 4 | 2020-03-01 | 20 | -- | 4 | 2020-03-04 | 30 | -- | 4 | 2020-03-04 | 60 | -- | 5 | 2020-02-25 | 50 | -- | 5 | 2020-02-27 | 50 | -- | 5 | 2020-03-01 | 50 | -- +--------------+--------------+----------+ -- -- Result 表: -- +--------------------+---------+ -- | product_name | unit | -- +--------------------+---------+ -- | Leetcode Solutions | 130 | -- | Leetcode Kit | 100 | -- +--------------------+---------+ -- -- 2020 年 2 月份下单 product_id = 1 的产品的数目总和为 (60 + 70) = 130 。 -- 2020 年 2 月份下单 product_id = 2 的产品的数目总和为 80 。 -- 2020 年 2 月份下单 product_id = 3 的产品的数目总和为 (2 + 3) = 5 。 -- 2020 年 2 月份 product_id = 4 的产品并没有下单。 -- 2020 年 2 月份下单 product_id = 5 的产品的数目总和为 (50 + 50) = 100 。 -- -- 来源:力扣(LeetCode) -- 链接:https://leetcode-cn.com/problems/list-the-products-ordered-in-a-period -- 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 SELECT p.product_name, sum( o.unit ) AS unit FROM Products AS p JOIN Orders AS o ON p.product_id = o.product_id WHERE o.order_date BETWEEN '2020-02-01' AND '2020-02-29' GROUP BY p.product_id HAVING unit >= 100;
select pls.cd_crt as cartao, count(*) as qtde, sum(opr.vl_opr) as valor, min(opr.dt_opr) as menor_data, max(opr.dt_opr) as maior_data from sc_opr.tbl_pls pls inner join sc_opr.tbl_opr opr on pls.cd_pls = opr.cd_pls where opr.cd_top = 5 and opr.st_opr = 2 group by pls.cd_crt having count(*) > 50 order by qtde desc; --> código da operação: 765882 - 6201554220691917 - 397,31 - 75 - SHOP PARANGABA 01 (06-01-2016) --> código da operação: 1633882 (01-102-16) select * from sc_opr.tbl_opr where cd_opr = 765882; select * from sc_ccb.tbl_ccb where cd_opr in (765882, 1633882); select min(cd_opr) from sc_ccb.tbl_ccb; --listando todos os lancamentos de contas vinculados a uma determinada operação de saque extra - analítico SELECT opr.cd_opr as codigo, opr.vl_opr as valor_cobrado, vl_opr - (vl_trf_opr+ vl_iof_opr+ vl_jrs_opr) as valor_sacado, opr.vl_trf_opr as valor_tarifa, opr.vl_iof_opr as valor_iof, opr.vl_jrs_opr as valor_juros, CNT.CD_CNT, CNT.NM_CNT AS CONTA, LCN.DT_REF_LCN, LCN.NM_HIS_LCN, LCN.FG_DCR_LCN, LCN.VL_LCN FROM sc_opr.tbl_opr opr inner join SC_CNT.TBL_LCN LCN on lcn.cd_sst = 3 and lcn.nsu_lcn = opr.cd_opr INNER JOIN SC_CNT.TBL_CNT CNT ON LCN.CD_CNT = CNT.CD_CNT WHERE opr.st_opr = 2 AND opr.cd_top = 5 and opr.dt_opr >= '2016-01-01' and opr.dt_opr < '2017-01-01' order by codigo limit 100; --listando todos os lancamentos de contas vinculados a uma determinada operação de saque extra - sintético SELECT opr.dt_opr::Date as dt, to_char(opr.dt_opr::Date, 'dd/mm/yyyy') as data, (CASE WHEN SCN.CD_SCN IN (20, 30) THEN SCN.CD_SCN ELSE CNT.CD_CNT END) AS CODIGO_CONTA, (CASE WHEN SCN.CD_SCN IN (20, 30) THEN SCN.DS_SCN ELSE CNT.NM_CNT END) AS nome_CONTA, replace(coalesce(scn.cd_cnt_ctb1, coalesce(cnt.cd_cnt_ctb1, cnt.cd_cnt_ctb)), '.', '') as conta_fortes, lcn.cd_tlc as tipo_lancamento, TLC.DS_TLC AS NOME_TIPO_LANCAMENTO, LCN.FG_DCR_LCN as "D/C", (CASE WHEN SCN_ctp.CD_SCN IN (20, 30) THEN SCN_ctp.CD_SCN ELSE CNT_ctp.CD_CNT END) AS CODIGO_CONtrapartida, (CASE WHEN SCN_ctp.CD_SCN IN (20, 30) THEN SCN_ctp.DS_SCN ELSE CNT_ctp.NM_CNT END) AS nome_CONTrapartida, replace(coalesce(scn_ctp.cd_cnt_ctb1, coalesce(cnt_ctp.cd_cnt_ctb1, cnt_ctp.cd_cnt_ctb)), '.', '') as contrapartida_fortes, sum(LCN.VL_LCN) as valor FROM sc_opr.tbl_opr opr inner join SC_CNT.TBL_LCN LCN on lcn.cd_sst = 3 and lcn.nsu_lcn = opr.cd_opr and lcn.fg_dcr_lcn = 'D' INNER JOIN SC_CNT.TBL_TLC TLC ON LCN.CD_TLC = TLC.CD_TLC INNER JOIN SC_CNT.TBL_CNT CNT ON LCN.CD_CNT = CNT.CD_CNT INNER JOIN SC_CNT.TBL_SCN SCN ON CNT.CD_SCN = SCN.CD_SCN inner join SC_CNT.TBL_LCN LCN_ctp on lcn.cd_ctp_lcn = lcn_ctp.cd_lcn INNER JOIN SC_CNT.TBL_CNT CNT_ctp ON LCN_ctp.CD_CNT = CNT_ctp.CD_CNT INNER JOIN SC_CNT.TBL_SCN SCN_ctp ON CNT_ctp.CD_SCN = SCN_ctp.CD_SCN WHERE opr.st_opr = 2 AND opr.cd_top = 5 and opr.dt_opr >= '2016-01-01' and opr.dt_opr < '2017-01-01' group by opr.dt_opr::Date, (CASE WHEN SCN.CD_SCN IN (20, 30) THEN SCN.DS_SCN ELSE CNT.NM_CNT END), (CASE WHEN SCN.CD_SCN IN (20, 30) THEN SCN.CD_SCN ELSE CNT.CD_CNT END), lcn.cd_tlc, LCN.FG_DCR_LCN, TLC.DS_TLC, (CASE WHEN SCN_ctp.CD_SCN IN (20, 30) THEN SCN_ctp.DS_SCN ELSE CNT_ctp.NM_CNT END), (CASE WHEN SCN_ctp.CD_SCN IN (20, 30) THEN SCN_ctp.CD_SCN ELSE CNT_ctp.CD_CNT END), replace(coalesce(scn_ctp.cd_cnt_ctb1, coalesce(cnt_ctp.cd_cnt_ctb1, cnt_ctp.cd_cnt_ctb)), '.', ''), replace(coalesce(scn.cd_cnt_ctb1, coalesce(cnt.cd_cnt_ctb1, cnt.cd_cnt_ctb)), '.', '') union all SELECT lcn.dt_ref_lcn::Date as dt, to_char(lcn.dt_ref_lcn::Date, 'dd/mm/yyyy') as data, (CASE WHEN SCN.CD_SCN IN (20, 30) THEN SCN.CD_SCN ELSE CNT.CD_CNT END) AS CODIGO_CONTA, (CASE WHEN SCN.CD_SCN IN (20, 30) THEN SCN.DS_SCN ELSE CNT.NM_CNT END) AS nome_CONTA, replace(coalesce(scn.cd_cnt_ctb1, coalesce(cnt.cd_cnt_ctb1, cnt.cd_cnt_ctb)), '.', '') as conta_fortes, lcn.cd_tlc as tipo_lancamento, TLC.DS_TLC AS NOME_TIPO_LANCAMENTO, LCN.FG_DCR_LCN as "D/C", (CASE WHEN SCN_ctp.CD_SCN IN (20, 30) THEN SCN_ctp.CD_SCN ELSE CNT_ctp.CD_CNT END) AS CODIGO_CONtrapartida, (CASE WHEN SCN_ctp.CD_SCN IN (20, 30) THEN SCN_ctp.DS_SCN ELSE CNT_ctp.NM_CNT END) AS nome_CONTrapartida, replace(coalesce(scn_ctp.cd_cnt_ctb1, coalesce(cnt_ctp.cd_cnt_ctb1, cnt_ctp.cd_cnt_ctb)), '.', '') as contrapartida_fortes, sum(LCN.VL_LCN) as valor FROM sc_aeo.tbl_aeop aeop inner join SC_CNT.TBL_LCN LCN on lcn.cd_sst = 21 and lcn.nsu_lcn = aeop.cd_aeop and lcn.fg_dcr_lcn = 'D' INNER JOIN SC_CNT.TBL_TLC TLC ON LCN.CD_TLC = TLC.CD_TLC INNER JOIN SC_CNT.TBL_CNT CNT ON LCN.CD_CNT = CNT.CD_CNT INNER JOIN SC_CNT.TBL_SCN SCN ON CNT.CD_SCN = SCN.CD_SCN inner join SC_CNT.TBL_LCN LCN_ctp on lcn.cd_ctp_lcn = lcn_ctp.cd_lcn INNER JOIN SC_CNT.TBL_CNT CNT_ctp ON LCN_ctp.CD_CNT = CNT_ctp.CD_CNT INNER JOIN SC_CNT.TBL_SCN SCN_ctp ON CNT_ctp.CD_SCN = SCN_ctp.CD_SCN WHERE lcn.dt_ref_lcn >= '2016-01-01' and lcn.dt_ref_lcn < '2017-01-01' --and aeop.st_aeop <> 1 group by lcn.dt_ref_lcn::Date, (CASE WHEN SCN.CD_SCN IN (20, 30) THEN SCN.DS_SCN ELSE CNT.NM_CNT END), (CASE WHEN SCN.CD_SCN IN (20, 30) THEN SCN.CD_SCN ELSE CNT.CD_CNT END), lcn.cd_tlc, LCN.FG_DCR_LCN, TLC.DS_TLC, (CASE WHEN SCN_ctp.CD_SCN IN (20, 30) THEN SCN_ctp.DS_SCN ELSE CNT_ctp.NM_CNT END), (CASE WHEN SCN_ctp.CD_SCN IN (20, 30) THEN SCN_ctp.CD_SCN ELSE CNT_ctp.CD_CNT END), replace(coalesce(scn_ctp.cd_cnt_ctb1, coalesce(cnt_ctp.cd_cnt_ctb1, cnt_ctp.cd_cnt_ctb)), '.', ''), replace(coalesce(scn.cd_cnt_ctb1, coalesce(cnt.cd_cnt_ctb1, cnt.cd_cnt_ctb)), '.', '') order by dt, tipo_lancamento, nome_conta, nome_contrapartida SELECT CNT.CD_CNT, CNT.NM_CNT AS CONTA, LCN.DT_REF_LCN, LCN.NM_HIS_LCN, LCN.FG_DCR_LCN, LCN.VL_LCN FROM SC_CNT.TBL_LCN LCN INNER JOIN SC_CNT.TBL_CNT CNT ON LCN.CD_CNT = CNT.CD_CNT WHERE LCN.CD_SST = 21 AND LCN.NSU_LCN = 164; SELECT * FROM sc_opr.tbl_eop WHERE CD_OPR = 765882; SELECT * FROM sc_ccb.tbl_ccb_ant WHERE CD_OPR = 765882; select * from sc_cad.tbl_dmn where nm_cmp_dmn = 'ST_AEOP' SELECT * FROM sc_aeo.tbl_aeoP WHERE CD_AEOP = 164; SELECT * FROM sc_aeo.tbl_eop WHERE CD_AEOP = 164; SELECT * FROM sc_aeo.tbl_eop WHERE CD_OPR = 765882; select sum(vl_opr) as valor_total, sum(vl_opr - (vl_trf_opr+ vl_iof_opr+ vl_jrs_opr)) as valor_principal, sum(vl_trf_opr) as valor_tarifa, sum(vl_iof_opr) as valor_iof, sum(vl_jrs_opr) as valor_juros, count(*) as qtde from sc_opr.tbl_opr where st_opr = 2 and cd_top = 5 and dt_opr >= current_date; select * from sc_cnt.tbl_cnt where cd_cnt = 535 select sum(vl_sld_cnt) as saldo from sc_cnt.tbl_cnt where cd_scn = 30; select nm_cnt, vl_sld_cnt as saldo from sc_cnt.tbl_cnt where cd_scn = 30;
INSERT INTO cs421g24.receipts( rid, did, "date", totalprice, pid ) VALUES( 1, 2227808233, '2017-07-21', $241.96, 1 ); INSERT INTO cs421g24.receipts( rid, did, "date", totalprice, pid ) VALUES( 2, 8911712167, '2016-12-01', $514.08, 2 ); INSERT INTO cs421g24.receipts( rid, did, "date", totalprice, pid ) VALUES( 3, 8911712167, '2017-02-03', $95.77, 20 ); INSERT INTO cs421g24.receipts( rid, did, "date", totalprice, pid ) VALUES( 4, 8911712167, '2017-02-04', $300.06, 20 ); INSERT INTO cs421g24.receipts( rid, did, "date", totalprice, pid ) VALUES( 5, 3758609089, '2017-08-14', $229.87, 54 ); INSERT INTO cs421g24.receipts( rid, did, "date", totalprice, pid ) VALUES( 6, 3758609089, '2017-08-20', $134.86, 54 ); INSERT INTO cs421g24.receipts( rid, did, "date", totalprice, pid ) VALUES( 7, 9628332635, '2017-05-13', $279.52, 6 );
-- Dec 11, 2009 9:53:05 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 INSERT INTO AD_Tab (AD_Client_ID,AD_Column_ID,AD_Org_ID,AD_Tab_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,HasTree,ImportFields,IsActive,IsAdvancedTab,IsInfoTab,IsInsertRecord,IsReadOnly,IsSingleRow,IsSortTab,IsTranslationTab,Name,Processing,SeqNo,TabLevel,Updated,UpdatedBy) VALUES (0,7729,0,53297,285,151,TO_DATE('2009-12-11 09:53:04','YYYY-MM-DD HH24:MI:SS'),100,'D','N','N','Y','N','N','N','N','N','N','N','Used in Process Parameter','N',40,1,TO_DATE('2009-12-11 09:53:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- Dec 11, 2009 9:53:05 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 INSERT INTO AD_Tab_Trl (AD_Language,AD_Tab_ID, CommitWarning,Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Tab_ID, t.CommitWarning,t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Tab t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Tab_ID=53297 AND EXISTS (SELECT * FROM AD_Tab_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Tab_ID!=t.AD_Tab_ID) ; -- Dec 11, 2009 9:54:09 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,2825,58566,0,53297,TO_DATE('2009-12-11 09:54:08','YYYY-MM-DD HH24:MI:SS'),100,'Process or Report',0,'D','The Process field identifies a unique Process or Report in the system.','Y','Y','Y','N','N','N','N','N','Process',10,0,TO_DATE('2009-12-11 09:54:08','YYYY-MM-DD HH24:MI:SS'),100) ; -- Dec 11, 2009 9:54:09 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58566 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) ; -- Dec 11, 2009 9:57:03 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,2814,58567,0,53297,TO_DATE('2009-12-11 09:56:57','YYYY-MM-DD HH24:MI:SS'),100,0,'D','Y','Y','Y','N','N','N','N','N','Process Parameter',20,0,TO_DATE('2009-12-11 09:56:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- Dec 11, 2009 9:57:03 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58567 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) ; -- Dec 11, 2009 9:59:03 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 UPDATE AD_Tab SET IsReadOnly='Y',Updated=TO_DATE('2009-12-11 09:59:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53297 ; -- Dec 11, 2009 9:59:31 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 UPDATE AD_Field SET AD_Column_ID=4017, Description='Name of the column in the database', Help='The Column Name indicates the name of a column on a table as defined in the database.', Name='DB Column Name',Updated=TO_DATE('2009-12-11 09:59:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58567 ; -- Dec 11, 2009 9:59:31 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=58567 ; -- Dec 11, 2009 10:00:16 AM CET -- FR[2830830] - New tab Used in Process Parameter into "System Element" -- https://sourceforge.net/tracker/?func=detail&aid=2830830&group_id=176962&atid=883808 UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2009-12-11 10:00:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58567 ;
// 객실 CREATE TABLE room( rno NUMBER(3) primary key, rname VARCHAR2(20 byte) NOT NULL, rsize NUMBER(2) NOT NULL, men NUMBER(2) NOT NULL, addman NUMBER(6) DEFAULT 0, weekday NUMBER(6) NOT NULL, weekend NUMBER(6) NOT NULL, sweekday NUMBER(6) NOT NULL, sweekend NUMBER(6) NOT NULL, constraint room_rname_uk unique(rname) ); // 예약 CREATE TABLE reservation( rsno NUMBER(11) primary key, rno NUMBER(3) NOT NULL, uno NUMBER(11) NOT NULL, res_date DATE NOT NULL, night NUMBER(2) NOT NULL, usemen NUMBER(2) NOT NULL, price NUMBER(7) NOT NULL, payment CHAR DEFAULT 'C', pay_name VARCHAR2(20 byte) NOT NULL, pay_number VARCHAR2(20 byte) NOT NULL, pay_yn CHAR DEFAULT 'N', reg_date DATE DEFAULT SYSDATE, constraint reservation_rno_fk foreign key(rno) references room(rno), constraint reservation_uno_fk foreign key(uno) references member(mno), constraint reservation_pay_ck CHECK(pay_yn IN ('Y','N')), constraint reservation_payment_ck CHECK(payment IN ('C','V')) ); // 객실 시퀀스 CREATE sequence room_seq minvalue 1 maxvalue 999 increment BY 1 START with 1; // 예약 시퀀스 CREATE sequence reservation_seq minvalue 1 maxvalue 99999999999 increment BY 1 START with 1; // 펜션관리(성수기,계좌) CREATE TABLE PUBLICPENSION( sseason VARCHAR2(5) NOT NULL, eseason VARCHAR2(5) NOT NULL, bankname VARCHAR2(20 byte) NOT NULL, banknumber VARCHAR2(30 byte) NOT NULL, bankuser VARCHAR2(20 byte) NOT null ); // 회원 CREATE TABLE MEMBER ( mno NUMBER(5) NOT NULL primary key, id VARCHAR2(12) NOT NULL, passwd VARCHAR2(12) NOT NULL, name VARCHAR2(12) NOT NULL, jumin1 CHAR(6) NOT NULL, jumin2 CHAR(7) NOT NULL, email VARCHAR2(50) NOT NULL, recv_yn CHAR(1) NOT NULL, phone1 VARCHAR2(5) NULL, phone2 VARCHAR2(5) NULL, phone3 VARCHAR2(5) NULL, cell1 VARCHAR2(5) NOT NULL, cell2 VARCHAR2(5) NOT NULL, cell3 VARCHAR2(5) NOT NULL, zip CHAR(7) NOT NULL, addr1 VARCHAR2(50) NOT NULL, addr2 VARCHAR2(50) NULL, reg_date TIMESTAMP NOT NULL ); // 관리자 입력 insert into member values(0,'admin','admin','이름',0,0,'이메일','n','0','0','0','0','0','0','0','펜션','펜션',sysdate); // 회원시퀀스 create sequence member_seq start with 1 increment by 1 nocycle // 게시판 create table board ( num number primary key, writer varchar2(10), email varchar2(30), subject varchar2(50), passwd varchar2(12), reg_date date, readcount number, ref number, re_step number, re_level number, content varchar2(4000) ); // 게시판 시퀀스 create sequence seq_board_id increment by 1 start with 1 maxvalue 999999; // 게시판2 create table board1 ( num number primary key, writer varchar2(10), email varchar2(30), subject varchar2(50), passwd varchar2(12), reg_date date, readcount number, ref number, re_step number, re_level number, content varchar2(4000) ); // 게시판2 시퀀스 create sequence seq_board1_id increment by 1 start with 1 maxvalue 999999; // 이미지게시판 create table gboard( name varchar2(15) primary key, passwd varchar2(15), email varchar2(20), homepage varchar2(20), title varchar2(20) , content varchar2(999), uploadfile varchar2(50), reg_date date );
INSERT INTO ch_provinces (id,province) VALUES ( 1,'北京市'); INSERT INTO ch_provinces (id,province) VALUES ( 2,'天津市'); INSERT INTO ch_provinces (id,province) VALUES ( 3,'河北省'); INSERT INTO ch_provinces (id,province) VALUES ( 4,'山西省'); INSERT INTO ch_provinces (id,province) VALUES ( 5,'内蒙古自治区'); INSERT INTO ch_provinces (id,province) VALUES ( 6,'辽宁省'); INSERT INTO ch_provinces (id,province) VALUES ( 7,'吉林省'); INSERT INTO ch_provinces (id,province) VALUES ( 8,'黑龙江省'); INSERT INTO ch_provinces (id,province) VALUES ( 9,'上海市'); INSERT INTO ch_provinces (id,province) VALUES ( 10,'江苏省'); INSERT INTO ch_provinces (id,province) VALUES ( 11,'浙江省'); INSERT INTO ch_provinces (id,province) VALUES ( 12,'安徽省'); INSERT INTO ch_provinces (id,province) VALUES ( 13,'福建省'); INSERT INTO ch_provinces (id,province) VALUES ( 14,'江西省'); INSERT INTO ch_provinces (id,province) VALUES ( 15,'山东省'); INSERT INTO ch_provinces (id,province) VALUES ( 16,'河南省'); INSERT INTO ch_provinces (id,province) VALUES ( 17,'湖北省'); INSERT INTO ch_provinces (id,province) VALUES ( 18,'湖南省'); INSERT INTO ch_provinces (id,province) VALUES ( 19,'广东省'); INSERT INTO ch_provinces (id,province) VALUES ( 20,'广西壮族自治区'); INSERT INTO ch_provinces (id,province) VALUES ( 21,'海南省'); INSERT INTO ch_provinces (id,province) VALUES ( 22,'重庆市'); INSERT INTO ch_provinces (id,province) VALUES ( 23,'四川省'); INSERT INTO ch_provinces (id,province) VALUES ( 24,'贵州省'); INSERT INTO ch_provinces (id,province) VALUES ( 25,'云南省'); INSERT INTO ch_provinces (id,province) VALUES ( 26,'西藏自治区'); INSERT INTO ch_provinces (id,province) VALUES ( 27,'陕西省'); INSERT INTO ch_provinces (id,province) VALUES ( 28,'甘肃省'); INSERT INTO ch_provinces (id,province) VALUES ( 29,'青海省'); INSERT INTO ch_provinces (id,province) VALUES ( 30,'宁夏回族自治区'); INSERT INTO ch_provinces (id,province) VALUES ( 31,'新疆维吾尔自治区');
-------Artist Table------- ----------------PROBLEM 1---------------- INSERT INTO artist (name) VALUES ('Imagine Dragons'), ('The Weeknd'), ('Ed Sheeran'); ----------------PROBLEM 2---------------- SELECT * FROM artist ORDER BY name ASC LIMIT 5; -------Employee Table------- ----------------PROBLEM 1---------------- SELECT first_name, last_name FROM employee WHERE city = 'Calgary'; ----------------PROBLEM 2---------------- SELECT * FROM employee WHERE reports_to IN (SELECT employee_id FROM employee WHERE first_name = 'Nancy' AND last_name = 'Edwards'); ----------------PROBLEM 3---------------- SELECT COUNT(*) FROM employee WHERE city = 'Lethbridge'; -------Invoice Table------- ----------------PROBLEM 1---------------- SELECT COUNT(*) FROM invoice WHERE billing_country = 'USA'; ----------------PROBLEM 2---------------- SELECT * FROM invoice ORDER BY total DESC LIMIT 1; ----------------PROBLEM 3---------------- SELECT * FROM invoice ORDER BY total ASC LIMIT 1; ----------------PROBLEM 4---------------- SELECT * FROM invoice WHERE total > 5; ----------------PROBLEM 5---------------- SELECT COUNT(*) FROM invoice WHERE total < 5; ----------------PROBLEM 6---------------- SELECT SUM(total) FROM invoice; -------JOIN Queries------- ----------------PROBLEM 1---------------- SELECT i.* FROM invoice i JOIN invoice_line il ON i.invoice_id = il.invoice_id WHERE il.unit_price > 0.99; ----------------PROBLEM 2---------------- SELECT i.invoice_date, c.first_name, c.last_name, i.total FROM invoice i JOIN customer c ON c.customer_id = i.customer_id; ----------------PROBLEM 3---------------- SELECT c.first_name, c.last_name, e.first_name, e.last_name FROM customer c JOIN employee e ON c.support_rep_id = e.employee_id; ----------------PROBLEM 4---------------- SELECT al.title, a.name FROM album al JOIN artist a ON a.artist_id = al.artist_id;
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Apr 30, 2019 at 04:21 PM -- Server version: 10.1.38-MariaDB -- PHP Version: 7.1.27 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: `mydb` -- -- -------------------------------------------------------- -- -- Table structure for table `particular_table` -- CREATE TABLE `particular_table` ( `particular_id` int(11) NOT NULL, `particular_name` varchar(50) NOT NULL, `user_id` int(50) NOT NULL, `amount` float NOT NULL, `status` varchar(50) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `particular_table` -- INSERT INTO `particular_table` (`particular_id`, `particular_name`, `user_id`, `amount`, `status`, `date`) VALUES (380049, 'Bangala', 1000001, 3456, 'pending', '2019-04-24 04:43:31'), (900001, 'Watch', 1000001, 445, 'closed', '2019-04-24 13:06:38'), (900002, 'Kammal', 1000001, 3500, 'closed', '2019-04-08 13:00:00'), (900003, 'Earing', 1000001, 5600, 'pending', '2019-04-01 07:30:00'), (900004, 'Watch', 1000002, 4300, 'pending', '2019-04-01 18:30:00'), (17308919, 'Bangal', 1000001, 3456, 'pending', '2019-04-25 08:13:36'), (36412449, 'Adagu', 1000001, 4874, 'pending', '2019-04-29 09:35:06'), (47210922, 'Lollus', 76454, 8000, 'pending', '2019-04-14 13:00:00'), (58280087, 'Bangal', 1000001, 3456, 'pending', '2019-04-25 08:13:34'), (97007227, 'Adagu', 1000001, 4874, 'pending', '2019-04-29 09:35:09'), (104602621, 'Rings', 1000001, 2345, 'pending', '2019-04-14 07:30:00'), (128563457, 'Bangal', 1000001, 3456, 'pending', '2019-04-25 08:13:26'), (140675920, 'Bangal', 1000001, 3456, 'pending', '2019-04-25 08:13:31'), (153933402, 'checkuu', 1000001, 44, 'pending', '2019-04-29 09:36:35'), (157140901, 'Bangal', 1000001, 3456, 'pending', '2019-04-25 08:13:35'), (259649792, 'Valayals', 76454, 7807, 'pending', '2019-04-28 20:53:51'), (265535157, 'Bangalass', 1000001, 3456, 'pending', '2019-04-24 04:43:27'); -- -------------------------------------------------------- -- -- Table structure for table `user_table` -- CREATE TABLE `user_table` ( `id` int(11) NOT NULL, `firstname` varchar(50) NOT NULL, `lastname` varchar(50) NOT NULL, `address1` varchar(150) NOT NULL, `address2` varchar(50) NOT NULL, `district` varchar(50) NOT NULL, `state` varchar(50) NOT NULL, `phone` double NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_table` -- INSERT INTO `user_table` (`id`, `firstname`, `lastname`, `address1`, `address2`, `district`, `state`, `phone`) VALUES (1112, 'Latha', 'Sugumar', '12, Manoj street', 'Agaram', 'Dharampuri', 'Tamilnadu', 988576676), (3507, 'Kathiresan', 'Mandanan', '67/6 Kurukku road', 'Panayapuram', 'Vellore', 'Tamilnadu', 9585858373), (14971, 'Maheshuuu', 'Kumaruuuu', '1/09, jakkama street', 'Ottapidaram', 'Ariyalur', 'TN', 9884500746), (26874, 'Sundari', 'Sivakumar', '45, royal street', 'Gangaveli', 'Salem', 'Tamilnadu', 943884489), (28277, 'Mani Raja', 'Kamalu', '1/56, Rottu theru', 'Panayapuram', 'Ariyalur', 'tn', 37437487), (30024, 'Anusha', 'Subbarao', '1/3535, mariyamman koil', 'Ongol', 'Chennai', 'Tamilnadu', 98374748739), (33023, 'Senthil Anand', 'Ganesan', '12, Jai jekkama', 'Perumpakkam', 'Chennai', 'Tamilnadu', 9883374478), (39959, 'Rakesh', 'Narayanan', '23,49 Plot road', 'Panapakkam', 'Villupuram', 'Tamilnadu', 9884747474), (44812, 'Sundar', 'Natarajan', '1/34, Haritham road', 'Medavakkam', 'Chennai', 'Tamilnadu', 94848548200), (64018, 'Vinoth', 'Ramamoorthy', '209, Thiyagarajan Road', 'Muthambalayam', 'Villupuram', 'Tamilnadu', 98484848329), (76454, 'Muthu', 'Kamalakannan', 'mailformuthu07@gmail.com', 'Panapakkam', 'Villupuram', 'Tamilnadu', 9884500746), (1000001, 'Subash', 'Kesavan', 'No 1/39, Mariyamman koil street\r\nPanapakkam (Mel),', 'Panapakkam', 'Villupuram', 'Tamilnadu', 9884500382), (1000002, 'Sabarish', 'Ramasesan', 'No 1/39, Mariyamman koil street\r\nPanapakkam (Mel),', 'Radhapuram', 'Villupuram', 'Tamilnadu', 9597652172); -- -- Indexes for dumped tables -- -- -- Indexes for table `particular_table` -- ALTER TABLE `particular_table` ADD PRIMARY KEY (`particular_id`); -- -- Indexes for table `user_table` -- ALTER TABLE `user_table` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `particular_table` -- ALTER TABLE `particular_table` MODIFY `particular_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=265535158; -- -- AUTO_INCREMENT for table `user_table` -- ALTER TABLE `user_table` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1000003; 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 spr_list_ReceivedCollection_Compare(@FROMDATE DATETIME, @TODATE DATETIME) as Select "DocumentID" = Collections.DocumentID, "Received CollectionId" = CollectionsReceived.FullDocID, "New CollectionID" = Collections.FullDocID, "Customer Id" = Customer.CustomerId, "Customer Name" = Customer.Company_Name, "Received Collection Value" = CollectionsReceived.Value, "New Collection Value" = Collections.Value, "Difference" = CollectionsReceived.Value - Collections.Value, "Branch Forum ID" = BranchForumCode From CollectionsReceived, Collections, Customer Where CollectionsReceived.CustomerId=Customer.CustomerID And CollectionsReceived.DocSerial = IsNull(Collections.OriginalCollection,0) and Collections.DocumentDate between @fromdate and @todate And (IsNull(Collections.Status,0) & 192) = 0 And (IsNull(Collections.Status,0) & 64) = 0 And IsNull(Collections.OriginalCollection,0) > 0
with sub_mrr as ( select c.id as sub_id, sum(cast(a.mrr as decimal(18,2))) as mrr from zuora.zuora_rate_plan_charge a join zuora.zuora_rate_plan b on a.rateplanid = b.id join zuora.zuora_subscription c on b.subscriptionid = c.id where a.islastsegment = true group by 1 ), sub_billing_periods as ( select listagg(billingperiod,', ') within group (order by billingperiod) as billing_periods, subscriptionid from ( select distinct b.subscriptionid,a.billingperiod from zuora.zuora_rate_plan_charge a join zuora.zuora_rate_plan b on a.rateplanid = b.id where a.islastsegment = true order by a.mrr desc ) group by 2 ), sub_product_list as ( select listagg(product_with_quantity,', ') within group (order by mrr desc) as product_list, subscriptionid from ( select subscriptionid, mrr, name || ' (' || cast(quantity as integer) || ')' as product_with_quantity from ( select distinct b.subscriptionid, b.name, a.mrr, case when a.quantity = 0 or a.quantity is null then 1 else a.quantity end as quantity from zuora.zuora_rate_plan_charge a join zuora.zuora_rate_plan b on a.rateplanid = b.id where a.islastsegment = true ) ) group by 2 ) select a.id as sub_id, a.name as sub_name, a.termtype, a.status, coalesce(lag(cast(b.effectivedate as date),1) over (partition by a.name order by cast(a."version#392c30e6081c24fb78ddf6d622de4f33" as integer)),cast(a.subscriptionstartdate as date)) as sub_effective_date, cast(a.contracteffectivedate as date) as contract_effective_date, cast(a.subscriptionstartdate as date) as sub_start_date, cast(a.subscriptionenddate as date) as sub_end_date, cast(a."version#392c30e6081c24fb78ddf6d622de4f33" as integer) as sub_version, coalesce(c.mrr,0) as mrr, d.billing_periods, e.product_list, a.accountid from zuora.zuora_subscription a left join zuora.zuora_amendment b on a.id = b.subscriptionid left join sub_mrr c on a.id = c.sub_id left join sub_billing_periods d on a.id = d.subscriptionid left join sub_product_list e on a.id = e.subscriptionid
select * from hasStock; #select * from OrderListingsByCustomerName; #select * from StockListings; select * from CoustomerStock;
-- script to run in phpmyadmin CREATE DATABASE IF NOT EXISTS 'www_authentication'; CREATE TABLE user ( email VARCHAR(255), password VARCHAR(255), ); INSERT INTO user (email, password) values ('asdf@asd', 'pass1'); INSERT INTO user (email, password) values ('qwerty@asd', 'pass2');
CREATE TABLE [actual].[kb_use] ( [sys_created_on_display_value] DATETIME NULL, [article_display_value] NVARCHAR(80) NULL, [sys_updated_by_display_value] NVARCHAR(255) NULL, [sys_id_display_value] NVARCHAR(255) NULL, [user_display_value] NVARCHAR(255) NULL, [used_display_value] NVARCHAR(80) NULL, [viewed_display_value] NVARCHAR(80) NULL, [sys_mod_count_display_value] NVARCHAR(80) NULL, [sys_created_by_display_value] NVARCHAR(255) NULL, [times_viewed_display_value] NVARCHAR(80) NULL, [sys_updated_on_display_value] DATETIME NULL, [sys_tags_display_value] NVARCHAR(80) NULL, )
CREATE table meals ( id INT AUTO_INCREMENT NOT NULL, image VARCHAR(255), link VARCHAR(255), title VARCHAR(255), calories DECIMAL(5,2), protein DECIMAL(5,2), fat DECIMAL(5,2), carbs DECIMAL (5,2), createdAt timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(id) ) CREATE table users ( id INT AUTO_INCREMENT NOT NULL, firstname VARCHAR(255), lastname VARCHAR(255), username VARCHAR(255), password VARCHAR(255), gender VARCHAR(255), age INT NOT NULL, ft INT NOT NULL, inches INT NOT NULL, lbs INT NOT NULL, mifflinStJeor BOOLEAN, exerciseLevel INT NOT NULL, goal DECIMAL(2,1), protein DECIMAL(5,2), fat DECIMAL(5,2), carbs DECIMAL(5,2), calories DECIMAL(5,2), caloriesmeal DECIMAL(5,2), carbsmeal DECIMAL (5,2), proteinmeal DECIMAL (5,2), fatmeal DECIMAL (5,2) createdAt timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(id) ) CREATE table ingredients ( id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255), image VARCHAR(255), link VARCHAR(255), createdAt timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(id) )
-- -- Update sql for MailWizz EMA from version 1.3.4.8 to 1.3.4.9 -- -- -- Table structure for table `delivery_server_to_customer_group` -- CREATE TABLE IF NOT EXISTS `delivery_server_to_customer_group` ( `server_id` int(11) NOT NULL, `group_id` int(11) NOT NULL, PRIMARY KEY (`server_id`,`group_id`), KEY `fk_delivery_server_to_customer_group_customer_group1_idx` (`group_id`), KEY `fk_delivery_server_to_customer_group_delivery_server1_idx` (`server_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Constraints for table `delivery_server_to_customer_group` -- ALTER TABLE `delivery_server_to_customer_group` ADD CONSTRAINT `fk_delivery_server_to_customer_group_delivery_server1` FOREIGN KEY (`server_id`) REFERENCES `delivery_server` (`server_id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `fk_delivery_server_to_customer_group_customer_group1` FOREIGN KEY (`group_id`) REFERENCES `customer_group` (`group_id`) ON DELETE CASCADE ON UPDATE NO ACTION; -- -- Alter statement for table `list` -- ALTER TABLE `list` ADD `display_name` VARCHAR(100) NOT NULL AFTER `name`; UPDATE `list` set `display_name` = `name` WHERE 1; -- -- Table structure for table `campaign_delivery_log_archive` -- CREATE TABLE IF NOT EXISTS `campaign_delivery_log_archive` ( `log_id` bigint(20) NOT NULL AUTO_INCREMENT, `campaign_id` int(11) NOT NULL, `subscriber_id` int(11) NOT NULL, `message` text NULL, `processed` enum('yes','no') NOT NULL DEFAULT 'no', `retries` int(1) NOT NULL DEFAULT '0', `max_retries` int(1) NOT NULL DEFAULT '3', `email_message_id` varchar(255) NULL, `status` char(15) NOT NULL DEFAULT 'success', `date_added` datetime NOT NULL, PRIMARY KEY (`log_id`), KEY `fk_campaign_delivery_log_archive_list_subscriber1_idx` (`subscriber_id`), KEY `fk_campaign_delivery_log_archive_campaign1_idx` (`campaign_id`), KEY `sub_proc_status` (`subscriber_id`,`processed`,`status`), KEY `email_message_id` (`email_message_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Constraints for table `campaign_delivery_log_archive` -- ALTER TABLE `campaign_delivery_log_archive` ADD CONSTRAINT `fk_campaign_delivery_log_archive_campaign1` FOREIGN KEY (`campaign_id`) REFERENCES `campaign` (`campaign_id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `fk_campaign_delivery_log_archive_list_subscriber1` FOREIGN KEY (`subscriber_id`) REFERENCES `list_subscriber` (`subscriber_id`) ON DELETE CASCADE ON UPDATE NO ACTION; -- -- Alter statement for table `campaign` -- ALTER TABLE `campaign` ADD `delivery_logs_archived` ENUM('yes','no') NOT NULL DEFAULT 'no' AFTER `send_at`; ALTER TABLE `campaign` ADD KEY `status_delivery_logs_archived_campaign_id` (`status`, `delivery_logs_archived`, `campaign_id`);
-- phpMyAdmin SQL Dump -- version 3.4.5 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 30, 2017 at 10:13 AM -- Server version: 5.5.16 -- PHP Version: 5.3.8 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `company` -- -- -------------------------------------------------------- -- -- Table structure for table `login` -- CREATE TABLE IF NOT EXISTS `login` ( `id` int(10) NOT NULL AUTO_INCREMENT, `username` varchar(255) NOT NULL, `fullname` varchar(50) NOT NULL, `email` varchar(40) NOT NULL, `password` varchar(255) NOT NULL, `securityquestion` varchar(100) NOT NULL, `securityanswer` varchar(20) NOT NULL, `points` int(11) NOT NULL, `firsttime` varchar(10) NOT NULL DEFAULT 'TRUE', `wizard` int(1) NOT NULL, `ppic` varchar(15) NOT NULL, `dob` varchar(15) NOT NULL, `occupation` varchar(20) NOT NULL, `state` varchar(25) NOT NULL, `city` varchar(25) NOT NULL, `gender` varchar(7) NOT NULL, `circlelist` varchar(255) NOT NULL, `requests` varchar(255) NOT NULL, `files` varchar(1000) NOT NULL, `apikey` varchar(70) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=42 ; -- -- Dumping data for table `login` -- INSERT INTO `login` (`id`, `username`, `fullname`, `email`, `password`, `securityquestion`, `securityanswer`, `points`, `firsttime`, `wizard`, `ppic`, `dob`, `occupation`, `state`, `city`, `gender`, `circlelist`, `requests`, `files`, `apikey`) VALUES (25, 'divyanshu9', 'Divyanshu Mishra', 'mishradivyanshu05@gmail.com', '137406', 'What is Your birth place?', 'lucknow', 0, 'FALSE', 0, 'divyanshu9.png', '10/05/1995', 'Student', '', 'Karnal', 'male', '27 26 ', '', '', ''), (26, 'rajivmishra', 'RAJIV MISHRA', 'rajivmishra12@rediffmail.com', '123', 'What is Your birth place?', 'lucknow', 0, 'FALSE', 0, 'rajivmishra.jpg', '26/10/1972', 'Service', '', 'Karnal', 'male', '27 25 ', '', '', ''), (27, 'divyansu7', 'Prince Mishra', 'mishradivyansu7@gmail.com', '12', 'What is Your favourite destination?', 'goa', 0, 'FALSE', 0, 'divyansu7.jpg', '05/10/1995', 'Student', '', 'Karnal', 'male', '26 25 ', '', '', ''), (40, 'e', '', 'e', 'e1671797c52e15f763380b45e841ec32', '', '', 0, 'TRUE', 0, '', '', '', '', '', '', '', '', 'Admit_Card.pdf Sr.pdf ', 't9kCh286QTqy8XXqDJcaQYAB'), (41, 'f', '', 'f', '8fa14cdd754f91cc6554c9e71929cce7', '', '', 0, 'TRUE', 0, '', '', '', '', '', '', '', '', 'bzip.zip samajwadisp.pdf ', 'XO85TyahJCOczxhh0NbcyUwY'); /*!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 */;