text stringlengths 6 9.38M |
|---|
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Relationships')
BEGIN
CREATE TABLE Relationships (
UserOneId UNIQUEIDENTIFIER NOT NULL,
UserTwoId UNIQUEIDENTIFIER NOT NULL,
RelationshipTypeId TINYINT NOT NULL,
AcceptedDate DATETIME NOT NULL,
CONSTRAINT PK_Relationships PRIMARY KEY (UserOneId, UserTwoId, RelationshipTypeId),
CONSTRAINT FK_Relationships_UserOneId_Users_Id FOREIGN KEY (UserOneId) REFERENCES Users(Id),
CONSTRAINT FK_Relationships_UserTwoId_Users_Id FOREIGN KEY (UserTwoId) REFERENCES Users(Id),
CONSTRAINT FK_Relationships_RelationshipTypeId_RelationshipTypes_Id FOREIGN KEY (RelationshipTypeId) REFERENCES RelationshipTypes(Id)
);
END |
--1. 직원명과 이메일 , 이메일 길이를 출력하시오
-- 이름 이메일 이메일길이
-- ex) 홍길동 , hong@kh.or.kr 13
select emp_name 이름,
email 이메일,
length(email) 이메일길이
from employee;
--2. 직원의 이름과 이메일 주소중 아이디 부분만 출력하시오
-- ex) 노옹철 no_hc
-- ex) 정중하 jung_jh
select emp_name,
substr(email, 1, instr(email, '@') - 1)
from employee;
--3. 60년대에 태어난 직원명과 년생, 보너스 값을 출력하시오
-- 그때 보너스 값이 null인 경우에는 0 이라고 출력 되게 만드시오
-- 직원명 년생 보너스
-- ex) 선동일 1962 0.3
-- ex) 송은희 1963 0
select emp_name 직원명,
'19'||substr(emp_no,1,2) 년생,
nvl(bonus, 0) 보너스
from employee
where substr(emp_no,1,1) = '6';
--4. '010' 핸드폰 번호를 쓰지 않는 사람의 수를 출력하시오 (뒤에 단위는 명을 붙이시오)
-- 인원
-- ex) 3명
select count(*) 인원
from employee
where substr(phone, 1, 3) != '010';
--5. 직원명과 입사년월을 출력하시오
-- 단, 아래와 같이 출력되도록 만들어 보시오
-- 직원명 입사년월
-- ex) 전형돈 2012년12월
-- ex) 전지연 1997년 3월
select emp_name 직원명,
to_char(hire_date, 'yyyy"년"mm"월"') 입사년월
from employee;
--6. 사원테이블에서 다음과 같이 조회하세요.
--[현재나이 = 현재년도 - 태어난년도 +1] 한국식 나이를 적용.
--
---------------------------------------------------------------------------
--사원번호 사원명 주민번호 성별 현재나이
---------------------------------------------------------------------------
--200 선동일 621235-1******* 남 57
--201 송종기 631156-1******* 남 56
--202 노옹철 861015-1******* 남 33
select emp_id 사원번호,
emp_name 사원명,
rpad(substr(emp_no, 1, 8), 14, '*') 주민번호,
case
when substr(emp_no, 8, 1) in('1','3') then '남'
else '여'
end 성별,
to_char(sysdate, 'yyyy') + 1 -
case
when substr(emp_no, 8, 1) in('1', '2') then '19' || substr(emp_no, 1, 2)
else '20' || substr(emp_no, 1, 2)
end 현재나이
from employee;
--7. 직원명, 직급코드, 연봉(원) 조회
-- 단, 연봉은 ₩57,000,000 으로 표시되게 함
-- 연봉은 보너스포인트가 적용된 1년치 급여임
select emp_name 직원명,
job_code 직급코드,
to_char((salary + (salary * nvl(bonus,0)))*12, 'fmL9,999,999,999,999') 연봉
from employee;
--8. 부서코드가 D5, D9인 직원들 중에서 2004년도에 입사한 직원중에 조회함.
-- 사번 사원명 부서코드 입사일
select emp_id 사번,
emp_name 사원명,
dept_code 부서코드,
hire_date 입사일
from employee
where dept_code in ('D5', 'D9') and substr(hire_date, 1, 2) = 04;
--9. 직원명, 입사일, 오늘까지의 근무일수 조회
-- * 주말도 포함 , 소수점 아래는 버림
select emp_name 직원명,
hire_date 입사일,
trunc(sysdate - hire_date) 근무일수
from employee;
--10. 직원명, 부서코드, 생년월일, 만나이 조회
-- 단, 생년월일은 주민번호에서 추출해서,
-- ㅇㅇㅇㅇ년 ㅇㅇ월 ㅇㅇ일로 출력되게 함.
-- 나이는 주민번호에서 추출해서 날짜데이터로 변환한 다음, 계산함
select emp_name 직원명,
dept_code 부서코드,
to_char(
to_date(
case
when substr(emp_no, 8, 1) in ('1', '2') then '19' || substr(emp_no, 1, 6)
else '20' || substr(emp_no, 1, 6)
end
, 'yyyymmdd')
, 'yyyy"년"mm"월"dd"일"') 생년월일,
to_char(sysdate, 'yyyy') -
to_char(
to_date(
case
when substr(emp_no, 8, 1) in ('1', '2') then '19' || substr(emp_no, 1, 6)
else '20' || substr(emp_no, 1, 6)
end
, 'yyyymmdd')
, 'yyyy') 만나이
from employee;
--11. 직원들의 입사일로 부터 년도만 가지고, 각 년도별 입사인원수를 구하시오.
-- 아래의 년도에 입사한 인원수를 조회하시오. 마지막으로 전체직원수도 구하시오
-- => decode, sum 사용
--
-- -------------------------------------------------------------------------
-- 1998년 1999년 2000년 2001년 2002년 2003년 2004년 전체직원수
-- -------------------------------------------------------------------------
select sum(decode(to_char(hire_date, 'yy'), '98', '1'))"1998년",
sum(decode(to_char(hire_date, 'yy'), '99', '1'))"1999년",
sum(decode(to_char(hire_date, 'yy'), '00', '1'))"2000년",
sum(decode(to_char(hire_date, 'yy'), '01', '1'))"2001년",
sum(decode(to_char(hire_date, 'yy'), '02', '1'))"2002년",
sum(decode(to_char(hire_date, 'yy'), '03', '1'))"2003년",
sum(decode(to_char(hire_date, 'yy'), '04', '1'))"2004년",
count(*) 전체직원수
from employee;
--12. 부서코드가 D5이면 총무부, D6이면 기획부, D9이면 영업부로 처리하시오.(case 사용)
-- 단, 부서코드가 D5, D6, D9 인 직원의 정보만 조회하고, 부서코드 기준으로 오름차순 정렬함.
select emp_id, emp_name, emp_no, email, phone, dept_code,
case
when dept_code = 'D5' then '총무부'
when dept_code = 'D6' then '기획부'
when dept_code = 'D9' then '영업부'
end 부서
from employee
where dept_code in ('D5', 'D6', 'D9')
order by dept_code;
select *
from employee;
|
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.2.6-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5125
-- --------------------------------------------------------
CREATE OR REPLACE VIEW `vw_merged_work_order_nm01` AS SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_chis`
WHERE `current_flag` = 1
UNION ALL
SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_f3fa`
WHERE `current_flag` = 1
UNION ALL
SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_grov`
WHERE `current_flag` = 1
UNION ALL
SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_grow`
WHERE `current_flag` = 1
UNION ALL
SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_mj6a`
WHERE `current_flag` = 1
UNION ALL
SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_mkew`
WHERE `current_flag` = 1
UNION ALL
SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_mst1`
WHERE `current_flag` = 1
UNION ALL
SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_stam`
WHERE `current_flag` = 1
UNION ALL
SELECT 'NM01' AS 'asset_code'
,`facility_code`
,`order`
,`functional_loc`
,`description`
,`order_type`
,`planner_group`
,`user_status`
,`abc_indic`
,`work_center`
,`maint_activ_type`
,`latest_allow_fin_dat`
,`system_status`
FROM `barrier_ods`.`work_order_nm01_wind`
WHERE `current_flag` = 1 ;
|
UPDATE estados
SET nome = 'Maranhão' -- Até comnado válido que causa JC, pois altera todo o banco
WHERE sigla = 'MA' -- ou utilizar a PK
SELECT est.nome FROM estados est WHERE sigla = "MA";
UPDATE estados
SET nome = 'Paraná',
populacao = 11.32
WHERE sigla = "PR" -- aspas não precisar ser simples
SELECT
est.nome,
sigla,
populacao
FROM estados est
WHERE sigla = "PR";
|
Create Procedure Sp_get_ReceivedOLTPM
As
Begin
Select ID From RecdDoc_PMOLT Where IsNull(Status,0) = 0
End
|
CREATE SCHEMA SQLExercise;
CREATE TABLE SQLExercise.Products (
ID INT IDENTITY(1,1),
Name NVARCHAR(100),
Price MONEY,
PRIMARY KEY (ID)
);
CREATE TABLE SQLExercise.Customers (
ID INT IDENTITY(1,1),
FirstName NVARCHAR(100),
LastName NVARCHAR(100),
CardNumber NCHAR(16),
PRIMARY KEY (ID)
);
CREATE TABLE SQLExercise.Orders (
ID INT IDENTITY(1,1),
ProductID INT NOT NULL,
CustomerID INT NOT NULL
PRIMARY KEY (ID),
FOREIGN KEY (ProductID) REFERENCES SQLExercise.Products(ID),
FOREIGN KEY (CustomerID) REFERENCES SQLExercise.Customers(ID)
);
-- 1
INSERT INTO SQLExercise.Products (Name, Price) VALUES('Apple', 0.5);
INSERT INTO SQLExercise.Products (Name, Price) VALUES('Cereal', 3.5);
INSERT INTO SQLExercise.Products (Name, Price) VALUES('Milk', 4);
INSERT INTO SQLExercise.Customers (FirstName, LastName, CardNumber) VALUES('Trevor', 'Dunbar', '1234567890123456');
INSERT INTO SQLExercise.Customers (FirstName, LastName, CardNumber) VALUES('John', 'Doe', '9876543212345678');
INSERT INTO SQLExercise.Customers (FirstName, LastName, CardNumber) VALUES('Kelly', 'Smith', '5555444466665555');
INSERT INTO SQLExercise.Orders (ProductID, CustomerID) VALUES (1, 1);
INSERT INTO SQLExercise.Orders (ProductID, CustomerID) VALUES (2, 2);
INSERT INTO SQLExercise.Orders (ProductID, CustomerID) VALUES (3, 3);
-- 2
INSERT INTO SQLExercise.Products (Name, Price) VALUES ('iPhone', 200);
--3
INSERT INTO SQLExercise.Customers (FirstName, LastName) VALUES ('Tina', 'Smith');
--4
INSERT INTO SQLExercise.Orders (ProductID, CustomerID) VALUES (4, 4);
--5
SELECT FirstName, Name FROM SQLExercise.Customers
INNER JOIN SQLExercise.Orders ON Customers.ID = Orders.CustomerID
INNER JOIN SQLExercise.Products ON Orders.ProductID = Products.ID
WHERE Customers.FirstName = 'Tina' AND Customers.LastName = 'Smith';
--6
SELECT Name, SUM(Price) FROM SQLExercise.Products
INNER JOIN SQLExercise.Orders ON Products.ID = SQLExercise.Orders.ProductID
WHERE Products.Name = 'iPhone'
GROUP BY Name;
--7
UPDATE SQLExercise.Products
SET Price = 250
WHERE Name = 'iPhone'; |
--1. 2014년 1월 2일 내원환자 전체 정보조회
-- 환자번호, 환자이름, 생년월일, 성별, 진료의사명, 진료과명
-- 스칼라 서브쿼리로 표현
SELECT
T.pat_code
, ( SELECT pat_name FROM PATIENT P WHERE T.pat_code=P.pat_code ) pat_name
, ( SELECT pat_birth FROM PATIENT P WHERE T.pat_code=P.pat_code ) pat_birth
, ( SELECT pat_gender FROM PATIENT P WHERE T.pat_code=P.pat_code ) pat_gender
, ( SELECT DOC_NAME FROM DOCTOR D WHERE D.doc_code = T.doc_code ) DOC_NAME
, ( SELECT DEP_NAME FROM DEPARTMENT M, DOCTOR D WHERE D.doc_code = T.doc_code AND M.DEP_CODE=D.DEP_CODE ) DEP_NAME
FROM TREAT T
WHERE 1=1
AND trt_year='2014'
AND trt_date='0102'
ORDER BY PAT_CODE;
1 오환자1 19831203 F 황선생 외상과
2 김환자 19710108 M 강선생 비과
3 박환자 19890330 F 최선생 위장관외과
5 오대식 19801222 M 구선생 비과
10 백명 19790322 M 한선생 간담췌외과
16 김성민 20060903 M 김선생 성형외과
17 배창환 20030407 M 김선생 호흡기내과
18 김성식 20051219 M 하선생 혈액내과
21 송주희 19910225 F 최선생 소아외과
22 김도연 19921125 F 최선생 소아외과
24 차은비 19840302 F 박선생 혈액내과
27 안성댁 20091106 F 기선생 혈관이식외과
30 권환자 20040526 M 강선생 알레르기내과
34 송환자 19700713 F 구선생 혈관이식외과
35 황환자 19970323 M 한선생 간담췌외과
38 도진 20020523 F 조선생 척추외과
42 지유 19881010 F 구선생 비과
44 송학 19831129 M 황선생 대장항문외과
49 광성 20070627 M 조선생 비과
50 김애플 20001221 M 박선생 이과
--2.2014년 1월 2일 내원환자 중 부서테이블을 WHERE 절 SubQuery를
--사용하여 조회
-- 환자번호, 환자이름, 생년월일, 성별, 진료의사명, 진료과명
-- 단 외과계열 환자만조회('02xx')
-- where절 subquery
SELECT
T.pat_code
, ( SELECT pat_name FROM PATIENT P WHERE T.pat_code=P.pat_code ) pat_name
, ( SELECT pat_birth FROM PATIENT P WHERE T.pat_code=P.pat_code ) pat_birth
, ( SELECT pat_gender FROM PATIENT P WHERE T.pat_code=P.pat_code ) pat_gender
, ( SELECT DOC_NAME FROM DOCTOR D WHERE D.doc_code = T.doc_code ) DOC_NAME
, ( SELECT DEP_NAME FROM DEPARTMENT M, DOCTOR D WHERE D.doc_code = T.doc_code AND M.DEP_CODE=D.DEP_CODE ) DEP_NAME
FROM TREAT T
WHERE 1=1
AND trt_year='2014'
AND trt_date='0102'
AND SUBSTR((
SELECT M.DEP_code
FROM DEPARTMENT M, DOCTOR D
WHERE D.doc_code = T.doc_code
AND M.DEP_CODE=D.DEP_CODE
),0,2) = '02'
ORDER BY PAT_CODE;
1 오환자1 19831203 F 황선생 외상과
3 박환자 19890330 F 최선생 위장관외과
10 백명 19790322 M 한선생 간담췌외과
21 송주희 19910225 F 최선생 소아외과
22 김도연 19921125 F 최선생 소아외과
27 안성댁 20091106 F 기선생 혈관이식외과
34 송환자 19700713 F 구선생 혈관이식외과
35 황환자 19970323 M 한선생 간담췌외과
44 송학 19831129 M 황선생 대장항문외과
|
create database marvin default character set utf8;
create user 'marvin' identified by 'abcd1234';
grant all on marvin.* to marvin;
|
■問題
ユーザテーブル(usr)から都道府県別のユーザ数を求めてみましょう。なお、取り出す列の別名は、それぞれ「都道府県名」「ユーザ数」とします。
■実行文
# prefecture列を都道府県名として、都道府県別のユーザ数をユーザ数として取得
SELECT
prefecture AS 都道府県名,
COUNT(*) AS ユーザ数
# ユーザテーブルから取得
FROM
usr
# 都道府県別に取得
GROUP BY
prefecture
;
■返却値
mysql> SELECT
-> prefecture AS 都道府県名,
-> COUNT(*) AS ユーザ数
-> FROM
-> usr
-> GROUP BY
-> prefecture
-> ;
+------------+----------+
| 都道府県名 | ユーザ数 |
+------------+----------+
| 千葉県 | 4 |
| 神奈川県 | 4 |
| 茨城県 | 4 |
| 東京都 | 3 |
| 埼玉県 | 2 |
| 栃木県 | 2 |
| 静岡県 | 2 |
+------------+----------+
7 rows in set (0.05 sec) |
INSERT INTO users (name, email, password)
VALUES ('Jamie Jones', 'jj@jones.com', '$2a$10$FB/BOAVhpuLvpOREQVmvmezD4ED/.JBIDRh70tGevYzYzQgFId2u.');
VALUES ('Tommy-Lee Jones', 'tl@jones.com', '$2a$10$FB/BOAVhpuLvpOREQVmvmezD4ED/.JBIDRh70tGevYzYzQgFId2u.');
VALUES ('Sam Jones', 'sj@jones.com', '$2a$10$FB/BOAVhpuLvpOREQVmvmezD4ED/.JBIDRh70tGevYzYzQgFId2u.');
INSERT INTO properties (owner_id, title, description, thumbnail_photo_url, cover_photo_url, cost_per_night, parking_spaces, number_of_bathrooms, number_of_bedrooms, country, street, city, province, post_code, active)
VALUES (1, 'Dreamy Palace', 'Dreamy', 'https://thumbs.dreamstime.com/b/foggy-window-closeup-shot-steamy-water-drops-abstract-background-close-up-115637315.jpg', 'https://barineauac.com/wp-content/uploads/bfi_thumb/steamy-windows-31tk7i04lgmtzitfclgpr3l76iuzqq9vm8seo5ahdalrgd5de.jpg', 500, 5, 3, 3, 'Canada', 'Dury', 'Guelph', 'BC', "H2GUIU", true);
VALUES (2, 'Steamy Palace', 'Steamy', 'https://i.redd.it/tkelj7oyluj01.jpg', 'https://i.ytimg.com/vi/pFDV04HObg0/hqdefault.jpg' 400, 6, 1, 2, 'Canada', 'Surry', 'Gattineua', 'ON', "H2GJHU", true);
VALUES (3, 'Sweaty Palace', 'Sweaty', 'https://vitalrecord.tamhsc.edu/wp-content/uploads/2016/05/w_sweating_thefacialfitness.jpg', 'https://thoughtcatalog.com/wp-content/uploads/2014/09/sweat.gif?resize=625,350&quality=95&strip=all&crop=1', 800, 7, 5, 4, 'Canada', 'Fury', 'Monterray', 'QC', "H2GTUT", true);
INSERT INTO reservations (guest_id, property_id, start_date, end_date)
VALUES (1, 1, '2018-09-11', '2018-09-26'),
(2, 2, '2019-01-04', '2019-02-01'),
(3, 3, '2021-10-01', '2021-10-14');
INSERT INTO property_reviews (guest_id, property_id, reservation_id, rating, message)
VALUES (1, 1, 1, 5, 'Great!');
VALUES (2, 2, 2, 4,'Swell!');
VALUES (3, 3, 3, 3, 'Meh!');
|
/*
================================================================================
Using the %TYPE Attribute
================================================================================
The %TYPE attribute lets you declare a
- constant
- variable
- field
- parameter
to be of the same data type a previously declared
- variable
- field
- record
- nested table
- database column
If the referenced item changes, your declaration is automatically updated.
You need not change your code when, for example, the length of a VARCHAR2
column increases.
The referencing item inherits the following from the referenced item:
- data type and size
- constraints (unless the referenced item is a column)
The referencing item does not inherit the initial value of the referenced
item. Therefore, if the referencing item specifies or inherits the NOT NULL
constraint, you must specify an initial value for it.
In Example 2-10, the variable debit inherits the data type of the variable credit.
The variables upper_name, lower_name, and init_name inherit the data type and default
value of the variable name.
*/
set serveroutput on;
DECLARE
credit PLS_INTEGER RANGE 1000..25000;
debit credit%TYPE; -- inherits data type
name1 VARCHAR2(20) default 'JoHn SmItH';
upper_name1 name1%TYPE; -- inherits data type but NOT the default value
lower_name1 name1%TYPE; -- inherits data type but NOT the default value
init_name1 name1%TYPE; -- inherits data type but NOT the default value
BEGIN
DBMS_OUTPUT.PUT_LINE ('name: ' || name1);
DBMS_OUTPUT.PUT_LINE ('upper_name: ' || UPPER(upper_name1));
DBMS_OUTPUT.PUT_LINE ('lower_name: ' || LOWER(lower_name1));
DBMS_OUTPUT.PUT_LINE ('init_name: ' || INITCAP(init_name1));
END;
/
DECLARE
name1 VARCHAR2(20) NOT NULL := 'JoHn SmItH';
-- inherits data type and constraint, therefore it will raise an error
-- because of the NOT NULL constraint
upper_name1 name1%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE ('name: ' || name1);
DBMS_OUTPUT.PUT_LINE ('upper_name: ' || UPPER(upper_name1));
END;
/
DECLARE
name1 constant VARCHAR2(20) := 'JoHn SmItH';
-- %TYPE cannot be used with CONSTANTS. It will raise a compilation error:
-- PLS-00206: %TYPE must be applied to a variable, column, field or attribute, not to "NAME1"
upper_name1 name1%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE ('name: ' || name1);
DBMS_OUTPUT.PUT_LINE ('upper_name: ' || UPPER(upper_name1));
END;
/
/*
Assigning Values to Variables
---------------------------------------
After declaring a variable, you can assign a value to it in these ways:
- Use the assignment statement to assign it the value of an expression.
- Use the SELECT INTO or FETCH statement to assign it a value from a table.
- Pass it to a subprogram as an OUT or IN OUT parameter, and then assign
the value inside the subprogram.
Assigning Values to BOOLEAN Variables
---------------------------------------
The only values that you can assign to a BOOLEAN variable are TRUE,
FALSE, and NULL.
*/
DECLARE
done BOOLEAN; -- Initial value is NULL by default
counter NUMBER := 0;
BEGIN
done := FALSE; -- Assign literal value
WHILE done != TRUE -- Compare to literal value
LOOP
counter := counter + 1;
done := (counter > 500); -- Assign value of BOOLEAN expression
END LOOP;
END;
/
/*
Assigning LITERALS to variables
-------------------------------
*/
declare
v_my_integer NUMBER;
v_my_sci_not NUMBER;
begin
v_my_integer := 100;
v_my_sci_not := 2E5; -- 2E5 meaning 2*10^5 = 200,000
end;
/
/*
BIND VARIABLES
---------------------------------------
Bind variable declaration
SQL> VARIABLE v_bind1 VARCHAR2(10);
VARIABLE is a command. If you issue the command
SQL> VARIABLE ;
it will show all bind variables declared in the session. If you issue the command
SQL> VARIABLE v_bind1;
it will show the definition of the bind variable specified
** RESTRICTIONS **
Restriction: If you are creating a bind variable of NUMBER datatype then you cannot
specify the precision and scale.
Bind variable assignment out of a PL/SQL block
SQL> EXEC :v_bind1 := 'Hello' ;
Bind variable assignment within a PL/SQL block
BEGIN
:v_bind1 := 'Bye!';
END;
/
Accessing the vale of a bind variable
BEGIN
DBMS_OUTPUT.PUT_LINE(:v_bind1);
END;
/
*/
/*
the RANGE constraint
-----------------------------
Note 1:
The only base types for which you can specify a range of values are PLS_INTEGER
and its subtypes (both predefined and user-defined).
*/
declare
l_constrained NUMBER(2) RANGE 7..10 ; --> ERROR: it's not applied on PLS_INTEGER or its subtype
begin
l_constrained := 9;
end ;
/
declare
subtype my_type is simple_integer range 10..20 ;
l_constrained_int my_type := 10 ;
procedure print(msg varchar2, v number) is
begin
dbms_output.put_line(msg||': '||v);
end ;
begin
l_constrained_int := 12 ;
print('12',l_constrained_int); --> OK
l_constrained_int := 4 ;
print('4',l_constrained_int); --> ERROR: out of range
end;
/
declare
subtype my_type is pls_integer range 10..20 ;
l_constrained_int my_type ; --> This is NULL when defined. Range allows NULL numbers
procedure print(msg varchar2, v number) is
begin
dbms_output.put_line(msg||': '||v);
end ;
begin
l_constrained_int := 12 ;
print('12',l_constrained_int); --> OK
end;
/
declare
C_MIN constant pls_integer := 10 ;
C_MAX constant pls_integer := 20 ;
--> Numeric literals are required using RANGE
--> Compilation ERROR !!!
subtype my_type is simple_integer range C_MIN..C_MAX ;
begin
null;
end;
/
/*
Note 2:
in case you want to apply the NOT NULL contraint, it must follow the RANGE operator
*/
declare
l_constrained1 PLS_INTEGER RANGE 7..10 NOT NULL;
l_constrained2 PLS_INTEGER NOT NULL RANGE 7..10 ; --> COMPILATION ERROR
begin
NULL;
end ;
/
declare
l_sub_int SIMPLE_INTEGER := 8 ;
l_anc_int l_sub_int%type ; --> thi will fail due to the NOT NULL constraint from SIMPLE_INTEGER
begin
null;
end;
/
/*
From Steven Feuerstein book "Oracle PL/SQL Programming, 5th Ed." page 183:
"Be aware that an anchored subtype does not carry over the NOT NULL constraint
to the variables it defines"
I cannot demonstrate that. I wrote an e-mail to Steven on 12 Dec 2015. Hope
he'll reply...
*/
declare
subtype my_type is pls_integer range 12 .. 15 not null ;
l_sub_int my_type := 13 ;
l_anc_int l_sub_int%type ; --> this will fail due to the NOT NULL constraint from SIMPLE_INTEGER
begin
null;
end;
/
/*
from Steven Feuerstein:
Massimo,
Here’s what I meant:
The NOT NULL constraint from the column definition is not carried over to the
subtype.
Best of luck wiht the 1Z0-144 exam! Are you by any chance testing your SQL and
PL/SQL knowledge at plsqlchallenge.oracle.com?
This code will run without an error:
*/
create table tst (n number not null)
/
declare
subtype my_type is tst.n%type ;
l_sub_int my_type ;
begin
null;
end;
/
|
/*
Navicat MySQL Data Transfer
Source Server : Linux
Source Server Version : 50523
Source Host : 192.168.42.123:3306
Source Database : meilv
Target Server Type : MYSQL
Target Server Version : 50523
File Encoding : 65001
Date: 2017-04-27 22:47:23
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for mlv_address
-- ----------------------------
DROP TABLE IF EXISTS `mlv_address`;
CREATE TABLE `mlv_address` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '无符号的自增ID',
`uid` int(11) NOT NULL,
`address` varchar(255) NOT NULL,
`phone` char(11) NOT NULL,
`name` varchar(50) NOT NULL,
`sex` tinyint(4) NOT NULL COMMENT '1:男 2:女',
`status` tinyint(4) DEFAULT '1' COMMENT '1位正常,2为用户已删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_address
-- ----------------------------
INSERT INTO `mlv_address` VALUES ('3', '6', '东圃珠村文华新大街三巷一号', '18320487321', '叶治良', '1', '1');
INSERT INTO `mlv_address` VALUES ('4', '1', '广州天河东圃', '18062939123', '汪亮', '1', '2');
INSERT INTO `mlv_address` VALUES ('5', '4', '北京市', '15920114635', '张', '1', '1');
INSERT INTO `mlv_address` VALUES ('6', '9', '北京市1环区天安门广场1号', '15920114635', '叶智障', '2', '1');
INSERT INTO `mlv_address` VALUES ('7', '10', '1110110110', '110110110', '张小强', '1', '1');
INSERT INTO `mlv_address` VALUES ('8', '15', '东圃珠村文华新大街三巷一号', '18320487321', '张志强', '1', '1');
INSERT INTO `mlv_address` VALUES ('9', '9', '324324324', '32432432', '432324', '2', '2');
INSERT INTO `mlv_address` VALUES ('10', '3', '背景', '15920114635', '朱忠想帅了', '1', '1');
INSERT INTO `mlv_address` VALUES ('11', '1', '爱的撒旦', '123456', '未来', '1', '2');
INSERT INTO `mlv_address` VALUES ('12', '1', '34343', '45555', '6565r65465', '1', '1');
-- ----------------------------
-- Table structure for mlv_auth_group
-- ----------------------------
DROP TABLE IF EXISTS `mlv_auth_group`;
CREATE TABLE `mlv_auth_group` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`status` tinyint(1) NOT NULL DEFAULT '1',
`rules` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`title`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_auth_group
-- ----------------------------
INSERT INTO `mlv_auth_group` VALUES ('1', '1', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,20,21,15,16,17,19', '超级管理员', '2017-03-05 06:35:38');
INSERT INTO `mlv_auth_group` VALUES ('23', '1', '1,2,7,8,11,13', '客服人员', '2017-03-03 11:30:45');
INSERT INTO `mlv_auth_group` VALUES ('24', '1', '1,2,3,4,5,6,7,8,11', '大后台', '2017-03-01 06:15:14');
-- ----------------------------
-- Table structure for mlv_auth_group_access
-- ----------------------------
DROP TABLE IF EXISTS `mlv_auth_group_access`;
CREATE TABLE `mlv_auth_group_access` (
`uid` int(11) NOT NULL,
`group_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_auth_group_access
-- ----------------------------
INSERT INTO `mlv_auth_group_access` VALUES ('1', '1');
INSERT INTO `mlv_auth_group_access` VALUES ('41', '1');
INSERT INTO `mlv_auth_group_access` VALUES ('42', '23');
INSERT INTO `mlv_auth_group_access` VALUES ('49', '1');
INSERT INTO `mlv_auth_group_access` VALUES ('52', '23');
INSERT INTO `mlv_auth_group_access` VALUES ('53', '24');
INSERT INTO `mlv_auth_group_access` VALUES ('54', '1');
-- ----------------------------
-- Table structure for mlv_auth_rule
-- ----------------------------
DROP TABLE IF EXISTS `mlv_auth_rule`;
CREATE TABLE `mlv_auth_rule` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` char(80) NOT NULL DEFAULT '',
`title` char(20) NOT NULL DEFAULT '',
`status` tinyint(1) NOT NULL DEFAULT '1',
`condition` char(100) NOT NULL DEFAULT '',
`cid` tinyint(4) NOT NULL COMMENT '所属模块ID',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_auth_rule
-- ----------------------------
INSERT INTO `mlv_auth_rule` VALUES ('1', 'MeilvAdmin/Index/welcome', '后台欢迎页', '1', '', '1');
INSERT INTO `mlv_auth_rule` VALUES ('2', 'MeilvAdmin/Index/index', '后台首页', '1', '', '1');
INSERT INTO `mlv_auth_rule` VALUES ('3', 'MeilvAdmin/Manager/addManager', '添加管理员', '1', '', '2');
INSERT INTO `mlv_auth_rule` VALUES ('4', 'MeilvAdmin/Manager/saveManager', '修改管理员信息', '1', '', '2');
INSERT INTO `mlv_auth_rule` VALUES ('5', 'MeilvAdmin/Manager/status', '修改管理员状态', '1', '', '2');
INSERT INTO `mlv_auth_rule` VALUES ('6', 'MeilvAdmin/Manager/delete', '删除管理员', '1', '', '2');
INSERT INTO `mlv_auth_rule` VALUES ('7', 'MeilvAdmin/Manager/adminList', '查看管理员', '1', '', '2');
INSERT INTO `mlv_auth_rule` VALUES ('8', 'MeilvAdmin/Auth/adminRole', '查看角色管理', '1', '', '3');
INSERT INTO `mlv_auth_rule` VALUES ('9', 'MeilvAdmin/Auth/adminSave', '修改角色权限', '1', '', '3');
INSERT INTO `mlv_auth_rule` VALUES ('10', 'MeilvAdmin/Auth/adminAdd', '添加角色', '1', '', '3');
INSERT INTO `mlv_auth_rule` VALUES ('11', 'MeilvAdmin/Auth/adminPermission', '查看权限管理', '1', '', '3');
INSERT INTO `mlv_auth_rule` VALUES ('12', 'MeilvAdmin/Auth/deleteAdmin', '删除角色', '1', '', '3');
INSERT INTO `mlv_auth_rule` VALUES ('13', 'MeilvAdmin/User/index', '查看会员', '1', '', '4');
INSERT INTO `mlv_auth_rule` VALUES ('14', 'MeilvAdmin/User/start', '会员权限设置', '1', '', '4');
INSERT INTO `mlv_auth_rule` VALUES ('15', 'MeilvAdmin/Friend/listShow', '查看友情链接', '1', '', '5');
INSERT INTO `mlv_auth_rule` VALUES ('16', 'MeilvAdmin/Friend/listLose', '删除友情链接', '1', '', '5');
INSERT INTO `mlv_auth_rule` VALUES ('17', 'MeilvAdmin/Friend/listEdit', '编辑友情链接', '1', '', '5');
INSERT INTO `mlv_auth_rule` VALUES ('19', 'MeilvAdmin/Friend/listAdd', '添加友情链接', '1', '', '5');
INSERT INTO `mlv_auth_rule` VALUES ('20', 'MeilvAdmin/User/change_password', '密码修改', '1', '', '4');
INSERT INTO `mlv_auth_rule` VALUES ('21', 'MeilvAdmin/User/editor', '添加会员', '1', '', '4');
-- ----------------------------
-- Table structure for mlv_auth_rule_classify
-- ----------------------------
DROP TABLE IF EXISTS `mlv_auth_rule_classify`;
CREATE TABLE `mlv_auth_rule_classify` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '无符号的自增ID',
`name` char(80) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_auth_rule_classify
-- ----------------------------
INSERT INTO `mlv_auth_rule_classify` VALUES ('1', '首页');
INSERT INTO `mlv_auth_rule_classify` VALUES ('2', '管理员模块');
INSERT INTO `mlv_auth_rule_classify` VALUES ('3', '权限模块');
INSERT INTO `mlv_auth_rule_classify` VALUES ('4', '会员模块');
INSERT INTO `mlv_auth_rule_classify` VALUES ('5', '友情链接模板');
-- ----------------------------
-- Table structure for mlv_collect
-- ----------------------------
DROP TABLE IF EXISTS `mlv_collect`;
CREATE TABLE `mlv_collect` (
`sid` int(11) NOT NULL,
`uid` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_collect
-- ----------------------------
INSERT INTO `mlv_collect` VALUES ('10', '8');
INSERT INTO `mlv_collect` VALUES ('6', '8');
INSERT INTO `mlv_collect` VALUES ('10', '8');
INSERT INTO `mlv_collect` VALUES ('7', '8');
INSERT INTO `mlv_collect` VALUES ('5', '8');
INSERT INTO `mlv_collect` VALUES ('10', '6');
INSERT INTO `mlv_collect` VALUES ('5', '6');
INSERT INTO `mlv_collect` VALUES ('11', '6');
INSERT INTO `mlv_collect` VALUES ('6', '6');
INSERT INTO `mlv_collect` VALUES ('7', '6');
-- ----------------------------
-- Table structure for mlv_comment
-- ----------------------------
DROP TABLE IF EXISTS `mlv_comment`;
CREATE TABLE `mlv_comment` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`level` decimal(2,1) unsigned DEFAULT '5.0' COMMENT '评分',
`content` varchar(255) DEFAULT '这家伙很懒什么都没写,不过我们推测应该吃的挺嗨。',
`oid` int(11) NOT NULL,
`time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_comment
-- ----------------------------
INSERT INTO `mlv_comment` VALUES ('3', '4.5', '好鬼好食啊!!', '25', '2017-03-04 15:37:33');
INSERT INTO `mlv_comment` VALUES ('4', '5.0', '一般般', '27', '2017-03-04 16:35:39');
INSERT INTO `mlv_comment` VALUES ('5', '4.5', '挺好的,多汁', '37', '2017-03-04 16:52:22');
INSERT INTO `mlv_comment` VALUES ('6', '5.0', '上下左右baba', '40', '2017-03-04 16:52:41');
INSERT INTO `mlv_comment` VALUES ('7', '1.0', '难吃', '36', '2017-03-04 16:53:07');
INSERT INTO `mlv_comment` VALUES ('8', '2.5', '煞笔东西', '33', '2017-03-04 16:53:24');
INSERT INTO `mlv_comment` VALUES ('9', '4.5', '好好吃啊,下次带我女朋友来吃\r\n', '48', '2017-03-04 17:18:54');
INSERT INTO `mlv_comment` VALUES ('10', '0.5', '这家伙很懒什么都没写,不过我们推测应该吃的挺嗨。', '54', '2017-03-04 17:55:22');
INSERT INTO `mlv_comment` VALUES ('11', '5.0', '屌!', '52', '2017-03-04 18:37:06');
INSERT INTO `mlv_comment` VALUES ('12', '4.0', '这家伙很懒什么都没写,不过我们推测应该吃的挺嗨。', '58', '2017-03-04 20:06:16');
INSERT INTO `mlv_comment` VALUES ('13', '0.5', '这家伙很懒什么都没写,不过我们推测应该吃的挺嗨。', '57', '2017-03-04 20:13:20');
INSERT INTO `mlv_comment` VALUES ('14', '5.0', '五星好评', '59', '2017-03-04 21:35:58');
INSERT INTO `mlv_comment` VALUES ('17', '5.0', '很好', '61', '2017-03-05 04:36:31');
INSERT INTO `mlv_comment` VALUES ('18', '5.0', '好评', '65', '2017-03-05 10:16:59');
INSERT INTO `mlv_comment` VALUES ('19', '1.0', '垃圾', '64', '2017-03-05 10:37:23');
INSERT INTO `mlv_comment` VALUES ('20', '1.0', '垃圾', '67', '2017-03-05 10:38:47');
-- ----------------------------
-- Table structure for mlv_goods
-- ----------------------------
DROP TABLE IF EXISTS `mlv_goods`;
CREATE TABLE `mlv_goods` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '无符号自增ID',
`name` varchar(255) NOT NULL,
`tid` int(4) NOT NULL,
`pic` varchar(255) NOT NULL,
`des` varchar(255) DEFAULT NULL,
`price` decimal(10,2) NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1:正常 2:下架',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_goods
-- ----------------------------
INSERT INTO `mlv_goods` VALUES ('6', '红豆双皮奶茶', '8', 'Uploads/2016-08-17/57b3591d798b1.jpeg', '配红豆甜品!欢乐畅饮尽在果度!', '9.00', '1');
INSERT INTO `mlv_goods` VALUES ('7', '台湾烧仙草', '8', 'Uploads/2016-08-17/57b359aecad28.jpg', '配红豆甜品!欢乐畅饮尽在果度!', '10.00', '1');
INSERT INTO `mlv_goods` VALUES ('8', '咖喱饺', '9', 'Uploads/2016-08-17/57b35a2c60799.jpg', '咖喱风十足', '5.00', '1');
INSERT INTO `mlv_goods` VALUES ('9', '金丝鸡柳棒', '9', 'Uploads/2016-08-17/57b35a80ae1db.jpg', '啵啵脆啊!!', '5.00', '1');
INSERT INTO `mlv_goods` VALUES ('11', '华夫肉饼', '9', 'Uploads/2016-08-17/57b35ace1932d.jpg', '香辣脆口', '6.00', '1');
INSERT INTO `mlv_goods` VALUES ('12', '红豆派', '8', 'Uploads/2016-08-17/57b35b263993b.jpg', '情侣必备', '6.00', '1');
INSERT INTO `mlv_goods` VALUES ('14', '手抓饼+鸡蛋', '10', 'Uploads/2016-08-17/57b35bb40324a.jpg', ' 粮山功夫手抓饼,身出名门宝岛,健康有机饼,作为健康时尚休闲小吃深受大家的喜欢。很多港台明星都在吃手抓饼,核心原料台湾直供,原料层层把关精心挑选。 ', '7.00', '1');
INSERT INTO `mlv_goods` VALUES ('17', '香辣车仔面', '11', 'Uploads/2016-08-17/57b35ef1e0aea.jpg', '车在面', '10.00', '1');
INSERT INTO `mlv_goods` VALUES ('22', '老北京手工炸酱面', '13', 'Uploads/2017-03-04/58ba6df375f09.jpg', '老北京手工炸酱面', '18.00', '1');
INSERT INTO `mlv_goods` VALUES ('23', '猪肉大葱包', '13', 'Uploads/2017-03-04/58ba6e4c82248.jpg', '猪肉大葱包', '28.00', '1');
INSERT INTO `mlv_goods` VALUES ('24', '牛肉圆葱包', '13', 'Uploads/2017-03-04/58ba6e6d4b8b8.jpg', '牛肉圆葱包', '32.00', '1');
INSERT INTO `mlv_goods` VALUES ('25', '韭菜鸡蛋包', '13', 'Uploads/2017-03-04/58ba6eb452b88.jpg', '韭菜鸡蛋包', '26.00', '1');
INSERT INTO `mlv_goods` VALUES ('26', '小米南瓜粥', '14', 'Uploads/2017-03-04/58ba6ee01cd14.jpg', '小米南瓜粥', '6.00', '1');
INSERT INTO `mlv_goods` VALUES ('27', '米饭', '14', 'Uploads/2017-03-04/58ba6f04a6790.jpg', '米饭', '2.00', '1');
INSERT INTO `mlv_goods` VALUES ('28', '可乐(1.25L)', '15', 'Uploads/2017-03-04/58ba6f3da808f.jpg', '可乐(1.25L)', '12.00', '1');
INSERT INTO `mlv_goods` VALUES ('30', '百威', '15', 'Uploads/2017-03-04/58ba6fc06fa43.jpg', '百威啤酒', '12.00', '1');
INSERT INTO `mlv_goods` VALUES ('31', '杜蕾斯 避孕套超薄安全套情趣型男用女用颗粒g点带刺狼牙震动高潮', '17', 'Uploads/2016-08-17/57b3aa1ae0e8c.jpg', '人气爆款 纯杜蕾斯 授权店铺', '39.00', '1');
INSERT INTO `mlv_goods` VALUES ('32', '杜蕾斯震动av按摩棒女用自慰器抽插高潮成人性用品激情趣用具跳蛋', '17', 'Uploads/2016-08-17/57b3b298644cd.jpg', '杜蕾斯爆款 官方正品 保密发货', '-1.00', '1');
INSERT INTO `mlv_goods` VALUES ('33', '小炒拆骨肉', '19', 'Uploads/2017-03-04/58ba9f2a3f61e.jpg', '小炒拆骨肉', '32.00', '1');
INSERT INTO `mlv_goods` VALUES ('34', '手撕包菜', '19', 'Uploads/2017-03-04/58ba9f90b5cbb.jpg', '手撕包菜', '22.00', '1');
INSERT INTO `mlv_goods` VALUES ('35', '香辣海龙鱼', '19', 'Uploads/2017-03-04/58ba9fe8c3bdb.jpg', '香辣海龙鱼', '32.00', '1');
INSERT INTO `mlv_goods` VALUES ('36', '水果杂切', '20', 'Uploads/2017-04-20/58f7bae22dc57.jpg', ' 西瓜,番石榴,苹果,梨,火龙果,奇异果,菠萝,香蕉三种 ', '17.00', '1');
INSERT INTO `mlv_goods` VALUES ('37', '西瓜汁', '20', 'Uploads/2017-04-20/58f7bb60b5232.jpg', '香甜可口', '15.00', '1');
INSERT INTO `mlv_goods` VALUES ('38', '一粒柠檬', '21', 'Uploads/2017-04-20/58f7bc01579d1.jpeg', ' 我是一整个的黄柠檬加红茶和蜂蜜哦,味道很特别哦。 ', '16.00', '1');
INSERT INTO `mlv_goods` VALUES ('39', '芒果益力多', '21', 'Uploads/2017-04-20/58f7bcb00458e.jpg', '健康又美味', '15.00', '1');
INSERT INTO `mlv_goods` VALUES ('40', '鲜柠檬薄荷冰', '21', 'Uploads/2017-04-20/58f7bce4624f7.jpg', ' 哈哈,我偷吃了薄荷汁,感觉心里凉飕飕的。 ', '15.00', '1');
INSERT INTO `mlv_goods` VALUES ('41', '烤奶', '22', 'Uploads/2017-04-20/58f7bd3884185.jpg', ' 我是清香型,重口味可选港式奶茶哦 ', '10.00', '1');
INSERT INTO `mlv_goods` VALUES ('42', '港式奶茶', '22', 'Uploads/2017-04-20/58f7bd646695a.jpg', ' 喝不习惯吗,呵呵,喝多几次你就会爱上我哦 ', '15.00', '1');
INSERT INTO `mlv_goods` VALUES ('43', '抹茶新冰乐', '23', 'Uploads/2017-04-20/58f7be2acd82f.jpeg', '冷', '18.00', '1');
INSERT INTO `mlv_goods` VALUES ('44', '蔓越莓星冰乐', '23', 'Uploads/2017-04-20/58f7be686161c.jpeg', '冷', '17.00', '1');
INSERT INTO `mlv_goods` VALUES ('45', '吞拿鱼沙律军舰', '26', 'Uploads/2017-03-05/58baf319bc8bf.jpg', '吞拿鱼沙律军舰', '3.00', '1');
INSERT INTO `mlv_goods` VALUES ('46', '芝士金凤王', '24', 'Uploads/2017-04-20/58f7bf1b9fe5b.jpg', '可冷可暖', '19.00', '1');
INSERT INTO `mlv_goods` VALUES ('47', '芝士青龙茗茶', '24', 'Uploads/2017-04-20/58f7bfe269e3f.jpeg', '可冷可热', '16.00', '1');
INSERT INTO `mlv_goods` VALUES ('48', '鸡中翅', '25', 'Uploads/2017-04-20/58f7c02eae12b.jpg', ' 3个,需酱料请备注 ', '15.00', '1');
INSERT INTO `mlv_goods` VALUES ('49', '香芋甜心', '25', 'Uploads/2017-04-20/58f7c06be0b9d.jpg', '四个', '13.00', '1');
INSERT INTO `mlv_goods` VALUES ('50', '蟹籽军舰', '26', 'Uploads/2017-03-05/58baf4e7111a4.jpg', '蟹籽军舰', '3.00', '1');
INSERT INTO `mlv_goods` VALUES ('51', '脆皮香蕉', '25', 'Uploads/2017-04-20/58f7c1096dd8e.jpg', '四个', '13.00', '1');
INSERT INTO `mlv_goods` VALUES ('52', '芒果欧蕾', '21', 'Uploads/2017-04-20/58f7c1be07a19.jpeg', '芒果', '15.00', '1');
INSERT INTO `mlv_goods` VALUES ('53', '赤贝寿司', '26', 'Uploads/2017-03-05/58baf5e7067ec.jpg', '赤贝寿司', '3.00', '1');
INSERT INTO `mlv_goods` VALUES ('54', '小汉堡', '30', 'Uploads/2016-12-04/5842fd92ba174.jpg', '好味', '8.00', '1');
INSERT INTO `mlv_goods` VALUES ('55', '汉堡王', '30', 'Uploads/2016-12-04/5842fda99fe3d.jpg', '好好吃', '8.00', '1');
INSERT INTO `mlv_goods` VALUES ('56', '汉堡', '31', 'Uploads/2017-03-05/58bb72c92ac2e.png', '撒大声地', '123.00', '1');
-- ----------------------------
-- Table structure for mlv_goods_type
-- ----------------------------
DROP TABLE IF EXISTS `mlv_goods_type`;
CREATE TABLE `mlv_goods_type` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '外卖分类表id',
`sid` int(11) NOT NULL COMMENT '商铺的id',
`name` varchar(255) NOT NULL COMMENT '外卖分类名',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_goods_type
-- ----------------------------
INSERT INTO `mlv_goods_type` VALUES ('13', '7', '美味包子类');
INSERT INTO `mlv_goods_type` VALUES ('14', '7', '米饭和粥');
INSERT INTO `mlv_goods_type` VALUES ('15', '7', '饮料');
INSERT INTO `mlv_goods_type` VALUES ('20', '10', '鲜果饮品');
INSERT INTO `mlv_goods_type` VALUES ('17', '8', '超薄安全套');
INSERT INTO `mlv_goods_type` VALUES ('8', '6', '烧仙草双皮奶玉米汁');
INSERT INTO `mlv_goods_type` VALUES ('9', '6', '鸡蛋仔章鱼丸翅包饭');
INSERT INTO `mlv_goods_type` VALUES ('10', '6', '手抓饼自由搭配');
INSERT INTO `mlv_goods_type` VALUES ('11', '6', '酸辣粉面饺子');
INSERT INTO `mlv_goods_type` VALUES ('12', '6', '鸡排汉堡');
INSERT INTO `mlv_goods_type` VALUES ('19', '7', '精品炒菜');
INSERT INTO `mlv_goods_type` VALUES ('21', '10', '特调');
INSERT INTO `mlv_goods_type` VALUES ('22', '10', '经典奶茶');
INSERT INTO `mlv_goods_type` VALUES ('23', '10', '星冰乐');
INSERT INTO `mlv_goods_type` VALUES ('24', '10', '皇芝士现泡茶');
INSERT INTO `mlv_goods_type` VALUES ('25', '10', '小吃');
INSERT INTO `mlv_goods_type` VALUES ('26', '11', '寿司3元尽享');
INSERT INTO `mlv_goods_type` VALUES ('27', '11', '招牌寿司6元尽享');
INSERT INTO `mlv_goods_type` VALUES ('28', '11', '优惠午晚餐');
INSERT INTO `mlv_goods_type` VALUES ('29', '11', '精品小食');
INSERT INTO `mlv_goods_type` VALUES ('30', '5', '汉堡');
INSERT INTO `mlv_goods_type` VALUES ('31', '14', '汉堡');
-- ----------------------------
-- Table structure for mlv_link
-- ----------------------------
DROP TABLE IF EXISTS `mlv_link`;
CREATE TABLE `mlv_link` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_link
-- ----------------------------
INSERT INTO `mlv_link` VALUES ('6', '三打哈网', 'http://www.sandaha.com');
INSERT INTO `mlv_link` VALUES ('8', '锤子网站', 'http://www.smartisan.com/');
INSERT INTO `mlv_link` VALUES ('9', '阿里云网', 'http://www.aliyun.com');
INSERT INTO `mlv_link` VALUES ('10', '三大哈', 'http://www.baidu.com');
-- ----------------------------
-- Table structure for mlv_manager
-- ----------------------------
DROP TABLE IF EXISTS `mlv_manager`;
CREATE TABLE `mlv_manager` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`mname` varchar(50) NOT NULL,
`pass` varchar(255) NOT NULL,
`time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`status` tinyint(4) DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`mname`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_manager
-- ----------------------------
INSERT INTO `mlv_manager` VALUES ('1', 'admin', '$2y$10$3VY.0fxX3hX3LxcxA3ZHLePZhVRTOlENRHCynniP44E.vgXTQgKEK', '2017-03-03 10:05:15', '1');
INSERT INTO `mlv_manager` VALUES ('41', 'zhangzhiqiang', '$2y$10$KLcme2pSg6M5YQpWU9t7ke9E93cKAci82C/U6B42oCtoYMktY9Zie', '2017-03-04 11:21:38', '2');
INSERT INTO `mlv_manager` VALUES ('42', 'zhang123', '$2y$10$htK2dNM0qnTZslA03xfVU.TtPvH3VPSzQGZvgaOegCgexbUtQGa3e', '2017-03-03 11:42:29', '1');
INSERT INTO `mlv_manager` VALUES ('49', 'zzq520', '$2y$10$zASdewxhFr4N621E5PKtUO0Cp.6K2hEYvm1ZqeAOW5T.1npt0MjrC', '2017-03-05 11:52:13', '2');
INSERT INTO `mlv_manager` VALUES ('52', 'zzxzzx', '$2y$10$3reUt5L6r0g.Ez.p9JR8quV5LLfxY9PdW72NK2X8RX66mGbnT6r3i', '2017-03-05 09:08:08', '2');
INSERT INTO `mlv_manager` VALUES ('53', '123as', '$2y$10$3IjHTjtSmAeZTqG7fg9JgOvsZGgsost2cwDH2GtTH./PHvsoW9Fqa', '2017-03-05 09:10:19', '2');
INSERT INTO `mlv_manager` VALUES ('54', 'qqqqq', '$2y$10$IkZwMS3VkCJwZtfsVFGcmeIo1iSMTEDNCLOFK8rbgCpFbS1wY9FXu', '2017-03-05 10:01:53', '1');
-- ----------------------------
-- Table structure for mlv_order_detail
-- ----------------------------
DROP TABLE IF EXISTS `mlv_order_detail`;
CREATE TABLE `mlv_order_detail` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '无符号的自增ID',
`oid` tinyint(4) NOT NULL,
`gid` tinyint(4) NOT NULL,
`num` tinyint(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=103 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_order_detail
-- ----------------------------
INSERT INTO `mlv_order_detail` VALUES ('31', '25', '6', '1');
INSERT INTO `mlv_order_detail` VALUES ('32', '25', '12', '1');
INSERT INTO `mlv_order_detail` VALUES ('33', '26', '22', '5');
INSERT INTO `mlv_order_detail` VALUES ('34', '27', '27', '1');
INSERT INTO `mlv_order_detail` VALUES ('35', '27', '26', '1');
INSERT INTO `mlv_order_detail` VALUES ('36', '27', '28', '8');
INSERT INTO `mlv_order_detail` VALUES ('37', '27', '30', '5');
INSERT INTO `mlv_order_detail` VALUES ('38', '27', '25', '1');
INSERT INTO `mlv_order_detail` VALUES ('39', '27', '22', '1');
INSERT INTO `mlv_order_detail` VALUES ('40', '27', '23', '1');
INSERT INTO `mlv_order_detail` VALUES ('41', '27', '24', '1');
INSERT INTO `mlv_order_detail` VALUES ('42', '28', '22', '2');
INSERT INTO `mlv_order_detail` VALUES ('43', '29', '23', '2');
INSERT INTO `mlv_order_detail` VALUES ('44', '30', '23', '1');
INSERT INTO `mlv_order_detail` VALUES ('45', '30', '22', '1');
INSERT INTO `mlv_order_detail` VALUES ('46', '31', '7', '1');
INSERT INTO `mlv_order_detail` VALUES ('47', '31', '8', '1');
INSERT INTO `mlv_order_detail` VALUES ('48', '32', '6', '3');
INSERT INTO `mlv_order_detail` VALUES ('49', '33', '14', '1');
INSERT INTO `mlv_order_detail` VALUES ('50', '33', '17', '1');
INSERT INTO `mlv_order_detail` VALUES ('51', '34', '23', '3');
INSERT INTO `mlv_order_detail` VALUES ('52', '35', '26', '4');
INSERT INTO `mlv_order_detail` VALUES ('53', '35', '27', '2');
INSERT INTO `mlv_order_detail` VALUES ('54', '35', '30', '1');
INSERT INTO `mlv_order_detail` VALUES ('55', '36', '17', '1');
INSERT INTO `mlv_order_detail` VALUES ('56', '36', '11', '1');
INSERT INTO `mlv_order_detail` VALUES ('57', '37', '7', '1');
INSERT INTO `mlv_order_detail` VALUES ('58', '38', '23', '2');
INSERT INTO `mlv_order_detail` VALUES ('59', '39', '23', '1');
INSERT INTO `mlv_order_detail` VALUES ('60', '39', '24', '1');
INSERT INTO `mlv_order_detail` VALUES ('61', '40', '9', '1');
INSERT INTO `mlv_order_detail` VALUES ('62', '40', '8', '1');
INSERT INTO `mlv_order_detail` VALUES ('63', '41', '30', '3');
INSERT INTO `mlv_order_detail` VALUES ('64', '42', '23', '4');
INSERT INTO `mlv_order_detail` VALUES ('65', '43', '25', '3');
INSERT INTO `mlv_order_detail` VALUES ('66', '44', '24', '2');
INSERT INTO `mlv_order_detail` VALUES ('67', '45', '23', '5');
INSERT INTO `mlv_order_detail` VALUES ('68', '46', '22', '4');
INSERT INTO `mlv_order_detail` VALUES ('69', '47', '23', '3');
INSERT INTO `mlv_order_detail` VALUES ('70', '48', '6', '2');
INSERT INTO `mlv_order_detail` VALUES ('71', '49', '28', '4');
INSERT INTO `mlv_order_detail` VALUES ('72', '50', '25', '3');
INSERT INTO `mlv_order_detail` VALUES ('73', '51', '23', '2');
INSERT INTO `mlv_order_detail` VALUES ('74', '52', '23', '3');
INSERT INTO `mlv_order_detail` VALUES ('75', '53', '6', '1');
INSERT INTO `mlv_order_detail` VALUES ('76', '53', '7', '1');
INSERT INTO `mlv_order_detail` VALUES ('77', '54', '6', '1');
INSERT INTO `mlv_order_detail` VALUES ('78', '54', '12', '1');
INSERT INTO `mlv_order_detail` VALUES ('79', '55', '31', '1');
INSERT INTO `mlv_order_detail` VALUES ('80', '56', '32', '1');
INSERT INTO `mlv_order_detail` VALUES ('81', '56', '31', '1');
INSERT INTO `mlv_order_detail` VALUES ('82', '57', '6', '3');
INSERT INTO `mlv_order_detail` VALUES ('83', '58', '6', '3');
INSERT INTO `mlv_order_detail` VALUES ('84', '59', '24', '1');
INSERT INTO `mlv_order_detail` VALUES ('85', '59', '35', '1');
INSERT INTO `mlv_order_detail` VALUES ('86', '60', '23', '2');
INSERT INTO `mlv_order_detail` VALUES ('87', '61', '55', '1');
INSERT INTO `mlv_order_detail` VALUES ('88', '62', '31', '1');
INSERT INTO `mlv_order_detail` VALUES ('89', '63', '36', '2');
INSERT INTO `mlv_order_detail` VALUES ('90', '63', '37', '1');
INSERT INTO `mlv_order_detail` VALUES ('91', '63', '39', '1');
INSERT INTO `mlv_order_detail` VALUES ('92', '63', '52', '1');
INSERT INTO `mlv_order_detail` VALUES ('93', '63', '42', '1');
INSERT INTO `mlv_order_detail` VALUES ('94', '63', '41', '1');
INSERT INTO `mlv_order_detail` VALUES ('95', '63', '43', '1');
INSERT INTO `mlv_order_detail` VALUES ('96', '64', '37', '1');
INSERT INTO `mlv_order_detail` VALUES ('97', '64', '43', '1');
INSERT INTO `mlv_order_detail` VALUES ('98', '64', '51', '1');
INSERT INTO `mlv_order_detail` VALUES ('99', '64', '40', '1');
INSERT INTO `mlv_order_detail` VALUES ('100', '65', '22', '2');
INSERT INTO `mlv_order_detail` VALUES ('101', '66', '8', '2');
INSERT INTO `mlv_order_detail` VALUES ('102', '67', '7', '1');
-- ----------------------------
-- Table structure for mlv_orders
-- ----------------------------
DROP TABLE IF EXISTS `mlv_orders`;
CREATE TABLE `mlv_orders` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '无符号的自增ID',
`uid` int(11) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`price` decimal(10,2) NOT NULL,
`aid` int(11) NOT NULL,
`sid` int(10) unsigned NOT NULL COMMENT '餐厅ID',
`status` tinyint(4) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_orders
-- ----------------------------
INSERT INTO `mlv_orders` VALUES ('25', '6', '2017-03-04 15:37:33', '22.00', '3', '6', '3');
INSERT INTO `mlv_orders` VALUES ('26', '1', '2017-03-04 15:50:53', '110.00', '4', '7', '0');
INSERT INTO `mlv_orders` VALUES ('27', '9', '2017-03-04 16:35:39', '302.00', '6', '7', '3');
INSERT INTO `mlv_orders` VALUES ('28', '1', '2017-03-04 16:30:38', '53.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('29', '1', '2017-03-04 16:31:23', '73.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('30', '9', '2017-03-04 16:35:04', '63.00', '6', '7', '2');
INSERT INTO `mlv_orders` VALUES ('31', '6', '2017-03-04 16:37:16', '22.00', '3', '6', '2');
INSERT INTO `mlv_orders` VALUES ('32', '1', '2017-03-04 16:37:44', '35.00', '4', '6', '2');
INSERT INTO `mlv_orders` VALUES ('33', '6', '2017-03-04 16:53:24', '24.00', '3', '6', '3');
INSERT INTO `mlv_orders` VALUES ('34', '1', '2017-03-04 16:41:52', '102.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('35', '1', '2017-03-04 16:44:34', '62.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('36', '6', '2017-03-04 16:53:07', '23.00', '3', '6', '3');
INSERT INTO `mlv_orders` VALUES ('37', '6', '2017-03-04 16:52:22', '16.00', '3', '6', '3');
INSERT INTO `mlv_orders` VALUES ('38', '1', '2017-03-04 16:49:04', '73.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('39', '9', '2017-03-04 16:50:25', '77.00', '6', '7', '2');
INSERT INTO `mlv_orders` VALUES ('40', '6', '2017-03-04 16:52:41', '17.00', '3', '6', '3');
INSERT INTO `mlv_orders` VALUES ('41', '1', '2017-03-04 16:53:48', '54.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('42', '1', '2017-03-04 16:55:18', '131.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('43', '1', '2017-03-04 16:56:12', '96.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('44', '1', '2017-03-04 16:58:21', '81.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('45', '1', '2017-03-04 17:01:09', '160.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('46', '1', '2017-03-04 17:03:02', '91.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('47', '1', '2017-03-04 17:04:09', '102.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('48', '6', '2017-03-04 17:18:54', '25.00', '3', '6', '3');
INSERT INTO `mlv_orders` VALUES ('49', '1', '2017-03-04 17:08:04', '67.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('50', '1', '2017-03-04 17:08:52', '96.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('51', '1', '2017-03-04 17:15:38', '73.00', '4', '7', '2');
INSERT INTO `mlv_orders` VALUES ('52', '1', '2017-03-04 18:37:06', '102.00', '4', '7', '3');
INSERT INTO `mlv_orders` VALUES ('53', '6', '2017-03-04 17:18:31', '26.00', '3', '6', '2');
INSERT INTO `mlv_orders` VALUES ('54', '10', '2017-03-04 17:55:22', '22.00', '7', '6', '3');
INSERT INTO `mlv_orders` VALUES ('55', '10', '2017-03-04 17:58:20', '37.90', '7', '8', '0');
INSERT INTO `mlv_orders` VALUES ('56', '6', '2017-03-04 18:29:53', '41.00', '3', '8', '0');
INSERT INTO `mlv_orders` VALUES ('57', '6', '2017-03-04 20:13:20', '35.00', '3', '6', '3');
INSERT INTO `mlv_orders` VALUES ('58', '6', '2017-03-04 20:06:16', '35.00', '3', '6', '3');
INSERT INTO `mlv_orders` VALUES ('59', '15', '2017-03-04 21:35:58', '81.00', '8', '7', '3');
INSERT INTO `mlv_orders` VALUES ('60', '15', '2017-03-04 21:37:20', '73.00', '8', '7', '3');
INSERT INTO `mlv_orders` VALUES ('61', '3', '2017-03-05 04:36:31', '9.00', '10', '5', '3');
INSERT INTO `mlv_orders` VALUES ('62', '3', '2017-03-05 04:38:56', '41.00', '10', '8', '0');
INSERT INTO `mlv_orders` VALUES ('63', '3', '2017-03-05 04:53:05', '135.00', '10', '10', '1');
INSERT INTO `mlv_orders` VALUES ('64', '6', '2017-03-05 10:37:23', '70.00', '3', '10', '3');
INSERT INTO `mlv_orders` VALUES ('65', '1', '2017-03-05 10:16:59', '53.00', '4', '7', '3');
INSERT INTO `mlv_orders` VALUES ('66', '1', '2017-03-05 10:16:39', '17.00', '12', '6', '2');
INSERT INTO `mlv_orders` VALUES ('67', '6', '2017-03-05 10:38:47', '16.00', '3', '6', '3');
-- ----------------------------
-- Table structure for mlv_store
-- ----------------------------
DROP TABLE IF EXISTS `mlv_store`;
CREATE TABLE `mlv_store` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL COMMENT '用户id',
`name` varchar(255) NOT NULL,
`tid` int(10) unsigned NOT NULL COMMENT '对应的mlv_goods_type的ID',
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1是开店,0是休息,2是申请中,3是审核失败,4是封店',
`pic` varchar(255) CHARACTER SET latin1 NOT NULL,
`time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '店铺申请成功的时间',
`start` int(11) NOT NULL DEFAULT '0' COMMENT '营业开始时间',
`stop` int(11) NOT NULL DEFAULT '24' COMMENT '关门时间',
`clickNum` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '餐厅的点击量',
`address` varchar(255) NOT NULL COMMENT '餐厅的地址',
`phone` varchar(50) NOT NULL COMMENT '餐厅的电话',
`upsend` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '起送费',
`peisend` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配送费',
`atime` tinyint(4) NOT NULL DEFAULT '0' COMMENT '配送时间',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_store
-- ----------------------------
INSERT INTO `mlv_store` VALUES ('5', '3', '德州汉堡', '2', '1', 'Uploads/2016-12-03/584238ba97aab.jpg', '2017-03-06 22:40:47', '0', '24', '53', '北京市人民医院', '15920114635', '0', '0', '0');
INSERT INTO `mlv_store` VALUES ('7', '1', '京味包子铺', '1', '1', 'Uploads/2017-03-04/58ba6c69a6f38.jpg', '2017-03-05 10:44:30', '8', '20', '220', '广州市天河区科新路商业街35-36号首层', '13888888888', '35', '15', '30');
INSERT INTO `mlv_store` VALUES ('6', '6', '果度奶茶+粮山手抓饼', '6', '1', 'Uploads/2016-08-17/57b357ae5770a.jpeg', '2017-03-06 10:38:25', '8', '22', '455', '东圃珠村文华新大街三巷一号', '18320487321', '10', '5', '30');
INSERT INTO `mlv_store` VALUES ('8', '10', '杜蕾斯专卖店', '3', '1', './Uploads/2016-08-17/57b3a9c860ddb.jpg', '2017-03-05 10:42:06', '0', '24', '33', '兄弟连教育', '110', '1', '1', '0');
INSERT INTO `mlv_store` VALUES ('9', '12', '时光鸡', '1', '4', 'Uploads/2016-12-03/5842a219daa76.jpg', '2017-03-04 18:44:02', '0', '24', '0', '广州市天河区京溪路', '15920114635', '0', '0', '0');
INSERT INTO `mlv_store` VALUES ('10', '15', 'royaltea皇茶', '4', '1', 'Uploads/2017-04-20/58f7b90078cb8.jpg', '2017-03-05 10:40:16', '0', '24', '60', '广州市天河区中山大道中282号B20房', '18825894336/18899756535/18899736423', '15', '5', '30');
INSERT INTO `mlv_store` VALUES ('11', '17', '吉兆手握寿司', '1', '1', 'Uploads/2017-03-05/58baf1bcad98e.jpg', '2017-03-06 10:38:15', '0', '24', '3', '广州市天河区奥体南路12号高德汇购物中心一楼F107铺', '13858585858', '0', '0', '0');
INSERT INTO `mlv_store` VALUES ('14', '26', '麦当劳', '1', '1', 'Uploads/2017-03-05/58bb7289ec42b.jpg', '2017-03-05 10:42:01', '0', '24', '4', '东圃', '13005111111', '0', '0', '0');
-- ----------------------------
-- Table structure for mlv_store_type
-- ----------------------------
DROP TABLE IF EXISTS `mlv_store_type`;
CREATE TABLE `mlv_store_type` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '商铺分类ID',
`name` varchar(50) NOT NULL COMMENT '分类名',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_store_type
-- ----------------------------
INSERT INTO `mlv_store_type` VALUES ('1', '美食');
INSERT INTO `mlv_store_type` VALUES ('2', '正餐优选');
INSERT INTO `mlv_store_type` VALUES ('3', '超市');
INSERT INTO `mlv_store_type` VALUES ('4', '精选小吃');
INSERT INTO `mlv_store_type` VALUES ('5', '鲜果购');
INSERT INTO `mlv_store_type` VALUES ('6', '下午茶');
INSERT INTO `mlv_store_type` VALUES ('7', 'zaoca');
-- ----------------------------
-- Table structure for mlv_user
-- ----------------------------
DROP TABLE IF EXISTS `mlv_user`;
CREATE TABLE `mlv_user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`phone` char(11) DEFAULT NULL,
`pass` varchar(255) NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1:正常 2:禁用',
`email` varchar(100) DEFAULT NULL,
`businessman` tinyint(4) NOT NULL DEFAULT '2' COMMENT '1:商户 2:普通用户',
`time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`sex` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1:男 2:女',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`) COMMENT '用户名的唯一索引'
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_user
-- ----------------------------
INSERT INTO `mlv_user` VALUES ('1', 'wl123123', null, '$2y$10$APCsM.pyoxRMNi.gjFQ2MOv8kihp/tu1S/Fftf2nRGEiPjqYtcb82', '1', '617014283@qq.com', '1', '2017-03-04 15:29:54', '1');
INSERT INTO `mlv_user` VALUES ('2', 'yel8888', null, '$2y$10$DIjHe3nNDuOcqCObXJg2ie3HqQG04pP.HpHa.Mt0jUpEqMt4.AN0q', '1', '822828995@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('3', 'yzl123', null, '$2y$10$kvPZTpGh4FKSF42YHCVMb.6yt9zA608VRB5MI37A/cDhS8KmfBaYq', '1', '822828995@qq.com', '1', '2017-03-05 01:56:01', '1');
INSERT INTO `mlv_user` VALUES ('4', 'zzq123', null, '$2y$10$cpvOOUqcmKZi/I2wHQBBVOaZxo75eN8x.6XPfY2f74jhm8gkB8aeu', '1', '1061495484@qq.com', '2', '2017-03-04 14:48:52', '1');
INSERT INTO `mlv_user` VALUES ('5', 'qqqq', null, '$2y$10$e8AZYqf7F8.C30FkAfFmS..Yf2VZbHp5QTi/0lEomnWMeycUeJxxy', '1', '1061495484@qq.com', '2', '2017-03-05 01:54:18', '1');
INSERT INTO `mlv_user` VALUES ('6', 'yzlyzl', '13888888888', '$2y$10$HfVsOmwoCMo6zqZqHOPCbOjZaUu32DP31tEU8DXJgC3G6ylklqt.m', '1', '822828995@qq.com', '1', '2017-03-05 09:47:17', '1');
INSERT INTO `mlv_user` VALUES ('7', 'yzl321', null, '$2y$10$/PxUaMRewoMMHpC4UZrBIu25NYT58qeGEvic6Kmt0nYbIEumZIQpy', '1', '822828995@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('8', 'qqqqq', '13888888888', '$2y$10$qP2DbrkXLI8ZbAD.2QroIufqgNJxzAvqSh3P8VWmMO4IW7ss4qZwu', '1', '1061495484@qq.com', '2', '2017-03-05 09:45:06', '1');
INSERT INTO `mlv_user` VALUES ('9', 'qiang123', null, '$2y$10$mpoWA0VFn/dC2TWbNRZfkOC4qTVArIxXXRoJIa9UZnutSDPlmTKY.', '1', '1061495484@qq.com', '2', '2017-03-04 15:12:08', '1');
INSERT INTO `mlv_user` VALUES ('10', 'zhang', null, '$2y$10$lj0jh0TR7mMME3Buw4/63.0Zs9n5ittkMgR0WN5AC.TgGB1KklO8K', '1', '285749023@qq.com', '1', '2017-03-04 17:59:01', '1');
INSERT INTO `mlv_user` VALUES ('11', 'zhang123', null, '$2y$10$pAt28IW233q88m34ePSobeefzPf.q.8ng8CNWjnDTwNh/5.IKpuuO', '1', '285749023@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('12', 'zzq213', null, '$2y$10$Rm.a8.Ug1g8rULUQmRid4ecPzzDKU/awwcqUQxRt9bhVgHMen9kqG', '1', '822828995@qq.com', '1', '2017-03-04 18:43:36', '1');
INSERT INTO `mlv_user` VALUES ('13', 'qiang', null, '$2y$10$5950ioi7LcGvr97DZsJwtO8tJw.puiyLmMwNIRhuMqHxN815Af0sm', '1', '1061495484@qq.com', '2', '2017-03-04 19:43:50', '1');
INSERT INTO `mlv_user` VALUES ('14', 'qqqqqq', null, '$2y$10$kEmEc/QBhzmRMI3xYeBc6u4bRYQFYwlhLGVIHGlGrXYYkSpgDpaL2', '1', '1061495484@qq.com', '2', '2017-03-04 20:07:31', '1');
INSERT INTO `mlv_user` VALUES ('15', 'zhangzhiqiangsb', null, '$2y$10$Je7nyur.v0NccWSR4JnSSuUJcO31PPd7h4aI14xRojDY.gEv2Swxu', '1', '822828995@qq.com', '1', '2017-03-05 00:37:48', '1');
INSERT INTO `mlv_user` VALUES ('16', 'wqe123', null, '$2y$10$xGZfUW.scN2AaaxkU.Upte3kfm3VrreVVZWmjJktnxbL6Mmk4xsP.', '1', '1061495484@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('17', 'wl617014283', null, '$2y$10$bFYHXeusfQUMKonv1pQ6VOnG4luasa8pbqk6wkbXGkx.VXcJ9Fx2K', '1', '617014283@qq.com', '1', '2017-03-05 00:56:57', '1');
INSERT INTO `mlv_user` VALUES ('18', 'zhang123123', null, '$2y$10$ErypM6cf1rS7EejzG1c6beRkcjFm1hXhRlo31a7xYUFV8Vc0rF93m', '2', '1061495484@qq.com', '2', '2017-03-05 06:27:28', '1');
INSERT INTO `mlv_user` VALUES ('19', 'qqqqqqqq', '15920114635', '$2y$10$SqQIdxi7tK./wGQB7BasqOmQMCWR5ePGcUZq/wbfJiVSoiTOIOzCK', '1', '1061495484@qq.com', '1', '2017-03-05 06:55:21', '2');
INSERT INTO `mlv_user` VALUES ('20', 'aaaaaa', null, '$2y$10$84cBZHSMGOl8aUgXxcHFLOiNgol/gvKB2TbCVgJwHS70At90RJe5G', '1', '1061495484@qq.com', '2', '2017-03-05 09:13:15', '1');
INSERT INTO `mlv_user` VALUES ('21', '213213', null, '$2y$10$mSLTA8w3cfRGEnfx7blyvut1O4Su.GmIY4QqZxM0nG5WkT3Pqm376', '1', '1061495484@qq.com', '2', '2017-03-05 09:06:31', '1');
INSERT INTO `mlv_user` VALUES ('22', 'aaabbb', null, '$2y$10$XlPoe.Rjaq7XzxJa4d1NkORwlkJciO2qnrj9YaRM4AhpgrOZzDIny', '1', '617014283@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('23', '111111', null, '$2y$10$H6k1vLS/qJJVQJH2d3z.COxo283n5bvtqbaq7my6D5Vg70k/COmwK', '1', '1061495484@qq.com', '2', '2017-03-05 09:52:01', '1');
INSERT INTO `mlv_user` VALUES ('24', '12301230', null, '$2y$10$/s65UZ0TG3jEl/eZUwMFoO/ZhA.IKvEEtycDtClT5FIM0021fpbF6', '2', '1061495484@qq.com', '2', '2017-03-05 09:53:42', '1');
INSERT INTO `mlv_user` VALUES ('25', 'asdzxc', null, '$2y$10$G8/nJns5/Yc6KL3Iy8EJOu5Q0EC7wIflk2c9KHyGEM0MFVrX2Txp.', '1', '1061495484@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('26', 'asdzxcz', null, '$2y$10$UsxHQYh6FIVrlfioyHTBMuMknsQgpPXW8QOdWcM9PfJbQxEtjwEs2', '1', '1061495484@qq.com', '1', '2017-03-05 10:06:22', '1');
INSERT INTO `mlv_user` VALUES ('27', 'wwwwww', null, '$2y$10$kab1hBWJUxbV0LdQ9md93OgVSDXME0jW1T7oPce5GnV17DaRUY60q', '1', '1061495484@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('28', 'zzq12301230', null, '$2y$10$Q6eiM9iGTa.CWWaetMxjdOFKuoTGipjHlhSjhj7d.xWLOqp4SdFyS', '1', '1061495484@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('29', 'fsdajl', null, '$2y$10$QxIA9nTwTBNZC.NUiuaue.W.TJ.nyo4DOk5o6Wmz/DWmdAlgnz.5S', '1', 'gzfjfj@qq.com', '2', '0000-00-00 00:00:00', '1');
INSERT INTO `mlv_user` VALUES ('30', 'qiang123123', null, '$2y$10$EGrai0a6aLtiyjsCMx8siOmn6jzIi.8RctGUFVE7DdcyBvX5dHitS', '1', '1061495484@qq.com', '2', '2017-03-05 10:28:27', '1');
-- ----------------------------
-- Table structure for mlv_user_s
-- ----------------------------
DROP TABLE IF EXISTS `mlv_user_s`;
CREATE TABLE `mlv_user_s` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`zid` int(11) NOT NULL,
`token` varchar(50) NOT NULL COMMENT '帐号激活码',
`token_exptime` int(10) NOT NULL COMMENT '激活码有效期',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态,0-未激活,1-已激活',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mlv_user_s
-- ----------------------------
INSERT INTO `mlv_user_s` VALUES ('1', '1', '2c09baf38ae22f61e34ffac547cdd53f', '1488592501', '1');
INSERT INTO `mlv_user_s` VALUES ('2', '2', '789f4f33b165d634efb8e02bf3869a29', '1471363376', '0');
INSERT INTO `mlv_user_s` VALUES ('3', '3', 'de6d2a7b8a525cc57c6b7b2b084e103d', '1480747925', '1');
INSERT INTO `mlv_user_s` VALUES ('4', '4', 'c9a7c11406bfbf44802f1b8256af932d', '1480729270', '1');
INSERT INTO `mlv_user_s` VALUES ('5', '5', '2cbc243d1cd71b42d80a747c2104ce29', '1480731140', '1');
INSERT INTO `mlv_user_s` VALUES ('6', '6', '5e750bd3bfeb407e8f5ecb955cb122c8', '1480735319', '1');
INSERT INTO `mlv_user_s` VALUES ('7', '7', '5a3e12163872d4ba1e2f9604cf949130', '1471373924', '0');
INSERT INTO `mlv_user_s` VALUES ('8', '8', 'eee848a2d510d4d44728f0518043f787', '1480741397', '1');
INSERT INTO `mlv_user_s` VALUES ('9', '9', 'e7fc03fa2d71ee22bc646ac97cc9a1ec', '1480748263', '1');
INSERT INTO `mlv_user_s` VALUES ('10', '10', '498121f60b324adea76305e34ec82246', '1471391884', '1');
INSERT INTO `mlv_user_s` VALUES ('11', '11', 'd6d32c4fd475bdaa3eb27e05fc61476f', '1471391878', '0');
INSERT INTO `mlv_user_s` VALUES ('12', '12', '6166e4bd79f212a1771bf7264a3195ef', '1480762434', '1');
INSERT INTO `mlv_user_s` VALUES ('13', '13', '6c10c59eb8615ab18ef55e58d75f8a2a', '1480764719', '1');
INSERT INTO `mlv_user_s` VALUES ('14', '14', '61e11459fa086cc93ce199a25def9771', '1480766124', '0');
INSERT INTO `mlv_user_s` VALUES ('15', '15', '773558db9f3708d6dd1eebb8f3715eea', '1480770615', '1');
INSERT INTO `mlv_user_s` VALUES ('16', '16', '178be286b2d3d39c054d3b8339eb6b62', '1480771002', '1');
INSERT INTO `mlv_user_s` VALUES ('17', '17', '41b51c715ce0066f64275b2d4ad831dc', '1488633939', '1');
INSERT INTO `mlv_user_s` VALUES ('18', '18', '7500e38e616f92062339f57e00c87016', '1480804804', '1');
INSERT INTO `mlv_user_s` VALUES ('19', '20', '42c8123aef8c828c2f1333d48bdb8412', '1480811192', '1');
INSERT INTO `mlv_user_s` VALUES ('20', '21', '446171d91ab7d4534b75b84eedbb0092', '1480812031', '1');
INSERT INTO `mlv_user_s` VALUES ('21', '22', 'b2f646d901625ff85f198d43ee8bb53f', '1488679154', '1');
INSERT INTO `mlv_user_s` VALUES ('22', '23', '1c5cc2d710cce981fd48daa5038317f1', '1488679518', '1');
INSERT INTO `mlv_user_s` VALUES ('23', '24', '0a69500947a8d2caab4a6243d599900c', '1488678760', '1');
INSERT INTO `mlv_user_s` VALUES ('24', '25', '9ff87bdac71bae41aa274b680372aaae', '1488680379', '0');
INSERT INTO `mlv_user_s` VALUES ('25', '26', '3c31382b30165886e84c7e4b07c0ac55', '1488680408', '1');
INSERT INTO `mlv_user_s` VALUES ('26', '27', '1e4c7ad68d8f439de8931a3868ba71f4', '1488681310', '0');
INSERT INTO `mlv_user_s` VALUES ('27', '28', 'ba73ba7803a7177a1c26e71fd499863d', '1488681400', '0');
INSERT INTO `mlv_user_s` VALUES ('28', '29', '17562b65dad00a701e0217c398c17aa5', '1488681447', '0');
INSERT INTO `mlv_user_s` VALUES ('29', '30', '744fb9a6926d55ab2ebead4566f4a8ee', '1488681526', '1');
|
------
-- [FINANCEIRO - INICIO]
------
-- 97342
delete from db_menu where id_item_filho in (10024, 10025, 10026);
delete from db_itensmenu where id_item in (10024, 10025, 10026);
delete from db_sysarqcamp where codarq = 1038 and codcam = 20881;
delete from db_syscampodef where codcam = 20881;
delete from db_syscampo where codcam = 20881;
delete from db_sysarqcamp where codarq = 1036 and codcam = 20884;
delete from db_sysarqcamp where codarq = 1036 and codcam = 20889;
delete from db_syscampo where codcam in (20884, 20889);
-- Assinatura
drop table if exists db_paragrafopadrao_97342;
create temp table db_paragrafopadrao_97342 as
select db62_codparag as paragrafo from db_docparagpadrao where db62_coddoc in (select db60_coddoc from db_documentopadrao where db60_tipodoc = 5016);
delete from db_docparagpadrao where db62_coddoc in (select db60_coddoc from db_documentopadrao where db60_tipodoc = 5016);
delete from db_paragrafopadrao where db61_codparag in (select paragrafo from db_paragrafopadrao_97342);
delete from db_documentopadrao where db60_tipodoc = 5016;
delete from db_tipodoc where db08_codigo = 5016;
------
-- [FINANCEIRO - FIM]
------
------
-- [FOLHA - INICIO]
------
update db_syscampo set nomecam = 'rh01_reajusteparidade', conteudo = 'bool', descricao = 'Tipo de reajuste do servidor. False = Real, True = c/ Paridade (reajuste)', valorinicial = 'f', rotulo = 'Tipo de Reajuste', nulo = 'f', tamanho = 20, maiusculo = 'f', autocompl = 'f', aceitatipo = 1, tipoobj = 'text', rotulorel = 'Tipo de Reajuste' where codcam = 20685;
delete from db_sysarqcamp where codarq = 3757;
delete from db_sysarqcamp where codarq = 1159 and codcam = 20897;
delete from db_syscampo where codcam in (20882,20883,20897);
delete from db_sysarqmod where codmod = 28 and codarq = 3757;
delete from db_sysprikey where codarq = 3757;
delete from db_sysforkey where codarq = 1153;
delete from db_sysarquivo where codarq = 3757;
-- Relatório por Tipo de Reajuste
update db_relatorio
set db63_xmlestruturarel = '<?xml version="1.0" encoding="ISO-8859-1"?>
<Relatorio>
<Versao>1.0</Versao>
<Propriedades versao="1.0" nome="Relatório de Servidores por Tipo de Reajuste" layout="dbseller" formato="A4" orientacao="portrait" margemsup="0" margeminf="0" margemesq="20" margemdir="20" tiposaida="pdf"/>
<Cabecalho></Cabecalho>
<Rodape></Rodape>
<Variaveis>
<Variavel nome="$sTipoReajuste" label="Tipo de Reajuste" tipodado="varchar" valor="f"/>
</Variaveis>
<Campos>
<Campo id="6964" nome="rh01_regist" alias="Matrícula" largura="18" alinhamento="c" alinhamentocab="c" mascara="t" totalizar="n" quebra=""/>
<Campo id="217" nome="z01_nome" alias="Nome" largura="90" alinhamento="l" alinhamentocab="c" mascara="t" totalizar="n" quebra=""/>
<Campo id="15613" nome="rh88_descricao" alias="Tipo Aposentadoria" largura="55" alinhamento="l" alinhamentocab="c" mascara="t" totalizar="n" quebra=""/>
<Campo id="15614" nome="rh01_descricaoreajusteparidade" alias="Tipo de Reajuste" largura="30" alinhamento="l" alinhamentocab="c" mascara="t" totalizar="n" quebra=""/>
</Campos>
<Consultas>
<Consulta tipo="Principal">
<Select>
<Campo id="6964"/>
<Campo id="217"/>
<Campo id="15613"/>
<Campo id="15614"/>
</Select>
<From>select distinct rh01_regist,
z01_nome,
rh88_descricao,
case when rh01_reajusteparidade = ''f'' then ''Real''
else ''Paridade''
end as rh01_descricaoreajusteparidade
from rhpessoal
inner join cgm on rhpessoal.rh01_numcgm = cgm.z01_numcgm
inner join rhpessoalmov on rhpessoal.rh01_regist = rhpessoalmov.rh02_regist
inner join rhtipoapos on rhpessoalmov.rh02_rhtipoapos = rhtipoapos.rh88_sequencial
where rh01_reajusteparidade = $sTipoReajuste
and rh01_instit = fc_getsession(''DB_instit'')::integer</From>
<Where/>
<Group></Group>
<Order>
<Ordem id="217" nome="z01_nome" ascdesc="asc" alias="Nome"/>
</Order>
</Consulta>
</Consultas>
</Relatorio>
'
where db63_sequencial = 28;
-- Comparativo de Férias
delete from db_syscampodef where codcam = 20899;
delete from db_sysarqcamp where codcam in (20899, 20900, 20901) and codarq = 536;
delete from db_syscampo where codcam in (20899, 20900, 20901);
-- Campo para vinculação de instituição à fundamentação legal
delete from db_sysforkey where codcam = 20902;
delete from db_sysarqcamp where codcam = 20902;
delete from db_syscampo where codcam = 20902;
-- Layout Integração Bancária TCE-RO
DELETE FROM db_layoutcampos WHERE db52_layoutlinha IN (724, 725, 726);
DELETE FROM db_layoutlinha WHERE db51_layouttxt = 221;
DELETE FROM db_layouttxt WHERE db50_codigo = 221;
-- Menu para processamento dos dados no Ponto.
delete from db_itensmenu where id_item = 10032;
delete from db_menu where id_item_filho = 10032 AND modulo = 952;
/**
* Criação da Tabela rhpreponto
*/
delete from db_sysarqcamp where codarq = 3766;
delete from db_sysforkey where codarq = 3766;
delete from db_sysforkey where codarq = 3766;
delete from db_syscampo where codcam = 20923;
delete from db_syscampo where codcam = 20924;
delete from db_syscampo where codcam = 20925;
delete from db_syscampo where codcam = 20926;
delete from db_syscampo where codcam = 20927;
delete from db_syscampo where codcam = 20928;
delete from db_sysarqmod where codarq = 3766;
delete from db_sysarquivo where codarq in(3765, 3766);
------
-- [FOLHA - FIM]
------
------
-- [TRIBUTARIO - INICIO]
------
update db_syscampo
set conteudo = 'varchar(20)', tamanho = 20
where codcam = 5110;
update db_syscampo
set conteudo = 'varchar(20)', tamanho = 20
where codcam = 5106;
delete from db_menu where id_item = 3331 and id_item_filho = 10029 and modulo = 4555;
delete from db_itensfilho where id_item = 10029 and codfilho = 1918;
delete from db_itensmenu where id_item = 10029;
delete from db_itensmenu where id_item = 10030;
delete from db_menu where id_item_filho = 10030 AND modulo = 7808;
delete from db_menu where id_item_filho = 9227 AND modulo = 7808;
delete from db_sysarqcamp where codcam = 20922;
delete from db_syscampo where codcam = 20922;
------
-- [TRIBUTARIO - FIM]
------
------
-- [TIME C - INICIO]
------
update db_syscampo set nomecam = 's152_i_pressaosistolica', conteudo = 'int4', descricao = 'Pressão arterial sistólica medida no paciente.', valorinicial = '0', rotulo = 'Sistólica', nulo = 'f', tamanho = 3, maiusculo = 'f', autocompl = 'f', aceitatipo = 1, tipoobj = 'text', rotulorel = 'Sistólica' where codcam = 17216;
update db_syscampo set nomecam = 's152_i_pressaodiastolica', conteudo = 'int4', descricao = 'Pressão arterial diastólica medida no paciente.', valorinicial = '0', rotulo = 'Diastólica', nulo = 'f', tamanho = 3, maiusculo = 'f', autocompl = 'f', aceitatipo = 1, tipoobj = 'text', rotulorel = 'Diastólica' where codcam = 17217;
update db_syscampo set nomecam = 's152_i_cintura', conteudo = 'int4', descricao = 'Cintura do paciente em centímetros.', valorinicial = '0', rotulo = 'Cintura', nulo = 'f', tamanho = 3, maiusculo = 'f', autocompl = 'f', aceitatipo = 1, tipoobj = 'text', rotulorel = 'Cintura' where codcam = 17218;
update db_syscampo set nomecam = 's152_n_peso', conteudo = 'float4', descricao = 'Peso do paciente.', valorinicial = '0', rotulo = 'Peso', nulo = 'f', tamanho = 7, maiusculo = 'f', autocompl = 'f', aceitatipo = 4, tipoobj = 'text', rotulorel = 'Peso' where codcam = 17219;
update db_syscampo set nomecam = 's152_i_altura', conteudo = 'int4', descricao = 'Altura do paciente medida em centímetros.', valorinicial = '0', rotulo = 'Altura', nulo = 'f', tamanho = 3, maiusculo = 'f', autocompl = 'f', aceitatipo = 1, tipoobj = 'text', rotulorel = 'Altura' where codcam = 17220;
-- TAREFA 104640
delete from db_sysarqmod where codmod = 1000004 and codarq = 3761;
delete from db_sysarqcamp where codarq = 3761;
delete from db_sysprikey where codarq = 3761;
delete from db_sysarqcamp where codarq = 3761;
delete from db_syssequencia where codsequencia = 1000424;
delete from db_syscampo where codcam in (20903,20904,20905,20906);
delete from db_sysarqmod where codmod = 1000004 and codarq = 3762;
delete from db_sysprikey where codarq = 3762;
delete from db_sysforkey where codarq = 3762;
delete from db_syscadind where codind = 4143 and codcam = 20908;
delete from db_syscadind where codind = 4144 and codcam = 20909;
delete from db_syscadind where codind = 4145 and codcam = 20913;
delete from db_sysarqcamp where codarq = 3762;
delete from db_syssequencia where codsequencia = 1000425;
delete from db_sysindices where codind IN (4143,4144,4145);
delete from db_sysarquivo where codarq IN (3761,3762);
delete from db_syscampo where codcam in (20907,20908,20909,20910,20912,20913);
delete from db_sysprikey where codarq in (3764,3763);
delete from db_sysforkey where codarq = 3764;
delete from db_syscadind where codind = 4147 and codcam in (20921,20920);
delete from db_sysindices where codind = 4147;
delete from db_sysarqcamp where codarq in (3764,3763);
delete from db_syscampo where codcam in (20919,20920,20921,20914,20915,20916,20917,20918);
delete from db_syssequencia where codsequencia in (1000427,1000426);
delete from db_sysarqmod where codmod = 1000004 and codarq in (3764,3763);
delete from db_sysarquivo where codarq in (3764,3763);
------
-- [TIME C - FIM]
------ |
-- DROP DATABASE
DROP DATABASE IF EXISTS bets_db;
-- CREATE DATABASE
CREATE DATABASE bets_db;
|
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table personn (
id bigint not null,
name varchar(100),
last_name varchar(100),
date_of_birth timestamp,
email varchar(255),
favorite_db integer,
notes varchar(5000),
constraint pk_personn primary key (id))
;
create sequence personn_seq;
# --- !Downs
drop table if exists personn cascade;
drop sequence if exists personn_seq;
|
# patch_54_55_a.sql
#
# title: Partition result_feature table
#
# description:
# Partition result-feature table based on a window_size, seq_region_id key
# Initial arbitrary partition number of 250, should see most seq_region_id/window_size
# keys hosted in their own partition (244 for current human).
# To do this on a species by species basis just use those seq_region_ids which are
# available in the probe_feature table for this release
# This will mean that any subsequent seq_regions/windows are added after
# partitioning, will share a partition.
--DROP TABLE IF EXISTS `part_result_feature`;
#CREATE TABLE `part_result_feature` (
# `result_feature_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
# `result_set_id` int(10) unsigned NOT NULL,
# `seq_region_id` int(10) unsigned NOT NULL,
# `seq_region_start` int(10) NOT NULL,
# `seq_region_end` int(10) NOT NULL,
# `seq_region_strand` tinyint(4) NOT NULL,
# `window_size` smallint(5) unsigned NOT NULL,
# `score` double DEFAULT NULL,
# KEY (result_feature_id),
# KEY `set_window_seq_region_idx` (`result_set_id`,`window_size`,`seq_region_id`,`seq_region_start`)
# ) ENGINE=MyISAM DEFAULT CHARSET=latin1
# PARTITION BY KEY (`window_size`,`seq_region_id`)
# PARTITIONS 250;
#INSERT into part_result_feature (SELECT * from result_feature);
rename table result_feature to tmp_result_feature;
DROP TABLE IF EXISTS `result_feature`;
CREATE TABLE `result_feature` (
`result_feature_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`result_set_id` int(10) unsigned NOT NULL,
`seq_region_id` int(10) unsigned NOT NULL,
`seq_region_start` int(10) NOT NULL,
`seq_region_end` int(10) NOT NULL,
`seq_region_strand` tinyint(4) NOT NULL,
`window_size` smallint(5) unsigned NOT NULL,
`score` double DEFAULT NULL,
KEY (result_feature_id),
KEY `set_window_seq_region_idx` (`result_set_id`,`window_size`,`seq_region_id`,`seq_region_start`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY KEY (`window_size`)
PARTITIONS 7;
#For human we have 93 seq_regions in result_feature
#7 windows gives 644 partitions, way too many
#Just stay with num windows for DBs with no data
#For DBs with data do 100, or product of seq_region_ids * num windows
#InnoDB cannot be used due to copying problems
INSERT into result_feature (SELECT * from tmp_result_feature);
DROP TABLE `tmp_result_feature`;
# patch identifier
INSERT INTO meta (species_id, meta_key, meta_value) VALUES (NULL, 'patch', 'patch_54_55_a.sql|partition_result_feature');
|
drop table if exists pret, exemplaire, tag, reservation, auteur, oeuvre, adherent cascade;
create table adherent (
id serial primary key, -- serial = int auto increment
nom text not null,
prenom text not null,
email text not null,
date_adhesion timestamp not null,
date_paiement timestamp
);
create table oeuvre (
cote text primary key,
titre text not null,
date_parution date
);
create table auteur ( -- many to many
nom text not null,
cote text references oeuvre(cote) not null,
primary key(nom, cote)
);
create table reservation (
id_adherent int references adherent(id) not null,
cote text references oeuvre(cote) not null,
primary key(id_adherent, cote),
date_reservation timestamp not null,
date_proposition timestamp
);
create table tag ( -- many to many
mot text not null,
cote text references oeuvre(cote) not null,
primary key(mot, cote)
);
create table exemplaire (
cote text references oeuvre(cote) not null,
numero int not null, -- todo : faire qu'il s'incrémentente tous seul en fonction du nombre d'exemplaire de ce livre
primary key(cote, numero),
date_achat timestamp,
dernier_pret int
);
create table pret (
id serial primary key,
cote text,
numero_exemplaire int,
foreign key(cote, numero_exemplaire) references exemplaire(cote, numero) match full,
numero_adherent int references adherent(id) not null,
date_emprunt timestamp not null,
duree_theorique interval not null,
date_rendu timestamp
);
alter table exemplaire
add FOREIGN KEY (dernier_pret) references pret(id);
|
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.6.33)
# Database: yhzj
# Generation Time: 2016-11-08 08:41:00 +0000
# ************************************************************
/*!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 */;
/*!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 */;
# Dump of table t_course_category
# ------------------------------------------------------------
DROP TABLE IF EXISTS `t_course_category`;
CREATE TABLE `t_course_category` (
`id` varchar(64) NOT NULL,
`title` varchar(20) DEFAULT NULL,
`icon` varchar(200) DEFAULT NULL,
`parent_id` varchar(64) DEFAULT NULL,
`sort` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `t_course_category` WRITE;
/*!40000 ALTER TABLE `t_course_category` DISABLE KEYS */;
INSERT INTO `t_course_category` (`id`, `title`, `icon`, `parent_id`, `sort`)
VALUES
('8w2rXhoYvuJ2QY9HTc8V5sRPm9w1nEZN','护士','icon1.png',NULL,1),
('TTBd7KeKT4vabckRb92BHyuEE6nt2EYI','护师','icon2.png',NULL,2);
/*!40000 ALTER TABLE `t_course_category` ENABLE KEYS */;
UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */;
|
SELECT *
FROM PortfolioProject.dbo.CovidDeaths
ORDER BY 3,4
;
--SELECT *
--FROM PortfolioProject.dbo.CovidVaccinations
--ORDER BY 3,4
--;
SELECT
location, date,total_cases,new_cases,total_deaths,population
FROM PortfolioProject.dbo.CovidDeaths
ORDER BY 1,2;
-- Total Cases VS Total Deaths
-- Shows likelihood of dying
SELECT
location, date,total_cases,total_deaths, (total_deaths/total_cases)*100 AS DeathPercentage
FROM PortfolioProject.dbo.CovidDeaths
ORDER BY 1,2;
-- Total Cases vs Population
-- Shows percentage of population got Covid
SELECT
location, date, total_cases, population, (total_cases/population)*100 AS Infectedpercentage
FROM PortfolioProject.dbo.CovidDeaths
ORDER BY 1, 2;
-- Countries with Highest Infection Rate vs Population
SELECT
location, population, MAX(total_cases) AS HighestInfectionCount, MAX(total_cases/population)*100 AS Infectedpercentage
FROM PortfolioProject.dbo.CovidDeaths
GROUP BY location, population
ORDER BY Infectedpercentage DESC;
-- Showing the countries with the highest death rate vs population
SELECT
location, MAX(cast(total_deaths AS INT)) AS TotalDeathCounts
FROM PortfolioProject.dbo.CovidDeaths
GROUP BY location
ORDER BY TotalDeathCounts DESC;
-- Break Things Down by Continent
-- Showing the continents with the highest death count per population
SELECT
location, MAX(cast(total_deaths AS INT)) AS TotalDeathCounts
FROM PortfolioProject.dbo.CovidDeaths
WHERE continent is NOT NULL
GROUP BY location
ORDER BY TotalDeathCounts DESC;
-- Global numbers
-- Use aggreagate function
--SELECT
-- Date,
-- SUM(new_cases) AS Cases,
-- SUM(cast(new_deaths AS INT)) AS Deaths,
-- SUM(cast(new_deaths AS INT))/SUM(new_cases)*100 AS GlobalDeathRate
-- FROM PortfolioProject.dbo.CovidDeaths
--WHERE continent is NOT NULL
--GROUP BY Date
--ORDER BY 1 ;
--SELECT
-- SUM(new_cases) AS Cases,
-- SUM(cast(new_deaths AS INT)) AS Deaths,
-- SUM(cast(new_deaths AS INT))/SUM(new_cases)*100 AS GlobalDeathRate
-- FROM PortfolioProject.dbo.CovidDeaths
--WHERE continent is NOT NULL
--;
-- Global Death Percentage
SELECT
SUM(new_cases) AS total_cases,
SUM(convert(int,new_deaths)) AS total_deaths,
SUM(convert(int,new_deaths))/SUM(new_cases)*100 AS GlobalDeathPercentage
FROM PortfolioProject.dbo.CovidDeaths
WHERE continent is NOT NULL
ORDER BY 1,2;
--SELECT *
--FROM PortfolioProject.dbo.CovidVaccinations
--ORDER BY 3,4
--;
--SELECT *
--FROM PortfolioProject.dbo.CovidVaccinations
--WHERE location = 'Malaysia'
--ORDER BY 3,4
--;
-- Total Population vs Vaccinations
SELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations
FROM PortfolioProject.dbo.CovidDeaths dea
JOIN PortfolioProject.dbo.CovidVaccinations vac
ON dea.location = vac.location
AND dea.date = vac.date
ORDER BY 1, 2;
SELECT continent, location, date, population, new_vaccinations
FROM PortfolioProject.dbo.CovidVaccinations vac
WHERE continent is NOT NULL
ORDER BY 1, 2;
--SELECT
-- continent,
-- location,
-- population,
-- date,
-- new_vaccinations,
-- SUM(CAST(new_vaccinations AS INT)) OVER (PARTITION BY location)
--FROM PortfolioProject.dbo.CovidVaccinations
--WHERE continent is NOT NULL
--ORDER BY 2,3;
SELECT
continent,
location,
population,
date,
new_vaccinations,
SUM(CONVERT(int, new_vaccinations)) OVER (PARTITION BY location ORDER BY location, date) AS SumVaccinated
FROM PortfolioProject.dbo.CovidVaccinations
WHERE continent is NOT NULL
ORDER BY 2,3;
-- USE CTE
With PopvsVac (Continent, Location, Population, Date, new_vaccinations, SumVaccinated)
AS (
SELECT
continent,
location,
population,
date,
new_vaccinations,
SUM(CONVERT(int, new_vaccinations)) OVER (PARTITION BY location ORDER BY location, date) AS SumVaccinated
FROM PortfolioProject.dbo.CovidVaccinations
WHERE continent is NOT NULL
)
SELECT *, (SumVaccinated/population)*100 AS VaccinatedPercentage
FROM PopvsVac;
|
CREATE TABLE IF NOT EXISTS address (
addressId INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
userId INT,
street VARCHAR(45),
country VARCHAR(25),
city VARCHAR(30),
state VARCHAR(20),
num INT,
FOREIGN KEY (userId) REFERENCES users (userId)
);
CREATE TABLE IF NOT EXISTS users (
userId INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(45),
email VARCHAR(100),
password VARCHAR(100)
);
|
CREATE TABLE `compound_page` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` tinytext,
`description` tinytext,
`keywords` tinytext,
`alias` tinytext,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `gallery` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` tinytext,
`flags` int(11) DEFAULT NULL,
`description` tinytext,
`keywords` tinytext,
`alias` tinytext,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `compound_lead` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` tinytext,
`url` tinytext,
`note` text,
`parent_id` int(11) DEFAULT NULL,
`ord` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE `gallery_photo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) DEFAULT NULL,
`img` varchar(255) DEFAULT NULL,
`imgtn` varchar(255) DEFAULT NULL,
`alt` varchar(255) DEFAULT NULL,
`ord` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
-- 1. Design the schema for movie cruiser in MySQL Workbench
-- 2. Generate the SQL schema script in MySQL Workbench
-- 3. Paste the generated the SQL code here
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema truyum
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema truyum
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `moviecruiser` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `moviecruiser` ;
-- -----------------------------------------------------
-- Table `truyum`.`user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `moviecruiser`.`user` (
`us_id` INT NOT NULL AUTO_INCREMENT,
`us_name` VARCHAR(60) NULL,
PRIMARY KEY (`us_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `truyum`.`menu_item`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `moviecruiser`.`movie` (
`mov_id` INT NOT NULL AUTO_INCREMENT,
`mov_title` VARCHAR(100) NULL,
`mov_box_office` DECIMAL(15) NULL,
`mov_active` VARCHAR(3) NULL,
`mov_date_of_launch` DATE NULL,
`mov_genre` VARCHAR(45) NULL,
`mov_has_teaser` VARCHAR(3) NULL,
PRIMARY KEY (`mov_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `truyum`.`cart`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `moviecruiser`.`favorite` (
`fav_id` INT NOT NULL AUTO_INCREMENT,
`fav_us_id` INT NULL,
`fav_mov_id` INT NULL,
PRIMARY KEY (`fav_id`),
INDEX `fav_us_fk_idx` (`fav_us_id` ASC),
INDEX `fav_mov_fk_idx` (`fav_mov_id` ASC),
CONSTRAINT `fav_us_fk`
FOREIGN KEY (`fav_us_id`)
REFERENCES `moviecruiser`.`user` (`us_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fav_mov_fk`
FOREIGN KEY (`fav_mov_id`)
REFERENCES `moviecruiser`.`movie` (`mov_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
ALTER TABLE CLASE DROP CONSTRAINT FK_CLASE_GRUPOS_ID
ALTER TABLE CLASE DROP CONSTRAINT FK_CLASE_ASIGNATURA_REFERENCIA
ALTER TABLE ASIGNATURAS DROP CONSTRAINT FK_ASIGNATURAS_TITULACION_CODIGO
ALTER TABLE OPTATIVA DROP CONSTRAINT FK_OPTATIVA_REFERENCIA
ALTER TABLE ENCUESTA DROP CONSTRAINT FK_ENCUESTA_EXPEDIENTE_NUM_EXPEDIENTE
ALTER TABLE EXPEDIENTES DROP CONSTRAINT FK_EXPEDIENTES_TITULACION_CODIGO
ALTER TABLE EXPEDIENTES DROP CONSTRAINT FK_EXPEDIENTES_ALUMNO_ID
ALTER TABLE MATRICULA DROP CONSTRAINT FK_MATRICULA_EXPEDIENTES_NUM_EXPEDIENTE
ALTER TABLE GRUPO DROP CONSTRAINT FK_GRUPO_grupoID
ALTER TABLE GRUPO DROP CONSTRAINT FK_GRUPO_TITULACION_CODIGO
ALTER TABLE GRUPOS_POR_ASIGNATURA DROP CONSTRAINT FK_GRUPOS_POR_ASIGNATURA_REFERENCIA_REFERENCIA
ALTER TABLE GRUPOS_POR_ASIGNATURA DROP CONSTRAINT FK_GRUPOS_POR_ASIGNATURA_ID_ID
ALTER TABLE ASIGNATURAS_MATRICULA DROP CONSTRAINT FK_ASIGNATURAS_MATRICULA_ASIGNATURA_REFERENCIA
ALTER TABLE ASIGNATURAS_MATRICULA DROP CONSTRAINT FK_ASIGNATURAS_MATRICULA_CURSO_ACADEMICO
ALTER TABLE ASIGNATURAS_MATRICULA DROP CONSTRAINT FK_ASIGNATURAS_MATRICULA_GRUPO_ID
ALTER TABLE jn_tit_opt DROP CONSTRAINT FK_jn_tit_opt_titulaciones_CODIGO
ALTER TABLE jn_tit_opt DROP CONSTRAINT FK_jn_tit_opt_optativa_REFERENCIA
ALTER TABLE jn_tit_cntr DROP CONSTRAINT FK_jn_tit_cntr_centro_fk
ALTER TABLE jn_tit_cntr DROP CONSTRAINT FK_jn_tit_cntr_tit_fk
ALTER TABLE jn_enc_grpXasi DROP CONSTRAINT FK_jn_enc_grpXasi_FECHA_DE_ENVIO
ALTER TABLE jn_enc_grpXasi DROP CONSTRAINT FK_jn_enc_grpXasi_CURSO_ACADEMICO
DROP TABLE ALUMNO
DROP TABLE CLASE
DROP TABLE ASIGNATURAS
DROP TABLE OPTATIVA
DROP TABLE CENTRO
DROP TABLE ENCUESTA
DROP TABLE EXPEDIENTES
DROP TABLE MATRICULA
DROP TABLE TITULACION
DROP TABLE GRUPO
DROP TABLE GRUPOS_POR_ASIGNATURA
DROP TABLE ASIGNATURAS_MATRICULA
DROP TABLE jn_tit_opt
DROP TABLE jn_tit_cntr
DROP TABLE jn_enc_grpXasi
DELETE FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN'
|
DROP PROCEDURE Clear_Alarm_For_Interface;
DROP PROCEDURE Create_Alarm_For_Interface;
DROP PROCEDURE Evaluate_Single_PM;
DROP PROCEDURE Status_To_Facilities_Rollup;
DROP PROCEDURE Status_To_TIDs_Rollup;
DROP PROCEDURE Status_To_Customers_Rollup;
DROP FUNCTION Call_Populate_TID_Queue;
DROP PROCEDURE Populate_TID_Queue;
DROP FUNCTION Get_Next_TID;
DROP FUNCTION Shift_TID_Queue;
DROP FUNCTION pnni_insertOrUpdate_facilities;
DROP FUNCTION pnni_insertOrUpdate_interfaces;
DROP PROCEDURE pnni_insOrUpd_tid_facility_map;
DROP PROCEDURE pnni_insOrUpd_tid_intf_status;
DROP FUNCTION pnni_insertOrUpdate_tids;
DROP PROCEDURE determine_tis;
DROP FUNCTION all_speeds_for_speed;
DROP PROCEDURE delete_TID;
DROP PROCEDURE Build_Links;
DROP PROCEDURE Drop_Links;
DROP PROCEDURE Build_Sequence;
DROP FUNCTION all_customers_for_proc;
SELECT DISTINCT 'Procedures Still Existing: ' || name FROM user_source WHERE type = 'PROCEDURE';
SELECT DISTINCT 'Fuctions Still Existing: ' || name FROM user_source WHERE type = 'FUNCTION';
|
# patch_48_49_d.sql
#
# Title: Add new info_type to xref table
#
# Description:
# Add the ENUM 'COORDINATE_OVERLAP' to the xref.info_type column.
ALTER TABLE xref CHANGE COLUMN info_type
info_type ENUM(
'PROJECTION', 'MISC', 'DEPENDENT', 'DIRECT', 'SEQUENCE_MATCH',
'INFERRED_PAIR', 'PROBE', 'UNMAPPED', 'COORDINATE_OVERLAP'
);
# Patch identifier
INSERT INTO meta (meta_key, meta_value)
VALUES ('patch', 'patch_48_49_d.sql|new_info_type_enum');
|
CREATE TYPE append_result AS (
-- data varchar, I think this is suppose to be max_count?
max_count bigint,
current_version bigint,
current_position bigint
);
|
CREATE KEYSPACE activity
WITH replication = {'class': 'NetworkTopologyStrategy', 'eu-west': '3'} AND durable_writes = true;
|
CREATE TABLE titles (
titleID VARCHAR(255) NOT NULL,
ordering INT NOT NULL,
title VARCHAR(255) NOT NULL,
region VARCHAR(255),
language VARCHAR(255),
attributes TEXT(65535),
isOriginalTitle BOOLEAN,
PRIMARY KEY (titleID)
);
CREATE TABLE titleTypes (
titleID VARCHAR(255) NOT NULL,
alternative BOOLEAN,
dvd BOOLEAN,
festival BOOLEAN,
tv BOOLEAN,
video BOOLEAN,
working BOOLEAN,
original BOOLEAN,
imdbDisplay BOOLEAN,
PRIMARY KEY (titleID)
);
CREATE TABLE titleBasics (
tconst VARCHAR(255) NOT NULL,
titleType VARCHAR(255),
primaryTitle VARCHAR(255),
originalTitle VARCHAR(255) NOT NULL,
isAdult BOOLEAN NOT NULL,
startYear YEAR NOT NULL,
endYear YEAR,
runtimeMinutes INT NOT NULL,
genres VARCHAR(255)
PRIMARY KEY (tconst)
);
CREATE TABLE principals (
tconst VARCHAR(255) NOT NULL,
ordering INT NOT NULL,
nconst VARCHAR(255) NOT NULL,
category VARCHAR(255),
job VARCHAR(255),
character VARCHAR(255),
PRIMARY KEY (nconst),
FOREIGN KEY (tconst)
REFERENCES titles(titleID)
);
CREATE TABLE ratings (
tconst VARCHAR(255) NOT NULL,
averageRating FLOAT(2) NOT NULL,
numVotes INT,
PRIMARY KEY (tconst)
);
CREATE TABLE nameBasics (
nconst VARCHAR(255) NOT NULL,
primaryName VARCHAR(255) NOT NULL,
birthYear YEAR NOT NULL,
deathYear YEAR,
primaryProfession VARCHAR(255),
knownForTitles VARCHAR(255),
PRIMARY KEY (nconst)
);
|
-- start with employee
alter table employee add
thtitle nvarchar(50),
entitle nvarchar(50)
;
|
CREATE TABLE users
(
id int not null auto_increment,
username varchar(100),
password varchar(100),
role varchar(20) not null,
last_name varchar(20),
first_name varchar(20),
last_kana varchar(40),
first_kana varchar(40),
about varchar(800),
birthday date,
tel varchar(30),
email varchar(255),
sex varchar(10),
zip varchar(20),
prefecture varchar(20),
address varchar(255),
status int not null default 0,
created datetime,
modified datetime,
primary key(id)
) |
alter table developers
add column salary integer;
update developers set salary=1000 where id=1;
update developers set salary=700 where id=4;
update developers set salary=800 where id=5;
update developers set salary=2000 where id=7;
update developers set salary=900 where id=8;
update developers set salary=200 where id=9;
|
# Compute the revenue generated by each product, sorted by product name.
SELECT p.productName AS 'Product Name',
d.productCode AS 'Product Code',
ROUND(SUM(quantityOrdered*priceEach),2) AS Profit
FROM OrderDetails AS d
JOIN Products AS p ON d.productCode=p.productCode
GROUP BY d.productCode
ORDER BY p.productName |
use negocioWebRopa;
drop trigger if exists TR_Articulos_Insert;
delimiter //
create trigger TR_Articulos_Insert
after insert on articulos
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('articulos','insert',curdate(),curtime(),current_user(),NEW.id);
end;
// delimiter ;
drop trigger if exists TR_Articulos_Delete;
delimiter //
create trigger TR_Articulos_Delete
after delete on articulos
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('articulos','delete',curdate(),curtime(),current_user(),OLD.id);
end;
// delimiter ;
drop trigger if exists TR_Articulos_Update;
delimiter //
create trigger TR_Articulos_Update
after update on articulos
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('articulos','update',curdate(),curtime(),current_user(),NEW.id);
end;
// delimiter ;
drop trigger if exists TR_Facturas_Insert;
delimiter //
create trigger TR_Facturas_Insert
after insert on facturas
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('facturas','insert',curdate(),curtime(),current_user(),NEW.id);
end;
// delimiter ;
drop trigger if exists TR_Facturas_Update;
delimiter //
create trigger TR_Facturas_Update
after update on facturas
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('facturas','update',curdate(),curtime(),current_user(),NEW.id);
end;
// delimiter ;
drop trigger if exists TR_Facturas_Delete;
delimiter //
create trigger TR_Facturas_Delete
after delete on facturas
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('facturas','delete',curdate(),curtime(),current_user(),OLD.id);
end;
// delimiter ;
drop trigger if exists TR_Detalles_Insert;
delimiter //
create trigger TR_Detalles_Insert
after insert on detalles
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('detalles','insert',curdate(),curtime(),current_user(),NEW.id);
end;
// delimiter ;
drop trigger if exists TR_Detalles_Update;
delimiter //
create trigger TR_Detalles_Update
after update on detalles
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('detalles','update',curdate(),curtime(),current_user(),NEW.id);
end;
// delimiter ;
drop trigger if exists TR_Detalles_Delete;
delimiter //
create trigger TR_Detalles_Delete
after delete on detalles
for each row
begin
insert into control (tabla,accion,fecha,hora,usuario,idRegistro)
values ('detalles','delete',curdate(),curtime(),current_user(),OLD.id);
end;
// delimiter ;
select * from control; |
DELIMITER $$
USE `elearning`$$
DROP FUNCTION IF EXISTS `hasPubResPermission`$$
CREATE FUNCTION `hasPubResPermission`(userId VARCHAR(64),pubResId VARCHAR(64)) RETURNS TINYINT(1)
DETERMINISTIC
BEGIN
DECLARE cunt INT(3) DEFAULT 0;
SELECT IFNULL(COUNT(1),0) INTO cunt FROM sp_pub_res_scope WHERE pub_res_id = pubResId AND scope = 1;/*1-仅管理员可见*/
IF cunt = 0 THEN RETURN TRUE;END IF;
SELECT IFNULL(COUNT(1),0) INTO cunt FROM sp_public_admin WHERE user_id = userId AND public_id = (SELECT spr.public_id FROM sp_public_resource spr WHERE spr.id = pubResId);
IF cunt > 0 THEN RETURN TRUE;END IF;
RETURN FALSE;
END$$
DELIMITER ; |
-- subquery
-- 1) from 절의 서브쿼리
select now() as n, sysdate() as b, 3+1 as c;
select *
from (select now() as n, sysdate() as b, 3+1 as c) s;
-- 2) where 절의 서브쿼리
-- 예제
-- 현재 Fai Bale이 근무하는 부서에서 근무하는 직원의 사번, 전체 이름을 출력해보세요.
select de.dept_no
from employees e, dept_emp de
where e.emp_no=de.emp_no
and de.to_date='9999-01-01'
and concat(e.first_name, ' ', e.last_name) = 'Fai Bale';
select e.emp_no as '사번', concat(e.first_name, ' ', e.last_name) as '이름'
from employees e, dept_emp de
where e.emp_no=de.emp_no
and de.to_date = '9999-01-01'
and de.dept_no = (select de.dept_no
from employees e, dept_emp de
where e.emp_no=de.emp_no
and de.to_date='9999-01-01'
and concat(e.first_name, ' ', e.last_name) = 'Fai Bale');
-- 2-1) 단일행 연산자: =, >, <, >=, <=, <>, != # 복수행이 나오면 에러!
-- 실습문제1
-- 현재 전체 사원의 평균 연봉보다 적은 급여를 받는 사원의 이름, 급여를 출력하세요.
select avg(salary)
from salaries
where to_date='9999-01-01';
select concat(e.first_name, ' ', e.last_name) as '이름', s.salary as '급여'
from employees e, salaries s
where e.emp_no = s.emp_no
and s.to_date='9999-01-01'
and s.salary < (select avg(salary) from salaries where to_date='9999-01-01')
order by s.salary desc;
-- 실습문제2
-- 현재 가장 적은 평균 급여의 직책과 평균 급여를 출력하세요.
-- 예시) Engineer 2000
-- min_avg_salary
-- 1) 직책별 평균 급여
select t.title, avg(s.salary)
from salaries s, titles t
where s.emp_no = t.emp_no
and s.to_date = '9999-01-01'
and t.to_date = '9999-01-01'
group by t.title
order by avg(s.salary) asc;
-- 2) 풀이1 - 가장 적은 평균 급여
select min(avg_salary)
from ( select t.title, avg(s.salary) as avg_salary
from salaries s, titles t
where s.emp_no = t.emp_no
and s.to_date = '9999-01-01'
and t.to_date = '9999-01-01'
group by t.title) t1;
select t.title, avg(s.salary)
from salaries s, titles t
where s.emp_no = t.emp_no
and s.to_date = '9999-01-01'
and t.to_date = '9999-01-01'
group by t.title
having avg(s.salary) = (select min(avg_salary)
from (select t.title, avg(s.salary) as avg_salary
from salaries s, titles t
where s.emp_no = t.emp_no
and s.to_date = '9999-01-01'
and t.to_date = '9999-01-01'
group by t.title) t1);
-- 3) 풀이2 - 가장 적은 평균 급여 # top-k
select t.title, avg(s.salary)
from salaries s, titles t
where s.emp_no = t.emp_no
and s.to_date = '9999-01-01'
and t.to_date = '9999-01-01'
group by t.title
order by avg(s.salary) asc
limit 1;
-- 2-2) 복수행 연산자: in, not in, any, all
-- any 사용법
-- 1. =any :
-- 2. >any, >=any : 최솟값
-- 3. <any, <=any : 최댓값
-- 4. <>any : not in 동일
/*
* select ,,, where price in (1,
* 10,
* 20);
*/
-- all 사용법
-- 1. =all (x)
-- 2. >all, >=all : 최댓값
-- 3. <all, <=all : 최솟값
-- 실습문제3: 현재 급여가 50000 이상인 직원의 이름을 출력하세요.
/* [출력 예시]
* 주이 50001
* 둘리 50002
*/
-- 풀이1) join
select concat(e.first_name, ' ', e.last_name) as '이름', s.salary as '급여'
from employees e, salaries s
where e.emp_no = s.emp_no
and s.to_date = '9999-01-01'
and s.salary > 50000
order by s.salary asc;
-- 풀이2) subquery(in)
select emp_no, salary
from salaries
where to_date='9999-01-01'
and salary > 50000;
select concat(e.first_name, ' ', e.last_name) as '이름', s.salary as '급여'
from employees e, salaries s
where e.emp_no = s.emp_no
and s.to_date = '9999-01-01'
and (e.emp_no, s.salary) in ( select emp_no, salary
from salaries
where to_date='9999-01-01'
and salary > 50000);
-- 풀이3) subquery(=any)
select concat(e.first_name, ' ', e.last_name) as '이름', s.salary as '급여'
from employees e, salaries s
where e.emp_no = s.emp_no
and s.to_date = '9999-01-01'
and (e.emp_no, s.salary) = any( select emp_no, salary
from salaries
where to_date='9999-01-01'
and salary > 50000);
-- 실습문제4: 현재 각 부서별로 최고 월급을 받는 직원의 이름과 월급을 출력하세요.
/* [출력 예시]
* 주이 40000
* 둘리 50000
*/
/* d004 40000
* d005 50000
*/
select de.dept_no, max(s.salary) as max_salary
from dept_emp de, salaries s
where de.emp_no = s.emp_no
and de.to_date = '9999-01-01'
and s.to_date = '9999-01-01'
group by de.dept_no;
-- 풀이1: where subquery =any(in)
select d.dept_name as '부서', concat(e.first_name, ' ', e.last_name) as '이름', s.salary as '급여'
from dept_emp de, salaries s, employees e, departments d
where de.emp_no = s.emp_no
and s.emp_no = e.emp_no
and de.dept_no = d.dept_no
and de.to_date = '9999-01-01'
and s.to_date = '9999-01-01'
and (de.dept_no, s.salary) in ( select de.dept_no, max(s.salary) as max_salary
from dept_emp de, salaries s
where de.emp_no = s.emp_no
and de.to_date = '9999-01-01'
and s.to_date = '9999-01-01'
group by de.dept_no);
-- 풀이1: from subquery
select d.dept_name as '부서', concat(e.first_name, ' ', e.last_name) as '이름', s.salary as '급여'
from dept_emp de,
salaries s,
employees e,
departments d,
(select de.dept_no, max(s.salary) as max_salary
from dept_emp de, salaries s
where de.emp_no = s.emp_no
and de.to_date = '9999-01-01'
and s.to_date = '9999-01-01'
group by de.dept_no) sub1
where de.emp_no = s.emp_no
and s.emp_no = e.emp_no
and de.dept_no = d.dept_no
and de.dept_no = sub1.dept_no
and de.to_date = '9999-01-01'
and s.to_date = '9999-01-01'
and s.salary = sub1.max_salary; |
SELECT * FROM NOTHING
|
-- NAME
-- login.sql
--
-- DESCRIPTION
-- SQL*Plus global login "site profile" file
--
-- Add any SQL*Plus commands here that are to be executed when a
-- user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--
-- USAGE
-- This script is automatically run
--
set lines 2000
set pages 2000
set timi on
set time on
set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "
SET TERMOUT OFF
DEFINE sqlprompt=none
COLUMN sqlprompt NEW_VALUE sqlprompt
SELECT
LOWER(SYS_CONTEXT('USERENV','CURRENT_USER')) || '@' || SYS_CONTEXT('USERENV','DB_UNIQUE_NAME')||'['||host_name||']' as sqlprompt
FROM v$instance ;
SET SQLPROMPT '&sqlprompt> '
UNDEFINE sqlprompt
SET TERMOUT ON
|
ALTER TABLE `m_savings_product`
ADD COLUMN `min_required_balance` DECIMAL(19,6) NULL AFTER `overdraft_limit`,
ADD COLUMN `allow_overdraft_min_balance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `min_required_balance`;
ALTER TABLE `m_savings_account`
ADD COLUMN `min_required_balance` DECIMAL(19,6) NULL AFTER `account_balance_derived`,
ADD COLUMN `allow_overdraft_min_balance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `min_required_balance`;
|
CREATE DATABASE IF NOT EXISTS `myFriend` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `myFriend`;
-- MySQL dump 10.13 Distrib 8.0.12, for macos10.13 (x86_64)
--
-- Host: localhost Database: myFriend
-- ------------------------------------------------------
-- Server version 8.0.12
/*!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 */;
SET NAMES utf8 ;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `profile`
--
DROP TABLE IF EXISTS `profile`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `profile` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(45) DEFAULT NULL,
`last_name` varchar(45) DEFAULT NULL,
`occupation` varchar(45) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `profile`
--
LOCK TABLES `profile` WRITE;
/*!40000 ALTER TABLE `profile` DISABLE KEYS */;
INSERT INTO `profile` VALUES (7,'Eddie','Cheng22222','Finance','2018-08-22 15:19:30','2018-08-22 16:44:19'),(14,'Eddie','Cheng','32rew','2018-08-22 16:02:51','2018-08-22 16:02:51'),(15,'Eddie','Cheng','House','2018-08-22 16:08:01','2018-08-22 16:08:01'),(16,'Eddie','Cheng','Finance','2018-08-22 16:08:14','2018-08-22 16:08:14'),(17,'ken','Cheng','House','2018-08-22 16:10:47','2018-08-22 16:43:21'),(18,'Eddie','Cheng','34','2018-08-22 16:10:53','2018-08-22 16:10:53'),(20,'Eddie','Cheng','Finance','2018-08-22 16:11:59','2018-08-22 16:11:59'),(21,'Eddie','asdf','asdf','2018-08-22 16:12:07','2018-08-22 16:12:07'),(25,'Eddie','Cheng','House','2018-08-22 16:43:39','2018-08-22 16:43:39');
/*!40000 ALTER TABLE `profile` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-08-22 16:46:06
|
SELECT TOP 10
s.FirstName,
s.LastName,
FORMAT(AVG(e.Grade), 'N2') AS Grade
FROM Students s
JOIN StudentsExams e ON s.Id = e.StudentId
GROUP BY s.FirstName, s.LastName
ORDER BY AVG(e.Grade) DESC, s.FirstName ASC, s.LastName ASC |
SELECT * FROM all_objects WHERE object_name LIKE 'MTL_SYSTEM_ITEMS%';
SELECT * FROM all_SYNONYMS WHERE SYNONYM_name = 'MTL_SYSTEM_ITEMS';
SELECT * FROM all_views WHERE view_name = 'MTL_SYSTEM_ITEMS_VL';
SELECT B.ROW_ID ,
B.INVENTORY_ITEM_ID ,
B.ORGANIZATION_ID ,
B.PRIMARY_UOM_CODE ,
B.PRIMARY_UNIT_OF_MEASURE ,
B.ITEM_TYPE ,
B.INVENTORY_ITEM_STATUS_CODE ,
B.ALLOWED_UNITS_LOOKUP_CODE ,
B.ITEM_CATALOG_GROUP_ID ,
B.CATALOG_STATUS_FLAG ,
B.INVENTORY_ITEM_FLAG ,
B.STOCK_ENABLED_FLAG ,
B.MTL_TRANSACTIONS_ENABLED_FLAG ,
B.CHECK_SHORTAGES_FLAG ,
B.REVISION_QTY_CONTROL_CODE ,
B.RESERVABLE_TYPE ,
B.SHELF_LIFE_CODE ,
B.SHELF_LIFE_DAYS ,
B.CYCLE_COUNT_ENABLED_FLAG ,
B.NEGATIVE_MEASUREMENT_ERROR ,
B.POSITIVE_MEASUREMENT_ERROR ,
B.LOT_CONTROL_CODE ,
B.AUTO_LOT_ALPHA_PREFIX ,
B.START_AUTO_LOT_NUMBER ,
B.SERIAL_NUMBER_CONTROL_CODE ,
B.AUTO_SERIAL_ALPHA_PREFIX ,
B.START_AUTO_SERIAL_NUMBER ,
B.LOCATION_CONTROL_CODE ,
B.RESTRICT_SUBINVENTORIES_CODE ,
B.RESTRICT_LOCATORS_CODE ,
B.BOM_ENABLED_FLAG ,
B.BOM_ITEM_TYPE ,
B.BASE_ITEM_ID ,
B.EFFECTIVITY_CONTROL ,
B.ENG_ITEM_FLAG ,
B.ENGINEERING_ECN_CODE ,
B.ENGINEERING_ITEM_ID ,
B.ENGINEERING_DATE ,
B.PRODUCT_FAMILY_ITEM_ID ,
B.AUTO_CREATED_CONFIG_FLAG ,
B.MODEL_CONFIG_CLAUSE_NAME ,
B.NEW_REVISION_CODE ,
B.COSTING_ENABLED_FLAG ,
B.INVENTORY_ASSET_FLAG ,
B.DEFAULT_INCLUDE_IN_ROLLUP_FLAG ,
B.COST_OF_SALES_ACCOUNT ,
B.STD_LOT_SIZE ,
B.PURCHASING_ITEM_FLAG ,
B.PURCHASING_ENABLED_FLAG ,
B.MUST_USE_APPROVED_VENDOR_FLAG ,
B.ALLOW_ITEM_DESC_UPDATE_FLAG ,
B.RFQ_REQUIRED_FLAG ,
B.OUTSIDE_OPERATION_FLAG ,
B.OUTSIDE_OPERATION_UOM_TYPE ,
B.TAXABLE_FLAG ,
B.PURCHASING_TAX_CODE ,
B.RECEIPT_REQUIRED_FLAG ,
B.INSPECTION_REQUIRED_FLAG ,
B.BUYER_ID ,
B.UNIT_OF_ISSUE ,
B.RECEIVE_CLOSE_TOLERANCE ,
B.INVOICE_CLOSE_TOLERANCE ,
B.UN_NUMBER_ID ,
B.HAZARD_CLASS_ID ,
B.LIST_PRICE_PER_UNIT ,
B.MARKET_PRICE ,
B.PRICE_TOLERANCE_PERCENT ,
B.ROUNDING_FACTOR ,
B.ENCUMBRANCE_ACCOUNT ,
B.EXPENSE_ACCOUNT ,
B.ASSET_CATEGORY_ID ,
B.RECEIPT_DAYS_EXCEPTION_CODE ,
B.DAYS_EARLY_RECEIPT_ALLOWED ,
B.DAYS_LATE_RECEIPT_ALLOWED ,
B.ALLOW_SUBSTITUTE_RECEIPTS_FLAG ,
B.ALLOW_UNORDERED_RECEIPTS_FLAG ,
B.ALLOW_EXPRESS_DELIVERY_FLAG ,
B.QTY_RCV_EXCEPTION_CODE ,
B.QTY_RCV_TOLERANCE ,
B.RECEIVING_ROUTING_ID ,
B.ENFORCE_SHIP_TO_LOCATION_CODE ,
B.WEIGHT_UOM_CODE ,
B.UNIT_WEIGHT ,
B.VOLUME_UOM_CODE ,
B.UNIT_VOLUME ,
B.CONTAINER_ITEM_FLAG ,
B.VEHICLE_ITEM_FLAG ,
B.CONTAINER_TYPE_CODE ,
B.INTERNAL_VOLUME ,
B.MAXIMUM_LOAD_WEIGHT ,
B.MINIMUM_FILL_PERCENT ,
B.INVENTORY_PLANNING_CODE ,
B.PLANNER_CODE ,
B.PLANNING_MAKE_BUY_CODE ,
B.MIN_MINMAX_QUANTITY ,
B.MAX_MINMAX_QUANTITY ,
B.MINIMUM_ORDER_QUANTITY ,
B.MAXIMUM_ORDER_QUANTITY ,
B.ORDER_COST ,
B.CARRYING_COST ,
B.SOURCE_TYPE ,
B.SOURCE_ORGANIZATION_ID ,
B.SOURCE_SUBINVENTORY ,
B.MRP_SAFETY_STOCK_CODE ,
B.SAFETY_STOCK_BUCKET_DAYS ,
B.MRP_SAFETY_STOCK_PERCENT ,
B.FIXED_ORDER_QUANTITY ,
B.FIXED_DAYS_SUPPLY ,
B.FIXED_LOT_MULTIPLIER ,
B.MRP_PLANNING_CODE ,
B.ATO_FORECAST_CONTROL ,
B.PLANNING_EXCEPTION_SET ,
B.END_ASSEMBLY_PEGGING_FLAG ,
B.SHRINKAGE_RATE ,
B.ROUNDING_CONTROL_TYPE ,
B.ACCEPTABLE_EARLY_DAYS ,
B.REPETITIVE_PLANNING_FLAG ,
B.OVERRUN_PERCENTAGE ,
B.ACCEPTABLE_RATE_INCREASE ,
B.ACCEPTABLE_RATE_DECREASE ,
B.MRP_CALCULATE_ATP_FLAG ,
B.AUTO_REDUCE_MPS ,
B.PLANNING_TIME_FENCE_CODE ,
B.PLANNING_TIME_FENCE_DAYS ,
B.DEMAND_TIME_FENCE_CODE ,
B.DEMAND_TIME_FENCE_DAYS ,
B.RELEASE_TIME_FENCE_CODE ,
B.RELEASE_TIME_FENCE_DAYS ,
B.PREPROCESSING_LEAD_TIME ,
B.FULL_LEAD_TIME ,
B.POSTPROCESSING_LEAD_TIME ,
B.FIXED_LEAD_TIME ,
B.VARIABLE_LEAD_TIME ,
B.CUM_MANUFACTURING_LEAD_TIME ,
B.CUMULATIVE_TOTAL_LEAD_TIME ,
B.LEAD_TIME_LOT_SIZE ,
B.BUILD_IN_WIP_FLAG ,
B.WIP_SUPPLY_TYPE ,
B.WIP_SUPPLY_SUBINVENTORY ,
B.WIP_SUPPLY_LOCATOR_ID ,
B.OVERCOMPLETION_TOLERANCE_TYPE ,
B.OVERCOMPLETION_TOLERANCE_VALUE ,
B.CUSTOMER_ORDER_FLAG ,
B.CUSTOMER_ORDER_ENABLED_FLAG ,
B.SHIPPABLE_ITEM_FLAG ,
B.INTERNAL_ORDER_FLAG ,
B.INTERNAL_ORDER_ENABLED_FLAG ,
B.SO_TRANSACTIONS_FLAG ,
B.PICK_COMPONENTS_FLAG ,
B.ATP_FLAG ,
B.REPLENISH_TO_ORDER_FLAG ,
B.ATP_RULE_ID ,
B.ATP_COMPONENTS_FLAG ,
B.SHIP_MODEL_COMPLETE_FLAG ,
B.PICKING_RULE_ID ,
B.COLLATERAL_FLAG ,
B.DEFAULT_SHIPPING_ORG ,
B.RETURNABLE_FLAG ,
B.RETURN_INSPECTION_REQUIREMENT ,
B.OVER_SHIPMENT_TOLERANCE ,
B.UNDER_SHIPMENT_TOLERANCE ,
B.OVER_RETURN_TOLERANCE ,
B.UNDER_RETURN_TOLERANCE ,
B.INVOICEABLE_ITEM_FLAG ,
B.INVOICE_ENABLED_FLAG ,
B.ACCOUNTING_RULE_ID ,
B.INVOICING_RULE_ID ,
B.TAX_CODE ,
B.SALES_ACCOUNT ,
B.PAYMENT_TERMS_ID ,
B.SERVICE_ITEM_FLAG ,
B.VENDOR_WARRANTY_FLAG ,
B.COVERAGE_SCHEDULE_ID ,
B.SERVICE_DURATION ,
B.SERVICE_DURATION_PERIOD_CODE ,
B.SERVICEABLE_PRODUCT_FLAG ,
B.SERVICE_STARTING_DELAY ,
B.MATERIAL_BILLABLE_FLAG ,
B.TIME_BILLABLE_FLAG ,
B.EXPENSE_BILLABLE_FLAG ,
B.SERVICEABLE_COMPONENT_FLAG ,
B.PREVENTIVE_MAINTENANCE_FLAG ,
B.PRORATE_SERVICE_FLAG ,
B.SERVICEABLE_ITEM_CLASS_ID ,
B.BASE_WARRANTY_SERVICE_ID ,
B.WARRANTY_VENDOR_ID ,
B.MAX_WARRANTY_AMOUNT ,
B.RESPONSE_TIME_PERIOD_CODE ,
B.RESPONSE_TIME_VALUE ,
B.PRIMARY_SPECIALIST_ID ,
B.SECONDARY_SPECIALIST_ID ,
B.WH_UPDATE_DATE ,
B.SEGMENT1 ,
B.SEGMENT2 ,
B.SEGMENT3 ,
B.SEGMENT4 ,
B.SEGMENT5 ,
B.SEGMENT6 ,
B.SEGMENT7 ,
B.SEGMENT8 ,
B.SEGMENT9 ,
B.SEGMENT10 ,
B.SEGMENT11 ,
B.SEGMENT12 ,
B.SEGMENT13 ,
B.SEGMENT14 ,
B.SEGMENT15 ,
B.SEGMENT16 ,
B.SEGMENT17 ,
B.SEGMENT18 ,
B.SEGMENT19 ,
B.SEGMENT20 ,
B.SUMMARY_FLAG ,
B.ENABLED_FLAG ,
B.START_DATE_ACTIVE ,
B.END_DATE_ACTIVE ,
B.ATTRIBUTE_CATEGORY ,
B.ATTRIBUTE1 ,
B.ATTRIBUTE2 ,
B.ATTRIBUTE3 ,
B.ATTRIBUTE4 ,
B.ATTRIBUTE5 ,
B.ATTRIBUTE6 ,
B.ATTRIBUTE7 ,
B.ATTRIBUTE8 ,
B.ATTRIBUTE9 ,
B.ATTRIBUTE10 ,
B.ATTRIBUTE11 ,
B.ATTRIBUTE12 ,
B.ATTRIBUTE13 ,
B.ATTRIBUTE14 ,
B.ATTRIBUTE15 ,
b.attribute16 ,
b.attribute17 ,
b.attribute18 ,
b.attribute19 ,
b.attribute20 ,
b.attribute21 ,
b.attribute22 ,
b.attribute23 ,
b.attribute24 ,
b.attribute25 ,
b.attribute26 ,
b.attribute27 ,
b.attribute28 ,
b.attribute29 ,
b.attribute30 ,
B.GLOBAL_ATTRIBUTE_CATEGORY ,
B.GLOBAL_ATTRIBUTE1 ,
B.GLOBAL_ATTRIBUTE2 ,
B.GLOBAL_ATTRIBUTE3 ,
B.GLOBAL_ATTRIBUTE4 ,
B.GLOBAL_ATTRIBUTE5 ,
B.GLOBAL_ATTRIBUTE6 ,
B.GLOBAL_ATTRIBUTE7 ,
B.GLOBAL_ATTRIBUTE8 ,
B.GLOBAL_ATTRIBUTE9 ,
B.GLOBAL_ATTRIBUTE10 ,
B.EQUIPMENT_TYPE ,
B.RECOVERED_PART_DISP_CODE ,
B.DEFECT_TRACKING_ON_FLAG ,
B.USAGE_ITEM_FLAG ,
B.EVENT_FLAG ,
B.ELECTRONIC_FLAG ,
B.DOWNLOADABLE_FLAG ,
B.VOL_DISCOUNT_EXEMPT_FLAG ,
B.COUPON_EXEMPT_FLAG ,
B.COMMS_NL_TRACKABLE_FLAG ,
B.ASSET_CREATION_CODE ,
B.COMMS_ACTIVATION_REQD_FLAG ,
B.ORDERABLE_ON_WEB_FLAG ,
B.BACK_ORDERABLE_FLAG ,
B.WEB_STATUS ,
B.INDIVISIBLE_FLAG ,
B.DIMENSION_UOM_CODE ,
B.UNIT_LENGTH ,
B.UNIT_WIDTH ,
B.UNIT_HEIGHT ,
B.BULK_PICKED_FLAG ,
B.LOT_STATUS_ENABLED ,
B.DEFAULT_LOT_STATUS_ID ,
B.SERIAL_STATUS_ENABLED ,
B.DEFAULT_SERIAL_STATUS_ID ,
B.LOT_SPLIT_ENABLED ,
B.LOT_MERGE_ENABLED ,
B.INVENTORY_CARRY_PENALTY ,
B.OPERATION_SLACK_PENALTY ,
B.FINANCING_ALLOWED_FLAG ,
B.EAM_ITEM_TYPE ,
B.EAM_ACTIVITY_TYPE_CODE ,
B.EAM_ACTIVITY_CAUSE_CODE ,
B.EAM_ACT_NOTIFICATION_FLAG ,
B.EAM_ACT_SHUTDOWN_STATUS ,
B.DUAL_UOM_CONTROL ,
B.SECONDARY_UOM_CODE ,
B.DUAL_UOM_DEVIATION_HIGH ,
B.DUAL_UOM_DEVIATION_LOW ,
B.CONTRACT_ITEM_TYPE_CODE ,
B.SUBSCRIPTION_DEPEND_FLAG ,
B.SERV_REQ_ENABLED_CODE ,
B.SERV_BILLING_ENABLED_FLAG ,
B.SERV_IMPORTANCE_LEVEL ,
B.PLANNED_INV_POINT_FLAG ,
B.LOT_TRANSLATE_ENABLED ,
B.DEFAULT_SO_SOURCE_TYPE ,
B.CREATE_SUPPLY_FLAG ,
B.SUBSTITUTION_WINDOW_CODE ,
B.SUBSTITUTION_WINDOW_DAYS ,
B.IB_ITEM_INSTANCE_CLASS ,
B.CONFIG_MODEL_TYPE ,
B.LOT_SUBSTITUTION_ENABLED ,
B.MINIMUM_LICENSE_QUANTITY ,
B.EAM_ACTIVITY_SOURCE_CODE ,
B.LIFECYCLE_ID ,
B.CURRENT_PHASE_ID ,
B.OBJECT_VERSION_NUMBER ,
B.TRACKING_QUANTITY_IND ,
B.ONT_PRICING_QTY_SOURCE ,
B.SECONDARY_DEFAULT_IND ,
B.OPTION_SPECIFIC_SOURCED ,
B.APPROVAL_STATUS ,
B.VMI_MINIMUM_UNITS ,
B.VMI_MINIMUM_DAYS ,
B.VMI_MAXIMUM_UNITS ,
B.VMI_MAXIMUM_DAYS ,
B.VMI_FIXED_ORDER_QUANTITY ,
B.SO_AUTHORIZATION_FLAG ,
B.CONSIGNED_FLAG ,
B.ASN_AUTOEXPIRE_FLAG ,
B.VMI_FORECAST_TYPE ,
B.FORECAST_HORIZON ,
B.EXCLUDE_FROM_BUDGET_FLAG ,
B.DAYS_TGT_INV_SUPPLY ,
B.DAYS_TGT_INV_WINDOW ,
B.DAYS_MAX_INV_SUPPLY ,
B.DAYS_MAX_INV_WINDOW ,
B.DRP_PLANNED_FLAG ,
B.CRITICAL_COMPONENT_FLAG ,
B.CONTINOUS_TRANSFER ,
B.CONVERGENCE ,
B.DIVERGENCE ,
B.CONFIG_ORGS ,
B.CONFIG_MATCH ,
B.CREATION_DATE ,
B.CREATED_BY ,
B.LAST_UPDATE_DATE ,
B.LAST_UPDATED_BY ,
B.LAST_UPDATE_LOGIN ,
B.REQUEST_ID ,
B.PROGRAM_APPLICATION_ID ,
B.PROGRAM_ID ,
B.PROGRAM_UPDATE_DATE ,
T.DESCRIPTION ,
T.LONG_DESCRIPTION ,
B.CONCATENATED_SEGMENTS ,
B.PADDED_CONCATENATED_SEGMENTS ,
b.lot_divisible_flag,
b.grade_control_flag,
b.default_grade,
b.child_lot_flag,
b.parent_child_generation_flag,
b.child_lot_prefix,
b.child_lot_starting_number,
b.child_lot_validation_flag,
b.copy_lot_attribute_flag,
b.recipe_enabled_flag,
b.process_costing_enabled_flag,
b.retest_interval,
b.expiration_action_interval,
b.expiration_action_code,
b.maturity_days,
b.hold_days ,
b.process_quality_enabled_flag ,
b.process_execution_enabled_flag ,
b.process_supply_subinventory ,
b.process_supply_locator_id ,
b.process_yield_subinventory ,
b.process_yield_locator_id ,
b.hazardous_material_flag ,
b.cas_number ,
B.CHARGE_PERIODICITY_CODE,
B.REPAIR_LEADTIME,
B.REPAIR_YIELD,
B.PREPOSITION_POINT,
B.REPAIR_PROGRAM,
B.SUBCONTRACTING_COMPONENT,
B.OUTSOURCED_ASSEMBLY,
B.GDSN_OUTBOUND_ENABLED_FLAG,
B.TRADE_ITEM_DESCRIPTOR,
B.STYLE_ITEM_ID,
B.STYLE_ITEM_FLAG,
B.LAST_SUBMITTED_NIR_ID ,
B.GLOBAL_ATTRIBUTE11 ,
B.GLOBAL_ATTRIBUTE12 ,
B.GLOBAL_ATTRIBUTE13 ,
B.GLOBAL_ATTRIBUTE14 ,
B.GLOBAL_ATTRIBUTE15 ,
B.GLOBAL_ATTRIBUTE16 ,
B.GLOBAL_ATTRIBUTE17 ,
B.GLOBAL_ATTRIBUTE18 ,
B.GLOBAL_ATTRIBUTE19 ,
B.GLOBAL_ATTRIBUTE20
FROM MTL_SYSTEM_ITEMS_TL T ,
MTL_SYSTEM_ITEMS_B_KFV B
WHERE B.INVENTORY_ITEM_ID = T.INVENTORY_ITEM_ID
AND B.ORGANIZATION_ID = T.ORGANIZATION_ID
AND T.LANGUAGE = userenv('LANG')
/
-- one way to identfy the item master orgs
select master_organization_id FRom mtl_parameters group by master_organization_id;
select * FRom ra_customer_trx_lines_all where rownum < 20;
-- in some cases, items are coming from multiple master org.
select l.org_id, i.organization_id
FRom ra_customer_trx_lines_all l
, mtl_system_items_b i
where ORG_ID <> 204
and l.inventory_item_id = i.inventory_item_id
and i.organization_id in (select master_organization_id FRom mtl_parameters group by master_organization_id)
group by l.org_id, i.organization_id
/
select l.WAREHOUSE_ID , l.INTERFACE_LINE_ATTRIBUTE10, p.MASTER_ORGANIZATION_ID
From RA_CUSTOMER_TRX_LINES_ALL l
inner join OE_SYSTEM_PARAMETERS_ALL p
on l.org_id = p.org_id
where COALESCE(l.WAREHOUSE_ID,0) <> p.MASTER_ORGANIZATION_ID
and l.inventory_item_id is not null
group by l.WAREHOUSE_ID , l.INTERFACE_LINE_ATTRIBUTE10, p.MASTER_ORGANIZATION_ID
;
select count(*)
From RA_CUSTOMER_TRX_LINES_ALL l
where l.WAREHOUSE_ID is null;
select count(*) from RA_CUSTOMER_TRX_LINES_ALL where warehouse_id is null;
select * from MTL_SYSTEM_ITEMS_B where rownum < 10;
|
/*
Oracle
*/
SELECT ROUND(ABS(MAX(LAT_N) - MIN(LAT_N))
+ ABS(MAX(LONG_W) - MIN(LONG_W)), 4)
FROM STATION; |
create table IF NOT EXISTS OCCUPATIONS (name varchar(20),occupation varchar(20)) ;
insert into OCCUPATIONS value
('Samantha','Doctor'),
('Julia','Actor'),
('Maria','Actor'),
('Meera','Singer'),
('Ashely','Professor'),
('Ketty','Professor'),
('Christeen','Professor'),
('Jane','Actor'),
('Jenny','Doctor'),
('Priya','Singer');
set @r1=0,@r2=0,@r3=0,@r4=0;
select min(Doctor), min(Professor), min(Singer), min(Actor) from
(
select
case when occupation='Doctor' then name end as Doctor,
case when occupation='Actor' then name end as Actor,
case when occupation='Singer' then name end as Singer,
case when occupation='Professor' then name end as Professor,
case when occupation='Doctor' then @r1:=@r1+1
when occupation='Actor' then @r2:=@r2+1
when occupation='Singer' then @r3:=@r3+1
when occupation='Professor' then @r4:=@r4+1 end as Row_Num from OCCUPATIONS order by name) temp group by Row_Num; |
USE `arenafifadb`;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGetAllConfirmElencoProOfUsuario` $$
CREATE PROCEDURE `spGetAllConfirmElencoProOfUsuario`(
pIdTemporada INTEGER,
pIdManager INTEGER
)
begin
select C.*, DATE_FORMAT(C.DT_CONFIRMACAO,'%d/%m/%Y') as DT_CONFIRM_FORMATADA, U.NM_USUARIO, U.PSN_ID
from TB_CONFIRM_ELENCO_PRO C, TB_USUARIO U
where C.ID_TEMPORADA = pIdTemporada
and C.ID_USUARIO_MANAGER = pIdManager
and C.ID_USUARIO = U.ID_USUARIO
order by C.DT_CONFIRMACAO, C.ID_USUARIO;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spDeleteConfirmElencoPro` $$
CREATE PROCEDURE `spDeleteConfirmElencoPro`(
pIdTemporada INTEGER,
pIdManager INTEGER,
pIdJogador INTEGER
)
begin
delete from TB_CONFIRM_ELENCO_PRO
where ID_TEMPORADA = pIdTemporada
and ID_USUARIO_MANAGER = pIdManager
and ID_USUARIO = pIdJogador;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spDeleteConfirmElencoProOfManager` $$
CREATE PROCEDURE `spDeleteConfirmElencoProOfManager`(
pIdManager INTEGER
)
begin
delete from TB_CONFIRM_ELENCO_PRO
where ID_USUARIO_MANAGER = pIdManager;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spDeleteConfirmElencoProOfManagerTemporada` $$
CREATE PROCEDURE `spDeleteConfirmElencoProOfManager`(
pIdTemporada INTEGER,
pIdManager INTEGER
)
begin
delete from TB_CONFIRM_ELENCO_PRO
where ID_TEMPORADA = pIdTemporada,
and ID_USUARIO_MANAGER = pIdManager;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAddConfirmElencoPro` $$
CREATE PROCEDURE `spAddConfirmElencoPro`(
pIdTemporada INTEGER,
pIdManager INTEGER,
pPsnJogador VARCHAR(30)
)
begin
DECLARE _total INTEGER DEFAULT 0;
DECLARE _idJogador INTEGER DEFAULT NULL;
DECLARE _idClub INTEGER DEFAULT NULL;
select ID_USUARIO into _idJogador
from TB_USUARIO
where PSN_ID = pPsnJogador;
IF (_idJogador IS NULL) THEN
select '1' as COD_VALIDATION, 'Incorrect validation - PSN not found.' as DSC_VALIDATION;
ELSE
SET _idClub = fcGetCurrentIdTimePRO(pIdManager);
select count(1) into _total
from TB_CONFIRM_ELENCO_PRO
where ID_TEMPORADA = pIdTemporada
and ID_USUARIO_MANAGER = pIdManager
and ID_USUARIO = _idJogador;
IF _total > 0 THEN
select '2' as COD_VALIDATION, 'Incorrect validation - Player was found on your squad.' as DSC_VALIDATION;
ELSE
SET _total = 0;
select count(1) into _total
from TB_GOLEADOR
where ID_TIME <> _idClub
and ID_USUARIO = _idJogador;
IF _total > 0 THEN
select '3' as COD_VALIDATION, 'Incorrect validation - Player was found on another squad.' as DSC_VALIDATION;
ELSE
SET _total = 0;
select count(1) into _total
from TB_GOLEADOR
where ID_USUARIO = _idJogador;
IF _total > 0 THEN
select '4' as COD_VALIDATION, 'Incorrect validation - Player was found and he is playing for another team in this season.' as DSC_VALIDATION;
ELSE
insert into TB_CONFIRM_ELENCO_PRO (ID_TEMPORADA, ID_USUARIO_MANAGER, ID_USUARIO, DT_CONFIRMACAO)
values (pIdTemporada, pIdManager, _idJogador, NOW());
select '0' as COD_VALIDATION, 'Validation done successfully.' as DSC_VALIDATION;
END IF;
END IF;
END IF;
END IF;
End$$
DELIMITER ;
|
/*
Name: Login errors by Category
Data source: 4
Created By: Admin
Last Update At: 2016-09-01T13:35:05.090204+00:00
*/
SELECT nvl(LE.Category, v.Error) AS Category_error,
REGEXP_REPLACE(nvl(LE.Category, v.Error), r'\s+', '_') as Category_parameter,
count(*) AS Logins
FROM
(SELECT post_prop28,
nvl(REGEXP_EXTRACT(post_prop28,r'^.*\|(.*)$'),'Error Not Defined') as Error,
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")'))
WHERE (post_prop23 = 'User Login Failed')
AND DATE(date_time) >= DATE('{{startdate}}')
AND DATE(date_time) <= DATE('{{enddate}}')
AND DATE(date_time) >= DATE('2016-07-26')
AND post_page_event = "100") AS v
LEFT JOIN [djomniture:devspark.MG_ACS_Errors] AS LE ON LE.Message = v.Error
GROUP BY Category_error,Category_parameter
ORDER BY Logins DESC
|
ALTER TABLE endret_utbetaling_andel
ADD COLUMN vedtak_begrunnelse_spesifikasjoner TEXT DEFAULT ''; |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 25 Des 2020 pada 11.29
-- Versi Server: 10.1.28-MariaDB
-- PHP Version: 7.1.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: `toko_online`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_barang`
--
CREATE TABLE `tb_barang` (
`id_brg` int(11) NOT NULL,
`nama_brg` varchar(120) NOT NULL,
`keterangan` varchar(256) NOT NULL,
`kategori` varchar(60) NOT NULL,
`harga` int(11) NOT NULL,
`stok` int(11) NOT NULL,
`gambar` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tb_barang`
--
INSERT INTO `tb_barang` (`id_brg`, `nama_brg`, `keterangan`, `kategori`, `harga`, `stok`, `gambar`) VALUES
(1, 'Sepatu', 'Sepatu Merk All Star', 'Pakaian Pria', 300000, 9, 'sepatu.jpg'),
(2, 'Smartphone', 'Vivo', 'Elektronik', 1500000, 3, 'hp.jpg'),
(3, 'Camera', 'Cannon', 'Elektronik', 2000000, 3, 'kamera.jpg'),
(4, 'Laptop Acer', 'Ram 4Gb', 'Elektronik', 4000000, 3, 'laptop.jpg'),
(5, 'Dress Aqila', 'Bahan Katun', 'Pakaian Anak Anak', 150000, 20, 'aqila.jpg'),
(6, 'Blouse Wanita', 'Baju', 'Pakaian Wanita', 150000, 5, 'blouse.jpg'),
(7, 'Bola basket', 'Molten', 'Peralatan olahraga', 300000, 5, 'basket.jpg'),
(8, 'Kameja Alonzo', 'Bahan Terbaik', 'Pakaian Pria', 200000, 20, 'alonzo1.jpg');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_invoice`
--
CREATE TABLE `tb_invoice` (
`id` int(11) NOT NULL,
`nama` varchar(60) NOT NULL,
`alamat` varchar(225) NOT NULL,
`tgl_pesan` datetime NOT NULL,
`batas_bayar` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tb_invoice`
--
INSERT INTO `tb_invoice` (`id`, `nama`, `alamat`, `tgl_pesan`, `batas_bayar`) VALUES
(1, 'Nuryana', 'Wado', '2020-06-14 04:07:22', '2020-06-15 04:07:22');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_pesanan`
--
CREATE TABLE `tb_pesanan` (
`id` int(11) NOT NULL,
`id_invoice` int(11) NOT NULL,
`id_brg` int(11) NOT NULL,
`nama_brg` varchar(100) NOT NULL,
`jumlah` varchar(3) NOT NULL,
`harga` int(10) NOT NULL,
`pilihan` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tb_pesanan`
--
INSERT INTO `tb_pesanan` (`id`, `id_invoice`, `id_brg`, `nama_brg`, `jumlah`, `harga`, `pilihan`) VALUES
(1, 1, 1, 'Sepatu', '2', 300000, ''),
(2, 1, 2, 'Smartphone', '1', 1500000, ''),
(3, 1, 3, 'Camera', '1', 2000000, ''),
(4, 1, 4, 'Tv Plasma 41 Inc', '1', 4000000, ''),
(5, 3, 4, 'Tv Plasma 41 Inc', '1', 4000000, ''),
(6, 4, 3, 'Camera', '1', 2000000, ''),
(7, 4, 4, 'Tv Plasma 41 Inc', '3', 4000000, ''),
(8, 5, 2, 'Smartphone', '3', 1500000, ''),
(9, 6, 1, 'Sepatu', '1', 300000, ''),
(10, 7, 2, 'Smartphone', '2', 1500000, ''),
(11, 8, 3, 'Camera', '2', 2000000, '');
--
-- Trigger `tb_pesanan`
--
DELIMITER $$
CREATE TRIGGER `pesanan_penjualan` AFTER INSERT ON `tb_pesanan` FOR EACH ROW BEGIN
UPDATE tb_barang SET stok = stok-NEW.jumlah
WHERE id_brg = NEW.id_brg;
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_user`
--
CREATE TABLE `tb_user` (
`id` int(11) NOT NULL,
`nama` varchar(100) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(50) NOT NULL,
`role_id` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tb_user`
--
INSERT INTO `tb_user` (`id`, `nama`, `username`, `password`, `role_id`) VALUES
(1, 'admin', 'admin', '123', 1),
(2, 'user', 'user', '123', 2),
(3, 'nuryana', 'nuryana', '1234', 1),
(4, 'refsi', 'refsi', '12345', 2),
(5, 'bud', 'bud', '123', 2);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tb_barang`
--
ALTER TABLE `tb_barang`
ADD PRIMARY KEY (`id_brg`);
--
-- Indexes for table `tb_invoice`
--
ALTER TABLE `tb_invoice`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_pesanan`
--
ALTER TABLE `tb_pesanan`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tb_user`
--
ALTER TABLE `tb_user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tb_barang`
--
ALTER TABLE `tb_barang`
MODIFY `id_brg` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tb_invoice`
--
ALTER TABLE `tb_invoice`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tb_pesanan`
--
ALTER TABLE `tb_pesanan`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `tb_user`
--
ALTER TABLE `tb_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TABLE IF NOT EXISTS titles (
TitleID VARCHAR,
Title VARCHAR NOT NULL,
PRIMARY KEY (TitleID)
);
CREATE TABLE IF NOT EXISTS employees (
EmployeeID INT,
TitleID VARCHAR NOT NULL,
BirthDate DATE,
FirstName VARCHAR NOT NULL,
LastName VARCHAR NOT NULL,
Sex VARCHAR NOT NULL,
HireDate DATE,
PRIMARY KEY (EmployeeID),
FOREIGN KEY (TitleID) REFERENCES titles(TitleID)
);
CREATE TABLE IF NOT EXISTS salaries (
EmployeeID INT NOT NULL,
Salary MONEY NOT NULL,
FOREIGN KEY (EmployeeID) REFERENCES employees(EmployeeID),
PRIMARY KEY (EmployeeID)
);
CREATE TABLE IF NOT EXISTS dep_type (
DepartmentID VARCHAR NOT NULL,
DepartmentName VARCHAR NOT NULL,
PRIMARY KEY (DepartmentID)
);
CREATE TABLE IF NOT EXISTS dep_emp (
EmployeeID INT,
DepartmentID VARCHAR NOT NULL,
FOREIGN KEY (EmployeeID) REFERENCES employees(EmployeeID),
FOREIGN KEY (DepartmentID) REFERENCES dep_type(DepartmentID),
PRIMARY KEY (EmployeeID, DepartmentID)
);
CREATE TABLE IF NOT EXISTS dep_man (
DepartmentID VARCHAR NOT NULL,
EmployeeID INT NOT NULL,
FOREIGN KEY (EmployeeID) REFERENCES employees(EmployeeID),
FOREIGN KEY (DepartmentID) REFERENCES dep_type(DepartmentID),
PRIMARY KEY (EmployeeID, DepartmentID)
); |
CREATE VIEW calls_by_status AS
SELECT project_issue.stage_id AS
id, count(project_issue.stage_id) AS nooftickets,
(SELECT task.name FROM project_task_type task WHERE (project_issue.stage_id = task.id)) AS stage
FROM project_issue
WHERE ((project_issue.state)::text <> ALL ((ARRAY['done'::character varying, 'cancelled'::character varying])::text[]))
GROUP BY project_issue.stage_id;
|
create database OnlineClinic
create table Doctor(
Doc_Id int not null identity(1,1) primary key,
Doc_Name nvarchar(30) not null,
Doc_Specialty nvarchar(30),
Doc_CNIC int,
Doc_Contact# int,
Activity_Id int,
Food_Id int,
Heart_Id int,
/*constraint pk_Doc_Id primary key(Doc_Id),*/
)
Alter table Doctor add constraint Doctor_Activity_Id_FK
Foreign Key (Activity_Id) references Physical_Activity(Activity_Id)
Alter table Doctor add constraint Doctor_Food_Id_FK
Foreign Key (Food_Id) references Nutrition(Food_Id)
Alter table Doctor add constraint Doctor_Heart_Id_FK
Foreign Key (Heart_Id) references Heart(Heart_Id)
create table Patient(
Patient_Id int not null identity(1,1) primary key,
Patient_Name nvarchar(30) not null,
Patient_CNIC int,
Patient_BloodGroup nvarchar(30),
Patient_Age nvarchar(30),
Patient_Adress nvarchar(50),
Patient_Contact# int,
Doc_Id int,
Gender_Id int,
Activity_Id int,
Food_Id int,
Heart_Id int,
)
Alter table Patient add constraint Patient_Doc_Id_FK
Foreign Key (Doc_Id) references Doctor(Doc_Id)
Alter table Patient add constraint Patient_Gender_Id_FK
Foreign Key (Gender_Id) references Gender(Gender_Id)
Alter table Patient add constraint Patient_Activity_Id_FK
Foreign Key (Activity_Id) references Physical_Activity(Activity_Id)
Alter table Patient add constraint Patient_Food_Id_FK
Foreign Key (Food_Id) references Nutrition(Food_Id)
create table Gender(
Gender_Id int not null identity(1,1) primary key,
Male nvarchar(30),
Female nvarchar(30),
Other nvarchar(30),
)
create table Heart(
Heart_Id int not null identity(1,1) primary key,
Heart_Rate nvarchar(50),
[Time] time,
[Date] date,
)
create table Physical_Activity(
Activity_Id int not null identity(1,1) primary key,
Activity_TypeId int,/*Foreign key*/
Activity_Date date,
Calories nvarchar(30),
StartTime nvarchar(30),
EndTime nvarchar(30),
)
Alter table Physical_Activity add constraint Patient_Activity_Activity_TypeId_FK
Foreign Key (Activity_TypeId) references Activity_Type(Activity_TypeId)
create table Activity_Type(
Activity_TypeId int not null identity(1,1) primary key,
Running nvarchar(30),
walking nvarchar(30),
)
create table Nutrition(
Food_Id int not null identity(1,1) primary key,
Food_Name nvarchar(50) not null,
Food_Calories nvarchar(30),
Food_Protien nvarchar(30),
Food_Carbohydrates nvarchar(30),
Food_Cholestrol nvarchar(30)
)
select * from Doctor
select * from Patient
select * from Gender
select * from Heart
select * from Physical_Activity
select * from Activity_Type
select * from Nutrition
|
-- Adminer 4.6.2 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP DATABASE IF EXISTS `sih`;
CREATE DATABASE `sih` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `sih`;
DROP TABLE IF EXISTS `action`;
CREATE TABLE `action` (
`actionid` int(10) NOT NULL AUTO_INCREMENT,
`taskid` int(10) NOT NULL,
`imgid1` int(10) NOT NULL,
`imgid2` int(10) NOT NULL,
`h` int(3) NOT NULL,
`v` int(3) NOT NULL,
`status` int(3) NOT NULL,
`result` text NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`actionid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `clients`;
CREATE TABLE `clients` (
`cid` int(10) NOT NULL AUTO_INCREMENT,
`chash` varchar(40) NOT NULL,
`last_active` varchar(15) NOT NULL,
`status` int(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `client_action`;
CREATE TABLE `client_action` (
`caid` bigint(30) NOT NULL AUTO_INCREMENT,
`cid` bigint(20) NOT NULL,
`aid` bigint(20) NOT NULL,
`started` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`stopped` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`caid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `outputs`;
CREATE TABLE `outputs` (
`did` bigint(20) NOT NULL AUTO_INCREMENT,
`taskid` bigint(20) NOT NULL,
`imgid1` bigint(20) NOT NULL,
`imgid2` bigint(20) NOT NULL,
`actid` bigint(20) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`isfinal` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`did`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `pending`;
CREATE TABLE `pending` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`task_id` int(10) NOT NULL,
`oname` varchar(100) NOT NULL,
`name_hash` varchar(33) NOT NULL,
`time` int(10) NOT NULL,
`ext` varchar(10) NOT NULL,
`staged` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `staged`;
CREATE TABLE `staged` (
`stage_id` bigint(20) NOT NULL AUTO_INCREMENT,
`task_id` bigint(20) NOT NULL,
`img_id` bigint(20) NOT NULL,
`h_splits` bigint(20) NOT NULL DEFAULT '9',
`v_splits` bigint(20) NOT NULL DEFAULT '9',
`status` tinyint(1) NOT NULL,
PRIMARY KEY (`stage_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `tasks`;
CREATE TABLE `tasks` (
`taskid` int(10) NOT NULL AUTO_INCREMENT,
`oname` varchar(500) NOT NULL,
`hashname` varchar(32) NOT NULL,
`created` int(10) NOT NULL,
`completed` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`taskid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- 2018-03-31 02:17:25 |
CREATE TABLE `book` (
`book_id` INT(11) UNSIGNED NOT NULL,
`name` TEXT DEFAULT NULL,
`bookclass` TEXT DEFAULT NULL,
`keywords` TEXT DEFAULT NULL,
`weight` TEXT DEFAULT NULL,
`content` LONGTEXT DEFAULT NULL,
PRIMARY KEY (`book_id`)
) CHARACTER SET = 'UTF8';
|
DELETE FROM Students;
SELECT * FROM Students; |
select *
from products
where type = 'headset';
|
-- Table definitions for the tournament project.
DROP DATABASE IF EXISTS tournament;
CREATE DATABASE tournament;
\c tournament;
CREATE TABLE a_user ( id SERIAL,
name TEXT,
email TEXT,
photo TEXT,
PRIMARY KEY (id) );
CREATE TABLE tournaments ( name TEXT,
id SERIAL,
user_id INTEGER REFERENCES a_user (id),
PRIMARY KEY (id) );
CREATE TABLE players ( name TEXT,
id SERIAL,
tournament_id INTEGER REFERENCES tournaments (id) ON DELETE CASCADE,
PRIMARY KEY (id) );
CREATE TABLE matches ( winner INTEGER REFERENCES players (id) ON DELETE CASCADE,
loser INTEGER REFERENCES players (id) ON DELETE CASCADE,
round_is_complete BOOLEAN );
CREATE VIEW matches_from_completed_rounds AS
SELECT
*
FROM
matches
WHERE
round_is_complete = true;
-- show how each player is doing sorted by number of games played and wins
CREATE VIEW standings AS
SELECT
player_wins.id,
player_wins.name,
SUM(player_wins.wins) AS wins,
SUM(player_loses.loses)+SUM(player_wins.wins) AS totalplayed,
player_wins.tournament_id
FROM
-- add up wins for each player (players may appear twice)
(
SELECT
players.id, players.name, COUNT(matches_from_completed_rounds.winner) AS wins, players.tournament_id
FROM
players
LEFT JOIN
matches_from_completed_rounds
ON players.id = matches_from_completed_rounds.winner
GROUP BY players.id, players.name
)
AS player_wins
LEFT JOIN
-- add up loses for each player
(
SELECT
players.id, COUNT(matches_from_completed_rounds.loser) AS loses
FROM
players
LEFT JOIN
matches_from_completed_rounds
ON players.id = matches_from_completed_rounds.loser
GROUP BY players.id
)
AS player_loses
ON player_wins.id = player_loses.id
GROUP BY player_wins.id, player_wins.name, player_wins.tournament_id
ORDER BY SUM(player_wins.wins), player_wins.tournament_id DESC; |
SELECT cohorts.name as cohort, AVG(completed_at - started_at) as average
FROM students JOIN assistance_requests ON students.id = student_id
JOIN cohorts ON cohorts.id = cohort_id
GROUP BY cohort
ORDER BY average DESC
limit 1; |
--
-- Table structure for table `#__mxcalendar_categories`
--
CREATE TABLE IF NOT EXISTS `#__mxcalendar_categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`isdefault` tinyint(1) NOT NULL DEFAULT '0',
`name` varchar(256) NOT NULL,
`foregroundcss` varchar(256) DEFAULT NULL,
`backgroundcss` varchar(256) DEFAULT NULL,
`inlinecss` tinytext,
`disable` INT NOT NULL DEFAULT '0',
`active` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ##
--
-- Dumping data for table `#__mxcalendar_categories`
--
INSERT INTO `#__mxcalendar_categories` (`id`, `isdefault`, `name`, `foregroundcss`, `backgroundcss`, `inlinecss`, `disable`, `active`) VALUES
(1, 1, 'General', '', '', '', 0, 1)##
--
-- Table structure for table `#__mxcalendar_config`
--
CREATE TABLE IF NOT EXISTS `#__mxcalendar_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`param` varchar(256) NOT NULL,
`value` text DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=35 ##
--
-- Dumping data for table `#__mxcalendar_config`
--
INSERT INTO `#__mxcalendar_config` (`id`, `param`, `value`) VALUES
(1, 'disptooltip', '0'),
(2, 'liststyle_limit', '5'),
(3, 'dispduration', '0'),
(4, 'dispeventtime', '0'),
(5, 'enableprevnext', '1'),
(6, 'useajax', '1'),
(7, 'calSMwidth', '125px'),
(8, 'calFULLwidth', '100%'),
(9, 'calstartday', '0'),
(10, 'calweekends', '0'),
(11, 'caltdbordercss', '666666'),
(12, 'caldatestampbgcss', 'CCCCCC'),
(13, 'caldatestamptxtcss', '000000'),
(14, 'GOOGLE_MAPS_HOST', 'maps.google.com'),
(15, 'GOOGLE_MAPS_KEY', ''),
(16, 'eventlist_multiday', '1'),
(17, 'mxcEventDetailId', ''),
(18, 'mxcEventDetailClass', ''),
(19, 'mxCalendarTheme', 'default'),
(20, 'mxcEventDetailBackBtnClass', 'bsCalBack'),
(21, 'mxcCalendarActiveDayClass', 'today'),
(22, 'mxcCalendarActiveDayDisplay', '0'),
(23, 'mxcEventDetailId', ''),
(24, 'mxcEventDetailClass', 'event'),
(25, 'mxcEventDetailLabelDateTime', ''),
(26, 'mxcEventDetailLabelLocation', ''),
(27, 'mgrAddClockTwentryFourHour', '0'),
(28, 'mxcEventDetailLabelHeading', ''),
(29, 'mxcLabelEventListMoreLink', ''),
(30, 'mxcEventDetailBackBtnClass', ''),
(31, 'mxcEventDetailBackBtnTitle', ''),
(32, 'mxcEventListItemId', ''),
(33, 'mxcEventListEventClass', 'event'),
(34, 'mxcEventListLabelLocation', ''),
(35, 'mxcGoogleMapDisplayCanvasID', 'map_canvas'),
(36, 'mxcGoogleMapDisplayWidth', '250px'),
(37, 'mxcGoogleMapDisplayHeigh', '250px'),
(38, 'mxcGoogleMapDisplayLngLat', '0'),
(39, 'mxcLocalization', ''),
(40, 'mxcGetCategoryListUIFilterLabel', 'Categories'),
(41, 'mxcGetCategoryListUIFilterLabelTag', 'H3'),
(42, 'mxcGetCategoryListUIFilterLabelTagClass', 'mxcCategoryHeading'),
(43, 'mxcGetCategoryListUIFilterType', 'list'),
(44,'mxcEventListItemMultiDayStyle','font-size:70%'),
(45,'mxcGetCategoryListUIFilterActive','1'),
(46,'mxcEventListItemStateDateStamp','%I:%M %p'),
(47,'mxcEventListItemEndDateStamp','%I:%M %p'),
(48,'mxcAdvancedDateEntry','0'),
(49,'mxcJSCodeSource','http://ajax.googleapis.com/ajax/libs/mootools/1.1/mootools.js'),
(50,'mxcJSCodeLibrary',''),
(51,'mxcMonthInnerHeadingRowID',''),
(52,'mxcMonthInnerHeadingRowClass',''),
(53,'mxcMonthListTodayOnly','0'),
(54,'mxcMonthHasEventClass','hasevents'),
(55,'mxcCustomFieldTypes',''),
(56,'mxcEventDetailStateDateStamp','%b %e'),
(57,'mxcEventDetailStateTimeStamp','%I:%M %p'),
(58,'mxcEventDetailEndDateStamp','%b %e'),
(59,'mxcEventDetailEndTimeStamp','%I:%M %p'),
(60,'mxcEventMonthUrlClass','tt mxModal'),
(61,'mxcEventMonthUrlStyle','color:inherit;display:block;position:relative;padding:3px;'),
(62,'mxcMonthNoEventClass','mxcDayNoEvents')##
--
-- Table structure for table `#__mxcalendar_events`
--
CREATE TABLE IF NOT EXISTS `#__mxcalendar_events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(256) NOT NULL,
`description` text NOT NULL,
`category` tinyint(3) NOT NULL DEFAULT '1',
`restrictedwebusergroup` VARCHAR(128) NULL DEFAULT NULL,
`link` text,
`linkrel` text,
`linktarget` text,
`location` text,
`displayGoogleMap` tinyint(1) NOT NULL DEFAULT '0',
`start` datetime NOT NULL,
`startdate` date NOT NULL,
`starttime` time NOT NULL,
`end` datetime NOT NULL,
`enddate` date NOT NULL,
`endtime` time NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`repeat` text,
`lastrepeat` varchar(19) DEFAULT NULL,
`event_occurance` varchar(1) DEFAULT NULL,
`_occurance_wkly` varchar(10) DEFAULT NULL,
`event_occurance_rep` tinyint(2) DEFAULT NULL,
`_occurance_properties` varchar(68) DEFAULT NULL,
`customFields` TEXT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=99##
--
-- Table structure for table `#__mxcalendar_pastevents`
--
CREATE TABLE IF NOT EXISTS `#__mxcalendar_pastevents` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(256) NOT NULL,
`description` text NOT NULL,
`category` tinyint(3) NOT NULL DEFAULT '1',
`restrictedwebusergroup` VARCHAR(128) NULL DEFAULT NULL,
`link` text,
`linkrel` text,
`linktarget` text,
`location` text,
`displayGoogleMap` tinyint(1) NOT NULL DEFAULT '0',
`start` datetime NOT NULL,
`startdate` date NOT NULL,
`starttime` time NOT NULL,
`end` datetime NOT NULL,
`enddate` date NOT NULL,
`endtime` time NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`repeat` text,
`lastrepeat` varchar(19) DEFAULT NULL,
`event_occurance` varchar(1) DEFAULT NULL,
`_occurance_wkly` varchar(10) DEFAULT NULL,
`event_occurance_rep` tinyint(2) DEFAULT NULL,
`_occurance_properties` varchar(68) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1##
|
DROP DATABASE IF EXISTS `game`;
CREATE DATABASE `game`;
USE game;
CREATE TABLE characters
(
id int (5) NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
health int(5) NOT NULL,
sanity int(10) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE spaceships
(
id int (5) NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
shields int(10) NOT NULL,
PRIMARY KEY (id)
); |
/* Grouping Sets*/
SELECT o.type AS ObjectType,
s.name AS SchemeName,
COUNT(*)
FROM sys.objects o
JOIN sys.schemas s ON o.schema_id = s.schema_id
GROUP BY GROUPING SETS((o.type), (s.name), (), (o.type, s.name));
/*The CUBE clause accepts a list of expressions as
inputs and defines all possible grouping sets that can be generated from the inputs—including
the empty grouping set.
Equal with CUBE:*/
SELECT o.type AS ObjectType,
s.name AS SchemeName,
COUNT(*)
FROM sys.objects o
JOIN sys.schemas s ON o.schema_id = s.schema_id
GROUP BY CUBE(o.type, s.name); |
ALTER TABLE classes
DROP COLUMN published_at; |
use starwars;
INSERT INTO starwarsapp_person (id, name) VALUES (1, 'Luke Skywalker');
INSERT INTO starwarsapp_person (id, name) VALUES (2, 'C-3PO');
INSERT INTO starwarsapp_person (id, name) VALUES (3, 'R2-D2');
INSERT INTO starwarsapp_person (id, name) VALUES (4, 'Darth Vader');
INSERT INTO starwarsapp_person (id, name) VALUES (5, 'Leia Organa');
INSERT INTO starwarsapp_person (id, name) VALUES (6, 'Owen Lars');
INSERT INTO starwarsapp_person (id, name) VALUES (7, 'Beru Whitesun lars');
INSERT INTO starwarsapp_person (id, name) VALUES (8, 'R5-D4');
INSERT INTO starwarsapp_person (id, name) VALUES (9, 'Biggs Darklighter');
INSERT INTO starwarsapp_person (id, name) VALUES (10, 'Obi-Wan Kenobi');
INSERT INTO starwarsapp_person (id, name) VALUES (11, 'Anakin Skywalker');
INSERT INTO starwarsapp_person (id, name) VALUES (12, 'Wilhuff Tarkin');
INSERT INTO starwarsapp_person (id, name) VALUES (13, 'Chewbacca');
INSERT INTO starwarsapp_person (id, name) VALUES (14, 'Han Solo');
INSERT INTO starwarsapp_film (id, name, opening, director, release_date) VALUES(1, 'A New Hope', 'It is a period of civil war.
Rebel spaceships, striking
from a hidden base, have won
their first victory against
the evil Galactic Empire.
During the battle, Rebel
spies managed to steal secret
plans to the Empire''s
ultimate weapon, the DEATH
STAR, an armored space
station with enough power
to destroy an entire planet.
Pursued by the Empire''s
sinister agents, Princess
Leia races home aboard her
starship, custodian of the
stolen plans that can save her
people and restore
freedom to the galaxy....', 'George Lucas', '1977-05-25');
INSERT INTO starwarsapp_film (id, name, opening, director, release_date) VALUES(2, 'The Empire Strikes Back', 'It is a dark time for the
Rebellion. Although the Death
Star has been destroyed,
Imperial troops have driven the
Rebel forces from their hidden
base and pursued them across
the galaxy.
Evading the dreaded Imperial
Starfleet, a group of freedom
fighters led by Luke Skywalker
has established a new secret
base on the remote ice world
of Hoth.
The evil lord Darth Vader,
obsessed with finding young
Skywalker, has dispatched
thousands of remote probes into
the far reaches of space....', 'Irvin Kershner', '1980-05-17');
INSERT INTO starwarsapp_film (id, name, opening, director, release_date) VALUES(3, 'Return of the Jedi', 'Luke Skywalker has returned to
his home planet of Tatooine in
an attempt to rescue his
friend Han Solo from the
clutches of the vile gangster
Jabba the Hutt.
Little does Luke know that the
GALACTIC EMPIRE has secretly
begun construction on a new
armored space station even
more powerful than the first
dreaded Death Star.
When completed, this ultimate
weapon will spell certain doom
for the small band of rebels
struggling to restore freedom
to the galaxy...', 'Richard Marquand', '1983-05-25');
INSERT INTO starwarsapp_film (id, name, opening, director, release_date) VALUES(4, 'The Phantom Menace', 'Turmoil has engulfed the
Galactic Republic. The taxation
of trade routes to outlying star
systems is in dispute.
Hoping to resolve the matter
with a blockade of deadly
battleships, the greedy Trade
Federation has stopped all
shipping to the small planet
of Naboo.
While the Congress of the
Republic endlessly debates
this alarming chain of events,
the Supreme Chancellor has
secretly dispatched two Jedi
Knights, the guardians of
peace and justice in the
galaxy, to settle the conflict....', 'George Lucas', '1999-05-19');
INSERT INTO starwarsapp_film (id, name, opening, director, release_date) VALUES(5, 'Attack of the Clones', 'There is unrest in the Galactic
Senate. Several thousand solar
systems have declared their
intentions to leave the Republic.
This separatist movement,
under the leadership of the
mysterious Count Dooku, has
made it difficult for the limited
number of Jedi Knights to maintain
peace and order in the galaxy.
Senator Amidala, the former
Queen of Naboo, is returning
to the Galactic Senate to vote
on the critical issue of creating
an ARMY OF THE REPUBLIC
to assist the overwhelmed
Jedi....', 'George Lucas', '2002-05-16');
INSERT INTO starwarsapp_film (id, name, opening, director, release_date) VALUES(6, 'Revenge of the Sith', 'War! The Republic is crumbling
under attacks by the ruthless
Sith Lord, Count Dooku.
There are heroes on both sides.
Evil is everywhere.
In a stunning move, the
fiendish droid leader, General
Grievous, has swept into the
Republic capital and kidnapped
Chancellor Palpatine, leader of
the Galactic Senate.
As the Separatist Droid Army
attempts to flee the besieged
capital with their valuable
hostage, two Jedi Knights lead a
desperate mission to rescue the
captive Chancellor....', 'George Lucas', '2005-05-19');
INSERT INTO starwarsapp_film (id, name, opening, director, release_date) VALUES(7, 'The Force Awakens', 'Luke Skywalker has vanished.
In his absence, the sinister
FIRST ORDER has risen from
the ashes of the Empire
and will not rest until
Skywalker, the last Jedi,
has been destroyed.
With the support of the
REPUBLIC, General Leia Organa
leads a brave RESISTANCE.
She is desperate to find her
brother Luke and gain his
help in restoring peace and
justice to the galaxy.
Leia has sent her most daring
pilot on a secret mission
to Jakku, where an old ally
has discovered a clue to
Luke''s whereabouts....', 'J. J. Abrams', '2015-12-11');
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 1);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 2);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 3);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 4);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 5);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 6);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 7);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 8);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 9);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 10);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 12);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 13);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (1, 14);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (2, 1);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (2, 2);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (2, 3);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (2, 4);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (2, 5);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (2, 10);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (2, 13);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (2, 14);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (3, 1);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (3, 2);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (3, 3);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (3, 4);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (3, 5);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (3, 10);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (3, 13);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (3, 14);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (4, 2);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (4, 3);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (4, 10);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (4, 11);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (5, 2);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (5, 3);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (5, 6);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (5, 7);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (5, 10);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (5, 11);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 1);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 2);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 3);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 4);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 5);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 6);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 7);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 10);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 11);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 12);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (6, 13);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (7, 1);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (7, 3);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (7, 5);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (7, 13);
INSERT INTO starwarsapp_film_people (film_id, person_id) VALUES (7, 14);
INSERT INTO starwarsapp_image (id, hash) VALUES (1, 'AnakinSkywalker1');
INSERT INTO starwarsapp_image (id, hash) VALUES (2, 'AnakinSkywalker2');
INSERT INTO starwarsapp_image (id, hash) VALUES (3, 'BeruWhitesun');
INSERT INTO starwarsapp_image (id, hash) VALUES (4, 'BiggsDarklighter1');
INSERT INTO starwarsapp_image (id, hash) VALUES (5, 'BiggsDarklighter2');
INSERT INTO starwarsapp_image (id, hash) VALUES (6, 'C3po1');
INSERT INTO starwarsapp_image (id, hash) VALUES (7, 'C3po2');
INSERT INTO starwarsapp_image (id, hash) VALUES (8, 'Chewbacca1');
INSERT INTO starwarsapp_image (id, hash) VALUES (9, 'Chewbacca2');
INSERT INTO starwarsapp_image (id, hash) VALUES (10, 'DarkVader1');
INSERT INTO starwarsapp_image (id, hash) VALUES (11, 'DarkVader2');
INSERT INTO starwarsapp_image (id, hash) VALUES (12, 'HanSolo1');
INSERT INTO starwarsapp_image (id, hash) VALUES (13, 'LeiaOrdanaOld2');
INSERT INTO starwarsapp_image (id, hash) VALUES (14, 'LeiaOrdanaYoung1');
INSERT INTO starwarsapp_image (id, hash) VALUES (15, 'LukeOld2');
INSERT INTO starwarsapp_image (id, hash) VALUES (16, 'LukeYoung1');
INSERT INTO starwarsapp_image (id, hash) VALUES (17, 'ObiWanKenobi1');
INSERT INTO starwarsapp_image (id, hash) VALUES (18, 'ObiWanKenobi2');
INSERT INTO starwarsapp_image (id, hash) VALUES (19, 'OwenLars1');
INSERT INTO starwarsapp_image (id, hash) VALUES (20, 'OwenLars2');
INSERT INTO starwarsapp_image (id, hash) VALUES (21, 'R2D21');
INSERT INTO starwarsapp_image (id, hash) VALUES (22, 'R2D22');
INSERT INTO starwarsapp_image (id, hash) VALUES (23, 'R5D41');
INSERT INTO starwarsapp_image (id, hash) VALUES (24, 'R5D42');
INSERT INTO starwarsapp_image (id, hash) VALUES (25, 'WilhuffTarkin1');
INSERT INTO starwarsapp_image (id, hash) VALUES (26, 'WilhuffTarkin2');
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (11, 1);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (11, 2);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (7, 3);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (9, 4);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (9, 5);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (2, 6);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (2, 7);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (13, 8);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (13, 9);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (4, 10);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (4, 11);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (14, 12);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (5, 13);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (5, 14);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (1, 15);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (1, 16);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (10, 17);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (10, 18);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (6, 19);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (6, 20);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (3, 21);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (3, 22);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (8, 23);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (8, 24);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (12, 25);
INSERT INTO starwarsapp_person_images (person_id, image_id) VALUES (12, 26);
|
insert into item values
(1, '堅牢な机', 3000,1),
(2, '生焼け肉', 50, 2),
(3, 'すっきりわかるJava入門', 3000, 3),
(4, 'おしゃれな椅子', 2000, 1),
(5, 'こんがり肉', 500, 2),
(6, '書き方ドリルSQL', 2500, 3),
(7, 'ふわふわのベッド', 30000, 1),
(8, 'ミラノ風ドリア', 300, 2);
|
-------------------------------下单用户------------------------------------------
--2017.10.01 - 2017.10.31下单的用户
select substr(ordertime,1,10),count(distinct uid) from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and substr(ordertime,1,10) >= '2017-10-01'
and substr(ordertime,1,10) <= '2017-10-31'
and agent = 0
group by substr(ordertime,1,10)
-------------------------------下单新客------------------------------------------
--2017.10.01-2017.10.31下单的新客
select ordertime,count(distinct uid) from
(select uid,ordertime,row_number() over(partition by uid order by ordertime) as rn from
(select uid,substr(ordertime,1,10) as ordertime from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0
) a
) b
where rn = 1
and substr(ordertime,1,10) >= '2017-10-01'
and substr(ordertime,1,10) <= '2017-10-31'
group by ordertime
-------------------------------下单老客(全量跑)---------------------------------------
use bnb_hive_db;
drop table if exists tmp_zc_newusers_value;
create table tmp_zc_newusers_value as
select substr(ordertime,1,10) as ordertime,uid,orderamount from
(select uid
,orderamount,ordertime
,row_number() over(partition by uid order by ordertime) as rn
from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0) a
where rn = 1
and substr(ordertime,1,10) >= '2017-10-01'
and substr(ordertime,1,10) <= '2017-10-31'
group by substr(ordertime,1,10),uid,orderamount
--2018年10月1日至11月01日+180日下单用户,下单时间及消费额度
use bnb_hive_db;
drop table if exists tmp_zc_repurchase_value;
create table tmp_zc_repurchase_value as
select uid
,substr(ordertime,1,10) as ordertime
,orderamount
from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0
and substr(ordertime,1,10) >= '2017-10-01'
and substr(ordertime,1,10) <= date_add('2017-11-01',180)
--复购价值
select a.ordertime,sum(b.orderamount)/count(distinct uid) from bnb_hive_db.tmp_zc_newusers_value a
inner join (select uid,ordertime,orderamount from bnb_hive_db.tmp_zc_repurchase_value) b
on a.uid = b.uid
where datediff(b.ordertime,a.ordertime) <= 180
group by a.ordertime
-------------------------------下单老客(每天跑)-------------------------------------------
--2017.10.01-2017.10.31下单的老客
select a.ordertime,count(a.uid) from
--2017.10.01下单的客户
(select substr(ordertime,1,10) ordertime,uid from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and substr(ordertime,1,10) = '2017-10-01'
-- and substr(ordertime,1,10) <= '2017-10-31'
and agent = 0
group by substr(ordertime,1,10),uid
) a
inner join
--2017.10.01之前下单的客户
(select uid from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and substr(ordertime,1,10) < '2017-10-01'
and agent = 0
group by uid
) b
on a.uid = b.uid
group by a.ordertime
-------------------------------新客30日,90日,180天复购人数-------------------------
--新客180天复购人数
--2018年10月1日至10月31日首单用户,下单时间
use bnb_hive_db;
drop table if exists tmp_zc_newusers;
create table tmp_zc_newusers as
select ordertime,uid from
(select uid,ordertime,row_number() over(partition by uid order by ordertime) as rn from
(select uid,substr(ordertime,1,10) as ordertime from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0) a
) b
where rn = 1
and substr(ordertime,1,10) >= '2017-10-01'
and substr(ordertime,1,10) <= '2017-10-31'
group by ordertime,uid
--2018年10月2日至11月01日+180日下单用户,下单时间
use bnb_hive_db;
drop table if exists tmp_zc_buyusers;
create table tmp_zc_buyusers as
select uid,substr(ordertime,1,10) as ordertime from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0
and substr(ordertime,1,10) >= '2017-10-02'
and substr(ordertime,1,10) <= date_add('2017-11-01',180)
group by substr(ordertime,1,10),uid
--180日复购用户
select a.ordertime,count(*) from
bnb_hive_db.tmp_zc_newusers a
inner join bnb_hive_db.tmp_zc_buyusers b
on a.uid = b.uid
where
datediff(b.ordertime,a.ordertime) <= 180
and datediff(b.ordertime,a.ordertime) > 0
group by a.ordertime
--------------------------------新客30日,90日,180天复购人数(每行1跑)--------------------------
--新客180天复购人数
--2018年10月1日首单用户,下单时间
use bnb_hive_db;
drop table if exists tmp_zc_newusers;
create table tmp_zc_newusers as
select ordertime,uid from
(select uid,ordertime,row_number() over(partition by uid order by ordertime) as rn from
(select uid,substr(ordertime,1,10) as ordertime from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0) a
) b
where rn = 1
and substr(ordertime,1,10) = '2017-10-01'
-- and substr(ordertime,1,10) <= '2017-10-31'
group by ordertime,uid
--2018年10月2日至10月02日+180日下单用户,下单时间
use bnb_hive_db;
drop table if exists tmp_zc_repurchase_users;
create table tmp_zc_repurchase_users as
select uid,substr(ordertime,1,10) as ordertime from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0
and substr(ordertime,1,10) >= '2017-10-02'
and substr(ordertime,1,10) <= date_add('2017-10-02',180)
group by substr(ordertime,1,10),uid
--180日复购用户
select a.ordertime,count(*) from
bnb_hive_db.tmp_zc_newusers a
inner join bnb_hive_db.tmp_zc_repurchase_users b
on a.uid = b.uid
where
datediff(b.ordertime,a.ordertime) <= 180
and datediff(b.ordertime,a.ordertime) > 0
group by a.ordertime
/*------------------------------------新客生命180天周期价值---------------------------------------
--2018年10月1日至10月31日首单用户,及消费额度
use bnb_hive_db;
drop table if exists tmp_zc_newusers;
create table tmp_zc_newusers as
select ordertime,uid,orderamount from
(select uid,ordertime,orderamount,row_number() over(partition by uid order by ordertime) as rn from
(select uid,orderamount,substr(ordertime,1,10) as ordertime from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0) a
) b
where rn = 1
and substr(ordertime,1,10) >= '2017-10-01'
and substr(ordertime,1,10) <= '2017-10-31'
group by ordertime,uid,orderamount
--2018年10月2日至11月01日+180日下单用户,及消费额度
use bnb_hive_db;
drop table if exists tmp_zc_buyusers;
create table tmp_zc_buyusers as
select uid,substr(ordertime,1,10),orderamount as ordertime from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0
and substr(ordertime,1,10) >= '2017-10-02'
and substr(ordertime,1,10) <= date_add('2017-11-01',180)
group by substr(ordertime,1,10),uid
--180日复购用户人均累计消费
select a.ordertime,sum(a.orderamount)/count(distinct a.uid) from
bnb_hive_db.tmp_zc_newusers a
inner join bnb_hive_db.tmp_zc_buyusers b
on a.uid = b.uid
where
datediff(b.ordertime,a.ordertime) <= 180
-- and datediff(b.ordertime,a.ordertime) > 0
group by a.ordertime*/
------------------------------------新客180天生命周期价值(每天1跑)---------------------------------------
--2018年10月1日首单用户,下单时间及消费额度
use bnb_hive_db;
drop table if exists tmp_zc_newusers_value;
create table tmp_zc_newusers_value as
select substr(ordertime,1,10) as ordertime,uid,orderamount from
(select uid
,orderamount,ordertime
,row_number() over(partition by uid order by ordertime) as rn
from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0) a
where rn = 1
and substr(ordertime,1,10) = '2017-10-01'
-- and substr(ordertime,1,10) <= '2017-10-31'
group by substr(ordertime,1,10),uid,orderamount
--2018年10月1日至10月01日+180日下单用户,下单时间及消费额度
use bnb_hive_db;
drop table if exists tmp_zc_repurchase_value;
create table tmp_zc_repurchase_value as
select uid
,substr(ordertime,1,10) as ordertime
,orderamount
from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0
and substr(ordertime,1,10) >= '2017-10-01'
and substr(ordertime,1,10) <= date_add('2017-10-01',180)
--180日复购用户人均累计消费
select a.ordertime
,sum(a.orderamount)/count(distinct a.uid)
from bnb_hive_db.tmp_zc_newusers a
inner join bnb_hive_db.tmp_zc_repurchase_value b
on a.uid = b.uid
where
datediff(b.ordertime,a.ordertime) <= 180
-- and datediff(b.ordertime,a.ordertime) > 0
group by a.ordertime
--180日复购用户人均累计消费
select sum(a.orderamount)/count(distinct a.uid) from
(select uid,orderamount,ordertime from bnb_hive_db.tmp_zc_repurchase_value) a
left semi join
(select uid from bnb_hive_db.tmp_zc_newusers_value) b
on a.uid = b.uid
-----------------------------------新客180天生命周期价值(1次全量跑)---------------------------------------
--2017年10月1日至10月31日首单用户,下单时间及消费额度
use bnb_hive_db;
drop table if exists tmp_zc_newusers_value;
create table tmp_zc_newusers_value as
select substr(ordertime,1,10) as ordertime,uid,orderamount from
(select uid
,orderamount,ordertime
,row_number() over(partition by uid order by ordertime) as rn
from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0) a
where rn = 1
and substr(ordertime,1,10) >= '2017-10-01'
and substr(ordertime,1,10) <= '2017-10-31'
group by substr(ordertime,1,10),uid,orderamount
--2018年10月1日至今下单用户,下单时间及消费额度
use bnb_hive_db;
drop table if exists tmp_zc_repurchase_value;
create table tmp_zc_repurchase_value as
select uid
,substr(ordertime,1,10) as ordertime
,orderamount
from bnb_hive_db.bnb_orderinfo
where d = '2018-06-21'
and agent = 0
and substr(ordertime,1,10) >= '2017-10-01'
--新客180天生命周期价值
select a.ordertime,sum(b.orderamount)/count(distinct b.uid) from bnb_hive_db.tmp_zc_newusers_value a
inner join (select uid,ordertime,orderamount from bnb_hive_db.tmp_zc_repurchase_value) b
on a.uid = b.uid
where datediff(b.ordertime,a.ordertime) <= 180
group by a.ordertime
--180日复购用户人均累计消费
select a.ordertime
,sum(a.orderamount)/count(distinct a.uid)
from bnb_hive_db.tmp_zc_newusers a
inner join bnb_hive_db.tmp_zc_repurchase_value b
on a.uid = b.uid
where
datediff(b.ordertime,a.ordertime) <= 180
-- and datediff(b.ordertime,a.ordertime) > 0
group by a.ordertime
--180日复购用户人均累计消费
select sum(a.orderamount)/count(distinct a.uid) from
(select uid,orderamount,ordertime from bnb_hive_db.tmp_zc_repurchase_value) a
left semi join
(select uid from bnb_hive_db.tmp_zc_newusers_value) b
on a.uid = b.uid
|
CREATE procedure Sp_Get_PricesFromBatch(@Product_code NVarchar(15),
@Batch_number Nvarchar(128))
as
Select bp.PTS, bp.PTR, bp.ECP, bp.Company_Price, IsNull(items.AdhocAmount,0)
from batch_products as Bp,Items
Where items.product_Code = bp.product_code and
bp.Product_Code = @Product_code and
bp.batch_number = @batch_number
|
-- ex19_groupby.sql
/*
group by 절
- 레코드를 특정 컬럼값(1개 or 그 이상)에 맞춰서 그룹을 나누는 역할
- 그룹을 왜 나누는지? -> 각각의 나눠진 그룹을 대상 -> 집계함수를 적용하기 위해서(***)
- group by 컬럼명
select 컬럼리스트
from 테이블
where 조건
group by 절
order by 컬럼
1. from 테이블
2. where 조건
3. group by 절
4. select 컬럼리스트
5. order by 컬럼
*/
-- 부서별 그룹
select count(*), buseo from tblInsa group by buseo;
-- 부서별 평균 급여?
select * from tblInsa;
select round(avg(basicpay)) from tblInsa; --155만원
select distinct buseo from tblInsa;
select round(avg(basicpay)) from tblInsa where buseo = '총무부'; --171
select round(avg(basicpay)) from tblInsa where buseo = '개발부'; --138
select round(avg(basicpay)) from tblInsa where buseo = '영업부'; --160
select round(avg(basicpay)) from tblInsa where buseo = '기획부'; --185
select round(avg(basicpay)) from tblInsa where buseo = '인사부'; --153
select round(avg(basicpay)) from tblInsa where buseo = '자재부'; --141
select round(avg(basicpay)) from tblInsa where buseo = '홍보부'; --145
select round(avg(basicpay)) as 평균급여, count(*), buseo from tblInsa group by buseo;
select
round(avg(basicpay)) as 평균급여,
decode(substr(ssn, 8, 1), 1, '남성', 2, '여성') as 성별
from tblInsa
group by substr(ssn, 8, 1);
select * from tblComedian;
select
count(decode(gender, 'm', 1)) as 남성,
count(decode(gender, 'f', 1)) as 여성
from tblComedian;
select
count(*) as 인원,
decode(gender, 'm', '남성', 'f', '여성') as 성별
from tblComedian
group by gender;
select
job, count(*)
from tblAddressbook
group by job
order by count(*) desc;
-- 다중, 다차원 그룹
select
city, buseo, count(*)
from tblInsa
group by buseo, city
order by buseo, city;
-- group by + 집계 함수
select
hometown as 지역,
count(*) as "지역별 인구수",
round(avg(weight), 1) as "지역별 평균 몸무게",
max(weight) as "지역별 최고 몸무게",
min(weight) as "지역별 최저 몸무게",
sum(weight) as "지역별 몸무게 총 합"
from tblAddressBook
group by hometown;
select
nvl2(completedate,'o','x') as 내역,
count(*) as 개수
from tbltodo
group by nvl2(completedate,'o','x');
/*
having 절
- 조건절
select 컬럼리스트
from 테이블
where 조건
group by 절
having 절
order by 컬럼
1. from 테이블
2. where 조건
3. group by 절
4. having 절
5. select 컬럼리스트
6. order by 컬럼
from절 -> where절 : 개인에 대한 질문(조건)
group by절 -> having절 : 그룸(집계 함수 결과)에 대한 질문(조건)
*/
select
buseo, count(*)
from tblInsa
--where count(*) >= 10 (where 절에는 집계함수를 쓸 수 없다.)
group by buseo
having count(*) >= 10;
select
buseo, round(avg(basicpay))
from tblInsa
--where basicpay >= 1550000
group by buseo
having avg(basicpay) >= 1550000;
-- 날짜
select * from tblhousekeeping;
select
to_char(buydate, 'dd') as 날짜,
count(*) as 구매횟수,
sum(qty) as 구매개수,
max(price) as 최대단가,
min(price) as 최소단가,
sum(qty * price) as 총구입액
from tblhousekeeping
group by to_char(buydate, 'dd')
order by to_char(buydate, 'dd') asc;
select
case
when price >= 0 and price < 3000 then '저가'
when price >= 3000 and price < 10000 then '중가'
when price >= 10000 then '고가'
end as 분류,
count(*) as 개수
from tblhousekeeping
group by
case
when price >= 0 and price < 3000 then '저가'
when price >= 3000 and price < 10000 then '중가'
when price >= 10000 then '고가'
end;
-- tblInsa. 부서별 직급의 인원수 가져오기
select
buseo as 부서,
count(*) as 인원,
count(decode(jikwi, '부장', 1)) as 부장,
count(decode(jikwi, '과장', 1)) as 과장,
count(decode(jikwi, '대리', 1)) as 대리,
count(decode(jikwi, '사원', 1)) as 사원
from tblInsa
group by buseo;
-- group by 결과를 좀 더 자세하게 출력하는 함수
-- rollup(), cube() : summary
-- rollup() : 2차로 정렬, 그담에 1차로 정렬한 통계를 내 준다.
-- cube() : rollup과 달리 2차 정렬만으로도 통계를 내 준다.
select
buseo,
count(*)
from tblInsa
group by rollup(buseo);
select
buseo,
count(*),
sum(basicpay),
round(avg(basicpay)),
max(basicpay),
min(basicpay)
from tblInsa
group by rollup(buseo);
select
buseo,
jikwi,
city,
count(*)
from tblInsa
group by rollup(buseo, jikwi, city)
order by buseo, jikwi, city;
select
buseo,
count(*)
from tblInsa
group by cube(buseo)
order by buseo;
select
buseo,
jikwi,
count(*)
from tblInsa
group by cube(buseo, jikwi)
order by buseo, jikwi;
-- listagg
-- 11g 이후 버전에서만 사용 가능
select
buseo,
count(*),
listagg(name, ', ') within group(order by name asc) as name
from tblInsa
group by buseo
order by buseo;
desc tblhousekeeping
select
buydate,
count(*),
listagg(item, ', ') within group(order by item asc) as item,
sum(qty * price) as totalprice
from tblhousekeeping
group by buydate
order by buydate;
|
-- --------------------------------------------------------
-- Host: iam2
-- Server version: 8.0.23 - MySQL Community Server - GPL
-- Server OS: Win64
-- HeidiSQL Version: 11.2.0.6251
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- Dumping structure for table ugcctest.config
CREATE TABLE IF NOT EXISTS `config` (
`config_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`config_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`id` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table ugcctest.config: ~14 rows (approximately)
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
INSERT INTO `config` (`config_name`, `config_value`, `id`) VALUES
('dbver', '7', 1),
('updateinterval', '60', 2),
('ContactInfo', 'Enter your contact info here.....', 3),
('ContactEmail', 'mail@null.com', 4),
('maxfilesize', '102400', 5),
('extension', '.txt', 6),
('extension', '.ini', 7),
('extension', '.cfg', 8),
('extension', '.log', 9),
('bccemail', 'masher@brainless.us', 10),
('ReminderMessage', 'Reminder: The payment for your game server, %ServerName%, is due %DueDate%.\r\n\r\nTo ensure uninterrupted service please send your payment of $%PaymentAmount% as soon as possible.\r\n\r\nThanks for your business!\r\n\r\nNote: This is an automated message and may not reflect your current account status. If you`ve already paid you can disregard this message.', 11),
('ReminderSubject', 'Gameserver Payment Reminder', 12),
('SMTPserver', 'mail.null.com', 13),
('fromemail', '"Game Servers"<mail@null.com>', 14);
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
-- Dumping structure for table ugcctest.groups
CREATE TABLE IF NOT EXISTS `groups` (
`gid` int NOT NULL AUTO_INCREMENT,
`name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
PRIMARY KEY (`gid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table ugcctest.groups: ~0 rows (approximately)
/*!40000 ALTER TABLE `groups` DISABLE KEYS */;
/*!40000 ALTER TABLE `groups` ENABLE KEYS */;
-- Dumping structure for table ugcctest.group_members
CREATE TABLE IF NOT EXISTS `group_members` (
`gid` double DEFAULT NULL,
`uid` double DEFAULT NULL,
`id` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table ugcctest.group_members: ~0 rows (approximately)
/*!40000 ALTER TABLE `group_members` DISABLE KEYS */;
/*!40000 ALTER TABLE `group_members` ENABLE KEYS */;
-- Dumping structure for table ugcctest.group_perms
CREATE TABLE IF NOT EXISTS `group_perms` (
`id` int NOT NULL AUTO_INCREMENT,
`gid` double DEFAULT NULL,
`sid` double DEFAULT NULL,
`perm` double DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table ugcctest.group_perms: ~0 rows (approximately)
/*!40000 ALTER TABLE `group_perms` DISABLE KEYS */;
/*!40000 ALTER TABLE `group_perms` ENABLE KEYS */;
-- Dumping structure for table ugcctest.serverdef
CREATE TABLE IF NOT EXISTS `serverdef` (
`id` int NOT NULL AUTO_INCREMENT,
`name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`ip` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`port` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`secret` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table ugcctest.serverdef: ~1 rows (approximately)
/*!40000 ALTER TABLE `serverdef` DISABLE KEYS */;
INSERT INTO `serverdef` (`id`, `name`, `ip`, `port`, `secret`) VALUES
(1, 'This Host', '', '', '');
/*!40000 ALTER TABLE `serverdef` ENABLE KEYS */;
-- Dumping structure for table ugcctest.servers
CREATE TABLE IF NOT EXISTS `servers` (
`id` int NOT NULL AUTO_INCREMENT,
`user` int DEFAULT '0',
`friendlyname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`startpath` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`cmd` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`cmdhash` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`args` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`hiddenargs` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`editargs` int DEFAULT '0',
`pid` int DEFAULT '0',
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`allowupdate` int DEFAULT '0',
`updcmd` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`updargs` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`fedit` int DEFAULT '0',
`fpath` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`lastupdate` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`qryip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`qryport` int DEFAULT '0',
`admin_notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`user_notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`autorestart` int DEFAULT '0',
`nostart` int DEFAULT '0',
`extracmd` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`extralbl` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`extraargs` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`priority` int DEFAULT '0',
`cpuafin` int DEFAULT '0',
`duedate` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`amountdue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`img` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`sdefid` int NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table ugcctest.servers: ~0 rows (approximately)
/*!40000 ALTER TABLE `servers` DISABLE KEYS */;
/*!40000 ALTER TABLE `servers` ENABLE KEYS */;
-- Dumping structure for table ugcctest.tickmon
CREATE TABLE IF NOT EXISTS `tickmon` (
`id` int NOT NULL AUTO_INCREMENT,
`ini` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`net` int DEFAULT '0',
`tick` int DEFAULT '0',
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table ugcctest.tickmon: ~0 rows (approximately)
/*!40000 ALTER TABLE `tickmon` DISABLE KEYS */;
/*!40000 ALTER TABLE `tickmon` ENABLE KEYS */;
-- Dumping structure for table ugcctest.users
CREATE TABLE IF NOT EXISTS `users` (
`id` int NOT NULL AUTO_INCREMENT,
`user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`admin` tinyint DEFAULT '0',
`god` tinyint DEFAULT '0',
`enabled` tinyint DEFAULT '0',
`email` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
`maxsrvrs` int NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table ugcctest.users: ~1 rows (approximately)
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` (`id`, `user`, `password`, `admin`, `god`, `enabled`, `email`, `info`, `maxsrvrs`) VALUES
(1, 'admin', 'admin', 1, 1, 1, 'youremail@null.com', '', 0);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
|
-- MySQL dump 10.13 Distrib 5.7.21, for Linux (x86_64)
--
-- Host: localhost Database: timeline
-- ------------------------------------------------------
-- Server version 5.7.21-0ubuntu0.16.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `刘海亮_event`
--
DROP TABLE IF EXISTS `刘海亮_event`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `刘海亮_event` (
`id` int(3) NOT NULL AUTO_INCREMENT,
`executor` varchar(20) NOT NULL,
`event` varchar(200) NOT NULL,
`exec_time` datetime NOT NULL,
`state` varchar(5) DEFAULT '未完成',
PRIMARY KEY (`id`),
KEY `executor_index` (`executor`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `刘海亮_event`
--
LOCK TABLES `刘海亮_event` WRITE;
/*!40000 ALTER TABLE `刘海亮_event` DISABLE KEYS */;
INSERT INTO `刘海亮_event` VALUES (1,'刘海亮','完成timeline数据备份功能\n','2018-01-22 12:00:00','未完成');
/*!40000 ALTER TABLE `刘海亮_event` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `刘海亮_profile`
--
DROP TABLE IF EXISTS `刘海亮_profile`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `刘海亮_profile` (
`id` int(3) NOT NULL AUTO_INCREMENT,
`account` varchar(20) NOT NULL,
`sex` varchar(2) DEFAULT NULL,
`birth` date DEFAULT NULL,
`phone` varchar(14) DEFAULT NULL,
`motto` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `account_index` (`account`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='刘海亮用户的好友列表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `刘海亮_profile`
--
LOCK TABLES `刘海亮_profile` WRITE;
/*!40000 ALTER TABLE `刘海亮_profile` DISABLE KEYS */;
INSERT INTO `刘海亮_profile` VALUES (1,'刘海亮','男','1996-08-03','18593488685','不忘初心'),(2,'李博',NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `刘海亮_profile` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `passwd`
--
DROP TABLE IF EXISTS `passwd`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `passwd` (
`id` int(3) NOT NULL AUTO_INCREMENT,
`account` varchar(20) NOT NULL COMMENT '账户名',
`passwd` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `account_index` (`account`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `passwd`
--
LOCK TABLES `passwd` WRITE;
/*!40000 ALTER TABLE `passwd` DISABLE KEYS */;
INSERT INTO `passwd` VALUES (1,'刘海亮','*CC67043C7BCFF5EEA5566BD9B1F3C74FD9A5CF5D');
/*!40000 ALTER TABLE `passwd` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-01-26 19:30:51
|
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Dec 02, 2019 at 12:24 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `db_ajax`
--
-- --------------------------------------------------------
--
-- Table structure for table `drzchat`
--
CREATE TABLE `drzchat` (
`nomor` int(3) NOT NULL,
`nama` varchar(20) NOT NULL,
`pesan` varchar(200) NOT NULL,
`waktu` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `drzchat`
--
INSERT INTO `drzchat` (`nomor`, `nama`, `pesan`, `waktu`) VALUES
(163, 'Admin', 'Mail bergabung dalam chat', '15:10'),
(164, 'Mail', 'hallo', '15:10');
-- --------------------------------------------------------
--
-- Table structure for table `message`
--
CREATE TABLE `message` (
`message_id` int(11) NOT NULL,
`chat_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`username` varchar(64) NOT NULL,
`message` text NOT NULL,
`post_time` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `message`
--
INSERT INTO `message` (`message_id`, `chat_id`, `user_id`, `username`, `message`, `post_time`) VALUES
(1, 1, 1, 'Nurmi', 'Halo apa kabar', '2019-11-13 13:56:05'),
(2, 1, 2, 'desrizal', 'kabar baik', '2019-11-13 00:00:00'),
(3, 1, 1, 'nurmi', 'lagi dimana', '2019-11-13 00:00:00'),
(4, 1, 2, 'desrizal', 'belitung', '2019-11-13 00:00:00');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `drzchat`
--
ALTER TABLE `drzchat`
ADD PRIMARY KEY (`nomor`);
--
-- Indexes for table `message`
--
ALTER TABLE `message`
ADD PRIMARY KEY (`message_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `drzchat`
--
ALTER TABLE `drzchat`
MODIFY `nomor` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=165;
--
-- AUTO_INCREMENT for table `message`
--
ALTER TABLE `message`
MODIFY `message_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 4.9.4
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 26-06-2020 a las 15:30:39
-- Versión del servidor: 5.6.48-cll-lve
-- Versión de PHP: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `danifer1_parapru`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `clases`
--
CREATE TABLE `clases` (
`id` int(100) NOT NULL,
`Nombre_clase` varchar(100) COLLATE utf8_spanish2_ci NOT NULL,
`Profesor` varchar(100) COLLATE utf8_spanish2_ci NOT NULL,
`Año` varchar(10) COLLATE utf8_spanish2_ci NOT NULL,
`fecha_inicio` date NOT NULL,
`fecha_fin` date NOT NULL,
`Alumno` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
`materia` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
`estado` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
`ref` int(50) NOT NULL,
`id_clase` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci;
--
-- Volcado de datos para la tabla `clases`
--
INSERT INTO `clases` (`id`, `Nombre_clase`, `Profesor`, `Año`, `fecha_inicio`, `fecha_fin`, `Alumno`, `materia`, `estado`, `ref`, `id_clase`) VALUES
(1, '20 Clases 1° de Bachillerato', '34', '4', '2020-06-10', '2020-07-10', '1', 'historia', 'activo', 0, 14),
(6, '20 clases 5 veces por semana 3° Bachillerato ', '42', '6', '2020-06-10', '2020-07-10', '47', 'matematica1', 'activo', 97847, 15),
(3, '20 clases para 3° de Bachillerato Derecho 5 días', '34', '4', '2020-06-10', '2020-07-10', '48', 'historia', 'activo', 0, 20),
(4, '20 clases para 3° Bachillerato de Economía 5 días a la semana ', '34', '4', '2020-06-10', '2020-07-10', '47', 'historia', 'activo', 0, 31),
(5, '20 clases, 3° de Ciclo Básico 5 días a la semana', '34', '3', '2020-06-10', '2020-07-10', '45', 'historia', 'activo', 0, 19);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `fatura`
--
CREATE TABLE `fatura` (
`id` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`ref` int(11) NOT NULL,
`forma` varchar(100) NOT NULL,
`data` varchar(100) NOT NULL,
`valor` varchar(100) NOT NULL,
`producto` varchar(50) NOT NULL,
`materia` varchar(100) NOT NULL,
`status` varchar(100) NOT NULL,
`comprobante` varchar(100) NOT NULL,
`identificador_compra` int(200) NOT NULL,
`id_clase` int(11) NOT NULL,
`fecha_compra` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `fatura`
--
INSERT INTO `fatura` (`id`, `id_user`, `ref`, `forma`, `data`, `valor`, `producto`, `materia`, `status`, `comprobante`, `identificador_compra`, `id_clase`, `fecha_compra`) VALUES
(18, 47, 607347, 'Mercado Pago', '42 ', '4000.00', '20 clases 5 veces por semana 3° Bachillerato ', 'matematica1', 'Pendiente', 'esperando confirmacion de Pago', 0, 15, '2020-06-11 11:17:46'),
(17, 47, 105347, 'Mercado Pago', '42 ', '4000.00', '20 clases 5 veces por semana 3° Bachillerato ', 'matematica1', 'Pendiente', 'esperando confirmacion de Pago', 0, 15, '2020-06-10 17:50:43'),
(3, 47, 297747, 'Mercado Pago', '42 ', '4000.00', '20 clases 5 veces por semana 3° Bachillerato ', 'matematica1', 'Pendiente', 'esperando confirmacion de Pago', 0, 15, '2020-06-08 17:43:57'),
(16, 47, 97847, 'Red Pagos', '42 ', '4000.00', '20 clases 5 veces por semana 3° Bachillerato ', 'matematica1', 'aprovado', 'acreditado', 1, 15, '2020-06-10 14:37:10'),
(5, 34, 137634, 'Mercado Pago', '34 ', '4000.00', '20 Clases 1° de Bachillerato', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 14, '2020-06-09 17:53:30'),
(6, 45, 749545, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-09 18:54:14'),
(7, 45, 324445, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-09 19:01:10'),
(8, 47, 710247, 'Mercado Pago', '34 ', '4500.00', '20 clases para 3° Bachillerato de EconomÃa 5 dÃ', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 31, '2020-06-09 19:54:14'),
(9, 47, 241747, 'Mercado Pago', '42 ', '4000.00', '20 clases 5 veces por semana 3° Bachillerato ', 'matematica1', 'Pendiente', 'esperando confirmacion de Pago', 0, 15, '2020-06-09 19:55:45'),
(10, 47, 949047, 'Mercado Pago', '42 ', '4000.00', '20 clases 5 veces por semana 3° Bachillerato ', 'matematica1', 'Pendiente', 'esperando confirmacion de Pago', 0, 15, '2020-06-09 23:33:58'),
(15, 1, 17741, 'Mercado Pago', '44 ', '4000.00', '20 Clases por Video Conferencia 3ero Ciclo Básico', 'fisica', 'Pendiente', 'esperando confirmacion de Pago', 0, 14, '2020-06-10 13:25:18'),
(14, 47, 720347, 'Mercado Pago', '42 ', '4000.00', '20 clases 5 veces por semana 3° Bachillerato ', 'matematica1', 'Pendiente', 'esperando confirmacion de Pago', 0, 15, '2020-06-10 11:27:57'),
(13, 48, 909448, 'Mercado Pago', '34 ', '4500.00', '20 clases para 3° de Bachillerato Derecho 5 dÃas', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 20, '2020-06-10 00:37:47'),
(19, 45, 443545, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-13 01:12:37'),
(20, 34, 524734, 'Mercado Pago', '34 ', '4500.00', '20 clases para 3° de Bachillerato Derecho 5 dÃas', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 20, '2020-06-15 01:24:29'),
(21, 45, 652545, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-16 00:38:16'),
(22, 45, 644245, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-16 00:40:14'),
(23, 45, 322245, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-17 00:28:20'),
(24, 45, 596145, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-17 00:28:20'),
(25, 45, 273545, 'Mercado Pago', '34 ', '3000.00', '12 clases de 3° de Ciclo Básico, 3 dÃas a la se', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 22, '2020-06-21 23:23:41'),
(26, 45, 932545, 'Mercado Pago', '34 ', '3000.00', '12 clases de 3° de Ciclo Básico, 3 dÃas a la se', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 22, '2020-06-21 23:23:41'),
(27, 45, 215545, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-21 23:23:52'),
(28, 45, 882045, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-21 23:23:53'),
(29, 45, 258045, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-21 23:29:00'),
(30, 45, 172545, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-21 23:29:00'),
(31, 45, 53645, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-24 00:25:02'),
(32, 45, 500745, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-24 00:25:02'),
(33, 34, 658734, 'Mercado Pago', '34 ', '4000.00', '20 clases, 3° de Ciclo Básico 5 dÃas a la seman', 'historia', 'Pendiente', 'esperando confirmacion de Pago', 0, 19, '2020-06-25 03:06:42');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE `usuario` (
`id` int(200) NOT NULL,
`Email` varchar(200) COLLATE utf8_spanish2_ci NOT NULL,
`Nombre` varchar(200) COLLATE utf8_spanish2_ci NOT NULL,
`Apellido` varchar(200) COLLATE utf8_spanish2_ci NOT NULL,
`Celular` varchar(200) COLLATE utf8_spanish2_ci NOT NULL,
`Contraseña` varchar(200) COLLATE utf8_spanish2_ci NOT NULL,
`token` varchar(200) COLLATE utf8_spanish2_ci NOT NULL,
`materias` varchar(400) COLLATE utf8_spanish2_ci NOT NULL,
`pago` tinyint(1) NOT NULL,
`estado` varchar(50) COLLATE utf8_spanish2_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci;
--
-- Volcado de datos para la tabla `usuario`
--
INSERT INTO `usuario` (`id`, `Email`, `Nombre`, `Apellido`, `Celular`, `Contraseña`, `token`, `materias`, `pago`, `estado`) VALUES
(1, 'danielferreira@studere.com.uy', 'Daniel', 'Ferreira', '096635675', 'ZGFuaWZlcnBybzIwMTk=', '1', 'admin', 1, 'offline'),
(26, 'rogeliocastro@studere.com.uy', 'Rogelio', 'Castro', '092079765', 'cm9nZWxpb2Nhc3RybzIwMTk=', '1', 'admin', 0, 'offline'),
(34, 'Profe_rogelio@studere.com.uy', 'Rogelio', 'Castro', '092079765', 'Um9nZS40NDY2', '1', 'historia', 1, 'offline'),
(45, 'yamilameyer1995@gmail.com', 'yamila', 'meyer balao', '091385061', 'MTk5NQ==', '1', '', 0, 'offline'),
(38, 'estelaantupi@gmail.com', 'Estela', 'Antúnez', '094 736 481', 'RWEyNzEyNzI=', '1', 'matematica', 0, 'online'),
(44, 'belquistorres@hotmail.com', 'Belquis', 'Torres', '095753370', 'TmV3dG9uMjAyMA==', '1', 'fisica', 0, 'online'),
(39, 'ceciflor2311@hotmail.com', 'Ana Cecilia', 'Florenciano Barboza', '099120035', 'SHVnb2NlY2lsaWEyMzA3Kw==', '1', 'derecho', 0, 'offline'),
(41, 'soxx_18@hotmail.com', 'Valeria', 'Rodríguez', '091997776', 'dnNyYzE4ODQ=', '1', 'ingles', 0, 'offline'),
(40, 'gonsalopz@gmail.com', 'Gonzalo', 'Lopez', '091217729', 'Z29uemEzMDExODc=', '1', 'quimica', 0, 'offline'),
(42, 'adri27nicodella@gmail.com', 'Adriana ', 'Nicodella ', '096247117', 'MDkxNjM3MDAz', '1', 'matematica1', 0, 'offline'),
(46, 'tonytacuarembo@hotmail.com', 'Winston ', 'Sant Anna', '099556050', 'Z2VvZ3JhZmlhMDUwODg3', '1', 'geografia', 0, 'offline'),
(47, 'aldarodriguezmdrs17@gmail.com', 'Alda ', 'Rodríguez ', '092623788', 'MDkyNjIzNzg4', '1', '', 0, 'online'),
(48, 'stefanitexeira@hotmail.es', 'Stefani', 'Texeira', '', 'c3RlZmFuaXRleGVpcmEyMDIw', '1', '', 0, 'online'),
(49, 'mayravictoria08@gmail.com', 'Mayra Victoria', 'Artigas Modernel', '097980860', 'NTA3NDc3Njk=', '1', '', 0, 'online'),
(50, 'mariamabelrodriguez89@gmail.com', 'María ', 'RODRÍGUEZ ', '092287767', 'bWFyaWNvdGEyMDIw', '1', '', 0, 'online'),
(52, 'maria341955@gmail.com', 'Francisco Nahuel', 'Rodriguez', '092231742', 'c2V0ZWFtZWVzdGEyMDIw', '1', 'admin', 0, 'offline'),
(53, 'profe_maria341955@gmail.com', 'Francisco', 'Vignoli', '0000000', 'c2V0ZWFtZWVzdGEyMDIw', '1', 'fisica1', 0, 'offline');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `clases`
--
ALTER TABLE `clases`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `fatura`
--
ALTER TABLE `fatura`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `clases`
--
ALTER TABLE `clases`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de la tabla `fatura`
--
ALTER TABLE `fatura`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT de la tabla `usuario`
--
ALTER TABLE `usuario`
MODIFY `id` int(200) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=54;
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 */;
|
insert into PRODUCTO (NOMBRE,DESCRIPCION,PRECIO,DESCUENTO) values ('Pimiento','Rojo de temporada',2.0,1);
insert into PRODUCTO (NOMBRE,DESCRIPCION,PRECIO, DESCUENTO) values ('Tomate', 'Fresco',5.0,1);
insert into PRODUCTO (NOMBRE, DESCRIPCION,PRECIO, DESCUENTO) values ('Manzana', 'Golden',3.0,1);
insert into PRODUCTO (NOMBRE, DESCRIPCION,PRECIO, DESCUENTO) values ('Pera', 'Golden',4.0,1);
insert into PRODUCTO (NOMBRE, DESCRIPCION,PRECIO, DESCUENTO) values ('Manzana', 'Royal Gala',2.0,1);
insert into PRODUCTO (NOMBRE, DESCRIPCION,PRECIO, DESCUENTO) values ('Jamon', 'Ibérico ',10.0,2);
insert into PRODUCTO (NOMBRE, DESCRIPCION,PRECIO, DESCUENTO) values ('Jamón', 'Cocido',4.0,1);
insert into PRODUCTO (NOMBRE, DESCRIPCION,PRECIO, DESCUENTO) values ('Lomo', 'Ibérico de Caña',12.0,1);
insert into ROL (ID_ROL, NOMBRE_ROL ) values (1, 'ROL_USUARIO');
insert into ROL (ID_ROL, NOMBRE_ROL ) values (2,'ROL_ADMIN');
INSERT INTO USUARIO (ID_USUARIO,NOMBRE,APELLIDOS,USERNAME,CONTRASEÑA,EMAIL,FECHA_NAC,NUMERO_TARJETA,CODIGO_SEGURIDAD,DIRECCION_FACTURACION) VALUES (1,'Alejandro','Valero','aaa','$2a$10$fLh4xMgBEXFKC69YL8jvhuraRNlIfgpwLzvSJn6GXSRaIO5Z50vfC','alexvalero34@gmail.com','111',111,28500,'C/catamaran bloque 17 piso 4 letra A');
INSERT INTO USUARIO (ID_USUARIO,NOMBRE,APELLIDOS,USERNAME,CONTRASEÑA,EMAIL,FECHA_NAC,NUMERO_TARJETA,CODIGO_SEGURIDAD,DIRECCION_FACTURACION) VALUES (2,'admin','admin','admin','$2a$10$GNbGuzIiW/Q/wezmOfyPWeVzS1NdUUMxbnwE7lZInWClOlPDWb6eO','admin@gmail.com','050400',1234,28500,'C/catamaran bloque 17 piso 4 letra A');
insert into USUARIO_ROL (ID_USUARIO ,ID_ROL ) values (1, 1);
insert into USUARIO_ROL (ID_USUARIO ,ID_ROL ) values (2, 2); |
#Revenue per actor
SELECT
a.actor_id,
concat(a.first_name," ", a.last_name) name,
sum(rpf.total_rental) total_revenue_per_actor
FROM film_actor fa,
actor a,
revenue_per_film rpf
WHERE
a.actor_id = fa.actor_id
AND rpf.film_id = fa.film_id
GROUP BY 1
ORDER BY total_revenue_per_actor DESC
LIMIT 10
;
|
insert into burgers_db (burger_name) values("The Ghetto Burger");
insert into burgers_db (burger_name) values("Double with Cheese");
insert into burgers_db (burger_name) values("The Primetime"); |
-- +migrate Up
CREATE TABLE tasks (
task_id VARCHAR(255) PRIMARY KEY
,task_data BYTEA
,task_labels BYTEA
);
-- +migrate Down
DROP TABLE tasks;
|
CREATE VIEW [V_CG_CreditLimit]
([Customer_ID], [Customer_Name], [Category_Group], [Group_wise_Credit_term], [Group_wise_Credit_Limit],
[Group_Wise_No_of_open_invoices], [Active])
AS
SELECT Customer.CustomerID, Customer.Company_Name, CustomerCreditLimit.GroupID, CustomerCreditLimit.CreditTermDays,
CustomerCreditLimit.CreditLimit, CustomerCreditLimit.NoOFbills,
'Active' = (Case When Isnull(Customer.Active, 1) + Isnull(ProductCategoryGroupAbstract.Active, 1)
+ Isnull(CreditTerm.Active, 1) <> 3 then 0 else 1 end)
FROM Customer
Left Outer Join CustomerCreditLimit On Customer.CustomerID = CustomerCreditLimit.CustomerID
Left Outer Join ProductCategoryGroupAbstract On CustomerCreditLimit.GroupID = ProductCategoryGroupAbstract.GroupID
Left Outer Join CreditTerm On CreditTerm.CreditID = CustomerCreditLimit.CreditTermDays
where ProductCategoryGroupAbstract.OCGtype = ( Select flag from tbl_merp_configabstract where screencode = 'OCGDS' )
|
SELECT
c.c_custkey,
c.c_name,
c.c_nationkey,
SUM(o.o_totalprice) AS total_order_price
FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS c
LEFT JOIN "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS o
ON c.c_custkey = o.o_custkey
GROUP BY c.c_custkey, c.c_name, c.c_nationkey |
select definition
from pg_views
where schemaname = '{0}'
and viewname = '{1}' |
-- phpMyAdmin SQL Dump
-- version 4.6.0
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 09, 2016 at 11:44 AM
-- Server version: 5.6.31-0ubuntu0.15.10.1
-- PHP Version: 5.6.11-1ubuntu3.4
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: `unfpa_global_data`
--
-- --------------------------------------------------------
--
-- Table structure for table `country_code`
--
CREATE TABLE `country_code` (
`id` int(11) NOT NULL,
`c_name` varchar(42) DEFAULT NULL,
`cc` varchar(255) DEFAULT NULL,
`region_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `country_code`
--
INSERT INTO `country_code` (`id`, `c_name`, `cc`, `region_id`) VALUES
(1, 'Afghanistan', 'AF', 3),
(2, 'Albania', 'AL', 4),
(3, 'Armenia', 'AM', 4),
(4, 'Angola', 'AO', 0),
(5, 'Argentina', 'AR', 5),
(6, 'Azerbaijan.2', 'AZ', 4),
(7, 'Bosnia and Herzegovina', 'BA', 4),
(8, 'Bangladesh', 'BD', 3),
(9, 'Burkina Faso', 'BF', 1),
(10, 'Burundi', 'BI', 0),
(11, 'Benin', 'BJ', 1),
(12, 'Bolivia, Plurinational State of', 'BO', 5),
(13, 'Brazil', 'BR', 5),
(14, 'Bhutan', 'BT', 3),
(15, 'Botswana', 'BW', 0),
(16, 'Belarus', 'BY', 4),
(17, 'Congo, the Democratic Republic of the', 'CD', 0),
(18, 'Central African Republic', 'CF', 1),
(19, 'Congo', 'CG', 1),
(20, 'Côte d\'Ivoire', 'CI', 1),
(21, 'Chile', 'CL', 5),
(22, 'Cameroon', 'CM', 1),
(23, 'China.3', 'CN', 3),
(24, 'Colombia', 'CO', 5),
(25, 'Costa Rica', 'CR', 5),
(26, 'Cuba', 'CU', 5),
(27, 'Cabo Verde', 'CV', 1),
(28, 'Djibouti', 'DJ', 2),
(29, 'Dominican Republic', 'DO', 5),
(30, 'Algeria', 'DZ', 2),
(31, 'Ecuador', 'EC', 5),
(32, 'Egypt', 'EG', 2),
(33, 'Eritrea', 'ER', 0),
(34, 'Ethiopia', 'ET', 0),
(35, 'Gabon', 'GA', 1),
(36, 'Georgia.8', 'GE', 4),
(37, 'Ghana', 'GH', 1),
(38, 'Gambia', 'GM', 1),
(39, 'Guinea', 'GN', 1),
(40, 'Equatorial Guinea', 'GQ', 1),
(41, 'Guatemala', 'GT', 5),
(42, 'Guinea-Bissau', 'GW', 1),
(43, 'Honduras', 'HN', 5),
(44, 'Haiti', 'HT', 5),
(45, 'Indonesia', 'ID', 3),
(46, 'India', 'IN', 3),
(47, 'Iraq', 'IQ', 2),
(48, 'Iran, Islamic Republic of', 'IR', 3),
(49, 'Jordan', 'JO', 2),
(50, 'Kenya', 'KE', 0),
(51, 'Kyrgyzstan', 'KG', 4),
(52, 'Cambodia', 'KH', 3),
(53, 'Comoros', 'KM', 0),
(54, 'Korea, Democratic People\'s Republic', 'KP', NULL),
(55, 'Kazakhstan', 'KZ', 4),
(56, 'Lao People\'s Democratic Republic', 'LA', 3),
(57, 'Lebanon', 'LB', 2),
(58, 'Sri Lanka', 'LK', 3),
(59, 'Liberia', 'LR', 1),
(60, 'Lesotho', 'LS', 0),
(61, 'Libya', 'LY', 2),
(62, 'Morocco', 'MA', 2),
(63, 'Moldova, Republic of.12', 'MD', 4),
(64, 'Madagascar', 'MG', 0),
(65, 'Macedonia, the former Yugoslav Republic of', 'MK', 4),
(66, 'Mali', 'ML', 1),
(67, 'Myanmar', 'MM', 3),
(68, 'Mongolia', 'MN', 3),
(69, 'Mauritania', 'MR', 1),
(70, 'Mauritius.11', 'MU', 0),
(71, 'Maldives', 'MV', 3),
(72, 'Malawi', 'MW', 0),
(73, 'Mexico', 'MX', 5),
(74, 'Malaysia.10', 'MY', 3),
(75, 'Mozambique', 'MZ', 0),
(76, 'Namibia', 'NA', 0),
(77, 'Niger', 'NE', 1),
(78, 'Nigeria', 'NG', 1),
(79, 'Nicaragua', 'NI', 5),
(80, 'Nepal', 'NP', 3),
(81, 'Oman', 'OM', 2),
(82, 'Panama', 'PA', 5),
(83, 'Peru', 'PE', 5),
(84, 'Papua New Guinea', 'PG', 3),
(85, 'Philippines', 'PH', 3),
(86, 'Pakistan', 'PK', 3),
(87, 'Palestine.14', 'PS', 2),
(88, 'Paraguay', 'PY', 5),
(89, 'Serbia.15', 'RS', 4),
(90, 'Rwanda', 'RW', 0),
(91, 'Sudan', 'SD', 2),
(92, 'Sierra Leone', 'SL', 1),
(93, 'Senegal', 'SN', 1),
(94, 'Somalia', 'SO', 2),
(95, 'South Sudan', 'SS', 0),
(96, 'Sao Tome and Principe', 'ST', 1),
(97, 'El Salvador', 'SV', 5),
(98, 'Syrian Arab Republic', 'SY', 2),
(99, 'Swaziland', 'SZ', 0),
(100, 'Chad', 'TD', 1),
(101, 'Togo', 'TG', 1),
(102, 'Thailand', 'TH', 3),
(103, 'Tajikistan', 'TJ', 4),
(104, 'Timor-Leste', 'TL', 3),
(105, 'Turkmenistan', 'TM', 4),
(106, 'Tunisia', 'TN', 2),
(107, 'Turkey', 'TR', 4),
(108, 'Tanzania, United Republic of.17', 'TZ', 0),
(109, 'Ukraine', 'UA', 4),
(110, 'Uganda', 'UG', 0),
(111, 'Uruguay', 'UY', 5),
(112, 'Uzbekistan', 'UZ', 4),
(113, 'Venezuela, Bolivarian Republic of', 'VE', 5),
(114, 'Viet Nam', 'VN', 3),
(115, 'Kosovo Office', 'XK', 4),
(116, 'Yemen', 'YE', 2),
(117, 'South Africa', 'ZA', 0),
(118, 'Zambia', 'ZM', 0),
(119, 'Zimbabwe', 'ZW', 0),
(120, 'Caribbean SRO', 'JM ', 5),
(121, 'Pacific-SRO', 'FJ ', 3),
(122, 'Antigua and Barbuda', 'AG', 5),
(123, 'Aruba', 'AW', NULL),
(124, 'Australia.1', 'AU', NULL),
(125, 'Austria', 'AT', NULL),
(126, 'Bahamas', 'BS', 5),
(127, 'Bahrain', 'BH', NULL),
(128, 'Barbados', 'BB', NULL),
(129, 'Belgium', 'BE', NULL),
(130, 'Belize', 'BZ', NULL),
(131, 'Brunei Darussalam', 'BN', NULL),
(132, 'Bulgaria', 'BG', NULL),
(133, 'Canada', 'CA', NULL),
(134, 'China, Hong Kong SAR.4', 'HK', NULL),
(135, 'China, Macao SAR.5', 'MO', NULL),
(136, 'Croatia', 'HR', NULL),
(137, 'Curacao', 'CW', NULL),
(138, 'Cyprus.6', 'CY', NULL),
(139, 'Czech Republic', 'CZ', NULL),
(140, 'Denmark', 'DK', NULL),
(141, 'Dominica', 'DM', NULL),
(142, 'Estonia', 'EE', NULL),
(143, 'Fiji', 'FJ1', 3),
(144, 'Finland.7', 'FI', NULL),
(145, 'France', 'FR', NULL),
(146, 'French Guiana', 'GF', NULL),
(147, 'French Polynesia', 'PF', NULL),
(148, 'Germany', 'DE', NULL),
(149, 'Greece', 'GR', NULL),
(150, 'Grenada', 'GD', NULL),
(151, 'Guadeloupe.9', 'GP', 5),
(152, 'Guam', 'GU', NULL),
(153, 'Guyana', 'GY', NULL),
(154, 'Hungary', 'HU', NULL),
(155, 'Iceland', 'IS', NULL),
(156, 'Ireland', 'IE', NULL),
(157, 'Israel', 'IL', NULL),
(158, 'Italy', 'IT', NULL),
(159, 'Jamaica', 'JM1', 5),
(160, 'Japan', 'JP', 3),
(161, 'Kiribati', 'KI', NULL),
(162, 'Korea, Republic of', 'KR', NULL),
(163, 'Kuwait', 'KW', NULL),
(164, 'Latvia', 'LV', NULL),
(165, 'Lithuania', 'LT', NULL),
(166, 'Luxembourg', 'LU', NULL),
(167, 'Malta', 'MT', NULL),
(168, 'Martinique', 'MQ', NULL),
(169, 'Micronesia (Federated States of)', 'FM', NULL),
(170, 'Montenegro', 'ME', NULL),
(171, 'Netherlands', 'NL', NULL),
(172, 'New Caledonia', 'NC', NULL),
(173, 'New Zealand', 'NZ', NULL),
(174, 'Norway.13', 'NO', NULL),
(175, 'Poland', 'PL', NULL),
(176, 'Portugal', 'PT', NULL),
(177, 'Puerto Rico', 'PR', 5),
(178, 'Qatar', 'QA', NULL),
(179, 'Reunion', 'RE', NULL),
(180, 'Romania', 'RO', NULL),
(181, 'Russian Federation', 'RU', NULL),
(182, 'Saint Kitts and Nevis', 'KN', 5),
(183, 'Saint Lucia', 'LC', NULL),
(184, 'Saint Vincent and the Grenadines', 'VC', NULL),
(185, 'Samoa', 'WS', NULL),
(186, 'San Marino', 'SM', NULL),
(187, 'Saudi Arabia', 'SA', NULL),
(188, 'Seychelles', 'SC', 0),
(189, 'Singapore', 'SG', NULL),
(190, 'Slovakia', 'SK', NULL),
(191, 'Slovenia', 'SI', NULL),
(192, 'Solomon Islands', 'SB', NULL),
(193, 'Spain.16', 'ES', NULL),
(194, 'Suriname', 'SR', NULL),
(195, 'Sweden', 'SE', NULL),
(196, 'Switzerland', 'CH', NULL),
(197, 'Tonga', 'TO', NULL),
(198, 'Trinidad and Tobago', 'TT', 5),
(199, 'Turks and Caicos Islands', 'TC', 5),
(200, 'Tuvalu', 'TV', NULL),
(201, 'United Arab Emirates', 'AE', NULL),
(202, 'United Kingdom', 'GB', NULL),
(203, 'United States of America', 'US', NULL),
(204, 'United States Virgin Islands', 'VI', 5),
(205, 'Vanuatu ', 'VU', NULL),
(206, 'Western Sahara', 'EH', NULL),
(207, 'Asia & the Pacific.d', 'ASIA', 3),
(208, 'Eastern Europe & Central Asia', 'EECA', 4),
(209, 'West & Central Africa', 'WCA', 1),
(210, 'Arab States.c', 'ARAB', 2),
(211, 'Latin America & the Caribbean.e', 'LAC', 5),
(212, 'East & Southern Africa', 'ESA', 0),
(213, 'WORLD', 'WORLD', NULL),
(214, 'More Developed Regions', 'MDREGION', NULL),
(215, 'Less Developed Regions', 'LDREGION', NULL),
(216, 'Least Developed Regions', 'LEDREGION', NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `country_code`
--
ALTER TABLE `country_code`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `country_code`
--
ALTER TABLE `country_code`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=217;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE SEQUENCE SEQ_LI_USER INCREMENT BY 20 CACHE 100;
CREATE SEQUENCE SEQ_LI_AUTHOR INCREMENT BY 20 CACHE 100;
CREATE SEQUENCE SEQ_LI_BOOK INCREMENT BY 20 CACHE 100;
CREATE SEQUENCE SEQ_LI_LISTING INCREMENT BY 20 CACHE 100;
create table LI_USER (
ID_USER NUMBER(22, 0) NOT NULL,
NAME VARCHAR2(255 CHAR) NOT NULL,
PASSWORD VARCHAR2(255 CHAR) NOT NULL,
SURNAME VARCHAR2(255 CHAR) NOT NULL,
USERNAME VARCHAR2(255 CHAR) NOT NULL,
REGISTRATION_DATE DATE NOT NULL,
LAST_LOGIN_DATE DATE NOT NULL,
CONSTRAINT "PK_LI_USER" PRIMARY KEY (ID_USER)
);
create table LI_BOOK (
ID_BOOK NUMBER(22, 0) NOT NULL,
LANGUAGE VARCHAR2(255 CHAR),
TITLE VARCHAR2(255 CHAR),
ISBN VARCHAR2(255 CHAR),
BOOK_CATEGORY VARCHAR2(255 CHAR),
CONSTRAINT "PK_LI_BOOK" PRIMARY KEY (ID_BOOK)
);
create table LI_BOOK_ISBN (
ID_ISBN NUMBER(22, 0) NOT NULL,
ISBNS NUMBER(22, 0) NOT NULL,
CONSTRAINT "PK_LI_BOOK_ISBN" PRIMARY KEY (ID_ISBN)
);
create table LI_BOOK_CATEGORY (
ID_BOOK_CATEGORY NUMBER (22, 0) NOT NULL,
BOOKCATEGORIES NUMBER (22, 0) NOT NULL,
CONSTRAINT "PK_LI_BOOK_CATEGORY" PRIMARY KEY (ID_BOOK_CATEGORY)
);
create table LI_AUTHOR (
ID_AUTHOR NUMBER(22, 0) not null,
BIRTH_DATE DATE,
COUNTRY VARCHAR2(255 CHAR),
NAME VARCHAR2(255 CHAR) NOT NULL,
CONSTRAINT "PK_LI_AUTHOR" PRIMARY KEY (ID_AUTHOR)
);
create table LI_BOOK_AUTH (
ID_BOOK NUMBER (22,0) NOT NULL,
ID_AUTHOR NUMBER (22,0) NOT NULL,
CONSTRAINT "PK_LI_BOOK_AUTH" PRIMARY KEY (ID_AUTHOR, ID_BOOK),
CONSTRAINT "FK_BA_BOOK" FOREIGN KEY (ID_BOOK) REFERENCES "LI_BOOK" (ID_BOOK),
CONSTRAINT "FK_BA_AUTHOR" FOREIGN KEY (ID_AUTHOR) REFERENCES LI_AUTHOR (ID_AUTHOR)
);
create table LI_LISTING (
ID_LISTING NUMBER(22, 0) NOT NULL,
CREATION_TIME TIMESTAMP,
AUTO_GRAPHED NUMBER(1,0),
ISBN NUMBER(22, 0),
PRICE NUMBER(22, 4),
ID_BOOK NUMBER(22, 0),
ID_USER NUMBER(22, 0),
CONSTRAINT "PK_LI_LISTING" PRIMARY KEY (ID_LISTING),
CONSTRAINT "FK_BOOK_LISTING" FOREIGN KEY (ID_BOOK) REFERENCES LI_BOOK(ID_BOOK)
); |
--dim_fp_funcionario (scd1)
create table "dim_fp_funcionario"
( "sk_funcionario" number not null enable,
"cod_funcionario" varchar2(10 byte),
"nome_funcionario" varchar2(20 byte),
"sobrenome_funcionario" varchar2(40 byte),
constraint "dim_fp_funcionario_dim_key_pk" primary key ("sk_funcionario"));
create index "nfuncionario_idx" on "dim_fp_funcionario" ("cod_funcionario");
-- dim_cargo (scd2)
create table "dim_fp_cargo"
( "sk_cargo" number not null enable,
"cod_cargo" varchar2(10 byte),
"des_cargo" varchar2(40 byte),
"dtc_inicio" date,
"dtc_fim" date,
constraint "dim_fp_cargo_dim_key_pk" primary key ("sk_cargo"));
create index "ncargo_idx" on "dim_fp_cargo" ("cod_cargo");
-- dim_fp_departamento (scd2)
create table "dim_fp_departamento"
( "sk_departamento" number not null enable,
"cod_departamento" varchar2(10 byte),
"des_departamento" varchar2(40 byte),
"dtc_inicio" date,
"dtc_fim" date,
constraint "dim_fp_departamento_dim_key_pk" primary key ("sk_departamento"));
create index "ndepartamento_idx" on "dim_fp_departamento" ("cod_departamento");
-- dim_fp_divisao (scd2)
create table "dim_fp_divisao"
( "sk_divisao" number not null enable,
"cod_divisao" varchar2(10 byte),
"des_divisao" varchar2(40 byte),
"dtc_inicio" date,
"dtc_fim" date,
constraint "dim_fp_divisao_dim_key_pk" primary key ("sk_divisao"));
create index "ndivisao_idx" on "dim_fp_divisao" ("cod_divisao");
-- dim_fp_tempo
create table "dim_fp_tempo"
( "sk_tempo" number not null enable,
"des_data_dia" varchar2(25 byte),
"dtc_data" date,
"num_ano" number(4,0),
"num_mes" number(3,0),
"num_dia" number(3,0),
"num_quadrimestre" number(3,0),
"num_trimestre" number(2,0),
"des_quinzena" varchar2(12 byte),
"des_quadrimestre" varchar2(12 byte),
"num_bimestre" number(3,0),
"des_bimestre" varchar2(12 byte),
"des_ano_mes" varchar2(8 byte),
"des_dia" varchar2(7 byte),
"num_semestre" number(3,0),
"des_mes_ano_numerico" varchar2(7 byte),
"des_trimestre" varchar2(12 byte),
"ind_final_semana" char(1 byte),
"des_mes" varchar2(15 byte),
"num_quinzena" number(3,0),
"des_mes_ano_completo" varchar2(30 byte),
"des_semestre" varchar2(12 byte),
"num_nivel" number(1,0),
"des_mes_ano" varchar2(8 byte),
constraint "dim_fp_tempo_dim_key_pk" primary key ("sk_tempo"));
create index "fptempo_idx" on "dim_fp_tempo" ("des_data_dia"); |
-- This is the first query:
SELECT DISTINCT year from population_years;
-- Add your additional queries below:
SELECT country, population, year
FROM population_years
WHERE country = 'Gabon'
ORDER BY population DESC;
SELECT country, population
FROM population_years
WHERE year = 2005
ORDER BY population ASC
LIMIT 10;
SELECT DISTINCT country
FROM population_years
WHERE year = 2010
AND population > 100;
SELECT COUNT(DISTINCT country)
FROM population_years
WHERE country LIKE '%Islands%';
SELECT country, population
FROM population_years
WHERE country = 'Indonesia'
AND year = 2000;
SELECT country, population
FROM population_years
WHERE country = 'Indonesia'
AND year = 2010;
|
alter table votes
drop foreign key fk_votes_decision_option_id;
drop index idx_votes_decision_option_id on votes;
alter table votes
add index idx_votes_decision_option_id (decision_option_id),
add constraint fk_votes_decision_option_id foreign key (decision_option_id) references decision_option_mapping (id); |
CREATE DATABASE IF NOT EXISTS `bd_grafico`;
# <PRODUCTO>
CREATE TABLE IF NOT EXISTS `bd_grafico`.`producto` (
`id` INT(255) NOT NULL AUTO_INCREMENT COMMENT 'id (Identificación)',
`producto_nombre` VARCHAR(50) NOT NULL COMMENT 'producto_nombre (Producto: Nombre)',
`producto_stock` VARCHAR(50) NOT NULL COMMENT 'producto_stock (Producto: Stock)',
PRIMARY KEY (`id`)
) ENGINE='InnoDB' DEFAULT CHARSET='utf8' COLLATE='utf8_bin' COMMENT='producto (Producto)';
INSERT INTO `bd_grafico`.`producto` VALUES(NULL, 'GASEOSA', 20);
INSERT INTO `bd_grafico`.`producto` VALUES(NULL, 'CHOCOLATES', 5);
INSERT INTO `bd_grafico`.`producto` VALUES(NULL, 'YOGURT', 10);
INSERT INTO `bd_grafico`.`producto` VALUES(NULL, 'SNACK', 3);
INSERT INTO `bd_grafico`.`producto` VALUES(NULL, 'ACEITE', 5);
CREATE PROCEDURE `SP_DATOSGRAFICOS_BAR`()
SELECT * FROM `producto`
# </PRODUCTO> |
-- phpMyAdmin SQL Dump
-- version 2.10.3
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 16-08-2013 a las 19:10:03
-- Versión del servidor: 5.0.51
-- Versión de PHP: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Base de datos: `diccionario`
--
CREATE DATABASE `diccionario` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `diccionario`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tabla`
--
CREATE TABLE `tabla` (
`id` int(10) unsigned NOT NULL auto_increment,
`palabra` varchar(30) NOT NULL,
`significado` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `palabra` (`palabra`,`significado`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Volcar la base de datos para la tabla `tabla`
--
|
DELETE FROM fxStageOperations;
INSERT INTO fxStageOperations (Name, Description, CanBeDelegated) VALUES ('View', 'View the stage', 0);
INSERT INTO fxStageOperations (Name, Description, CanBeDelegated) VALUES ('Pass', 'Pass the stage', 0);
DELETE FROM fxThemeOperations;
INSERT INTO fxThemeOperations (Name, Description, CanBeDelegated) VALUES ('View', 'View the theme', 0);
INSERT INTO fxThemeOperations (Name, Description, CanBeDelegated) VALUES ('Pass', 'Pass the theme', 0); |
-- Write a query against the professors table that can output the following in the result: "Chong works in the Science department"
SELECT last_name || ' works in the ' || department || ' department'
FROM professors;
SELECT 'It is '||(salary > 95000) || ' that professor' || last_name || ' is higly paid.'
FROM professors;
-- Write a query that returns all of the records and columns from the professors table
-- but shortens the department names to only the first three characters in upper case
SELECT last_name, UPPER(SUBSTRING(department, 1, 3)), salary, hire_date
FROM professors;
--Write a query that returns the highest and lowest salary from the professors table excluding the professor named 'Wilson'
SELECT MAX(salary) AS max_salary, MIN(salary) AS min_salary
FROM professors
WHERE last_name != 'Wilson';
-- Write a query that will display the hire date of the professor that has been teaching the longest
SELECT MIN(hire_date)
FROM professors; |
WHENEVER SQLERROR EXIT SQL.SQLCODE
CREATE TABLE tabla_ejemplo (
person_id NUMBER GENERATED BY DEFAULT AS IDENTITY,
first_name VARCHAR2(50) NOT NULL,
last_name VARCHAR2(50) NOT NULL,
PRIMARY KEY(person_id)
);
/
|
/*
* cleanRecipesAndIngredients.sql
*
* Drops the 'Recipes' and 'Ingredients' tables, and creates new (empty) ones in their place.
*
* Usage: mysql> SOURCE cleanRecipesAndIngredients.sql;
*
* Author: Mark Matney
*/
USE CS130;
DROP TABLE Recipes;
DROP TABLE Ingredients;
CREATE TABLE Recipes(
RecipeID INT NOT NULL AUTO_INCREMENT,
RecipeName VARCHAR(100) NOT NULL,
URL VARCHAR(512) NOT NULL,
Image VARCHAR(512) NOT NULL,
TotalCookingTime TIME,
Instructions VARCHAR(2500),
PRIMARY KEY(RecipeID)
);
CREATE TABLE Ingredients(
Recipe INT NOT NULL,
IngredientName VARCHAR(100) NOT NULL,
Quantity FLOAT,
Units VARCHAR(100),
FOREIGN KEY(Recipe) REFERENCES Recipes(RecipeID)
);
|
/*
User directory fails to sync with Confluence due to 'Unable to find user mapping' error
Link: https://confluence.atlassian.com/confkb/user-directory-fails-to-sync-with-confluence-due-to-unable-to-find-user-mapping-error-894116978.html
*/
SELECT * FROM cwd_user WHERE lower_user_name NOT IN (SELECT lower_username FROM user_mapping);
|
-- DoctoresPerteneciantesASeguros
select seguro.Nombre, persona.Nombre1, persona.nombre2, persona.ApellidoPaterno, persona.ApellidoMaterno from seguro
inner join hospital on seguro.CodSeguro=hospital.CodSeguro
inner join consultorio on hospital.CodHospital = consultorio.CodHospital
inner join medico on consultorio.CodConsultorio= medico.CodConsultorio
inner join persona on medico.CI = persona.CI |
-- Lists all cities in the database hbtn_0d_usa.
-- Records are sorted in order of ascending cities.id.
SELECT c.`id`, c.`name`, s.`name`
FROM `cities` AS c
INNER JOIN `states` AS s
ON c.`state_id` = s.`id`
ORDER BY c.`id`;
|
select user.name as name, photo_post.createdAt as date, photo_post.description as description
from mydb.photo_post
left join mydb.user on photo_post.user_iduser = user.iduser where length(photo_post.description) > 30
order by createdAt asc; |
/* ============================= */
create sequence code_push_seq
increment by 1
start with 10;
create table oraclegit_env (
environment_name varchar2(100) constraint oraclegit_env_pk primary key
, environment_value varchar2(4000)
);
insert into oraclegit_env values ('branch_level_setting', 'PRODMASTER');
insert into oraclegit_env values ('github_issues', 'N');
insert into oraclegit_env values ('privacy_level', 'PUBLIC');
insert into oraclegit_env values ('default_branch', 'DEV');
insert into oraclegit_env values ('multiple_schema_repos', 'N');
insert into oraclegit_env values ('github_wallet_location', 'file:/home/oracle/wallet');
insert into oraclegit_env values ('github_wallet_passwd', 'Manager123');
insert into oraclegit_env values ('github_api_location', 'https://api.github.com');
create table github_organization (
org_name varchar2(200) constraint github_org_pk primary key
);
create table github_account (
github_username varchar2(200) constraint github_account_pk primary key
, github_password varchar2(4000) constraint github_password_nn not null
, github_name varchar2(4000)
, github_email varchar2(4000)
, org_name varchar2(200) constraint github_account_org_ref references github_organization(org_name)
);
create table github_repository (
repository_name varchar2(4000) constraint gh_repos_pk primary key
, org_name varchar2(200) constraint gh_rep_org_ref references github_organization(org_name)
, repository_owner varchar2(200) constraint gh_rep_owner_ref references github_account(github_username)
, repository_branch varchar2(200) default 'DEV'
, issues_enabled varchar2(1) default 'N'
);
create table repository_schema (
schema_name varchar2(200) constraint rep_schema_pk primary key
, repository varchar2(4000) constraint schema_rep_ref references github_repository(repository_name)
);
create table repository_objects (
repository_name varchar2(4000) constraint object_rep_ref references github_repository(repository_name)
, schema_name varchar2(200) constraint object_schema_ref references repository_schema(schema_name)
, object_name varchar2(200) constraint object_name_nn not null
, object_type varchar2(200) constraint object_type_nn not null
, object_path varchar2(4000) constraint object_path_nn not null
);
create table repository_code_pushes (
code_push_id number constraint code_push_pk primary key
, code_data clob
); |
CREATE DATABASE friends_db;
USE friends_db;
create table friends(
ID int NOT NULL AUTO_INCREMENT,
name varchar(255) not null,
photo varchar(255) not null,
score_1 int not null,
score_2 int not null,
score_3 int not null,
score_4 int not null,
score_5 int not null,
score_6 int not null,
score_7 int not null,
score_8 int not null,
score_9 int not null,
score_10 int not null,
PRIMARY KEY (ID)
); |
drop table if exists t_directories;
create table t_directories(
did int(11) not null auto_increment,
dname varchar(100) not null,
primary key(did),
unique key dname using BTREE(dname)
)DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; |
#设置客户端连接服务器为utf-8
set names utf8;
#丢弃数据库cake,如果存在
drop database if exists cake;
#创建数据库cake,设置储存编码为utf-8
create database cake charset=utf8;
#进入数据库cake
use cake;
#创建首页数据列表
/*导航栏地址*/
CREATE TABLE address(
aid INT PRIMARY KEY AUTO_INCREMENT,#主键约束
address varchar(64) #地址
);
/*导航栏所有产品项*/
CREATE TABLE products(
pid INT PRIMARY KEY AUTO_INCREMENT,#主键约束
products varchar(64) #所有蛋糕
);
/*蛋糕口味筛选*/
CREATE TABLE taste(
tid INT PRIMARY KEY AUTO_INCREMENT,#主键约束
taste varchar(64) #口味
);
/*场景筛选*/
CREATE TABLE scene(
tid INT PRIMARY KEY AUTO_INCREMENT,#主键约束
fenlei varchar(12) ,#分类
scene varchar(64) #场景
);
/*用户信息*/
CREATE TABLE users(
uid INT PRIMARY KEY AUTO_INCREMENT,
uname VARCHAR(32),#用户名
upwd VARCHAR(32),#密码
user_name VARCHAR(32),#昵称
gender INT, #性别 0-女 1-男
birth VARCHAR(32),#生日
email VARCHAR(64),#邮箱
phone VARCHAR(16),#电话
avatar VARCHAR(128) #头像图片路径
);
/*首页轮播广告商品*/
CREATE TABLE cakecarousel(
cid INT PRIMARY KEY AUTO_INCREMENT,
img VARCHAR(128),
title VARCHAR(64),
href VARCHAR(128)
);
/*首页三排图片*/
CREATE TABLE threepictrue(
tid INT PRIMARY KEY AUTO_INCREMENT,
img VARCHAR(128),
href VARCHAR(128)
);
/*首页本季推荐下的图片*/
CREATE TABLE bigpicture(
tid INT PRIMARY KEY AUTO_INCREMENT,
img VARCHAR(128),
href VARCHAR(128)
);
/*商品列表头部口味*/
CREATE TABLE protaste(
tid INT PRIMARY KEY AUTO_INCREMENT,
fenlei varchar(12) ,#分类
proaddr VARCHAR(128)
);
/*蛋糕详情*/
CREATE TABLE list(
lid INT PRIMARY KEY AUTO_INCREMENT,#主键约束
fenlei varchar(12) ,#分类
cname varchar(120) ,#蛋糕名称
title varchar(120) ,#英文标题
price decimal(6,2),#价格
reserve varchar(64),#预定时间
category varchar(64),#口味
adetails varchar(64),#详情
bdetails varchar(64),#详情
cdetails varchar(64),#详情
sweet varchar(64),#甜味
tableware varchar(64),#标配餐具
size varchar(64),#尺寸
Storage varchar(64),#提示
Sweight varchar(64),#分量
shelfTime date,#上架时间
img varchar(128),#图片路径
xqimg varchar(128),#详情页图片路径
xqpcimg varchar(128),#详情页图片路径
spec varchar(128),#详情页图片路径
islndex bool #1>是,0>不是 是否为首页推荐
);
/*配件*/
CREATE TABLE peijian(
lid INT PRIMARY KEY AUTO_INCREMENT,#主键约束
img varchar(128),#配件1
title varchar(120),#标题
pricep decimal(6,2) #价格
);
/*导航栏地址*/
insert into address values
(null,"杭州市"),
(null,"上海市"),
(null,"苏州市"),
(null,"北京市");
/*导航栏所有产品项*/
insert into products values
(null,"所有蛋糕"),
(null,"所有小食"),
(null,"所有配件");
/*蛋糕口味筛选*/
insert into taste values
(null,"拿破仑系列"),
(null,"奶油系列"),
(null,"莫斯系列"),
(null,"芝士系列"),
(null,"巧克力系列"),
(null,"咖啡系列"),
(null,"坚果系列"),
(null,"水果系列"),
(null,"冰淇淋系列");
/*场景筛选*/
insert into scene values
(null,1,"生日"),
(null,2,"聚会"),
(null,1,"情侣"),
(null,3,"儿童"),
(null,3,"长辈"),
(null,2,"下午茶");
/*配件*/
insert into peijian values
(null,"http://localhost:3001/img/xaingqing/peijian/pj1.jpg","炫彩趣味礼包",39.90),
(null,"http://localhost:3001/img/xaingqing/peijian/pj2.jpg","缤纷欢乐礼包",29.90),
(null,"http://localhost:3001/img/xaingqing/peijian/pj3.jpg","生日牌",5.00),
(null,"http://localhost:3001/img/xaingqing/peijian/pj4.jpg","数字蜡烛",3.00);
/*蛋糕详情插入数据*/
insert into list values
(null,1,"约瑟玫瑰","Fleur de pêche",398.00,"提前24小时预定","奶油、水果","口味基底:Whipping Cream","口感:绵软细腻","口味:奶油/水果","甜味:2","标配餐具(免费)5份","SIZE:15cm*13cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.3磅(591g)适合2-3人食","2020-7-20","http://localhost:3001/img/list/new1.jpg","http://localhost:3001/img/xaingqing/1/detail1.jpg","http://localhost:3001/img/xaingqing/1/pc.jpg","约2磅 —— 900g",true),
(null,3,"爱之风物诗","Souhaiter Un Joyeux Anniversai",218.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new2.jpg","http://localhost:3001/img/xaingqing/2/detail1.jpg","http://localhost:3001/img/xaingqing/2/pc.jpg","约2磅 —— 900g",true),
(null,1,"男友力","Charmes masculins",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new3.jpg","http://localhost:3001/img/xaingqing/3/detail1.jpg","http://localhost:3001/img/xaingqing/3/pc.jpg","约2磅 —— 900g",true),
(null,6,"甜愿·生日蛋糕","Souhaiter Un Joyeux Anniversai",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new4.jpg","http://localhost:3001/img/xaingqing/4/detail1.jpg","http://localhost:3001/img/xaingqing/4/pc.jpg","约2磅 —— 900g",true),
(null,5,"阳光心芒","Le Soleil",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new5.jpg","http://localhost:3001/img/xaingqing/5/detail1.jpg","http://localhost:3001/img/xaingqing/5/pc.jpg","约2磅 —— 900g",true),
(null,2,"浓巧·迷情冰淇淋蛋糕","Choco ~ Mariage",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new6.jpg","http://localhost:3001/img/xaingqing/6/detail1.jpg","http://localhost:3001/img/xaingqing/6/pc.jpg","约2磅 —— 900g",true),
(null,4,"胖达乐园","Choco ~ Mariage",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new7.jpg","http://localhost:3001/img/xaingqing/7/detail1.jpg","http://localhost:3001/img/xaingqing/7/pc.jpg","约2磅 —— 900g",true),
(null,2,"尼诺 ","Nino",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new8.jpg","http://localhost:3001/img/xaingqing/8/detail1.jpg","http://localhost:3001/img/xaingqing/8/pc.jpg","约2磅 —— 900g",true),
(null,6,"安逸兔","lapin détendu",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new9.jpg","http://localhost:3001/img/xaingqing/9/detail1.jpg","http://localhost:3001/img/xaingqing/9/pc.jpg","约2磅 —— 900g",true),
(null,7,"黛西的旅行","Voyage de Daisy",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new10.jpg","http://localhost:3001/img/xaingqing/10/detail1.jpg","http://localhost:3001/img/xaingqing/10/pc.jpg","约2磅 —— 900g",true),
(null,9,"Finn的蘑菇星球","La planète champignon de Finn",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new11.jpg","http://localhost:3001/img/xaingqing/11/detail1.jpg","http://localhost:3001/img/xaingqing/11/pc.jpg","约2磅 —— 900g",true),
(null,8,"卢克和咚咚冰淇淋蛋糕","Luke et dondon",298.00,"提前5小时预定","慕斯、巧克力","口味基底:Mousse","口感:绵软细腻","口味:巧克力/干果","甜味:1","标配餐具(免费)10份","15.5cm*6cm(直径*高)","若不及时食用,请放置0-10℃冷藏","1.7磅(772g)适合4-7人食","2020-7-20","http://localhost:3001/img/list/new12.jpg","http://localhost:3001/img/xaingqing/12/detail1.jpg","http://localhost:3001/img/xaingqing/12/pc.jpg","约2磅 —— 900g",true);
/*用户信息插入数据*/
insert into users values
(null,"xiaoming","123456","王小明",1,"1998-03-30","1324546451@qq.com","18123304138",null),
(null,"dingding","121212","丁丁",0,"1997-04-10","1515421542@qq.com","18454542141",null);
/*首页轮播广告商品*/
INSERT INTO cakecarousel VALUES
(NULL,'http://localhost:3001/img/lunbo/big1.png','轮播广告商品1','/about/:1'),
(NULL,'http://localhost:3001/img/lunbo/big2.png','轮播广告商品2','/about/:2'),
(NULL,'http://localhost:3001/img/lunbo/big3.png','轮播广告商品3','/about/:3'),
(NULL,'http://localhost:3001/img/lunbo/big4.png','轮播广告商品4','/about/:4'),
(NULL,'http://localhost:3001/img/lunbo/big6.png','轮播广告商品5','/about/:5');
/*首页三排图片*/
INSERT INTO threepictrue VALUES
(NULL,'http://localhost:3001/img/body/3.1.jpg','/about/:1'),
(NULL,'http://localhost:3001/img/body/3.2.jpg','/about/:2'),
(NULL,'http://localhost:3001/img/body/3.3.jpg','/about/:3');
/*首页本季推荐下的图片*/
INSERT INTO bigpicture VALUES
(NULL,'http://localhost:3001/img/body/body1.jpg','/about/:4'),
(NULL,'http://localhost:3001/img/body/body2.jpg','/about/:5');
/*商品列表头部口味*/
INSERT INTO protaste VALUES
(null,1,"拿破仑"),
(null,2,"奶油"),
(null,3,"莫斯"),
(null,4,"芝士"),
(null,5,"巧克力"),
(null,6,"咖啡"),
(null,7,"坚果"),
(null,8,"水果"),
(null,9,"冰淇淋");
|
-- 序列 主键生成策略为sequence时使用
CREATE SEQUENCE "METAFORM"."SEQ_PENDINGTABLEID" MINVALUE 0 MAXVALUE 99999999999999 INCREMENT BY 1 START WITH 10 CACHE 10 NOORDER NOCYCLE
CREATE SEQUENCE "METAFORM"."SEQ_PENDINGRELATIONID" MINVALUE 0 MAXVALUE 99999999999999 INCREMENT BY 1 START WITH 10 CACHE 10 NOORDER NOCYCLE
-- 序列表 主键为tableGenerator时使用
CREATE TABLE "METAFORM"."HIBERNATE_SEQUENCES" (
"SEQ_NAME" VARCHAR2(15 BYTE) NOT NULL ,
"SEQ_VALUE" NUMBER(20) NULL
) |
SET search_path to :schema, public;
-- routes
ALTER TABLE routes
ADD CONSTRAINT route_types_fkey
FOREIGN KEY (route_type)
REFERENCES route_types (route_type);
ALTER TABLE routes
ADD CONSTRAINT routes_fkey
FOREIGN KEY (feed_index, agency_id)
REFERENCES agency (feed_index, agency_id);
-- calendar_dates
ALTER TABLE calendar_dates
ADD CONSTRAINT calendar_fkey
FOREIGN KEY (feed_index, service_id)
REFERENCES calendar (feed_index, service_id);
ALTER TABLE fare_attributes
ADD CONSTRAINT fare_attributes_fkey
FOREIGN KEY (feed_index, agency_id)
REFERENCES agency (feed_index, agency_id);
-- fare_rules
ALTER TABLE fare_rules
ADD CONSTRAINT fare_rules_service_fkey
FOREIGN KEY (feed_index, service_id)
REFERENCES calendar (feed_index, service_id);
ALTER TABLE fare_rules
ADD CONSTRAINT fare_rules_fare_id_fkey
FOREIGN KEY (feed_index, fare_id)
REFERENCES fare_attributes (feed_index, fare_id);
ALTER TABLE fare_rules
ADD CONSTRAINT fare_rules_route_id_fkey
FOREIGN KEY (feed_index, route_id)
REFERENCES routes (feed_index, route_id);
-- trips
ALTER TABLE trips
ADD CONSTRAINT trips_route_id_fkey
FOREIGN KEY (feed_index, route_id)
REFERENCES routes (feed_index, route_id);
ALTER TABLE trips
ADD CONSTRAINT trips_calendar_fkey
FOREIGN KEY (feed_index, service_id)
REFERENCES calendar (feed_index, service_id);
-- stop_times
ALTER TABLE stop_times
ADD CONSTRAINT stop_times_trips_fkey
FOREIGN KEY (feed_index, trip_id)
REFERENCES trips (feed_index, trip_id);
ALTER TABLE stop_times
ADD CONSTRAINT stop_times_stops_fkey
FOREIGN KEY (feed_index, stop_id)
REFERENCES stops (feed_index, stop_id);
-- frequencies
ALTER TABLE frequencies
ADD CONSTRAINT frequencies_trip_fkey
FOREIGN KEY (feed_index, trip_id)
REFERENCES trips (feed_index, trip_id);
-- transfers
ALTER TABLE transfers
ADD CONSTRAINT transfers_from_stop_fkey
FOREIGN KEY (feed_index, from_stop_id)
REFERENCES stops (feed_index, stop_id);
ALTER TABLE transfers
ADD CONSTRAINT transfers_to_stop_fkey
FOREIGN KEY (feed_index, to_stop_id)
REFERENCES stops (feed_index, stop_id);
ALTER TABLE transfers
ADD CONSTRAINT transfers_from_route_fkey
FOREIGN KEY (feed_index, from_route_id)
REFERENCES routes (feed_index, route_id);
ALTER TABLE transfers
ADD CONSTRAINT transfers_to_route_fkey
FOREIGN KEY (feed_index, to_route_id)
REFERENCES routes (feed_index, route_id);
ALTER TABLE transfers
ADD CONSTRAINT transfers_service_fkey
FOREIGN KEY (feed_index, service_id)
REFERENCES calendar (feed_index, service_id);
|
-- customer who subscribed to marketing email and placed orders
CREATE VIEW mailing_list
AS
select
distinct cu.email as email, gen.genre_description as genre_preference from Genre gen, Product p,
Customer cu, OrderDetail od
where
gen.genre_id = p.Genre_genre_id
AND cu.subscribed = 1
AND cu.email = od.Customer_email
AND p.ISBN13 = od.Product_ISBN13
-- subscribed customers' genre preferences
CREATE VIEW Customer_genre_preferences AS
SELECT email,GROUP_CONCAT(distinct genre_preference) as "genres"
FROM mailing_list
GROUP BY email;
|
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- 主機: localhost:3306
-- 產生時間: 2018 年 03 月 28 日 15:54
-- 伺服器版本: 5.6.39-cll-lve
-- PHP 版本: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- 資料庫: `internat_messenger`
--
-- --------------------------------------------------------
--
-- 資料表結構 `moneyhistory`
--
CREATE TABLE `moneyhistory` (
`id` int(255) NOT NULL,
`userid` text COLLATE utf8_unicode_ci NOT NULL,
`howtouse` text COLLATE utf8_unicode_ci,
`subuse` text COLLATE utf8_unicode_ci,
`inorout` text COLLATE utf8_unicode_ci NOT NULL,
`money` text COLLATE utf8_unicode_ci,
`description` text COLLATE utf8_unicode_ci,
`record` text COLLATE utf8_unicode_ci,
`year` text COLLATE utf8_unicode_ci NOT NULL,
`month` text COLLATE utf8_unicode_ci NOT NULL,
`day` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- 資料表的匯出資料 `moneyhistory`
--
INSERT INTO `moneyhistory` (`id`, `userid`, `howtouse`, `subuse`, `inorout`, `money`, `description`, `record`, `year`, `month`, `day`) VALUES
(29, 'Ua26fb8ffde57c999926d03b22f8b7434', NULL, NULL, 'in', NULL, NULL, 'cab704ba75', '2018', '2', '17'),
(28, 'Ua26fb8ffde57c999926d03b22f8b7434', NULL, NULL, 'in', NULL, NULL, 'b6fca51a6c', '2018', '2', '17'),
(98, 'U078c4858e8456e3e52e1f4fc90254e70', '其他收入', NULL, 'in', '632', NULL, 'b6cba80207', '2018', '2', '26'),
(26, 'U2f9a518831f3cad25d9d912564547ecb', NULL, NULL, 'in', NULL, NULL, '7cf4177e40', '2018', '2', '17'),
(27, 'U2e2700b5c586ae27b7904802bd6c5b8c', '其他收入', NULL, 'in', NULL, NULL, '7fc04e79a8', '2018', '2', '17'),
(25, 'U9e9ee16886c74444fafe2660b520668c', NULL, NULL, 'in', NULL, NULL, 'cfaf730b80', '2018', '2', '17'),
(23, 'U9e9ee16886c74444fafe2660b520668c', '食品酒水支出', NULL, 'out', '200', NULL, '0f58da731e', '2018', '2', '17'),
(53, 'U1a14d3d120eb1348b3eb7c3a5a71e0d5', '其他收入', NULL, 'in', NULL, NULL, '59f33c7d68', '2018', '2', '19'),
(21, 'U9e9ee16886c74444fafe2660b520668c', NULL, NULL, 'in', NULL, NULL, 'f8fa3adbf6', '2018', '2', '17'),
(30, 'Ua26fb8ffde57c999926d03b22f8b7434', NULL, NULL, 'in', NULL, NULL, 'dffd35cca5', '2018', '2', '17'),
(31, 'Ua26fb8ffde57c999926d03b22f8b7434', '工作收入', NULL, 'out', '1000', NULL, '3bed8c96c5', '2018', '2', '17'),
(32, 'U0975e518c713b9a66831ab7496670eba', '工作收入', NULL, 'in', NULL, NULL, 'e1c8cea52a', '2018', '2', '17'),
(33, 'U0975e518c713b9a66831ab7496670eba', '工作收入', NULL, 'in', '5000', NULL, 'c306727e41', '2018', '2', '17'),
(34, 'U0975e518c713b9a66831ab7496670eba', NULL, NULL, 'out', NULL, NULL, '0d8e26c1c4', '2018', '2', '17'),
(51, 'Ue2c16050aac96b870eecc7a8891039b8', '其他收入', NULL, 'in', '1500', NULL, '0b9d4554f2', '2018', '2', '18'),
(36, 'U078c4858e8456e3e52e1f4fc90254e70', '其他收入', NULL, 'in', '3000', NULL, '2fcb3f6527', '2018', '2', '18'),
(37, 'Ua53ad9c3efc2828ec1f649b64dc2ea6b', NULL, NULL, 'in', NULL, NULL, '01da71ca8c', '2018', '2', '18'),
(38, 'Ua53ad9c3efc2828ec1f649b64dc2ea6b', '工作收入', NULL, 'out', NULL, NULL, 'f8c91ed16c', '2018', '2', '18'),
(39, 'Ud2b5f36322b7583e3ea292bb72c9a012', '食品酒水支出', NULL, 'out', NULL, NULL, '4bfb316fa4', '2018', '2', '18'),
(40, 'U1134bd0925fa2f2af2305de8fe3973e8', NULL, NULL, 'in', NULL, NULL, 'a457373fab', '2018', '2', '18'),
(41, 'U1134bd0925fa2f2af2305de8fe3973e8', '食品酒水支出', NULL, 'out', NULL, NULL, 'aeb64a5cbf', '2018', '2', '18'),
(42, 'U1134bd0925fa2f2af2305de8fe3973e8', '食品酒水支出', NULL, 'out', '300', NULL, 'c5e294b48a', '2018', '2', '18'),
(43, 'U1134bd0925fa2f2af2305de8fe3973e8', NULL, NULL, 'in', NULL, NULL, '8693ad0126', '2018', '2', '18'),
(44, 'U1134bd0925fa2f2af2305de8fe3973e8', NULL, NULL, 'in', NULL, NULL, '72eb64fcfc', '2018', '2', '18'),
(52, 'Ue2c16050aac96b870eecc7a8891039b8', '行車交通支出', NULL, 'out', '200', NULL, 'ed5283c0f7', '2018', '2', '18'),
(46, 'U253330e077ac44a65b2f020385d44dcc', '休閒娛樂支出', NULL, 'out', '920', NULL, 'def5dba2d8', '2018', '2', '18'),
(47, 'U97a361d3b3a3b88396eeaf140f558f20', '工作收入', NULL, 'in', NULL, NULL, '62f2426bc8', '2018', '2', '18'),
(48, 'Ub3064a0ca186df76488e3808e3f462ae', '工作收入', NULL, 'in', '1000', NULL, 'e87214457a', '2018', '2', '18'),
(49, 'Ub3064a0ca186df76488e3808e3f462ae', '其他支出', '咖啡', 'out', '50', NULL, '36425c6138', '2018', '2', '18'),
(50, 'U9e9ee16886c74444fafe2660b520668c', '食品酒水支出', NULL, 'out', '120', NULL, '796fa2d4dd', '2018', '2', '18'),
(54, 'U1a14d3d120eb1348b3eb7c3a5a71e0d5', NULL, NULL, 'out', '[now]', NULL, 'e33d0e1f08', '2018', '2', '19'),
(83, 'Ueed65fdbd6c510b759c03299581716ac', '食品酒水支出', NULL, 'out', '274', NULL, 'cb76ca208f', '2018', '2', '23'),
(56, 'U9e9ee16886c74444fafe2660b520668c', '食品酒水支出', NULL, 'out', '110', NULL, '19a0aa0083', '2018', '2', '19'),
(57, 'U9e9ee16886c74444fafe2660b520668c', NULL, NULL, 'in', NULL, NULL, '555b395024', '2018', '2', '19'),
(58, 'U9e9ee16886c74444fafe2660b520668c', '休閒娛樂支出', NULL, 'out', '1150', NULL, '785bcf2c42', '2018', '2', '19'),
(59, 'U253330e077ac44a65b2f020385d44dcc', '食品酒水支出', NULL, 'out', '咖啡 45', NULL, '06e0710428', '2018', '2', '19'),
(60, 'U253330e077ac44a65b2f020385d44dcc', '其他支出', '誠品買書 信用卡 1451', 'out', '1451', NULL, '6729a4e9fc', '2018', '2', '19'),
(61, 'U70d3edd1c5d47691decc4a9bda0e7624', '工作收入', NULL, 'in', '10000', NULL, '33d79aca20', '2018', '2', '20'),
(62, 'U70d3edd1c5d47691decc4a9bda0e7624', '工作收入', NULL, 'in', 'Dgud do', NULL, 'e26ab9dadf', '2018', '2', '20'),
(63, 'U70d3edd1c5d47691decc4a9bda0e7624', '食品酒水支出', NULL, 'out', '922337203685477580789999999999999999999', NULL, '38044b59fe', '2018', '2', '20'),
(64, 'U70d3edd1c5d47691decc4a9bda0e7624', '其他支出', NULL, 'out', NULL, NULL, '5589fdf2db', '2018', '2', '20'),
(65, 'U253330e077ac44a65b2f020385d44dcc', '其他支出', '喬治傑生名片夾', 'out', '999', NULL, '31faa33241', '2018', '2', '20'),
(66, 'U253330e077ac44a65b2f020385d44dcc', '食品酒水支出', NULL, 'out', '125', NULL, '8e8c71661a', '2018', '2', '20'),
(67, 'U253330e077ac44a65b2f020385d44dcc', '食品酒水支出', NULL, 'out', '220', NULL, 'c34708eba2', '2018', '2', '20'),
(68, 'U253330e077ac44a65b2f020385d44dcc', '休閒娛樂支出', NULL, 'out', NULL, NULL, 'a821a13891', '2018', '2', '20'),
(69, 'U6b723b60f925c31c8545abcbcb1a7bc7', '工作收入', NULL, 'in', '0', NULL, 'a6614a447a', '2018', '2', '20'),
(70, 'U4bbe0987e3771116ac5455618644cbb5', NULL, NULL, 'in', NULL, NULL, '3a0982fede', '2018', '2', '21'),
(71, 'U4bbe0987e3771116ac5455618644cbb5', '食品酒水支出', NULL, 'out', '98', NULL, 'aecf4ff2fc', '2018', '2', '21'),
(72, 'U4e62144690220252b8d2eb8730ab1313', '其他收入', NULL, 'in', '30100', NULL, 'c0828205f7', '2018', '2', '21'),
(73, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '230', NULL, '041a2ba21a', '2018', '2', '21'),
(74, 'U4e62144690220252b8d2eb8730ab1313', '其他支出', '10000', 'out', '10000', NULL, '7770de94d5', '2018', '2', '21'),
(82, 'Ueed65fdbd6c510b759c03299581716ac', NULL, NULL, 'in', NULL, NULL, '9de5365118', '2018', '2', '23'),
(76, 'U4e62144690220252b8d2eb8730ab1313', '休閒娛樂支出', NULL, 'out', '400', NULL, 'ca2e56a193', '2018', '2', '21'),
(77, 'U4e62144690220252b8d2eb8730ab1313', '其他支出', '11300', 'out', '11300', NULL, '5b50ae836d', '2018', '2', '22'),
(78, 'U9e9ee16886c74444fafe2660b520668c', '食品酒水支出', NULL, 'out', '110', NULL, 'ca000d7697', '2018', '2', '22'),
(79, 'U9e9ee16886c74444fafe2660b520668c', '其他收入', NULL, 'in', '1000', NULL, '5bea3bea51', '2018', '2', '22'),
(80, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '130', NULL, 'eae6e5b04a', '2018', '2', '22'),
(81, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '15', NULL, '6e7f3c7452', '2018', '2', '22'),
(84, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '55', NULL, 'e66c442049', '2018', '2', '23'),
(85, 'U601ce7a16a8d052738bd6ccbe5628add', '食品酒水支出', NULL, 'out', '90', NULL, '08fa122050', '2018', '2', '23'),
(86, 'U601ce7a16a8d052738bd6ccbe5628add', NULL, NULL, 'out', NULL, NULL, 'deaa2567fb', '2018', '2', '23'),
(87, 'U9a9f12f26c7805e953c52b20602ae2ec', '食品酒水支出', NULL, 'out', '95', NULL, 'f4cf1f47df', '2018', '2', '23'),
(88, 'U4e62144690220252b8d2eb8730ab1313', '其他收入', NULL, 'in', '700', NULL, 'c82f3573dd', '2018', '2', '23'),
(89, 'U9e9ee16886c74444fafe2660b520668c', '食品酒水支出', NULL, 'out', '90', NULL, 'b76a4a9835', '2018', '2', '23'),
(90, 'Ufe9d2d04be1ab4aa06f21a5f143c0fd3', '工作收入', NULL, 'in', '999999', NULL, '270c31408a', '2018', '2', '23'),
(91, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '535', NULL, '7721fdfd69', '2018', '2', '23'),
(92, 'U4e62144690220252b8d2eb8730ab1313', NULL, NULL, 'in', NULL, NULL, 'c503fa7fbe', '2018', '2', '24'),
(93, 'U4e62144690220252b8d2eb8730ab1313', NULL, NULL, 'out', NULL, NULL, '7d2ef64b85', '2018', '2', '24'),
(94, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '105', NULL, '8f6323e326', '2018', '2', '24'),
(95, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '180', NULL, '5b77e0b50c', '2018', '2', '24'),
(96, 'Ufebfb69d632f5c05c1f298d89c29fe36', '其他收入', NULL, 'in', '615', NULL, '2452b2faff', '2018', '2', '26'),
(97, 'Ufebfb69d632f5c05c1f298d89c29fe36', '食品酒水支出', NULL, 'out', '50', NULL, 'c75bd77f09', '2018', '2', '26'),
(99, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '50', NULL, '27e13f2c83', '2018', '2', '26'),
(100, 'U078c4858e8456e3e52e1f4fc90254e70', '其他支出', '學校用途', 'out', '12', NULL, 'c1700f0d3a', '2018', '2', '26'),
(101, 'U9e9ee16886c74444fafe2660b520668c', '食品酒水支出', NULL, 'out', '40', NULL, '831ffa1a54', '2018', '2', '26'),
(102, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '185', NULL, '5f69924212', '2018', '2', '26'),
(103, 'Ufebfb69d632f5c05c1f298d89c29fe36', '行車交通支出', NULL, 'out', '100', NULL, 'afa1101c56', '2018', '2', '26'),
(104, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '135', NULL, '19365bbdf3', '2018', '2', '26'),
(105, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '15', NULL, '7f457954d3', '2018', '2', '27'),
(106, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '20', NULL, 'e6af1c00a7', '2018', '2', '27'),
(107, 'Ufebfb69d632f5c05c1f298d89c29fe36', '食品酒水支出', NULL, 'out', '50', NULL, 'dc8d563de1', '2018', '2', '27'),
(108, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '0', NULL, '3e2a4f8d86', '2018', '2', '27'),
(109, 'U4e62144690220252b8d2eb8730ab1313', '其他支出', '學雜', 'out', '560', NULL, '39de4e906b', '2018', '2', '27'),
(110, 'U4e62144690220252b8d2eb8730ab1313', '其他支出', '信用卡', 'out', '5200', NULL, '779cf81854', '2018', '2', '27'),
(111, 'U078c4858e8456e3e52e1f4fc90254e70', '其他收入', NULL, 'in', '100', NULL, '98b15d2832', '2018', '2', '27'),
(112, 'U078c4858e8456e3e52e1f4fc90254e70', NULL, NULL, 'out', NULL, NULL, 'b3408b83cb', '2018', '2', '27'),
(113, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '50', NULL, '52ec79edec', '2018', '2', '27'),
(114, 'U078c4858e8456e3e52e1f4fc90254e70', '行車交通支出', NULL, 'out', '60', NULL, '9ea3aade16', '2018', '2', '27'),
(115, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '145', NULL, '9735d4d98b', '2018', '2', '27'),
(116, 'U90c2a73b78eab2f364ebecd59ac4609b', '其他收入', NULL, 'in', '10000', NULL, 'f89a29a264', '2018', '2', '28'),
(117, 'U90c2a73b78eab2f364ebecd59ac4609b', '食品酒水支出', NULL, 'out', '65', NULL, 'd5c85bf994', '2018', '2', '28'),
(118, 'U9aef6dd46ae75549c4322c577b67c2f9', NULL, NULL, 'in', NULL, NULL, 'ecae0f287c', '2018', '2', '28'),
(119, 'U9aef6dd46ae75549c4322c577b67c2f9', NULL, NULL, 'out', NULL, NULL, '2087236a8c', '2018', '2', '28'),
(120, 'U078c4858e8456e3e52e1f4fc90254e70', '其他支出', '多餘', 'out', '206', NULL, 'd14215b8ff', '2018', '2', '28'),
(121, 'U078c4858e8456e3e52e1f4fc90254e70', '其他收入', NULL, 'in', '200', NULL, '295668588c', '2018', '2', '28'),
(122, 'U078c4858e8456e3e52e1f4fc90254e70', '行車交通支出', NULL, 'out', '100', NULL, 'a852aec75f', '2018', '3', '1'),
(123, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '50', NULL, '01ccd24b61', '2018', '3', '1'),
(124, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '30', NULL, 'c13170efa1', '2018', '3', '1'),
(125, 'U4e62144690220252b8d2eb8730ab1313', '食品酒水支出', NULL, 'out', '165', NULL, '82bc067306', '2018', '3', '1'),
(126, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '12', NULL, 'afce2e718b', '2018', '3', '1'),
(127, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '111', NULL, 'edd2ab905f', '2018', '3', '2'),
(128, 'U078c4858e8456e3e52e1f4fc90254e70', '其他支出', '借媽媽', 'out', '100', NULL, '2a1126e36c', '2018', '3', '2'),
(129, 'U078c4858e8456e3e52e1f4fc90254e70', '行車交通支出', NULL, 'out', '100', NULL, '6ad5ac66c6', '2018', '3', '2'),
(130, 'U078c4858e8456e3e52e1f4fc90254e70', '其他收入', NULL, 'in', '100', NULL, 'dfc2a45026', '2018', '3', '2'),
(131, 'Ufebfb69d632f5c05c1f298d89c29fe36', '其他收入', NULL, 'in', '200', NULL, '7a612d404c', '2018', '3', '2'),
(132, 'Ufebfb69d632f5c05c1f298d89c29fe36', '食品酒水支出', NULL, 'out', '39', NULL, '655ce89ee6', '2018', '3', '2'),
(133, 'Ufebfb69d632f5c05c1f298d89c29fe36', '行車交通支出', NULL, 'out', '100', NULL, '0d242da97c', '2018', '3', '2'),
(134, 'Ufebfb69d632f5c05c1f298d89c29fe36', '食品酒水支出', NULL, 'out', '28', NULL, '975e917364', '2018', '3', '2'),
(135, 'U078c4858e8456e3e52e1f4fc90254e70', '其他支出', '員生社', 'out', '100', NULL, 'ece83892be', '2018', '3', '2'),
(136, 'U078c4858e8456e3e52e1f4fc90254e70', '食品酒水支出', NULL, 'out', '65', NULL, '84505f0be0', '2018', '3', '3'),
(137, 'U078c4858e8456e3e52e1f4fc90254e70', '其他收入', NULL, 'in', '332', NULL, '154b86860d', '2018', '3', '3'),
(138, 'U078c4858e8456e3e52e1f4fc90254e70', '其他收入', NULL, 'in', '10', NULL, 'e8f29f2eed', '2018', '3', '3'),
(139, 'Ufebfb69d632f5c05c1f298d89c29fe36', '其他收入', NULL, 'in', '200', NULL, '73b2c1fd75', '2018', '3', '5'),
(140, 'Ufebfb69d632f5c05c1f298d89c29fe36', '食品酒水支出', NULL, 'out', '30', NULL, 'fbb1e33624', '2018', '3', '5'),
(141, 'Uf945114efe46de5263e70bd36ea84e3c', '其他收入', NULL, 'in', '[now]', NULL, '099fed4ee9', '2018', '3', '15'),
(142, 'U95828cdba19b2f9394f1e9b11f9438d5', '工作收入', NULL, 'in', NULL, NULL, '45887eb78f', '2018', '3', '15'),
(143, 'Ud8c16a5c85693acbae1d58fead3dcea1', '工作收入', NULL, 'in', NULL, NULL, 'fb2c63e6c2', '2018', '3', '15'),
(144, 'U387e447c67d1d55c381136e78e7fcc03', '工作收入', NULL, 'in', NULL, NULL, '42b0b07f29', '2018', '3', '15'),
(145, 'Uf12ca427cb41b099d3c0c332bd306bff', NULL, NULL, 'in', NULL, NULL, 'c7029ba69f', '2018', '3', '15'),
(146, 'U95828cdba19b2f9394f1e9b11f9438d5', NULL, NULL, 'in', NULL, NULL, '24a63816b7', '2018', '3', '15'),
(147, 'Uf12ca427cb41b099d3c0c332bd306bff', '工作收入', NULL, 'in', '5000', NULL, 'fda48f43b0', '2018', '3', '15'),
(148, 'U5ce44f82d2b8be9eea7e327777149b2e', '工作收入', NULL, 'in', NULL, NULL, 'a0cdb16f21', '2018', '3', '15'),
(149, 'U677ea9cbb1fba5459fe5e699e72c54de', NULL, NULL, 'in', NULL, NULL, '1fdc929218', '2018', '3', '15'),
(150, 'U677ea9cbb1fba5459fe5e699e72c54de', '行車交通支出', NULL, 'out', '[now]', NULL, '9dfec032f6', '2018', '3', '15'),
(151, 'U677ea9cbb1fba5459fe5e699e72c54de', NULL, NULL, 'in', NULL, NULL, '00ace34d55', '2018', '3', '16');
-- --------------------------------------------------------
--
-- 資料表結構 `moneyuser`
--
CREATE TABLE `moneyuser` (
`id` int(255) NOT NULL,
`userid` text COLLATE utf8_unicode_ci NOT NULL,
`nickname` text COLLATE utf8_unicode_ci NOT NULL,
`email` text COLLATE utf8_unicode_ci NOT NULL,
`sex` text COLLATE utf8_unicode_ci NOT NULL,
`nowmoney` text COLLATE utf8_unicode_ci NOT NULL,
`record` text COLLATE utf8_unicode_ci,
`mode` text COLLATE utf8_unicode_ci,
`invite` text COLLATE utf8_unicode_ci,
`inviter` text COLLATE utf8_unicode_ci
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- 資料表的匯出資料 `moneyuser`
--
INSERT INTO `moneyuser` (`id`, `userid`, `nickname`, `email`, `sex`, `nowmoney`, `record`, `mode`, `invite`, `inviter`) VALUES
(3, 'U078c4858e8456e3e52e1f4fc90254e7', 'Stan', 'lol97554@gmail.com', '男', '3293', NULL, NULL, '26fe4', 'sdnk'),
(4, 'U9e9ee16886c74444fafe2660b520668c', 'SA', 'jeremychang919@gmail.com', '男', '-11280', NULL, '', NULL, NULL),
(5, 'U2f9a518831f3cad25d9d912564547ecb', 'Ski', 'Ski@socialweb.com.tw', '男', '0', '7cf4177e40', NULL, NULL, NULL),
(6, 'U2e2700b5c586ae27b7904802bd6c5b8c', '晴晴', 'saseminy@gmail.com', '女', '0', '7fc04e79a8', NULL, NULL, NULL),
(7, 'Ua26fb8ffde57c999926d03b22f8b7434', '蘿拉', 'skypiea2010@gmail.com', '女', '0', NULL, '', NULL, NULL),
(11, 'U4e62144690220252b8d2eb8730ab1313', 'DK', 'a0975725639@gmail.com', '男', '1460', NULL, '', NULL, NULL),
(9, 'U0975e518c713b9a66831ab7496670eba', 'May', 'ar841011@yahoo.com.tw', '女', '5000', '0d8e26c1c4', '', NULL, NULL),
(10, 'U72c3a6447ace48825d93c2eab70981ea', '納豆吳', 'dht141414@gmail.com', '男', '0', NULL, NULL, NULL, NULL),
(12, 'Ua53ad9c3efc2828ec1f649b64dc2ea6b', '都市野人', 'mineral0629@gmail.com', '男', '0', 'f8c91ed16c', NULL, NULL, NULL),
(13, 'Ud2b5f36322b7583e3ea292bb72c9a012', '娟', 'yahorng@hotmail.com', '女', '0', '4bfb316fa4', NULL, NULL, NULL),
(14, 'U1134bd0925fa2f2af2305de8fe3973e8', 'kevinaalin', 'kevinaa@seed.net.tw', '男', '1000', NULL, NULL, NULL, NULL),
(15, 'U253330e077ac44a65b2f020385d44dcc', '維也納奇異果', 'xavierkiwi@gmail.com', '男', '-3715', 'a821a13891', NULL, NULL, NULL),
(16, 'U97a361d3b3a3b88396eeaf140f558f20', 'Carol', 'spp3990@gmail.com', '女', '0', '62f2426bc8', NULL, NULL, NULL),
(17, 'Ub3064a0ca186df76488e3808e3f462ae', 'Amanda ', 'skylightshop321@gmail.com', '女', '950', NULL, '', NULL, NULL),
(18, 'Ue2c16050aac96b870eecc7a8891039b8', 'Ethan', 'ethanlee1101@gmail.com', '男', '1300', NULL, '', NULL, NULL),
(19, 'U1a14d3d120eb1348b3eb7c3a5a71e0d5', 'Andy', 'lfu0327@gmail.com', '男', '0', NULL, '', NULL, NULL),
(20, 'U1be84467bdbfb20c7aa6d8a73020e50c', 'Khsu', 'Kh@cloudmii.com', '男', '0', NULL, NULL, NULL, NULL),
(21, 'U70d3edd1c5d47691decc4a9bda0e7624', 'F', 'Qq@qq.com', '男', '-9.2233720368548E+38', '5589fdf2db', NULL, NULL, NULL),
(22, 'U6b723b60f925c31c8545abcbcb1a7bc7', '眼睛', 'crab992010@gmail.com', '男', '0', NULL, '', NULL, NULL),
(23, 'U4bbe0987e3771116ac5455618644cbb5', '公主', 'Eyes1117@hotmail.com', '女', '-98', NULL, '', NULL, NULL),
(24, 'Ueed65fdbd6c510b759c03299581716ac', 'Gina', 'wg98212@yahoo.com.tw', '女', '-274', NULL, '', NULL, NULL),
(25, 'U601ce7a16a8d052738bd6ccbe5628add', 'Axtol', 'Annieya814@gmail.com', '女', '-180', 'deaa2567fb', '', NULL, NULL),
(26, 'U9a9f12f26c7805e953c52b20602ae2ec', 'shiung', 'annie-shiung@yahoo.com.tw', '女', '-95', NULL, '', NULL, NULL),
(27, 'Ufe9d2d04be1ab4aa06f21a5f143c0fd3', 'Rick', 'Aaa@aaa.me', '男', '999999', NULL, '', NULL, NULL),
(28, 'U3b46a4acedc6d8b0414f3e5db123b4f6', 'Vera', 'veralimlim@gmail.com', '女', '0', NULL, NULL, NULL, NULL),
(29, 'Ufebfb69d632f5c05c1f298d89c29fe36', '賴昱辰', 'demo@127.0.0.1', '女', '618', NULL, '', NULL, NULL),
(30, 'U90c2a73b78eab2f364ebecd59ac4609b', '球球', 'ballball0612@yahoo.com.tw', '女', '9875', NULL, '', NULL, NULL),
(31, 'U9aef6dd46ae75549c4322c577b67c2f9', '阿德', 'faxx5168@gmail.com', '男', '0', NULL, NULL, NULL, NULL),
(32, 'U9aef6dd46ae75549c4322c577b67c2f9', '阿德', 'faxx5168@gmail.com', '男', '0', '2087236a8c', NULL, NULL, NULL),
(33, 'Uf945114efe46de5263e70bd36ea84e3c', '胡力仁', 'larry840506@gmail.com', '男', '0', NULL, '', NULL, NULL),
(34, 'U5ce44f82d2b8be9eea7e327777149b2e', 'Test123', 'Test123', '女', '0', 'a0cdb16f21', 'updatemoney', NULL, NULL),
(35, 'Uf12ca427cb41b099d3c0c332bd306bff', 'Jackal', 'jackalma630821@gmail.com', '男', '5000', NULL, '', NULL, NULL),
(36, 'U95828cdba19b2f9394f1e9b11f9438d5', 'Jojo', 'Jojo831001@gmail.com', '女', '0', '24a63816b7', '', NULL, NULL),
(37, 'Ud8c16a5c85693acbae1d58fead3dcea1', '小高', 'mathew@materialworld.com.tw', '男', '0', NULL, NULL, NULL, NULL),
(38, 'Ud8c16a5c85693acbae1d58fead3dcea1', '小高', 'mathew@materialworld.com.tw', '男', '0', 'fb2c63e6c2', 'updatemoney', NULL, NULL),
(39, 'U387e447c67d1d55c381136e78e7fcc03', '上珍', 'a82862332@yahoo.com.tw', '女', '0', '42b0b07f29', 'updatemoney', NULL, NULL),
(40, 'U677ea9cbb1fba5459fe5e699e72c54de', '囂張', 'osca1689@yahoo.com.tw', '男', '0', '00ace34d55', '', NULL, NULL),
(41, 'U078c4858e8456e3e52e1f4fc90254e70', 'Stan', 'Tesr', '男', '0', NULL, NULL, NULL, NULL);
--
-- 已匯出資料表的索引
--
--
-- 資料表索引 `moneyhistory`
--
ALTER TABLE `moneyhistory`
ADD PRIMARY KEY (`id`);
--
-- 資料表索引 `moneyuser`
--
ALTER TABLE `moneyuser`
ADD PRIMARY KEY (`id`);
--
-- 在匯出的資料表使用 AUTO_INCREMENT
--
--
-- 使用資料表 AUTO_INCREMENT `moneyhistory`
--
ALTER TABLE `moneyhistory`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=152;
--
-- 使用資料表 AUTO_INCREMENT `moneyuser`
--
ALTER TABLE `moneyuser`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
USE sample;
IF (SELECT COUNT(*)
FROM works_on
WHERE proj_id = 1
GROUP BY proj_id ) > 3
PRINT 'The number of employees in the project p1 is 4 or more'
ELSE BEGIN
PRINT 'The following employees work for the project p1'
SELECT emp_fname, emp_lname
FROM employee, works_on
WHERE employee.emp_id = works_on.emp_id
AND proj_id = 1
END
USE sample;
WHILE (SELECT SUM(proj_budget) FROM project) < 500000
BEGIN
UPDATE project SET proj_budget = proj_budget*1.1
IF (SELECT MAX(proj_budget) FROM project) > 240000
BREAK
ELSE
CONTINUE
END |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.