blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 3 276 | src_encoding stringclasses 33
values | length_bytes int64 23 9.61M | score float64 2.52 5.28 | int_score int64 3 5 | detected_licenses listlengths 0 44 | license_type stringclasses 2
values | text stringlengths 23 9.43M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
8415206e47d8487ac5b9c0c5a13b5d3fa8bdfcc4 | SQL | zfleharty/RiskSenseTakeHome | /problem1/query.sql | UTF-8 | 574 | 4.03125 | 4 | [] | no_license | -- create a table
CREATE TABLE cars (
manufacturer TEXT NOT NULL,
model TEXT NOT NULL,
price INTEGER NOT NULL
);
-- insert data
INSERT INTO cars VALUES ('Toyota', 'Camry', 16000);
INSERT INTO cars VALUES ('Toyota', 'Hilander', 22000);
INSERT INTO cars VALUES ('Honda', 'Pilot',24000);
INSERT INTO cars VALUES ('Honda', 'Accor',17000);
-- fetch max values
select c.manufacturer, c.model, c.price
from (
Select manufacturer,max(price) as maxprice
from cars GROUP BY manufacturer
) as x inner join cars as c on c.manufacturer = x.manufacturer and c.price = x.maxprice;
| true |
ed1163bfea7b426d8afd28243d7c5209d3caa6de | SQL | jimsmith/redshift-rate-throttling | /reports/Last Few Minutes.sql | UTF-8 | 360 | 3.171875 | 3 | [
"MIT"
] | permissive | -- Usage by minute for the last few data points (reverse chronologically)
SELECT
date(eventTime) || ' ' || strftime('%H-%M', eventTime) AS t
, count(*) AS num_api_calls
, userIdentityName AS by_user
, userAgent AS using_agent
, eventSource
FROM
cloudtrail
GROUP BY t, by_user, using_agent, eventSource
ORDER BY t DESC, num_api_calls DESC
LIMIT 24;
| true |
f64a2937e50d23662669e018c8d561e33fb624ca | SQL | hw79chopin/MySQL-Codebook | /SQL 스터디/프로그래머스/pmg(GROUP BY) 동명 동물 수 찾기.sql | UTF-8 | 389 | 3.296875 | 3 | [] | no_license | -- 동물 보호소에 들어온 동물 이름 중 두 번 이상 쓰인 이름과 해당 이름이 쓰인 횟수를 조회하는 SQL문을 작성해주세요.
-- 이때 결과는 이름이 없는 동물은 집계에서 제외하며, 결과는 이름 순으로 조회해주세요.
SELECT NAME, COUNT(NAME)
FROM ANIMAL_INS
GROUP BY NAME
HAVING COUNT(NAME) > 1
ORDER BY NAME; | true |
c88e64b8e5f9513ecb0d353432b8dbd6e7c1da05 | SQL | yingchauhuang/rsit | /db/Update_Fin.sql | UTF-8 | 25,574 | 2.84375 | 3 | [] | no_license | MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT003',F24 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT003')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F24
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT003',S.F24);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT003',F24 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT003')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F24
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT003',S.F24);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT004',F25 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT004')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F25
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT004',S.F25);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT004',F25 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT004')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F25
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT004',S.F25);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT009',F26 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT009')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F26
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT009',S.F26);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT009',F26 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT009')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F26
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT009',S.F26);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT010',F28 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT010')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F28
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT010',S.F28);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT010',F28 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT010')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F28
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT010',S.F28);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT014',F12 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT014')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F12
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT014',S.F12);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'ACT014',F12 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='ACT014')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F12
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'ACT014',S.F12);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'MKT001',F7 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='MKT001')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F7
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'MKT001',S.F7);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'MKT001',F7 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='MKT001')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F7
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'MKT001',S.F7);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'MKT002',F5 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='MKT002')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F5
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'MKT002',S.F5);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'MKT002',F5 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='MKT002')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F5
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'MKT002',S.F5);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'MKT009',F6 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='MKT009')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F6
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'MKT009',S.F6);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'MKT009',F6 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='MKT009')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F6
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'MKT009',S.F6);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'SRF003',F19 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='SRF003')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F19
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'SRF003',S.F19);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'SRF003',F19 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='SRF003')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F19
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'SRF003',S.F19);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'SRF008',F23 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='SRF008')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F23
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'SRF008',S.F23);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'SRF008',F23 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='SRF008')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F23
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'SRF008',S.F23);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'SRF008',F23 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='SRF008')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F23
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'SRF008',S.F23);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'SRF008',F23 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='SRF008')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F23
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'SRF008',S.F23);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'STR002',F21 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='STR002')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F21
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'STR002',S.F21);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'STR002',F21 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='STR002')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F21
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'STR002',S.F21);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'YLD001',F1 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='YLD001')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F1
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'YLD001',S.F1);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'YLD001',F1 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='YLD001')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F1
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'YLD001',S.F1);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'YLD002',F2 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='YLD002')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F2
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'YLD002',S.F2);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'YLD002',F2 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='YLD002')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F2
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'YLD002',S.F2);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'YLD015',F9 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='YLD015')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F9
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'YLD015',S.F9);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'YLD015',F9 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='YLD015')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F9
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'YLD015',S.F9);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'YLD016',F19 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='YLD016')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F19
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'YLD016',S.F19);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'YLD016',F19 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='YLD016')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F19
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'YLD016',S.F19);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP01',F3 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP01')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F3
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP01',S.F3);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP01',F3 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP01')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F3
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP01',S.F3);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP02',F4 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP02')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F4
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP02',S.F4);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP02',F4 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP02')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F4
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP02',S.F4);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP03',F8 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP03')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F8
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP03',S.F8);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP03',F8 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP03')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F8
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP03',S.F8);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP04',F11 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP04')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F11
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP04',S.F11);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP04',F11 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP04')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F11
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP04',S.F11);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP05',F13 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP05')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F13
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP05',S.F13);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP05',F13 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP05')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F13
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP05',S.F13);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP06',F14 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP06')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F14
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP06',S.F14);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP06',F14 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP06')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F14
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP06',S.F14);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP07',F15 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP07')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F15
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP07',S.F15);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP07',F15 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP07')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F15
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP07',S.F15);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP08',F16 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP08')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F16
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP08',S.F16);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP08',F16 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP08')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F16
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP08',S.F16);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP09',F17 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP09')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F17
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP09',S.F17);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP09',F17 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP09')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F17
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP09',S.F17);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP10',F18 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP10')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F18
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP10',S.F18);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP10',F18 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP10')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F18
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP10',S.F18);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP11',F22 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP11')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F22
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP11',S.F22);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP11',F22 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP11')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F22
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP11',S.F22);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP12',F27 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP12')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F27
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP12',S.F27);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP12',F27 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP12')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F27
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP12',S.F27);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP13',F29 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP13')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F29
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP13',S.F29);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP13',F29 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP13')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F29
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP13',S.F29);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP14',F30 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP14')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F30
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP14',S.F30);
Commit;
MERGE INTO SW.RAT001 D
USING (select (LTRIM(SYMBOL,'0')||' HK') as SYMBOL, YQ,'XQSP14',F30 from XQ.FIN001 where FinDate>TRUNC(TRUNC(SYSDATE , 'Year')-360 , 'Year')) S
ON (D.LIST_CODE = S.SYMBOL AND D.YQ=S.YQ AND D.RATIO_CODE='XQSP14')
WHEN MATCHED THEN UPDATE SET D.RATIO_VALUE = S.F30
WHEN NOT MATCHED THEN INSERT (D.LIST_CODE,D.YQ,D.RATIO_CODE,D.RATIO_VALUE) VALUES (S.SYMBOL, S.YQ,'XQSP14',S.F30);
Commit;
exit;
| true |
cbcb0c464fa52d4e9d02cba60ef9401bd6e10d01 | SQL | brisskit-uol/puppet | /modules/redcap/files/install_6.4.4/redcap_v6.4.4/Resources/sql/install_data.sql | UTF-8 | 18,602 | 3.28125 | 3 | [] | no_license |
-- REDCAP INSTALLATION INITIAL DATA --
INSERT INTO redcap_user_information (username, user_email, user_firstname, user_lastname, super_user, user_firstvisit) VALUES
('site_admin', 'joe.user@projectredcap.org', 'Joe', 'User', 1, now());
INSERT INTO redcap_standard_map_audit_action (id, action) VALUES
(1, 'add mapped field'),
(2, 'modify mapped field'),
(3, 'remove mapped field');
INSERT INTO redcap_crons (cron_name, cron_description, cron_enabled, cron_frequency, cron_max_run_time, cron_instances_max, cron_instances_current, cron_last_run_end, cron_times_failed, cron_external_url) VALUES
('PubMed', 'Query the PubMed API to find publications associated with PIs in REDCap, and store publication attributes and PI/project info. Emails will then be sent to any PIs that have been found to have publications in PubMed, and (if applicable) will be asked to associate their publication to a REDCap project.', 'DISABLED', 86400, 7200, 1, 0, NULL, 0, NULL),
('RemoveTempAndDeletedFiles', 'Delete all files from the REDCap temp directory, and delete all edoc and Send-It files marked for deletion.', 'ENABLED', 120, 600, 1, 0, NULL, 0, NULL),
('ExpireSurveys', 'For any surveys where an expiration timestamp is set, if the timestamp <= NOW, then make the survey inactive.', 'ENABLED', 120, 600, 1, 0, NULL, 0, NULL),
('SurveyInvitationEmailer', 'Mailer that sends any survey invitations that have been scheduled.', 'ENABLED', 60, 1800, 5, 0, NULL, 0, NULL),
('DeleteProjects', 'Delete all projects that are scheduled for permanent deletion', 'ENABLED', 300, 1200, 1, 0, NULL, 0, NULL),
('ClearIPCache', 'Clear all IP addresses older than X minutes from the redcap_ip_cache table.', 'ENABLED', 180, 60, 1, 0, NULL , 0, NULL),
('ExpireUsers', 'For any users whose expiration timestamp is set, if the timestamp <= NOW, then suspend the user''s account and set expiration time back to NULL.', 'ENABLED', 120, 600, 1, 0, NULL, 0, NULL),
('WarnUsersAccountExpiration', 'For any users whose expiration timestamp is set, if the expiration time is less than X days from now, then email the user to warn them of their impending account expiration.', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
('SuspendInactiveUsers', 'For any users whose last login time exceeds the defined max days of inactivity, auto-suspend their account (if setting enabled).', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
('ReminderUserAccessDashboard', 'At a regular interval, email all users to remind them to visit the User Access Dashboard page. Enables the ReminderUserAccessDashboardEmail cron job.', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
('ReminderUserAccessDashboardEmail', 'Email all users in batches to remind them to visit the User Access Dashboard page. Will disable itself when done.', 'DISABLED', 60, 1800, 5, 0, NULL, 0, NULL),
('DDPQueueRecordsAllProjects', 'Queue records that are ready to be fetched from the external source system via the DDP service.', 'ENABLED', 300, 600, 1, 0, NULL, 0, NULL),
('DDPFetchRecordsAllProjects', 'Fetch data from the external source system for records already queued by the DDP service.', 'ENABLED', 60, 1800, 10, 0, NULL, 0, NULL),
('PurgeCronHistory', 'Purges all rows from the crons history table that are older than one week.', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
('UpdateUserPasswordAlgo', 'Send email to all Table-based users telling them to log in for the purpose of upgrading their password security (one time only)', 'DISABLED', 86400, 7200, 1, 0, NULL, 0, NULL),
('AutomatedSurveyInvitationsDatediffChecker', 'Check all conditional logic in Automated Surveys Invitations that uses "today" inside datediff() function', 'ENABLED', 43200, 7200, 1, 0, NULL, 0, NULL),
('ClearSurveyShortCodes', 'Clear all survey short codes older than X minutes.', 'ENABLED', 300, 60, 1, 0, NULL , 0, NULL),
('ClearLogViewRequests', 'Clear all items from redcap_log_view_requests table older than X hours.', 'ENABLED', 1800, 300, 1, 0, NULL , 0, NULL);
INSERT INTO redcap_auth_questions (qid, question) VALUES
(1, 'What was your childhood nickname?'),
(2, 'In what city did you meet your spouse/significant other?'),
(3, 'What is the name of your favorite childhood friend?'),
(4, 'What street did you live on in third grade?'),
(5, 'What is your oldest sibling''s birthday month and year? (e.g., January 1900)'),
(6, 'What is the middle name of your oldest child?'),
(7, 'What is your oldest sibling''s middle name?'),
(8, 'What school did you attend for sixth grade?'),
(9, 'What was your childhood phone number including area code? (e.g., 000-000-0000)'),
(10, 'What is your oldest cousin''s first and last name?'),
(11, 'What was the name of your first stuffed animal?'),
(12, 'In what city or town did your mother and father meet?'),
(13, 'Where were you when you had your first kiss?'),
(14, 'What is the first name of the boy or girl that you first kissed?'),
(15, 'What was the last name of your third grade teacher?'),
(16, 'In what city does your nearest sibling live?'),
(17, 'What is your oldest brother''s birthday month and year? (e.g., January 1900)'),
(18, 'What is your maternal grandmother''s maiden name?'),
(19, 'In what city or town was your first job?'),
(20, 'What is the name of the place your wedding reception was held?'),
(21, 'What is the name of a college you applied to but didn''t attend?');
INSERT INTO redcap_config (field_name, value) VALUES
('two_factor_auth_enabled', '0'),
('allow_kill_mysql_process', '0'),
('mobile_app_enabled', '1'),
('twilio_display_info_project_setup', '0'),
('twilio_enabled_global', '0'),
('twilio_enabled_by_super_users_only', '1'),
('field_comment_log_enabled_default', '1'),
('from_email', ''),
('promis_enabled', '1'),
('promis_api_base_url', 'https://www.redcap-cats.org/promis_api/'),
('sams_logout', ''),
('promis_registration_id', ''),
('promis_token', ''),
('hook_functions_file', ''),
('project_encoding', ''),
('default_datetime_format', 'M/D/Y_12'),
('default_number_format_decimal', '.'),
('default_number_format_thousands_sep', ','),
('homepage_announcement', ''),
('password_algo', 'md5'),
('password_recovery_custom_text', ''),
('user_access_dashboard_enable', '1'),
('user_access_dashboard_custom_notification', ''),
('suspend_users_inactive_send_email', 1),
('suspend_users_inactive_days', 180),
('suspend_users_inactive_type', ''),
('page_hit_threshold_per_minute', '600'),
('enable_http_compression', '1'),
('realtime_webservice_data_fetch_interval', '24'),
('realtime_webservice_url_metadata', ''),
('realtime_webservice_url_data', ''),
('realtime_webservice_url_user_access', ''),
('realtime_webservice_global_enabled', '0'),
('realtime_webservice_custom_text', ''),
('realtime_webservice_display_info_project_setup', '1'),
('realtime_webservice_source_system_custom_name', ''),
('realtime_webservice_user_rights_super_users_only', '1'),
('realtime_webservice_stop_fetch_inactivity_days', '7'),
('amazon_s3_key', ''),
('amazon_s3_secret', ''),
('amazon_s3_bucket', ''),
('system_offline_message', ''),
('openid_provider_url', ''),
('openid_provider_name', ''),
('file_attachment_upload_max', ''),
('data_entry_trigger_enabled', '1'),
('redcap_base_url_display_error_on_mismatch', '1'),
('email_domain_whitelist', ''),
('helpfaq_custom_text', ''),
('randomization_global', '1'),
('login_custom_text', ''),
('auto_prod_changes', '2'),
('enable_edit_prod_events', '1'),
('allow_create_db_default', '1'),
('api_enabled', '1'),
('auth_meth_global', 'none'),
('auto_report_stats', '1'),
('auto_report_stats_last_sent', '2000-01-01'),
('autologout_timer', '30'),
('certify_text_create', ''),
('certify_text_prod', ''),
('homepage_custom_text', ''),
('doc_to_edoc_transfer_complete', '1'),
('dts_enabled_global', '0'),
('display_nonauth_projects', '1'),
('display_project_logo_institution', '0'),
('display_today_now_button', '1'),
('edoc_field_option_enabled', '1'),
('edoc_upload_max', ''),
('edoc_storage_option', '0'),
('file_repository_upload_max', ''),
('file_repository_enabled', '1'),
('temp_files_last_delete', now()),
('edoc_path', ''),
('enable_edit_survey_response', '1'),
('enable_plotting', '2'),
('enable_plotting_survey_results', '1'),
('enable_projecttype_singlesurvey', '1'),
('enable_projecttype_forms', '1'),
('enable_projecttype_singlesurveyforms', '1'),
('enable_url_shortener', '1'),
('enable_user_whitelist', '0'),
('logout_fail_limit', '5'),
('logout_fail_window', '15'),
('footer_links', ''),
('footer_text', ''),
('google_translate_enabled', '0'),
('googlemap_key',''),
('grant_cite', ''),
('headerlogo', ''),
('homepage_contact', ''),
('homepage_contact_email', ''),
('homepage_grant_cite', ''),
('identifier_keywords', 'name, street, address, city, county, precinct, zip, postal, date, phone, fax, mail, ssn, social security, mrn, dob, dod, medical, record, id, age'),
('institution', ''),
('language_global','English'),
('login_autocomplete_disable', '0'),
('login_logo', ''),
('my_profile_enable_edit','1'),
('password_history_limit','0'),
('password_reset_duration','0'),
('project_contact_email', ''),
('project_contact_name', ''),
('project_contact_prod_changes_email', ''),
('project_contact_prod_changes_name', ''),
('project_language', 'English'),
('proxy_hostname', ''),
('pub_matching_enabled', '0'),
('redcap_base_url', ''),
('pub_matching_emails', '0'),
('pub_matching_email_days', '7'),
('pub_matching_email_limit', '3'),
('pub_matching_email_text', ''),
('pub_matching_email_subject', ''),
('pub_matching_institution', 'Vanderbilt\nMeharry'),
('redcap_last_install_date', CURRENT_DATE),
('redcap_version', '4.0.0'),
('sendit_enabled', '1'),
('sendit_upload_max', ''),
('shared_library_enabled', '1'),
('shibboleth_logout', ''),
('shibboleth_username_field', 'none'),
('site_org_type', ''),
('superusers_only_create_project', '0'),
('superusers_only_move_to_prod', '1'),
('system_offline', '0');
INSERT INTO `redcap_pub_sources` (`pubsrc_id`, `pubsrc_name`, `pubsrc_last_crawl_time`) VALUES
(1, 'PubMed', NULL);
INSERT INTO `redcap_validation_types` (`validation_name`, `validation_label`, `regex_js`, `regex_php`, `data_type`, `legacy_value`, `visible`) VALUES
('alpha_only', 'Letters only', '/^[a-z]+$/i', '/^[a-z]+$/i', 'text', NULL, 0),
('date_dmy', 'Date (D-M-Y)', '/^((29([-\\/.]?)02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/.]?)(0[1-9]|1[012]))|((29|30)([-\\/.]?)(0[13-9]|1[012]))|(31([-\\/.]?)(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4}))$/', '/^((29([-\\/.]?)02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/.]?)(0[1-9]|1[012]))|((29|30)([-\\/.]?)(0[13-9]|1[012]))|(31([-\\/.]?)(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4}))$/', 'date', NULL, 1),
('date_mdy', 'Date (M-D-Y)', '/^((02([-\\/.]?)29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/.]?)(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/.]?)(29|30))|((0[13578]|1[02])([-\\/.]?)31))(\\11|\\15|\\19)\\d{4}))$/', '/^((02([-\\/.]?)29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/.]?)(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/.]?)(29|30))|((0[13578]|1[02])([-\\/.]?)31))(\\11|\\15|\\19)\\d{4}))$/', 'date', NULL, 1),
('date_ymd', 'Date (Y-M-D)', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/.]?)02(\\6)29)|(\\d{4}([-\\/.]?)((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31))))$/', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/.]?)02(\\6)29)|(\\d{4}([-\\/.]?)((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31))))$/', 'date', 'date', 1),
('datetime_dmy', 'Datetime (D-M-Y H:M)', '/^((29([-\\/.]?)02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/.]?)(0[1-9]|1[012]))|((29|30)([-\\/.]?)(0[13-9]|1[012]))|(31([-\\/.]?)(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4})) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', '/^((29([-\\/.]?)02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/.]?)(0[1-9]|1[012]))|((29|30)([-\\/.]?)(0[13-9]|1[012]))|(31([-\\/.]?)(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4})) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', 'datetime', NULL, 1),
('datetime_mdy', 'Datetime (M-D-Y H:M)', '/^((02([-\\/.]?)29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/.]?)(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/.]?)(29|30))|((0[13578]|1[02])([-\\/.]?)31))(\\11|\\15|\\19)\\d{4})) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', '/^((02([-\\/.]?)29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/.]?)(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/.]?)(29|30))|((0[13578]|1[02])([-\\/.]?)31))(\\11|\\15|\\19)\\d{4})) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', 'datetime', NULL, 1),
('datetime_seconds_dmy', 'Datetime w/ seconds (D-M-Y H:M:S)', '/^((29([-\\/.]?)02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/.]?)(0[1-9]|1[012]))|((29|30)([-\\/.]?)(0[13-9]|1[012]))|(31([-\\/.]?)(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4})) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', '/^((29([-\\/.]?)02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/.]?)(0[1-9]|1[012]))|((29|30)([-\\/.]?)(0[13-9]|1[012]))|(31([-\\/.]?)(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4})) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', 'datetime_seconds', NULL, 1),
('datetime_seconds_mdy', 'Datetime w/ seconds (M-D-Y H:M:S)', '/^((02([-\\/.]?)29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/.]?)(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/.]?)(29|30))|((0[13578]|1[02])([-\\/.]?)31))(\\11|\\15|\\19)\\d{4})) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', '/^((02([-\\/.]?)29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/.]?)(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/.]?)(29|30))|((0[13578]|1[02])([-\\/.]?)31))(\\11|\\15|\\19)\\d{4})) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', 'datetime_seconds', NULL, 1),
('datetime_seconds_ymd', 'Datetime w/ seconds (Y-M-D H:M:S)', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/.]?)02(\\6)29)|(\\d{4}([-\\/.]?)((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31)))) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/.]?)02(\\6)29)|(\\d{4}([-\\/.]?)((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31)))) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', 'datetime_seconds', 'datetime_seconds', 1),
('datetime_ymd', 'Datetime (Y-M-D H:M)', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/.]?)02(\\6)29)|(\\d{4}([-\\/.]?)((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31)))) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/.]?)02(\\6)29)|(\\d{4}([-\\/.]?)((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31)))) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', 'datetime', 'datetime', 1),
('email', 'Email', '/^([_a-z0-9-'']+)(\\.[_a-z0-9-'']+)*@([a-z0-9-]+)(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})$/i', '/^([_a-z0-9-'']+)(\\.[_a-z0-9-'']+)*@([a-z0-9-]+)(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})$/i', 'email', NULL, 1),
('integer', 'Integer', '/^[-+]?\\b\\d+\\b$/', '/^[-+]?\\b\\d+\\b$/', 'integer', 'int', 1),
('mrn_10d', 'MRN (10 digits)', '/^\\d{10}$/', '/^\\d{10}$/', 'text', NULL, 0),
('number', 'Number', '/^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$/', '/^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$/', 'number', 'float', 1),
('number_1dp', 'Number (1 decimal place)', '/^-?\\d+\\.\\d$/', '/^-?\\d+\\.\\d$/', 'number', NULL, 0),
('number_2dp', 'Number (2 decimal places)', '/^-?\\d+\\.\\d{2}$/', '/^-?\\d+\\.\\d{2}$/', 'number', NULL, 0),
('number_3dp', 'Number (3 decimal places)', '/^-?\\d+\\.\\d{3}$/', '/^-?\\d+\\.\\d{3}$/', 'number', NULL, 0),
('number_4dp', 'Number (4 decimal places)', '/^-?\\d+\\.\\d{4}$/', '/^-?\\d+\\.\\d{4}$/', 'number', NULL, 0),
('phone', 'Phone (U.S.)', '/^(?:\\(?([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\)?)\\s*(?:[.-]\\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})(?:\\s*(?:#|x\\.?|ext\\.?|extension)\\s*(\\d+))?$/', '/^(?:\\(?([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\)?)\\s*(?:[.-]\\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})(?:\\s*(?:#|x\\.?|ext\\.?|extension)\\s*(\\d+))?$/', 'phone', NULL, 1),
('phone_australia', 'Phone (Australia)', '/^(\\(0[2-8]\\)|0[2-8])\\s*\\d{4}\\s*\\d{4}$/', '/^(\\(0[2-8]\\)|0[2-8])\\s*\\d{4}\\s*\\d{4}$/', 'phone', NULL, 0),
('postalcode_australia', 'Postal Code (Australia)', '/^\\d{4}$/', '/^\\d{4}$/', 'postal_code', NULL, 0),
('postalcode_canada', 'Postal Code (Canada)', '/^[ABCEGHJKLMNPRSTVXY]{1}\\d{1}[A-Z]{1}\\s*\\d{1}[A-Z]{1}\\d{1}$/i', '/^[ABCEGHJKLMNPRSTVXY]{1}\\d{1}[A-Z]{1}\\s*\\d{1}[A-Z]{1}\\d{1}$/i', 'postal_code', NULL, 0),
('ssn', 'Social Security Number (U.S.)', '/^\\d{3}-\\d\\d-\\d{4}$/', '/^\\d{3}-\\d\\d-\\d{4}$/', 'ssn', NULL, 0),
('time', 'Time (HH:MM)', '/^([0-9]|[0-1][0-9]|[2][0-3]):([0-5][0-9])$/', '/^([0-9]|[0-1][0-9]|[2][0-3]):([0-5][0-9])$/', 'time', NULL, 1),
('time_mm_ss', 'Time (MM:SS)', '/^[0-5]\\d:[0-5]\\d$/', '/^[0-5]\\d:[0-5]\\d$/', 'time', NULL, 0),
('vmrn', 'Vanderbilt MRN', '/^[0-9]{4,9}$/', '/^[0-9]{4,9}$/', 'mrn', NULL, 0),
('zipcode', 'Zipcode (U.S.)', '/^\\d{5}(-\\d{4})?$/', '/^\\d{5}(-\\d{4})?$/', 'postal_code', NULL, 1),
('number_comma_decimal', 'Number (comma as decimal)', '/^[-+]?[0-9]*,?[0-9]+([eE][-+]?[0-9]+)?$/', '/^[-+]?[0-9]*,?[0-9]+([eE][-+]?[0-9]+)?$/', 'number_comma_decimal', NULL, 0),
('number_1dp_comma_decimal', 'Number (1 decimal place - comma as decimal)', '/^-?\\d+,\\d$/', '/^-?\\d+,\\d$/', 'number_comma_decimal', NULL , '0'),
('number_2dp_comma_decimal', 'Number (2 decimal places - comma as decimal)', '/^-?\\d+,\\d{2}$/', '/^-?\\d+,\\d{2}$/', 'number_comma_decimal', NULL , '0'),
('number_3dp_comma_decimal', 'Number (3 decimal places - comma as decimal)', '/^-?\\d+,\\d{3}$/', '/^-?\\d+,\\d{3}$/', 'number_comma_decimal', NULL , '0'),
('number_4dp_comma_decimal', 'Number (4 decimal places - comma as decimal)', '/^-?\\d+,\\d{4}$/', '/^-?\\d+,\\d{4}$/', 'number_comma_decimal', NULL , '0');
| true |
d97269d959adc71b23a6bbf306e5785a99c49f85 | SQL | cgiovvnni/Car-Control-Online | /Scripts/s-15-fx-proximos-pagos.sql | UTF-8 | 616 | 3.078125 | 3 | [
"MIT"
] | permissive | --@Autor: Rodrigo Lopez López - Carlos Giovanni Martínez Gutiérrez
--@Fecha creación: 19/06/2020
--@Descripción: Proyecto Final 'Funcion Costo Mensual'
create or replace type fechas_varray
as varray(5) of date;
/
create or replace function proximas_cuotas(
p_fecha_pago date
)
return fechas_varray
pipelined is
--declaracion de la colección
anio fechas_varray;
begin
anio := fechas_varray(p_fecha_pago + 365, p_fecha_pago + 2 * 365,
p_fecha_pago + 3 * 365, p_fecha_pago + 4 * 365, p_fecha_pago + 5 * 365);
for i in 1 .. anio.last loop
pipe row(anio(i));
end loop;
return;
end;
/
show errors
| true |
887475a46dac139124bc7811c43ee2ff9e887928 | SQL | gmoraga/kt_employee | /postgres_kt_kt_employees.sql | UTF-8 | 2,488 | 3.4375 | 3 | [] | no_license | CREATE SCHEMA IF NOT EXISTS kitchen_talk;
DROP TABLE IF EXISTS kitchen_talk.kt_employees;
DROP SEQUENCE IF EXISTS kitchen_talk.kt_employees_seq;
CREATE SEQUENCE IF NOT EXISTS kitchen_talk.kt_employees_seq;
CREATE TABLE kitchen_talk.kt_employees
(
id bigint DEFAULT nextval('kitchen_talk.kt_employees_seq'::regclass) NOT NULL,
first_name varchar(30) NOT NULL,
second_name varchar(30),
last_name varchar(40) NOT NULL,
second_last_name varchar(40),
email varchar(100) NOT NULL,
gender varchar(1) DEFAULT 'M'::character varying NOT NULL,
phone_country smallint,
phone_region smallint,
phone_number integer,
country varchar(20) NOT NULL,
state varchar(20) NOT NULL,
city varchar(20) NOT NULL,
address varchar(60) NOT NULL,
entry_date timestamp with time zone,
category varchar(3) DEFAULT 'SA'::character varying NOT NULL,
level varchar(2) DEFAULT 'N1'::character varying NOT NULL,
is_active varchar(1) DEFAULT 'Y'::character varying NOT NULL
);
CREATE UNIQUE INDEX key_kt_employees ON kitchen_talk.kt_employees (id);
CREATE UNIQUE INDEX ix_kt_employees_unique_business ON kitchen_talk.kt_employees (first_name, last_name, gender, email);
INSERT INTO kitchen_talk.kt_employees (id, first_name, second_name, last_name, second_last_name, email, gender, phone_country, phone_region, phone_number, country, state, city, address, entry_date, category, level, is_active) VALUES (135718, 'Thedrick', 'Nealy', 'Flippen', 'Priestnall', 'thedrick.flippen.priestnall@everis.com', 'M', 56, 2, 22221641, 'Chile', 'Metropolitana', 'Santiago', '579 Bultman Center', '2001-02-04 07:01:55.000000', 'SN', 'N2', 'Y');
INSERT INTO kitchen_talk.kt_employees (id, first_name, second_name, last_name, second_last_name, email, gender, phone_country, phone_region, phone_number, country, state, city, address, entry_date, category, level, is_active) VALUES (135719, 'Baudoin', 'Yank', 'Josilevich', 'Beagley', 'baudoin.josilevich.beagley@everis.com', 'M', 56, 2, 25432031, 'Chile', 'Metropolitana', 'Santiago', '20 Grim Point', '2011-01-27 00:10:35.000000', 'SA', 'N1', 'Y');
INSERT INTO kitchen_talk.kt_employees (id, first_name, second_name, last_name, second_last_name, email, gender, phone_country, phone_region, phone_number, country, state, city, address, entry_date, category, level, is_active) VALUES (135720, 'Gabbey', 'Jessie', 'Stradling', 'Liepina', 'gabbey.stradling.liepina@everis.com', 'F', 56, 2, 22628876, 'Chile', 'Metropolitana', 'Santiago', '937 Florence Plaza', '2002-02-24 10:18:03.000000', 'STL', 'N2', 'Y'); | true |
9ce982a1264532d8d0d7799ffb7235e718027356 | SQL | PNNL-Comp-Mass-Spec/DBSchema_PgSQL_DMS | /dms/pc/pc.t_encrypted_collection_authorizations.sql | UTF-8 | 1,334 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | --
-- Name: t_encrypted_collection_authorizations; Type: TABLE; Schema: pc; Owner: d3l243
--
CREATE TABLE pc.t_encrypted_collection_authorizations (
authorization_id integer NOT NULL,
login_name public.citext NOT NULL,
protein_collection_id integer NOT NULL
);
ALTER TABLE pc.t_encrypted_collection_authorizations OWNER TO d3l243;
--
-- Name: t_encrypted_collection_authorizations_authorization_id_seq; Type: SEQUENCE; Schema: pc; Owner: d3l243
--
ALTER TABLE pc.t_encrypted_collection_authorizations ALTER COLUMN authorization_id ADD GENERATED ALWAYS AS IDENTITY (
SEQUENCE NAME pc.t_encrypted_collection_authorizations_authorization_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: t_encrypted_collection_authorizations pk_t_encrypted_collection_authorizations; Type: CONSTRAINT; Schema: pc; Owner: d3l243
--
ALTER TABLE ONLY pc.t_encrypted_collection_authorizations
ADD CONSTRAINT pk_t_encrypted_collection_authorizations PRIMARY KEY (authorization_id);
--
-- Name: TABLE t_encrypted_collection_authorizations; Type: ACL; Schema: pc; Owner: d3l243
--
GRANT SELECT ON TABLE pc.t_encrypted_collection_authorizations TO readaccess;
GRANT SELECT ON TABLE pc.t_encrypted_collection_authorizations TO writeaccess;
| true |
70c3a164678420c4319ed6b8bf523e720a2e283a | SQL | Frodenkvist/erik-portfolio-api | /ErikPortfolioApi/db/migrations/V4__add_cascade.sql | UTF-8 | 181 | 2.953125 | 3 | [] | no_license | ALTER TABLE photo
DROP CONSTRAINT photo_parent_folder_id_fkey,
ADD CONSTRAINT photo_parent_folder_id_fkey FOREIGN KEY (parent_folder_id) REFERENCES folder(id) ON DELETE CASCADE;
| true |
a7c71af92c6321b2f47dac2618bfb8711cc9b19f | SQL | naffets77/CPAExamBank | /Backend/Ciborium/StoredProceduresAndTriggers/StoredProcedures/sp_DELETEAccountUserById.sql | UTF-8 | 873 | 3.28125 | 3 | [] | no_license | DELIMITER //
DROP PROCEDURE IF EXISTS sp_DELETEAccountUserById//
CREATE PROCEDURE sp_DELETEAccountUserById(IN inAccountUserId INT)
BEGIN
DELETE FROM `LicenseTransactionHistory` WHERE `LicenseId` IN (SELECT LicenseId FROM License WHERE AccountUserId = inAccountUserId);
DELETE FROM `LicenseToSectionType` WHERE `LicenseId` IN (SELECT LicenseId FROM License WHERE AccountUserId = inAccountUserId);
DELETE FROM `License` WHERE `AccountUserId` = inAccountUserId;
DELETE FROM `AccountUserToPromotion` WHERE `AccountUserId` = inAccountUserId;
DELETE FROM `AccountUserHistory` WHERE `AccountUserId` = inAccountUserId;
DELETE FROM `AccountUserQuestionHistory` WHERE `AccountUserId` = inAccountUserId;
DELETE FROM `AccountUserSettings` WHERE `AccountUserId` = inAccountUserId;
DELETE FROM `AccountUser` WHERE `AccountUserId` = inAccountUserId;
END //
DELIMITER ; | true |
2d912b7824cbb40601f8d06760a871d168738ffa | SQL | tespechit/SNEP-Porteiro | /banco.sql | UTF-8 | 2,828 | 3.625 | 4 | [] | no_license | CREATE TABLE IF NOT EXISTS `snep`.`senha` (
`id` INT NOT NULL AUTO_INCREMENT,
`senha` VARCHAR(21) NOT NULL,
`usuario` VARCHAR(100) NOT NULL,
`grupo` VARCHAR(100) NOT NULL,
`cadastro` VARCHAR(50) NOT NULL,
`atualizado` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id`));
CREATE TABLE IF NOT EXISTS `snep`.`rfid` (
`id` INT NOT NULL AUTO_INCREMENT,
`rfid` VARCHAR(150) NOT NULL,
`grupo` VARCHAR(100) NOT NULL,
`cadastro` VARCHAR(50) NOT NULL,
`atualizado` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id`));
CREATE TABLE IF NOT EXISTS `snep`.`tb_grupos` (
`id` INT NOT NULL AUTO_INCREMENT,
`grupo` VARCHAR(100) NOT NULL,
`cadastro` VARCHAR(50) NOT NULL,
`atualizado` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id`));
CREATE TABLE IF NOT EXISTS `snep`.`tb_porteiro` (
`id` INT NOT NULL AUTO_INCREMENT,
`ip` VARCHAR(31) NOT NULL,
`porta` VARCHAR(8) NOT NULL,
`transporte` VARCHAR(12) NOT NULL,
`mac` VARCHAR(31) NOT NULL,
`nome` VARCHAR(100) NOT NULL,
`rele1` VARCHAR(20) NOT NULL,
`rele2` VARCHAR(20) NOT NULL,
`ramal` VARCHAR(8) NOT NULL,
`cadastro` VARCHAR(50) NOT NULL,
`atualizado` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id`));
CREATE TABLE IF NOT EXISTS `snep`.`tb_porteirogrupos` (
`porteiro` INT NOT NULL,
`grupo` INT NOT NULL,
INDEX `mac_idx` (`porteiro` ASC),
INDEX `grupo_idx` (`grupo` ASC),
CONSTRAINT `mac`
FOREIGN KEY (`porteiro`)
REFERENCES `snep`.`tb_porteiro` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `grupo`
FOREIGN KEY (`grupo`)
REFERENCES `snep`.`tb_grupos` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE TABLE IF NOT EXISTS `snep`.`contador_senha` (
`data` VARCHAR(45) NOT NULL,
`porteiro` INT NOT NULL,
`ramal` VARCHAR(45) NOT NULL,
`senha` VARCHAR(150) NOT NULL,
`id_senha` INT NOT NULL,
`resultado` VARCHAR(4) NOT NULL,
INDEX `id_senha_idx` (`id_senha` ASC),
INDEX `porteiro_idx` (`porteiro` ASC),
CONSTRAINT `id_senha`
FOREIGN KEY (`id_senha`)
REFERENCES `snep`.`senha` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `porteiro`
FOREIGN KEY (`porteiro`)
REFERENCES `snep`.`tb_porteiro` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE TABLE IF NOT EXISTS `snep`.`contador_rfid` (
`data` VARCHAR(45) NOT NULL,
`porteiro` INT NOT NULL,
`ramal` VARCHAR(45) NOT NULL,
`rfid` VARCHAR(150) NOT NULL,
`id_rfid` INT NOT NULL,
`resultado` VARCHAR(4) NOT NULL,
INDEX `porteiro_idx` (`porteiro` ASC),
INDEX `id_rfid_idx` (`id_rfid` ASC),
CONSTRAINT `porteiro_id`
FOREIGN KEY (`porteiro`)
REFERENCES `snep`.`tb_porteiro` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `rfid_id`
FOREIGN KEY (`id_rfid`)
REFERENCES `snep`.`rfid` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
| true |
ad813c3c06585cee7da56efde2c09cb6feb77a80 | SQL | chirdxing/WeEvent | /weevent-governance/dist/conf/script/governance.sql | UTF-8 | 6,431 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | CREATE TABLE t_account(
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create date',
`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'update date',
`is_delete` INT(1) NOT NULL DEFAULT 0 COMMENT '0 means not deleted 1 means deleted',
`email` VARCHAR(256) NOT NULL COMMENT 'email',
`username` VARCHAR(64) NOT NULL COMMENT 'username',
`password` VARCHAR(256) NOT NULL COMMENT 'password`',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 comment 't_account';
CREATE TABLE t_broker (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create date',
`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'update date',
`is_delete` INT(1) NOT NULL DEFAULT 0 COMMENT '0 means not deleted 1 means deleted',
`is_config_rule` INT(1) NULL DEFAULT NULL COMMENT '1 means configured ,2 means not configured',
`user_id` INT(11) NOT NULL COMMENT 'user id',
`name` VARCHAR(256) NOT NULL COMMENT 'name',
`broker_url` VARCHAR(256) DEFAULT NULL COMMENT 'broker url',
`webase_url` VARCHAR(256) DEFAULT NULL COMMENT 'webase url',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 comment 't_broker';
CREATE TABLE t_topic (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create date',
`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'update date',
`is_delete` INT(1) NOT NULL DEFAULT 0 COMMENT '0 means not deleted 1 means deleted',
`topic_name` VARCHAR(256) NOT NULL COMMENT 'topic name',
`creater` VARCHAR(256) DEFAULT NULL COMMENT 'creator',
`broker_id` INT(11) NOT NULL COMMENT 'broker id',
`group_id` VARCHAR(64) DEFAULT NULL COMMENT 'group id',
`description` VARCHAR(256) NULL DEFAULT NULL COMMENT 'description',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 comment 't_topic';
CREATE TABLE t_permission (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create date',
`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'update date',
`broker_id` INT(11) NOT NULL COMMENT 'broker_id',
`user_id` INT(11) NOT NULL COMMENT 'user_id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 comment 't_permission';
CREATE TABLE t_rule_engine (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create date',
`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update date',
`rule_name` VARCHAR(128) NOT NULL COMMENT 'rule name',
`payload_type` INT(4) NULL DEFAULT NULL COMMENT '1 means JASON, 2 means binary',
`payload` VARCHAR(4096) NULL DEFAULT NULL COMMENT 'message payload',
`broker_id` INT(11) not NULL COMMENT 'broker id',
`user_id` INT(11) not NULL COMMENT 'user id',
`group_id` VARCHAR(64) not NULL COMMENT 'group id',
`cep_id` VARCHAR(64) NULL COMMENT 'complex event processing id',
`broker_url` VARCHAR(255) NULL DEFAULT NULL COMMENT 'broker url',
`from_destination` VARCHAR(64) NULL DEFAULT NULL COMMENT 'message origin',
`to_destination` VARCHAR(64) NULL DEFAULT NULL COMMENT 'message reached',
`select_field` VARCHAR(4096) NULL DEFAULT NULL COMMENT 'selected field',
`condition_field` VARCHAR(4096) NULL DEFAULT NULL COMMENT 'condition field',
`condition_type` INT(2) NULL DEFAULT NULL COMMENT 'condition type',
`status` INT(2) NULL DEFAULT null COMMENT '0 means not started, 1 means running,2 means is deleted',
`database_url` VARCHAR(255) NULL DEFAULT NULL COMMENT 'database url',
`rule_database_id` INT(11) NULL DEFAULT NULL COMMENT 'rule database id',
`error_destination` VARCHAR(255) NULL DEFAULT NULL COMMENT 'error destination',
`error_message` VARCHAR(255) NULL DEFAULT NULL COMMENT 'error message',
`system_tag` VARCHAR(1) NOT NULL DEFAULT '2' COMMENT '1 means system,2 means user add',
PRIMARY KEY (`id`),
UNIQUE KEY ruleName(rule_name)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='t_rule_engine';
CREATE TABLE t_rule_database (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create date',
`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update date',
`database_url` VARCHAR(256) NOT NULL COMMENT 'database url',
`database_name` VARCHAR(128) NOT NULL COMMENT 'database name',
`table_name` VARCHAR(128) NOT NULL COMMENT 'table name',
`broker_id` VARCHAR(256) DEFAULT NULL COMMENT 'broker id',
`user_id` VARCHAR(256) DEFAULT NULL COMMENT 'user id',
`is_visible` VARCHAR(1) NOT NULL DEFAULT '1' COMMENT '1 visible ,2 invisible',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='t_rule_database';
CREATE TABLE t_rule_engine_condition (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create date',
`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update date',
`rule_id` INT(64) DEFAULT NULL COMMENT 'rule id',
`sql_condition_json` VARCHAR(512) DEFAULT NULL COMMENT 'sql condition json',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='t_rule_engine_condition';
CREATE TABLE t_topic_historical (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create date',
`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update date',
`topicName` VARCHAR(128) NOT NULL COMMENT 'topic name',
`groupId` VARCHAR(64) NOT NULL COMMENT 'group id',
`eventId` VARCHAR(64) NOT NULL COMMENT 'event id',
`brokerId` VARCHAR(64) NOT NULL COMMENT 'broker id',
PRIMARY KEY (`id`),
UNIQUE KEY brokerIdGroupIdEventId(brokerId,groupId,eventId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='t_topic_historical';
| true |
826d57036a7e2c54ca229dca3ef64ed95fb07b0b | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/low/day21/select0205.sql | UTF-8 | 412 | 3.5625 | 4 | [] | no_license |
SELECT obs.sensor_id, avg(counts)
FROM (SELECT sensor_id, date_trunc('day', timestamp), count(*) as counts
FROM WiFiAPObservation WHERE timestamp>'2017-11-20T02:05:00Z' AND timestamp<'2017-11-21T02:05:00Z' AND SENSOR_ID = ANY(array['3141_clwa_1600','3141_clwa_1420','3142_clwa_2065','3146_clwa_6029','3143_clwa_3019'])
GROUP BY sensor_id, date_trunc('day', timestamp)) AS obs
GROUP BY sensor_id
| true |
31d11799c507cc4782e5531d9219df091cee1ec2 | SQL | 1105Deepak/Use-case-Activity | /db_structure.sql | UTF-8 | 4,480 | 3.34375 | 3 | [] | no_license | -- MySQL dump 8.0 Distrib 5.6.11, for osx10.7 (x86_64)
--
-- Host: localhost Database: bank
-- ------------------------------------------------------
-- Server version 5.6.11
/*!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 */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `account_details`
( `account_id` int(11) NOT NULL AUTO_INCREMENT,
`pin` int(6) DEFAULT NULL,
`amount` double DEFAULT NULL,
`account_type` int(11) DEFAULT NULL,
`bank_branch_id` int(11) DEFAULT NULL,
PRIMARY KEY (`account_id`),
UNIQUE KEY `bank_accounts_UNIQUE` (`account_id`)
); ENGINE=InnoDB AUTO_INCREMENT=23185 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `deposit_cash`
( `customer_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`amount` int(20) DEFAULT NULL,
`time` int(45) DEFAULT NULL,
PRIMARY KEY (`customer_id`),
UNIQUE KEY `bank_branch_id_UNIQUE` (`customer_id`)
); ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
CREATE TABLE `Withdraw_cash`
( `customer_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`amount` int(20) DEFAULT NULL,
`time` int(45) DEFAULT NULL,
PRIMARY KEY (`customer_id`),
UNIQUE KEY `bank_branch_id_UNIQUE` (`customer_id`)
); /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `customer` (
`customer_id` int(11) NOT NULL AUTO_INCREMENT,
`nric` varchar(45) DEFAULT NULL,
`username` varchar(45) DEFAULT NULL,
`password` varchar(45) DEFAULT NULL,
`givenname` varchar(45) DEFAULT NULL,
`address` varchar(45) DEFAULT NULL,
`gender` varchar(45) DEFAULT NULL,
`nationality` varchar(45) DEFAULT NULL,
`date_of_birth` timestamp NULL DEFAULT NULL,
`date_of_join` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`customer_id`),
UNIQUE KEY `userid_UNIQUE` (`customer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10002 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
CREATE TABLE `transfer_money`
( `transaction_id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id_by` int(11) DEFAULT NULL,
`account_id` int(11) DEFAULT NULL,
`account_id_to` int(11) DEFAULT NULL,
`transaction_type` tinyint(4) DEFAULT NULL,
`amount_to_transfer` double DEFAULT NULL,
`transaction_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`transaction_id`),
UNIQUE KEY `transaction_id_UNIQUE` (`transaction_id`)
); /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `transaction_history`
( `transaction_id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id_by` int(11) DEFAULT NULL,
`account_id` int(11) DEFAULT NULL,
`account_id_to` int(11) DEFAULT NULL,
`transaction_type` tinyint(4) DEFAULT NULL,
`transaction_amount` double DEFAULT NULL,
`transaction_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`transaction_id`),
UNIQUE KEY `transaction_id_UNIQUE` (`transaction_id`)
); ENGINE=InnoDB AUTO_INCREMENT=64591 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-07-28 12:04:25
| true |
5ce63af4ca55e4e0070b9f777128ec84d2a97477 | SQL | rockytrice/Node-Express-Handlebars | /db/schema.sql | UTF-8 | 180 | 2.828125 | 3 | [] | no_license | CREATE DATABASE cars_db;
USE cars_db;
CREATE TABLE cars
(
id int NOT NULL AUTO_INCREMENT,
car_name varchar(255) NOT NULL,
purchased BOOLEAN DEFAULT false,
PRIMARY KEY (id)
);
| true |
764dd72287aeb30fc498dd4e78368727572a3ec8 | SQL | bravesoftdz/sgts | /sql/oracle/patch_11.11.2007/003_alter_table_measure_type_params.sql | WINDOWS-1251 | 782 | 3.34375 | 3 | [] | no_license | /* */
CREATE OR REPLACE VIEW S_MEASURE_TYPE_PARAMS
AS
SELECT MTP.*,
MT.NAME AS MEASURE_TYPE_NAME,
P.NAME AS PARAM_NAME,
P.DESCRIPTION AS PARAM_DESCRIPTION,
P.PARAM_TYPE,
P.FORMAT AS PARAM_FORMAT,
P.ALGORITHM_ID,
A.NAME AS ALGORITHM_NAME,
A.PROC_NAME AS ALGORITHM_PROC_NAME,
P.DETERMINATION AS PARAM_DETERMINATION,
P.IS_NOT_CONFIRM AS PARAM_IS_NOT_CONFIRM
FROM MEASURE_TYPE_PARAMS MTP, MEASURE_TYPES MT, PARAMS P, ALGORITHMS A
WHERE MT.MEASURE_TYPE_ID=MTP.MEASURE_TYPE_ID
AND P.PARAM_ID=MTP.PARAM_ID
AND P.ALGORITHM_ID=A.ALGORITHM_ID (+)
ORDER BY MTP.PRIORITY
--
/* */
COMMIT | true |
82d67db9009483889e0e790b183a989b1e77a2e3 | SQL | prestodb/presto | /presto-product-tests/src/main/resources/sql-tests/testcases/window_functions/rowsFirstLast.sql | UTF-8 | 402 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | -- database: presto; groups: window;
select orderkey, suppkey, extendedprice,
first_value(extendedprice) over (partition by suppkey order by extendedprice desc rows between unbounded preceding and unbounded following),
last_value(extendedprice) over (partition by suppkey order by extendedprice desc rows between unbounded preceding and unbounded following)
from tpch.tiny.lineitem where partkey = 272
| true |
97d7a72ed5ecba3b7d0b9c5b084359875afe82fe | SQL | Dishant111/SCG---Copy | /database/careerguidancefinal.sql | UTF-8 | 92,874 | 3.0625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 21, 2020 at 03:51 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.10
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: `careerguidancefinal`
--
-- --------------------------------------------------------
--
-- Table structure for table `admins`
--
CREATE TABLE `admins` (
`admin_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`fname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`contact` int(10) UNSIGNED DEFAULT 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 `admins`
--
INSERT INTO `admins` (`admin_id`, `fname`, `lname`, `email`, `password`, `contact`, `remember_token`, `created_at`, `updated_at`) VALUES
('admin', 'admin', 'admin', 'admin@example.com', '$2y$10$ED/R00WrOjgXVguVpK0AHueHXtuFlt4GrxQp8ABWtyQ4epsLWmZvy', NULL, NULL, '2020-05-10 08:59:40', '2020-05-10 08:59:40');
-- --------------------------------------------------------
--
-- Table structure for table `careerfields`
--
CREATE TABLE `careerfields` (
`careerfield_id` bigint(20) UNSIGNED NOT NULL,
`field_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`stream_id` bigint(20) UNSIGNED 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 `careerfields`
--
INSERT INTO `careerfields` (`careerfield_id`, `field_name`, `description`, `stream_id`, `created_at`, `updated_at`) VALUES
(1, 'Finance planner/ Advisor', '', 2, NULL, NULL),
(2, 'Accountant', '', 2, NULL, NULL),
(3, 'Administrator', '', 2, NULL, NULL),
(4, 'Banker', '', 2, NULL, NULL),
(5, 'Real estate agent', '', 2, NULL, NULL),
(6, 'Publishing', '', 2, NULL, NULL),
(7, 'Broker', '', 2, NULL, NULL),
(8, 'Event planner', '', 2, NULL, NULL),
(9, 'manager', '', 2, NULL, NULL),
(10, 'Working for or starting a non-profit', '', 2, NULL, NULL),
(11, 'Ministers', '', 2, NULL, NULL),
(12, 'Preschool and Childcare Center Directors', '', 2, NULL, NULL),
(13, 'Caretaking', '', 2, NULL, NULL),
(14, 'Human Resources', '', 2, NULL, NULL),
(15, ' Ministry Work', '', 2, NULL, NULL),
(16, 'CEO', '', 2, NULL, NULL),
(17, 'Entrepreneur', '', 2, NULL, NULL),
(18, 'Marketing director', '', 2, NULL, NULL),
(19, 'Advertising', '', 2, NULL, NULL),
(20, 'Social Media Manager', '', 2, NULL, NULL),
(21, 'Sales Person', '', 2, NULL, NULL),
(22, 'producer', '', 2, NULL, NULL),
(23, 'agent (sports, literary, entertainment, or otherwise)', '', 2, NULL, NULL),
(24, 'Environmental Planner', '', 2, NULL, NULL),
(26, 'Business manager ', '', 2, NULL, NULL),
(27, 'Lawyer', '', 2, NULL, NULL),
(28, 'Surgeon', '', 4, NULL, NULL),
(29, 'Biomedical engineering', '', 4, NULL, NULL),
(30, 'neurologist', '', 4, NULL, NULL),
(31, 'Dentist', '', 4, NULL, NULL),
(32, 'Nurse', '', 4, NULL, NULL),
(33, 'Veterinarian', '', 4, NULL, NULL),
(34, 'dermatologist', '', 4, NULL, NULL),
(35, 'Yoga instructor', '', 4, NULL, NULL),
(36, 'Therapist', '', 4, NULL, NULL),
(37, 'data analysts', '', 3, NULL, NULL),
(38, 'Biomedical engineering', '', 3, NULL, NULL),
(39, 'Automotive technician', '', 3, NULL, NULL),
(40, 'architect', '', 3, NULL, NULL),
(41, 'Engineer', '', 3, NULL, NULL),
(42, 'business analyst', '', 3, NULL, NULL),
(44, 'Administrator', '', 3, NULL, NULL),
(45, 'Auditor', '', 1, NULL, NULL),
(46, 'Editor', '', 1, NULL, NULL),
(47, 'Interior designer', '', 1, NULL, NULL),
(48, 'Content writing', '', 1, NULL, NULL),
(49, 'Administrator', '', 1, NULL, NULL),
(50, 'Caretaking', '', 1, NULL, NULL),
(51, 'psychiatrist', '', 1, NULL, NULL),
(52, 'Human Resource Managers', '', 1, NULL, NULL),
(53, 'Athletes and Sports Competitors', '', 1, NULL, NULL),
(54, 'Journalist', '', 1, NULL, NULL),
(55, 'Journalism', '', 1, NULL, NULL),
(56, 'Writer', '', 1, NULL, NULL),
(57, 'Psychotherapist', '', 1, NULL, NULL),
(58, 'Researcher', '', 1, NULL, NULL),
(59, 'Designer', '', 1, NULL, NULL),
(60, 'hair stylist', '', 1, NULL, NULL),
(61, 'tattoo artist', '', 1, NULL, NULL),
(62, 'Photography', '', 1, NULL, NULL),
(63, 'Actor/Musician', '', 1, NULL, NULL),
(64, 'Web developer', '', 1, NULL, NULL),
(65, 'Environmental Planner', '', 1, NULL, NULL),
(66, 'Occupational Health and Safety Specialists and Technicians', '', 1, NULL, NULL),
(67, 'Tour Guides', '', 1, NULL, NULL),
(68, 'Trainer', '', 1, NULL, NULL),
(69, 'Chef', '', 1, NULL, NULL),
(70, 'Healthcare\r\nAdministrator', '', 1, NULL, NULL),
(72, 'nutritionist', '', 4, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `classes`
--
CREATE TABLE `classes` (
`classes_id` bigint(20) UNSIGNED NOT NULL,
`class` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`stream_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `classes`
--
INSERT INTO `classes` (`classes_id`, `class`, `stream_id`) VALUES
(5, '12', 1),
(6, '12', 2),
(7, '12', 4),
(8, '12', 3);
-- --------------------------------------------------------
--
-- Table structure for table `classrooms`
--
CREATE TABLE `classrooms` (
`classroom_id` bigint(20) UNSIGNED NOT NULL,
`year` year(4) NOT NULL,
`classes_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `classrooms`
--
INSERT INTO `classrooms` (`classroom_id`, `year`, `classes_id`) VALUES
(21, 2020, 5),
(22, 2020, 6),
(23, 2020, 7),
(24, 2020, 8);
-- --------------------------------------------------------
--
-- Table structure for table `classroom_students`
--
CREATE TABLE `classroom_students` (
`id` bigint(20) UNSIGNED NOT NULL,
`student_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`classroom_id` bigint(20) UNSIGNED NOT NULL,
`teacher_id` 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 `classroom_students`
--
INSERT INTO `classroom_students` (`id`, `student_id`, `classroom_id`, `teacher_id`, `created_at`, `updated_at`) VALUES
(5, '160090107056', 22, 'Dishant1234', '2020-06-09 03:22:42', '2020-06-09 03:22:42'),
(7, '160090107043', 22, 'Dishant1234', '2020-06-11 11:27:44', '2020-06-11 11:27:44'),
(8, 'test1', 22, 'Dishant1234', '2020-06-11 17:05:29', '2020-06-11 17:05:29'),
(9, '160090107002', 22, 'Dishant1234', '2020-06-12 01:11:19', '2020-06-12 01:11:19');
-- --------------------------------------------------------
--
-- Table structure for table `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED 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 `final_career`
--
CREATE TABLE `final_career` (
`id` bigint(20) UNSIGNED NOT NULL,
`student_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`careerfield_id` bigint(20) UNSIGNED NOT NULL,
`personality_type_id` bigint(20) UNSIGNED NOT NULL,
`success_rate` bigint(4) 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 `final_career`
--
INSERT INTO `final_career` (`id`, `student_id`, `careerfield_id`, `personality_type_id`, `success_rate`, `created_at`, `updated_at`) VALUES
(21, '160090107056', 20, 4, 84, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(22, '160090107056', 19, 4, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(23, '160090107043', 24, 5, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(24, '160090107043', 27, 5, 84, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(25, 'test1', 3, 7, 63, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(26, 'test1', 5, 7, 50, '2020-06-12 00:24:50', '2020-06-12 00:24:50');
-- --------------------------------------------------------
--
-- 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
(1, '2014_10_12_100000_create_password_resets_table', 1),
(2, '2019_01_24_062139_personality_type', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2020_01_09_061652_streams', 1),
(5, '2020_01_10_161850_parents', 1),
(6, '2020_01_10_162226_teachers', 1),
(7, '2020_01_10_171908_students', 1),
(8, '2020_01_10_173045_classes', 1),
(9, '2020_01_10_173045_classrooms', 1),
(10, '2020_01_10_173046_subjects', 1),
(11, '2020_01_10_173047_classroom_students', 1),
(12, '2020_01_10_179005_subject_results', 1),
(13, '2020_01_10_233916_test_types', 1),
(14, '2020_01_10_234507_careerfields', 1),
(15, '2020_01_10_234607_test_results', 1),
(16, '2020_02_11_052517_questions', 1),
(17, '2020_02_11_053240_question_options', 1),
(18, '2020_02_11_053838_tests_answers', 1),
(19, '2020_02_24_061051_subject_careerfields', 1),
(20, '2020_02_24_062703_final_careers', 1),
(21, '2020_03_02_153914_admin', 1),
(22, '2020_03_02_183132_create_sessions_table', 1),
(23, '2020_03_31_133516_personality_careerfields', 2);
-- --------------------------------------------------------
--
-- Table structure for table `parents`
--
CREATE TABLE `parents` (
`parent_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`fname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`contact` bigint(12) UNSIGNED 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 `parents`
--
INSERT INTO `parents` (`parent_id`, `fname`, `lname`, `email`, `password`, `contact`, `created_at`, `updated_at`) VALUES
('mahesh777', 'mahesh', 'rana', 'mahesh777@gmail.com', '$2y$10$MXhtjwCjWSsIBdvVbLKRJOYi8hUtG2i4GE4CwMtMh836Xj0pdGg1O', 123456789, '2020-03-16 13:39:31', '2020-03-16 13:39:31'),
('parent1', 'parent 1', 'parent', 'parent@gmail.com', '$2y$10$5LQfbu/ylZqaHS2RiWTGp.x8LQDxQ1vuEllGWgjeN//VZNQnwyGLO', 9547863214, '2020-05-10 03:46:03', '2020-05-10 03:46:16'),
('pnt001', 'Manojbhai', 'Patil', 'pnt001@gmail.com', '$2y$10$Yjcrfz0gJIiuaWtXRECMfOnOEVbApafbqmjzbcWmOylsu9asCNTIe', 9876543215, '2020-06-12 01:08:58', '2020-06-12 01:08:58');
-- --------------------------------------------------------
--
-- 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 `personality_careerfields`
--
CREATE TABLE `personality_careerfields` (
`id` bigint(20) UNSIGNED NOT NULL,
`careerfield_id` bigint(20) UNSIGNED NOT NULL,
`personality_type_id` bigint(20) UNSIGNED 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 `personality_careerfields`
--
INSERT INTO `personality_careerfields` (`id`, `careerfield_id`, `personality_type_id`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(2, 2, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(3, 3, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(4, 4, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(5, 5, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(6, 6, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(7, 7, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(8, 8, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(9, 9, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(10, 28, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(11, 29, 1, '2020-04-18 16:41:00', '2020-04-18 16:41:00'),
(12, 30, 1, '2020-04-18 16:45:34', '2020-04-18 16:45:34'),
(13, 31, 1, '2020-04-18 16:45:34', '2020-04-18 16:45:34'),
(14, 47, 1, '2020-04-18 16:45:34', '2020-04-18 16:45:34'),
(15, 70, 1, '2020-04-18 16:45:34', '2020-04-18 16:45:34'),
(16, 42, 1, '2020-04-18 16:45:34', '2020-04-18 16:45:34'),
(17, 27, 1, '2020-04-18 16:45:34', '2020-04-18 16:45:34'),
(18, 46, 1, '2020-04-18 16:45:34', '2020-04-18 16:45:34'),
(19, 48, 1, '2020-04-18 16:45:34', '2020-04-18 16:45:34'),
(20, 10, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(21, 11, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(22, 12, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(23, 50, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(24, 14, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(25, 15, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(26, 32, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(27, 38, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(28, 37, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(29, 49, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(30, 13, 2, '2020-04-18 16:52:41', '2020-04-18 16:52:41'),
(31, 51, 2, '2020-04-18 16:53:09', '2020-04-18 16:53:09'),
(32, 16, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(33, 17, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(34, 18, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(35, 52, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(36, 19, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(37, 20, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(38, 21, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(39, 23, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(40, 22, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(41, 53, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(42, 54, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(43, 55, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(44, 56, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(45, 39, 3, '2020-04-18 17:00:02', '2020-04-18 17:00:02'),
(46, 20, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(47, 19, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(48, 57, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(49, 54, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(50, 58, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(51, 59, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(52, 60, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(53, 61, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(54, 62, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(55, 63, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(56, 48, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(57, 40, 4, '2020-04-18 17:03:18', '2020-04-18 17:03:18'),
(58, 24, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(60, 41, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(61, 40, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(62, 39, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(63, 42, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(64, 37, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(65, 27, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(66, 34, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(67, 30, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(68, 33, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(69, 64, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(70, 58, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(71, 65, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(72, 48, 5, '2020-04-18 17:10:12', '2020-04-18 17:10:12'),
(73, 2, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(74, 1, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(75, 4, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(76, 26, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(77, 31, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(78, 34, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(79, 33, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(80, 49, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(81, 40, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(82, 42, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(83, 37, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(84, 66, 6, '2020-04-18 17:15:49', '2020-04-18 17:15:49'),
(85, 67, 7, '2020-04-18 17:18:22', '2020-04-18 17:18:22'),
(86, 68, 7, '2020-04-18 17:18:22', '2020-04-18 17:18:22'),
(87, 69, 7, '2020-04-18 17:18:22', '2020-04-18 17:18:22'),
(88, 62, 7, '2020-04-18 17:18:22', '2020-04-18 17:18:22'),
(89, 44, 7, '2020-04-18 17:18:22', '2020-04-18 17:18:22'),
(90, 1, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(91, 4, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(92, 8, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(93, 27, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(94, 70, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(95, 57, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(96, 54, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(97, 44, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(98, 42, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(99, 37, 8, '2020-04-18 17:22:27', '2020-04-18 17:22:27'),
(100, 35, 9, '2020-04-18 17:27:03', '2020-04-18 17:27:03'),
(101, 36, 9, '2020-04-18 17:27:03', '2020-04-18 17:27:03'),
(102, 29, 9, '2020-04-18 17:27:03', '2020-04-18 17:27:03'),
(103, 33, 9, '2020-04-18 17:27:03', '2020-04-18 17:27:03'),
(104, 52, 9, '2020-04-18 17:27:03', '2020-04-18 17:27:03'),
(105, 45, 1, NULL, NULL),
(106, 72, 6, NULL, NULL),
(107, 72, 9, NULL, NULL),
(108, 3, 7, NULL, NULL),
(109, 5, 7, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `personality_types`
--
CREATE TABLE `personality_types` (
`personality_type_id` bigint(20) UNSIGNED NOT NULL,
`name` 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 `personality_types`
--
INSERT INTO `personality_types` (`personality_type_id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'Reformer', '2020-03-18 17:11:36', '2020-03-18 17:11:36'),
(2, 'Helper', '2020-03-18 17:11:53', '2020-03-18 17:11:53'),
(3, 'Achiever', '2020-03-18 17:12:04', '2020-03-18 17:12:04'),
(4, 'Individualist', '2020-03-18 17:12:12', '2020-03-18 17:12:12'),
(5, 'Investigator', '2020-03-18 17:12:21', '2020-03-18 17:12:21'),
(6, 'Loyalist', '2020-03-18 17:12:29', '2020-03-18 17:12:29'),
(7, 'Enthusiast', '2020-03-18 17:12:37', '2020-03-18 17:12:37'),
(8, 'challenger', '2020-03-18 17:12:46', '2020-03-18 17:12:46'),
(9, 'Peace Maker', '2020-03-18 17:12:53', '2020-03-18 17:12:53');
-- --------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE `questions` (
`id` bigint(20) UNSIGNED NOT NULL,
`test_type_id` bigint(20) UNSIGNED NOT NULL,
`question_text` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`question_description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`careerfield_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `questions`
--
INSERT INTO `questions` (`id`, `test_type_id`, `question_text`, `question_description`, `careerfield_id`) VALUES
(11, 1, 'Which of the following suits you.', NULL, NULL),
(12, 1, 'Which of the following suits you.', NULL, NULL),
(13, 1, 'Which of the following suits you.', NULL, NULL),
(14, 1, 'Which of the following suits you.', NULL, NULL),
(15, 1, 'Which of the following suits you.', NULL, NULL),
(16, 1, 'Which of the following suits you.', NULL, NULL),
(17, 1, 'Which of the following suits you.', NULL, NULL),
(18, 1, 'Which of the following suits you.', NULL, NULL),
(19, 1, 'Which of the following suits you.', NULL, NULL),
(20, 1, 'Which of the following suits you.', NULL, NULL),
(21, 1, 'Which of the following suits you.', NULL, NULL),
(22, 1, 'Which of the following suits you.', NULL, NULL),
(23, 1, 'Which of the following suits you.', NULL, NULL),
(24, 1, 'Which of the following suits you.', NULL, NULL),
(25, 1, 'Which of the following suits you.', NULL, NULL),
(26, 1, 'Which of the following suits you.', NULL, NULL),
(27, 1, 'Which of the following suits you.', NULL, NULL),
(28, 1, 'Which of the following suits you.', NULL, NULL),
(29, 1, 'Which of the following suits you.', NULL, NULL),
(30, 1, 'Which of the following suits you.', NULL, NULL),
(31, 1, 'Which of the following suits you.', NULL, NULL),
(32, 1, 'Which of the following suits you.', NULL, NULL),
(33, 1, 'Which of the following suits you.', NULL, NULL),
(34, 1, 'Which of the following suits you.', NULL, NULL),
(35, 1, 'Which of the following suits you.', NULL, NULL),
(36, 1, 'Which of the following suits you.', NULL, NULL),
(37, 1, 'Which of the following suits you.', NULL, NULL),
(38, 1, 'Which of the following suits you.', NULL, NULL),
(39, 1, 'Which of the following suits you.', NULL, NULL),
(40, 1, 'Which of the following suits you.', NULL, NULL),
(41, 1, 'Which of the following suits you.', NULL, NULL),
(42, 1, 'Which of the following suits you.', NULL, NULL),
(43, 1, 'Which of the following suits you.', NULL, NULL),
(44, 1, 'Which of the following suits you.', NULL, NULL),
(45, 1, 'Which of the following suits you.', NULL, NULL),
(46, 1, 'Which of the following suits you.', NULL, NULL),
(48, 2, 'Skills and knowledge in programming languages', NULL, 64),
(50, 2, 'Use mathematics to solve problems', NULL, 64),
(52, 2, 'Up to date with the latest web technology trends and programming techniques', NULL, 64),
(54, 2, 'Handle whole web project from start to roll-out', NULL, 64),
(55, 2, 'You are familiar with more than one accounting applications.', NULL, 2),
(56, 2, 'You know the advantages and disadvantages of different accounting packages you have used.', NULL, 2),
(57, 2, 'you’ve developed or sought to improve an accounting process. ', NULL, 2),
(58, 2, 'you ensure that you don’t forget details and ensure accuracy.', NULL, 2),
(59, 2, 'You can reduce costs unexpectedly through your personal innovation or diligence.', NULL, 2),
(60, 2, 'You are familiar with different types of analysis and modeling techniques.', NULL, 42),
(61, 2, 'You know the steps that are necessary to turn an idea into a product.', NULL, 42),
(62, 2, 'You can capture and describe customer needs and convey technical information.', NULL, 42),
(63, 2, 'You can determine which Business Intelligence (BI) tools to use.', NULL, 42),
(64, 2, 'If two companies are merging, you can explain what tasks should be implemented to make the merge successful.', NULL, 42),
(65, 2, 'You can define the diagrams that business analysts us.', NULL, 42),
(66, 2, 'You can accomplished a marketing activity on a tight budget.', NULL, 18),
(67, 2, 'How much familiar are you with our target market?', NULL, 18),
(68, 2, 'You can successfully change a customer\'s mind.', NULL, 18),
(69, 2, 'You can incorporate with online marketing tools.', NULL, 18),
(70, 2, 'You can coordinate and manage a diverse team of people to achieve deliverables.', NULL, 18),
(71, 2, 'You have a combination of creativity and the ability to communicate well to an audience.', NULL, 18),
(72, 2, 'You can handle a patient who complains constantly of pain.', NULL, 32),
(73, 2, 'You can respond well when family members ask for your personal diagnosis?', NULL, 32),
(74, 2, 'you can handle stress on the job.', NULL, 32),
(75, 2, 'Would you describe yourself as organized?', NULL, 32),
(76, 2, 'Are you a self-motivator?', NULL, 32),
(77, 2, 'You can deal with a family that isn\'t following care instructions.', NULL, 32),
(78, 2, 'You can keep in touch with your clients and give them updates periodically.', NULL, 7),
(79, 2, 'You can keep in touch with your clients and give them updates periodically.', NULL, 5),
(80, 2, 'You know dos and don’ts of buying and selling a property.', NULL, 7),
(81, 2, 'You know dos and don’ts of buying and selling a property.', NULL, 5),
(82, 2, 'You can use social media to promote properties.', NULL, 7),
(83, 2, 'You can use social media to promote properties.', NULL, 5),
(84, 2, 'You know what documents are required to close the deal.', NULL, 7),
(85, 2, 'You know what documents are required to close the deal.', NULL, 5),
(86, 2, 'You can manage your appointments?', NULL, 7),
(87, 2, 'You can manage your appointments?', NULL, 5),
(88, 2, 'You stay up-to-date with trends in the real estate market?', NULL, 7),
(89, 2, 'You stay up-to-date with trends in the real estate market?', NULL, 5),
(90, 2, 'you keep up with industry trends and news.', NULL, 8),
(91, 2, 'You can manage event promotion, including social media outreach and email campaigns.', NULL, 8),
(92, 2, 'You have a game plan for managing event budgets.', NULL, 8),
(93, 2, 'You can handle an event going over budget.', NULL, 8),
(94, 2, 'You can plan more than one event at a time.', NULL, 8),
(95, 2, 'You know the best way to choose an event venue.', NULL, 8),
(96, 2, 'Can you describe a simple audit?', NULL, 45),
(97, 2, 'You have developed systems for reducing the number of errors in your audits.', NULL, 45),
(98, 2, 'You have the ability to recall or find specific data quickly.', NULL, 45),
(99, 2, 'You can handle giving client feedback that might be difficult to hear.', NULL, 45),
(100, 2, 'You have expertise at using modern auditing software.', NULL, 45),
(101, 2, 'You have organizational skills.', NULL, 45),
(102, 2, 'You can evaluate an athlete\'s readiness to play in a game', NULL, 53),
(103, 2, 'You have experience in determining mental preparedness for opponents.', NULL, 53),
(104, 2, 'You have Knowledge of on-site triage.', NULL, 53),
(105, 2, 'You have Knowledge of injury-prevention techniques.', NULL, 53),
(106, 2, 'You have the Understanding of objective measurements.', NULL, 53),
(107, 2, 'You have full and accurate understanding of an administrator\'s responsibilities.', NULL, 3),
(108, 2, 'You have full and accurate understanding of an administrator\'s responsibilities.', NULL, 44),
(109, 2, 'You have full and accurate understanding of an administrator\'s responsibilities.', NULL, 49),
(110, 2, 'You have Willingness to work with a team.', NULL, 3),
(111, 2, 'You have Willingness to work with a team.', NULL, 44),
(112, 2, 'You have Willingness to work with a team.', NULL, 49),
(113, 2, 'You have Technical skill and technological expertise.', NULL, 3),
(114, 2, 'You have Technical skill and technological expertise.', NULL, 44),
(115, 2, 'You have Technical skill and technological expertise.', NULL, 49),
(116, 2, 'You have Technical skill and technological expertise.', NULL, 3),
(117, 2, 'You have Technical skill and technological expertise.', NULL, 44),
(118, 2, 'You have Technical skill and technological expertise.', NULL, 49),
(119, 2, 'You have Comprehensive awareness of the interrelated components of business operations.', NULL, 3),
(120, 2, 'You have Comprehensive awareness of the interrelated components of business operations.', NULL, 44),
(121, 2, 'You have Comprehensive awareness of the interrelated components of business operations.', NULL, 49),
(122, 2, 'You have Confident and eloquent speaking voice.', NULL, 3),
(123, 2, 'You have Confident and eloquent speaking voice.', NULL, 44),
(124, 2, 'You have Confident and eloquent speaking voice.', NULL, 49),
(125, 2, 'You have Friendly and engaging demeanor.', NULL, 3),
(126, 2, 'You have Friendly and engaging demeanor.', NULL, 44),
(127, 2, 'You have Friendly and engaging demeanor.', NULL, 49),
(128, 2, 'You have the skills listed in your job description.', NULL, 40),
(129, 2, 'You can give Practical and helpful suggestions to your clients.', NULL, 40),
(130, 2, 'You have Deep knowledge of architectural figure(s).', NULL, 40),
(131, 2, 'You have Understanding of the factors that contribute to project success.', NULL, 40),
(132, 2, 'You have Coverage of the basics.', NULL, 40),
(133, 2, 'You can maintain respect for customers.', NULL, 39),
(134, 2, 'You have Appropriate use of conflict resolution techniques.', NULL, 39),
(135, 2, 'You have Ability to recommend safe equipment at an appropriate price.', NULL, 39),
(136, 2, 'You have Knowledge of current product offerings.', NULL, 39),
(137, 2, 'You are Familiarity with the software/technology in the industry.', NULL, 39),
(138, 2, 'You have Recent training/experience with technology.', NULL, 39),
(139, 2, 'You can operate technology independently.', NULL, 39),
(140, 2, 'You outline a clear plan for delegating tasks.', NULL, 26),
(141, 2, 'you will be responsible for coaching less-experienced employees.', NULL, 26),
(142, 2, 'You have strong understanding of the business situation', NULL, 26),
(143, 2, 'You have an approach to leading business meetings to ensure that everything goes smoothly.', NULL, 26),
(144, 2, 'You are able to create a good team dynamic and ensure that organizational norms are carried out on a daily basis.', NULL, 26),
(145, 2, 'You have strong communication skills.', NULL, 26),
(146, 2, 'You understand the responsibilities of the position.', NULL, 4),
(147, 2, 'You are honest.', NULL, 4),
(148, 2, 'You can convince customers.', NULL, 4),
(149, 2, 'You have Ability to remain calm and patient.', NULL, 4),
(150, 2, 'You have good Communication skills.', NULL, 4),
(151, 2, 'You have patience and the ability to listen well while still selling a product.', NULL, 4),
(152, 2, 'You have Interpersonal skills.', NULL, 4),
(153, 2, 'You have Education or experience that is relevant to the position.', NULL, 29),
(154, 2, 'You have Education or experience that is relevant to the position.', NULL, 38),
(155, 2, 'You have Apprenticeship or work-study experience.', NULL, 29),
(156, 2, 'You have Apprenticeship or work-study experience.', NULL, 38),
(157, 2, 'You have The ability to learn quickly and listen to colleagues with more experience.', NULL, 29),
(158, 2, 'You have The ability to learn quickly and listen to colleagues with more experience.', NULL, 38),
(159, 2, 'You have Confidence in the steps needed to do the tasks.', NULL, 29),
(160, 2, 'You have Confidence in the steps needed to do the tasks.', NULL, 38),
(161, 2, 'You have An understanding of risk prevention and the implications for a business.', NULL, 29),
(162, 2, 'You have An understanding of risk prevention and the implications for a business.', NULL, 38),
(163, 2, 'You have, at some extent Medical training experience.', NULL, 50),
(164, 2, 'You have, at some extent Medical training experience.', NULL, 13),
(165, 2, 'You see yourself as compassionate and empathetic human.', NULL, 50),
(166, 2, 'You see yourself as compassionate and empathetic human.', NULL, 13),
(167, 2, 'You have Positive reinforcement techniques in handing special needs.', NULL, 50),
(168, 2, 'You have Positive reinforcement techniques in handing special needs.', NULL, 13),
(169, 2, 'You have Willingness to listen and encourage.', NULL, 50),
(170, 2, 'You have Willingness to listen and encourage.', NULL, 13),
(171, 2, 'You can give A spontaneous and unforced answer.', NULL, 50),
(172, 2, 'You can give A spontaneous and unforced answer.', NULL, 13),
(173, 2, 'You have Fitness for the specific caregiving skills,', NULL, 50),
(174, 2, 'You have Fitness for the specific caregiving skills,', NULL, 13),
(175, 2, 'You have a strong set of management philosophies.', NULL, 16),
(176, 2, 'You have a flexibility to consider new principles', NULL, 16),
(177, 2, 'You have approaches to make big-picture decisions.', NULL, 16),
(178, 2, 'You have skills you can use to carry out corporate change successfully.', NULL, 16),
(179, 2, 'You have a history of leading corporate transformation.', NULL, 16),
(180, 2, 'You have a well-conceived approach to setting goals.', NULL, 16),
(181, 2, 'You are able create an environment that makes talented people want to work for you.', NULL, 16),
(182, 2, 'Do you think your love for cooking can still be intact after cooking 8-10 hours a day?', NULL, 69),
(183, 2, 'You have a diverse culinary background.', NULL, 69),
(184, 2, 'You have an appropriate culinary training.', NULL, 69),
(185, 2, 'You have an Ability to work a flexible schedule.', NULL, 69),
(186, 2, 'You are Able to handle stress without burning out.', NULL, 69),
(187, 2, 'You maintain food safety standards.', NULL, 69),
(188, 2, 'You have Training in specific cuisines.', NULL, 69),
(189, 2, 'You have experience in in writing for the web.', NULL, 48),
(190, 2, 'You have SEO skills, which are integral for content writing.', NULL, 48),
(191, 2, 'You have English language education, including grammar.', NULL, 48),
(192, 2, 'You have Understanding of why targeting an audience is crucial to content.', NULL, 48),
(193, 2, 'You have Analytical skills for given raw data.', NULL, 48),
(194, 2, 'You have an idea of Factual information versus keyword stuffing.', NULL, 48),
(195, 2, 'You have Experience with newer technologies for exams and treatment.', NULL, 34),
(196, 2, 'You have Ability to adapt exam for specific ages/health concerns.', NULL, 34),
(197, 2, 'You have Capacity to keep patients comfortable.', NULL, 34),
(198, 2, 'You are able to switch tasks quickly.', NULL, 34),
(199, 2, 'You have Ability to verify patient allergies prior to choosing anesthetic.', NULL, 34),
(200, 2, 'You have Ability to systematically check all necessary oral health areas.', NULL, 31),
(201, 2, 'You have Capacity to keep patients comfortable', NULL, 31),
(202, 2, 'You have Ability to use X-rays only where clinically indicated', NULL, 31),
(203, 2, 'You have understanding of radiation shielding and safety.', NULL, 31),
(204, 2, 'You have Ability to verify patient allergies prior to choosing anesthetic.', NULL, 31),
(205, 2, 'You have Understanding of varied anesthesia types and methods.', NULL, 31),
(206, 2, 'you coach a pediatric patient through a tooth extraction or similar procedure.', NULL, 31),
(207, 2, 'you ensure that you are up to date with the latest trends.', NULL, 59),
(208, 2, 'you can explain complex engineering designs to your clients.', NULL, 59),
(209, 2, 'You have Excellent communication skills.', NULL, 59),
(210, 2, 'You have Level of expertise in software mentioned.', NULL, 59),
(211, 2, 'You have Ability to think creatively.', NULL, 59),
(212, 2, 'You have Ability to see big picture.', NULL, 37),
(213, 2, 'You have Ability to identify variables/data segments.', NULL, 37),
(214, 2, 'You have Ability to communicate thought process.', NULL, 37),
(215, 2, 'You have Consideration of deadline.', NULL, 37),
(216, 2, 'You can use data to spot opportunities for preventative measures.', NULL, 37),
(217, 2, 'You have Practical ways the applicant used engineering skills to overcome adverse conditions.', NULL, 41),
(218, 2, 'You can present technical concepts to a nontechnical audience.', NULL, 41),
(219, 2, 'You have Ability to manage time throughout all parts of a project.', NULL, 41),
(220, 2, 'You have engineering resources do you use to stay on top of the latest news, technology and developments in the field.', NULL, 41),
(221, 2, 'You have Enthusiasm for learning more about the engineering field.', NULL, 41),
(222, 2, 'You have safeguards in place for double-checking your engineering work and ensuring that mistakes don\'t slip past you.', NULL, 41),
(223, 2, 'You have Knowledge of safety standards for the applicant\'s engineering specialization.', NULL, 41),
(224, 2, 'You have an Ability to translate data from relational database management systems.', NULL, 1),
(225, 2, 'You understand the importance of efficiency and accuracy.', NULL, 1),
(226, 2, 'You have Experience preparing financial documents with a tight deadline.', NULL, 1),
(227, 2, 'You have methods for avoiding errors when recording and examining financial documents.', NULL, 1),
(228, 2, 'You have a solid understanding of multiple financial documents.', NULL, 1),
(229, 2, 'You know the ins and outs of a plethora of different financial documents.', NULL, 1),
(230, 2, 'You have Ability to handle unforeseen and critical situations.', NULL, 70),
(231, 2, 'You have ability to display the cost modification required efficiently.', NULL, 70),
(232, 2, 'You have understanding of applying and explaining an analysis.', NULL, 70),
(233, 2, 'You have Ability to organize the work from most crucial to least.', NULL, 70),
(234, 2, 'You have Ability to handle problems between departments.', NULL, 70),
(235, 2, 'You have a Commitment to staying calm.', NULL, 70),
(236, 2, 'You have Ability for rational self-judgment.', NULL, 52),
(237, 2, 'You have Ability for rational self-judgment.', NULL, 14),
(238, 2, 'You can help lead the workplace culture..', NULL, 52),
(239, 2, 'You can help lead the workplace culture..', NULL, 14),
(240, 2, 'You stay current on issues of compliance with national labor laws..', NULL, 52),
(241, 2, 'You stay current on issues of compliance with national labor laws..', NULL, 14),
(242, 2, 'You have knowledge about finding the best and most qualified job applicants for any given position.', NULL, 52),
(243, 2, 'You have knowledge about finding the best and most qualified job applicants for any given position.', NULL, 14),
(244, 2, 'You can determine chosen applicant\'s success or failure in the position.', NULL, 52),
(245, 2, 'You can determine chosen applicant\'s success or failure in the position.', NULL, 14),
(246, 2, 'You know how to manage Level of comfort in an office environment.', NULL, 52),
(247, 2, 'You know how to manage Level of comfort in an office environment.', NULL, 14),
(248, 2, 'You can Focus on the client\'s budget and time constraints.', NULL, 47),
(249, 2, 'You are concise in your strategy while planning on working with a client.', NULL, 47),
(250, 2, 'You believe that aestheticism and functionality have a vital place in a home.', NULL, 47),
(251, 2, 'You have Flexibility regarding your own plans.', NULL, 47),
(252, 2, 'You have contingency plans in mind for most situations.', NULL, 47),
(253, 2, 'You might be able to overcome these potential challenges.', NULL, 47),
(254, 2, 'You also have room to share your own vision.', NULL, 47),
(255, 2, 'You have Background knowledge of legal principles.', NULL, 27),
(257, 2, 'You have Ability to quickly cite legal precedent.', NULL, 27),
(259, 2, 'You have Ability to articulate conflict-handling strategies.', NULL, 27),
(261, 2, 'You have Knowledge of choosing when to agree to disagree.', NULL, 27),
(263, 2, 'You have Resilience to deal with failure.', NULL, 27),
(265, 2, 'You have Passion for different areas of the law.', NULL, 27),
(267, 2, 'You have Public speaking experience regarding nutrition.', NULL, 72),
(268, 2, 'You have Internship experience in nutrition programs.', NULL, 72),
(269, 2, 'You have Ability to branch out and discuss advanced dieting techniques.', NULL, 72),
(270, 2, 'You have Adaptability regarding unique client approaches.', NULL, 72),
(271, 2, 'You can help clients adhere to new lifestyle routines.', NULL, 72),
(272, 2, 'You have Knowledge of fiber\'s role in the body.', NULL, 72),
(273, 2, 'You have Experience with a wide variety of neurological disorders.', NULL, 30),
(274, 2, 'You have Knowledge that is specific to your practice\'s specialty.', NULL, 30),
(275, 2, 'You have Experience with electronic health record systems.', NULL, 30),
(276, 2, 'You have Willingness to learn how to use electronic health record systems, if needed.', NULL, 30),
(277, 2, 'You have Up-to-date understanding of neurology.', NULL, 30),
(278, 2, 'You have Experience assisting families with in-home care arrangements.', NULL, 30),
(279, 2, 'You have Appropriate knowledge of the newest flea and tick products.', NULL, 33),
(280, 2, 'You have Ability to account for potential allergies or contraindications.', NULL, 33),
(281, 2, 'You take Consideration of the pet owner\'s medication preference.', NULL, 33),
(282, 2, 'You have Ability to include the client in the pet\'s treatment plan.', NULL, 33),
(283, 2, 'You have Familiarity with keeping pets calm and cooperative.', NULL, 33),
(284, 2, 'You have Ability to explain procedures to clients.', NULL, 33),
(285, 2, 'Understanding of the latest medications/psychotherapy approaches', NULL, 51),
(286, 2, 'You have Warm, positive approach to patient care.', NULL, 51),
(287, 2, 'You have Ability to be empathetic and professional.', NULL, 51),
(288, 2, 'you approach the care of patients who have multiple mental health issues.', NULL, 51),
(289, 2, 'You have Ability to prioritize the patient\'s most urgent needs.', NULL, 51),
(290, 2, 'You have Appropriate knowledge of conflict resolution strategies.', NULL, 51),
(291, 2, 'You have Dedication to patients with complex health needs.', NULL, 51),
(292, 2, 'You usually know the types of movies they prefer to produce.', NULL, 22),
(293, 2, 'You know the hiring process for director position.', NULL, 22),
(294, 2, 'You have Aptitude for financial management.', NULL, 22),
(295, 2, 'You have Effective communication and persuasion skills.', NULL, 22),
(296, 2, 'You can manage to set a deadline for a project and keep it on schedule.', NULL, 22),
(297, 2, 'You have a definite understanding of basic equipment requirements.', NULL, 62),
(298, 2, 'You have adaptability when it comes to using new gear.', NULL, 62),
(299, 2, 'You have Professionally traceable techniques in your portfolio.', NULL, 62),
(300, 2, 'You have Experience with photo editing software.', NULL, 62),
(301, 2, 'You have strong focus on lighting and arrangement.', NULL, 62),
(302, 2, 'You have Willingness to collaborate with the client on details.', NULL, 62),
(303, 2, 'you have A desire to protect patients\' best interests', NULL, 28),
(304, 2, 'You have Willingness to constantly update surgical knowledge.', NULL, 28),
(305, 2, 'You have Thorough understanding of surgical techniques.', NULL, 28),
(306, 2, 'You have the Ability to calm agitated or aggressive patients.', NULL, 28),
(307, 2, 'You have Ability to clearly communicate suggestions to coworkers.', NULL, 28),
(308, 2, 'You have Understanding and empathy for patients.', NULL, 28),
(309, 2, 'You have Ability to handle disagreements maturely.', NULL, 28),
(310, 2, 'Reputation management is a top priority for you.', NULL, 20),
(311, 2, 'You Understand search engine optimization.', NULL, 20),
(312, 2, 'You Cultivate leads and uses lead scoring techniques.', NULL, 20),
(313, 2, 'You Keep brand consistent on all profiles.', NULL, 20),
(314, 2, 'You Convey the company message appropriately.', NULL, 20),
(315, 2, 'You Use tools that increase traffic to websites and social media accounts.', NULL, 20),
(316, 2, 'You have the skills necessary to create interesting content and follows steps to improve quality.', NULL, 20);
-- --------------------------------------------------------
--
-- Table structure for table `question_options`
--
CREATE TABLE `question_options` (
`id` bigint(20) UNSIGNED NOT NULL,
`question_id` bigint(20) UNSIGNED NOT NULL,
`option` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`personality_type_id` bigint(20) UNSIGNED 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 `question_options`
--
INSERT INTO `question_options` (`id`, `question_id`, `option`, `personality_type_id`, `created_at`, `updated_at`) VALUES
(11, 11, 'I\'ve been romantic and imaginative.', 4, '2020-03-23 13:20:31', '2020-03-23 13:20:31'),
(12, 11, 'I\'ve been pragmatic and down to earth.', 6, '2020-03-23 13:20:31', '2020-03-23 13:20:31'),
(13, 12, 'I have tended to take on confrontations.', 8, '2020-03-23 13:26:51', '2020-03-23 13:26:51'),
(14, 12, 'I have tended avoid confrontations.', 9, '2020-03-23 13:26:51', '2020-03-23 13:26:51'),
(15, 13, 'I have typically been diplomatic, charming, and ambitious.', 3, '2020-03-23 13:27:39', '2020-03-23 13:27:39'),
(16, 13, 'I have typically been direct, formal, and idealistic.', 1, '2020-03-23 13:27:39', '2020-03-23 13:27:39'),
(17, 14, 'I have tended to be focused and intense.', 5, '2020-03-23 13:28:35', '2020-03-23 13:28:35'),
(18, 14, 'I have tended to be spontaneous and fun-loving.', 7, '2020-03-23 13:28:35', '2020-03-23 13:28:35'),
(19, 15, 'I have been a hospitable person and have enjoyed welcoming new friends into my life.', 2, '2020-03-31 08:39:13', '2020-03-31 08:39:13'),
(20, 15, 'I have been a private person and have not mixed much with others.', 4, '2020-03-31 08:39:13', '2020-03-31 08:39:13'),
(21, 16, 'Generally, it\'s been easy to \"get a rise\" out of me.', 6, '2020-03-31 08:39:51', '2020-03-31 08:39:51'),
(22, 16, 'Generally, it\'s been difficult to \"get a rise\" out of me.', 9, '2020-03-31 08:39:51', '2020-03-31 08:39:51'),
(23, 17, 'I\'ve been more of a \"street-smart\" survivor.', 8, '2020-03-31 08:41:06', '2020-03-31 08:41:06'),
(24, 17, 'I\'ve been more of a \"high-minded\" idealist .', 1, '2020-03-31 08:41:06', '2020-03-31 08:41:06'),
(25, 18, 'I have needed to show affection to people.', 2, '2020-03-31 08:42:12', '2020-03-31 08:42:12'),
(26, 18, 'I have preferred to maintain a certain distance with people.', 5, '2020-03-31 08:42:12', '2020-03-31 08:42:12'),
(27, 19, 'When presented with a new experience, I\'ve usually asked myself if it would be useful to me.', 3, '2020-03-31 08:43:09', '2020-03-31 08:43:09'),
(28, 19, 'When presented with a new experience, I\'ve usually asked myself if it would be enjoyable.', 7, '2020-03-31 08:43:09', '2020-03-31 08:43:09'),
(29, 20, 'I have tended to focus too much on myself.', 4, '2020-03-31 08:44:17', '2020-03-31 08:44:17'),
(30, 20, 'I have tended to focus too much on others.', 9, '2020-03-31 08:44:17', '2020-03-31 08:44:17'),
(31, 21, 'Others have depended on my insight and knowledge.', 5, '2020-03-31 08:45:26', '2020-03-31 08:45:26'),
(32, 21, 'Others have depended on my strength and decisiveness.', 8, '2020-03-31 08:45:26', '2020-03-31 08:45:26'),
(33, 22, 'I have come across as being too unsure of myself.', 6, '2020-03-31 08:46:45', '2020-03-31 08:46:45'),
(34, 22, 'I have come across as being too sure of myself.', 1, '2020-03-31 08:46:45', '2020-03-31 08:46:45'),
(35, 23, 'I have been more relationship-oriented than goal-oriented.', 2, '2020-03-31 08:47:50', '2020-03-31 08:47:50'),
(36, 23, 'I have been more goal-oriented than relationship-oriented.', 3, '2020-03-31 08:47:50', '2020-03-31 08:47:50'),
(37, 24, 'I have not been able to speak up for myself very well.', 4, '2020-03-31 08:48:42', '2020-03-31 08:48:42'),
(38, 24, 'I have been outspoken—I\'ve said what others wished they had the nerve to say.', 7, '2020-03-31 08:48:42', '2020-03-31 08:48:42'),
(39, 25, 'It\'s been difficult for me to stop considering alternatives and do something definite.', 5, '2020-03-31 08:49:35', '2020-03-31 08:49:35'),
(40, 25, 'It\'s been difficult for me to take it easy and be more flexible.', 1, '2020-03-31 08:49:35', '2020-03-31 08:49:35'),
(41, 26, 'I have tended to be hesitant and procrastinating.', 6, '2020-03-31 08:50:40', '2020-03-31 08:50:40'),
(42, 26, 'I have tended to be bold and domineering.', 8, '2020-03-31 08:50:40', '2020-03-31 08:50:40'),
(43, 27, 'My reluctance to get too involved has gotten me into trouble with people.', 9, '2020-03-31 08:51:14', '2020-03-31 08:51:14'),
(44, 27, 'My eagerness to have people depend on me has gotten me into trouble with them.', 2, '2020-03-31 08:51:14', '2020-03-31 08:51:14'),
(45, 28, 'Usually, I have been able to put my feelings aside to get the job done.', 3, '2020-03-31 08:52:04', '2020-03-31 08:52:04'),
(46, 28, 'Usually, I have needed to work through my feelings before I could act.', 4, '2020-03-31 08:52:04', '2020-03-31 08:52:04'),
(47, 29, 'Generally, I have been methodical and cautious.', 6, '2020-03-31 08:52:48', '2020-03-31 08:52:48'),
(48, 29, 'Generally, I have been adventurous and taken risks.', 7, '2020-03-31 08:52:48', '2020-03-31 08:52:48'),
(49, 30, 'I have tended to be a supportive, giving person who enjoys the company of others.', 2, '2020-03-31 08:55:02', '2020-03-31 08:55:02'),
(50, 30, 'I have tended to be a serious, reserved person who likes discussing issues.', 1, '2020-03-31 08:55:02', '2020-03-31 08:55:02'),
(51, 31, 'I\'ve often felt the need to be a \"pillar of strength.\"', 8, '2020-03-31 08:55:47', '2020-03-31 08:55:47'),
(52, 31, 'I\'ve often felt the need to perform perfectly.', 3, '2020-03-31 08:55:47', '2020-03-31 08:55:47'),
(53, 32, 'I\'ve typically been interested in asking tough questions and maintaining my independence.', 5, '2020-03-31 08:56:28', '2020-03-31 08:56:28'),
(54, 32, 'I\'ve typically been interested in maintaining my stability and peace of mind.', 9, '2020-03-31 08:56:28', '2020-03-31 08:56:28'),
(55, 33, 'I\'ve been too hard-nosed and sceptical.', 6, '2020-03-31 08:57:07', '2020-03-31 08:57:07'),
(56, 33, 'I\'ve been too soft-hearted and sentimental.', 2, '2020-03-31 08:57:07', '2020-03-31 08:57:07'),
(57, 34, 'I\'ve often worried that I\'m missing out on something better.', 7, '2020-03-31 08:57:42', '2020-03-31 08:57:42'),
(58, 34, 'I\'ve often worried that if I let down my guard, someone will take advantage of me.', 8, '2020-03-31 08:57:42', '2020-03-31 08:57:42'),
(59, 35, 'My habit of being \"stand-offish\" has annoyed people.', 4, '2020-03-31 08:58:25', '2020-03-31 08:58:25'),
(60, 35, 'My habit of telling people what to do has annoyed people.', 1, '2020-03-31 08:58:25', '2020-03-31 08:58:25'),
(61, 36, 'Usually, when troubles have gotten to me, I have been able to \"tune them out.\"', 9, '2020-03-31 08:59:03', '2020-03-31 08:59:03'),
(62, 36, 'Usually, when troubles have gotten to me, I have treated myself to something I\'ve enjoyed.', 7, '2020-03-31 08:59:03', '2020-03-31 08:59:03'),
(63, 37, 'I have depended upon my friends and they have known that they can depend on me.', 6, '2020-03-31 08:59:35', '2020-03-31 08:59:35'),
(64, 37, 'I have not depended on people; I have done things on my own.', 3, '2020-03-31 08:59:35', '2020-03-31 08:59:35'),
(65, 38, 'I have tended to be detached and preoccupied.', 5, '2020-03-31 09:01:38', '2020-03-31 09:01:38'),
(66, 38, 'I have tended to be moody and self-absorbed.', 4, '2020-03-31 09:01:38', '2020-03-31 09:01:38'),
(67, 39, 'I have liked to challenge people and \"shake them up.\"', 8, '2020-03-31 09:02:19', '2020-03-31 09:02:19'),
(68, 39, 'I have liked to comfort people and calm them down.', 2, '2020-03-31 09:02:19', '2020-03-31 09:02:19'),
(69, 40, 'I have generally been an outgoing, sociable person.', 7, '2020-03-31 09:02:58', '2020-03-31 09:02:58'),
(70, 40, 'I have generally been an earnest, self-disciplined person.', 1, '2020-03-31 09:02:58', '2020-03-31 09:02:58'),
(71, 41, 'I\'ve usually been shy about showing my abilities.', 9, '2020-03-31 09:03:30', '2020-03-31 09:03:30'),
(72, 41, 'I\'ve usually liked to let people know what I can do well.', 3, '2020-03-31 09:03:30', '2020-03-31 09:03:30'),
(73, 42, 'Pursuing my personal interests has been more important to me than having comfort and security.', 5, '2020-03-31 09:04:04', '2020-03-31 09:04:04'),
(74, 42, 'Having comfort and security has been more important to me than pursuing my personal interests.', 6, '2020-03-31 09:04:04', '2020-03-31 09:04:04'),
(75, 43, 'When I\'ve had conflict with others, I\'ve tended to withdraw.', 4, '2020-03-31 09:04:54', '2020-03-31 09:04:54'),
(76, 43, 'When I\'ve had conflict with others, I\'ve tended to withdraw.', 5, '2020-03-31 09:04:54', '2020-03-31 09:04:54'),
(77, 44, 'I have given in too easily and let others push me around.', 9, '2020-03-31 09:05:27', '2020-03-31 09:05:27'),
(78, 44, 'I have been too uncompromising and demanding with others.', 4, '2020-03-31 09:05:27', '2020-03-31 09:05:27'),
(79, 45, 'I\'ve been appreciated for my unsinkable spirit and great sense of humour.', 7, '2020-03-31 09:06:05', '2020-03-31 09:06:05'),
(80, 45, 'I\'ve been appreciated for my quiet strength and exceptional generosity.', 2, '2020-03-31 09:06:05', '2020-03-31 09:06:05'),
(81, 46, 'Much of my success has been due to my talent for making a favourable impression.', 3, '2020-03-31 09:06:43', '2020-03-31 09:06:43'),
(82, 46, 'Much of my success has been achieved despite my lack of interest in developing \"interpersonal skills.\"', 5, '2020-03-31 09:06:43', '2020-03-31 09:06:43');
-- --------------------------------------------------------
--
-- Table structure for table `sessions`
--
CREATE TABLE `sessions` (
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` bigint(20) UNSIGNED DEFAULT NULL,
`ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`user_agent` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`payload` text COLLATE utf8mb4_unicode_ci NOT NULL,
`last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `sessions`
--
INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('0SRNGcOAFM78pKXXSbbLtZ26xpFDtgIZTUoHLrlX', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoicTF6eDZkRnMwRWZyZkpyMTNGeHJ0VlV2OGpRdVJIRXVoN2RHRnRoMCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=', 1592820743),
('aN5NXtNBnNXJD78ehpWW48kp3zqKPdXIyr1SR4wQ', NULL, '192.168.43.1', 'Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.96 Mobile Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiUDJjcFBKQmI1dzJjd1U1QUlQZ3VBbzh0eU04ZWFSa2tmR3lHOGJEUiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6ODc6Imh0dHA6Ly8xOTIuMTY4LjQzLjExNC9sYXJhdmVsL2Jvb3RzdHJhcFNDRy9TQ0clMjAtJTIwQ29weS9wdWJsaWMvc3R1ZGVudC9kYXNoYm9hcmQvc29udSI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NTQ6ImxvZ2luX3N0dWRlbnRfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7czoxMjoiMTYwMDkwMTA3MDU2Ijt9', 1592841303),
('viVw4R42TDUncyKDg4hfgdo7lyxLKYWm6vM1Goc1', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiN2xaR0FPcjIzUXphQkw5Y0pyc3duTGRRSEJ6TTVJSTd0Sk1yaXBoTCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6ODg6Imh0dHA6Ly9sb2NhbGhvc3QvbGFyYXZlbC9ib290c3RyYXBTQ0cvU0NHJTIwLSUyMENvcHkvcHVibGljL3N0dWRlbnQvcGVyc29uYWxpdHl0ZXN0L3NvbnUiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX1zOjU0OiJsb2dpbl9zdHVkZW50XzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO3M6MTI6IjE2MDA5MDEwNzA1NiI7fQ==', 1592840618),
('W6k7zxPmayauhLJuqtVnH21n2DX8Ifr0JAn8YcHo', NULL, '192.168.43.181', 'Mozilla/5.0 (Linux; Android 9; Redmi Note 5 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Mobile Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiQm9IRlM4Mndvclg2RFZOQmUzMDZySjNlZ3RlWXlZM0J3V1JUbzJ0OCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6OTI6Imh0dHA6Ly8xOTIuMTY4LjQzLjExNC9sYXJhdmVsL2Jvb3RzdHJhcFNDRy9TQ0clMjAtJTIwQ29weS9wdWJsaWMvc3R1ZGVudC9yZWNvbW1hbmRhdGlvbi9zb251Ijt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo1NDoibG9naW5fc3R1ZGVudF81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtzOjEyOiIxNjAwOTAxMDcwNTYiO30=', 1592841183);
-- --------------------------------------------------------
--
-- Table structure for table `streams`
--
CREATE TABLE `streams` (
`stream_id` bigint(20) UNSIGNED NOT NULL,
`stream_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `streams`
--
INSERT INTO `streams` (`stream_id`, `stream_name`) VALUES
(1, 'Arts'),
(2, 'Commerce'),
(3, 'Science(Maths)'),
(4, 'Science(Bio)');
-- --------------------------------------------------------
--
-- Table structure for table `students`
--
CREATE TABLE `students` (
`student_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`parent_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`fname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`DOB` date DEFAULT NULL,
`contact` bigint(12) UNSIGNED 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 `students`
--
INSERT INTO `students` (`student_id`, `parent_id`, `fname`, `lname`, `email`, `password`, `DOB`, `contact`, `created_at`, `updated_at`) VALUES
('160090107002', 'pnt001', 'Fenil', 'Patil', 'Fenil@gmail.com', '$2y$10$5OHGDBVWoKtcBgw33RKFceqRuosgXZHTgvv8V9NQ.rqddhoV.bKSa', '2020-06-17', 9876543215, '2020-06-12 01:11:19', '2020-06-12 01:11:19'),
('160090107043', 'mahesh777', 'dishant', 'rana', 'dishant@gmail.com', '$2y$10$MxI5Hv1OmMPuvDRZOCvEB.NbzsN6W0U8x9O1dSfSw1cCnFm5f.cfS', '2020-06-08', 9876543215, '2020-06-11 11:27:44', '2020-06-11 11:27:44'),
('160090107056', 'mahesh777', 'sonu', 'rana', 'sonu@gmail.com', '$2y$10$mK1bSTWm1Y8SqvdrhEEj6uR777XgYeCAZmn15yT/k3UZN.NOYdHwy', '2020-01-28', 9876543215, '2020-06-09 03:22:42', '2020-06-09 03:22:42'),
('test1', 'mahesh777', 'test1', 'test1', 'test1@gmail.com', '$2y$10$tVa76YnGWKudulV5fUcP4uqunKAPYJ8Mnyy9bO8PeHMhMz0TuPaDi', '2019-12-30', 9234567890, '2020-06-11 17:05:29', '2020-06-11 17:05:29');
-- --------------------------------------------------------
--
-- Table structure for table `subjects`
--
CREATE TABLE `subjects` (
`subject_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`classes_id` bigint(20) UNSIGNED NOT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `subjects`
--
INSERT INTO `subjects` (`subject_id`, `name`, `classes_id`, `description`) VALUES
(2, 'English', 5, NULL),
(4, 'Computer', 5, NULL),
(6, 'Sociology', 5, NULL),
(8, 'History', 5, NULL),
(10, 'Political Science', 5, NULL),
(12, 'Psychology', 5, NULL),
(14, 'Economics', 5, NULL),
(16, 'Environment Education', 5, NULL),
(18, 'Public Administration', 5, NULL),
(20, 'Fine Arts', 5, NULL),
(22, 'English', 6, NULL),
(24, 'Computer', 6, NULL),
(26, 'Elements Of Accounts', 6, NULL),
(28, 'Statistics', 6, NULL),
(30, 'Economics', 6, NULL),
(32, 'Organization Of Commerce & Management', 6, NULL),
(34, ' COMMERCIAL CORRESPONDENCE AND SECRETARIAL', 6, NULL),
(36, 'Business Studies', 6, NULL),
(39, 'Computer', 7, NULL),
(40, 'Computer', 8, NULL),
(43, 'English', 7, NULL),
(44, 'English', 8, NULL),
(47, 'Physics', 7, NULL),
(48, 'Physics', 8, NULL),
(51, 'Chemistry', 7, NULL),
(52, 'Chemistry', 8, NULL),
(54, 'Biology', 7, NULL),
(56, 'Maths', 8, NULL),
(57, 'Language', 6, NULL),
(58, 'Geography', 5, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `subject_careerfields`
--
CREATE TABLE `subject_careerfields` (
`id` bigint(20) UNSIGNED NOT NULL,
`subject_id` bigint(20) UNSIGNED NOT NULL,
`careerfield_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `subject_careerfields`
--
INSERT INTO `subject_careerfields` (`id`, `subject_id`, `careerfield_id`) VALUES
(1, 26, 1),
(2, 26, 2),
(3, 26, 3),
(4, 26, 4),
(6, 36, 6),
(7, 36, 7),
(9, 30, 5),
(10, 30, 8),
(11, 30, 9),
(12, 54, 28),
(13, 54, 29),
(14, 54, 30),
(15, 54, 31),
(18, 20, 45),
(19, 20, 46),
(20, 20, 47),
(21, 57, 48),
(22, 30, 10),
(23, 30, 11),
(24, 30, 12),
(25, 30, 13),
(26, 30, 14),
(27, 30, 15),
(28, 54, 32),
(29, 56, 38),
(30, 56, 37),
(31, 12, 51),
(32, 12, 49),
(33, 12, 50),
(34, 36, 16),
(35, 36, 17),
(36, 36, 18),
(38, 36, 20),
(39, 36, 21),
(41, 30, 22),
(42, 30, 23),
(43, 30, 19),
(45, 12, 52),
(46, 12, 53),
(47, 8, 54),
(48, 8, 55),
(49, 8, 56),
(50, 56, 39),
(51, 12, 57),
(52, 8, 58),
(53, 20, 59),
(54, 20, 60),
(55, 20, 61),
(56, 20, 62),
(57, 20, 63),
(58, 56, 40),
(59, 30, 24),
(60, 56, 41),
(61, 54, 34),
(62, 54, 33),
(63, 4, 64),
(65, 58, 65),
(66, 36, 26),
(68, 56, 44),
(69, 12, 66),
(70, 8, 67),
(71, 20, 68),
(72, 20, 69),
(73, 30, 27),
(74, 12, 70),
(75, 54, 35),
(76, 54, 36);
-- --------------------------------------------------------
--
-- Table structure for table `subject_results`
--
CREATE TABLE `subject_results` (
`id` bigint(20) UNSIGNED NOT NULL,
`student_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_id` bigint(20) UNSIGNED NOT NULL,
`marks` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `subject_results`
--
INSERT INTO `subject_results` (`id`, `student_id`, `subject_id`, `marks`) VALUES
(31, '160090107056', 26, 80),
(32, '160090107056', 32, 70),
(33, '160090107056', 28, 65),
(34, '160090107056', 30, 75),
(35, '160090107056', 34, 65),
(36, '160090107056', 36, 80),
(37, '160090107056', 57, 70),
(38, '160090107056', 22, 80),
(39, '160090107056', 24, 65),
(40, '160090107043', 24, 80),
(41, '160090107043', 30, 70),
(42, '160090107043', 32, 75),
(43, '160090107043', 26, 50),
(44, '160090107043', 28, 59),
(45, '160090107043', 34, 63),
(46, '160090107043', 36, 54),
(47, '160090107043', 57, 71),
(48, 'test1', 26, 67),
(49, 'test1', 22, 80),
(50, 'test1', 24, 50),
(51, 'test1', 28, 75),
(52, 'test1', 30, 65),
(53, 'test1', 32, 59),
(54, 'test1', 34, 50),
(55, 'test1', 36, 55),
(56, 'test1', 57, 70),
(57, '160090107002', 26, 65),
(58, '160090107002', 30, 50),
(59, '160090107002', 22, 75),
(60, '160090107002', 24, 59),
(61, '160090107002', 28, 70),
(62, '160090107002', 34, 56),
(63, '160090107002', 36, 65),
(64, '160090107002', 32, 60),
(65, '160090107002', 57, 50);
-- --------------------------------------------------------
--
-- Table structure for table `teachers`
--
CREATE TABLE `teachers` (
`teacher_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`fname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`contact` bigint(12) UNSIGNED 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 `teachers`
--
INSERT INTO `teachers` (`teacher_id`, `fname`, `lname`, `email`, `password`, `contact`, `created_at`, `updated_at`) VALUES
('Dishant123', 'Dishant', 'Rana', 'dishanat@gmail.com', '$2y$10$TopreuGrRZuVHwcQCaXkI.el5DraUCAcYJhGOKzE8C0vt2MgRosIq', 8140443145, '2020-05-21 01:16:59', '2020-05-21 01:16:59'),
('Dishant1234', 'Dishant', 'Rana', 'dishant@gmail.com', '$2y$10$tooqN3HeEf/COJ0OCreKoumoK8BMUxmXg8XGwGYE8rUZMbNJ.ktwu', 8140443145, '2020-05-21 01:11:57', '2020-05-21 01:11:57'),
('Nilam1234', 'Nilam', 'Surti', 'Nilam123@gmail.com', '$2y$10$JaCAaEv0qXUyAA/P48swJemlHocsQ1vxHFMBK4N5/.Qaw7uPPd8/C', 123456789, '2020-03-16 13:36:45', '2020-03-16 13:36:45'),
('Teacher1', 'Teacher1', 'abc', 'Teacher1@gmail.com', '$2y$10$FLdKPEp/b5rtmNr/tuKvFenGvF.MwMMH.QUCr9KZnge8zIIJ1mVSm', 9547863214, '2020-05-10 03:43:17', '2020-05-10 03:43:17');
-- --------------------------------------------------------
--
-- Table structure for table `test_answers`
--
CREATE TABLE `test_answers` (
`id` bigint(20) UNSIGNED NOT NULL,
`student_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`test_type_id` bigint(20) UNSIGNED NOT NULL,
`question_id` bigint(20) UNSIGNED NOT NULL,
`option_id` bigint(20) UNSIGNED DEFAULT NULL,
`std_answer` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `test_answers`
--
INSERT INTO `test_answers` (`id`, `student_id`, `test_type_id`, `question_id`, `option_id`, `std_answer`, `created_at`, `updated_at`) VALUES
(1794, '160090107056', 1, 11, 11, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1795, '160090107056', 1, 12, 14, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1796, '160090107056', 1, 13, 15, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1797, '160090107056', 1, 14, 18, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1798, '160090107056', 1, 15, 19, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1799, '160090107056', 1, 16, 21, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1800, '160090107056', 1, 17, 23, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1801, '160090107056', 1, 18, 26, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1802, '160090107056', 1, 19, 27, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1803, '160090107056', 1, 20, 30, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1804, '160090107056', 1, 21, 31, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1805, '160090107056', 1, 22, 34, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1806, '160090107056', 1, 23, 36, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1807, '160090107056', 1, 24, 37, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1808, '160090107056', 1, 25, 39, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1809, '160090107056', 1, 26, 42, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1810, '160090107056', 1, 27, 44, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1811, '160090107056', 1, 28, 46, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1812, '160090107056', 1, 29, 47, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1813, '160090107056', 1, 30, 50, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1814, '160090107056', 1, 31, 51, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1815, '160090107056', 1, 32, 53, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1816, '160090107056', 1, 33, 56, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1817, '160090107056', 1, 34, 58, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1818, '160090107056', 1, 35, 60, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1819, '160090107056', 1, 36, 62, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1820, '160090107056', 1, 37, 63, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1821, '160090107056', 1, 38, 66, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1822, '160090107056', 1, 39, 68, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1823, '160090107056', 1, 40, 70, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1824, '160090107056', 1, 41, 71, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1825, '160090107056', 1, 42, 73, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1826, '160090107056', 1, 43, 75, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1827, '160090107056', 1, 44, 78, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1828, '160090107056', 1, 45, 80, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(1829, '160090107056', 1, 46, 81, NULL, '2020-06-11 06:29:05', '2020-06-11 06:29:05'),
(2005, '160090107056', 2, 310, NULL, 9, '2020-06-11 08:04:17', '2020-06-11 08:04:17'),
(2006, '160090107056', 2, 311, NULL, 7, '2020-06-11 08:04:17', '2020-06-11 08:04:17'),
(2007, '160090107056', 2, 312, NULL, 8, '2020-06-11 08:04:17', '2020-06-11 08:04:17'),
(2008, '160090107056', 2, 313, NULL, 6, '2020-06-11 08:04:17', '2020-06-11 08:04:17'),
(2009, '160090107056', 2, 314, NULL, 9, '2020-06-11 08:04:17', '2020-06-11 08:04:17'),
(2010, '160090107056', 2, 315, NULL, 9, '2020-06-11 08:04:17', '2020-06-11 08:04:17'),
(2011, '160090107056', 2, 316, NULL, 10, '2020-06-11 08:04:17', '2020-06-11 08:04:17'),
(2048, '160090107043', 1, 11, 12, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2049, '160090107043', 1, 12, 13, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2050, '160090107043', 1, 13, 16, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2051, '160090107043', 1, 14, 17, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2052, '160090107043', 1, 15, 20, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2053, '160090107043', 1, 16, 22, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2054, '160090107043', 1, 17, 23, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2055, '160090107043', 1, 18, 26, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2056, '160090107043', 1, 19, 27, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2057, '160090107043', 1, 20, 30, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2058, '160090107043', 1, 21, 31, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2059, '160090107043', 1, 22, 34, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2060, '160090107043', 1, 23, 36, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2061, '160090107043', 1, 24, 38, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2062, '160090107043', 1, 25, 39, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2063, '160090107043', 1, 26, 42, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2064, '160090107043', 1, 27, 44, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2065, '160090107043', 1, 28, 45, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2066, '160090107043', 1, 29, 47, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2067, '160090107043', 1, 30, 49, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2068, '160090107043', 1, 31, 51, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2069, '160090107043', 1, 32, 53, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2070, '160090107043', 1, 33, 55, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2071, '160090107043', 1, 34, 58, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2072, '160090107043', 1, 35, 60, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2073, '160090107043', 1, 36, 62, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2074, '160090107043', 1, 37, 63, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2075, '160090107043', 1, 38, 66, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2076, '160090107043', 1, 39, 67, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2077, '160090107043', 1, 40, 70, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2078, '160090107043', 1, 41, 71, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2079, '160090107043', 1, 42, 74, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2080, '160090107043', 1, 43, 76, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2081, '160090107043', 1, 44, 77, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2082, '160090107043', 1, 45, 79, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2083, '160090107043', 1, 46, 82, NULL, '2020-06-11 11:50:54', '2020-06-11 11:50:54'),
(2276, '160090107043', 2, 255, NULL, 9, '2020-06-11 13:18:20', '2020-06-11 13:18:20'),
(2277, '160090107043', 2, 257, NULL, 9, '2020-06-11 13:18:20', '2020-06-11 13:18:20'),
(2278, '160090107043', 2, 259, NULL, 7, '2020-06-11 13:18:20', '2020-06-11 13:18:20'),
(2279, '160090107043', 2, 261, NULL, 8, '2020-06-11 13:18:20', '2020-06-11 13:18:20'),
(2280, '160090107043', 2, 263, NULL, 8, '2020-06-11 13:18:20', '2020-06-11 13:18:20'),
(2281, '160090107043', 2, 265, NULL, 6, '2020-06-11 13:18:20', '2020-06-11 13:18:20'),
(2282, 'test1', 1, 11, 11, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2283, 'test1', 1, 12, 13, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2284, 'test1', 1, 13, 15, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2285, 'test1', 1, 14, 18, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2286, 'test1', 1, 15, 19, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2287, 'test1', 1, 16, 22, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2288, 'test1', 1, 17, 24, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2289, 'test1', 1, 18, 25, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2290, 'test1', 1, 19, 28, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2291, 'test1', 1, 20, 29, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2292, 'test1', 1, 21, 31, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2293, 'test1', 1, 22, 34, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2294, 'test1', 1, 23, 36, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2295, 'test1', 1, 24, 37, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2296, 'test1', 1, 25, 39, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2297, 'test1', 1, 26, 42, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2298, 'test1', 1, 27, 44, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2299, 'test1', 1, 28, 46, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2300, 'test1', 1, 29, 48, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2301, 'test1', 1, 30, 49, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2302, 'test1', 1, 31, 51, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2303, 'test1', 1, 32, 54, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2304, 'test1', 1, 33, 56, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2305, 'test1', 1, 34, 57, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2306, 'test1', 1, 35, 60, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2307, 'test1', 1, 36, 62, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2308, 'test1', 1, 37, 63, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2309, 'test1', 1, 38, 66, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2310, 'test1', 1, 39, 67, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2311, 'test1', 1, 40, 69, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2312, 'test1', 1, 41, 71, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2313, 'test1', 1, 42, 74, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2314, 'test1', 1, 43, 76, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2315, 'test1', 1, 44, 78, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2316, 'test1', 1, 45, 79, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2317, 'test1', 1, 46, 81, NULL, '2020-06-12 00:24:50', '2020-06-12 00:24:50'),
(2344, 'test1', 2, 107, NULL, 7, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2345, 'test1', 2, 110, NULL, 8, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2346, 'test1', 2, 113, NULL, 5, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2347, 'test1', 2, 116, NULL, 7, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2348, 'test1', 2, 119, NULL, 6, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2349, 'test1', 2, 122, NULL, 7, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2350, 'test1', 2, 125, NULL, 6, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2351, 'test1', 2, 79, NULL, 8, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2352, 'test1', 2, 81, NULL, 7, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2353, 'test1', 2, 83, NULL, 5, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2354, 'test1', 2, 85, NULL, 7, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2355, 'test1', 2, 87, NULL, 6, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2356, 'test1', 2, 89, NULL, 6, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(2357, '160090107002', 1, 11, 11, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2358, '160090107002', 1, 12, 14, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2359, '160090107002', 1, 13, 15, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2360, '160090107002', 1, 14, 18, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2361, '160090107002', 1, 15, 19, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2362, '160090107002', 1, 16, 22, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2363, '160090107002', 1, 17, 24, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2364, '160090107002', 1, 18, 25, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2365, '160090107002', 1, 19, 28, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2366, '160090107002', 1, 20, 30, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2367, '160090107002', 1, 21, 32, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2368, '160090107002', 1, 22, 34, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2369, '160090107002', 1, 23, 35, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2370, '160090107002', 1, 24, 38, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2371, '160090107002', 1, 25, 40, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2372, '160090107002', 1, 26, 42, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2373, '160090107002', 1, 27, 43, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2374, '160090107002', 1, 28, 46, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2375, '160090107002', 1, 29, 47, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2376, '160090107002', 1, 30, 49, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2377, '160090107002', 1, 31, 51, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2378, '160090107002', 1, 32, 53, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2379, '160090107002', 1, 33, 55, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2380, '160090107002', 1, 34, 57, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2381, '160090107002', 1, 35, 59, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2382, '160090107002', 1, 36, 61, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2383, '160090107002', 1, 37, 63, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2384, '160090107002', 1, 38, 65, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2385, '160090107002', 1, 39, 67, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2386, '160090107002', 1, 40, 69, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2387, '160090107002', 1, 41, 71, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2388, '160090107002', 1, 42, 74, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2389, '160090107002', 1, 43, 76, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2390, '160090107002', 1, 44, 77, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2391, '160090107002', 1, 45, 79, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00'),
(2392, '160090107002', 1, 46, 82, NULL, '2020-06-12 02:06:00', '2020-06-12 02:06:00');
-- --------------------------------------------------------
--
-- Table structure for table `test_results`
--
CREATE TABLE `test_results` (
`test_result_id` bigint(20) UNSIGNED NOT NULL,
`student_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`test_type_id` bigint(20) UNSIGNED NOT NULL,
`score` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`date` date DEFAULT NULL,
`careerfield_id` bigint(20) UNSIGNED 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 `test_results`
--
INSERT INTO `test_results` (`test_result_id`, `student_id`, `test_type_id`, `score`, `date`, `careerfield_id`, `created_at`, `updated_at`) VALUES
(35, '160090107056', 2, '41', NULL, 20, '2020-06-11 08:04:17', '2020-06-11 08:04:17'),
(68, '160090107043', 2, '39', NULL, 27, '2020-06-11 13:18:20', '2020-06-11 13:18:20'),
(73, 'test1', 2, '32', NULL, 3, '2020-06-12 00:33:04', '2020-06-12 00:33:04'),
(74, 'test1', 2, '32', NULL, 5, '2020-06-12 00:33:04', '2020-06-12 00:33:04');
-- --------------------------------------------------------
--
-- Table structure for table `test_types`
--
CREATE TABLE `test_types` (
`test_type_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`discription` 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 `test_types`
--
INSERT INTO `test_types` (`test_type_id`, `name`, `discription`, `created_at`, `updated_at`) VALUES
(1, 'Personality Test', '', '2020-03-18 17:24:27', '2020-03-18 17:24:27'),
(2, 'Skill Test', '', '2020-03-18 17:24:27', '2020-03-18 17:24:27');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
ADD PRIMARY KEY (`admin_id`),
ADD UNIQUE KEY `admins_admin_id_unique` (`admin_id`),
ADD UNIQUE KEY `admins_email_unique` (`email`);
--
-- Indexes for table `careerfields`
--
ALTER TABLE `careerfields`
ADD PRIMARY KEY (`careerfield_id`),
ADD KEY `careerfields_stream_id_foreign` (`stream_id`);
--
-- Indexes for table `classes`
--
ALTER TABLE `classes`
ADD PRIMARY KEY (`classes_id`),
ADD KEY `classes_stream_id_foreign` (`stream_id`);
--
-- Indexes for table `classrooms`
--
ALTER TABLE `classrooms`
ADD PRIMARY KEY (`classroom_id`),
ADD KEY `classrooms_classes_id_foreign` (`classes_id`);
--
-- Indexes for table `classroom_students`
--
ALTER TABLE `classroom_students`
ADD PRIMARY KEY (`id`),
ADD KEY `classroom_students_student_id_foreign` (`student_id`),
ADD KEY `classroom_students_classroom_id_foreign` (`classroom_id`),
ADD KEY `classroom_students_teacher_id_foreign` (`teacher_id`);
--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `final_career`
--
ALTER TABLE `final_career`
ADD PRIMARY KEY (`id`),
ADD KEY `final_career_personality_type_id_foreign` (`personality_type_id`),
ADD KEY `final_career_student_id_foreign` (`student_id`),
ADD KEY `final_career_careerfield_id_foreign` (`careerfield_id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `parents`
--
ALTER TABLE `parents`
ADD PRIMARY KEY (`parent_id`),
ADD UNIQUE KEY `parents_parent_id_unique` (`parent_id`),
ADD UNIQUE KEY `parents_email_unique` (`email`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `personality_careerfields`
--
ALTER TABLE `personality_careerfields`
ADD PRIMARY KEY (`id`),
ADD KEY `personality_careerfields_personality_type_id_foreign` (`personality_type_id`),
ADD KEY `personality_careerfields_careerfield_id_foreign` (`careerfield_id`);
--
-- Indexes for table `personality_types`
--
ALTER TABLE `personality_types`
ADD PRIMARY KEY (`personality_type_id`);
--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
ADD PRIMARY KEY (`id`),
ADD KEY `questions_test_type_id_foreign` (`test_type_id`),
ADD KEY `questions_careerfield_id_foreign` (`careerfield_id`);
--
-- Indexes for table `question_options`
--
ALTER TABLE `question_options`
ADD PRIMARY KEY (`id`),
ADD KEY `question_options_question_id_foreign` (`question_id`),
ADD KEY `question_options_personality_type_id_foreign` (`personality_type_id`);
--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
ADD UNIQUE KEY `sessions_id_unique` (`id`);
--
-- Indexes for table `streams`
--
ALTER TABLE `streams`
ADD PRIMARY KEY (`stream_id`);
--
-- Indexes for table `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`student_id`),
ADD UNIQUE KEY `students_student_id_unique` (`student_id`),
ADD UNIQUE KEY `students_email_unique` (`email`),
ADD KEY `students_parent_id_foreign` (`parent_id`);
--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
ADD PRIMARY KEY (`subject_id`),
ADD KEY `subjects_classes_id_foreign` (`classes_id`);
--
-- Indexes for table `subject_careerfields`
--
ALTER TABLE `subject_careerfields`
ADD PRIMARY KEY (`id`),
ADD KEY `subject_careerfields_subject_id_foreign` (`subject_id`),
ADD KEY `subject_careerfields_careerfield_id_foreign` (`careerfield_id`);
--
-- Indexes for table `subject_results`
--
ALTER TABLE `subject_results`
ADD PRIMARY KEY (`id`),
ADD KEY `subject_results_subject_id_foreign` (`subject_id`),
ADD KEY `subject_results_student_id_foreign` (`student_id`);
--
-- Indexes for table `teachers`
--
ALTER TABLE `teachers`
ADD PRIMARY KEY (`teacher_id`),
ADD UNIQUE KEY `teachers_teacher_id_unique` (`teacher_id`),
ADD UNIQUE KEY `teachers_email_unique` (`email`);
--
-- Indexes for table `test_answers`
--
ALTER TABLE `test_answers`
ADD PRIMARY KEY (`id`),
ADD KEY `test_answers_test_type_id_foreign` (`test_type_id`),
ADD KEY `test_answers_student_id_foreign` (`student_id`),
ADD KEY `test_answers_question_id_foreign` (`question_id`),
ADD KEY `test_answers_option_id_foreign` (`option_id`);
--
-- Indexes for table `test_results`
--
ALTER TABLE `test_results`
ADD PRIMARY KEY (`test_result_id`),
ADD KEY `test_results_test_type_id_foreign` (`test_type_id`),
ADD KEY `test_results_student_id_foreign` (`student_id`),
ADD KEY `test_results_careerfield_id_foreign` (`careerfield_id`);
--
-- Indexes for table `test_types`
--
ALTER TABLE `test_types`
ADD PRIMARY KEY (`test_type_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `careerfields`
--
ALTER TABLE `careerfields`
MODIFY `careerfield_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=73;
--
-- AUTO_INCREMENT for table `classes`
--
ALTER TABLE `classes`
MODIFY `classes_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `classrooms`
--
ALTER TABLE `classrooms`
MODIFY `classroom_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `classroom_students`
--
ALTER TABLE `classroom_students`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `final_career`
--
ALTER TABLE `final_career`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
--
-- AUTO_INCREMENT for table `personality_careerfields`
--
ALTER TABLE `personality_careerfields`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=110;
--
-- AUTO_INCREMENT for table `personality_types`
--
ALTER TABLE `personality_types`
MODIFY `personality_type_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=317;
--
-- AUTO_INCREMENT for table `question_options`
--
ALTER TABLE `question_options`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=83;
--
-- AUTO_INCREMENT for table `streams`
--
ALTER TABLE `streams`
MODIFY `stream_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `subjects`
--
ALTER TABLE `subjects`
MODIFY `subject_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59;
--
-- AUTO_INCREMENT for table `subject_careerfields`
--
ALTER TABLE `subject_careerfields`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=77;
--
-- AUTO_INCREMENT for table `subject_results`
--
ALTER TABLE `subject_results`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=66;
--
-- AUTO_INCREMENT for table `test_answers`
--
ALTER TABLE `test_answers`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2393;
--
-- AUTO_INCREMENT for table `test_results`
--
ALTER TABLE `test_results`
MODIFY `test_result_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=75;
--
-- AUTO_INCREMENT for table `test_types`
--
ALTER TABLE `test_types`
MODIFY `test_type_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `careerfields`
--
ALTER TABLE `careerfields`
ADD CONSTRAINT `careerfields_stream_id_foreign` FOREIGN KEY (`stream_id`) REFERENCES `streams` (`stream_id`);
--
-- Constraints for table `classes`
--
ALTER TABLE `classes`
ADD CONSTRAINT `classes_stream_id_foreign` FOREIGN KEY (`stream_id`) REFERENCES `streams` (`stream_id`);
--
-- Constraints for table `classrooms`
--
ALTER TABLE `classrooms`
ADD CONSTRAINT `classrooms_classes_id_foreign` FOREIGN KEY (`classes_id`) REFERENCES `classes` (`classes_id`);
--
-- Constraints for table `classroom_students`
--
ALTER TABLE `classroom_students`
ADD CONSTRAINT `classroom_students_classroom_id_foreign` FOREIGN KEY (`classroom_id`) REFERENCES `classrooms` (`classroom_id`),
ADD CONSTRAINT `classroom_students_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
ADD CONSTRAINT `classroom_students_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`) ON UPDATE CASCADE;
--
-- Constraints for table `final_career`
--
ALTER TABLE `final_career`
ADD CONSTRAINT `final_career_careerfield_id_foreign` FOREIGN KEY (`careerfield_id`) REFERENCES `careerfields` (`careerfield_id`),
ADD CONSTRAINT `final_career_personality_type_id_foreign` FOREIGN KEY (`personality_type_id`) REFERENCES `personality_types` (`personality_type_id`),
ADD CONSTRAINT `final_career_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);
--
-- Constraints for table `personality_careerfields`
--
ALTER TABLE `personality_careerfields`
ADD CONSTRAINT `personality_careerfields_careerfield_id_foreign` FOREIGN KEY (`careerfield_id`) REFERENCES `careerfields` (`careerfield_id`),
ADD CONSTRAINT `personality_careerfields_personality_type_id_foreign` FOREIGN KEY (`personality_type_id`) REFERENCES `personality_types` (`personality_type_id`);
--
-- Constraints for table `questions`
--
ALTER TABLE `questions`
ADD CONSTRAINT `questions_careerfield_id_foreign` FOREIGN KEY (`careerfield_id`) REFERENCES `careerfields` (`careerfield_id`),
ADD CONSTRAINT `questions_test_type_id_foreign` FOREIGN KEY (`test_type_id`) REFERENCES `test_types` (`test_type_id`);
--
-- Constraints for table `question_options`
--
ALTER TABLE `question_options`
ADD CONSTRAINT `question_options_personality_type_id_foreign` FOREIGN KEY (`personality_type_id`) REFERENCES `personality_types` (`personality_type_id`),
ADD CONSTRAINT `question_options_question_id_foreign` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`);
--
-- Constraints for table `students`
--
ALTER TABLE `students`
ADD CONSTRAINT `students_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `parents` (`parent_id`) ON UPDATE CASCADE;
--
-- Constraints for table `subjects`
--
ALTER TABLE `subjects`
ADD CONSTRAINT `subjects_classes_id_foreign` FOREIGN KEY (`classes_id`) REFERENCES `classes` (`classes_id`);
--
-- Constraints for table `subject_careerfields`
--
ALTER TABLE `subject_careerfields`
ADD CONSTRAINT `subject_careerfields_careerfield_id_foreign` FOREIGN KEY (`careerfield_id`) REFERENCES `careerfields` (`careerfield_id`),
ADD CONSTRAINT `subject_careerfields_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`subject_id`);
--
-- Constraints for table `subject_results`
--
ALTER TABLE `subject_results`
ADD CONSTRAINT `subject_results_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
ADD CONSTRAINT `subject_results_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`subject_id`);
--
-- Constraints for table `test_answers`
--
ALTER TABLE `test_answers`
ADD CONSTRAINT `test_answers_option_id_foreign` FOREIGN KEY (`option_id`) REFERENCES `question_options` (`id`),
ADD CONSTRAINT `test_answers_question_id_foreign` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`),
ADD CONSTRAINT `test_answers_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
ADD CONSTRAINT `test_answers_test_type_id_foreign` FOREIGN KEY (`test_type_id`) REFERENCES `test_types` (`test_type_id`);
--
-- Constraints for table `test_results`
--
ALTER TABLE `test_results`
ADD CONSTRAINT `test_results_careerfield_id_foreign` FOREIGN KEY (`careerfield_id`) REFERENCES `careerfields` (`careerfield_id`),
ADD CONSTRAINT `test_results_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
ADD CONSTRAINT `test_results_test_type_id_foreign` FOREIGN KEY (`test_type_id`) REFERENCES `test_types` (`test_type_id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
d49ab0d466dfa002535fa1b8c0e4e21c81e1f265 | SQL | conan513/spp-legion-patch | /Website/install/SQL/fx_slides.sql | UTF-8 | 1,199 | 3.109375 | 3 | [
"MIT"
] | permissive | /*
SQLyog Ultimate v11.11 (64 bit)
MySQL - 5.5.5-10.1.29-MariaDB : Database - blizzcms
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_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 `fx_slides` */
DROP TABLE IF EXISTS `fx_slides`;
CREATE TABLE `fx_slides` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`title` varchar(100) DEFAULT NULL,
`image` varchar(100) NOT NULL DEFAULT 'image.jpg' COMMENT 'assets/images/slides',
`mobile_image` varchar(100) DEFAULT 'imagemobile.jpg' COMMENT 'assets/images/slides',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*Data for the table `fx_slides` */
insert into `fx_slides`(`id`,`title`,`image`,`mobile_image`) values (1,'BlizzCMS','slide1.jpg','slide1_mobile.jpg'),(2,'Constant updates!','slide2.jpg','slide2_mobile.jpg');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
| true |
1b7c94e4ecbcfc9b74aca09a4c1527925fdfad5c | SQL | CUBRID/cubrid-testcases | /medium/_02_xtests/cases/group8.sql | UTF-8 | 172 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | autocommit off;
select product_code, avg(price) * avg(quantity)
from joe.inventory_v s
group by product_code
having avg(price) * avg(quantity) > $500000;
rollback;
| true |
1523aee57d615d1e63de25bdb843d0ed9d373879 | SQL | MattConrad/cross-platform-sql-tricks-presentation | /app/sqlfiddle_setup.sql | UTF-8 | 999 | 3.28125 | 3 | [] | no_license | /*
This is a script for setting up all the tables used in the presentation.
You can run this on sqlfiddle.com against the MS SQL Server 2008 db engine and all your tables will be ready to go.
Unfortunately, there doesn't appear to be a way to set up the tables in successive steps the way the presentation does. It's all at once or nothing.
*/
create table test_a
(Id int NOT NULL,
Value varchar(100) NOT NULL);
insert into test_a (Id, Value) values (1, 'a');
insert into test_a (Id, Value) values (2, 'b');
insert into test_a (Id, Value) values (3, 'c');
insert into test_a (Id, Value) values (4, 'd');
create table test_b
(Id int NOT NULL,
Value varchar(100) NOT NULL);
insert into test_b
(Id, Value)
select Id, Value
from test_a;
insert into test_b
(Id, Value)
select Id + 10, Value + cast(Id as varchar)
from test_a
where Id > 2;
select *
into test_c
from test_a;
select number as n
into ints
from master..spt_values
where name is null and number >= 1 and number <=100
| true |
8b4bc11cac1e5a1b5ab94cd6699b8f4890fc5055 | SQL | ThanitsornMsr/Querying-with-Transact-SQL-course | /Labs/Lab03.sql | UTF-8 | 2,854 | 4.65625 | 5 | [] | no_license | -- Challenge 1: Generate Invoice Reports
/*As an initial step towards generating the invoice report, write a query that returns the company name
from the SalesLT.Customer table, and the sales order ID and total due from the
SalesLT.SalesOrderHeader table*/
select c.CompanyName, oh.SalesOrderID, oh.TotalDue
from SalesLT.Customer as c
join SalesLT.SalesOrderHeader as oh
on c.CustomerID = oh.CustomerID
/*Extend your customer orders query to include the Main Office address for each customer, including the
full street address, city, state or province, postal code, and country or region*/
select a.AddressLine1+ISNULL(a.Addressline2,'') as FullStreetAddress, a.City, a.StateProvince, a.CountryRegion, a.PostalCode
from SalesLT.Customer as c
join SalesLT.CustomerAddress as ca
on c.CustomerID = ca.CustomerID
join SalesLT.Address as a
on ca.AddressID = a.AddressID
where ca.AddressType = 'Main Office'
--Challenge 2: Retrieve Sales Data
/*The sales manager wants a list of all customer companies and their contacts (first name and last name),
showing the sales order ID and total due for each order they have placed. Customers who have not
placed any orders should be included at the bottom of the list with NULL values for the order ID and
total due.*/
select c.FirstName, c.LastName, oh.SalesOrderID, oh.TotalDue
from SalesLT.Customer as c
left join SalesLT.SalesOrderHeader as oh
on c.CustomerID = oh.CustomerID
order by oh.TotalDue desc
/*A sales employee has noticed that Adventure Works does not have address information for all
customers. You must write a query that returns a list of customer IDs, company names, contact names
(first name and last name), and phone numbers for customers with no address stored in the database.*/
select c.CustomerID, c.CompanyName, c.FirstName+''+c.LastName as ContactName, c.Phone
from SalesLT.Customer as c
left join SalesLT.CustomerAddress as ca
on c.CustomerID = ca.CustomerID
left join SalesLT.Address as a
on ca.AddressID = a.AddressID
where a.AddressID is null
/*Some customers have never placed orders, and some products have never been ordered. Create a query
that returns a column of customer IDs for customers who have never placed an order, and a column of
product IDs for products that have never been ordered. Each row with a customer ID should have a
NULL product ID (because the customer has never ordered a product) and each row with a product ID
should have a NULL customer ID (because the product has never been ordered by a customer)*/
select c.CustomerID, p.ProductID
from SalesLT.Customer as c
left join SalesLT.SalesOrderHeader as oh
on c.CustomerID = oh.CustomerID
left join SalesLT.SalesOrderDetail as od
on oh.SalesOrderID = od.SalesOrderID
full join SalesLT.Product as p
on od.ProductID = p.ProductID
order by c.CustomerID
| true |
ab2687e2d778388ed669df98670072b0aca5f9bf | SQL | smk86131/DB | /팀프로젝트/로컬-sqlDB.sql | UTF-8 | 228 | 2.546875 | 3 | [] | no_license |
create table cartoon
(
cartoonid varchar2(4 byte) not null primary key,
cartoonname varchar2(30 byte),
cartoondescription varchar2(40 byte)
);
select * from cartoon;
select * from cartoon where cartoonid = 'c001';
| true |
0008e8f1c8614d9adeffd6062f264162605dd1e8 | SQL | alejandrocalderonhernandez/spring-boot-kotlin | /sql/create_schema.sql | UTF-8 | 541 | 3.796875 | 4 | [] | no_license | -- table company
create table if not exists company(
id serial primary key,
"name" varchar(32) not null unique,
founder varchar(128),
logo varchar(255),
foundation_date date
);
-- index for name
create index name_company
on company("name");
-- table web site
create table if not exists web_site(
id serial primary key,
id_company bigint,
"name" varchar(32) not null unique,
category varchar(32) not null,
description text,
constraint fk_company
foreign key(id_company)
references company(id)
on delete cascade
); | true |
648b75e2fd157a63709263a8469b93feada7d14c | SQL | edimaudo/SQL | /retail.sql | UTF-8 | 9,518 | 3.25 | 3 | [] | no_license | CREATE TABLE staff (
st_ID int NOT NULL,
st_FName varchar(60) NOT NULL,
st_LName varchar(60) NOT NULL,
st_AddrLine1 varchar(30) NOT NULL,
st_AddrLine2 varchar(30) NOT NULL,
st_City varchar(25) NOT NULL,
st_Postcode varchar(7) NOT NULL,
st_Email varchar(30),
st_Telephone varchar(11),
PRIMARY KEY (st_ID)
);
CREATE TABLE location (
l_ID int NOT NULL,
l_Name varchar(40) NOT NULL,
l_AddrLine1 varchar(30) NOT NULL,
l_AddrLine2 varchar(30) NOT NULL,
l_City varchar(25) NOT NULL,
l_Postcode varchar(7) NOT NULL,
PRIMARY KEY (l_ID)
);
CREATE TABLE product (
p_ID int NOT NULL,
p_Name varchar(30) NOT NULL,
p_Team varchar(20) NOT NULL,
p_Year int NOT NULL,
p_Version varchar(10) NOT NULL,
p_Desc varchar(90) NOT NULL,
p_Player varchar(25),
p_Brand varchar(15),
p_UnitPrice DECIMAL(3,2) NOT NULL,
PRIMARY KEY (p_ID)
);
CREATE TABLE time_t (
t_ID int NOT NULL,
t_Day varchar(11) NOT NULL,
t_Week int NOT NULL,
t_Month varchar(14) NOT NULL,
t_Year int NOT NULL,
t_Hour int NOT NULL,
t_Min int NOT NULL,
t_Second int NOT NULL,
t_Quarter varchar(2) NOT NULL,
PRIMARY KEY (t_ID)
);
CREATE TABLE payment (
pm_ID int NOT NULL,
pm_Type varchar(10),
PRIMARY KEY (pm_ID)
);
CREATE TABLE sales (
s_ID int NOT NULL PRIMARY KEY,
s_t_ID int NOT NULL //time key
s_l_ID int NOT NULL //location key
s_p_ID int NOT NULL //product key
s_st_ID int NOT NULL //staff key
s_Total DECIMAL(5,2) NOT NULL,
s_pm_ID int NOT NULL,
PRIMARY KEY (s_ID),
CONSTRAINT time_fk FOREIGN KEY (s_t_ID) REFERENCES time_t(t_ID),
CONSTRAINT location_fk FOREIGN KEY (s_l_ID) REFERENCES location(l_ID),
CONSTRAINT product_fk CONSTRAINT time_fk FOREIGN KEY (s_p_ID) REFERENCES product(p_ID),
CONSTRAINT staff_fk FOREIGN KEY (s_st_ID) REFERENCES staff(st_ID),
CONSTRAINT payment_fk FOREIGN KEY (s_pm_ID) REFERENCES payment(pm_ID)
);
//data
//LOCATION
INSERT INTO location (l_Name,l_AddrLine1,l_AddrLine2,l_City,l_Postcode)
VALUES ('El Classico Hackney', '4, Kingsland High St', 'Hackney', 'London', 'E8 1DJ');
INSERT INTO location (l_Name,l_AddrLine1,l_AddrLine2,l_City,l_Postcode)
VALUES ('El Classico Covent Garden', '11, Tavistock St', 'Covent Garden', 'London', 'WC2 8PT');
INSERT INTO location (l_Name,l_AddrLine1,l_AddrLine2,l_City,l_Postcode)
VALUES ('El Classico Hammersmith', '92, Goldhawk Rd', 'Hammersmith', 'London', 'W12 8HH');
INSERT INTO location (l_Name,l_AddrLine1,l_AddrLine2,l_City,l_Postcode) VALUES ('El Classico Enfield', '8, Church St', 'Enfield', 'London', 'EN2 6AA');
INSERT INTO location (l_Name,l_AddrLine1,l_AddrLine2,l_City,l_Postcode)
VALUES ('El Classico Greenwich', '22, Trafalgar Road', 'Greenwich', 'London', 'SE9 9UW');
//PAYMENT
INSERT INTO payment (pm_Type) VALUES ('Cash'); INSERT INTO payment (pm_Type) VALUES ('Card'); INSERT INTO payment (pm_Type) VALUES ('Voucher');
//STAFF
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Thierry', 'Henry', '154, St. Thomas Road', 'Highbury', 'London', 'N4 2QP', 'kinghenry@gmail.com','07864364532');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Dennis', 'Bergkamp', '65, Gillespie Road', 'Highbury', 'London', 'N5 1HL', 'bergkamp@gmail.com','07936483748');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Paolo', 'Maldini', '1, Allen Street', 'Kensington', 'London', 'W8 6UX', 'p.maldini@gmail.com','07473647369');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Alessandro', 'Nesta', '184, Kensington High Street', 'Kensington', 'London', 'W8 6SH', 'alexnesta@gmail.com','07293850946');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Xavi', 'Hernandez', '220, City Road', 'Shoreditch', 'London', 'EC1 2NR', 'xavi4@gmail.com','07385983844');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Carles', 'Puyol', '56, City Road', 'Shoreditch', 'London', 'EC1 1BD', 'c.puyol@gmail.com','07904111242');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Oliver', 'Kahn', '235, Regent Street', 'Mayfair', 'London', 'W1B 2EL', 'oliverkahn@gmail.com','07748392835');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Mark', 'van Bommel', '318, Oxford Street', 'Mayfair', 'London', 'W1C 1HF', 'vanbommel@gmail.com','07819374937');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Zinedine', 'Zidane', '11, Queensway', 'Hyde Park', 'London', 'W2 3RR', 'zizou@gmail.com','07856473999');
INSERT INTO staff (st_FName, st_LName,st_AddrLine1,st_AddrLine2,st_City,st_Postcode,st_Email,st_Telephone)
VALUES ('Claude', 'Makelele', '33, Sussex Street', 'Hyde Park', 'London', 'W2 2TH', 'makelele@gmail.com','07748930284');
//PRODUCT
INSERT INTO `product` (`p_ID`, `p_Name`, `p_Team`, `p_Year`, `p_Version`, `p_Desc`, `p_Player`, `p_Brand`, `p_UnitPrice`)
VALUES (1,'Barcelona 10/11','FC Barcelona',2010,'Home','Worn by the Barcelona team that won every title in the 2010/11 season','','Nike',200.00),
(2,'Zidane - UEFA CL Final 2002','Real Madrid CF',2002,'Home','Worn by Zinedine Zidane in the 2002 Champions League Final against Bayer Leverkusen','ZIDANE','Adidas',250.00),
(3,'Ronaldo - World Cup 2002','Brazil',2002,'Home','Worn by Ronaldo during the 2002 World Cup Finals','RONALDO','NIKE',250.00),
(4,'Arsenal 2003/04','Arsenal FC',2004,'Home','Worn by the Arsenal team in 2004 who went unbeaten in the league','','NIKE',200.00),
(5,'Ronaldinho - UEFA CL R16 2005','FC Barcelona',2005,'Away','Worn by Ronaldinho in match against Chelsea at Stamford Bridge','RONALDINHO','NIKE',250.00),
(6,'Manchester United - 1998/99','Manchester United FC',1999,'Home','Worn by Manchester United team that won the treble in 1999','','NIKE',200.00),
(10,'Wayne Rooney -UEFA CL Grp 2004','Manchester United FC',2004,'Home','Worn by Rooney on his debut for Man United vs. Fenerbahce','ROONEY','NIKE',250.00),
(11,'Chelsea 2004/05','Chelsea FC',2005,'Home','Worn by Chelsea that won first league title in 50 years',NULL,'UMBRO',200.00),
(17,'A. Iniesta - UEFA CL SF 2009','FC Barcelona',2009,'Away','Worn by Iniesta who scored last minute winner at Chelsea','INIESTA','NIKE',250.00),
(18,'Roberto Carlos - TDF 1997','Brazil',1997,'Home','Worn by Roberto Carlos who scored an amazing free kick vs France','R. CARLOS','NIKE',250.00),
(19,'S. Tshabalala World Cup 2010','South Africa',2010,'Home','Worn by Tshabalala who scored an amazing goal for South Africa','TSHABALALA','ADIDAS',250.00),
(20,'Liverpool 2004/05','Liverpool FC',2005,'Home','Worn by Liverpool team who made historic CL comeback vs Milan',NULL,'REEBOK',200.00),
(21,'Porto 2003/04','FC Porto',2004,'Home','Worn by Porto team who eliminated Man United at Old Trafford',NULL,'NIKE',200.00),
(22,'Zidane - World Cup 1998','France',1998,'Home','Worn by Zidane who scored two goals to beat Brazil in the final','ZIDANE','ADIDAS',250.00),
(23,'Michael Owen - World Cup 1998','England',1998,'Home','Worn by a young Owen who scored a great goal vs Argentina','OWEN','UMBRO',250.00);
(23,'Michael Owen - World Cup 1998','England',1998,'Home','Worn by a young Owen who scored a great goal vs Argentina','OWEN','UMBRO',250.00);
//TIME
INSERT INTO `time_t` (`t_ID`, `t_Day`, `t_Week`, `t_Month`, `t_Year`, `t_Hour`, `t_Min`, `t_Second`, `t_Quarter`, `t_DayM`)
VALUES (1,'Monday',1,'January',2015,15,10,42,'Q1',1), (2,'Monday',1,'January',2015,16,23,15,'Q1',1),
(3,'Monday',1,'January',2015,15,38,4,'Q1',1),
(4,'Monday',1,'January',2015,17,20,57,'Q1',1),
(5,'Monday',1,'January',2015,12,56,26,'Q1',1),
(6,'Monday',1,'January',2015,10,8,8,'Q1',1),
(7,'Monday',1,'January',2015,13,42,58,'Q1',1),
(8,'Monday',1,'January',2015,10,13,40,'Q1',2),
(9,'Monday',1,'January',2015,14,39,36,'Q1',2),
(10,'Monday',1,'January',2015,17,46,33,'Q1',2),
(11,'Tuesday',1,'January',2015,12,37,6,'Q1',2),
(12,'Tuesday',1,'January',2015,11,2,28,'Q1',2),
(13,'Tuesday',1,'January',2015,10,6,15,'Q1',2),
(14,'Tuesday',2,'January',2015,15,14,22,'Q1',2),
(15,'Tuesday',2,'January',2015,10,51,42,'Q1',3),
(16,'Tuesday',2,'January',2015,11,43,35,'Q1',3),
(17,'Tuesday',2,'January',2015,11,38,25,'Q1',3),
(18,'Tuesday',2,'January',2015,15,35,58,'Q1',3),
(19,'Tuesday',2,'January',2015,14,13,19,'Q1',3),
(20,'Tuesday',2,'January',2015,17,29,15,'Q1',3),
(21,'Wednesday',2,'January',2015,12,2,6,'Q1',3),
(22,'Wednesday',2,'January',2015,12,6,49,'Q1',4),
(23,'Wednesday',2,'January',2015,13,6,38,'Q1',4),
(24,'Wednesday',2,'January',2015,17,29,0,'Q1',4),
(25,'Wednesday',2,'January',2015,14,43,29,'Q1',4),
(26,'Wednesday',2,'January',2015,11,18,6,'Q1',4);
//SALES
INSERT INTO `sales` (`s_ID`, `t_ID`, `l_ID`, `p_ID`, `st_ID`, `s_Total`, `pm_ID`) VALUES (1,1,2,23,8,200.00,1),
(2,2,1,18,2,250.00,2),
(3,3,5,19,8,250.00,2),
(4,4,3,18,5,200.00,2),
(5,5,1,20,6,250.00,2), (6,6,1,22,5,200.00,1),
(7,7,2,4,7,200.00,2), (8,8,1,5,7,200.00,1), (9,9,2,22,7,250.00,2),
(10,10,1,11,3,250.00,1), (11,11,5,3,1,250.00,1), (12,12,2,20,1,200.00,1),
(13,13,2,1,2,200.00,1), (14,14,2,2,9,200.00,2), (15,15,3,4,4,250.00,1),
(16,16,3,4,1,200.00,2), (17,17,3,22,10,200.00,1), (18,18,3,18,4,200.00,1),
(19,19,3,4,5,200.00,1), (20,20,5,19,6,250.00,1), (21,21,1,20,2,250.00,2),
(22,22,1,2,9,250.00,1), (23,23,5,20,3,200.00,2), (24,24,4,17,4,200.00,1),
(25,25,4,22,4,250.00,2), (26,26,1,23,10,200.00,1);
| true |
25d26aede8f456539afef05b8ac5f1373fbbfb7c | SQL | HPeteL/SQL---Training | /SQL Functions.sql | UTF-8 | 374 | 3.578125 | 4 | [] | no_license | # Counting
SELECT * FROM employee;
SELECT COUNT(emp_id)
FROM employee;
SELECT COUNT(emp_id)
FROM employee
WHERE birt >'1971-01-01';
SELECT AVG(salary)
FROM employee;
SELECT SUM(salary)
FROM employee;
# Aggregration function
SELECT COUNT(sex),sex
FROM employee
GROUP BY sex;
# WILDCARDS % any number _ one characters
SELECT *
FROM client
WHERE client_name LIKE('%LLC'); | true |
97233688a16966d625ab2a78b7ed445135c46173 | SQL | gordon-cs/CPS350UpdatedCheckerApp | /CheckerApplication-master/CheckerSystem/SQLqueries/SqlQuery_Events.sql | UTF-8 | 178 | 3.171875 | 3 | [] | no_license | select sEventID, sTitle, dtStart, dtEnd
from Attendum.dbo.Events
where abs( datediff(day, dtStart, dtEnd) ) <= (31 * 1)
and dtStart >= getdate() -7
order by dtStart | true |
347f8b54f234543ce4639bde89a1b9cbbc3f5ccb | SQL | Jhorgen/employee_tracker | /database_backup.sql | UTF-8 | 21,399 | 3.046875 | 3 | [] | no_license | --
-- PostgreSQL database dump
--
-- Dumped from database version 10.5
-- Dumped by pg_dump version 10.5
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 client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: Guest
--
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE public.ar_internal_metadata OWNER TO "Guest";
--
-- Name: divisions; Type: TABLE; Schema: public; Owner: Guest
--
CREATE TABLE public.divisions (
id bigint NOT NULL,
name character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE public.divisions OWNER TO "Guest";
--
-- Name: divisions_id_seq; Type: SEQUENCE; Schema: public; Owner: Guest
--
CREATE SEQUENCE public.divisions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.divisions_id_seq OWNER TO "Guest";
--
-- Name: divisions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: Guest
--
ALTER SEQUENCE public.divisions_id_seq OWNED BY public.divisions.id;
--
-- Name: employee_projects; Type: TABLE; Schema: public; Owner: Guest
--
CREATE TABLE public.employee_projects (
id bigint NOT NULL,
employee_id bigint,
project_id bigint,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE public.employee_projects OWNER TO "Guest";
--
-- Name: employee_projects_id_seq; Type: SEQUENCE; Schema: public; Owner: Guest
--
CREATE SEQUENCE public.employee_projects_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.employee_projects_id_seq OWNER TO "Guest";
--
-- Name: employee_projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: Guest
--
ALTER SEQUENCE public.employee_projects_id_seq OWNED BY public.employee_projects.id;
--
-- Name: employees; Type: TABLE; Schema: public; Owner: Guest
--
CREATE TABLE public.employees (
id bigint NOT NULL,
name character varying,
division_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE public.employees OWNER TO "Guest";
--
-- Name: employees_id_seq; Type: SEQUENCE; Schema: public; Owner: Guest
--
CREATE SEQUENCE public.employees_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.employees_id_seq OWNER TO "Guest";
--
-- Name: employees_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: Guest
--
ALTER SEQUENCE public.employees_id_seq OWNED BY public.employees.id;
--
-- Name: projects; Type: TABLE; Schema: public; Owner: Guest
--
CREATE TABLE public.projects (
id bigint NOT NULL,
name character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE public.projects OWNER TO "Guest";
--
-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: Guest
--
CREATE SEQUENCE public.projects_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.projects_id_seq OWNER TO "Guest";
--
-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: Guest
--
ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id;
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: Guest
--
CREATE TABLE public.schema_migrations (
version character varying NOT NULL
);
ALTER TABLE public.schema_migrations OWNER TO "Guest";
--
-- Name: divisions id; Type: DEFAULT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.divisions ALTER COLUMN id SET DEFAULT nextval('public.divisions_id_seq'::regclass);
--
-- Name: employee_projects id; Type: DEFAULT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.employee_projects ALTER COLUMN id SET DEFAULT nextval('public.employee_projects_id_seq'::regclass);
--
-- Name: employees id; Type: DEFAULT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.employees ALTER COLUMN id SET DEFAULT nextval('public.employees_id_seq'::regclass);
--
-- Name: projects id; Type: DEFAULT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass);
--
-- Data for Name: ar_internal_metadata; Type: TABLE DATA; Schema: public; Owner: Guest
--
COPY public.ar_internal_metadata (key, value, created_at, updated_at) FROM stdin;
environment development 2019-08-07 20:30:52.751255 2019-08-07 20:30:52.751255
\.
--
-- Data for Name: divisions; Type: TABLE DATA; Schema: public; Owner: Guest
--
COPY public.divisions (id, name, created_at, updated_at) FROM stdin;
2 Construction 2019-08-07 23:31:30.782235 2019-08-07 23:31:30.782235
3 Retail 2019-08-07 23:31:30.830684 2019-08-07 23:31:30.830684
4 Advertising 2019-08-07 23:31:30.846257 2019-08-07 23:31:30.846257
5 Manufacturing 2019-08-07 23:31:30.861054 2019-08-07 23:31:30.861054
6 Sales 2019-08-07 23:31:30.877147 2019-08-07 23:31:30.877147
7 Banking 2019-08-07 23:31:30.901808 2019-08-07 23:31:30.901808
8 Administration 2019-08-07 23:31:30.916903 2019-08-07 23:31:30.916903
9 Marketing 2019-08-07 23:31:30.931236 2019-08-07 23:31:30.931236
10 Design 2019-08-07 23:31:30.94733 2019-08-07 23:31:30.94733
11 Accounting 2019-08-07 23:31:30.962704 2019-08-07 23:31:30.962704
\.
--
-- Data for Name: employee_projects; Type: TABLE DATA; Schema: public; Owner: Guest
--
COPY public.employee_projects (id, employee_id, project_id, created_at, updated_at) FROM stdin;
1 1 8 2019-08-07 23:31:31.019451 2019-08-07 23:31:31.019451
2 1 1 2019-08-07 23:31:31.03563 2019-08-07 23:31:31.03563
3 1 10 2019-08-07 23:31:31.038064 2019-08-07 23:31:31.038064
4 1 6 2019-08-07 23:31:31.040252 2019-08-07 23:31:31.040252
5 2 10 2019-08-07 23:31:31.042672 2019-08-07 23:31:31.042672
6 2 1 2019-08-07 23:31:31.044592 2019-08-07 23:31:31.044592
7 2 2 2019-08-07 23:31:31.046711 2019-08-07 23:31:31.046711
8 3 8 2019-08-07 23:31:31.049158 2019-08-07 23:31:31.049158
9 3 7 2019-08-07 23:31:31.052599 2019-08-07 23:31:31.052599
10 3 3 2019-08-07 23:31:31.054941 2019-08-07 23:31:31.054941
11 4 9 2019-08-07 23:31:31.057476 2019-08-07 23:31:31.057476
12 5 6 2019-08-07 23:31:31.060062 2019-08-07 23:31:31.060062
13 5 9 2019-08-07 23:31:31.062191 2019-08-07 23:31:31.062191
14 6 4 2019-08-07 23:31:31.064602 2019-08-07 23:31:31.064602
15 7 1 2019-08-07 23:31:31.067124 2019-08-07 23:31:31.067124
16 8 9 2019-08-07 23:31:31.069606 2019-08-07 23:31:31.069606
17 9 4 2019-08-07 23:31:31.071891 2019-08-07 23:31:31.071891
18 9 8 2019-08-07 23:31:31.073888 2019-08-07 23:31:31.073888
19 9 1 2019-08-07 23:31:31.075776 2019-08-07 23:31:31.075776
20 9 6 2019-08-07 23:31:31.077948 2019-08-07 23:31:31.077948
21 10 10 2019-08-07 23:31:31.080409 2019-08-07 23:31:31.080409
22 10 7 2019-08-07 23:31:31.082941 2019-08-07 23:31:31.082941
23 10 5 2019-08-07 23:31:31.085148 2019-08-07 23:31:31.085148
24 10 2 2019-08-07 23:31:31.087273 2019-08-07 23:31:31.087273
25 11 2 2019-08-07 23:31:31.089728 2019-08-07 23:31:31.089728
26 11 3 2019-08-07 23:31:31.091879 2019-08-07 23:31:31.091879
27 12 5 2019-08-07 23:31:31.094233 2019-08-07 23:31:31.094233
28 12 9 2019-08-07 23:31:31.096292 2019-08-07 23:31:31.096292
29 12 1 2019-08-07 23:31:31.098344 2019-08-07 23:31:31.098344
30 13 7 2019-08-07 23:31:31.10076 2019-08-07 23:31:31.10076
31 13 6 2019-08-07 23:31:31.102871 2019-08-07 23:31:31.102871
32 14 5 2019-08-07 23:31:31.1052 2019-08-07 23:31:31.1052
33 14 7 2019-08-07 23:31:31.10723 2019-08-07 23:31:31.10723
34 15 5 2019-08-07 23:31:31.109659 2019-08-07 23:31:31.109659
35 15 9 2019-08-07 23:31:31.111814 2019-08-07 23:31:31.111814
36 16 10 2019-08-07 23:31:31.114209 2019-08-07 23:31:31.114209
37 16 9 2019-08-07 23:31:31.116254 2019-08-07 23:31:31.116254
38 17 6 2019-08-07 23:31:31.119501 2019-08-07 23:31:31.119501
39 17 2 2019-08-07 23:31:31.122039 2019-08-07 23:31:31.122039
40 18 6 2019-08-07 23:31:31.124426 2019-08-07 23:31:31.124426
41 19 4 2019-08-07 23:31:31.126778 2019-08-07 23:31:31.126778
42 19 1 2019-08-07 23:31:31.128772 2019-08-07 23:31:31.128772
43 19 9 2019-08-07 23:31:31.130691 2019-08-07 23:31:31.130691
44 20 5 2019-08-07 23:31:31.133237 2019-08-07 23:31:31.133237
45 20 10 2019-08-07 23:31:31.135542 2019-08-07 23:31:31.135542
46 20 7 2019-08-07 23:31:31.13767 2019-08-07 23:31:31.13767
47 20 3 2019-08-07 23:31:31.139846 2019-08-07 23:31:31.139846
48 21 10 2019-08-07 23:31:31.142818 2019-08-07 23:31:31.142818
49 21 5 2019-08-07 23:31:31.145223 2019-08-07 23:31:31.145223
50 21 4 2019-08-07 23:31:31.147342 2019-08-07 23:31:31.147342
51 21 9 2019-08-07 23:31:31.149487 2019-08-07 23:31:31.149487
52 22 6 2019-08-07 23:31:31.15242 2019-08-07 23:31:31.15242
53 22 4 2019-08-07 23:31:31.154717 2019-08-07 23:31:31.154717
54 22 3 2019-08-07 23:31:31.156833 2019-08-07 23:31:31.156833
55 23 5 2019-08-07 23:31:31.159419 2019-08-07 23:31:31.159419
56 23 7 2019-08-07 23:31:31.161544 2019-08-07 23:31:31.161544
57 23 1 2019-08-07 23:31:31.163673 2019-08-07 23:31:31.163673
58 23 4 2019-08-07 23:31:31.165914 2019-08-07 23:31:31.165914
59 24 5 2019-08-07 23:31:31.168745 2019-08-07 23:31:31.168745
60 24 7 2019-08-07 23:31:31.170839 2019-08-07 23:31:31.170839
61 24 6 2019-08-07 23:31:31.173086 2019-08-07 23:31:31.173086
62 25 2 2019-08-07 23:31:31.17581 2019-08-07 23:31:31.17581
63 26 3 2019-08-07 23:31:31.178273 2019-08-07 23:31:31.178273
64 26 1 2019-08-07 23:31:31.180461 2019-08-07 23:31:31.180461
65 26 7 2019-08-07 23:31:31.182536 2019-08-07 23:31:31.182536
66 26 2 2019-08-07 23:31:31.184779 2019-08-07 23:31:31.184779
67 27 7 2019-08-07 23:31:31.18721 2019-08-07 23:31:31.18721
68 27 6 2019-08-07 23:31:31.189255 2019-08-07 23:31:31.189255
69 27 3 2019-08-07 23:31:31.19134 2019-08-07 23:31:31.19134
70 28 9 2019-08-07 23:31:31.193836 2019-08-07 23:31:31.193836
71 29 6 2019-08-07 23:31:31.196251 2019-08-07 23:31:31.196251
72 29 4 2019-08-07 23:31:31.198349 2019-08-07 23:31:31.198349
73 29 9 2019-08-07 23:31:31.200357 2019-08-07 23:31:31.200357
74 30 5 2019-08-07 23:31:31.202796 2019-08-07 23:31:31.202796
75 30 7 2019-08-07 23:31:31.204773 2019-08-07 23:31:31.204773
76 30 6 2019-08-07 23:31:31.20686 2019-08-07 23:31:31.20686
77 31 5 2019-08-07 23:31:31.209123 2019-08-07 23:31:31.209123
78 31 4 2019-08-07 23:31:31.211249 2019-08-07 23:31:31.211249
79 32 10 2019-08-07 23:31:31.213614 2019-08-07 23:31:31.213614
80 32 2 2019-08-07 23:31:31.215637 2019-08-07 23:31:31.215637
81 33 3 2019-08-07 23:31:31.218171 2019-08-07 23:31:31.218171
82 33 2 2019-08-07 23:31:31.220547 2019-08-07 23:31:31.220547
83 34 6 2019-08-07 23:31:31.222951 2019-08-07 23:31:31.222951
84 34 3 2019-08-07 23:31:31.224997 2019-08-07 23:31:31.224997
85 35 2 2019-08-07 23:31:31.227431 2019-08-07 23:31:31.227431
86 35 1 2019-08-07 23:31:31.229544 2019-08-07 23:31:31.229544
87 35 7 2019-08-07 23:31:31.231571 2019-08-07 23:31:31.231571
88 35 8 2019-08-07 23:31:31.233687 2019-08-07 23:31:31.233687
89 36 8 2019-08-07 23:31:31.237179 2019-08-07 23:31:31.237179
90 37 7 2019-08-07 23:31:31.239771 2019-08-07 23:31:31.239771
91 37 3 2019-08-07 23:31:31.241913 2019-08-07 23:31:31.241913
92 38 1 2019-08-07 23:31:31.244349 2019-08-07 23:31:31.244349
93 38 2 2019-08-07 23:31:31.246373 2019-08-07 23:31:31.246373
94 38 4 2019-08-07 23:31:31.2484 2019-08-07 23:31:31.2484
95 38 7 2019-08-07 23:31:31.250355 2019-08-07 23:31:31.250355
96 39 6 2019-08-07 23:31:31.252967 2019-08-07 23:31:31.252967
97 40 8 2019-08-07 23:31:31.255409 2019-08-07 23:31:31.255409
98 40 5 2019-08-07 23:31:31.257565 2019-08-07 23:31:31.257565
99 40 7 2019-08-07 23:31:31.25965 2019-08-07 23:31:31.25965
100 41 9 2019-08-07 23:31:31.262034 2019-08-07 23:31:31.262034
101 41 1 2019-08-07 23:31:31.264252 2019-08-07 23:31:31.264252
102 41 10 2019-08-07 23:31:31.266884 2019-08-07 23:31:31.266884
103 41 2 2019-08-07 23:31:31.26927 2019-08-07 23:31:31.26927
104 42 9 2019-08-07 23:31:31.271811 2019-08-07 23:31:31.271811
105 43 5 2019-08-07 23:31:31.274199 2019-08-07 23:31:31.274199
106 43 2 2019-08-07 23:31:31.276335 2019-08-07 23:31:31.276335
107 43 9 2019-08-07 23:31:31.278324 2019-08-07 23:31:31.278324
108 44 5 2019-08-07 23:31:31.280658 2019-08-07 23:31:31.280658
109 44 8 2019-08-07 23:31:31.282684 2019-08-07 23:31:31.282684
110 44 6 2019-08-07 23:31:31.28483 2019-08-07 23:31:31.28483
111 45 7 2019-08-07 23:31:31.287386 2019-08-07 23:31:31.287386
112 46 3 2019-08-07 23:31:31.289817 2019-08-07 23:31:31.289817
113 46 1 2019-08-07 23:31:31.291833 2019-08-07 23:31:31.291833
114 47 5 2019-08-07 23:31:31.294186 2019-08-07 23:31:31.294186
115 47 8 2019-08-07 23:31:31.296239 2019-08-07 23:31:31.296239
116 47 6 2019-08-07 23:31:31.298271 2019-08-07 23:31:31.298271
117 47 1 2019-08-07 23:31:31.30033 2019-08-07 23:31:31.30033
118 48 3 2019-08-07 23:31:31.303741 2019-08-07 23:31:31.303741
119 48 5 2019-08-07 23:31:31.306034 2019-08-07 23:31:31.306034
120 48 6 2019-08-07 23:31:31.308175 2019-08-07 23:31:31.308175
121 48 4 2019-08-07 23:31:31.310333 2019-08-07 23:31:31.310333
122 49 1 2019-08-07 23:31:31.31301 2019-08-07 23:31:31.31301
123 49 5 2019-08-07 23:31:31.315093 2019-08-07 23:31:31.315093
124 49 10 2019-08-07 23:31:31.317338 2019-08-07 23:31:31.317338
125 49 9 2019-08-07 23:31:31.319461 2019-08-07 23:31:31.319461
126 50 1 2019-08-07 23:31:31.321914 2019-08-07 23:31:31.321914
127 50 7 2019-08-07 23:31:31.323994 2019-08-07 23:31:31.323994
128 50 2 2019-08-07 23:31:31.326386 2019-08-07 23:31:31.326386
129 50 9 2019-08-07 23:31:31.328691 2019-08-07 23:31:31.328691
\.
--
-- Data for Name: employees; Type: TABLE DATA; Schema: public; Owner: Guest
--
COPY public.employees (id, name, division_id, created_at, updated_at) FROM stdin;
1 Junie Goyette 2 2019-08-07 23:31:30.798846 2019-08-07 23:31:30.798846
2 Nedra Ortiz 2 2019-08-07 23:31:30.820149 2019-08-07 23:31:30.820149
3 Shoshana Feest 2 2019-08-07 23:31:30.823128 2019-08-07 23:31:30.823128
4 Candance Doyle IV 2 2019-08-07 23:31:30.826042 2019-08-07 23:31:30.826042
5 Merlene Wyman 2 2019-08-07 23:31:30.828777 2019-08-07 23:31:30.828777
6 Jeffrey Pollich 3 2019-08-07 23:31:30.833313 2019-08-07 23:31:30.833313
7 Kandace Tromp 3 2019-08-07 23:31:30.836206 2019-08-07 23:31:30.836206
8 Nadine Lind 3 2019-08-07 23:31:30.839173 2019-08-07 23:31:30.839173
9 Rosalia Pollich 3 2019-08-07 23:31:30.841887 2019-08-07 23:31:30.841887
10 Marx Skiles 3 2019-08-07 23:31:30.844436 2019-08-07 23:31:30.844436
11 Evette Pagac 4 2019-08-07 23:31:30.848699 2019-08-07 23:31:30.848699
12 Rodolfo Leffler 4 2019-08-07 23:31:30.8517 2019-08-07 23:31:30.8517
13 Austin Kozey 4 2019-08-07 23:31:30.854474 2019-08-07 23:31:30.854474
14 Leonida Reichel 4 2019-08-07 23:31:30.856953 2019-08-07 23:31:30.856953
15 Lady Morar DVM 4 2019-08-07 23:31:30.859356 2019-08-07 23:31:30.859356
16 Napoleon Armstrong Jr. 5 2019-08-07 23:31:30.863607 2019-08-07 23:31:30.863607
17 Joellen Greenholt 5 2019-08-07 23:31:30.866117 2019-08-07 23:31:30.866117
18 Starr Leannon 5 2019-08-07 23:31:30.869592 2019-08-07 23:31:30.869592
19 Arnulfo Kassulke 5 2019-08-07 23:31:30.872522 2019-08-07 23:31:30.872522
20 Mrs. Paulita Rolfson 5 2019-08-07 23:31:30.875222 2019-08-07 23:31:30.875222
21 Ms. Cordelia Emard 6 2019-08-07 23:31:30.879717 2019-08-07 23:31:30.879717
22 Dr. Ivory Hettinger 6 2019-08-07 23:31:30.882626 2019-08-07 23:31:30.882626
23 Dr. Demarcus Parker 6 2019-08-07 23:31:30.893621 2019-08-07 23:31:30.893621
24 Fidelia Schroeder 6 2019-08-07 23:31:30.896434 2019-08-07 23:31:30.896434
25 Latoya Hettinger DVM 6 2019-08-07 23:31:30.899704 2019-08-07 23:31:30.899704
26 Ji Wiegand 7 2019-08-07 23:31:30.904628 2019-08-07 23:31:30.904628
27 Carmelita Wintheiser 7 2019-08-07 23:31:30.907381 2019-08-07 23:31:30.907381
28 Casandra O'Kon 7 2019-08-07 23:31:30.910076 2019-08-07 23:31:30.910076
29 Mrs. Karl Kessler 7 2019-08-07 23:31:30.912641 2019-08-07 23:31:30.912641
30 Mr. Yuki Wehner 7 2019-08-07 23:31:30.915177 2019-08-07 23:31:30.915177
31 Travis Lind 8 2019-08-07 23:31:30.919541 2019-08-07 23:31:30.919541
32 Suzann Dach 8 2019-08-07 23:31:30.922132 2019-08-07 23:31:30.922132
33 Rodger Bergnaum 8 2019-08-07 23:31:30.924497 2019-08-07 23:31:30.924497
34 Garland Toy Sr. 8 2019-08-07 23:31:30.926956 2019-08-07 23:31:30.926956
35 Malcom Funk 8 2019-08-07 23:31:30.929436 2019-08-07 23:31:30.929436
36 Seymour Rippin 9 2019-08-07 23:31:30.934412 2019-08-07 23:31:30.934412
37 Latosha Reichert 9 2019-08-07 23:31:30.937632 2019-08-07 23:31:30.937632
38 Jermaine Berge 9 2019-08-07 23:31:30.940307 2019-08-07 23:31:30.940307
39 Mr. Edwardo Bosco 9 2019-08-07 23:31:30.943041 2019-08-07 23:31:30.943041
40 Tracy Cole 9 2019-08-07 23:31:30.945546 2019-08-07 23:31:30.945546
41 Lenard Lubowitz 10 2019-08-07 23:31:30.949834 2019-08-07 23:31:30.949834
42 Dion Collins 10 2019-08-07 23:31:30.952536 2019-08-07 23:31:30.952536
43 Larraine Hills 10 2019-08-07 23:31:30.95509 2019-08-07 23:31:30.95509
44 Paul O'Reilly 10 2019-08-07 23:31:30.957682 2019-08-07 23:31:30.957682
45 Hans Hand 10 2019-08-07 23:31:30.960537 2019-08-07 23:31:30.960537
46 Skye Hand V 11 2019-08-07 23:31:30.965298 2019-08-07 23:31:30.965298
47 Hank Cremin 11 2019-08-07 23:31:30.968347 2019-08-07 23:31:30.968347
48 Mr. Orville Powlowski 11 2019-08-07 23:31:30.971077 2019-08-07 23:31:30.971077
49 Alonzo Russel 11 2019-08-07 23:31:30.973652 2019-08-07 23:31:30.973652
50 Jeniffer Rodriguez 11 2019-08-07 23:31:30.976228 2019-08-07 23:31:30.976228
\.
--
-- Data for Name: projects; Type: TABLE DATA; Schema: public; Owner: Guest
--
COPY public.projects (id, name, created_at, updated_at) FROM stdin;
1 Leadership 2019-08-07 23:31:30.982707 2019-08-07 23:31:30.982707
2 Problem solving 2019-08-07 23:31:30.984736 2019-08-07 23:31:30.984736
3 Proactive 2019-08-07 23:31:30.986487 2019-08-07 23:31:30.986487
4 Fast learner 2019-08-07 23:31:30.988177 2019-08-07 23:31:30.988177
5 Organisation 2019-08-07 23:31:30.989883 2019-08-07 23:31:30.989883
6 Self-motivated 2019-08-07 23:31:30.991627 2019-08-07 23:31:30.991627
7 Networking skills 2019-08-07 23:31:30.993225 2019-08-07 23:31:30.993225
8 Work under pressure 2019-08-07 23:31:30.994699 2019-08-07 23:31:30.994699
9 Confidence 2019-08-07 23:31:30.996237 2019-08-07 23:31:30.996237
10 Communication 2019-08-07 23:31:30.997721 2019-08-07 23:31:30.997721
\.
--
-- Data for Name: schema_migrations; Type: TABLE DATA; Schema: public; Owner: Guest
--
COPY public.schema_migrations (version) FROM stdin;
20190807202717
20190807203420
20190807205113
20190807205939
20190807211110
\.
--
-- Name: divisions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: Guest
--
SELECT pg_catalog.setval('public.divisions_id_seq', 11, true);
--
-- Name: employee_projects_id_seq; Type: SEQUENCE SET; Schema: public; Owner: Guest
--
SELECT pg_catalog.setval('public.employee_projects_id_seq', 129, true);
--
-- Name: employees_id_seq; Type: SEQUENCE SET; Schema: public; Owner: Guest
--
SELECT pg_catalog.setval('public.employees_id_seq', 50, true);
--
-- Name: projects_id_seq; Type: SEQUENCE SET; Schema: public; Owner: Guest
--
SELECT pg_catalog.setval('public.projects_id_seq', 10, true);
--
-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
--
-- Name: divisions divisions_pkey; Type: CONSTRAINT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.divisions
ADD CONSTRAINT divisions_pkey PRIMARY KEY (id);
--
-- Name: employee_projects employee_projects_pkey; Type: CONSTRAINT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.employee_projects
ADD CONSTRAINT employee_projects_pkey PRIMARY KEY (id);
--
-- Name: employees employees_pkey; Type: CONSTRAINT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.employees
ADD CONSTRAINT employees_pkey PRIMARY KEY (id);
--
-- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.projects
ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
--
-- Name: index_employee_projects_on_employee_id; Type: INDEX; Schema: public; Owner: Guest
--
CREATE INDEX index_employee_projects_on_employee_id ON public.employee_projects USING btree (employee_id);
--
-- Name: index_employee_projects_on_project_id; Type: INDEX; Schema: public; Owner: Guest
--
CREATE INDEX index_employee_projects_on_project_id ON public.employee_projects USING btree (project_id);
--
-- Name: employees fk_rails_550e0790c5; Type: FK CONSTRAINT; Schema: public; Owner: Guest
--
ALTER TABLE ONLY public.employees
ADD CONSTRAINT fk_rails_550e0790c5 FOREIGN KEY (division_id) REFERENCES public.divisions(id);
--
-- PostgreSQL database dump complete
--
| true |
0ea3567c64b77e3d8539373967984d2769a15354 | SQL | MrSquiggles13/upenn-python-homework | /SuspiciousTransactions/SQL/python_queries.sql | UTF-8 | 945 | 4.28125 | 4 | [] | no_license | -- Had to restructure tables for credit_card_number column
-- DROP TABLE credit_card;
-- DROP TABLE transaction;
-- Get card holders 2 & 18
-- SELECT card_holder.cardholder_id,
-- transaction.amount,
-- transaction.date
-- FROM card_holder
-- LEFT JOIN credit_card on card_holder.cardholder_id = credit_card.cardholder_id
-- LEFT JOIN transaction on transaction.card_number = credit_card.card_number
-- WHERE card_holder.cardholder_id in (2, 18);
-- Get daily transactions from jan to jun 2018 for card holder 25
-- SELECT EXTRACT(MONTH FROM transaction.date) AS month,
-- EXTRACT(DAY FROM transaction.date) AS day,
-- transaction.amount
-- FROM card_holder
-- LEFT JOIN credit_card ON card_holder.cardholder_id = credit_card.cardholder_id
-- LEFT JOIN transaction ON credit_card.card_number = transaction.card_number
-- WHERE card_holder.cardholder_id in (25)
-- AND date BETWEEN '2018-01-01' and '2018-06-30'; | true |
ea3b69e0a19ec1981273fc678b61015a27c4e3be | SQL | NeoPhoenix/net.neophoenix.githubdata | /sql/install.sql | UTF-8 | 256 | 2.609375 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `wcf1_githubdata_hash` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`timestamp` int(11) NOT NULL,
`hash` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `hash` (`hash`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; | true |
f962e53e2c4b6d156897a2d002890d44afce4689 | SQL | fmidev/radon | /sql/geom_reduced_gaussian.sql | UTF-8 | 4,184 | 3.21875 | 3 | [
"MIT"
] | permissive | --
-- PostgreSQL database dump
--
-- Dumped from database version 15.2
-- Dumped by pg_dump version 15.3
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;
--
-- Name: geom_reduced_gaussian; Type: TABLE; Schema: public; Owner: radon_admin
--
CREATE TABLE public.geom_reduced_gaussian (
id integer NOT NULL,
name text NOT NULL,
nj integer NOT NULL,
first_point public.geometry(Point,4326) NOT NULL,
last_point public.geometry(Point,4326) NOT NULL,
scanning_mode text NOT NULL,
n integer NOT NULL,
points_along_parallels integer[] NOT NULL,
description text NOT NULL,
last_updater text,
last_updated timestamp with time zone,
earth_shape_id integer,
datum_id integer,
CONSTRAINT geom_reduced_gaussian_datum_chk CHECK (((datum_id IS NULL) OR ((datum_id IS NOT NULL) AND (earth_shape_id IS NULL)))),
CONSTRAINT geom_reduced_gaussian_scanning_mode_chk CHECK ((scanning_mode = ANY (ARRAY['+x-y'::text, '+x+y'::text])))
);
ALTER TABLE public.geom_reduced_gaussian OWNER TO radon_admin;
--
-- Name: geom_reduced_gaussian geom_reduced_gaussian_name_uniq; Type: CONSTRAINT; Schema: public; Owner: radon_admin
--
ALTER TABLE ONLY public.geom_reduced_gaussian
ADD CONSTRAINT geom_reduced_gaussian_name_uniq UNIQUE (name);
--
-- Name: geom_reduced_gaussian geom_reduced_gaussian_pkey; Type: CONSTRAINT; Schema: public; Owner: radon_admin
--
ALTER TABLE ONLY public.geom_reduced_gaussian
ADD CONSTRAINT geom_reduced_gaussian_pkey PRIMARY KEY (id);
--
-- Name: geom_reduced_gaussian_geom_fkey_02_idx; Type: INDEX; Schema: public; Owner: radon_admin
--
CREATE INDEX geom_reduced_gaussian_geom_fkey_02_idx ON public.geom_reduced_gaussian USING btree (name);
--
-- Name: geom_reduced_gaussian_geom_fkey_idx; Type: INDEX; Schema: public; Owner: radon_admin
--
CREATE INDEX geom_reduced_gaussian_geom_fkey_idx ON public.geom_reduced_gaussian USING btree (id);
--
-- Name: geom_reduced_gaussian audit_trigger_row; Type: TRIGGER; Schema: public; Owner: radon_admin
--
CREATE TRIGGER audit_trigger_row AFTER UPDATE ON public.geom_reduced_gaussian FOR EACH ROW EXECUTE FUNCTION audit.if_modified_func('true');
--
-- Name: geom_reduced_gaussian geom_reduced_gaussian_store_last_updated_trg; Type: TRIGGER; Schema: public; Owner: radon_admin
--
CREATE TRIGGER geom_reduced_gaussian_store_last_updated_trg AFTER UPDATE ON public.geom_reduced_gaussian FOR EACH ROW EXECUTE FUNCTION public.store_last_updated_f();
--
-- Name: geom_reduced_gaussian geom_reduced_gaussian_datum_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: radon_admin
--
ALTER TABLE ONLY public.geom_reduced_gaussian
ADD CONSTRAINT geom_reduced_gaussian_datum_id_fkey FOREIGN KEY (datum_id) REFERENCES public.datum(id);
--
-- Name: geom_reduced_gaussian geom_reduced_gaussian_earth_shape_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: radon_admin
--
ALTER TABLE ONLY public.geom_reduced_gaussian
ADD CONSTRAINT geom_reduced_gaussian_earth_shape_id_fkey FOREIGN KEY (earth_shape_id) REFERENCES public.earth_shape(id);
--
-- Name: geom_reduced_gaussian geom_reduced_gaussian_geom_fkey; Type: FK CONSTRAINT; Schema: public; Owner: radon_admin
--
ALTER TABLE ONLY public.geom_reduced_gaussian
ADD CONSTRAINT geom_reduced_gaussian_geom_fkey FOREIGN KEY (id) REFERENCES public.geom(id);
--
-- Name: geom_reduced_gaussian geom_reduced_gaussian_geom_fkey_02; Type: FK CONSTRAINT; Schema: public; Owner: radon_admin
--
ALTER TABLE ONLY public.geom_reduced_gaussian
ADD CONSTRAINT geom_reduced_gaussian_geom_fkey_02 FOREIGN KEY (name) REFERENCES public.geom(name);
--
-- Name: TABLE geom_reduced_gaussian; Type: ACL; Schema: public; Owner: radon_admin
--
GRANT SELECT ON TABLE public.geom_reduced_gaussian TO radon_ro;
--
-- PostgreSQL database dump complete
--
| true |
342b41a8684427da72d94da228310cc1ec08b697 | SQL | dividedbyzero360/SQL_Server | /3_SQLQuery2.sql | UTF-8 | 752 | 4.25 | 4 | [] | no_license | ALTER table ForeignKeyTable add constraint ForeignKeyTable_ForeignKeyColumn_FK
FOREIGN KEY(ForeignKeyColumn) references PrimaryKeyTable (PrimaryKeyColumn)
CREATE DATABASE DBLearning
use DBLearning
CREATE TABLE tblPerson
(
ID INT Primary key, -- By default primary keys are not null
Name nvarchar(50),
Email nvarchar(50),
GenderId INT
)
CREATE TABLE tblGender
(
ID int NOT NULL Primary KEY,
Gender nvarchar(50) NOT NUll
)
ALTER TABLE tblPerson add constraint tblPerson_GenderId_FK
FOREIGN KEY(GenderId) references tblGender (ID)
--A FOREIGN KEY constraint does not have to be linked only to a PRIMARY KEY constraint in another table;
-- it can also be defined to reference the columns of a UNIQUE constraint in another table. | true |
2900072de12a2c11084ecc90124bd017f11015b7 | SQL | kangqi0421/sql | /client_info.sql | WINDOWS-1250 | 818 | 2.765625 | 3 | [] | no_license | -- V$SESSION_CONNECT_INFO
select client_driver, client_version, count(*)
--inst_id, sid, osuser, client_oci_library, client_version, client_driver
from GV$SESSION_CONNECT_INFO
where NETWORK_SERVICE_BANNER like '%TCP/IP%' -- pouze TCP/IP spojen
-- and client_driver like 'jdbcthin'
group by client_driver, client_version
order by count(*) desc
;
-- SYS.x$ksusecon
SELECT x.sid,
DECODE(to_c,'0','Unknown',TO_NUMBER(SUBSTR(v,8,2),'xx') || '.' || -- maj_rel
SUBSTR(v,10,1) || '.' || -- mnt_rel
SUBSTR(v,11,2) || '.' || -- ias_rel
SUBSTR(v,13,1) || '.' || -- ptc_set
SUBSTR(v,14,2)) client_version, -- port_mnt
username,program, module
FROM x, v$session s
WHERE x.sid like s.sid AND type != 'BACKGROUND'
/
| true |
5ece57140a5e613b30b1651c1127eeeccfd92987 | SQL | Gwanom/spotigram-backend | /db_setup.sql | UTF-8 | 2,061 | 3.84375 | 4 | [] | no_license | /*
Spotigram Database v0.1.2
*/
SET SCHEMA 'spotigram';
CREATE TABLE roles (
sg_role_id SERIAL,
role_name TEXT NOT NULL,
CONSTRAINT sg_role_pk PRIMARY KEY (sg_role_id)
);
CREATE TABLE users (
sg_user_id SERIAL,
username TEXT NOT NULL UNIQUE,
u_password TEXT NOT NULL,
user_first_name TEXT NOT NULL,
user_last_name TEXT NOT NULL,
user_email TEXT NOT NULL UNIQUE,
user_role INTEGER NOT NULL,
isBanned BOOLEAN NOT NULL,
CONSTRAINT sg_user_PK PRIMARY KEY (sg_user_id),
FOREIGN KEY (user_role) REFERENCES roles (sg_role_id)
);
CREATE TABLE artists (
artist_id SERIAL,
artist_name TEXT NOT NULL,
CONSTRAINT sg_artist_PK PRIMARY KEY (artist_id)
);
CREATE TABLE albums (
album_id SERIAL,
album_title TEXT NOT NULL,
artist INTEGER NOT NULL,
CONSTRAINT sg_album_PK PRIMARY KEY (album_id),
FOREIGN KEY (artist) REFERENCES artists(artist_id)
);
CREATE TABLE songs (
sg_song_id SERIAL,
song_title TEXT NOT NULL,
album INTEGER NOT NULL,
artist INTEGER NOT NULL,
video TEXT,
audio_sample TEXT,
CONSTRAINT sg_song_PK PRIMARY KEY (sg_song_id),
FOREIGN KEY (album) REFERENCES albums (album_id),
FOREIGN KEY (artist) REFERENCES artists (artist_id)
);
CREATE TABLE posts (
sg_post_id SERIAL,
author_id INTEGER NOT NULL,
topic_song INTEGER NOT NULL,
topic_album INTEGER NOT NULL,
topic_artist INTEGER NOT NULL,
content TEXT NOT NULL,
CONSTRAINT sg_post_PK PRIMARY KEY (sg_post_id),
FOREIGN KEY (author_id) REFERENCES users (sg_user_id),
FOREIGN KEY (topic_song) REFERENCES songs (sg_song_id),
FOREIGN KEY (topic_album) REFERENCES albums (album_id),
FOREIGN KEY (topic_artist) REFERENCES artists (artist_id)
);
CREATE TABLE replies (
sg_reply_id SERIAL,
parent INTEGER NOT NULL,
author INTEGER NOT NULL,
content TEXT NOT NULL,
CONSTRAINT sg_reply_PK PRIMARY KEY (sg_reply_id),
FOREIGN KEY (parent) REFERENCES posts (sg_post_id),
FOREIGN KEY (author) REFERENCES users (sg_user_id)
);
| true |
45ce2ef5d5156e306b1dfce2cc5c91f92ded8226 | SQL | fanlun008/multi-table-query-2019-5-21-3-10-2-585 | /select.sql | UTF-8 | 1,841 | 4.75 | 5 | [] | no_license | # 1.查询同时存在1课程和2课程的情况
SELECT * from student_course sc WHERE sc.courseId=1 OR sc.courseId=2;
# 2.查询同时存在1课程和2课程的情况
?????1,2题不是很了解什么意思????
# 3.查询平均成绩大于等于60分的同学的学生编号和学生姓名和平均成绩
SELECT s.id,s.name,AVG(sc.score) FROM student s LEFT JOIN student_course sc ON s.id=sc.studentId GROUP BY sc.studentId HAVING AVG(sc.score)>60;
# 4.查询在student_course表中不存在成绩的学生信息的SQL语句
SELECT * FROM student s WHERE s.id NOT IN (
SELECT sc.studentId FROM student_course sc
);
# 5.查询所有有成绩的SQL
SELECT s.id as '学号',s.`name` as '姓名',c.`name` as '课程',sc.score as '成绩' FROM student s, course c, student_course sc WHERE sc.studentId=s.id AND sc.courseId=c.id;
# 6.查询学过编号为1并且也学过编号为2的课程的同学的信息
select * FROM student s, student_course sc WHERE s.id=sc.studentId AND sc.courseId=1 AND EXISTS (
SELECT sc2.score FROM student_course sc2 WHERE sc2.studentId=s.id AND sc2.courseId=2
);
# 7.检索1课程分数小于60,按分数降序排列的学生信息
SELECT s.*, c.`name`,sc.score FROM student s, course c, student_course sc WHERE s.id=sc.studentId AND c.id=sc.courseId AND sc.courseId=1 AND sc.score<60 ORDER BY sc.score DESC;
# 8.查询每门课程的平均成绩,结果按平均成绩降序排列,平均成绩相同时,按课程编号升序排列
SELECT courseId as '课程编号', AVG(score) as '平均成绩' FROM student_course GROUP BY courseId ORDER BY courseId ASC;
# 9.查询课程名称为"数学",且分数低于60的学生姓名和分数
SELECT s.`name`, sc.score FROM student s, student_course sc WHERE s.id=sc.studentId AND sc.courseId=(
SELECT id FROM course WHERE `name`='数学'
) AND sc.score<60;
| true |
b4d130e69f764815c077f1ef47971827dfcb9a1e | SQL | sucun21/CMS_20171005 | /sogo-lms-cms-api/sql/web_cms_execute_trainer_course.sql | UTF-8 | 1,030 | 3.375 | 3 | [] | no_license | delimiter //
DROP PROCEDURE IF EXISTS web_cms_execute_trainer_course;
//
CREATE PROCEDURE PROCEDURE `web_cms_execute_trainer_course`(
IN p_course_id INT,
IN p_trainer_id INT,
IN p_execute_type VARCHAR(1)
)
BEGIN
DECLARE errorText TEXT;
/**Delare handler sql_exception*/
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 errorText = MESSAGE_TEXT;
SELECT -1 `id`,
errorText `message`;
ROLLBACK;
END;
IF p_execute_type='I' THEN
IF EXISTS (SELECT 1 FROM sg_course_trainer WHERE course_id = p_course_id AND trainer_id = p_trainer_id) THEN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Trainer course does exist';
END IF;
INSERT INTO sg_course_trainer(course_id,trainer_id,is_active,is_delete)
VALUES (p_course_id,p_trainer_id,1,0);
ELSE
DELETE FROM sg_course_trainer
WHERE course_id=p_course_id
AND trainer_id=p_trainer_id;
END IF;
SELECT 1 `id`,
'Trainer course excuted' `message`;
END
//
delimiter ; | true |
45b78966664a24edf11d8ff67848b81680e1ae14 | SQL | GDGDouala/jelis | /data/jelisdb.sql | UTF-8 | 3,647 | 3.578125 | 4 | [
"BSD-3-Clause"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Dim 22 Février 2015 à 19:24
-- Version du serveur : 5.6.17
-- Version de PHP : 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+01:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de données : `jelisdb`
--
-- --------------------------------------------------------
--
-- Structure de la table `article`
--
CREATE TABLE IF NOT EXISTS `article` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`date_parution` date NOT NULL,
`date_publication` date NOT NULL,
`titre` varchar(500) NOT NULL,
`description` text NOT NULL,
`lien` varchar(500) NOT NULL,
`id_blog` int(10) NOT NULL,
`tags` text,
PRIMARY KEY (`id`),
KEY `id_blog` (`id_blog`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `blog`
--
CREATE TABLE IF NOT EXISTS `blog` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`nom_blog` varchar(500) NOT NULL,
`nom_bloggeur` varchar(500) NOT NULL,
`url_page_accueil` text NOT NULL,
`id_categorie` int(10) NOT NULL,
`date_ajout` date NOT NULL,
`email` varchar(500) DEFAULT NULL,
`telephone` varchar(100) DEFAULT NULL,
`adresse` text,
`sexe` int(5) DEFAULT NULL,
`metadonnees` text,
`tags` text,
PRIMARY KEY (`id`),
KEY `id_categorie` (`id_categorie`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `categorie_blog`
--
CREATE TABLE IF NOT EXISTS `categorie_blog` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`nom` varchar(500) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `vote`
--
CREATE TABLE IF NOT EXISTS `vote` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`id_article` int(10) NOT NULL,
`date_heure` timestamp NOT NULL,
`adresse_ip` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `id_article` (`id_article`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `vue`
--
CREATE TABLE IF NOT EXISTS `vue` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`id_article` int(10) NOT NULL,
`date_heure` timestamp NOT NULL,
`adresse_ip` varchar(500) NOT NULL,
PRIMARY KEY (`id`),
KEY `id_article` (`id_article`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `article`
--
ALTER TABLE `article`
ADD CONSTRAINT `article_ibfk_1` FOREIGN KEY (`id_blog`) REFERENCES `blog` (`id`);
--
-- Contraintes pour la table `blog`
--
ALTER TABLE `blog`
ADD CONSTRAINT `blog_ibfk_1` FOREIGN KEY (`id_categorie`) REFERENCES `categorie_blog` (`id`);
--
-- Contraintes pour la table `vote`
--
ALTER TABLE `vote`
ADD CONSTRAINT `vote_ibfk_1` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`);
--
-- Contraintes pour la table `vue`
--
ALTER TABLE `vue`
ADD CONSTRAINT `vue_ibfk_1` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
4f14213d75de71b395cc41f730d014ca618dccea | SQL | DawidBochenek/SQL_Kolokwium | /SQL_Kolokwium/dbo/Views/StudentNieprzypisany.sql | UTF-8 | 196 | 3.09375 | 3 | [] | no_license | CREATE VIEW StudentNieprzypisany
AS
SELECT Student.Imie, Student.Nazwisko, Student.Indeks FROM Student LEFT JOIN Przypisanie ON Student.StudentId=Przypisanie.StudentId
WHERE PrzedmiotId is null | true |
a2dd8300eab85f668cb013e261e852848ff0476e | SQL | k2khalsa/jarvis_data_eng_karan | /linux_sql/sql/ddl.sql | UTF-8 | 768 | 3.15625 | 3 | [] | no_license | --Karan Khalsa 05/12/2020
--Automation file to create db tables
--CREATE TABLE host_info if it does not exist
CREATE TABLE IF NOT EXISTS PUBLIC.host_info(
id serial NOT NULL PRIMARY KEY,
hostname VARCHAR UNIQUE NOT NULL,
cpu_number INT NOT NULL,
cpu_architecture VARCHAR NOT NULL,
cpu_model VARCHAR NOT NULL,
cpu_mhz INT NOT NULL,
L2_cache INT NOT NULL,
total_mem INT NOT NULL,
time_stamp TIMESTAMP NOT NULL);
--CREATE TABLE host_usage if it does not exist
CREATE TABLE PUBLIC.host_usage(
time_stamp TIMESTAMP NOT NULL PRIMARY KEY,
host_id serial NOT NULL REFERENCES host_info(id),
memory_free INT NOT NULL,
cpu_idle INT NOT NULL,
cpu_kernel INT NOT NULL,
disk_io INT NOT NULL,
disk_available INT NOT NULL);
| true |
ee07ad3f60ec8de24bddf0a1d9b56cebe515488c | SQL | cdiaz19/examenParcial2 | /ExamenParcial2/baseDatos/progra3_exa2.sql | UTF-8 | 3,931 | 3.34375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 01-02-2017 a las 09:56:37
-- Versión del servidor: 5.7.17-0ubuntu0.16.04.1
-- Versión de PHP: 7.0.13-0ubuntu0.16.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `progra3_exa2`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `author`
--
CREATE TABLE `author` (
`id_author` int(11) NOT NULL,
`name` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `author`
--
INSERT INTO `author` (`id_author`, `name`) VALUES
(1, 'Garcia Marquez'),
(9, 'Garcia Marquez'),
(17, 'William Shakespeare'),
(18, 'William Shakespeare'),
(19, 'Garcia Marquez'),
(20, 'William Shakespeare'),
(21, 'Garcia Marquez');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `authorContact`
--
CREATE TABLE `authorContact` (
`id_authorContact` int(11) NOT NULL,
`id_author` int(11) NOT NULL,
`contact` text NOT NULL,
`type` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `authorContact`
--
INSERT INTO `authorContact` (`id_authorContact`, `id_author`, `contact`, `type`) VALUES
(1, 1, '22798952', 'Casa'),
(2, 9, '22798952', 'Casa'),
(3, 19, '22798952', 'Casa'),
(4, 21, '22798952', 'Casa');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `book`
--
CREATE TABLE `book` (
`id_book` int(11) NOT NULL,
`id_author` int(11) NOT NULL,
`id_type` int(11) NOT NULL,
`name` text NOT NULL,
`dateRelease` date NOT NULL,
`price` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `book`
--
INSERT INTO `book` (`id_book`, `id_author`, `id_type`, `name`, `dateRelease`, `price`) VALUES
(2, 17, 7, 'Romeo y Julieta', '1597-03-01', 16500),
(3, 18, 8, 'Romeo y Julieta', '1597-03-01', 16500),
(4, 20, 10, 'Romeo y Julieta', '1597-03-01', 16500);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `bookType`
--
CREATE TABLE `bookType` (
`id_type` int(11) NOT NULL,
`type` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `bookType`
--
INSERT INTO `bookType` (`id_type`, `type`) VALUES
(1, 'Novela'),
(7, 'Drama'),
(8, 'Drama'),
(9, 'Novela'),
(10, 'Drama'),
(11, 'Novela');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `author`
--
ALTER TABLE `author`
ADD PRIMARY KEY (`id_author`);
--
-- Indices de la tabla `authorContact`
--
ALTER TABLE `authorContact`
ADD PRIMARY KEY (`id_authorContact`);
--
-- Indices de la tabla `book`
--
ALTER TABLE `book`
ADD PRIMARY KEY (`id_book`);
--
-- Indices de la tabla `bookType`
--
ALTER TABLE `bookType`
ADD PRIMARY KEY (`id_type`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `author`
--
ALTER TABLE `author`
MODIFY `id_author` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT de la tabla `authorContact`
--
ALTER TABLE `authorContact`
MODIFY `id_authorContact` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `book`
--
ALTER TABLE `book`
MODIFY `id_book` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `bookType`
--
ALTER TABLE `bookType`
MODIFY `id_type` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
/*!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 */;
| true |
9a5d44df5cfa336bca4520d2e8aded99c3b530fe | SQL | ambujsharma23/shopping | /dbfiles/state_ganna.sql | UTF-8 | 1,601 | 2.984375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 23, 2017 at 04:24 PM
-- Server version: 5.5.44-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4.17
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `new_survey`
--
-- --------------------------------------------------------
--
-- Table structure for table `state_ganna`
--
CREATE TABLE IF NOT EXISTS `state_ganna` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`state_name` varchar(500) NOT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;
--
-- Dumping data for table `state_ganna`
--
INSERT INTO `state_ganna` (`id`, `state_name`, `status`) VALUES
(1, '\r\nAndhra Pradesh', 1),
(2, 'Bihar', 1),
(3, 'Chandigarh', 1),
(4, 'Delhi', 1),
(5, 'Gujarat', 1),
(6, 'Harayana', 1),
(7, 'Jammu & Kashmir', 1),
(8, 'Jharkhand', 1),
(9, 'Karnataka', 1),
(10, 'Kerala', 1),
(11, 'Madhya Pradesh', 1),
(12, 'Maharashtra', 1),
(13, 'Punjab', 1),
(14, 'Rajasthan', 1),
(15, 'Tamil Nadu', 1),
(16, 'Uttar Pradesh', 1),
(17, 'West Bengal', 1),
(18, 'Chhattisgarh', 1);
/*!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 */;
| true |
4b3ae60d7150da8efddd7d9cc143198710d3c322 | SQL | JustinData/GA-WDI-Work | /w03/d04/Instructor/clowns/examples.sql | UTF-8 | 587 | 3.28125 | 3 | [] | no_license | insert into clown_cars (color, capacity) values('blue', 20) returning id;
insert into clowns (name) values ('Bozo');
insert into clowns (name) values ('Pozo');
select clown_cars.color, clowns.* from clown_cars inner join clowns on clowns.clown_car_id = clown_cars.id;
select clown_cars.*, clowns.* from clown_cars left outer join clowns on clowns.clown_car_id = clown_cars.id;
update clowns set clown_car_id = 1 where name='Bozo';
# At capacity
select clown_cars.* from clown_cars where (select count(*) from clowns where clowns.clown_car_id = clown_cars.id) = clown_cars.capacity; | true |
78b8d1c270ce413b8b86ef1292908e6b22ffb713 | SQL | bobzhangwz/zio-dojo | /db/migration/V2__create_todo_table.sql | UTF-8 | 187 | 2.875 | 3 | [] | no_license |
CREATE TABLE todos (
id SERIAL PRIMARY KEY,
orders SMALLINT NOT NULL,
completed BOOLEAN NOT NULL DEFAULT false,
url varchar(1024)
);
CREATE INDEX order_index ON todos (orders);
| true |
fcebbbdf991339a1ba6a59d57c24c67146a5a612 | SQL | nikhilbhatewara/Leetcode | /Tournament Winners.sql | UTF-8 | 719 | 4.28125 | 4 | [
"MIT"
] | permissive | # Write your MySQL query statement below
/*
Assign group to each player
split the table between first and second player
for each group, create a dense rank based on total score
select palyer with rank = 1
*/
with pgroups as (
select b.group_id, b.player_id,a.first_score as score
from matches a
join players b
on a.first_player = b.player_id
union all
select b.group_id, b.player_id,a.second_score as score
from matches a
join players b
on a.second_player = b.player_id
)
, CTE2 as (
select group_id,player_id,score, dense_rank() over (partition by group_id order by sum(score) desc,player_id asc) scorerank
from pgroups
group by group_id,player_id
)
select group_id,player_id
from CTE2
where scorerank = 1
| true |
14ad07f42658d04c99b46a94d02e9af5f25f5a66 | SQL | robgalicia/katsa_php | /Database/Tablas/CATEGORIA.sql | UTF-8 | 484 | 2.84375 | 3 | [] | no_license | drop table if exists categoria;
/*==============================================================*/
/* Table: categoria */
/*==============================================================*/
create table categoria
(
idcategoria smallint not null auto_increment,
desccategoria varchar(50) not null,
quien varchar(15) not null,
cuando datetime not null,
primary key (idcategoria)
);
| true |
a2cda92196b2656db17edc944ea6e736fa29b9fd | SQL | luanchezan/DataAnalystPortfolio | /Query Report - Reporte de Consultas.sql | UTF-8 | 7,418 | 4.34375 | 4 | [] | no_license | -- First 20 rows
-- Primeras 20 filas de la base de datos
SELECT *
FROM "Covid"."covid-deaths"
LIMIT 20;
-- locations disregarding whole continents and the whole world
-- Locaciones sin tomar en cuenta continentes y todo el mundo
Select *
From "Covid"."covid-deaths"
Where continent NOT LIKE ''
Order By 1,3;
-- locations containing whole continents' data but disregarding the whole world's data
-- Locaciones solo de datos de continentes sin tomar en cuenta datos de todo el mundo
Select *
From "Covid"."covid-deaths"
Where continent LIKE ''
AND location NOT LIKE 'World'
Order By 3 DESC;
-- locations containing the whole world's data only
-- Locaciones solo de datos de todo el mundo
Select *
From "Covid"."covid-deaths"
WHERE location LIKE 'World'
Order By 3 DESC;
-- Select data that we are going to be starting with ordered by location and date
-- Seleccionando los datos más relevantes ordenado por locación y fecha
Select location, datetime, total_cases, new_cases, total_deaths, population
From "Covid"."covid-deaths"
Where continent NOT LIKE ''
Order By 1,2;
-- Total Cases vs Total Deaths
-- Total de casos vs Total de muertes
-- Shows likelihood of dying if you contract Covid in US
-- Muestra la probabilidad de morir si se contrae Covid en EEUU
Select location, datetime, total_cases,total_deaths, (cast(total_deaths as float)/total_cases)*100 as DeathPercentage
From "Covid"."covid-deaths"
Where total_deaths not like ''
And total_cases > 0
And location like 'United States'
Order By datetime;
-- Shows likelihood of dying if you contract Covid in Colombia
-- Muestra la probabilidad de morir si se contrae Covid en Colombia
Select location, datetime, total_cases,total_deaths, (cast(total_deaths as float)/total_cases)*100 as DeathPercentage
From "Covid"."covid-deaths"
Where total_deaths not like ''
And total_cases > 0
And location like 'Colombia'
Order By datetime;
-- Total Cases vs Population
-- Total de casos vs Población
-- Shows what percentage of population infected with Covid in the US and Colombia
-- Muestra el porcentajde población que ha contraído Covid en EEUU y Colombia
Select location, datetime, population, total_cases,
(cast(total_cases as float)/population)*100 as PercentPopulationInfected
From "Covid"."covid-deaths"
Where population > 0
And location like '%States'
Or location like 'Colombia'
Order By 1,2;
-- Countries with Highest Infection Rate compared to Population
-- Países con la tasa de infección más alta por población
Select location, Population, MAX(total_cases) as HighestInfectionCount,
Max((Cast(total_cases as float)/population))*100 as PercentPopulationInfected
From "Covid"."covid-deaths"
Where population > 0
-- Where location like '%States'
-- Where location like 'Colombia'
Group by location, Population
Order By HighestInfectionCount Desc, PercentPopulationInfected Desc;
-- Countries with Highest Death Count per Population
-- Países con la tasa de mortalidad más alta por población
Select location, MAX(cast(total_deaths as int)) as TotalDeathCount
From "Covid"."covid-deaths"
-- Where location like '%States'
-- Where location like 'Colombia'
Where population > 0
And total_deaths Not Like ''
And continent Is Not null
Group by location
Order By TotalDeathCount Desc;
-- BREAKING THINGS DOWN BY CONTINENT
-- MOSTRANDO DATA DE CONTINENTES ENTEROS
-- Showing contintents with the highest death count per population
-- Mostrando continentes con el número mas alto por población
Select location as Continent, MAX(Cast(Total_deaths As int)) As TotalDeathCount
From "Covid"."covid-deaths"
-- Where location like '%states%'
-- Where location like 'Colombia'
Where continent Like ''
And total_deaths Not Like ''
Group by location
Order By TotalDeathCount Desc;
-- GLOBAL NUMBERS
-- CIFRAS GLOBALES
Select SUM(new_cases) as total_cases, SUM(cast(new_deaths as int)) as total_deaths, SUM(cast(new_deaths as float))/SUM(New_Cases)*100 as DeathPercentage
From "Covid"."covid-deaths"
-- Where location like 'States%'
-- Where location like 'Colombia'
where continent Not Like ''
And total_deaths Not Like ''
And new_deaths Not Like ''
--Group By datetime
Order By 1,2
-- Elderly people are more likely to die from Covid so life expectancy probably needs to be recalculated
-- Personas ancianas tienen más probabilidades de morir de Covid por lo
-- que la esperanza de vida probablemente deba ser recalculada
Select continent, location, population, MAX(life_expectancy) as HighestLifeExpectancy
From "Covid"."covid-deaths"
Where population > 0
-- Where location like '%States'
-- Where location like 'Colombia'
Group by continent, location, population
Order By HighestLifeExpectancy Desc;
-- Total Population vs Vaccinations
-- Población total vs Vacunados
-- Shows Percentage of Population that has recieved at least one Covid Vaccine
-- Muestra el porcentaje de la población que ha recibido la vacuna del Covid
Select dea.continent, dea.location, dea.datetime, dea.population, vac.new_vaccinations,
SUM(vac.new_vaccinations::integer)
OVER (Partition by dea.Location Order by dea.location, dea.datetime) as RollingPeopleVaccinated
--, (RollingPeopleVaccinated/population)*100
From "Covid"."covid-deaths" dea
Join "Covid"."covid-vaccinated" vac
On dea.location = vac.location
and dea.datetime = vac.datetime
where dea.continent Not Like ''
And vac.new_vaccinations Not Like ''
order by 2,3
-- Using CTE to perform Calculation on Partition By in previous query
-- Usando CTE para calcular sobre la partición de la consuolta anterior
With PopvsVac (Continent, Location, Date, Population, New_Vaccinations, RollingPeopleVaccinated)
as
(
Select dea.continent, dea.location, dea.datetime, dea.population, vac.new_vaccinations,
SUM(vac.new_vaccinations::float)
OVER (Partition by dea.Location Order by dea.location, dea.datetime) as RollingPeopleVaccinated
--, (RollingPeopleVaccinated/population)*100
From "Covid"."covid-deaths" dea
Join "Covid"."covid-vaccinated" vac
On dea.location = vac.location
And dea.datetime = vac.datetime
where dea.continent Not Like ''
And vac.new_vaccinations Not Like ''
)
Select *, (RollingPeopleVaccinated/population)*100 As PercentagePeopleVaccinated
From PopvsVac
where population > 0
-- Creating View to store data of daily deceased population according to the daily death count´s statitics
-- Creando Vista para almacenar datos de la población que ha fallecido en la estadística de personas fallecidas
Create View "Covid".RollingDeathPeople as
Select continent, location, datetime, population, new_deaths, SUM(new_deaths::integer)
OVER (Partition by Location Order by location, datetime) As RollingPeopleVaccinated
From "Covid"."covid-deaths"
where continent Not Like ''
And new_deaths::integer > 0
-- Creating View to store data of daily vaccinated population
-- Creando Vista para almacenar datos de la población vacunada a diario
Create View "Covid".PercentPopulationVaccinated as
Select dea.continent, dea.location, dea.datetime, dea.population, vac.new_vaccinations,
SUM(vac.new_vaccinations::float)
OVER (Partition by dea.Location Order by dea.location, dea.datetime) As RollingPeopleVaccinated
--, (RollingPeopleVaccinated/population)*100
From "Covid"."covid-deaths" dea
Join "Covid"."covid-vaccinated" vac
On dea.location = vac.location
And dea.datetime = vac.datetime
where dea.continent Not Like ''
And vac.new_vaccinations Not Like ''
| true |
b65358a639b8b7861a8886b4ba090ea5dd48e139 | SQL | emipy/DB | /carrosd.sql | UTF-8 | 2,579 | 3.28125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 16-Out-2020 às 04:06
-- Versão do servidor: 10.4.13-MariaDB
-- versão do PHP: 7.4.8
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 */;
--
-- Banco de dados: `carrosd`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `marca`
--
CREATE TABLE `marca` (
`codigo` int(11) NOT NULL,
`nome` varchar(30) NOT NULL,
`pais` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Extraindo dados da tabela `marca`
--
INSERT INTO `marca` (`codigo`, `nome`, `pais`) VALUES
(1, 'Volkswagen', 'Alemanha'),
(2, 'Ford', 'EUA'),
(3, 'Fiat', 'Italia'),
(4, 'GM', 'EUA');
-- --------------------------------------------------------
--
-- Estrutura da tabela `modelo`
--
CREATE TABLE `modelo` (
`codigo` int(11) NOT NULL,
`nome` varchar(30) NOT NULL,
`categoria` varchar(30) NOT NULL,
`cor` varchar(30) NOT NULL,
`codigo_marca` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Extraindo dados da tabela `modelo`
--
INSERT INTO `modelo` (`codigo`, `nome`, `categoria`, `cor`, `codigo_marca`) VALUES
(1, 'Gol', 'Hatch', 'preto', 1),
(2, 'Palio', 'Hatch', 'vermelho', 3),
(3, 'Ecosport', 'SUV', 'azul', 2),
(4, 'Fox', 'Familia', 'cinza', 1);
--
-- Índices para tabelas despejadas
--
--
-- Índices para tabela `marca`
--
ALTER TABLE `marca`
ADD PRIMARY KEY (`codigo`);
--
-- Índices para tabela `modelo`
--
ALTER TABLE `modelo`
ADD PRIMARY KEY (`codigo`),
ADD KEY `FK_marca` (`codigo_marca`);
--
-- AUTO_INCREMENT de tabelas despejadas
--
--
-- AUTO_INCREMENT de tabela `marca`
--
ALTER TABLE `marca`
MODIFY `codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de tabela `modelo`
--
ALTER TABLE `modelo`
MODIFY `codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Restrições para despejos de tabelas
--
--
-- Limitadores para a tabela `modelo`
--
ALTER TABLE `modelo`
ADD CONSTRAINT `FK_marca` FOREIGN KEY (`codigo_marca`) REFERENCES `marca` (`codigo`);
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 */;
| true |
b6d30a2e736151441c4c1c616f09a13d12b735e6 | SQL | cmog/TechEd2018_DAT364 | /DAT364_SQLexamples/MLLAB_Exercise_1.2.sql | UTF-8 | 9,209 | 3.625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | *******************************************************************************************************************************/
/*** SAP TechEd 2018 - HandsOn session Developing Smart Applications using SAP HANA In-Database Machine Learning ***/
/*** Prepared by Christoph Morgen, SAP SE - 1st August 2018 ***/
/*** Step 1 - Data Preparation *************************************************************************************************/
/*** Scenario objective: Develop a customer churn prediction model using different PAL-classification algorithms ***/
/*** Embed the classification prediction functions into table functions for use within applications. ***/
/*** Given is a data set (analytical base table) CUSTOMER_CHURN_ABT, with insight about each customer ***/
/*** and measure on current, previous month (_PM) and previous-previous month (_PPM) observations. ***/
/*** For CUSTOMER_CHURN_ABT the churn behavior is known (ContractActivity), thus it is used for training ***/
/*** the classification predictive model. ***/
/*** For NEWCUSTOMER_CHURN_ABT_VIEW, the churn behavior is not known, data is from a new or current ***/
/*** month, describing the current customer state. ***/
/*** Exercise objective: Creating the input data views for the predictive modeling process ***/
/*** Select the relevant columns, add further derived column for better predictive modeling results, ... ***/
/*** Furthermore, the input data is split into 3 random sampled partition: ***/
/*** The train-partition is used to train the algorithm for the pattern, the validate-partition is ***/
/*** used to validate against the trained model, tune and re-iterate the algorithm training, in order ***/
/*** to not overfit the model towards the train-partition, is must show good prediction results also ***/
/*** against data not seen in the training, i.e. the validate-partition. ***/
/*** The test-partition is then used to cross-compare different trained algorithm using a neutral ***/
/*** set of data, which yet hasn't been involved in training or model validation. ***/
/*******************************************************************************************************************************/
/*******************************************************************************************************************************/
/*** Step 1a - Create Input views for training the classification algorithm and for the later prediction ***/
/*** Note, it would be common to derive additional calculated columns ***/
/*** CODE-STEP 01 ***/
--SET SCHEMA MLLAB_###;
select * from "MLLAB"."CUSTOMER_CHURN_ABT";
--drop view MLLAB_###.CUSTOMER_CHURN_ABT_VIEW;
CREATE VIEW MLLAB_###.CUSTOMER_CHURN_ABT_VIEW
as select "AccountID", "ServiceType" , "ServiceName", "DataAllowance_MB", "VoiceAllowance_Minutes" , "SMSAllowance_N_Messages" ,
"DataUsage_PCT" , "DataUsage_PCT_PM", "DataUsage_PCT_PPM" ,
"VoiceUsage_PCT" , "VoiceUsage_PCT_PM" , "VoiceUsage_PCT_PPM" ,
"SMSUsage_PCT" , "SMSUsage_PCT_PM" , "SMSUsage_PCT_PPM" ,
"Revenue_Month" , "Revenue_Month_PM", "Revenue_Month_PPM" , "Revenue_Month_PPPM" ,
"ServiceFailureRate_PCT" , "ServiceFailureRate_PCT_PM" , "ServiceFailureRate_PCT_PPM" ,
"CustomerLifetimeValue_USD" , "CustomerLifetimeValue_USD_PM" , "CustomerLifetimeValue_USD_PPM" ,
"Device_Lifetime" , "Device_Lifetime_PM" , "Device_Lifetime_PPM" ,
"ContractActivityLABEL"
from "MLLAB"."CUSTOMER_CHURN_ABT";
select * from MLLAB_###.CUSTOMER_CHURN_ABT_VIEW;
--drop view MLLAB_###.NEWCUSTOMER_CHURN_ABT_VIEW;
CREATE VIEW MLLAB_###.NEWCUSTOMER_CHURN_ABT_VIEW
as select "AccountID", "ServiceType" , "ServiceName", "DataAllowance_MB", "VoiceAllowance_Minutes" , "SMSAllowance_N_Messages" ,
"DataUsage_PCT" , "DataUsage_PCT_PM", "DataUsage_PCT_PPM" ,
"VoiceUsage_PCT" , "VoiceUsage_PCT_PM" , "VoiceUsage_PCT_PPM" ,
"SMSUsage_PCT" , "SMSUsage_PCT_PM" , "SMSUsage_PCT_PPM" ,
"Revenue_Month" , "Revenue_Month_PM", "Revenue_Month_PPM" , "Revenue_Month_PPPM" ,
"ServiceFailureRate_PCT" , "ServiceFailureRate_PCT_PM" , "ServiceFailureRate_PCT_PPM" ,
"CustomerLifetimeValue_USD" , "CustomerLifetimeValue_USD_PM" , "CustomerLifetimeValue_USD_PPM" ,
"Device_Lifetime" , "Device_Lifetime_PM" , "Device_Lifetime_PPM"
from "MLLAB"."NEWCUSTOMER_CHURN_ABT";
select * from MLLAB_###.NEWCUSTOMER_CHURN_ABT_VIEW;
/*******************************************************************************************************************************/
/*** Step 1b - Create TRAIN, VALIDATE, TEST Partition and Views ***/
/*** The training input data shall be split into 3 partitions, using a stratified sampling approach, to ensure equal ***/
/*** proportions of positive labels ***/
/*** Calling the new PAL_PARTITION procedure from _SYS_AFL-Schema to create the Train, Validate and Test-subsets ***/
/*** CODE-STEP 02 ***/
----DROP TABLE #PAL_PARAMETER_TBL;
CREATE LOCAL TEMPORARY COLUMN TABLE #PAL_PARAMETER_TBL (
"PARAM_NAME" VARCHAR (256),
"INT_VALUE" INTEGER,
"DOUBLE_VALUE" DOUBLE,
"STRING_VALUE" VARCHAR (1000)
);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('PARTITION_METHOD',1,null,null); --stratified sample;
INSERT INTO #PAL_PARAMETER_TBL VALUES ('RANDOM_SEED',23,null,null);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('HAS_ID',1,NULL,NULL);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('STRATIFIED_COLUMN',null,null,'ContractActivityLABEL');
INSERT INTO #PAL_PARAMETER_TBL VALUES ('TRAINING_PERCENT', null,0.6,null);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('TESTING_PERCENT', null,0.2,null);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('VALIDATION_PERCENT', null,0.2,null);
--- The actual PAL-procedure call, no wrapper procedure use required anymore.;
--- Firstly, explore the PAL-procedure use and results, without specifying any defined output;
CALL "_SYS_AFL"."PAL_PARTITION"(MLLAB_###.CUSTOMER_CHURN_ABT_VIEW, #PAL_PARAMETER_TBL, ?) ;
--DROP TABLE MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS;
/*** CODE-STEP 03 ***/
--- Now we want to, save the partition output into a table, therefore prepare a table to do so;
CREATE COLUMN TABLE MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS (
"AccountID" INTEGER,
"PARTITION_TYPE" INTEGER
);
CALL "_SYS_AFL"."PAL_PARTITION"(MLLAB_###.CUSTOMER_CHURN_ABT_VIEW, #PAL_PARAMETER_TBL, MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS) with overview ;
select count(*), "PARTITION_TYPE" from MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS group by "PARTITION_TYPE";
select count(*), P."PARTITION_TYPE", D."ContractActivityLABEL"
from MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS as P, MLLAB_###.CUSTOMER_CHURN_ABT_VIEW as D
where P."AccountID"=D."AccountID"
group by "PARTITION_TYPE", D."ContractActivityLABEL" ;
/*** CODE-STEP 04 ***/
--- Finally, we join the partition information based on the AccountID back with the original training input view, to get 3 subset views with the train-, validate- and test-subsets;
Create View MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_TRAINSAMPLE
as select C.* from MLLAB_###.CUSTOMER_CHURN_ABT_VIEW as C, MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS as P
where C."AccountID"=P."AccountID" and P."PARTITION_TYPE"=1;
select count(*), "ContractActivityLABEL" from MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_TRAINSAMPLE group by "ContractActivityLABEL";
Create View MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_VALSAMPLE
as select C.* from MLLAB_###.CUSTOMER_CHURN_ABT_VIEW as C, MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS as P
where C."AccountID"=P."AccountID" and P."PARTITION_TYPE"=3;
select count(*), "ContractActivityLABEL" from MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_VALSAMPLE group by "ContractActivityLABEL";
Create View MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_TESTSAMPLE
as select C.* from MLLAB_###.CUSTOMER_CHURN_ABT_VIEW as C, MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS as P
where C."AccountID"=P."AccountID" and P."PARTITION_TYPE"=2;
select count(*), "ContractActivityLABEL" from MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_TESTSAMPLE group by "ContractActivityLABEL";
/*** Results: ***/
--- MLLAB_###.CUSTOMER_CHURN_ABT_VIEW;
--- MLLAB_###.NEWCUSTOMER_CHURN_ABT_VIEW;;
--- MLLAB_###.CUSTOMER_CHURN_ABT_PARTITIONS;
--- MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_TRAINSAMPLE;
--- MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_VALSAMPLE;
--- MLLAB_###.CUSTOMER_CHURN_ABT_VIEW_TESTSAMPLE;
| true |
03045b3c56a38d554446cbca8296264d24d9f6cf | SQL | carget/CarGet | /sql/ddl.sql | UTF-8 | 2,481 | 3.609375 | 4 | [] | no_license | CREATE TABLE brands
(
brand_id INT(11) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT,
brand_name VARCHAR(25) NOT NULL,
brand_full_name VARCHAR(60) NOT NULL
);
CREATE UNIQUE INDEX brands_brand_id_uindex ON brands (brand_id);
CREATE TABLE cars
(
car_id INT(11) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT,
model_id INT(11) unsigned NOT NULL,
price_day DECIMAL(10) DEFAULT '777' NOT NULL,
fuel_type INT(1) DEFAULT '0' NOT NULL,
year INT(11) DEFAULT '2008' NOT NULL,
CONSTRAINT cars_models_fk FOREIGN KEY (model_id) REFERENCES models (model_id) ON UPDATE CASCADE
);
CREATE UNIQUE INDEX cars_car_id_uindex ON cars (car_id);
CREATE INDEX cars_models_fk_idx ON cars (model_id);
CREATE TABLE models
(
model_id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT,
brand_id INT(10) unsigned NOT NULL,
class_name CHAR(1) DEFAULT 'B' NOT NULL,
model_name VARCHAR(45) NOT NULL,
doors_qty INT(10) unsigned DEFAULT '4' NOT NULL,
automat TINYINT(4) DEFAULT '0' NOT NULL,
power DOUBLE UNSIGNED DEFAULT '100' NOT NULL,
conditioning TINYINT(4) DEFAULT '0' NOT NULL,
img VARCHAR(255),
CONSTRAINT models_brands_fk FOREIGN KEY (brand_id) REFERENCES brands (brand_id) ON UPDATE CASCADE
);
CREATE INDEX models_brands_fk_idx ON models (brand_id);
CREATE UNIQUE INDEX model_id_UNIQUE ON models (model_id);
CREATE TABLE orders
(
order_id INT(11) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT,
user_id INT(11) unsigned NOT NULL,
car_id INT(11) unsigned NOT NULL,
date_start DATE NOT NULL,
date_end DATE NOT NULL,
comment VARCHAR(60),
rent DECIMAL(18,2) DEFAULT '0.00',
fine DECIMAL(18,2) DEFAULT '0.00',
status INT(1) NOT NULL,
CONSTRAINT orders_users_fk FOREIGN KEY (user_id) REFERENCES users (user_id) ON UPDATE CASCADE,
CONSTRAINT orders_cars_fk FOREIGN KEY (car_id) REFERENCES cars (car_id) ON UPDATE CASCADE
);
CREATE INDEX orders_users_fk ON orders (user_id);
CREATE INDEX order_car_fk_idx ON orders (car_id);
CREATE UNIQUE INDEX order_id_UNIQUE ON orders (order_id);
CREATE TABLE users
(
user_id INT(11) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
password VARCHAR(30) NOT NULL,
passport VARCHAR(45),
email VARCHAR(60) NOT NULL,
is_admin TINYINT(4) DEFAULT '0' NOT NULL
);
CREATE UNIQUE INDEX users_email_uindex ON users (email);
CREATE UNIQUE INDEX users_id_uindex ON users (user_id);
| true |
506183f50710cc4f79a45314bb78bbc413fd017c | SQL | myoshimu/bigquery-ml-templates | /conversion_prediction_binary_classification_sql/total_timeOnScreen_month3_calculation.sql | UTF-8 | 951 | 3.515625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | /*
Copyright 2019 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
SELECT
GA360.User_ID,
SUM(timeOnScreen) Total_timeOnScreen
FROM
`caramel-howl-182418.ConversionPrediction_BinaryClassification.GA360` GA360,
`caramel-howl-182418.ConversionPrediction_BinaryClassification.First_Activity` First_Activity
WHERE
GA360.User_ID = First_Activity.User_ID
AND DATE_DIFF(GA360.Activity_Date, First_Activity.Activity_Date, month) = 3
GROUP BY
GA360.User_ID | true |
35d5f48491b9d5619d5f0f0a6e9074bfe8812513 | SQL | brentgroves/bpgsql | /CM/ItemLocationDiff.sql | UTF-8 | 11,736 | 2.875 | 3 | [] | no_license | -- DO drops later in case you spot an error somewhere else in the process
-- I messed up and called 1223 files 1213.
select *
into station022621
from STATION
select count(*) cnt from station022621
-- 12677 02/26
-- 12677 02/22
-- 12677 02/15
-- 12677 02/08
-- 12677 02/01
-- 12677 01/27
-- 12679 01/04
-- 12679 12/21
-- 12679 12/14
-- 12679 12/08
-- 12679 11/30
-- 12679 11/20
-- 12679 11/16
-- 12679 11/03
-- 12679 10/26
-- 12679 10/19
-- 12679 10/12
--12679 10/05
--12679 10/01
--12679 09/28
--12679 09/21
--12679 09/14
--12679 09/08
--12679 09/01
--12679 08/17
--12679 07/20
--12679 07/13
--12677 07/01
--12677 06/30
--12677 06/22
--12676 --06/15
--12676 --06/09
--12676 --06/02
--12676
--12676
--12676 --05/18
--12680
--12681
--12682
--12679
--12696
--12696
--12695
--12695
--12674
--12674
--12673
--12677
--12676
--12673
--12675
--12674
--12668
--12666
--12660
--12653
--12624
--verify backup of station
select top 100 * from station022621
-- Upload the item_location table into PlxSupplyItemLocation table.
CREATE TABLE Cribmaster.dbo.PlxSupplyItemLocation022621 (
item_no varchar(50),
location varchar(50),
quantity integer
)
-- Insert Plex item_location data into CM
Bulk insert PlxSupplyItemLocation022621
from 'c:\il0226GT12500.csv'
with
(
fieldterminator = ',',
rowterminator = '\n'
)
select
count(*)
-- top 1000 *
from PlxSupplyItemLocation022621
-- Check for duplicates
select count(*)
from
(
select distinct item_no,location from PlxSupplyItemLocation022621
)s1
-- 14873 02/26
-- 14861 02/22
-- 14876 02/15
-- 14888 02/08
-- 14895 02/01
-- 14851 01/27
-- 14704 01/04
-- 14668 12/21
-- 14652 12/14
-- 14652 12/08
-- 14648 11/30
-- 14652 11/20
-- 14649 11/16
-- 14,613 11/03
-- 14,605 10/26
-- 14595 10/19
-- 14590 10/12
-- 14583 10/05
-- 14570 10/01
-- 14547 09/28
-- 14487 09/21
-- 14547 09/14
-- 14685 09/08
-- 14634 09/01
-- 14426 08/17
-- 14146 07/20
-- 14114 07/13
-- 14036 07/01
-- 14016 06/30
-- 14007 06/22
-- 13991 06/15
-- 13991 06/09
-- 13990 06/02
-- 13990 06/01
--,13990
--13992 --05/18
/*
* Item locations in plex but not in CM: 2563
* Plex Item locations not in CM not having location '01-002A01': 22
* Plex '01-002A01' Item locations with quantity = 0: 2534
* Plex '01-002A01' Item locations with quantity <> 0: 7
*/
select
il.item_no
--il.item_no,il.location,il.quantity
into nic022621 --Plex supply items with the default location and a quantity = 0
-- count(*)
-- 4196 02/26/21
-- 4193 02/22/21
-- 4001 02/08/21
-- 3919 02/01/21
-- 3836 01/04
-- 3820 12/21
-- 3802 12/14
-- 3807 12/08
-- 3807 11/30
-- 3814 11/20
-- 3821 11/16
-- 3788 11/03
-- 3783 10/26
-- 3782 10/19
-- 3779 10/12
-- 3779 10/01
--3783 10/01
--3773 09/28
--3714 09/21
--3685 09/09
-- 3678 09/08
--3628 09/01
--3460 08/17
--3301 07/20
--3214 07/01
--3211 06/30
--3206 06/22
--3192 06-15
--3194 06/09
--3196 06/02
-- 3196 05/26, 3197 05/18
--2615,2614,2591,2590,2591,2595,2585,2580,2578,2581,2578,2578,2577,2581,2563,2563,2563,2562,2561,236
--il.item_no,inv.ItemClass,inv.Description1,il.location,il.quantity as PlexQuantity,st.BinQuantity as CribMasterQty,st.Quantity as CMQuantity
from (
select --distinct incase I inserted items more than once
distinct item_no,location,quantity
from PlxSupplyItemLocation022621
) il
left outer join STATION st
on il.location=st.CribBin
and il.item_no=st.Item
--13291 0726 13193 --0628 13206
left outer join INVENTRY inv
on il.item_no=inv.ItemNumber
where st.CribBin is null
and il.location='01-002A01'
and il.quantity = 0
--and il.location<>'01-002A01'
--and il.quantity is null
--and il.quantity = 0
--and il.quantity <> 0
select COUNT(*)
from nic022621
-- 4196 02/26
-- 4193 02/22
-- 4076 02/15
-- 4001 02/08
-- 3919 02/01
-- 3881 01/27
-- 3836 01/04
-- 3820 12/21
-- 3802 12/14
-- 3807 12/08
-- 3807 11/30
-- 3814 11/20
-- 3821 11/16
-- 3788 11/03
-- 3783 10/26
-- 3782 10/19
-- 3779 10/05
--3779 10/05
--3783 10/01
--3771 09/28
--3714 09/21
--3685 09/14
-- 3678 09/08
--3628 09/01
--3460 08/17
--3301 07/20
--3271 07/13
--3114 07/01
--3211 06/30
--3206 06/22
--3192 06/15
--3194 06/09
--3196 06/02
--3196 06/01
--3196 05/26
--3197 05/18
--2611 05/11
--2615 --03/24??
--2614
--2591
--2590
--2591
--2595
--2585
--2580
--2578
--2581
--2578
--2578
--2577
--2581
--2563
--2563
--2562
--2561
--2562
--2560
--2553
--2554
--2551
--2550
--2541
/*
* Set CM item stations with Plex Supply Item Locations = '01-002A01' and a quantity = 0
* equal to 0.
* There are only 1965 of these items in CM.
*/
--update STATION
set BinQuantity = 0,
Quantity = 0
--select
-- count(*) cnt
-- 11/20 9
-- 10/26 11
--10/01 11
--09/08 11
--07/02 14
--05/18 11 items
--05/11 11 items,
-- item,st.BinQuantity,st.Quantity
from STATION st
where
item in
(
select item_no
from nic022621
)
and (st.BinQuantity<>0 or st.Quantity <> 0 )
-- 11 02/26/21
-- 47 02/22/21
-- 63 02/15/21
-- 72 02/08/21
-- 12 02/01/21
-- 10 01/27/21
-- 9 01/04/21
-- 9 12/21/20
-- 9 12/14/20
-- 9 12/08/20
-- 9 11/30/20
-- 9 11/20/20
-- 10 11/16/20
-- 11 11/03/20
-- 11 10/26/20
-- 11 10/19/20
-- 13 10/12/20
-- 11 10/05/20
-- 11 10/01/20
-- 11 09/28/20
-- 11 09/21/20
-- 11 09/14/20
-- 11 09/08/20
-- 11 09/01/20
-- 11 08/17/20
-- 9 07/20/20
-- 9 07/13/20
-- 12 06/30
-- 12 06/22
-- 11 06/15
-- 11 06/09
-- 11 06/02
-- 11 06/01
--05/26 11 more
-- 05/18
-- 05/11 = 11
-- 03/24?? 12,11,12,14,19,14,13,12,11,12,12,12, 12, 12,12,12,13,13,15,12,13,12, 10, 8,9,10
-- and (st.BinQuantity=0 and st.Quantity = 0 ) --1919,1960,1963
--Join these 2 tables on item number and location.
--Set the station table’s quantity equal to PlxItemLocation.quantity value.
-- update STATION
set BinQuantity = il.quantity,
Quantity = il.quantity
--select
--il.item_no
--il.item_no,il.location,il.quantity
-- count(*)
from (
select --distinct incase I inserted items more than once
distinct item_no,location,quantity
from PlxSupplyItemLocation022621
) il
inner join STATION st
on il.location=st.CribBin
and il.item_no=st.Item
--0729=10630, 0726=10630, --0628=11285
where
-- il.quantity <> st.BinQuantity -- 162 02/26/21, 169 02/22/21,164 02/15/21,201, 02/01,155 02/01/21,918 01/27/21, 472 01/04/21,238 12/21,799 12/14, 529 12/08,213 11/30 252 11/20,255 11/16,447 11/03, 346 10/26,288 10/19,242 10/12,130 10/05, 247 10/01, 267 09/28, 291, 09/21,184 09/14,212 09/08, 581 09/01,158 08/17,261 07/20, 246 07/13, 386 07/01,309 06/30, 179 06/15,06/09 333,06/02 89,06/01 126, --05/26=115,05/18=172,340,334,351,381,421,375,304,409,312, 213,177,1330,1319,510,293,376,416,417,472, 342,353, 455,406,384
-- il.quantity > st.BinQuantity -- 50 02/26/21,74 02/22/21,57 02/15/21,50 02/01/21,57 02/01/21 57, 536 01/27, 267 01/04 82 12/21,393 12/08,198 12/08,86 11/30, 93/11/20,143 11/16,194 11/03,200 10/26,135 10/19,93 10/12,89 10/05,112 10/01,142 09/21,74 09/14,77 09/08, 211 09/01,48 08/17,50 07/20, 148 07/01,112 06/30,60 06/22,43 06/15,145 06/09,12 06/02,58 06/01 05/26=40,05/18=84,120,143,107,95,154,149,122, 124, 124,77,51, 492,538,134,140,171,172,177,120,138,131,61
-- il.quantity < st.BinQuantity -- 112 02/26/21,95 02/22/21, 107 02/15/21,151 02/08/21, 98 02/01/21 98,382 01/27/21,205 01/04/21,156 12/21,406 12/14,331 12/08,127 11/30,159 11/20, 112 11/16,253 11/03, 146 10/26, 153 10/19,149 10/12, 41 10/05,135 10/01,125 09/28,167 09/21,110 09/14,135 09/11, 370 09/01,110 08/17/20,211 07/20,173 07/13,238 07/01, 197 06/30,190 06/22,136 06/15,188 06/09, 77 06/02 --68 06/01--05/26=75,05/18=88,220,191,244,286,267,226,182,285,188,136,126,838,781,376,168,236,245,245,295,222,311,215, 316,275,105
--80 more items dropped in quantity 0820
--385
--0813=389
--0806=272
--0801=181
--0729=183
-- DROP OLD TABLES
--drop table PlxSupplyItemLocation022221
--drop table station022221
--drop table nic022221
select * from nic101920
/*
* TESTING
*/
-- Don't know why 0418/0411 don't have as many blank locations
select
--s0518.*
-- s0203.*
count(*)
from PlxSupplyItemLocation0518 s0518
full join dbo.PlxSupplyItemLocation0203 s0203
on s0518.item_no=s0203.item_no
and s0518.location=s0203.location
where s0203.item_no is NULL
and s0518.location = '01-002A01' --625
where s0518.item_no is NULL
and s0203.location = '01-002A01' -- 6
--update purchasing.dbo.item set Description=Brief_Description + ', ' + Description where Brief_Description <> Description
-- Verify table was created and has zero records
--drop table PlxSupplyItemLocation1125
select count(*) from PlxSupplyItemLocation0518 --
select count(*)
from
(
select distinct item_no,location from PlxSupplyItemLocation0518
)s1 --13992 --05/18
--top 1000 *
-- Don't know why 0418/0411 don't have as many blank locations
select count(*) from PlxSupplyItemLocation0518 where location = '01-002A01' --3217
select count(*) from PlxSupplyItemLocation0418 where location = '01-002A01' --95
select count(*) from PlxSupplyItemLocation0411 where location = '01-002A01' --1
select count(*) from PlxSupplyItemLocation0203 where location = '01-002A01' --1 --2617
SELECT count(*) from nic0511 --2611
/*
* Between 05-11 and 05-18 it looks like there have been 587 items that have had all of
* their item_location removed from Plex. Since we regularly only remove about 12 items per week
* it made me wonder what was going on. So I verified that there were no bin locations for these items in CM.
* None of the 587 items had a bin location in CM so everything should be ok with this large update.
*/
select
nic0526.item_no
into rm0518
-- nic0518.*
-- count(*) --587
from nic0518 --3197
left outer join nic0511
on nic0518.item_no=nic0511.item_no
where nic0511.item_no is null
SELECT count(*)
from nic0526
--3197 05/18
--2611 05/11
--Bev Rathburn updated on 05/14/20
--16704
--Farkas, Justin --05/13/20
select count(*) from rm0518 --587
select
*
from rm0518 rm
inner join station st
on rm.item_no=item
where st.BinQuantity <> 0
or st.quantity <> 0
--05/18 -- 0
select
--itemnumber
count(*)
from dbo.nic0518 nic
inner join inventry inv
on nic.item_no=inv.ItemNumber --3168
inner join station st
on nic.item_no=st.item --1864
/*
*
* Plex and CM Item location Differences
* CM item locations not in Plex with a quantity <> 0: 10
* Plex Item locations not in CM not having location '01-002A01': 22
* Plex '01-002A01' Item locations with quantity <> 0: 7
*
*/
/*
* Plex 'BPG Central Stores' Item Location not in CM: 2563
* Plex Item locations not in CM not having location '01-002A01': 22
* Plex '01-002A01' Item locations with quantity = 0: 2534
* Plex '01-002A01' Item locations with quantity <> 0: 7
*
*
*/
select * from dbo.INVENTRY
where
ItemNumber in
('16718','16772','16647','16166','0004235')
select item,quantity,received
FROM PODetail
where item in ('16718','16772','16647','16166','0004235')
ItemNumber like '%16718%'
select
il.item_no,il.location,il.quantity
--count(*)
from (
select --distinct incase I inserted items more than once
distinct item_no,location,quantity
--COUNT(*)
from PlxSupplyItemLocation0729
) il
left outer join STATION st
on il.location=st.CribBin
and il.item_no=st.Item
where
st.CribBin is NULL
and il.location <> '01-002A01'
and il.quantity <> 0
/*
* CM item locations not in Plex: 63
* CM item locations not in Plex with a quantity <> 0: 10
* We are expecting the nic0729 records to not be in plex because there locations have been removed
*
*/
select
st.Item,st.CribBin,st.BinQuantity
--count(*)cnt
from STATION st
left outer join PlxSupplyItemLocation0729 il --there are no dups in this table
on st.CribBin=il.location
and st.Item=il.item_no
where il.item_no is null --2023
and st.Item not in
(
select item_no from nic0729
) --63
and st.BinQuantity <> 0 | true |
62c2a9bb6e0421f47c3bb4bd5889a9dcf0dc57f5 | SQL | mehmetefeerkan/fivemScriptDB | /esx/Brn_Log/data.sql | UTF-8 | 1,045 | 3.03125 | 3 | [] | no_license | CREATE TABLE `cylex_give_money` (
`Gonderen` VARCHAR(50) NULL DEFAULT NULL,
`Tip` VARCHAR(50) NULL DEFAULT NULL,
`Sayi` INT(11) NULL DEFAULT NULL,
`Alici` VARCHAR(50) NULL DEFAULT NULL,
`Zaman` TIMESTAMP NULL DEFAULT current_timestamp()
)
COMMENT='ESYA, PARA VERME LOGLARI'
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
CREATE TABLE `cylex_give` (
`Veren` VARCHAR(50) NULL DEFAULT NULL,
`Tip` VARCHAR(50) NULL DEFAULT NULL,
`Sayi` INT(25) NULL DEFAULT NULL,
`Item` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_turkish_ci',
`Alici` VARCHAR(50) NULL DEFAULT NULL,
`Zaman` TIMESTAMP NULL DEFAULT current_timestamp()
)
COMMENT='EŞYA, PARA VERME LOGLARI'
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
CREATE TABLE `cylex_drop` (
`Atan` VARCHAR(50) NULL DEFAULT NULL,
`Tip` VARCHAR(50) NULL DEFAULT NULL,
`Item` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_turkish_ci',
`Sayi` BIGINT(50) NULL DEFAULT NULL,
`Zaman` TIMESTAMP NULL DEFAULT current_timestamp()
)
COMMENT='YERE ATMA LOGLARI'
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
| true |
d7a6278a5d948d4b5645df6e2e8d04e638a9b9d5 | SQL | mahmutemrahsari/informatics | /IN2090/Oblig 3/sarime_oblig3.sql | UTF-8 | 1,926 | 3.84375 | 4 | [] | no_license | --Oblig 3
--sarime
--Oppgave 2
--a)
select * from timelistelinje
where timelistenr=3;
--b)
select count(*) from timelistelinje;
--c)
select count(*) from timelistelinje INNER JOIN timeliste on timeliste.timelistenr = timelistelinje.timelistenr
where timeliste.status = 'utbetalt';
--her jeg brukte inner join for aa join tabellene
--d)
select timeliste.status, count(*) as counted
from timelistelinje, timeliste
where timeliste.timelistenr = timelistelinje.timelistenr
group by timeliste.status;
--e)
select count(*) as antall, (select count(*) from timelistelinje where pause is not null) as antallmedpause
from timelistelinje;
--f)
select count(timelistenr) from timelistelinje
where pause is null;
--Oppgave 3
--a)
select sum(varighet.varighet)/60 as antalltime from varighet, timeliste
where timeliste.timelistenr=varighet.timelistenr
and timeliste.status <> 'utbetalt';
--b)
select timelistenr, beskrivelse from timelistelinje
where beskrivelse like '%test%' or beskrivelse like '%Test%';
--c)
select timelistelinje.timelistenr, timelistelinje.linjenr, varighet.varighet, timelistelinje.beskrivelse
from timelistelinje, varighet
where timelistelinje.timelistenr = varighet.timelistenr
order by varighet.varighet desc
limit 5 --Tar bare foerste 5 linjene
--d)
select timeliste.timelistenr, count(timelistelinje.timelistenr) as antall
from timeliste left join timelistelinje on timeliste.timelistenr = timelistelinje.timelistenr
group by timeliste.timelistenr
order by timeliste.timelistenr asc;
--e)
select sum(varighet.varighet)/60*200 as utbetaltpenger from varighet, timeliste
where timeliste.timelistenr=varighet.timelistenr
and timeliste.status <> 'utbetalt';
--f)
select timelistelinje.timelistenr, count(timelistelinje.timelistenr) as antall
from timelistelinje
where pause is null
group by timelistelinje.timelistenr
having count(timelistelinje.timelistenr) >=4
order by antall;
| true |
7120790d5382332be14a93266d4e8c33899e0f68 | SQL | WackoBeast/ConnHealth | /ConnHealthDB/connhealth_database.sql | UTF-8 | 20,484 | 2.96875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 18, 2019 at 12:05 AM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.3.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: `connhealth database`
--
-- --------------------------------------------------------
--
-- Table structure for table `angajati`
--
CREATE TABLE `angajati` (
`ID` int(11) NOT NULL,
`nume` varchar(40) NOT NULL,
`data_nastere` date NOT NULL,
`adresa_fizica` varchar(70) NOT NULL,
`telefon` varchar(20) NOT NULL,
`adresa_mail` varchar(40) NOT NULL,
`nr_contract` int(11) NOT NULL,
`tip_angajat` int(40) NOT NULL,
`salariu` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `angajati_tipmedic_specializarimedicale_competentemedicale`
--
CREATE TABLE `angajati_tipmedic_specializarimedicale_competentemedicale` (
`ID` int(11) NOT NULL,
`AngajatID` int(11) NOT NULL,
`tip_medic` int(11) NOT NULL,
`specializareMedicalaID` int(11) NOT NULL,
`competenteMedicaleID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `angajat_tipasistent_tipspecializareasistent`
--
CREATE TABLE `angajat_tipasistent_tipspecializareasistent` (
`ID` int(11) NOT NULL,
`ID_AST` int(11) NOT NULL,
`ID_SPC` int(11) NOT NULL,
`AngajatID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `competente_medicale`
--
CREATE TABLE `competente_medicale` (
`ID` int(11) NOT NULL,
`nume` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `competente_medicale`
--
INSERT INTO `competente_medicale` (`ID`, `nume`) VALUES
(1, 'anestezie-terapie intensiva'),
(8, 'aparate gipsate'),
(10, 'competente generale'),
(16, 'computer tomograf'),
(5, 'diabet si dietetica'),
(13, 'dializa pediatrica'),
(3, 'explorari functionale'),
(18, 'igiena alimentara'),
(6, 'instrumentara (sala de operatie)'),
(7, 'medicina muncii din intreprinderi'),
(14, 'medicina nucleara'),
(11, 'neonatologie'),
(12, 'planificare familiala'),
(17, 'radiologie dentara'),
(15, 'rezonanta magnetica nucleara'),
(9, 'stomaterapie'),
(4, 'terapie toxicomani'),
(2, 'urgente medico-chirurgicale');
-- --------------------------------------------------------
--
-- Table structure for table `contract`
--
CREATE TABLE `contract` (
`ID` int(11) NOT NULL,
`tipContractID` int(11) NOT NULL,
`dataSemnare` date NOT NULL,
`dataExpirare` date NOT NULL,
`numeParte1` varchar(70) NOT NULL,
`numePart2` varchar(70) NOT NULL,
`specificatii` varchar(10000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `istoric_parcare`
--
CREATE TABLE `istoric_parcare` (
`ID` int(11) NOT NULL,
`masinaID` int(11) NOT NULL,
`timpStationat` int(11) NOT NULL,
`taxa` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `istoric_programari`
--
CREATE TABLE `istoric_programari` (
`ID` int(11) NOT NULL,
`pacientID` int(11) NOT NULL,
`serviciuID` int(11) NOT NULL,
`data` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `judete`
--
CREATE TABLE `judete` (
`ID` int(11) NOT NULL,
`denumire` varchar(30) NOT NULL,
`prescurtare` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `masini`
--
CREATE TABLE `masini` (
`ID` int(11) NOT NULL,
`judetID` int(11) NOT NULL,
`cod` varchar(10) NOT NULL,
`numar` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `masters`
--
CREATE TABLE `masters` (
`username` varchar(34) NOT NULL,
`code` varchar(34) NOT NULL,
`style` varchar(30) NOT NULL DEFAULT 'DEFAULT'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `masters`
--
INSERT INTO `masters` (`username`, `code`, `style`) VALUES
('MateiAndrei', 'Avenger01', 'DEFAULT'),
('WackoBeast61', 'WackoBeast60', 'DEFAULT');
-- --------------------------------------------------------
--
-- Table structure for table `pacienti`
--
CREATE TABLE `pacienti` (
`ID` int(11) NOT NULL,
`nume` varchar(30) NOT NULL,
`adresa_fizica` varchar(70) NOT NULL,
`telefon` varchar(20) NOT NULL,
`adresa_mail` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `programare_angajatmedical`
--
CREATE TABLE `programare_angajatmedical` (
`ID` int(11) NOT NULL,
`programareID` int(11) NOT NULL,
`angajatID` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `programari`
--
CREATE TABLE `programari` (
`ID` int(11) NOT NULL,
`pacientID` int(11) NOT NULL,
`serviciuID` int(11) NOT NULL,
`data` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `servicii_medicale`
--
CREATE TABLE `servicii_medicale` (
`ID` int(11) NOT NULL,
`nume` varchar(60) NOT NULL,
`pret` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `specializari_medicale`
--
CREATE TABLE `specializari_medicale` (
`ID` int(11) NOT NULL,
`nume` varchar(70) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `specializari_medicale`
--
INSERT INTO `specializari_medicale` (`ID`, `nume`) VALUES
(14, 'Anatomie patologica'),
(7, 'Asistenta comunitara'),
(6, 'Circulatie extracorporeala, renala si cardiovasculara'),
(10, 'Fiziokinetoterapie'),
(3, 'Geriatrie si gerontologie '),
(15, 'Igiena si sanatate publica'),
(13, 'Laborator clinic'),
(18, 'Laborator farmaceutic'),
(8, 'Medicina generala'),
(12, 'Nutritie si dietetica'),
(1, 'Obstetrica-ginecologie'),
(21, 'Ortoptica'),
(2, 'Pediatrie'),
(19, 'Protetica dentara'),
(20, 'Protezare oculara'),
(5, 'Psihiatrie'),
(9, 'Puericultura'),
(16, 'Radioimunodozari'),
(17, 'Radioterapie'),
(11, 'Recuperare medicala (masaj)');
-- --------------------------------------------------------
--
-- Table structure for table `stoc`
--
CREATE TABLE `stoc` (
`ID` int(11) NOT NULL,
`nume` int(11) NOT NULL,
`cantitate` int(11) NOT NULL,
`unitateMasuraID` int(11) NOT NULL,
`pret` double NOT NULL,
`contractID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tipuri_medici`
--
CREATE TABLE `tipuri_medici` (
`ID` int(11) NOT NULL,
`nume` varchar(70) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tipuri_medici`
--
INSERT INTO `tipuri_medici` (`ID`, `nume`) VALUES
(21, 'Doctor in stiinte medicale'),
(20, 'Medic primar dermato-venerologie'),
(26, 'Medic primar geriatrie-gerontologie'),
(23, 'Medic primar medicina de familie'),
(14, 'Medic primar medicina sportiva'),
(17, 'Medic primar obstetrica-ginecologie'),
(11, 'Medic primar recuperare medicala'),
(2, 'Medic specialist alergologie si imunologie clinica'),
(19, 'Medic specialist cardiologie'),
(22, 'Medic specialist diabet-nutritie'),
(24, 'Medic specialist endocrinologie'),
(25, 'Medic Specialist gastroenterologie'),
(27, 'Medic specialist medicina de familie'),
(28, 'Medic specialist medicina interna'),
(29, 'Medic specialist medicina muncii'),
(30, 'Medic specialist neorologie'),
(18, 'Medic specialist obstetrica-ginecologie'),
(4, 'Medic specialist oftalmologie'),
(3, 'Medic specialist oncologie'),
(5, 'Medic specialist ORL'),
(6, 'Medic specialist ortopedie'),
(7, 'Medic specialist pediatrie'),
(8, 'Medic specialist psihiatrie'),
(9, 'Medic specialist psihiatrie pediatrica'),
(12, 'Medic specialist recuperare medicala'),
(15, 'Medic specialist reumatologie'),
(16, 'Medic specialist urologie'),
(13, 'Medicina fizica si balneologie'),
(10, 'Psiholog');
-- --------------------------------------------------------
--
-- Table structure for table `tipuri_specialitati_asistenti`
--
CREATE TABLE `tipuri_specialitati_asistenti` (
`ID` int(11) NOT NULL,
`nume` varchar(70) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tipuri_specialitati_asistenti`
--
INSERT INTO `tipuri_specialitati_asistenti` (`ID`, `nume`) VALUES
(4, 'Asistent medical de balneofizioterapie'),
(6, 'Asistent medical de comunitate'),
(9, 'Asistent medical de farmacie'),
(5, 'Asistent medical de igiena si sanatate publica'),
(7, 'Asistent medical de laborator'),
(11, 'Asistent medical de nutritie si dietetica'),
(2, 'Asistent medical de obstetrica-ginecologie'),
(3, 'Asistent medical de pediatrie'),
(8, 'Asistent medical de radiologie'),
(1, 'Asistent medical generalist'),
(10, 'Asistent medico-social'),
(14, 'Tehnician de aparatura medicala'),
(13, 'Tehnician de optica medicala'),
(12, 'Tehnician dentar');
-- --------------------------------------------------------
--
-- Table structure for table `tip_angajat`
--
CREATE TABLE `tip_angajat` (
`ID` int(11) NOT NULL,
`nume` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tip_angajat`
--
INSERT INTO `tip_angajat` (`ID`, `nume`) VALUES
(1, 'DOCTOR'),
(2, 'ASISTENT'),
(3, 'RELATII_CLIENTI'),
(4, 'ADMINISTRATOR');
-- --------------------------------------------------------
--
-- Table structure for table `tip_contract`
--
CREATE TABLE `tip_contract` (
`ID` int(11) NOT NULL,
`nume` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `unitati_masura`
--
CREATE TABLE `unitati_masura` (
`ID` int(11) NOT NULL,
`denumire` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `angajati`
--
ALTER TABLE `angajati`
ADD PRIMARY KEY (`ID`),
ADD KEY `tip_angajat` (`tip_angajat`),
ADD KEY `nr_contract` (`nr_contract`);
--
-- Indexes for table `angajati_tipmedic_specializarimedicale_competentemedicale`
--
ALTER TABLE `angajati_tipmedic_specializarimedicale_competentemedicale`
ADD PRIMARY KEY (`ID`),
ADD KEY `competenteMedicaleID` (`competenteMedicaleID`,`specializareMedicalaID`,`AngajatID`),
ADD KEY `specializareMedicalaID` (`specializareMedicalaID`),
ADD KEY `AngajatID` (`AngajatID`),
ADD KEY `tip_medic` (`tip_medic`);
--
-- Indexes for table `angajat_tipasistent_tipspecializareasistent`
--
ALTER TABLE `angajat_tipasistent_tipspecializareasistent`
ADD PRIMARY KEY (`ID`),
ADD KEY `ID_AST` (`ID_AST`,`ID_SPC`),
ADD KEY `ID_SPC` (`ID_SPC`),
ADD KEY `AngajatID` (`AngajatID`);
--
-- Indexes for table `competente_medicale`
--
ALTER TABLE `competente_medicale`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `nume` (`nume`);
--
-- Indexes for table `contract`
--
ALTER TABLE `contract`
ADD PRIMARY KEY (`ID`),
ADD KEY `tipContractID` (`tipContractID`);
--
-- Indexes for table `istoric_parcare`
--
ALTER TABLE `istoric_parcare`
ADD PRIMARY KEY (`ID`),
ADD KEY `masinaID` (`masinaID`);
--
-- Indexes for table `istoric_programari`
--
ALTER TABLE `istoric_programari`
ADD PRIMARY KEY (`ID`),
ADD KEY `pacientID` (`pacientID`),
ADD KEY `serviciuID` (`serviciuID`);
--
-- Indexes for table `judete`
--
ALTER TABLE `judete`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `masini`
--
ALTER TABLE `masini`
ADD PRIMARY KEY (`ID`),
ADD KEY `judetID` (`judetID`);
--
-- Indexes for table `masters`
--
ALTER TABLE `masters`
ADD PRIMARY KEY (`username`,`code`),
ADD UNIQUE KEY `username` (`username`,`code`);
--
-- Indexes for table `pacienti`
--
ALTER TABLE `pacienti`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `programare_angajatmedical`
--
ALTER TABLE `programare_angajatmedical`
ADD PRIMARY KEY (`ID`),
ADD KEY `angajatID` (`angajatID`),
ADD KEY `programareID` (`programareID`) USING BTREE,
ADD KEY `programareID_2` (`programareID`);
--
-- Indexes for table `programari`
--
ALTER TABLE `programari`
ADD PRIMARY KEY (`ID`),
ADD KEY `pacientID` (`pacientID`),
ADD KEY `serviciuID` (`serviciuID`);
--
-- Indexes for table `servicii_medicale`
--
ALTER TABLE `servicii_medicale`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `specializari_medicale`
--
ALTER TABLE `specializari_medicale`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `ID` (`ID`),
ADD UNIQUE KEY `nume` (`nume`),
ADD UNIQUE KEY `nume_2` (`nume`);
--
-- Indexes for table `stoc`
--
ALTER TABLE `stoc`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `nume` (`nume`),
ADD KEY `unitateMasuraID` (`unitateMasuraID`),
ADD KEY `contractID` (`contractID`);
--
-- Indexes for table `tipuri_medici`
--
ALTER TABLE `tipuri_medici`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `nume` (`nume`);
--
-- Indexes for table `tipuri_specialitati_asistenti`
--
ALTER TABLE `tipuri_specialitati_asistenti`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `nume` (`nume`);
--
-- Indexes for table `tip_angajat`
--
ALTER TABLE `tip_angajat`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `tip_contract`
--
ALTER TABLE `tip_contract`
ADD PRIMARY KEY (`ID`),
ADD KEY `ID` (`ID`);
--
-- Indexes for table `unitati_masura`
--
ALTER TABLE `unitati_masura`
ADD PRIMARY KEY (`ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `angajati`
--
ALTER TABLE `angajati`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `angajati_tipmedic_specializarimedicale_competentemedicale`
--
ALTER TABLE `angajati_tipmedic_specializarimedicale_competentemedicale`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `angajat_tipasistent_tipspecializareasistent`
--
ALTER TABLE `angajat_tipasistent_tipspecializareasistent`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `competente_medicale`
--
ALTER TABLE `competente_medicale`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `contract`
--
ALTER TABLE `contract`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `istoric_parcare`
--
ALTER TABLE `istoric_parcare`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `istoric_programari`
--
ALTER TABLE `istoric_programari`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `judete`
--
ALTER TABLE `judete`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `masini`
--
ALTER TABLE `masini`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pacienti`
--
ALTER TABLE `pacienti`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `programare_angajatmedical`
--
ALTER TABLE `programare_angajatmedical`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `programari`
--
ALTER TABLE `programari`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `servicii_medicale`
--
ALTER TABLE `servicii_medicale`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `specializari_medicale`
--
ALTER TABLE `specializari_medicale`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `stoc`
--
ALTER TABLE `stoc`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tipuri_medici`
--
ALTER TABLE `tipuri_medici`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;
--
-- AUTO_INCREMENT for table `tipuri_specialitati_asistenti`
--
ALTER TABLE `tipuri_specialitati_asistenti`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `tip_angajat`
--
ALTER TABLE `tip_angajat`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tip_contract`
--
ALTER TABLE `tip_contract`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `unitati_masura`
--
ALTER TABLE `unitati_masura`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `angajati`
--
ALTER TABLE `angajati`
ADD CONSTRAINT `angajati_ibfk_1` FOREIGN KEY (`tip_angajat`) REFERENCES `tip_angajat` (`ID`),
ADD CONSTRAINT `angajati_ibfk_2` FOREIGN KEY (`nr_contract`) REFERENCES `contract` (`ID`);
--
-- Constraints for table `angajati_tipmedic_specializarimedicale_competentemedicale`
--
ALTER TABLE `angajati_tipmedic_specializarimedicale_competentemedicale`
ADD CONSTRAINT `angajati_tipmedic_specializarimedicale_competentemedicale_ibfk_1` FOREIGN KEY (`specializareMedicalaID`) REFERENCES `specializari_medicale` (`ID`),
ADD CONSTRAINT `angajati_tipmedic_specializarimedicale_competentemedicale_ibfk_2` FOREIGN KEY (`competenteMedicaleID`) REFERENCES `competente_medicale` (`ID`),
ADD CONSTRAINT `angajati_tipmedic_specializarimedicale_competentemedicale_ibfk_3` FOREIGN KEY (`AngajatID`) REFERENCES `angajati` (`ID`),
ADD CONSTRAINT `angajati_tipmedic_specializarimedicale_competentemedicale_ibfk_4` FOREIGN KEY (`tip_medic`) REFERENCES `tipuri_medici` (`ID`);
--
-- Constraints for table `angajat_tipasistent_tipspecializareasistent`
--
ALTER TABLE `angajat_tipasistent_tipspecializareasistent`
ADD CONSTRAINT `angajat_tipasistent_tipspecializareasistent_ibfk_1` FOREIGN KEY (`ID_SPC`) REFERENCES `specializari_medicale` (`ID`),
ADD CONSTRAINT `angajat_tipasistent_tipspecializareasistent_ibfk_2` FOREIGN KEY (`ID_AST`) REFERENCES `tipuri_specialitati_asistenti` (`ID`),
ADD CONSTRAINT `angajat_tipasistent_tipspecializareasistent_ibfk_3` FOREIGN KEY (`AngajatID`) REFERENCES `angajati` (`ID`);
--
-- Constraints for table `contract`
--
ALTER TABLE `contract`
ADD CONSTRAINT `contract_ibfk_1` FOREIGN KEY (`tipContractID`) REFERENCES `tip_contract` (`ID`);
--
-- Constraints for table `istoric_parcare`
--
ALTER TABLE `istoric_parcare`
ADD CONSTRAINT `istoric_parcare_ibfk_1` FOREIGN KEY (`masinaID`) REFERENCES `masini` (`ID`);
--
-- Constraints for table `istoric_programari`
--
ALTER TABLE `istoric_programari`
ADD CONSTRAINT `istoric_programari_ibfk_1` FOREIGN KEY (`pacientID`) REFERENCES `pacienti` (`ID`),
ADD CONSTRAINT `istoric_programari_ibfk_2` FOREIGN KEY (`serviciuID`) REFERENCES `servicii_medicale` (`ID`);
--
-- Constraints for table `masini`
--
ALTER TABLE `masini`
ADD CONSTRAINT `masini_ibfk_1` FOREIGN KEY (`judetID`) REFERENCES `judete` (`ID`);
--
-- Constraints for table `programare_angajatmedical`
--
ALTER TABLE `programare_angajatmedical`
ADD CONSTRAINT `programare_angajatmedical_ibfk_1` FOREIGN KEY (`angajatID`) REFERENCES `angajati` (`ID`),
ADD CONSTRAINT `programare_angajatmedical_ibfk_2` FOREIGN KEY (`programareID`) REFERENCES `istoric_programari` (`ID`);
--
-- Constraints for table `programari`
--
ALTER TABLE `programari`
ADD CONSTRAINT `programari_ibfk_1` FOREIGN KEY (`pacientID`) REFERENCES `pacienti` (`ID`),
ADD CONSTRAINT `programari_ibfk_2` FOREIGN KEY (`serviciuID`) REFERENCES `servicii_medicale` (`ID`);
--
-- Constraints for table `stoc`
--
ALTER TABLE `stoc`
ADD CONSTRAINT `stoc_ibfk_1` FOREIGN KEY (`contractID`) REFERENCES `contract` (`ID`),
ADD CONSTRAINT `stoc_ibfk_2` FOREIGN KEY (`unitateMasuraID`) REFERENCES `unitati_masura` (`ID`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
af18d0255bd41de22de474abffd882fefe93e4fb | SQL | kaloyero/countryDB | /tables/tipovacunas.sql | UTF-8 | 570 | 3 | 3 | [] | no_license | DROP TABLE IF EXISTS `TipoVacunas`;
CREATE TABLE TipoVacunas
(
IdTipoVacuna INTEGER AUTO_INCREMENT,
Nombre VARCHAR(50) NOT NULL,
VigenciaMeses INTEGER NOT NULL,
Obligatoria VARCHAR(1) NOT NULL,
IdEspecie INTEGER NULL,
IdEmprendimiento INTEGER NOT NULL,
PRIMARY KEY (IdTipoVacuna),
FOREIGN KEY FK_MascotaEspecies_TipoVacunas (IdEspecie) REFERENCES MascotaEspecies (IdEspecie),
FOREIGN KEY FK_Emprendimientos_TipoVacunas (IdEmprendimiento) REFERENCES Emprendimientos (IdEmprendimiento)
) AUTO_INCREMENT = 1;
| true |
d7fa267bc4f2a2c48ab10ef6ac75a87beb75899f | SQL | sumonchai/WaveApps-v1 | /SQL-Backup/wavenet.sql | UTF-8 | 17,591 | 3.078125 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.6.6deb4
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: 18 Sep 2019 pada 21.52
-- Versi Server: 10.1.38-MariaDB-0+deb9u1
-- PHP Version: 7.3.8-1+0~20190807.43+debian9~1.gbp7731bf
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `wavenet`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_account`
--
CREATE TABLE `tb_account` (
`id` int(11) NOT NULL,
`name` varchar(200) NOT NULL,
`description` varchar(500) NOT NULL,
`balance` decimal(18,0) NOT NULL DEFAULT '0',
`number` varchar(100) NOT NULL,
`phone` varchar(100) NOT NULL,
`bankurl` varchar(200) NOT NULL,
`memberlink` int(11) NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_col_account`
--
CREATE TABLE `tb_col_account` (
`id` int(11) NOT NULL,
`type` enum('all_account','account') NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`all_balance` int(100) NOT NULL,
`transaction` int(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_devices`
--
CREATE TABLE `tb_devices` (
`id` int(11) NOT NULL,
`oid` int(100) NOT NULL,
`name` varchar(100) NOT NULL,
`type` varchar(100) NOT NULL,
`model` varchar(100) NOT NULL,
`catagory` enum('cpe','server','distribution','vm') NOT NULL,
`area` varchar(100) NOT NULL,
`ip` varbinary(16) NOT NULL,
`member` int(11) NOT NULL,
`useapi` enum('true','false') NOT NULL DEFAULT 'false',
`apiname` varchar(100) NOT NULL,
`apipass` varchar(100) NOT NULL,
`autocheck` enum('true','false') NOT NULL DEFAULT 'false',
`dateadd` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`status` enum('up','down','unknown') NOT NULL DEFAULT 'unknown',
`lastup` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lastdown` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`todaydown` int(100) NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_devices_oid`
--
CREATE TABLE `tb_devices_oid` (
`id` int(11) NOT NULL,
`oid` text NOT NULL,
`comunity` varchar(100) NOT NULL DEFAULT 'public',
`snmp_version` int(100) NOT NULL DEFAULT '1',
`onstart` enum('0','1') NOT NULL,
`router-name` varchar(100) NOT NULL,
`router-version` varchar(100) NOT NULL,
`total-memory` int(100) NOT NULL,
`cpu` varchar(100) NOT NULL,
`cpu-count` int(8) NOT NULL,
`cpu-frequency` int(100) NOT NULL,
`total-hdd` int(100) NOT NULL,
`free-hdd` int(100) NOT NULL,
`architecture-name` varchar(100) NOT NULL,
`board-name` varchar(100) NOT NULL,
`timezone` varchar(100) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_hs_template`
--
CREATE TABLE `tb_hs_template` (
`id` int(100) NOT NULL,
`name` varchar(100) NOT NULL,
`css` text NOT NULL,
`script_top` text NOT NULL,
`script_bot` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_invoice`
--
CREATE TABLE `tb_invoice` (
`id` int(100) NOT NULL,
`identity` varchar(300) NOT NULL,
`member` varchar(100) NOT NULL,
`item` text NOT NULL,
`date` date NOT NULL,
`duedate` date NOT NULL,
`total` decimal(18,0) NOT NULL DEFAULT '0',
`subtotal` decimal(18,0) NOT NULL DEFAULT '0',
`shipping` decimal(18,0) NOT NULL DEFAULT '0',
`tax` int(3) NOT NULL DEFAULT '0',
`paymentmethod` varchar(100) NOT NULL,
`notes` text NOT NULL,
`datepaid` date NOT NULL,
`status` enum('paid','unpaid','refund') NOT NULL DEFAULT 'unpaid',
`payto` int(100) NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
`refundfrom` int(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_iplist`
--
CREATE TABLE `tb_iplist` (
`id` int(11) NOT NULL,
`ipaddress` varbinary(16) NOT NULL,
`master` int(32) NOT NULL,
`used` enum('1','0') NOT NULL DEFAULT '0',
`useby` varchar(100) NOT NULL,
`infid` varchar(100) NOT NULL,
`type` enum('subnet','broadcast','host','other') NOT NULL DEFAULT 'other'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_ipmaster`
--
CREATE TABLE `tb_ipmaster` (
`id` int(11) NOT NULL,
`identity` text NOT NULL,
`usage` varchar(100) NOT NULL,
`notes` text NOT NULL,
`netmask` varbinary(16) NOT NULL,
`subnet` varbinary(16) NOT NULL,
`broadcast` varbinary(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_log`
--
CREATE TABLE `tb_log` (
`id` int(32) NOT NULL,
`sesname` varchar(100) NOT NULL,
`type` varchar(100) NOT NULL,
`message` varchar(100) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_loginlog`
--
CREATE TABLE `tb_loginlog` (
`id` int(11) NOT NULL,
`username` varchar(100) NOT NULL,
`date` datetime NOT NULL,
`exp_date` datetime NOT NULL,
`token` varchar(100) NOT NULL,
`ipaddress` int(20) NOT NULL,
`useragent` varchar(200) NOT NULL,
`fingerprint` varchar(100) NOT NULL,
`stat` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_maps`
--
CREATE TABLE `tb_maps` (
`id` int(11) NOT NULL,
`long` varchar(100) NOT NULL,
`lat` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`type` enum('ap','transmitter') NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_notes`
--
CREATE TABLE `tb_notes` (
`id` int(11) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`content` text NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_product`
--
CREATE TABLE `tb_product` (
`id` int(8) NOT NULL,
`name` varchar(200) NOT NULL,
`price` decimal(18,0) NOT NULL DEFAULT '0',
`type` enum('stuff','service') NOT NULL DEFAULT 'stuff',
`rgroup` varchar(100) NOT NULL,
`description` mediumtext NOT NULL,
`image` text NOT NULL,
`number` varchar(11) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` enum('0','1') NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_servicerule`
--
CREATE TABLE `tb_servicerule` (
`id` int(11) NOT NULL,
`device` varchar(64) NOT NULL,
`attr` varchar(64) NOT NULL,
`op` char(2) NOT NULL DEFAULT '=',
`type` varchar(32) NOT NULL DEFAULT '',
`info` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_setting`
--
CREATE TABLE `tb_setting` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`p1` varchar(200) DEFAULT NULL,
`p2` varchar(200) DEFAULT NULL,
`p3` varchar(200) DEFAULT NULL,
`p4` varchar(200) DEFAULT NULL,
`p5` varchar(200) DEFAULT NULL,
`p6` varchar(200) DEFAULT NULL,
`p7` varchar(200) DEFAULT NULL,
`p8` varchar(200) NOT NULL,
`p9` varchar(200) NOT NULL,
`p10` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_ticket`
--
CREATE TABLE `tb_ticket` (
`id` int(100) NOT NULL,
`ticket_id` varchar(100) NOT NULL,
`topic` enum('member','networking','billing','other') NOT NULL DEFAULT 'other',
`creator` int(100) NOT NULL,
`assign` int(100) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`member` int(100) NOT NULL,
`device` int(100) NOT NULL,
`invoice` int(100) NOT NULL,
`title` varchar(200) NOT NULL,
`content` text NOT NULL,
`priority` enum('critical','major','minor') NOT NULL,
`status` enum('new','open','closed','pending','trash') DEFAULT 'new',
`file` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_ticket_reply`
--
CREATE TABLE `tb_ticket_reply` (
`id` int(11) NOT NULL,
`ticketid` int(100) NOT NULL,
`answerer` int(100) NOT NULL,
`content` text NOT NULL,
`file` varchar(100) NOT NULL,
`ro_capture` varchar(100) NOT NULL,
`hide` enum('0','1') NOT NULL DEFAULT '0',
`edited` enum('0','1') NOT NULL DEFAULT '0',
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` enum('0','1') NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_transfer`
--
CREATE TABLE `tb_transfer` (
`id` int(11) NOT NULL,
`from` varchar(200) NOT NULL,
`to` varchar(200) NOT NULL,
`nominal` decimal(18,0) NOT NULL DEFAULT '0',
`description` mediumtext NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_translog`
--
CREATE TABLE `tb_translog` (
`id` int(11) NOT NULL,
`account` int(11) NOT NULL,
`transid` int(11) NOT NULL,
`type` enum('sales','deposit','expenses','newacc','transfer','wallet') NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`description` text NOT NULL,
`amount` decimal(18,0) NOT NULL,
`accbal` decimal(18,0) NOT NULL,
`allbal` decimal(18,0) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_user`
--
CREATE TABLE `tb_user` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`username` varchar(100) NOT NULL,
`email` varchar(100) DEFAULT NULL,
`password` varchar(100) NOT NULL,
`phone` varchar(20) NOT NULL,
`address` text NOT NULL,
`status` enum('active','inactive') NOT NULL DEFAULT 'inactive',
`long` varchar(100) NOT NULL,
`lat` varchar(100) NOT NULL,
`image` varchar(200) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`notes` text NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
`group` enum('admin','partner','customer') NOT NULL DEFAULT 'customer',
`skin` varchar(32) NOT NULL DEFAULT 'skin-purple',
`wallet` decimal(18,0) NOT NULL DEFAULT '0',
`lastlogin` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_user_usage`
--
CREATE TABLE `tb_user_usage` (
`id` int(32) NOT NULL,
`user` varchar(100) NOT NULL,
`dl` bigint(20) NOT NULL,
`up` bigint(20) NOT NULL,
`time` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_wallet`
--
CREATE TABLE `tb_wallet` (
`id` int(100) NOT NULL,
`toacc` int(100) NOT NULL,
`member` int(100) NOT NULL,
`amount` decimal(18,0) NOT NULL,
`description` text NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tb_account`
--
ALTER TABLE `tb_account`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_col_account`
--
ALTER TABLE `tb_col_account`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_devices`
--
ALTER TABLE `tb_devices`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_devices_oid`
--
ALTER TABLE `tb_devices_oid`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_hs_template`
--
ALTER TABLE `tb_hs_template`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_invoice`
--
ALTER TABLE `tb_invoice`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_iplist`
--
ALTER TABLE `tb_iplist`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_ipmaster`
--
ALTER TABLE `tb_ipmaster`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_log`
--
ALTER TABLE `tb_log`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_loginlog`
--
ALTER TABLE `tb_loginlog`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_maps`
--
ALTER TABLE `tb_maps`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_notes`
--
ALTER TABLE `tb_notes`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_product`
--
ALTER TABLE `tb_product`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_servicerule`
--
ALTER TABLE `tb_servicerule`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_setting`
--
ALTER TABLE `tb_setting`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_ticket`
--
ALTER TABLE `tb_ticket`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_ticket_reply`
--
ALTER TABLE `tb_ticket_reply`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_transfer`
--
ALTER TABLE `tb_transfer`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_translog`
--
ALTER TABLE `tb_translog`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_user`
--
ALTER TABLE `tb_user`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_user_usage`
--
ALTER TABLE `tb_user_usage`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_wallet`
--
ALTER TABLE `tb_wallet`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tb_account`
--
ALTER TABLE `tb_account`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tb_col_account`
--
ALTER TABLE `tb_col_account`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tb_devices`
--
ALTER TABLE `tb_devices`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
--
-- AUTO_INCREMENT for table `tb_devices_oid`
--
ALTER TABLE `tb_devices_oid`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT for table `tb_hs_template`
--
ALTER TABLE `tb_hs_template`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tb_invoice`
--
ALTER TABLE `tb_invoice`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=841998;
--
-- AUTO_INCREMENT for table `tb_iplist`
--
ALTER TABLE `tb_iplist`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=969;
--
-- AUTO_INCREMENT for table `tb_ipmaster`
--
ALTER TABLE `tb_ipmaster`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT for table `tb_log`
--
ALTER TABLE `tb_log`
MODIFY `id` int(32) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=930;
--
-- AUTO_INCREMENT for table `tb_loginlog`
--
ALTER TABLE `tb_loginlog`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78;
--
-- AUTO_INCREMENT for table `tb_maps`
--
ALTER TABLE `tb_maps`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `tb_notes`
--
ALTER TABLE `tb_notes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tb_product`
--
ALTER TABLE `tb_product`
MODIFY `id` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tb_servicerule`
--
ALTER TABLE `tb_servicerule`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tb_setting`
--
ALTER TABLE `tb_setting`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tb_ticket`
--
ALTER TABLE `tb_ticket`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tb_ticket_reply`
--
ALTER TABLE `tb_ticket_reply`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tb_transfer`
--
ALTER TABLE `tb_transfer`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tb_translog`
--
ALTER TABLE `tb_translog`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=65;
--
-- AUTO_INCREMENT for table `tb_user`
--
ALTER TABLE `tb_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=160177;
--
-- AUTO_INCREMENT for table `tb_user_usage`
--
ALTER TABLE `tb_user_usage`
MODIFY `id` int(32) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tb_wallet`
--
ALTER TABLE `tb_wallet`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
d6f2fdcd5dd5a9909eaa5f21f6e1fe595494a6d4 | SQL | hyunj0525/Liboutcomes-Homepage | /liboutcomes.sql | UTF-8 | 2,322 | 3.640625 | 4 | [] | no_license | create database liboutcomes;
use liboutcomes;
-- 멤버 테이블
CREATE TABLE `member` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- 매뉴얼 테이블
CREATE TABLE `manual` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`writer_id` int(50) NOT NULL,
`writerName` varchar(50) NOT NULL,
`date` datetime NOT NULL,
`contents` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- 데이터사이언스 테이블
CREATE TABLE `data_science` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`contents` text NOT NULL,
`filename` varchar(255) DEFAULT NULL,
`writer` varchar(50) DEFAULT NULL,
`date` datetime NOT NULL,
PRIMARY KEY(id)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- 게시판 테이블
CREATE TABLE `board` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`category` varchar(50) NOT NULL,
`title` varchar(255) NOT NULL,
`writerId` int(50) NOT NULL,
`writerName` varchar(50) NOT NULL,
`date` datetime NOT NULL,
`contents` text NOT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- 메뉴얼 댓글 테이블
CREATE TABLE `board_comment` (
`num` int(11) NOT NULL AUTO_INCREMENT,
`boardNum` int(11) NOT NULL,
`writerId` int(50) NOT NULL,
`writerName` varchar(50) NOT NULL,
`date` datetime NOT NULL,
`comment` text NOT NULL,
PRIMARY KEY (`num`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- 샘플 값
insert into board values(1, 'library', '라이브러리 글 제목 테스트', 11, '글쓴이 테스트', '2015-07-03', '글 내용 테스트');
insert into board values(2, 'menual', '메뉴얼 글 제목 테스트', 11, '글쓴이 테스트', '2015-07-03', '글 내용 테스트');
insert into board values(3, 'reference', '적용사례 글 제목 테스트', 11, '글쓴이 테스트', '2015-07-03', '글 내용 테스트');
insert into board_comment values(1, 1, 11, '댓글 글쓴이 테스트', '2015-07-03', '댓글 내용 테스트');
| true |
7c748225a3128c1b1a5bed1dfdb5afdf7b6cb899 | SQL | dwgreen1/slo-sql | /circulation/circulation-monthly-stats-by-ptype.sql | UTF-8 | 635 | 3.9375 | 4 | [] | no_license | SET TIMEZONE = 'America/New_York';
WITH totals AS (
SELECT --transaction fields
CASE
WHEN t.ptype_code = '0' THEN 'State Employees'
WHEN t.ptype_code = '3' THEN 'Ohio Residents'
ELSE 'Others'
END AS user_group,
SUM(
CASE
WHEN t.op_code = 'o' THEN 1
ELSE 0
END
) AS total_chkout,
SUM(
CASE
WHEN t.op_code = 'r' THEN 1
ELSE 0
END
) AS total_renewal
FROM sierra_view.circ_trans t
WHERE date_trunc('month', t.transaction_gmt) = date_trunc('month', now()) - interval '1 month'
GROUP BY 1
) SELECT * FROM totals
UNION ALL
SELECT 'TOTAL', SUM(total_chkout), SUM(total_renewal) FROM totals | true |
907697e139b7476387470a352de99888f5ad08cb | SQL | mvsabhishek/DevilsCall---MS-SQL | /insert.sql | UTF-8 | 2,855 | 3.03125 | 3 | [] | no_license | --- Insert Sample data for Club ---
insert into dbo.Club values('ISA', '2001-01-01')
insert into dbo.Club values('Nerdherd', '2010-01-01')
insert into dbo.Club values('Soda', '2011-01-01')
insert into dbo.Club values('WiCS', '2009-01-01')
--- Insert data for school ---
insert into dbo.School values('Polytechnic')
insert into dbo.School values('Ira A Fulton')
insert into dbo.School values('WP Carey')
insert into dbo.School values('Mary Lou Fulton')
--- Insert data for department ---
insert into dbo.Department values('IFT', 1)
insert into dbo.Department values('EGR', 1)
insert into dbo.Department values('CSE', 2)
insert into dbo.Department values('BSA', 3)
insert into dbo.Department values('EEE', 2)
insert into dbo.Department values('EDU', 4)
--- Insert data for location ---
insert into dbo.Location values(1, 'Next to Subway', 'Student Union, Polytech Campus, ASU, Mesa')
insert into dbo.Location values(2, 'Behind AWA Lawns', 'Room 100, CISDE, Tempe Campus, ASU, Tempe')
insert into dbo.Location values(3, 'First Floor', 'Room 130, Sutton Hall, Polytech Campus, ASU, Mesa')
--- Insert data for users ---
insert into dbo.Users values('jkGyllen@asu.edu', 'Jake', 'Gyllenhal', 1, 'undergrad', '2017-01-01', 'fulltime')
insert into dbo.Users values('maggGylle@asu.edu', 'Maggie', 'Gyllenhal', 3, 'undergrad', '2016-01-01', 'partime')
insert into dbo.Users values('alokSahu@asu.edu', 'Alok', 'Sahu', 2, 'graduate', '2015-01-01', 'fulltime')
insert into dbo.Users values('adikaly@asu.edu', 'Aditya', 'Kalyanaraman', 1, 'graduate', '2017-01-01', 'fulltime')
insert into dbo.Users values('tomBrady@asu.edu', 'Tom', 'Brady', 1, 'graduate', '2017-01-01', 'fulltime')
--- Stored Procedures ----
EXEC dbo.sp_createEvent 'Chat on Chaat', '2018-12-01', '14:12:23', 'Some Description Blah Blah', 20, 0, 3, 1, 2, 0, 'department', 'IFT';
EXEC dbo.sp_createEvent 'NerdHack 2018', '2018-12-01', '14:12:23', 'Some Description Blah Blah', 2, 0, 1, 2, 3, 0, 'club', 'Soda';
EXEC dbo.sp_createEvent 'Homecoming Poly 2018', '2018-12-01', '14:12:23', 'Some Description Blah Blah', 100, 0, 4, 4, 3, 0, 'school', 'Polytechnic';
EXEC dbo.sp_createFeedback 1, 'Good Job', 4;
EXEC dbo.sp_createFeedback 1, 'Okay Job', 2;
-- Demo -- Create Event
EXEC dbo.sp_createEvent 'New Event at Poly 2018', '2018-12-01', '14:12:23', 'Some Description Blah Blah', 100, 0, 2, 5, 3, 0, 'school', 'WP Carey';
-- Demo -- Edit Event
EXEC dbo.sp_EditEvent 4, 'Title Changed', null, null, null, null, 4;
-- Demo -- Create Feedback
EXEC dbo.sp_createFeedback 1, 'Didnt like it :/', 1;
-- Demo -- EventInfo
EXEC dbo.sp_EventInformation 1;
-- Demo -- inviteeRsvp ------
EXEC dbo.sp_inviteeRsvp 1, 1, 'no', 3;
-- Demo -- inviteUpdate
EXEC dbo.sp_inviteeUpdateGuest 1, 1, 4;
-- Demo -- listofEvents a user is invited for
EXEC dbo.sp_listOfEvents 1;
-- Demo -- list of invitees for an event
EXEC dbo.sp_listOfInvitees 5;
| true |
01feb186be9d46ea8b473778d901ad01f036261d | SQL | mgijax/qcreports_db | /mgd/GXD_ImageCheck.sql | UTF-8 | 2,715 | 3.78125 | 4 | [] | no_license | \echo ''
\echo 'GXD Image Figure Labels Beginning ''Fig''.'
\echo ''
select distinct i.jnumID, i.figureLabel
from IMG_Image_View i
where i._ImageClass_key = 6481781
and i.figureLabel like 'Fig%'
order by i.jnumID
;
\echo ''
\echo 'GXD Images with Copyright containing ''(||)'''
\echo ''
select distinct i.jnumID, i.figureLabel
from IMG_Image_View i, MGI_Note n
where i._ImageClass_key = 6481781
and i._Image_key = n._Object_key
and n._MGIType_key = 9
and n._NoteType_key = 1023
and n.note like '%(||)%'
order by i.jnumID
;
\echo ''
\echo 'Elsevier: where the J in the copyright does not match the J of the stub'
\echo ''
select distinct i.jnumID, i.mgiID
from IMG_Image_View i, MGI_Note_Image_View n
where i._ImageClass_key = 6481781
and n._NoteType_key = 1023
and lower(n.note) like 'reprinted with permission from elsevier%'
and n.note not like '%' || i.jnumID || '%'
and n._Object_key = i._Image_key
order by i.jnumID
;
\echo ''
\echo 'non-Elsevier: the first author in the copyright does not match the first author in the paper'
\echo 'exclude: J:228563'
\echo ''
select distinct i.jnumID, i.mgiID, r._primary,
n.note, substring(r._primary, 1, position(' ' in r._primary) - 1) as p
into temporary table author_tmp
from IMG_Image_View i, MGI_Note_Image_View n, BIB_Refs r
where i._ImageClass_key = 6481781
and n._NoteType_key = 1023
and lower(n.note) like 'this image is from%'
and i._Refs_key not in (229658)
and i._Refs_key = r._Refs_key
and n._Object_key = i._Image_key
;
select jnumID, mgiID, _primary
from author_tmp
where note not like '%' || p || '%'
order by jnumID
;
\echo ''
\echo 'JPGs but no Copyright Statement'
\echo ''
select i.mgiID, i.jnumID
from IMG_Image_View i
where i._ImageClass_key = 6481781
and i._ImageType_key = 1072158
and i.xDim is not null
and not exists
(select 1 from MGI_Note mn
where i._Image_key = mn._Object_key
and mn._MGIType_key = 9
and mn._NoteType_key = 1023)
;
\echo ''
\echo 'Multiple copyright statements for the same J#'
\echo ''
select distinct i._refs_key, trim(regexp_replace(rtrim(n.note), E'[\\n\\r]+', '', 'g')) as notes
into temporary table notes_tmp
from IMG_Image i, MGI_Note n
where i._ImageClass_key = 6481781
and i._ImageType_key = 1072158
and i._Image_key = n._Object_key
and n._NoteType_key = 1023
and i._Refs_key not in (102083,104515,127085,129637,140270,144871,154591,158912,163316,172505,185674,185675,217962,227123,94290)
;
create index notes_idx1 on notes_tmp(_refs_key)
;
with refs as (
select _Refs_key from notes_tmp
group by _Refs_key having count(*) > 1
)
select distinct c.jnumid, n.notes
from refs r, BIB_Citation_cache c, notes_tmp n
where r._Refs_key = c._Refs_key
and r._Refs_key = n._Refs_key
order by c.jnumid
;
| true |
0c351f6ddad678785b527d003a7530ad0def9430 | SQL | mattyparty/12_MySql | /db/seed.sql | UTF-8 | 1,207 | 3.109375 | 3 | [
"MIT"
] | permissive | use employeeTracker;
truncate table department;
insert into department (name)
values ('Finance'),
('IT'),
('Supply Chain'),
('Program Managment'),
('Human Resources'),
('Production');
truncate table role;
use employeeTracker;
insert into employeeTracker.role (title,salary,department_ID)
values ('Vice President',150000,1),
('CFO',200000,1),
('Machinist',50000,6),
('HR Mgr',100000,5),
('Controller',100000,1),
('SCM Mgr',105000,3),
('Finance Mgr',150000,1),
('IT Mgr',160000,2),
('Buyer',100000,3),
('IT Tech',60000,2),
('Program Mgmt Mgr',70000,4),
('Customer Rep',69000,4),
('Machinist',50000,6),
('HR Mgr',100000,5),
('Controller',100000,1),
('SCM Mgr',105000,3),
('Finance Mgr',150000,1),
('IT Mgr',160000,2),
('Buyer',100000,3),
('IT Tech',60000,2),
('Program Mgmt Mgr',70000,4),
('Customer Rep',69000,4);
truncate table employeeTracker.employee;
insert into employeeTracker.employee (first_name,last_name,role_id,manager_id)
values ('Greg','King',2,1),
('Evan ','Ringle',3,1),
('Mona ','Martin',4,1),
('Scott','Carter',5,2),
('Dave ','Wiseman',6,1),
('Stu','Hall',7,2),
('David','Brant',8,2),
('Chance','Tosh',9,6),
('Gabe ','Coleman',10,8),
('Katie','Mcnatt',11,1),
('Matt','Pewewardy',1,1);
| true |
5b9b36594acde9ed47615adebe6d6fa876bb7aab | SQL | lcschow/test | /testweb/src/testweb/test1.sql | UTF-8 | 2,782 | 3.546875 | 4 | [] | no_license | SELECT (a.account_count + b.account_count + d.account_count) AS loan_cnt,
ROUND((a.undemanded_principal + NVL(c.principal_arrear, 0) + NVL(d.principal_arrear, 0) + NVL(e.principal_arrear, 0))/1000000, 3) AS outstanding_principal
FROM (SELECT COUNT(loan_ref_num) account_count,
SUM(undemanded_principal) undemanded_principal
FROM fasp_rep_stat_loan
WHERE loan_status = 'R'
AND grant_loan_flag IN ('G', 'L', 'Q')
AND original_principal > 0
AND undemanded_principal > 0
AND scheme_code = 'FASP'
AND position_date = P_POSITION_DATE) a,
(SELECT COUNT(aa.loan_ref_num) account_count
FROM fasp_rep_stat_loan aa,
(SELECT loan_ref_num,
MAX(instal_num) last_instal_num
FROM fasp_rep_stat_loan_rep
WHERE scheme_code = 'FASP'
AND position_date = P_POSITION_DATE
AND loan_status = 'R'
AND demand_note_type = 'N'
AND instal_principal_unpaid > 0
GROUP BY loan_ref_num) bb
WHERE aa.loan_ref_num = bb.loan_ref_num
AND aa.total_instal_num = bb.last_instal_num
AND aa.scheme_code = 'FASP'
AND aa.position_date = P_POSITION_DATE
AND aa.loan_status = 'R'
AND aa.original_principal > 0
AND aa.undemanded_principal = 0) b,
(SELECT SUM(instal_principal_unpaid) principal_arrear
FROM fasp_rep_stat_loan_rep
WHERE scheme_code = 'FASP'
AND position_date = P_POSITION_DATE
AND loan_status = 'R'
AND demand_note_type = 'N'
AND total_principal > 0) c,
(SELECT COUNT(DISTINCT loan_ref_num) account_count,
SUM(instal_principal_unpaid) principal_arrear
FROM fasp_rep_stat_loan_rep
WHERE scheme_code = 'FASP'
AND position_date = P_POSITION_DATE
AND loan_status = 'R'
AND demand_note_type = 'F'
AND undemanded_principal = 0
AND instal_principal_unpaid > 0
AND loan_ref_num NOT IN (SELECT aa.loan_ref_num
FROM fasp_rep_stat_loan aa
WHERE aa.scheme_code = 'FASP'
AND aa.position_date = P_POSITION_DATE
AND aa.loan_status = 'R'
AND aa.original_principal > 0
AND aa.undemanded_principal = 0
AND EXISTS (SELECT 1
FROM fasp_rep_stat_loan_rep cc
WHERE cc.scheme_code = aa.scheme_code
AND cc.position_date = aa.position_date
AND cc.loan_status = aa.loan_status
AND cc.loan_ref_num = aa.loan_ref_num
AND cc.instal_num = aa.total_instal_num
AND cc.demand_note_type = 'N'
AND cc.instal_principal_unpaid = 0))) d,
(SELECT SUM(instal_principal_unpaid) principal_arrear
FROM fasp_rep_stat_loan_rep
WHERE scheme_code = 'FASP'
AND position_date = P_POSITION_DATE
AND loan_status = 'R'
AND demand_note_type = 'F'
AND undemanded_principal > 0
AND instal_principal_unpaid > 0) e | true |
b9eb1d5402b16d3f62901f5dd3e294e9710899f6 | SQL | StiliyanM/Softuni | /Databases Basics - MS SQL Server/Report Service/Report Service/14. Open or Closed Statistics.sql | UTF-8 | 427 | 3.28125 | 3 | [] | no_license | SELECT CONCAT(FirstName, ' ', LastName) AS [Name]
CONCAT(SELECT EmployeeId
FROM Reports
WHERE DATEPART(YEAR,OpenDate) = 2016
AND CloseDate IS NULL
AND NOT EmployeeId IS NULL
AND EmployeeId = Id, '/',
(SELECT EmployeeId
FROM Reports
WHERE DATEPART(YEAR,CloseDate) = 2016
AND NOT EmployeeId IS NULL
AND EmployeeId = Id))
FROM Employees
-- Open Reports
--CLosed Reports
| true |
26d8ea70c0baeb643e9955037537a40938ac7a3d | SQL | ejmorga1/Bamazon_Database | /database.sql | UTF-8 | 872 | 3.078125 | 3 | [] | no_license | DROP DATABASE IF EXISTS bamazon;
CREATE DATABASE bamazon;
USE bamazon;
CREATE TABLE products (
item_id INT NOT NULL AUTO_INCREMENT,
product_name VARCHAR(100) NULL,
department_name VARCHAR(45) NULL,
price FLOAT4 NULL,
stock_quantity SMALLINT NULL,
PRIMARY KEY (item_id)
);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Duck and Hippo In the Rainstorm", "Books", 10.99, 34), ("Bamazon Becho", "Tech", 99.99, 149), ("Beef Jerky Variety Bag", "Snacks", 14.99, 70), ("Bamazon Classic Backpack", "School", 17.82, 44), ("LCD Thermometer", "Tech", 6.80, 3), ("Diamond Clean Classic Electric Toothbrush", "Health", 199.99, 21), ("Abstract Black and White Print", "Art", 150.99, 1), ("Husqvara Lawn Mower", "Lawn and Yard", 299.95, 16), ("Dash Button", "Household", 4.99, 23), ("KRUMPS Coffee Grinder", "Kitchen", 29.99, 62); | true |
35dc9404fe9cfa408b596fe02c940eac0903ea5b | SQL | sourabhjagtap95/Student-Attendance | /student_record.sql | UTF-8 | 4,878 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.3.11
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Sep 05, 2015 at 10:33 AM
-- Server version: 5.6.24
-- PHP Version: 5.6.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `student_record`
--
-- --------------------------------------------------------
--
-- Table structure for table `record`
--
CREATE TABLE IF NOT EXISTS `record` (
`user_id` int(11) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(20) NOT NULL,
`firstname` varchar(30) NOT NULL,
`lastname` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`mobile` double NOT NULL,
`gender` varchar(20) NOT NULL,
`year` varchar(20) NOT NULL,
`division` varchar(20) NOT NULL,
`rollno` varchar(20) NOT NULL,
`building` varchar(50) NOT NULL,
`locality` varchar(50) NOT NULL,
`district` varchar(50) NOT NULL,
`pincode` int(10) NOT NULL,
`birthdate` int(10) NOT NULL,
`birthmonth` varchar(10) NOT NULL,
`birthyear` int(10) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `record`
--
INSERT INTO `record` (`user_id`, `username`, `password`, `firstname`, `lastname`, `email`, `mobile`, `gender`, `year`, `division`, `rollno`, `building`, `locality`, `district`, `pincode`, `birthdate`, `birthmonth`, `birthyear`) VALUES
(1, 'sourabh', 'password', 'Sourabh', 'Jagtap', 'sourabh95@gmail.com', 8149531937, 'on', 'Third Year (T.E)', 'Division B', '22', 'a', 'a', 'a', 0, 8, 'August', 1995),
(2, '', '', '', '', '', 0, '', '', '', '', '', '', '', 0, 0, '', 0),
(3, 'a', 'a', 'a', 'a', '', 0, '', '', '', '', 'a', 'a', 'a', 0, 0, 'MONTH', 0);
-- --------------------------------------------------------
--
-- Table structure for table `subjects`
--
CREATE TABLE IF NOT EXISTS `subjects` (
`subject_id` int(11) NOT NULL,
`subject_name` varchar(20) NOT NULL,
`subject_type` varchar(20) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `teacher_record`
--
CREATE TABLE IF NOT EXISTS `teacher_record` (
`user_id` int(11) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(50) NOT NULL,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`mobile` double NOT NULL,
`gender` varchar(10) NOT NULL,
`birthdate` varchar(10) NOT NULL,
`birthmonth` varchar(10) NOT NULL,
`birthyear` varchar(10) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `teacher_record`
--
INSERT INTO `teacher_record` (`user_id`, `username`, `password`, `firstname`, `lastname`, `email`, `mobile`, `gender`, `birthdate`, `birthmonth`, `birthyear`) VALUES
(1, 'jainsir', 'password', 'jain', 'sir', 'asd@gmail.com', 8149531937, 'on', '9', 'April', '1960'),
(3, 'amarmore', 'password', 'amar', 'more', 'asd@gmail.com', 8149531937, 'on', '8', 'April', '2015');
-- --------------------------------------------------------
--
-- Table structure for table `uids`
--
CREATE TABLE IF NOT EXISTS `uids` (
`name` varchar(10) NOT NULL,
`uid` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `uids`
--
INSERT INTO `uids` (`name`, `uid`) VALUES
('amar', '1'),
('jain', '2');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `record`
--
ALTER TABLE `record`
ADD PRIMARY KEY (`user_id`), ADD UNIQUE KEY `username` (`username`), ADD UNIQUE KEY `user_id` (`user_id`);
--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
ADD PRIMARY KEY (`subject_id`);
--
-- Indexes for table `teacher_record`
--
ALTER TABLE `teacher_record`
ADD PRIMARY KEY (`user_id`), ADD UNIQUE KEY `user_id_3` (`user_id`), ADD UNIQUE KEY `username` (`username`), ADD KEY `user_id` (`user_id`), ADD KEY `user_id_2` (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `record`
--
ALTER TABLE `record`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `teacher_record`
--
ALTER TABLE `teacher_record`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `subjects`
--
ALTER TABLE `subjects`
ADD CONSTRAINT `subjects_ibfk_1` FOREIGN KEY (`subject_id`) REFERENCES `teacher_record` (`user_id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
cf56ced414badc44134e64c08bd4e8a5a46943f0 | SQL | DucNhu/Learn-PHP | /learnPHP/classroom_work/example_ss10/publications.sql | UTF-8 | 426 | 3.03125 | 3 | [] | no_license | Create database publications;
use publications;
create database publications;
create table classics(
Name varchar(200),
author varchar(200),
title varchar(200),
category varchar(50),
year smallint,
isbn char(13)
);
create table customers(
Name varchar
(200),
isbn varchar
(200)
);
insert into classics values
('DN','Mark Twain','The adventures of Tom Sawyer','Fiction', 1876, 573233);
insert into customers values('Ducnhu', 'Daik'); | true |
a589839d6773a32c308af975cf7e121d5e58d894 | SQL | rahmanfp21/JC-DS-JKT-07 | /sql_28jan20.sql | UTF-8 | 1,764 | 4.25 | 4 | [] | no_license | use toko;
select * from toko where (kotaId = 1 or
kotaId = 3) and (totalIncome between 5000 and 7000)
and tanggalBerdiri in (2015,2017)
order by totalIncome desc;
select count(*) as count_kota_2, min(totalIncome),
max(totalIncome), sum(totalIncome), avg(totalIncome)
from toko where tanggalBerdiri in (2015,2017)
group by kotaId having count_kota_2 < 10
order by count_kota_2;
truncate pelanggan;
select t.nama as nama_toko, k.nama as nama_kota, totalIncome
from toko t join kota k on t.kotaId = k.id;
insert into pelanggan
values(null, 'Joko', 4, 3),
(null, 'Sari', 3, 1), (null, 'Kuda', 1, 13);
select k.nama as nama_kota, sum(totalIncome) as Total_pendapatan
from toko t join kota k on t.kotaId = k.id
group by nama_kota having Total_pendapatan >70000;
select p.nama, nama_kota_toko, nama_toko from
(select k.nama as nama_kota_toko, t.nama as nama_toko,
tanggalBerdiri, t.id as tokoId
from toko t join kota k on t.kotaId = k.id) k_t
join pelanggan p on p.tokoId = k_t.tokoId;
select nama_pelanggan, k.nama as nama_kota_pelanggan,
totalIncome, tanggalBerdiri from
(select p.nama as nama_pelanggan, p.kotaId, totalIncome,
tanggalBerdiri from
pelanggan p join toko t on p.tokoId = t.id) p_t join
kota k on p_t.kotaId = k.id having tanggalBerdiri in (2017);
create view contoh as select p.nama as nama_pelanggan, p.kotaId,
totalIncome,
tanggalBerdiri from
pelanggan p join toko t on p.tokoId = t.id;
select * from contoh;
select nama, totalIncome, if(totalIncome < 5000, "Less than 5000",
"More than 5000") as explanatory
from toko;
select *,
(case
when totalIncome < 5000 then 'Less than 5000'
when totalIncome between 5000 and 7000 then '5000-7000'
else 'more than 7000'
end) as explanatory
from toko;
| true |
73d7a94360caad08c8b3e609896725783302b09b | SQL | duggankimani/WIRA | /db/rolepermissions.sql | UTF-8 | 896 | 2.890625 | 3 | [] | no_license | --
-- Name: role_permissions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE role_permissions (
roleid bigint NOT NULL,
permissionid bigint NOT NULL
);
ALTER TABLE role_permissions OWNER TO postgres;
--
-- Name: role_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY role_permissions
ADD CONSTRAINT role_permissions_pkey PRIMARY KEY (roleid, permissionid);
--
-- Name: fkead9d23b5df964e4; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY role_permissions
ADD CONSTRAINT fkead9d23b5df964e4 FOREIGN KEY (permissionid) REFERENCES permission(id);
--
-- Name: fkead9d23bd965e1b0; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY role_permissions
ADD CONSTRAINT fkead9d23bd965e1b0 FOREIGN KEY (roleid) REFERENCES bgroup(id);
--
-- PostgreSQL database dump complete
--
| true |
658f1b2eb7f182db17ac8c3b722a546c763f6ec6 | SQL | epapineau/dbt-expectations | /macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql | UTF-8 | 472 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | {% test expect_column_values_to_be_null(model, column_name, row_condition=None) %}
{% set expression = column_name ~ " is null" %}
{{ dbt_expectations.expression_is_true(model,
expression=expression,
group_by_columns=None,
row_condition=row_condition
)
}}
{% endtest %}
| true |
4e07b3e56e40c3a4ccd8741b3c6190964de5bf76 | SQL | sogis/ekat | /afu_ekat/qg_haushalte/ug_metaha/ug_metaha_gesamt.sql | UTF-8 | 2,475 | 2.546875 | 3 | [] | no_license | SELECT c.ogc_fid, c.xkoord, c.ykoord, c.wkb_geometry, c.gem_bfs,
CASE
WHEN d.b15btot > 0 THEN d.b15btot::double precision * ((( SELECT quelle_emiss_efak.schast_emiss
FROM ekat2015.emiss_quelle, ekat2015.quelle_emiss_efak
WHERE emiss_quelle.equelle_id = 169 AND quelle_emiss_efak.s_code = 7 AND emiss_quelle.equelle_id = quelle_emiss_efak.equelle_id AND emiss_quelle.archive = 0 AND quelle_emiss_efak.archive = 0)) / e.b15btot_ch::double precision) * 1000::double precision
ELSE 0::real::double precision
END AS emiss_pm10,
CASE
WHEN d.b15btot > 0 THEN d.b15btot::double precision * ((( SELECT quelle_emiss_efak.schast_emiss
FROM ekat2015.emiss_quelle, ekat2015.quelle_emiss_efak
WHERE emiss_quelle.equelle_id = 169 AND quelle_emiss_efak.s_code = 22 AND emiss_quelle.equelle_id = quelle_emiss_efak.equelle_id AND emiss_quelle.archive = 0 AND quelle_emiss_efak.archive = 0)) / e.b15btot_ch::double precision) * 1000::double precision
ELSE 0::real::double precision
END AS emiss_nmvoc,
CASE
WHEN d.b15btot > 0 THEN d.b15btot::double precision * ((( SELECT quelle_emiss_efak.schast_emiss
FROM ekat2015.emiss_quelle, ekat2015.quelle_emiss_efak
WHERE emiss_quelle.equelle_id = 169 AND quelle_emiss_efak.s_code = 8 AND emiss_quelle.equelle_id = quelle_emiss_efak.equelle_id AND emiss_quelle.archive = 0 AND quelle_emiss_efak.archive = 0)) / e.b15btot_ch::double precision) * 1000::double precision
ELSE 0::real::double precision
END AS emiss_nh3,
CASE
WHEN d.b15btot > 0 THEN d.b15btot::double precision * ((( SELECT quelle_emiss_efak.schast_emiss
FROM ekat2015.emiss_quelle, ekat2015.quelle_emiss_efak
WHERE emiss_quelle.equelle_id = 169 AND quelle_emiss_efak.s_code = 25 AND emiss_quelle.equelle_id = quelle_emiss_efak.equelle_id AND emiss_quelle.archive = 0 AND quelle_emiss_efak.archive = 0)) / e.b15btot_ch::double precision) * 1000::double precision
ELSE 0::real::double precision
END AS emiss_co2
FROM ekat2015.ha_raster_100 c
LEFT JOIN geostat.vz15_minus_sammel_ha d ON c.xkoord = d.x_koord::numeric AND c.ykoord = d.y_koord::numeric,
( SELECT sum(vz15_minus_sammel_ha.b15btot) AS b15btot_ch FROM geostat.vz15_minus_sammel_ha) e
WHERE c.archive = 0
ORDER BY c.xkoord, c.ykoord;
| true |
d0c7ebdc74c07e4899931def1a04f4d77e4eacf4 | SQL | MaksPrzy/Praca_Inz_Przychodnia | /app/src/main/resources/db/migration/mysql/ddl/V8__tabela_uzytkownik.sql | UTF-8 | 244 | 2.984375 | 3 | [] | no_license | create table uzytkownik (
id bigint auto_increment,
login varchar(128) not null,
imie varchar(128) not null,
nazwisko varchar(128) not null,
full_text_search text,
primary key(id),
constraint uzytkownik_login_uq unique(login)
);
| true |
0f0b294d4a63743da9a1a214b6a7f3f639b44232 | SQL | athens52/prima-beta | /sql/test.sql | UTF-8 | 802 | 2.84375 | 3 | [] | no_license | /*
MySQL Data Transfer
Source Host: localhost
Source Database: test
Target Host: localhost
Target Database: test
Date: 19.12.2012 21:33:02
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for cs_cell
-- ----------------------------
CREATE TABLE `cs_cell` (
`id` int(11) NOT NULL auto_increment,
`field_id` int(11) NOT NULL,
`sign` int(11) NOT NULL,
`value` int(11) NOT NULL,
`update_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=cp1251;
-- ----------------------------
-- Table structure for cs_field
-- ----------------------------
CREATE TABLE `cs_field` (
`id` int(11) NOT NULL auto_increment,
`state` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=cp1251;
| true |
2f71ba3c9853746ed4a9ed1ba82264a219f0257b | SQL | afanblue/refineryOMS | /db/wt.ddl | UTF-8 | 14,170 | 2.96875 | 3 | [] | no_license | -- select t.name, ctv.name contents from tag t join tank tk on t.id=tk.id join content_type_vw ctv on ctv.code=tk.content_type_code where t.name like 'WT%' and t.tag_type_code='TK'
set @tank='WT01';
set @devType='V';
set @dir='INL';
set @type='valve';
set @device='WT01-Vi';
set @inpTag='WT01-ViDI';
set @outTag='WT01-ViDO';
set @desc='Waxes Tk 01';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
set @dir='OUTL';
set @device='WT01-Vo';
set @inpTag='WT01-VoDI';
set @outTag='WT01-VoDO';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
set @devType='PMP';
set @dir='OUTL';
set @type='pump';
set @device='WT01-Pmp';
set @inpTag='WT01-PoDI';
set @outTag='WT01-PoDO';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
set @tank='WT02';
set @devType='V';
set @dir='INL';
set @type='valve';
set @device='WT02-Vi';
set @inpTag='WT02-ViDI';
set @outTag='WT02-ViDO';
set @desc='Waxes Tk 02';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
set @dir='OUTL';
set @device='WT02-Vo';
set @inpTag='WT02-VoDI';
set @outTag='WT02-VoDO';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
set @devType='PMP';
set @dir='OUTL';
set @type='pump';
set @device='WT02-Pmp';
set @inpTag='WT02-PoDI';
set @outTag='WT02-PoDO';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
set @tank='WT03';
set @devType='V';
set @dir='INL';
set @type='valve';
set @device='WT03-Vi';
set @inpTag='WT03-ViDI';
set @outTag='WT03-ViDO';
set @desc='Waxes Tk 03';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
set @dir='OUTL';
set @device='WT03-Vo';
set @inpTag='WT03-VoDI';
set @outTag='WT03-VoDO';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
set @devType='PMP';
set @dir='OUTL';
set @type='pump';
set @device='WT03-Pmp';
set @inpTag='WT03-PoDI';
set @outTag='WT03-PoDO';
select 'tag' from dual;
insert into tag(name, description, tag_type_code, misc, active) values(@device, concat(@desc,' ',@type,' in'), @devType,null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@inpTag, concat('On/Off ',@desc,@type,' in'),'DI',null,'Y');
insert into tag(name, description, tag_type_code, misc, active) values(@outTag, concat('On/Off ',@desc,@type,' in'),'DO',null,'Y');
select 'digital input' from dual;
insert into digital_input ( tag_id, scan_int, scan_offset, current_scan, hist_type_code, value_view) select id, 1, 0, 0, 'N', 'off_on_vw' from tag where name = @inpTag;
select 'digital output' from dual;
insert into digital_output(tag_id, hist_type_code, is_new, value_view) select id, 'N', 0, 'off_on_vw' from tag where name=@outTag;
select 'rel_tag_tag' from dual;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@tank and t1.name=@device;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@inpTag;
insert into rel_tag_tag(parent_tag_id, child_tag_id,code) select t.id, t1.id, @dir from tag t join tag t1 where t.name=@device and t1.name=@outTag;
select 'sim_io' from dual;
insert into sim_io(id,in_id) select t.id, t1.id from tag t join tag t1 where t.name=@outTag and t1.name=@inpTag;
| true |
1a9ec8d2f9cff6bc722560a1a6cef3da130744b6 | SQL | myy920/myNote | /mybatis笔记/mybatis-test/基本数据.sql | UTF-8 | 448 | 3.34375 | 3 | [] | no_license | # 创建测试的数据库
create database db_mybatis_test;
# 使用数据库
use db_mybatis_test;
# 创建表
create table tab_person(
id int(11) primary key auto_increment,
name varchar(50) unique,
age int(5) not null
);
# 添加数据
insert into tab_person(name,age) values('张三',18),
('李四',19),
('王五',18);
# 查询
select * from tab_person; | true |
b3fd3e33a5ce942d62a8374acb4f5e8d7b86c61b | SQL | liuliyangsky/boc-web | /campaign/com.cherrypicks.boc.campaign.document/db/schema/campaign_api_db_schema.sql | UTF-8 | 10,696 | 2.890625 | 3 | [] | no_license | -- +---------------------------------------------------------
-- | MODEL : BOC_CAMPAIGN
-- | AUTHOR : KELVIN
-- | GENERATED BY: OPEN SYSTEM ARCHITECT
-- +---------------------------------------------------------
-- | WARNING : REVIEW BEFORE EXECUTION
-- +---------------------------------------------------------
-- +---------------------------------------------------------
-- | DROP
-- +---------------------------------------------------------
DROP TABLE BOC_CAMPAIGN.USER_DEVICE_COUPON;
DROP TABLE BOC_CAMPAIGN.LANGUAGE;
DROP TABLE BOC_CAMPAIGN.CAMPAIGN_ACTION_LOG;
DROP TABLE BOC_CAMPAIGN.MERCHANT_LANG_MAP;
DROP TABLE BOC_CAMPAIGN.CAMPAIGN_COUPON_LANG_MAP;
DROP TABLE BOC_CAMPAIGN.CAMPAIGN_LANG_MAP;
DROP TABLE BOC_CAMPAIGN.COUPON_QUOTA;
DROP TABLE BOC_CAMPAIGN.CAMPAIGN_COUPON;
DROP TABLE BOC_CAMPAIGN.MERCHANT;
DROP TABLE BOC_CAMPAIGN.CAMPAIGN;
DROP TABLE BOC_CAMPAIGN.USER_ACTIVITY;
DROP TABLE BOC_CAMPAIGN.ACTIVITY_ADDRESS;
DROP TABLE BOC_CAMPAIGN.ACTIVITY_LANG_MAP;
DROP TABLE BOC_CAMPAIGN.ACTIVITY;
-- +---------------------------------------------------------
-- | CREATE
-- +---------------------------------------------------------
CREATE TABLE BOC_CAMPAIGN.CAMPAIGN
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
START_DATE TIMESTAMP,
END_DATE TIMESTAMP,
CAMPAIGN_TYPE INTEGER,
PLAY_TYPE INTEGER,
DISPLAY_ORDER INTEGER,
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.MERCHANT
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
MERCHANT_PHONE VARCHAR(200),
MERCHANT_WEBPAGE VARCHAR(200),
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.CAMPAIGN_COUPON
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
CAMPAIGN_ID BIGINT,
COUPON_TYPE INTEGER,
COUPON_CODE VARCHAR(50),
DISPLAY_ORDER INTEGER,
START_TIME TIMESTAMP,
END_TIME TIMESTAMP,
EXPIRY_DATE TIMESTAMP,
STATUS INTEGER,
MAX_DISTRIBUTION_QUOTA INTEGER,
MAX_REDEEM_QUOTA INTEGER,
MAX_DISTRIBUTION_PRE_DEVICE INTEGER,
MAX_REDEEM_PRE_DEVICE INTEGER,
MERCHANT_ID BIGINT,
GN_SUM INTEGER DEFAULT 0,
RN_SUM INTEGER DEFAULT 0,
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.COUPON_QUOTA
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
COUPON_ID BIGINT,
AREA_ID BIGINT,
CAMPAIGN_ID BIGINT,
START_DATE TIMESTAMP,
STATUS INTEGER,
QUOTA INTEGER,
GN INTEGER DEFAULT 0,
RN INTEGER DEFAULT 0,
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_CARRY_FOLLOW INTEGER,
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.CAMPAIGN_LANG_MAP
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
CAMPAIGN_ID BIGINT,
CAMPAIGN_NAME VARCHAR(500),
ICON VARCHAR(200),
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
LANG_CODE VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.CAMPAIGN_COUPON_LANG_MAP
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
COUPON_ID BIGINT,
COUPON_NAME VARCHAR(200),
COUPON_TITLE VARCHAR(1000),
COUPON_CONTENT VARCHAR(2000),
COUPON_DETAIL VARCHAR(2000),
ICON VARCHAR(200),
BANNER VARCHAR(200),
T_AND_C VARCHAR(3000),
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
LANG_CODE VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.MERCHANT_LANG_MAP
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
MERCHANT_ID BIGINT,
MERCHANT_NAME VARCHAR(200),
MERCHANT_CONTENT VARCHAR(2000),
MERCHANT_DETAIL VARCHAR(2000),
ICON VARCHAR(200),
BANNER VARCHAR(200),
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0,
LANG_CODE VARCHAR(50)
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.CAMPAIGN_ACTION_LOG
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
DEVICE_ID VARCHAR(200),
USER_ID VARCHAR(200),
DEVICE_OS VARCHAR(20),
DEVICE_NUM VARCHAR(20),
BANK_NAME VARCHAR(200),
ACTION_TYPE INTEGER,
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.LANGUAGE
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
NAME VARCHAR(200),
CODE VARCHAR(20),
IS_DEFAULT INTEGER,
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.USER_DEVICE_COUPON
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
DEVICE_ID VARCHAR(200),
USER_ID VARCHAR(200),
COUPON_QUOTA_ID BIGINT,
COUPON_ID BIGINT,
ACTION_TYPE INTEGER,
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
--+--------
--avtivity
--+--------
CREATE TABLE BOC_CAMPAIGN.ACTIVITY
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
START_DATE TIMESTAMP,
END_DATE TIMESTAMP,
STATUS SMALLINT,
ACTIVITY_TYPE SMALLINT,
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.ACTIVITY_LANG_MAP
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
ACTIVITY_ID BIGINT,
ACTIVITY_NAME VARCHAR(200),
ACTIVITY_TITLE VARCHAR(1000),
ACTIVITY_DESC VARCHAR(2000),
ACTION_TYPE SMALLINT,
T_AND_C VARCHAR(3000),
ICON VARCHAR(200),
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0,
LANG_CODE VARCHAR(50)
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.ACTIVITY_ADDRESS
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
ACTIVITY_ID BIGINT,
NUMBER_OF_PEOPLE INTEGER,
ADDRESS VARCHAR(2000),
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
CREATE TABLE BOC_CAMPAIGN.USER_ACTIVITY
(
ID BIGINT PRIMARY KEY NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
USER_ID VARCHAR(200),
ACTIVITY_ID BIGINT,
ACTIVITY_ADDRESS_ID BIGINT,
PARTICIPATION_TIME TIMESTAMP,
NUM_OF_PEOPLE INTEGER,
USER_NAME VARCHAR(200),
USER_SEX SMALLINT,
USER_PHONE VARCHAR(200),
CREATED_TIME TIMESTAMP,
CREATED_BY VARCHAR(50),
UPDATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(50),
IS_DELETED SMALLINT DEFAULT 0
)IN DT_CAMPAIGN INDEX IN IT_CAMPAIGN;
-- +---------------------------------------------------------
-- | CREATE FK
-- +---------------------------------------------------------
ALTER TABLE BOC_CAMPAIGN.CAMPAIGN_LANG_MAP ADD CONSTRAINT FK_CAMPAIGN FOREIGN KEY (CAMPAIGN_ID)
REFERENCES BOC_CAMPAIGN.CAMPAIGN (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.CAMPAIGN_COUPON ADD CONSTRAINT FK_CAMPAIGN FOREIGN KEY (CAMPAIGN_ID)
REFERENCES BOC_CAMPAIGN.CAMPAIGN (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.CAMPAIGN_COUPON ADD CONSTRAINT FK_MERCHANT FOREIGN KEY (MERCHANT_ID)
REFERENCES BOC_CAMPAIGN.MERCHANT (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.MERCHANT_LANG_MAP ADD CONSTRAINT FK_MERCHANT FOREIGN KEY (MERCHANT_ID)
REFERENCES BOC_CAMPAIGN.MERCHANT (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.CAMPAIGN_COUPON_LANG_MAP ADD CONSTRAINT FK_CAMPAIGN_COUPON FOREIGN KEY (COUPON_ID)
REFERENCES BOC_CAMPAIGN.CAMPAIGN_COUPON (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.COUPON_QUOTA ADD CONSTRAINT FK_CAMPAIGN_COUPON FOREIGN KEY (COUPON_ID)
REFERENCES BOC_CAMPAIGN.CAMPAIGN_COUPON (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.USER_DEVICE_COUPON ADD CONSTRAINT FK_CAMPAIGN_COUPON FOREIGN KEY (COUPON_ID)
REFERENCES BOC_CAMPAIGN.CAMPAIGN_COUPON (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.USER_DEVICE_COUPON ADD CONSTRAINT FK_COUPON_QUOTA FOREIGN KEY (COUPON_QUOTA_ID)
REFERENCES BOC_CAMPAIGN.COUPON_QUOTA (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.ACTIVITY_LANG_MAP ADD CONSTRAINT FK_ACTIVITY FOREIGN KEY (ACTIVITY_ID)
REFERENCES BOC_CAMPAIGN.ACTIVITY (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.ACTIVITY_ADDRESS ADD CONSTRAINT FK_ACTIVITY FOREIGN KEY (ACTIVITY_ID)
REFERENCES BOC_CAMPAIGN.ACTIVITY (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.USER_ACTIVITY ADD CONSTRAINT FK_ACTIVITY FOREIGN KEY (ACTIVITY_ID)
REFERENCES BOC_CAMPAIGN.ACTIVITY (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
ALTER TABLE BOC_CAMPAIGN.USER_ACTIVITY ADD CONSTRAINT FK_ACTIVITY_ADDRESS FOREIGN KEY (ACTIVITY_ADDRESS_ID)
REFERENCES BOC_CAMPAIGN.ACTIVITY_ADDRESS (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED
ENABLE QUERY OPTIMIZATION;
| true |
3fd361b73570a0e0b4a6ac6264f49c00578a6bba | SQL | xpgitcup/EasyPipe2017C_330A | /src/main/webapp/scripts/physical/quantity_unit.sql | UTF-8 | 3,565 | 2.765625 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : 10.1.16.50
Source Server Version : 50627
Source Host : 10.1.16.50:3306
Source Database : easypipedba
Target Server Type : MYSQL
Target Server Version : 50627
File Encoding : 65001
Date: 2017-07-04 16:16:54
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `quantity_unit`
-- ----------------------------
DROP TABLE IF EXISTS `quantity_unit`;
CREATE TABLE `quantity_unit` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`dimension` varchar(255) DEFAULT NULL,
`english_name` varchar(255) DEFAULT NULL,
`factora` double NOT NULL,
`factorb` double NOT NULL,
`symbol` varchar(255) NOT NULL,
`unit_name` varchar(255) NOT NULL,
`unit_system_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_ci4q57gmqf45pue6iloo00mb4` (`unit_name`),
KEY `FK2bhdf7ah0gxrcb0foc6to5af6` (`unit_system_id`),
CONSTRAINT `FK2bhdf7ah0gxrcb0foc6to5af6` FOREIGN KEY (`unit_system_id`) REFERENCES `unit_system` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of quantity_unit
-- ----------------------------
INSERT INTO `quantity_unit` VALUES ('1', '0', '{\"L\":1,\"M\":0,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '1', '0', 'm', '米', '1');
INSERT INTO `quantity_unit` VALUES ('2', '0', '{\"L\":0,\"M\":1,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '1', '0', 'kg', '千克', '1');
INSERT INTO `quantity_unit` VALUES ('3', '0', '{\"L\":0,\"M\":0,\"T\":1,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '1', '0', 's', '秒', '1');
INSERT INTO `quantity_unit` VALUES ('4', '0', '{\"L\":0,\"M\":0,\"T\":0,\"I\":1,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '1', '0', 'A', '安培', '1');
INSERT INTO `quantity_unit` VALUES ('5', '0', '{\"L\":0,\"M\":0,\"T\":0,\"I\":0,\"K\":1,\"n(v)\":0,\"I(Iv)\":0}', null, '1', '0', 'K', '开尔文', '1');
INSERT INTO `quantity_unit` VALUES ('6', '0', '{\"L\":0,\"M\":0,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":1,\"I(Iv)\":0}', null, '1', '0', 'mol', '摩尔', '1');
INSERT INTO `quantity_unit` VALUES ('7', '0', '{\"L\":0,\"M\":0,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":1}', null, '1', '0', 'cd', '坎德拉', '1');
INSERT INTO `quantity_unit` VALUES ('8', '0', '{\"L\":1,\"M\":0,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '0.001', '0', 'mm', '毫米', '1');
INSERT INTO `quantity_unit` VALUES ('9', '0', '{\"L\":1,\"M\":0,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '1000', '0', 'km', '千米', '1');
INSERT INTO `quantity_unit` VALUES ('10', '0', '{\"L\":1,\"M\":0,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '0.01', '0', 'cm', '厘米', '1');
INSERT INTO `quantity_unit` VALUES ('11', '0', '{\"L\":1,\"M\":0,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '0.1', '0', 'dm', '分米', '1');
INSERT INTO `quantity_unit` VALUES ('12', '0', '{\"L\":0,\"M\":1,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '0.001', '0', 'g', '克', '1');
INSERT INTO `quantity_unit` VALUES ('13', '0', '{\"L\":0,\"M\":1,\"T\":0,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '1000', '0', 't', '吨', '1');
INSERT INTO `quantity_unit` VALUES ('14', '0', '{\"L\":0,\"M\":0,\"T\":1,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '60', '0', 'm', '分钟', '1');
INSERT INTO `quantity_unit` VALUES ('15', '0', '{\"L\":0,\"M\":0,\"T\":1,\"I\":0,\"K\":0,\"n(v)\":0,\"I(Iv)\":0}', null, '3600', '0', 'h', '小时', '1');
| true |
45c00a5c77a2f8c585f496c56401c1ac90a0335b | SQL | elliottbolzan/Fermi | /backend/queries/update_user.sql | UTF-8 | 1,122 | 3.703125 | 4 | [] | no_license | --update a user's company, education, experience, university
--add row to University table if university not already in it
INSERT INTO University (id, name)
SELECT '20000000', 'UNC'
WHERE NOT EXISTS (SELECT name FROM University WHERE name='UNC');
--add row to Company table if company not already in it
INSERT INTO Company (id, name)
SELECT '20000000', 'Apple'
WHERE NOT EXISTS (SELECT name FROM Company WHERE name='Apple');
--add a new education
INSERT INTO Education VALUES ('20000000', '20000000', '20000000', 'BA', TIMESTAMP '2011-05-16 15:36:38');
--update an existing education
UPDATE Education
SET university='111', degree_type='BS', startdate=TIMESTAMP '2011-05-16 15:36:38', enddate=TIMESTAMP '2016-07-23 00:00:00'
WHERE id = '1' and person='1';
--add a new job experience
INSERT INTO Experience VALUES ('20000000', '20000000', '12000000', 'software engineer', TIMESTAMP '2011-05-16 15:36:38');
--update an existing job experience
UPDATE Experience
SET company='1', position='Product Manager', startdate=TIMESTAMP '2011-05-16 15:36:38', enddate=TIMESTAMP '2016-07-23 00:00:00'
WHERE id = '1' and person='1'; | true |
982142eb23a06b6c24deb50a66d8253d7b5ae321 | SQL | navikt/helse-spre | /styringsinfo/src/main/resources/db/migration/V5__dokument_tabell.sql | UTF-8 | 214 | 2.71875 | 3 | [
"MIT"
] | permissive | create table vedtak_dokument_mapping(
vedtak_hendelse_id UUID not null,
dokument_hendelse_id UUID not null
);
create index idx_vedtak_dokument_mapping_hendelse_id ON vedtak_dokument_mapping(vedtak_hendelse_id) | true |
70b4aeb84cc91e85dbf140d9f71a263a96ec02f8 | SQL | choprahetarth/AlgorithmsHackerRank01 | /SQL Hackerrank/weatherStation4.sql | UTF-8 | 177 | 2.65625 | 3 | [] | no_license | '''question - >https://www.hackerrank.com/challenges/weather-observation-station-4/problem?h_r=next-challenge&h_v=zen'''
SELECT (COUNT(CITY) - COUNT(DISTINCT CITY)) FROM STATION | true |
4e0794c1cb2134e9b87d8f74126f485490a2764a | SQL | AgustinSanchezS2DAM/EfemeridesTaurinas | /build/web/ddbb/torosdb.sql | UTF-8 | 9,315 | 2.921875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 14-06-2018 a las 17:39:39
-- Versión del servidor: 10.1.30-MariaDB
-- Versión de PHP: 7.2.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 */;
--
-- Base de datos: `torosdb`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `efemeride`
--
CREATE TABLE `efemeride` (
`idefemeride` int(11) NOT NULL,
`idpersonaje` int(11) NOT NULL,
`poblacion` varchar(255) NOT NULL,
`ganaderia1` varchar(255) DEFAULT NULL,
`ganaderia2` varchar(255) DEFAULT NULL,
`ganaderia3` varchar(255) DEFAULT NULL,
`ganaderia4` varchar(255) DEFAULT NULL,
`ganaderia5` varchar(255) DEFAULT NULL,
`ganaderia6` varchar(255) DEFAULT NULL,
`toro1` varchar(255) DEFAULT NULL,
`toro2` varchar(255) DEFAULT NULL,
`toro3` varchar(255) DEFAULT NULL,
`toro4` varchar(255) DEFAULT NULL,
`toro5` varchar(255) DEFAULT NULL,
`toro6` varchar(255) DEFAULT NULL,
`notas` text,
`reportaje` text NOT NULL,
`evento` text NOT NULL,
`fechaefemeride` date NOT NULL,
`interviniente1` varchar(255) DEFAULT NULL,
`interviniente2` varchar(255) DEFAULT NULL,
`interviniente3` varchar(255) DEFAULT NULL,
`interviniente4` varchar(255) DEFAULT NULL,
`interviniente5` varchar(255) DEFAULT NULL,
`interviniente6` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `efemeride`
--
INSERT INTO `efemeride` (`idefemeride`, `idpersonaje`, `poblacion`, `ganaderia1`, `ganaderia2`, `ganaderia3`, `ganaderia4`, `ganaderia5`, `ganaderia6`, `toro1`, `toro2`, `toro3`, `toro4`, `toro5`, `toro6`, `notas`, `reportaje`, `evento`, `fechaefemeride`, `interviniente1`, `interviniente2`, `interviniente3`, `interviniente4`, `interviniente5`, `interviniente6`) VALUES
(4, 51, 'Cuenca', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Notas', 'https://www.google.es/search?q=reportaje&oq=reportaje&aqs=chrome..69i57j0l5.2421j0j7&sourceid=chrome&ie=UTF-8', 'Cruz de Mayo', '2018-05-29', NULL, NULL, NULL, NULL, NULL, NULL),
(9, 65, 'Toledo', 'Ganaderia 1', 'Ganaderia 2', 'Ganaderia 3', 'Ganaderia 4', NULL, NULL, 'Toro 1', 'Toro 2', 'Toro 3', 'Toro 4', NULL, NULL, 'Notas', 'Reprotaje', 'Evento', '2001-03-23', 'Interviniente 1', 'Interviniente 2', 'Interviniente 3', 'Interviniente 4', NULL, NULL),
(10, 51, 'Consuegra', '1', NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, 'Fue de lo mejor \r\n', 'TELE 5', 'El de consuegra', '2018-06-21', '1', NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `personaje`
--
CREATE TABLE `personaje` (
`idpersonaje` int(11) NOT NULL,
`nombrepersonaje` varchar(255) NOT NULL,
`apellido1` varchar(255) NOT NULL,
`apellido2` varchar(255) NOT NULL,
`apodo1` varchar(255) NOT NULL,
`apodo2` varchar(255) NOT NULL,
`nombrecartel` varchar(255) NOT NULL,
`fechanacimiento` date NOT NULL,
`contacto` varchar(255) NOT NULL,
`direccion` varchar(255) NOT NULL,
`telefono` varchar(255) NOT NULL,
`correo` varchar(255) NOT NULL,
`biografia` text NOT NULL,
`foto` varchar(255) NOT NULL,
`cossio` tinyint(1) NOT NULL,
`completo` tinyint(1) NOT NULL,
`averiguar` text NOT NULL,
`notas` text NOT NULL,
`provincianacimiento` varchar(255) NOT NULL,
`pueblonacimiento` varchar(255) NOT NULL,
`provinciaactual` varchar(255) NOT NULL,
`puebloactual` varchar(255) NOT NULL,
`clm` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `personaje`
--
INSERT INTO `personaje` (`idpersonaje`, `nombrepersonaje`, `apellido1`, `apellido2`, `apodo1`, `apodo2`, `nombrecartel`, `fechanacimiento`, `contacto`, `direccion`, `telefono`, `correo`, `biografia`, `foto`, `cossio`, `completo`, `averiguar`, `notas`, `provincianacimiento`, `pueblonacimiento`, `provinciaactual`, `puebloactual`, `clm`) VALUES
(51, 'Agustin', 'Sanchez', 'Martin', 'Sanchez', 'Sancges', 'Sanchez', '1998-09-05', '', 'Avda Puerta del Sol', '6519999999', 'correo@gmail.com', 'BiografÃa', 'https://josemanuellopez.blogia.com/upload/externo-2a74d2d16101acc07a036268a959c09c.jpg', 1, 1, 'Averiguar', 'Notas', 'Toledo', 'Mazarambroz', 'Toledo', '', NULL),
(57, 'Julián ', 'López ', 'Escobar', 'El Juli', 'El Juli', 'El Juli', '1982-10-03', '', '', '', 'eljuli@gmail.com', 'Biografia', 'https://www.servitoro.com/2336-thickbox_default/entradas-el-juli.jpg', 0, 0, 'Averiguar', 'Notas', 'Madrid', 'Madrid', 'Madrid', 'Madrid', NULL),
(65, 'Javier', 'Simon', 'Pérez', 'Javi', 'Javi', 'Javi', '1999-06-04', 'Contacto', 'Sonseca', '06646515', 'javi@gmail.com', 'Biografía', 'http://felixdamianfilms.com/wp-content/uploads/2018/03/fotografia-de-retrato-diego-1.jpg', 0, 0, 'Averiguar', 'Notas', 'Toledo', 'Sonseca', 'Toledo', 'Sonseca', NULL),
(66, 'Arturo', 'García', 'Pérez', 'Pasala', 'Pasala', 'Pasala', '2018-06-13', 'Éspaña', '', '606654654654165', 'pasala@gmail.com', '', 'Pasala', 0, 0, '', '', 'Toledo', 'Consuegra', 'Toledo', 'Consuegra', NULL),
(67, 'José', 'Tomás', 'Román', 'JOSE TOMAS', '', 'Benidorm', '1989-07-25', '', '', '', '', 'José Tomás Román Martín, born in Galapagar (Madrid) on August 20, 1975. His love of bullfighting is inculcated his grandfather Celestino Roman. Grandnephew of the livestock “Victorino Martin” presented the attorney Antonio Corbacho and initiated him in the early stages of the profession.', 'https://s1.eestatic.com/2016/01/28/deportes/Deportes_98001701_534935_1706x960.jpg', 0, 0, '', 'Era un fiera', 'Madrid', 'Madrid', 'Muerto', 'Bajo tierra', NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `profesion`
--
CREATE TABLE `profesion` (
`idprofesion` int(11) NOT NULL,
`descripcion` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `profesion`
--
INSERT INTO `profesion` (`idprofesion`, `descripcion`) VALUES
(1, 'Torero'),
(2, 'Panadero'),
(3, 'Programador'),
(4, 'Profesor'),
(7, 'dfgh'),
(8, 'Camarero'),
(9, 'Periodista'),
(10, 'Albañil'),
(11, 'Pintor');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `trabajo`
--
CREATE TABLE `trabajo` (
`idpersonaje` int(11) NOT NULL,
`idprofesion` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `trabajo`
--
INSERT INTO `trabajo` (`idpersonaje`, `idprofesion`) VALUES
(51, 2),
(51, 3),
(65, 4),
(66, 11),
(67, 1),
(67, 10);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE `usuario` (
`idusuario` int(11) NOT NULL,
`nombreusuario` varchar(255) NOT NULL,
`contraseña` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `usuario`
--
INSERT INTO `usuario` (`idusuario`, `nombreusuario`, `contraseña`) VALUES
(1, 'superadmin', 'b640a0ce465fa2a4150c36b305c1c11b'),
(2, 'admin', '21232f297a57a5a743894a0e4a801fc3');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `efemeride`
--
ALTER TABLE `efemeride`
ADD PRIMARY KEY (`idefemeride`),
ADD KEY `FK_EFEMERIDE_PERSONAJE` (`idpersonaje`);
--
-- Indices de la tabla `personaje`
--
ALTER TABLE `personaje`
ADD PRIMARY KEY (`idpersonaje`);
--
-- Indices de la tabla `profesion`
--
ALTER TABLE `profesion`
ADD PRIMARY KEY (`idprofesion`);
--
-- Indices de la tabla `trabajo`
--
ALTER TABLE `trabajo`
ADD PRIMARY KEY (`idpersonaje`,`idprofesion`),
ADD KEY `FK_TRABAJO_PROFESION` (`idprofesion`);
--
-- Indices de la tabla `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`idusuario`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `efemeride`
--
ALTER TABLE `efemeride`
MODIFY `idefemeride` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT de la tabla `personaje`
--
ALTER TABLE `personaje`
MODIFY `idpersonaje` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=68;
--
-- AUTO_INCREMENT de la tabla `profesion`
--
ALTER TABLE `profesion`
MODIFY `idprofesion` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT de la tabla `usuario`
--
ALTER TABLE `usuario`
MODIFY `idusuario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `efemeride`
--
ALTER TABLE `efemeride`
ADD CONSTRAINT `FK_EFEMERIDE_PERSONAJE` FOREIGN KEY (`idpersonaje`) REFERENCES `personaje` (`idpersonaje`);
--
-- Filtros para la tabla `trabajo`
--
ALTER TABLE `trabajo`
ADD CONSTRAINT `FK_TRABAJO_PERSONAJE` FOREIGN KEY (`idpersonaje`) REFERENCES `personaje` (`idpersonaje`),
ADD CONSTRAINT `FK_TRABAJO_PROFESION` FOREIGN KEY (`idprofesion`) REFERENCES `profesion` (`idprofesion`);
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 */;
| true |
ab9c9be9332c6a3cc95e7c69f17f52142ad3e084 | SQL | amiraba/insarise-Symfony | /insarisedb.sql | UTF-8 | 21,602 | 3.203125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 11, 2016 at 10:01 AM
-- Server version: 10.1.10-MariaDB
-- PHP Version: 7.0.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `insarisedb`
--
-- --------------------------------------------------------
--
-- Table structure for table `achievement`
--
CREATE TABLE `achievement` (
`id_ach` int(11) UNSIGNED NOT NULL,
`nom_ach` varchar(50) DEFAULT NULL,
`description_ach` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `approbation`
--
CREATE TABLE `approbation` (
`id_mod_ap` int(11) UNSIGNED NOT NULL,
`id_proj_ap` int(11) UNSIGNED NOT NULL,
`date_ap` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `candidat`
--
CREATE TABLE `candidat` (
`id_cand` int(11) UNSIGNED NOT NULL,
`login_cand` varchar(50) NOT NULL,
`password_cand` varchar(50) NOT NULL,
`nom_cand` varchar(50) DEFAULT NULL,
`prenom_cand` varchar(50) DEFAULT NULL,
`email_cand` varchar(50) DEFAULT NULL,
`telephone_cand` varchar(50) DEFAULT NULL,
`adresse_cand` varchar(255) DEFAULT NULL,
`type_cand` enum('indiv','club') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `candidat`
--
INSERT INTO `candidat` (`id_cand`, `login_cand`, `password_cand`, `nom_cand`, `prenom_cand`, `email_cand`, `telephone_cand`, `adresse_cand`, `type_cand`) VALUES
(1, 'lili', 'lili', 'bouriel', 'ilhem', 'ilhem@gmail.com', '93 444 555', 'ariana', 'indiv'),
(2, 'sassou', 'sassou', 'amor', 'sarra', 'sassou@hotmail.com', '40 444 555', 'tunis', 'indiv'),
(3, 'netlinks', 'netlinks', 'net', 'links', 'netlinks@gmail.com', '71 444 555 ', 'insat', 'club'),
(4, 'android', 'android', 'android', 'android', 'android@yahoo.fr', '71 222 555', 'insat_palace', 'club'),
(5, 'mimi', 'mimi', 'marie', 'mmmm', 'matie@gmail.com', '50 222 111 ', 'sfax', 'indiv'),
(6, 'someone', 'someone', 'some', 'one', 'unknown@gmail.com', '92 554 888', 'ariana-tunis', 'indiv');
-- --------------------------------------------------------
--
-- Table structure for table `candidature`
--
CREATE TABLE `candidature` (
`id_cand_candid` int(10) UNSIGNED NOT NULL,
`id_proj_candid` int(10) UNSIGNED NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `candidature`
--
INSERT INTO `candidature` (`id_cand_candid`, `id_proj_candid`) VALUES
(1, 10);
-- --------------------------------------------------------
--
-- Table structure for table `candidat_competence`
--
CREATE TABLE `candidat_competence` (
`id_cand_ec` int(11) UNSIGNED NOT NULL,
`id_com_ec` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `candidat_competence`
--
INSERT INTO `candidat_competence` (`id_cand_ec`, `id_com_ec`) VALUES
(1, 2),
(1, 4),
(1, 8),
(1, 10),
(1, 13),
(1, 15),
(1, 18),
(1, 22),
(2, 1),
(2, 6),
(2, 8),
(2, 9),
(2, 11),
(2, 12),
(3, 1),
(3, 3),
(3, 8),
(3, 16),
(3, 17),
(3, 19),
(4, 4),
(4, 9),
(4, 13),
(4, 14),
(4, 15),
(4, 17),
(4, 18),
(5, 1),
(5, 5),
(5, 12),
(5, 13),
(5, 14),
(5, 15),
(5, 18),
(6, 8),
(6, 10),
(6, 18),
(6, 21),
(6, 22),
(6, 24);
-- --------------------------------------------------------
--
-- Table structure for table `competence`
--
CREATE TABLE `competence` (
`id_com` int(11) UNSIGNED NOT NULL,
`nom_com` varchar(50) DEFAULT NULL,
`description_com` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `competence`
--
INSERT INTO `competence` (`id_com`, `nom_com`, `description_com`) VALUES
(1, 'Wordpress', 'technologie web'),
(2, 'angular js', 'technologie web'),
(3, 'jee', 'architecture java'),
(4, 'java', 'langage de programmation'),
(5, 'linux shell', 'systeme d''exploitation'),
(6, 'node js', 'technologie web'),
(7, 'python', 'langage de programmation'),
(8, 'php', 'langage de programmation'),
(9, 'symfony3', 'framework php'),
(10, 'html5&css3', 'web deseign'),
(11, 'javascript', 'technologie web'),
(12, 'ajax', 'technologie web'),
(13, 'ruby', 'langage de programmation'),
(14, 'ruby on rails', 'framework ruby'),
(15, 'unity', 'jeu video'),
(16, '.net', 'framework c#'),
(17, 'c#', 'langage de programmation'),
(18, 'c++', 'langage de programmation'),
(19, 'andoid', 'os phone'),
(20, 'ios', 'os phone'),
(21, 'MongoDB', 'hhhhhh'),
(22, 'clojure', 'ffff'),
(23, 'web_security', 'fsssx'),
(24, 'jQuery', 'hhhhhhh'),
(25, 'asp.net', 'ggdgssre');
-- --------------------------------------------------------
--
-- Table structure for table `entreprise`
--
CREATE TABLE `entreprise` (
`id_ent` int(11) UNSIGNED NOT NULL,
`login_ent` varchar(50) DEFAULT NULL,
`password_ent` varchar(50) DEFAULT NULL,
`nom_ent` varchar(50) DEFAULT NULL,
`nom_responsable_ent` varchar(255) DEFAULT NULL,
`email_ent` varchar(50) DEFAULT NULL,
`adresse_ent` varchar(255) DEFAULT NULL,
`description_ent` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `entreprise`
--
INSERT INTO `entreprise` (`id_ent`, `login_ent`, `password_ent`, `nom_ent`, `nom_responsable_ent`, `email_ent`, `adresse_ent`, `description_ent`) VALUES
(1, 'sungard', 'sungard', 'sungard', 'aaaa', 'sungard@gmail.com', 'tunis', 'SunGard is one of the world’s leading software and technology services companies, with annual revenue of about $2.8 billion. SunGard provides software and processing solutions for financial services, education and the public sector. SunGard serves approximately 16,000 customers in more than 100 countries and has more than 13,000 employees.'),
(2, 'linedata', 'linedata', 'linedata', 'bbbb', 'linedata@gmail.com', 'tunis', 'Linedata est un éditeur de solutions globales, dédiées à la communauté internationale des professionnels de l’asset management, de l’assurance et du crédit'),
(3, 'vermeg', 'vermeg', 'vermeg', 'cccc', 'vermeg@gmail.com', 'tunis', 'At Vermeg, we deliver trusted financial software that allows our clients to focus on their core competencies without worrying about their IT solutions.\r\n\r\nWe are the partner of choice of financial institutions all over Europe and beyond.'),
(4, 'vynd', 'vynd', 'vynd', 'dddd', 'vynd@gmail.com', 'manar_tunis', 'Vynd is a community platform and participatory space for sharing opinions, experiences and information about entreprises and local businesses in Tunisia. Accessible through the website vynd.tn and the mobile application, it is made by and for users. As an urban guide, Vynd is a pledge of confidence between its members and business owners. Its mission is to contribute to improve the services provided by companies and local businesses while highlighting the voice of the customer.'),
(5, 'sofrecom', 'sofrecom', 'sofrecom', 'eeeee', 'sofrecom@yahoo.com', 'lac_tunis', 'Sofrecom, filiale d’Orange, développe depuis 50 ans un savoir-faire unique dans les métiers de l’opérateur, ce qui en fait un leader mondial du conseil et de l’ingénierie télécom.\r\n\r\nSon expérience des marchés matures et des économies émergentes, conjuguée à sa solide connaissance des évolutions structurantes du marché des télécommunications, en font un partenaire incontournable pour les opérateurs, les gouvernements et les investisseurs internationaux.'),
(6, 'ericsson', 'ericsson', 'ericsson', 'ssss', 'ericsson@hotmail.fr', 'lac2-tunis', 'At Ericsson, we strive to connect everyone, wherever they may be. Because by being connected, people can take part in the emerging global collaboration that is the Networked Society - a society in which every person and every industry is empowered to reach their full potential.\r\nOur services, software and infrastructure - especially in mobility, broadband and the cloud - are enabling the communications industry and other sectors to do better business, increase efficiency, improve their users'' experience and capture new opportunities.');
-- --------------------------------------------------------
--
-- Table structure for table `etape`
--
CREATE TABLE `etape` (
`id_et` int(11) UNSIGNED NOT NULL,
`id_proj_et` int(11) UNSIGNED NOT NULL,
`id_ent_et` int(11) UNSIGNED NOT NULL,
`id_cand_et` int(11) UNSIGNED DEFAULT NULL,
`nom_et` varchar(50) DEFAULT NULL,
`description_et` varchar(50) DEFAULT NULL,
`date_achevement_et` date DEFAULT NULL,
`datevalidation_et` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `etape`
--
INSERT INTO `etape` (`id_et`, `id_proj_et`, `id_ent_et`, `id_cand_et`, `nom_et`, `description_et`, `date_achevement_et`, `datevalidation_et`) VALUES
(11, 1, 1, NULL, 'Define a Problem', ' he first step is a project management is defining', '2016-05-07', '2016-05-09'),
(12, 1, 1, NULL, 'Plan the Project', 'Devising the project plan is to define the scope o', '2016-05-09', '2016-05-09'),
(13, 1, 1, NULL, 'Execute the Plan', 'Executing is the process that being used to comple', '2016-05-09', '2016-05-09'),
(14, 1, 1, NULL, 'Monitor and Control Progress', 'Potential problems can be identified by monitoring', '2016-05-09', '2016-05-09'),
(15, 1, 1, NULL, 'Close Project', 'Closing is a controlled way to end a project. ', NULL, NULL),
(27, 3, 3, NULL, ' Definition / initiation', ' The first step in the process is defining the ob', '2016-05-09', '2016-05-09'),
(28, 3, 3, NULL, 'Planning', 'Once you’ve defined all the objectives, goals and ', '2016-05-09', '2016-05-09'),
(29, 3, 3, NULL, ' Execution', 'So you’ve got everything planned out, now it’s tim', NULL, NULL),
(30, 3, 3, NULL, ' Control', 'This step is also known as Quality Control and als', NULL, NULL),
(31, 3, 3, NULL, 'Post-Mortem', 'Great, the project is finished, the client is happ', NULL, NULL),
(32, 10, 1, NULL, 'etape1', ' frgggffd', '2016-05-11', '2016-05-11'),
(33, 10, 1, NULL, '', '', NULL, NULL),
(34, 10, 1, NULL, 'etape2', 'd;d,klnssd!lffnmnmf', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `gratifie`
--
CREATE TABLE `gratifie` (
`id_proj` int(11) UNSIGNED NOT NULL,
`id_ent` int(11) UNSIGNED NOT NULL,
`id_cand` int(11) UNSIGNED NOT NULL,
`id_ach` int(11) UNSIGNED NOT NULL,
`date` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `message`
--
CREATE TABLE `message` (
`id_mes` int(11) UNSIGNED NOT NULL,
`id_emetteur_mes` int(11) UNSIGNED NOT NULL,
`type_emetteur_mes` enum('Candidat','entreprise') NOT NULL,
`id_destinataire_mes` int(11) UNSIGNED NOT NULL,
`type_destinataire_mes` enum('Candidat','entreprise') NOT NULL,
`titre_mes` varchar(50) DEFAULT NULL,
`contenu_mes` text,
`dateenvoi_mes` date DEFAULT NULL,
`datelecture_mes` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `message`
--
INSERT INTO `message` (`id_mes`, `id_emetteur_mes`, `type_emetteur_mes`, `id_destinataire_mes`, `type_destinataire_mes`, `titre_mes`, `contenu_mes`, `dateenvoi_mes`, `datelecture_mes`) VALUES
(1, 1, 'Candidat', 3, 'entreprise', 'ggggggggggg', 'ezf ez zfre e ', '2016-05-10', NULL),
(2, 1, 'entreprise', 1, 'Candidat', 'hhhhhhh', 'dsssssssssssss', '2016-05-10', NULL),
(4, 7, 'entreprise', 10, 'Candidat', 'gggggggg', 'hhhhhhhhhhhhhhhh', '2016-05-11', NULL),
(6, 7, 'entreprise', 10, 'Candidat', 'bravoooooooooooooo', 'excellent travail INSARISE ', '2016-05-11', NULL),
(7, 1, 'Candidat', 1, 'entreprise', 'aaaaaaaaaaaa', 'fddddddddddddddd', '2016-05-11', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `moderateur`
--
CREATE TABLE `moderateur` (
`id_mod` int(11) UNSIGNED NOT NULL,
`login_mod` varchar(50) DEFAULT NULL,
`password_mod` varchar(50) DEFAULT NULL,
`nom_mod` varchar(50) DEFAULT NULL,
`prenom_mod` varchar(50) DEFAULT NULL,
`email_mod` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `moderateur`
--
INSERT INTO `moderateur` (`id_mod`, `login_mod`, `password_mod`, `nom_mod`, `prenom_mod`, `email_mod`) VALUES
(1, 'mod1', 'mod1', 'nom_mod1', 'prenom_mod2', 'mode@gmail.com');
-- --------------------------------------------------------
--
-- Table structure for table `projet`
--
CREATE TABLE `projet` (
`id_proj` int(11) UNSIGNED NOT NULL,
`id_ent_proj` int(11) UNSIGNED NOT NULL,
`id_cand_proj` int(11) UNSIGNED DEFAULT NULL,
`nom_proj` varchar(50) DEFAULT NULL,
`description_proj` text,
`statut_proj` enum('non_classé','approuvé','désapprouvé','') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `projet`
--
INSERT INTO `projet` (`id_proj`, `id_ent_proj`, `id_cand_proj`, `nom_proj`, `description_proj`, `statut_proj`) VALUES
(1, 1, 0, 'site e-commerce', 'le but de ce projet consiste à la création d''un site web e-commerce ', 'non_classé'),
(2, 1, 0, 'application android', 'application android pour la gestion des services hoteliers', 'approuvé'),
(3, 3, 0, 'Landing Page- One page', 'Looking for a simple clean landing page to link to a Facebook add for lead conversion. I will provide some content for the general idea, but will need the freelancer to be creative to possibly add to it and have knowledge of marketing for what works and what doesn''t', 'non_classé'),
(4, 4, 0, 'Wordpress site', ' Our company is looking for Wordpress Theme and Plugin developer to work as freelancer for long term job. Need to have a good portfolio. ', 'non_classé'),
(5, 6, 0, 'Automated Web Browsing on Ubuntu with Java', '''m looking for someone who has experience making Java front-end (UI) applications that run on Ubuntu Linux. It''ll be a high-performance, asynchronous web browsing system, automatically navigating through millions of pages from 40 simultaneous browser frames. Here is the full description: https://www.evernote.com/shard/s5/sh/faaf55e9-a44b-4ef9-94c7-6c8ba2bd675c/acb309796ac26914afe5d49d46ea27c9 To be eligible, in your application please summarize the Evernote file (above) in your own words, and describe the most similar application you''ve ever made (just ONE example of your best, don''t send me a long list of examples).', 'approuvé'),
(6, 6, 0, 'Viral theme site', 'Looking for someone who can: 1. Recommend a wordpress theme of Likes.com and set it up accordingly. 2. The mobile site must be the same as what in the likes.com This is an ongoing project. I would appreciate if you can send me your quotation.', 'approuvé'),
(7, 4, 0, 'Creat website and IOS app for cars sell', 'I would like to creat a websit page and application for IOS software. The site and app will cars sale such as cars.com and autotrader with some changes.', 'approuvé'),
(8, 3, 0, 'Senior Python/Django And React/Angular Developer', 'Looking for an experienced Python + Javascript developer to implement a web-based text data management system. The interface needs to be snappy (asynchronous), attractive, and responsive / mobile-ready, but it does not need fancy graphics. We are interested in the following technologies: Frontend -> React or AngularJS Backend -> Python, Django, PostgreSQL', 'non_classé'),
(9, 3, 0, 'web tool for checking the update on CrunchBase', 'I would like to ask you to make a tool for checking the update on CrunchBase (https://www.crunchbase.com/) focusing in location. The tool should be developed like - For checking how many companies would be added in a period of time on Crunchbase. - I am thinking there is no need to make crawler, but using API provided by them. (https://data.crunchbase.com/) - Using Clojure (of course with some java libraries would be nice) and MongoDB as backend - A frontend (web page) would be very simple (like just listing the updated list with some parameters, like from date and to date) ', 'non_classé'),
(10, 1, 1, 'projet1', 'd jnrn leb kjfndfdfkj nerbn reljnrmk r', 'approuvé');
-- --------------------------------------------------------
--
-- Table structure for table `projet_competence`
--
CREATE TABLE `projet_competence` (
`id_proj_pc` int(11) UNSIGNED NOT NULL,
`id_com_pc` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `projet_competence`
--
INSERT INTO `projet_competence` (`id_proj_pc`, `id_com_pc`) VALUES
(1, 1),
(1, 8),
(1, 10),
(2, 19),
(3, 8),
(3, 10),
(3, 12),
(4, 1),
(4, 10),
(5, 5),
(5, 9),
(6, 1),
(6, 5),
(6, 10),
(7, 10),
(7, 20),
(8, 7),
(8, 10),
(8, 11),
(10, 1),
(10, 2),
(10, 3);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `achievement`
--
ALTER TABLE `achievement`
ADD PRIMARY KEY (`id_ach`);
--
-- Indexes for table `approbation`
--
ALTER TABLE `approbation`
ADD PRIMARY KEY (`id_mod_ap`,`id_proj_ap`),
ADD KEY `fk_approbation_projet` (`id_proj_ap`);
--
-- Indexes for table `candidat`
--
ALTER TABLE `candidat`
ADD PRIMARY KEY (`id_cand`),
ADD KEY `fk_estdetype` (`type_cand`);
--
-- Indexes for table `candidature`
--
ALTER TABLE `candidature`
ADD PRIMARY KEY (`id_cand_candid`,`id_proj_candid`),
ADD KEY `id_proj_candid` (`id_proj_candid`);
--
-- Indexes for table `candidat_competence`
--
ALTER TABLE `candidat_competence`
ADD PRIMARY KEY (`id_cand_ec`,`id_com_ec`),
ADD KEY `fk_etudiant_competence2` (`id_com_ec`);
--
-- Indexes for table `competence`
--
ALTER TABLE `competence`
ADD PRIMARY KEY (`id_com`);
--
-- Indexes for table `entreprise`
--
ALTER TABLE `entreprise`
ADD PRIMARY KEY (`id_ent`);
--
-- Indexes for table `etape`
--
ALTER TABLE `etape`
ADD PRIMARY KEY (`id_et`),
ADD KEY `fk_etape_projet` (`id_proj_et`),
ADD KEY `fk_etape_entreprise` (`id_ent_et`),
ADD KEY `fk_etape_etud` (`id_cand_et`);
--
-- Indexes for table `gratifie`
--
ALTER TABLE `gratifie`
ADD PRIMARY KEY (`id_proj`,`id_ent`,`id_cand`,`id_ach`),
ADD KEY `fk_grat_ent` (`id_ent`),
ADD KEY `fk_grat_etud` (`id_cand`),
ADD KEY `fk_grat_ach` (`id_ach`);
--
-- Indexes for table `message`
--
ALTER TABLE `message`
ADD PRIMARY KEY (`id_mes`),
ADD KEY `fk_emetteur` (`id_emetteur_mes`),
ADD KEY `fk_destinataire` (`id_destinataire_mes`);
--
-- Indexes for table `moderateur`
--
ALTER TABLE `moderateur`
ADD PRIMARY KEY (`id_mod`);
--
-- Indexes for table `projet`
--
ALTER TABLE `projet`
ADD PRIMARY KEY (`id_proj`),
ADD KEY `fk_projet_ent` (`id_ent_proj`);
--
-- Indexes for table `projet_competence`
--
ALTER TABLE `projet_competence`
ADD PRIMARY KEY (`id_proj_pc`,`id_com_pc`),
ADD KEY `fk_projet_competence_comp` (`id_com_pc`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `achievement`
--
ALTER TABLE `achievement`
MODIFY `id_ach` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `candidat`
--
ALTER TABLE `candidat`
MODIFY `id_cand` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `competence`
--
ALTER TABLE `competence`
MODIFY `id_com` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;
--
-- AUTO_INCREMENT for table `entreprise`
--
ALTER TABLE `entreprise`
MODIFY `id_ent` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `etape`
--
ALTER TABLE `etape`
MODIFY `id_et` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
--
-- AUTO_INCREMENT for table `message`
--
ALTER TABLE `message`
MODIFY `id_mes` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `moderateur`
--
ALTER TABLE `moderateur`
MODIFY `id_mod` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `projet`
--
ALTER TABLE `projet`
MODIFY `id_proj` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `approbation`
--
ALTER TABLE `approbation`
ADD CONSTRAINT `fk_approbation_moderateur` FOREIGN KEY (`id_mod_ap`) REFERENCES `moderateur` (`id_mod`),
ADD CONSTRAINT `fk_approbation_projet` FOREIGN KEY (`id_proj_ap`) REFERENCES `projet` (`id_proj`);
--
-- Constraints for table `candidat_competence`
--
ALTER TABLE `candidat_competence`
ADD CONSTRAINT `fk_etudiant_competence1` FOREIGN KEY (`id_cand_ec`) REFERENCES `candidat` (`id_cand`),
ADD CONSTRAINT `fk_etudiant_competence2` FOREIGN KEY (`id_com_ec`) REFERENCES `competence` (`id_com`);
--
-- Constraints for table `etape`
--
ALTER TABLE `etape`
ADD CONSTRAINT `fk_etape_entreprise` FOREIGN KEY (`id_ent_et`) REFERENCES `entreprise` (`id_ent`),
ADD CONSTRAINT `fk_etape_etud` FOREIGN KEY (`id_cand_et`) REFERENCES `candidat` (`id_cand`),
ADD CONSTRAINT `fk_etape_projet` FOREIGN KEY (`id_proj_et`) REFERENCES `projet` (`id_proj`);
--
-- Constraints for table `projet`
--
ALTER TABLE `projet`
ADD CONSTRAINT `fk_projet_ent` FOREIGN KEY (`id_ent_proj`) REFERENCES `entreprise` (`id_ent`);
--
-- Constraints for table `projet_competence`
--
ALTER TABLE `projet_competence`
ADD CONSTRAINT `fk_projet_competence_comp` FOREIGN KEY (`id_com_pc`) REFERENCES `competence` (`id_com`),
ADD CONSTRAINT `fk_projet_competence_projet` FOREIGN KEY (`id_proj_pc`) REFERENCES `projet` (`id_proj`);
/*!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 */;
| true |
e8c874b5ec7ff1238ea656f79b5bae6039bed613 | SQL | haohuiyao/commerce | /program/database/commerce002.sql | UTF-8 | 19,157 | 3.515625 | 4 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50505
Source Host : localhost:3306
Source Database : commerce
Target Server Type : MYSQL
Target Server Version : 50505
File Encoding : 65001
Date: 2017-07-20 16:58:29
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for mng_shop
-- ----------------------------
DROP TABLE IF EXISTS `mng_shop`;
CREATE TABLE `mng_shop` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`NAME` varchar(256) DEFAULT NULL,
`PROVINCE` varchar(16) DEFAULT NULL,
`CITY` varchar(16) DEFAULT NULL,
`DISTRICT` varchar(16) DEFAULT NULL,
`ADDRESS` varchar(255) DEFAULT NULL,
`TRADER_ID` int(11) DEFAULT NULL,
`STATUS` varchar(4) DEFAULT NULL,
`IDENTIFYING` varchar(4) DEFAULT NULL,
`PHONE` varchar(16) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `TRADER_ID` (`TRADER_ID`),
CONSTRAINT `mng_shop_ibfk_1` FOREIGN KEY (`TRADER_ID`) REFERENCES `mng_trader` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mng_sku_attr_pair
-- ----------------------------
DROP TABLE IF EXISTS `mng_sku_attr_pair`;
CREATE TABLE `mng_sku_attr_pair` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`SKU_ID` int(11) DEFAULT NULL,
`SKU_KEY_ID` int(11) DEFAULT NULL,
`SKU_VALUE_ID` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `SKU_ID` (`SKU_ID`) USING BTREE,
KEY `SKU_KEY_ID` (`SKU_KEY_ID`) USING BTREE,
KEY `SKU_VALUE_ID` (`SKU_VALUE_ID`) USING BTREE,
CONSTRAINT `mng_sku_attr_pair_ibfk_2` FOREIGN KEY (`SKU_KEY_ID`) REFERENCES `mng_sku_key` (`SKU_KEY_ID`),
CONSTRAINT `mng_sku_attr_pair_ibfk_3` FOREIGN KEY (`SKU_VALUE_ID`) REFERENCES `mng_sku_value` (`SKU_VALUE_ID`),
CONSTRAINT `mng_sku_attr_pair_ibfk_4` FOREIGN KEY (`SKU_ID`) REFERENCES `mn_sku` (`SKU_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mng_sku_key
-- ----------------------------
DROP TABLE IF EXISTS `mng_sku_key`;
CREATE TABLE `mng_sku_key` (
`SKU_KEY_ID` int(11) NOT NULL AUTO_INCREMENT,
`KEY_NAME` varchar(255) DEFAULT NULL,
`GOODS_ID` int(11) DEFAULT NULL,
PRIMARY KEY (`SKU_KEY_ID`),
KEY `GOODS_ID` (`GOODS_ID`) USING BTREE,
CONSTRAINT `mng_sku_key_ibfk_1` FOREIGN KEY (`GOODS_ID`) REFERENCES `mn_product` (`PRODUCT_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mng_sku_value
-- ----------------------------
DROP TABLE IF EXISTS `mng_sku_value`;
CREATE TABLE `mng_sku_value` (
`SKU_VALUE_ID` int(11) NOT NULL AUTO_INCREMENT,
`SKU_KEY_ID` int(11) DEFAULT NULL,
`WORDS` varchar(255) DEFAULT NULL,
`VALUE_IMG_PATH` varchar(255) DEFAULT NULL,
PRIMARY KEY (`SKU_VALUE_ID`),
KEY `SKU_KEY_ID` (`SKU_KEY_ID`) USING BTREE,
CONSTRAINT `mng_sku_value_ibfk_1` FOREIGN KEY (`SKU_KEY_ID`) REFERENCES `mng_sku_key` (`SKU_KEY_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=83 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mng_trader
-- ----------------------------
DROP TABLE IF EXISTS `mng_trader`;
CREATE TABLE `mng_trader` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`IMG_URL` varchar(1024) DEFAULT NULL,
`NAME` varchar(1024) DEFAULT NULL,
`CONTACT_NAME` varchar(16) DEFAULT NULL,
`CONTACT_PHONE` varchar(16) DEFAULT NULL,
`CONTACT_EMAIL` varchar(256) DEFAULT NULL,
`REGISTER_TIME` datetime DEFAULT NULL,
`SETTLE_BY_MONTH` varchar(4) DEFAULT NULL COMMENT '是否可以月结[Y:是;N:否]',
`STATUS` varchar(4) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mnp_account
-- ----------------------------
DROP TABLE IF EXISTS `mnp_account`;
CREATE TABLE `mnp_account` (
`UUID` varchar(50) NOT NULL COMMENT 'uuid',
`STATUS` varchar(8) DEFAULT NULL COMMENT '状态',
PRIMARY KEY (`UUID`),
KEY `mn_acct_uuid` (`UUID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mnp_acc_normal
-- ----------------------------
DROP TABLE IF EXISTS `mnp_acc_normal`;
CREATE TABLE `mnp_acc_normal` (
`NORMAL_PP_ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`USER_NAME` varchar(120) DEFAULT NULL COMMENT '用户名',
`PWD` varchar(100) NOT NULL COMMENT '密码',
`ACCT_UUID` varchar(50) DEFAULT NULL COMMENT '关联的ACCOUNT的UUID',
PRIMARY KEY (`NORMAL_PP_ID`),
KEY `mnp_acc_normal_ibfk_1` (`ACCT_UUID`) USING BTREE,
CONSTRAINT `mnp_acc_normal_ibfk_1` FOREIGN KEY (`ACCT_UUID`) REFERENCES `mnp_account` (`UUID`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mnp_acc_phone
-- ----------------------------
DROP TABLE IF EXISTS `mnp_acc_phone`;
CREATE TABLE `mnp_acc_phone` (
`PHONE_PP_ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`PHONE` varchar(16) DEFAULT NULL COMMENT '手机号',
`ACCT_UUID` varchar(50) DEFAULT NULL COMMENT '关联的ACCOUNT的UUID',
PRIMARY KEY (`PHONE_PP_ID`),
KEY `phone_vcode_pp_fk_1` (`ACCT_UUID`) USING BTREE,
CONSTRAINT `mnp_acc_phone_ibfk_1` FOREIGN KEY (`ACCT_UUID`) REFERENCES `mnp_account` (`UUID`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mnp_acc_qq
-- ----------------------------
DROP TABLE IF EXISTS `mnp_acc_qq`;
CREATE TABLE `mnp_acc_qq` (
`QQ_PP_ID` int(11) NOT NULL AUTO_INCREMENT,
`OPEN_ID` varchar(60) DEFAULT NULL,
`ACCT_UUID` varchar(50) DEFAULT NULL,
PRIMARY KEY (`QQ_PP_ID`),
KEY `ACCT_UUID` (`ACCT_UUID`),
CONSTRAINT `mnp_acc_qq_ibfk_1` FOREIGN KEY (`ACCT_UUID`) REFERENCES `mnp_account` (`UUID`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mnp_acc_wx
-- ----------------------------
DROP TABLE IF EXISTS `mnp_acc_wx`;
CREATE TABLE `mnp_acc_wx` (
`WX_PP_ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`OPEN_ID` varchar(60) DEFAULT NULL COMMENT '用户微信登录唯一ID',
`ACCT_UUID` varchar(50) DEFAULT NULL COMMENT '关联的ACCOUNT的UUID',
PRIMARY KEY (`WX_PP_ID`),
KEY `mnp_acc_wx_ibfk_1` (`ACCT_UUID`) USING BTREE,
CONSTRAINT `mnp_acc_wx_ibfk_1` FOREIGN KEY (`ACCT_UUID`) REFERENCES `mnp_account` (`UUID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mnp_login_record
-- ----------------------------
DROP TABLE IF EXISTS `mnp_login_record`;
CREATE TABLE `mnp_login_record` (
`UUID` varchar(50) NOT NULL,
`ENTRY_TYPE` varchar(8) NOT NULL,
`TOKEN` varchar(255) DEFAULT NULL,
`LAST_LOGIN_TIME` datetime DEFAULT NULL,
PRIMARY KEY (`UUID`,`ENTRY_TYPE`),
CONSTRAINT `mnp_login_record_ibfk_1` FOREIGN KEY (`UUID`) REFERENCES `mnp_account` (`UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mnu_base_user
-- ----------------------------
DROP TABLE IF EXISTS `mnu_base_user`;
CREATE TABLE `mnu_base_user` (
`USER_ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户主键',
`NAME` varchar(32) DEFAULT NULL COMMENT '姓名',
`GENDER` varchar(8) DEFAULT NULL COMMENT '性别',
`CREATE_TIME` timestamp NULL DEFAULT NULL COMMENT '创建时间',
`USER_TYPE` varchar(6) DEFAULT NULL COMMENT '用户类型:1普通用户 2管理员 3经销商',
`ACCT_UUID` varchar(50) DEFAULT NULL COMMENT '关联的ACCOUNT_UUID',
PRIMARY KEY (`USER_ID`),
KEY `ACCT_UUID` (`ACCT_UUID`) USING BTREE,
CONSTRAINT `mnu_base_user_ibfk_1` FOREIGN KEY (`ACCT_UUID`) REFERENCES `mnp_account` (`UUID`)
) ENGINE=InnoDB AUTO_INCREMENT=2272 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_area
-- ----------------------------
DROP TABLE IF EXISTS `mn_area`;
CREATE TABLE `mn_area` (
`ID` int(10) NOT NULL,
`NAME` varchar(64) NOT NULL,
`PARENT_ID` int(10) DEFAULT '0',
`LEVEL` tinyint(4) DEFAULT '0' COMMENT '区域等级',
`INITIALS` varchar(16) DEFAULT 'A' COMMENT '首字母',
PRIMARY KEY (`ID`),
KEY `parent_id` (`PARENT_ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_category
-- ----------------------------
DROP TABLE IF EXISTS `mn_category`;
CREATE TABLE `mn_category` (
`CATEGORY_ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '分类ID',
`CATEGORY_NAME` varchar(50) DEFAULT NULL COMMENT '分类名',
`LEVEL` int(11) DEFAULT NULL COMMENT '菜单级别',
`STYLE` varchar(40) DEFAULT NULL COMMENT '样式',
`ABBREVIATION` varchar(20) DEFAULT NULL COMMENT '首字母缩写',
`PARENT_ID` int(11) DEFAULT NULL COMMENT '上级菜单ID',
`TEMPLATE_ID` int(11) DEFAULT NULL COMMENT '分类参数模板ID',
`IMG_URL` varchar(255) DEFAULT NULL COMMENT '分类图片地址',
`STATUS` varchar(6) DEFAULT NULL COMMENT '状态(A:可用 D:禁用)',
`CREATE_TIME` datetime DEFAULT NULL,
PRIMARY KEY (`CATEGORY_ID`),
KEY `TEMPLATE_ID` (`TEMPLATE_ID`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_config
-- ----------------------------
DROP TABLE IF EXISTS `mn_config`;
CREATE TABLE `mn_config` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`NAME` varchar(32) DEFAULT NULL COMMENT '参数名',
`VALUE` varchar(255) DEFAULT NULL COMMENT '参数值',
`MODIFY_TIME` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_franking_templet
-- ----------------------------
DROP TABLE IF EXISTS `mn_franking_templet`;
CREATE TABLE `mn_franking_templet` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`FARENAME` varchar(20) DEFAULT NULL COMMENT '模板名称',
`POSTAGE` varchar(4) DEFAULT NULL COMMENT '是否包邮',
`PATTERN` int(11) DEFAULT NULL COMMENT '计费方式',
`DISPATCHING` varchar(11) DEFAULT NULL COMMENT '配送方式',
`BASEWEIGHT` decimal(11,2) DEFAULT NULL COMMENT '基本重量',
`BASEPRICE` decimal(11,2) DEFAULT NULL COMMENT '基本价钱',
`ADDWEIGHT` decimal(11,2) DEFAULT NULL COMMENT '新增重量',
`ADDPRICE` decimal(11,2) DEFAULT NULL COMMENT '价钱',
`SCOPE` varchar(10) DEFAULT NULL COMMENT '配送范围 0:全国',
`UPDATETIME` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_param_template
-- ----------------------------
DROP TABLE IF EXISTS `mn_param_template`;
CREATE TABLE `mn_param_template` (
`TEMPLATE_ID` int(11) NOT NULL AUTO_INCREMENT,
`CONTENT` text,
`CREATE_TIME` datetime DEFAULT NULL,
`STATUS` varchar(6) NOT NULL COMMENT '状态(A:可用 D:禁用)',
`NAME` varchar(64) DEFAULT NULL COMMENT '模板名',
PRIMARY KEY (`TEMPLATE_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_product
-- ----------------------------
DROP TABLE IF EXISTS `mn_product`;
CREATE TABLE `mn_product` (
`PRODUCT_ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '具体的商品',
`NAME` varchar(64) CHARACTER SET utf8 DEFAULT NULL,
`SUMMARY` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '商品简介',
`DETAIL` text CHARACTER SET utf8 COMMENT '商品详情',
`CATEGORY_ID` int(11) DEFAULT NULL COMMENT '商品所属的分类ID',
`CREATE_TIME` datetime DEFAULT NULL,
`TEMPLATE_ID` int(11) DEFAULT NULL COMMENT '参数模板',
`PARAMS_VALUE` varchar(1024) CHARACTER SET utf8 DEFAULT NULL COMMENT '模板参数值',
`STATUS` varchar(6) CHARACTER SET utf8 DEFAULT NULL COMMENT '状态(A:可用 D:禁用)',
`MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改的时间',
`PRODUCT_BRAND_ID` int(11) DEFAULT NULL COMMENT '商品品牌',
`SOURCE_ID` int(11) DEFAULT NULL COMMENT '商品货源',
`PLACE` varchar(40) CHARACTER SET utf8 DEFAULT NULL COMMENT '商品产地',
`CODE` varchar(40) CHARACTER SET utf8 DEFAULT NULL,
`COST` decimal(10,2) DEFAULT NULL COMMENT '商品成本价',
`PICTURE` text CHARACTER SET utf8 COMMENT '商品图片',
`COMMON` varchar(10) CHARACTER SET utf8 DEFAULT NULL COMMENT '商品通用名',
`CURRENCY` varchar(5) CHARACTER SET utf8 DEFAULT NULL COMMENT '标识是否为全国统一价',
`WEIGHT` varchar(11) CHARACTER SET utf8 DEFAULT NULL,
`VOLUME` varchar(11) CHARACTER SET utf8 DEFAULT NULL,
`CARRIAGEID` int(11) DEFAULT NULL COMMENT '运费模板Id',
`DISPLAY_IMG` varchar(1024) CHARACTER SET utf8 DEFAULT NULL COMMENT '首图',
PRIMARY KEY (`PRODUCT_ID`),
KEY `CATEGORY_ID` (`CATEGORY_ID`),
KEY `PRODUCT_BRAND_ID` (`PRODUCT_BRAND_ID`),
KEY `TEMPLATE_ID` (`TEMPLATE_ID`),
KEY `SOURCE_ID` (`SOURCE_ID`),
CONSTRAINT `mn_product_ibfk_1` FOREIGN KEY (`CATEGORY_ID`) REFERENCES `mn_category` (`CATEGORY_ID`),
CONSTRAINT `mn_product_ibfk_2` FOREIGN KEY (`PRODUCT_BRAND_ID`) REFERENCES `mn_product_brand` (`ID`),
CONSTRAINT `mn_product_ibfk_3` FOREIGN KEY (`TEMPLATE_ID`) REFERENCES `mn_param_template` (`TEMPLATE_ID`),
CONSTRAINT `mn_product_ibfk_4` FOREIGN KEY (`SOURCE_ID`) REFERENCES `mn_source` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for mn_product_brand
-- ----------------------------
DROP TABLE IF EXISTS `mn_product_brand`;
CREATE TABLE `mn_product_brand` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`BRAND_NAME` varchar(20) DEFAULT NULL,
`IMG_URL` varchar(1024) DEFAULT NULL,
`STATUS` varchar(4) DEFAULT NULL,
`ABBREVIATION` varchar(20) DEFAULT NULL COMMENT '品牌缩写',
`GROOM` varchar(4) DEFAULT NULL COMMENT '是否推荐 0:否 1:是',
`GROOM_TIME` datetime DEFAULT NULL COMMENT '设置时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_product_model
-- ----------------------------
DROP TABLE IF EXISTS `mn_product_model`;
CREATE TABLE `mn_product_model` (
`ID` int(11) NOT NULL,
`BRAND_ID` int(11) DEFAULT NULL COMMENT '品牌ID',
`MODEL_NAME` varchar(256) DEFAULT NULL COMMENT '机型名称',
`PARENT` int(11) DEFAULT NULL COMMENT '父级ID',
PRIMARY KEY (`ID`),
KEY `BRAND_ID` (`BRAND_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for mn_product_rel
-- ----------------------------
DROP TABLE IF EXISTS `mn_product_rel`;
CREATE TABLE `mn_product_rel` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`rel_type` int(6) DEFAULT NULL COMMENT ' 用来表示obj1与obj2的关系',
`obj_type1` int(6) DEFAULT NULL,
`obj_id1` int(11) DEFAULT NULL,
`obj_type2` int(6) DEFAULT NULL,
`obj_id2` int(11) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for mn_recommend_genre
-- ----------------------------
DROP TABLE IF EXISTS `mn_recommend_genre`;
CREATE TABLE `mn_recommend_genre` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`POSITION` int(5) DEFAULT NULL,
`IMGURL` varchar(255) DEFAULT NULL,
`CATEGORY_ID` int(11) DEFAULT NULL,
`CREATETIME` datetime DEFAULT NULL,
`TYPE` int(5) DEFAULT NULL COMMENT '1:推荐类别 2:类别展示',
`SIGN` varchar(5) NOT NULL COMMENT '标记添加的是大类还是细类',
PRIMARY KEY (`ID`),
KEY `CATEGORY_ID` (`CATEGORY_ID`),
CONSTRAINT `mn_recommend_genre_ibfk_1` FOREIGN KEY (`CATEGORY_ID`) REFERENCES `mn_category` (`CATEGORY_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_shelves
-- ----------------------------
DROP TABLE IF EXISTS `mn_shelves`;
CREATE TABLE `mn_shelves` (
`SHELVES_ID` int(11) NOT NULL AUTO_INCREMENT,
`NAME` varchar(32) DEFAULT NULL,
`SHOP_ID` int(11) DEFAULT NULL,
PRIMARY KEY (`SHELVES_ID`),
KEY `SHOP_ID` (`SHOP_ID`),
CONSTRAINT `mn_shelves_ibfk_1` FOREIGN KEY (`SHOP_ID`) REFERENCES `mng_shop` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_shelves_rel_sku
-- ----------------------------
DROP TABLE IF EXISTS `mn_shelves_rel_sku`;
CREATE TABLE `mn_shelves_rel_sku` (
`ID` int(11) NOT NULL,
`SKU_ID` int(11) DEFAULT NULL,
`SHELVES_ID` int(11) DEFAULT NULL,
`PRICE` decimal(10,2) DEFAULT NULL,
`STATUS` varchar(6) DEFAULT NULL,
`STOCK` int(10) DEFAULT NULL COMMENT '库存',
`SALES` int(11) DEFAULT '0' COMMENT '销量',
`CREATE_TIME` datetime DEFAULT NULL,
`GROOM_TIME` datetime DEFAULT NULL COMMENT '设置时间',
PRIMARY KEY (`ID`),
KEY `SKU_ID` (`SKU_ID`),
KEY `SHELVES_ID` (`SHELVES_ID`),
CONSTRAINT `mn_shelves_rel_sku_ibfk_1` FOREIGN KEY (`SKU_ID`) REFERENCES `mn_sku` (`SKU_ID`),
CONSTRAINT `mn_shelves_rel_sku_ibfk_2` FOREIGN KEY (`SHELVES_ID`) REFERENCES `mn_shelves` (`SHELVES_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for mn_sku
-- ----------------------------
DROP TABLE IF EXISTS `mn_sku`;
CREATE TABLE `mn_sku` (
`SKU_ID` int(11) NOT NULL AUTO_INCREMENT,
`PRODUCT_ID` int(11) DEFAULT NULL COMMENT '关联商品ID',
`CREATE_TIME` datetime DEFAULT NULL,
`TEMPLATE_ID` int(11) DEFAULT NULL,
`PARAMS_VALUE` varchar(1024) DEFAULT NULL,
`ADAPTATION` varchar(200) DEFAULT NULL COMMENT '生成的产品标题',
`PICTURE` varchar(1024) DEFAULT NULL,
`CODE` varchar(40) DEFAULT NULL,
`STATUS` varchar(4) DEFAULT NULL,
`DETAIL` text,
`BRAND_ID` int(11) DEFAULT NULL COMMENT '品牌ID',
`SKU_NAME` varchar(256) DEFAULT NULL COMMENT '型号',
`DISPLAY_IMG` varchar(1024) DEFAULT NULL,
`SUMMARY` varchar(255) DEFAULT NULL COMMENT '商品简介',
`WEIGHT` varchar(11) DEFAULT NULL,
`VOLUME` varchar(11) DEFAULT NULL,
PRIMARY KEY (`SKU_ID`),
KEY `GOODS_ID` (`PRODUCT_ID`) USING BTREE,
KEY `TEMPLATE_ID` (`TEMPLATE_ID`),
KEY `BRAND_ID` (`BRAND_ID`),
KEY `MODEL_ID` (`SKU_NAME`(255)),
CONSTRAINT `mn_sku_ibfk_1` FOREIGN KEY (`PRODUCT_ID`) REFERENCES `mn_product` (`PRODUCT_ID`),
CONSTRAINT `mn_sku_ibfk_2` FOREIGN KEY (`BRAND_ID`) REFERENCES `mn_product_brand` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for mn_source
-- ----------------------------
DROP TABLE IF EXISTS `mn_source`;
CREATE TABLE `mn_source` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`SOURCE_NAME` varchar(100) DEFAULT NULL,
`STATUS` varchar(4) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phone_vcode
-- ----------------------------
DROP TABLE IF EXISTS `phone_vcode`;
CREATE TABLE `phone_vcode` (
`ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`PHONE` varchar(16) DEFAULT NULL COMMENT '手机号',
`VERIFY_CODE` varchar(10) DEFAULT NULL COMMENT '验证码',
`V_TYPE` varchar(2) DEFAULT NULL COMMENT '验证码类型: 1.登录验证 2.微信绑定手机号验证',
`V_CODE_CREATE_TIME` datetime DEFAULT NULL COMMENT '当前验证码创建时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
| true |
8c71b8828c486d211d30885fcbcaa00f38f423ae | SQL | Tanim-Ahmed/Operational-Database-for-Library-Management-System | /triggerautomaticincreasedecreasenobook.sql | UTF-8 | 562 | 3.65625 | 4 | [] | no_license | --A trigger to automatically increment and decrement the no_of_books from the member table upon issue and return--
create or replace trigger incr_trigger
after insert or update on trans
for each row
begin
if inserting then
update book
set no_of_books=no_of_books-1
where book_id =:NEW.book_id;
update member
set no_of_books_taken=no_of_books_taken+1
where mem_id=:NEW.mem_id;
elsif updating then
update book
set no_of_books=no_of_books+1
where book_id=:old.book_id;
update member
set no_of_books_taken=no_of_books_taken-1
where mem_id=:NEW.mem_id;
end if;
end;
/ | true |
4c0fdecdb0e93953fafad6e9cb40479308f31449 | SQL | nss-day-cohort-19/chinook-bsgreaves | /invoice_37_line_item_count.sql | UTF-8 | 112 | 2.859375 | 3 | [] | no_license | SELECT COUNT(InvoiceLineID) as "Number of Line Items in Invoice 37"
FROM InvoiceLine IL
WHERE IL.InvoiceID="37"; | true |
1e26cc36bf495cd7e1ed8206fcfba8567d538923 | SQL | CKudella/corr_data | /budé/sql_queries/no_corr_per_loc/no_corr_per_loc_receiving_from_budé_with_geocoordinates.sql | UTF-8 | 507 | 3.984375 | 4 | [] | no_license | SELECT locations_name_modern AS 'Location Name Modern',
locations_lat AS Latitude,
locations_lng AS Longitude,
COUNT(DISTINCT recipient_id) AS 'Number of correspondents who received at this location letters from Budé'
FROM budé_cdb_v1.letters
JOIN budé_cdb_v1.locations ON locations.locations_id = letters.target_loc_id
WHERE sender_id = 'c0b89c75-45b8-4b04-bfd7-25bfe9ed040b'
AND target_loc_id NOT LIKE 'unknown%'
GROUP BY target_loc_id
ORDER BY COUNT(DISTINCT recipient_id) DESC
| true |
c303fe1f829df205152e86a9e2a188a8e1a2bdd3 | SQL | rafaelcostab/food-api | /src/main/resources/import.sql | UTF-8 | 965 | 2.578125 | 3 | [] | no_license | insert into kitchen (id, name) values (1, 'Thai');
insert into kitchen (id, name) values (2, 'Indian');
insert into restaurant (name, tax_freight, kitchen_id) values ('Jabaquara Corner', 6.0, 1);
insert into restaurant (name, tax_freight, kitchen_id) values ('Bony', 66.0, 1);
insert into restaurant (name, tax_freight, kitchen_id) values ('Esquerda Esquerda', 1.0, 2);
insert into form_payment (description) values ('Credit');
insert into form_payment (description) values ('Debit');
insert into form_payment (description) values ('Money');
insert into permission (name, description) values ('Consult kitchen', 'Permit user consult kitchen');
insert into permission (name, description) values ('Consult restaurant', 'Permit user consult restaurant');
insert into state (name) values ('São Paulo');
insert into state (name) values ('Paraná');
insert into city (name, state_id) values ('Diadema', 1);
insert into city (name, state_id) values ('Jabaquara', 1); | true |
ea5179471c90d50c5e729b8750e116b46be52f76 | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/high/day20/select0737.sql | UTF-8 | 191 | 2.71875 | 3 | [] | no_license |
SELECT timeStamp, temperature
FROM ThermometerObservation
WHERE timestamp>'2017-11-19T07:37:00Z' AND timestamp<'2017-11-20T07:37:00Z' AND SENSOR_ID='de0f6149_6a69_4041_9a1b_73fad3b24142'
| true |
44df1535729aadd459e7ffd2fff9a3e88edcf8b5 | SQL | wei50o7/LowInFit | /127_0_0_1 (1).sql.sql | UTF-8 | 26,487 | 2.84375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Sep 28, 2020 at 09:44 AM
-- Server version: 8.0.18
-- PHP Version: 7.3.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `sdp5`
--
-- --------------------------------------------------------
--
-- Table structure for table `addon`
--
DROP TABLE IF EXISTS `addon`;
CREATE TABLE IF NOT EXISTS `addon` (
`AddOnID` int(11) NOT NULL AUTO_INCREMENT,
`OrderID` int(11) NOT NULL,
`AddOnMenuID` int(11) NOT NULL,
`AddOnQuantity` int(11) NOT NULL,
PRIMARY KEY (`AddOnID`),
KEY `AddOnMenuID` (`AddOnMenuID`),
KEY `OrderID` (`OrderID`)
) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `addon`
--
INSERT INTO `addon` (`AddOnID`, `OrderID`, `AddOnMenuID`, `AddOnQuantity`) VALUES
(1, 1, 2, 100),
(2, 1, 1, 150),
(49, 79, 1, 40),
(56, 82, 2, 80),
(57, 83, 2, 130),
(58, 85, 1, 50),
(59, 86, 1, 40),
(60, 89, 1, 60),
(61, 90, 1, 30),
(62, 91, 1, 70),
(63, 91, 5, 40),
(64, 91, 7, 30),
(65, 91, 11, 30),
(66, 92, 1, 20),
(67, 92, 3, 20),
(68, 92, 6, 20),
(69, 92, 8, 20),
(70, 92, 11, 30),
(71, 93, 1, 50),
(72, 93, 6, 50),
(73, 93, 8, 50),
(74, 94, 1, 30),
(75, 94, 2, 200),
(76, 95, 1, 50),
(77, 96, 2, 80),
(78, 96, 4, 60),
(79, 97, 1, 30),
(80, 97, 3, 10),
(81, 97, 8, 110),
(82, 97, 10, 110),
(83, 98, 2, 70),
(84, 99, 1, 80),
(85, 104, 1, 10),
(86, 104, 2, 80),
(87, 105, 1, 30),
(88, 106, 1, 10),
(89, 106, 2, 80),
(90, 107, 1, 30),
(91, 108, 1, 10),
(92, 108, 2, 80),
(93, 109, 1, 30),
(94, 110, 1, 10),
(95, 110, 2, 80),
(96, 111, 1, 30),
(97, 112, 1, 10),
(98, 112, 2, 80),
(99, 113, 1, 30),
(100, 114, 1, 10),
(101, 114, 2, 80),
(102, 115, 1, 30),
(103, 116, 1, 10),
(104, 116, 2, 80),
(105, 117, 1, 30),
(106, 118, 1, 10),
(107, 118, 2, 80),
(108, 119, 1, 30),
(109, 119, 4, 120),
(110, 120, 1, 10),
(111, 120, 2, 80),
(112, 121, 1, 30),
(113, 121, 4, 120);
-- --------------------------------------------------------
--
-- Table structure for table `addonmenu`
--
DROP TABLE IF EXISTS `addonmenu`;
CREATE TABLE IF NOT EXISTS `addonmenu` (
`AddOnMenuID` int(11) NOT NULL AUTO_INCREMENT,
`AddOnMenuName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`AddOnPricePer10g` float NOT NULL,
`AddOnCalories` float NOT NULL,
`AddOnCarbohydrates` float NOT NULL,
`AddOnProtein` float NOT NULL,
`AddOnFats` float NOT NULL,
`AddOnFibre` float NOT NULL,
PRIMARY KEY (`AddOnMenuID`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `addonmenu`
--
INSERT INTO `addonmenu` (`AddOnMenuID`, `AddOnMenuName`, `AddOnPricePer10g`, `AddOnCalories`, `AddOnCarbohydrates`, `AddOnProtein`, `AddOnFats`, `AddOnFibre`) VALUES
(1, 'Salmon', 0.7, 19, 0, 2.5, 0.9, 0),
(2, 'Chicken Breast', 0.4, 15, 0, 3, 0.3, 0),
(3, 'White Rice', 0.1, 13, 2.8, 0.2, 0.02, 0.03),
(4, 'Stir-fried mushroom', 0.2, 5.6, 1.4, 0.15, 0.02, 0.21),
(5, 'Spaghetti', 0.3, 16, 3, 0.5, 0.09, 0.18),
(6, 'Boiled egg', 0.2, 15, 0.1, 1.2, 1, 0),
(7, 'Lettuce', 0.2, 1.4, 0.3, 0.09, 0.1, 0.12),
(8, 'Corn', 0.4, 9, 2, 0.3, 0.1, 0.24),
(10, 'Shrimp', 0.8, 10, 0, 2.4, 0.02, 0),
(11, 'Potato cubes', 0.2, 12.5, 2, 0.2, 0.4, 0.4);
-- --------------------------------------------------------
--
-- Table structure for table `customer`
--
DROP TABLE IF EXISTS `customer`;
CREATE TABLE IF NOT EXISTS `customer` (
`CustomerID` int(11) NOT NULL AUTO_INCREMENT,
`UserID` int(11) NOT NULL,
`FirstName` varchar(50) NOT NULL,
`LastName` varchar(50) NOT NULL,
`Gender` varchar(6) NOT NULL,
`Age` int(11) NOT NULL,
`Weight` int(11) NOT NULL,
`Height` int(11) NOT NULL,
`ActivityLevel` float NOT NULL,
`Address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`Phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`CustPicture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`TDEE` int(11) DEFAULT NULL,
PRIMARY KEY (`CustomerID`),
KEY `UserID` (`UserID`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `customer`
--
INSERT INTO `customer` (`CustomerID`, `UserID`, `FirstName`, `LastName`, `Gender`, `Age`, `Weight`, `Height`, `ActivityLevel`, `Address`, `Phone`, `CustPicture`, `TDEE`) VALUES
(1, 3, 'Customer', '1', 'Male', 24, 68, 175, 1, 'Customer 1\'s house address', '0198852024', 'img/profpic/default.png', 2500),
(20, 7, 'Wong', 'Tai Wei', 'Male', 20, 70, 180, 1, 'Wong Tai Wei\'s house address', '0102222024', 'img/profpic/default.png', 2500),
(21, 16, 'SAS', 'SAS', 'Male', 18, 68, 167, 1, '78, jalan 52', '012345699', 'img/profpic/default.png', 2436),
(22, 17, 'q', 'wqrqw', 'Female', 0, 0, 0, 1, 'qweqw', 'qwe', 'img/profpic/default.png', 274),
(23, 18, 'yyy', 'yyy', 'Female', 19, 68, 170, 1, '213213124', '12412312', 'img/profpic/default.png', 3427),
(24, 19, 'sasd', 'sad', 'Female', 21, 81, 169, 1, 'adsas', '123141', 'img/profpic/default.png', 3258),
(25, 20, 'abc', 'abc', 'Male', 17, 63, 170, 1, 'sdaadasfa', '3124123', 'img/profpic/default.png', 2716),
(26, 22, 'saddsa', 'dsadsa', 'Male', 20, 68, 167, 1, 'dsadsfesfesaf', '21421453', 'img/profpic/default.png', 2744),
(27, 23, 'qqq', 'qqq', 'Female', 31, 63, 167, 1, 'dsadsafdsf', '21312214', 'img/profpic/default.png', 3185),
(28, 24, 'qwe', 'qwe', 'Female', 21, 46, 156, 1, '213', '213', 'img/profpic/default.png', 2233),
(29, 25, 'asd', 'asd', 'Female', 41, 56, 152, 1, '213', '213', 'img/profpic/default.png', 2490),
(30, 26, 'zxc', 'zxc', 'Male', 12, 42, 132, 0, '2134', '213451', 'img/profpic/default.png', 0),
(31, 27, 'sdf', 'sdf', 'Male', 31, 101, 167, 1, '2131564564', '534532', 'img/profpic/default.png', 2264),
(32, 28, 'wer', 'wer', 'Male', 16, 64, 152, 1, '1265745', '7623243', 'img/profpic/default.png', 2250),
(33, 29, 'xcv', 'xcv', 'Male', 16, 62, 158, 1, 'dsadsa', '12312451', 'img/profpic/default.png', 1821),
(34, 30, 'qer', 'qer', 'Male', 17, 72, 168, 0, '21312421', '6457642', 'img/profpic/default.png', 0),
(35, 31, 'adf', 'adf', 'Male', 19, 72, 168, 1, '214314125', '99999999', 'img/profpic/default.png', 2497),
(36, 32, 'zcv', 'zcv', 'Male', 19, 72, 191, 0, '2155', '0000', 'img/profpic/default.png', 0),
(37, 33, 'qwr', 'qwr', 'Male', 19, 67, 167, 1, '123', '098', 'img/profpic/default.png', 2735),
(38, 34, 'asf', 'asf', 'Male', 18, 65, 164, 1, '444', '555', 'img/profpic/default.png', 1890),
(39, 35, 'wong', 'wong', 'Male', 20, 70, 176, 0, 'Lot 2024,Desa Bahagia\\r\\nBandar Baru Permyjaya', '102662024', 'img/profpic/default.png', 0),
(42, 38, 'v', 'v', 'Male', 1, 1, 1, 1.2, 'Jalan Teknologi 6', '102662024', 'img/profpic/default.png', 8),
(43, 39, 'Wong', 'Wei', 'Female', 1, 1, 1, 1.3, 'Lot 2024,Desa Bahagia\\r\\nBandar Baru Permyjaya', '123', 'img/profpic/default.png', 224);
-- --------------------------------------------------------
--
-- Table structure for table `meal`
--
DROP TABLE IF EXISTS `meal`;
CREATE TABLE IF NOT EXISTS `meal` (
`MealID` int(11) NOT NULL AUTO_INCREMENT,
`MealName` varchar(100) NOT NULL,
`MealDesc` varchar(200) NOT NULL,
`MealPricePerUnit` float NOT NULL,
`MealCalories` float NOT NULL,
`MealCarbohydrates` float NOT NULL,
`MealProtein` float NOT NULL,
`MealFats` float NOT NULL,
`MealFibre` float NOT NULL,
`MealPicture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`CategoryID` int(11) NOT NULL,
PRIMARY KEY (`MealID`),
KEY `CategoryID` (`CategoryID`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `meal`
--
INSERT INTO `meal` (`MealID`, `MealName`, `MealDesc`, `MealPricePerUnit`, `MealCalories`, `MealCarbohydrates`, `MealProtein`, `MealFats`, `MealFibre`, `MealPicture`, `CategoryID`) VALUES
(2, 'Chicken Rice', 'White Rice 200g with 200g skinless boneless chicken breast, sides broccoli and boiled egg', 7.9, 430, 42, 44, 9, 5.1, 'img/chickenrice.jpg', 1),
(4, 'Egg sandwich', '2 slices of sandwich bread with the filling of egg mayo sides with some fresh lettuce', 4.9, 350, 37, 29, 12, 2.2, 'img/eggmayosandwich.jpg', 3),
(5, 'Bolognese Pasta with minced chicken', 'Pasta with minced chicken breast meat and tomato pesto', 7.9, 511, 60, 25, 19, 5, 'img/bolognesepasta', 1),
(6, 'Pasta with chicken breast', 'Spaghetti with 200g grilled succulent chicken breast with mixed herbs and tomato ', 8.9, 503, 60, 30, 15, 5, 'img/chickenpasta.jpg', 1),
(8, 'Salad with Chicken Breast', 'Fresh coral lettuce salad with 200g grilled juicy chicken breast and with one whole boiled egg and some cherry tomatoes', 7.9, 322, 11, 16, 11, 2.5, 'img/chickensalad.jpg', 1),
(9, 'Tortilla wrap with chicken', 'Soft tortilla wrap with 150g grilled chicken breast sides with fresh salad of the day', 8.9, 464, 56, 31, 14, 11, 'img/chickenwrap.jpg', 1),
(10, 'Red Tomato Shrimp with Rice', '150g of shell-less shrimp cooked in a tomato broth, sides with rice and some salad vegetables and egg', 16.9, 380, 36, 39, 4, 5, 'img/shrimprice.jpg', 2),
(11, 'Mushroom Couscous', 'Rice stewed with fresh shiitake mushroom and a hell lot variety of vegetables', 15.9, 380, 30, 35, 8, 7, 'img/mushroomcouscous.jpg', 3),
(12, 'Mushroom Salad', 'Stir-fried mushroom salad sides with some fresh steamed corn', 7.9, 278, 40, 16, 8, 8, 'img/mushroomsalad.jpg', 3),
(13, 'Grilled Salmon with Stir-fried mushroom rice', '150g of grilled salmon with stir-fried rice that contain mushroom, bell peppers, cherry tomatoes and sides with some fresh vegetables', 12.9, 430, 40, 30, 8, 4, 'img/grilledsalmonwithmushroomrice.jpg', 2),
(14, 'Grilled Salmon with Spaghetti', '150g of grilled salmon with 150g of spaghetti, topped with some stir-fried garlic and sides with fresh vegetables', 13.9, 400, 48, 32, 6, 3, 'img/salmonspaghetti', 2);
-- --------------------------------------------------------
--
-- Table structure for table `mealcategory`
--
DROP TABLE IF EXISTS `mealcategory`;
CREATE TABLE IF NOT EXISTS `mealcategory` (
`CategoryID` int(11) NOT NULL AUTO_INCREMENT,
`CategoryName` varchar(50) NOT NULL,
PRIMARY KEY (`CategoryID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `mealcategory`
--
INSERT INTO `mealcategory` (`CategoryID`, `CategoryName`) VALUES
(1, 'ChickenMain'),
(2, 'FishMain'),
(3, 'VegeMain');
-- --------------------------------------------------------
--
-- Table structure for table `orderfood`
--
DROP TABLE IF EXISTS `orderfood`;
CREATE TABLE IF NOT EXISTS `orderfood` (
`OrderID` int(11) NOT NULL AUTO_INCREMENT,
`CustomerID` int(11) NOT NULL,
`MealID` int(11) NOT NULL,
`Remarks` varchar(100) NOT NULL,
`TotalCalories` float NOT NULL,
`TotalCarbohydrates` float NOT NULL,
`TotalProtein` float NOT NULL,
`TotalFats` float NOT NULL,
`TotalFibre` float NOT NULL,
`TotalOrderPrice` float DEFAULT NULL,
`OrderDate` date NOT NULL,
`DeliveryDate` date NOT NULL,
`OrderStatus` varchar(20) NOT NULL,
`StaffID` int(11) DEFAULT NULL,
`PaymentID` int(11) DEFAULT NULL,
PRIMARY KEY (`OrderID`),
KEY `CustomerID` (`CustomerID`),
KEY `MealID` (`MealID`),
KEY `StaffID` (`StaffID`),
KEY `PaymentID` (`PaymentID`)
) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `orderfood`
--
INSERT INTO `orderfood` (`OrderID`, `CustomerID`, `MealID`, `Remarks`, `TotalCalories`, `TotalCarbohydrates`, `TotalProtein`, `TotalFats`, `TotalFibre`, `TotalOrderPrice`, `OrderDate`, `DeliveryDate`, `OrderStatus`, `StaffID`, `PaymentID`) VALUES
(1, 1, 2, 'wadadwjvhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhwadadwjvhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhwadadwjvhhhhhhhh', 6969, 12, 34, 56, 78, 88, '2020-08-13', '2020-08-15', 'OrderDelivered', 2, 2),
(76, 20, 9, 'No remarks', 464, 56, 31, 14, 11, 8.9, '2020-08-21', '2020-08-15', 'OrderDelivered', 5, 2),
(78, 20, 2, 'No remarks', 430, 42, 44, 9, 5.1, NULL, '2020-08-24', '2020-08-20', 'OrderDelivered', 5, 1),
(79, 20, 2, 'dsadafsafasfeqwdasdqwdqwda', 506, 42, 54, 12, 5, 10.7, '2020-08-27', '2020-08-29', 'OrderDelivered', 2, 1),
(81, 20, 9, 'dsad', 464, 56, 31, 14, 11, 8.9, '2020-09-06', '2020-09-17', 'Order Received', NULL, NULL),
(82, 21, 2, 'chicken seaprate', 550, 42, 68, 11.4, 5.1, 11.1, '2020-09-07', '2020-09-10', 'OrderReceived', 1, 3),
(83, 21, 8, 'no tomato, tomato is bad', 517, 11, 55, 14.9, 2.5, 13.1, '2020-09-07', '2020-09-24', 'Order Received', NULL, 4),
(84, 21, 6, '', 503, 60, 30, 15, 5, 8.9, '2020-09-07', '2020-09-25', 'Order Received', NULL, 5),
(85, 22, 2, '', 525, 42, 56.5, 13.5, 5.1, 11.4, '2020-09-07', '2020-09-10', 'Order Received', NULL, 7),
(86, 23, 2, '', 506, 42, 54, 12.6, 5.1, 10.7, '2020-09-07', '2020-09-18', 'Order Received', NULL, 8),
(87, 25, 2, '', 430, 42, 44, 9, 5.1, 7.9, '2020-09-07', '2020-09-25', 'Order Received', NULL, 9),
(88, 26, 2, '', 430, 42, 44, 9, 5.1, 7.9, '2020-09-07', '2020-09-26', 'Order Received', NULL, 10),
(89, 27, 11, '', 494, 30, 50, 13.4, 7, 20.1, '2020-09-08', '2020-09-26', 'Order Received', NULL, 12),
(90, 27, 8, '', 379, 11, 23.5, 13.7, 2.5, 10, '2020-09-08', '2020-09-26', 'Order Received', NULL, 16),
(91, 28, 9, '', 702.7, 74.9, 51.37, 22.16, 13.28, 16.2, '2020-09-08', '2020-09-26', 'Order Received', NULL, 18),
(92, 29, 14, '', 549.5, 63.8, 41, 11.24, 4.74, 17.3, '2020-09-08', '2020-09-26', 'Order Received', NULL, 19),
(93, 30, 12, '', 493, 50.5, 36, 18, 9.2, 14.4, '2020-09-08', '2020-09-26', 'Order Received', NULL, 20),
(94, 31, 4, '', 707, 37, 96.5, 20.7, 2.2, 15, '2020-09-08', '2020-09-26', 'Order Received', NULL, 21),
(95, 32, 9, '', 559, 56, 43.5, 18.5, 11, 12.4, '2020-09-08', '2020-09-26', 'Order Received', NULL, 22),
(96, 33, 10, '', 530, 42, 63, 6, 5, 21.3, '2020-09-08', '2020-09-26', 'Order Received', NULL, 23),
(97, 34, 12, '', 557, 64.8, 53.4, 12.04, 10.67, 23.3, '2020-09-09', '2020-09-26', 'Order Received', NULL, 24),
(98, 35, 13, '', 535, 40, 51, 10.1, 4, 15.7, '2020-09-09', '2020-09-26', 'Order Received', NULL, 25),
(99, 36, 11, '', 532, 30, 55, 15.2, 7, 21.5, '2020-09-09', '2020-09-26', 'Order Received', NULL, 26),
(100, 20, 2, '', 430, 42, 44, 9, 5.1, 7.9, '2020-09-09', '2020-09-25', 'Order Received', NULL, 27),
(101, 20, 5, '', 511, 60, 25, 19, 5, 7.9, '2020-09-09', '2020-09-17', 'Order Received', NULL, 28),
(102, 20, 5, '', 511, 60, 25, 19, 5, 7.9, '2020-09-09', '2020-09-12', 'Order Received', NULL, 29),
(103, 20, 5, 'wad', 511, 60, 25, 19, 5, 7.9, '2020-09-09', '2020-09-12', 'Order Received', NULL, 29),
(104, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 30),
(105, 20, 2, '', 487, 42, 50, 9, 5, 10, '2020-09-10', '2020-09-19', 'Order Received', NULL, 30),
(106, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 31),
(107, 20, 2, '', 487, 42, 50, 9, 5, 10, '2020-09-10', '2020-09-19', 'Order Received', NULL, 31),
(108, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 32),
(109, 20, 2, '', 487, 42, 50, 9, 5, 10, '2020-09-10', '2020-09-19', 'Order Received', NULL, 32),
(110, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 33),
(111, 20, 2, '', 487, 42, 50, 9, 5, 10, '2020-09-10', '2020-09-19', 'Order Received', NULL, 33),
(112, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 34),
(113, 20, 2, '', 487, 42, 50, 9, 5, 10, '2020-09-10', '2020-09-19', 'Order Received', NULL, 34),
(114, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 35),
(115, 20, 2, '', 487, 42, 50, 9, 5, 10, '2020-09-10', '2020-09-19', 'Order Received', NULL, 35),
(116, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 36),
(117, 20, 2, '', 487, 42, 50, 9, 5, 10, '2020-09-10', '2020-09-19', 'Order Received', NULL, 36),
(118, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 37),
(119, 20, 2, '', 547, 54, 50, 9, 5, 12.4, '2020-09-10', '2020-09-19', 'Order Received', NULL, 37),
(120, 20, 5, '', 650, 60, 51, 19, 5, 11.8, '2020-09-10', '2020-09-19', 'Order Received', NULL, 38),
(121, 20, 2, '', 547, 54, 50, 9, 5, 12.4, '2020-09-10', '2020-09-19', 'Order Received', NULL, 38);
-- --------------------------------------------------------
--
-- Table structure for table `payment`
--
DROP TABLE IF EXISTS `payment`;
CREATE TABLE IF NOT EXISTS `payment` (
`PaymentID` int(11) NOT NULL AUTO_INCREMENT,
`PaymentDate` date DEFAULT NULL,
`PaidAmount` float DEFAULT NULL,
PRIMARY KEY (`PaymentID`)
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `payment`
--
INSERT INTO `payment` (`PaymentID`, `PaymentDate`, `PaidAmount`) VALUES
(1, '2020-09-23', 125),
(2, '2020-09-18', 69),
(3, '2020-09-07', 12),
(4, '2020-09-07', 123),
(5, '2020-09-07', 213),
(6, '2020-09-07', 213),
(7, '2020-09-07', 23),
(8, '2020-09-07', 21),
(9, '2020-09-07', 41),
(10, '2020-09-07', 213),
(11, '2020-09-08', 41),
(12, '2020-09-08', 32),
(13, '2020-09-08', 324),
(14, '2020-09-08', 51),
(15, '2020-09-08', 43),
(16, '2020-09-08', 34),
(17, '2020-09-08', 431),
(18, '2020-09-08', 53),
(19, '2020-09-08', 43),
(20, '2020-09-08', 41),
(21, '2020-09-08', 53),
(22, '2020-09-08', 53.13),
(23, '2020-09-08', 43),
(24, '2020-09-09', 234),
(25, '2020-09-09', 23),
(26, '2020-09-09', 10),
(27, '2020-09-09', 10),
(28, '2020-09-09', 20),
(29, '2020-09-09', 15.8),
(30, '2020-09-10', 43),
(31, '2020-09-10', 43),
(32, '2020-09-10', 32),
(33, '2020-09-10', 43),
(34, '2020-09-10', 21.8),
(35, '2020-09-10', 21.8),
(36, '2020-09-10', 21.8),
(37, '2020-09-10', 24.2),
(38, '2020-09-10', 24.2);
-- --------------------------------------------------------
--
-- Table structure for table `rolename`
--
DROP TABLE IF EXISTS `rolename`;
CREATE TABLE IF NOT EXISTS `rolename` (
`RoleID` int(11) NOT NULL AUTO_INCREMENT,
`RoleName` varchar(20) NOT NULL,
PRIMARY KEY (`RoleID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `rolename`
--
INSERT INTO `rolename` (`RoleID`, `RoleName`) VALUES
(1, 'Admin'),
(2, 'Staff'),
(3, 'Customer');
-- --------------------------------------------------------
--
-- Table structure for table `staff`
--
DROP TABLE IF EXISTS `staff`;
CREATE TABLE IF NOT EXISTS `staff` (
`StaffID` int(11) NOT NULL AUTO_INCREMENT,
`StaffFName` varchar(50) NOT NULL,
`StaffLName` varchar(50) NOT NULL,
`UserID` int(11) NOT NULL,
PRIMARY KEY (`StaffID`),
KEY `UserID` (`UserID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `staff`
--
INSERT INTO `staff` (`StaffID`, `StaffFName`, `StaffLName`, `UserID`) VALUES
(1, 'admin', '1', 1),
(2, 'staff', '1', 2),
(5, 'Wong', 'SIck', 12),
(7, '1', 'z', 40),
(8, '123', '12', 41),
(9, '1231', '123', 42),
(10, '123', '123', 43);
-- --------------------------------------------------------
--
-- Table structure for table `useraccount`
--
DROP TABLE IF EXISTS `useraccount`;
CREATE TABLE IF NOT EXISTS `useraccount` (
`UserID` int(11) NOT NULL AUTO_INCREMENT,
`Username` varchar(20) NOT NULL,
`Password` varchar(158) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`Email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`RoleID` int(11) NOT NULL,
`Hashemail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`LoginCookieHash` varchar(255) DEFAULT NULL,
`Active` tinyint(1) NOT NULL,
PRIMARY KEY (`UserID`),
KEY `RoleID` (`RoleID`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `useraccount`
--
INSERT INTO `useraccount` (`UserID`, `Username`, `Password`, `Email`, `RoleID`, `Hashemail`, `LoginCookieHash`, `Active`) VALUES
(1, 'admin', '$2y$10$f2jTTDEnDbrCqSfCJDkdtOyctcNLTrTEv5prWS0/9E1MoRUcPEK0C', 'admin@mail.com', 1, NULL, NULL, 1),
(2, 'staff', '$2y$10$TGSXpQZylPwLB.xojsQlceHXMRMhQX.VmzfanjnYsze8B4GuQVT8u', 'staff@mail.com', 1, NULL, NULL, 1),
(3, 'customer', '$2y$10$UyAzrn0PAk0bT2v/Df/RjOpHMAEMT3Ck/qe4TuyNFLc/4F3qibNUy', 'customer@mail.com', 3, NULL, NULL, 1),
(7, 'a', '$2y$10$UyAzrn0PAk0bT2v/Df/RjOpHMAEMT3Ck/qe4TuyNFLc/4F3qibNUy', 'wei050297@gmail.com', 3, '72da7fd6d1302c0a159f6436d01e9eb0', '$2y$10$5O25hB/KRO092n1WzdX0suZ6/cKtSCbPFSVkhsO4ZKIX1DIiGKXXq', 1),
(9, 'b', '$2y$10$uEs5l7oicin8mA6Nf0jaTuVgs/6aJT6YFzYC9u.NLHOWMe0LQj9zW', 'b@mail.com', 3, 'e4bb4c5173c2ce17fd8fcd40041c068f', NULL, 0),
(12, 'staff1', '$2y$10$tsp2KPZinWw3usA4RWzQVeydmtkcn/BK7BAix6dTKJ.EhkWRwe7CC', 'mingtyre@gmail.com', 2, NULL, NULL, 1),
(13, 'gary', '$2y$10$Oyy3oLuUKdfiRf8PykBTSO2TkPVJ3qZJYLsCN9WfctD4EsGgPO9A2', 'gary@mail.com', 3, '6e7b33fdea3adc80ebd648fffb665bb8', NULL, 0),
(14, 'student', '$2y$10$xo3hwJcqhlCVTPk2tTX40Oi28T3bRqaHW2iBKZUc4dRMVsSL4WYhG', 'student@mail.com', 3, '9908279ebbf1f9b250ba689db6a0222b', NULL, 0),
(15, 'sss', '$2y$10$Ptwaf6Ja3H9J1ZDFedWXG.YKfQ2XbXaSE4C5o1gpF0qD.CWRkOale', 'sss@mail.com', 3, '16c222aa19898e5058938167c8ab6c57', NULL, 1),
(16, 'sas', '$2y$10$jA2TxA3rC73BsGf5P2uLTONQxiVHh/h3BW0alb3vTVazT8umOVovW', 'sas@mail.com', 3, 'c6e19e830859f2cb9f7c8f8cacb8d2a6', NULL, 1),
(17, 'qwerty', '$2y$10$BY/SvRpL3ICfD7CdaYC.Qed3mf3FY3I3XFIYWpoZhFg.8qwPa0r9a', 'qwerty@mail.com', 3, 'ed3d2c21991e3bef5e069713af9fa6ca', NULL, 1),
(18, 'yyy', '$2y$10$588lQz1kuXCovqcdwZXteenCFb9jteUMA9EbQxgtgpjqV61aPLbMa', 'yyy@mail.com', 3, '4b0a59ddf11c58e7446c9df0da541a84', NULL, 1),
(19, 'sad', '$2y$10$UdqL7oyor/KbMRV5FfWGwuilZ9BOII5ds/PG5YhITCW9JQ8AxqZV6', 'sad@mail.com', 3, '250cf8b51c773f3f8dc8b4be867a9a02', NULL, 1),
(20, '123', '$2y$10$SEjjgUgrYU7A428B99nwp.yyq.0DaTTNK0VjM3ffn78MG1pxixyvG', '123@mail.com', 3, 'f57a2f557b098c43f11ab969efe1504b', NULL, 1),
(22, '555', '$2y$10$HHkX.YxCAYzEiCYKXP457OvotiJ1w0J5/NIS3GCzeFStb3qFaDx3S', '555@mail.come', 3, '0ff8033cf9437c213ee13937b1c4c455', NULL, 1),
(23, 'qqq', '$2y$10$CMIx1T5X3ky16dXRT.Wpz.c5Bo8dfHZI21fVNRpS630Cyy9E5ZOiy', 'qqq@mail.com', 3, '6081594975a764c8e3a691fa2b3a321d', NULL, 1),
(24, 'qwe', '$2y$10$qQB8W994PDV1jbq71t242usTnlZYzPs.NcChOnJOQOOvZ8CIcOtO2', 'qwe@mail.com', 3, 'a8c88a0055f636e4a163a5e3d16adab7', NULL, 1),
(25, 'asd', '$2y$10$/lOoeb8zH9rajhqQLApVrer3lkhb1tfcXjzM2BUKhfPPi7z9tRzLi', 'asd@mail.com', 3, '303ed4c69846ab36c2904d3ba8573050', NULL, 1),
(26, 'zxc', '$2y$10$6RhaABetf84phJb.sMnb6uaHWRVsGrv72kAp7S6ffAk98e7pCs67y', 'zxc@mail.com', 3, '5a4b25aaed25c2ee1b74de72dc03c14e', NULL, 1),
(27, 'sdf', '$2y$10$XnCGwwXyqpIqQXkPo7.a5uE1yIFIwGd6j.5iHS0vGVbquPzQMpDpO', 'sdf@mail.com', 3, '3295c76acbf4caaed33c36b1b5fc2cb1', NULL, 1),
(28, 'wer', '$2y$10$guyVMcpokjNIXsMDJ1bHtO/ZtlSMGIUjsD5xffc1IzjMRGJDaxb.S', 'wer@mail.com', 3, '3b8a614226a953a8cd9526fca6fe9ba5', NULL, 1),
(29, 'xcv', '$2y$10$/u0BXQgaVZDBTebI.ARnN.pLEFGhEur803R5QQjqiDKWuBFn.Icb6', 'xcv@mail.com', 3, 'eae27d77ca20db309e056e3d2dcd7d69', NULL, 1),
(30, 'qer', '$2y$10$Jv/0jprzJN05GW8WqjNyA.HutW8w4h43W2oxqnWBHxHIh/tiE1eee', 'qer@mail.com', 3, 'e205ee2a5de471a70c1fd1b46033a75f', NULL, 1),
(31, 'adf', '$2y$10$LyFIPI0rcmLYPlefIWvqAezWo/YIyZeUcvFFle8skj7hNxnyDzZRC', 'adf@mail.com', 3, '556f391937dfd4398cbac35e050a2177', '$2y$10$KyKDWY/hssYMCXR6avdfmOdXtJfb/VAg8Wer3GIe21D92o4jBicVW', 1),
(32, 'zcv', '$2y$10$col41rfK/Z5Jq7388RmuXu398ri9YZ0FxIWlo671OJXauew4161nO', 'zcv@mail.com', 3, '555d6702c950ecb729a966504af0a635', NULL, 1),
(33, 'qwr', '$2y$10$SEGaDPIS4r8.a64UTh4uuuDbYs72zk74ykGS3hE6YnvDkLng7MtFe', 'qwr@mail.com', 3, '84d9ee44e457ddef7f2c4f25dc8fa865', NULL, 1),
(34, 'asf', '$2y$10$92NL2gtjkA5KMi9xH1ANjO/183ty4mYyGR2z36z3uQF8lhculBR5y', 'asf@mail.com', 3, 'c24cd76e1ce41366a4bbe8a49b02a028', NULL, 1),
(35, 'wong', '$2y$10$5IhPSL1En68pXVB0T158.eW3JwTjtNY2CNRo5D.LPo5pIFDTOpeye', 'wong050297@gmail.com', 3, '69cb3ea317a32c4e6143e665fdb20b14', NULL, 1),
(38, 'v', '$2y$10$k0u8ygfN6KsQW/d/x97Xl.zQhjDMIzznh3E3ohF3Ci1qx7iHLV.wq', 'v@gmail.com', 3, '07c5807d0d927dcd0980f86024e5208b', NULL, 1),
(39, 'q', '$2y$10$BW/JsMLyer7skidmmGhpL.KmHUeGBX/hZOgLkkz9xXlvGrlnu1.di', 'b@mail.com', 3, 'a666587afda6e89aec274a3657558a27', NULL, 1),
(40, 'z', '$2y$10$bFVv/Z/KehzrYei6dNn0Te1HPXbsGs5gKPLsq4q9dS.IZYPMjJdLK', 'z@mail.cpm', 2, NULL, NULL, 1),
(41, '12', '$2y$10$oArQ/XViZGATPesqAbR8NegH2PdVy1R1o0Z65i4gsinN3wQaTzwt2', '12@mail.com', 2, NULL, NULL, 1),
(42, 'awdaw', '$2y$10$uGDr9aIoq.T.ZKMKE1DBWe6SUQg5tus2uBuHs3g4nDPRz585l2wBy', '123123123@mail.com', 2, NULL, NULL, 1),
(43, '123123', '$2y$10$86JC7SaNpKbZPMs/gwqOf.e.f4kcq5P18vAiyVqAYkNKTRXHTVsey', '123123123@mail.com', 2, NULL, NULL, 1);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `customer`
--
ALTER TABLE `customer`
ADD CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `useraccount` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `meal`
--
ALTER TABLE `meal`
ADD CONSTRAINT `meal_ibfk_1` FOREIGN KEY (`CategoryID`) REFERENCES `mealcategory` (`CategoryID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `orderfood`
--
ALTER TABLE `orderfood`
ADD CONSTRAINT `orderfood_ibfk_1` FOREIGN KEY (`CustomerID`) REFERENCES `customer` (`CustomerID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `orderfood_ibfk_2` FOREIGN KEY (`MealID`) REFERENCES `meal` (`MealID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `orderfood_ibfk_3` FOREIGN KEY (`StaffID`) REFERENCES `staff` (`StaffID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `orderfood_ibfk_4` FOREIGN KEY (`PaymentID`) REFERENCES `payment` (`PaymentID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `staff`
--
ALTER TABLE `staff`
ADD CONSTRAINT `staff_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `useraccount` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `useraccount`
--
ALTER TABLE `useraccount`
ADD CONSTRAINT `useraccount_ibfk_1` FOREIGN KEY (`RoleID`) REFERENCES `rolename` (`RoleID`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
3624c61a1d8c59fc4d4ba7c510b9009f4d52fbc5 | SQL | diegoorbezoh/sql_dropesac | /update_venta_final.sql | UTF-8 | 5,939 | 3.8125 | 4 | [] | no_license | /*
Script de ventas
Procesos:
- Actualización de ventas, pedidos en proceso
- Implementación Data Studio
*/
# Update ventas y Transferencias
drop table if exists test.venta;
create temporary table test.venta
SELECT a.idDetalle,
a.idProducto,
a.tipoDocumento,
a.producto,
a.idCliente,
a.razonSocialCliente,
a.numeroDocumentoCliente,
a.codigoCliente,
a.idTipoCliente,
a.nombreTipoCliente,
a.idVendedor,
a.vendedor,
a.numeroDocumentoVendedor,
a.idSede,
a.nombreSede,
a.departamento,
a.provincia,
a.distrito,
a.total,
a.fechaEmision,
a.mes,
a.cantidad,
a.serie,
a.numero,
a.formaPago,
a.nombreComercial,
a.semanaYear
from dropesac2015_temp.view_factura_boleta_reporteria a;
alter table test.venta add serieRef varchar(100);
alter table test.venta add numeroRef varchar(100);
update test.venta
set serieRef = ''
,numeroRef = ''
where venta.serieRef is null;
truncate table comercial.venta_reporteria;
insert into comercial.venta_reporteria
select a.idDetalle,
a.idProducto,
a.tipoDocumento,
a.producto,
a.idCliente,
a.razonSocialCliente,
a.numeroDocumentoCliente,
a.codigoCliente,
a.idTipoCliente,
a.nombreTipoCliente,
a.idVendedor,
a.vendedor,
a.numeroDocumentoVendedor,
a.idSede,
a.nombreSede,
a.departamento,
a.provincia,
a.distrito,
a.total,
a.fechaEmision,
a.mes,
a.cantidad,
a.serie,
a.numero,
a.formaPago,
a.nombreComercial,
a.semanaYear,
a.serieRef,
a.numeroRef
from test.venta a
union distinct
select b.idDetalle,
b.idProducto,
b.tipoDocumento,
b.producto,
b.idCliente,
b.razonSocialCliente,
b.numeroDocumentoCliente,
b.codigoCliente,
b.idTipoCliente,
b.nombreTipoCliente,
b.idVendedor,
b.vendedor,
b.numeroDocumentoVendedor,
b.idSede,
b.nombreSede,
b.departamento,
b.provincia,
b.distrito,
b.total,
b.fechaEmision,
b.mes,
b.cantidad,
b.serie,
b.numero,
b.formaPago,
b.nombreComercial,
b.semanaYear,
b.serieRef,
b.numeroRef
from dropesac2015_temp.view_nota_credito_devolucion_reporteria b;
# Reemplazamos ","
update comercial.venta_reporteria
set producto = replace(producto,',',';')
where producto like '%,%'
;
select * from comercial.venta_reporteria
where year(fechaEmision) = '2020'
select * from comercial.venta_reporteria
order by 1 desc
# Update pedidos en proceso
truncate table comercial.transferencias_reporteria;
insert into comercial.transferencias_reporteria
select * from dropesac2015_temp.view_pre_pedidos_distribucion;
# Temporal venta directa
drop table if exists test.venta_reporteria_aux;
create temporary table test.venta_reporteria_aux
select a.idVendedor
,a.vendedor
,cast(a.fechaEmision as date)fechaEmision
,sum(a.total)venta_directa
from comercial.venta_reporteria a
group by a.idVendedor
,a.vendedor
,a.fechaEmision
;
/*
select * from test.venta_reporteria_aux
*/
# Temporal transferencias
drop table if exists test.transferencias_reporteria_aux;
create temporary table test.transferencias_reporteria_aux
select a.idVendedor
,a.nombreVendedor
,cast(a.fechaEmisionPrePedido as date)fechaEmision
,sum(a.subTotalValorVenta)venta_transferencia
from comercial.transferencias_reporteria a
group by a.idVendedor
,a.nombreVendedor
,a.fechaEmisionPrePedido
;
/*
select * from comercial.transferencias_reporteria
idVendedor,fechaEmision,venta_transferencia
10,2020-11-19,1694.9152542
*/
# Matriz de fecha
drop table if exists test.vendedor;
create temporary table test.vendedor
select distinct idVendedor
from test.venta_reporteria_aux;
drop table if exists test.matriz;
create temporary table test.matriz
select *
from test.fecha
CROSS JOIN test.vendedor;
select * from test.matriz;
truncate table comercial.venta_resultado;
insert into comercial.venta_resultado
drop table if exists test.resultado_venta;
create temporary table test.resultado_venta
select distinct
c.dia as fechaEmision
,c.idVendedor
,a.vendedor
,a.venta_directa
from test.matriz c
left join test.venta_reporteria_aux a
on (a.fechaEmision = c.dia
and a.idVendedor = c.idVendedor)
;
drop table if exists test.resultado_transferencia;
create temporary table test.resultado_transferencia
select distinct
c.dia as fechaEmision
,c.idVendedor
,a.nombreVendedor
,a.venta_transferencia
from test.matriz c
left join test.transferencias_reporteria_aux a
on (a.fechaEmision = c.dia
and a.idVendedor = c.idVendedor)
;
drop table if exists test.resultado_final;
create temporary table test.resultado_final
select distinct
a.fechaEmision
,a.idVendedor
,a.vendedor as nombreVendedor
,a.venta_directa
,sum(b.venta_transferencia)venta_transferencia
from test.resultado_venta a
left join test.resultado_transferencia b
on (a.fechaEmision = b.fechaEmision
and a.idVendedor = b.idVendedor)
group by a.fechaEmision
,a.idVendedor
,a.vendedor
,a.venta_directa
;
update test.resultado_final a
join test.resultado_transferencia b
on a.idVendedor = b.idVendedor
set a.nombreVendedor = b.nombreVendedor
where a.nombreVendedor is null
and a.venta_transferencia is not null
;
# Nota: Revisar optimización de la tabla Matriz con un union select de valores admisibles
select * from test.resultado_final
where fechaEmision = '2020-04-03'
and vendedor is not null;
select * from test.resultado2
where dia >= '2019-01-01'
order by dia desc;
select count(*) from test.resultado2
where venta_transferencia is not null;
select * from visita_dia_laborable
limit 100;
| true |
783e12c7b1366c0e559b334c28c6c013fb0d0855 | SQL | oschaefer-fu/udbp | /2018/computerspieledatenbank/sql/Create-Computerspieledatenbank.sql | UTF-8 | 3,438 | 3.8125 | 4 | [] | no_license | -- Miniwelt Computerspieledatenbank
-- erstellt von K. Güttler, M. Kark, S. Moke, J. Schult
-- Erstellung der Ralationen in SQL
-- Überlegungen zu der Wahl des Typs der Variable
CREATE TABLE Publisher
(
PID INTEGER NOT NULL, -- laufende Nummer
PName VARCHAR (50), -- Namen haben unterschiedliche Länge, daher varchar
GJahr INTEGER CHECK (GJahr > 1955), -- Vor dem Jahr 1955 gab es noch keine Computerspielefirmen, daher
-- sollte die Jahreszahl nicht kleiner sein
CONSTRAINT publ_key PRIMARY KEY (PID)
);
CREATE TABLE Computerspiel
(
SID INTEGER NOT NULL, -- laufende Nummer
SName VARCHAR (50), -- der Name des Computerspiels, habe unterscheidliche Länge
FSK INTEGER CHECK (FSK IN (0,6,12,16,18,21)), -- FSK gibt es nur mit bestimmten Werten, daher die Kontrolle
EJahr INTEGER NOT NULL, -- Nur die Jahreszahl ist interessant
MP BOOL, -- hier gibt es nur zwei Optionen
PID INTEGER REFERENCES Publisher (PID), -- jedes Spiel hat einen Publisher
CONSTRAINT games_key PRIMARY KEY (SID)
);
CREATE TABLE Schlagwort
(
WID INTEGER NOT NULL, -- laufende Nummer
WName VARCHAR (50), -- hat einen Namen, variable Länge
CONSTRAINT sw_key PRIMARY KEY (WID)
);
CREATE TABLE Plattform
(
PlaID INTEGER NOT NULL, -- laufende Nummer
PlaName VARCHAR (20), -- Name, unterscheidliche Länge
CONSTRAINT pla_key PRIMARY KEY (PlaID)
);
CREATE TABLE Benutzer
(
BID INTEGER NOT NULL, -- laufende Nummer
BName VARCHAR (30), -- Name, unterschiedliche Länge
Geschlecht VARCHAR (1) CHECK (Geschlecht in ('m','w')), -- Geschlecht kann durch einen Buchstaben geklärt werden
-- bisher nur männlich oder weiblich
EMail VARCHAR (50), -- Email-Adresse, unterscheidliche Länge
GebDatum DATE, -- Tagesgenaues Datum ist erforderlich
CONSTRAINT user_key PRIMARY KEY (BID)
);
CREATE TABLE Kommentar
(
KID INTEGER NOT NULL, -- laufende Nummer
KText VARCHAR (200), -- Kommentartext, unterscheidliche Länge, 200 Zeichen müssen ausreichen
KNote INTEGER CHECK (KNote IN (1,2,3,4,5,6)), -- Schultnote, daher die Einschränkung
SID INTEGER REFERENCES Computerspiel (SID), -- Verweis auf Computerspiel
BID INTEGER REFERENCES Benutzer (BID), -- Verweis auf Benutzer
CONSTRAINT komm_key PRIMARY KEY (KID)
);
CREATE TABLE Eigenschaften
(
WID INTEGER REFERENCES Schlagwort (WID), -- Verweis auf Schlagwort
SID INTEGER REFERENCES Computerspiel (SID), -- Verweis auf Computerspiel
CONSTRAINT eigen_key PRIMARY KEY (WID, SID)
);
CREATE TABLE Kompatibilitaet
(
PlaID INTEGER REFERENCES Plattform (PlaID), -- Verweis Plattform
SID INTEGER REFERENCES Computerspiel (SID), -- Verweis Computerspiel
Preis NUMERIC (4,2), -- Preis in Euro,Cent. Spiele über 99,99 € gibt es bei uns nicht
CONSTRAINT komp_key PRIMARY KEY (PlaID, SID)
);
CREATE TABLE Befreundet
(
BID1 INTEGER REFERENCES Benutzer (BID), -- erster Verweis auf Benutzer
BID2 INTEGER REFERENCES Benutzer (BID), -- zweiter Verweis auf Benutzer
CONSTRAINT friend_key PRIMARY KEY (BID1,BID2)
);
CREATE TABLE Besitz
(
SID INTEGER REFERENCES Computerspiel (SID), -- Verweis auf Computerspiel
BID INTEGER REFERENCES Benutzer (BID), -- Verweis auf Benutzer
CONSTRAINT bes_key PRIMARY KEY (SID,BID)
);
| true |
818549941254474782466fe50c4eae8e1fe01cf0 | SQL | SunnnKim/Java_Bitcamp_191218_Oracle | /assignment_SQL/assignment4_hr.sql | UHC | 7,835 | 4.5 | 4 | [] | no_license | -- 1) EMPLOYEES ̺ King ҹڷ ˻ϰ
-- ȣ,, (ҹڷ),μȣ ϶.
-- LOWER Լ ϱ
SELECT employee_id, last_name, Lower(job_id), department_id
FROM employees
WHERE LOWER(last_name) = 'king';
--2) EMPLOYEES ̺ King 빮ڷ ˻ϰ
--ȣ,, (빮ڷ),μȣ ϶.
-- UPPER Լ ϱ
SELECT employee_id, last_name, first_name, UPPER(job_id), department_id
FROM employees
WHERE UPPER(last_name) = 'KING';
-- 3) DEPARTMENTS ̺ μȣ μ̸, μ̸ ġȣ Ͽ ϵ ϶.
-- concat Լ Ǵ ||
SELECT department_id, department_name,
CONCAT(department_id,department_name),
CONCAT(department_name,location_id)
FROM departments;
-- 4) EMPLOYEES ̺ ̸ ù ڰ K ũ Y
-- ȣ, ̸, , , μȣ ϶. ̸ Ͽ.
--SUBSTR
SELECT employee_id, first_name, job_id, salary, department_id
FROM employees
WHERE SUBSTR(first_name,1,1) > 'K'
AND SUBSTR(first_name,1,1) < 'Y'
ORDER BY first_name ASC;
-- 5) EMPLOYEES ̺ 20 μ ̸ ڸ
--ȣ, ̸, ̸ ڸ, , ڸ ϶.
-- Length
SELECT employee_id, first_name, length(first_name)"̸ ڸ", salary, length(salary)" ڸ"
FROM employees
WHERE department_id = 20;
-- 6) EMPLOYEES ̺ ̸ e ġ ϶.
-- INSTR(ڿ, ã,n°ĺã,m°ãġ)
SELECT first_name,
INSTR( lower(first_name) , 'e',1,1) as e_1,
INSTR( lower(first_name) , 'e',1,2) as e_2,
INSTR( lower(first_name) , 'e',1,3) as e_3
FROM employees;
-- 7) ϰ м϶.
SELECT ROUND(4567.678),ROUND(4567.678,0),
ROUND(4567.678,2),ROUND(4567.678,-2)
FROM dual;
-- ROUND():Ҽ ù°ڸ ݿø
-- ROUND(, ): ŭ Ҽ ȯ
-- ROUND(, ): 밪ŭ ڸ ͼ ݿø
--8) EMPLOYEES ̺ μȣ 80 30 Ͽ ϶.
--MOD
SELECT salary, MOD(salary,30), department_id
FROM employees
WHERE department_id = 80;
-- 9) EMPLOYEES ̺ 30 μ ̸ Ͽ Ͽ.
-- Ʒ ϶.
-- ( ̱ ó 带 Ŭϸ Ǿٴ Ȯ ֽϴ.)
-- CHR(10) : Ʈ(new line),
-- *: CHR(13) : ij : Ŀ ġ Ǿ
SELECT employee_id,last_name || CHR(10)|| job_id
FROM employees
WHERE department_id = 30;
-- 10) EMPLOYEES ̺ ٹ ΰ Ͽ.
-- ٹ ϼ Ͽ.
SELECT last_name, hire_date, sysdate,
TRUNC(sysdate - hire_date) as "Total days",
TRUNC((sysdate - hire_date) / 7) as weeks,
mod( (TO_DATE('19/12/01') - hire_date), 7) " "
FROM employees
ORDER by "Total days" DESC;
-- 11) EMPLOYEES ̺ μ 50 տ $ ϰ 3ڸ , ϶
--TO_CHAR
SELECT first_name, department_id, salary,TO_CHAR(salary, '$999,999,999')
FROM employees
WHERE department_id = 50;
--12) мϿ ƶ.
SELECT EMPLOYEE_ID,LAST_NAME,JOB_ID,SALARY,
DECODE (JOB_ID, 'IT_PROC',SALARY*1.1,
'ST_MAN', SALARY*1.15,
'SA_MAN', SALARY*1.2,
SALARY) d_sal
FROM EMPLOYEES
ORDER BY SALARY DESC;
-- decode(): if-else ǹ
-- DECODE(JOB_ID,'IT_PROC',SALARY*1.1,'ST_MAN', SALARY*1.15,'SA_MAN', SALARY*1.2, SALARY)
-- 1:JOB_ID ='IT_PROC' ϶ SALARY*1.1
-- 2:JOB_ID ='ST_MAN' ϶ SALARY*1.15.....
-- : ϶ SALARY
-- Employees ̺ ȣ, ̸, , , d_sal ϵ,
-- Լ
--1) EMPLOYEES ̺ SALESMAN(SA_MAN) Ͽ
--, ְ, , հ踦 Ͽ Ͽ.
SELECT AVG(salary), MAX(salary), MIN(salary), SUM(salary)
FROM employees
WHERE job_id = 'SA_MAN';
-- 2) EMPLOYEES ̺ ϵǾ ִ ο, ʽ NULL ƴ
-- ο, ʽ , ϵǾ ִ μ Ͽ ϶.
SELECT COUNT(last_name) as ο,
COUNT(commission_pct) ʽ,
AVG(commission_pct) "ʽ ",
COUNT(DISTINCT department_id) "μ "
FROM employees;
-- 3) EMPLOYEES ̺ μ ο, , , ְ, Ͽ ϶.
SELECT department_id,COUNT(salary) ο, AVG(salary) ձ,
MIN(salary), MAX(salary), SUM(salary)
FROM employees
GROUP BY department_id;
-- 4) EMPLOYEES ̺ μ ο, , ,
-- ְ , Ͽ Ͽ.
SELECT department_id,COUNT(salary) ο, AVG(salary) ձ,
MIN(salary), MAX(salary), SUM(salary)
FROM employees
GROUP BY department_id
ORDER BY SUM(salary) DESC;
-- 5) EMPLOYEES ̺ μ, Ͽ
-- μȣ, , ο, , Ͽ Ͽ.
-- GROUTP BY 2 ̻ ε ִ.
SELECT department_id,job_id, count(*),
AVG(salary), SUM(salary)
FROM employees
GROUP BY department_id, job_id;
-- 6) EMPLOYEES ̺ μ ο 4 μ
-- μȣ,ο, Ͽ Ͽ.(GROUP BY, HAVING)
SELECT department_id, COUNT(*), SUM(salary)
FROM employees
GROUP BY department_id
HAVING COUNT(*)>4;
-- 7) EMPLOYEES ̺ ִ 10000̻ μ ؼ
-- μȣ, , Ͽ Ͽ.
SELECT department_id, AVG(salary), SUM(salary)
FROM employees
GROUP BY department_id
HAVING MAX(salary) > 10000;
-- 8) EMPLOYEES ̺ 10000 ̻ ؼ
-- , , Ͽ ϶.
SELECT job_id, AVG(salary), SUM(salary)
FROM employees
GROUP BY job_id
HAVING AVG(salary) >= 10000;
--9) EMPLOYEES ̺ ü 10000 ʰϴ ؼ
-- հ踦 ϶. Ǹſ ϰ հ ()϶.(SA_)
SELECT job_id, SUM(salary)
FROM employees
WHERE job_id NOT LIKE 'SA%'
GROUP BY job_id
HAVING SUM(salary)>10000
ORDER BY SUM(salary) DESC;
| true |
4fa8b48e4622e5a8afd859d0f5003ae50b80585e | SQL | DrBlogPro/DrBlog | /DrBlog/target/classes/db.sql | UTF-8 | 1,842 | 3.125 | 3 | [] | no_license | create database DrBlog;
use DrBlog;
create table users(
uid int primary key auto_increment,
email varchar(50) unique,
touchphone char(11) unique,
username varchar(10) unique,
password varchar(20),
signtime datetime,
sex varchar(1)
);
create table userinfo(
uiid int primary key auto_increment,
uid int,
photo varchar(100),
introduce varchar(200),
illegal int,
status int,
money decimal
);
create table adminuser(
adid int primary key auto_increment,
uname varchar(10) unique,
password varchar(10)
);
create table blog(
bid int primary key auto_increment,
uid int,
olduser int,
title varchar(50),
pubtime datetime,
tags varchar(50),
blogtype int,
url varchar(100),
fid int
);
create table tags(
tagid int primary key auto_increment,
name varchar(5)
);
create table folder(
fid int primary key auto_increment,
uid int,
name varchar(20),
newtime datetime,
folderinfo varchar(50)
);
--↑↑↑↑↑基本功能↑↑↑↑↑
create table information(
ifid int primary key auto_increment,
uid int,
title varchar(50),
content varchar(200),
sendtime datetime
);
create table attention(
atid int primary key auto_increment,
uid int,
attentionuid int
);
create table bloginfo(
bfid int primary key auto_increment,
bid int,
status int,
good int,
bad int,
browse int,
pay int,
hot double
);
create table reply(
reid int primary key auto_increment,
bid int,
uid int,
content varchar(200),
retime datetime,
forid int
);
create table report(
repid int primary key auto_increment,
bid int,
content varchar(200),
reporttime datetime
);
create table countinfo(
countid int primary key auto_increment,
countdate date,
active int,
money decimal
);
commit;
| true |
c2ccc5c2282a7d28dfc57a9e75954a01ff798554 | SQL | yurivillarinho/T2S | /TESTE T2S.sql | UTF-8 | 5,746 | 3.546875 | 4 | [] | no_license | O teste consiste em o candidato gravar um vídeo de até 1 h realizando o teste e
explicando passo a passo do que está fazendo. Para isso será necessário gravar a tela
do computador e o microfone. O vídeo não deverá conter cortes, não tem nenhum
problema se, durante o teste, o candidato precisar consultar algum material de apoio ou
a internet, não será descontado nada da avaliação. O vídeo deverá ser publicado no
YouTube e o código da aplicação versionado no GitHub.
O sistema deverá ser uma aplicação WEB, conter um banco de dados estruturado (SQL),
o back-end deverá ser desenvolvido em JAVA ou C#, a tecnologia utilizada no front-end
fica a critério do candidato.
Obs.: Sabemos que o tempo é curto, portanto se não der tempo de completar o teste,
não tem problema realizar uma entrega parcial porém funcional.
"Crud de Contêiner
● Cliente
● Número do contêiner (4 letras e 7 números. Ex: TEST1234567)
● Tipo: 20 / 40
● Status: Cheio / Vazio
● Categoria: Importação / Exportação
Crud de Movimentações
● Tipo de Movimentação (Embarque, Descarga, Gate In, Gate out, Posicionamento
Pilha, Pesagem, Scanner)
● Data e Hora do Início
● Data e Hora do Fim
Gerar um relatório com o total de movimentações agrupadas por cliente e tipo de
movimentação.
No final do relatório deverá conter um sumário com o total de importação / exportação.
Premissas para todos os artefatos:
● Validações
● Ordenações
● Filtros
Peso da avaliação
● Funcionalidade (Atender o que foi solicitado) - 8
● Usabilidade e Design (Layout agradável) - 2"
CREATE DATABASE BD_TERMINAL;
USE BD_TERMINAL;
--CRIAÇÃO DO CONTEINER
CREATE TABLE TB_PAIS(
CD_PAIS INT NOT NULL,
NM_PAIS VARCHAR(100) NOT NULL,
CONSTRAINTS PK_PAIS
PRIMARY KEY (CD_PAIS)
);
CREATE TABLE TB_ESTADO(
CD_ESTADO INT NOT NULL,
NM_ESTADO VARCHAR (100) NOT NULL,
CD_PAIS INT NOT NULL,
CONSTRAINTS PK_ESTADO
PRIMARY KEY (CD_ESTADO),
CONSTRAINT FK_ESTADO_PAIS
FOREIGN KEY (CD_PAIS) REFERENCES TB_PAIS (CD_PAIS)
);
CREATE TABLE TB_CIDADE(
CD_CIDADE INT NOT NULL,
NM_CIDADE VARCHAR(100) NOT NULL,
CD_ESTADO INT NOT NULL,
CONSTRAINTS PK_CIDADE
PRIMARY KEY (CD_CIDADE),
CONSTRAINT FK_CIDADE_ESTADO
FOREIGN KEY (CD_ESTADO) REFERENCES TB_ESTADO (CD_ESTADO)
);
CREATE TABLE TB_ENDERECO(
CD_ENDERECO INT NOT NULL,
NM_ENDERECO VARCHAR (200) NOT NULL,
CD_CIDADE INT NOT NULL,
CONSTRAINTS PK_ENDERECO
PRIMARY KEY (CD_ENDERECO),
CONSTRAINT FK_ENDERECO_CIDADE
FOREIGN KEY (CD_CIDADE) REFERENCES TB_CIDADE (CD_CIDADE)
);
CREATE TABLE CLIENTE(
CD_CLIENTE INT NOT NULL,
NM_CLIENTE VARCHAR(200) NOT NULL,
CD_CNPJ CHAR(14) NOT NULL,
CD_ENDERECO INT NOT NULL,
CONSTRAINTS PK_CLIENTE
PRIMARY KEY (CD_CLIENTE),
CONSTRAINT FK_CLIENTE_ENDERECO
FOREIGN KEY (CD_CLIENTE) REFERENCES TB_CLIENTE (CD_CLIENTE)
);
CREATE TABLE TB_TIPO(
CD_TIPO INT NOT NULL,
NM_TIPO VARCHAR(50) NOT NULL,
CONSTRAINTS PK_TIPO
PRIMARY KEY (CD_TIPO)
);
CREATE TABLE TB_STATUS(
CD_STATUS INT NOT NULL,
NM_STATUS VARCHAR(50) NOT NULL,
CONSTRAINTS PK_STATUS
PRIMARY KEY (CD_STATUS)
);
CREATE TABLE TB_CATEGORIA(
CD_CATEGORIA INT NOT NULL,
NM_CATEGORIA VARCHAR(50) NOT NULL,
CONSTRAINTS PK_CATEGORIA
PRIMARY KEY (CD_CATEGORIA)
);
CREATE TABLE TB_CONTEINER(
CD_CLIENTE INT,
NM_CONTAINER CHAR(11) NOT NULL,
CD_TIPO INT,
CD_STATUS INT,
CD_CATEGORIA INT
CONSTRAINTS PK_CONTEINER
PRIMARY KEY (CD_CONTEINER),
CONSTRAINT FK_CONTEINER_CLIENTE
FOREIGN KEY (CD_CLIENTE) REFERENCES TB_CLIENTE (CD_CLIENTE),
CONSTRAINT FK_CONTEINER_TIPO
FOREIGN KEY (CD_TIPO) REFERENCES TB_TIPO (CD_TIPO),
CONSTRAINT FK_CONTEINER_STATUS
FOREIGN KEY (CD_STATUS) REFERENCES TB_STATUS (CD_STATUS),
CONSTRAINT FK_CONTEINER_CATEGORIA
FOREIGN KEY (CD_CATEGORIA) REFERENCES TB_CATEGORIA (CD_CATEGORIA)
);
--CRIAÇÃO DA MOVIMENTAÇÃO
CREATE TABLE TB_TIPO_MOVIMENTACAO(
CD_TIPO_MOVIMENTACAO INT NOT NULL,
NM_TIPO_MOVIMENTACAO VARCHAR(50) NOT NULL,
CONSTRAINTS PK_TIPO_MOVIMENTACAO
PRIMARY KEY (CD_TIPO_MOVIMENTACAO),
);
CREATE TABLE TB_MOVIMENTACAO(
CD_MOVIMENTACAO INT NOT NULL,
CD_CONTEINER INT NOT NULL,
CD_TIPO_MOVIMENTACAO INT NOT NULL,
DT_INICIO DATETIME NOT NULL,
DT_FIM DATETIME,
CONSTRAINTS PK_MOVIMENTACAO
PRIMARY KEY (CD_MOVIMENTACAO),
CONSTRAINT FK_MOVIMENTACAO_CONTEINER
FOREIGN KEY (CD_CONTEINER) REFERENCES TB_CONTEINER(CD_CONTEINER),
CONSTRAINT FK_MOVIMENTACAO_TIPO_MOVIMENTACAO
FOREIGN KEY (CD_TIPO_MOVIMENTACAO) REFERENCES TB_TIPO_MOVIMENTACAO (CD_TIPO_MOVIMENTACAO)
);
--INSERT BASE
INSERT INTO TB_TIPO_MOVIMENTO VALUES
(1,'EMBARQUE'),
(2,'DESCARGA'),
(3,'GATE IN'),
(4,'GATE OUT'),
(5,'POSICIONAMENTO PILHA'),
(6,'PESAGEM'),
(7,'SCANNER');
INSERT INTO TB_TIPO VALUES
(1,'20'),
(2,'40');
INSERT INTO TB_STATUS VALUES
(1,'CHEIO'),
(2,'VAZIO');
INSERT INTO TB_CATEGORIA VALUES
(1,'IMPORTAÇÃO'),
(2,'EXPORTAÇÃO');
--SELECTS
"Gerar um relatório com o total de movimentações agrupadas por cliente e tipo de
movimentação."
SELECT B.NM_TIPO_MOVIMENTACAO AS 'MOVIMENTAÇÃO',
D.NM_CLIENTE AS CLIENTE,
FROM TB_MOVIMENTACAO AS A
JOIN TB_TIPO_MOVIMENTACAO AS B
ON A.CD_TIPO_MOVIMENTACAO = B.CD_TIPO_MOVIMENTACAO
JOIN TB_CONTEINER AS C
ON A.CD_CONTEINER = C.CD_CONTEINER
JOIN TB_CLIENTE AS D
ON C.CD_CLIENTE = D.CD_CLIENTE
GROUP BY NM_CLIENTE, NM_TIPO_MOVIMENTACAO;
"No final do relatório deverá conter um sumário com o total de importação / exportação."
SELECT NM_CATEGORIA AS CATEGORIA
FROM TB_CONTEINER
GROUP BY CD_CATEGORIA; | true |
2d3770318d6ba038745e27f88d83801d68090f05 | SQL | CibinMohan/IPS-Web | /DB/ips_data.sql | UTF-8 | 4,964 | 2.921875 | 3 | [] | no_license | # MySQL-Front 3.2 (Build 8.0)
/*!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 latin1 */;
# Host: localhost Database: ips_data
# ------------------------------------------------------
# Server version 5.0.15-nt
DROP DATABASE IF EXISTS `ips_data`;
CREATE DATABASE `ips_data` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `ips_data`;
#
# Table structure for table case_details_info
#
CREATE TABLE `case_details_info` (
`case_id` int(11) NOT NULL auto_increment,
`police_id` int(11) NOT NULL default '0',
`name` varchar(50) NOT NULL,
`suspect_adhaar_no` varchar(50) NOT NULL,
`suspect_phone` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`address` varchar(50) NOT NULL,
`vehicle_no` varchar(50) NOT NULL,
`case_camands` blob NOT NULL,
`Case_type` varchar(50) NOT NULL,
`time` varchar(50) NOT NULL,
`dates` date NOT NULL,
`location` varchar(50) NOT NULL,
`victim_adhaar_no` varchar(50) NOT NULL,
`case_status` varchar(50) NOT NULL,
PRIMARY KEY (`case_id`),
KEY `police_id` (`police_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Dumping data for table case_details_info
#
#
# Table structure for table case_file_info
#
CREATE TABLE `case_file_info` (
`case_file_id` int(11) NOT NULL auto_increment,
`case_id` int(11) NOT NULL default '0',
`case_file` blob NOT NULL,
PRIMARY KEY (`case_file_id`),
KEY `case_id` (`case_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Dumping data for table case_file_info
#
#
# Table structure for table case_penalty_info
#
CREATE TABLE `case_penalty_info` (
`penalty_id` int(11) NOT NULL auto_increment,
`case_id` int(11) NOT NULL default '0',
`penaity_amt` varchar(50) NOT NULL,
`penalty_status` varchar(50) NOT NULL,
`last_date` varchar(50) NOT NULL,
PRIMARY KEY (`penalty_id`),
KEY `case_id` (`case_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Dumping data for table case_penalty_info
#
#
# Table structure for table court_info
#
CREATE TABLE `court_info` (
`court_id` int(11) NOT NULL auto_increment,
`username` varchar(50) NOT NULL,
`court_name` varchar(50) NOT NULL,
`phone` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`address` varchar(50) NOT NULL,
PRIMARY KEY (`court_id`),
KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Dumping data for table court_info
#
INSERT INTO `court_info` VALUES (2,'cout','court','1478523690','aneesh.think@gmail.com','dfvhdhfgb');
#
# Table structure for table login_info
#
CREATE TABLE `login_info` (
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`type` varchar(50) NOT NULL,
KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Dumping data for table login_info
#
INSERT INTO `login_info` VALUES ('admin','admin','admin');
INSERT INTO `login_info` VALUES ('manu','12345','police');
INSERT INTO `login_info` VALUES ('cout','54321','court');
#
# Table structure for table lost_vehicle_info
#
CREATE TABLE `lost_vehicle_info` (
`id` int(11) NOT NULL auto_increment,
`vehicle_no` varchar(50) NOT NULL,
`owner_name` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`phone` varchar(50) NOT NULL,
`case_date` varchar(50) NOT NULL,
`time` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Dumping data for table lost_vehicle_info
#
#
# Table structure for table police_info
#
CREATE TABLE `police_info` (
`police_id` int(11) NOT NULL auto_increment,
`username` varchar(50) NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`phone` varchar(50) NOT NULL,
`address` varchar(50) NOT NULL,
PRIMARY KEY (`police_id`),
KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Dumping data for table police_info
#
INSERT INTO `police_info` VALUES (33,'manu','manu','aneesh.think@gmail.com','1478523690','hdgfhjdhjfhdehgdfghlrfkl ');
#
# Foreign keys for table case_file_info
#
ALTER TABLE `case_file_info`
ADD FOREIGN KEY (`case_id`) REFERENCES `case_details_info` (`case_id`) ON DELETE CASCADE ON UPDATE CASCADE;
#
# Foreign keys for table case_penalty_info
#
ALTER TABLE `case_penalty_info`
ADD FOREIGN KEY (`case_id`) REFERENCES `case_details_info` (`case_id`) ON DELETE CASCADE ON UPDATE CASCADE;
#
# Foreign keys for table court_info
#
ALTER TABLE `court_info`
ADD FOREIGN KEY (`username`) REFERENCES `login_info` (`username`) ON DELETE CASCADE ON UPDATE CASCADE;
#
# Foreign keys for table police_info
#
ALTER TABLE `police_info`
ADD FOREIGN KEY (`username`) REFERENCES `login_info` (`username`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
801e6b0f7378e3b950f0a321ce06240c8b0d7ff8 | SQL | govardhanhegde/MIT-CSE-LABS | /DBMS Lab/PL Cursors Advanced/01.sql | UTF-8 | 1,582 | 3.765625 | 4 | [] | no_license |
-- 1 (i)
DROP TABLE Salary_Raise;
CREATE TABLE Salary_Raise (iid varchar(20), rdate date, raise numeric(8, 2));
DECLARE
CURSOR curse IS
SELECT * FROM Instructor WHERE dept_name = 'Biology' FOR UPDATE;
raiseamt numeric(8, 2);
BEGIN
FOR sal IN curse LOOP
raiseamt := sal.salary * 1.05;
UPDATE Instructor SET salary = salary * 1.05;
INSERT INTO Salary_Raise VALUES (sal.ID, CURRENT_DATE, raiseamt);
END LOOP;
END;
/
SELECT * FROM Salary_Raise;
-- 1 (ii)
DROP TABLE Salary_Raise;
CREATE TABLE Salary_Raise (iid varchar(20), rdate date, raise numeric(8, 2));
DECLARE
id varchar(20);
sal numeric(8, 2);
dept varchar(20);
raiseamt numeric(8, 2);
CURSOR curse IS
SELECT ID, salary, dept_name FROM Instructor FOR UPDATE;
BEGIN
OPEN curse;
LOOP
FETCH curse INTO id, sal, dept;
IF dept = 'Comp. Sci.' THEN
UPDATE Instructor SET salary = sal * 1.05 WHERE CURRENT OF curse;
raiseamt := sal * 1.05;
INSERT INTO Salary_Raise VALUES (id, CURRENT_DATE, raiseamt);
END IF;
EXIT WHEN curse%NOTFOUND;
END LOOP;
END;
/
SELECT * FROM Salary_Raise;
-- 3
DECLARE
tsal numeric;
BEGIN
SAVEPOINT insertIn;
INSERT INTO Instructor VALUES ('19299', 'Walter White', 'Chemistry', '80000');
SAVEPOINT salInc;
UPDATE Instructor SET salary = 100000 WHERE name LIKE '%Mozart%';
UPDATE Instructor SET salary = 150000 WHERE name LIKE '%Srinivasan%'
SELECT SUM(salary) INTO tsal FROM Instructor;
IF tsal > 2000000 THEN
ROLLBACK TO SAVEPOINT salInc;
END IF;
END;
/
| true |
2884330ecd966c0d90cb3c4495a305e56df90193 | SQL | joshzwrd/POE-CDI | /php/1_PHP_Procedural/Exercices_V3/Exercice_1.sql | UTF-8 | 761 | 3.828125 | 4 | [] | no_license | -- Créez une base de données nommée M2i_PHP_MYSQL;
-- Créez une table nommée Bibliothèque, dont les champs sont :
-- -- Ref : nombre réel non-nullable et unique
-- -- Nom : chaine de caractère, dont la taille est de 255, non-nullable
-- -- Ville : chaine de caractères, dont la taille est de 255.
-- -- Code Postal
-- Dont Ref est une clé primaire.
CREATE DATABASE M2i_PHP_MYSQL1 CHARACTER SET utf8 COLLATE utf8_general_ci;
USE M2i_PHP_MYSQL1;
CREATE TABLE Bibliotheque (
Ref int NOT NULL UNIQUE,
Nom varchar(255) NOT NULL,
Ville varchar(255),
CodePostal varchar(25),
PRIMARY KEY (Ref)
);
-- Type en SQL : varchar, int, text, etc
-- Clé primaire / Clé étrangère : Primary Key / Foreign Key
--
| true |
5035e74ccd1cb6894bf5753e48318bea4a44e307 | SQL | fhoffa-snow/AdventOfCodeSQL | /2020/2-1.sql | UTF-8 | 433 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive | create or replace temp table passwords as
select regexp_substr(v, '[0-9]*') pmin
, regexp_substr(v, '-([0-9]*)', 1, 1, 'e') pmax
, regexp_substr(v, '[a-z]') char
, regexp_substr(v, '[a-z]+$') pass
from (
select index i, value v
from table(flatten(SPLIT(
'1-3 a: abcde
1-3 b: cdefg
2-9 c: ccccccccc'
, '\n'))));
select count_if(
len(regexp_replace(pass, '[^'||char||']', '')) between pmin and pmax
) result
from passwords;
| true |
f2d983221f9da26759ba05832222a3bece1bb2d6 | SQL | shc1227/sql | /2021_03_11.sql | UTF-8 | 460 | 3.234375 | 3 | [] | no_license | SELECT *
FROM emp;
--데이터 조회 방법
-- FROM : 데이터를 조회할 테이블 명시
-- SELECT : 테이블에 있는 컴럼명, 조회 하고자 하는 컴럼명
테이블의 모든 컴럼을 조회할 경우 *를 기술
SELECT empno, ename
FROM EMP;
SELECT *
FROM EMP;
--EMPNO : 직원번호, ENAME;직원이름, JOB:담당업무,
--MGR:상위 담당자 ,HRIEDATE:고용일자 ,SAL:급여 ,
--COMM:커미션 ,DEPTNO: 부서번호
| true |
584e83a32b2cba2ee866c5525571bb11a4f6c539 | SQL | ANeshkova/MySQL | /07.2 Database Programmability - Exercise/04. Employees from Town.sql | UTF-8 | 444 | 3.515625 | 4 | [] | no_license | USE `soft_uni`;
-- FOR JUDGE TESTING SYSTEM(without delimiter):
-- DELIMITER $$
CREATE PROCEDURE `usp_get_employees_from_town` (town_name VARCHAR(40))
BEGIN
SELECT e.`first_name`, e.`last_name`
FROM `employees` AS e
JOIN `addresses` AS a
ON a.`address_id` = e.`address_id`
JOIN `towns` AS t
ON t.`town_id` = a.`town_id`
WHERE t.`name` = town_name
ORDER BY e.`first_name`, e.`last_name`, e.`employee_id`;
END; -- END$$
-- DELIMITER ;
| true |
a8d90a1daf1c7f88b85988b4771815becb0e2d2f | SQL | benoutram/explore-education-statistics | /src/GovUk.Education.ExploreEducationStatistics.Data.Model/Migrations/20200520085437_ReleaseFootnote_Up.sql | UTF-8 | 193 | 3 | 3 | [
"MIT"
] | permissive | INSERT INTO ReleaseFootnote (FootnoteId, ReleaseId)
SELECT Id, ReleaseId from Footnote AS f
WHERE NOT EXISTS(select * FROM ReleaseFootnote WHERE FootnoteId = f.Id AND ReleaseId = f.ReleaseId); | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.