text
stringlengths
6
9.38M
drop table stock_info; CREATE TABLE stock_info ( stock_code character(6) NOT NULL, stock_name character varying(50), --所属行业 industrial_category character(100), --总市值 total_market_value decimal, --总股本 general_capital decimal, --流通股本 circulation_stock decimal, insert_time timestamp without time zone, update_time timestamp without time zone, CONSTRAINT stock_info_idx1 PRIMARY KEY (stock_code) ) WITH ( OIDS = FALSE ) ; ALTER TABLE stock_info OWNER TO adams;
use orderBook; INSERT INTO stock (name,symbol) VALUES ('APPLE' , 'AAPL'); INSERT INTO stock (name,symbol) VALUES ( 'Amazon','AMAZN'); INSERT INTO stock (name,symbol) VALUES ( 'Netflix','NFLX'); INSERT INTO stock (name,symbol) VALUES ( 'Tesla','TSLA'); INSERT INTO stock (name,symbol) VALUES ( 'Walmart','WMT'); INSERT INTO stock (name,symbol) VALUES ( ' NVIDIA Corporation','NVDA'); INSERT INTO stock (name,symbol) VALUES ( 'JPMorgan Chase & Co.','JPM'); INSERT INTO stock (name,symbol) VALUES ( 'Google','GOOG'); INSERT INTO stock (name,symbol) VALUES ( 'Alibaba Group Holding Limited','BABA'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'CANCELLED', '3', '320','2020-08-02 19:06:30.140250','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'CANCELLED', '2', '3550','2020-07-16 22:07:51.140212','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'IN-PROGRESS', '4', '33450','2020-08-16 07:02:51.140222','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'IN-PROGRESS', '5', '30','2020-03-16 20:06:41.140211','1.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'IN-PROGRESS', '6', '50','2020-08-11 05:12:11.140220','98.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'IN-PROGRESS', '7', '310','2020-08-16 16:14:21.140255','567.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'IN-PROGRESS', '5', '35','2020-08-16 06:11:51.14034','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'IN-PROGRESS', '7', '30','2020-08-16 15:05:51.140215','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'IN-PROGRESS', '2', '380','2020-08-16 17:07:51.140212','3967.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('SELL', 'IN-PROGRESS', '2', '20','2020-08-16 18:08:51.140211','452.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '2', '398','2020-08-16 19:15:51.140210','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '1', '98','2020-08-16 15:17:51.140239','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '4', '120','2020-08-16 11:34:51.140238','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '8', '250','2020-08-16 21:23:51.140237','987.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '9', '300','2020-08-16 22:45:51.140236','2.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '6', '360','2020-08-16 12:02:51.140235','98.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '4', '90','2020-08-16 11:13:51.140234','12.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '3', '55','2020-08-16 15:05:51.140233','900.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '5', '40','2020-08-16 14:09:51.140232','17.00'); INSERT INTO stock_order (side,status,stock_id,quantity,datetime,price) VALUES ('BUY', 'IN-PROGRESS', '7', '69','2020-08-16 19:16:51.140231','15.00'); -- INSERT INTO `orderTransaction` (order_id,order_stock_id,quantity, datetime, transaction_type) VALUES ('1', '1', '250', '2020-09-16 12:03:21.140234','FULFILLED');
--Drop the database : `example_jdbc` DROP DATABASE IF EXISTS `example_jdbc`; --Create the database : `example_jdbc` CREATE DATABASE IF NOT EXISTS `example_jdbc` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `example_jdbc`; --Create the Example table. CREATE TABLE IF NOT EXISTS `example` ( `example_id` int(6) NOT NULL AUTO_INCREMENT, `title` varchar(60) NOT NULL, `description` varchar(250) NOT NULL, PRIMARY KEY (`example_id`), UNIQUE KEY `title` (`title`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; --Insert some examples in the database. INSERT INTO `example` (`title`, `description`) VALUES ('example title 1', 'example description 1'); INSERT INTO `example` (`title`, `description`) VALUES ('example title 2', 'example description 2'); INSERT INTO `example` (`title`, `description`) VALUES ('example title 3', 'example description 3'); INSERT INTO `example` (`title`, `description`) VALUES ('example title 4', 'example description 4');
-------------------- studentsFollowing---------------- CREATE OR REPLACE VIEW studentsFollowing AS SELECT students.ssn, students.studentid, students.name, students.program, branch FROM students LEFT JOIN isPartOf ON students.ssn = isPartOf.ssn; -------------------- FinishedCourses------------------ CREATE OR REPLACE VIEW finishedCourses AS SELECT students.ssn, students.name, courses.code, hasRead.grade, courses.credits FROM students, courses, hasRead WHERE students.ssn = hasread.ssn AND courses.code = hasread.course; -------------------- Registrations-------------------- /*OLD APROCHE CREATE OR REPLACE VIEW Registrations AS SELECT sub1.ssn, sub1.name, registeredTo, queue.datetime FROM queue RIGHT OUTER JOIN(SELECT students.ssn, students.name, registeredTo FROM students LEFT OUTER JOIN registeredTo ON students.ssn = registeredTo.studentID) AS sub1 ON sub1.ssn = queue.ssn; */ /*NEW APROCHE*/ CREATE OR REPLACE VIEW Registrations AS SELECT ssn, course, 'waiting' AS status FROM queue UNION SELECT studentid, course, 'registered' as status FROM registeredto; ---------------------- PassedCourses------------------- CREATE OR REPLACE VIEW PassedCourses AS SELECT * FROM FinishedCourses WHERE grade <> 'U'; ---------------------- UnreadMandatory---------------- CREATE OR REPLACE VIEW UnreadMandatory AS ( ( SELECT students.ssn AS "ssn", students.name AS "name", courses.code AS "code", courses.credits AS "credits" FROM(students NATURAL LEFT JOIN mandatoryForProgram) LEFT JOIN Courses ON mandatoryForProgram.course = code ) UNION ( SELECT students.ssn AS "ssn", students.name AS "name", courses.code AS "code", courses.credits AS "credits" FROM ((isPartOf NATURAL LEFT JOIN mandatoryForBranch) LEFT JOIN Courses ON mandatoryForBranch.course = code) LEFT JOIN students ON students.ssn = IsPartOf.ssn ) EXCEPT ( SELECT "ssn", "name", "code", "credits" FROM passedCourses ) ORDER BY "ssn" ); ------------------ PathToGraduation---------------- CREATE OR REPLACE VIEW PathToGraduation AS( WITH allStudentsAndCredits AS (( SELECT ssn, COALESCE(sum(credits),0) AS credits FROM PassedCourses GROUP BY ssn) ), allStudentsAndMathCredits AS( ( SELECT ssn, COALESCE(sum(credits),0) AS mathCredits FROM PassedCourses INNER JOIN hasClassification ON PassedCourses.code = hasClassification.course WHERE hasClassification.classificationtype = 'Math' GROUP BY ssn) ), allStudentsAndResearchCredits AS( ( SELECT ssn, COALESCE(sum(credits),0) AS researchCredits FROM PassedCourses INNER JOIN hasClassification ON PassedCourses.code = hasClassification.course WHERE hasClassification.classificationtype = 'Research' GROUP BY ssn) ), allStudentsAndSeminarCredits AS( ( SELECT ssn, COALESCE(sum(credits),0) AS seminarCredits FROM PassedCourses INNER JOIN hasClassification ON PassedCourses.code = hasClassification.course WHERE hasClassification.classificationtype = 'Seminar' GROUP BY ssn) ), allNumberOfMandatoryLeft AS ( ( SELECT ssn, count(code) AS nbrOfMandatoryLeft FROM UnreadMandatory GROUP BY ssn ) ) SELECT students.ssn, credits, nbrOfMandatoryLeft, MathCredits, ResearchCredits, SeminarCredits, case when nbrOfMandatoryLeft is null and MathCredits >= 20 and ResearchCredits >= 10 and SeminarCredits > 0 then 'Yes' else 'No' end as GraduationStatus from students left outer join allStudentsAndCredits on students.ssn = allStudentsAndCredits.ssn left outer join allNumberOfMandatoryLeft on students.ssn = allNumberOfMandatoryLeft.ssn left outer join allStudentsAndMathCredits on students.ssn = allStudentsAndMathCredits.ssn left outer join allStudentsAndResearchCredits on students.ssn = allStudentsAndResearchCredits.ssn left outer join allStudentsAndSeminarCredits on students.ssn = allStudentsAndSeminarCredits.ssn ); ----------------------CourseQueuePositions--------------------------------------------------- CREATE OR REPLACE VIEW CourseQueuePositions AS SELECT * FROM queue ORDER BY course, datetime;
INSERT INTO posts (body, user_id) VALUES ($1, $2) RETURNING *;
CREATE TABLE IF NOT EXISTS url ( id serial PRIMARY KEY, original_url TEXT UNIQUE NOT NULL, code TEXT UNIQUE NOT NULL ); CREATE TABLE IF NOT EXISTS code_pool ( code TEXT PRIMARY KEY );
CREATE SEQUENCE rhferiasperiodoassentamento_rh169_sequencial_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; CREATE SEQUENCE tipoassentamentoferias_rh168_sequencial_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- TABELAS E ESTRUTURA -- Módulo: recursoshumanos CREATE TABLE rhferiasperiodoassentamento( rh169_sequencial int4 NOT NULL default 0, rh169_rhferiasperiodo int4 NOT NULL default 0, rh169_assenta int4 default 0, CONSTRAINT rhferiasperiodoassentamento_rhfe_pk PRIMARY KEY (rh169_sequencial)); -- Módulo: recursoshumanos CREATE TABLE tipoassentamentoferias( rh168_sequencial int4 NOT NULL default 0, rh168_tipoassentamentoferias int4 default 0, rh168_tipoassentamentoabono int4 default 0, CONSTRAINT tipoassentamentoferias_sequ_pk PRIMARY KEY (rh168_sequencial)); -- CHAVE ESTRANGEIRA ALTER TABLE rhferiasperiodoassentamento ADD CONSTRAINT rhferiasperiodoassentamento_assenta_fk FOREIGN KEY (rh169_assenta) REFERENCES assenta; ALTER TABLE rhferiasperiodoassentamento ADD CONSTRAINT rhferiasperiodoassentamento_rhferiasperiodo_fk FOREIGN KEY (rh169_rhferiasperiodo) REFERENCES rhferiasperiodo; ALTER TABLE tipoassentamentoferias ADD CONSTRAINT tipoassentamentoferias_tipoassentamentoferias_fk FOREIGN KEY (rh168_tipoassentamentoferias) REFERENCES tipoasse; -- INDICES CREATE INDEX rhferiasperiodoassentamento_assenta_in ON rhferiasperiodoassentamento(rh169_assenta); CREATE INDEX rhferiasperiodoassentamento_rhferiasperiodo_in ON rhferiasperiodoassentamento(rh169_rhferiasperiodo); CREATE INDEX tipoassentamentoferias_assenta_abono_in ON tipoassentamentoferias(rh168_tipoassentamentoabono); CREATE INDEX tipoassentamentoferias_assenta_ferias_in ON tipoassentamentoferias(rh168_tipoassentamentoferias); alter table rhferiasperiodo drop rh110_periodoespecificoinicial; alter table rhferiasperiodo drop rh110_periodoespecificofinal; alter table cfpess add column r11_rubricaescalaferias varchar(4);
-- 20.03.2010 16:57:19 MEZ -- FR 2897194 Advanced Zoom and RelationTypes INSERT INTO AD_Reference (AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType,AD_Client_ID) VALUES (0,53345,TO_TIMESTAMP('2010-03-20 16:57:18','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','RelType C_Invoice_ID->M_InOut',TO_TIMESTAMP('2010-03-20 16:57:18','YYYY-MM-DD HH24:MI:SS'),100,'T',0) ; -- 20.03.2010 16:57:19 MEZ INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_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_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53345 AND NOT EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 20.03.2010 16:57:55 MEZ INSERT INTO AD_Ref_Table (AD_Display,AD_Key,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,AD_Client_ID,WhereClause,AD_Reference_ID,AD_Table_ID) VALUES (3791,3521,0,TO_TIMESTAMP('2010-03-20 16:57:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N',TO_TIMESTAMP('2010-03-20 16:57:55','YYYY-MM-DD HH24:MI:SS'),100,0,'M_InOut_ID IN ( select m.M_InOut_ID from M_InOut m left join M_InOutline ml on ml.M_InOut_ID = m.M_InOut_ID left join c_invoiceline il on il.M_InOutline_ID = ml.M_InOutline_ID where il.C_Invoice_ID=@C_Invoice_ID@ )',53345,319) ; -- 20.03.2010 16:58:04 MEZ UPDATE AD_Ref_Table SET OrderByClause=NULL,Updated=TO_TIMESTAMP('2010-03-20 16:58:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53345 ; -- 20.03.2010 16:58:43 MEZ INSERT INTO AD_Reference (AD_Org_ID,AD_Reference_ID,Created,CreatedBy,Description,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType,AD_Client_ID) VALUES (0,53346,TO_TIMESTAMP('2010-03-20 16:58:43','YYYY-MM-DD HH24:MI:SS'),100,'Finds C_Invoice_IDs for a given C_C_Order_ID','D','Y','N','RelType C_Order->C_Invoice',TO_TIMESTAMP('2010-03-20 16:58:43','YYYY-MM-DD HH24:MI:SS'),100,'T',0) ; -- 20.03.2010 16:58:43 MEZ INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_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_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53346 AND NOT EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 20.03.2010 16:59:18 MEZ INSERT INTO AD_Ref_Table (AD_Display,AD_Key,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,OrderByClause,Updated,UpdatedBy,AD_Client_ID,WhereClause,AD_Reference_ID,AD_Table_ID) VALUES (3492,3484,0,TO_TIMESTAMP('2010-03-20 16:59:18','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','DocumentNo',TO_TIMESTAMP('2010-03-20 16:59:18','YYYY-MM-DD HH24:MI:SS'),100,0,'C_Invoice_ID IN ( select i.C_Invoice_ID from C_Invoice i left join C_InvoiceLine il on il.C_Invoice_ID = i.C_Invoice_ID left join C_OrderLine ol on ol.C_OrderLine_ID = il.C_OrderLine_ID where ol.C_Order_ID=@C_Order_ID@ )',53346,318) ; -- 20.03.2010 17:00:00 MEZ INSERT INTO AD_Reference (AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType,AD_Client_ID) VALUES (0,53347,TO_TIMESTAMP('2010-03-20 16:59:59','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','RelType C_Order->M_InOut',TO_TIMESTAMP('2010-03-20 16:59:59','YYYY-MM-DD HH24:MI:SS'),100,'T',0) ; -- 20.03.2010 17:00:00 MEZ INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_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_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53347 AND NOT EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 20.03.2010 17:00:49 MEZ INSERT INTO AD_Ref_Table (AD_Display,AD_Key,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,OrderByClause,Updated,UpdatedBy,AD_Client_ID,WhereClause,AD_Reference_ID,AD_Table_ID) VALUES (3791,3521,0,TO_TIMESTAMP('2010-03-20 17:00:49','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','DocumentNo',TO_TIMESTAMP('2010-03-20 17:00:49','YYYY-MM-DD HH24:MI:SS'),100,0,'M_InOut_ID IN ( select i.M_InOut_ID from M_InOut i left join M_InOutline il on il.M_InOut_ID = i.M_InOut_ID left join C_OrderLine ol on ol.C_OrderLine_ID = il.C_OrderLine_ID where ol.C_Order_ID=@C_Order_ID@ )',53347,319) ; -- 20.03.2010 17:01:14 MEZ INSERT INTO AD_Reference (AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType,AD_Client_ID) VALUES (0,53348,TO_TIMESTAMP('2010-03-20 17:01:13','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','RelType M_InOut_ID->C_Invoice',TO_TIMESTAMP('2010-03-20 17:01:13','YYYY-MM-DD HH24:MI:SS'),100,'T',0) ; -- 20.03.2010 17:01:14 MEZ INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_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_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53348 AND NOT EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 20.03.2010 17:01:48 MEZ INSERT INTO AD_Ref_Table (AD_Display,AD_Key,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,OrderByClause,Updated,UpdatedBy,AD_Client_ID,WhereClause,AD_Reference_ID,AD_Table_ID) VALUES (3492,3484,0,TO_TIMESTAMP('2010-03-20 17:01:48','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','DocumentNo',TO_TIMESTAMP('2010-03-20 17:01:48','YYYY-MM-DD HH24:MI:SS'),100,0,'C_Invoice_ID IN ( select i.C_Invoice_ID from C_Invoice i left join c_invoiceline il on il.C_Invoice_ID = i.C_Invoice_ID left join M_InOutline ml on ml.M_InOutline_ID = il.M_InOutline_ID where ml.M_InOut_ID=@M_InOut_ID@ )',53348,318) ; -- 20.03.2010 17:02:14 MEZ INSERT INTO AD_Reference (AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType,AD_Client_ID) VALUES (0,53349,TO_TIMESTAMP('2010-03-20 17:02:08','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','RelType M_InOut_ID->C_Order',TO_TIMESTAMP('2010-03-20 17:02:08','YYYY-MM-DD HH24:MI:SS'),100,'T',0) ; -- 20.03.2010 17:02:14 MEZ INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_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_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53349 AND NOT EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 20.03.2010 17:02:48 MEZ INSERT INTO AD_Ref_Table (AD_Display,AD_Key,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,OrderByClause,Updated,UpdatedBy,AD_Client_ID,WhereClause,AD_Reference_ID,AD_Table_ID) VALUES (2169,2161,0,TO_TIMESTAMP('2010-03-20 17:02:48','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','DocumentNo',TO_TIMESTAMP('2010-03-20 17:02:48','YYYY-MM-DD HH24:MI:SS'),100,0,'C_Order_ID IN ( select o.c_order_id from c_order o left join c_orderline ol on ol.c_order_id = o.c_order_id left join M_InOutline il on il.c_orderline_id = ol.c_orderline_id where il.M_InOut_ID=@M_InOut_ID@ )',53349,259) ; -- 20.03.2010 17:18:22 MEZ INSERT INTO AD_RelationType (AD_Org_ID,AD_Client_ID,AD_Reference_Target_ID,AD_RelationType_ID,Created,CreatedBy,IsActive,IsDirected,Name,Type,Updated,UpdatedBy,AD_Reference_Source_ID) VALUES (0,0,53347,50002,TO_TIMESTAMP('2010-03-20 17:18:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Order<->InOut','I',TO_TIMESTAMP('2010-03-20 17:18:21','YYYY-MM-DD HH24:MI:SS'),100,53349) ; -- 20.03.2010 17:19:18 MEZ INSERT INTO AD_RelationType (AD_Org_ID,AD_Client_ID,AD_Reference_Target_ID,AD_RelationType_ID,Created,CreatedBy,IsActive,IsDirected,Name,Type,Updated,UpdatedBy,AD_Reference_Source_ID) VALUES (0,0,53345,50003,TO_TIMESTAMP('2010-03-20 17:19:17','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Invoice<->InOut','I',TO_TIMESTAMP('2010-03-20 17:19:17','YYYY-MM-DD HH24:MI:SS'),100,53348) ; -- 22.03.2010 07:40:40 MEZ INSERT INTO AD_Reference (AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType,AD_Client_ID) VALUES (0,53352,TO_TIMESTAMP('2010-03-22 07:40:39','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','RelType C_BPartner_ID->Customer_RMA',TO_TIMESTAMP('2010-03-22 07:40:39','YYYY-MM-DD HH24:MI:SS'),100,'T',0) ; -- 22.03.2010 07:40:40 MEZ INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_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_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53352 AND NOT EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 22.03.2010 07:44:03 MEZ INSERT INTO AD_Ref_Table (AD_Display,AD_Key,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy,AD_Client_ID,WhereClause,AD_Reference_ID,AD_Table_ID) VALUES (2901,2893,0,TO_TIMESTAMP('2010-03-22 07:44:03','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N',TO_TIMESTAMP('2010-03-22 07:44:03','YYYY-MM-DD HH24:MI:SS'),100,0,'M_RMA.IsSOTrx=''Y'' AND M_RMA.C_BPartner_ID=@C_BPartner_ID@',53352,291) ; -- 22.03.2010 07:44:30 MEZ INSERT INTO AD_Reference (AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType,AD_Client_ID) VALUES (0,53353,TO_TIMESTAMP('2010-03-22 07:44:29','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','RelType Customer_RMA->C_BPartner_ID',TO_TIMESTAMP('2010-03-22 07:44:29','YYYY-MM-DD HH24:MI:SS'),100,'T',0) ; -- 22.03.2010 07:44:30 MEZ INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_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_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53353 AND NOT EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 22.03.2010 07:46:44 MEZ INSERT INTO AD_Ref_Table (AD_Display,AD_Key,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,OrderByClause,Updated,UpdatedBy,AD_Client_ID,WhereClause,AD_Reference_ID,AD_Table_ID) VALUES (10841,10847,0,TO_TIMESTAMP('2010-03-22 07:46:44','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','Value',TO_TIMESTAMP('2010-03-22 07:46:44','YYYY-MM-DD HH24:MI:SS'),100,0,'C_BPartner_ID=@C_BPartner_ID@',53353,661) ; -- 22.03.2010 07:49:29 MEZ UPDATE AD_Ref_Table SET WhereClause='M_RMA.IsSOTrx=''Y'' AND M_RMA.C_BPartner_ID=@C_BPartner_ID@',Updated=TO_TIMESTAMP('2010-03-22 07:49:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53353 ; -- 22.03.2010 07:49:38 MEZ UPDATE AD_Reference SET Name='RelType Customer_RMA<=C_BPartner_ID',Updated=TO_TIMESTAMP('2010-03-22 07:49:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53353 ; -- 22.03.2010 07:49:38 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53353 ; -- 22.03.2010 07:50:20 MEZ UPDATE AD_Reference SET Name='RelType C_BPartner_ID<=Customer_RMA',Updated=TO_TIMESTAMP('2010-03-22 07:50:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:50:20 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:50:48 MEZ UPDATE AD_Ref_Table SET WhereClause='C_BPartner.C_BPartner_ID=@C_BPartner_ID@',Updated=TO_TIMESTAMP('2010-03-22 07:50:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:51:07 MEZ UPDATE AD_Reference SET Name='RelType C_BPartner_ID <= Customer_RMA',Updated=TO_TIMESTAMP('2010-03-22 07:51:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:51:07 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:51:13 MEZ UPDATE AD_Reference SET Name='RelType C_Invoice_ID <= C_Order',Updated=TO_TIMESTAMP('2010-03-22 07:51:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53333 ; -- 22.03.2010 07:51:13 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53333 ; -- 22.03.2010 07:51:19 MEZ UPDATE AD_Reference SET Name='RelType C_Invoice_ID <= M_InOut',Updated=TO_TIMESTAMP('2010-03-22 07:51:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53345 ; -- 22.03.2010 07:51:19 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53345 ; -- 22.03.2010 07:51:26 MEZ UPDATE AD_Reference SET Name='RelType C_Order <= C_Invoice',Updated=TO_TIMESTAMP('2010-03-22 07:51:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53346 ; -- 22.03.2010 07:51:26 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53346 ; -- 22.03.2010 07:51:29 MEZ UPDATE AD_Reference SET Name='RelType C_Order_ID <= C_Invoice',Updated=TO_TIMESTAMP('2010-03-22 07:51:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53334 ; -- 22.03.2010 07:51:29 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53334 ; -- 22.03.2010 07:51:32 MEZ UPDATE AD_Reference SET Name='RelType C_Order <= M_InOut',Updated=TO_TIMESTAMP('2010-03-22 07:51:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53347 ; -- 22.03.2010 07:51:32 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53347 ; -- 22.03.2010 07:51:35 MEZ UPDATE AD_Reference SET Name='RelType Customer_RMA <= C_BPartner_ID',Updated=TO_TIMESTAMP('2010-03-22 07:51:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53353 ; -- 22.03.2010 07:51:35 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53353 ; -- 22.03.2010 07:51:38 MEZ UPDATE AD_Reference SET Name='RelType M_InOut_ID <= C_Invoice',Updated=TO_TIMESTAMP('2010-03-22 07:51:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53348 ; -- 22.03.2010 07:51:38 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53348 ; -- 22.03.2010 07:51:43 MEZ UPDATE AD_Reference SET Name='RelType M_InOut_ID <= C_Order',Updated=TO_TIMESTAMP('2010-03-22 07:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53349 ; -- 22.03.2010 07:51:43 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53349 ; -- 22.03.2010 07:52:11 MEZ UPDATE AD_Reference SET Name='RelType C_Order <= M_InOut_ID',Updated=TO_TIMESTAMP('2010-03-22 07:52:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53349 ; -- 22.03.2010 07:52:11 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53349 ; -- 22.03.2010 07:52:22 MEZ UPDATE AD_Reference SET Name='RelType C_Invoice <= M_InOut_ID',Updated=TO_TIMESTAMP('2010-03-22 07:52:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53348 ; -- 22.03.2010 07:52:22 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53348 ; -- 22.03.2010 07:52:58 MEZ UPDATE AD_Reference SET Name='RelType M_InOut <= C_Order',Updated=TO_TIMESTAMP('2010-03-22 07:52:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53347 ; -- 22.03.2010 07:52:58 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53347 ; -- 22.03.2010 07:53:10 MEZ UPDATE AD_Reference SET Name='RelType C_Invoice <= C_Order_ID',Updated=TO_TIMESTAMP('2010-03-22 07:53:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53334 ; -- 22.03.2010 07:53:10 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53334 ; -- 22.03.2010 07:53:48 MEZ DELETE FROM AD_Reference_Trl WHERE AD_Reference_ID=53346 ; -- 22.03.2010 07:53:48 MEZ DELETE FROM AD_Reference WHERE AD_Reference_ID=53346 ; -- 22.03.2010 07:53:59 MEZ UPDATE AD_Reference SET Name='RelType M_InOut <= C_Invoice_ID',Updated=TO_TIMESTAMP('2010-03-22 07:53:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53345 ; -- 22.03.2010 07:53:59 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53345 ; -- 22.03.2010 07:55:18 MEZ UPDATE AD_Reference SET Name='RelType C_Order <= C_Invoice_ID',Updated=TO_TIMESTAMP('2010-03-22 07:55:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53333 ; -- 22.03.2010 07:55:18 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53333 ; -- 22.03.2010 07:55:23 MEZ UPDATE AD_Reference SET Name='RelType M_InOut <= C_Order_ID',Updated=TO_TIMESTAMP('2010-03-22 07:55:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53347 ; -- 22.03.2010 07:55:23 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53347 ; -- 22.03.2010 07:55:52 MEZ UPDATE AD_Reference SET Name='RelType C_BPartner <= Customer_RMA_ID',Updated=TO_TIMESTAMP('2010-03-22 07:55:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:55:52 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:56:13 MEZ UPDATE AD_Reference SET Name='RelType C_BPartner <= RMA_ID',Updated=TO_TIMESTAMP('2010-03-22 07:56:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:56:13 MEZ UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53352 ; -- 22.03.2010 07:56:33 MEZ INSERT INTO AD_Reference (AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType,AD_Client_ID) VALUES (0,53354,TO_TIMESTAMP('2010-03-22 07:56:32','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','RelType Vendor_RMA <= C_BPartner_ID',TO_TIMESTAMP('2010-03-22 07:56:32','YYYY-MM-DD HH24:MI:SS'),100,'T',0) ; -- 22.03.2010 07:56:33 MEZ INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_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_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53354 AND NOT EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 22.03.2010 07:57:23 MEZ INSERT INTO AD_Ref_Table (AD_Display,AD_Key,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,OrderByClause,Updated,UpdatedBy,AD_Client_ID,WhereClause,AD_Reference_ID,AD_Table_ID) VALUES (10841,10847,0,TO_TIMESTAMP('2010-03-22 07:57:23','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','DocumentNo',TO_TIMESTAMP('2010-03-22 07:57:23','YYYY-MM-DD HH24:MI:SS'),100,0,'M_RMA.IsSOTrx=''N'' AND M_RMA.C_BPartner_ID=@C_BPartner_ID@',53354,661) ; -- 22.03.2010 08:00:23 MEZ INSERT INTO AD_RelationType (AD_Org_ID,AD_Client_ID,AD_Reference_Target_ID,AD_RelationType_ID,Created,CreatedBy,IsActive,IsDirected,Name,Type,Updated,UpdatedBy,AD_Reference_Source_ID) VALUES (0,0,53354,50004,TO_TIMESTAMP('2010-03-22 08:00:22','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Customer<->VendorRMA','I',TO_TIMESTAMP('2010-03-22 08:00:22','YYYY-MM-DD HH24:MI:SS'),100,53352) ; -- 22.03.2010 08:00:51 MEZ INSERT INTO AD_RelationType (AD_Org_ID,AD_Client_ID,AD_RelationType_ID,Created,CreatedBy,IsActive,IsDirected,Name,Type,Updated,UpdatedBy) VALUES (0,0,50005,TO_TIMESTAMP('2010-03-22 08:00:50','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','BPartner<->CustomerRMA','I',TO_TIMESTAMP('2010-03-22 08:00:50','YYYY-MM-DD HH24:MI:SS'),100) ; -- 22.03.2010 08:00:57 MEZ UPDATE AD_RelationType SET Name='BPartner<->VendorRMA',Updated=TO_TIMESTAMP('2010-03-22 08:00:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=50004 ; -- 22.03.2010 08:01:16 MEZ UPDATE AD_RelationType SET AD_Reference_Target_ID=53353, AD_Reference_Source_ID=53352,Updated=TO_TIMESTAMP('2010-03-22 08:01:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=50005 ; -- Mar 22, 2010 1:36:03 PM COT UPDATE AD_RelationType SET Name='BPartner<->VendorReturn',Updated=TO_TIMESTAMP('2010-03-22 13:36:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=50004 ; -- Mar 22, 2010 1:37:03 PM COT UPDATE AD_Reference SET EntityType='D', Name='RelType Vendor Return <= C_BPartner_ID',Updated=TO_TIMESTAMP('2010-03-22 13:37:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53354 ; -- Mar 22, 2010 1:37:03 PM COT UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53354 ; -- Mar 22, 2010 1:37:08 PM COT UPDATE AD_Reference SET Name='RelType C_BPartner <= Vendor Return',Updated=TO_TIMESTAMP('2010-03-22 13:37:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53352 ; -- Mar 22, 2010 1:37:08 PM COT UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53352 ; -- Mar 22, 2010 1:39:08 PM COT UPDATE AD_Ref_Table SET AD_Display=3791, AD_Key=3521, AD_Table_ID=319, WhereClause='M_InOut.MovementType IN (''V+'') AND M_InOut.C_BPartner_ID=@C_BPartner_ID@',Updated=TO_TIMESTAMP('2010-03-22 13:39:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53354 ; -- Mar 22, 2010 1:39:54 PM COT UPDATE AD_RelationType SET Name='BPartner<->Customer Return',Updated=TO_TIMESTAMP('2010-03-22 13:39:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=50005 ; -- Mar 22, 2010 1:40:28 PM COT UPDATE AD_Reference SET Name='RelType C_BPartner <= Vendor/Customer Return',Updated=TO_TIMESTAMP('2010-03-22 13:40:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53352 ; -- Mar 22, 2010 1:40:28 PM COT UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53352 ; -- Mar 22, 2010 1:40:39 PM COT UPDATE AD_Reference SET Name='RelType Customer Return <= C_BPartner_ID',Updated=TO_TIMESTAMP('2010-03-22 13:40:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53353 ; -- Mar 22, 2010 1:40:39 PM COT UPDATE AD_Reference_Trl SET IsTranslated='N' WHERE AD_Reference_ID=53353 ; -- Mar 22, 2010 1:41:09 PM COT UPDATE AD_Ref_Table SET AD_Display=3791, AD_Key=3521, AD_Table_ID=319, WhereClause='M_InOut.MovementType IN (''C-'') AND M_InOut.C_BPartner_ID=@C_BPartner_ID@',Updated=TO_TIMESTAMP('2010-03-22 13:41:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53353 ; -- Mar 22, 2010 1:48:48 PM COT UPDATE AD_Ref_Table SET AD_Window_ID=53097,Updated=TO_TIMESTAMP('2010-03-22 13:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53354 ; -- Mar 22, 2010 1:49:28 PM COT UPDATE AD_Ref_Table SET AD_Window_ID=53098,Updated=TO_TIMESTAMP('2010-03-22 13:49:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53354 ; -- Mar 22, 2010 1:49:55 PM COT UPDATE AD_Ref_Table SET WhereClause='M_InOut.MovementType IN (''V-'') AND M_InOut.C_BPartner_ID=@C_BPartner_ID@',Updated=TO_TIMESTAMP('2010-03-22 13:49:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53354 ; -- Mar 22, 2010 1:51:01 PM COT UPDATE AD_Ref_Table SET AD_Window_ID=53097, WhereClause='M_InOut.MovementType IN (''C+'') AND M_InOut.C_BPartner_ID=@C_BPartner_ID@',Updated=TO_TIMESTAMP('2010-03-22 13:51:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=53353 ;
DROP TABLE __MigrationHistory DROP TABLE Absences DROP TABLE BloodSamples DROP TABLE MaterialWorkOrders DROP TABLE MedicineWorkOrders DROP TABLE ActivityInputDatas DROP TABLE ActivityActivityInputs DROP TABLE ServiceActivities DROP TABLE PatientWorkOrders DROP TABLE Materials DROP TABLE Medicines DROP TABLE ActivityInputs DROP TABLE Activities DROP TABLE Visits DROP TABLE WorkOrders DROP TABLE Employees DROP TABLE Diseases DROP TABLE Users DROP TABLE Patients DROP TABLE Relationships DROP TABLE Districts DROP TABLE Contractors DROP TABLE Roles DROP TABLE JobTitles DROP TABLE PostOffices DROP TABLE IpLogs DROP TABLE Services
CREATE TABLE persons ( id BIGINT AUTO_INCREMENT, social_security_number VARCHAR(20), person_name VARCHAR(50), sum_of_costs BIGINT, PRIMARY KEY (id) );
create proc sp_get_Status (@STK_REQ_NO int) as select sum(quantity),sum(pending) from stock_request_detail where stock_req_number = @STK_REQ_NO
CREATE PROCEDURE sp_get_ReceivedPO(@PONUMBER INT) AS SELECT PODate, Customer.Company_Name, RequiredDate, Value, POAbstractReceived.BillingAddress, POAbstractReceived.ShippingAddress, POReference, POAbstractReceived.CustomerID, DocumentID, POPrefix FROM POAbstractReceived, Customer WHERE PONumber = @PONUMBER AND POAbstractReceived.CustomerID = Customer.CustomerID AND POAbstractReceived.Status = 0
■問題 以下は書籍情報テーブル(books)から価格(price列)が5000円未満の書籍情報を取り出すためのSQL命令です (取り出す列はtitle, publish, price 列とします)。 SQL命令に含まれる誤りをふたつ指摘してください。 SELECT title publish price FROM books WHERE price <= 5000 ; ■回答・実行文 指摘1:SELECTするカラムが複数の場合はカンマで区切る必要がある 指摘2:5000円'未満'なので不等号は「<=」ではなく「<」が正しい # title, publish, price 列を取り出す SELECT title, publish, price # 書籍情報テーブルから取得 FROM books # 5000円未満の書籍情報 WHERE price < 5000 ; ■返却値 mysql> SELECT -> title, -> publish, -> price -> FROM -> books -> WHERE -> price < 5000 -> ; +------------------+--------------+-------+ | title | publish | price | +------------------+--------------+-------+ | ハムスターの観察 | 山田出版 | 900 | | フェレットの観察 | 山田出版 | 1000 | | らくだの観察日記 | 山田出版 | 1100 | | あひるの観察日記 | 山田出版 | 700 | | かえるの観察日記 | 山田出版 | 800 | | JSPリファレンス | 秀和システム | 1800 | | PHP5サンプル集 | 秀和システム | 3000 | | XML辞典 | 翔泳社 | 3300 | | PEAR入門 | 翔泳社 | 3000 | | SQLリファレンス | 日経BP | 2500 | | SQLプチブック | 日経BP | 1600 | | XMLリファレンス | 日経BP | 3200 | +------------------+--------------+-------+ 12 rows in set (0.00 sec)
-- -- PostgreSQL database dump -- SET statement_timeout = 0; SET lock_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; SET search_path = public, pg_catalog; SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: drawings_drawing; Type: TABLE; Schema: public; Owner: mmahnken; Tablespace: -- CREATE TABLE drawings_drawing ( created timestamp with time zone NOT NULL, modified timestamp with time zone NOT NULL, title character varying(200) NOT NULL, id character varying(20) NOT NULL, favorite boolean NOT NULL, image character varying(100) NOT NULL, description text NOT NULL, notebook_id character varying(20) NOT NULL ); ALTER TABLE drawings_drawing OWNER TO mmahnken; -- -- Data for Name: drawings_drawing; Type: TABLE DATA; Schema: public; Owner: mmahnken -- COPY drawings_drawing (created, modified, title, id, favorite, image, description, notebook_id) FROM stdin; 2016-09-03 13:09:48.509269-07 2016-09-03 15:50:17.624119-07 MDW mdw t drawings/oriented.jpg In flight drawing, MDW to OAK. in-between-galaxies 2016-09-03 14:18:46.812138-07 2016-09-03 15:55:55.323769-07 Wavy Hair wavy-hair f drawings/wavyh.JPG in-between-galaxies 2016-09-03 13:11:02.115436-07 2016-09-03 15:56:13.470525-07 Vanity Williams vanity-williams f drawings/vanitywill.JPG in-between-galaxies 2016-09-03 13:12:55.963343-07 2016-09-03 15:56:34.373908-07 Toby Rustworthy toby-rustworthy f drawings/jo.JPG in-between-galaxies 2016-09-03 13:08:25.593389-07 2016-09-03 15:56:54.506275-07 Scurd scurd t drawings/scurd.JPG in-between-galaxies 2016-09-03 13:11:45.809085-07 2016-09-03 15:57:23.052332-07 Day After Pill day-after-pill f drawings/morning.JPG in-between-galaxies 2016-09-03 13:07:21.754494-07 2016-09-03 15:57:52.532417-07 Planet 6616 planet-6616 f drawings/saturn2.JPG in-between-galaxies 2016-09-03 12:57:24.474818-07 2016-09-03 16:01:50.729373-07 Rex Wattleigh rex-wattleigh t drawings/rex.JPG square-to-be-hip 2016-09-03 13:00:03.449286-07 2016-09-03 16:02:39.165184-07 Untitled untitled-1 f drawings/this.JPG square-to-be-hip 2016-09-03 12:59:04.329703-07 2016-09-03 16:03:07.952983-07 Herminio Dulce herminio-dulce t drawings/farmer.JPG Mild-mannered farmer square-to-be-hip \. -- -- Name: drawings_drawing_pkey; Type: CONSTRAINT; Schema: public; Owner: mmahnken; Tablespace: -- ALTER TABLE ONLY drawings_drawing ADD CONSTRAINT drawings_drawing_pkey PRIMARY KEY (id); -- -- Name: drawings_drawing_03b31b8c; Type: INDEX; Schema: public; Owner: mmahnken; Tablespace: -- CREATE INDEX drawings_drawing_03b31b8c ON drawings_drawing USING btree (notebook_id); -- -- Name: drawings_drawing_id_e1ad3179_like; Type: INDEX; Schema: public; Owner: mmahnken; Tablespace: -- CREATE INDEX drawings_drawing_id_e1ad3179_like ON drawings_drawing USING btree (id varchar_pattern_ops); -- -- Name: drawings_drawing_notebook_id_a2eec757_like; Type: INDEX; Schema: public; Owner: mmahnken; Tablespace: -- CREATE INDEX drawings_drawing_notebook_id_a2eec757_like ON drawings_drawing USING btree (notebook_id varchar_pattern_ops); -- -- Name: drawings_drawing_notebook_id_a2eec757_fk_drawings_notebook_id; Type: FK CONSTRAINT; Schema: public; Owner: mmahnken -- ALTER TABLE ONLY drawings_drawing ADD CONSTRAINT drawings_drawing_notebook_id_a2eec757_fk_drawings_notebook_id FOREIGN KEY (notebook_id) REFERENCES drawings_notebook(id) DEFERRABLE INITIALLY DEFERRED; -- -- PostgreSQL database dump complete --
create table UNIDADES ( id integer identity(1,1), barrio varchar(30) not null, estrato integer not null, valorCanon float not null default 0, area float not null default 0, direccion varchar(50) not null, habitaciones integer not null default 1, banios integer not null default 1, parqueadero integer not null default 0, cuartoUtil integer not null default 0, tipoParqueadero varchar(20), tipoCocina varchar(20), imagenPrincipal varchar (200), primary key(id) ) create table FOTOGRAFIAS ( idUnidad integer, nroFoto integer, direccionFoto varchar(80), primary key(idUnidad, nroFoto) ) alter table FOTOGRAFIAS add constraint FORANEA_ID_UNIDAD foreign key (idUnidad) references UNIDADES(id);
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Jun 16, 2019 at 10:38 AM -- Server version: 10.3.14-MariaDB -- PHP Version: 7.3.2 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: `id9626789_d_futsal` -- -- -------------------------------------------------------- -- -- Table structure for table `booking` -- CREATE TABLE `booking` ( `idbooking` int(255) NOT NULL, `kodeunik` varchar(38) NOT NULL, `nama` varchar(255) NOT NULL, `NIK` varchar(27) NOT NULL, `notelp` varchar(38) NOT NULL, `alamat` varchar(255) NOT NULL, `tgl_sewa` varchar(87) NOT NULL, `jammulai` varchar(84) NOT NULL, `jamselesai` varchar(45) NOT NULL, `lapangan` varchar(11) NOT NULL, `status` enum('Lunas','Belum Bayar') NOT NULL, `total` int(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `booking` -- INSERT INTO `booking` (`idbooking`, `kodeunik`, `nama`, `NIK`, `notelp`, `alamat`, `tgl_sewa`, `jammulai`, `jamselesai`, `lapangan`, `status`, `total`) VALUES (71, 'sadsda', 'aan', '100288282', '09228', 'aaasu', '20-01-2009', '12:30', '13:30', 'D', 'Lunas', 100000); -- -- Indexes for dumped tables -- -- -- Indexes for table `booking` -- ALTER TABLE `booking` ADD PRIMARY KEY (`idbooking`), ADD KEY `lapangan` (`lapangan`), ADD KEY `lapangan_2` (`lapangan`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `booking` -- ALTER TABLE `booking` MODIFY `idbooking` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=72; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump -- version 4.1.12 -- http://www.phpmyadmin.net -- -- Хост: 127.0.0.1 -- Время создания: Окт 13 2014 г., 18:24 -- Версия сервера: 5.6.16 -- Версия PHP: 5.5.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- База данных: `mydatabase` -- -- -------------------------------------------------------- -- -- Структура таблицы `blog` -- CREATE TABLE IF NOT EXISTS `blog` ( `postid` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(50) COLLATE utf8_bin NOT NULL, `subtitle` varchar(400) COLLATE utf8_bin NOT NULL, `text` varchar(5000) COLLATE utf8_bin NOT NULL, `photo` varchar(255) COLLATE utf8_bin NOT NULL, `postdate` int(11) NOT NULL, PRIMARY KEY (`postid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; -- phpMyAdmin SQL Dump -- version 4.1.12 -- http://www.phpmyadmin.net -- -- Хост: 127.0.0.1 -- Время создания: Окт 13 2014 г., 18:26 -- Версия сервера: 5.6.16 -- Версия PHP: 5.5.11 -- -- База данных: `mydatabase` -- -- -------------------------------------------------------- -- -- Структура таблицы `user` -- CREATE TABLE IF NOT EXISTS `user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_login` varchar(30) COLLATE utf8_bin NOT NULL, `user_password` varchar(32) COLLATE utf8_bin NOT NULL, `user_hash` varchar(32) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3 ; -- -- Дамп данных таблицы `user` -- INSERT INTO `user` (`user_id`, `user_login`, `user_password`, `user_hash`) VALUES (1, 'ristee', '7aa14f5819ef01c48efc0b1ee138f47e', ''), (2, 'lina', '141cdb8d460043b6cfc8060cc155ff11', '');
use lab; CREATE TABLE Department( `code` INT PRIMARY KEY NOT NULL, `title` VARCHAR(30), `dept_name` VARCHAR(30) UNIQUE NOT NULL, `dept_id` INT UNIQUE NOT NULL, `salary` INT, CHECK (`salary` > 2000 ) ); INSERT INTO Department(`code`, `title`, `dept_name`, `dept_id`,`salary`) VALUES (333, "Hello World", "Computer Science", 333, 99000); CREATE TABLE Instructor( `name` VARCHAR(50) NOT NULL, `code` INT NOT NULL, `id` INT PRIMARY KEY DEFAULT 0 ); INSERT INTO Instructor(`name`, `code`, `id`) VALUES ("Diego Maradona", 10, 10);
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server version: 10.1.19-MariaDB - mariadb.org binary distribution -- Server OS: Win32 -- HeidiSQL Version: 9.5.0.5196 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- Dumping database structure for ujian_pegawai DROP DATABASE IF EXISTS `ujian_pegawai`; CREATE DATABASE IF NOT EXISTS `ujian_pegawai` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `ujian_pegawai`; -- Dumping structure for table ujian_pegawai.daftar_nilai DROP TABLE IF EXISTS `daftar_nilai`; CREATE TABLE IF NOT EXISTS `daftar_nilai` ( `nik` char(16) NOT NULL, `nilai_akademik` decimal(10,0) NOT NULL DEFAULT '0', `nilai_psikotest` decimal(10,0) NOT NULL DEFAULT '0', `nilai_w_rektor` decimal(10,0) NOT NULL DEFAULT '0', `nilai_w_wr_1` decimal(10,0) NOT NULL DEFAULT '0', `nilai_w_wr_2` decimal(10,0) NOT NULL DEFAULT '0', `nilai_w_wr_3` decimal(10,0) NOT NULL DEFAULT '0', `nilai_w_yayasan` decimal(10,0) NOT NULL DEFAULT '0', KEY `FK_daftar_nilai_pelamar` (`nik`), CONSTRAINT `FK_daftar_nilai_pelamar` FOREIGN KEY (`nik`) REFERENCES `pelamar` (`nik`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.daftar_nilai: ~0 rows (approximately) DELETE FROM `daftar_nilai`; /*!40000 ALTER TABLE `daftar_nilai` DISABLE KEYS */; INSERT INTO `daftar_nilai` (`nik`, `nilai_akademik`, `nilai_psikotest`, `nilai_w_rektor`, `nilai_w_wr_1`, `nilai_w_wr_2`, `nilai_w_wr_3`, `nilai_w_yayasan`) VALUES ('1471101009950001', 100, 88, 20, 20, 20, 20, 20); /*!40000 ALTER TABLE `daftar_nilai` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.detail_jabatan_periode DROP TABLE IF EXISTS `detail_jabatan_periode`; CREATE TABLE IF NOT EXISTS `detail_jabatan_periode` ( `id_periode` int(11) NOT NULL, `id_fakultas` int(11) NOT NULL, `id_subbag` int(11) NOT NULL, `jumlah` int(11) NOT NULL, UNIQUE KEY `id_periode_id_fakultas_id_subbag` (`id_periode`,`id_fakultas`,`id_subbag`), KEY `FK_detail_jabatan_periode_mst_fakultas` (`id_fakultas`), KEY `FK_detail_jabatan_periode_mst_subbag` (`id_subbag`), CONSTRAINT `FK_detail_jabatan_periode_konfig_periode` FOREIGN KEY (`id_periode`) REFERENCES `konfig_periode` (`id_periode`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_detail_jabatan_periode_mst_fakultas` FOREIGN KEY (`id_fakultas`) REFERENCES `mst_fakultas` (`id_fakultas`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_detail_jabatan_periode_mst_subbag` FOREIGN KEY (`id_subbag`) REFERENCES `mst_subbag` (`id_subbag`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.detail_jabatan_periode: ~28 rows (approximately) DELETE FROM `detail_jabatan_periode`; /*!40000 ALTER TABLE `detail_jabatan_periode` DISABLE KEYS */; INSERT INTO `detail_jabatan_periode` (`id_periode`, `id_fakultas`, `id_subbag`, `jumlah`) VALUES (19, 1, 1, 2), (19, 1, 2, 2), (21, 1, 1, 2), (21, 1, 2, 3), (22, 1, 1, 2), (22, 1, 2, 3), (23, 1, 1, 2), (23, 1, 2, 3), (24, 1, 1, 2), (24, 1, 2, 3), (25, 1, 1, 2), (25, 1, 2, 3), (26, 1, 1, 2), (26, 1, 2, 3), (27, 1, 1, 2), (27, 1, 2, 3), (28, 1, 1, 2), (28, 1, 2, 3), (29, 1, 1, 2), (29, 1, 2, 3), (30, 1, 1, 2), (30, 1, 2, 3), (31, 1, 1, 2), (31, 1, 2, 3), (32, 1, 1, 2), (32, 1, 2, 3), (33, 1, 1, 2), (33, 1, 2, 3); /*!40000 ALTER TABLE `detail_jabatan_periode` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.konfig_periode DROP TABLE IF EXISTS `konfig_periode`; CREATE TABLE IF NOT EXISTS `konfig_periode` ( `id_periode` int(11) NOT NULL AUTO_INCREMENT, `tanggal_ujian_akademik` datetime NOT NULL, `tanggal_ujian_psikotest` datetime NOT NULL, `tanggal_ujian_wawancara` datetime NOT NULL, `tanggal_buka_lamaran` datetime NOT NULL, `tanggal_tutup_lamaran` datetime NOT NULL, PRIMARY KEY (`id_periode`) ) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.konfig_periode: ~18 rows (approximately) DELETE FROM `konfig_periode`; /*!40000 ALTER TABLE `konfig_periode` DISABLE KEYS */; INSERT INTO `konfig_periode` (`id_periode`, `tanggal_ujian_akademik`, `tanggal_ujian_psikotest`, `tanggal_ujian_wawancara`, `tanggal_buka_lamaran`, `tanggal_tutup_lamaran`) VALUES (16, '2018-02-14 09:00:00', '2018-02-15 09:00:00', '2018-02-16 09:00:00', '2018-02-10 00:00:00', '2018-02-13 00:00:00'), (17, '2018-02-14 09:00:00', '2018-02-15 09:00:00', '2018-02-16 09:00:00', '2018-02-10 00:00:00', '2018-02-13 00:00:00'), (18, '2018-02-14 09:00:00', '2018-02-15 09:00:00', '2018-02-16 09:00:00', '2018-02-10 00:00:00', '2018-02-13 00:00:00'), (19, '2018-02-14 09:00:00', '2018-02-15 09:00:00', '2018-02-16 09:00:00', '2018-02-10 00:00:00', '2018-02-13 00:00:00'), (20, '2018-02-14 09:00:00', '2018-02-15 09:00:00', '2018-02-16 09:00:00', '2018-02-10 00:00:00', '2018-02-13 00:00:00'), (21, '2018-03-05 10:51:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (22, '2018-03-05 10:51:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (23, '2018-03-05 10:51:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (24, '2018-03-05 10:51:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (25, '2018-03-05 10:51:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (26, '2018-03-05 10:51:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (27, '2018-03-05 10:51:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (28, '2018-03-05 10:51:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (29, '2018-03-05 10:00:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (30, '2018-03-05 10:00:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (31, '2018-03-05 10:00:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (32, '2018-03-05 10:00:00', '2018-03-06 10:00:00', '2018-03-08 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'), (33, '2018-03-12 15:00:00', '2018-03-13 10:00:00', '2018-03-14 10:00:00', '2018-03-01 00:00:00', '2018-03-04 00:00:00'); /*!40000 ALTER TABLE `konfig_periode` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.konfig_umum DROP TABLE IF EXISTS `konfig_umum`; CREATE TABLE IF NOT EXISTS `konfig_umum` ( `persyaratan_umum` text, `lokasi_ujian_akademik` varchar(50) DEFAULT NULL, `lokasi_ujian_psikotest` varchar(50) DEFAULT NULL, `lokasi_ujian_wawancara` varchar(50) DEFAULT NULL, `durasi_ujian_akademik` tinyint(4) DEFAULT NULL, `aktif` enum('Y','N') NOT NULL DEFAULT 'N' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.konfig_umum: ~0 rows (approximately) DELETE FROM `konfig_umum`; /*!40000 ALTER TABLE `konfig_umum` DISABLE KEYS */; INSERT INTO `konfig_umum` (`persyaratan_umum`, `lokasi_ujian_akademik`, `lokasi_ujian_psikotest`, `lokasi_ujian_wawancara`, `durasi_ujian_akademik`, `aktif`) VALUES ('> Warga Negara Republik Indonesia \r\n> Berusia Minimal 18 Tahun \r\n> Sehat Jamani dan Rohani serta Bebas Narkoba \r\n> Berkelakuan Baik \r\n> Tidak Pernah diberhentikan secara Tidak Hormat \r\n> Tidak berkedudukan sebagai CPNS atau PNS \r\n> Pendidikan Minimal S1 Dengan IPK Minimal 3.00 \r\n\r\nMengunggah Berkas Lamaran Yang Terdiri Dari : \r\n> Surat Lamaran \r\n> Fotokopi Ijazah dan transkrip nilai yang sudah dilegalisir \r\n> Fotokopi KTP \r\n> Surat Keterangan Sehat dari Rumah Sakit/Dokter \r\n> Surat Bebas Narkoba dari Rumah Sakit/Dokter \r\n> Surat Berkelakuan Baik dari Kepolisian \r\n\r\nSemua Berkas Lamaran Dijadikan 1 File Berformat PDF Dan Di Upload Pada Saat Pengajuan. ', 'Laboratorium IT', 'Ruang Psikologi', 'Rektor Lantai 222', 50, 'Y'); /*!40000 ALTER TABLE `konfig_umum` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.log_ujian_akademik DROP TABLE IF EXISTS `log_ujian_akademik`; CREATE TABLE IF NOT EXISTS `log_ujian_akademik` ( `nik` char(16) NOT NULL, `jawaban_dipilih` text NOT NULL, `list_matpel` text NOT NULL, `waktu_mulai` datetime NOT NULL, `status` enum('Y','N') NOT NULL DEFAULT 'N', PRIMARY KEY (`nik`), CONSTRAINT `FK_log_ujian_akademik_pelamar` FOREIGN KEY (`nik`) REFERENCES `pelamar` (`nik`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.log_ujian_akademik: ~0 rows (approximately) DELETE FROM `log_ujian_akademik`; /*!40000 ALTER TABLE `log_ujian_akademik` DISABLE KEYS */; /*!40000 ALTER TABLE `log_ujian_akademik` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.mst_fakultas DROP TABLE IF EXISTS `mst_fakultas`; CREATE TABLE IF NOT EXISTS `mst_fakultas` ( `id_fakultas` int(11) NOT NULL AUTO_INCREMENT, `nama_fakultas` varchar(100) NOT NULL, PRIMARY KEY (`id_fakultas`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.mst_fakultas: ~10 rows (approximately) DELETE FROM `mst_fakultas`; /*!40000 ALTER TABLE `mst_fakultas` DISABLE KEYS */; INSERT INTO `mst_fakultas` (`id_fakultas`, `nama_fakultas`) VALUES (1, 'Fakultas Hukum'), (2, 'Fakultas Agama Islam'), (3, 'Fakultas Teknik'), (4, 'Fakultas Pertanian'), (5, 'Fakultas Ekonomi'), (6, 'Fakultas Ilmu Keguruan dan Ilmu Pendidikan'), (7, 'Fakultas Ilmu Sosial Dan Ilmu Politik'), (8, 'Fakultas Psikologi'), (9, 'Fakultas Ilmu Komunikasi'), (10, 'Pascasarjana'); /*!40000 ALTER TABLE `mst_fakultas` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.mst_pelajaran_akademik DROP TABLE IF EXISTS `mst_pelajaran_akademik`; CREATE TABLE IF NOT EXISTS `mst_pelajaran_akademik` ( `id_pelajaran` int(11) NOT NULL AUTO_INCREMENT, `nama_pelajaran` varchar(50) NOT NULL, PRIMARY KEY (`id_pelajaran`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.mst_pelajaran_akademik: ~5 rows (approximately) DELETE FROM `mst_pelajaran_akademik`; /*!40000 ALTER TABLE `mst_pelajaran_akademik` DISABLE KEYS */; INSERT INTO `mst_pelajaran_akademik` (`id_pelajaran`, `nama_pelajaran`) VALUES (1, 'Agama'), (2, 'Bahasa Indonesia'), (3, 'Bahasa Inggris'), (4, 'Pancasila'), (5, 'Matematika'); /*!40000 ALTER TABLE `mst_pelajaran_akademik` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.mst_subbag DROP TABLE IF EXISTS `mst_subbag`; CREATE TABLE IF NOT EXISTS `mst_subbag` ( `id_subbag` int(11) NOT NULL AUTO_INCREMENT, `nama_subbag` varchar(100) NOT NULL, PRIMARY KEY (`id_subbag`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.mst_subbag: ~5 rows (approximately) DELETE FROM `mst_subbag`; /*!40000 ALTER TABLE `mst_subbag` DISABLE KEYS */; INSERT INTO `mst_subbag` (`id_subbag`, `nama_subbag`) VALUES (1, 'Akademis & Kemahasiswaan'), (2, 'Umum & Kepegawaian'), (3, 'Ekspedisi & Agenda'), (4, 'Pelayanan Perpustakaan'), (5, 'Sekretariat Dekanat'); /*!40000 ALTER TABLE `mst_subbag` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.mst_tingkatan DROP TABLE IF EXISTS `mst_tingkatan`; CREATE TABLE IF NOT EXISTS `mst_tingkatan` ( `id_tingkatan` int(11) NOT NULL, `keterangan` varchar(50) NOT NULL, PRIMARY KEY (`id_tingkatan`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.mst_tingkatan: ~6 rows (approximately) DELETE FROM `mst_tingkatan`; /*!40000 ALTER TABLE `mst_tingkatan` DISABLE KEYS */; INSERT INTO `mst_tingkatan` (`id_tingkatan`, `keterangan`) VALUES (-1, 'Ditolak'), (0, 'Belum Verifikasi'), (1, 'Tahap 1'), (2, 'Tahap 2'), (3, 'Tahap 3'), (4, 'Diterima'); /*!40000 ALTER TABLE `mst_tingkatan` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.pelamar DROP TABLE IF EXISTS `pelamar`; CREATE TABLE IF NOT EXISTS `pelamar` ( `nik` char(16) NOT NULL, `id_periode` int(11) NOT NULL, `id_fakultas` int(11) NOT NULL, `nama` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `status` int(11) NOT NULL, `id_subbag` int(11) NOT NULL, `file_photo` varchar(50) NOT NULL, `file_lamaran` varchar(50) NOT NULL, `date_created` datetime NOT NULL, PRIMARY KEY (`nik`), KEY `FK_pelamar_konfig_periode` (`id_periode`), KEY `FK_pelamar_tingkatan` (`status`), KEY `FK_pelamar_jabatan` (`id_subbag`), KEY `FK_pelamar_mst_fakultas` (`id_fakultas`), CONSTRAINT `FK_pelamar_jabatan` FOREIGN KEY (`id_subbag`) REFERENCES `mst_subbag` (`id_subbag`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_pelamar_konfig_periode` FOREIGN KEY (`id_periode`) REFERENCES `konfig_periode` (`id_periode`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_pelamar_mst_fakultas` FOREIGN KEY (`id_fakultas`) REFERENCES `mst_fakultas` (`id_fakultas`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_pelamar_tingkatan` FOREIGN KEY (`status`) REFERENCES `mst_tingkatan` (`id_tingkatan`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.pelamar: ~1 rows (approximately) DELETE FROM `pelamar`; /*!40000 ALTER TABLE `pelamar` DISABLE KEYS */; INSERT INTO `pelamar` (`nik`, `id_periode`, `id_fakultas`, `nama`, `email`, `status`, `id_subbag`, `file_photo`, `file_lamaran`, `date_created`) VALUES ('1471101009950001', 33, 1, 'Ilham Rahmadhani', 'cybercature@gmail.com', 4, 2, '1471101009950001_PHOTO.jpg', '1471101009950001_FILE_LAMARAN.pdf', '2018-03-01 02:31:32'); /*!40000 ALTER TABLE `pelamar` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.personalia DROP TABLE IF EXISTS `personalia`; CREATE TABLE IF NOT EXISTS `personalia` ( `username` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `keterangan` varchar(50) NOT NULL, PRIMARY KEY (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.personalia: ~0 rows (approximately) DELETE FROM `personalia`; /*!40000 ALTER TABLE `personalia` DISABLE KEYS */; INSERT INTO `personalia` (`username`, `password`, `keterangan`) VALUES ('admin', 'admin', ''); /*!40000 ALTER TABLE `personalia` ENABLE KEYS */; -- Dumping structure for table ujian_pegawai.soal_ujian_akademik DROP TABLE IF EXISTS `soal_ujian_akademik`; CREATE TABLE IF NOT EXISTS `soal_ujian_akademik` ( `id_soal` int(11) NOT NULL AUTO_INCREMENT, `id_pelajaran` int(11) NOT NULL, `soal` text NOT NULL, `pilihan_A` varchar(50) NOT NULL, `pilihan_B` varchar(50) NOT NULL, `pilihan_C` varchar(50) NOT NULL, `pilihan_D` varchar(50) NOT NULL, `jawaban` char(1) NOT NULL, PRIMARY KEY (`id_soal`), KEY `FK_soal_ujian_akademik_mst_pelajaran_akademik` (`id_pelajaran`), CONSTRAINT `FK_soal_ujian_akademik_mst_pelajaran_akademik` FOREIGN KEY (`id_pelajaran`) REFERENCES `mst_pelajaran_akademik` (`id_pelajaran`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1; -- Dumping data for table ujian_pegawai.soal_ujian_akademik: ~8 rows (approximately) DELETE FROM `soal_ujian_akademik`; /*!40000 ALTER TABLE `soal_ujian_akademik` DISABLE KEYS */; INSERT INTO `soal_ujian_akademik` (`id_soal`, `id_pelajaran`, `soal`, `pilihan_A`, `pilihan_B`, `pilihan_C`, `pilihan_D`, `jawaban`) VALUES (3, 1, 'Arti fana adalah', 'Kekal', 'Tidak Kekal', 'Abadi', 'Selamanya', 'B'), (11, 3, 'I know Is ', 'hmm', 'hmmmm', 'hmmmmmm', 'hmmmmmmmmmm', 'B'), (12, 4, 'sila ke 4 pancasila', 'asfasfas', 'fasfasfas', 'asfasd', 'asdfasf', 'D'), (13, 5, '1 + 1 = ', '2', '3', '4', '5', 'A'), (15, 1, 'Allah memiliki sifat Al Karim, artinya Allah Maha', 'Pemberi keamanan', 'Akhir', 'Kokoh', 'Adil', 'B'), (16, 1, 'Allah memiki sifat Al Karim, yang tercantum dalam surah', 'Al Hadid ayat 3', 'Al A’raf ayat 180', 'An Naml ayt 40', 'Taha ayat 8', 'C'), (17, 1, 'Allah memiliki sifat Al Matin, artinya Allah Maha', 'Pemberi Keamanan', 'Mulia', 'Adil', 'Kokoh', 'D'), (18, 1, 'Allah memiliki sifat Al Matin, yang tercantum dalam surat', 'Al Hadid ayat 3', 'Al A’raf ayat 180', 'Az Zariyat ayat 58', 'Taha ayat 8', 'C'); /*!40000 ALTER TABLE `soal_ujian_akademik` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
use Agenda; create table utilizador ( id int primary key, username varchar(30), pass varchar(30) ); create table tarefa( id int primary key, titulo varchar(50), descricao varchar(500), importancia int, utilizador int, constraint tarefa_utilizador foreign key (utilizador) references utilizador(id) );
-- phpMyAdmin SQL Dump -- version 4.8.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Mar 11, 2019 at 06:08 PM -- Server version: 10.1.37-MariaDB -- PHP Version: 7.3.1 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: `gst_bcm` -- -- -------------------------------------------------------- -- -- Table structure for table `departments` -- CREATE TABLE `departments` ( `id` bigint(20) UNSIGNED NOT NULL, `department` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci, `status` tinyint(1) NOT NULL DEFAULT '0', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `departments` -- INSERT INTO `departments` (`id`, `department`, `description`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 'Electrical', 'test', 0, '2019-03-11 08:38:53', '2019-03-11 08:38:53', NULL), (2, 'mechanic', 'test', 0, '2019-03-11 08:39:02', '2019-03-11 08:39:02', NULL), (3, 'software', 'test', 0, '2019-03-11 08:39:15', '2019-03-11 08:39:15', NULL); -- -------------------------------------------------------- -- -- Table structure for table `indents` -- CREATE TABLE `indents` ( `id` int(155) NOT NULL, `indent_month` varchar(155) DEFAULT NULL, `indent_discription` varchar(155) DEFAULT NULL, `indent_department` varchar(155) NOT NULL, `indent_department_name` varchar(155) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `created_by` int(155) NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `indents` -- INSERT INTO `indents` (`id`, `indent_month`, `indent_discription`, `indent_department`, `indent_department_name`, `created_at`, `updated_at`, `created_by`, `deleted_at`) VALUES (1, 'March 2019', 'feeg', '3', 'software', '2019-03-11 08:42:05', '2019-03-11 08:42:05', 1, NULL); -- -------------------------------------------------------- -- -- Table structure for table `indent_details` -- CREATE TABLE `indent_details` ( `id` int(155) NOT NULL, `product_code` varchar(155) DEFAULT NULL, `product_name` varchar(155) NOT NULL, `speciaman` varchar(155) DEFAULT NULL, `make` varchar(155) DEFAULT NULL, `quantity` double(155,2) NOT NULL DEFAULT '0.00', `purpose` varchar(155) DEFAULT NULL, `bf_stock` varchar(155) DEFAULT NULL, `remarks` text, `indent_id` int(155) DEFAULT NULL, `department` int(155) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `indent_details` -- INSERT INTO `indent_details` (`id`, `product_code`, `product_name`, `speciaman`, `make`, `quantity`, `purpose`, `bf_stock`, `remarks`, `indent_id`, `department`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 'SOF/BCM/3', '3', 'fdsd', 'sdfdfg', 10.00, 'fdgbffg', 'fbfdfg', 'fbfbf', 1, 3, '2019-03-11 08:42:05', '2019-03-11 08:42:05', NULL), (2, 'SOF/BCM/1', '1', 'fdsf', 'sdf', 10.00, 'fbf', 'fbgf', 'fbghfghtfh', 1, 3, '2019-03-11 08:42:06', '2019-03-11 08:42:06', NULL); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2019_03_01_175425_create_departments_table', 2); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `products` -- CREATE TABLE `products` ( `id` int(155) NOT NULL, `product_code` varchar(155) DEFAULT NULL, `product_name` varchar(155) NOT NULL, `product_department` varchar(155) DEFAULT NULL, `product_department_Name` varchar(155) DEFAULT NULL, `product_specification` text, `product_type` varchar(155) DEFAULT NULL, `product_unit` varchar(155) DEFAULT NULL, `product_color` varchar(55) DEFAULT NULL, `product_hsn` varchar(155) DEFAULT NULL, `place` varchar(155) DEFAULT NULL, `product_igst` double(155,2) NOT NULL DEFAULT '0.00', `product_cgst` double(155,2) NOT NULL DEFAULT '0.00', `product_sgst` double(155,2) NOT NULL DEFAULT '0.00', `product_gst` double(155,2) NOT NULL DEFAULT '0.00', `stock_in` double(155,2) NOT NULL DEFAULT '0.00', `stock_out` double(155,2) NOT NULL DEFAULT '0.00', `available_stock` double(155,2) NOT NULL DEFAULT '0.00', `opening_stock` double(155,2) NOT NULL DEFAULT '0.00', `closing_stok` double(155,2) NOT NULL DEFAULT '0.00', `status` tinyint(1) DEFAULT '0', `created_by` int(155) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `products` -- INSERT INTO `products` (`id`, `product_code`, `product_name`, `product_department`, `product_department_Name`, `product_specification`, `product_type`, `product_unit`, `product_color`, `product_hsn`, `place`, `product_igst`, `product_cgst`, `product_sgst`, `product_gst`, `stock_in`, `stock_out`, `available_stock`, `opening_stock`, `closing_stok`, `status`, `created_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 'SOF/BCM/1', 'BCM', '3', 'software', 'test', 'eree', 'sdfdsfsdf', NULL, '34sdfsf', 'dsfsd', 3.00, 3.00, 3.00, 9.00, 70.00, 0.00, 70.00, 61.50, 100.00, 0, NULL, '2019-03-11 08:39:56', '2019-03-11 09:05:27', NULL), (2, 'MEC/BIK/2', 'bike', '2', 'mechanic', 'test', 'eree', 'sdfdsfsdf', NULL, '34sdfsf', 'dsfsd', 3.00, 3.00, 3.00, 9.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0, NULL, '2019-03-11 08:40:21', '2019-03-11 08:40:21', NULL), (3, 'SOF/BCM/3', 'bCM GST', '3', 'software', 'dfgd', 'df', 'dfg', NULL, 'fdg54654', 'fdgdf', 5.00, 4.00, 5.00, 14.00, 20.00, 0.00, 20.00, 16.50, 10.00, 0, NULL, '2019-03-11 08:41:04', '2019-03-11 09:05:27', NULL); -- -------------------------------------------------------- -- -- Table structure for table `purchases` -- CREATE TABLE `purchases` ( `id` int(155) NOT NULL, `pur_product_code` varchar(155) DEFAULT NULL, `pur_product_name` varchar(155) DEFAULT NULL, `pur_pro_id` int(155) DEFAULT NULL, `pur_dep_name` varchar(155) DEFAULT NULL, `pur_dep_code` varchar(155) DEFAULT NULL, `pur_pro_specif` varchar(155) DEFAULT NULL, `pur_pro_type` varchar(155) DEFAULT NULL, `pur_pro_place` varchar(155) DEFAULT NULL, `pur_indent_id` int(155) DEFAULT NULL, `pur_indent_discription` varchar(155) DEFAULT NULL, `pur_pro_opening` double(155,2) DEFAULT NULL, `pur_pro_closing` double(155,2) DEFAULT NULL, `pur_pro_price` double(155,2) DEFAULT NULL, `pur_pro_quanity` double(155,2) DEFAULT NULL, `created_by` int(155) DEFAULT NULL, `status` tinyint(1) NOT NULL DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `purchases` -- INSERT INTO `purchases` (`id`, `pur_product_code`, `pur_product_name`, `pur_pro_id`, `pur_dep_name`, `pur_dep_code`, `pur_pro_specif`, `pur_pro_type`, `pur_pro_place`, `pur_indent_id`, `pur_indent_discription`, `pur_pro_opening`, `pur_pro_closing`, `pur_pro_price`, `pur_pro_quanity`, `created_by`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 'SOF/BCM/1', 'BCM', 1, 'software', '3', 'fbghfghtfh', 'eree', 'dsfsd', 1, 'feeg', 100.00, 100.00, 100.00, 60.00, NULL, 0, '2019-03-11 08:56:05', '2019-03-11 08:56:05', NULL), (2, 'SOF/BCM/3', 'bCM GST', 3, 'software', '3', 'fbfbf', 'df', 'fdgdf', 1, 'feeg', 10.00, 0.00, 10.00, 10.00, NULL, 0, '2019-03-11 08:56:05', '2019-03-11 08:56:05', NULL), (3, 'SOF/BCM/1', 'BCM', 1, 'software', '3', 'fbghfghtfh', 'eree', 'dsfsd', 1, 'feeg', 61.50, 100.00, 23.00, 70.00, NULL, 0, '2019-03-11 09:05:27', '2019-03-11 09:05:27', NULL), (4, 'SOF/BCM/3', 'bCM GST', 3, 'software', '3', 'fbfbf', 'df', 'fdgdf', 1, 'feeg', 16.50, 10.00, 23.00, 20.00, NULL, 0, '2019-03-11 09:05:27', '2019-03-11 09:05:27', NULL); -- -------------------------------------------------------- -- -- Table structure for table `suppliers` -- CREATE TABLE `suppliers` ( `id` int(10) UNSIGNED NOT NULL, `user_id` int(11) DEFAULT NULL, `supplier_name` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL, `mob_num` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `address` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `email` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `total_supplier_balance` double(100,2) DEFAULT NULL, `total_supplier_credit` double(100,2) DEFAULT NULL, `total_supplier_debit` double(100,2) DEFAULT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `gstin` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` int(2) DEFAULT '1', `deleted_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `suppliers` -- INSERT INTO `suppliers` (`id`, `user_id`, `supplier_name`, `mob_num`, `address`, `email`, `total_supplier_balance`, `total_supplier_credit`, `total_supplier_debit`, `email_verified_at`, `gstin`, `status`, `deleted_at`, `created_at`, `updated_at`) VALUES (1, NULL, 'Ashutosh', '9658476170', 'asdfgd', 'ashu@sdg.frd', NULL, NULL, NULL, NULL, 'asas3535', 1, NULL, '2019-03-10 15:24:32', '2019-03-11 04:04:38'); -- -------------------------------------------------------- -- -- Table structure for table `supplier_debit_logs` -- CREATE TABLE `supplier_debit_logs` ( `id` int(100) NOT NULL, `user_id` int(100) DEFAULT NULL, `supplier_id` int(100) NOT NULL, `purchase_id` int(100) DEFAULT NULL, `debit_amount` float(100,2) DEFAULT NULL, `total_amount` float(100,2) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'Ashutosh Kumar Choubey', 'admin@admin.com', NULL, '$2y$10$j5Qw5sbpuL2CZy139U5Nq.4OzITqZmeYDYQB9sIzaNCdgI2m2dn7m', NULL, '2019-02-25 19:26:43', '2019-02-25 19:26:43'), (10, 'kkkkkkkkkkkkkkhhh', 'admin6@admin.com', NULL, '$2y$10$Onct8CoRyoh6Dgv2huCh.uorL3oySoULwAwCBstaheorq1r2hfdLa', NULL, '2019-02-26 06:52:43', '2019-02-26 06:52:43'), (11, 'Ashutosh Kumar Choubey', 'admin7@admin.com', NULL, '$2y$10$lEuZ9.O3Y3hTkx1zdn6KUeFLYsmsz4cmKXEdvh5BdDmGwljNaTO6a', NULL, '2019-02-26 07:43:15', '2019-02-26 07:43:15'), (12, 'Ashdfg', 'admin11@admin.com', NULL, '$2y$10$GX9b7wGPcoYuMFbe94b4rOJzgkpXegGBfELLhHBlGZubgRKPhoTmm', NULL, '2019-02-26 08:41:53', '2019-02-26 08:41:53'), (13, 'Ashutosh Kumar Choubey', 'admin12@admin.com', NULL, '$2y$10$DNjx0jTH8eK8r8krEzwguels4cQsuj4J/2bHsG9Dwv70G1zxqo4Hi', NULL, '2019-03-01 02:35:17', '2019-03-01 02:35:17'), (14, 'kkkkkkkkkkkkkkhhh', 'admin15@admin.com', NULL, '$2y$10$Lwe/27AMUmm5iGceTzJu/u620zQQGtvA51IuV6b4fMzESnPulG7cy', NULL, '2019-03-01 04:04:11', '2019-03-01 04:04:11'), (15, 'kkkkkkkkkkkkkkhhh', 'admin16@admin.com', NULL, '$2y$10$9X5oi6O02eV72en/6ko6muXQgRfOv6Me/A.XCG75WLVfluvDwQGKy', NULL, '2019-03-01 06:05:01', '2019-03-01 06:05:01'), (16, 'Ashutosh Kumar Choubey', 'admin18@admin.com', NULL, '$2y$10$97kII0qvFMb7aI3nbGhujOH3YyI/0xd5BvVvlGZwWT8wCh8mT8yqm', NULL, '2019-03-01 11:55:25', '2019-03-01 11:55:25'), (17, 'dfdhf', 'admin20@admin.com', NULL, '$2y$10$lKxL/HCIZIzPsfGKY5fYWenIZY6/BgFBCWo3N4jIsp4K3r.2x9YDa', NULL, '2019-03-07 01:53:11', '2019-03-07 01:53:11'), (18, 'Ashutosh Kumar Choubey', 'admin21@admin.com', NULL, '$2y$10$N0fxesFnwAWRJM/W3WDPDOembBp/B2K6VDXFukafgcaqHBb7TBYaO', NULL, '2019-03-07 01:54:34', '2019-03-07 01:54:34'); -- -- Indexes for dumped tables -- -- -- Indexes for table `departments` -- ALTER TABLE `departments` ADD PRIMARY KEY (`id`); -- -- Indexes for table `indents` -- ALTER TABLE `indents` ADD PRIMARY KEY (`id`); -- -- Indexes for table `indent_details` -- ALTER TABLE `indent_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `products` -- ALTER TABLE `products` ADD PRIMARY KEY (`id`); -- -- Indexes for table `purchases` -- ALTER TABLE `purchases` ADD KEY `id` (`id`); -- -- Indexes for table `suppliers` -- ALTER TABLE `suppliers` ADD PRIMARY KEY (`id`); -- -- Indexes for table `supplier_debit_logs` -- ALTER TABLE `supplier_debit_logs` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `departments` -- ALTER TABLE `departments` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `indents` -- ALTER TABLE `indents` MODIFY `id` int(155) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `indent_details` -- ALTER TABLE `indent_details` MODIFY `id` int(155) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `products` -- ALTER TABLE `products` MODIFY `id` int(155) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `purchases` -- ALTER TABLE `purchases` MODIFY `id` int(155) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `suppliers` -- ALTER TABLE `suppliers` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `supplier_debit_logs` -- ALTER TABLE `supplier_debit_logs` MODIFY `id` int(100) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE TABLE usuario ( email VARCHAR PRIMARY KEY, nome VARCHAR, foto TEXT, nivel INTEGER ); CREATE TABLE modo ( id INTEGER PRIMARY KEY, nome VARCHAR, timer INTEGER, multiplicador FLOAT ); CREATE TABLE categoria ( id INTEGER PRIMARY KEY, titulo VARCHAR, icone VARCHAR ); CREATE TABLE partida ( inicio TIMESTAMP, fim TIMESTAMP, pontos INTEGER, id INTEGER PRIMARY KEY, fk_modo_id INTEGER, FOREIGN KEY (fk_modo_id) REFERENCES modo(id) ); CREATE TABLE pergunta ( id INTEGER PRIMARY KEY texto TEXT, imagem TEXT, fk_categoria_id INTEGER, FOREIGN KEY (fk_categoria_id) REFERENCES categoria(id) ); CREATE TABLE respostas ( id INTEGER PRIMARY KEY, texto TEXT, imagem TEXT, correta BOOLEAN ); CREATE TABLE categoria_partida ( fk_categoria_id INTEGER, fk_partida_id INTEGER, FOREIGN KEY (fk_categoria_id) REFERENCES categoria(id), FOREIGN KEY (fk_partida_id) REFERENCES partida(id) ); CREATE TABLE desafio ( inicio TIMESTAMP, fk_partida_id INTEGER, FOREIGN KEY (fk_partida_id) REFERENCES partida(id) ); CREATE TABLE ranking ( id INTEGER PRIMARY KEY, titulo VARCHAR ); CREATE TABLE follow ( email_seguidor VARCHAR, email_seguido VARCHAR, FOREIGN KEY (email_seguidor) REFERENCES usuario(email), FOREIGN KEY (email_seguido) REFERENCES usuario(email) ); CREATE TABLE participacao ( fk_usuario_email VARCHAR, fk_partida_id INTEGER, FOREIGN KEY (fk_usuario_email) REFERENCES usuario(email), FOREIGN KEY (fk_partida_id) REFERENCES partida(id) ); CREATE TABLE usuario_ranking ( fk_ranking_id INTEGER, fk_usuario_email VARCHAR, FOREIGN KEY (fk_ranking_id) REFERENCES ranking(id), FOREIGN KEY (fk_usuario_email) REFERENCES usuario(email) );
SELECT TOP 1 AVG(Salary) AS MinAverageSalary FROM Employees GROUP BY DepartmentID ORDER BY AVG(Salary) ASC
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jul 29, 2021 at 08:01 PM -- Server version: 10.4.17-MariaDB -- PHP Version: 7.4.13 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: `rabbil_web_project` -- -- -------------------------------------------------------- -- -- Table structure for table `admins` -- CREATE TABLE `admins` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `admins` -- INSERT INTO `admins` (`id`, `name`, `username`, `email`, `password`, `created_at`, `updated_at`) VALUES (1, 'admin', 'admin', 'admin@gmail.com', '1234', NULL, NULL), (2, '1', '1', '1', '1', NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `contacts` -- CREATE TABLE `contacts` ( `id` bigint(20) UNSIGNED NOT NULL, `contact_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `contact_phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `contact_email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `contact_msg` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `contacts` -- INSERT INTO `contacts` (`id`, `contact_name`, `contact_phone`, `contact_email`, `contact_msg`, `created_at`, `updated_at`) VALUES (1, 'Abu Bokkor Farhan', '01868362878', 'farhanbokkor@gmail.com', 'qqqqqqqqqqqqqqqqqq', '2021-07-24 06:08:37', NULL), (4, 'Abu Bokkor Farhan', '01868362878', 'farhanbokkor@gmail.com', 'aa', '2021-07-24 07:04:09', NULL), (5, 'Abu Bokkor Farhan', '01868362878', 'farhanbokkor@gmail.com', 'tt', '2021-07-24 07:04:26', NULL), (15, 'Abu Bokkor Farhan', '01868362878', 'farhanbokkor@gmail.com', 'contacty', '2021-07-25 12:14:16', NULL), (16, 'Abu Bokkor Farhan', '01868362878', 'farhanbokkor@gmail.com', 'dd', '2021-07-26 09:07:17', NULL); -- -------------------------------------------------------- -- -- Table structure for table `courses` -- CREATE TABLE `courses` ( `id` bigint(20) UNSIGNED NOT NULL, `course_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `course_sort_des` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `course_long_des` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `course_fee` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `course_total_enroll` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `course_total_class` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `course_link` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `course_img` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `courses` -- INSERT INTO `courses` (`id`, `course_name`, `course_sort_des`, `course_long_des`, `course_fee`, `course_total_enroll`, `course_total_class`, `course_link`, `course_img`, `created_at`, `updated_at`) VALUES (3, 'লারাভেল এবং প্রোজেক্ট', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', 'long', 'কোর্স ফ্রি : ১০০০/-', 'মোট শিক্ষার্থী : ২০০ জন', 'মোট ক্লাস : ১৫০ টি', '#', 'admin/images/android.jpg', NULL, '2021-07-20 02:38:26'), (4, 'লারাভেল এবং প্রোজেক্ট 4', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/- ', 'মোট শিক্ষার্থী : ২০০ জন ', 'মোট ক্লাস : ১৫০ টি ', '#', 'admin/images/react.jpg', NULL, NULL), (5, 'লারাভেল এবং প্রোজেক্ট 5', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/- ', 'মোট শিক্ষার্থী : ২০০ জন ', 'মোট ক্লাস : ১৫০ টি ', '#', 'admin/images/laravel.jpg', NULL, NULL), (6, 'লারাভেল এবং প্রোজেক্ট 6', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/- ', 'মোট শিক্ষার্থী : ২০০ জন ', 'মোট ক্লাস : ১৫০ টি ', '#', 'admin/images/android.jpg', NULL, NULL), (7, 'লারাভেল এবং প্রোজেক্ট 7', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/- ', 'মোট শিক্ষার্থী : ২০০ জন ', 'মোট ক্লাস : ১৫০ টি ', '#', 'admin/images/laravel.jpg', NULL, NULL), (8, 'লারাভেল এবং প্রোজেক্ট 8', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/- ', 'মোট শিক্ষার্থী : ২০০ জন ', 'মোট ক্লাস : ১৫০ টি ', '#', 'admin/images/react.jpg', NULL, NULL), (9, 'লারাভেল এবং প্রোজেক্ট 9', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/- ', 'মোট শিক্ষার্থী : ২০০ জন ', 'মোট ক্লাস : ১৫০ টি ', '#', 'admin/images/laravel.jpg', NULL, NULL), (10, 'লারাভেল এবং প্রোজেক্ট 10', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/', 'মোট শিক্ষার্থী : ২০০ জন', 'মোট ক্লাস : ১৫০ টি', '#', 'admin/images/react.jpg', NULL, '2021-07-20 01:30:31'), (23, 'লারাভেল এবং প্রোজেক্ট 11', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/-', 'মোট ক্লাস : ১৫০ টি', 'মোট শিক্ষার্থী : ২০০ জন', '##', 'website/images/custom.svg', '2021-07-20 02:29:58', '2021-07-25 11:08:09'), (24, 'লারাভেল এবং প্রোজেক্ট 12', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/-', 'মোট ক্লাস : ১৫০ টি', 'মোট শিক্ষার্থী : ২০০ জন', '##', 'website/images/graphic.svg', '2021-07-20 02:30:20', '2021-07-25 11:08:01'), (25, 'লারাভেল এবং প্রোজেক্ট 13', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/-', 'মোট ক্লাস : ১৫০ টি', 'মোট শিক্ষার্থী : ২০০ জন', '##', 'website/images/knowledge.svg', '2021-07-20 02:30:26', '2021-07-25 11:06:16'), (26, 'লারাভেল এবং প্রোজেক্ট 14', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, 'কোর্স ফ্রি : ১০০০/-', 'মোট ক্লাস : ১৫০ টি', 'মোট শিক্ষার্থী : ২০০ জন', '##', 'website/images/code.svg', '2021-07-20 02:30:30', '2021-07-25 11:06:03'); -- -------------------------------------------------------- -- -- Table structure for table `failed_jobs` -- CREATE TABLE `failed_jobs` ( `id` bigint(20) UNSIGNED NOT NULL, `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `failed_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `galleries` -- CREATE TABLE `galleries` ( `id` bigint(20) UNSIGNED NOT NULL, `imgLocation` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `galleries` -- INSERT INTO `galleries` (`id`, `imgLocation`, `created_at`, `updated_at`) VALUES (52, 'http://127.0.0.1:8000/storage/dFeNxgo9qv0nOvCEF951hm9yCSuruVeHKF8pDZik.jpg', '2021-07-28 18:07:05', NULL), (54, 'http://127.0.0.1:8000/storage/mmHSxXwKGcyLpo9u5GPh3kfuE7qAZgpZoa9hAACq.png', '2021-07-28 18:07:18', NULL), (55, 'http://127.0.0.1:8000/storage/AZbQOhj4nQObaSSSVkBY6XWdEfPTMqahCfrF7g1m.jpg', '2021-07-28 18:07:29', NULL), (57, 'http://127.0.0.1:8000/storage/EicgvUqCbTAT6hEcoK34FCvRGB3nYGvesvaq9uDS.jpg', '2021-07-29 17:06:28', NULL), (58, 'http://127.0.0.1:8000/storage/nmssRnTSigkbBRngcN3JnQB1hQ4ZLn9FkpAJZeEr.webp', '2021-07-29 17:06:38', NULL), (61, 'http://127.0.0.1:8000/storage/IYjRVGkLxaioNvVyElkdfqI0548c3GstE6MnI8g3.jpg', '2021-07-29 17:06:58', NULL), (65, 'http://127.0.0.1:8000/storage/eP0gGG2yUi8rz8Cv699RvNrExufm23hkBfiyrv5r.jpg', '2021-07-29 17:17:22', NULL), (66, 'http://127.0.0.1:8000/storage/s2BURRv1e2qnwPaAOyb1PFH2UdRvEF1Ta2oLDrz6.jpg', '2021-07-29 17:17:28', NULL), (67, 'http://127.0.0.1:8000/storage/zWQeYrJGsR00VNpUmiXEgmFmd2YxB8O65OI4DtPh.jpg', '2021-07-29 17:17:37', NULL), (69, 'http://127.0.0.1:8000/storage/U3YK12bAMmJIoB1gWydEVcUJz3CZ334fibM8MaEV.png', '2021-07-29 17:17:49', NULL), (72, 'http://127.0.0.1:8000/storage/PT5C35IZ7fX7PP8LlPvaeO74H9Ma6JCiSO3yqsQU.jpg', '2021-07-29 17:18:07', NULL), (74, 'http://127.0.0.1:8000/storage/QNSUlJevCi3e4VEAV6BB6MrsmCvD2IurrzRaK4UK.png', '2021-07-29 17:19:10', NULL), (75, 'http://127.0.0.1:8000/storage/FbbeVigoPjVkXImZKT20NmizmlzvSpUQuea76K4O.png', '2021-07-29 17:19:17', NULL), (76, 'http://127.0.0.1:8000/storage/q1uhwOdPuzjJmrNuHkMfq0ba60mV8yuenfPbhBEh.jpg', '2021-07-29 17:19:24', NULL); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (4, '2021_07_15_113133_vistor_table', 1), (7, '2014_10_12_100000_create_password_resets_table', 3), (8, '2019_08_19_000000_create_failed_jobs_table', 3), (9, '2021_07_15_202913_services', 3), (11, '2021_07_18_061028_create_courses_table', 4), (13, '2021_07_20_092057_create_projects_table', 5), (14, '2021_07_24_103717_create_contacts_table', 6), (15, '2021_07_24_202430_create_reviews_table', 7), (17, '2014_10_12_000000_create_users_table', 9), (18, '2021_07_25_195034_create_admins_table', 10), (19, '2021_07_26_111657_create_galleries_table', 11); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `projects` -- CREATE TABLE `projects` ( `id` bigint(20) UNSIGNED NOT NULL, `project_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `project_sort_des` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `project_long_des` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `project_link` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `project_img` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `projects` -- INSERT INTO `projects` (`id`, `project_name`, `project_sort_des`, `project_long_des`, `project_link`, `project_img`, `created_at`, `updated_at`) VALUES (1, 'প্রজেক্ট 1', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, '#', 'images/poject.jpg', NULL, NULL), (2, 'প্রজেক্ট 2', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, '#', 'images/poject.jpg', NULL, NULL), (3, 'প্রজেক্ট 3', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, '#', 'images/poject.jpg', NULL, NULL), (4, 'প্রজেক্ট 4', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, '#', 'images/poject.jpg', NULL, NULL), (5, 'প্রজেক্ট 5', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, '#', 'images/poject.jpg', NULL, NULL), (6, 'প্রজেক্ট 6', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, '#', 'images/poject.jpg', NULL, NULL), (8, 'প্রজেক্ট 7', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, '#', 'images/poject.jpg', NULL, NULL), (9, 'প্রজেক্ট 8', 'আইটি কোর্স, প্রজেক্ট ভিত্তিক সোর্স কোড সহ আরো যে সকল সার্ভিস আমরা প্রদান করি', NULL, '#', 'images/poject.jpg', NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `reviews` -- CREATE TABLE `reviews` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `des` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `img` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `reviews` -- INSERT INTO `reviews` (`id`, `name`, `des`, `img`, `created_at`, `updated_at`) VALUES (1, 'বিল গেটস', 'মাইক্রোসফটের প্রতিষ্ঠাতা বিল গেটসের জীবন কেটেছে নানা ঘটনার মধ্য দিয়ে। হার্ভার্ড বিশ্ববিদ্যালয়ে লেখাপড়া শেষ না করেই মাইক্রোসফট প্রতিষ্ঠা করা', 'images/bill.jpg', NULL, NULL), (2, 'Abu Bokkor', 'মাইক্রোসফটের প্রতিষ্ঠাতা বিল গেটসের জীবন কেটেছে নানা ঘটনার মধ্য দিয়ে। হার্ভার্ড বিশ্ববিদ্যালয়ে লেখাপড়া শেষ না করেই মাইক্রোসফট প্রতিষ্ঠা করা', 'images/bill.jpg', NULL, NULL), (3, 'AB Farhan', 'মাইক্রোসফটের প্রতিষ্ঠাতা বিল গেটসের জীবন কেটেছে নানা ঘটনার মধ্য দিয়ে। হার্ভার্ড বিশ্ববিদ্যালয়ে লেখাপড়া শেষ না করেই মাইক্রোসফট প্রতিষ্ঠা করা', 'images/bill.jpg', NULL, '2021-07-24 17:17:58'); -- -------------------------------------------------------- -- -- Table structure for table `services` -- CREATE TABLE `services` ( `id` bigint(20) UNSIGNED NOT NULL, `service_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `service_sort_des` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `service_long_des` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `service_img` text COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `services` -- INSERT INTO `services` (`id`, `service_name`, `service_sort_des`, `service_long_des`, `service_img`, `created_at`, `updated_at`) VALUES (1, 'আইটি কোর্স 1', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/knowledge.svg', NULL, NULL), (2, 'সোর্স কোড 2', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/code.svg', NULL, '2021-07-19 08:48:59'), (3, 'ইন্টারফেস 3', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/graphic.svg', NULL, '2021-07-17 07:00:49'), (52, 'ইন্টারফেস 4', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/custom.svg', NULL, '2021-07-17 07:00:49'), (58, 'ইন্টারফেস 50', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/code.svg', '2021-07-17 12:20:06', '2021-07-20 02:18:34'), (61, 'ইন্টারফেস 6', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/custom.svg', '2021-07-20 02:25:47', NULL), (62, 'ইন্টারফেস 7', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/code.svg', '2021-07-20 02:26:03', NULL), (63, 'ইন্টারফেস 8', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/knowledge.svg', '2021-07-20 02:26:48', NULL), (64, 'ইন্টারফেস 9', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/graphic.svg', '2021-07-20 02:27:09', NULL), (66, 'ইন্টারফেস 11', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/knowledge.svg', '2021-07-20 02:27:37', NULL), (67, 'ইন্টারফেস 11', 'মোবাইল এবং ওয়েব এপ্লিকেশন ডেভেলপমেন্ট', NULL, 'images/graphic.svg', '2021-07-20 02:27:45', NULL); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `visitor` -- CREATE TABLE `visitor` ( `id` int(11) NOT NULL, `ip_address` varchar(255) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `visitor` -- INSERT INTO `visitor` (`id`, `ip_address`, `created_at`, `updated_at`) VALUES (1, '127.0.0.1', '2021-07-20 05:20:27', NULL), (2, '127.0.0.1', '2021-07-20 06:05:50', NULL), (3, '127.0.0.1', '2021-07-20 06:06:06', NULL), (4, '127.0.0.1', '2021-07-20 06:06:25', NULL), (5, '127.0.0.1', '2021-07-20 06:07:18', NULL), (6, '127.0.0.1', '2021-07-20 06:07:19', NULL), (7, '127.0.0.1', '2021-07-20 06:07:25', NULL), (8, '127.0.0.1', '2021-07-20 06:07:25', NULL), (9, '127.0.0.1', '2021-07-20 06:07:44', NULL), (10, '127.0.0.1', '2021-07-20 06:12:01', NULL), (11, '127.0.0.1', '2021-07-20 06:12:12', NULL), (12, '127.0.0.1', '2021-07-20 06:12:20', NULL), (13, '127.0.0.1', '2021-07-20 15:00:47', NULL), (14, '127.0.0.1', '2021-07-20 15:02:38', NULL), (15, '127.0.0.1', '2021-07-23 13:21:38', NULL), (16, '127.0.0.1', '2021-07-24 04:12:03', NULL), (17, '127.0.0.1', '2021-07-24 04:40:23', NULL), (18, '127.0.0.1', '2021-07-24 04:46:44', NULL), (19, '127.0.0.1', '2021-07-24 04:50:36', NULL), (20, '127.0.0.1', '2021-07-24 04:54:58', NULL), (21, '127.0.0.1', '2021-07-24 04:55:08', NULL), (22, '127.0.0.1', '2021-07-24 04:55:56', NULL), (23, '127.0.0.1', '2021-07-24 04:56:04', NULL), (24, '127.0.0.1', '2021-07-24 04:57:52', NULL), (25, '127.0.0.1', '2021-07-24 04:58:19', NULL), (26, '127.0.0.1', '2021-07-24 04:58:31', NULL), (27, '127.0.0.1', '2021-07-24 05:00:59', NULL), (28, '127.0.0.1', '2021-07-24 05:02:23', NULL), (29, '127.0.0.1', '2021-07-24 05:03:02', NULL), (30, '127.0.0.1', '2021-07-24 05:04:22', NULL), (31, '127.0.0.1', '2021-07-24 05:04:38', NULL), (32, '127.0.0.1', '2021-07-24 05:05:26', NULL), (33, '127.0.0.1', '2021-07-24 05:06:35', NULL), (34, '127.0.0.1', '2021-07-24 05:07:48', NULL), (35, '127.0.0.1', '2021-07-24 05:08:27', NULL), (36, '127.0.0.1', '2021-07-24 05:08:56', NULL), (37, '127.0.0.1', '2021-07-24 05:09:30', NULL), (38, '127.0.0.1', '2021-07-24 05:09:47', NULL), (39, '127.0.0.1', '2021-07-24 05:10:09', NULL), (40, '127.0.0.1', '2021-07-24 05:11:05', NULL), (41, '127.0.0.1', '2021-07-24 05:12:13', NULL), (42, '127.0.0.1', '2021-07-24 05:12:32', NULL), (43, '127.0.0.1', '2021-07-24 05:13:03', NULL), (44, '127.0.0.1', '2021-07-24 05:18:17', NULL), (45, '127.0.0.1', '2021-07-24 06:08:23', NULL), (46, '127.0.0.1', '2021-07-24 06:25:43', NULL), (47, '127.0.0.1', '2021-07-24 06:25:54', NULL), (48, '127.0.0.1', '2021-07-24 06:26:01', NULL), (49, '127.0.0.1', '2021-07-24 06:26:17', NULL), (50, '127.0.0.1', '2021-07-24 06:27:26', NULL), (51, '127.0.0.1', '2021-07-24 06:27:37', NULL), (52, '127.0.0.1', '2021-07-24 06:27:56', NULL), (53, '127.0.0.1', '2021-07-24 06:28:29', NULL), (54, '127.0.0.1', '2021-07-24 06:29:51', NULL), (55, '127.0.0.1', '2021-07-24 06:30:04', NULL), (56, '127.0.0.1', '2021-07-24 06:30:21', NULL), (57, '127.0.0.1', '2021-07-24 06:36:45', NULL), (58, '127.0.0.1', '2021-07-24 06:38:00', NULL), (59, '127.0.0.1', '2021-07-24 06:38:22', NULL), (60, '127.0.0.1', '2021-07-24 06:38:46', NULL), (61, '127.0.0.1', '2021-07-24 06:39:21', NULL), (62, '127.0.0.1', '2021-07-24 06:39:41', NULL), (63, '127.0.0.1', '2021-07-24 06:41:07', NULL), (64, '127.0.0.1', '2021-07-24 06:41:31', NULL), (65, '127.0.0.1', '2021-07-24 06:43:36', NULL), (66, '127.0.0.1', '2021-07-24 06:43:48', NULL), (67, '127.0.0.1', '2021-07-24 06:44:01', NULL), (68, '127.0.0.1', '2021-07-24 06:44:37', NULL), (69, '127.0.0.1', '2021-07-24 06:44:53', NULL), (70, '127.0.0.1', '2021-07-24 06:45:04', NULL), (71, '127.0.0.1', '2021-07-24 06:45:25', NULL), (72, '127.0.0.1', '2021-07-24 06:45:52', NULL), (73, '127.0.0.1', '2021-07-24 06:46:00', NULL), (74, '127.0.0.1', '2021-07-24 06:46:35', NULL), (75, '127.0.0.1', '2021-07-24 06:47:01', NULL), (76, '127.0.0.1', '2021-07-24 06:47:17', NULL), (77, '127.0.0.1', '2021-07-24 06:47:45', NULL), (78, '127.0.0.1', '2021-07-24 06:48:26', NULL), (79, '127.0.0.1', '2021-07-24 06:48:43', NULL), (80, '127.0.0.1', '2021-07-24 06:49:05', NULL), (81, '127.0.0.1', '2021-07-24 06:49:16', NULL), (82, '127.0.0.1', '2021-07-24 06:49:24', NULL), (83, '127.0.0.1', '2021-07-24 06:49:34', NULL), (84, '127.0.0.1', '2021-07-24 06:50:24', NULL), (85, '127.0.0.1', '2021-07-24 06:50:48', NULL), (86, '127.0.0.1', '2021-07-24 06:53:05', NULL), (87, '127.0.0.1', '2021-07-24 06:54:40', NULL), (88, '127.0.0.1', '2021-07-24 06:55:09', NULL), (89, '127.0.0.1', '2021-07-24 06:55:49', NULL), (90, '127.0.0.1', '2021-07-24 06:56:10', NULL), (91, '127.0.0.1', '2021-07-24 07:02:30', NULL), (92, '127.0.0.1', '2021-07-24 07:03:24', NULL), (93, '127.0.0.1', '2021-07-24 07:04:03', NULL), (94, '127.0.0.1', '2021-07-24 07:04:20', NULL), (95, '127.0.0.1', '2021-07-24 07:05:24', NULL), (96, '127.0.0.1', '2021-07-24 07:05:46', NULL), (97, '127.0.0.1', '2021-07-24 07:05:56', NULL), (98, '127.0.0.1', '2021-07-24 07:06:53', NULL), (99, '127.0.0.1', '2021-07-24 07:07:26', NULL), (100, '127.0.0.1', '2021-07-24 07:08:01', NULL), (101, '127.0.0.1', '2021-07-24 07:08:23', NULL), (102, '127.0.0.1', '2021-07-24 07:09:34', NULL), (103, '127.0.0.1', '2021-07-24 07:09:42', NULL), (104, '127.0.0.1', '2021-07-24 07:10:20', NULL), (105, '127.0.0.1', '2021-07-24 12:46:21', NULL), (106, '127.0.0.1', '2021-07-24 14:52:27', NULL), (107, '127.0.0.1', '2021-07-24 15:02:21', NULL), (108, '127.0.0.1', '2021-07-24 15:02:46', NULL), (109, '127.0.0.1', '2021-07-24 17:19:22', NULL), (110, '127.0.0.1', '2021-07-25 09:16:39', NULL), (111, '127.0.0.1', '2021-07-25 09:43:59', NULL), (112, '127.0.0.1', '2021-07-25 09:45:26', NULL), (113, '127.0.0.1', '2021-07-25 09:45:33', NULL), (114, '127.0.0.1', '2021-07-25 09:50:06', NULL), (115, '127.0.0.1', '2021-07-25 09:50:09', NULL), (116, '127.0.0.1', '2021-07-25 09:55:30', NULL), (117, '127.0.0.1', '2021-07-25 10:12:40', NULL), (118, '127.0.0.1', '2021-07-25 10:15:43', NULL), (119, '127.0.0.1', '2021-07-25 12:12:39', NULL), (120, '127.0.0.1', '2021-07-25 12:13:42', NULL), (121, '127.0.0.1', '2021-07-25 12:29:20', NULL), (122, '127.0.0.1', '2021-07-26 06:39:37', NULL), (123, '127.0.0.1', '2021-07-26 08:57:54', NULL), (124, '127.0.0.1', '2021-07-26 09:06:51', NULL), (125, '127.0.0.1', '2021-07-26 09:07:03', NULL), (126, '127.0.0.1', '2021-07-27 08:35:57', NULL), (127, '127.0.0.1', '2021-07-28 14:36:01', NULL), (128, '127.0.0.1', '2021-07-29 08:41:47', NULL), (129, '127.0.0.1', '2021-07-29 16:03:56', NULL), (130, '127.0.0.1', '2021-07-29 16:03:59', NULL); -- -- Indexes for dumped tables -- -- -- Indexes for table `admins` -- ALTER TABLE `admins` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `admins_email_unique` (`email`); -- -- Indexes for table `contacts` -- ALTER TABLE `contacts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `courses` -- ALTER TABLE `courses` ADD PRIMARY KEY (`id`); -- -- Indexes for table `failed_jobs` -- ALTER TABLE `failed_jobs` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`); -- -- Indexes for table `galleries` -- ALTER TABLE `galleries` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `projects` -- ALTER TABLE `projects` ADD PRIMARY KEY (`id`); -- -- Indexes for table `reviews` -- ALTER TABLE `reviews` ADD PRIMARY KEY (`id`); -- -- Indexes for table `services` -- ALTER TABLE `services` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- Indexes for table `visitor` -- ALTER TABLE `visitor` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admins` -- ALTER TABLE `admins` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `contacts` -- ALTER TABLE `contacts` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT for table `courses` -- ALTER TABLE `courses` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28; -- -- AUTO_INCREMENT for table `failed_jobs` -- ALTER TABLE `failed_jobs` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `galleries` -- ALTER TABLE `galleries` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=79; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20; -- -- AUTO_INCREMENT for table `projects` -- ALTER TABLE `projects` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `reviews` -- ALTER TABLE `reviews` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `services` -- ALTER TABLE `services` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=68; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `visitor` -- ALTER TABLE `visitor` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=131; 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 */;
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: 127.0.0.1 Database: empresa -- ------------------------------------------------------ -- Server version 5.7.19-log /*!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 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `clientes` -- DROP TABLE IF EXISTS `clientes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientes` ( `Clientes_id` int(11) NOT NULL, `Clientes_descripcion` varchar(45) NOT NULL, PRIMARY KEY (`Clientes_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clientes` -- LOCK TABLES `clientes` WRITE; /*!40000 ALTER TABLE `clientes` DISABLE KEYS */; INSERT INTO `clientes` VALUES (101,'Camilo Zanabria'),(112,'Jhon Rodriguez'),(123,'Juan Lopez'),(456,'Andres Perez'),(789,'Sergio Alvarez'),(5678,'Mao'); /*!40000 ALTER TABLE `clientes` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `integrantes` -- DROP TABLE IF EXISTS `integrantes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `integrantes` ( `Integrantes_id` int(11) NOT NULL, `Integrantes_descripcion` varchar(45) NOT NULL, PRIMARY KEY (`Integrantes_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `integrantes` -- LOCK TABLES `integrantes` WRITE; /*!40000 ALTER TABLE `integrantes` DISABLE KEYS */; INSERT INTO `integrantes` VALUES (19,'gordo'),(123,'Esteban Tellez'),(321,'Felipe Padilla'),(456,'Michael Rodriguez'),(987,'Santiago Bohorquez'),(65718,'test'); /*!40000 ALTER TABLE `integrantes` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `testt` -- DROP TABLE IF EXISTS `testt`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `testt` ( `Testt_id` int(11) NOT NULL, `Testt_descripcion` varchar(45) NOT NULL, PRIMARY KEY (`Testt_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `testt` -- LOCK TABLES `testt` WRITE; /*!40000 ALTER TABLE `testt` DISABLE KEYS */; /*!40000 ALTER TABLE `testt` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2017-11-02 16:57:32
/*Most sold media type based on quantity of Tracks sold*/ select m.Name "Media Type", sum(iL.Quantity) "Quantity Sold" from MediaType m join Track t on t.MediaTypeId = m.MediaTypeId join InvoiceLine iL on iL.TrackId = t.TrackId group by t.MediaTypeId order by "Quantity Sold" desc /*Idon't like using 2 or Numeric*/
create sequence hibernate_seq increment by 1; CREATE TABLE itemmodel ( id BIGINT PRIMARY KEY NOT NULL DEFAULT nextval('hibernate_seq'::regclass), make VARCHAR(255), model VARCHAR(255), year VARCHAR(255), createdate DATE, lastupdatedate DATE, status VARCHAR(255) );
CREATE DATABASE twlight; GRANT ALL PRIVILEGES on twlight.* to twlight@'%' IDENTIFIED BY 'twlight'; GRANT ALL PRIVILEGES on test_twlight.* to twlight@'%' IDENTIFIED BY 'twlight';
create table user ( id int primary key auto_increment comment '自增id', username varchar(255) not null comment '用户昵称', password varchar(255) not null comment '密码', gender tinyint comment '性别,男-0 女-1', phone varchar(255) comment '电话号码', email varchar(255) comment '邮箱', address varchar(255) comment '住址', create_time timestamp not null default CURRENT_TIMESTAMP comment '创建时间', update_time timestamp comment '修改时间', status tinyint default 1 comment '账号当前状态 0-禁用 1-启用' ) ENGINE = InnoDB CHARSET = utf8mb4; create table role ( id int primary key auto_increment comment '权限自增id', name varchar(255) not null comment '权限名称' ) ENGINE = InnoDB CHARSET = utf8mb4; create table user_roles ( user_id int not null comment '用户id', role_id int not null comment '权限id', foreign key (user_id) references user (id), foreign key (role_id) references role (id) ) CHARSET = utf8mb4; -- 用户登录日志表 create table login_info ( id int primary key auto_increment, user_id int not null, login_time timestamp not null default CURRENT_TIMESTAMP comment '登录时间', ip varchar(255) comment '登录ip', foreign key (user_id) references user (id) ) CHARSET = utf8mb4; -- 场景表 create table scene ( id int primary key auto_increment, parent_id int comment '父id', user_id int comment '所属用户id', name varchar(255) not null comment '场景名称', description varchar(255) comment '描述', create_time timestamp not null default CURRENT_TIMESTAMP comment '创建时间', update_time timestamp comment '修改时间', foreign key (user_id) references user (id) ) CHARSET = utf8mb4; -- 插座表 create table receptacle ( id int primary key auto_increment, user_id int comment '所属用户id', scene_id int comment '场景id', name varchar(255) comment '插座名称', status tinyint comment '当前状态', last_used_time timestamp comment '上一次使用时间', create_time timestamp not null default CURRENT_TIMESTAMP comment '创建时间', update_time timestamp comment '修改时间', foreign key (user_id) references user (id), foreign key (scene_id) references scene (id) ) CHARSET = utf8mb4; -- 插孔表 create table jack ( id int primary key auto_increment, user_id int comment '所属用户id', receptacle_id int comment '插座id', type tinyint comment '插孔类型', status tinyint comment '插孔状态', foreign key (user_id) references user (id), foreign key (receptacle_id) references receptacle (id) ) CHARSET = utf8mb4; -- 设备表 create table device ( id int primary key auto_increment, user_id int comment '所属用户id', jack_id int comment '插孔id', name varchar(255) comment '设备名称', status tinyint comment '当前状态', create_time timestamp not null default CURRENT_TIMESTAMP comment '创建时间', update_time timestamp comment '修改时间', foreign key (user_id) references user (id), foreign key (jack_id) references receptacle (id) ) CHARSET = utf8mb4; -- 预警信息表 create table alert ( user_id int, email_auth varchar(255) comment '邮箱授权码', ding_token varchar(255) comment '钉钉token', foreign key (user_id) references user (id) ) CHARSET = utf8mb4;
UPDATE item SET unit_price_cost='0' WHERE trim(unit_price_cost)=''; UPDATE item SET unit_price_cost='0' WHERE unit_price_cost='NaN'; UPDATE item SET unit_price_cost='0' WHERE isnumeric(unit_price_cost)=FALSE; UPDATE stock_mgnt SET unit_price='0' WHERE trim(unit_price)=''; UPDATE stock_mgnt SET unit_price='0' WHERE unit_price='NaN'; UPDATE stock_mgnt SET unit_price='0' WHERE isnumeric(unit_price)=FALSE; UPDATE order_item SET unit_price_cost='0' WHERE trim(unit_price_cost)='' AND verify_date=Cast(CURRENT_DATE AS VARCHAR(10)); UPDATE order_item SET unit_price_cost='0' WHERE unit_price_cost='NaN' AND verify_date=Cast(CURRENT_DATE AS VARCHAR(10)); UPDATE order_item SET unit_price_cost='0' WHERE isnumeric(unit_price_cost)=FALSE AND verify_date=Cast(CURRENT_DATE AS VARCHAR(10));
INSERT INTO NAccount ( Id , NAASAccount , IsActive , SystemRole , Affiliation , ModifiedBy , ModifiedOn ) VALUES ( '00000000-0000-0000-0000-000000000000', 'node@myagency.gov', 'Y', 'Admin', 'MY_AGENCY', '00000000-0000-0000-0000-000000000000', sysdate ) ; INSERT INTO NAccount ( Id , NAASAccount , IsActive , SystemRole , Affiliation , ModifiedBy , ModifiedOn ) VALUES ( '00000000-0000-0000-0000-000000000001', 'Anonymous', 'Y', 'Anonymous', 'MY_AGENCY', '00000000-0000-0000-0000-000000000000', sysdate ) ; COMMIT ;
CREATE TABLE A (x INT); -- error 42601: syntax error: near "A" CREATE TABLE ABSOLUTE (x INT); -- error 42601: syntax error: near "ABSOLUTE" CREATE TABLE ACTION (x INT); -- error 42601: syntax error: near "ACTION" CREATE TABLE ADA (x INT); -- error 42601: syntax error: near "ADA" CREATE TABLE ADD (x INT); -- error 42601: syntax error: near "ADD" CREATE TABLE ADMIN (x INT); -- error 42601: syntax error: near "ADMIN" CREATE TABLE AFTER (x INT); -- error 42601: syntax error: near "AFTER" CREATE TABLE ALWAYS (x INT); -- error 42601: syntax error: near "ALWAYS" CREATE TABLE ASC (x INT); -- error 42601: syntax error: near "ASC" CREATE TABLE ASSERTION (x INT); -- error 42601: syntax error: near "ASSERTION" CREATE TABLE ASSIGNMENT (x INT); -- error 42601: syntax error: near "ASSIGNMENT" CREATE TABLE ATTRIBUTE (x INT); -- error 42601: syntax error: near "ATTRIBUTE" CREATE TABLE ATTRIBUTES (x INT); -- error 42601: syntax error: near "ATTRIBUTES" CREATE TABLE BEFORE (x INT); -- error 42601: syntax error: near "BEFORE" CREATE TABLE BERNOULLI (x INT); -- error 42601: syntax error: near "BERNOULLI" CREATE TABLE BREADTH (x INT); -- error 42601: syntax error: near "BREADTH" CREATE TABLE C (x INT); -- error 42601: syntax error: near "C" CREATE TABLE CASCADE (x INT); -- error 42601: syntax error: near "CASCADE" CREATE TABLE CATALOG (x INT); -- error 42601: syntax error: near "CATALOG" CREATE TABLE CATALOG_NAME (x INT); -- error 42601: syntax error: near "CATALOG_NAME" CREATE TABLE CHAIN (x INT); -- error 42601: syntax error: near "CHAIN" CREATE TABLE CHAINING (x INT); -- error 42601: syntax error: near "CHAINING" CREATE TABLE CHARACTER_SET_CATALOG (x INT); -- error 42601: syntax error: near "CHARACTER_SET_CATALOG" CREATE TABLE CHARACTER_SET_NAME (x INT); -- error 42601: syntax error: near "CHARACTER_SET_NAME" CREATE TABLE CHARACTER_SET_SCHEMA (x INT); -- error 42601: syntax error: near "CHARACTER_SET_SCHEMA" CREATE TABLE CHARACTERISTICS (x INT); -- error 42601: syntax error: near "CHARACTERISTICS" CREATE TABLE CHARACTERS (x INT); -- error 42601: syntax error: near "CHARACTERS" CREATE TABLE CLASS_ORIGIN (x INT); -- error 42601: syntax error: near "CLASS_ORIGIN" CREATE TABLE COBOL (x INT); -- error 42601: syntax error: near "COBOL" CREATE TABLE COLLATION (x INT); -- error 42601: syntax error: near "COLLATION" CREATE TABLE COLLATION_CATALOG (x INT); -- error 42601: syntax error: near "COLLATION_CATALOG" CREATE TABLE COLLATION_NAME (x INT); -- error 42601: syntax error: near "COLLATION_NAME" CREATE TABLE COLLATION_SCHEMA (x INT); -- error 42601: syntax error: near "COLLATION_SCHEMA" CREATE TABLE COLUMNS (x INT); -- error 42601: syntax error: near "COLUMNS" CREATE TABLE COLUMN_NAME (x INT); -- error 42601: syntax error: near "COLUMN_NAME" CREATE TABLE COMMAND_FUNCTION (x INT); -- error 42601: syntax error: near "COMMAND_FUNCTION" CREATE TABLE COMMAND_FUNCTION_CODE (x INT); -- error 42601: syntax error: near "COMMAND_FUNCTION_CODE" CREATE TABLE COMMITTED (x INT); -- error 42601: syntax error: near "COMMITTED" CREATE TABLE CONDITIONAL (x INT); -- error 42601: syntax error: near "CONDITIONAL" CREATE TABLE CONDITION_NUMBER (x INT); -- error 42601: syntax error: near "CONDITION_NUMBER" CREATE TABLE CONNECTION (x INT); -- error 42601: syntax error: near "CONNECTION" CREATE TABLE CONNECTION_NAME (x INT); -- error 42601: syntax error: near "CONNECTION_NAME" CREATE TABLE CONSTRAINT_CATALOG (x INT); -- error 42601: syntax error: near "CONSTRAINT_CATALOG" CREATE TABLE CONSTRAINT_NAME (x INT); -- error 42601: syntax error: near "CONSTRAINT_NAME" CREATE TABLE CONSTRAINT_SCHEMA (x INT); -- error 42601: syntax error: near "CONSTRAINT_SCHEMA" CREATE TABLE CONSTRAINTS (x INT); -- error 42601: syntax error: near "CONSTRAINTS" CREATE TABLE CONSTRUCTOR (x INT); -- error 42601: syntax error: near "CONSTRUCTOR" CREATE TABLE CONTINUE (x INT); -- error 42601: syntax error: near "CONTINUE" CREATE TABLE CURSOR_NAME (x INT); -- error 42601: syntax error: near "CURSOR_NAME" CREATE TABLE DATA (x INT); -- error 42601: syntax error: near "DATA" CREATE TABLE DATETIME_INTERVAL_CODE (x INT); -- error 42601: syntax error: near "DATETIME_INTERVAL_CODE" CREATE TABLE DATETIME_INTERVAL_PRECISION (x INT); -- error 42601: syntax error: near "DATETIME_INTERVAL_PRECISION" CREATE TABLE DEFAULTS (x INT); -- error 42601: syntax error: near "DEFAULTS" CREATE TABLE DEFERRABLE (x INT); -- error 42601: syntax error: near "DEFERRABLE" CREATE TABLE DEFERRED (x INT); -- error 42601: syntax error: near "DEFERRED" CREATE TABLE DEFINED (x INT); -- error 42601: syntax error: near "DEFINED" CREATE TABLE DEFINER (x INT); -- error 42601: syntax error: near "DEFINER" CREATE TABLE DEGREE (x INT); -- error 42601: syntax error: near "DEGREE" CREATE TABLE DEPTH (x INT); -- error 42601: syntax error: near "DEPTH" CREATE TABLE DERIVED (x INT); -- error 42601: syntax error: near "DERIVED" CREATE TABLE DESC (x INT); -- error 42601: syntax error: near "DESC" CREATE TABLE DESCRIBE_CATALOG (x INT); -- error 42601: syntax error: near "DESCRIBE_CATALOG" CREATE TABLE DESCRIBE_NAME (x INT); -- error 42601: syntax error: near "DESCRIBE_NAME" CREATE TABLE DESCRIBE_PROCEDURE_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "DESCRIBE_PROCEDURE_SPECIFIC_CATALOG" CREATE TABLE DESCRIBE_PROCEDURE_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "DESCRIBE_PROCEDURE_SPECIFIC_NAME" CREATE TABLE DESCRIBE_PROCEDURE_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "DESCRIBE_PROCEDURE_SPECIFIC_SCHEMA" CREATE TABLE DESCRIBE_SCHEMA (x INT); -- error 42601: syntax error: near "DESCRIBE_SCHEMA" CREATE TABLE DESCRIPTOR (x INT); -- error 42601: syntax error: near "DESCRIPTOR" CREATE TABLE DIAGNOSTICS (x INT); -- error 42601: syntax error: near "DIAGNOSTICS" CREATE TABLE DISPATCH (x INT); -- error 42601: syntax error: near "DISPATCH" CREATE TABLE DOMAIN (x INT); -- error 42601: syntax error: near "DOMAIN" CREATE TABLE DYNAMIC_FUNCTION (x INT); -- error 42601: syntax error: near "DYNAMIC_FUNCTION" CREATE TABLE DYNAMIC_FUNCTION_CODE (x INT); -- error 42601: syntax error: near "DYNAMIC_FUNCTION_CODE" CREATE TABLE ENCODING (x INT); -- error 42601: syntax error: near "ENCODING" CREATE TABLE ENFORCED (x INT); -- error 42601: syntax error: near "ENFORCED" CREATE TABLE ERROR (x INT); -- error 42601: syntax error: near "ERROR" CREATE TABLE EXCLUDE (x INT); -- error 42601: syntax error: near "EXCLUDE" CREATE TABLE EXCLUDING (x INT); -- error 42601: syntax error: near "EXCLUDING" CREATE TABLE EXPRESSION (x INT); -- error 42601: syntax error: near "EXPRESSION" CREATE TABLE FINAL (x INT); -- error 42601: syntax error: near "FINAL" CREATE TABLE FINISH (x INT); -- error 42601: syntax error: near "FINISH" CREATE TABLE FINISH_CATALOG (x INT); -- error 42601: syntax error: near "FINISH_CATALOG" CREATE TABLE FINISH_NAME (x INT); -- error 42601: syntax error: near "FINISH_NAME" CREATE TABLE FINISH_PROCEDURE_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "FINISH_PROCEDURE_SPECIFIC_CATALOG" CREATE TABLE FINISH_PROCEDURE_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "FINISH_PROCEDURE_SPECIFIC_NAME" CREATE TABLE FINISH_PROCEDURE_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "FINISH_PROCEDURE_SPECIFIC_SCHEMA" CREATE TABLE FINISH_SCHEMA (x INT); -- error 42601: syntax error: near "FINISH_SCHEMA" CREATE TABLE FIRST (x INT); -- error 42601: syntax error: near "FIRST" CREATE TABLE FLAG (x INT); -- error 42601: syntax error: near "FLAG" CREATE TABLE FOLLOWING (x INT); -- error 42601: syntax error: near "FOLLOWING" CREATE TABLE FORMAT (x INT); -- error 42601: syntax error: near "FORMAT" CREATE TABLE FORTRAN (x INT); -- error 42601: syntax error: near "FORTRAN" CREATE TABLE FOUND (x INT); -- error 42601: syntax error: near "FOUND" CREATE TABLE FULFILL (x INT); -- error 42601: syntax error: near "FULFILL" CREATE TABLE FULFILL_CATALOG (x INT); -- error 42601: syntax error: near "FULFILL_CATALOG" CREATE TABLE FULFILL_NAME (x INT); -- error 42601: syntax error: near "FULFILL_NAME" CREATE TABLE FULFILL_PROCEDURE_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "FULFILL_PROCEDURE_SPECIFIC_CATALOG" CREATE TABLE FULFILL_PROCEDURE_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "FULFILL_PROCEDURE_SPECIFIC_NAME" CREATE TABLE FULFILL_PROCEDURE_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "FULFILL_PROCEDURE_SPECIFIC_SCHEMA" CREATE TABLE FULFILL_SCHEMA (x INT); -- error 42601: syntax error: near "FULFILL_SCHEMA" CREATE TABLE G (x INT); -- error 42601: syntax error: near "G" CREATE TABLE GENERAL (x INT); -- error 42601: syntax error: near "GENERAL" CREATE TABLE GENERATED (x INT); -- error 42601: syntax error: near "GENERATED" CREATE TABLE GO (x INT); -- error 42601: syntax error: near "GO" CREATE TABLE GOTO (x INT); -- error 42601: syntax error: near "GOTO" CREATE TABLE GRANTED (x INT); -- error 42601: syntax error: near "GRANTED" CREATE TABLE HAS_PASS_THROUGH_COLUMNS (x INT); -- error 42601: syntax error: near "HAS_PASS_THROUGH_COLUMNS" CREATE TABLE HAS_PASS_THRU_COLS (x INT); -- error 42601: syntax error: near "HAS_PASS_THRU_COLS" CREATE TABLE HIERARCHY (x INT); -- error 42601: syntax error: near "HIERARCHY" CREATE TABLE IGNORE (x INT); -- error 42601: syntax error: near "IGNORE" CREATE TABLE IMMEDIATE (x INT); -- error 42601: syntax error: near "IMMEDIATE" CREATE TABLE IMMEDIATELY (x INT); -- error 42601: syntax error: near "IMMEDIATELY" CREATE TABLE IMPLEMENTATION (x INT); -- error 42601: syntax error: near "IMPLEMENTATION" CREATE TABLE INCLUDING (x INT); -- error 42601: syntax error: near "INCLUDING" CREATE TABLE INCREMENT (x INT); -- error 42601: syntax error: near "INCREMENT" CREATE TABLE INITIALLY (x INT); -- error 42601: syntax error: near "INITIALLY" CREATE TABLE INPUT (x INT); -- error 42601: syntax error: near "INPUT" CREATE TABLE INSTANCE (x INT); -- error 42601: syntax error: near "INSTANCE" CREATE TABLE INSTANTIABLE (x INT); -- error 42601: syntax error: near "INSTANTIABLE" CREATE TABLE INSTEAD (x INT); -- error 42601: syntax error: near "INSTEAD" CREATE TABLE INVOKER (x INT); -- error 42601: syntax error: near "INVOKER" CREATE TABLE ISOLATION (x INT); -- error 42601: syntax error: near "ISOLATION" CREATE TABLE IS_PRUNABLE (x INT); -- error 42601: syntax error: near "IS_PRUNABLE" CREATE TABLE JSON (x INT); -- error 42601: syntax error: near "JSON" CREATE TABLE K (x INT); -- error 42601: syntax error: near "K" CREATE TABLE KEEP (x INT); -- error 42601: syntax error: near "KEEP" CREATE TABLE KEY (x INT); -- error 42601: syntax error: near "KEY" CREATE TABLE KEYS (x INT); -- error 42601: syntax error: near "KEYS" CREATE TABLE KEY_MEMBER (x INT); -- error 42601: syntax error: near "KEY_MEMBER" CREATE TABLE KEY_TYPE (x INT); -- error 42601: syntax error: near "KEY_TYPE" CREATE TABLE LAST (x INT); -- error 42601: syntax error: near "LAST" CREATE TABLE LENGTH (x INT); -- error 42601: syntax error: near "LENGTH" CREATE TABLE LEVEL (x INT); -- error 42601: syntax error: near "LEVEL" CREATE TABLE LOCATOR (x INT); -- error 42601: syntax error: near "LOCATOR" CREATE TABLE M (x INT); -- error 42601: syntax error: near "M" CREATE TABLE MAP (x INT); -- error 42601: syntax error: near "MAP" CREATE TABLE MATCHED (x INT); -- error 42601: syntax error: near "MATCHED" CREATE TABLE MAXVALUE (x INT); -- error 42601: syntax error: near "MAXVALUE" CREATE TABLE MESSAGE_LENGTH (x INT); -- error 42601: syntax error: near "MESSAGE_LENGTH" CREATE TABLE MESSAGE_OCTET_LENGTH (x INT); -- error 42601: syntax error: near "MESSAGE_OCTET_LENGTH" CREATE TABLE MESSAGE_TEXT (x INT); -- error 42601: syntax error: near "MESSAGE_TEXT" CREATE TABLE MINVALUE (x INT); -- error 42601: syntax error: near "MINVALUE" CREATE TABLE MORE (x INT); -- error 42601: syntax error: near "MORE" CREATE TABLE MUMPS (x INT); -- error 42601: syntax error: near "MUMPS" CREATE TABLE NAME (x INT); -- error 42601: syntax error: near "NAME" CREATE TABLE NAMES (x INT); -- error 42601: syntax error: near "NAMES" CREATE TABLE NESTED (x INT); -- error 42601: syntax error: near "NESTED" CREATE TABLE NESTING (x INT); -- error 42601: syntax error: near "NESTING" CREATE TABLE NEXT (x INT); -- error 42601: syntax error: near "NEXT" CREATE TABLE NFC (x INT); -- error 42601: syntax error: near "NFC" CREATE TABLE NFD (x INT); -- error 42601: syntax error: near "NFD" CREATE TABLE NFKC (x INT); -- error 42601: syntax error: near "NFKC" CREATE TABLE NFKD (x INT); -- error 42601: syntax error: near "NFKD" CREATE TABLE NORMALIZED (x INT); -- error 42601: syntax error: near "NORMALIZED" CREATE TABLE NULLABLE (x INT); -- error 42601: syntax error: near "NULLABLE" CREATE TABLE NULLS (x INT); -- error 42601: syntax error: near "NULLS" CREATE TABLE NUMBER (x INT); -- error 42601: syntax error: near "NUMBER" CREATE TABLE OBJECT (x INT); -- error 42601: syntax error: near "OBJECT" CREATE TABLE OCTETS (x INT); -- error 42601: syntax error: near "OCTETS" CREATE TABLE OPTION (x INT); -- error 42601: syntax error: near "OPTION" CREATE TABLE OPTIONS (x INT); -- error 42601: syntax error: near "OPTIONS" CREATE TABLE ORDERING (x INT); -- error 42601: syntax error: near "ORDERING" CREATE TABLE ORDINALITY (x INT); -- error 42601: syntax error: near "ORDINALITY" CREATE TABLE OTHERS (x INT); -- error 42601: syntax error: near "OTHERS" CREATE TABLE OUTPUT (x INT); -- error 42601: syntax error: near "OUTPUT" CREATE TABLE OVERFLOW (x INT); -- error 42601: syntax error: near "OVERFLOW" CREATE TABLE OVERRIDING (x INT); -- error 42601: syntax error: near "OVERRIDING" CREATE TABLE P (x INT); -- error 42601: syntax error: near "P" CREATE TABLE PAD (x INT); -- error 42601: syntax error: near "PAD" CREATE TABLE PARAMETER_MODE (x INT); -- error 42601: syntax error: near "PARAMETER_MODE" CREATE TABLE PARAMETER_NAME (x INT); -- error 42601: syntax error: near "PARAMETER_NAME" CREATE TABLE PARAMETER_ORDINAL_POSITION (x INT); -- error 42601: syntax error: near "PARAMETER_ORDINAL_POSITION" CREATE TABLE PARAMETER_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "PARAMETER_SPECIFIC_CATALOG" CREATE TABLE PARAMETER_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "PARAMETER_SPECIFIC_NAME" CREATE TABLE PARAMETER_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "PARAMETER_SPECIFIC_SCHEMA" CREATE TABLE PARTIAL (x INT); -- error 42601: syntax error: near "PARTIAL" CREATE TABLE PASCAL (x INT); -- error 42601: syntax error: near "PASCAL" CREATE TABLE PASS (x INT); -- error 42601: syntax error: near "PASS" CREATE TABLE PASSING (x INT); -- error 42601: syntax error: near "PASSING" CREATE TABLE PAST (x INT); -- error 42601: syntax error: near "PAST" CREATE TABLE PATH (x INT); -- error 42601: syntax error: near "PATH" CREATE TABLE PLACING (x INT); -- error 42601: syntax error: near "PLACING" CREATE TABLE PLAN (x INT); -- error 42601: syntax error: near "PLAN" CREATE TABLE PLI (x INT); -- error 42601: syntax error: near "PLI" CREATE TABLE PRECEDING (x INT); -- error 42601: syntax error: near "PRECEDING" CREATE TABLE PRESERVE (x INT); -- error 42601: syntax error: near "PRESERVE" CREATE TABLE PRIOR (x INT); -- error 42601: syntax error: near "PRIOR" CREATE TABLE PRIVATE (x INT); -- error 42601: syntax error: near "PRIVATE" CREATE TABLE PRIVATE_PARAMETERS (x INT); -- error 42601: syntax error: near "PRIVATE_PARAMETERS" CREATE TABLE PRIVATE_PARAMS_S (x INT); -- error 42601: syntax error: near "PRIVATE_PARAMS_S" CREATE TABLE PRIVILEGES (x INT); -- error 42601: syntax error: near "PRIVILEGES" CREATE TABLE PRUNE (x INT); -- error 42601: syntax error: near "PRUNE" CREATE TABLE PUBLIC (x INT); -- error 42601: syntax error: near "PUBLIC" CREATE TABLE QUOTES (x INT); -- error 42601: syntax error: near "QUOTES" CREATE TABLE READ (x INT); -- error 42601: syntax error: near "READ" CREATE TABLE RELATIVE (x INT); -- error 42601: syntax error: near "RELATIVE" CREATE TABLE REPEATABLE (x INT); -- error 42601: syntax error: near "REPEATABLE" CREATE TABLE RESPECT (x INT); -- error 42601: syntax error: near "RESPECT" CREATE TABLE RESTART (x INT); -- error 42601: syntax error: near "RESTART" CREATE TABLE RESTRICT (x INT); -- error 42601: syntax error: near "RESTRICT" CREATE TABLE RETURNED_CARDINALITY (x INT); -- error 42601: syntax error: near "RETURNED_CARDINALITY" CREATE TABLE RETURNED_LENGTH (x INT); -- error 42601: syntax error: near "RETURNED_LENGTH" CREATE TABLE RETURNED_OCTET_LENGTH (x INT); -- error 42601: syntax error: near "RETURNED_OCTET_LENGTH" CREATE TABLE RETURNED_SQLSTATE (x INT); -- error 42601: syntax error: near "RETURNED_SQLSTATE" CREATE TABLE RETURNING (x INT); -- error 42601: syntax error: near "RETURNING" CREATE TABLE RETURNS_ONLY_PASS_THROUGH (x INT); -- error 42601: syntax error: near "RETURNS_ONLY_PASS_THROUGH" CREATE TABLE RET_ONLY_PASS_THRU (x INT); -- error 42601: syntax error: near "RET_ONLY_PASS_THRU" CREATE TABLE ROLE (x INT); -- error 42601: syntax error: near "ROLE" CREATE TABLE ROUTINE (x INT); -- error 42601: syntax error: near "ROUTINE" CREATE TABLE ROUTINE_CATALOG (x INT); -- error 42601: syntax error: near "ROUTINE_CATALOG" CREATE TABLE ROUTINE_NAME (x INT); -- error 42601: syntax error: near "ROUTINE_NAME" CREATE TABLE ROUTINE_SCHEMA (x INT); -- error 42601: syntax error: near "ROUTINE_SCHEMA" CREATE TABLE ROW_COUNT (x INT); -- error 42601: syntax error: near "ROW_COUNT" CREATE TABLE SCALAR (x INT); -- error 42601: syntax error: near "SCALAR" CREATE TABLE SCALE (x INT); -- error 42601: syntax error: near "SCALE" CREATE TABLE SCHEMA (x INT); -- error 42601: syntax error: near "SCHEMA" CREATE TABLE SCHEMA_NAME (x INT); -- error 42601: syntax error: near "SCHEMA_NAME" CREATE TABLE SCOPE_CATALOG (x INT); -- error 42601: syntax error: near "SCOPE_CATALOG" CREATE TABLE SCOPE_NAME (x INT); -- error 42601: syntax error: near "SCOPE_NAME" CREATE TABLE SCOPE_SCHEMA (x INT); -- error 42601: syntax error: near "SCOPE_SCHEMA" CREATE TABLE SECTION (x INT); -- error 42601: syntax error: near "SECTION" CREATE TABLE SECURITY (x INT); -- error 42601: syntax error: near "SECURITY" CREATE TABLE SELF (x INT); -- error 42601: syntax error: near "SELF" CREATE TABLE SEQUENCE (x INT); -- error 42601: syntax error: near "SEQUENCE" CREATE TABLE SERIALIZABLE (x INT); -- error 42601: syntax error: near "SERIALIZABLE" CREATE TABLE SERVER_NAME (x INT); -- error 42601: syntax error: near "SERVER_NAME" CREATE TABLE SESSION (x INT); -- error 42601: syntax error: near "SESSION" CREATE TABLE SETS (x INT); -- error 42601: syntax error: near "SETS" CREATE TABLE SIMPLE (x INT); -- error 42601: syntax error: near "SIMPLE" CREATE TABLE SIZE (x INT); -- error 42601: syntax error: near "SIZE" CREATE TABLE SOURCE (x INT); -- error 42601: syntax error: near "SOURCE" CREATE TABLE SPACE (x INT); -- error 42601: syntax error: near "SPACE" CREATE TABLE SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "SPECIFIC_NAME" CREATE TABLE START_CATALOG (x INT); -- error 42601: syntax error: near "START_CATALOG" CREATE TABLE START_NAME (x INT); -- error 42601: syntax error: near "START_NAME" CREATE TABLE START_PROCEDURE_SPECIFIC_CATALOG (x INT); -- error 42601: syntax error: near "START_PROCEDURE_SPECIFIC_CATALOG" CREATE TABLE START_PROCEDURE_SPECIFIC_NAME (x INT); -- error 42601: syntax error: near "START_PROCEDURE_SPECIFIC_NAME" CREATE TABLE START_PROCEDURE_SPECIFIC_SCHEMA (x INT); -- error 42601: syntax error: near "START_PROCEDURE_SPECIFIC_SCHEMA" CREATE TABLE START_SCHEMA (x INT); -- error 42601: syntax error: near "START_SCHEMA" CREATE TABLE STATE (x INT); -- error 42601: syntax error: near "STATE" CREATE TABLE STATEMENT (x INT); -- error 42601: syntax error: near "STATEMENT" CREATE TABLE STRING (x INT); -- error 42601: syntax error: near "STRING" CREATE TABLE STRUCTURE (x INT); -- error 42601: syntax error: near "STRUCTURE" CREATE TABLE STYLE (x INT); -- error 42601: syntax error: near "STYLE" CREATE TABLE SUBCLASS_ORIGIN (x INT); -- error 42601: syntax error: near "SUBCLASS_ORIGIN" CREATE TABLE T (x INT); -- error 42601: syntax error: near "T" CREATE TABLE TABLE_NAME (x INT); -- error 42601: syntax error: near "TABLE_NAME" CREATE TABLE TABLE_SEMANTICS (x INT); -- error 42601: syntax error: near "TABLE_SEMANTICS" CREATE TABLE TEMPORARY (x INT); -- error 42601: syntax error: near "TEMPORARY" CREATE TABLE THROUGH (x INT); -- error 42601: syntax error: near "THROUGH" CREATE TABLE TIES (x INT); -- error 42601: syntax error: near "TIES" CREATE TABLE TOP_LEVEL_COUNT (x INT); -- error 42601: syntax error: near "TOP_LEVEL_COUNT" CREATE TABLE TRANSACTION (x INT); -- error 42601: syntax error: near "TRANSACTION" CREATE TABLE TRANSACTION_ACTIVE (x INT); -- error 42601: syntax error: near "TRANSACTION_ACTIVE" CREATE TABLE TRANSACTIONS_COMMITTED (x INT); -- error 42601: syntax error: near "TRANSACTIONS_COMMITTED" CREATE TABLE TRANSACTIONS_ROLLED_BACK (x INT); -- error 42601: syntax error: near "TRANSACTIONS_ROLLED_BACK" CREATE TABLE TRANSFORM (x INT); -- error 42601: syntax error: near "TRANSFORM" CREATE TABLE TRANSFORMS (x INT); -- error 42601: syntax error: near "TRANSFORMS" CREATE TABLE TRIGGER_CATALOG (x INT); -- error 42601: syntax error: near "TRIGGER_CATALOG" CREATE TABLE TRIGGER_NAME (x INT); -- error 42601: syntax error: near "TRIGGER_NAME" CREATE TABLE TRIGGER_SCHEMA (x INT); -- error 42601: syntax error: near "TRIGGER_SCHEMA" CREATE TABLE TYPE (x INT); -- error 42601: syntax error: near "TYPE" CREATE TABLE UNBOUNDED (x INT); -- error 42601: syntax error: near "UNBOUNDED" CREATE TABLE UNCOMMITTED (x INT); -- error 42601: syntax error: near "UNCOMMITTED" CREATE TABLE UNCONDITIONAL (x INT); -- error 42601: syntax error: near "UNCONDITIONAL" CREATE TABLE UNDER (x INT); -- error 42601: syntax error: near "UNDER" CREATE TABLE UNNAMED (x INT); -- error 42601: syntax error: near "UNNAMED" CREATE TABLE USAGE (x INT); -- error 42601: syntax error: near "USAGE" CREATE TABLE USER_DEFINED_TYPE_CATALOG (x INT); -- error 42601: syntax error: near "USER_DEFINED_TYPE_CATALOG" CREATE TABLE USER_DEFINED_TYPE_CODE (x INT); -- error 42601: syntax error: near "USER_DEFINED_TYPE_CODE" CREATE TABLE USER_DEFINED_TYPE_NAME (x INT); -- error 42601: syntax error: near "USER_DEFINED_TYPE_NAME" CREATE TABLE USER_DEFINED_TYPE_SCHEMA (x INT); -- error 42601: syntax error: near "USER_DEFINED_TYPE_SCHEMA" CREATE TABLE UTF16 (x INT); -- error 42601: syntax error: near "UTF16" CREATE TABLE UTF32 (x INT); -- error 42601: syntax error: near "UTF32" CREATE TABLE UTF8 (x INT); -- error 42601: syntax error: near "UTF8" CREATE TABLE VIEW (x INT); -- error 42601: syntax error: near "VIEW" CREATE TABLE WORK (x INT); -- error 42601: syntax error: near "WORK" CREATE TABLE WRAPPER (x INT); -- error 42601: syntax error: near "WRAPPER" CREATE TABLE WRITE (x INT); -- error 42601: syntax error: near "WRITE" CREATE TABLE ZONE (x INT); -- error 42601: syntax error: near "ZONE" CREATE TABLE absolute (x INT); -- error 42601: syntax error: near "ABSOLUTE" CREATE TABLE t2 (absolute INT); -- error 42601: syntax error: near "ABSOLUTE"
-- 197. 上升的温度 -- 表 Weather -- -- +---------------+---------+ -- | Column Name | Type | -- +---------------+---------+ -- | id | int | -- | recordDate | date | -- | temperature | int | -- +---------------+---------+ -- id 是这个表的主键 -- 该表包含特定日期的温度信息 --   -- -- 编写一个 SQL 查询,来查找与之前(昨天的)日期相比温度更高的所有日期的 id 。 -- -- 返回结果 不要求顺序 。 -- -- 查询结果格式如下例: -- -- Weather -- +----+------------+-------------+ -- | id | recordDate | Temperature | -- +----+------------+-------------+ -- | 1 | 2015-01-01 | 10 | -- | 2 | 2015-01-02 | 25 | -- | 3 | 2015-01-03 | 20 | -- | 4 | 2015-01-04 | 30 | -- +----+------------+-------------+ -- -- Result table: -- +----+ -- | id | -- +----+ -- | 2 | -- | 4 | -- +----+ -- 2015-01-02 的温度比前一天高(10 -> 25) -- 2015-01-04 的温度比前一天高(20 -> 30) -- -- 来源:力扣(LeetCode) -- 链接:https://leetcode-cn.com/problems/rising-temperature -- 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 SELECT w2.id FROM Weather AS w1 JOIN Weather AS w2 ON datediff( w2.recordDate, w1.recordDate )= 1 WHERE w2.Temperature > w1.Temperature;
DROP TABLE IF EXISTS USER; DROP TABLE IF EXISTS ROLE; DROP TABLE IF EXISTS PROFILE; CREATE TABLE USER( STR_NAME VARCHAR(255) NOT NULL, STR_CPF VARCHAR(255) NOT NULL, STR_GENDER VARCHAR(255) NOT NULL, DAT_BIRTH DATE NOT NULL, STATUS INT NOT NULL, NUM_ROLE_ID INTEGER NOT NULL, NUM_PROFILE_ID INTEGER NOT NULL ); ALTER TABLE USER ADD CONSTRAINT PK_USER PRIMARY KEY ( STR_CPF ); CREATE TABLE ROLE( NUM_ID INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, STR_ROLE VARCHAR(255) ); CREATE TABLE PROFILE( NUM_ID INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, STR_PROFILE VARCHAR(100) NOT NULL ); ALTER TABLE USER ADD FOREIGN KEY (NUM_ROLE_ID) REFERENCES ROLE(NUM_ID); ALTER TABLE USER ADD FOREIGN KEY (NUM_PROFILE_ID) REFERENCES PROFILE(NUM_ID);
/** * As type is a reserved keyword in SQL we're trying not to use it. */ CREATE TABLE types ( typing VARCHAR(255) PRIMARY KEY NOT NULL );
ALTER TABLE student_degree ADD COLUMN edebo_id VARCHAR(15); UPDATE student_degree SET edebo_id = supplement_number WHERE supplement_number IS NOT NULL; UPDATE student_degree SET supplement_number = NULL WHERE active = true;
-------------------------------------------------------- -- Archivo creado - mi�rcoles-febrero-01-2017 -------------------------------------------------------- -------------------------------------------------------- -- DDL for Package Body PK_GPY_POLITICA -------------------------------------------------------- CREATE OR REPLACE PACKAGE BODY "PK_GPY_POLITICA" AS PROCEDURE Pr_RegistrarPolitica( p_A007IDPROYECTO IN GPYT_T007_Proy_Politica.A007IDPROYECTO%TYPE, p_A003NIVEL1 IN GPYT_T003_POLITICA.A003NIVEL1%TYPE, p_A003NOMNIVEL1 IN GPYT_T003_POLITICA.A003NOMNIVEL1%TYPE, p_A003NIVEL2 IN GPYT_T003_POLITICA.A003NIVEL2%TYPE, p_A003NOMNIVEL2 IN GPYT_T003_POLITICA.A003NOMNIVEL2%TYPE, p_A003NIVEL3 IN GPYT_T003_POLITICA.A003NIVEL3%TYPE, p_A003NOMNIVEL3 IN GPYT_T003_POLITICA.A003NOMNIVEL3%TYPE, p_A003NOMNIVEL4 IN GPYT_T003_POLITICA.A003NOMNIVEL4%TYPE, P_A026CODIGO IN GPYT_T026_ARCHIVO.A026CODIGO%TYPE, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2) AS NOMBRE_PROCEDIMIENTO VARCHAR2(50) := 'Pr_RegistrarPolitica'; codExcepcion NUMBER; P_A007IDPOLITICA NUMBER; P_A003NIVEL4 NUMBER; --Codigo de politica para ser insertado P_A003CODIGO NUMBER; -- Llave primaria de politica, para insercion politica proyecto P_A007CODIGO NUMBER; -- llave primaria proyecto politica mumreg NUMBER; BEGIN -- TAREA: Se necesita implantaci�n para PROCEDURE PK_GPY_POLITICA.Pr_RegistrarPolitica PK_UTL_UTILIDAD.PR_REGISTRARDEBUG(p_niveldebug => PK_UTL_CONSTANTE.NIVEL_TRACE, p_paquete => NOMBRE_PAQUETE, p_procedimiento => NOMBRE_PROCEDIMIENTO, p_usuario => p_idUsuario, p_descripcion => 'Entro a Pr_RegistrarPolitica '); -- Valida datos obligatorios para insertar una nueva politica IF p_A007IDPROYECTO IS NULL OR p_A003NIVEL1 IS NULL OR p_A003NOMNIVEL1 IS NULL OR p_A003NIVEL2 IS NULL OR p_A003NOMNIVEL2 IS NULL OR p_A003NIVEL3 IS NULL OR p_A003NOMNIVEL3 IS NULL OR p_A003NOMNIVEL4 IS NULL OR P_A026CODIGO IS NULL THEN p_codError := 4; p_msjError := PK_UTL_UTILIDAD.Fn_Obtenermensaje(p_codError) || 's , necesarios para ingreso politica '; OPEN p_resultado FOR SELECT '' FROM dual; RETURN; END IF; -- valida si el arbol de politica existe SELECT COUNT(DISTINCT(POL.A003CODIGO)) INTO mumreg FROM GPYT_T003_POLITICA POL WHERE A003NIVEL1 = p_A003NIVEL1 AND A003NIVEL2 = p_A003NIVEL2 AND A003NIVEL3 = p_A003NIVEL3 AND POL.A003NOMNIVEL4 = p_A003NOMNIVEL4 AND POL.A003ESTADOREGISTRO = PK_UTL_CONSTANTE.COD_ACTIVO; ---Si politica existe IF mumreg > 0 THEN -- Traer codigo de politica SELECT POL.A003CODIGO INTO P_A007IDPOLITICA FROM GPYT_T003_POLITICA POL WHERE A003NIVEL1 = p_A003NIVEL1 AND A003NIVEL2 = p_A003NIVEL2 AND A003NIVEL3 = p_A003NIVEL3 AND POL.A003NOMNIVEL4 = p_A003NOMNIVEL4 AND POL.A003ESTADOREGISTRO = PK_UTL_CONSTANTE.COD_ACTIVO; --Validar si politica ya esta asignada al proyecto SELECT COUNT(DISTINCT(PP.A007CODIGO)) INTO P_A007CODIGO FROM GPYT_T007_PROY_POLITICA PP WHERE PP.A007IDPOLITICA = P_A007IDPOLITICA AND PP.A007IDPROYECTO = P_A007IDPROYECTO AND PP.A007ESTADOREGISTRO = PK_UTL_CONSTANTE.COD_ACTIVO; -- IF P_A007CODIGO > 0 THEN ---Valida si politica ya esta asociada al proyecto p_codError := 10; p_msjError := 'Politica ya asociada a proyecto'; OPEN p_resultado FOR SELECT '' FROM dual; ELSE PK_T007_PROY_POLITICA.PR_INSERTAR( P_A007IDPROYECTO => P_A007IDPROYECTO, P_A007IDPOLITICA => P_A007IDPOLITICA, P_IDUSUARIO => P_IDUSUARIO, P_RESULTADO => P_RESULTADO, P_CODERROR => P_CODERROR, P_MSJERROR => P_MSJERROR ); END IF; ELSE --Si politica no existe SELECT MAX(GPYT_T003_POLITICA.A003NIVEL4)+1 INTO P_A003NIVEL4 FROM GPYT_T003_POLITICA WHERE A003NIVEL1 = p_A003NIVEL1 AND A003NIVEL2 = p_A003NIVEL2 AND A003NIVEL3 = p_A003NIVEL3 AND A003ESTADOREGISTRO = PK_UTL_CONSTANTE.COD_ACTIVO; --- PK_T003_POLITICA.PR_INSERTAR( P_A003NIVEL1 => P_A003NIVEL1, P_A003NOMNIVEL1 => P_A003NOMNIVEL1, P_A003NIVEL2 => P_A003NIVEL2, P_A003NOMNIVEL2 => P_A003NOMNIVEL2, P_A003NIVEL3 => P_A003NIVEL3, P_A003NOMNIVEL3 => P_A003NOMNIVEL3, P_A003NIVEL4 => P_A003NIVEL4, P_A003NOMNIVEL4 => P_A003NOMNIVEL4, P_A003DESCRPCNPOLTC => P_A003NOMNIVEL4, P_A003IDARCHIV => P_A026CODIGO, P_IDUSUARIO => P_IDUSUARIO, P_RESULTADO => P_RESULTADO, P_CODERROR => P_CODERROR, P_MSJERROR => P_MSJERROR ); FETCH P_RESULTADO INTO P_A003CODIGO; -- Asociar politica a proyecto PK_T007_PROY_POLITICA.PR_INSERTAR( P_A007IDPROYECTO => P_A007IDPROYECTO, P_A007IDPOLITICA => P_A003CODIGO, P_IDUSUARIO => P_IDUSUARIO, P_RESULTADO => P_RESULTADO, P_CODERROR => P_CODERROR, P_MSJERROR => P_MSJERROR ); END IF; -- PK_UTL_UTILIDAD.PR_REGISTRARDEBUG(p_niveldebug => PK_UTL_CONSTANTE.NIVEL_TRACE, p_paquete => NOMBRE_PAQUETE, p_procedimiento => NOMBRE_PROCEDIMIENTO, p_usuario => p_idUsuario, p_descripcion => 'Salio de Pr_RegistrarFuente'); -- EXCEPTION WHEN OTHERS THEN ROLLBACK; codExcepcion := PK_UTL_UTILIDAD.Fn_RegistrarExcepcion (PK_UTL_CONSTANTE.COD_USUARIO_DEFECTO, NOMBRE_PAQUETE, NOMBRE_PROCEDIMIENTO, SQLCODE, SQLERRM); OPEN p_resultado FOR SELECT '' FROM dual; p_codError := PK_UTL_CONSTANTE.ERROR_GENERAL; p_msjError := PK_UTL_CONSTANTE.MSJ_EXCEPCION_GENERAL || TO_CHAR(codExcepcion); END Pr_RegistrarPolitica; ----**** PROCEDURE Pr_EliminarPolitica( p_A007CODIGO IN GPYT_T007_Proy_Politica.A007CODIGO%TYPE, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2) AS ----***** -- Procedimeinto que desasigna la politca al proyecto codExcepcion NUMBER; NOMBRE_PROCEDIMIENTO VARCHAR2(50) := 'Pr_EliminarPolitica'; estadoReg VARCHAR2(1); numReg NUMBER; BEGIN PK_UTL_UTILIDAD.PR_REGISTRARDEBUG(p_niveldebug => PK_UTL_CONSTANTE.NIVEL_TRACE, p_paquete => NOMBRE_PAQUETE, p_procedimiento => NOMBRE_PROCEDIMIENTO, p_usuario => p_idUsuario, p_descripcion => 'Entro a Pr_EliminarPolitica '); -- PK_T007_PROY_POLITICA.PR_ELIMINAR( P_A007CODIGO => P_A007CODIGO, P_IDUSUARIO => P_IDUSUARIO, P_RESULTADO => P_RESULTADO, P_CODERROR => P_CODERROR, P_MSJERROR => P_MSJERROR ); -- PK_UTL_UTILIDAD.PR_REGISTRARDEBUG(p_niveldebug => PK_UTL_CONSTANTE.NIVEL_TRACE, p_paquete => NOMBRE_PAQUETE, p_procedimiento => NOMBRE_PROCEDIMIENTO, p_usuario => p_idUsuario, p_descripcion => 'Salio de Pr_EliminarPolitica'); EXCEPTION WHEN OTHERS THEN ROLLBACK; codExcepcion := PK_UTL_UTILIDAD.Fn_RegistrarExcepcion (PK_UTL_CONSTANTE.COD_USUARIO_DEFECTO, NOMBRE_PAQUETE, NOMBRE_PROCEDIMIENTO, SQLCODE, SQLERRM); OPEN p_resultado FOR SELECT '' FROM dual; p_codError := PK_UTL_CONSTANTE.ERROR_GENERAL; p_msjError := PK_UTL_CONSTANTE.MSJ_EXCEPCION_GENERAL || TO_CHAR(codExcepcion); END Pr_EliminarPolitica; ---*** PROCEDURE Pr_ListarPoliticasProyecto( p_A007IDPROYECTO IN GPYT_T007_Proy_Politica.A007IDPROYECTO%TYPE, p_IdUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2) AS NOMBRE_PROCEDIMIENTO VARCHAR2(50) := 'Pr_ListarPoliticasProyecto'; codExcepcion NUMBER; numReg NUMBER; BEGIN -- PK_UTL_UTILIDAD.PR_REGISTRARDEBUG(p_niveldebug => PK_UTL_CONSTANTE.NIVEL_TRACE, p_paquete => NOMBRE_PAQUETE, p_procedimiento => NOMBRE_PROCEDIMIENTO, p_usuario => p_idUsuario, p_descripcion => 'Entro a Pr_ListarPoliticasProyecto '); -- TAREA: Se necesita implantaci�n para PROCEDURE PK_PARTICIPANTE.Pr_ListarParticipantesProyecto IF p_A007IDPROYECTO IS NULL THEN p_codError := 4; p_msjError := PK_UTL_UTILIDAD.Fn_Obtenermensaje(p_codError); OPEN p_resultado FOR SELECT '' FROM dual; RETURN; END IF; -- OPEN p_resultado FOR SELECT * FROM GPYV_009_POLITICAPROYECTO FUE WHERE FUE.A007IDPROYECTO = p_A007IDPROYECTO AND FUE.A026ESTADOREGISTRO = PK_UTL_CONSTANTE.COD_ACTIVO; p_codError := PK_UTL_CONSTANTE.COD_OPERACION_CORRECTA; p_msjError := PK_UTL_UTILIDAD.Fn_ObtenerMensaje (p_codError); PK_UTL_UTILIDAD.PR_REGISTRARDEBUG(p_niveldebug => PK_UTL_CONSTANTE.NIVEL_TRACE, p_paquete => NOMBRE_PAQUETE, p_procedimiento => NOMBRE_PROCEDIMIENTO, p_usuario => p_idUsuario, p_descripcion => 'Salio de Pr_ListarPoliticasProyecto'); -- EXCEPTION WHEN OTHERS THEN ROLLBACK; codExcepcion := PK_UTL_UTILIDAD.Fn_RegistrarExcepcion (PK_UTL_CONSTANTE.COD_USUARIO_DEFECTO, NOMBRE_PAQUETE, NOMBRE_PROCEDIMIENTO, SQLCODE, SQLERRM); OPEN p_resultado FOR SELECT '' FROM dual; p_codError := PK_UTL_CONSTANTE.ERROR_GENERAL; p_msjError := PK_UTL_CONSTANTE.MSJ_EXCEPCION_GENERAL || TO_CHAR(codExcepcion); END Pr_ListarPoliticasProyecto; ---*** PROCEDURE Pr_RegistrarArchivoPolitica( p_A026DESCRPCNARCHIV IN GPYT_T026_ARCHIVO.A026DESCRPCNARCHIV%TYPE, p_A026NOMARCHIVO IN GPYT_T026_ARCHIVO.A026NOMARCHIVO%TYPE, p_A026HASHARCHIVO IN GPYT_T026_ARCHIVO.A026HASHARCHIVO%TYPE, p_IdUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2) AS NOMBRE_PROCEDIMIENTO VARCHAR2(50) := 'Pr_RegistrarArchivoPolitica'; codExcepcion NUMBER; numReg NUMBER; BEGIN -- PK_UTL_UTILIDAD.PR_REGISTRARDEBUG(p_niveldebug => PK_UTL_CONSTANTE.NIVEL_TRACE, p_paquete => NOMBRE_PAQUETE, p_procedimiento => NOMBRE_PROCEDIMIENTO, p_usuario => p_idUsuario, p_descripcion => 'Entro a Pr_RegistrarArchivoPolitica '); -- PK_T026_ARCHIVO.PR_INSERTAR( P_A026DESCRPCNARCHIV => P_A026DESCRPCNARCHIV, p_A026NOMARCHIVO => p_A026NOMARCHIVO,p_A026HASHARCHIVO => p_A026HASHARCHIVO, P_IDUSUARIO => P_IDUSUARIO, P_RESULTADO => P_RESULTADO, P_CODERROR => P_CODERROR, P_MSJERROR => P_MSJERROR ); -- PK_UTL_UTILIDAD.PR_REGISTRARDEBUG(p_niveldebug => PK_UTL_CONSTANTE.NIVEL_TRACE, p_paquete => NOMBRE_PAQUETE, p_procedimiento => NOMBRE_PROCEDIMIENTO, p_usuario => p_idUsuario, p_descripcion => 'Salio de Pr_RegistrarArchivoPolitica'); -- EXCEPTION WHEN OTHERS THEN ROLLBACK; codExcepcion := PK_UTL_UTILIDAD.Fn_RegistrarExcepcion (PK_UTL_CONSTANTE.COD_USUARIO_DEFECTO, NOMBRE_PAQUETE, NOMBRE_PROCEDIMIENTO, SQLCODE, SQLERRM); OPEN p_resultado FOR SELECT '' FROM dual; p_codError := PK_UTL_CONSTANTE.ERROR_GENERAL; p_msjError := PK_UTL_CONSTANTE.MSJ_EXCEPCION_GENERAL || TO_CHAR(codExcepcion); END Pr_RegistrarArchivoPolitica; END PK_GPY_POLITICA; /
ALTER TABLE `m_product_loan` ADD COLUMN `days_in_month_enum` SMALLINT(5) NOT NULL DEFAULT '1' AFTER `overdue_days_for_npa`, ADD COLUMN `days_in_year_enum` SMALLINT(5) NOT NULL DEFAULT '1' AFTER `days_in_month_enum`, ADD COLUMN `interest_recalculation_enabled` TINYINT NOT NULL DEFAULT '0' AFTER `days_in_year_enum`; ALTER TABLE `m_loan` ADD COLUMN `days_in_month_enum` SMALLINT(5) NOT NULL DEFAULT '1' AFTER `accrued_till`, ADD COLUMN `days_in_year_enum` SMALLINT(5) NOT NULL DEFAULT '1' AFTER `days_in_month_enum`, ADD COLUMN `interest_recalculation_enabled` TINYINT NOT NULL DEFAULT '0' AFTER `days_in_year_enum`; CREATE TABLE `m_product_loan_recalculation_details` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `product_id` BIGINT(20) NOT NULL, `compound_type_enum` SMALLINT(5) NOT NULL, `reschedule_strategy_enum` SMALLINT(5) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `FK_m_product_loan_m_product_loan_recalculation_details` FOREIGN KEY (`product_id`) REFERENCES `m_product_loan` (`id`) ) COLLATE='latin1_swedish_ci' ENGINE=InnoDB; CREATE TABLE `m_loan_recalculation_details` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `loan_id` BIGINT(20) NOT NULL, `compound_type_enum` SMALLINT(5) NOT NULL, `reschedule_strategy_enum` SMALLINT(5) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `FK_m_loan_m_loan_recalculation_details` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`) ) COLLATE='latin1_swedish_ci' ENGINE=InnoDB;
select * from person; select * from photo order by postingdate desc; select * from friendgroup; select * from belongto; select * from sharedwith; select * from follow; select * from tag; -- update photo -- set filepath = "static/img/mountain.jpg" -- where pid = 3; insert into friendgroup (groupname, groupcreator, description) values ('NYU', 'thrmn', 'A group for students currently attending NYU'); insert into friendgroup (groupname, groupcreator, description) values ('Game of Thrones', 'thrmn', 'A group for Game of Thrones fans'); insert into BelongTo (username, groupname, groupcreator) values ('thrmn', 'NYU', 'thrmn'); insert into BelongTo (username, groupname, groupcreator) values ('jnd', 'NYU', 'thrmn'); insert into BelongTo (username, groupname, groupcreator) values ('thrmn', 'Game of Thrones', 'thrmn'); select groupname from belongto where username = 'thrmn'; SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'Finstagram' AND TABLE_NAME = 'Photo'; select groupcreator from friendgroup where groupname = 'NYU'; SELECT * FROM belongto WHERE username = 'thrmn' and groupname = 'NYU'; select * from person natural join belongto natural join friendgroup where username = 'thrmn'; select followee from follow where followStatus = 0 and follower = 'jnd'; sELECT * FROM follow WHERE followStatus = 0 AND followee = 'thrmn'; UPDATE follow SET followstatus = 1 WHERE follower = 'jhnsmth' AND followee = 'thrmn' AND followstatus = 0; UPDATE follow SET followstatus = 0 WHERE follower = 'jnd' AND followee = 'thrmn' AND followstatus = 1; update follow set followstatus = 0 where followee = 'thrmn'; DELETE FROM follow WHERE follower = 'jnd' AND followee = 'thrmn' AND followStatus = 0; -- INSERT INTO reactto (username, pID, reactiontime, comment, emoji) INSERT INTO tag (pid, username, tagstatus) VALUES (28, 'jnd', 0); select * from photo where poster = 'thrmn'; select * from photo where poster = 'jnd'; select * from photo where poster = 'geohot'; -- select * -- from -- where followstatus = 1 or photo.poster = 'thrmn'; select * from person natural join photo where person.username = photo.poster; select * from person natural join follow where person.username = follow.followee AND followstatus = 1; select * from photo join person on person.username = photo.poster join follow on person.username = follow.follower where person.username = 'thrmn'; select pID, postingDate, filePath, allFollowers, caption, posterv from person join follow on (person.username = follow.follower) join photo on (follow.follower = photo.poster) where followStatus = 1 OR person.username = 'jhnsmth' order by postingdate desc; select * from follow; select * from photo where poster = 'thrmn' and allfollowers = 1; SELECT * from tag; -- show all photos (user's photos and all followers) SELECT distinct pid, postingdate, filepath, allfollowers, caption, poster FROM person JOIN follow ON (person.username = follow.follower) JOIN photo ON (follow.followee = photo.poster) WHERE (follow.follower = 'geohot' AND follow.followstatus = 1) OR (poster = 'geohot') ORDER BY postingdate DESC; -- problem with current query is that it shows photos from everyone you follow, but the result doesnt contain photos that the user itself has posted SELECT distinct pid, postingdate, filepath, allfollowers, caption, poster FROM person JOIN follow ON (person.username = follow.follower) JOIN photo ON (follow.followee = photo.poster) WHERE (follow.follower = 'geohot' AND follow.followstatus = 1) OR (follow.followee = 'geohot') ORDER BY postingdate DESC; SELECT * FROM person JOIN follow ON (person.username = follow.follower) JOIN photo ON (follow.followee = photo.poster) WHERE follow.follower = 'hrrypttr' AND followstatus = 1; select * from person join follow on (person.username = follow.follower) join photo on (follow.followee = photo.poster) where person.username = 'geohot'; -- UNION pt 1+2most recent correct query w/o friendgroup shared SELECT pid, postingdate, filepath, allfollowers, caption, poster FROM person JOIN follow ON (person.username = follow.follower) JOIN photo ON (follow.followee = photo.poster) WHERE follow.follower = 'jnd' AND followstatus = 1 AND allfollowers = 1 UNION SELECT pid, postingdate, filepath, allfollowers, caption, poster FROM photo WHERE poster = 'jnd' ORDER BY postingdate DESC; -- most recent correct query w/ friendgroup shared SELECT pid, postingdate, filepath, allfollowers, caption, poster FROM person JOIN follow ON (person.username = follow.follower) JOIN photo ON (follow.followee = photo.poster) WHERE follow.follower = 'D' AND followstatus = 1 AND allfollowers = 1 UNION SELECT pid, postingdate, filepath, allfollowers, caption, poster FROM photo WHERE poster = 'D' UNION SELECT pid, postingdate, filepath, allfollowers, caption, poster FROM person JOIN belongto ON (person.username = belongto.username) JOIN sharedwith ON (belongto.groupname = sharedwith.groupname) NATURAL JOIN photo WHERE person.username = 'D' ORDER BY postingdate DESC; -- (INCORRECT pt 3) photos sharedwith friendgroups user belongs in (incorrect as of test data, A should not be able to see 3 since 3 was shared with a different group named best friends SELECT pid, postingdate, filepath, allfollowers, caption, poster FROM person JOIN belongto ON (person.username = belongto.username) JOIN sharedwith ON (belongto.groupname = sharedwith.groupname) NATURAL JOIN photo WHERE person.username = 'A'; -- (correct) UNION PT 3 photos sharedwith friendgroups user belongs in SELECT * FROM person JOIN belongto ON (person.username = belongto.username) JOIN sharedwith ON (belongto.groupname = sharedwith.groupname) AND (belongto.groupcreator = sharedwith.groupcreator) NATURAL JOIN photo WHERE person.username = 'A'; SELECT * FROM photo JOIN person ON (photo.poster = person.username) WHERE pid = 34; SELECT * FROM tag JOIN person ON (tag.username = person.username) WHERE tag.pid = 34 AND tagstatus = 1; SELECT * FROM tag WHERE pid = 34 AND username = 'thrmn' AND tagstatus = 0; -- see if given user can see a given photo, change follow.followerS and pIDs SELECT pid, postingdate, filepath, allfollowers, caption, poster FROM person JOIN follow ON (person.username = follow.follower) JOIN photo ON (follow.followee = photo.poster) WHERE follow.follower = 'jnhsmth' AND followstatus = 1 AND allfollowers = 1 AND pID = 41 UNION SELECT pid, postingdate, filepath, allfollowers, caption, poster FROM person JOIN belongto ON (person.username = belongto.username) JOIN sharedwith ON (belongto.groupname = sharedwith.groupname) NATURAL JOIN photo WHERE person.username = 'jhnsmth' AND pID = 41 ORDER BY postingdate DESC; select * from photo where pid = 41; select * from person; select * from photo order by postingdate desc; select * from friendgroup; select * from belongto; select * from sharedwith; select * from reactto order by reactiontime asc; select * from follow; select * from tag; insert into belongto (username, groupname, groupcreator) values ('testuser', 'Administrators', 'secureadmin'); delete from friendgroup where groupname = '206' and groupcreator = 'thrmn'; update person set password = '0bce500e4b03f8a68e722105001eda09a1bcdf8dddbfd243068b9d453c8ae6b8' where username = 'geohot'; delete from person where username = 'thrmn';
SELECT nom FROM `distrib` WHERE (id_distrib = 42 OR id_distrib >= 62 AND id_distrib <= 69 OR id_distrib = 71 OR id_distrib = 88 OR id_distrib = 89 OR id_distrib = 90) OR (LENGTH('nom') - LENGTH(REPLACE(LOWER('nom'), 'y', ''))) = 2 LIMIT 2, 5;
CREATE DATABASE lesson_db; USE test_login; CREATE TABLE users (id int not null auto_increment primary key, name varchar(32) not null, passwd varchar(512) not null);
create table ciudad (nombre varchar(20),com_auton varchar(20), primary key (nombre,com_auton)); insert into ciudad values ('Fuenlabrada','Madrid'); insert into ciudad values ('Avila','Castilla y Leon'); insert into ciudad values ('Mostoles','Madrid'); insert into ciudad values ('Valencia','Com. Valenciana'); select * from ciudad; create table equipo ( nombre varchar(20),primary key(nombre)); insert into equipo values ('Estudiantes'); insert into equipo values ('Real Madrid CB'); insert into equipo values ('Baskonia'); insert into equipo values ('Unicaja de Malaga '); create table cancha (nombre varchar(20), dir varchar(20), primary key(nombre)); insert into cancha values ('cancha01','C/ Pi 3'); insert into cancha values ('cancha02','C/ La avenida 2'); insert into cancha values ('cancha03','C/ Madrid 23' ); insert into cancha values ('cancha04','C/ Real 2'); create table entrena_cancha (nom_equipo varchar(20),nom_cancha varchar(20), primary key (nom_cancha), foreign key(nom_cancha) references cancha(nombre)); insert into entrena_cancha values('Real Madrid CB','cancha01'); insert into entrena_cancha values('Estudiantes','cancha02'); insert into entrena_cancha values('Unicaja de Malaga','cancha03'); insert into entrena_cancha values('Baskonia','cancha04'); create table equipo_pertenece (nom_eq varchar(20),nom_ciu varchar(20),nom_com varchar(20), primary key(nom_ciu,nom_com), foreign key(nom_ciu,nom_com) references ciudad(nombre,com_auton)); insert into equipo_pertenece values ('Real Madrid CB','Fuenlabrada','Madrid'); insert into equipo_pertenece values ('Unicaja de Malaga','Avila','Castilla y Leon'); insert into equipo_pertenece values ('Estudiantes','Mostoles','Madrid'); insert into equipo_pertenece values ('Baskonia','Valencia','Com. Valenciana'); create table campeonato(id_c int, fecha_in datetime, fecha_fin datetime, primary key (id_c)); insert into campeonato values (1110,"2013-07-30","2014-05-12"); insert into campeonato values (1111,"2014-07-30","2015-05-23"); insert into campeonato values (1112,"2015-07-25","2016-05-21"); insert into campeonato values (1113,"2016-06-30","2017-05-25"); create table entrenadores ( nif varchar(20),nombre varchar(20), fecha_nac datetime,primary key(nif)); insert into entrenadores values ('1234','Edu Fernandez',"1980-9-12"); insert into entrenadores values ('12345','Mumbru ',"1977-7-2"); insert into entrenadores values ('12346','Chapu Fernandez',"1989-5-7"); create table entrena_eq( nif_entr varchar(20), idc int , nombre_cancha varchar(20), fecha_in datetime, fecha_fin datetime, primary key( nif_entr,nombre_cancha), foreign key (nif_entr) references entrenadores(nif), foreign key(idc) references campeonato (id_c),foreign key(nombre_cancha) references cancha(nombre)); insert into entrena_eq values ('12346','1113','cancha04',"2015-11-02","2016-01-16"); create table empresa_patr(nombre varchar(20), cif int, primary key(nombre)); insert into empresa_patr values('Endesa',1); insert into empresa_patr values('Iberdrola',2); insert into empresa_patr values('Repsol',3); insert into empresa_patr values('Nike',4); create table patrocina( id_c int , nomb_camp varchar(20), primary key(id_c),foreign key(id_c) references campeonato(id_c),foreign key(nomb_camp) references empresa_patr(nombre)); insert into patrocina values(1110,'Endesa'); insert into patrocina values(1111,'Repsol'); insert into patrocina values(1112,'Nike'); insert into patrocina values(1113,'Iberdrola'); create table jugadores (nif varchar(20), nombre varchar(20), fecha_nac datetime, estatura int, primary key(nif)); insert into jugadores values ('12345','Mumbru ',"1977-7-2",180); insert into jugadores values ('12346','Olesson ',"1989-5-7",183); select * from jugadores; create table jugadores_pertenece ( nif varchar(20), idc int , nombre_eq varchar(20), primary key(nif,idc,nombre_eq), foreign key(nif) references jugadores(nif), foreign key(idc) references campeonato(id_c)); insert into jugadores_pertenece values ('12346',1113,'Unicaja de Malaga'); create table juega_contra(id_p int,idc int , equipo_casa varchar(20), equipo_fuera varchar(20),nombre_cancha varchar(20),hora_in datetime, hora_fin datetime, primary key(id_p,equipo_casa,equipo_fuera), foreign key(nombre_cancha) references cancha(nombre), foreign key(idc) references campeonato(id_c)); insert into juega_contra values (3,1110,'Real Madrid CB','Unicaja de Malaga',"cancha01","19:00:00","21:00:00"); insert into juega_contra values (2,1110,'Baskonia','Estudiantes',"cancha02","18:00:00","21:00:00"); insert into juega_contra values (1,1111,'Baskonia','Unicaja de Malaga',"cancha03","18:00:00","21:00:00"); create table juega_pos (idp int, nif varchar(20), pos varchar(20),tpo_banquillo int, tpo_jugando int, peso int , primary key(nif,pos,idp), foreign key(nif) references jugadores(nif)); insert into juega_pos values (1,'123','base','15','34',89); insert into juega_pos values (2,'1234','base','20','23',90); insert into juega_pos values (3,'12345','escolta','2','39',91); insert into juega_pos values (2,'12346','alero','15','34',76); insert into juega_pos values (4,'123','alero','49','3',98); create table info_partido (idp int, numcuarto int, puntuacion_casa int, puntuacion_fuera int, hora_com datetime, hora_fin datetime , primary key(idp,numcuarto,puntuacion_casa,puntuacion_fuera)); insert into info_partido values (1,2,67,65,"13:40","14:00"); insert into info_partido values (2,2,67,65,"13:40","14:00"); insert into info_partido values (3,4,87,65,"13:40","14:00"); insert into info_partido values (4,4,97,85,"13:40","14:00"); insert into info_partido values (2,4,107,65,"13:40","14:00"); select * from cancha;
/* ---------------JOIN------------------ -equi join --> null 포함x -outer join (left right full) --> null 포함시켜야할때 (+)<- 오라클에서만 -self join */ select em.employee_id "사번", em.first_name "사원이름", em.manager_id "매니저 사번", ma.first_name as 매니저이름 from employees em,employees ma where em.manager_id=ma.employee_id; -------------------------------------- -------------SUBQUERY----------------- --Den의급여의 쿼리 select salary from employees where first_name='Den'; -- Den의 급여 쿼리 를 서브쿼리로 이용한 쿼리 select first_name, salary from employees where salary >=(select salary from employees where first_name='Den'; --ex01.급여를 가장 적게 받는 사람의 이름, 급여, 사원번호는? --1.급여를 가장 적게 받는사람의 급여 select min(em.salary) from employees em; --2.10000을 받는사람의 이름 급여 사원번호 select em.first_name, em.salary, em.employee_id from employees em where salary=10000; --3.두 식을 조합 select em.first_name, em.salary, em.employee_id from employees em where salary = (select min(em.salary) from employees em); --예제) 평균 급여보다 적게받는 사름의 이름, 급여를 출력하세요. --1.평균급여를 구한다. --6461.83 select avg(salary) from employees; --2. 6461.83보다 적게받는 사람의 이름, 급여를 구한다. select first_name, salary from employees where salary < 6461.83; --3. 식을 조합한다. select first_name, salary from employees where salary < (select avg(salary) from employees); /*다중행 SubQuery*/ --부서번호 110인 직원의 급여리스트 select salary, first_name from employees where department_id=110; -->Shelly 12008, William 8300 --급여가 12008,8300인 직원리스트를 구한다. select salary from employees where salary=12008 or salary=8300; select first_name, salary from employees where salary in (12008,8300); select first_name, salary, department_id from employees where salary in (select salary from employees where department_id=110); --예제)각 부서별로 최고급여를 받는 사원을 출력하세요. --1.그룹별 최고급여를 구한다. select max(salary), department_id from employees where department_id IS not NULL group by department_id; --2.사원테이블에서 그룹번호와 급여가 같은 직원의 정보를 구한다. select * from employees where (department_id,salary) in (select department_id,max(salary) from employees --where department_id IS not NULL group by department_id); --예제)부서번호가 110인 직원의 급여보다 큰 모든직원의 -- 사번, 이름, 급여를 출력하세요.(or연산-->8300보다 큰) --1.부서번호가 110인 직원 리스트 12008, 8300 select * from employees where department_id=110; --2. 12008,8300 보다 급여가 큰 직원리스트 (사번,이름,급여)를 구하시오. select em.employee_id, em.first_name, em.salary from employees em where salary>12008 or salary>8300; select em.employee_id, em.first_name, em.department_id, em.salary from employees em where salary> = any(select salary from employees where department_id=110) and em.department_id<>110; select em.employee_id, em.first_name, em.department_id, em.salary from employees em where salary> = all(select salary from employees where department_id=110) and em.department_id<>110; --예제 --각 부서별로 최고급여를 받는 사원을 출력하세요 --1. 각부서별 최고급여 리스트 구하기 select max(salary), department_id from employees group by department_id; --2. 직원테이블 부서코드,급여가 동시에 같은 직원리스트 출력하기 select first_name, department_id, salary from employees where (salary,department_id) in (select max(salary), department_id from employees group by department_id); select em.employee_id, em.first_name, em.department_id, em.salary, s.salary, s.department_id from employees em,(select max(salary) salary, department_id from employees group by department_id) s where em.department_id=s.department_id and em.salary=s.salary; --급여를 가장많이 받는 5명의 직원의 이름을 출력하시요. --1.rownum이 먼저 작동 select rownum , employee_id, first_name, salary from employees where rownum>0 and rownum<6 order by salary desc; -->정렬 하고 rownum select rownum, ot.employee_id, ot.first_name, ot.salary, ot.hire_date from (select employee_id, salary, first_name, hire_date from employees --정렬이 되어있는 테이블을 from에 쓴다 ! order by salary desc) ot where rownum<6; --rownum >= 데이터가 없다 (1부터매겨지는데 조건에 걸려서 1버려짐) ---> 정렬하고 rownum하고 그테이블 쓴다. select rt.rn, rt.employee_id, rt.first_name, rt.salary from (select rownum rn, ot.employee_id, ot.first_name, ot.salary from (select employee_id, first_name, salary from employees order by salary desc) ot) rt where rn>2 and rn<6; --[예제] --07년에 입사한 직원중 급여가 많은 직우너중 3~7등의 이름 급여 입사일은? select ort.rn, ort.first_name, ort.salary, ort.hire_date from (select rownum rn, ot.first_name, ot.salary, ot.hire_date from (select first_name, salary, hire_date from employees where to_char(hire_date,'YYYY')='2007' order by salary desc) ot) ort where ort.rn>=3 and ort.rn<=7;
drop database dbname; create database dbname; use dbname; create table tablename1( columnName varchar (50) ); create table tablename2( name varchar (50) PRIMARY KEY , age int (2) ); create table tablename3( name varchar (50) , favouritefood varchar (50), favouritedrink varchar (50), FOREIGN KEY (name) REFERENCES tablename2(name) ON UPDATE CASCADE );
/* SubConsultas */ /* SubConsulta Escalonada */ SELECT AVG(PRECIO) AS MEDIA FROM PRODUCTOS; SELECT NOMBREARTÍCULO,SECCIÓN,PRECIO FROM PRODUCTOS WHERE PRECIO > (SELECT AVG(PRECIO) AS MEDIA FROM PRODUCTOS) ORDER BY PRECIO; /* SubConsulta de lista */ SELECT PRECIO FROM PRODUCTOS WHERE SECCIÓN = "CERÁMICA" ORDER BY PRECIO DESC; /*EN LISTA*/ SELECT MAX(PRECIO) FROM PRODUCTOS WHERE SECCIÓN = "CERÁMICA"; /* SACANDO EL MAYOR */ SELECT NOMBREARTÍCULO,SECCIÓN,PRECIO FROM PRODUCTOS WHERE PRECIO > (SELECT MAX(PRECIO) FROM PRODUCTOS WHERE SECCIÓN = "CERÁMICA") ORDER BY PRECIO; /* OTRA FORMA MAS MINUCIOSA ALL: SUPERIORES A ESTA SUBCONSULTA */ SELECT * FROM PRODUCTOS WHERE PRECIO > ALL (SELECT PRECIO FROM PRODUCTOS WHERE SECCIÓN = "CERÁMICA") ORDER BY PRECIO; /* MAYOR QUE CUALQUIERA de la lista ANY */ SELECT * FROM PRODUCTOS WHERE PRECIO > ANY (SELECT PRECIO FROM PRODUCTOS WHERE SECCIÓN = "CERÁMICA") ORDER BY PRECIO;
--RRQ2074 select B.OTXACT, B.OTSEQ, D.STRING09 from ORDERHDR_ALL A, ORDERTRAILER B, ORDERTRAILER_TAX_ITEMS C, ORDERTI_CHARACTERISTICS D, CHARACTERISTICS_DEF E Where A.OHXACT = B.OTXACT AND B.OTXACT = C.OTXACT AND B.OTSEQ = C.OTSEQ AND C.OTXACT = D.OTXACT AND C.OTI_SEQNO = D.OTI_SEQNO AND D.CHAR_ID = E.CHAR_ID AND E.CHAR_DES = 'FinancialDocItemTaxVOResponse' Order by 1 select distinct B.OTXACT, B.OTSEQ,d.sncode,d.des --,B.TMCODE,B.SPCODE,B.SNCODE, --distinct C.EPC_CHARGE_ITEM, C.EPC_FEATURE, C.EPC_PROD_OFFER from ORDERHDR_ALL A, ORDERTRAILER B,mpulktmb c, mpusntab d Where A.OHXACT = B.OTXACT AND b.tmcode = c.tmcode and b.RATEPLAN_VSCODE = c.vscode and b.spcode = c.spcode and b.sncode = c.sncode and b.sncode = d.sncode and d.sncode not in (14,15,16,24,18) --and otxact = 68 select distinct B.OTXACT, B.OTSEQ,B.TMCODE,B.SPCODE,B.SNCODE from ORDERHDR_ALL A, ORDERTRAILER B Where A.OHXACT = B.OTXACT ORDERTRLR_CHARACTERISTICS|ORDERTRLR_CHARACTERISTICS_HIST NUMBER02 FinancialDocHardGoodsExtension select a.ohxact, EXT_ID lineItemNumber, NUMBER01 quantity, STRING01 transactionType, STRING02 division, STRING03 destinationLocationCode, STRING04 product, STRING05 productClass, STRING06 flexiCodeField9, STRING07 flexiCodeField10, STRING08 flexiCodeField13, STRING09 flexiCodeField14, STRING10 flexiCodeField20, STRING11 flexiNumericField3, STRING12 flexiNumericField4, STRING13 flexiNumericField5, STRING14 flexiNumericField6, STRING15 destTaxAreaId, STRING16 adminDestTaxAreaId, d.* from orderhdr_all a, ordertrailer b, ORDERTRLR_CHARACTERISTICS c, characteristics_def d where a.ohxact = b.otxact and B.OTXACT = C.OTXACT and B.OTSEQ = C.OTSEQ and C.CHAR_ID = D.CHAR_ID and D.CHAR_DES = 'FinancialDocItemVOResponse' --and a.ohxact = 11547 order by 1,2 --order by 2,3 group by c.otxact having count(*)>4 select * from ordertrailer where otxact = 11547 select * from ORDERTRAILER_TAX_ITEMS where otxact = 11547 select * from ORDERTAX_ITEMS where otxact = 11547 select * from ORDERTRLR_CHARACTERISTICS select * from ORDERTI_CHARACTERISTICS select * from ORDERTRLRTI_CHARACT SELECT C.OTXACT INVOICEINTERNALID, C.OTSEQ CHARGEITEMNUMBER, C.OTI_SEQNO TAXITEMBUMBER,c.* FROM ORDERHDR_ALL A, ORDERTRAILER B, ORDERTRAILER_TAX_ITEMS C WHERE A.OHXACT = B.OTXACT AND B.OTXACT = C.OTXACT AND B.OTSEQ = C.OTSEQ AND A.OHXACT = 11547 --IDW-02755 SELECT B.OTXACT INVOICEINTERNALID, B.OTSEQ CHARGEITEMNUMBER, C.JURISDICTION_CODE FROM ORDERHDR_ALL A, ORDERTRAILER B, JURISDICTION C WHERE A.OHXACT = B.OTXACT AND B.JURISDICTION_ID = C.JURISDICTION_ID AND A.OHXACT = 11547 --IDW-02758 SELECT C.OTXACT INVOICEINTERNALID, C.OTSEQ CHARGEITEMNUMBER, C.OTI_SEQNO TAXITEMBUMBER,D.TAXAMT_DOC, D.CHARGE_DOC, STRING09 FROM ORDERHDR_ALL A, ORDERTRAILER B, ORDERTRAILER_TAX_ITEMS C, ORDERTAX_ITEMS D, ORDERTI_CHARACTERISTICS e, CHARACTERISTICS_DEF f WHERE A.OHXACT = B.OTXACT AND B.OTXACT = C.OTXACT AND B.OTSEQ = C.OTSEQ AND C.OTXACT = D.OTXACT AND C.OTI_SEQNO = D.OTI_SEQNO and D.OTXACT = E.OTXACT and D.OTI_SEQNO = E.OTI_SEQNO and E.CHAR_ID = F.CHAR_ID and F.CHAR_DES = 'FinancialDocItemTaxVOResponse' AND A.OHXACT = 10892 select * from ORDERTI_CHARACTERISTICS SELECT JURISDICTION_ID FROM ORDERTRAILER WHERE OTXACT = 10892 -->38459 SELECT JURISDICTION_ID FROM ORDERTAX_ITEMS WHERE OTXACT = 10892 -->38459 SELECT a.NUMBER01,a.* FROM ORDERTI_CHARACTERISTICS a WHERE OTXACT = 10892 -->23018 select NUMBER01 from ORDERTI_CHARACTERISTICS_hist where otXACT = 10892 select * from ordertrailer where otXACT = 10892 select otxact,ORDERTRLR_CHAR_ID,otseq,a.char_id, b.char_des,ext_id,string01,created_date from ORDERTRLR_CHARACTERISTICS a, characteristics_def b where otxact = 2818 --and a.char_id = 18 and a.char_id = b.char_id order by 2 select distinct CHAR_DES from ( select otxact,otseq,a.char_id, b.char_des,string01, created_date, count(ext_id) from ORDERTRLR_CHARACTERISTICS a, characteristics_def b --where otxact = 238 --and a.char_id = 18 where a.char_id = b.char_id group by otxact,otseq,a.char_id, b.char_des,string01, created_date having count(*) > 1) select * from characteristics_def where char_id in (4,18,43) SELECT OT.OTXACT, OT.OTSEQ, CD.CHAR_DES, NUMBER02 FINANCIALDOCHARDGOODSEXTENSION, NUMBER02 FINANCIALDOCSOFTGOODEXTENSION, NUMBER01 FINANCIALDOCVOUCHEREXTENSION FROM ORDERHDR_ALL OH, ORDERTRAILER OT, ORDERTRLR_CHARACTERISTICS OTC, CHARACTERISTICS_DEF CD WHERE OH.OHXACT = OT.OTXACT AND OT.OTXACT = OTC.OTXACT AND OT.OTSEQ = OTC.OTSEQ AND CD.CHAR_ID = OTC.CHAR_ID AND CD.CHAR_DES IN ('FinancialDocHardGoodsExtension','FinancialDocSoftgoodExtension','FinancialDocVoucherExtension') --and ohxact = 10892 ORDER BY 1,2 SELECT B.EPC_CHARGE_ITEM, B.EPC_FEATURE, B.EPC_PROD_OFFER FROM ORDERTRAILER A, MPULKTMB B WHERE A.TMCODE = B.TMCODE AND A.RATEPLAN_VSCODE = B.VSCODE AND A.SPCODE = B.SPCODE AND A.SNCODE = B.SNCODE AND OTXACT = 8786 select distinct sncode,otname from ordertrailer --where otxact = 10892 where sncode not in (14,15,16) order by 1 select * from ordertrailer where sncode = 29
use Training sp_tables select * from Staff_Master --Self Join --Display stafff_Name who are working as Managers Select Distinct S1.Staff_Name,S1.Staff_Code as 'Managers' from Staff_Master S1 join Staff_Master S2 on S1.Staff_Code=S2.Mgr_code Select Distinct S1.Staff_code as 'Managers' from Staff_Master S1 join Staff_Master S2 on S1.Staff_Code=S2.Mgr_code
USE sakila; CREATE VIEW movies_languages AS SELECT f.title, l.language_id, l.name FROM film AS f INNER JOIN language AS l ON f.language_id = l.language_id;
-- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 04 Jan 2019 pada 02.16 -- Versi server: 10.1.35-MariaDB -- Versi PHP: 7.2.9 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: `ukmpnj` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `absen` -- CREATE TABLE `absen` ( `id_absen` int(10) NOT NULL, `id_jadwal` varchar(100) NOT NULL, `nim` int(10) NOT NULL, `ukm` varchar(100) NOT NULL, `tanggal` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `absen` -- INSERT INTO `absen` (`id_absen`, `id_jadwal`, `nim`, `ukm`, `tanggal`) VALUES (4, '8', 1316030049, 'pesoet', '2019-01-04'), (5, '8', 1316030075, 'pesoet', '2019-01-04'); -- -------------------------------------------------------- -- -- Struktur dari tabel `admin` -- CREATE TABLE `admin` ( `nim` int(10) NOT NULL, `password` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struktur dari tabel `jadwal` -- CREATE TABLE `jadwal` ( `id_jadwal` int(10) NOT NULL, `ukm` varchar(100) NOT NULL, `hari` varchar(100) NOT NULL, `mulai` time NOT NULL, `selesai` time NOT NULL, `password` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `jadwal` -- INSERT INTO `jadwal` (`id_jadwal`, `ukm`, `hari`, `mulai`, `selesai`, `password`) VALUES (7, 'pesoet', 'Senin', '17:00:00', '19:00:00', '1234'), (8, 'pesoet', 'Jumat', '12:00:00', '15:00:00', '456'); -- -------------------------------------------------------- -- -- Struktur dari tabel `jurusan` -- CREATE TABLE `jurusan` ( `id_prodi` int(10) NOT NULL, `jurusan` varchar(100) NOT NULL, `prodi` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `jurusan` -- INSERT INTO `jurusan` (`id_prodi`, `jurusan`, `prodi`) VALUES (1, 'Teknik Elektro', 'Teknik Telekomunikasi'), (2, 'Teknik Sipil', 'Teknik Konstruksi Gedung'), (3, 'Teknik Elektro', 'Teknik Elektronika Industri'), (4, 'Administrasi Niaga', 'Administrasi Bisnis'), (5, 'Teknik Mesin', 'Teknik Konversi Energi'), (6, 'Teknik Mesin', 'Teknik Alat Berat'), (7, 'Teknik Sipil', 'Manajemen Konstruksi'), (8, 'Teknik Sipil', 'Perancangan Jalan dan Jembatan'), (9, 'Teknik Mesin', 'Teknik Mesin'), (10, 'Teknik Mesin', 'Manufaktur'), (11, 'Teknik Elektro', 'Teknik Listrik'), (12, 'Teknik Elektro', 'Broadband Multimedia'), (13, 'Teknik Informatika dan Komputer', 'Teknik Informatika'), (14, 'Teknik Informatika dan Komputer', 'Teknik Multimedia dan Jaringan'), (15, 'Teknik Grafika dan Penerbitan', 'Teknik Grafika'), (16, 'Teknik Grafika dan Penerbitan', 'Desain Grafis'), (17, 'Akuntansi', 'Akuntansi'), (18, 'Akuntansi', 'Akuntansi Keuangan'); -- -------------------------------------------------------- -- -- Struktur dari tabel `mahasiswa` -- CREATE TABLE `mahasiswa` ( `nim` int(10) NOT NULL, `password` varchar(100) NOT NULL, `nama` varchar(100) NOT NULL, `jurusan` varchar(100) NOT NULL, `prodi` varchar(100) NOT NULL, `angkatan` varchar(100) NOT NULL, `no_telpon` varchar(13) NOT NULL, `ukm` varchar(100) DEFAULT NULL, `jabatan` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `mahasiswa` -- INSERT INTO `mahasiswa` (`nim`, `password`, `nama`, `jurusan`, `prodi`, `angkatan`, `no_telpon`, `ukm`, `jabatan`) VALUES (1234567890, '123', 'andi', 'Akuntansi', 'Akuntansi Keuangan', '2017', '089898989', NULL, NULL), (1316020021, '123', 'Mantap Jiwa', 'Teknik Mesin', 'Teknik Alat Berat', '2017', '0812311181', 'polbac', 'ketua'), (1316030041, '123', 'Nur Ramadhan', 'Administrasi Niaga', 'Administrasi Bisnis', '2018', '080889898', NULL, NULL), (1316030049, '123', 'Ary Utomo', 'Teknik Elektro', 'Teknik Telekomunikasi', '2016', '082121212', 'pesoet', 'ketua'), (1316030069, '1234', 'Fira', 'Teknik Elektro', 'Teknik Telekomunikasi', '2018', '00909', NULL, NULL), (1316030070, '123', 'Ganang Wijaya', 'Teknik Elektro', 'Teknik Telekomunikasi', '2016', '08567995371', NULL, NULL), (1316030072, '123', 'Hilmy Rafi', 'Teknik Elektro', 'Teknik Telekomunikasi', '2016', '087787878', NULL, NULL), (1316030075, '123', 'Jamariel', 'Teknik Elektro', 'Teknik Telekomunikasi', '2018', '0808989', NULL, NULL); -- -------------------------------------------------------- -- -- Struktur dari tabel `ukm` -- CREATE TABLE `ukm` ( `id_ukm` varchar(100) NOT NULL, `nama_ukm` varchar(100) NOT NULL, `penjelasan_ukm` varchar(10000) NOT NULL, `jenis` varchar(100) NOT NULL, `ketua` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `ukm` -- INSERT INTO `ukm` (`id_ukm`, `nama_ukm`, `penjelasan_ukm`, `jenis`, `ketua`) VALUES ('pesoet', 'Politeknik Soccer Team', 'Politeknik Soccear Teams (PESOET) merupakan UKM yang menaungi olahraga sepak bola dan futsal di PNJ', 'Olahraga', '1316030049'), ('polbac', 'Politeknik Badminton Club', 'Polbac adalah UKM yang bergerak dibidang olahraga khususnya badminton', 'Olahraga', '1316020021'); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `absen` -- ALTER TABLE `absen` ADD PRIMARY KEY (`id_absen`); -- -- Indeks untuk tabel `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`nim`); -- -- Indeks untuk tabel `jadwal` -- ALTER TABLE `jadwal` ADD PRIMARY KEY (`id_jadwal`); -- -- Indeks untuk tabel `jurusan` -- ALTER TABLE `jurusan` ADD PRIMARY KEY (`id_prodi`); -- -- Indeks untuk tabel `mahasiswa` -- ALTER TABLE `mahasiswa` ADD PRIMARY KEY (`nim`); -- -- Indeks untuk tabel `ukm` -- ALTER TABLE `ukm` ADD PRIMARY KEY (`id_ukm`); -- -- AUTO_INCREMENT untuk tabel yang dibuang -- -- -- AUTO_INCREMENT untuk tabel `absen` -- ALTER TABLE `absen` MODIFY `id_absen` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT untuk tabel `jadwal` -- ALTER TABLE `jadwal` MODIFY `id_jadwal` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT untuk tabel `jurusan` -- ALTER TABLE `jurusan` MODIFY `id_prodi` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19; 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 */;
DROP DATABASE IF EXISTS dogshelter; CREATE DATABASE IF NOT EXISTS dogshelter; USE dogshelter; /* Table structure */ CREATE TABLE dog_table( id int PRIMARY KEY auto_increment, name char(30), Breed char(30), AdoptionPrice DEC(5,2), Description text, ThumbnailImageName char (50), LargeImageName char (50) )ENGINE=InnoDB AUTO_INCREMENT=00632; Insert into dog_table (id, name, Breed, AdoptionPrice, Description, ThumbnailImageName, LargeImageName) Values (NULL,"Jack","Beagle",175.00,"Jack is a great Beagle who loves typical Beagle things like sniffing and going for walks. He is a happy dog that was found as a stray. Jack is already neutered, house-trained, purebred and up to date with shots. So, if you are looking for a nice family dog, Jack is your boy!","dogsmall1.jpg","doglarge1.jpg"), (NULL,"Kayla","Border Collie",155.00,"Kayla is an adorable little 3 1/2 month old Border Collie. Kayla was part of an unwanted litter and she is the last one that needs a home. Kayla is very sweet and a little shy. She is still learning how to walk on a leash. Kayla has been vaccinated and had a deworming.","dogsmall2.jpg","doglarge2.jpg"), (NULL,"Molly","Boston Terrier",120.00,"Molly is a 2 year old Boston Terrier who needs a good home with good people. Molly is a high energy dog, which is typical with Boston Terriers. She loves going on walks and playing with her toys. Molly is spayed, up to date with shots, good with kids, and also good with other dogs.","dogsmall3.jpg","doglarge3.jpg"), (NULL,"Rocky","American Bulldog",185.00,"Rocky is a handsome Bulldog who was rescued in Allegheny County. He has had a rough life up until now so Rocky would be best fitted for a family without kids. Rocky is neutered, purebred, up to date with shots, and is good with other dogs and cats.","dogsmall4.jpg","doglarge4.jpg"), (NULL,"Pudge","Dachshund",110.00,"Pudge is a 5 year old neutered dog. His previous owner moved into an apartment that did not allow dogs so he had to put him up for adoption. Pudge loves to play and is very social. He is already neutered, housetrained, up to date with shots, good with kids and other dogs.","dogsmall5.jpg","doglarge5.jpg"), (NULL,"Lady","German Shephard",230.00,"Lady is a 6 year old German Shepherd. It will take a while for Lady to get to know you because she has been through losing her family and being transferred between a couple shelters. She needs a family that will spend time getting to know her and give her extra attention and care. Lady is already spayed.","dogsmall6.jpg","doglarge6.jpg"), (NULL,"Foxy","Golden Retriever",250.00,"Foxy is a 3 year old Golden Retriever. We found her injured laying along the road in a rain storm. She loves little kids and adores senior citizens. Foxy is already neutered, housetrained, purebred and up to date with all shots.","dogsmall7.jpg","doglarge7.jpg"), (NULL, "Bruce","Great Dane",190.00,"Bruce is a very sweet gentleman. He loves to play and have fun but will settle down very quickly if you tell him so. Bruce is 4 years old and will make a great addition to your family. Not only is he neutered but Bruce is housetrained, up to date with shots and is good with kids, other dogs and even cats.","dogsmall8.jpg","doglarge8.jpg"), (NULL,"Mia","Siberian Husky",300.00,"Mia is a lovely 1-2 year old Siberian Husky. She is calm, sweet, smart and well behaved. She has had a difficult start in life, being picked up as a stray puppy at the age of 4 months. Mia is already spayed and is up to date with her shots.","dogsmall9.jpg","doglarge9.jpg"), (NULL,"Wrinkles","Pug",50.00,"Wrinkles is an adorable pug. He is 3 years old. He is afraid of little kids, so a place without kids would be the ideal home for Wrinkles. One of his best traits is that he loves to snuggle and will give a big yelp when he wants attention. Wrinkles is neutered, housetrained, up to date with shots and is good with other dogs and cats.","dogsmall10.jpg","doglarge10.jpg"); create table user_table( id INT PRIMARY KEY AUTO_INCREMENT, username CHAR(25), password CHAR(25), privilege ENUM("normal","admin","super") ); INSERT INTO user_table VALUES (null,"master","master","admin"); SELECT * FROM user_table; select * from dog_table; show tables; show databases; show columns from dog_table;
DROP TABLE IF EXISTS `point_system_achievement_contests`; CREATE TABLE `point_system_achievement_contests` ( `entry` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `realm` int(10) UNSIGNED NOT NULL DEFAULT '0', `achievement` int(10) UNSIGNED NOT NULL DEFAULT '0', `date_issued` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `after_only` int(10) UNSIGNED NOT NULL DEFAULT '1', `expiration` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `prize_bag` int(10) NOT NULL DEFAULT '0', `winner_guid` int(10) UNSIGNED NOT NULL DEFAULT '0', `announce` int(10) UNSIGNED NOT NULL DEFAULT '0', `announce_msg` longtext NOT NULL, `enabled` int(10) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`entry`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
SELECT first.LastName AS UserName, second.LastName AS Boss FROM Northwind.Employees first, Northwind.Employees second WHERE second.EmployeeID = first.ReportsTo -- Не выводится Fuller, потому что он никому ничего не отправляет --Запрос для проверки --SELECT LastName, ReportsTo --FROM Northwind.Employees;
-- DROP TABLE users; -- DROP TABLE questions; -- DROP TABLE question_follows; -- DROP TABLE replies; -- DROP TABLE question_likes; CREATE TABLE users ( id INTEGER PRIMARY KEY, fname VARCHAR(30) NOT NULL, lname VARCHAR(30) NOT NULL ); CREATE TABLE questions ( id INTEGER PRIMARY KEY, title VARCHAR(50) NOT NULL, body VARCHAR(250) NOT NULL, author_id INTEGER NOT NULL, FOREIGN KEY(author_id) REFERENCES users(id) ); CREATE TABLE question_follows( user_id INTEGER NOT NULL, question_id INTEGER NOT NULL, FOREIGN KEY(user_id) REFERENCES users(id), FOREIGN KEY(question_id) REFERENCES questions(id) ); CREATE TABLE replies( id INTEGER PRIMARY KEY, parent_reply_id INTEGER, user_id INTEGER NOT NULL, question_id INTEGER NOT NULL, body VARCHAR(250) NOT NULL, FOREIGN KEY(question_id) REFERENCES questions(id), FOREIGN KEY(user_id) REFERENCES users(id) ); CREATE TABLE question_likes ( user_id INTEGER NOT NULL, question_id INTEGER NOT NULL, FOREIGN KEY(user_id) REFERENCES users(id), FOREIGN KEY(question_id) REFERENCES questions(id) ); INSERT INTO users (fname, lname) VALUES ('Patrick', 'Long'), ('CJ', 'Douglas'), ('Dale', 'Douglas'), ('Stephany', 'Long'), ('Leen', 'VB'); INSERT INTO questions (title, body, author_id) VALUES ('What is a Table?', 'I dont know what a table is, please help!', 1), ('How do I Join tables?', 'I dont know and im hungry...', 2), ('Third Question?', 'I dont know and im hungry...', 2), ('Fourth Question?', 'I dont know and im hungry...', 2); INSERT INTO replies (question_id, parent_reply_id, user_id, body) VALUES (1, null, 2, 'Read the reading assigned to us man! It''s all in there.'), (1, 1, 1, 'Why you have to use dat tone tho....'); INSERT INTO question_follows (user_id, question_id) VALUES (1, 1), (1, 2), (2, 2), (3, 2), (4, 2), (5,1); INSERT INTO question_likes (user_id, question_id) VALUES (1, 3), (2, 3), (5, 3), (4, 1), (4, 4), (5, 1);
SELECT id, plan_id, to_char (apno) apno FROM plan_app_plan_permit
-- -- PostgreSQL database dump -- -- Dumped from database version 13.0 -- Dumped by pg_dump version 13.0 -- Started on 2020-10-08 10:31:24 SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; SET default_tablespace = ''; SET default_table_access_method = heap; -- -- TOC entry 200 (class 1259 OID 16437) -- Name: fingerprints; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.fingerprints ( id integer NOT NULL, hashe character varying, id_music integer ); ALTER TABLE public.fingerprints OWNER TO postgres; -- -- TOC entry 201 (class 1259 OID 16443) -- Name: music; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.music ( id integer NOT NULL, titre character varying, idvideo character varying ); ALTER TABLE public.music OWNER TO postgres; -- -- TOC entry 202 (class 1259 OID 16449) -- Name: music_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.music_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.music_id_seq OWNER TO postgres; -- -- TOC entry 2995 (class 0 OID 0) -- Dependencies: 202 -- Name: music_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.music_id_seq OWNED BY public.music.id; -- -- TOC entry 2856 (class 2604 OID 16454) -- Name: music id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.music ALTER COLUMN id SET DEFAULT nextval('public.music_id_seq'::regclass); -- -- TOC entry 2858 (class 2606 OID 16456) -- Name: music music_pk; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.music ADD CONSTRAINT music_pk PRIMARY KEY (id); -- -- TOC entry 2859 (class 2606 OID 16457) -- Name: fingerprints fingerprints_music_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.fingerprints ADD CONSTRAINT fingerprints_music_id_fk FOREIGN KEY (id_music) REFERENCES public.music(id); ALTER TABLE ONLY public.fingerprints ADD CONSTRAINT fingerprints_pk PRIMARY KEY (id); -- Completed on 2020-10-08 10:31:25 -- -- PostgreSQL database dump complete -- CREATE INDEX hashe_index ON public.fingerprints (hashe); -- Table: public.buffer -- DROP TABLE public.buffer; CREATE TABLE public.buffer ( hashe character varying COLLATE pg_catalog."default", id_user integer ) TABLESPACE pg_default; ALTER TABLE public.buffer OWNER to postgres; -- Index: buffer_hashe_hashe1_idx -- DROP INDEX public.buffer_hashe_hashe1_idx; CREATE INDEX buffer_hashe_hashe1_idx ON public.buffer USING btree (hashe COLLATE pg_catalog."default" ASC NULLS LAST) INCLUDE(hashe) TABLESPACE pg_default; CREATE TABLE public.history ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 0 MINVALUE 0 MAXVALUE 99999999 CACHE 1 ), id_video character varying(255) COLLATE pg_catalog."default", id_user integer, CONSTRAINT history_pkey PRIMARY KEY (id) ) TABLESPACE pg_default; ALTER TABLE public.history OWNER to postgres;
CREATE TABLE diagnosticos_leite ( codigo BIGINT(20) PRIMARY KEY AUTO_INCREMENT, tiragem VARCHAR(20) NOT NULL, data_diagnostico DATE NOT NULL, responsavel VARCHAR(50) NOT NULL, agua DOUBLE NOT NULL, lactose DOUBLE NOT NULL, gordura DOUBLE NOT NULL, proteina DOUBLE NOT NULL, minerais DOUBLE NOT NULL, acidos_organicos DOUBLE NOT NULL, outros VARCHAR(50), observacao VARCHAR(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#/************************************************** # Coppermine 1.6.x Plugin - Picture Annotation (annotate) # ************************************************* # Copyright (c) 2003-2019 Coppermine Dev Team # ************************************************* # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # **************************************************/ CREATE TABLE IF NOT EXISTS `CPG_plugin_annotate` ( nid smallint(5) unsigned NOT NULL auto_increment, pid mediumint(8) unsigned NOT NULL, posx smallint(5) unsigned NOT NULL, posy smallint(5) unsigned NOT NULL, width smallint(5) unsigned NOT NULL, height smallint(5) unsigned NOT NULL, note text NOT NULL, user_id smallint(5) unsigned NOT NULL, PRIMARY KEY (nid) );
CREATE PROCEDURE [sp_update_Country] (@CountryID_1 [int], @CountryID_2 [int], @Country_3 [nvarchar](50), @Active_4 [int]) AS UPDATE [Country] SET [Country] = @Country_3, [Active] = @Active_4 WHERE ( [CountryID] = @CountryID_1)
--Script para popular tabela de usuario INSERT INTO `tb_usuario` (`id`,`nome`, `email`, `password`) VALUES (1,'User 1','admin@gmail.com','123'); INSERT INTO `tb_usuario` (`id`,`nome`, `email`, `password`) VALUES (2,'User 2','teste@gmail.com','123');
UPDATE `topic_callbacks` SET `topic` = ? WHERE `id` = ?;
-- CreateEnum CREATE TYPE "UserType" AS ENUM ('STUDENT', 'TEACHER'); -- CreateTable CREATE TABLE "user" ( "id" TEXT NOT NULL, "email" TEXT NOT NULL, "name" TEXT, "type" "UserType" NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "user_pkey" PRIMARY KEY ("id") ); -- CreateIndex CREATE UNIQUE INDEX "user_email_key" ON "user"("email");
SET SESSION FOREIGN_KEY_CHECKS=0; /* Drop Tables */ DROP TABLE BOARD; DROP TABLE BRANCHLOG; DROP TABLE CUSTOMINFO; DROP TABLE BRANCH; DROP TABLE PHONEMODEL; DROP TABLE PHONEPRICE; /* Create Tables */ CREATE TABLE BOARD ( SEQ DECIMAL NOT NULL, BOARD_CHK DECIMAL(2) NOT NULL, TITLE VARCHAR(100) NOT NULL, CONTENT VARCHAR(4000) NOT NULL, READCOUNT DECIMAL DEFAULT 0, RP_SEQ DECIMAL DEFAULT 0, WRITE_DATE DATE DEFAULT NOW(), SYSDATE(), WRITE_IP VARCHAR(20), BRC_ID VARCHAR(20) NOT NULL, PRIMARY KEY (SEQ) ); CREATE TABLE BRANCH ( SEQ DECIMAL NOT NULL UNIQUE, BRC_ID VARCHAR(20) NOT NULL, ATTACH_ID VARCHAR(20), PASSWORD VARCHAR(20) NOT NULL, BRC_NAME VARCHAR(30) NOT NULL, BRC_PHONE VARCHAR(12), BRC_ADDR1 VARCHAR(50), BRC_ADDR2 VARCHAR(50), BRC_POST VARCHAR(8), BRC_BOSS VARCHAR(20) NOT NULL, BOSS_PHONE VARCHAR(12), BRC_LEV DECIMAL(2) DEFAULT 0, BRC_STATE DECIMAL(2) DEFAULT 0, WRITE_ID VARCHAR(20), WRITE_DATE DATE DEFAULT NOW(), SYSDATE(), WRITE_IP VARCHAR(20), PRIMARY KEY (BRC_ID) ); CREATE TABLE BRANCHLOG ( SEQ DECIMAL NOT NULL, LOG_DATE DATE DEFAULT NOW(), SYSDATE(), LOG_IP VARCHAR(20) NOT NULL, BRC_ID VARCHAR(20) NOT NULL, PRIMARY KEY (SEQ) ); CREATE TABLE CUSTOMINFO ( SEQ DECIMAL NOT NULL, CUST_NAME VARCHAR(20), CUST_PHONE VARCHAR(20), CONT_TERM VARCHAR(20) NOT NULL, OPEN_DATE DATE NOT NULL, MEMO VARCHAR(4000), WRITE_DATE DATE DEFAULT NOW(), SYSDATE(), WRITE_IP VARCHAR(20), BRC_ID VARCHAR(20) NOT NULL, PRICE_NAME VARCHAR(50) NOT NULL, MODEL_CODE VARCHAR(50) NOT NULL, PRIMARY KEY (SEQ) ); CREATE TABLE PHONEMODEL ( SEQ DECIMAL NOT NULL UNIQUE, MODEL_CODE VARCHAR(50) NOT NULL, MODEL_NAME VARCHAR(50) NOT NULL, FILENAME VARCHAR(100) NOT NULL, OPEN_DATE DATE NOT NULL, WRITE_DATE DATE DEFAULT NOW(), SYSDATE(), WRITE_IP VARCHAR(20), PRIMARY KEY (MODEL_CODE) ); CREATE TABLE PHONEPRICE ( SEQ DECIMAL NOT NULL UNIQUE, PRICE_NAME VARCHAR(50) NOT NULL, PRICE DECIMAL(8) NOT NULL, USE_CALL VARCHAR(100), USE_SMS VARCHAR(100), USE_DATA VARCHAR(100), MEMO VARCHAR(500), WRITE_DATE DATE DEFAULT NOW(), SYSDATE(), WRITE_IP VARCHAR(20), PRIMARY KEY (PRICE_NAME) ); /* Create Foreign Keys */ ALTER TABLE BOARD ADD FOREIGN KEY (BRC_ID) REFERENCES BRANCH (BRC_ID) ON UPDATE RESTRICT ON DELETE RESTRICT ; ALTER TABLE BRANCHLOG ADD FOREIGN KEY (BRC_ID) REFERENCES BRANCH (BRC_ID) ON UPDATE RESTRICT ON DELETE RESTRICT ; ALTER TABLE CUSTOMINFO ADD FOREIGN KEY (BRC_ID) REFERENCES BRANCH (BRC_ID) ON UPDATE RESTRICT ON DELETE RESTRICT ; ALTER TABLE CUSTOMINFO ADD FOREIGN KEY (MODEL_CODE) REFERENCES PHONEMODEL (MODEL_CODE) ON UPDATE RESTRICT ON DELETE RESTRICT ; ALTER TABLE CUSTOMINFO ADD FOREIGN KEY (PRICE_NAME) REFERENCES PHONEPRICE (PRICE_NAME) ON UPDATE RESTRICT ON DELETE RESTRICT ;
CREATE DATABASE TABLA_PERIODICA; SET DATEFORMAT dmy; CREATE TABLE USUARIOS ( NOMBRE NVARCHAR(50), APELLIDO NVARCHAR(50), TIPO_USUARIO CHAR(3), MAIL NVARCHAR(50) PRIMARY KEY, CONTRASENIA NVARCHAR(50) ) CREATE TABLE TIPO_ELEMENTO ( ID INT PRIMARY KEY, NOMBRE NVARCHAR(30) ); CREATE TABLE ELEMENTO ( NRO_ATOMICO INT PRIMARY KEY, NOMBRE NVARCHAR(40) NOT NULL, SIMBOLO NVARCHAR(3) NOT NULL, MASA_ATOMICA NVARCHAR(10) NOT NULL, TIPO INT NOT NULL FOREIGN KEY REFERENCES TIPO_ELEMENTO(ID), GRUPO INT NOT NULL, PERIODO INT NOT NULL ); CREATE TABLE DETALLE ( NRO_ATOMICO INT PRIMARY KEY, URL NVARCHAR(60), DETALLE NVARCHAR(1000) ); CREATE TABLE MENSAJES ( ID_MENSAJE INT PRIMARY KEY IDENTITY(1,1), DE_USUARIO NVARCHAR(50) NOT NULL FOREIGN KEY REFERENCES USUARIOS(MAIL), A_USUARIO NVARCHAR(50) NOT NULL FOREIGN KEY REFERENCES USUARIOS(MAIL), PREGUNTA NVARCHAR(200) NOT NULL, RESPUESTA NVARCHAR(200) NOT NULL, ELEMENTO INT FOREIGN KEY REFERENCES ELEMENTO(NRO_ATOMICO), FECHA DATETIME ); CREATE TABLE CONFIGURACION ( ID NVARCHAR(30) PRIMARY KEY, VALOR NVARCHAR(60) );
SELECT v1.vendor_id, SUM(i.invoice_total) AS invoice_total_sum FROM vendors v1 JOIN invoices i ON i.vendor_id = v1.vendor_id GROUP BY v1.vendor_id ORDER BY v1.vendor_id ASC; /* Write a SELECT statement that returns one row for each vendor in the Invoices table that contains these columns: The vendor_id column from the Vendors table The sum of the invoice_total columns in the Invoices table for that vendor This should return 34 rows. */
CREATE TABLE `browse_node_product` ( `browse_node_id` bigint(10) unsigned NOT NULL, `product_id` int(10) unsigned NOT NULL, `sales_rank` int(10) unsigned DEFAULT NULL, `order` TINYINT(2) unsigned NOT NULL, PRIMARY KEY (`browse_node_id`, `product_id`), UNIQUE `product_id_order` (`product_id`, `order`), CONSTRAINT `browse_node_browse_node_product` FOREIGN KEY (`browse_node_id`) REFERENCES `browse_node` (`browse_node_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `product_browse_node_product` FOREIGN KEY (`product_id`) REFERENCES `product` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE "public"."Certification";
-- user_group_user_map -- -- This table contains what users belong in what user groups. CREATE TABLE user_group_user_map ( user_group_id NUMBER NOT NULL REFERENCES user_groups(id), -- The group associated with this record user_id NUMBER NOT NULL REFERENCES users(id), -- The user associated with this record PRIMARY KEY(user_group_id, user_id) );
insert into prueba(nombre,dni) values ("Mátias bribío",3421); insert into prueba(nombre,dni) values ("Juán ñaño",34); insert into prueba(nombre,dni) values ("Teófilo nñaña",324); insert into prueba(nombre,dni) values ("Ma'cos sunña",34); insert into prueba(nombre,dni) values ("óiasd ñbío",23); insert into prueba(nombre,dni) values ("Máññias Ríchapa",45);
set linesi 100 trimspool on pagesi 50 col grantee format a15 col privilege format a10 col priv_type format a10 col object_name format a30 select grantee, privilege, owner||'.'||table_name object_name, 'OBJECT' priv_type from dba_tab_privs where table_name = upper('&1');
SELECT CityName, ProductCategory.Name FROM (SELECT City AS CityName, SUM(SalesOrderHeader.SalesOrderID) AS TotalOrders, SalesOrderDetail.ProductID FROM Address JOIN SalesOrderHeader ON (Address.AddressID = SalesOrderHeader.ShipToAddressID) JOIN SalesOrderDetail ON (SalesOrderHeader.SalesOrderID = SalesOrderDetail.SalesOrderID) GROUP BY CityName ORDER BY TotalOrders DESC LIMIT 3) T1 INNER JOIN ProductAW ON (T1.ProductID = ProductAW.ProductID) JOIN ProductCategory ON (ProductAW.ProductCategoryID = ProductCategory.ProductCategoryID);
-- 09.12.2008 19:27:42 EET -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Val_Rule_ID=189,Updated=TO_TIMESTAMP('2008-12-09 19:27:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53824 ; -- 09.12.2008 19:27:47 EET -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator insert into t_alter_column values('pp_cost_collector','M_Warehouse_ID','NUMERIC(10)',null,'NULL') ; -- 09.12.2008 19:54:39 EET -- [ 2412212 ] Fix Activity Control Report Window INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52035,'PP_Order_Node.PP_Order_Workflow_ID=@PP_Order_Workflow_ID@',TO_TIMESTAMP('2008-12-09 19:54:37','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','PP_Order_Node of PP_Order_Workflow','S',TO_TIMESTAMP('2008-12-09 19:54:37','YYYY-MM-DD HH24:MI:SS'),0) ; -- 09.12.2008 19:55:25 EET -- [ 2412212 ] Fix Activity Control Report Window UPDATE AD_Column SET AD_Val_Rule_ID=52035,Updated=TO_TIMESTAMP('2008-12-09 19:55:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53831 ; -- 09.12.2008 19:55:29 EET -- [ 2412212 ] Fix Activity Control Report Window insert into t_alter_column values('pp_cost_collector','PP_Order_Node_ID','NUMERIC(10)',null,'NULL') ; -- 09.12.2008 20:11:54 EET -- [ 2412212 ] Fix Activity Control Report Window INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52036,'PP_Order_Workflow.PP_Order_ID=@PP_Order_ID@',TO_TIMESTAMP('2008-12-09 20:11:53','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','PP_Order_Workflow_ID of PP_Order_ID','S',TO_TIMESTAMP('2008-12-09 20:11:53','YYYY-MM-DD HH24:MI:SS'),0) ; -- 09.12.2008 20:14:34 EET -- [ 2412212 ] Fix Activity Control Report Window UPDATE AD_Column SET AD_Val_Rule_ID=52036,Updated=TO_TIMESTAMP('2008-12-09 20:14:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53832 ; update AD_Val_Rule set entitytype='EE01' where AD_Val_Rule_ID in (52035, 52036); -- 09.12.2008 21:53:16 EET -- [ 2412212 ] Fix Activity Control Report Window UPDATE AD_Column SET AD_Val_Rule_ID=164,Updated=TO_TIMESTAMP('2008-12-09 21:53:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53806 ;
-- adding genre's to movies /* insert into movieGenre (movieID, genreID) values (1,1), (1,2), (2,3), (2,4), (2,5), (3,1), (3,2), (4,1), (4,2), (5,1), (5,3), (5,5), (5,6), (6,4), (7,7); */ -- adding credits to actors /* insert into credit (movieID, actorID, role) values (1, 1, 'Hi McDunnough'), (1, 2, 'Ed McDunnough'), (1, 3, 'Gale Snoats'), (2, 4, 'Marge Gunderson'), (2, 5, 'Jerry Lundegaard'), (2, 6, 'Carl Showalter'), (3, 3, 'Walter Sobchak'), (3, 6, 'Donny Kerabatsos'), (3, 8, 'Jeffrey Lebowski'), (3, 9, 'Maude Lebowski'), (3, 10, 'Jesus Quintana'), (4, 3, 'Daniel Teague'), (4, 2, 'Penny Wharvey-McGill'), (4, 10, 'Pete Hogwallop'), (4, 7, 'Ulysses Everett McGill'), (4, 11, 'Delmar ODonnell'), (5, 12, 'Ed Tom Bell'), (5, 13, 'Anton Chigurh'), (5, 14, 'Llewlyn Moss'), (6, 4, 'Linda Litzke'), (6, 7, 'Harry Pfarrer'), (6, 15, 'Osbourne Cox'), (6, 16, 'Katie Cox'), (6, 17, 'Ted'), (6, 18, 'Chad Feldheimer'), (7, 8, 'Rooster Cogburn'), (7, 14, 'Tom Chaney'), (7, 19, 'Texas Ranger LaBoeuf'), (7, 20, 'Lucky Ned Pepper'), (7, 21, 'Mattie Ross'); */ select * from movie; select * from actors; -- birthdate check older & younger select count(*) from actor where birthDate < '1984-01-23'; select count(*) from actor where birthDate > '1984-01-23'; select * from actor where birthdate < '1984-01-23'; -- list actors from one movie without join select * from credit where movieID = 3; -- list actors from one movie with join select concat(a.firstName, ' ', a.lastName) as 'Actor' from actor a join credit c on a.ID = c.actorID where c.movieID = 3; -- list of movie titles, actors and their roles select m.title as 'Title', m.year as 'Year', concat(a.firstName, ' ', a.lastName) as 'Actor', c.role as 'Role' from movie m join credit c on m.ID = c.movieID join actor a on a.ID = c.actorID; -- list all movies and associated actors select title, year, concat(a.firstName, " ", a.lastName) from movie m join credit c on c.movieID = m.ID join actor a on c.actorID = a.ID; -- another way to join select * from actor, credit where actor.id = credit.actorID; -- select a movie by name select id from movie where title = 'The Big Lebowski'; -- genres for each movie select m.title as 'Title', group_concat(genre.name) as 'Genre' from movie m join movieGenre g on m.ID = g.movieID join genre on g.genreID = genre.ID group by m.title; -- specific movie, genre, actors and characters select m.title as 'Title', concat(genre.name) as 'Genre', concat(a.firstName, ' ', a.lastName) as 'Actors', c.role as 'Roles' from movie m join movieGenre g on m.ID = g.movieID join genre on g.genreID = genre.ID right join credit c on c.movieID = m.id right join actor a on a.ID = c.actorID where m.title = 'The Big Lebowski'; -- all movies, genre's, actors and characters select m.title as 'Title', group_concat(distinct g.name separator ', ') as 'Genre', group_concat(distinct a.firstName, ' ', a.lastName separator ', ') as 'Actors', group_concat(distinct c.role separator ', ') as 'Characters' from credit c join actor a on a.ID = c.actorID join movie m on m.ID = c.movieID join movieGenre mg on m.ID = mg.movieID join genre g on mg.genreID = g.ID group by m.title; -- list? select m.title as 'Movie Name', g.name as 'Movie Genre', concat(a.firstName, " ", a.lastName) as 'Actor', c.role as 'Role' from movie m join credit c on m.ID = c.movieID left join actor a on c.actorID = a.ID left join movieGenre mg on mg.movieID = m.ID left join genre g on mg.genreID = g.ID; -- multiple joins select * from movie m join movieGenre mg on mg.movieID = m.ID join genre g on g.ID = mg.genreID join credit c on c.movieID = m.ID join actor a on a.ID = c.actorID; select * from movie m left join movieGenre mg on mg.movieID = m.ID left join genre g on g.ID = mg.genreID group by m.title;
CREATE TABLE courses ( id int NOT NULL, coursename varchar(255) NOT NULL, CONSTRAINT courses_pk PRIMARY KEY (id) ); CREATE TABLE users ( id int NOT NULL, username varchar(255) NOT NULL, password varchar(255) NOT NULL, courses_id int NULL, CONSTRAINT users_pk PRIMARY KEY (id) ); ALTER TABLE users ADD CONSTRAINT users_courses FOREIGN KEY users_courses (courses_id) REFERENCES courses (id);
--CASE USE RamenShopBDDK --Cases are answered with query in number order --1 SELECT RD.RamenID, RamenName, [Total Ingredient] = CAST(COUNT(RD.IngredientID) AS VARCHAR) + ' Ingredients' FROM RecipeDetail RD JOIN RsRamen RR ON RR.RamenID = RD.RamenID JOIN RsIngredient RI ON RI.IngredientID = RD.IngredientID WHERE IngredientStock < 25 GROUP BY RD.RamenID, RamenName HAVING COUNT(RD.IngredientID) > 1 --2 SELECT [Number of Sales] = COUNT(STD.SalesTransactionID), CustomerName, [Gender] = LEFT(CustomerGender,1), StaffName FROM SalesTransactionDetail STD JOIN SalesTransaction ST ON ST.SalesTransactionID = STD.SalesTransactionID JOIN RsCustomer RC ON RC.CustomerID = ST.CustomerID JOIN RsStaff RS ON RS.StaffID = ST.StaffID WHERE StaffGender LIKE 'Female' AND DATEDIFF(YEAR,StaffDOB,CustomerDOB) > 5 GROUP BY STD.SalesTransactionID, CustomerName, StaffName, CustomerGender ORDER BY CustomerName --3 SELECT [Purchase Date] = CONVERT(VARCHAR,PurchaseTransactionDate,103), StaffName, SupplierName, [Total Ingredient] = COUNT(PTD.IngredientID), [Total Quantity] = SUM(IngredientQty) FROM PurchaseTransaction PT JOIN PurchaseTransactionDetail PTD ON PTD.PurchaseTransactionID = PT.PurchaseTransactionID JOIN RsStaff RS ON RS.StaffID = PT.StaffID JOIN RsSupplier RSU ON RSU.SupplierID = PT.SupplierID WHERE YEAR(PurchaseTransactionDate) = 2016 AND LEN(SupplierName) < 15 GROUP BY PurchaseTransactionDate, StaffName, SupplierName --4 SELECT CustomerName, CustomerPhone, [Sales Day] = DATENAME(WEEKDAY,SalesTransactionDate), [Variant Ramen Sold] = COUNT(STD.RamenID) FROM SalesTransactionDetail STD JOIN SalesTransaction ST ON ST.SalesTransactionID = STD.SalesTransactionID JOIN RsCustomer RC ON RC.CustomerID = ST.CustomerID WHERE MONTH(SalesTransactionDate) = 3 GROUP BY DATENAME(WEEKDAY,SalesTransactionDate), CustomerName, CustomerPhone HAVING SUM(RamenQty) > 10 --5 SELECT [PurchaseID] = PTD.PurchaseTransactionID, [RamenIngredientName] = IngredientName, [Quantity] = IngredientQty, StaffName, [Staff Phone] = REPLACE(StaffPhone,'0','+62'), [Staff Salary] = 'Rp. ' + CAST(StaffSalary AS VARCHAR) FROM PurchaseTransactionDetail PTD JOIN PurchaseTransaction PT ON PT.PurchaseTransactionID = PTD.PurchaseTransactionID JOIN RsIngredient RI ON RI.IngredientID = PTD.IngredientID JOIN RsStaff RS ON RS.StaffID = PT.StaffID WHERE YEAR(PurchaseTransactionDate) = 2017 AND StaffSalary > ( SELECT AVG(StaffSalary) AS SS FROM RsStaff ) ORDER BY PTD.PurchaseTransactionID ASC --6 SELECT [Staff ID] = REPLACE(RS.StaffID,'ST','Staff'), StaffName, [Sales Date] = CONVERT(VARCHAR,SalesTransactionDate,107), [Quantity] = SUM(RamenQty) FROM SalesTransactionDetail STD JOIN SalesTransaction ST ON ST.SalesTransactionID = STD.SalesTransactionID JOIN RsStaff RS ON RS.StaffID = ST.StaffID WHERE LEN(StaffName) >=3 AND StaffSalary < ( SELECT AVG(StaffSalary) AS SS FROM RsStaff ) GROUP BY STD.SalesTransactionID, RS.StaffID, StaffName, SalesTransactionDate --7 SELECT [Total Ramen Sold] = SUM(RamenQty), [Customer Last Name] = SUBSTRING(CustomerName,CHARINDEX(' ',CustomerName)+1,LEN(CustomerName)), StaffName, [SalesDate] = SalesTransactionDate FROM SalesTransactionDetail STD JOIN SalesTransaction ST ON ST.SalesTransactionID = STD.SalesTransactionID JOIN RsCustomer RC ON RC.CustomerID = ST.CustomerID JOIN RsStaff RS ON RS.StaffID = ST.StaffID WHERE LEN(CustomerName) > 15 AND RamenQty < ( SELECT AVG(RamenQty) AS RQ FROM SalesTransactionDetail ) GROUP BY STD.SalesTransactionID, CustomerName, StaffName, SalesTransactionDate --8 SELECT [SalesID] = STD.SalesTransactionID, CustomerName, [Gender] = LEFT(CustomerGender,1), [Ramen Name] = RamenName, [Total Price] = CAST(RamenQty*RamenPrice AS VARCHAR) + ' IDR' FROM SalesTransactionDetail STD JOIN SalesTransaction ST ON ST.SalesTransactionID = STD.SalesTransactionID JOIN RsCustomer RC ON RC.CustomerID = ST.CustomerID JOIN RsRamen RR ON RR.RamenID = STD.RamenID WHERE DATEDIFF(YEAR,CustomerDOB,GETDATE()) < 17 AND RamenPrice > ( SELECT MIN(RamenPrice) AS RP FROM RsRamen ) ORDER BY STD.SalesTransactionID ASC --9 CREATE VIEW ViewSales AS( SELECT CustomerName, [Number of Sales] = COUNT(STD.SalesTransactionID), [Total Price] = SUM(RamenPrice*RamenQty) FROM SalesTransactionDetail STD JOIN SalesTransaction ST ON ST.SalesTransactionID = STD.SalesTransactionID JOIN RsCustomer RC ON RC.CustomerID = ST.CustomerID JOIN RsRamen RR ON RR.RamenID = STD.RamenID WHERE YEAR(SalesTransactionDate) < 2017 AND ST.CustomerID IN( SELECT CustomerID FROM RsCustomer WHERE CustomerAddress LIKE 'Pasar%' ) GROUP BY CustomerName ) --10 CREATE VIEW PurchaseDetail AS( SELECT [Number of Item Purchased] = CAST(SUM(IngredientQty) AS VARCHAR) + ' Pcs', [Number of Transaction] = COUNT(PTD.PurchaseTransactionID), SupplierName, StaffName FROM PurchaseTransaction PT JOIN PurchaseTransactionDetail PTD ON PTD.PurchaseTransactionID = PT.PurchaseTransactionID JOIN RsSupplier RSU ON RSU.SupplierID = PT.SupplierID JOIN RsStaff RS ON RS.StaffID = PT.StaffID WHERE YEAR(PurchaseTransactionDate) = 2016 AND StaffGender LIKE 'Male' GROUP BY StaffName, SupplierName )
-- phpMyAdmin SQL Dump -- version 3.3.8.1 -- http://www.phpmyadmin.net -- -- Host: sql -- Erstellungszeit: 10. Januar 2013 um 05:31 -- Server Version: 5.1.66 -- PHP-Version: 5.3.8 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Datenbank: `u_fschulenburg` -- -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `universities` -- CREATE TABLE IF NOT EXISTS `universities` ( `university_id` int(11) NOT NULL AUTO_INCREMENT, `university_name` text NOT NULL, `university_city` text NOT NULL, `university_country` text NOT NULL, PRIMARY KEY (`university_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=91 ; -- -- Daten für Tabelle `universities` -- INSERT INTO `universities` (`university_id`, `university_name`, `university_city`, `university_country`) VALUES (1, 'George Washington University', 'Washington, D.C.', 'United States'), (2, 'Georgetown University', 'Washington, D.C.', 'United States'), (3, 'Harvard University', 'Boston', 'United States'), (4, 'Indiana University', 'Bloomington', 'United States'), (5, 'James Madison University', 'Harrisonburg', 'United States'), (6, 'Lehigh University', 'Bethlehem', 'United States'), (7, 'Syracuse University', 'Syracuse', 'United States'), (8, 'University of California, Berkeley', 'Berkeley', 'United States'), (9, 'Louisiana State University', 'Baton Rouge', 'United States'), (10, 'Michigan State University', 'East Lansing', 'United States'), (11, 'Montana State University - Bozeman', 'Bozeman', 'United States'), (12, 'New York University', 'New York City', 'United States'), (13, 'San Francisco State University', 'San Francisco', 'United States'), (14, 'Santa Clara University', 'Santa Clara', 'United States'), (15, 'Simmons College (Massachusetts)', 'Boston', 'United States'), (16, 'Texas Southern University', 'Houston', 'United States'), (17, 'Troy University', 'Troy', 'United States'), (18, 'University of Kentucky', 'Lexington', 'United States'), (19, 'University of San Francisco', 'San Francisco', 'United States'), (20, 'Virginia Polytechnic Institute and State University', 'Blacksburg', 'United States'), (21, 'Western Carolina University', 'Cullowhee', 'United States'), (22, 'Winona State University', 'Winona', 'United States'), (23, 'Boston University', 'Boston', 'United States'), (24, 'College of Engineering, Pune', 'Pune', 'India'), (25, 'Symbiosis School of Economics', 'Pune', 'India'), (26, 'SNDT Women''s University', 'Pune', 'India'), (27, 'Nanjing Normal University', 'Nanjing', 'China'), (28, 'Georgia Gwinnett College', 'Lawrenceville, Georgia', 'United States'), (29, 'Georgia Southern University', 'Statesboro', 'United States'), (30, 'Illinois State University', 'Normal, Illinois', 'United States'), (31, 'Lansing Community College', 'Lansing, Michigan', 'United States'), (32, 'Mills College', 'Oakland, California', 'United States'), (33, 'Southern Connecticut State University', 'Connecticut', 'United States'), (34, 'St. Charles Community College', 'St. Louis, Missouri', 'United States'), (35, 'University of Massachusetts Amherst', 'Amherst, Massachusetts', 'United States'), (36, 'University of Pittsburgh', 'Pittsburgh, Pennsylvania', 'United States'), (37, 'University of Southern Indiana', 'Vanderburgh County, Indiana', 'United States'), (38, 'University of Wisconsin-Madison', 'Madison, Wisconsin', 'United States'), (39, 'Davidson College', 'Davidson, North Carolina', 'United States'), (40, 'College of Staten Island', 'Staten Island, New York', 'United States'), (41, 'Yale University', 'New Haven, Connecticut', 'United States'), (42, 'Western Washington University', 'Bellingham, Washington', 'United States'), (43, 'New Jersey Institute of Technology', 'Newark, New Jersey', 'United States'), (44, 'University of Toronto', 'Toronto', 'Canada'), (45, 'University of Toronto Scarborough', 'Toronto', 'Canada'), (46, 'University of Alberta Augustana Faculty', 'Camrose, Alberta', 'Canada'), (47, 'Alverno College', 'Milwaukee', 'United States'), (48, 'Ball State University', 'Muncie, Indiana', 'United States'), (49, 'Clemson University', 'Clemson, South Carolina', 'United States'), (50, 'The College of New Jersey', 'Ewing Township, New Jersey', 'United States'), (51, 'Drake University', 'Des Moines, Iowa', 'United States'), (52, 'Gonzaga University', 'Spokane, Washington', 'United States'), (53, 'Peer 2 Peer University', '', 'United States'), (54, 'University of Alabama', 'Tuscaloosa, Alabama', 'United States'), (55, 'University of Michigan', 'Ann Arbor, Michigan', 'United States'), (56, 'University of Washington', 'Seattle', 'United States'), (57, 'University of Western Ontario', 'London, Ontario', 'Canada'), (58, 'Mount Allison University', 'Sackville, New Brunswick', 'Canada'), (59, 'Carleton University', 'Ottawa, Ontario', 'Canada'), (60, 'Hunter College, City University of New York', 'New York', 'United States'), (61, 'Gustavus Adolphus College', 'St. Peter, Minnesota', 'United States'), (62, 'Wake Forest University', 'Winston-Salem, North Carolina', 'United States'), (63, 'Shenandoah University', 'Winchester, Virginia', 'United States'), (64, 'Graduate Center, City University of New York', 'New York', 'United States'), (65, 'University of Arizona', 'Tucson, Arizona', 'United States'), (66, 'Rice University', 'Houston, Texas', 'United States'), (67, 'California Maritime Academy', 'Vallejo, California', 'United States'), (68, 'Ohio University', 'Athens, Ohio', 'United States'), (69, 'Indiana University - Purdue University Indianapolis', 'Indianapolis', 'United States'), (70, 'Northwestern University', 'Evanston and Chicago, Illinois', 'United States'), (71, 'McMaster University', 'Hamilton, Ontario', 'Canada'), (72, 'Mount Royal University', 'Calgary, Alberta', 'Canada'), (73, 'University of Utah', 'Salt Lake City, Utah', 'United States'), (74, 'George Fox University', 'Newberg, Oregon', 'United States'), (75, 'University of New Haven', 'West Haven, Connecticut', 'United States'), (76, 'Jackson Community College', 'Jackson County, Michigan', 'United States'), (77, 'University of Toronto Mississauga', 'Mississauga, Ontario', 'Canada'), (78, 'University of South Carolina', 'Columbia, South Carolina', 'United States'), (79, 'Philipps-Universität Marburg', 'Marburg', 'Germany'), (80, 'Martin-Luther-Universität Halle-Wittenberg', 'Halle (Saale) und Wittenberg', 'Germany'), (81, 'Cairo University', 'Cairo', 'Egypt'), (82, 'Ain Shams University', 'Cairo', 'Egypt'), (83, 'Carnegie Mellon University', 'Pittsburgh, Pennsylvania', 'United States'), (84, 'University of British Columbia', 'Vancouver', 'Canada'), (85, 'Universidade Estadual Paulista', 'São Paulo', 'Brazil'), (86, 'Universidade de São Paulo', 'São Paulo', 'Brazil'), (87, 'Universidade Federal do Rio de Janeiro', 'Rio de Janeiro', 'Brazil'), (88, 'Universität Potsdam', 'Potsdam', 'Germany'), (89, 'Hochschule der Medien', 'Stuttgart', 'Germany'), (90, 'Ludwig-Maximilians-Universität München', 'München', 'Germany');
CREATE DATABASE cjava; USE cjava ; CREATE TABLE Proveedores ( idProveedor char(5) NOT NULL, RazonSocial varchar(60) NOT NULL, Direccion varchar(60) NOT NULL, Ruc varchar(11) NOT NULL, Telefono varchar(15) NOT NULL, PRIMARY KEY (idProveedor) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Empleados ( idEmpleado char(5) NOT NULL, Apellido varchar(40) NOT NULL, Nombre varchar(30) NOT NULL, Email varchar(50) NOT NULL, Usuario varchar(20) NOT NULL, Clave varchar(20) NOT NULL, PRIMARY KEY (idEmpleado) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Categorias ( idCategoria int(2) not null, Nombre varchar(20) NOT NULL, Descripcion varchar(60) null, PRIMARY KEY (idCategoria) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Productos ( idProducto char(5), Descripcion varchar(50) NOT NULL, IdCategoria int(2) NOT NULL, PrecioCompra decimal(18,2) NOT NULL, PrecioVenta decimal(18,2) NOT NULL, Stock int(5) NOT NULL, PRIMARY KEY (idProducto) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Clientes( idCliente char(5) NOT NULL, Nombre varchar(60) NOT NULL, Direccion varchar(60) NOT NULL, RucDNI varchar(11) NOT NULL, Telefono varchar(15) NOT NULL, PRIMARY KEY (idCliente) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Ventas ( idVenta int(5) NOT NULL, idCliente char(5) NOT NULL, idEmpleado char(5) NOT NULL, TipoDoc varchar(10) NOT NULL, NroDoc varchar(7) NOT NULL, Fecha datetime NOT NULL, Total decimal(18,2) NOT NULL, PRIMARY KEY (idVenta), Foreign Key (idCliente) References Clientes(idCliente), Foreign Key (idEmpleado) References Empleados(idEmpleado) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE DetalleVenta ( idVenta int(5) NOT NULL, idProducto char(5) NOT NULL, PrecioVenta decimal(18,2) NOT NULL, Cantidad int(5) NOT NULL, Importe decimal(18,2) NOT NULL, Foreign Key (idVenta) references Ventas(idVenta), Foreign Key (idProducto) references Productos(idProducto) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Compras ( idCompra int(5) NOT NULL, idProveedor char(5) NOT NULL, idEmpleado char(5) NOT NULL, TipoDoc varchar(20) NOT NULL, NroDoc varchar(7) NOT NULL, Fecha date NOT NULL, SubTotal decimal(18,2) NOT NULL, Igv decimal(18,2) NOT NULL, Total decimal(18,2) NOT NULL, PRIMARY KEY (idCompra), FOREIGN KEY (idproveedor) REFERENCES proveedores(idProveedor), Foreign Key (idEmpleado) References Empleados(idEmpleado) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE DetalleCompra ( idCompra int(5) NOT NULL, idProducto char(5) NOT NULL, Precio decimal(18,2) NOT NULL, Cantidad int(5) NOT NULL, Importe decimal(18,2) NOT NULL, Foreign Key (idCompra) References Compras(idCompra), Foreign Key (idProducto) References Productos(idProducto) )ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Control ( parametro varchar(20) NOT NULL, Valor int(4) not null, PRIMARY KEY (parametro) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
# --- Created by Ebean DDL # To stop Ebean DDL generation, remove this comment and start using Evolutions # --- !Ups create table admin ( id integer auto_increment not null, username varchar(255), password varchar(255), level integer, constraint uq_admin_username unique (username), constraint pk_admin primary key (id)) ; create table attachment ( id integer auto_increment not null, url varchar(255), size bigint, date datetime, constraint pk_attachment primary key (id)) ; create table content ( id integer auto_increment not null, content longtext, date datetime, constraint pk_content primary key (id)) ; create table content_attachment ( id integer auto_increment not null, attachment_id integer, content_id integer, constraint pk_content_attachment primary key (id)) ; create table content_image ( id integer auto_increment not null, image_id integer, content_id integer, constraint pk_content_image primary key (id)) ; create table donation ( id integer auto_increment not null, volunteer_id integer, organization_id integer, volunteer_transaction_id integer, organization_transaction_id integer, date datetime, constraint pk_donation primary key (id)) ; create table event ( id integer auto_increment not null, name varchar(255), description varchar(255), content_id integer, organization_id integer, location_id integer, number_of_places integer, image_id integer, start_time datetime, end_time datetime, date datetime, constraint pk_event primary key (id)) ; create table event_registrant ( id integer auto_increment not null, event_id integer, volunteer_id integer, date datetime, constraint pk_event_registrant primary key (id)) ; create table image ( id integer auto_increment not null, url varchar(255), type integer, size integer, width integer, height integer, date datetime, constraint pk_image primary key (id)) ; create table location ( id integer auto_increment not null, text varchar(255), postal_code varchar(255), lat integer, lng integer, constraint pk_location primary key (id)) ; create table mail ( id integer auto_increment not null, data longtext, template_id integer, date datetime, status integer, constraint pk_mail primary key (id)) ; create table mail_queue ( id integer auto_increment not null, user_id integer, title varchar(255), content varchar(255), status integer, date datetime, mail_id integer, constraint pk_mail_queue primary key (id)) ; create table mail_template ( id integer auto_increment not null, title varchar(255), template longtext, constraint pk_mail_template primary key (id)) ; create table news ( id integer auto_increment not null, content_id integer, category_id integer, constraint pk_news primary key (id)) ; create table news_category ( id integer auto_increment not null, slug varchar(255), name varchar(255), constraint pk_news_category primary key (id)) ; create table organization ( id integer auto_increment not null, name varchar(255), image_id integer, description varchar(255), content_id integer, location_id integer, user_id integer, category_id integer, date datetime, status integer, contact_number varchar(255), email varchar(255), website varchar(255), facebook_link varchar(255), twitter_link varchar(255), balance bigint, constraint pk_organization primary key (id)) ; create table organization_category ( id integer auto_increment not null, name varchar(255), pool bigint, sort integer, constraint pk_organization_category primary key (id)) ; create table organization_notification ( id integer auto_increment not null, organization_id integer, type integer, content varchar(255), link varchar(255), date datetime, constraint pk_organization_notification primary key (id)) ; create table organization_transaction ( id integer auto_increment not null, amount integer, date datetime, organization_id integer, constraint pk_organization_transaction primary key (id)) ; create table page ( id integer auto_increment not null, slug varchar(255), constraint pk_page primary key (id)) ; create table user ( id integer auto_increment not null, username varchar(255), password varchar(255), email varchar(255), secret_key varchar(255), status integer, constraint uq_user_username unique (username), constraint uq_user_email unique (email), constraint pk_user primary key (id)) ; create table volunteer ( id integer auto_increment not null, user_id integer, status integer, first_name varchar(255), last_name varchar(255), contact_number varchar(255), address1 varchar(255), address2 varchar(255), nationality varchar(255), image_id integer, balance integer, constraint pk_volunteer primary key (id)) ; create table volunteer_document ( id integer auto_increment not null, type integer, number varchar(255), volunteer_id integer, constraint pk_volunteer_document primary key (id)) ; create table volunteer_notification ( id integer auto_increment not null, volunteer_id integer, type integer, content varchar(255), link varchar(255), date datetime, constraint pk_volunteer_notification primary key (id)) ; create table volunteer_record ( id integer auto_increment not null, volunteer_id integer, event_id integer, transaction_id integer, start_time datetime, end_time datetime, deducted_time integer, length integer, date datetime, constraint pk_volunteer_record primary key (id)) ; create table volunteer_transaction ( id integer auto_increment not null, amount integer, date datetime, volunteer_id integer, constraint pk_volunteer_transaction primary key (id)) ; create table mail_user ( mail_id integer not null, user_id integer not null, constraint pk_mail_user primary key (mail_id, user_id)) ; alter table content_attachment add constraint fk_content_attachment_attachment_1 foreign key (attachment_id) references attachment (id) on delete restrict on update restrict; create index ix_content_attachment_attachment_1 on content_attachment (attachment_id); alter table content_attachment add constraint fk_content_attachment_content_2 foreign key (content_id) references content (id) on delete restrict on update restrict; create index ix_content_attachment_content_2 on content_attachment (content_id); alter table content_image add constraint fk_content_image_image_3 foreign key (image_id) references image (id) on delete restrict on update restrict; create index ix_content_image_image_3 on content_image (image_id); alter table content_image add constraint fk_content_image_content_4 foreign key (content_id) references content (id) on delete restrict on update restrict; create index ix_content_image_content_4 on content_image (content_id); alter table donation add constraint fk_donation_volunteer_5 foreign key (volunteer_id) references volunteer (id) on delete restrict on update restrict; create index ix_donation_volunteer_5 on donation (volunteer_id); alter table donation add constraint fk_donation_organization_6 foreign key (organization_id) references organization (id) on delete restrict on update restrict; create index ix_donation_organization_6 on donation (organization_id); alter table donation add constraint fk_donation_volunteerTransaction_7 foreign key (volunteer_transaction_id) references volunteer_transaction (id) on delete restrict on update restrict; create index ix_donation_volunteerTransaction_7 on donation (volunteer_transaction_id); alter table donation add constraint fk_donation_organizationTransaction_8 foreign key (organization_transaction_id) references organization_transaction (id) on delete restrict on update restrict; create index ix_donation_organizationTransaction_8 on donation (organization_transaction_id); alter table event add constraint fk_event_content_9 foreign key (content_id) references content (id) on delete restrict on update restrict; create index ix_event_content_9 on event (content_id); alter table event add constraint fk_event_organization_10 foreign key (organization_id) references organization (id) on delete restrict on update restrict; create index ix_event_organization_10 on event (organization_id); alter table event add constraint fk_event_location_11 foreign key (location_id) references location (id) on delete restrict on update restrict; create index ix_event_location_11 on event (location_id); alter table event add constraint fk_event_image_12 foreign key (image_id) references image (id) on delete restrict on update restrict; create index ix_event_image_12 on event (image_id); alter table event_registrant add constraint fk_event_registrant_event_13 foreign key (event_id) references event (id) on delete restrict on update restrict; create index ix_event_registrant_event_13 on event_registrant (event_id); alter table event_registrant add constraint fk_event_registrant_volunteer_14 foreign key (volunteer_id) references volunteer (id) on delete restrict on update restrict; create index ix_event_registrant_volunteer_14 on event_registrant (volunteer_id); alter table mail add constraint fk_mail_template_15 foreign key (template_id) references mail_template (id) on delete restrict on update restrict; create index ix_mail_template_15 on mail (template_id); alter table mail_queue add constraint fk_mail_queue_user_16 foreign key (user_id) references user (id) on delete restrict on update restrict; create index ix_mail_queue_user_16 on mail_queue (user_id); alter table mail_queue add constraint fk_mail_queue_mail_17 foreign key (mail_id) references mail (id) on delete restrict on update restrict; create index ix_mail_queue_mail_17 on mail_queue (mail_id); alter table news add constraint fk_news_content_18 foreign key (content_id) references content (id) on delete restrict on update restrict; create index ix_news_content_18 on news (content_id); alter table news add constraint fk_news_category_19 foreign key (category_id) references news_category (id) on delete restrict on update restrict; create index ix_news_category_19 on news (category_id); alter table organization add constraint fk_organization_image_20 foreign key (image_id) references image (id) on delete restrict on update restrict; create index ix_organization_image_20 on organization (image_id); alter table organization add constraint fk_organization_content_21 foreign key (content_id) references content (id) on delete restrict on update restrict; create index ix_organization_content_21 on organization (content_id); alter table organization add constraint fk_organization_location_22 foreign key (location_id) references location (id) on delete restrict on update restrict; create index ix_organization_location_22 on organization (location_id); alter table organization add constraint fk_organization_user_23 foreign key (user_id) references user (id) on delete restrict on update restrict; create index ix_organization_user_23 on organization (user_id); alter table organization add constraint fk_organization_category_24 foreign key (category_id) references organization_category (id) on delete restrict on update restrict; create index ix_organization_category_24 on organization (category_id); alter table organization_notification add constraint fk_organization_notification_organization_25 foreign key (organization_id) references organization (id) on delete restrict on update restrict; create index ix_organization_notification_organization_25 on organization_notification (organization_id); alter table organization_transaction add constraint fk_organization_transaction_organization_26 foreign key (organization_id) references organization (id) on delete restrict on update restrict; create index ix_organization_transaction_organization_26 on organization_transaction (organization_id); alter table volunteer add constraint fk_volunteer_user_27 foreign key (user_id) references user (id) on delete restrict on update restrict; create index ix_volunteer_user_27 on volunteer (user_id); alter table volunteer add constraint fk_volunteer_image_28 foreign key (image_id) references image (id) on delete restrict on update restrict; create index ix_volunteer_image_28 on volunteer (image_id); alter table volunteer_document add constraint fk_volunteer_document_volunteer_29 foreign key (volunteer_id) references volunteer (id) on delete restrict on update restrict; create index ix_volunteer_document_volunteer_29 on volunteer_document (volunteer_id); alter table volunteer_notification add constraint fk_volunteer_notification_volunteer_30 foreign key (volunteer_id) references volunteer (id) on delete restrict on update restrict; create index ix_volunteer_notification_volunteer_30 on volunteer_notification (volunteer_id); alter table volunteer_record add constraint fk_volunteer_record_volunteer_31 foreign key (volunteer_id) references volunteer (id) on delete restrict on update restrict; create index ix_volunteer_record_volunteer_31 on volunteer_record (volunteer_id); alter table volunteer_record add constraint fk_volunteer_record_event_32 foreign key (event_id) references event (id) on delete restrict on update restrict; create index ix_volunteer_record_event_32 on volunteer_record (event_id); alter table volunteer_record add constraint fk_volunteer_record_transaction_33 foreign key (transaction_id) references volunteer_transaction (id) on delete restrict on update restrict; create index ix_volunteer_record_transaction_33 on volunteer_record (transaction_id); alter table volunteer_transaction add constraint fk_volunteer_transaction_volunteer_34 foreign key (volunteer_id) references volunteer (id) on delete restrict on update restrict; create index ix_volunteer_transaction_volunteer_34 on volunteer_transaction (volunteer_id); alter table mail_user add constraint fk_mail_user_mail_01 foreign key (mail_id) references mail (id) on delete restrict on update restrict; alter table mail_user add constraint fk_mail_user_user_02 foreign key (user_id) references user (id) on delete restrict on update restrict; # --- !Downs SET FOREIGN_KEY_CHECKS=0; drop table admin; drop table attachment; drop table content; drop table content_attachment; drop table content_image; drop table donation; drop table event; drop table event_registrant; drop table image; drop table location; drop table mail; drop table mail_user; drop table mail_queue; drop table mail_template; drop table news; drop table news_category; drop table organization; drop table organization_category; drop table organization_notification; drop table organization_transaction; drop table page; drop table user; drop table volunteer; drop table volunteer_document; drop table volunteer_notification; drop table volunteer_record; drop table volunteer_transaction; SET FOREIGN_KEY_CHECKS=1;
CREATE TABLE PERSONEL( ID tinyint not null IDENTITY (1,1)unique, AD varchar(20) not null, SOYAD varchar(20) not null, GOREV varchar(20)not null, GIRIS_TARIHI date, MAAS VARCHAR(10), TEL_NO CHAR(11) not null, EMAIL varchar(50) not null, KULLANICI_ADI VARCHAR(20) not null, SIFRE varchar(10) not null, KURTARMA_SORUSU varchar(50) not null, CEVAP VARCHAR (20)not null )
-- -------------------------------------------------------------------------------- -- Routine DDL -- Author: Andrey Petrov -- Date: lun 8 dic 2014 -- Note: Pre_cond: in_nomestrumento e' def. -- Post_cond: out un boolean t.c e' true sse e' soddisfatta l'if altrimenti false -- -------------------------------------------------------------------------------- DROP FUNCTION IF EXISTS match_in_strumenti; DELIMITER $$ CREATE DEFINER=`apetrov`@`localhost` FUNCTION `match_in_strumenti`(in_nomestrumento VARCHAR(50)) RETURNS tinyint(1) READS SQL DATA DETERMINISTIC BEGIN DECLARE bool_val BOOLEAN ; IF ( (SELECT NomeStrumento FROM Strumenti WHERE NomeStrumento = in_nomestrumento) <> NULL ) THEN SET bool_val = TRUE ; ELSE SET bool_val = FALSE; END IF; RETURN bool_val ; END$$ DELIMITER ;
CREATE TABLE Department ( dept_number CHAR(18) NOT NULL , dept_name CHAR(18) NULL , factory_name CHAR(18) NOT NULL ); CREATE UNIQUE INDEX XPKDepartment ON Department (dept_number ASC,factory_name ASC); ALTER TABLE Department ADD CONSTRAINT XPKDepartment PRIMARY KEY (dept_number,factory_name); CREATE TABLE Employee ( emp_code CHAR(18) NOT NULL , emp_name CHAR(18) NULL , dept_number CHAR(18) NOT NULL , factory_name CHAR(18) NOT NULL ); CREATE UNIQUE INDEX XPKEmployee ON Employee (emp_code ASC,dept_number ASC,factory_name ASC); ALTER TABLE Employee ADD CONSTRAINT XPKEmployee PRIMARY KEY (emp_code,dept_number,factory_name); CREATE TABLE Factory ( factory_name CHAR(18) NOT NULL ); CREATE UNIQUE INDEX XPKFactory ON Factory (factory_name ASC); ALTER TABLE Factory ADD CONSTRAINT XPKFactory PRIMARY KEY (factory_name); CREATE TABLE Job ( job_number CHAR(18) NOT NULL , job_description CHAR(18) NULL , date CHAR(18) NULL , emp_code CHAR(18) NULL , dept_number CHAR(18) NULL , factory_name CHAR(18) NULL ); CREATE UNIQUE INDEX XPKJob ON Job (job_number ASC); ALTER TABLE Job ADD CONSTRAINT XPKJob PRIMARY KEY (job_number); CREATE TABLE Job_Sheet ( week_number CHAR(18) NULL , emp_code CHAR(18) NOT NULL , dept_number CHAR(18) NOT NULL , year CHAR(18) NULL , factory_name CHAR(18) NOT NULL ); CREATE UNIQUE INDEX XPKJob_Sheet ON Job_Sheet (emp_code ASC,dept_number ASC,factory_name ASC); ALTER TABLE Job_Sheet ADD CONSTRAINT XPKJob_Sheet PRIMARY KEY (emp_code,dept_number,factory_name); CREATE TABLE Product ( product_id CHAR(18) NOT NULL , product_type CHAR(18) NULL , product_description CHAR(18) NULL , factory_name CHAR(18) NOT NULL ); CREATE UNIQUE INDEX XPKProduct ON Product (product_id ASC,factory_name ASC); ALTER TABLE Product ADD CONSTRAINT XPKProduct PRIMARY KEY (product_id,factory_name); CREATE TABLE Product_Material ( material_type CHAR(18) NOT NULL , product_id CHAR(18) NULL , factory_name CHAR(18) NULL ); CREATE UNIQUE INDEX XPKProduct_Material ON Product_Material (material_type ASC); ALTER TABLE Product_Material ADD CONSTRAINT XPKProduct_Material PRIMARY KEY (material_type); CREATE TABLE Product_Paint ( paint_id CHAR(18) NOT NULL , paint_color CHAR(18) NULL , paint_type CHAR(18) NULL , product_id CHAR(18) NULL , factory_name CHAR(18) NULL ); CREATE UNIQUE INDEX XPKProduct_Paint ON Product_Paint (paint_id ASC); ALTER TABLE Product_Paint ADD CONSTRAINT XPKProduct_Paint PRIMARY KEY (paint_id); CREATE TABLE Task ( task_description CHAR(18) NOT NULL , job_number CHAR(18) NULL ); CREATE UNIQUE INDEX XPKTask ON Task (task_description ASC); ALTER TABLE Task ADD CONSTRAINT XPKTask PRIMARY KEY (task_description); CREATE TABLE Task_Rate ( hourly_rate CHAR(18) NULL , payment CHAR(18) NULL , task_description CHAR(18) NOT NULL ); CREATE UNIQUE INDEX XPKTask_Rate ON Task_Rate (task_description ASC); ALTER TABLE Task_Rate ADD CONSTRAINT XPKTask_Rate PRIMARY KEY (task_description); ALTER TABLE Department ADD (CONSTRAINT R_6 FOREIGN KEY (factory_name) REFERENCES Factory (factory_name)); ALTER TABLE Employee ADD (CONSTRAINT R_1 FOREIGN KEY (dept_number, factory_name) REFERENCES Department (dept_number, factory_name)); ALTER TABLE Job ADD (CONSTRAINT R_3 FOREIGN KEY (emp_code, dept_number, factory_name) REFERENCES Job_Sheet (emp_code, dept_number, factory_name) ON DELETE SET NULL); ALTER TABLE Job_Sheet ADD (CONSTRAINT R_2 FOREIGN KEY (emp_code, dept_number, factory_name) REFERENCES Employee (emp_code, dept_number, factory_name)); ALTER TABLE Product ADD (CONSTRAINT R_7 FOREIGN KEY (factory_name) REFERENCES Factory (factory_name)); ALTER TABLE Product_Material ADD (CONSTRAINT R_8 FOREIGN KEY (product_id, factory_name) REFERENCES Product (product_id, factory_name) ON DELETE SET NULL); ALTER TABLE Product_Paint ADD (CONSTRAINT R_9 FOREIGN KEY (product_id, factory_name) REFERENCES Product (product_id, factory_name) ON DELETE SET NULL); ALTER TABLE Task ADD (CONSTRAINT R_4 FOREIGN KEY (job_number) REFERENCES Job (job_number) ON DELETE SET NULL); ALTER TABLE Task_Rate ADD (CONSTRAINT R_5 FOREIGN KEY (task_description) REFERENCES Task (task_description)); CREATE TRIGGER tD_Department AFTER DELETE ON Department for each row -- ERwin Builtin Trigger -- DELETE trigger on Department DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Department Employee on parent delete restrict */ /* ERWIN_RELATION:CHECKSUM="0000f4e2", PARENT_OWNER="", PARENT_TABLE="Department" CHILD_OWNER="", CHILD_TABLE="Employee" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_1", FK_COLUMNS="dept_number""factory_name" */ SELECT count(*) INTO NUMROWS FROM Employee WHERE /* %JoinFKPK(Employee,:%Old," = "," AND") */ Employee.dept_number = :old.dept_number AND Employee.factory_name = :old.factory_name; IF (NUMROWS > 0) THEN raise_application_error( -20001, 'Cannot delete Department because Employee exists.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Department BEFORE INSERT ON Department for each row -- ERwin Builtin Trigger -- INSERT trigger on Department DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Factory Department on child insert restrict */ /* ERWIN_RELATION:CHECKSUM="0000e533", PARENT_OWNER="", PARENT_TABLE="Factory" CHILD_OWNER="", CHILD_TABLE="Department" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_6", FK_COLUMNS="factory_name" */ SELECT count(*) INTO NUMROWS FROM Factory WHERE /* %JoinFKPK(:%New,Factory," = "," AND") */ :new.factory_name = Factory.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20002, 'Cannot insert Department because Factory does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Department AFTER UPDATE ON Department for each row -- ERwin Builtin Trigger -- UPDATE trigger on Department DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Department Employee on parent update restrict */ /* ERWIN_RELATION:CHECKSUM="000237f0", PARENT_OWNER="", PARENT_TABLE="Department" CHILD_OWNER="", CHILD_TABLE="Employee" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_1", FK_COLUMNS="dept_number""factory_name" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.dept_number <> :new.dept_number OR :old.factory_name <> :new.factory_name THEN SELECT count(*) INTO NUMROWS FROM Employee WHERE /* %JoinFKPK(Employee,:%Old," = "," AND") */ Employee.dept_number = :old.dept_number AND Employee.factory_name = :old.factory_name; IF (NUMROWS > 0) THEN raise_application_error( -20005, 'Cannot update Department because Employee exists.' ); END IF; END IF; /* ERwin Builtin Trigger */ /* Factory Department on child update restrict */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Factory" CHILD_OWNER="", CHILD_TABLE="Department" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_6", FK_COLUMNS="factory_name" */ SELECT count(*) INTO NUMROWS FROM Factory WHERE /* %JoinFKPK(:%New,Factory," = "," AND") */ :new.factory_name = Factory.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Department because Factory does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tD_Employee AFTER DELETE ON Employee for each row -- ERwin Builtin Trigger -- DELETE trigger on Employee DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Employee Job_Sheet on parent delete restrict */ /* ERWIN_RELATION:CHECKSUM="0001138e", PARENT_OWNER="", PARENT_TABLE="Employee" CHILD_OWNER="", CHILD_TABLE="Job_Sheet" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_2", FK_COLUMNS="emp_code""dept_number""factory_name" */ SELECT count(*) INTO NUMROWS FROM Job_Sheet WHERE /* %JoinFKPK(Job_Sheet,:%Old," = "," AND") */ Job_Sheet.emp_code = :old.emp_code AND Job_Sheet.dept_number = :old.dept_number AND Job_Sheet.factory_name = :old.factory_name; IF (NUMROWS > 0) THEN raise_application_error( -20001, 'Cannot delete Employee because Job_Sheet exists.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Employee BEFORE INSERT ON Employee for each row -- ERwin Builtin Trigger -- INSERT trigger on Employee DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Department Employee on child insert restrict */ /* ERWIN_RELATION:CHECKSUM="00010b84", PARENT_OWNER="", PARENT_TABLE="Department" CHILD_OWNER="", CHILD_TABLE="Employee" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_1", FK_COLUMNS="dept_number""factory_name" */ SELECT count(*) INTO NUMROWS FROM Department WHERE /* %JoinFKPK(:%New,Department," = "," AND") */ :new.dept_number = Department.dept_number AND :new.factory_name = Department.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20002, 'Cannot insert Employee because Department does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Employee AFTER UPDATE ON Employee for each row -- ERwin Builtin Trigger -- UPDATE trigger on Employee DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Employee Job_Sheet on parent update restrict */ /* ERWIN_RELATION:CHECKSUM="0002854b", PARENT_OWNER="", PARENT_TABLE="Employee" CHILD_OWNER="", CHILD_TABLE="Job_Sheet" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_2", FK_COLUMNS="emp_code""dept_number""factory_name" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.emp_code <> :new.emp_code OR :old.dept_number <> :new.dept_number OR :old.factory_name <> :new.factory_name THEN SELECT count(*) INTO NUMROWS FROM Job_Sheet WHERE /* %JoinFKPK(Job_Sheet,:%Old," = "," AND") */ Job_Sheet.emp_code = :old.emp_code AND Job_Sheet.dept_number = :old.dept_number AND Job_Sheet.factory_name = :old.factory_name; IF (NUMROWS > 0) THEN raise_application_error( -20005, 'Cannot update Employee because Job_Sheet exists.' ); END IF; END IF; /* ERwin Builtin Trigger */ /* Department Employee on child update restrict */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Department" CHILD_OWNER="", CHILD_TABLE="Employee" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_1", FK_COLUMNS="dept_number""factory_name" */ SELECT count(*) INTO NUMROWS FROM Department WHERE /* %JoinFKPK(:%New,Department," = "," AND") */ :new.dept_number = Department.dept_number AND :new.factory_name = Department.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Employee because Department does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tD_Factory AFTER DELETE ON Factory for each row -- ERwin Builtin Trigger -- DELETE trigger on Factory DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Factory Product on parent delete restrict */ /* ERWIN_RELATION:CHECKSUM="0001c628", PARENT_OWNER="", PARENT_TABLE="Factory" CHILD_OWNER="", CHILD_TABLE="Product" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_7", FK_COLUMNS="factory_name" */ SELECT count(*) INTO NUMROWS FROM Product WHERE /* %JoinFKPK(Product,:%Old," = "," AND") */ Product.factory_name = :old.factory_name; IF (NUMROWS > 0) THEN raise_application_error( -20001, 'Cannot delete Factory because Product exists.' ); END IF; /* ERwin Builtin Trigger */ /* Factory Department on parent delete restrict */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Factory" CHILD_OWNER="", CHILD_TABLE="Department" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_6", FK_COLUMNS="factory_name" */ SELECT count(*) INTO NUMROWS FROM Department WHERE /* %JoinFKPK(Department,:%Old," = "," AND") */ Department.factory_name = :old.factory_name; IF (NUMROWS > 0) THEN raise_application_error( -20001, 'Cannot delete Factory because Department exists.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Factory AFTER UPDATE ON Factory for each row -- ERwin Builtin Trigger -- UPDATE trigger on Factory DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Factory Product on parent update restrict */ /* ERWIN_RELATION:CHECKSUM="000232b5", PARENT_OWNER="", PARENT_TABLE="Factory" CHILD_OWNER="", CHILD_TABLE="Product" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_7", FK_COLUMNS="factory_name" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.factory_name <> :new.factory_name THEN SELECT count(*) INTO NUMROWS FROM Product WHERE /* %JoinFKPK(Product,:%Old," = "," AND") */ Product.factory_name = :old.factory_name; IF (NUMROWS > 0) THEN raise_application_error( -20005, 'Cannot update Factory because Product exists.' ); END IF; END IF; /* ERwin Builtin Trigger */ /* Factory Department on parent update restrict */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Factory" CHILD_OWNER="", CHILD_TABLE="Department" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_6", FK_COLUMNS="factory_name" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.factory_name <> :new.factory_name THEN SELECT count(*) INTO NUMROWS FROM Department WHERE /* %JoinFKPK(Department,:%Old," = "," AND") */ Department.factory_name = :old.factory_name; IF (NUMROWS > 0) THEN raise_application_error( -20005, 'Cannot update Factory because Department exists.' ); END IF; END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tD_Job AFTER DELETE ON Job for each row -- ERwin Builtin Trigger -- DELETE trigger on Job DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Job Task on parent delete set null */ /* ERWIN_RELATION:CHECKSUM="0000a832", PARENT_OWNER="", PARENT_TABLE="Job" CHILD_OWNER="", CHILD_TABLE="Task" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_4", FK_COLUMNS="job_number" */ UPDATE Task SET /* %SetFK(Task,NULL) */ Task.job_number = NULL WHERE /* %JoinFKPK(Task,:%Old," = "," AND") */ Task.job_number = :old.job_number; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Job BEFORE INSERT ON Job for each row -- ERwin Builtin Trigger -- INSERT trigger on Job DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Job_Sheet Job on child insert set null */ /* ERWIN_RELATION:CHECKSUM="000124af", PARENT_OWNER="", PARENT_TABLE="Job_Sheet" CHILD_OWNER="", CHILD_TABLE="Job" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_3", FK_COLUMNS="emp_code""dept_number""factory_name" */ UPDATE Job SET /* %SetFK(Job,NULL) */ Job.emp_code = NULL, Job.dept_number = NULL, Job.factory_name = NULL WHERE NOT EXISTS ( SELECT * FROM Job_Sheet WHERE /* %JoinFKPK(:%New,Job_Sheet," = "," AND") */ :new.emp_code = Job_Sheet.emp_code AND :new.dept_number = Job_Sheet.dept_number AND :new.factory_name = Job_Sheet.factory_name ) /* %JoinPKPK(Job,:%New," = "," AND") */ and Job.job_number = :new.job_number; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Job AFTER UPDATE ON Job for each row -- ERwin Builtin Trigger -- UPDATE trigger on Job DECLARE NUMROWS INTEGER; BEGIN /* Job Task on parent update set null */ /* ERWIN_RELATION:CHECKSUM="00021f88", PARENT_OWNER="", PARENT_TABLE="Job" CHILD_OWNER="", CHILD_TABLE="Task" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_4", FK_COLUMNS="job_number" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.job_number <> :new.job_number THEN UPDATE Task SET /* %SetFK(Task,NULL) */ Task.job_number = NULL WHERE /* %JoinFKPK(Task,:%Old," = ",",") */ Task.job_number = :old.job_number; END IF; /* ERwin Builtin Trigger */ /* Job_Sheet Job on child update no action */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Job_Sheet" CHILD_OWNER="", CHILD_TABLE="Job" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_3", FK_COLUMNS="emp_code""dept_number""factory_name" */ SELECT count(*) INTO NUMROWS FROM Job_Sheet WHERE /* %JoinFKPK(:%New,Job_Sheet," = "," AND") */ :new.emp_code = Job_Sheet.emp_code AND :new.dept_number = Job_Sheet.dept_number AND :new.factory_name = Job_Sheet.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ :new.emp_code IS NOT NULL AND :new.dept_number IS NOT NULL AND :new.factory_name IS NOT NULL AND NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Job because Job_Sheet does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tD_Job_Sheet AFTER DELETE ON Job_Sheet for each row -- ERwin Builtin Trigger -- DELETE trigger on Job_Sheet DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Job_Sheet Job on parent delete set null */ /* ERWIN_RELATION:CHECKSUM="0000e3e8", PARENT_OWNER="", PARENT_TABLE="Job_Sheet" CHILD_OWNER="", CHILD_TABLE="Job" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_3", FK_COLUMNS="emp_code""dept_number""factory_name" */ UPDATE Job SET /* %SetFK(Job,NULL) */ Job.emp_code = NULL, Job.dept_number = NULL, Job.factory_name = NULL WHERE /* %JoinFKPK(Job,:%Old," = "," AND") */ Job.emp_code = :old.emp_code AND Job.dept_number = :old.dept_number AND Job.factory_name = :old.factory_name; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Job_Sheet BEFORE INSERT ON Job_Sheet for each row -- ERwin Builtin Trigger -- INSERT trigger on Job_Sheet DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Employee Job_Sheet on child insert restrict */ /* ERWIN_RELATION:CHECKSUM="00012734", PARENT_OWNER="", PARENT_TABLE="Employee" CHILD_OWNER="", CHILD_TABLE="Job_Sheet" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_2", FK_COLUMNS="emp_code""dept_number""factory_name" */ SELECT count(*) INTO NUMROWS FROM Employee WHERE /* %JoinFKPK(:%New,Employee," = "," AND") */ :new.emp_code = Employee.emp_code AND :new.dept_number = Employee.dept_number AND :new.factory_name = Employee.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20002, 'Cannot insert Job_Sheet because Employee does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Job_Sheet AFTER UPDATE ON Job_Sheet for each row -- ERwin Builtin Trigger -- UPDATE trigger on Job_Sheet DECLARE NUMROWS INTEGER; BEGIN /* Job_Sheet Job on parent update set null */ /* ERWIN_RELATION:CHECKSUM="00025606", PARENT_OWNER="", PARENT_TABLE="Job_Sheet" CHILD_OWNER="", CHILD_TABLE="Job" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_3", FK_COLUMNS="emp_code""dept_number""factory_name" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.emp_code <> :new.emp_code OR :old.dept_number <> :new.dept_number OR :old.factory_name <> :new.factory_name THEN UPDATE Job SET /* %SetFK(Job,NULL) */ Job.emp_code = NULL, Job.dept_number = NULL, Job.factory_name = NULL WHERE /* %JoinFKPK(Job,:%Old," = ",",") */ Job.emp_code = :old.emp_code AND Job.dept_number = :old.dept_number AND Job.factory_name = :old.factory_name; END IF; /* ERwin Builtin Trigger */ /* Employee Job_Sheet on child update restrict */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Employee" CHILD_OWNER="", CHILD_TABLE="Job_Sheet" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_2", FK_COLUMNS="emp_code""dept_number""factory_name" */ SELECT count(*) INTO NUMROWS FROM Employee WHERE /* %JoinFKPK(:%New,Employee," = "," AND") */ :new.emp_code = Employee.emp_code AND :new.dept_number = Employee.dept_number AND :new.factory_name = Employee.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Job_Sheet because Employee does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tD_Product AFTER DELETE ON Product for each row -- ERwin Builtin Trigger -- DELETE trigger on Product DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Product Product_Paint on parent delete set null */ /* ERWIN_RELATION:CHECKSUM="000204ae", PARENT_OWNER="", PARENT_TABLE="Product" CHILD_OWNER="", CHILD_TABLE="Product_Paint" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_9", FK_COLUMNS="product_id""factory_name" */ UPDATE Product_Paint SET /* %SetFK(Product_Paint,NULL) */ Product_Paint.product_id = NULL, Product_Paint.factory_name = NULL WHERE /* %JoinFKPK(Product_Paint,:%Old," = "," AND") */ Product_Paint.product_id = :old.product_id AND Product_Paint.factory_name = :old.factory_name; /* ERwin Builtin Trigger */ /* Product Product_Material on parent delete set null */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Product" CHILD_OWNER="", CHILD_TABLE="Product_Material" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_8", FK_COLUMNS="product_id""factory_name" */ UPDATE Product_Material SET /* %SetFK(Product_Material,NULL) */ Product_Material.product_id = NULL, Product_Material.factory_name = NULL WHERE /* %JoinFKPK(Product_Material,:%Old," = "," AND") */ Product_Material.product_id = :old.product_id AND Product_Material.factory_name = :old.factory_name; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Product BEFORE INSERT ON Product for each row -- ERwin Builtin Trigger -- INSERT trigger on Product DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Factory Product on child insert restrict */ /* ERWIN_RELATION:CHECKSUM="0000ea81", PARENT_OWNER="", PARENT_TABLE="Factory" CHILD_OWNER="", CHILD_TABLE="Product" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_7", FK_COLUMNS="factory_name" */ SELECT count(*) INTO NUMROWS FROM Factory WHERE /* %JoinFKPK(:%New,Factory," = "," AND") */ :new.factory_name = Factory.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20002, 'Cannot insert Product because Factory does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Product AFTER UPDATE ON Product for each row -- ERwin Builtin Trigger -- UPDATE trigger on Product DECLARE NUMROWS INTEGER; BEGIN /* Product Product_Paint on parent update set null */ /* ERWIN_RELATION:CHECKSUM="00036cc7", PARENT_OWNER="", PARENT_TABLE="Product" CHILD_OWNER="", CHILD_TABLE="Product_Paint" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_9", FK_COLUMNS="product_id""factory_name" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.product_id <> :new.product_id OR :old.factory_name <> :new.factory_name THEN UPDATE Product_Paint SET /* %SetFK(Product_Paint,NULL) */ Product_Paint.product_id = NULL, Product_Paint.factory_name = NULL WHERE /* %JoinFKPK(Product_Paint,:%Old," = ",",") */ Product_Paint.product_id = :old.product_id AND Product_Paint.factory_name = :old.factory_name; END IF; /* Product Product_Material on parent update set null */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Product" CHILD_OWNER="", CHILD_TABLE="Product_Material" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_8", FK_COLUMNS="product_id""factory_name" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.product_id <> :new.product_id OR :old.factory_name <> :new.factory_name THEN UPDATE Product_Material SET /* %SetFK(Product_Material,NULL) */ Product_Material.product_id = NULL, Product_Material.factory_name = NULL WHERE /* %JoinFKPK(Product_Material,:%Old," = ",",") */ Product_Material.product_id = :old.product_id AND Product_Material.factory_name = :old.factory_name; END IF; /* ERwin Builtin Trigger */ /* Factory Product on child update restrict */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Factory" CHILD_OWNER="", CHILD_TABLE="Product" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_7", FK_COLUMNS="factory_name" */ SELECT count(*) INTO NUMROWS FROM Factory WHERE /* %JoinFKPK(:%New,Factory," = "," AND") */ :new.factory_name = Factory.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Product because Factory does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Product_Material BEFORE INSERT ON Product_Material for each row -- ERwin Builtin Trigger -- INSERT trigger on Product_Material DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Product Product_Material on child insert set null */ /* ERWIN_RELATION:CHECKSUM="00012b18", PARENT_OWNER="", PARENT_TABLE="Product" CHILD_OWNER="", CHILD_TABLE="Product_Material" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_8", FK_COLUMNS="product_id""factory_name" */ UPDATE Product_Material SET /* %SetFK(Product_Material,NULL) */ Product_Material.product_id = NULL, Product_Material.factory_name = NULL WHERE NOT EXISTS ( SELECT * FROM Product WHERE /* %JoinFKPK(:%New,Product," = "," AND") */ :new.product_id = Product.product_id AND :new.factory_name = Product.factory_name ) /* %JoinPKPK(Product_Material,:%New," = "," AND") */ and Product_Material.material_type = :new.material_type; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Product_Material AFTER UPDATE ON Product_Material for each row -- ERwin Builtin Trigger -- UPDATE trigger on Product_Material DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Product Product_Material on child update no action */ /* ERWIN_RELATION:CHECKSUM="000127b8", PARENT_OWNER="", PARENT_TABLE="Product" CHILD_OWNER="", CHILD_TABLE="Product_Material" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_8", FK_COLUMNS="product_id""factory_name" */ SELECT count(*) INTO NUMROWS FROM Product WHERE /* %JoinFKPK(:%New,Product," = "," AND") */ :new.product_id = Product.product_id AND :new.factory_name = Product.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ :new.product_id IS NOT NULL AND :new.factory_name IS NOT NULL AND NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Product_Material because Product does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Product_Paint BEFORE INSERT ON Product_Paint for each row -- ERwin Builtin Trigger -- INSERT trigger on Product_Paint DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Product Product_Paint on child insert set null */ /* ERWIN_RELATION:CHECKSUM="00011d75", PARENT_OWNER="", PARENT_TABLE="Product" CHILD_OWNER="", CHILD_TABLE="Product_Paint" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_9", FK_COLUMNS="product_id""factory_name" */ UPDATE Product_Paint SET /* %SetFK(Product_Paint,NULL) */ Product_Paint.product_id = NULL, Product_Paint.factory_name = NULL WHERE NOT EXISTS ( SELECT * FROM Product WHERE /* %JoinFKPK(:%New,Product," = "," AND") */ :new.product_id = Product.product_id AND :new.factory_name = Product.factory_name ) /* %JoinPKPK(Product_Paint,:%New," = "," AND") */ and Product_Paint.paint_id = :new.paint_id; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Product_Paint AFTER UPDATE ON Product_Paint for each row -- ERwin Builtin Trigger -- UPDATE trigger on Product_Paint DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Product Product_Paint on child update no action */ /* ERWIN_RELATION:CHECKSUM="00012967", PARENT_OWNER="", PARENT_TABLE="Product" CHILD_OWNER="", CHILD_TABLE="Product_Paint" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_9", FK_COLUMNS="product_id""factory_name" */ SELECT count(*) INTO NUMROWS FROM Product WHERE /* %JoinFKPK(:%New,Product," = "," AND") */ :new.product_id = Product.product_id AND :new.factory_name = Product.factory_name; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ :new.product_id IS NOT NULL AND :new.factory_name IS NOT NULL AND NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Product_Paint because Product does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tD_Task AFTER DELETE ON Task for each row -- ERwin Builtin Trigger -- DELETE trigger on Task DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Task Task_Rate on parent delete restrict */ /* ERWIN_RELATION:CHECKSUM="0000dbe2", PARENT_OWNER="", PARENT_TABLE="Task" CHILD_OWNER="", CHILD_TABLE="Task_Rate" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_5", FK_COLUMNS="task_description" */ SELECT count(*) INTO NUMROWS FROM Task_Rate WHERE /* %JoinFKPK(Task_Rate,:%Old," = "," AND") */ Task_Rate.task_description = :old.task_description; IF (NUMROWS > 0) THEN raise_application_error( -20001, 'Cannot delete Task because Task_Rate exists.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Task BEFORE INSERT ON Task for each row -- ERwin Builtin Trigger -- INSERT trigger on Task DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Job Task on child insert set null */ /* ERWIN_RELATION:CHECKSUM="0000dda3", PARENT_OWNER="", PARENT_TABLE="Job" CHILD_OWNER="", CHILD_TABLE="Task" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_4", FK_COLUMNS="job_number" */ UPDATE Task SET /* %SetFK(Task,NULL) */ Task.job_number = NULL WHERE NOT EXISTS ( SELECT * FROM Job WHERE /* %JoinFKPK(:%New,Job," = "," AND") */ :new.job_number = Job.job_number ) /* %JoinPKPK(Task,:%New," = "," AND") */ and Task.task_description = :new.task_description; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Task AFTER UPDATE ON Task for each row -- ERwin Builtin Trigger -- UPDATE trigger on Task DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Task Task_Rate on parent update restrict */ /* ERWIN_RELATION:CHECKSUM="0002041e", PARENT_OWNER="", PARENT_TABLE="Task" CHILD_OWNER="", CHILD_TABLE="Task_Rate" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_5", FK_COLUMNS="task_description" */ IF /* %JoinPKPK(:%Old,:%New," <> "," OR ") */ :old.task_description <> :new.task_description THEN SELECT count(*) INTO NUMROWS FROM Task_Rate WHERE /* %JoinFKPK(Task_Rate,:%Old," = "," AND") */ Task_Rate.task_description = :old.task_description; IF (NUMROWS > 0) THEN raise_application_error( -20005, 'Cannot update Task because Task_Rate exists.' ); END IF; END IF; /* ERwin Builtin Trigger */ /* Job Task on child update no action */ /* ERWIN_RELATION:CHECKSUM="00000000", PARENT_OWNER="", PARENT_TABLE="Job" CHILD_OWNER="", CHILD_TABLE="Task" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_4", FK_COLUMNS="job_number" */ SELECT count(*) INTO NUMROWS FROM Job WHERE /* %JoinFKPK(:%New,Job," = "," AND") */ :new.job_number = Job.job_number; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ :new.job_number IS NOT NULL AND NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Task because Job does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tI_Task_Rate BEFORE INSERT ON Task_Rate for each row -- ERwin Builtin Trigger -- INSERT trigger on Task_Rate DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Task Task_Rate on child insert restrict */ /* ERWIN_RELATION:CHECKSUM="0000e787", PARENT_OWNER="", PARENT_TABLE="Task" CHILD_OWNER="", CHILD_TABLE="Task_Rate" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_5", FK_COLUMNS="task_description" */ SELECT count(*) INTO NUMROWS FROM Task WHERE /* %JoinFKPK(:%New,Task," = "," AND") */ :new.task_description = Task.task_description; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20002, 'Cannot insert Task_Rate because Task does not exist.' ); END IF; -- ERwin Builtin Trigger END; / CREATE TRIGGER tU_Task_Rate AFTER UPDATE ON Task_Rate for each row -- ERwin Builtin Trigger -- UPDATE trigger on Task_Rate DECLARE NUMROWS INTEGER; BEGIN /* ERwin Builtin Trigger */ /* Task Task_Rate on child update restrict */ /* ERWIN_RELATION:CHECKSUM="0000e59f", PARENT_OWNER="", PARENT_TABLE="Task" CHILD_OWNER="", CHILD_TABLE="Task_Rate" P2C_VERB_PHRASE="", C2P_VERB_PHRASE="", FK_CONSTRAINT="R_5", FK_COLUMNS="task_description" */ SELECT count(*) INTO NUMROWS FROM Task WHERE /* %JoinFKPK(:%New,Task," = "," AND") */ :new.task_description = Task.task_description; IF ( /* %NotnullFK(:%New," IS NOT NULL AND") */ NUMROWS = 0 ) THEN raise_application_error( -20007, 'Cannot update Task_Rate because Task does not exist.' ); END IF; -- ERwin Builtin Trigger END; /
-- phpMyAdmin SQL Dump -- version 4.7.9 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3307 -- Generation Time: Jun 13, 2018 at 02:10 AM -- Server version: 10.2.14-MariaDB -- PHP Version: 5.6.35 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `db_ams` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- DROP TABLE IF EXISTS `admin`; CREATE TABLE IF NOT EXISTS `admin` ( `admin_id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(15) NOT NULL, `password` varchar(12) NOT NULL, `firstname` varchar(30) NOT NULL, `middlename` varchar(30) NOT NULL, `lastname` varchar(30) NOT NULL, PRIMARY KEY (`admin_id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`admin_id`, `username`, `password`, `firstname`, `middlename`, `lastname`) VALUES (1, 'admin', 'admin', 'Private', '', 'Administrator'); -- -------------------------------------------------------- -- -- Table structure for table `courses` -- DROP TABLE IF EXISTS `courses`; CREATE TABLE IF NOT EXISTS `courses` ( `course_no` int(10) NOT NULL AUTO_INCREMENT, `course_id` varchar(10) NOT NULL, `programme_name` varchar(100) NOT NULL, `programme_code` varchar(20) NOT NULL, `course_year` year(4) NOT NULL, `course_month` varchar(10) NOT NULL, PRIMARY KEY (`course_no`) ) ENGINE=MyISAM AUTO_INCREMENT=37 DEFAULT CHARSET=latin1; -- -- Dumping data for table `courses` -- INSERT INTO `courses` (`course_no`, `course_id`, `programme_name`, `programme_code`, `course_year`, `course_month`) VALUES (23, 'GDC2017F', 'Graduate Diploma in Computing', 'GDC', 2017, 'February'), (24, 'GDC2017J', 'Graduate Diploma in Computing', 'GDC', 2017, 'July'), (32, 'GDB2017J', 'Graduate Diploma in Business', 'GDB', 2017, 'July'), (33, 'GDB2018F', 'Graduate Diploma in Business', 'GDB', 2018, 'February'), (26, 'GDCPM2017J', 'Graduate Diploma in Construction Project Management', 'GDCPM', 2017, 'July'), (27, 'GDC2018F', 'Graduate Diploma in Computing', 'GDC', 2018, 'February'), (31, 'GDB2017F', 'Graduate Diploma in Business', 'GDB', 2017, 'February'), (29, 'GDCPM2017J', 'Graduate Diploma in Construction Project Management', 'GDCPM', 2017, 'July'), (30, 'GDCPM2018F', 'Graduate Diploma in Construction Project Management', 'GDCPM', 2018, 'February'), (34, 'BAS2017F', 'Bachelor of Applied Science', 'BAS', 2017, 'February'), (35, 'BAS2017J', 'Bachelor of Applied Science', 'BAS', 2017, 'July'), (36, 'BAS2018F', 'Bachelor of Applied Science', 'BAS', 2018, 'February'); -- -------------------------------------------------------- -- -- Table structure for table `faculty` -- DROP TABLE IF EXISTS `faculty`; CREATE TABLE IF NOT EXISTS `faculty` ( `faculty_id` int(11) NOT NULL AUTO_INCREMENT, `faculty_name` varchar(50) NOT NULL, `faculty_email` varchar(50) NOT NULL, `faculty_password` varchar(20) NOT NULL, PRIMARY KEY (`faculty_id`) ) ENGINE=MyISAM AUTO_INCREMENT=200011 DEFAULT CHARSET=latin1; -- -- Dumping data for table `faculty` -- INSERT INTO `faculty` (`faculty_id`, `faculty_name`, `faculty_email`, `faculty_password`) VALUES (200010, 'mark foad', 'foad2gmail.com', 'mark123'), (200009, 'Hyme latif', 'latif@gmail.com', 'Hyme123'); -- -------------------------------------------------------- -- -- Table structure for table `manage_faculty` -- DROP TABLE IF EXISTS `manage_faculty`; CREATE TABLE IF NOT EXISTS `manage_faculty` ( `manage_faculty_id` int(11) NOT NULL AUTO_INCREMENT, `course_id` varchar(10) NOT NULL, `subject_id` varchar(10) NOT NULL, `faculty_id` int(11) NOT NULL, PRIMARY KEY (`manage_faculty_id`), KEY `course_id` (`course_id`), KEY `subject_id` (`subject_id`), KEY `faculty_id` (`faculty_id`) ) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1; -- -- Dumping data for table `manage_faculty` -- INSERT INTO `manage_faculty` (`manage_faculty_id`, `course_id`, `subject_id`, `faculty_id`) VALUES (13, 'GDC2017F', 'CSC', 200010), (14, 'GDC2017F', 'RM', 200009); -- -------------------------------------------------------- -- -- Table structure for table `manage_subject` -- DROP TABLE IF EXISTS `manage_subject`; CREATE TABLE IF NOT EXISTS `manage_subject` ( `id` int(10) NOT NULL AUTO_INCREMENT, `course_id` varchar(20) NOT NULL, `subject_id` varchar(20) NOT NULL, `subject_name` varchar(100) NOT NULL, `status` int(2) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `course_id` (`course_id`) ) ENGINE=MyISAM AUTO_INCREMENT=115 DEFAULT CHARSET=latin1; -- -- Dumping data for table `manage_subject` -- INSERT INTO `manage_subject` (`id`, `course_id`, `subject_id`, `subject_name`, `status`) VALUES (92, 'GDB2017F', 'AHRM', 'Applied Human Resource Management', 0), (55, 'GDC2017J', 'CADD', 'Cloud Application Design and Development', 0), (42, 'GDC2017F', 'ISA', 'Information Systems and Analysis', 0), (43, 'GDC2017F', 'CSC', 'Computer Systems Security', 1), (44, 'GDC2017F', 'ADC', 'Advanced Data Communications', 0), (45, 'GDC2017F', 'NDI', 'Network Design and Implementation', 0), (46, 'GDC2017F', 'RM', 'Risk Management', 1), (47, 'GDC2017F', 'MSD', 'Mobile Software Development', 0), (48, 'GDC2017F', 'CADD', 'Cloud Application Design and Development', 0), (49, 'GDC2017J', 'ISA', 'Information Systems and Analysis', 1), (50, 'GDC2017J', 'CSC', 'Computer Systems Security', 1), (51, 'GDC2017J', 'ADC', 'Advanced Data Communications', 0), (52, 'GDC2017J', 'NDI', 'Network Design and Implementation', 0), (53, 'GDC2017J', 'RM', 'Risk Management', 0), (54, 'GDC2017J', 'MSD', 'Mobile Software Development', 0), (91, 'GDB2017F', 'OS', 'Organizational Strategies', 1), (61, 'GDCPM2017J', 'DF', 'Development and Finance', 0), (62, 'GDCPM2017J', 'PMP', 'Project Management Practice', 0), (63, 'GDCPM2017J', 'CA', 'Contract Administration', 0), (64, 'GDCPM2017J', 'PM', 'Property Management', 0), (65, 'GDCPM2017J', 'UE', 'Urban Economics', 1), (66, 'GDC2018F', 'ISA', 'Information Systems and Analysis', 0), (67, 'GDC2018F', 'CSC', 'Computer Systems Security', 0), (68, 'GDC2018F', 'ADC', 'Advanced Data Communications', 0), (69, 'GDC2018F', 'NDI', 'Network Design and Implementation', 0), (70, 'GDC2018F', 'RM', 'Risk Management', 0), (71, 'GDC2018F', 'MSD', 'Mobile Software Development', 0), (72, 'GDC2018F', 'CADD', 'Cloud Application Design and Development', 0), (90, 'GDB2017F', 'TDM', 'Talent Development and Management', 0), (89, 'GDB2017F', 'ERL', 'Employee Relations and Legislation', 1), (88, 'GDB2017F', 'SIB', 'Sustainability in Business', 0), (78, 'GDCPM2017J', 'DF', 'Development and Finance', 0), (79, 'GDCPM2017J', 'PMP', 'Project Management Practice', 0), (80, 'GDCPM2017J', 'CA', 'Contract Administration', 0), (81, 'GDCPM2017J', 'PM', 'Property Management', 0), (82, 'GDCPM2017J', 'UE', 'Urban Economics', 0), (83, 'GDCPM2018F', 'DF', 'Development and Finance', 0), (84, 'GDCPM2018F', 'PMP', 'Project Management Practice', 1), (85, 'GDCPM2018F', 'CA', 'Contract Administration', 0), (86, 'GDCPM2018F', 'PM', 'Property Management', 0), (87, 'GDCPM2018F', 'UE', 'Urban Economics', 0), (93, 'GDB2017J', 'SIB', 'Sustainability in Business', 0), (94, 'GDB2017J', 'ERL', 'Employee Relations and Legislation', 0), (95, 'GDB2017J', 'TDM', 'Talent Development and Management', 0), (96, 'GDB2017J', 'OS', 'Organizational Strategies', 0), (97, 'GDB2017J', 'AHRM', 'Applied Human Resource Management', 0), (98, 'GDB2018F', 'SIB', 'Sustainability in Business', 0), (99, 'GDB2018F', 'ERL', 'Employee Relations and Legislation', 0), (100, 'GDB2018F', 'TDM', 'Talent Development and Management', 0), (101, 'GDB2018F', 'OS', 'Organizational Strategies', 0), (102, 'GDB2018F', 'AHRM', 'Applied Human Resource Management', 0), (103, 'BAS2017F', 'CRT', 'Clinical Reasoning and Therapeutics', 0), (104, 'BAS2017F', 'CTH', 'Current Trends in Healthcare', 0), (105, 'BAS2017F', 'AR', 'Advanced Research', 0), (106, 'BAS2017F', 'OP', 'Osteopathic Practice', 0), (107, 'BAS2017J', 'CRT', 'Clinical Reasoning and Therapeutics', 0), (108, 'BAS2017J', 'CTH', 'Current Trends in Healthcare', 0), (109, 'BAS2017J', 'AR', 'Advanced Research', 0), (110, 'BAS2017J', 'OP', 'Osteopathic Practice', 0), (111, 'BAS2018F', 'CRT', 'Clinical Reasoning and Therapeutics', 0), (112, 'BAS2018F', 'CTH', 'Current Trends in Healthcare', 0), (113, 'BAS2018F', 'AR', 'Advanced Research', 0), (114, 'BAS2018F', 'OP', 'Osteopathic Practice', 0); -- -------------------------------------------------------- -- -- Table structure for table `programme` -- DROP TABLE IF EXISTS `programme`; CREATE TABLE IF NOT EXISTS `programme` ( `programme_code` varchar(10) NOT NULL, `programme_name` varchar(100) NOT NULL, PRIMARY KEY (`programme_code`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `programme` -- INSERT INTO `programme` (`programme_code`, `programme_name`) VALUES ('GDC', 'Graduate Diploma in Computing'), ('GDCPM', 'Graduate Diploma in Construction Project Management'), ('GDB', 'Graduate Diploma in Business '), ('BAS', 'Bachelor of Applied Science'), ('FDC', 'Food deploy and Compare'); -- -------------------------------------------------------- -- -- Table structure for table `student` -- DROP TABLE IF EXISTS `student`; CREATE TABLE IF NOT EXISTS `student` ( `student_id` int(11) NOT NULL AUTO_INCREMENT, `firstname` varchar(30) NOT NULL, `middlename` varchar(30) NOT NULL, `lastname` varchar(30) NOT NULL, `email` varchar(50) NOT NULL, `course` varchar(100) NOT NULL, `course_year` year(4) NOT NULL, `course_month` varchar(10) NOT NULL, `course_id` varchar(10) NOT NULL, PRIMARY KEY (`student_id`) ) ENGINE=InnoDB AUTO_INCREMENT=100027 DEFAULT CHARSET=latin1; -- -- Dumping data for table `student` -- INSERT INTO `student` (`student_id`, `firstname`, `middlename`, `lastname`, `email`, `course`, `course_year`, `course_month`, `course_id`) VALUES (100019, 'Albin', '', 'Lukose', 'albin@gmail.com', 'Graduate Diploma in Business', 2017, 'February', 'GDC2017F'), (100020, 'jose', '', 'pullan', 'jose@gmail.com', 'Graduate Diploma in Construction Project Management', 2018, 'February', 'GDCPM2018F'), (100024, 'Renjith', '', 'sp', 'r@gmail.com', 'Graduate Diploma in Computing', 2017, 'February', 'GDC2017F'), (100025, 'varun', '', 'sankar', 'v@gmail.com', 'Graduate Diploma in Computing', 2017, 'February', 'GDC2017F'), (100026, 'jishnu', '', 'rama', 'j@gmail.com', 'Graduate Diploma in Construction Project Management', 2018, 'February', 'GDCPM2018F'); -- -------------------------------------------------------- -- -- Table structure for table `student_login` -- DROP TABLE IF EXISTS `student_login`; CREATE TABLE IF NOT EXISTS `student_login` ( `student_id` int(11) NOT NULL, `student_username` varchar(50) NOT NULL, `student_password` varchar(20) NOT NULL, `course_id` varchar(10) NOT NULL, PRIMARY KEY (`student_username`), KEY `student_id` (`student_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `student_login` -- INSERT INTO `student_login` (`student_id`, `student_username`, `student_password`, `course_id`) VALUES (100019, 'albin@gmail.com', 'Lukose2017', 'GDB2017F'), (100020, 'jose@gmail.com', 'pullan2018', 'GDCPM2018F'), (1000254, 'a@b.c', '123', 'GDC2017J'), (100024, 'r@gmail.com', 'sp2017', 'GDC2017F'), (100025, 'v@gmail.com', 'sankar2017', 'GDC2017F'), (100026, 'j@gmail.com', 'rama2018', 'GDCPM2018F'); -- -------------------------------------------------------- -- -- Table structure for table `subjects` -- DROP TABLE IF EXISTS `subjects`; CREATE TABLE IF NOT EXISTS `subjects` ( `subject_id` varchar(10) NOT NULL, `subject_name` varchar(100) NOT NULL, `programme_code` varchar(20) NOT NULL, PRIMARY KEY (`subject_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `subjects` -- INSERT INTO `subjects` (`subject_id`, `subject_name`, `programme_code`) VALUES ('ISA', 'Information Systems and Analysis', 'GDC'), ('CSC', 'Computer Systems Security', 'GDC'), ('ADC', 'Advanced Data Communications', 'GDC'), ('NDI', 'Network Design and Implementation', 'GDC'), ('RM', 'Risk Management', 'GDC'), ('MSD', 'Mobile Software Development', 'GDC'), ('CADD', 'Cloud Application Design and Development', 'GDC'), ('DF', 'Development and Finance', 'GDCPM'), ('PMP', 'Project Management Practice', 'GDCPM'), ('CA', 'Contract Administration', 'GDCPM'), ('PM', 'Property Management', 'GDCPM'), ('UE', 'Urban Economics', 'GDCPM'), ('SIB', 'Sustainability in Business', 'GDB'), ('ERL', 'Employee Relations and Legislation', 'GDB'), ('TDM', 'Talent Development and Management', 'GDB'), ('OS', 'Organizational Strategies', 'GDB'), ('AHRM', 'Applied Human Resource Management', 'GDB'), ('CRT', 'Clinical Reasoning and Therapeutics', 'BAS'), ('CTH', 'Current Trends in Healthcare', 'BAS'), ('AR', 'Advanced Research', 'BAS'), ('OP', 'Osteopathic Practice', 'BAS'); -- -------------------------------------------------------- -- -- Table structure for table `temp_attendance` -- DROP TABLE IF EXISTS `temp_attendance`; CREATE TABLE IF NOT EXISTS `temp_attendance` ( `subject_id` varchar(10) NOT NULL, `faculty_id` int(11) NOT NULL, `student_id` int(11) NOT NULL, `attedance_date` date NOT NULL, `attendance` tinyint(1) NOT NULL, KEY `subject_id` (`subject_id`), KEY `faculty_id` (`faculty_id`), KEY `student_id` (`student_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `time` -- DROP TABLE IF EXISTS `time`; CREATE TABLE IF NOT EXISTS `time` ( `time_id` int(11) NOT NULL AUTO_INCREMENT, `student_no` int(6) NOT NULL, `student_name` varchar(50) NOT NULL, `time` time NOT NULL, `date` date NOT NULL, PRIMARY KEY (`time_id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- -- Dumping data for table `time` -- INSERT INTO `time` (`time_id`, `student_no`, `student_name`, `time`, `date`) VALUES (1, 121299, 'John Connor', '13:45:00', '2016-12-29'), (2, 121299, 'John Connor', '13:46:00', '2016-12-29'); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
SELECT * FROM Students WHERE City IN ('Philadelphia' , 'Trenton');
/*5. Realizati un query in care sa afisati toti angajatii care au salariul mai mare decat media oficiului in care lucreaza. a. Pentru fiecare inregistrare, va trebui sa afisati numele si prenumele angajatului, codul oficiului in care lucreaza si salariul acestuia. b. Adaugati o coloana in care sa afisati, pentru fiecare inregistrare, media salariala a oficiului in care lucreaza. [Vom numi aceasta coloana OFFICE_AVG_SAL] c. Adaugati doua coloane in care sa afisati, pentru fiecare inregistrare: i.cel mai mic salariu din oficiu care este mai mare decat media salariala a oficiului. [Vom numi aceasta coloana SMALLEST_SALARY_ABOVE_AVG_SAL] ii.media salariala a tuturor salariilor peste media salariala a oficiului. [Vom numi aceasta coloana OFFICE_TOP_AVG_SAL] d. Adaugati o coloana numita raportare in care sa afisati: i.'over TOP_AVG', daca salariul respectivului este mai mare decat OFFICE_TOP_AVG_SAL ii.'under TOP_AVG', daca salariul respectivului este mai mic decat OFFICE_TOP_AVG_SAL*/ SELECT X.COD_OFICIU, X.NUME, X.PRENUME, X.SALARIU, ROUND(X.OFFICE_AVG_SAL) AS OFFICE_AVG_SAL , Y.OFFICE_TOP_AVG_SAL, Y.SMALLEST_SALARY_ABOVE_AVG_SAL, CASE WHEN X.SALARIU > Y.OFFICE_TOP_AVG_SAL THEN '> upperAVG' WHEN X.SALARIU < Y.OFFICE_TOP_AVG_SAL THEN '< upperAVG' ELSE '= upperAvg' END AS "RAPOARTE" FROM ( SELECT NUME, PRENUME, COD_OFICIU, SALARIU, AVG(SALARIU) OVER (PARTITION BY COD_OFICIU ORDER BY COD_OFICIU) OFFICE_AVG_SAL FROM AB_ANGAJATI2 ) X INNER JOIN (SELECT AB_ANGAJATI2.COD_OFICIU, MIN(AB_ANGAJATI2.SALARIU) SMALLEST_SALARY_ABOVE_AVG_SAL, AVG(AB_ANGAJATI2.SALARIU) OFFICE_TOP_AVG_SAL FROM ( SELECT COD_OFICIU, AVG(SALARIU) AVG_SAL FROM AB_ANGAJATI2 GROUP BY COD_OFICIU ) s JOIN AB_ANGAJATI2 ON s.COD_OFICIU = AB_ANGAJATI2.COD_OFICIU WHERE AB_ANGAJATI2.SALARIU >= s.AVG_SAL GROUP BY AB_ANGAJATI2.COD_OFICIU ) Y ON X.COD_OFICIU = Y.COD_OFICIU WHERE X.SALARIU > OFFICE_AVG_SAL; /*6: Modificati query-ul de mai sus astfel incat sa afiseze doar inregistrarile din oficiile care returneaza minim doua rezultate. */ SELECT COD_OFICIU, NUME, PRENUME, SALARIU, ROUND(OFFICE_AVG_SAL) AS OFFICE_AVG_SAL, OFFICE_TOP_AVG_SAL, SMALLEST_SALARY_ABOVE_AVG_SAL, Rapoarte FROM( SELECT X.NUME , X.PRENUME , X.COD_OFICIU, X.SALARIU, X.OFFICE_AVG_SAL, Y.SMALLEST_SALARY_ABOVE_AVG_SAL, Y.OFFICE_TOP_AVG_SAL, CASE WHEN X.SALARIU > Y.OFFICE_TOP_AVG_SAL THEN '> upperAVG' WHEN X.SALARIU < Y.OFFICE_TOP_AVG_SAL THEN '< upperAVG' ELSE '= upperAvg' END AS "RAPOARTE" , COUNT(X.COD_OFICIU) OVER (PARTITION BY X.COD_OFICIU ORDER BY X.COD_OFICIU) NR_ANGAJATI FROM ( SELECT NUME, PRENUME, COD_OFICIU, SALARIU, AVG(SALARIU) OVER (PARTITION BY COD_OFICIU ORDER BY COD_OFICIU) OFFICE_AVG_SAL FROM AB_ANGAJATI2 ) X INNER JOIN (SELECT AB_ANGAJATI2.COD_OFICIU, MIN(AB_ANGAJATI2.SALARIU) SMALLEST_SALARY_ABOVE_AVG_SAL, AVG(AB_ANGAJATI2.SALARIU) OFFICE_TOP_AVG_SAL FROM ( SELECT COD_OFICIU, AVG(SALARIU) AVG_SAL FROM AB_ANGAJATI2 GROUP BY COD_OFICIU ) s JOIN AB_ANGAJATI2 ON s.COD_OFICIU = AB_ANGAJATI2.COD_OFICIU WHERE AB_ANGAJATI2.SALARIU >= s.AVG_SAL GROUP BY AB_ANGAJATI2.COD_OFICIU ) Y ON X.COD_OFICIU = Y.COD_OFICIU WHERE X.SALARIU > OFFICE_AVG_SAL ) WHERE NR_ANGAJATI >1;
delimiter // drop function if exists Chattahoochee.getPrimaryAddress// create function Chattahoochee.getPrimaryAddress ( CustomerID INT ) returns INT DETERMINISTIC begin select address_id into @addrid from Addresses where cust_id = CustomerID and is_primary = 1 LIMIT 1; return @addrid; end// delimiter ;
--SET STATISTICS PROFILE OFF SELECT LINE_D [STATEMENT], --dbo.STRING_PADLEFT(COALESCE(FORMAT(X1/1000000,'#,##0.0'),''),15,' ') AS [2015], X1/1000000 AS [15Q1], --dbo.STRING_PADLEFT(COALESCE(FORMAT(X2/1000000,'#,##0.0'),''),15,' ') AS [2016], X2/1000000 AS [15Q2], --dbo.STRING_PADLEFT(COALESCE(FORMAT(X3/1000000,'#,##0.0'),''),15,' ') AS [2017] X3/1000000 AS [15Q3], --dbo.STRING_PADLEFT(COALESCE(FORMAT(X3/1000000,'#,##0.0'),''),15,' ') AS [2017] X4/1000000 AS [15Q4] FROM ( SELECT 'X1' X, STMT, LINE, STAT, LINE_D, PVALUE FROM STMT.STMT_PERDRANGE_P('1503','1504','CGSOESS','19') UNION ALL SELECT 'X2' X, STMT, LINE, STAT, LINE_D, PVALUE FROM STMT.STMT_PERDRANGE_P('1505','1507','CGSOESS','19') UNION ALL SELECT 'X3' X, STMT, LINE, STAT, LINE_D, PVALUE FROM STMT.STMT_PERDRANGE_P('1508','1510','CGSOESS','19') UNION ALL SELECT 'X4' X, STMT, LINE, STAT, LINE_D, PVALUE FROM STMT.STMT_PERDRANGE_P('1511','1513','CGSOESS','19') ) S PIVOT ( SUM(PVALUE) FOR X IN ([X1],[X2],[X3],[X4]) ) AS PVT ORDER BY LINE OPTION (MAXDOP 8)
SELECT client_pref_channel_config_id, client_preference_id, chan.channel_id AS channel_id, chan.channel_name AS channel_name, selected_permitted FROM dc_ui.client_pref_channel_config AS cfg RIGHT OUTER JOIN dc_ui.channel AS chan ON cfg.channel_id = chan.channel_id WHERE cfg.client_preference_id = $1 ORDER BY chan.channel_name
CREATE procedure sp_acc_insert_group ( @GROUPNAME nvarchar(255), @ACCOUNTTYPE int, @PARENTGROUP int) AS INSERT INTO AccountGroup(GroupName, AccountType, ParentGroup, Active, Fixed) Values (@GROUPNAME, @ACCOUNTTYPE, @PARENTGROUP, 1, 0)
CREATE DATABASE CarDealershipDB; Use CarDealershipDB; CREATE TABLE Cars( Id INT PRIMARY KEY IDENTITY(1,1), Make NVARCHAR(20) NOT NULL, Model NVARCHAR(20) NOT NULL, [Year] SMALLINT NOT NULL, Color NVARCHAR(20) NOT NULL ); INSERT INTO Cars VALUES ('Honda', 'Odyssey', 2007, 'Light Blue'), ('Subaru','Outback', 2009, 'Tan'), ('Mini Cooper', 'Countryman SW4', 2014, 'White w/ Black Top'), ('Maserati', 'DBSQ4', 2015, 'Graphite')
-- 适用于Proc_Board_SalesRanking_Salesman,参数:Salesman,TotalAmount -- Proc_Board_SalesRanking_Product,参数:ENGItemName(ItemNo) as sName,TotalAmount,OrderQty -- Proc_Board_SalesRanking_Customers,参数:CustomerShortName,TotalAmount declare sItemName text; -- 保存销售员姓名html信息 declare sItemValue text; -- 保存销售员业绩html信息 declare sUp varchar(4000); -- 增长html标记 declare sDown varchar(4000); -- 减少html标记 declare sLevel varchar(4000); create table if not exists Board_SalesRanking_Salesman ( ItemName text, ItemValue text); begin local variable: declare sSalesman varchar(255); declare fTotalAmount decimal(18,2); -- 今年业绩总额 declare fLastTotalAmount decimal(18,2); -- 去年该业务员同期业绩 declare fGlowRate decimal(18,2); -- 业绩增长率 declare iRowNo int; -- 今年排名 declare iLastRowNo int default 0; -- 去年该业务员的同期排名 declare iGlowNo int default 0; -- 排名增长率 declare Cursor_Board_SalesRanking_Salesman cursor for 今年销售员排行 loop start if 循环结束 then leave loop set iRowNo=销售排名,sSalesman=销售员名字,fTotalAmount销售量; if iRowNo=第1 then 拼接第一名sItemName if iRowNo=第2 then 拼接第二名sItemName if iRowNo=第3 then 拼接第三名sItemName else 拼接其他sItemName 清空之前循环数据set fLastTotalAmount = 0; 清空之前循环数据set fGlowRate = 0; 清空之前循环数据set iLastRowNo = 0; set fLastTotalAmount=去年该业务员同期业绩 if 今年大于去年 then 算出业绩增长fGlowRate 拼接业绩增长sItemValue elseif 今年小于去年 then 算出业绩下降fGlowRate 拼接业绩下降sItemValue else 拼接其他业绩情况sItemValue set iLastRowNo=去年该业务员的同期排名 if 排名上升 then 算出排名增长fGlowNo 继业绩后继续拼接排名增长sItemValue elseif 排名下降 then 算出排名下降fGlowNo 继业绩后继续拼接排名下降sItemValue else 拼接其他排名情况sItemValue insert into Board_SalesRanking_Salesman(ItemName,ItemValue) values (sItemName,sItemValue); end loop end;
INSERT INTO delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) VALUES ('1', '1', '2019-08-01', '2019-08-02'); INSERT INTO delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) VALUES ('2', '5', '2019-08-02', '2019-08-02'); INSERT INTO delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) VALUES ('3', '1', '2019-08-11', '2019-08-11'); INSERT INTO delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) VALUES ('4', '3', '2019-08-24', '2019-08-26'); INSERT INTO delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) VALUES ('5', '4', '2019-08-21', '2019-08-22'); INSERT INTO delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) VALUES ('6', '2', '2019-08-11', '2019-08-13');
--修改人:李德成 --修改时间:2012-10-11 create or replace trigger TRI_LOANSEND_status after UPDATE ON cms_loan_deferred FOR EACH ROW -------------------------------------------------------- -- SYSTEM: 拜特资金管理系统 -- SUBSYS: 信贷模块 -- DESCRIPTION: 当贷款展期cs确认之后更改贷款发放表的状态 -- AUTHOR: lidecheng -- CREATE DATE: 20111011 -- EDIT HISTORY: -- 20101029 HUANGCH 功能说明 -------------------------------------------------------- declare -- local variables here begin if :new.status =102 then update loan_send_out_info set status = 104 where bill_code = :new.li_code; end if; end TRI_LOANSEND_status ; /
{{ config(MATERIALIZED='table') }} with cte as ( select *, row_number() over (partition by symbol order by symbol) num from {{ ref('stg_stock_history') }} where date = (select max(date) from {{ source('zepl_us_stocks_daily', 'stock_history') }} where symbol = 'SBUX') ) select symbol, date, open, high, low, close, volume, adjclose from cte where num = 1 order by symbol
-- May 12, 2008 11:25:19 AM EST -- BF1962125 entitytype incorrect for IsRegistered in table HR_Movement UPDATE AD_Column SET EntityType='EE02',Updated=TO_DATE('2008-05-12 11:25:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55031 ; -- May 12, 2008 11:25:19 AM EST -- BF1962125 entitytype incorrect for IsRegistered in table HR_Movement UPDATE AD_Field SET EntityType='EE02',Updated=TO_DATE('2008-05-12 11:55:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=55186 ;
-- Monte uma query que exiba a quantidade de clientes cadastrados na tabela -- sakila.customer que estão ativos e a quantidade que estão inativos. SELECT COUNT(*), active FROM sakila.customer GROUP BY active; -- Monte uma query para a tabela sakila.customer que exiba a quantidade de -- clientes ativos e inativos por loja. Os resultados devem conter o ID da loja , -- o status dos clientes (ativos ou inativos) e a quantidade de clientes por status . SELECT store_id, active, COUNT(*) FROM sakila.customer GROUP BY store_id, active; -- Monte uma query que exiba a média de duração por classificação indicativa ( rating ) -- dos filmes cadastrados na tabela sakila.film . Os resultados devem ser agrupados pela -- classificação indicativa e ordenados da maior média para a menor. SELECT AVG(rental_duration) AS Média, rating FROM sakila.film GROUP BY rating ORDER BY Média DESC; -- Monte uma query para a tabela sakila.address que exiba o nome do distrito e a -- quantidade de endereços registrados nele. Os resultados devem ser ordenados da -- maior quantidade para a menor. SELECT district, COUNT(*) AS Registros FROM sakila.address GROUP BY district ORDER BY Registros DESC; -- Usando a query a seguir, exiba apenas as durações médias que estão entre 115.0 a 121.50. -- Além disso, dê um alias (apelido) à coluna gerada por AVG(length) , de forma que deixe a -- query mais legível. Finalize ordenando os resultados de forma decrescente. SELECT rating, AVG(length) AS Tamanho FROM sakila.film GROUP BY rating HAVING Tamanho BETWEEN 115 AND 121.50 ORDER BY Tamanho DESC; -- Usando a query a seguir, exiba apenas os valores de total de substituição de custo- -- que estão acima de $3950.50. Dê um alias que faça sentido para SUM(replacement_cost) , -- de forma que deixe a query mais legível. Finalize ordenando os resultados de forma crescente. SELECT rating, SUM(replacement_cost) Substituição FROM sakila.film GROUP by rating HAVING Substituição > 3950.50 ORDER BY Substituição;
CREATE DATABASE IF NOT EXISTS xively_iostp; USE xively_iostp; CREATE TABLE IF NOT EXISTS permalinks( code VARCHAR(30) PRIMARY KEY, observation_kit_json TEXT NOT NULL, creation_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE USER 'xively_iostp'@'localhost' IDENTIFIED BY 'x1v3ly_i0stp'; GRANT ALL PRIVILEGES ON xively_iostp.* TO 'xively_iostp'@'localhost';
-- Total Money In/out SELECT SUM(money_in) FROM transactions; SELECT SUM(money_out) FROM transactions; -- number of transactions SELECT COUNT(money_in) as 'Number of Transactions' FROM transactions; SELECT COUNT(money_in) as 'Bitcoin Transactions' FROM transactions WHERE currency = 'BIT'; -- biggest transactions SELECT MAX(money_in) FROM transactions; SELECT MAX(money_out) FROM transactions; -- biggest transactions for each currency type-- SELECT currency, MAX (money_in) as 'Money In', MAX (money_out) as 'Money Out' FROM transactions GROUP by 1 ORDER by 1 ASC; -- Average Etherum transaction amount SELECT ROUND(AVG(money_in), 2) as 'Average Ethereum In', ROUND(AVG(money_out), 2) as 'Average Ethereum Out' FROM transactions WHERE currency = 'ETH'; -- Average Sale Ledger per date -- SELECT date, ROUND(AVG(money_in),2) as 'Average Sell', ROUND(AVG(money_out),2) as 'Average Buy' FROM transactions GROUP BY 1 ORDER BY 1 ASC;
Create Procedure SP_get_TaxCompSplitup(@TaxCode int, @TaxType int, @RegisterStatus int = 0) AS BEGIN If (Select IsNull(CS_TaxCode,0) From Tax Where Tax_Code = @TaxCode) > 0 Select TC.TaxComponent_code, TCD.TaxComponent_desc, Case When TC.ComponentType = 1 Then 'Percentage' Else 'Amount' End As 'ComponentType', TC.Tax_percentage, -- Case When isnull(TC.ApplicableonComp,0) = 0 Then 'Price' -- Else (Select TAC.TaxComponent_desc From TaxComponentDetail TAC -- Where TAC.TaxComponent_desc = TC.ApplicableOn) End As 'ApplicableOnComp', TC.ApplicableOn As 'ApplicableOnComp', TAO.ApplicableOnDesc, Case When isnull(TC.ApplicableUOM,0) =1 Then 'Base UOM' When isnull(TC.ApplicableUOM,0) = 2 Then 'UOM1' When isnull(TC.ApplicableUOM,0) = 3 Then 'UOM2' When isnull(TC.ApplicableUOM,0) = 0 Then '' End As 'ApplicableUOM', --Case When TC.TaxType = 1 Then 'Intra State' Else 'Inter State' End As 'TaxType', Case isnull(T.GSTFlag,0) When 0 Then (Case @TaxType When 2 then 'Outstation' ELSE 'Local' End) Else (Case @TaxType When 2 Then 'Inter State' ELSE 'Intra State' End) End 'TaxType', GC.GSTComponentDesc As 'GSTComponentDesc', Case When isnull(TC.FirstPoint,0) = 1 Then 'Yes' Else 'No' End as FirstPoint , Case When isnull(TC.RegisterStatus,0) = 1 Then 'Registered Only' When isnull(TC.RegisterStatus,0) = 2 Then 'UnRegistered Only' Else 'All' End As 'RegisterStatus' From Tax T Join TaxComponents TC on T.Tax_Code = TC.Tax_Code Join TaxComponentDetail TCD on TC.TaxComponent_code = TCD.TaxComponent_code Left Join TaxApplicableOn TAO on TAO.ApplicableOnCode = TC.ApplicableOnCode Left Join GSTComponent GC on GC.GSTComponentCode = TC.GSTComponentCode Where TC.Tax_Code = @TaxCode and TC.CSTaxType = @TaxType and (isnull(TC.RegisterStatus,0) = 0 or isnull(TC.RegisterStatus,0) = isnull(@RegisterStatus,0)) Order By TC.CS_ComponentCode --TC.CompLevel Else Select TC.TaxComponent_code, TCD.TaxComponent_desc, Case When TC.ComponentType = 1 Then 'Percentage' Else 'Amount' End As 'ComponentType', TC.Tax_percentage, -- Case When isnull(TC.ApplicableonComp,0) = 0 Then 'Price' -- Else (Select TAC.TaxComponent_desc From TaxComponentDetail TAC -- Where TAC.TaxComponent_desc = TC.ApplicableOn) End As 'ApplicableOnComp', TC.ApplicableOn As 'ApplicableOnComp', TAO.ApplicableOnDesc, Case When isnull(TC.ApplicableUOM,0) =1 Then 'Base UOM' When isnull(TC.ApplicableUOM,0) = 2 Then 'UOM1' When isnull(TC.ApplicableUOM,0) = 3 Then 'UOM2' When isnull(TC.ApplicableUOM,0) = 0 Then '' End As 'ApplicableUOM', --Case When TC.TaxType = 1 Then 'Intra State' Else 'Inter State' End As 'TaxType', Case isnull(T.GSTFlag,0) When 0 Then (Case @TaxType When 2 then 'Outstation' ELSE 'Local' End) Else (Case @TaxType When 2 Then 'Inter State' ELSE 'Intra State' End) End 'TaxType', GC.GSTComponentDesc As 'GSTComponentDesc', Case When isnull(TC.FirstPoint,0) = 1 Then 'Yes' Else 'No' End as FirstPoint , Case When isnull(TC.RegisterStatus,0) = 1 Then 'Registered Only' When isnull(TC.RegisterStatus,0) = 2 Then 'UnRegistered Only' Else 'All' End As 'RegisterStatus' From Tax T Join TaxComponents TC on T.Tax_Code = TC.Tax_Code Join TaxComponentDetail TCD on TC.TaxComponent_code = TCD.TaxComponent_code Left Join TaxApplicableOn TAO on TAO.ApplicableOnCode = TC.ApplicableOnCode Left Join GSTComponent GC on GC.GSTComponentCode = TC.GSTComponentCode Where TC.Tax_Code = @TaxCode and IsNull(TC.LST_Flag,0) = Case When @TaxType = 1 Then 1 Else 0 End and (isnull(TC.RegisterStatus,0) = 0 or isnull(TC.RegisterStatus,0) = isnull(@RegisterStatus,0)) Order By TC.CS_ComponentCode --TC.CompLevel END
ALTER TABLE users RENAME COLUMN user_name TO username;
CREATE TABLE person (person_id SMALLINT UNSIGNED, fname VARCHAR(20), lname VARCHAR(20), gender ENUM('M','F'),de birth_date DATE, street VARCHAR(30), city VARCHAR(20), state VARCHAR(20), country VARCHAR(20), postal_code VARCHAR(20), CONSTRAINT pk_person PRIMARY KEY (person_id) ); DESC person; CREATE TABLE favorite_food (person_id SMALLINT UNSIGNED, food VARCHAR(20), CONSTRAINT pk_favorite_food PRIMARY KEY (person_id, food), CONSTRAINT fk_fav_food_person_id FOREIGN KEY (person_id) REFERENCES person (person_id) ); DESC favorite_food; ALTER TABLE person MODIFY person_id SMALLINT UNSIGNED AUTO_INCREMENT; INSERT INTO person (person_id, fname, lname, gender, birth_date) VALUES (null, 'William','Turner', 'M', '1972-05-27'); SELECT person_id, fname, lname, birth_date FROM person; SELECT person_id, fname, lname, birth_date FROM person WHERE person_id = 1; SELECT person_id, fname, lname, birth_date FROM person WHERE lname = 'Turner'; INSERT INTO favorite_food (person_id, food) VALUES (1, 'pizza'); INSERT INTO favorite_food (person_id, food) VALUES (1, 'cookies'); INSERT INTO favorite_food (person_id, food) VALUES (1, 'nachos'); SELECT food FROM favorite_food WHERE person_id = 1 ORDER BY food; INSERT INTO person (person_id, fname, lname, gender, birth_date, street, city, state, country, postal_code) VALUES (null, 'Susan','Smith', 'F', '1975-11-02','23 Maple St.', 'Arlington', 'VA', 'USA', '20220'); SELECT person_id, fname, lname, birth_date FROM person; --SELECT * FROM favorite_food --FOR XML AUTO, ELEMENTS; ??? UPDATE person SET street = '1225 Tremont St.', city = 'Boston', state = 'MA', country = 'USA', postal_code = '02138' WHERE person_id = 1; DELETE FROM person WHERE person_id = 2; INSERT INTO person (person_id, fname, lname, gender, birth_date) VALUES (1, 'Charles','Fulton', 'M', '1968-01-15'); INSERT INTO favorite_food (person_id, food) VALUES (999, 'lasagna'); UPDATE person SET gender = 'Z' WHERE person_id = 1; UPDATE person SET birth_date = 'DEC-21-1980' WHERE person_id = 1; UPDATE person SET birth_date = str_to_date('DEC-21-1980' , '%b-%d-%Y') WHERE person_id = 1;
LOAD CSV WITH HEADERS FROM "file:///persons.csv" AS row MERGE (person:Entity:Org:Person { id: row.login, email: row.email, name: row.name, role: row.role, slack: row.slack, github: row.github, github_url: row.github_url, location: row.location })