text
stringlengths 6
9.38M
|
|---|
alter table message drop constraint message_to_user_fkey;
alter table message drop column to_user;
alter table message add column to_project int8 references project;
|
create table member (
name varchar2(30),
userid varchar2(30) primary key,
pwd varchar2(20),
email varchar2(30),
phone char(13),
admin number(1)
);
|
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
-- ---------------------------
CREATE TABLE IF NOT EXISTS `products` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL,
`code` varchar(100) NOT NULL,
`price` double(9,2) NOT NULL,
`image` varchar(250) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`id`, `name`, `code`, `price`, `image`) VALUES
(1, 'Laptop Core i5', 'Laptop01', 600.00, 'product-images/med3.jpg'),
(2, 'Laptop Bag', 'Bag01', 50.00, 'product-images/med1.jpg'),
(3, 'iPhone X', 'iphone01', 700.00, 'product-images/med2.jpg'),
(4, 'Laptop Bag', 'Bag01', 50.00, 'product-images/med3.jpg'),
(5, 'Laptop Bag', 'Bag01', 50.00, 'product-images/med4.jpg'),
(6, 'Laptop Bag', 'Bag01', 50.00, 'product-images/med5.jpg'),
(7, 'Laptop Bag', 'Bag01', 50.00, 'product-images/med6.jpg'),
(8, 'Laptop Bag', 'Bag01', 50.00, 'product-images/med7.jpg');
/*!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 */;
|
DataBase name: UnderSet
CREATE TABLE Users (
fName VARCHAR(30) NOT NULL,
lName VARCHAR(30) NOT NULL,
username VARCHAR(50) NOT NULL PRIMARY KEY,
passwrd VARCHAR(50) NOT NULL,
eMail VARCHAR(50) NOT NULL,
gender VARCHAR(50) NOT NULL,
country VARCHAR(50) NOT NULL
);
INSERT INTO Users (fName, lName, username, passwrd, eMail, gender, country) VALUES
('Administrador', 'Molinar', 'admin', 'RABUDurd/uQVbtm49UCDUk2E2APVdOkLO/XwJg74jXM=', 'admin@itesm.mx', 'Male', 'Australia'),
('Mario', 'Molinar', 'molinar7', 'CgjhpZVbUzQGiwm+P+y5brlw5a3EwiGj72FDo+iu0Lc=', 'a01186155@itesm.mx', 'Male', 'Mexico');
CREATE TABLE Events (
ID int(30) NOT NULL AUTO_INCREMENT PRIMARY KEY,
eName varchar(30) NOT NULL,
eDate varchar(30) NOT NULL,
eLocation varchar(30) NOT NULL
) ;
INSERT INTO Events (ID, eName, eDate, eLocation) VALUES
(7, 'Tame Impala', '09/10/2016 ', 'Monterrey'),
(36, 'Solomun', '06/23/2016', 'Los Angeles'),
(37, 'Acid Pauli', '06/08/2016', 'Tulum');
CREATE TABLE Requests (
ID int(30) NOT NULL,
eName varchar(30) NOT NULL,
username varchar(50) NOT NULL,
cNumber varchar(30) NOT NULL,
reason text(100) NOT NULL,
AD tinyint(1) NOT NULL,
primary key (ID, username)
)
INSERT INTO Requests (ID, eName, username, cNumber, reason, AD) VALUES
(36, 'Solomun', 'molinar7', '614 103 6060', 'Solomun is one of my favorites underground artists , if my request is accepted i would be the happier person on earth', 0);
|
SELECT CASE
WHEN e.FirstName IS NULL THEN 'None'
WHEN e.LastName IS NULL THEN 'None'
ELSE CONCAT(e.FirstName, ' ', e.LastName)
END AS Employee,
CASE
WHEN d.[Name] IS NULL THEN 'None'
ELSE d.[Name]
END AS Department,
c.[Name] AS Category,
r.[Description],
FORMAT(r.OpenDate, 'dd.MM.yyy') AS OpenDate,
s.[Label] AS [Status],
CASE
WHEN u.[Name] IS NULL THEN 'None'
ELSE u.[Name]
END AS [User]
FROM Reports AS r
LEFT JOIN Employees AS e ON r.EmployeeId = e.Id
LEFT JOIN Departments AS d ON e.DepartmentId = d.Id
LEFT JOIN Categories AS c ON r.CategoryId = c.Id
LEFT JOIN [Status] AS s ON r.StatusId = s.Id
LEFT JOIN Users AS u ON r.UserId = u.Id
ORDER BY e.FirstName DESC,
e.LastName DESC,
[Department],
[Category],
r.[Description],
r.OpenDate,
[Status],
[User]
|
DROP DATABASE IF EXISTS projectis;
CREATE DATABASE projectis;
USE projectis;
CREATE TABLE users (
id int(6) NOT NULL AUTO_INCREMENT,
login varchar(50) NOT NULL,
password varchar(20) NOT NULL,
firstname char(20) NOT NULL,
lastname char(20) NOT NULL,
phone double NOT NULL,
email char(50) NOT NULL,
agent_id int(6),
PRIMARY KEY (id),
FOREIGN KEY (agent_id) REFERENCES users(id) ON DELETE SET NULL
);
CREATE TABLE roles (
id int(6) NOT NULL AUTO_INCREMENT,
role char(20) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE user_roles (
user_id int(6) NOT NULL,
role_id int(6) NOT NULL,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (role_id) REFERENCES roles(id)
);
CREATE TABLE category (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
name varchar(50)NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE poi (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
id_places varchar(100),
name varchar(50) NOT NULL,
lat double NOT NULL,
lng double NOT NULL,
description varchar(100),
PRIMARY KEY(id)
);
CREATE TABLE poi_category(
poi_id int(11) unsigned NOT NULL,
category_id int(11) unsigned NOT NULL,
FOREIGN KEY(category_id) REFERENCES category(id),
FOREIGN KEY(poi_id) REFERENCES poi(id)
);
INSERT INTO category VALUES (null, "accounting");
INSERT INTO category VALUES (null, "airport");
INSERT INTO category VALUES (null, "amusement_park");
INSERT INTO category VALUES (null, "aquarium");
INSERT INTO category VALUES (null, "art_gallery");
INSERT INTO category VALUES (null, "atm");
INSERT INTO category VALUES (null, "bakery");
INSERT INTO category VALUES (null, "bank");
INSERT INTO category VALUES (null, "bar");
INSERT INTO category VALUES (null, "beauty_salon");
INSERT INTO category VALUES (null, "bicycle_store");
INSERT INTO category VALUES (null, "book_store");
INSERT INTO category VALUES (null, "bowling_alley");
INSERT INTO category VALUES (null, "bus_station");
INSERT INTO category VALUES (null, "cafe");
INSERT INTO category VALUES (null, "campground");
INSERT INTO category VALUES (null, "car_dealer");
INSERT INTO category VALUES (null, "car_rental");
INSERT INTO category VALUES (null, "car_repair");
INSERT INTO category VALUES (null, "car_wash");
INSERT INTO category VALUES (null, "casino");
INSERT INTO category VALUES (null, "cemetery");
INSERT INTO category VALUES (null, "church");
INSERT INTO category VALUES (null, "city_hall");
INSERT INTO category VALUES (null, "clothing_store");
INSERT INTO category VALUES (null, "convenience_store");
INSERT INTO category VALUES (null, "courthouse");
INSERT INTO category VALUES (null, "dentist");
INSERT INTO category VALUES (null, "department_store");
INSERT INTO category VALUES (null, "doctor");
INSERT INTO category VALUES (null, "electrician");
INSERT INTO category VALUES (null, "electronics_store");
INSERT INTO category VALUES (null, "embassy");
INSERT INTO category VALUES (null, "establishment");
INSERT INTO category VALUES (null, "finance");
INSERT INTO category VALUES (null, "fire_station");
INSERT INTO category VALUES (null, "florist");
INSERT INTO category VALUES (null, "food");
INSERT INTO category VALUES (null, "funeral_home");
INSERT INTO category VALUES (null, "furniture_store");
INSERT INTO category VALUES (null, "gas_station");
INSERT INTO category VALUES (null, "general_contractor");
INSERT INTO category VALUES (null, "grocery_or_supermarket");
INSERT INTO category VALUES (null, "gym");
INSERT INTO category VALUES (null, "hair_care");
INSERT INTO category VALUES (null, "hardware_store");
INSERT INTO category VALUES (null, "health");
INSERT INTO category VALUES (null, "hindu_temple");
INSERT INTO category VALUES (null, "home_goods_store");
INSERT INTO category VALUES (null, "hospital");
INSERT INTO category VALUES (null, "insurance_agency");
INSERT INTO category VALUES (null, "jewelry_store");
INSERT INTO category VALUES (null, "laundry");
INSERT INTO category VALUES (null, "lawyer");
INSERT INTO category VALUES (null, "library");
INSERT INTO category VALUES (null, "liquor_store");
INSERT INTO category VALUES (null, "local_government_office");
INSERT INTO category VALUES (null, "locksmith");
INSERT INTO category VALUES (null, "lodging");
INSERT INTO category VALUES (null, "meal_delivery");
INSERT INTO category VALUES (null, "meal_takeaway");
INSERT INTO category VALUES (null, "mosque");
INSERT INTO category VALUES (null, "movie_rental");
INSERT INTO category VALUES (null, "movie_theater");
INSERT INTO category VALUES (null, "moving_company");
INSERT INTO category VALUES (null, "museum");
INSERT INTO category VALUES (null, "night_club");
INSERT INTO category VALUES (null, "painter");
INSERT INTO category VALUES (null, "park");
INSERT INTO category VALUES (null, "parking");
INSERT INTO category VALUES (null, "pet_store");
INSERT INTO category VALUES (null, "pharmacy");
INSERT INTO category VALUES (null, "physiotherapist");
INSERT INTO category VALUES (null, "place_of_worship");
INSERT INTO category VALUES (null, "plumber");
INSERT INTO category VALUES (null, "police");
INSERT INTO category VALUES (null, "post_office");
INSERT INTO category VALUES (null, "real_estate_agency");
INSERT INTO category VALUES (null, "restaurant");
INSERT INTO category VALUES (null, "roofing_contractor");
INSERT INTO category VALUES (null, "rv_park");
INSERT INTO category VALUES (null, "school");
INSERT INTO category VALUES (null, "shoe_store");
INSERT INTO category VALUES (null, "shopping_mall");
INSERT INTO category VALUES (null, "spa");
INSERT INTO category VALUES (null, "stadium");
INSERT INTO category VALUES (null, "storage");
INSERT INTO category VALUES (null, "store");
INSERT INTO category VALUES (null, "subway_station");
INSERT INTO category VALUES (null, "synagogue");
INSERT INTO category VALUES (null, "taxi_stand");
INSERT INTO category VALUES (null, "train_station");
INSERT INTO category VALUES (null, "transit_station");
INSERT INTO category VALUES (null, "travel_agency");
INSERT INTO category VALUES (null, "university");
INSERT INTO category VALUES (null, "veterinary_care");
INSERT INTO category VALUES (null, "zoo");
INSERT INTO poi VALUES (null, "place1", "SOGENE", 41.854431,12.605243,"ciao");
INSERT INTO poi VALUES (null, "place4", "Anagnina", 41.8426285,12.5842282,"metro");
INSERT INTO poi VALUES (null, "place5", "La Romanina", 41.850973,12.5967737,"Centro Commerciale");
INSERT INTO poi_category VALUES (1,1);
INSERT INTO poi_category VALUES (2,2);
INSERT INTO poi_category VALUES (3,2);
insert into roles values (null,'administrator');
insert into roles values (null,'agent');
insert into roles values (null,'user');
insert into users values(null,'adrian.drob88@gmail.com','ciao','adrian','drob',123456789,'adrian.drob88@gmail.com',null);
insert into users values(null,'ameluzio90@gmail.com','ciao','alessandro','meluzio',123456789,'ameluzio89@gmail.com',1);
insert into users values(null,'andrea.bei@capgemini.com','andrea','andrea','bei',123456789,'andrea.bei@capgemini.com',1);
insert into user_roles values (1,1);
insert into user_roles values (2,2);
insert into user_roles values (3,1);
|
DROP TABLE IF EXISTS IH_EBPP_BILLCATALOG;
DROP TABLE IF EXISTS IH_EBPP_BILLINSTANCE;
DROP TABLE IF EXISTS IH_EBPP_BILLINSTANCELOG;
DROP TABLE IF EXISTS IH_EBPP_BILLPAYINFO;
DROP TABLE IF EXISTS IH_EBPP_BILLTYPE;
DROP TABLE IF EXISTS IH_EBPP_BIZCHANNEL;
DROP TABLE IF EXISTS IH_EBPP_PAYCHANNEL;
DROP TABLE IF EXISTS IH_EBPP_PAYINFO;
CREATE TABLE IH_EBPP_BILLCATALOG
(
CODE CHAR(32) NOT NULL,
NAME VARCHAR(100),
MEMO VARCHAR(100),
CREATED_ON VARCHAR(19),
STATUS CHAR(2) COMMENT '01-启用
02-暂时停用
00-作废',
PARENT_ID CHAR(32),
PRIMARY KEY (CODE)
);
ALTER TABLE IH_EBPP_BILLCATALOG COMMENT '--公共事业缴费
---------教育类
---------生活类
';
CREATE TABLE IH_EBPP_BILLINSTANCE
(
ID CHAR(32) NOT NULL,
NO VARCHAR(30),
_TYPE CHAR(32),
FLAG CHAR(1) COMMENT '1-可用
0-撤销',
STATUS CHAR(1) COMMENT '01-新建
08-异常关闭
09-正常关闭
11-支付中
12-支付成功
21-支付异常
22-支付失败
',
CREATED_ON CHAR(19),
UPDATED_ON CHAR(19),
FINISHED_ON CHAR(19),
MEMO VARCHAR(255),
CCY CHAR(3),
AMT NUMERIC(17,2) DEFAULT 0,
BIZCH_CODE CHAR(6),
ORIBIZNO VARCHAR(50),
PAYER_ACCT VARCHAR(50),
PAYER_CODE VARCHAR(50),
PAYER_NAME VARCHAR(70),
PAYEE_ACCT VARCHAR(50),
PAYEE_CODE VARCHAR(50),
PAYEE_NAME VARCHAR(70),
TRANS_ON CHAR(19) COMMENT '业务原始生成时间,由调用方发送',
EXTRA1 VARCHAR(100),
EXTRA2 VARCHAR(100),
EXTRA3 VARCHAR(100),
EXTRA4 VARCHAR(100),
EXTRA5 VARCHAR(100),
EXTRA6 VARCHAR(100),
EXTRA7 VARCHAR(100),
EXTRA8 VARCHAR(100),
EXTRA9 VARCHAR(100),
EXTRA10 VARCHAR(100),
PRIMARY KEY (ID)
);
CREATE TABLE IH_EBPP_BILLINSTANCELOG
(
ID CHAR(32) NOT NULL,
BILL_ID CHAR(32),
OPERATE_ON VARCHAR(19),
CONTENT TEXT,
ORI_DATA TEXT,
PRE_DATA TEXT,
PRIMARY KEY (ID)
);
CREATE TABLE IH_EBPP_BILLPAYINFO
(
B_ID CHAR(32) NOT NULL,
P_ID CHAR(32) NOT NULL,
PRIMARY KEY (B_ID, P_ID)
);
CREATE TABLE IH_EBPP_BILLTYPE
(
CODE CHAR(32) NOT NULL,
NAME VARCHAR(100),
MEMO VARCHAR(100),
BIZCH_CODE CHAR(6) COMMENT '类型 0-特色业务费种 1-外部业务费种 2-开放费种',
CREATED_ON VARCHAR(19),
STATUS CHAR(2) COMMENT '01-启用
02-暂时停用
00-作废
',
CATLOG_ID CHAR(32),
PRIMARY KEY (CODE)
);
ALTER TABLE IH_EBPP_BILLTYPE COMMENT '--物业费
--学费
--供暖费
--水费
--电费
--燃';
CREATE TABLE IH_EBPP_BIZCHANNEL
(
CODE CHAR(6) NOT NULL,
NAME VARCHAR(100),
_TYPE CHAR(2) COMMENT '01-直接业务渠道
02-代理业务渠道',
STATUS CHAR(2) COMMENT '01-启用
00-作废
02-暂时停用',
MEMO VARCHAR(100),
CREATED_ON VARCHAR(19),
PRIMARY KEY (CODE)
);
CREATE TABLE IH_EBPP_PAYCHANNEL
(
CODE CHAR(6) NOT NULL,
NAME VARCHAR(100),
MEMO VARCHAR(100),
STATUS CHAR(2) COMMENT '01-启用
00-作废
02-暂时停用
',
CREATED_ON VARCHAR(19),
BIZCH_CODE CHAR(6),
PRIMARY KEY (CODE)
);
CREATE TABLE IH_EBPP_PAYINFO
(
ID CHAR(32) NOT NULL,
SEQUENCENO VARCHAR(30),
STATUS CHAR(2),
AMT NUMERIC(17,2),
TRAN_TIEM VARCHAR(19),
TRAN_WAY CHAR(2) COMMENT '--01-积分
--02-优惠券
--03-余额支付
--04-红包',
TRAN_QUANTITY CHAR(6),
TRAN_CHANEL CHAR(6),
EXTRA1 VARCHAR(100),
EXTRA2 VARCHAR(100),
EXTRA3 VARCHAR(100),
EXTRA4 VARCHAR(100),
EXTRA5 VARCHAR(100),
EXTRA6 VARCHAR(100),
EXTRA7 VARCHAR(100),
EXTRA8 VARCHAR(100),
EXTRA9 VARCHAR(100),
EXTRA10 VARCHAR(100),
PRIMARY KEY (ID)
);
ALTER TABLE IH_EBPP_BILLCATALOG ADD CONSTRAINT FK_BILLCATALOG_PARENT FOREIGN KEY (PARENT_ID)
REFERENCES IH_EBPP_BILLCATALOG (CODE) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE IH_EBPP_BILLINSTANCE ADD CONSTRAINT FK_BILLINSTANCE_BIZCH_CODE FOREIGN KEY (BIZCH_CODE)
REFERENCES IH_EBPP_BIZCHANNEL (CODE) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE IH_EBPP_BILLINSTANCE ADD CONSTRAINT FK_FK_BILLINSTANCE_TYPE FOREIGN KEY (_TYPE)
REFERENCES IH_EBPP_BILLTYPE (CODE) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE IH_EBPP_BILLINSTANCELOG ADD CONSTRAINT FK_BILLINSTANCELOG_BILL_ID FOREIGN KEY (BILL_ID)
REFERENCES IH_EBPP_BILLINSTANCE (ID) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE IH_EBPP_BILLPAYINFO ADD CONSTRAINT FK_BILLPAYINFO_B_ID FOREIGN KEY (B_ID)
REFERENCES IH_EBPP_BILLINSTANCE (ID) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE IH_EBPP_BILLPAYINFO ADD CONSTRAINT FK_BILLPAYINFO_P_ID FOREIGN KEY (P_ID)
REFERENCES IH_EBPP_PAYINFO (ID) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE IH_EBPP_BILLTYPE ADD CONSTRAINT FK_BILLTYPE_BIZCH_CODE FOREIGN KEY (BIZCH_CODE)
REFERENCES IH_EBPP_BIZCHANNEL (CODE) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE IH_EBPP_BILLTYPE ADD CONSTRAINT FK_BILLTYPE_CATALOIOG_ID FOREIGN KEY (CATLOG_ID)
REFERENCES IH_EBPP_BILLCATALOG (CODE) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE IH_EBPP_PAYCHANNEL ADD CONSTRAINT FK_PAYCHANNEL_BIZCH_CODE FOREIGN KEY (BIZCH_CODE)
REFERENCES IH_EBPP_BIZCHANNEL (CODE) ON DELETE SET NULL ON UPDATE CASCADE;
|
-- event types
INSERT INTO public."TFEventType" ("TFEventTypeID", "Name")
VALUES (E'707d82de-3ddd-11e4-95c4-a77fdf4021b5', E'WorkflowRelated');
INSERT INTO public."TFEventType" ("TFEventTypeID", "Name")
VALUES (E'b7fae0de-4f8f-11e4-81f1-7bbebc204f52', E'Payment');
-- Events
INSERT INTO public."TFEvent" ("TFEventID", "TFEventName", "TFEventDescription", "TFEventTypeID")
VALUES (E'5a3ef2f0-3ddd-11e4-947f-d794c7dc9b9c', E'RegistrationCompletedEvent', E'Registration Completed', E'707d82de-3ddd-11e4-95c4-a77fdf4021b5');
INSERT INTO public."TFEvent" ("TFEventID", "TFEventName", "TFEventDescription", "TFEventTypeID")
VALUES (E'4633a062-400d-11e4-92d1-3bbc97b163aa', E'CreateLoginCompletedEvent', E'CreateLoginCompletedEvent', E'707d82de-3ddd-11e4-95c4-a77fdf4021b5');
INSERT INTO public."TFEvent" ("TFEventID", "TFEventName", "TFEventDescription", "TFEventTypeID")
VALUES (E'460f71d2-47bb-11e4-bc90-6ffc47e436f3', E'TemporaryAccountCreatedEvent', E'TemporaryAccountCreatedEvent', E'707d82de-3ddd-11e4-95c4-a77fdf4021b5');
INSERT INTO public."TFEvent" ("TFEventID", "TFEventName", "TFEventDescription", "TFEventTypeID")
VALUES (E'b7fba438-4f8f-11e4-b8f6-5b4d4f08b608', E'OnlinePaymentEvent', E'Online Payment Event', E'b7fae0de-4f8f-11e4-81f1-7bbebc204f52');
INSERT INTO public."TFEvent"("TFEventID", "TFEventName", "TFEventDescription", "TFEventTypeID")
VALUES (E'4fb1b2c4-489f-11e4-8ad9-175db514c526', E'ForgottenUsernamePasswordEvent', '', '707d82de-3ddd-11e4-95c4-a77fdf4021b5');
INSERT INTO public."TFEventMessageSubscriber" ("TFEventMessageSubscriberID", "Name", "ObjectName", "ObjectAssembly", "DefaultMessageSubscriberFilter")
VALUES (E'f141991a-3ddc-11e4-a4e6-3b2e2db526bf', E'RegistrationCompletedEvent', E'Bec.TargetFramework.SB.Messages.Events.RegistrationCompletedEvent', E'Bec.TargetFramework.SB.Messages', NULL);
INSERT INTO public."TFEventMessageSubscriber" ("TFEventMessageSubscriberID", "Name", "ObjectName", "ObjectAssembly", "DefaultMessageSubscriberFilter")
VALUES (E'6f85fd84-400d-11e4-a6c8-1fe24de621cb', E'CreateLoginCompletedEvent', E'Bec.TargetFramework.SB.Messages.Events.CreateLoginCompletedEvent', E'Bec.TargetFramework.SB.Messages', NULL);
INSERT INTO public."TFEventMessageSubscriber" ("TFEventMessageSubscriberID", "Name", "ObjectName", "ObjectAssembly", "DefaultMessageSubscriberFilter")
VALUES (E'7d8401d2-47bb-11e4-b893-8bad290b3216', E'ColpRegistrationTemporaryAccountEvent', E'Bec.TargetFramework.SB.Messages.Events.ColpRegistrationTemporaryAccountEvent', E'Bec.TargetFramework.SB.Messages', NULL);
INSERT INTO public."TFEventMessageSubscriber" ("TFEventMessageSubscriberID", "Name", "ObjectName", "ObjectAssembly", "DefaultMessageSubscriberFilter")
VALUES (E'96ea8d42-47c2-11e4-8e0f-e3daeaa9f723', E'NonColpTemporaryAccountEvent', E'Bec.TargetFramework.SB.Messages.Events.NonColpTemporaryAccountEvent', E'Bec.TargetFramework.SB.Messages', NULL);
INSERT INTO public."TFEventMessageSubscriber" ("TFEventMessageSubscriberID", "Name", "ObjectName", "ObjectAssembly", "DefaultMessageSubscriberFilter")
VALUES (E'b7fbcb3e-4f8f-11e4-a726-236dc67efbde', E'OnlinePaymentEvent', E'Bec.TargetFramework.SB.Messages.Events.OnlinePaymentEvent', E'Bec.TargetFramework.SB.Messages', NULL);
INSERT INTO public."TFEventMessageSubscriber"("TFEventMessageSubscriberID", "Name", "ObjectName", "ObjectAssembly")
VALUES (E'4fb1b2c4-489f-11e4-a026-2b96867a5561', E'ForgottenPasswordEvent', E'Bec.TargetFramework.SB.Messages.Events.ForgottenPasswordEvent', E'Bec.TargetFramework.SB.Messages');
INSERT INTO public."TFEventMessageSubscriber"("TFEventMessageSubscriberID", "Name", "ObjectName", "ObjectAssembly")
VALUES (E'9bfc5370-48b1-11e4-9968-1392d9ed7dfd', E'ForgottenUsernameEvent', E'Bec.TargetFramework.SB.Messages.Events.ForgottenUsernameEvent', E'Bec.TargetFramework.SB.Messages');
--INSERT INTO public."TFEventMessageSubscriber"("TFEventMessageSubscriberID", "Name", "ObjectName", "ObjectAssembly")
--VALUES (E'4fb1b2c4-489f-11e4-a026-2b96867a5561', E'ForgottenUsernamePasswordEvent', E'Bec.TargetFramework.SB.Messages.Events.ForgottenUsernamePasswordEvent', E'Bec.TargetFramework.SB.Messages');
INSERT INTO public."TFEventTFEventMessageSubscriber" ("TFEventID", "TFEventMessageSubscriberID", "IsActive", "IsDeleted", "TFEventMessageSubscriberFilter")
VALUES (E'5a3ef2f0-3ddd-11e4-947f-d794c7dc9b9c', E'f141991a-3ddc-11e4-a4e6-3b2e2db526bf', True, False, NULL);
INSERT INTO public."TFEventTFEventMessageSubscriber" ("TFEventID", "TFEventMessageSubscriberID", "IsActive", "IsDeleted", "TFEventMessageSubscriberFilter")
VALUES (E'4633a062-400d-11e4-92d1-3bbc97b163aa', E'6f85fd84-400d-11e4-a6c8-1fe24de621cb', True, False, NULL);
INSERT INTO public."TFEventTFEventMessageSubscriber" ("TFEventID", "TFEventMessageSubscriberID", "IsActive", "IsDeleted", "TFEventMessageSubscriberFilter")
VALUES (E'460f71d2-47bb-11e4-bc90-6ffc47e436f3', E'7d8401d2-47bb-11e4-b893-8bad290b3216', True, False, NULL);
INSERT INTO public."TFEventTFEventMessageSubscriber" ("TFEventID", "TFEventMessageSubscriberID", "IsActive", "IsDeleted", "TFEventMessageSubscriberFilter")
VALUES (E'460f71d2-47bb-11e4-bc90-6ffc47e436f3', E'96ea8d42-47c2-11e4-8e0f-e3daeaa9f723', True, False, NULL);
-- payment tasks
INSERT INTO public."TFEventTFEventMessageSubscriber" ("TFEventID", "TFEventMessageSubscriberID", "IsActive", "IsDeleted", "TFEventMessageSubscriberFilter")
VALUES (E'b7fba438-4f8f-11e4-b8f6-5b4d4f08b608', E'b7fbcb3e-4f8f-11e4-a726-236dc67efbde', True, False, NULL);
-- security tasks
INSERT INTO public."TFEventTFEventMessageSubscriber"("TFEventID", "TFEventMessageSubscriberID", "IsActive", "IsDeleted", "TFEventMessageSubscriberFilter")
VALUES ( E'4fb1b2c4-489f-11e4-8ad9-175db514c526', E'4fb1b2c4-489f-11e4-a026-2b96867a5561', True, False, NULL);
INSERT INTO public."TFEventTFEventMessageSubscriber"("TFEventID", "TFEventMessageSubscriberID", "IsActive", "IsDeleted", "TFEventMessageSubscriberFilter")
VALUES ( E'4fb1b2c4-489f-11e4-8ad9-175db514c526', E'9bfc5370-48b1-11e4-9968-1392d9ed7dfd', True, False, NULL);
-- Scheduled Tasks
INSERT INTO public."BusTaskHandler" ("BusTaskHandlerID", "Name", "ObjectTypeName", "IsActive", "IsDeleted", "ObjectTypeAssembly", "MessageTypeName", "MessageTypeAssembly")
VALUES (E'54e6b9b0-47f5-11e4-bdc4-1fff1c7f479e', E'UserNotLoggedInScheduledTask', E'Bec.TargetFramework.SB.TaskHandlers.ScheduledTaskHandlers.UserNotLoggedInScheduledTask, Bec.TargetFramework.SB.TaskHandlers', True, False, E'Bec.TargetFramework.SB.TaskHandlers', E'Bec.TargetFramework.SB.TaskHandlers.ScheduledTaskHandlers.TestTaskHandlerMessage', E'Bec.TargetFramework.SB.TaskHandlers');
INSERT INTO public."BusTask" ("BusTaskID", "Name", "Description", "CreatedOn", "IsActive", "IsDeleted", "BusTaskHandlerID")
VALUES (E'3b1ab5ea-47f5-11e4-8c12-d39d0d71000d', E'UserNotLoggedInScheduledTask', E'Reminds users not logged in for X periods', E'2014-09-29 00:00:00', True, False, E'54e6b9b0-47f5-11e4-bdc4-1fff1c7f479e');
INSERT INTO public."BusTaskSchedule" ("BusTaskScheduleID", "BusTaskID", "IntervalInMinutes", "IsActive", "IsDeleted")
VALUES (E'8e9cf002-47f5-11e4-9b97-03ba009b2b53', E'3b1ab5ea-47f5-11e4-8c12-d39d0d71000d', 200, True, False);
|
/*
select 'SELECT * INTO ' + (select MapTable from VC3ETL.LoadTable maph WHERE ExtractDatabase = '29D14961-928D-4BEE-9025-238496D144C6' AND HasMapTable = 1 and lt.MapTable = maph.MapTable) + '_Inspire FROM '+ (select MapTable from VC3ETL.LoadTable map WHERE ExtractDatabase = '29D14961-928D-4BEE-9025-238496D144C6' AND HasMapTable = 1 and lt.MapTable = map.MapTable) FROM VC3ETL.LoadTable lt
WHERE lt.ExtractDatabase = '29D14961-928D-4BEE-9025-238496D144C6' AND HasMapTable = 1
ORDER BY Sequence
select 'TRUNCATE TABLE ' + (select MapTable from VC3ETL.LoadTable maph WHERE ExtractDatabase = '29D14961-928D-4BEE-9025-238496D144C6' AND HasMapTable = 1 and lt.MapTable = maph.MapTable) FROM VC3ETL.LoadTable lt
WHERE lt.ExtractDatabase = '29D14961-928D-4BEE-9025-238496D144C6' AND HasMapTable = 1
ORDER BY Sequence
*/
--select * from VC3ETL.ExtractTable where ExtractDatabase= '29D14961-928D-4BEE-9025-238496D144C6'
begin tran
SELECT * INTO LEGACYSPED.SelectLists_LOCAL_Inspire FROM LEGACYSPED.SelectLists_LOCAL
SELECT * INTO LEGACYSPED.District_LOCAL_Inspire FROM LEGACYSPED.District_LOCAL
SELECT * INTO LEGACYSPED.School_LOCAL_Inspire FROM LEGACYSPED.School_LOCAL
SELECT * INTO LEGACYSPED.Student_LOCAL_Inspire FROM LEGACYSPED.Student_LOCAL
SELECT * INTO LEGACYSPED.IEP_LOCAL_Inspire FROM LEGACYSPED.IEP_LOCAL
SELECT * INTO LEGACYSPED.SpedStaffMember_LOCAL_Inspire FROM LEGACYSPED.SpedStaffMember_LOCAL
SELECT * INTO LEGACYSPED.Service_LOCAL_Inspire FROM LEGACYSPED.Service_LOCAL
SELECT * INTO LEGACYSPED.Goal_LOCAL_Inspire FROM LEGACYSPED.Goal_LOCAL
SELECT * INTO LEGACYSPED.Objective_LOCAL_Inspire FROM LEGACYSPED.Objective_LOCAL
SELECT * INTO LEGACYSPED.TeamMember_LOCAL_Inspire FROM LEGACYSPED.TeamMember_LOCAL
SELECT * INTO LEGACYSPED.StaffSchool_LOCAL_Inspire FROM LEGACYSPED.StaffSchool_LOCAL
SELECT * INTO LEGACYSPED.MAP_OrgUnitID_Inspire FROM LEGACYSPED.MAP_OrgUnitID
SELECT * INTO LEGACYSPED.MAP_SchoolID_Inspire FROM LEGACYSPED.MAP_SchoolID
SELECT * INTO LEGACYSPED.MAP_IepServiceCategoryID_Inspire FROM LEGACYSPED.MAP_IepServiceCategoryID
SELECT * INTO LEGACYSPED.MAP_IepPlacementOptionID_Inspire FROM LEGACYSPED.MAP_IepPlacementOptionID
SELECT * INTO LEGACYSPED.MAP_PrgStatusID_Inspire FROM LEGACYSPED.MAP_PrgStatusID
SELECT * INTO LEGACYSPED.MAP_IepDisabilityID_Inspire FROM LEGACYSPED.MAP_IepDisabilityID
SELECT * INTO LEGACYSPED.MAP_GradeLevelID_Inspire FROM LEGACYSPED.MAP_GradeLevelID
SELECT * INTO LEGACYSPED.MAP_ServiceFrequencyID_Inspire FROM LEGACYSPED.MAP_ServiceFrequencyID
SELECT * INTO LEGACYSPED.MAP_PrgLocationID_Inspire FROM LEGACYSPED.MAP_PrgLocationID
SELECT * INTO LEGACYSPED.MAP_ServiceProviderTitleID_Inspire FROM LEGACYSPED.MAP_ServiceProviderTitleID
SELECT * INTO LEGACYSPED.MAP_ServiceDefID_Inspire FROM LEGACYSPED.MAP_ServiceDefID
SELECT * INTO LEGACYSPED.MAP_StudentRefID_Inspire FROM LEGACYSPED.MAP_StudentRefID
SELECT * INTO LEGACYSPED.MAP_PrgInvolvementID_Inspire FROM LEGACYSPED.MAP_PrgInvolvementID
SELECT * INTO LEGACYSPED.MAP_IepStudentRefID_Inspire FROM LEGACYSPED.MAP_IepStudentRefID
SELECT * INTO LEGACYSPED.MAP_PrgVersionID_Inspire FROM LEGACYSPED.MAP_PrgVersionID
SELECT * INTO LEGACYSPED.MAP_FormInstance_Services_Inspire FROM LEGACYSPED.MAP_FormInstance_Services
SELECT * INTO LEGACYSPED.MAP_FormInstanceInterval_Services_Inspire FROM LEGACYSPED.MAP_FormInstanceInterval_Services
SELECT * INTO LEGACYSPED.MAP_FormInputValue_Services_Inspire FROM LEGACYSPED.MAP_FormInputValue_Services
SELECT * INTO LEGACYSPED.MAP_PrgSectionID_NonVersioned_Inspire FROM LEGACYSPED.MAP_PrgSectionID_NonVersioned
SELECT * INTO LEGACYSPED.MAP_PrgSectionID_Inspire FROM LEGACYSPED.MAP_PrgSectionID
SELECT * INTO LEGACYSPED.MAP_PrgInvolvementTeamMemberID_Inspire FROM LEGACYSPED.MAP_PrgInvolvementTeamMemberID
SELECT * INTO LEGACYSPED.MAP_IepPlacementID_Inspire FROM LEGACYSPED.MAP_IepPlacementID
SELECT * INTO LEGACYSPED.MAP_IepDisabilityEligibilityID_Inspire FROM LEGACYSPED.MAP_IepDisabilityEligibilityID
SELECT * INTO LEGACYSPED.MAP_ScheduleID_Inspire FROM LEGACYSPED.MAP_ScheduleID
SELECT * INTO LEGACYSPED.MAP_ServicePlanID_Inspire FROM LEGACYSPED.MAP_ServicePlanID
SELECT * INTO LEGACYSPED.MAP_IepGoalAreaDefID_Inspire FROM LEGACYSPED.MAP_IepGoalAreaDefID
SELECT * INTO LEGACYSPED.MAP_PrgGoalID_Inspire FROM LEGACYSPED.MAP_PrgGoalID
SELECT * INTO LEGACYSPED.MAP_IepGoalArea_Inspire FROM LEGACYSPED.MAP_IepGoalArea
SELECT * INTO LEGACYSPED.MAP_PrgGoalObjectiveID_Inspire FROM LEGACYSPED.MAP_PrgGoalObjectiveID
SELECT * INTO LEGACYSPED.MAP_PersonID_Inspire FROM LEGACYSPED.MAP_PersonID
--SELECT * INTO LEGACYSPED.MAP_OutcomeID_Inspire FROM LEGACYSPED.MAP_OutcomeID
--TRUNCATE TABLE LEGACYSPED.SelectLists_LOCAL
--TRUNCATE TABLE LEGACYSPED.District_LOCAL
--TRUNCATE TABLE LEGACYSPED.School_LOCAL
--TRUNCATE TABLE LEGACYSPED.Student_LOCAL
--TRUNCATE TABLE LEGACYSPED.IEP_LOCAL
--TRUNCATE TABLE LEGACYSPED.SpedStaffMember_LOCAL
--TRUNCATE TABLE LEGACYSPED.Service_LOCAL
--TRUNCATE TABLE LEGACYSPED.Goal_LOCAL
--TRUNCATE TABLE LEGACYSPED.Objective_LOCAL
--TRUNCATE TABLE LEGACYSPED.TeamMember_LOCAL
--TRUNCATE TABLE LEGACYSPED.StaffSchool_LOCAL
TRUNCATE TABLE LEGACYSPED.MAP_OrgUnitID
TRUNCATE TABLE LEGACYSPED.MAP_SchoolID
TRUNCATE TABLE LEGACYSPED.MAP_IepServiceCategoryID
TRUNCATE TABLE LEGACYSPED.MAP_IepPlacementOptionID
TRUNCATE TABLE LEGACYSPED.MAP_PrgStatusID
TRUNCATE TABLE LEGACYSPED.MAP_IepDisabilityID
TRUNCATE TABLE LEGACYSPED.MAP_GradeLevelID
TRUNCATE TABLE LEGACYSPED.MAP_ServiceFrequencyID
TRUNCATE TABLE LEGACYSPED.MAP_PrgLocationID
TRUNCATE TABLE LEGACYSPED.MAP_ServiceProviderTitleID
TRUNCATE TABLE LEGACYSPED.MAP_ServiceDefID
TRUNCATE TABLE LEGACYSPED.MAP_StudentRefID
TRUNCATE TABLE LEGACYSPED.MAP_PrgInvolvementID
TRUNCATE TABLE LEGACYSPED.MAP_IepStudentRefID
TRUNCATE TABLE LEGACYSPED.MAP_PrgVersionID
TRUNCATE TABLE LEGACYSPED.MAP_FormInstance_Services
TRUNCATE TABLE LEGACYSPED.MAP_FormInstanceInterval_Services
TRUNCATE TABLE LEGACYSPED.MAP_FormInputValue_Services
TRUNCATE TABLE LEGACYSPED.MAP_PrgSectionID_NonVersioned
TRUNCATE TABLE LEGACYSPED.MAP_PrgSectionID
TRUNCATE TABLE LEGACYSPED.MAP_PrgInvolvementTeamMemberID
TRUNCATE TABLE LEGACYSPED.MAP_IepPlacementID
TRUNCATE TABLE LEGACYSPED.MAP_IepDisabilityEligibilityID
TRUNCATE TABLE LEGACYSPED.MAP_ScheduleID
TRUNCATE TABLE LEGACYSPED.MAP_ServicePlanID
TRUNCATE TABLE LEGACYSPED.MAP_IepGoalAreaDefID
TRUNCATE TABLE LEGACYSPED.MAP_PrgGoalID
TRUNCATE TABLE LEGACYSPED.MAP_IepGoalArea
TRUNCATE TABLE LEGACYSPED.MAP_PrgGoalObjectiveID
TRUNCATE TABLE LEGACYSPED.MAP_PersonID
--TRUNCATE TABLE LEGACYSPED.MAP_OutcomeID
--rollback tran
commit tran
|
CREATE TABLE question
(
id int PRIMARY KEY AUTO_INCREMENT,
title varchar(50),
description text,
gmt_create bigint,
gmt_modified bigint,
creator int,
comment_count int NOT NULL DEFAULT '0',
view_count int NOT NULL DEFAULT '0',
like_count int NOT NULL DEFAULT '0',
tag varchar(255)
);
|
ALTER TABLE App_Users ADD Info VARCHAR;
ALTER SEQUENCE user_id_seq RESTART WITH 100;
ALTER TABLE routes
ADD count_of_places BIGINT NOT NULL default 1;
ALTER TABLE schedules
ADD schedule_day BIGINT;
ALTER TABLE schedules
ADD start_day date;
|
CREATE TABLE jobs(
_id serial PRIMARY KEY,
company_id INT,
number VARCHAR (10)
);
|
--The beginning of the SQL for the employee database. Not completed, could use some help
CREATE EXTENSION pgcrypto; --Allows PostgreSQL to understand UUIDs. Only have to create the extension once for a database.
--DROP TABLE employee;
CREATE TABLE employee (
ID uuid NOT NULL DEFAULT gen_random_uuid(),
firstName character varying(32) NOT NULL DEFAULT(''),
lastName character varying(32) NOT NULL DEFAULT(''),
employeeID character varying(32) NOT NULL DEFAULT(''),
active character varying(32) NOT NULL DEFAULT(''),
CONSTRAINT chk_active CHECK (active IN ('Active', 'Inactive')),
role character varying(32) NOT NULL DEFAULT(''),
CONSTRAINT chk_role CHECK (role IN ('General Manager', 'Shift Manager', 'Cashier')),
manager ,
password character varying(32) NOT NULL DEFAULT('')
createdon timestamp without time zone NOT NULL DEFAULT now(),
CONSTRAINT employee_pkey PRIMARY KEY (ID)
) WITH (
OIDS=FALSE
);
--DROP INDEX ix_employee_lookupcode;
CREATE INDEX ix_employee_lookupcode
ON employee
USING btree
(lower(lookupcode::text) COLLATE pg_catalog."default");
INSERT INTO employee (lookupcode, count) VALUES (
'lookupcode1'
, 100)
RETURNING ID, createdon;
INSERT INTO employee (lookupcode, count) VALUES (
'lookupcode2'
, 125)
RETURNING ID, createdon;
INSERT INTO employee (lookupcode, count) VALUES (
'lookupcode3'
, 150)
RETURNING ID, createdon;
--SELECT * FROM employee;
--DELETE FROM employee;
|
select played_in.actor_id, name, role, episodes, other_shows
from played_in
inner join actors
on actors.id = actor_id
left join (
select actor_id, count(1)-1 as other_shows
from played_in
group by actor_id
) other_shows_by_actor on other_shows_by_actor.actor_id = played_in.actor_id
where show_id = :show_id
order by episodes desc
limit 20;
|
CREATE TABLE public.pessoa
(
id integer NOT NULL DEFAULT nextval('pessoa_id_seq'::regclass),
nome character varying(100) NOT NULL,
idade integer,
CONSTRAINT pessoa_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.pessoa
OWNER TO postgres;
|
DROP TABLE IF EXISTS wf_docstates_master;
--
CREATE TABLE wf_docstates_master (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
PRIMARY KEY (id),
UNIQUE (name)
);
--
-- This reserved state has ID `1`. This is used as the only legal
-- state for children documents.
INSERT INTO wf_docstates_master(name)
VALUES('__RESERVED_CHILD_STATE__');
|
SELECT * FROM helo_users WHERE ( username = $1 AND password = $2 );
|
select avg(age) from people;
select count(*) from people where age<40;
update train_people set is_age_more_40=1
from people
where people.age<=40
and people.id=train_people.id;
update train_people set education_is_G=0
from people
where trim(people.education) in ('Bachelors', 'Masters', 'Doctorate')
and people.id=train_people.id;
update train_people set employer_type_is_gov=0
from people
where trim(people.type_employer) in ('Federal-gov', 'Local-gov', 'State-gov')
and people.id=train_people.id;
update train_people set is_sex_male=0
from people
where trim(people.sex) = ('Male')
and people.id=train_people.id;
update train_people set is_avg_work_less_40=0
from people
where hours_per_week < 40
and people.id=train_people.id;
|
-- CreateEnum
CREATE TYPE "Role" AS ENUM ('STUDENT', 'TEACHER', 'ADMIN');
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"firstName" TEXT NOT NULL,
"lastName" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
"role" "Role" NOT NULL DEFAULT E'STUDENT',
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Notification" (
"id" TEXT NOT NULL,
"courseId" TEXT,
"exerciseId" TEXT NOT NULL,
"text" TEXT NOT NULL,
"seen" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "GlobalNews" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"adminId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Upload" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"type" TEXT NOT NULL,
"uploadedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Course" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"locked" BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "CourseMaterial" (
"courseId" TEXT NOT NULL,
"uploadId" TEXT NOT NULL,
"description" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("courseId","uploadId")
);
-- CreateTable
CREATE TABLE "CourseNews" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT,
"teacherId" TEXT NOT NULL,
"courseId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Enrollment" (
"userId" TEXT NOT NULL,
"courseId" TEXT NOT NULL,
"enrolledAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("userId","courseId")
);
-- CreateTable
CREATE TABLE "Exercise" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deadline" TIMESTAMP(3),
"courseId" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "ExerciseSubmission" (
"studentId" TEXT NOT NULL,
"exerciseId" TEXT NOT NULL,
"studentComment" TEXT,
"teacherComment" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"grade" TEXT,
"uploadId" TEXT,
PRIMARY KEY ("studentId","exerciseId")
);
-- CreateIndex
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");
-- AddForeignKey
ALTER TABLE "Notification" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "GlobalNews" ADD FOREIGN KEY ("adminId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Upload" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CourseMaterial" ADD FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CourseMaterial" ADD FOREIGN KEY ("uploadId") REFERENCES "Upload"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CourseNews" ADD FOREIGN KEY ("teacherId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CourseNews" ADD FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Enrollment" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Enrollment" ADD FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Exercise" ADD FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ExerciseSubmission" ADD FOREIGN KEY ("studentId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ExerciseSubmission" ADD FOREIGN KEY ("exerciseId") REFERENCES "Exercise"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ExerciseSubmission" ADD FOREIGN KEY ("uploadId") REFERENCES "Upload"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
create schema new_releases_bot;
--drop table new_releases_bot.user_channels;
create table new_releases_bot.user_channels
(
id serial not null,
user_id int not null,
channel_name varchar not null,
channel_id bigint not null
);
--drop table new_releases_bot.releases;
create table new_releases_bot.releases
(
id serial not null,
release_id varchar not null,
artists varchar not null,
release_name varchar not null,
release_type varchar not null,
release_date date not null,
url varchar not null
);
|
CREATE TABLE IF NOT EXISTS `message_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) DEFAULT NULL COMMENT '用户id',
`messageId` int(11) DEFAULT NULL COMMENT '信息id',
`status` int(11) NULL DEFAULT 10 COMMENT '(10:已阅读)',
`createDate` varchar(50) DEFAULT NULL COMMENT '阅读日期',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
select count(*) as count from performance P where P.Dest='TPA' and P.AirTime between 60 and 300;
|
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50132
Source Host : localhost:3306
Source Schema : student
Target Server Type : MySQL
Target Server Version : 50132
File Encoding : 65001
Date: 15/03/2019 00:26:40
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for accesscount
-- ----------------------------
DROP TABLE IF EXISTS `accesscount`;
CREATE TABLE `accesscount` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`count` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of accesscount
-- ----------------------------
INSERT INTO `accesscount` VALUES (4, '2018/05/01', 49);
INSERT INTO `accesscount` VALUES (5, '2018/05/02', 152);
INSERT INTO `accesscount` VALUES (6, '2018/05/03', 200);
INSERT INTO `accesscount` VALUES (7, '2018/05/04', 500);
INSERT INTO `accesscount` VALUES (8, '2018/05/05', 289);
INSERT INTO `accesscount` VALUES (9, '2018/05/06', 236);
INSERT INTO `accesscount` VALUES (10, '2018/05/07', 98);
INSERT INTO `accesscount` VALUES (11, '2018/05/08', 136);
INSERT INTO `accesscount` VALUES (12, '2018/05/09', 360);
INSERT INTO `accesscount` VALUES (13, '2018/05/10', 230);
INSERT INTO `accesscount` VALUES (14, '2018/05/11', 109);
INSERT INTO `accesscount` VALUES (15, '2019/03/14', 77);
INSERT INTO `accesscount` VALUES (16, '2019/03/15', 98);
-- ----------------------------
-- Table structure for accessdetail
-- ----------------------------
DROP TABLE IF EXISTS `accessdetail`;
CREATE TABLE `accessdetail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`ipLocation` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`resourcePath` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`comeDate` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 709 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of accessdetail
-- ----------------------------
INSERT INTO `accessdetail` VALUES (492, '187.194.93.189', '', '/', '2018-05-11 01:24:52.131');
INSERT INTO `accessdetail` VALUES (493, '187.194.93.189', '', '/', '2018-05-11 01:24:53.582');
INSERT INTO `accessdetail` VALUES (494, '177.11.142.10', '', '/', '2018-05-11 01:29:56.779');
INSERT INTO `accessdetail` VALUES (495, '187.155.134.144', '', '/', '2018-05-11 01:31:31.133');
INSERT INTO `accessdetail` VALUES (496, '223.104.187.110', '', '/', '2018-05-11 01:31:54.779');
INSERT INTO `accessdetail` VALUES (497, '223.104.187.110', '', '/', '2018-05-11 01:32:59.556');
INSERT INTO `accessdetail` VALUES (498, '223.104.187.110', '', '/stu/stuList.html', '2018-05-11 01:33:06.244');
INSERT INTO `accessdetail` VALUES (499, '223.104.187.110', '', '/', '2018-05-11 01:33:14.084');
INSERT INTO `accessdetail` VALUES (500, '187.207.153.9', '', '/', '2018-05-11 01:36:01.533');
INSERT INTO `accessdetail` VALUES (501, '223.104.187.110', '', '/', '2018-05-11 01:53:11');
INSERT INTO `accessdetail` VALUES (502, '223.104.187.110', '', '/', '2018-05-11 01:58:11');
INSERT INTO `accessdetail` VALUES (503, '223.104.187.110', '', '/', '2018-05-11 02:00:11');
INSERT INTO `accessdetail` VALUES (504, '223.104.187.110', '', '/', '2018-05-11 02:05:11');
INSERT INTO `accessdetail` VALUES (505, '223.104.187.110', '', '/dept/addDept.html', '2018-05-11 02:06:11');
INSERT INTO `accessdetail` VALUES (506, '223.104.187.110', '', '/dept/addDept.html', '2018-05-11 02:07:11');
INSERT INTO `accessdetail` VALUES (507, '223.104.187.110', '', '/dept/addDept.html', '2018-05-11 02:08:11');
INSERT INTO `accessdetail` VALUES (508, '223.104.187.110', '', '/dept/addDept.html', '2018-05-11 02:09:11');
INSERT INTO `accessdetail` VALUES (509, '223.104.187.110', '', '/spe/addSpe.html', '2018-05-11 02:12:11');
INSERT INTO `accessdetail` VALUES (510, '223.104.187.110', '', '/spe/addSpe.html', '2018-05-11 02:13:11');
INSERT INTO `accessdetail` VALUES (511, '223.104.187.110', '', '/spe/spetList.html', '2018-05-11 02:14:11');
INSERT INTO `accessdetail` VALUES (512, '223.104.187.110', '', '/spe/addSpe.html', '2018-05-11 02:15:11');
INSERT INTO `accessdetail` VALUES (513, '223.104.187.110', '', '/spe/addSpe.html', '2018-05-11 02:16:11');
INSERT INTO `accessdetail` VALUES (514, '223.104.187.110', '', '/spe/addSpe.html', '2018-05-11 02:17:11');
INSERT INTO `accessdetail` VALUES (515, '223.104.187.110', '', '/spe/addSpe.html', '2018-05-11 02:18:11');
INSERT INTO `accessdetail` VALUES (516, '223.104.187.110', '', '/spe/addSpe.html', '2018-05-11 02:19:11');
INSERT INTO `accessdetail` VALUES (517, '223.104.187.110', '', '/spe/addSpe.html', '2018-05-11 02:20:11');
INSERT INTO `accessdetail` VALUES (518, '223.104.187.110', '', '/dept/deptList.html', '2018-05-11 02:21:11');
INSERT INTO `accessdetail` VALUES (519, '223.104.187.110', '', '/stu/findStuById.action', '2018-05-11 02:22:11');
INSERT INTO `accessdetail` VALUES (520, '223.104.187.110', '', '/stu/findSpeByDeptId.action', '2018-05-11 02:23:11');
INSERT INTO `accessdetail` VALUES (521, '223.104.187.110', '', '/stu/stuList.html', '2018-05-11 02:24:11');
INSERT INTO `accessdetail` VALUES (522, '223.104.187.110', '', '/stu/findSpeByDeptId.action', '2018-05-11 02:25:11');
INSERT INTO `accessdetail` VALUES (523, '120.24.208.141', '', '/', '2018-05-11 02:25:11');
INSERT INTO `accessdetail` VALUES (524, '223.104.187.110', '', '/stu/findStuById.action', '2018-05-11 02:26:11');
INSERT INTO `accessdetail` VALUES (525, '223.104.187.110', '', '/', '2018-05-11 02:27:11');
INSERT INTO `accessdetail` VALUES (526, '223.104.187.110', '', '/', '2018-05-11 02:31:11');
INSERT INTO `accessdetail` VALUES (527, '223.104.187.110', '', '/', '2018-05-11 02:33:11');
INSERT INTO `accessdetail` VALUES (528, '223.104.187.110', '', '/stu/addStuPage.html', '2018-05-11 02:34:11');
INSERT INTO `accessdetail` VALUES (529, '0:0:0:0:0:0:0:1', '', '/', '2019-03-14 21:58:31');
INSERT INTO `accessdetail` VALUES (530, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:08:12');
INSERT INTO `accessdetail` VALUES (531, '0:0:0:0:0:0:0:1', '', '/', '2019-03-14 22:08:15');
INSERT INTO `accessdetail` VALUES (532, '0:0:0:0:0:0:0:1', '', '/', '2019-03-14 22:08:54');
INSERT INTO `accessdetail` VALUES (533, '0:0:0:0:0:0:0:1', '', '/dept/deptList.html', '2019-03-14 22:08:57');
INSERT INTO `accessdetail` VALUES (534, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:09:10');
INSERT INTO `accessdetail` VALUES (535, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:28:58');
INSERT INTO `accessdetail` VALUES (536, '127.0.0.1', '', '/', '2019-03-14 22:29:06');
INSERT INTO `accessdetail` VALUES (537, '127.0.0.1', '', '/spe/spetList.html', '2019-03-14 22:29:38');
INSERT INTO `accessdetail` VALUES (538, '127.0.0.1', '', '/stu/stuList.html', '2019-03-14 22:29:46');
INSERT INTO `accessdetail` VALUES (539, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:30:14');
INSERT INTO `accessdetail` VALUES (540, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-14 22:30:17');
INSERT INTO `accessdetail` VALUES (541, '127.0.0.1', 'XX-XX-内网IP', '/dept/deptList.html', '2019-03-14 22:30:19');
INSERT INTO `accessdetail` VALUES (542, '127.0.0.1', 'XX-XX-内网IP', '/dept/editById.action', '2019-03-14 22:30:22');
INSERT INTO `accessdetail` VALUES (543, '127.0.0.1', 'XX-XX-内网IP', '/dept/updateDept.html', '2019-03-14 22:30:25');
INSERT INTO `accessdetail` VALUES (544, '127.0.0.1', 'XX-XX-内网IP', '/dept/deptList.html', '2019-03-14 22:30:25');
INSERT INTO `accessdetail` VALUES (545, '127.0.0.1', '', '/spe/spetList.html', '2019-03-14 22:30:31');
INSERT INTO `accessdetail` VALUES (546, '127.0.0.1', '', '/', '2019-03-14 22:32:13');
INSERT INTO `accessdetail` VALUES (547, '127.0.0.1', '', '/', '2019-03-14 22:32:48');
INSERT INTO `accessdetail` VALUES (548, '127.0.0.1', '', '/', '2019-03-14 22:32:52');
INSERT INTO `accessdetail` VALUES (549, '127.0.0.1', '', '/', '2019-03-14 22:33:21');
INSERT INTO `accessdetail` VALUES (550, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:33:28');
INSERT INTO `accessdetail` VALUES (551, '127.0.0.1', '', '/', '2019-03-14 22:33:59');
INSERT INTO `accessdetail` VALUES (552, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-14 22:34:10');
INSERT INTO `accessdetail` VALUES (553, '127.0.0.1', '', '/', '2019-03-14 22:34:24');
INSERT INTO `accessdetail` VALUES (554, '127.0.0.1', '', '/stu/stuList.html', '2019-03-14 22:34:27');
INSERT INTO `accessdetail` VALUES (555, '127.0.0.1', '', '/dept/deptList.html', '2019-03-14 22:34:28');
INSERT INTO `accessdetail` VALUES (556, '127.0.0.1', '', '/spe/spetList.html', '2019-03-14 22:34:58');
INSERT INTO `accessdetail` VALUES (557, '127.0.0.1', '', '/spe/findSpeBySpeId.action', '2019-03-14 22:35:24');
INSERT INTO `accessdetail` VALUES (558, '127.0.0.1', '', '/spe/findSpeBySpeId.action', '2019-03-14 22:35:35');
INSERT INTO `accessdetail` VALUES (559, '127.0.0.1', '', '/', '2019-03-14 22:38:05');
INSERT INTO `accessdetail` VALUES (560, '127.0.0.1', '', '/spe/spetList.html', '2019-03-14 22:38:19');
INSERT INTO `accessdetail` VALUES (561, '127.0.0.1', '', '/dept/deptList.html', '2019-03-14 22:38:22');
INSERT INTO `accessdetail` VALUES (562, '127.0.0.1', '', '/spe/spetList.html', '2019-03-14 22:38:23');
INSERT INTO `accessdetail` VALUES (563, '127.0.0.1', '', '/', '2019-03-14 22:38:24');
INSERT INTO `accessdetail` VALUES (564, '127.0.0.1', '', '/', '2019-03-14 22:38:31');
INSERT INTO `accessdetail` VALUES (565, '127.0.0.1', '', '/dept/deptList.html', '2019-03-14 22:39:01');
INSERT INTO `accessdetail` VALUES (566, '127.0.0.1', '', '/dept/addDept.html', '2019-03-14 22:41:42');
INSERT INTO `accessdetail` VALUES (567, '127.0.0.1', '', '/dept/addDept.html', '2019-03-14 22:41:47');
INSERT INTO `accessdetail` VALUES (568, '127.0.0.1', '', '/dept/deptList.html', '2019-03-14 22:41:50');
INSERT INTO `accessdetail` VALUES (569, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:41:58');
INSERT INTO `accessdetail` VALUES (570, '127.0.0.1', 'XX-XX-内网IP', '/dept/deptList.html', '2019-03-14 22:42:02');
INSERT INTO `accessdetail` VALUES (571, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-14 22:42:03');
INSERT INTO `accessdetail` VALUES (572, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:42:05');
INSERT INTO `accessdetail` VALUES (573, '127.0.0.1', '', '/spe/spetList.html', '2019-03-14 22:42:12');
INSERT INTO `accessdetail` VALUES (574, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-14 22:43:06');
INSERT INTO `accessdetail` VALUES (575, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:43:07');
INSERT INTO `accessdetail` VALUES (576, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 22:43:10');
INSERT INTO `accessdetail` VALUES (577, '127.0.0.1', '', '/spe/spetList.html', '2019-03-14 22:43:14');
INSERT INTO `accessdetail` VALUES (578, '0:0:0:0:0:0:0:1', '', '/', '2019-03-14 23:45:09');
INSERT INTO `accessdetail` VALUES (579, '0:0:0:0:0:0:0:1', '', '/dept/deptList.html', '2019-03-14 23:45:13');
INSERT INTO `accessdetail` VALUES (580, '0:0:0:0:0:0:0:1', '', '/spe/spetList.html', '2019-03-14 23:45:15');
INSERT INTO `accessdetail` VALUES (581, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 23:45:18');
INSERT INTO `accessdetail` VALUES (582, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 23:47:13');
INSERT INTO `accessdetail` VALUES (583, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-14 23:58:52');
INSERT INTO `accessdetail` VALUES (584, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 23:58:54');
INSERT INTO `accessdetail` VALUES (585, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-14 23:58:56');
INSERT INTO `accessdetail` VALUES (586, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getDeptChart.action', '2019-03-14 23:58:58');
INSERT INTO `accessdetail` VALUES (587, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getSpeChart.action', '2019-03-14 23:59:00');
INSERT INTO `accessdetail` VALUES (588, '127.0.0.1', 'XX-XX-内网IP', '/back/userList.html', '2019-03-14 23:59:01');
INSERT INTO `accessdetail` VALUES (589, '127.0.0.1', '', '/back/accessList.html', '2019-03-14 23:59:06');
INSERT INTO `accessdetail` VALUES (590, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 23:59:12');
INSERT INTO `accessdetail` VALUES (591, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-14 23:59:16');
INSERT INTO `accessdetail` VALUES (592, '127.0.0.1', 'XX-XX-内网IP', '/stu/findStuByStuId.action', '2019-03-14 23:59:19');
INSERT INTO `accessdetail` VALUES (593, '127.0.0.1', 'XX-XX-内网IP', '/stu/updateStudent.action', '2019-03-14 23:59:24');
INSERT INTO `accessdetail` VALUES (594, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-14 23:59:25');
INSERT INTO `accessdetail` VALUES (595, '127.0.0.1', 'XX-XX-内网IP', '/stu/findStuByStuId.action', '2019-03-14 23:59:28');
INSERT INTO `accessdetail` VALUES (596, '127.0.0.1', 'XX-XX-内网IP', '/stu/findStuByStuId.action', '2019-03-14 23:59:32');
INSERT INTO `accessdetail` VALUES (597, '127.0.0.1', 'XX-XX-内网IP', '/stu/updateStudent.action', '2019-03-14 23:59:34');
INSERT INTO `accessdetail` VALUES (598, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-14 23:59:36');
INSERT INTO `accessdetail` VALUES (599, '127.0.0.1', '', '/stu/findStuByStuId.action', '2019-03-14 23:59:41');
INSERT INTO `accessdetail` VALUES (600, '127.0.0.1', 'XX-XX-内网IP', '/stu/deleteStu.action', '2019-03-14 23:59:49');
INSERT INTO `accessdetail` VALUES (601, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-14 23:59:52');
INSERT INTO `accessdetail` VALUES (602, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-14 23:59:54');
INSERT INTO `accessdetail` VALUES (603, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-14 23:59:55');
INSERT INTO `accessdetail` VALUES (604, '127.0.0.1', 'XX-XX-内网IP', '/back/chartList.html', '2019-03-14 23:59:57');
INSERT INTO `accessdetail` VALUES (605, '127.0.0.1', 'XX-XX-内网IP', '/back/accessList.html', '2019-03-14 23:59:58');
INSERT INTO `accessdetail` VALUES (606, '127.0.0.1', '', '/back/chartList.html', '2019-03-15 00:00:01');
INSERT INTO `accessdetail` VALUES (607, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:00:01');
INSERT INTO `accessdetail` VALUES (608, '127.0.0.1', '', '/back/chart/getDeptChart.action', '2019-03-15 00:00:03');
INSERT INTO `accessdetail` VALUES (609, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getSpeChart.action', '2019-03-15 00:00:04');
INSERT INTO `accessdetail` VALUES (610, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:01:17');
INSERT INTO `accessdetail` VALUES (611, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getDeptChart.action', '2019-03-15 00:01:31');
INSERT INTO `accessdetail` VALUES (612, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getSpeChart.action', '2019-03-15 00:01:32');
INSERT INTO `accessdetail` VALUES (613, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:01:32');
INSERT INTO `accessdetail` VALUES (614, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:01:33');
INSERT INTO `accessdetail` VALUES (615, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:01:48');
INSERT INTO `accessdetail` VALUES (616, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:02:37');
INSERT INTO `accessdetail` VALUES (617, '127.0.0.1', '', '/back/chart/getAccessChart.action', '2019-03-15 00:02:37');
INSERT INTO `accessdetail` VALUES (618, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getDeptChart.action', '2019-03-15 00:02:54');
INSERT INTO `accessdetail` VALUES (619, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:02:55');
INSERT INTO `accessdetail` VALUES (620, '127.0.0.1', '', '/', '2019-03-15 00:02:55');
INSERT INTO `accessdetail` VALUES (621, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getSpeChart.action', '2019-03-15 00:02:57');
INSERT INTO `accessdetail` VALUES (622, '127.0.0.1', 'XX-XX-内网IP', '/back/userList.html', '2019-03-15 00:02:59');
INSERT INTO `accessdetail` VALUES (623, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:03:00');
INSERT INTO `accessdetail` VALUES (624, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:03:14');
INSERT INTO `accessdetail` VALUES (625, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:03:14');
INSERT INTO `accessdetail` VALUES (626, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getDeptChart.action', '2019-03-15 00:03:16');
INSERT INTO `accessdetail` VALUES (627, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getSpeChart.action', '2019-03-15 00:03:17');
INSERT INTO `accessdetail` VALUES (628, '127.0.0.1', 'XX-XX-内网IP', '/back/userList.html', '2019-03-15 00:03:19');
INSERT INTO `accessdetail` VALUES (629, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:03:20');
INSERT INTO `accessdetail` VALUES (630, '127.0.0.1', '', '/spe/spetList.html', '2019-03-15 00:04:26');
INSERT INTO `accessdetail` VALUES (631, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:04:29');
INSERT INTO `accessdetail` VALUES (632, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:04:30');
INSERT INTO `accessdetail` VALUES (633, '127.0.0.1', 'XX-XX-内网IP', '/dept/deptList.html', '2019-03-15 00:04:30');
INSERT INTO `accessdetail` VALUES (634, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-15 00:04:31');
INSERT INTO `accessdetail` VALUES (635, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:04:32');
INSERT INTO `accessdetail` VALUES (636, '127.0.0.1', '', '/', '2019-03-15 00:04:32');
INSERT INTO `accessdetail` VALUES (637, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-15 00:04:33');
INSERT INTO `accessdetail` VALUES (638, '127.0.0.1', '', '/', '2019-03-15 00:04:33');
INSERT INTO `accessdetail` VALUES (639, '127.0.0.1', '', '/back/chartList.html', '2019-03-15 00:04:33');
INSERT INTO `accessdetail` VALUES (640, '127.0.0.1', '', '/back/accessList.html', '2019-03-15 00:04:36');
INSERT INTO `accessdetail` VALUES (641, '127.0.0.1', '', '/back/accessList.html', '2019-03-15 00:04:56');
INSERT INTO `accessdetail` VALUES (642, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:05:35');
INSERT INTO `accessdetail` VALUES (643, '127.0.0.1', 'XX-XX-内网IP', '/back/userList.html', '2019-03-15 00:05:35');
INSERT INTO `accessdetail` VALUES (644, '127.0.0.1', '', '/back/userList.html', '2019-03-15 00:05:35');
INSERT INTO `accessdetail` VALUES (645, '127.0.0.1', '', '/', '2019-03-15 00:05:40');
INSERT INTO `accessdetail` VALUES (646, '127.0.0.1', '', '/back/userList.html', '2019-03-15 00:05:42');
INSERT INTO `accessdetail` VALUES (647, '127.0.0.1', '', '/', '2019-03-15 00:05:42');
INSERT INTO `accessdetail` VALUES (648, '127.0.0.1', '', '/', '2019-03-15 00:05:44');
INSERT INTO `accessdetail` VALUES (649, '127.0.0.1', '', '/back/accessList.html', '2019-03-15 00:05:46');
INSERT INTO `accessdetail` VALUES (650, '127.0.0.1', '', '/back/accessList.html', '2019-03-15 00:05:48');
INSERT INTO `accessdetail` VALUES (651, '127.0.0.1', '', '/', '2019-03-15 00:05:48');
INSERT INTO `accessdetail` VALUES (652, '127.0.0.1', '', '/', '2019-03-15 00:05:50');
INSERT INTO `accessdetail` VALUES (653, '127.0.0.1', '', '/back/userList.html', '2019-03-15 00:05:59');
INSERT INTO `accessdetail` VALUES (654, '127.0.0.1', '', '/back/chartList.html', '2019-03-15 00:06:00');
INSERT INTO `accessdetail` VALUES (655, '127.0.0.1', '', '/back/accessList.html', '2019-03-15 00:06:13');
INSERT INTO `accessdetail` VALUES (656, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:09:18');
INSERT INTO `accessdetail` VALUES (657, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-15 00:09:28');
INSERT INTO `accessdetail` VALUES (658, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-15 00:09:31');
INSERT INTO `accessdetail` VALUES (659, '127.0.0.1', 'XX-XX-内网IP', '/stu/addStuPage.html', '2019-03-15 00:09:35');
INSERT INTO `accessdetail` VALUES (660, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:09:39');
INSERT INTO `accessdetail` VALUES (661, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-15 00:09:41');
INSERT INTO `accessdetail` VALUES (662, '127.0.0.1', '', '/stu/exportData.html', '2019-03-15 00:09:45');
INSERT INTO `accessdetail` VALUES (663, '127.0.0.1', '', '/stu/stuList.html', '2019-03-15 00:10:00');
INSERT INTO `accessdetail` VALUES (664, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:10:03');
INSERT INTO `accessdetail` VALUES (665, '127.0.0.1', 'XX-XX-内网IP', '/dept/deptList.html', '2019-03-15 00:10:04');
INSERT INTO `accessdetail` VALUES (666, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-15 00:10:14');
INSERT INTO `accessdetail` VALUES (667, '127.0.0.1', 'XX-XX-内网IP', '/spe/findSpeBySpeId.action', '2019-03-15 00:10:17');
INSERT INTO `accessdetail` VALUES (668, '127.0.0.1', 'XX-XX-内网IP', '/spe/findSpeBySpeId.action', '2019-03-15 00:10:24');
INSERT INTO `accessdetail` VALUES (669, '127.0.0.1', 'XX-XX-内网IP', '/spe/updateSpe.action', '2019-03-15 00:10:36');
INSERT INTO `accessdetail` VALUES (670, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-15 00:10:37');
INSERT INTO `accessdetail` VALUES (671, '127.0.0.1', '', '/spe/spetList.html', '2019-03-15 00:10:48');
INSERT INTO `accessdetail` VALUES (672, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-15 00:10:53');
INSERT INTO `accessdetail` VALUES (673, '127.0.0.1', 'XX-XX-内网IP', '/stu/findStuByStuId.action', '2019-03-15 00:10:58');
INSERT INTO `accessdetail` VALUES (674, '127.0.0.1', 'XX-XX-内网IP', '/stu/findStuByStuId.action', '2019-03-15 00:11:05');
INSERT INTO `accessdetail` VALUES (675, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:11:14');
INSERT INTO `accessdetail` VALUES (676, '127.0.0.1', '', '/back/chart/getAccessChart.action', '2019-03-15 00:11:15');
INSERT INTO `accessdetail` VALUES (677, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getDeptChart.action', '2019-03-15 00:11:26');
INSERT INTO `accessdetail` VALUES (678, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getSpeChart.action', '2019-03-15 00:11:36');
INSERT INTO `accessdetail` VALUES (679, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getDeptChart.action', '2019-03-15 00:12:12');
INSERT INTO `accessdetail` VALUES (680, '127.0.0.1', '', '/back/accessList.html', '2019-03-15 00:12:13');
INSERT INTO `accessdetail` VALUES (681, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:13:04');
INSERT INTO `accessdetail` VALUES (682, '127.0.0.1', 'XX-XX-内网IP', '/stu/addStuPage.html', '2019-03-15 00:13:08');
INSERT INTO `accessdetail` VALUES (683, '127.0.0.1', 'XX-XX-内网IP', '/stu/findSpeByDeptId.action', '2019-03-15 00:13:12');
INSERT INTO `accessdetail` VALUES (684, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:13:30');
INSERT INTO `accessdetail` VALUES (685, '127.0.0.1', 'XX-XX-内网IP', '/dept/deptList.html', '2019-03-15 00:13:32');
INSERT INTO `accessdetail` VALUES (686, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:13:34');
INSERT INTO `accessdetail` VALUES (687, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getDeptChart.action', '2019-03-15 00:13:35');
INSERT INTO `accessdetail` VALUES (688, '127.0.0.1', '', '/', '2019-03-15 00:13:42');
INSERT INTO `accessdetail` VALUES (689, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:13:42');
INSERT INTO `accessdetail` VALUES (690, '127.0.0.1', 'XX-XX-内网IP', '/dept/deptList.html', '2019-03-15 00:15:31');
INSERT INTO `accessdetail` VALUES (691, '127.0.0.1', 'XX-XX-内网IP', '/dept/editById.action', '2019-03-15 00:15:35');
INSERT INTO `accessdetail` VALUES (692, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-15 00:15:38');
INSERT INTO `accessdetail` VALUES (693, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:15:55');
INSERT INTO `accessdetail` VALUES (694, '127.0.0.1', 'XX-XX-内网IP', '/dept/deptList.html', '2019-03-15 00:16:10');
INSERT INTO `accessdetail` VALUES (695, '127.0.0.1', 'XX-XX-内网IP', '/dept/editById.action', '2019-03-15 00:16:19');
INSERT INTO `accessdetail` VALUES (696, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:16:32');
INSERT INTO `accessdetail` VALUES (697, '127.0.0.1', 'XX-XX-内网IP', '/spe/spetList.html', '2019-03-15 00:16:35');
INSERT INTO `accessdetail` VALUES (698, '127.0.0.1', 'XX-XX-内网IP', '/spe/findSpeBySpeId.action', '2019-03-15 00:16:38');
INSERT INTO `accessdetail` VALUES (699, '127.0.0.1', 'XX-XX-内网IP', '/dept/editById.action', '2019-03-15 00:16:38');
INSERT INTO `accessdetail` VALUES (700, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:16:44');
INSERT INTO `accessdetail` VALUES (701, '127.0.0.1', 'XX-XX-内网IP', '/back/chart/getAccessChart.action', '2019-03-15 00:16:48');
INSERT INTO `accessdetail` VALUES (702, '127.0.0.1', 'XX-XX-内网IP', '/', '2019-03-15 00:17:55');
INSERT INTO `accessdetail` VALUES (703, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-15 00:18:13');
INSERT INTO `accessdetail` VALUES (704, '127.0.0.1', 'XX-XX-内网IP', '/stu/stuList.html', '2019-03-15 00:18:22');
INSERT INTO `accessdetail` VALUES (705, '127.0.0.1', 'XX-XX-内网IP', '/stu/findSpeByDeptId.action', '2019-03-15 00:18:27');
INSERT INTO `accessdetail` VALUES (706, '127.0.0.1', '', '/stu/stuList.html', '2019-03-15 00:18:33');
INSERT INTO `accessdetail` VALUES (707, '127.0.0.1', 'XX-XX-内网IP', '/stu/findSpeByDeptId.action', '2019-03-15 00:18:35');
INSERT INTO `accessdetail` VALUES (708, '127.0.0.1', 'XX-XX-内网IP', '/stu/addStuPage.html', '2019-03-15 00:18:45');
-- ----------------------------
-- Table structure for deptment
-- ----------------------------
DROP TABLE IF EXISTS `deptment`;
CREATE TABLE `deptment` (
`deptId` int(11) NOT NULL AUTO_INCREMENT,
`deptName` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`createDate` datetime NULL DEFAULT NULL,
`discription` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`updateDate` datetime NULL DEFAULT NULL,
PRIMARY KEY (`deptId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 31 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of deptment
-- ----------------------------
INSERT INTO `deptment` VALUES (21, '计算机工程学院', '2018-05-11 02:06:01', '计算机工程学院', '2018-05-11 02:06:01');
INSERT INTO `deptment` VALUES (22, '经济管理学院', '2018-05-11 02:06:52', '经济管理学院x', '2019-03-14 22:30:25');
INSERT INTO `deptment` VALUES (23, '信息与控制学院', '2018-05-11 02:07:50', '信息与控制学院', '2018-05-11 02:07:50');
INSERT INTO `deptment` VALUES (24, '机电与车辆工程学院', '2018-05-11 02:08:12', '机电与车辆工程学院', '2018-05-11 02:08:12');
INSERT INTO `deptment` VALUES (25, '数学与信息科学学院', '2018-05-11 02:08:31', '数学与信息科学学院', '2018-05-11 02:08:31');
INSERT INTO `deptment` VALUES (26, '外国语学院', '2018-05-11 02:08:44', '外国语学院', '2018-05-11 02:08:44');
INSERT INTO `deptment` VALUES (27, '物理与光电工程学院', '2018-05-11 02:09:03', '物理与光电工程学院', '2018-05-11 02:09:03');
INSERT INTO `deptment` VALUES (28, '历史文化与旅游学院', '2018-05-11 02:09:25', '历史文化与旅游学院', '2018-05-11 02:09:25');
INSERT INTO `deptment` VALUES (29, '213124', '2019-03-14 22:41:42', '2131231231', '2019-03-14 22:41:42');
INSERT INTO `deptment` VALUES (30, '213124', '2019-03-14 22:41:47', '2131231231', '2019-03-14 22:41:47');
-- ----------------------------
-- Table structure for specialty
-- ----------------------------
DROP TABLE IF EXISTS `specialty`;
CREATE TABLE `specialty` (
`speId` int(11) NOT NULL AUTO_INCREMENT,
`speName` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`createDate` datetime NULL DEFAULT NULL,
`description` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`deptId` int(11) NULL DEFAULT NULL,
`deptName` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`speId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 44 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of specialty
-- ----------------------------
INSERT INTO `specialty` VALUES (24, '计算机科学与技术', '2018-05-11 02:12:56', '计算机科学与技术', 21, '计算机工程学院');
INSERT INTO `specialty` VALUES (25, '网络工程', '2018-05-11 02:13:12', '网络工程', 21, '计算机工程学院');
INSERT INTO `specialty` VALUES (28, '通信工程', '2018-05-11 02:14:43', '通信工程', 21, '计算机工程学院');
INSERT INTO `specialty` VALUES (29, '软件工程', '2018-05-11 02:14:59', '软件工程', 21, '计算机工程学院');
INSERT INTO `specialty` VALUES (30, '会计学', '2018-05-11 02:15:17', '会计学', 22, '经济管理学院');
INSERT INTO `specialty` VALUES (31, '市场营销', '2018-05-11 02:15:33', '市场营销', 22, '经济管理学院');
INSERT INTO `specialty` VALUES (32, '经济与金融', '2018-05-11 02:15:52', '经济与金融', 22, '经济管理学院');
INSERT INTO `specialty` VALUES (33, '自动化', '2018-05-11 02:16:55', '自动化', 23, '信息与控制学院');
INSERT INTO `specialty` VALUES (34, '电子信息工程', '2018-05-11 02:17:06', '电子信息工程', 23, '信息与控制学院');
INSERT INTO `specialty` VALUES (35, '历史学', '2018-05-11 02:17:27', '历史学', 28, '历史文化与旅游学院');
INSERT INTO `specialty` VALUES (36, '旅游管理', '2018-05-11 02:17:41', '旅游管理', 28, '历史文化与旅游学院');
INSERT INTO `specialty` VALUES (37, '物理学', '2018-05-11 02:17:57', '物理学', 27, '物理与光电工程学院');
INSERT INTO `specialty` VALUES (38, '电子科学与技术', '2018-05-11 02:18:26', '电子科学与技术', 27, '物理与光电工程学院');
INSERT INTO `specialty` VALUES (39, '工业设计', '2018-05-11 02:18:59', '工业设计', 24, '机电与车辆工程学院');
INSERT INTO `specialty` VALUES (40, '机械设计制造及其自动化', '2018-05-11 02:19:18', '机械设计制造及其自动化', 24, '机电与车辆工程学院');
INSERT INTO `specialty` VALUES (41, '车辆工程', '2018-05-11 02:19:30', '车辆工程', 24, '机电与车辆工程学院');
INSERT INTO `specialty` VALUES (42, '统计学', '2018-05-11 02:19:52', '统计学', 25, '数学与信息科学学院');
INSERT INTO `specialty` VALUES (43, '数学与应用数学', '2018-05-11 02:20:08', '数学与应用数学', 25, '数学与信息科学学院');
-- ----------------------------
-- Table structure for stu
-- ----------------------------
DROP TABLE IF EXISTS `stu`;
CREATE TABLE `stu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`stuId` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`stuName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`gender` int(1) NULL DEFAULT NULL,
`headPic` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`birthday` datetime NULL DEFAULT NULL,
`comeDate` datetime NULL DEFAULT NULL,
`speId` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 51 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of stu
-- ----------------------------
INSERT INTO `stu` VALUES (34, '214124151', '2141232', 0, '/images/defaultHead.jpg', '2018-05-17 00:00:00', '2018-05-11 00:00:00', 24);
INSERT INTO `stu` VALUES (35, '214123252', 'fdsfs', 0, '/images/defaultHead.jpg', '2018-05-23 00:00:00', '2018-05-16 00:00:00', 25);
INSERT INTO `stu` VALUES (36, '124124578', 'asdadf', 0, '/images/defaultHead.jpg', '2018-05-04 00:00:00', '2018-05-25 00:00:00', 28);
INSERT INTO `stu` VALUES (38, '215235346', 'asfasc', 1, '/images/defaultHead.jpg', '2018-05-10 00:00:00', '2018-05-17 00:00:00', 24);
INSERT INTO `stu` VALUES (39, '2352352', 'tweg', 0, '/images/defaultHead.jpg', '2018-05-24 00:00:00', '2018-05-15 00:00:00', 30);
INSERT INTO `stu` VALUES (40, '12412', '2352352', 1, '/images/defaultHead.jpg', '2018-05-24 00:00:00', '2018-05-18 00:00:00', 31);
INSERT INTO `stu` VALUES (41, '236326346', 'sdgsdg', 0, '/images/defaultHead.jpg', '2018-05-10 00:00:00', '2018-05-30 00:00:00', 32);
INSERT INTO `stu` VALUES (42, '12523688458', 'asdasd', 1, '/images/defaultHead.jpg', '2018-05-16 00:00:00', '2018-05-23 00:00:00', 30);
INSERT INTO `stu` VALUES (43, '347457458', '63t43t3', 0, '/images/defaultHead.jpg', '2018-05-17 00:00:00', '2018-05-25 00:00:00', 33);
INSERT INTO `stu` VALUES (44, '375869564', 'asfasf', 1, '/images/defaultHead.jpg', '2018-05-23 00:00:00', '2018-05-24 00:00:00', 34);
INSERT INTO `stu` VALUES (45, '12547569867', '342532', 1, '/images/defaultHead.jpg', '2018-05-24 00:00:00', '2018-05-15 00:00:00', 39);
INSERT INTO `stu` VALUES (46, '3263464', '7egweg', 0, '/images/defaultHead.jpg', '2018-05-17 00:00:00', '2018-05-24 00:00:00', 40);
INSERT INTO `stu` VALUES (47, '1241251', '15125151', 1, '/images/defaultHead.jpg', '2018-05-24 00:00:00', '2018-05-15 00:00:00', 24);
INSERT INTO `stu` VALUES (48, '25235235', '2352352', 0, '/images/defaultHead.jpg', '2018-05-10 00:00:00', '2018-05-09 00:00:00', 30);
INSERT INTO `stu` VALUES (49, '325365474', 'wfsdgsd', 1, '/images/defaultHead.jpg', '2018-05-17 00:00:00', '2018-05-24 00:00:00', 37);
INSERT INTO `stu` VALUES (50, '2364376595', '2352352', 1, '/images/defaultHead.jpg', '2018-05-23 00:00:00', '2018-05-31 00:00:00', 38);
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`gender` int(2) NULL DEFAULT NULL,
`telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`headPic` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`sign` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`registDate` datetime NULL DEFAULT NULL,
`lastLoginDate` datetime NULL DEFAULT NULL,
`loginNum` int(20) NULL DEFAULT NULL,
`role` int(1) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (1, 'admin', 'admin', 1, '13563274342', '757853223@qq.com', 'http://www.gxc.com:9999/admin/20190314_235450.jpg', 'xxx', 'xxxxxx', '2019-03-14 23:47:01', '2019-03-15 00:14:15', 3, 0);
SET FOREIGN_KEY_CHECKS = 1;
|
UPDATE customer
set items_in_cart = $2
where cust_id = $1;
SELECT items_in_cart from CUSTOMER;
|
-- ----------------------------
-- Table structure for pms_product_attribute_category
-- ----------------------------
DROP TABLE IF EXISTS `pms_product_attribute_category`;
CREATE TABLE `pms_product_attribute_category` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL,
`attribute_count` int(11) DEFAULT '0' COMMENT '属性数量',
`param_count` int(11) DEFAULT '0' COMMENT '参数数量',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='产品属性分类表';
|
SELECT DISTINCT school
FROM teacher;
SELECT firts_name, last_name, salary
FROM teacher
ORDER BY salary ASC;
SELECT last_name, school, hire_date
FROM teacher
WHERE school = 'Meyers Middle School';
SELECT salary
From teacher
WHERE salary BETWEEN 39000 AND 70000
SELECT firts_name
FROM teacher
WHERE firts_name LIKE 'Sam%';
SELECT firts_name, last_name, school, hire_date, salary
FROM teacher
WHERE school LIKE '%Roos%'
ORDER BY hire_date DESC;
SELECT firts_name, last_name, school, hire_date, salary
FROM teacher
ORDER BY school,firts_name DESC;
|
-- 架构
select cdme.center,
cdme.region,
cdme.department,
cdme.department_name
from dt_mobdb.dt_charlie_dept_month_end cdme
where to_date(cdme.stats_date)='${analyse_date}'
and cdme.class='CC' and cdme.department_name like 'CC%'
and to_date(cdme.`date`)>=trunc('${analyse_date}','MM')
group by cdme.center, cdme.region, cdme.department, cdme.department_name
-- 试听关单率
select b.department_name,
count(distinct case when to_date(b.adjust_start_time)='${analyse_date}' then b.contract_id end)/count(distinct case when to_date(b.adjust_start_time)='${analyse_date}' then b.student_intention_id end) yes_trial_deal_rate,
count(distinct case when to_date(b.adjust_start_time)>=date_sub('${analyse_date}',7) then b.contract_id end)/count(distinct case when to_date(b.adjust_start_time)>=date_sub('${analyse_date}',7) then b.student_intention_id end) rc7_trial_deal_rate,
count(distinct case when to_date(b.adjust_start_time)>=date_sub('${analyse_date}',30) then b.contract_id end)/count(distinct case when to_date(b.adjust_start_time)>=date_sub('${analyse_date}',30) then b.student_intention_id end) rc30_trial_deal_rate
from(
select cdme.department_name, lpo.student_intention_id, lpo.apply_user_id, lp.adjust_start_time, a.max_date, a.contract_id
from dw_hf_mobdb.dw_lesson_plan_order lpo
left join dw_hf_mobdb.dw_lesson_relation lr on lpo.order_id = lr.order_id
left join dw_hf_mobdb.dw_lesson_plan lp on lr.plan_id = lp.lesson_plan_id
left join dw_hf_mobdb.dw_view_student s on s.student_intention_id = lpo.student_intention_id
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id = lpo.apply_user_id
and to_date(cdme.stats_date)='${analyse_date}' and cdme.class = 'CC'
and to_date(cdme.`date`)>=date_sub('${analyse_date}',30)
left join (
select max(tcp.pay_date) max_date,
tc.contract_id,
tc.student_intention_id,
sum(tcp.`sum`/100) real_pay_amount,
max((tc.`sum`-666)*10) contract_amount,
tcp.submit_user_id,
cdme.department_name
from dw_hf_mobdb.dw_view_tms_contract_payment tcp
left join dw_hf_mobdb.dw_view_tms_contract tc on tc.contract_id = tcp.contract_id
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id = tcp.submit_user_id
and to_date(cdme.stats_date)='${analyse_date}' and cdme.class = 'CC'
and to_date(cdme.`date`)>=date_sub('${analyse_date}',30)
where tcp.pay_status in (2,4)
and tc.status<>8
group by tc.contract_id, cdme.department_name, tc.student_intention_id, tcp.submit_user_id
having max(tcp.pay_date)>=date_sub('${analyse_date}',30)
and max(tcp.pay_date)<='${analyse_date}'
and round(sum(tcp.`sum`/100),0)>=round(max((tc.`sum`-666)*10),0)
) as a on a.student_intention_id=lpo.student_intention_id
and a.department_name=cdme.department_name
where lp.lesson_type = 2
and to_date(lpo.apply_time)>=date_sub('${analyse_date}',30)
and to_date(lpo.apply_time)<='${analyse_date}'
and lp.status in (3,5) and lp.solve_status <> 6
and s.account_type = 1
) as b
group by b.department_name
-- 当月粒子数
select c.department_name,
count(case when to_date(s.create_time)>=trunc('${analyse_date}','MM') then c.intention_id end) tomonth_new_keys,
count(case when to_date(s.create_time)<trunc('${analyse_date}','MM') then c.intention_id end) tomonth_oc_keys
from(
select tpel.intention_id, cdme.department_name
from dw_hf_mobdb.dw_tms_pool_exchange_log tpel
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id = tpel.track_userid
and to_date(cdme.stats_date)='${analyse_date}' and cdme.class = 'CC'
and to_date(cdme.`date`)>=trunc('${analyse_date}','MM')
where to_date(tpel.into_pool_date)>=trunc('${analyse_date}','MM')
and to_date(tpel.into_pool_date)<='${analyse_date}'
union all
select tnn.student_intention_id, cdme.department_name
from dw_hf_mobdb.dw_tms_new_name_get_log tnn
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id = tnn.user_id
and to_date(cdme.stats_date)='${analyse_date}' and cdme.class = 'CC'
and to_date(cdme.`date`)>=trunc('${analyse_date}','MM')
where to_date(tnn.create_time)>=trunc('${analyse_date}','MM')
and to_date(tnn.create_time)<='${analyse_date}'
and student_intention_id<>0
) as c
left join dw_hf_mobdb.dw_view_student s on s.student_intention_id=c.intention_id
group by c.department_name
-- 当月订单数
select d.department_name,
count(case when d.is_new=1 then d.contract_id end) as new_order,
count(case when d.is_new=0 then d.contract_id end) as oc_order
from(
select max(tcp.pay_date) max_date,
tc.contract_id,
tc.student_intention_id,
sum(tcp.`sum`/100) real_pay_amount,
max((tc.`sum`-666)*10) contract_amount,
tcp.submit_user_id,
max(case when to_date(s.create_time)>=trunc('${analyse_date}','MM') then 1 else 0 end) is_new,
cdme.department_name
from dw_hf_mobdb.dw_view_tms_contract_payment tcp
left join dw_hf_mobdb.dw_view_tms_contract tc on tc.contract_id=tcp.contract_id
left join dw_hf_mobdb.dw_view_student s on s.student_intention_id=tc.student_intention_id
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id=tcp.submit_user_id
and to_date(cdme.stats_date)='${analyse_date}' and cdme.class='CC'
and to_date(cdme.`date`)>=trunc('${analyse_date}','MM')
where tcp.pay_status in (2,4) and tc.status<>8
group by tc.contract_id, cdme.department_name, tc.student_intention_id, tcp.submit_user_id
having max(tcp.pay_date)>=trunc('${analyse_date}','MM')
and max(tcp.pay_date)<='${analyse_date}'
and round(sum(tcp.`sum`/100),0)>=round(max((tc.`sum`-666)*10),0)
) as d
group by d.department_name
-- 最近30天注册转化率
select f.department_name,
count(distinct f.contract_id)/count(distinct f.intention_id) as rc30_order_rate
from(
select tpel.intention_id, cdme.department_name, e.contract_id
from dw_hf_mobdb.dw_tms_pool_exchange_log tpel
left join dw_hf_mobdb.dw_view_student s on s.student_intention_id = tpel.intention_id
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id=tpel.track_userid
and to_date(cdme.stats_date)='${analyse_date}' and cdme.class='CC'
and to_date(cdme.`date`)>=trunc('${analyse_date}','MM')
left join (
select min(tcp.pay_date) min_date,
tc.contract_id,
tc.student_intention_id,
sum(tcp.`sum`/100) real_pay_amount,
max((tc.`sum`-666) * 10) contract_amount,
tcp.submit_user_id,
cdme.department_name
from hfjydb.view_tms_contract_payment tcp
left join hfjydb.view_tms_contract tc on tc.contract_id = tcp.contract_id
inner join bidata.charlie_dept_month_end cdme on cdme.user_id = tcp.submit_user_id
and to_date(cdme.stats_date)='${analyse_date}' and cdme.class = 'CC'
and to_date(cdme.`date`)>=date_sub('${analyse_date}',interval 30 day)
where tcp.pay_status in (2,4)
and tc.status<>8
group by tc.contract_id, cdme.department_name, tc.student_intention_id, tcp.submit_user_id,
having max(tcp.pay_date)>=date_sub('${analyse_date}',interval 30 day)
and max(tcp.pay_date)<='${analyse_date}'
and round(sum(tcp.`sum`/100),0)>=round(max((tc.`sum`-666) * 10),0)
) as e on e.student_intention_id=tpel.intention_id
and e.department_name=cdme.department_name
where to_date(s.create_time)>=date_sub('${analyse_date}',interval 30 day)
and to_date(s.create_time)<='${analyse_date}'
group by tpel.intention_id, cdme.department_name, e.contract_id
) as f
group by f.department_name
|
--
--Aufgabe 3
--
DROP TABLE IF EXISTS partnercand;
CREATE TABLE partnercand (
searcher integer,
cand integer
);
INSERT INTO partnercand (searcher, cand)
SELECT searcher, id
FROM dbuser, partner WHERE
id != searcher AND
(psex IS NULL OR sex = ANY(psex)) AND
(page_min IS NULL OR page_min <= EXTRACT(year FROM age(bday))) AND
(page_max IS NULL OR page_min >= EXTRACT(year FROM age(bday))) AND
(psize_min IS NULL OR psize_min <= size) AND
(psize_max IS NULL OR psize_max >= size) AND
(phcolor IS NULL OR hcolor = ANY(phcolor)) AND
(pecolor IS NULL OR ecolor = ANY(pecolor)) AND
(pbody IS NULL OR body = ANY(pbody));
--
--Aufgabe 4
--
DROP TABLE IF EXISTS pair;
CREATE TABLE pair (
p1 integer,
p2 integer
);
INSERT INTO pair (p1, p2)
SELECT t2.cand, t1.cand
FROM partnercand AS t1, partnercand AS t2 WHERE
t1.searcher = t2.cand AND
t2.searcher = t1.cand AND
t1.searcher < t2.searcher;
--
--Aufgabe 5
--
DROP TABLE IF EXISTS single;
CREATE TABLE single (
s integer
);
INSERT INTO single (s)
SELECT id
FROM dbuser EXCEPT
SELECT p1
FROM pair EXCEPT
SELECT p2
FROM pair;
|
UPDATE inland SET lt_dispatch_level = obs.named_lt_dispatch_level
FROM obs
WHERE obs.created_at = (SELECT MAX(created_at) FROM obs)
AND inland.cartodb_id = 1
|
INVALID TEST
-- SQLite doesn't support sequences
|
CLEAR SCREEN;
SET SERVEROUTPUT ON;
SET FEEDBACK ON;
DECLARE
rb RMAN_RULEBLOCKS%ROWTYPE;
BEGIN
-- BEGINNING OF RULEBLOCK --
rb.blockid:='rrt_tx';
DELETE FROM rman_ruleblocks WHERE blockid=rb.blockid;
rb.picoruleblock:='
/* Rule block to determine Tx metrics*/
#define_ruleblock([[rb_id]],
{
description: "Rule block to determine Tx metrics",
is_active:2,
filter: "SELECT eid FROM rout_rrt WHERE rrt=3"
}
);
#doc(,
{
txt : "Transplant graft status"
}
);
tx_dt => rout_rrt.tx_dt.val.bind();
cr_min => eadv.lab_bld_creatinine._.minfdv().where(dt > tx_dt);
cr_last => eadv.lab_bld_creatinine._.lastdv().where(dt > tx_dt);
rx_l04ad => eadv.rxnc_l04ad.dt.last().where(val=1);
rx_l04aa => eadv.rxnc_l04aa.dt.last().where(val=1);
rx_l04ax => eadv.rxnc_l04aa.dt.last().where(val=1);
rx_h02ab => eadv.rxnc_l04aa.dt.last().where(val=1);
rxn : { coalesce(rx_l04ad,rx_l04aa,rx_l04ax,rx_h02ab)!? => 1},{=>0};
tac_c0 => eadv.lab_bld_tdm_tacrolimus._.lastdv();
[[rb_id]] : { cr_min_val!? and rxn>0 =>1},{=>0};
#define_attribute(
[[rb_id]] ,
{
label:"Graft function known and therapy",
is_reportable:1,
type:2
}
);
';
rb.picoruleblock := replace(rb.picoruleblock,'[[rb_id]]',rb.blockid);
rb.picoruleblock:=rman_pckg.sanitise_clob(rb.picoruleblock);
INSERT INTO rman_ruleblocks(blockid,picoruleblock) VALUES(rb.blockid,rb.picoruleblock);
-- END OF RULEBLOCK --
END;
|
CREATE TABLE classes (classID INTEGER PRIMARY KEY, class_name varchar(100), class_dx varchar(200), numberOfLevels INT);
CREATE TABLE guestLevels (
rowID INTEGER PRIMARY KEY,
guestID INT,
classID INT,
current_level INT,
FOREIGN KEY(guestID) REFERENCES guests(guestID),
FOREIGN KEY(classID) REFERENCES classes(classID)
);
CREATE TABLE guestStatuses (
guest_statusID INTEGER PRIMARY KEY,
guestStatus_name varchar(100),
guestStatus_dx varchar(200)
);
CREATE TABLE guests (
guestID INTEGER PRIMARY KEY,
first_name varchar(100),
last_name varchar(100),
notes varchar(200),
birthday TEXT,
cakeday TEXT,
guest_statusID INT,
FOREIGN KEY(guest_statusID) REFERENCES guestStatuses(guest_statusID)
);
CREATE TABLE inventories (
inventoryID INTEGER PRIMARY KEY,
supplyID INT,
tavernID INT,
current_count INT,
date_updated TEXT,
FOREIGN KEY(tavernID) REFERENCES taverns(tavernID),
FOREIGN KEY(supplyID) REFERENCES supplies(supplyID)
);
CREATE TABLE locations (
locationID INTEGER PRIMARY KEY,
address varchar(250)
);
CREATE TABLE owners (
ownerID INTEGER PRIMARY KEY,
name Varchar(100),
tavernID INT,
FOREIGN KEY(tavernID) REFERENCES taverns(tavernID)
);
CREATE TABLE rats (
ratID INTEGER PRIMARY KEY,
name varchar(100),
tavernID INT,
FOREIGN KEY(tavernID) REFERENCES taverns(tavernID)
);
CREATE TABLE receivables (
receivableID INTEGER PRIMARY KEY,
orderID INT,
date_received text,
FOREIGN KEY(orderID) REFERENCES supplyOrders(orderID)
);
CREATE TABLE roles (
roleID INTEGER PRIMARY KEY,
name Varchar(100),
role_description varchar(250)
);
CREATE TABLE sales (
saleID INTEGER PRIMARY KEY,
tavernID INT,
serviceID INT,
guestID int,
quantity_sold int,
price int,
date_purchased TEXT,
FOREIGN KEY(tavernID) REFERENCES taverns(tavernID),
FOREIGN KEY(serviceID) REFERENCES services(serviceID),
FOREIGN KEY(guestID) REFERENCES guests(guestID)
);
CREATE TABLE serviceAvailabilities (
availabilityID INTEGER PRIMARY KEY,
serviceID INT,
tavernID INT,
serviceStatusID INT,
FOREIGN KEY(tavernID) REFERENCES taverns(tavernID),
FOREIGN KEY(serviceID) REFERENCES services(serviceID),
FOREIGN KEY(serviceStatusID) REFERENCES serviceStatus(serviceStatusID)
);
CREATE TABLE serviceStatuses (
serviceStatusID INTEGER PRIMARY KEY,
statusName varchar(100),
status_dx varchar(200)
);
CREATE TABLE services (
serviceID INTEGER PRIMARY KEY,
service_name varchar(100),
service_dx varchar(250)
);
CREATE TABLE supplies (
supplyID INTEGER PRIMARY KEY,
name varchar(100),
price_per_unit INT,
unit TEXT
);
CREATE TABLE supplyOrders (
orderID INTEGER PRIMARY KEY,
tavernID INT,
supplyID INT,
quantity_ordered INT,
cost INT,
order_date text,
FOREIGN KEY(tavernID) REFERENCES taverns(tavernID),
FOREIGN KEY(supplyID) REFERENCES supplies(supplyID)
);
CREATE TABLE taverns (
tavernID INTEGER PRIMARY KEY,
name varchar(100),
ownerID INT,
locationID INT,
numberOfFloors INT,
FOREIGN KEY(ownerID) REFERENCES owners(ownerID),
FOREIGN KEY(locationID) REFERENCES locations(locationID)
);
CREATE TABLE users (
userID INTEGER PRIMARY KEY,
name varchar(100),
tavernID INT,
roleID INT,
FOREIGN KEY(tavernID) REFERENCES taverns(tavernID),
FOREIGN KEY(roleID) REFERENCES roles(roleID)
);
--table data entries --
INSERT into classes(class_name, class_dx, numberOfLevels)
VALUES ('magician', 'guesses your card', 10), ('clown', 'juggles objects', 5),
('archer', 'mobilizes very large darts', 17), ('henchman', 'does dirty work', 30),
('philosopher', 'says simple things longwindedly', 3);
INSERT INTO guests(first_name, last_name, notes, birthday, cakeday, guest_statusID)
VALUES
('john', 'smith', 'none', '1800-02-15', '1995-02-28', 1),
('mark', 'brown', 'sings too loud', '1850-02-15', '1987-02-28', 2),
('joe', 'black', 'keep away from fire', '1800-02-15', '1995-02-28', 2),
('chris', 'cooper', 'none', '1850-02-15', '1987-02-28', 4),
('rachel', 'leigh', 'tips well', '1906-02-15', '2012-02-28', 5);
INSERT INTO guestLevels(guestID, classID, current_level)
VALUES (1, 2, 1), (1, 1, 4), (2, 1, 2), (3, 4, 5), (4, 1, 1);
INSERT INTO guestStatuses(guestStatus_name, guestStatus_dx)
VALUES
('sick', 'will need a bucket soon'), ('fine', 'could use another drink though'),
('hangry', 'hurry up with the food'), ('raging', 'keep sharp objects away'), ('placid', 'could use some free popcorn');
INSERT INTO inventories(supplyID, tavernID, current_count, date_updated)
VALUES (1, 1, 5, "2021-02-15"), (1, 2, 6, "2021-03-15"), (2, 2, 5, "2021-04-08"), (3, 4, 30, "2021-02-15"), (5, 5, 92, "2021-06-04");
INSERT into locations(address)
VALUES ('123 Smith St'), ('45 Brown Rd'), ('6b Cove Ln'), ('89 Birch Way'), ('32 Fjords Dr');
INSERT INTO owners(name, tavernID)
VALUES ('Hank', 1),
('John', 2),
('Kaley', 3),
('Rose', 4),
('Tyler', 5);
INSERT into rats(name, tavernID)
VALUES ('Snippy', 1),
('Snappy', 2), ('Snoppy', 3), ('Snuppy', 4),
('Cliff', 4), ('Stubert', 2);
INSERT into receivables(orderID, date_received)
VALUES
(1, "2021-09-01"), (2, "2021-09-01"), (3, "2021-04-23"), (4, "2021-04-23"), (5, "2021-08-13");
INSERT INTO roles(name, role_description)
VALUES ('owner', 'runs the joint'),
('sweeper', 'sweeps up'),
('barkeeper', 'pours drinks'),
('helper', 'does odds and ends'),
('assistant helper', 'does dirty jobs'),
('bouncer', 'gets rid of people');
INSERT INTO sales(tavernID, serviceID, guestID, quantity_sold, price, date_purchased)
VALUES
(1, 1, 1, 10, 100, "2021-02-23"), (2, 1, 2, 5, 50, "2021-03-15"), (3, 3, 3, 10, 50, "2021-02-23"), (3, 2, 4, 50, 700, "2021-08-13"),
(4, 5, 5, 1, 5, "2021-09-01");
INSERT INTO services(service_name, service_dx)
VALUES ('drinks', 'the providing of beverages'),
('food', 'the providing of eatables'),
('room', 'a bed to sleep on'),
('dessert', 'eatables of minimal nutritional value'),
('game', 'cards and such for playing');
INSERT INTO serviceAvailabilities(serviceID, tavernID, serviceStatusID)
VALUES (1, 1, 1), (2, 1, 2), (3, 2, 3),
(4, 3, 4), (5, 2, 5);
INSERT INTO serviceStatuses(statusName, status_dx)
VALUES ('available', 'get it while it is hot'), ('running low', 'hurry before it is gone'),
('limited', 'now you see it, now you do not'), ('out of stock', 'try again later'),
('discontinued', 'no longer offered');
INSERT INTO supplies(name, unit, price_per_unit)
VALUES ('beer', 'stein', 3.50),
('good beer', 'stein', 4.50),
('cheap beer', 'stein', 2.50),
('sandwich', 'plate', 20),
('stew', 'bowl', 15),
('cake', 'slice', 5);
INSERT INTO supplyOrders(tavernID, supplyID, quantity_ordered, cost, order_date)
VALUES
(1, 1, 10, 35, "2021-02-23"),
(2, 1, 20, 70, "2021-03-15"),
(2, 4, 50, 1000, "2021-02-23"),
(3, 4, 10, 200, "2021-03-15"),
(5, 6, 5, 25, "2021-06-01");
INSERT INTO taverns(name, ownerID, locationID, numberOffloors)
VALUES ('Mended Drum', 1, 1, 4), ('Repaired Bongos', 2, 2, 3), ('Restored Gong', 3, 3, 1), ('Improved Piano', 4, 4, 3),
('Overturned Bucket', 5, 5, 1);
INSERT into users(name, tavernID, roleID)
VALUES ('Hank', 1, 1),
('John', 2, 1),
('Kaley', 3, 1),
('Rose', 4, 1),
('Tyler', 5, 1),
('Hanna', 1, 2),
('Joe', 2, 3),
('Kyle', 3, 4),
('Rosalyn', 4, 4),
('Timber', 5, 6);
|
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50732
Source Host : 127.0.0.1:3306
Source Schema : blog
Target Server Type : MySQL
Target Server Version : 50732
File Encoding : 65001
Date: 07/04/2021 19:53:11
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for blog_article
-- ----------------------------
DROP TABLE IF EXISTS `blog_article`;
CREATE TABLE `blog_article` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '文章标题',
`desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '文章简述',
`cover_image_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '封面图片地址',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '文章内容',
`created_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '新建时间',
`created_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建人',
`modified_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '修改时间',
`modified_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '修改人',
`deleted_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '删除时间',
`is_del` tinyint(3) UNSIGNED NULL DEFAULT 0 COMMENT '是否删除 0为未删除、1为已删除',
`state` tinyint(3) UNSIGNED NULL DEFAULT 1 COMMENT '状态 0为禁用、1为启用',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章管理' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of blog_article
-- ----------------------------
-- ----------------------------
-- Table structure for blog_article_tag
-- ----------------------------
DROP TABLE IF EXISTS `blog_article_tag`;
CREATE TABLE `blog_article_tag` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`article_id` int(11) NOT NULL COMMENT '文章ID',
`tag_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '标签ID',
`created_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '创建时间',
`created_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建人',
`modified_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '修改时间',
`modified_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '修改人',
`deleted_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '删除时间',
`is_del` tinyint(3) UNSIGNED NULL DEFAULT 0 COMMENT '是否删除 0为未删除、1为已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章标签关联' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of blog_article_tag
-- ----------------------------
-- ----------------------------
-- Table structure for blog_auth
-- ----------------------------
DROP TABLE IF EXISTS `blog_auth`;
CREATE TABLE `blog_auth` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`app_key` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'Key',
`app_secret` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'Secret',
`created_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '新建时间',
`created_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建人',
`modified_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '修改时间',
`modified_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '修改人',
`deleted_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '删除时间',
`is_del` tinyint(3) UNSIGNED NULL DEFAULT 0 COMMENT '是否删除 0为未删除、1为已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '认证管理' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of blog_auth
-- ----------------------------
-- ----------------------------
-- Table structure for blog_tag
-- ----------------------------
DROP TABLE IF EXISTS `blog_tag`;
CREATE TABLE `blog_tag` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '标签名称',
`created_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '创建时间',
`created_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建人',
`modified_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '修改时间',
`modified_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '修改人',
`deleted_on` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '删除时间',
`is_del` tinyint(3) UNSIGNED NULL DEFAULT 0 COMMENT '是否删除 0为未删除、1为已删除',
`state` tinyint(3) UNSIGNED NULL DEFAULT 1 COMMENT '状态 0为禁用、1为启用',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签管理' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of blog_tag
-- ----------------------------
SET FOREIGN_KEY_CHECKS = 1;
|
-- Adminer 4.7.5 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `competition`;
CREATE TABLE `competition` (
`id_competition` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`id_family` int(11) NOT NULL,
`address` varchar(255) NOT NULL,
`city` varchar(255) NOT NULL,
PRIMARY KEY (`id_competition`),
KEY `id_family` (`id_family`),
CONSTRAINT `competition_ibfk_1` FOREIGN KEY (`id_family`) REFERENCES `family` (`id_family`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `competition` (`id_competition`, `name`, `id_family`, `address`, `city`) VALUES
(1, 'Athletics', 9, 'Stade de France', 'Saint-Denis'),
(2, 'Triathlon', 11, '5 Avenue Anatole France', 'Paris'),
(3, 'Climbing', 11, 'Place de la Concorde', 'Paris'),
(4, 'Weightlifting', 11, 'Le Zénith de Paris - La villette', 'Paris'),
(5, 'Horse riding', 10, 'Château de Versailles', 'Versailles'),
(6, 'Modern pentathlon', 11, 'Château de Versailles', 'Versailles'),
(7, 'Freestyle BMX', 8, 'Place de la Concorde', 'Paris'),
(8, 'BMX', 5, 'Vélodrome national de Saint-Quentin-En-Yvelines', 'Saint-Quentin-En-Yvelines'),
(9, 'Skateboard', 8, 'Place de la Concorde', 'Paris'),
(10, 'Breakdance', 8, 'Place de la Concorde', 'Paris'),
(11, 'Gymnastic', 8, 'Paris la Défense Arena', 'Nanterre'),
(12, 'VTT', 5, 'ColLine d\'Élancourt', 'Élancourt'),
(13, 'Road Cycling', 5, 'Avenue des Champs-Élysées', 'Paris'),
(14, 'Track cycling', 5, 'Vélodrome national de Saint-Quentin-En-Yvelines', 'Saint-Quentin-En-Yvelines'),
(15, 'Badminton', 4, 'Paris Arena II', 'Paris'),
(16, 'Table tennis', 5, 'Paris Expo Porte de Versailles', 'Paris'),
(17, 'Tennis', 5, 'Rolland-Garros', 'Paris'),
(18, 'Shooting', 6, 'Stand de tir du Bourget', 'Le Bourget'),
(19, 'Archery', 6, 'Esplanade des Invalides', 'Paris'),
(20, 'Open water swimming', 7, 'Pont d\'Iéna', 'Paris'),
(21, 'Swimming', 7, '361 avenue du Président Wilson', 'Saint-Denis'),
(22, 'Water-Polo', 7, '361 avenue du Président Wilson', 'Saint-Denis'),
(23, 'Plunge', 7, '361 avenue du Président Wilson', 'Saint-Denis'),
(24, 'Synchronized swimming', 7, '361 avenue du Président Wilson', 'Saint-Denis'),
(25, 'Handball', 1, 'Paris Expo Porte de Versailles', 'Paris'),
(26, 'Football', 1, 'Le Parc des Princes', 'Paris'),
(27, 'Filed hockey', 1, 'Stade Olympique Yves du Manoir', 'Colombes'),
(28, 'Basket-ball', 1, 'AccorHotels Arena', 'Paris'),
(29, 'Basket-ball 3X3', 1, 'Place de la Concorde', 'Paris'),
(30, 'Rugby sevens', 1, 'Stade Jean Bouin', 'Paris'),
(31, 'Beach volley', 1, 'Champs de Mars', 'Paris'),
(32, 'Volley-ball indoor', 1, 'Parc des Expositions Paris Le Bourget', 'Le Bourget'),
(33, 'Canoe Kayak', 3, 'Base nautique de Vaires-sur-Marne', 'Vaires-sur-Marne'),
(34, 'Rowing', 3, 'Base nautique de Vaires-sur-Marne', 'Vaires-sur-Marne'),
(35, 'Taekwondo', 2, 'Grand Palais', 'Paris'),
(36, 'Boxing', 2, 'Rolland-Garros', 'Paris'),
(37, 'Fencing', 2, 'Grand Palais', 'Paris'),
(38, 'Wrestling', 2, 'Grand Palais', 'Paris'),
(39, 'Judo', 2, 'Grand Palais', 'Paris');
DROP TABLE IF EXISTS `family`;
CREATE TABLE `family` (
`id_family` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id_family`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `family` (`id_family`, `name`) VALUES
(1, 'Teams sports'),
(2, 'Martial Arts'),
(3, 'Sailing'),
(4, 'Racket sports'),
(5, 'Cycling'),
(6, 'Shooting sports'),
(7, 'Water sports'),
(8, 'Artistic sports - Freestyle'),
(9, 'Athletics'),
(10, 'Nature sports'),
(11, 'Others');
DROP TABLE IF EXISTS `travel`;
CREATE TABLE `travel` (
`area` int(2) NOT NULL,
`time` int(2) NOT NULL,
`correspondence` int(2) NOT NULL,
`id_competition` int(11) NOT NULL,
KEY `id_competition` (`id_competition`),
CONSTRAINT `travel_ibfk_1` FOREIGN KEY (`id_competition`) REFERENCES `competition` (`id_competition`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- 2020-01-21 18:35:57
|
PARAMETERS [@FichaID] Text (255);
SELECT A.FichaID,
A.Item,
A.ProveedorID,
B.Llave,
B.TipoDocumento,
B.RUC,
B.RazonSocial,
B.NombreComercial,
A.ProductoID,
D.NombreComercial,
D.IngredienteActivo,
E.Unidad,
E.Unidad AS UnidadDoc,
format(A.Cantidad,"#,##0.000;(#,##0.000)") AS Cantidad,
A.Observacion,
A.DocumentoID,
iif(A.DocumentoItem=0,NULL,A.DocumentoItem) AS DocumentoItem,
H.ComprobanteID,
J.ComprobanteNombre,
H.Serie,
H.Numero,
L.MonedaSimbolo+format(iif(isnull(F.PrecioUnitario),0,F.PrecioUnitario),"0.00") AS PrecioUnitario,
format(F.Cantidad,"#,##0.000;(#,##0.000)") AS CantidadTotal,
Format(F.Cantidad-iif(isnull(K.Asignado),0,K.Asignado),"#,##0.000;(#,##0.000)") AS Saldo,
A.TipoID,
I.Tipo,
cdate(format(H.FechaEmisionID,"####-##-##")) AS FechaCompra,
A.Orden
FROM (((((((((TB_IngresoInventarioDetalle AS A
LEFT JOIN K_Proveedor AS B ON A.ProveedorID=B.ProveedorID)
LEFT JOIN TB_Producto AS D ON A.ProductoID=d.ProductoID)
LEFT JOIN TB_Unidades AS E ON D.UnidadID=E.UnidadID)
LEFT JOIN TB_IngresoInventario AS G ON A.FichaID=G.FichaID)
LEFT JOIN TB_CompraDetalle AS F ON (A.DocumentoID=F.DocumentoID)
AND (A.DocumentoItem=F.Item))
LEFT JOIN TB_Compra AS H ON A.DocumentoID=H.DocumentoID)
LEFT JOIN TB_IngresoInventarioTipo AS I ON A.TipoID=I.TipoID)
LEFT JOIN TB_ComprobanteCompra AS J ON H.ComprobanteID=J.ComprobanteID)
LEFT JOIN TB_Moneda AS L ON H.MonedaID=L.MonedaID)
LEFT JOIN
(SELECT A.DocumentoID,
A.DocumentoItem,
SUM(Cantidad) AS Asignado
FROM TB_IngresoInventarioDetalle A
GROUP BY A.DocumentoID,
A.DocumentoItem) AS K ON (A.DocumentoID=K.DocumentoID)
AND (A.DocumentoItem=K.DocumentoItem)
WHERE A.FichaID=[@FichaID] OR [@FichaID] IS NULL
ORDER BY A.FichaID,
A.Item
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 21 Apr 2018 pada 19.34
-- Versi Server: 10.1.30-MariaDB
-- PHP Version: 7.2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `pw_173040125`
--
CREATE DATABASE IF NOT EXISTS `pw_173040125` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `pw_173040125`;
-- --------------------------------------------------------
--
-- Struktur dari tabel `perusahaan_teknologi`
--
DROP TABLE IF EXISTS `perusahaan_teknologi`;
CREATE TABLE IF NOT EXISTS `perusahaan_teknologi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`NamaPerusahaan` varchar(256) NOT NULL,
`PendiriPerusahaan` varchar(256) NOT NULL,
`TahunBerdiri` year(4) NOT NULL,
`KantorPusat` varchar(256) NOT NULL,
`Produk` text NOT NULL,
`Gambar` varchar(256) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `perusahaan_teknologi`
--
INSERT INTO `perusahaan_teknologi` (`id`, `NamaPerusahaan`, `PendiriPerusahaan`, `TahunBerdiri`, `KantorPusat`, `Produk`, `Gambar`) VALUES
(1, 'Amazon', 'Jeff Bezos', 1994, 'Seattle, Washington, Amerika Serikat', 'A2Z Development, A9.com, Alexa Internet, Amazon.com, Amazon Kindle, Amazon Studios,Amazon Web Services, \r\nAudible.com, dpreview.com, Endless.com, IMDb, LoveFilm,Zappos.com, Woot, Junglee.com .', 'amazon.jpg'),
(2, 'Apple Inc', 'Steve Jobs,Steve Wozniak,Ronald Wayne', 1977, 'Silicon Valley, Cupertino, California, Amerika ', 'Mac, iPod, iPhone, iPad, iPad Mini, Apple TV, OS X, iLife, iWork, iOS, Apple Watch,Watch OS .', 'apple.jpg'),
(3, 'Google', 'Sundar Pichai (CEO)', 1998, 'Mountain View, California, Amerika serikat', 'teknologi pencarian, komputasi web, perangkat lunak, dan periklanan daring.', 'google.jpg'),
(4, 'Facebook', 'Mark Zuckerberg, Eduardo Saverin, Andrew McCollum, Dustin Moskovitz, Chris Hughes', 2004, 'Menlo Park, California, Amerika Serikat', 'Layanan jejaring sosial ', 'fb.jpg'),
(5, 'Microsoft', 'Bill Gates, Paul Allen .', 1975, 'Redmond, Washington, Amerika Serikat', 'Windows & Windows Live Division, Server and Tools, Online Services Division, Microsoft Business Division, Entertainment and Devices Division. \r\n', 'microsoft.jpg'),
(6, 'Verizon', 'Lowell McAdam', 1983, 'New York City, Amerika Serikat', 'telekomunikasi', 'verizon.jpg'),
(7, 'Walmart', 'Sam Walton', 1962, 'Bentonville, Arkansas, Amerika serikat', 'Perlengkapan, cash & carry/klub gudang, toko serba ada diskon, toko diskon, \r\nhipermarket/supercenter/supertoko, supermarket. \r\n\r\n', 'walmart.jpg'),
(8, 'ICBC', 'Jiang Jianqing(Ketua dan Direktur Eksekutif', 1984, 'Beijing, Republik Rakyat Tiongkok', 'Keuangan dan Asuransi, Perbankan Konsumen,Perbankan Perusahaan, Bank investasi, Manajemen investasi, Manajemen Kekayaan Global, Ekuitas swasta, Hipotek, Kartu kredit. \r\n ', 'icbc.jpg'),
(9, 'At&t', 'Randall L. Stephenson (Chairman, Presiden dan ceo', 1983, 'Dallas, Texas, Amerika Serikat', 'telekomunikasi', 'at&t.jpg'),
(10, 'Samsung', 'Lee Kun-hee (Ketua dan CEO),Lee Soo-bin (Presiden, CEO dari Samsung \r\nLifeInsurance)', 1938, 'Samsung Town, Seoul, Korea Selatan', 'Pakaian, otomotif, bahan kimia,\r\nelektronik konsumen, komponen elektronik, peralatan medis,instrumen presisi, semikonduktor,solid-state \r\ndrive, DRAM, kapal, peralatan telekomunikasi dan peralatan rumah tangga \r\n \r\n\r\n', 'Samsung.jpg');
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 */;
|
UPDATE ft_table SET creation_date=DATE_ADD(creation_date, INTERVAL 20 YEAR) WHERE id > 5;
|
CREATE DATABASE IF NOT EXISTS `frameworks` CHARACTER SET 'utf8';
USE frameworks;
|
--use [template_db]
--go
/* Сгенерировано из шаблона
Developer : Перепечко А.В.
Created : 25.10.2016
Purpose : Документы, удостоверения личности
Change list:
09.03.2017 Перепечко А.В. Замена dbo.dicts на dbo.dict_enums
21.05.2017 Перепечко А.В. Приводим к единому виду обязательных атрибутов (id, descr, comm, cu, cd, ct, cu_id)
21.05.2017 Перепечко А.В. Переносим на pg
*/
--if OBJECT_ID( 'dbo.[id_documents]', 'U') is NOT NULL
-- drop table dbo.[id_documents];
drop table fos.id_documents cascade;
/*
Атрибуты:
id - Уникальный идентификатор экземпляра
-- Ссылки
kind_id - Ссылка на вид документа удостоверения личности (простой справочник id_document_kinds)
contragent_id - Ссылка на контрагента
-- Атрибуты
doc_serie - Серия документа
doc_number - Номер документа
doc_date - Когда выдан
valid_from_date - Дата начала валидности документа
valid_till_date - Дата окончания валидности документа
doc_department - Кем выдан
doc_department_code - Код подразделения
-- Не обязательные, но тоже есть у всех
description - Описание
comments - Коменты
-- Системные
change_user - Пользователь
chnage_date - Дата последнего изменения
change_term - Терминал
change_user_id - Ссылка на юзверя
*/
create table fos.id_documents
(
id bigint NOT NULL,
-- Ссылки
kind_id bigint NOT NULL,
contragent_id bigint NOT NULL,
-- Атрибуты
doc_serie varchar(50) NULL,
doc_number varchar(100) NULL,
doc_date timestamp NULL,
valid_from_date timestamp NULL,
valid_till_date timestamp NULL,
doc_department varchar(100) NULL,
doc_department_code varchar(50) NULL,
primary_flag int NOT NULL constraint id_documents_df_pf default 0,
-- description and comments
description varchar(500) NULL,
comments varchar(1000) NULL,
-- system info
change_user varchar(256) NOT NULL default session_user,
change_date timestamp NOT NULL default current_timestamp,
change_term varchar(256) NOT NULL default inet_client_addr(),
change_user_id bigint NULL,
-- constraints ---------------------------------------------
constraint id_documents_pk primary key ( id),
-- Ссылки
constraint id_documents_fk_kind foreign key( kind_id) references fos.dict_enum_items( id),
constraint id_documents_fk_contragent foreign key( contragent_id) references fos.contragents( id),
constraint id_documents_fk_cu_id foreign key( change_user_id) references fos.sys_users( id),
-- Уникальность
constraint id_documents_uk unique( kind_id, doc_serie, doc_number)
)
;
grant select on fos.id_documents to public;
grant select on fos.id_documents to fos_public;
comment on table fos.id_documents is 'Удостоверения личности контрагента';
comment on column fos.id_documents.id is 'Никальный идентификатор экземпляра';
comment on column fos.id_documents.kind_id is 'Ссылка на вид документа, справочник fos.dict_enum_items';
comment on column fos.id_documents.contragent_id is 'Ссылка на контрагента';
comment on column fos.id_documents.doc_serie is 'Серия';
comment on column fos.id_documents.doc_number is 'Номер';
comment on column fos.id_documents.doc_date is 'Дата';
comment on column fos.id_documents.valid_from_date is 'Годен с даты';
comment on column fos.id_documents.valid_till_date is 'Годен до даты';
comment on column fos.id_documents.doc_department is 'Кем выдан';
comment on column fos.id_documents.doc_department_code is 'Код подразделения';
comment on column fos.id_documents.primary_flag is 'Признак основного документа: 0 (default) - нет, 1 - да';
comment on column fos.id_documents.description is 'Описание';
comment on column fos.id_documents.comments is 'Коментарии';
comment on column fos.id_documents.change_user is 'Крайний изменивший';
comment on column fos.id_documents.change_date is 'Крайняя дата изменений';
comment on column fos.id_documents.change_term is 'Терминал';
comment on column fos.id_documents.change_user_id is 'Пользователь';
/*
-- Проверка
select
*
from
dbo.[table_name]
;
-- SQL запросы
select
error_code,
error_message
from
dbo.sys_errors with (NoLock)
order by
error_code desc
;
select
*
from
dbo.sys_settings with (NoLock)
select
*
from
dbo.v_dicts
order by
1,
4
*/
|
CREATE OR REPLACE VIEW GW_MIGRA_NETAQUA.ANL_MINCUT_CAT_CAUSE AS
SELECT 1 AS "id",
'Fortu´ta' AS descript
FROM DUAL
UNION
SELECT 2, 'Programada' FROM DUAL
UNION
SELECT 3, 'Provocada' FROM DUAL;
CREATE OR REPLACE VIEW GW_MIGRA_NETAQUA.ANL_MINCUT_CAT_CLASS AS
SELECT 1 AS "id",
'Tancament de Xarxa' AS "name",
null AS descript
FROM DUAL
UNION
SELECT 2, 'Tancament d''Escomesa', NULL FROM DUAL
UNION
SELECT 3, 'Tancament d''Abonat', NULL FROM DUAL;
CREATE OR REPLACE VIEW GW_MIGRA_NETAQUA.ANL_MINCUT_CAT_STATE AS
SELECT 0 AS "id",
'Planificat' AS "name",
null AS descript
FROM DUAL
UNION
SELECT 1, 'Actiu', NULL FROM DUAL
UNION
SELECT 2, 'Finalitzat', NULL FROM DUAL;
CREATE OR REPLACE VIEW GW_MIGRA_NETAQUA.ANL_MINCUT_CAT_TYPE AS
SELECT CODI AS "id",
CASE TANC_REAL
WHEN 'S' THEN 'false'
ELSE 'true'
END AS virtual,
TIPUS_TANCAMENT AS descript
FROM NA_MATARO.CAT_T_TIPUS_TANCAMENT
ORDER BY CODI;
CREATE OR REPLACE VIEW GW_MIGRA_NETAQUA.ANL_MINCUT_SELECTOR_VALVE AS
SELECT 'VALVULA' AS "id"
FROM DUAL;
|
--
-- Script was generated by Devart dbForge Studio 2020 for MySQL, Version 9.0.791.0
-- Product home page: http://www.devart.com/dbforge/mysql/studio
-- Script date 28/11/2022 23:00:35
-- Server version: 10.2.36
-- Client version: 4.1
--
SET NAMES 'utf8';
|
CREATE DATABASE relaxprice;
CREATE USER relax WITH SUPERUSER PASSWORD '9^<veu^Y[+';
GRANT ALL PRIVILEGES ON DATABASE relaxprice TO relax;
|
/*
Programming for Data Science with Python Nanodegree
Udacity's certified program
SQL practice > Lesson 1 : SQL Basics
Use the 'web_events' table to find all information regarding individuals who
were contacted via any method except using 'organic' or 'adwords' methods.
Hint: 'organic' or 'adwords' are listed under 'channel' column
*/
SELECT *
FROM web_events
WHERE channel NOT IN ('organic', 'adwords');
|
-- MySQL dump 10.13 Distrib 8.0.17, for Win64 (x86_64)
--
-- Host: localhost Database: dttodo
-- ------------------------------------------------------
-- Server version 8.0.17
/*!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 */;
/*!50503 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 `notes`
--
DROP TABLE IF EXISTS `notes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `notes` (
`noteID` int(11) NOT NULL AUTO_INCREMENT,
`userID` int(11) NOT NULL,
`categoryID` int(11) DEFAULT NULL,
`title` longtext NOT NULL,
`description` longtext,
`stateID` int(11) DEFAULT NULL,
`isMyDay` tinyint(4) DEFAULT NULL,
`isImportance` tinyint(4) DEFAULT NULL,
`createDate` datetime DEFAULT CURRENT_TIMESTAMP,
`dueDate` datetime DEFAULT NULL,
PRIMARY KEY (`noteID`),
KEY `userID_idx` (`userID`),
KEY `categoryID_idx` (`categoryID`),
KEY `stateID_note_idx` (`stateID`),
CONSTRAINT `categoryID` FOREIGN KEY (`categoryID`) REFERENCES `categories` (`CategoryID`) ON DELETE CASCADE,
CONSTRAINT `stateID_note` FOREIGN KEY (`stateID`) REFERENCES `state` (`stateID`),
CONSTRAINT `userID` FOREIGN KEY (`userID`) REFERENCES `user` (`UserID`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13029 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `notes`
--
LOCK TABLES `notes` WRITE;
/*!40000 ALTER TABLE `notes` DISABLE KEYS */;
INSERT INTO `notes` VALUES (13020,11001,11025,'ehehe','',12002,0,1,'2020-01-03 00:00:00',NULL),(13021,11001,11025,'abc','',12001,0,1,'2020-01-03 00:00:00',NULL);
/*!40000 ALTER TABLE `notes` 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 2020-01-03 17:01:31
|
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';
CREATE SCHEMA IF NOT EXISTS `internetbanking` DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ;
USE `internetbanking` ;
-- -----------------------------------------------------
-- Table `internetbanking`.`bank`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`bank` (
`code` INT NOT NULL ,
`name` VARCHAR(255) NOT NULL ,
PRIMARY KEY (`code`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`currency`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`currency` (
`code` VARCHAR(3) NOT NULL ,
`name` VARCHAR(250) NOT NULL ,
`decimalDigits` INT NOT NULL ,
PRIMARY KEY (`code`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`customer`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`customer` (
`id` INT NOT NULL ,
`firstName` VARCHAR(250) NOT NULL ,
`lastName` VARCHAR(250) NOT NULL ,
`email` VARCHAR(500) NOT NULL ,
`valid` VARCHAR(1) NOT NULL DEFAULT 'Y' ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`currencyrate`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`currencyrate` (
`code` VARCHAR(3) NOT NULL ,
`rate` DECIMAL(5,2) NOT NULL ,
INDEX `fk_CurrencyRate_Currency1` (`code` ASC) ,
PRIMARY KEY (`code`) ,
CONSTRAINT `fk_CurrencyRate_Currency1`
FOREIGN KEY (`code` )
REFERENCES `internetbanking`.`currency` (`code` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`account`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`account` (
`id` INT NOT NULL ,
`accountNumber` VARCHAR(250) NOT NULL ,
`code` VARCHAR(3) NOT NULL ,
`balance` DECIMAL(20,2) NOT NULL ,
`valid` VARCHAR(1) NOT NULL DEFAULT 'Y' ,
`lowestDailyBalance` DECIMAL(20,2) NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_Account_Currency` (`code` ASC) ,
CONSTRAINT `fk_Account_Currency`
FOREIGN KEY (`code` )
REFERENCES `internetbanking`.`currency` (`code` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`customeraccount`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`customeraccount` (
`idAccount` INT NOT NULL ,
`idCustomer` INT NOT NULL ,
INDEX `fk_CustomerAccount_Account1` (`idAccount` ASC) ,
INDEX `fk_CustomerAccount_Customer1` (`idCustomer` ASC) ,
CONSTRAINT `fk_CustomerAccount_Account1`
FOREIGN KEY (`idAccount` )
REFERENCES `internetbanking`.`account` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_CustomerAccount_Customer1`
FOREIGN KEY (`idCustomer` )
REFERENCES `internetbanking`.`customer` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`banktransaction`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`banktransaction` (
`id` INT NOT NULL ,
`accountFrom` VARCHAR(250) NOT NULL ,
`bankFrom` INT NOT NULL ,
`idAccountFrom` INT NULL ,
`accountTo` VARCHAR(250) NOT NULL ,
`bankTo` INT NOT NULL ,
`idAccountTo` INT NULL ,
`amountFrom` DECIMAL(20,2) NOT NULL ,
`currencyFrom` VARCHAR(3) NOT NULL ,
`amountTo` DECIMAL(20,2) NOT NULL ,
`currencyTo` VARCHAR(3) NOT NULL ,
`description` VARCHAR(250) NOT NULL ,
`creationTime` DATETIME NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_BankTransaction_Bank1` (`bankFrom` ASC) ,
INDEX `fk_BankTransaction_Bank2` (`bankTo` ASC) ,
INDEX `fk_BankTransaction_Currency1` (`currencyFrom` ASC) ,
INDEX `fk_BankTransaction_Currency2` (`currencyTo` ASC) ,
INDEX `fk_BankTransaction_Account1` (`idAccountFrom` ASC) ,
INDEX `fk_BankTransaction_Account2` (`idAccountTo` ASC) ,
CONSTRAINT `fk_BankTransaction_Bank1`
FOREIGN KEY (`bankFrom` )
REFERENCES `internetbanking`.`bank` (`code` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_BankTransaction_Bank2`
FOREIGN KEY (`bankTo` )
REFERENCES `internetbanking`.`bank` (`code` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_BankTransaction_Currency1`
FOREIGN KEY (`currencyFrom` )
REFERENCES `internetbanking`.`currency` (`code` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_BankTransaction_Currency2`
FOREIGN KEY (`currencyTo` )
REFERENCES `internetbanking`.`currency` (`code` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_BankTransaction_Account1`
FOREIGN KEY (`idAccountFrom` )
REFERENCES `internetbanking`.`account` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_BankTransaction_Account2`
FOREIGN KEY (`idAccountTo` )
REFERENCES `internetbanking`.`account` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`currentcurrencyrate`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`currentcurrencyrate` (
`code` VARCHAR(3) NOT NULL ,
`rate` DECIMAL(5,2) NOT NULL ,
PRIMARY KEY (`code`) ,
CONSTRAINT `fk_CurrentCurrencyRate_CurrencyRate1`
FOREIGN KEY (`code` )
REFERENCES `internetbanking`.`currencyrate` (`code` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`idtable`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`idtable` (
`name` VARCHAR(50) NOT NULL ,
`val` INT NOT NULL ,
PRIMARY KEY (`name`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`autentizationgroup`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`autentizationgroup` (
`groupName` VARCHAR(20) NOT NULL ,
PRIMARY KEY (`groupName`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`autentization`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`autentization` (
`login` VARCHAR(45) NOT NULL ,
`password` VARCHAR(45) NOT NULL ,
`groupName` VARCHAR(20) NOT NULL ,
`idCustomer` INT NULL ,
PRIMARY KEY (`login`) ,
INDEX `fk_autentization_customer1` (`idCustomer` ASC) ,
INDEX `fk_autentization_autentizationgroup1` (`groupName` ASC) ,
UNIQUE INDEX `login_UNIQUE` (`login` ASC) ,
CONSTRAINT `fk_autentization_customer1`
FOREIGN KEY (`idCustomer` )
REFERENCES `internetbanking`.`customer` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_autentization_autentizationgroup1`
FOREIGN KEY (`groupName` )
REFERENCES `internetbanking`.`autentizationgroup` (`groupName` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `internetbanking`.`globalparam`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `internetbanking`.`globalparam` (
`code` VARCHAR(20) NOT NULL ,
`value` VARCHAR(255) NOT NULL ,
`dataType` VARCHAR(1) NOT NULL ,
PRIMARY KEY (`code`) )
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-- -----------------------------------------------------
-- Data for table `internetbanking`.`bank`
-- -----------------------------------------------------
SET AUTOCOMMIT=0;
USE `internetbanking`;
INSERT INTO `internetbanking`.`bank` (`code`, `name`) VALUES (666, 'OndrepeBank');
COMMIT;
-- -----------------------------------------------------
-- Data for table `internetbanking`.`idtable`
-- -----------------------------------------------------
SET AUTOCOMMIT=0;
USE `internetbanking`;
INSERT INTO `internetbanking`.`idtable` (`name`, `val`) VALUES ('account', 10000);
INSERT INTO `internetbanking`.`idtable` (`name`, `val`) VALUES ('transaction', 10000);
INSERT INTO `internetbanking`.`idtable` (`name`, `val`) VALUES ('customer', 10000);
COMMIT;
-- -----------------------------------------------------
-- Data for table `internetbanking`.`autentizationgroup`
-- -----------------------------------------------------
SET AUTOCOMMIT=0;
USE `internetbanking`;
INSERT INTO `internetbanking`.`autentizationgroup` (`groupName`) VALUES ('MANAGER');
INSERT INTO `internetbanking`.`autentizationgroup` (`groupName`) VALUES ('CUSTOMER');
COMMIT;
-- -----------------------------------------------------
-- Data for table `internetbanking`.`autentization`
-- -----------------------------------------------------
SET AUTOCOMMIT=0;
USE `internetbanking`;
INSERT INTO `internetbanking`.`autentization` (`login`, `password`, `groupName`, `idCustomer`) VALUES ('karel', '2cd324f30dc548396570da4e637c53ee', 'MANAGER', NULL);
COMMIT;
-- -----------------------------------------------------
-- Data for table `internetbanking`.`globalparam`
-- -----------------------------------------------------
SET AUTOCOMMIT=0;
USE `internetbanking`;
INSERT INTO `internetbanking`.`globalparam` (`code`, `value`, `dataType`) VALUES ('MYBANKCODE', '666', 'N');
INSERT INTO `internetbanking`.`globalparam` (`code`, `value`, `dataType`) VALUES ('CB_ENDPOINT', 'http://localhost:8080/central-bank-ws/', 'C');
INSERT INTO `internetbanking`.`globalparam` (`code`, `value`, `dataType`) VALUES ('EO_ENDPOINT', 'http://localhost:8080/ExchangeOffice/exchangerate/', 'C');
COMMIT;
|
INSERT INTO asesoria
(asesor, hora_inicio, hora_fin, fecha_asesoria, duracion)
VALUES(:asesor, :horaInicio, :horaFin, :fechaAsesoria, :duracion);
|
CREATE TABLE in_tmprefe(
tmprefe_tmprefe SERIAL,
tmprefe_codexte VARCHAR(500) NOT NULL,
tmprefe_ubicaci VARCHAR(500) NOT NULL,
tmprefe_descrip VARCHAR(2000) NOT NULL,
tmprefe_categor VARCHAR(500),
tmprefe_subcate VARCHAR(500),
tmprefe_tipo VARCHAR(100) NOT NULL,
tmprefe_existencia INT NOT NULL,
tmprefe_costo NUMERIC(15,5),
tmprefe_fecha TIMESTAMP,
tmprefe_usu INT,
PRIMARY KEY(tmprefe_tmprefe)
);
|
CREATE OR REPLACE DIRECTORY etf AS 'C:\GIT\STOCKAN\YAHOO_data\ETF';
GRANT EXECUTE, READ, WRITE ON DIRECTORY etf TO stockan WITH GRANT OPTION;
|
INSERT INTO Vendedor (id, nome) VALUES ('1', 'Vendedor 1');
INSERT INTO Vendedor (id, nome) VALUES ('2', 'Vendedor 2');
INSERT INTO Vendedor (id, nome) VALUES ('3', 'Vendedor 3');
INSERT INTO Vendedor (id, nome) VALUES ('4', 'Vendedor 4');
|
FETCH_PONTO {
SELECT pr.idPontoRef, pr.nome, pr.descricao, gps.latitude, gps.longitude , gps.altitude, p.nomePais, ROUND(AVG(a.estrelas)) AS ava
FROM ((PontoReferencia pr LEFT JOIN CoordenadasGPS gps ON pr.idCoordenadasGPS = gps.idCoordenadasGPS) LEFT JOIN pais p ON
p.idPais = pr.idPais) LEFT JOIN Avaliacao a ON a.idPontoRef = pr.idPontoRef
WHERE pr.idPontoRef = ? and pr.privadoPontoRef = 0
}
LIST_PONTOS {
SELECT pr.idPontoRef, pr.nome, pr.descricao, gps.latitude, gps.longitude , gps.altitude, p.nomePais, ROUND(AVG(a.estrelas)) AS ava
FROM ((PontoReferencia pr LEFT JOIN CoordenadasGPS gps ON pr.idCoordenadasGPS = gps.idCoordenadasGPS) LEFT JOIN pais p ON
p.idPais = pr.idPais) LEFT JOIN Avaliacao a ON a.idPontoRef = pr.idPontoRef
WHERE pr.privadoPontoRef = 0
GROUP BY pr.idPontoRef
ORDER BY AVG(a.estrelas) DESC, COUNT(a.idPontoRef) DESC
}
LIST_EVENTOS_PONTO {
SELECT e.idEvento, e.nome, e.descricao, e.link, e.imagem, gps.latitude, gps.longitude, ti.descricao, e.idUser,
e.dataInicio, e.dataFim
FROM (((PontoReferencia pr LEFT JOIN PontoReferencia_Evento pre ON pr.idPontoRef = pre.idPontoRef) LEFT JOIN Evento e ON
e.idEvento = pre.idEvento) LEFT JOIN TipoInteresse ti ON ti.idTipoInteresse = e.idTipoInteresse) LEFT JOIN CoordenadasGPS gps
ON gps.idCoordenadasGPS = e.idCoordenadasGPS
WHERE pr.idPontoRef = ? and pr.privadoPontoRef = 0
}
LIST_VISITAS_PONTO {
SELECT v.idVisita, v.nome, v.descricao, v.link, v.imagem, gps.latitude, gps.longitude, ti.descricao, v.idUser
FROM (((PontoReferencia pr LEFT JOIN PontoReferencia_Visita prv ON pr.idPontoRef = prv.idPontoRef) LEFT JOIN Visita v ON
v.idVisita = prv.idVisita) LEFT JOIN TipoInteresse ti ON ti.idTipoInteresse = v.idTipoInteresse) LEFT JOIN CoordenadasGPS gps
ON gps.idCoordenadasGPS = v.idCoordenadasGPS
WHERE pr.idPontoRef = ? and pr.privadoPontoRef = 0
}
LIST_COMMENTS_PONTO {
SELECT a.idAvaliacao, a.estrelas, a.comentario, a.data, u.name, a.idPontoRef
FROM (Avaliacao a LEFT JOIN Users u ON u.idUser = a.idUser) LEFT JOIN pontoreferencia pr ON pr.idPontoRef = a.idPontoRef
WHERE pr.idPontoRef = ?
ORDER BY a.data DESC LIMIT 10
}
|
CREATE TABLE `appointment` (
`DID` int(11) NOT NULL,
`maxpatients` int(11) DEFAULT NULL,
`currentpatients` int(11) DEFAULT NULL,
`timestart` varchar(20) DEFAULT NULL,
`timestop` varchar(20) DEFAULT NULL,
`name` varchar(10) DEFAULT NULL,
PRIMARY KEY (`DID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `article` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) DEFAULT NULL,
`DID` int(11) DEFAULT NULL,
`platform` varchar(20) DEFAULT NULL,
`release_time` date DEFAULT NULL,
`intro` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `disease` (
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`distinguish` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`reason` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`symptom` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`heal` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`alias` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
CREATE TABLE `doctor` (
`DID` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`faculty` varchar(255) DEFAULT NULL,
`profession` varchar(255) DEFAULT NULL,
`political` varchar(255) DEFAULT NULL,
`expertise` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`HID` int(11) DEFAULT NULL,
`status` varchar(255) DEFAULT NULL,
`password` varchar(255) NOT NULL,
`phone_number` varchar(255) DEFAULT NULL,
`id_number` varchar(255) DEFAULT NULL,
`sex` varchar(255) DEFAULT NULL,
PRIMARY KEY (`DID`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `forum` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`topic` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`author` varchar(40) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
`replynum` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `hospital` (
`HID` int(11) NOT NULL,
`hos_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`province` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`introduction` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`classifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`HID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
CREATE TABLE `reply` (
`topic` varchar(60) DEFAULT NULL,
`sender` varchar(20) DEFAULT NULL,
`sendtime` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`content` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`sex` varchar(255) DEFAULT NULL,
`phone_number` bigint(20) DEFAULT NULL,
`id_number` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
--
-- Script de creation des tables
-- Auteurs
-- Code permanent: GARS13069209, LACF18048601
-- Code permanent: PHAC02579100, AMIS25119000
--
--
SET ECHO ON;
ALTER SESSION SET NLS_TIMESTAMP_FORMAT='yyyy.mm.dd';
SET SERVEROUTPUT ON SIZE UNLIMITED;
SPOOL resultats/create.res;
CREATE TABLE Utilisateur
(
idUtilisateur INTEGER NOT NULL PRIMARY KEY,
motPass VARCHAR(20) NOT NULL,
nom VARCHAR(200) NOT NULL,
prenom VARCHAR(200) NOT NULL
);
CREATE TABLE Employe
(
idEmploye INTEGER PRIMARY KEY REFERENCES Utilisateur(idUtilisateur) ON DELETE CASCADE,
codeMatricule VARCHAR(20) NOT NULL UNIQUE,
categorie VARCHAR2(40) CHECK( categorie IN ('bibliothecaire', 'employe', 'responsable des adherents', 'responsable des oeuvres') )
);
CREATE TABLE Adherent
(
idAdherent INTEGER PRIMARY KEY REFERENCES Utilisateur(idUtilisateur) ON DELETE CASCADE,
numero INTEGER NOT NULL,
adresse VARCHAR(200) NOT NULL,
telephone VARCHAR(12) NOT NULL,
nbMaxPrets INTEGER DEFAULT 3,
dureeMaxPrets INTEGER DEFAULT 4
);
CREATE TABLE Oeuvre
(
idOeuvre INTEGER NOT NULL PRIMARY KEY,
titre VARCHAR(200) NOT NULL
);
CREATE TABLE Emplacement
(
idEmplacement Integer NOT NULL PRIMARY KEY,
travee Varchar(40) NOT NULL,
etagere Varchar(40) NOT NULL,
rayon Varchar(40) NOT NULL
);
CREATE TABLE Exemplaire
(
idExemplaire INTEGER NOT NULL PRIMARY KEY,
idOeuvre INTEGER REFERENCES Oeuvre(idOeuvre) ON DELETE CASCADE,
statut VARCHAR2(10) CHECK( statut IN ('prete', 'disponible', 'reserve') ),
nomSupport VARCHAR2(10) CHECK( nomSupport IN ('livre', 'cassette', 'audio', 'video','CD','DVD') ),
surPlaceSeulement NUMBER(1) NOT NULL,
idEmplacement INTEGER REFERENCES Emplacement(idEmplacement) ON DELETE CASCADE,
numeroExamplaire VARCHAR2(10) NOT NULL
);
CREATE TABLE Reservation
(
idReservation INTEGER NOT NULL PRIMARY KEY,
dateFinReservation DATE,
idAdherent INTEGER REFERENCES Adherent(idAdherent),
idExemplaire INTEGER REFERENCES Exemplaire(idExemplaire)
);
CREATE TABLE Pret
(
idPret INTEGER NOT NULL PRIMARY KEY,
dateEmprunt DATE,
dateRetour DATE,
idAdherent INTEGER REFERENCES Adherent(idAdherent) ON DELETE CASCADE,
idExemplaire INTEGER REFERENCES Exemplaire(idExemplaire) ON DELETE CASCADE
);
CREATE TABLE Auteur
(
idAuteur INTEGER NOT NULL PRIMARY KEY,
nom VARCHAR(200) NOT NULL,
prenom VARCHAR(200) NOT NULL
);
CREATE TABLE Editeur
(
idEditeur INTEGER NOT NULL PRIMARY KEY,
nomEditeur VARCHAR(200)
);
CREATE TABLE Categorie
(
idCategorie INTEGER NOT NULL PRIMARY KEY,
descripteur Varchar(200) NOT NULL
);
CREATE TABLE AuteurOeuvre
(
idAuteur INTEGER REFERENCES Auteur(idAuteur) ON DELETE CASCADE,
idOeuvre INTEGER REFERENCES Oeuvre(idOeuvre) ON DELETE CASCADE
);
CREATE TABLE EditeurOeuvre
(
idEditeur INTEGER REFERENCES Editeur(idEditeur) ON DELETE CASCADE,
idOeuvre INTEGER REFERENCES Oeuvre(idOeuvre) ON DELETE CASCADE
);
CREATE TABLE CategorieOeuvre
(
idCategorie INTEGER REFERENCES Categorie(idCategorie) ON DELETE CASCADE,
idOeuvre INTEGER REFERENCES Oeuvre(idOeuvre) ON DELETE CASCADE
);
CREATE TABLE Livre
(
idLivre INTEGER PRIMARY KEY REFERENCES Exemplaire(idExemplaire) ON DELETE CASCADE,
ISBN VARCHAR(40) NOT NULL,
nbPages INTEGER NOT NULL
);
CREATE TABLE Musique
(
idMusique INTEGER PRIMARY KEY REFERENCES Exemplaire(idExemplaire) ON DELETE CASCADE,
duree INTEGER NOT NULL
);
CREATE TABLE Film
(
idFilm INTEGER PRIMARY KEY REFERENCES Exemplaire(idExemplaire) ON DELETE CASCADE,
duree INTEGER NOT NULL
);
-- Liste des index
CREATE INDEX ind_nom ON Utilisateur(nom);
CREATE INDEX ind_numero ON Adherent(numero);
CREATE INDEX ind_titre ON Oeuvre(titre);
CREATE INDEX ind_nomAuteur ON Auteur(nom);
CREATE INDEX ind_nomEditeur ON Editeur(nomEditeur);
CREATE INDEX ind_categorie ON Categorie(descripteur);
CREATE INDEX ind_ISBN ON Livre(ISBN);
SPOOL OFF
SET ECHO OFF;
|
SELECT TOP 1 *
FROM RED_BOOK_VEHICLE_MST
WHERE MAKE_DESCRIPTION = /*dto.selectMake*/'Isuzu'
AND FAMILY_DESCRIPTION = /*dto.selectFamily*/'D-Max'
AND YEAR_GROUP = /*dto.selectYear*/'2013'
AND DESCRIPTION = /*dto.selectVehicle*/
/*IF (dto.transmission == "1")*/
AND GEAR_TYPE_DESCRIPTION = /*dto.strAutomatic*/'Manual'
/*END*/
/*IF (dto.transmission == "0")*/
AND GEAR_TYPE_DESCRIPTION != /*dto.strAutomatic*/'Manual'
/*END*/
|
SELECT date, SUM(new_deaths) AS NEW_DEATHS
FROM covid_data
GROUP BY date
|
레퍼런싱 스트링 : 이순서로 접근한다
18쪽에서 네번째칸처럼 되려면 7을 victim으로 쫓아낸다.
본인이 구현한 부분 설명하기 (소실 발표할때)
완성된 코드랑 실행파일 가져오기 안되면 실행화면이라도 찍어올
CREATE TABLE account (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
pw TEXT NULL,
is_student INT NULL,
name TEXT NULL,
email TEXT NULL,
PRIMARY KEY(id)
);
CREATE TABLE board (
pk INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
course_no VARCHAR(255) NOT NULL,
title TEXT NULL,
attach1 BLOB NULL,
attach2 BLOB NULL,
p_id INTEGER UNSIGNED NULL,
timestamp TIMESTAMP NULL,
PRIMARY KEY(pk, course_no),
INDEX board_FKIndex1(course_no)
);
CREATE TABLE course (
course_no VARCHAR(255) NOT NULL ,
p_id INTEGER UNSIGNED NOT NULL,
name TEXT NULL,
open_year INTEGER UNSIGNED NULL,
semester INTEGER UNSIGNED NULL,
max_s INTEGER UNSIGNED NULL,
PRIMARY KEY(course_no),
INDEX course_FKIndex1(p_id)
);
CREATE TABLE course_plan (
course_no VARCHAR(255) NOT NULL ,
PRIMARY KEY(course_no),
course_count INTEGER UNSIGNED NOT NULL,
course_text TEXT NULL,
INDEX course_plan_FKIndex1(course_no)
);
CREATE TABLE course_registration (
s_id INTEGER UNSIGNED NOT NULL,
course_no VARCHAR(255) NOT NULL,
PRIMARY KEY(s_id, course_no),
INDEX account_has_course_FKIndex1(s_id),
INDEX account_has_course_FKIndex2(course_no)
);
|
--Task 3a.)
--Report 1
--a.)What is the total number of sale for properties of each suburb in VIC?
--b.) Explanation: This query will help users to understand the market scope for properties
--in each suburb in Victoria
--c.) SQL commands
select s.state_name, a.suburb, count(f.total_number_of_sale) as total_number_of_sales
from monre_sale_fact_v1 f, address_dim a, postcode_dim p, state_dim s, property_dim pr
where f.property_id = pr.property_id and pr.address_id = a.address_id
and a.postcode = p.postcode and p.state_code = s.state_code
and s.state_code = 'VIC'
group by s.state_name, a.suburb, f.total_number_of_sale
order by total_number_of_sales desc
fetch next 20 rows only;
--Report 2
--a.)What is the total number of sales for properties of each suburb in NSW?
--b.)Explanation: This query will help users to understand the market scope for properties
--in each suburb in New South Wales
--c.)SQL commands
select s.state_name, a.suburb, count(f.total_number_of_sale) as total_number_of_sales
from monre_sale_fact_v1 f, address_dim a, postcode_dim p, state_dim s, property_dim pr
where f.property_id = pr.property_id and pr.address_id = a.address_id
and a.postcode = p.postcode and p.state_code = s.state_code
and s.state_code = 'NSW'
group by s.state_name, a.suburb, f.total_number_of_sale
order by total_number_of_sales desc
fetch first 5 percent rows only;
--Report 3
--a.)What is the total number of sales for property by scale in Victoria?*/
--b.)Explanation: This query will help users to understand the market scope of
--each type of property in Victoria
--c.)SQL commands
select s.state_name, pr.property_type,
count(f.total_number_of_sale) as total_number_of_sales
from monre_sale_fact_v1 f, address_dim a, postcode_dim p, state_dim s, property_dim pr
where f.property_id = pr.property_id and pr.address_id = a.address_id
and a.postcode = p.postcode and p.state_code = s.state_code
and s.state_code = 'VIC'
group by s.state_name, pr.property_type, f.total_number_of_sale
order by total_number_of_sales desc;
-- Task 3b.)
--Report 4
--a.)What are the sub-total and total rental fees from each suburb, time period,
--and property type? (Use Cube)
--b.)Explanation: This query will help give information to management on the
--top renting property type at each suburb at a particular time
--c.)SQL commands
select a.suburb, t.time_rent_id as period, pr.property_type,
sum(f.total_rental) as Total_Rental_Fees
from address_dim a, time_rent_dim t, property_dim pr, monre_rent_fact_v1 f
where f.property_id = pr.property_id and pr.address_id = a.address_id
and f.time_rent_id = t.time_rent_id
group by cube (a.suburb, t.time_rent_id, pr.property_type)
order by t.time_rent_id;
--Report 5
--a.)What are the sub-total and total rental fees from each suburb, time period,
--and property type? (Use Partial Cube)
--b.)Explanation: This query will help give information to management on the
--top renting property type at each suburb at a particular time
--c.)SQL commands
select decode(grouping(a.suburb), 1, 'All Suburbs', a.suburb) as Suburb,
decode(grouping(t.time_rent_id), 1, 'All Periods', t.time_rent_id) as Period,
decode(grouping(pr.property_type), 1, 'All Property Type', pr.property_type) as Property_Type,
sum(f.total_rental) as Total_Rental_Fees
from address_dim a, time_rent_dim t, property_dim pr, monre_rent_fact_v1 f
where f.property_id = pr.property_id and pr.address_id = a.address_id
and f.time_rent_id = t.time_rent_id
group by cube (a.suburb, t.time_rent_id), pr.property_type
order by t.time_rent_id;
--Report 6
--a.)What are the sub-total and total rental fees from each state, time period, and
--property scale? (use Roll-up)
--b.)Explanation: This query will be usefull for management to type the top selling
--property scale by each state at a particular time and understand
--buyer preference by state.
--c.)SQL commands
select decode(grouping(s.state_name), 1, 'All States', s.state_name) as State_Name,
decode(grouping(t.time_rent_id), 1, 'All Periods', t.time_rent_id) as Period,
decode(grouping(pr.property_scale), 1, 'All Property Scale', pr.property_scale) as Property_Scale,
sum(f.total_rental) as Total_Rental_Fees
from address_dim a, state_dim s, postcode_dim p, time_rent_dim t,
property_dim pr, monre_rent_fact_v1 f
where f.property_id = pr.property_id and pr.address_id = a.address_id
and a.postcode = p.postcode and p.state_code = s.state_code
and f.time_rent_id = t.time_rent_id
group by rollup (s.state_name, t.time_rent_id, pr.property_scale)
order by t.time_rent_id;
--Report 7
--a.)What are the sub-total and total rental fees from each state, time period, and
--property scale? (use Partial Roll up)
--b.)Explanation: This query will be usefull for management to type the top selling
--property scale by each state at a particular time and understand
--buyer preference by state.
--c.)SQL commands
select decode(grouping(s.state_name), 1, 'All States', s.state_name) as State_Name,
decode(grouping(t.time_rent_id), 1, 'All Periods', t.time_rent_id) as Period,
decode(grouping(pr.property_scale), 1, 'All Property Scale', pr.property_scale) as Property_Scale,
sum(f.total_rental) as Total_Rental_Fees
from address_dim a, state_dim s, postcode_dim p, time_rent_dim t,
property_dim pr, monre_rent_fact_v1 f
where f.property_id = pr.property_id and pr.address_id = a.address_id
and a.postcode = p.postcode and p.state_code = s.state_code
and f.time_rent_id = t.time_rent_id
group by rollup (s.state_name, t.time_rent_id), pr.property_scale
order by t.time_rent_id;
--Task 3c
--Report 8
--a.)What is the total number of clients and cumulative number of clients with a
--high budget in each year?(cumulative aggregates)
--b.)Explanation: This query helps to identify the type of property to represent
--or acquire based on the client budget capacity.
--c.)SQL commands
select tr.time_rent_year, count(fr.total_number_of_clients) as Total_Number_of_Rental_Clients,
to_char(count(count(fr.total_number_of_clients)) over(partition by tr.time_rent_year
order by time_rent_year rows unbounded preceding), '9,999,999.99')
as Cumulative_number_of_rental_clients,
ts.time_sale_year, count(fs.total_number_of_clients) as Total_Number_of_Sales_Client,
to_char(count(count(fs.total_number_of_clients)) over(partition by ts.time_sale_year
order by time_sale_year rows unbounded preceding), '9,999,999.99')
as Cumulative_number_of_rental_clients
from monre_rent_fact_v1 fr, time_rent_dim tr, monre_sale_fact_v1 fs, time_sale_dim ts,
property_dim pr, client_dim c
where fr.time_rent_id = tr.time_rent_id and fs.time_sale_id = ts.time_sale_id and
pr.property_id = fr.property_id and pr.property_id = fs.property_id and
c.person_id = fr.client_person and c.person_id = fs.client_person
and c.budget_range = 'High'
group by tr.time_rent_year,ts.time_sale_year
order by time_rent_year, time_sale_year;
--Report 9
--a.)What is the total rental fees and cumulative rental fees by property type in
--each year? (cumulative aggregate)
--b.)Explanation: This query is particularly useful in understanding the rental
--properties trend among tenant by each year and to know the contribution
--of rental fees in total for a year
--c.)SQL command
select tr.time_rent_year, pr.property_type, sum(fr.total_rental) as Total_Rental,
to_char(sum(sum(fr.total_rental)) over(order by tr.time_rent_year
rows unbounded preceding), '9,999,999.99')
as Cumulative_rental_fees
from monre_rent_fact_v1 fr, time_rent_dim tr, property_dim pr
where fr.time_rent_id = tr.time_rent_id and fr.property_id = pr.property_id
group by tr.time_rent_year, pr.property_type
order by time_rent_year;
--Report 10
--a.)What is the total rental fees and moving aggregate rental fees by property type in
--each month of the year? (moving aggregate)
--b.)Explanation: This query is particularly useful in understanding the rental
--properties trend among tenant by each year and to know the contribution in average
--by months of a year
--c.)SQL command
select tr.time_rent_id, pr.property_type, sum(fr.total_rental) as Total_Rental,
to_char(avg(sum(fr.total_rental)) over(order by tr.time_rent_id
rows 2 preceding), '9,999,999.99')
as Moving_aggregate_3_monthly_rental_fees
from monre_rent_fact_v1 fr, time_rent_dim tr, property_dim pr
where fr.time_rent_id = tr.time_rent_id and fr.property_id = pr.property_id
group by tr.time_rent_id, pr.property_type
order by time_rent_id;
--Report 11
--a.)Show ranking of each property type based on the yearly total number of
--sales and the ranking of each state based on the yearly total number of sales.
--b.)Explanation: this query is useful to management to analyse the company
--based on property type and state which it has been able to most actively market
--properties
--c.)SQL command
select t.time_sale_year, pr.property_type, s.state_name,
count(f.total_number_of_sale) as Total_number_of_sales,
rank()over (partition by pr.property_type order by count(f.total_number_of_sale)desc)
as rank_by_property_type,
rank()over (partition by s.state_name order by count(f.total_number_of_sale)desc)
as rank_by_state
from monre_sale_fact_v1 f, property_dim pr, time_sale_dim t, state_dim s,
postcode_dim po, address_dim a
where f.property_id = pr.property_id and f.time_sale_id = t.time_sale_id and
pr.address_id = a.address_id and a.postcode = po.postcode and
po.state_code = s.state_code
group by t.time_sale_year, pr.property_type, s.state_name;
--Report 12
--a.)Show ranking of each property scale on the yearly total number of
--sales and the ranking of each suburb on the yearly total number of sales.
--b.)Explanation: this query is useful to management to analyse the company
--based on property scale and the suburb that it has been able to most actively market
--properties
--c.)SQL command
select t.time_sale_year, pr.property_scale, a.suburb,
count(f.total_number_of_sale) as Total_number_of_sales,
rank()over (partition by pr.property_scale order by count(f.total_number_of_sale)desc)
as rank_by_property_scale,
rank()over (partition by a.suburb order by count(f.total_number_of_sale)desc)
as rank_by_suburb
from monre_sale_fact_v1 f, property_dim pr, time_sale_dim t, address_dim a
where f.property_id = pr.property_id and f.time_sale_id = t.time_sale_id and
pr.address_id = a.address_id
group by t.time_sale_year, pr.property_scale, a.suburb;
|
# ************************************************************
# Sequel Pro SQL dump
# Version 4096
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: 127.0.0.1 (MySQL 5.6.10)
# Database: todoapp
# Generation Time: 2013-10-13 19:34:07 +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 access
# ------------------------------------------------------------
CREATE TABLE `access` (
`uid` int(11) unsigned NOT NULL COMMENT 'Users id.',
`listId` int(11) NOT NULL COMMENT 'Lists is.',
`role` varchar(50) NOT NULL DEFAULT '' COMMENT 'Access role, owner or contributor.',
UNIQUE KEY `listId` (`listId`,`uid`),
KEY `uid` (`uid`),
KEY `lid` (`listId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table list
# ------------------------------------------------------------
CREATE TABLE `list` (
`listId` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'List unique id.',
`name` varchar(255) DEFAULT NULL COMMENT 'List name.',
`created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'List creation time.',
`edited` timestamp NULL DEFAULT NULL COMMENT 'Timestamp when list was last modified.',
PRIMARY KEY (`listId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table session
# ------------------------------------------------------------
CREATE TABLE `session` (
`uid` int(11) DEFAULT NULL COMMENT 'Session users id.',
`sessionId` varchar(255) DEFAULT NULL COMMENT 'Session id string.',
`created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation timestamp.',
UNIQUE KEY `sessionid` (`sessionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table tag
# ------------------------------------------------------------
CREATE TABLE `tag` (
`tagId` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Tags id field',
`name` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tags name',
`uid` int(11) NOT NULL COMMENT 'User id of tag owner.',
PRIMARY KEY (`tagId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table tag_ref
# ------------------------------------------------------------
CREATE TABLE `tag_ref` (
`listId` int(11) unsigned NOT NULL,
`tagId` int(11) DEFAULT NULL,
KEY `listId` (`listId`),
KEY `listId_2` (`listId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table task
# ------------------------------------------------------------
CREATE TABLE `task` (
`taskId` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Task id.',
`listId` int(11) DEFAULT NULL COMMENT 'Associated list id.',
`creator` int(11) DEFAULT NULL COMMENT 'Creator of the task',
`editedby` int(11) DEFAULT NULL COMMENT 'User who last edited the item.',
`created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Task creation timestamp',
`modified` timestamp NULL DEFAULT NULL COMMENT 'Timestamp when task was last modified.',
`status` int(1) DEFAULT '0' COMMENT 'Tasks status.',
`text` varchar(255) DEFAULT NULL COMMENT 'Task contents.',
PRIMARY KEY (`taskId`),
KEY `lid` (`listId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table user
# ------------------------------------------------------------
CREATE TABLE `user` (
`uid` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique user id',
`email` varchar(80) NOT NULL DEFAULT '' COMMENT 'Users unique email',
`password` varchar(255) NOT NULL DEFAULT '' COMMENT 'Password hash',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp when usr was created.',
`lastlogin` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Timestamp when user last logged in the app.',
`firstname` varchar(100) DEFAULT NULL COMMENT 'Users first name',
`lastname` varchar(100) DEFAULT NULL COMMENT 'Users last name',
PRIMARY KEY (`uid`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!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 */;
|
EXEC sp_rename 'Adims_BeforeShfs_YS' ,'Adims_AfterVisit_YS' ;
EXEC sp_rename 'Adims_Mzzj_CJ' ,'Adims_AnesthesiaSummary' ;
EXEC sp_rename 'Adims_SHZT_YS' ,'Adims_AfterAnalgesia' ;
EXEC sp_rename 'Adims_SHZTGCZB_YS' ,'Adims_AfterAnalgesiaDetail' ;
EXEC sp_rename 'Adims_OTypesetting' ,'Adims_OperSchedule' ;
EXEC sp_rename 'Adims_SSSZR' ,'Adims_OperImplant' ;
EXEC sp_rename 'Adims_AfterVisit_YS.ZYNumber' ,'PatId' , 'COLUMN' ;
EXEC sp_rename 'Adims_AfterVisit_YS.PayTime' ,'Odate' , 'COLUMN';
EXEC sp_rename 'Adims_BeforeVisit_HS.ZYNumber' ,'PatId' , 'COLUMN' ;
EXEC sp_rename 'Adims_BeforeVisit_YS.PayTime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_BeforeVisit_YS.ZYNumber' ,'PatId' , 'COLUMN' ;
EXEC sp_rename 'Adims_MZZQTYS_YS.ZYNumber' ,'PatId' , 'COLUMN' ;
EXEC sp_rename 'Adims_AfterAnalgesia.ZYNumber' ,'PatId' , 'COLUMN';
EXEC sp_rename 'Adims_ZTZLZQTYS_YS.ZYNumber' ,'PatId' , 'COLUMN' ;
EXEC sp_rename 'Adims_OperImplant.ZYNumber' ,'PatId' , 'COLUMN' ;
EXEC sp_rename 'Adims_BeforeVisit_HS.sstiem' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_AnesthesiaSummary.Paytime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_MZZQTYS_YS.Paytime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_NurseRecord_HQ.Paytime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_PACU.Paytime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_SHZT_YS.Paytime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_OperImplant.Paytime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_AfterVisit_YS.Mzjld' ,'MzjldID' , 'COLUMN';
EXEC sp_rename 'Adims_AfterAnalgesiaDetail.Paytime' ,'VisitTime' , 'COLUMN'
EXEC sp_rename 'Adims_ZTZLZQTYS_YS.Paytime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_AfterAnalgesia.Paytime' ,'Odate' , 'COLUMN' ;
EXEC sp_rename 'Adims_AfterAnalgesia.mzjld' ,'MzjldID' , 'COLUMN' ;
EXEC sp_rename 'Adims_AfterAnalgesiaDetail.mzjld' ,'MzjldID' , 'COLUMN' ;
EXEC sp_rename 'Adims_AfterVisit_YS.mzjid' ,'MzjldID', 'COLUMN' ;
EXEC sp_rename 'Adims_AfterAnalgesiaDetail.mzjld' ,'VisitDate' , 'Odate' ;
alter table Adims_BeforeVisit_YS add PatZhuYuanID nvarchar(100)
update Adims_BeforeVisit_YS set PatZhuYuanID=PatId
alter table Adims_BeforeVisit_HS add PatZhuYuanID nvarchar(100)
update Adims_BeforeVisit_HS set PatZhuYuanID=PatId
alter table Adims_Mzjld add PatZhuYuanID nvarchar(100)
update Adims_Mzjld set PatZhuYuanID=PatId
alter table Adims_MZZQTYS_YS add PatZhuYuanID nvarchar(100)
update Adims_MZZQTYS_YS set PatZhuYuanID=PatId
alter table Adims_AfterAnalgesia add PatZhuYuanID nvarchar(100)
update Adims_AfterAnalgesia set PatZhuYuanID=PatId
alter table Adims_AfterVisit_YS add PatZhuYuanID nvarchar(100)
update Adims_AfterVisit_YS set PatZhuYuanID=PatId
alter table Adims_AnesthesiaSummary add PatZhuYuanID nvarchar(100)
update Adims_AnesthesiaSummary set PatZhuYuanID=PatId
alter table Adims_ZTZLZQTYS_YS add PatZhuYuanID nvarchar(100)
update Adims_ZTZLZQTYS_YS set PatZhuYuanID=PatId
|
CREATE PROC [ERP].Usp_Sel_ComprobanteDetalle_By_ListaComprobante
@IdComprobantes VARCHAR(250)
AS
BEGIN
SELECT CD.IdProducto,
CD.Nombre,
PRO.CodigoReferencia,
CD.PrecioUnitarioLista,
CD.FlagAfecto,
T6.CodigoSunat UnidadMedida,
CD.Cantidad,
CD.PrecioIGV,
CD.PrecioTotal
FROM ERP.ComprobanteDetalle CD
INNER JOIN ERP.Producto PRO ON PRO.ID = CD.IdProducto
INNER JOIN PLE.T6UnidadMedida T6 ON T6.ID = PRO.IdUnidadMedida
WHERE CD.IdComprobante IN (SELECT DATA FROM ERP.Fn_SplitContenido(@IdComprobantes,',')) AND PRO.IdTipoProducto = 1
END
|
CREATE SCHEMA DW
|
create table gtdb (
release text not null,
accession text not null,
representative_accession text not null,
is_representative boolean not null,
ncbi_assembly_name text,
ncbi_genbank_accession text,
superkingdom text,
phylum text,
class text,
orderr text,
family text,
genus text,
species text,
-- The following 6 fields are taken from the sp_clusters file and are
-- only defined for representative genomes
ani_circumscription_radius float,
mean_intra_species_ani float,
min_intra_species_ani float,
mean_intra_species_af float,
min_intra_species_af float,
num_clustered_genomes integer,
checkm_completeness float,
checkm_contamination float,
checkm_marker_count integer,
checkm_marker_taxa_field text,
checkm_marker_taxa_value text,
checkm_marker_uid integer,
checkm_marker_set_count integer,
checkm_strain_heterogeneity float,
primary key (release, accession)
) partition by list (release);
comment on table gtdb is 'Genome Taxonomy Database (GTDB) phylogeny records';
comment on column gtdb.release is 'text-encoded release version; e.g. "95.0"';
comment on column gtdb.accession is 'Genbank or RefSeq prefixed accession version; e.g. GB_GCA_000007345.1';
comment on column gtdb.representative_accession is 'accession of representative genome for this accession';
-- MIGRATION DOWN SQL
drop table gtdb;
|
-- sc: https://ru.hexlet.io/challenges/rdb_basics_rich_employees
-- Таблица employees содержит всех работников включая их менеджеров. Каждый
-- работник имеет id и колонку для id менеджера manager_id.
-- id name salary manager_id
-- 1 Joe 70000 3
-- 2 Henry 80000 4
-- 3 Sam 60000 NULL
-- 4 Max 90000 NULL
-- solution.sql
-- Напишите SQL запрос который найдет имена всех работников, которые получают
-- больше чем их менеджеры. Если у работника нет менеджера, они не должны попадать
-- в выборку.
-- Запишите запрос в файл solution.sql.
-- CREATE TABLE employees (
-- id integer,
-- name varchar(10),
-- salary integer,
-- manager_id integer
-- );
-- через подзапросы (не проходили в этом курсе)
SELECT name
FROM employees AS programmer
WHERE (manager_id IS NOT NULL) AND (salary > (
SELECT salary FROM employees WHERE id=programmer.manager_id
));
-- из-за связи двух полей JOIN - выдает только те, у которых уже есть менджер, не
-- нужно фильтровать работников без менеджеров
SELECT employees.name
FROM employees
JOIN employees AS managers ON employees.manager_id = managers.id
WHERE employees.salary > managers.salary;
|
/*
SQLyog Ultimate v10.00 Beta1
MySQL - 5.7.21-log : Database - ahpc
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`ahpc` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `ahpc`;
/*Table structure for table `provisional` */
DROP TABLE IF EXISTS `provisional`;
CREATE TABLE `provisional` (
`provisionalid` int(12) NOT NULL AUTO_INCREMENT,
`full_name` varchar(256) DEFAULT NULL,
`title` varchar(200) DEFAULT NULL,
`othertitle` varchar(200) DEFAULT NULL,
`index_number` varchar(256) DEFAULT NULL,
`surname` varchar(250) DEFAULT NULL,
`first_name` varchar(250) DEFAULT NULL,
`other_name` varchar(250) DEFAULT NULL,
`previous_name` varchar(250) DEFAULT NULL,
`birth_date` date DEFAULT NULL,
`place_of_birth` varchar(250) DEFAULT NULL,
`nationality` varchar(256) DEFAULT NULL,
`hometown` varchar(256) DEFAULT NULL,
`res_region` varchar(256) DEFAULT NULL,
`gender` varchar(250) DEFAULT NULL,
`marital_status` varchar(250) DEFAULT NULL,
`profession` varchar(256) DEFAULT NULL,
`period_registered` datetime DEFAULT NULL,
`telephone` varchar(250) DEFAULT NULL,
`applicant_id` varchar(256) DEFAULT NULL,
`application_id` varchar(256) DEFAULT NULL,
`email_address` varchar(256) DEFAULT NULL,
`contact_address` varchar(256) DEFAULT NULL,
`reg_type` varchar(256) DEFAULT NULL,
`res_housenumber` varchar(256) DEFAULT NULL,
`res_streetname` varchar(256) DEFAULT NULL,
`res_locality` varchar(256) DEFAULT NULL,
`res_town` varchar(256) DEFAULT NULL,
`res_landmark` varchar(256) DEFAULT NULL,
`res_phone` varchar(256) DEFAULT NULL,
`res_box` varchar(256) DEFAULT NULL,
`provisional_period` datetime DEFAULT NULL,
`provisional_registration` tinyint(5) DEFAULT '0',
`provisional_payment` tinyint(5) DEFAULT '0',
`permanent_payment` tinyint(5) DEFAULT '0',
`temporal_payment` tinyint(5) DEFAULT '0',
`provisional_usercheck_user` varchar(256) DEFAULT NULL,
`provisional_usercheck_status` varchar(256) DEFAULT NULL,
`provisional_form_submitted` varchar(200) DEFAULT NULL,
`provisional_usercheck_comment` longtext,
`provisional_admincheck_user` varchar(256) DEFAULT NULL,
`provisional_admincheck_status` varchar(256) DEFAULT NULL,
`provisional_admincheck_comment` longtext,
`provisional_pin` varchar(256) DEFAULT NULL,
`provisional_check_time` datetime DEFAULT NULL,
`permanent_period` datetime DEFAULT NULL,
`permanent_registration` tinyint(5) DEFAULT '0',
`permanent_usercheck_user` varchar(256) DEFAULT NULL,
`permanent_usercheck_status` varchar(256) DEFAULT NULL,
`permanent_usercheck_comment` longtext,
`permanent_admincheck_user` varchar(256) DEFAULT NULL,
`permanent_admincheck_status` varchar(256) DEFAULT NULL,
`permanent_admincheck_comment` longtext,
`permanent_check_time` datetime DEFAULT NULL,
`permanent_pin` varchar(256) DEFAULT NULL,
`temporal_period` datetime DEFAULT NULL,
`temporal_registration` tinyint(5) DEFAULT '0',
`temporal_usercheck_user` varchar(256) DEFAULT NULL,
`temporal_usercheck_status` varchar(256) DEFAULT NULL,
`temporal_usercheck_comment` longtext,
`temporal_admincheck_user` varchar(256) DEFAULT NULL,
`temporal_admincheck_status` varchar(256) DEFAULT NULL,
`temporal_admincheck_comment` longtext,
`temporal_pin` varchar(256) DEFAULT NULL,
`temporal_check_time` datetime DEFAULT NULL,
`password` varchar(256) DEFAULT NULL,
`2012_reg` tinyint(5) DEFAULT '0',
`permanent_form_submitted` varchar(256) DEFAULT NULL,
`email_verification_link` varchar(256) DEFAULT NULL,
`email_verified` tinyint(5) DEFAULT '0',
`declaration` varchar(200) DEFAULT NULL,
`institution` varchar(256) DEFAULT NULL,
`completion_year` varchar(255) DEFAULT NULL,
`professionid` int(12) DEFAULT NULL,
`registration_mode` varchar(256) DEFAULT NULL,
PRIMARY KEY (`provisionalid`)
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
DELETE FROM product;
INSERT INTO product (name, price, quantity) VALUES ('PC', 15000, 1);
INSERT INTO product (name, price, quantity) VALUES ('Table', 5000, 2);
INSERT INTO product (name, price, quantity) VALUES ('Book', 540, 10);
INSERT INTO product (name, price, quantity) VALUES ('Suit', 10000, 2);
INSERT INTO product (name, price, quantity) VALUES ('Window', 8000, 3);
|
create or replace TRIGGER TU_TORRE_FRETES_CAPRO
BEFORE INSERT OR UPDATE ON ELO_CARTEIRA_TORRE_FRETES
REFERENCING OLD AS old NEW AS new FOR EACH ROW
DECLARE
V_TORRE_FRETES_PRO NUMBER;
V_TORRE_CANEW NUMBER;
V_CD_ELO_CARTEIRA NUMBER;
BEGIN
IF :new.NU_QUANTIDADE > 0 AND :new.VL_FRETE_CONTRATADO > 0 THEN
BEGIN
SELECT I_ST_NEW_PRO.CD_ELO_STATUS INTO V_TORRE_CANEW
FROM VND.ELO_CARTEIRA E_CT
INNER JOIN VND.ELO_STATUS I_ST_NEW_PRO
ON E_CT.CD_STATUS_TORRE_FRETES = I_ST_NEW_PRO.CD_ELO_STATUS
INNER JOIN VND.ELO_TIPO_STATUS I_ST_TIPO_NP
ON
I_ST_NEW_PRO.CD_ELO_TIPO_STATUS = I_ST_TIPO_NP.CD_ELO_TIPO_STATUS
WHERE
I_ST_NEW_PRO.SG_STATUS IN('CANEW', 'CAPRO')
AND I_ST_TIPO_NP.SG_TIPO_STATUS = 'CARTE'
AND E_CT.CD_ELO_CARTEIRA = :new.CD_ELO_CARTEIRA;
EXCEPTION
WHEN OTHERS THEN
V_TORRE_CANEW:= NULL;
END;
IF V_TORRE_CANEW IS NOT NULL THEN
BEGIN
BEGIN
SELECT I_ST_NEW_PRO.CD_ELO_STATUS INTO V_TORRE_FRETES_PRO
FROM VND.ELO_STATUS I_ST_NEW_PRO
INNER JOIN VND.ELO_TIPO_STATUS I_ST_TIPO_NP
ON
I_ST_NEW_PRO.CD_ELO_TIPO_STATUS = I_ST_TIPO_NP.CD_ELO_TIPO_STATUS
WHERE
I_ST_NEW_PRO.SG_STATUS IN('CAPRO')
AND I_ST_TIPO_NP.SG_TIPO_STATUS = 'CARTE' ;
EXCEPTION
WHEN OTHERS THEN
V_TORRE_FRETES_PRO:= NULL;
END;
BEGIN
UPDATE VND.ELO_CARTEIRA c
SET c.CD_STATUS_TORRE_FRETES = V_TORRE_FRETES_PRO,
DH_MODIFICACAO_TORRE_FRETES= CURRENT_DATE,
DH_CONTRATACAO_TORRE_FRETES= CURRENT_DATE
WHERE
c.CD_ELO_CARTEIRA_GROUPING = (SELECT X.CD_ELO_CARTEIRA_GROUPING FROM VND.ELO_CARTEIRA X WHERE X.CD_ELO_CARTEIRA = :new.CD_ELO_CARTEIRA )
AND c.CD_STATUS_TORRE_FRETES IN( V_TORRE_CANEW, V_TORRE_FRETES_PRO);
EXCEPTION
WHEN OTHERS THEN
ROLLBACK ;
END;
END ;
END IF;
END IF;
END;
|
DROP TABLE IF EXISTS `message`;
CREATE TABLE message (
ID int NOT NULL PRIMARY KEY,
Message varchar(1024) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT message (ID,Message) VALUES (12345,"test");
|
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS tags (id INTEGER PRIMARY KEY, name TEXT, ord INTEGER);
CREATE TEMPORARY TABLE products_backup(ean, name, shelf, list);
INSERT INTO products_backup SELECT ean, name, shelf, list FROM products;
DROP TABLE products;
CREATE TABLE products (ean TEXT PRIMARY KEY, name TEXT, shelf TEXT, list INTEGER, tag INTEGER, FOREIGN KEY (list) REFERENCES lists (id), FOREIGN KEY (tag) REFERENCES tags (id));
INSERT INTO products (ean, name, shelf, list) SELECT ean, name, shelf, list FROM products_backup;
DROP TABLE products_backup;
UPDATE version SET major=3;
COMMIT;
|
-- phpMyAdmin SQL Dump
-- version 4.4.10
-- http://www.phpmyadmin.net
--
-- Client : localhost:8889
-- Généré le : Mar 10 Avril 2018 à 14:56
-- Version du serveur : 5.5.42
-- Version de PHP : 7.0.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `sitelivre`
--
-- --------------------------------------------------------
--
-- Structure de la table `book`
--
CREATE TABLE `book` (
`id_livre` int(11) NOT NULL,
`titre` varchar(50) NOT NULL,
`auteur` varchar(20) NOT NULL,
`editeur` varchar(20) NOT NULL,
`prix` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `panier`
--
CREATE TABLE `panier` (
`titre` int(11) NOT NULL,
`auteur` int(11) NOT NULL,
`edition` int(11) NOT NULL,
`prix` int(11) NOT NULL,
`couverture` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `Utilisateur`
--
CREATE TABLE `Utilisateur` (
`Id` int(11) NOT NULL,
`nom` varchar(20) NOT NULL,
`prenom` varchar(20) NOT NULL,
`age` int(11) NOT NULL,
`mail` varchar(20) NOT NULL,
`mdp` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Index pour les tables exportées
--
--
-- Index pour la table `book`
--
ALTER TABLE `book`
ADD PRIMARY KEY (`id_livre`);
--
-- Index pour la table `Utilisateur`
--
ALTER TABLE `Utilisateur`
ADD PRIMARY KEY (`Id`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `book`
--
ALTER TABLE `book`
MODIFY `id_livre` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `Utilisateur`
--
ALTER TABLE `Utilisateur`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE PROCEDURE [HomeAura].[BuildingUpdate]
@buildingId uniqueidentifier,
@name varchar(50)
AS
UPDATE HomeAura.Buildings
SET Name = @name
WHERE BuildingId = @buildingId;
RETURN 0
|
-- https://modeanalytics.com/editor/code_for_san_francisco/reports/9b612f447429
-- Query 2
-- The recipient_candidate_name is entered by the user.
-- This displays the candidate, election cycle, number of in-state contributions, total amount of in-state contributions,
-- the in-state average contribution amount, scaled contribution for in-state, number of out of state contributions,
-- the total amount out of state contributions, and the average amount out of state contribution.
-- Whew, that wa a mouthful. This will inform users of how much contributions are from in and out out state.
with table_ten as ( -- candidate in state contributions per election cycle
select
recipient_candidate_name,
election_cycle,
count(*) as num,
regexp_replace(upper(donor_state), '[^A-Z]', '' , 'g') as candidate_donor_states,
sum(transaction_amount) as in_state_trans
from trg_analytics.candidate_contributions
where regexp_replace(upper(donor_state), '[^A-Z]', '' , 'g') in (
'CA'
-- 'AK', 'AL', 'AR', 'AZ', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'GA', 'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME', 'MI', 'MN', 'MO', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM', 'NV', 'NY', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VA', 'VT', 'WA', 'WI', 'WV', 'WY'
)
and recipient_candidate_name like '%BROWN, EDMUND G. (JERRY)%'
group by recipient_candidate_name, election_cycle, candidate_donor_states
order by election_cycle desc
),
table_eleven as ( -- candidate total donor city per election cycle
select
recipient_candidate_name,
election_cycle,
count(*) as total_donor_states,
sum(transaction_amount) as total_trans
from trg_analytics.candidate_contributions
where recipient_candidate_name like '%BROWN, EDMUND G. (JERRY)%'
group by
election_cycle,
recipient_candidate_name
order by election_cycle desc
)
select
table_ten.recipient_candidate_name as candidate_name,
table_ten.election_cycle as election_cycle,
--in state
table_ten.num as num_in_state_contib,
table_ten.in_state_trans as in_state_transaction,
case when table_ten.num != 0
then table_ten.in_state_trans / table_ten.num
else 0
end as avg_trans_per_in_state_contrib,
table_ten.in_state_trans / table_eleven.total_trans as scaled_in_state_trans,
-- out of state
table_eleven.total_donor_states - table_ten.num as num_out_state_contib,
table_eleven.total_trans - table_ten.in_state_trans as out_state_trans,
case when (table_eleven.total_donor_states - table_ten.num) != 0
then (table_eleven.total_trans - table_ten.in_state_trans) / (table_eleven.total_donor_states - table_ten.num)
else 0
end as avg_trans_per_out_state_contrib
from table_ten
join table_eleven
on table_ten.recipient_candidate_name = table_eleven.recipient_candidate_name
and table_ten.election_cycle = table_eleven.election_cycle
|
create table Owns (
title varchar(20),
year int,
studioName varchar(20) not null,
primary key (title, year),
foreign key (title, year) references Movies(title, year),
foreign key (studioName) references Studios(name)
);
|
DROP TABLE IF EXISTS `XXX_plugin_geo_var`; ##b_dump##
|
TRUNCATE TABLE OLE_CAT_REPRO_POL_T
/
INSERT INTO OLE_CAT_REPRO_POL_T (REPRO_POL_ID,OBJ_ID,VER_NBR,REPRO_POL_CD,REPRO_POL_NM,SRC,SRC_DT,ROW_ACT_IND)
VALUES (1.0,'89c05582-c048-4ceb-8301-d69984788ffe',1.0,'a','Will Reproduce','MFHD 008-21 http://www.loc.gov/marc/holdings/hd008.html',STR_TO_DATE( '20120322000000', '%Y%m%d%H%i%s' ),'Y')
/
INSERT INTO OLE_CAT_REPRO_POL_T (REPRO_POL_ID,OBJ_ID,VER_NBR,REPRO_POL_CD,REPRO_POL_NM,SRC,SRC_DT,ROW_ACT_IND)
VALUES (2.0,'85d9c259-a6e8-4a49-8832-f71dc70d895d',1.0,'b','Will Not Reproduce','MFHD 008-21 http://www.loc.gov/marc/holdings/hd008.html',STR_TO_DATE( '20120322000000', '%Y%m%d%H%i%s' ),'Y')
/
INSERT INTO OLE_CAT_REPRO_POL_T (REPRO_POL_ID,OBJ_ID,VER_NBR,REPRO_POL_CD,REPRO_POL_NM,SRC,SRC_DT,ROW_ACT_IND)
VALUES (3.0,'c8c9a29c-6798-4252-bc93-141348143c7a',1.0,'u','unknown','MFHD 008-21 http://www.loc.gov/marc/holdings/hd008.html',STR_TO_DATE( '20120322000000', '%Y%m%d%H%i%s' ),'Y')
/
|
SELECT TOP(CONVERT(INT, /*topRow*/))
--A.見積番号
A.QUOTATION_NO AS H_QUOTATION_NO,
--A.見積案件No.
A.RECEIPT_NO AS H_RECEIPT_NO,
--B.受付日
B.RECEIPT_DATE AS H_RECEIPT_DATE,
--B.顧客_名称
B.CUSTOMER_NAME AS H_CUSTOMERT_NAME,
--A.取得総額
A.OBTAIN_SUM_TOTAL AS H_OBTAIN_SUM_TOTAL,
--B.担当者
B.CHARGER_NAME AS H_CHARGE_NAME,
--C.コード名称(見積ステータス名)
C.CODE_NAME AS H_QUOTATION_STATUS,
--A.見積ステータス
A.QUOTATION_STATUS AS H_QUOTATION_STATUS_CODE,
--D.コード名称(取引形態)
D.CODE_NAME AS H_BUSINESS_STATE,
--E.案件名称
E.CASES_NAME AS H_CASE_NO,
--A.見積日
A.QUOTATION_DATE AS H_QUOTATION_DATE,
--A.取引通貨
A.KEY_CURRENCY_ID AS H_CURRENCY,
--A.申請番号
A.APPLY_NO AS H_APPLY_NO
FROM
--見積情報
QUOTATION_INFO A
INNER JOIN
--見積案件情報
QUOTATION_CASE_INFO B
ON
--見積情報.見積案件No.=見積案件情報.見積案件No.
A.RECEIPT_NO = B.RECEIPT_NO
LEFT JOIN
--コードマスタ
CODE_MASTER C
ON
--見積情報.見積ステータス=コードマスタ.コードID(+)
A.QUOTATION_STATUS = C.CODE_ID
--コードマスタ.国ID = セッション.国ID
AND C.COUNTRY_ID = /*dto.countryId*/''
--コードマスタ.コード種類 = 「263:見積ステータス」
AND C.CODE_TYPE = CAST(/*quotationStatus*/'' AS CHAR(3))
LEFT JOIN
--コードマスタ
CODE_MASTER D
ON
--見積情報.取引形態=コードマスタ.コードID
A.BUSINESS_STATE = D.CODE_ID
--コードマスタ.国ID = セッション.国ID
AND D.COUNTRY_ID = /*dto.countryId*/''
--コードマスタ.コード種類 = 「001:取引形態区分」
AND D.CODE_TYPE = CAST(/*customerFormKbn*/'' AS CHAR(3))
INNER JOIN
--案件属性マスタ
CASE_MST E
ON
--案件属性マスタ.案件番号 = 見積情報.案件番号
A.CASE_NO = E.CASE_NO
/*BEGIN*/
WHERE
--見積情報.案件No.=画面.案件No.
/*IF dto.receiptNo != null*/
A.RECEIPT_NO = CAST(/*dto.receiptNo*/ AS CHAR(10))
/*END*/
--見積情報.見積番号=画面.見積番号
/*IF dto.quotationNo != null*/
AND A.QUOTATION_NO = /*dto.quotationNo*/''
/*END*/
--見積案件情報.顧客_取引先コード=画面.顧客コード
/*IF dto.customerCdSearch != null*/
AND B.CUSTOMER_CODE = /*dto.customerCdSearch*/''
/*END*/
--見積案件情報.受付日>=画面.案件受付日From
/*IF dto.receiptDateFrom != null*/
AND B.RECEIPT_DATE >= /*dto.receiptDateFrom*/''
/*END*/
--見積案件情報.受付日<=画面.案件受付日To
/*IF dto.receiptDateTo != null*/
AND B.RECEIPT_DATE <= /*dto.receiptDateTo*/''
/*END*/
--見積案件情報.担当者=画面.担当者
/*IF dto.chargeName != null*/
AND B.USER_ID = /*dto.chargeName*/''
/*END*/
--見積情報.見積日>=画面.見積作成日From
/*IF dto.lastPrintDateFrom != null*/
AND CONVERT(VARCHAR(10),A.QUOTATION_DATE,120) >= /*dto.lastPrintDateFrom*/''
/*END*/
--見積情報.見積日<=画面.見積作成日To
/*IF dto.lastPrintDateTo != null*/
AND CONVERT(VARCHAR(10),A.QUOTATION_DATE,120) <= /*dto.lastPrintDateTo*/''
/*END*/
--見積情報.見積=画面.見積ステータス
/*IF dto.quotationStatus != null*/
AND A.QUOTATION_STATUS = CAST(/*dto.quotationStatus*/ AS CHAR(1))
/*END*/
--見積情報.申請番号=画面.申請番号
/*IF dto.applyNo != null*/
AND A.APPLY_NO = /*dto.applyNo*/''
/*END*/
/*IF dto.customertName != null*/
AND B.CUSTOMER_NAME LIKE /*dto.customertName*/
/*END*/
/*END*/
ORDER BY
A.RECEIPT_NO DESC,
A.QUOTATION_NO ASC
|
CREATE PROC [ERP].[Usp_Sel_Propiedad_By_ID] --14
@ID int
AS
BEGIN
SELECT PR.ID ID,
UM.ID IdUnidadMedida,
PR.Nombre NombrePropiedad,
UM.Nombre NombreUnidadMedida,
UM.CodigoSunat CodigoSunat,
PR.FechaRegistro,
PR.FechaEliminado,
PR.FechaModificado,
PR.FechaActivacion,
PR.UsuarioRegistro,
PR.UsuarioModifico,
PR.UsuarioElimino,
PR.UsuarioActivo
FROM [Maestro].[Propiedad] PR
LEFT JOIN [PLE].[T6UnidadMedida] UM
ON UM.ID = PR.IdUnidadMedida
WHERE PR.ID = @ID
END
|
insert into `categories`(`title`)
values
('Home'),
('Audio'),
('Phone'),
('All Categories');
|
CREATE DATABASE IF NOT EXISTS `world_news_corp_cms`;
use world_news_corp_cms;
/*Create Table authors*/
CREATE TABLE IF NOT EXISTS authors (
NINumber BIGINT UNSIGNED NOT NULL,
FirstName VARCHAR(255),
LastName VARCHAR(255),
Gender Enum('Male', 'Female'),
Age int(10),
Salary int,
Country VARCHAR(200),
PRIMARY KEY (NINumber)
);
#Data entries for table authors
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(1987234920,'John', 'Smith', 'Male', 34, 20000, 'England')
;
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(9348098234,'Tom', 'Potter', 'Male', 32, 32000, 'Scotland');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(4564547547,'Jack', 'Kingman', 'Male', 23, 14000, 'India');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(5654674575,'Chris', 'Trethick', 'Male', 45, 24000, 'India');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(5675675675,'Dave', 'Carter', 'Male', 56, 40000, 'Ireland');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(7775656765,'Ian', 'Packwood', 'Male', 33, 19000, 'England');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(8964334324,'Lucy', 'Teague', 'Female', 18, 20000, 'America');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(6612355667,'Jane', 'Connor', 'Female', 19, 49000, 'France');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(3456456457,'Mary', 'Van Schmidt', 'Female', 42, 32000, 'France');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(1875432325,'Liz', 'Fogarty', 'Female', 53, 34000, 'America');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(1134576877,'Emma', 'Baker', 'Female', 37, 20000, 'England');
INSERT INTO `authors`(`NINumber`,`FirstName`, `LastName`, `Gender`, `Age`,
`Salary`, `Country`) VALUES
(2345457654,'Anne', 'Nuttley', 'Female', 43, 34000, 'Indonesia');
#Create table for Articles
CREATE TABLE IF NOT EXISTS `Articles` (
`ArticleID` int UNSIGNED NOT NULL AUTO_INCREMENT,
`Title` VARCHAR(50),
`Topic` Enum('Financial','Politics', 'Sport', 'Science', 'Entertainment'),
`Content` VARCHAR(250),
`TimePost` timestamp,
`CountryPost` VARCHAR (50),
`NewsArticle` BIGINT,
PRIMARY KEY (ArticleID)
);
#Data entries for table Article
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (1, 1987234920, 'Europe crackdown on jihadist network', 'Politics',
'Police target 17 people in raids in several European countries on suspicion of links to a jihadist network.', now(), 'England'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (2, 9348098234, 'Modi visit historic opportunity for UK', 'Politics',
'Indian prime minister arrives in the UK for a three day visit, described by David Cameron as a historic opportunity for both countries.', now(), 'India'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES(3, 5675675675,'Sweden brings in migrant border checks', 'Politics',
'Sweden brings in temporary border checks to control the flow of migrants into the country, as an EU Africa summit continues.', Now(), 'Sweden'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (4, 7775656765, 'Apple apologises after racism outcry', 'Financial',
'Apple apologises to six schoolboys who were asked to leave one of their shops in Australia, in what the students described as a racist incident.', Now(), 'Australia'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (5, 1134576877, 'HMRC reveals tax office shake-up', 'Financial',
'The UKs tax authority will close 137 local offices and replace them with 13 regional centres, raising fears over job losses.', Now(), 'England'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (6, 1987234920, 'Film star visits cafe for homeless', 'Entertainment',
'Hollywood star George Clooney visits a sandwich shop which helps homeless people during a visit to Edinburgh.', now(), 'Scotland'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (7, 1134576877, 'Rolls-Royce shares dive on profit woes', 'Financial',
'Shares in aerospace group RollsRoyce sink after it warns that its profits will be hit by sharply weaker demand.', Now(), 'England'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (8, 1134576877, 'Ex-MPs GBP13,700 on shredding and skips', 'Politics',
'The Independent Parliamentary Standards Authority releases expenses claims for 182 MPs who left the Commons at the election - with GBP705,000 spent on closing down their offices.',
now(), 'England'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (9, 3456456457, 'Action needed to protect UK coast', 'Science',
'The UK is ignoring known risks of flood and erosion at the coast and immediate action is needed to manage the threats, the National Trust warns.', now(), 'England'
);
INSERT INTO `Articles`(`ArticleID`, `NewsArticle`, `Title`, `Topic`, `Content`, `TimePost`, `CountryPost`) VALUES (10, 2345457654, 'Venus twin excites astronomers', 'Science',
'Astronomers hunting distant worlds say they have made one of their most significant discoveries to date, what could be a kind of hot twin to our Venus.', now(), 'England'
);
#Create Comments table
CREATE TABLE IF NOT EXISTS `Comments` (
`CommentID` int UNSIGNED NOT NULL AUTO_INCREMENT,
`UserName` VARCHAR(25),
`UserComment` VARCHAR(100),
`TimeStamp` TimeStamp,
`has_comment` int,
PRIMARY KEY (CommentID)
) ENGINE = InnoDB;
#Input data for table Comments
INSERT INTO `Comments`(`CommentID`, `UserName`, `UserComment`, `TimeStamp`, `has_comment`) VALUES (1,'userName01', 'Modi should make a better deal with the David Cameron before return back to India.', now(), 2
);
INSERT INTO `Comments`(`CommentID`, `UserName`, `UserComment`, `TimeStamp`,`has_comment`) VALUES (2,'Love-Tech', 'What is the actual fuss about him?', now(), 2
);
INSERT INTO `Comments`(`CommentID`, `UserName`,`UserComment`, `TimeStamp`, `has_comment`) VALUES (3, 'LordHaveMercy', 'What is on earth happening to this world?',
now(), 1
);
INSERT INTO `Comments`(`CommentID`, `UserName`, `UserComment`, `TimeStamp`, `has_comment`) VALUES (4, 'jhonlegend', 'I believe these jihadists get help from someone.', now(), 1
);
INSERT INTO `Comments`(`CommentID`, `UserName`, `UserComment`, `TimeStamp`, `has_comment`) VALUES (5, 'Md_jb', 'well done to author to bring up current poor state of HMRC.', now(), 5
);
#Create Likes table
CREATE TABLE IF NOT EXISTS `Likes` (
`LikeID` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`has_like` int,
`TimeStamp` TimeStamp,
PRIMARY KEY (LikeID)
) ENGINE = InnoDB;
#input data into the table Likes
INSERT INTO `Likes`(`LikeID`, `has_like`, `TimeStamp`) VALUES(1, 1,Now());
INSERT INTO `Likes`(`LikeID`, `has_like`, `TimeStamp`) VALUES(2, 1,Now());
INSERT INTO `Likes`(`LikeID`, `has_like`, `TimeStamp`) VALUES(3, 9,Now());
INSERT INTO `Likes`(`LikeID`, `has_like`, `TimeStamp`) VALUES(4, 5,Now());
INSERT INTO `Likes`(`LikeID`, `has_like`, `TimeStamp`) VALUES(5, 3,Now());
|
CREATE DATABASE docentedb DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
use docentedb;
create table docente(
id integer not null auto_increment,
nombres varchar(127),
apellidos varchar(127),
grado varchar(63),
urlimg varchar(255),
primary key(id)
);
create table auxiliar(
id integer not null auto_increment,
nombres varchar(127),
apellidos varchar(127),
urlimg varchar(255),
primary key(id)
);
create table materia(
id integer not null auto_increment,
sigla varchar(7),
nombre varchar(255),
primary key(id)
);
create table docente_materia(
docente_id integer not null,
materia_id integer not null,
estado boolean,
primary key(docente_id, materia_id),
foreign key(docente_id)
references docente(id)
on delete cascade,
foreign key(materia_id)
references materia(id)
on delete cascade
);
create table auxiliar_materia(
auxiliar_id integer not null,
materia_id integer not null,
estado boolean,
primary key(auxiliar_id, materia_id),
foreign key(auxiliar_id)
references auxiliar(id)
on delete cascade,
foreign key(materia_id)
references materia(id)
on delete cascade
);
create table comentario(
id integer not null auto_increment,
nick varchar(63),
cont text,
fecha date,
hora time,
comentario_id integer default null,
primary key(id)
);
create table reaccion(
id integer not null auto_increment,
nombre varchar(63),
urlimg varchar(255),
primary key(id)
);
create table administrador(
id integer not null auto_increment,
nombres varchar(127),
apellidos varchar(127),
correo varchar(128),
passw varchar(255),
primary key(id)
);
create table comentario_docente(
comentario_id integer not null,
docente_id integer not null,
val tinyint,
primary key(comentario_id, docente_id),
foreign key(comentario_id)
references comentario(id)
on delete cascade,
foreign key(docente_id)
references docente(id)
on delete cascade
);
create table auxiliar_comentario(
comentario_id integer not null,
auxiliar_id integer not null,
val tinyint,
primary key(comentario_id, auxiliar_id),
foreign key(comentario_id)
references comentario(id)
on delete cascade,
foreign key(auxiliar_id)
references auxiliar(id)
on delete cascade
);
create table comentario_reaccion(
comentario_id integer not null,
reaccion_id integer not null,
primary key(comentario_id, reaccion_id),
foreign key(comentario_id)
references comentario(id)
on delete cascade,
foreign key(reaccion_id)
references reaccion(id)
on delete cascade
);
insert into materia values(null, 'INF-111', 'Introducción a la Informática');
insert into materia values(null, 'LAB-111', 'Laboratorio de Inf-111');
insert into materia values(null, 'INF-112', 'Organización de Computadoras');
insert into materia values(null, 'INF-113', 'Laboratorio de Computación');
insert into materia values(null, 'MAT-114', 'Matemática Discreta I');
insert into materia values(null, 'MAT-115', 'Análisis Matemático I - Calculo 1');
insert into materia values(null, 'LIN-116', 'Gramática Española');
insert into materia values(null, 'INF-121', 'Algoritmos y Programación');
insert into materia values(null, 'LAB-121', 'Laboratorio de Inf-121');
insert into materia values(null, 'FIS-122', 'Física I');
insert into materia values(null, 'LAB-122', 'Laboratorio de Física I');
insert into materia values(null, 'MAT-123', 'Matemática Discreta II');
insert into materia values(null, 'MAT-124', 'Álgebra Lineal');
insert into materia values(null, 'MAT-125', 'Análisis Matemático II Calculo 2');
insert into materia values(null, 'INF-131', 'Estructura de Datos y Algoritmos');
insert into materia values(null, 'LAB-131', 'Laboratorio de Inf-131');
insert into materia (sigla, nombre) values('FIS-132', 'Física II'),
('LAB-132', 'Laboratorio de Física II'),
('EST-133', 'Estadística I'),
('MAT-134', 'Análisis Matemático III'),
('LIN-135', 'Idioma I'),
('INF-141', 'Sistemas de Gestión'),
('INF-142', 'Fundamentos Digitales'),
('INF-143', 'Taller de Programación'),
('INF-144', 'Lógica para la Ciencia de la Computación'),
('EST-145', 'Estadística II'),
('INF-151', 'Sistemas Operativos'),
('INF-152', 'Sistemas de Información Gerencial'),
('INF-153', 'Assembler'),
('INF-154', 'Lenguajes Formales y Autómatas'),
('EST-155', 'Investigación de Operaciones I'),
('MAT-156', 'Análisis Numérico'),
('INF-161', 'Diseño y Administración de Base de Datos'),
('INF-162', 'Análisis y Diseño de Sistemas de Información'),
('INF-163', 'Ingeniería de Software'),
('INF-164', 'Teoría de la Información y Codificación'),
('EST-165', 'Investigación de Operaciones II'),
('INF-166', 'Informática y Sociedad'),
('INF-271', 'Teoría de Sistemas y Modelos'),
('INF-272', 'Taller de Base de Datos'),
('INF-273', 'Telemática'),
('LAB-273', 'Laboratorio de Inf-273'),
('INF-281', 'Taller de Sistemas de Información'),
('INF-282', 'Especificaciones Formales y Verificación'),
('INF-391', 'Simulación de Sistemas'),
('INF-398', 'Taller de Licenciatura I'),
('INF-399', 'Taller de Licenciatura II'),
('CPA-201', 'Sistemas Contables'),
('INF-312', 'Administración de Unidades de Procesamiento de Datos'),
('INF-314', 'Auditoría Informática'),
('INF-315', 'Planificación y Seguridad de los Sistemas Informáticos'),
('INF-316', 'Sistemas de Información Gerencial II'),
('INF-320', 'Programación Lógica'),
('INF-323', 'Programación Gráfica'),
('INF-324', 'Programación Multimedial'),
('INF-325', 'Programación Virtual'),
('INF-327', 'Sistemas de Control Automático'),
('INF-328', 'Comparación de Lenguajes'),
('INF-329', 'Idiomas II'),
('INF-330', 'Hardware I'),
('INF-331', 'Organización y Métodos de Información'),
('INF-332', 'Economía'),
('INF-333', 'Preparación y Evaluación de Proyectos I'),
('INF-335', 'Muestreo'),
('INF-336', 'Teoría General de Sistemas'),
('INF-338', 'Microprocesadores'),
('INF-351', 'Sistemas Expertos'),
('INF-354', 'Inteligencia Artificial'),
('INF-359', 'Compiladores y Traductores'),
('INF-360', 'Computabilidad y Complejidad Algorítmica'),
('INF-363', 'Modelos Lineales'),
('INF-364', 'Diseño Experimental'),
('INF-365', 'Simulación y Modelaje'),
('INF-367', 'Investigación Operativa III'),
('INF-369', 'Procesos Estocásticos'),
('INF-317', 'Sistemas en Tiempo Real y Distribuido'),
('INF-340', 'Arquitectura de Computadoras y Procesamientos en Paralelo'),
('INF-319', 'Programación Funcional y Software'),
('MAT-391', 'Seminario II'),
('INF-355', 'Lenguajes Naturales y Formales'),
('INF-361', 'Diseño y Análisis de Algoritmos I'),
('INF-334', 'Preparación y Evaluación de Proyectos II'),
('INF-311', 'Protocolos de Comunicación'),
('MAT-398', 'Diseño de Compiladores'),
('INF-357', 'Robótica'),
('INF-322', 'Programación Distribuida');
|
SELECT DISTINCT(GENDER) FROM EMPLOYEEDEMOGRAPHICS
SELECT COUNT(LASTNAME) AS LASTNAMECOUNT FROM EMPLOYEEDEMOGRAPHICS;
SELECT MAX(SALARY) FROM EMPLOYEESALARY
SELECT AVG(SALARY) FROM EMPLOYEESALARY
SELECT MIN(SALARY) FROM EMPLOYEESALARY
SELECT * FROM SQLTutorial.dbo.EMPLOYEESALARY
|
create table [Main].[Playlist]
(
[PlaylistId] smallint NOT NULL IDENTITY (1, 1)
, [Name] varchar(50) NOT NULL
, CONSTRAINT [PK_Playlist] PRIMARY KEY ([PlaylistId])
, CONSTRAINT [AK_Playlist_Name] UNIQUE ([Name])
)
|
drop table BURI_STATE_UNDO_LOG;
|
-- ------------------------------------------------------------------------------------------------------------------------------------
-- Estrutura
-- ------------------------------------------------------------------------------------------------------------------------------------
-- Tabela ItemImagem
CREATE TABLE `ItemMatch` (
`Id` char(36) NOT NULL,
`Data` datetime NOT NULL,
`UsuarioId` char(36) NOT NULL,
`NecessidadeId` char(36) NOT NULL,
`DoacaoId` char(36) NOT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `UK_ItemMatch_ND` (`NecessidadeId`,`DoacaoId`),
KEY `IX_ItemMatch_Data` (`Data`),
KEY `IX_ItemMatch_Usuario` (`UsuarioId`),
KEY `IX_ItemMatch_Doacao` (`DoacaoId`),
KEY `IX_ItemMatch_Necessidade` (`NecessidadeId`),
CONSTRAINT `FK_ItemMatch_Doacao` FOREIGN KEY (`DoacaoId`) REFERENCES `Item` (`Id`),
CONSTRAINT `FK_ItemMatch_Necessidade` FOREIGN KEY (`NecessidadeId`) REFERENCES `Item` (`Id`),
CONSTRAINT `FK_ItemMatch_Usuario` FOREIGN KEY (`UsuarioId`) REFERENCES `Usuario` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ------------------------------------------------------------------------------------------------------------------------------------
-- Dados
-- ------------------------------------------------------------------------------------------------------------------------------------
-- Tabela __ControleVersaoUpgradeDB
INSERT INTO `__ControleVersaoUpgradeDB` VALUES (2, now(), 'Criação de mecanismo de Match.');
|
ALTER TABLE public.audits DROP CONSTRAINT IF EXISTS check_reason_reason_reason_reason;
ALTER TABLE public.audits ADD CONSTRAINT check_reason_reason_reason_reason_reason CHECK (
reason='threshold' or
reason='samplesize' or
reason='missing-review-submission' or
reason='did-not-submit-review' or
reason='plagiarism'
);
|
select version ();
-- Sandbox in exercise-db
-- Calc diff set using left join and is null
-- no diff
select
with_alias.district
, with_alias.total
from (
select
case pref_name
when '徳島' then '四国'
when '香川' then '四国'
when '愛媛' then '四国'
when '高知' then '四国'
when '福岡' then '九州'
when '佐賀' then '九州'
when '長崎' then '九州'
else 'その他' end as district,
sum(population) as total
from poptbl
group by district ) as with_alias
left join (
select
case pref_name
when '徳島' then '四国'
when '香川' then '四国'
when '愛媛' then '四国'
when '高知' then '四国'
when '福岡' then '九州'
when '佐賀' then '九州'
when '長崎' then '九州'
else 'その他' end as district,
sum(population) as total
from poptbl
group by
case pref_name
when '徳島' then '四国'
when '香川' then '四国'
when '愛媛' then '四国'
when '高知' then '四国'
when '福岡' then '九州'
when '佐賀' then '九州'
when '長崎' then '九州'
else 'その他' end ) as no_alias
on with_alias.district = no_alias.district
where
no_alias.district is null
;
|
DROP TABLE IF EXISTS AUTHORITIES;
DROP TABLE IF EXISTS USER;
DROP TABLE IF EXISTS BLOG_POST;
--USER TABLE
CREATE TABLE IF NOT EXISTS USER (
ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) NOT NULL,
USERNAME VARCHAR(255) NOT NULL,
PASSWORD VARCHAR(255) NOT NULL,
ENABLED BOOLEAN NOT NULL,
PRIMARY KEY(ID)
);
--AUTHORITIES TABLE
CREATE TABLE IF NOT EXISTS AUTHORITIES(
ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) NOT NULL,
USERNAME VARCHAR(255) NOT NULL,
AUTHORITY VARCHAR(255) NOT NULL
);
--BLOG TABLE
CREATE TABLE IF NOT EXISTS BLOG_POST(
ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) NOT NULL,
TITLE VARCHAR(255) NOT NULL,
CONTENT VARCHAR(255) NOT NULL,
DRAFT BOOLEAN NULL,
PUBLISHDATE DATE NULL,
USER_ID BIGINT NOT NULL,
CONSTRAINT FK_BLOGPOST_USER FOREIGN KEY(USER_ID) REFERENCES USER(ID)
);
|
ALTER TABLE races ADD COLUMN game_id VARCHAR(128)
|
CREATE LOGIN [sa]
WITH PASSWORD = N'gOkJjjhcqyfUY>E|sztjvslymsFT7_&#$!~<k!lzt_OpTsco', DEFAULT_LANGUAGE = [us_english];
|
-- Sequence: public."Product_id_seq"
CREATE SEQUENCE public."Product_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER TABLE public."Product_id_seq"
OWNER TO postgres;
-- Sequence: public."User_id_seq"
CREATE SEQUENCE public."User_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER TABLE public."User_id_seq"
OWNER TO postgres;
-- Table: public."User"
CREATE TABLE public."User"
(
id bigint NOT NULL DEFAULT nextval('"User_id_seq"'::regclass),
name character varying(50) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY (id),
CONSTRAINT "User_name_check" CHECK (length(btrim(name::text)) >= 2)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public."User"
OWNER TO postgres;
-- Table: public."Product"
CREATE TABLE public."Product"
(
id bigint NOT NULL DEFAULT nextval('"Product_id_seq"'::regclass),
name character varying(50) NOT NULL,
price bigint,
CONSTRAINT "Product_pkey" PRIMARY KEY (id),
CONSTRAINT "Product_name_check" CHECK (length(btrim(name::text)) >= 3),
CONSTRAINT "Product_price_check" CHECK (price >= 0)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public."Product"
OWNER TO postgres;
-- Table: public."Order"
CREATE TABLE public."Order"
(
user_id bigint NOT NULL,
product_id bigint NOT NULL,
CONSTRAINT "Order_product_id_fkey" FOREIGN KEY (product_id)
REFERENCES public."Product" (id) MATCH SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT,
CONSTRAINT "Order_user_id_fkey" FOREIGN KEY (user_id)
REFERENCES public."User" (id) MATCH SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT
)
WITH (
OIDS=FALSE
);
ALTER TABLE public."Order"
OWNER TO postgres;
|
CREATE OR REPLACE PACKAGE BODY rmnode AS
--更新T_policy表
PROCEDURE removenode (v_objectid IN VARCHAR2) IS
BEGIN
delete from T_SubjAgri where objectno = v_objectid;
delete from T_SubjProfitLoss where objectno = v_objectid;
delete from T_ReExpensive where objectno = v_objectid;
delete from T_SubjShip where objectno = v_objectid;
delete from T_SubjFreight where objectno = v_objectid;
delete from T_PersonList where objectno = v_objectid;
delete from T_SubjDuty where objectno = v_objectid;
delete from T_SubjProductDuty where objectno = v_objectid;
delete from T_PropertyList where objectno = v_objectid;
delete from T_ProjectParty where objectno = v_objectid;
delete from T_AcquisitionCost where objectno = v_objectid;
delete from T_PolicyUnderWrite where objectno = v_objectid;
delete from T_SubjEmployerDuty where objectno = v_objectid;
delete from T_PolicyAgency where objectno = v_objectid;
delete from T_JoInsurance where objectno = v_objectid;
delete from T_Liability where objectno = v_objectid;
delete from T_SubjProject where objectno = v_objectid;
delete from T_AcquisitionCostDetail where objectno = v_objectid;
delete from T_PolicyApplicant where objectno = v_objectid;
delete from T_SubjTrafficDuty where objectno = v_objectid;
delete from T_SubjAircraftDuty where objectno = v_objectid;
delete from T_Policy where objectno = v_objectid;
delete from T_PayPlan where objectno = v_objectid;
delete from T_ReinsureInfo where objectno = v_objectid;
delete from T_Node where objectno = v_objectid;
delete from T_SubjGuarantee where objectno = v_objectid;
delete from T_PolicyContact where objectno = v_objectid;
delete from T_Endorse where objectno = v_objectid;
delete from T_SubjEconomic where objectno = v_objectid;
delete from T_PolicyBeneficiary where objectno = v_objectid;
delete from T_SubjMarketDuty where objectno = v_objectid;
delete from T_PolicyInsure where objectno = v_objectid;
delete from T_SubjEnterprise where objectno = v_objectid;
delete from T_SubjFreightForward where objectno = v_objectid;
delete from T_CoInsurance where objectno = v_objectid;
delete from T_SubjMedLiab where objectno = v_objectid;
delete from T_Subject where objectno = v_objectid;
delete from T_Contract where objectno = v_objectid;
END;
PROCEDURE removeproposal(v_objectid IN VARCHAR2) IS
BEGIN
delete from T_Proposal where objectno = v_objectid;
END;
PROCEDURE removequotation(v_objectid IN VARCHAR2) IS
BEGIN
delete from t_Quotation where objectno = v_objectid;
END;
END rmnode;
|
--Execute this line from the master database
CREATE LOGIN dataloader WITH PASSWORD = 'Demo@pass123';
CREATE USER dataloader FOR LOGIN dataloader;
--Execute the remainder of these lines from the sqlpool database
CREATE USER dataloader FOR LOGIN dataloader;
GRANT CONTROL ON DATABASE::sqlpool to dataloader;
EXEC sp_addrolemember 'largerc', 'dataloader';
|
select dt.text, 'COPD' as label from
(select dx.subject_id, dx.hadm_id, dx.icd9_code, dx.seq_num,
round((LENGTH(n.text) - LENGTH(REPLACE(n.text, 'bronchitis', '')))/LENGTH('bronchitis')) as bronchitis,
round((LENGTH(n.text) - LENGTH(REPLACE(n.text, 'copd', '')))/LENGTH('copd')) as copd,
round((LENGTH(n.text) - LENGTH(REPLACE(n.text, 'emphysema', '')))/LENGTH('emphysema')) as emphysema,
round((LENGTH(n.text) - LENGTH(REPLACE(n.text, 'hypoxia', '')))/LENGTH('hypoxia')) as hypoxia,
round((LENGTH(n.text) - LENGTH(REPLACE(n.text, 'hyperinflated', '')))/LENGTH('hyperinflated')) as hyperinflated,
round((LENGTH(n.text) - LENGTH(REPLACE(n.text, 'thickening', '')))/LENGTH('thickening')) as thickening,
round((LENGTH(n.text) - LENGTH(REPLACE(n.text, 'distress', '')))/LENGTH('distress')) as distress,
n.text
from mimic.noteevents n
join mimic.diagnoses_icd dx on n.subject_id = dx.subject_id
and n.hadm_id = dx.hadm_id
and n.category = 'Radiology'
where (1 = 1)
and dx.seq_num = 1
and (dx.icd9_code = '490'
or dx.icd9_code = '493'
or dx.icd9_code = '495'
or dx.icd9_code = '496'
or dx.icd9_code = '491'
or dx.icd9_code = '4910'
or dx.icd9_code = '4911'
or dx.icd9_code = '4912'
or dx.icd9_code = '49120'
or dx.icd9_code = '49121'
or dx.icd9_code = '49122'
or dx.icd9_code = '4918'
or dx.icd9_code = '4919'
or dx.icd9_code = '492'
or dx.icd9_code = '4920'
or dx.icd9_code = '4928'
or dx.icd9_code = '4932'
or dx.icd9_code = '496'
or dx.icd9_code = '5181'
or dx.icd9_code = '5181'
or dx.icd9_code = '5182'
or dx.icd9_code = '7702'
or dx.icd9_code = '9587'
or dx.icd9_code = 'V813'
)) dt
where (bronchitis + copd + emphysema + hypoxia + hyperinflated + thickening + distress) > 0
order by (bronchitis + copd + emphysema + hypoxia + hyperinflated + thickening + distress) desc
limit 500
|
CREATE TABLE IF NOT EXISTS `performance_interval` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dns` decimal(8,2) DEFAULT NULL COMMENT 'DNS查询耗时',
`tcp` decimal(8,2) DEFAULT NULL COMMENT 'TCP连接耗时',
`ttfb` decimal(8,2) DEFAULT NULL COMMENT '请求响应耗时',
`trans` decimal(8,2) DEFAULT NULL COMMENT '内容传输耗时',
`dom` decimal(8,2) DEFAULT NULL COMMENT 'DOM解析耗时',
`res` decimal(8,2) DEFAULT NULL COMMENT '资源加载耗时',
`sslTime` decimal(8,2) DEFAULT NULL COMMENT 'SSL安全连接耗时',
`createTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
--
-- security professionals will tell you it's not a good idea to use the username 'admin'.
-- The admin dashboard doesn't let you change usernames. So use this in the mysql console
--
UPDATE wp_users SET user_login = 'new_username' WHERE user_login = 'admin';
|
CREATE TABLE [ERP].[ComparadorDetalle] (
[ID] INT IDENTITY (1, 1) NOT NULL,
[IdComparador] INT NULL,
[IdProducto] INT NULL,
[IdProveedor] INT NULL,
[Cantidad] INT NULL,
[Precio] DECIMAL (14, 5) NULL,
[Total] DECIMAL (14, 5) NULL,
[Seleccionado] BIT NULL,
CONSTRAINT [PK__Comparad__3214EC27AA6B237B] PRIMARY KEY CLUSTERED ([ID] ASC),
CONSTRAINT [FK__Comparado__IdCom__4DB6E531] FOREIGN KEY ([IdComparador]) REFERENCES [ERP].[Comparador] ([ID]),
CONSTRAINT [FK__Comparado__IdPro__4EAB096A] FOREIGN KEY ([IdProducto]) REFERENCES [ERP].[Producto] ([ID]),
CONSTRAINT [FK__Comparado__IdPro__4F9F2DA3] FOREIGN KEY ([IdProveedor]) REFERENCES [ERP].[Proveedor] ([ID])
);
|
INSERT INTO CodeSystem (CODESYSTEM_ID,CODE_SYSTEM_URI,CODESYSTEM_NAME)
VALUES (952,'https://fhir.nhs.uk/STU3/CodeSystem/DCH-ChildHealthEncounterType-1',NULL);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('001','Birth Discharge For use with the Discharge Details Event message only.',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('002','Maternity Discharge For use with the Discharge Details Event message only.',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('003','Birth',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('004','Post Birth Review',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('005','Community Midwife Discharge',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('006','Newborn Infant Physical Examination',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('007','Newborn Hearing Screening',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('008','Newborn Blood Spot Screening',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('009','6-8 Week GP Led Review',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0010','BCG immunisation',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0011','8 week immunisations',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0012','12 week immunisations',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0013','16 week immunisations',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0014','1 Year immunisations',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0015','Pre-school immunisations',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0016','HPV immunisations',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0017','Teenage booster immunisations',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0018','Influenza immunisations',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0019','2-2 ½ Year Early Years Progress',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0020','2-2 ½ Year Heath Visitor Review',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0021','1 Year Health Review',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0022','6-8 Week Health Visitor review',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0023','New Baby Health Visitor Review',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0024','School Entry Review',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0025','National Child Measurement Programme',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0026','Ad-hoc Health Review',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0027','Ad-hoc Immunisation',952);
INSERT INTO Concept(CODE,DISPLAY,CODESYSTEM_ID) VALUES ('0028','GP Appointment',952);
|
create table Auctioneer (
assn int,
salesrate int,
foreign key (assn) references Employee (ssn)
);
insert into Auctioneer (assn, salesrate) values (737635511, 42);
insert into Auctioneer (assn, salesrate) values (407895301, 35);
insert into Auctioneer (assn, salesrate) values (628761508, 45);
insert into Auctioneer (assn, salesrate) values (339659428, 33);
insert into Auctioneer (assn, salesrate) values (718906354, 39);
insert into Auctioneer (assn, salesrate) values (588300301, 37);
insert into Auctioneer (assn, salesrate) values (896606700, 46);
insert into Auctioneer (assn, salesrate) values (688795377, 35);
insert into Auctioneer (assn, salesrate) values (984159086, 34);
insert into Auctioneer (assn, salesrate) values (845254654, 23);
|
-- migrate:up
CREATE TABLE probes (
id SERIAL,
name TEXT NOT NULL,
ip TEXT NOT NULL,
asn TEXT NOT NULL,
network_name TEXT NOT NULL,
country_code CHAR(2) NOT NULL,
resolver_ip TEXT NOT NULL,
resolver_asn TEXT NOT NULL,
resolver_network_name TEXT NOT NULL,
software_name TEXT NOT NULL,
software_version TEXT NOT NULL,
token CHAR(36) NULL NULL,
active boolean NOT NULL,
last_contact timestamp NOT NULL,
created_at timestamp NOT NULL DEFAULT NOW(),
updated_at timestamp NOT NULL DEFAULT NOW(),
UNIQUE (token)
);
SELECT manage_updated_at('probes');
CREATE TABLE jobs (
id SERIAL,
website TEXT NOT NULL,
domain TEXT NOT NULL,
hidden boolean NOT NULL DEFAULT false,
created_at timestamp NOT NULL DEFAULT NOW(),
updated_at timestamp NOT NULL DEFAULT NOW()
);
CREATE INDEX jobs_domain_idx ON jobs (domain);
SELECT manage_updated_at('jobs');
CREATE TABLE results (
id SERIAL,
job_id integer NOT NULL,
probe_id integer NOT NULL,
hidden boolean NOT NULL DEFAULT false,
dns_consistency text,
accessible boolean,
blocking text,
raw_data text,
created_at timestamp NOT NULL DEFAULT NOW(),
updated_at timestamp NOT NULL DEFAULT NOW()
);
SELECT manage_updated_at('results');
-- migrate:down
DROP TABLE IF EXISTS probes;
DROP TABLE IF EXISTS jobs;
DROP TABLE IF EXISTS results;
|
USE Смелова_UNIVER;
UPDATE STUDENT set Номер_группы = 5;
DELETE from STUDENT WHERE Номер_зачетки = 707098;
|
create table user_detail (
id varchar(64) not null primary key,
username varchar(100) not null unique,
encript_password varchar(255) not null,
hash_id varchar(100),
enabled boolean not null default false,
blocked boolean not null default false,
expired boolean not null default false,
last_login datetime,
created_by varchar(64) not null,
created_date datetime not null default now(),
last_updated_by varchar(64),
last_udpated_date datetime
) engine = InnoDB;
create table roles (
id varchar(64) not null primary key,
name varchar(100) not null,
description text
) engine = InnoDB;
create table user_roles (
id varchar(64) not null primary key,
user_id varchar(64) not null,
role_id varchar(64) not null
) engine = InnoDB;
alter table user_roles
add constraint fk_user_role_user_id foreign key (user_id)
references user_detail (id)
on update cascade
on delete cascade;
alter table user_roles
add constraint fk_user_role_role_id foreign key (role_id)
references roles (id)
on update cascade
on delete cascade;
|
INSERT INTO moviemarklist(movieID,userID,markScore,markContent,markDate)
VALUES(5,5,10,'zzzzzzzzzzzzzzzzzzzzzzzz',now())
ON DUPLICATE KEY UPDATE markContent='123456',markDate=now(),markScore='2';
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.