blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 3 276 | src_encoding stringclasses 33
values | length_bytes int64 23 9.61M | score float64 2.52 5.28 | int_score int64 3 5 | detected_licenses listlengths 0 44 | license_type stringclasses 2
values | text stringlengths 23 9.43M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
9bd423f35e2c62523fc1aba3ad14468816e32701 | SQL | hongyouqin/ppms | /ppms/ppms-admin/src/main/resources/db/schema.sql | UTF-8 | 247 | 2.6875 | 3 | [] | no_license |
-- 用户信息表
CREATE TABLE user_info
(
id BIGINT IDENTITY PRIMARY KEY ,
email VARCHAR(20) NOT NULL,
pwd VARCHAR(20) NOT NULL,
user_name VARCHAR(20) NOT NULL,
created_time DATETIME,
login_time DATETIME
);
-- 收入表 | true |
af265ab9158f37355a3a4a7e7b92c4baa175876f | SQL | jkyjustin/TeamTree | /start.sql | UTF-8 | 4,989 | 4.0625 | 4 | [] | no_license | DROP TABLE Accounts CASCADE CONSTRAINTS;
DROP TABLE Students CASCADE CONSTRAINTS;
DROP TABLE Employers CASCADE CONSTRAINTS;
DROP TABLE Schools CASCADE CONSTRAINTS;
DROP TABLE Courses CASCADE CONSTRAINTS;
DROP TABLE Companies CASCADE CONSTRAINTS;
DROP TABLE Endorsements CASCADE CONSTRAINTS;
DROP TABLE Reviews CASCADE CONSTRAINTS;
CREATE TABLE Schools (
schoolID INT,
sName VARCHAR(40),
campusLoc VARCHAR(100),
PRIMARY KEY (schoolID)
);
grant select on Schools to public;
CREATE TABLE Accounts (
acctID INT,
fname VARCHAR(40),
lname VARCHAR(40),
email VARCHAR(40),
password VARCHAR(40),
isEmployer NUMBER(1), /* 0 = student acct, 1 = employer acct */
PRIMARY KEY (acctID),
CONSTRAINT email_uniq UNIQUE (email)
);
grant select on Accounts to public;
CREATE TABLE Students (
acctID INT,
schoolID INT NOT NULL,
PRIMARY KEY (acctID),
FOREIGN KEY (acctID) REFERENCES Accounts(acctID)
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED, /* aka. ON UPDATE CASCADE */
FOREIGN KEY (schoolID) REFERENCES Schools(schoolID)
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED,
CONSTRAINT schoolID
CHECK (schoolID between 1 and 2)
);
grant select on Students to public;
CREATE TABLE Companies (
companyID INT,
name VARCHAR(40),
website VARCHAR(40),
PRIMARY KEY (companyID)
);
grant select on Companies to public;
CREATE TABLE Employers (
acctID INT,
companyID INT NOT NULL,
PRIMARY KEY (acctID),
FOREIGN KEY (acctID) REFERENCES Accounts(acctID)
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED,
FOREIGN KEY (companyID) REFERENCES Companies(companyID)
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED
);
grant select on Employers to public;
CREATE TABLE Courses (
courseNo INT,
dept CHAR(4),
schoolID INT,
PRIMARY KEY (courseNo, dept, schoolID),
FOREIGN KEY (schoolID) REFERENCES Schools(schoolID)
);
grant select, insert on Courses to public;
CREATE TABLE Endorsements (
employerID INT,
studentID INT,
PRIMARY KEY (employerID, studentID),
FOREIGN KEY (employerID) REFERENCES Employers(acctID)
ON DELETE SET NULL
DEFERRABLE INITIALLY DEFERRED
);
grant select on Endorsements to public;
CREATE TABLE Reviews (
datetime TIMESTAMP,
reviewID INT,
reviewerID INT,
revieweeID INT,
courseNo INT,
dept CHAR(4),
schoolID INT,
score INT,
assignmentDesc VARCHAR(255),
content VARCHAR(1000),
numLikes INT,
numDislikes INT,
PRIMARY KEY (datetime, reviewID, reviewerID, revieweeID, courseNo, dept),
FOREIGN KEY (reviewerID) REFERENCES Students(acctID)
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED,
FOREIGN KEY (revieweeID) REFERENCES Students(acctID)
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED,
FOREIGN KEY (courseNo, dept, schoolID) REFERENCES Courses(courseNo, dept, schoolID)
);
grant select on Reviews to public;
/* Schools */
INSERT INTO Schools
VALUES (1, 'University of British Columbia', '2255 Lower Mall, Vancouver, BC, FDS 334');
INSERT INTO Schools
VALUES (2, 'Simon Fraser University', '8888 University Dr, Burnaby, BC V5A 1S6');
/* Companies */
INSERT INTO Companies
VALUES (1, 'Google', 'Google.com');
INSERT INTO Companies
VALUES (2, 'Microsoft', 'Msft.com');
INSERT INTO Companies
VALUES (3, 'Facebook', 'Facebook.com');
/* UBC Students */
INSERT INTO Accounts
VALUES(1, 'Justin', 'Yoon', 'jy@email.com', 'password', 0);
INSERT INTO Students
VALUES (1, 1);
INSERT INTO Accounts
VALUES(8, 'Justin', 'ABC', 'jy123@email.com', 'password', 0);
INSERT INTO Students
VALUES (8, 1);
INSERT INTO Accounts
VALUES(2, 'Blake', 'Turnable', 'blaketmeng@gmail.com', 'password', 0);
INSERT INTO Students
VALUES(2, 1);
/* SFU Students */
INSERT INTO Accounts
VALUES(3, 'LeBron', 'James', 'lb_goat@cavs.com', 'password', 0);
INSERT INTO Students
VALUES(3, 2);
INSERT INTO Accounts
VALUES(4, 'Steph', 'Curry', 'i_suck@yahoo.com', 'password', 0);
INSERT INTO Students
VALUES(4, 2);
/* Employers */
INSERT INTO Accounts
VALUES(5, 'Billy', 'Googley', 'BGoogley@GoogleRecruiting.com', 'password', 1);
INSERT INTO Employers
VALUES (5, 1);
INSERT INTO Accounts
VALUES(6, 'Bill', 'Gates', 'bgates@msft.com', 'password', 1);
INSERT INTO Employers
VALUES (6, 2);
INSERT INTO Accounts
VALUES(7, 'Mark', 'Zuckerberg', 'markz@facebook.com', 'password', 1);
INSERT INTO Employers
VALUES (7, 3);
/* UBC Courses */
INSERT INTO Courses
VALUES (110, 'CPSC', 1);
INSERT INTO Courses
VALUES (121, 'CPSC', 1);
INSERT INTO Courses
VALUES (304, 'CPSC', 1);
INSERT INTO Courses
VALUES (317, 'CPSC', 1);
/* SFU Courses */
INSERT INTO Courses
VALUES (125, 'CMPT', 2);
INSERT INTO Courses
VALUES (225, 'CMPT', 2);
INSERT INTO Reviews
VALUES(CURRENT_TIMESTAMP, 1, 1, 2, 304, 'CPSC', 1, 1, 'Make a pony and ride it ; )', 'Dude sucked', 1, 0);
INSERT INTO Reviews
VALUES(CURRENT_TIMESTAMP, 2, 2, 1, 317, 'CPSC', 1, 5, 'blah blah 123', 'Yey we passed', 0, 0);
INSERT INTO Endorsements
VALUES (5, 1);
COMMIT; | true |
2b172e4f06b4b10eda29d0827710cb148de4ea53 | SQL | vkscorpio3/atg_training | /workspace/modules/ClothingStore/build/atgsql/DCS/sql/db_components/db2/contracts_ddl.sql | UTF-8 | 1,051 | 3.140625 | 3 | [] | no_license |
-- @version $Id: //product/DCS/version/11.2/templates/DCS/sql/contracts_ddl.xml#1 $$Change: 946917 $
-- Normally, catalog_id and price_list_id would reference the appropriate table it is possible not to use those tables though, which is why the reference is not included
create table dbc_contract (
contract_id varchar(40) not null,
display_name varchar(254) default null,
creation_date timestamp default null,
start_date timestamp default null,
end_date timestamp default null,
creator_id varchar(40) default null,
negotiator_info varchar(40) default null,
price_list_id varchar(40) default null,
catalog_id varchar(40) default null,
term_id varchar(40) default null,
comments varchar(254) default null
,constraint dbc_contract_p primary key (contract_id));
create table dbc_contract_term (
terms_id varchar(40) not null,
terms varchar(20480) default null,
disc_percent numeric(19,7) default null,
disc_days integer default null,
net_days integer default null
,constraint dbc_contract_ter_p primary key (terms_id));
commit;
| true |
ee4b900ff0a8674aa65ff8b34b86bd56f4162c6e | SQL | amrit1996/mounty-backend-test | /productform.sql | UTF-8 | 2,630 | 3.265625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 14, 2019 at 04:23 PM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `productform`
--
-- --------------------------------------------------------
--
-- Table structure for table `cart`
--
CREATE TABLE `cart` (
`id` int(11) NOT NULL,
`cid` int(11) NOT NULL,
`pid` int(11) NOT NULL,
`title` varchar(200) NOT NULL,
`quantity` tinyint(4) NOT NULL,
`totalamount` float NOT NULL,
`createdOn` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `prodform`
--
CREATE TABLE `prodform` (
`id` int(11) NOT NULL,
`protitle` varchar(60) NOT NULL,
`prodesc` varchar(60) DEFAULT NULL,
`procost` float DEFAULT NULL,
`prosell` float DEFAULT NULL,
`image` varchar(60) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `prodform`
--
INSERT INTO `prodform` (`id`, `protitle`, `prodesc`, `procost`, `prosell`, `image`) VALUES
(1, 'samsung', 'this is samsung mobile', 52000, 45000, 'samsungs10.jpg'),
(2, 'nokia', 'this is nokia mobile', 25000, 20000, 'nokia.jpg'),
(3, 'Apple', 'this is apple iphone', 90000, 85000, 'iphone.jpg'),
(4, 'oneplus', 'this is oneplus 6t', 40000, 37500, 'oneplus.jpg'),
(7, 'vivo', 'this is vivo mobile', 25600, 24000, 'vivo.jpg'),
(8, 'xiaomi', 'this is xiaomi mobile', 28000, 25000, 'xiaomi.jpg'),
(9, 'lava', 'this is a lava mobile', 15000, 12000, 'lava.jpg'),
(10, '', '', 0, 0, '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cart`
--
ALTER TABLE `cart`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `prodform`
--
ALTER TABLE `prodform`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cart`
--
ALTER TABLE `cart`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prodform`
--
ALTER TABLE `prodform`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
1894d21181afc6e57d331de49f28618e5acebab8 | SQL | jiangqianghua/seckill | /schema.sql | UTF-8 | 1,747 | 3.96875 | 4 | [] | no_license | -- 数据库初始化脚本
-- 创建数据库
CREATE database IF NOT EXISTS seckill default charset utf8 COLLATE utf8_general_ci;
--使用数据库
use seckill ;
-- 创建秒杀库存表
CREATE TABLE `seckill`(
`seckill_id` bigint NOT null AUTO_INCREMENT COMMENT'商品库存id',
`name` varchar(120) NOT NULL COMMENT '商品名称',
`number` int NOT NULL COMMENT '库存数量',
`start_time` timestamp NOT NULL COMMENT '秒杀开始时间',
`end_time` timestamp NOT NULL COMMENT '秒杀结束时间',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY(`seckill_id`),
key `idx_start_time` (`start_time`),
key `idx_end_time` (`end_time`),
key `idx_create_time` (`create_time`)
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 COMMENT='秒杀库存表'
--初始化数据
insert into seckill(name,number,start_time,end_time)
values
('1000元秒杀iphone6',100,'2016-05-08 00:00:00','2016-05-09 00:00:00'),
('500元秒杀ipad2',200,'2016-05-08 00:00:00','2016-05-09 00:00:00'),
('200元秒杀小米4',300,'2016-05-08 00:00:00','2016-05-09 00:00:00'),
('200元秒杀红米',400,'2016-05-08 00:00:00','2016-05-09 00:00:00'),
-- 描述成功明细表
-- 用户登录认证相关信息
create table `success_killed`(
`seckill_id` bigint NOT NULL COMMENT '秒杀商品id',
`user_phone` bigint NOT NULL COMMENT '用户手机号',
`state` tinyint NOT NULL DEFAULT -1 COMMENT '状态表示:-1:无效 0:成功 1:已付款',
`create_time` timestamp NOT NULL COMMENT '创建时间',
PRIMARY KEY(`seckill_id` , `user_phone`),/*联合主键*/
key idx_create_time(`create_time`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='描述成功明细表'
| true |
a70d218bedee589ba468f3f22ddc8646c3903b93 | SQL | USLabs/SpartanFlix | /database_design/schema/Scripts/testedByUmang/28. GetAdsForAdvertiser.sql | UTF-8 | 750 | 3.28125 | 3 | [] | no_license | use CMPE226_SPARTAN_FLIX;
drop procedure if exists prc_get_ads_for_advertiser;
delimiter //
create procedure prc_get_ads_for_advertiser(in advertiser_id int unsigned, in _search VARCHAR(128), in _title VARCHAR(128))
begin
declare searchT varchar(128);
declare titleT varchar(128);
set searchT = coalesce(_search, '');
set titleT = coalesce(_title, '');
if searchT = 'null' then
set searchT = '';
end if;
if titleT= 'null' then
set titleT = '';
end if;
select advertisementId, isApproved, title, description, concat(fname, ' ', lname) as advertiser from ADVERTISEMENT_VIEW
where advertiserId = advertiser_id and description like concat('%', searchT, '%') and title like concat('%', titleT, '%');
end // | true |
3f96829a97b4c3f65e5b120fa4d666f4c165c0ec | SQL | topfreegames/mqtt-history | /scripts/create.cql | UTF-8 | 309 | 2.9375 | 3 | [
"MIT"
] | permissive | CREATE KEYSPACE IF NOT EXISTS chat
WITH REPLICATION = {
'class': 'SimpleStrategy',
'replication_factor': 1
};
CREATE TABLE IF NOT EXISTS chat.messages (
id timeuuid,
topic varchar,
payload varchar,
bucket int,
PRIMARY KEY ((topic, bucket), id)
) WITH CLUSTERING ORDER BY (id DESC);
| true |
e5e3b939fc617b644e4461ba669fee88b8652bb5 | SQL | sprokushev/Delphi | /MASTER/_DATABASE/Tables/KLS_VOZN_RST.sql | WINDOWS-1251 | 1,578 | 3.28125 | 3 | [] | no_license | --
-- KLS_VOZN_RST (Table)
--
CREATE TABLE MASTER.KLS_VOZN_RST
(
ID NUMBER(10) NOT NULL,
IS_AGENT NUMBER(10) DEFAULT NULL,
BEGIN_DATE DATE,
END_DATE DATE,
ID_GROUP_NPR VARCHAR2(5 BYTE),
PROD_ID_NPR VARCHAR2(5 BYTE),
VAGOWN_TYP_ID NUMBER(10),
RAST_MIN NUMBER(10) DEFAULT 0,
RAST_MAX NUMBER(10) DEFAULT 0,
CENA_VOZN NUMBER(15,2) DEFAULT 0
)
TABLESPACE USERS2
NOCOMPRESS ;
COMMENT ON TABLE MASTER.KLS_VOZN_RST IS ' ';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.ID IS '';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.IS_AGENT IS ' ';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.BEGIN_DATE IS ' ';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.END_DATE IS ' ';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.ID_GROUP_NPR IS ' ';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.PROD_ID_NPR IS '';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.VAGOWN_TYP_ID IS ' ';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.RAST_MIN IS ' ';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.RAST_MAX IS ' ';
COMMENT ON COLUMN MASTER.KLS_VOZN_RST.CENA_VOZN IS ' ( )';
| true |
a4ed8179316efe17bfaa643e76c7bed4c9bae653 | SQL | alialaghbandrad/Warehouse-Management-System | /SQLQuery-Warehouse.sql | UTF-8 | 3,937 | 4.21875 | 4 | [] | no_license | use warehouse;
CREATE TABLE Customer
(
CustomersID int identity(1,1) NOT NULL,
CompanyName nvarchar(45) NOT NULL,
ContactName nvarchar(45) NOT NULL,
Address nvarchar(45) NOT NULL,
City nvarchar(45) NOT NULL,
Province nvarchar(45) NOT NULL,
Country nvarchar(45) NOT NULL,
Phone nvarchar(45) NOT NULL,
constraint PK_CustID PRIMARY KEY (CustomersID)
)
;
select * from Customer;
CREATE TABLE Vendor
(
VendorID int identity(1,1) NOT NULL,
VendorName nvarchar(45) NOT NULL,
ContactName nvarchar(45) NOT NULL,
Address nvarchar(100) NOT NULL,
City nvarchar(45) NOT NULL,
Province nvarchar(45) NOT NULL,
Country nvarchar(45) NOT NULL,
Phone nvarchar(45) NOT NULL,
constraint PK_VendID PRIMARY KEY (VendorID)
)
;
select * from Vendor;
CREATE TABLE Product
(
ProductID int identity(1,1) NOT NULL,
Description nvarchar(100) NOT NULL,
UnitOfMeasure nvarchar(45) NOT NULL,
SellingPrice money NOT NULL,
CostPrice money NOT NULL,
VendorID int NOT NULL,
ProductImage varbinary(max) NOT NULL,
constraint PK_ProdID PRIMARY KEY (ProductID),
CONSTRAINT FK_PRD_VND FOREIGN KEY (VendorID)
REFERENCES Vendor (VendorID),
CONSTRAINT CK_PRD_UOM CHECK
(UnitOfMeasure IN ('Kg', 'Litre', 'Each', 'Case'))
)
;
select * from Product;
CREATE TABLE Inventory
(
LocationID int identity(1,1) NOT NULL,
ProductID int NOT NULL,
Quantity int NOT NULL,
WarehouseID int NOT NULL,
constraint PK_LocID PRIMARY KEY (LocationID),
constraint FK_Prd_Inv_ProdID FOREIGN KEY (ProductID)
REFERENCES Product (ProductID)
)
;
ALTER TABLE Inventory
ADD constraint FK_Prd_Inv_ProdID FOREIGN KEY (ProductID)
REFERENCES Product (ProductID);
ALTER TABLE Inventory
DROP constraint FK_ProdID;
select * from Inventory;
CREATE TABLE Purchase_Order
(
PurchaseOrderID int identity(1,1) NOT NULL,
ProductID int NOT NULL,
VendorID int NOT NULL,
Description nvarchar(100) NOT NULL,
PurchaseQuantity int NOT NULL,
UnitOfMeasure nvarchar(45) NOT NULL,
CostPrice money NOT NULL,
ShipMethod nvarchar(45) NOT NULL,
PurchaseDate datetime NOT NULL,
ShipDate datetime NOT NULL,
OrderStatus nvarchar(45) NOT NULL,
constraint PK_PurID PRIMARY KEY (PurchaseOrderID),
constraint FK_Prd_Prch_Ord_ProdID FOREIGN KEY (ProductID)
REFERENCES Product (ProductID),
constraint FK_VendID FOREIGN KEY (VendorID)
REFERENCES Vendor (VendorID),
CONSTRAINT CK_PRCH_ORD_UOM CHECK
(UnitOfMeasure IN ('Kg', 'Litre', 'Each', 'Case')),
CONSTRAINT CK_PRCH_ORD_SHP_MTHD CHECK
(ShipMethod IN ('Standard', 'Express')),
CONSTRAINT CK_PRCH_ORD_ORD_STS CHECK
(OrderStatus IN ('Canceled','Declined','Pending','Shipped','In Transit','Complete'))
)
;
ALTER TABLE Purchase_Order
ADD constraint FK_VNDR_Prch_Ord_VendID FOREIGN KEY (VendorID)
REFERENCES Vendor (VendorID);
ALTER TABLE Purchase_Order
DROP constraint FK_VendID ;
select * from Purchase_Order;
CREATE TABLE Sale_Order
(
SaleOrderID int identity(1,1) NOT NULL,
ProductID int NOT NULL,
CustomersID int NOT NULL,
Description nvarchar(100) NOT NULL,
SaleQuantity int NOT NULL,
UnitOfMeasure nvarchar(45) NOT NULL,
SellingPrice money NOT NULL,
ShipMethod nvarchar(45) NOT NULL,
OrderDate datetime NOT NULL,
ShipDate datetime NOT NULL,
OrderStatus nvarchar(45) NOT NULL,
constraint PK_SaleID PRIMARY KEY (SaleOrderID),
constraint FK_Prd_Sale_Ord_ProdID FOREIGN KEY (ProductID)
REFERENCES Product (ProductID),
constraint FK_Cust_Sale_Ord_CustID FOREIGN KEY (CustomersID)
REFERENCES Customer (CustomersID),
CONSTRAINT CK_SALE_ORD_UOM CHECK
(UnitOfMeasure IN ('Kg', 'Litre', 'Each', 'Case')),
CONSTRAINT CK_SALE_ORD_SHP_MTHD CHECK
(ShipMethod IN ('Standard', 'Express')),
CONSTRAINT CK_SALE_ORD_ORD_STS CHECK
(OrderStatus IN ('Canceled','Declined','Pending','Shipped','In Transit','Complete'))
)
;
select * from Sale_Order;
| true |
e203a2ce00cc4c6005a655327e0f45f33be64d2f | SQL | ksmerwin/TravelAgency-CIS560 | /DataModeling/SQL/Reports/Agency.AgeReport.sql | UTF-8 | 1,007 | 4.3125 | 4 | [] | no_license | /*
Report query: Aggregates customers into three age categories, "Young Adult," "Middle Aged", and "Senior."
*/
CREATE OR ALTER PROC Agency.AgeReport
AS
SELECT
CASE
WHEN C.Age BETWEEN 16 AND 29 THEN 'Young Adult'
WHEN C.Age BETWEEN 30 AND 60 THEN 'Middle Aged'
WHEN C.Age > 60 THEN 'Senior'
END AS AgeGroup,
COUNT(C.CustomerID) AS [Count],
AVG(C.Budget) AS AverageBudget,
MIN(C.Budget) AS LowestBudget,
MAX(C.Budget) AS HighestBudget,
AVG(C.Age) AS AverageAge,
Count(T.TripID) AS TripCount
FROM Agency.Customer C
INNER JOIN Agency.Trips T ON C.CustomerID = T.CustomerID
INNER JOIN Agency.Reservations R ON T.TripID = R.TripID
INNER JOIN Airlines.BoardingPass BP ON R.ReservationID = BP.ReservationID
INNER JOIN Airlines.Flight F ON F.FlightID = BP.FlightID
INNER JOIN [Location].Cities CY ON CY.CityID = F.CityArrivalID
GROUP BY
CASE
WHEN C.Age BETWEEN 16 AND 29 THEN 'Young Adult'
WHEN C.Age BETWEEN 30 AND 60 THEN 'Middle Aged'
WHEN C.AGE > 60 THEN 'Senior'
END
| true |
bd3e8b45cd4bf6513d6aeca8e0638d567fa00953 | SQL | France-ioi/bebras-platform | /dbv_data/revisions/428/translations.sql | UTF-8 | 400 | 3.046875 | 3 | [
"MIT"
] | permissive | CREATE TABLE `translations` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`languageID` int(11) NOT NULL,
`category` varchar(50) CHARACTER SET utf8 NOT NULL,
`key` varchar(50) CHARACTER SET utf8 NOT NULL,
`translation` text CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `id_in_template` (`category`,`key`),
KEY `languageID` (`languageID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | true |
91e4159b4f7082b1f1a7fa311645e6e6ed47e06a | SQL | hashgraph/hedera-mirror-node | /hedera-mirror-importer/src/main/resources/db/migration/v1/V1.46.9__smart_contracts_children.sql | UTF-8 | 5,952 | 4 | 4 | [
"Apache-2.0"
] | permissive | -- Fixes up the smart contract tables after normalizing the contract result raw protobuf into discrete columns
alter table if exists contract
add column if not exists parent_id bigint null,
alter column memo set default '';
alter table if exists contract_history
add column if not exists parent_id bigint null,
alter column memo set default '',
alter column type set default 2;
alter table if exists entity_history
add column if not exists parent_id bigint null,
alter column memo set default '';
create temp table if not exists contract_transaction on commit drop as
select consensus_timestamp, entity_id, initial_balance, type
from transaction
where entity_id is not null
and type in (7, 8, 9, 22);
-- Update the contract_result.amount from the contract call to clear the previous erroneous value from the last migration.
update contract_result cr
set amount = null
from contract_transaction ct
where cr.consensus_timestamp = ct.consensus_timestamp
and ct.type = 7;
-- Update the contract_result.amount from the contract create transaction.initial_balance.
update contract_result cr
set amount = ct.initial_balance
from contract_transaction ct
where cr.consensus_timestamp = ct.consensus_timestamp
and ct.type = 8;
-- Update the contract_result.contract_id from transaction.entity_id since it wasn't always populated correctly by main nodes
update contract_result cr
set contract_id = ct.entity_id
from contract_transaction ct
where cr.consensus_timestamp = ct.consensus_timestamp
and ct.entity_id is not null
and (cr.contract_id is null or cr.contract_id <= 0);
-- Create a map of parent contract IDs to created child contract IDs. In some HAPI versions, created_contract_ids can
-- also contain the parent so we exclude self-references.
create temporary table if not exists contract_relationship on commit drop as
select consensus_timestamp, contract_id as parent_contract_id, created_contract_ids[i] as child_contract_id
from (
select consensus_timestamp,
contract_id,
created_contract_ids,
generate_subscripts(created_contract_ids, 1) as i
from contract_result
where array_length(created_contract_ids, 1) > 0
and contract_id is not null
) children
where contract_id <> created_contract_ids[i];
-- Move child contract IDs still marked as accounts in entity table to the contract table
with deleted_entity as (
delete from entity e using contract_relationship cr where e.id = cr.child_contract_id returning *
)
insert
into contract (auto_renew_period,
created_timestamp,
deleted,
expiration_timestamp,
id,
key,
memo,
num,
proxy_account_id,
public_key,
realm,
shard,
timestamp_range)
select auto_renew_period,
created_timestamp,
deleted,
expiration_timestamp,
id,
key,
memo,
num,
proxy_account_id,
public_key,
realm,
shard,
timestamp_range
from deleted_entity;
-- Upsert the child contract. If the child ID doesn't exist copy the fields from the parent. If it does, update using
-- the merged parent and child fields.
insert
into contract (auto_renew_period,
created_timestamp,
deleted,
expiration_timestamp,
file_id,
id,
key,
memo,
num,
obtainer_id,
parent_id,
proxy_account_id,
public_key,
realm,
shard,
timestamp_range,
type)
select coalesce(child.auto_renew_period, parent.auto_renew_period),
coalesce(child.created_timestamp, cr.consensus_timestamp),
coalesce(child.deleted, parent.deleted),
coalesce(child.expiration_timestamp, parent.expiration_timestamp),
coalesce(child.file_id, parent.file_id),
cr.child_contract_id,
coalesce(child.key, parent.key),
coalesce(child.memo, parent.memo, ''),
cr.child_contract_id & 4294967295, -- Extract the num from the last 32 bits of the entity id
coalesce(child.obtainer_id, parent.obtainer_id),
cr.parent_contract_id,
coalesce(child.proxy_account_id, parent.proxy_account_id),
coalesce(child.public_key, parent.public_key),
coalesce(child.realm, parent.realm, 0),
coalesce(child.shard, parent.shard, 0),
case
when lower(child.timestamp_range) > 0 then child.timestamp_range
else int8range(cr.consensus_timestamp, null) end,
coalesce(parent.type, 2)
from contract_relationship cr
left join contract child on child.id = cr.child_contract_id
left join contract parent on parent.id = cr.parent_contract_id
on conflict (id)
do update set auto_renew_period = excluded.auto_renew_period,
created_timestamp = excluded.created_timestamp,
deleted = excluded.deleted,
expiration_timestamp = excluded.expiration_timestamp,
file_id = excluded.file_id,
key = excluded.key,
memo = excluded.memo,
num = excluded.num,
obtainer_id = excluded.obtainer_id,
parent_id = excluded.parent_id,
proxy_account_id = excluded.proxy_account_id,
public_key = excluded.public_key,
realm = excluded.realm,
shard = excluded.shard,
timestamp_range = excluded.timestamp_range,
type = excluded.type;
| true |
a2172f0c7ccfdd31c2fa1a6ccca2266f8a6e962e | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/high/day18/select1653.sql | UTF-8 | 178 | 2.65625 | 3 | [] | no_license |
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-17T16:53:00Z' AND timestamp<'2017-11-18T16:53:00Z' AND temperature>=22 AND temperature<=70
| true |
d785246f77f7e41e8b32788178fae825fd3e3c5e | SQL | BG30/eHealth | /smarthealth.sql | UTF-8 | 6,375 | 3.390625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 11, 2018 at 06:06 AM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 7.2.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `smarthealth`
--
-- --------------------------------------------------------
--
-- Table structure for table `administrator`
--
CREATE TABLE `administrator` (
`adminId` int(9) NOT NULL,
`name` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`phoneNo` int(10) NOT NULL,
`address` varchar(30) NOT NULL,
`password` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `appointment`
--
CREATE TABLE `appointment` (
`appointNo` int(9) NOT NULL,
`doctorId` int(9) NOT NULL,
`healthNo` int(9) NOT NULL,
`day` varchar(10) NOT NULL,
`status` int(11) NOT NULL,
`time` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `doctor`
--
CREATE TABLE `doctor` (
`doctorId` int(9) NOT NULL,
`name` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`medicalLicense` varchar(10) NOT NULL,
`businessLicense` varchar(10) NOT NULL,
`phoneNo` int(10) NOT NULL,
`address` varchar(30) NOT NULL,
`specializations` varchar(40) NOT NULL,
`degrees` varchar(40) NOT NULL,
`password` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `insurance`
--
-- Error reading structure for table smarthealth.insurance: #1932 - Table 'smarthealth.insurance' doesn't exist in engine
-- Error reading data for table smarthealth.insurance: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM `smarthealth`.`insurance`' at line 1
-- --------------------------------------------------------
--
-- Table structure for table `medication`
--
CREATE TABLE `medication` (
`prescriptionNo` varchar(8) NOT NULL,
`healthNo` int(9) NOT NULL,
`medicineName` varchar(25) NOT NULL,
`dosage` varchar(30) NOT NULL,
`medicineTakeDate` date NOT NULL,
`appointNo` int(9) NOT NULL,
`medID` int(9) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `patient`
--
CREATE TABLE `patient` (
`healthNo` int(9) NOT NULL,
`name` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`phoneNo` int(9) NOT NULL,
`address` varchar(30) NOT NULL,
`gender` char(1) NOT NULL,
`insuranceAccountNo` varchar(10) DEFAULT NULL,
`password` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `payment`
--
CREATE TABLE `payment` (
`transactionNo` varchar(8) NOT NULL,
`cardType` char(1) NOT NULL,
`cardNo` int(16) NOT NULL,
`healthNo` int(9) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `record`
--
CREATE TABLE `record` (
`recordNo` int(6) NOT NULL,
`healthNo` int(9) NOT NULL,
`appointNo` int(6) DEFAULT NULL,
`prescriptionNo` varchar(8) NOT NULL,
`observations` varchar(100) NOT NULL,
`testResult` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `administrator`
--
ALTER TABLE `administrator`
ADD PRIMARY KEY (`adminId`);
--
-- Indexes for table `appointment`
--
ALTER TABLE `appointment`
ADD PRIMARY KEY (`appointNo`),
ADD KEY `doctorId` (`doctorId`),
ADD KEY `healthNo` (`healthNo`);
--
-- Indexes for table `doctor`
--
ALTER TABLE `doctor`
ADD PRIMARY KEY (`doctorId`);
--
-- Indexes for table `medication`
--
ALTER TABLE `medication`
ADD PRIMARY KEY (`prescriptionNo`),
ADD KEY `appointNo` (`appointNo`),
ADD KEY `healthNo` (`healthNo`);
--
-- Indexes for table `patient`
--
ALTER TABLE `patient`
ADD PRIMARY KEY (`healthNo`),
ADD KEY `insuranceAccountNo` (`insuranceAccountNo`);
--
-- Indexes for table `payment`
--
ALTER TABLE `payment`
ADD PRIMARY KEY (`transactionNo`),
ADD KEY `healthNo` (`healthNo`);
--
-- Indexes for table `record`
--
ALTER TABLE `record`
ADD PRIMARY KEY (`recordNo`),
ADD KEY `healthNo` (`healthNo`),
ADD KEY `appointNo` (`appointNo`),
ADD KEY `prescriptionNo` (`prescriptionNo`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `appointment`
--
ALTER TABLE `appointment`
ADD CONSTRAINT `appointment_ibfk_1` FOREIGN KEY (`doctorId`) REFERENCES `doctor` (`doctorId`),
ADD CONSTRAINT `appointment_ibfk_2` FOREIGN KEY (`healthNo`) REFERENCES `patient` (`healthNo`);
--
-- Constraints for table `medication`
--
ALTER TABLE `medication`
ADD CONSTRAINT `medication_ibfk_1` FOREIGN KEY (`appointNo`) REFERENCES `appointment` (`appointNo`),
ADD CONSTRAINT `medication_ibfk_2` FOREIGN KEY (`healthNo`) REFERENCES `patient` (`healthNo`);
--
-- Constraints for table `patient`
--
ALTER TABLE `patient`
ADD CONSTRAINT `patient_ibfk_1` FOREIGN KEY (`insuranceAccountNo`) REFERENCES `insurance` (`InsuranceAccountNo`);
--
-- Constraints for table `payment`
--
ALTER TABLE `payment`
ADD CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`healthNo`) REFERENCES `patient` (`healthNo`);
--
-- Constraints for table `record`
--
ALTER TABLE `record`
ADD CONSTRAINT `record_ibfk_1` FOREIGN KEY (`healthNo`) REFERENCES `patient` (`healthNo`),
ADD CONSTRAINT `record_ibfk_2` FOREIGN KEY (`appointNo`) REFERENCES `appointment` (`appointNo`),
ADD CONSTRAINT `record_ibfk_3` FOREIGN KEY (`prescriptionNo`) REFERENCES `medication` (`prescriptionNo`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
95256e6c7d2c1aa42fd24426530cb2ce487e373b | SQL | Lundalogik/LimeBootstrapAppStore | /businessOverview/install/scp_BusinessOverviewTranslation.sql | ISO-8859-1 | 2,170 | 2.828125 | 3 | [] | no_license | insert into localize ([status], createduser, updateduser, [timestamp], createdtime,
[owner], code,
sv, [no], en_us,
context, lookupcode)
VALUES (0, 1, 1, GETDATE(), GETDATE(),
'app_businessoverview', 'lasthistorie',
'dag sedan sista kontakten', 'dag siden sist kontakt', 'day since last contact',
'Translation for the app "business overview"', 'Localize.GetText("app_BusinessOverview", "lasthistorie")'),
(0, 1, 1, GETDATE(), GETDATE(),
'app_businessoverview', 'lasthistories',
'dager sedan sista kontakten', 'dager siden sist kontakt', 'days sinse last contact',
'Translation for the app "business overview"', 'Localize.GetText("app_BusinessOverview", "lasthistories")'),
(0, 1, 1, GETDATE(), GETDATE(),
'app_businessoverview', 'nohist',
'Ingen historik att hmta frn', 'Ingen historie hente fra', 'No history on this customer',
'Translation for the app "business overview"', 'Localize.GetText("app_BusinessOverview", "nohist")'),
(0, 1, 1, GETDATE(), GETDATE(),
'app_businessoverview', 'salesopp',
'Frsljning mj.', 'Salgs mulig.', 'Sales opp.',
'Translation for the app "business overview"', 'Localize.GetText("app_BusinessOverview", "salesop")'),
(0, 1, 1, GETDATE(), GETDATE(),
'app_businessoverview', 'saleswon',
'Svensk?', 'Totalt solgt', 'Total won',
'Translation for the app "business overview"', 'Localize.GetText("app_BusinessOverview", "saleswon")'),
(0, 1, 1, GETDATE(), GETDATE(),
'app_businessoverview', 'activesos',
'Aktive SOS!', 'Aktive SOS!', 'Active SOS!',
'Translation for the app "business overview"', 'Localize.GetText("app_BusinessOverview", "activesos")'),
(0, 1, 1, GETDATE(), GETDATE(),
'app_businessoverview', 'noactivesos',
'Aktive SOS :D', 'Aktive SOS :D', 'Active SOS :D',
'Translation for the app "business overview"', 'Localize.GetText("app_BusinessOverview", "noactivesos")'),
(0, 1, 1, GETDATE(), GETDATE(),
'app_businessoverview', 'totalactivesos',
'Totalt', 'Total', 'In Total',
'Translation for the app "business overview"', 'Localize.GetText("app_BusinessOverview", "totalactivesos")')
--select * from localize order by createdtime desc
--delete from localize where [owner] = 'app_businessoverview' | true |
ed09db617caaeb6a6b07de1e12712ec9c6123fbd | SQL | SF-Felling7/new-pet_hotel | /pet_hotel_db.sql | UTF-8 | 924 | 3.65625 | 4 | [] | no_license | CREATE TABLE owners (
owner_id SERIAL PRIMARY KEY NOT NULL,
owner_name VARCHAR(12),
address VARCHAR(25),
phone VARCHAR(13)
);
CREATE TABLE pets (
pet_id SERIAL PRIMARY KEY NOT NULL,
pet_name VARCHAR(20),
color VARCHAR(13),
Breed VARCHAR(20)
);
CREATE TABLE visits (
visit_id SERIAL PRIMARY KEY NOT NULL,
check_in TIMESTAMP,
CHECK_OUT TIMESTAMP,
pet_id references (pets_id)
);
CREATE TABLE owner_pet
(
owner_id int NOT NULL,
pet_id int NOT NULL,
owner_id,
pet_id
FOREIGN KEY (owner_id) REFERENCES owners (owner_id),
FOREIGN KEY (pet_id) REFERENCES pets (pet_id)
)
INSERT INTO pets (pet_id, pet_name, color, breed) VALUES ( '2', 'spot', 'grey', 'boxer' );
INSERT INTO pets (pet_id, pet_name, color, breed) VALUES ('3', 'fluffy', 'black', 'boxer' );
INSERT INTO pets (pet_id, pet_name, color, breed) VALUES ('4', 'tinker', 'grey', 'lab' );
| true |
f6f3007cf375a44ce924b08c1326364b88d1ca19 | SQL | MarceloData/apiPHP | /apiMySql.sql | UTF-8 | 1,862 | 3.53125 | 4 | [] | no_license | CREATE TABLE `users` (
`id` int PRIMARY KEY AUTO_INCREMENT,
`id_groups` int UNIQUE,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`avatar` varchar(255),
`birthday` timestamp,
`password` varchar(255) NOT NULL,
`token` varchar(255),
`created_at` timestamp DEFAULT (now()),
`updated_at` timestamp DEFAULT (now())
);
CREATE TABLE `contacts` (
`id` int PRIMARY KEY AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`created_at` timestamp DEFAULT (now()),
`updated_at` timestamp DEFAULT (now())
);
CREATE TABLE `images` (
`id` int PRIMARY KEY AUTO_INCREMENT,
`slug` varchar(255),
`title` varchar(255) NOT NULL,
`url_image` varchar(255) NOT NULL,
`id_user` int NOT NULL,
`created_at` timestamp DEFAULT (now()),
`updated_at` timestamp DEFAULT (now())
);
CREATE TABLE `permissions` (
`id` int PRIMARY KEY AUTO_INCREMENT,
`name` varchar(255),
`description` text,
`created_at` timestamp DEFAULT (now()),
`updated_at` timestamp DEFAULT (now())
);
CREATE TABLE `groups` (
`id` int PRIMARY KEY AUTO_INCREMENT,
`name` varchar(255),
`permissions_id` varchar(255),
`id_user` int,
`created_at` timestamp DEFAULT (now()),
`updated_at` timestamp DEFAULT (now())
);
CREATE TABLE `messages` (
`id` int PRIMARY KEY AUTO_INCREMENT,
`id_contact` int NOT NULL,
`message` text NOT NULL,
`created_at` timestamp DEFAULT (now()),
`updated_at` timestamp DEFAULT (now())
);
CREATE TABLE `history` (
`id` int PRIMARY KEY AUTO_INCREMENT,
`id_user` int NOT NULL,
`description` text,
`created_at` timestamp DEFAULT (now())
);
ALTER TABLE `messages` ADD FOREIGN KEY (`id_contact`) REFERENCES `contacts` (`id`);
ALTER TABLE `history` ADD FOREIGN KEY (`id_user`) REFERENCES `users` (`id`);
ALTER TABLE `images` ADD FOREIGN KEY (`id_user`) REFERENCES `users` (`id`);
| true |
4d913a2232c98c9e4cf8811d9a9748e0723caa95 | SQL | FahadAminShovon/SQLZOO_solutions | /solves/solve3.sql | UTF-8 | 2,579 | 4.46875 | 4 | [] | no_license | --1.
--Change the query shown so that it displays Nobel prizes for 1950.
SELECT yr, subject, winner
FROM nobel
WHERE yr = 1950
--2.
--Show who won the 1962 prize for Literature.
SELECT winner
FROM nobel
WHERE yr = 1962
AND subject = 'Literature'
--3.
--Show the year and subject that won 'Albert Einstein' his prize.
SELECT yr,subject FROM nobel
WHERE winner = 'Albert Einstein'
--4.
--Give the name of the 'Peace' winners since the year 2000, including 2000.
SELECT winner FROM nobel WHERE
yr >= 2000 AND subject = 'Peace'
--5.
--Show all details (yr, subject, winner) of the Literature prize winners for 1980 to 1989 inclusive.
SELECT yr,subject,winner FROM nobel WHERE
yr>=1980 AND yr<=1989 AND subject = 'Literature'
--6.
--Show all details of the presidential winners:
-- Theodore Roosevelt
-- Woodrow Wilson
-- Jimmy Carter
-- Barack Obama
SELECT * FROM nobel WHERE
winner IN
('Theodore Roosevelt','Woodrow Wilson','Jimmy Carter','Barack Obama')
--7.
--Show the winners with first name John
SELECT winner FROM nobel WHERE winner LIKE 'John%'
--8.
--Show the year, subject, and name of Physics winners
-- for 1980 together with the Chemistry winners for 1984.
SELECT yr,subject,winner FROM nobel WHERE
(yr = 1980 AND subject = 'Physics') OR (yr = 1984 AND subject = 'Chemistry')
--9.
--Show the year, subject, and name of winners for 1980 excluding Chemistry and Medicine
SELECT yr,subject,winner FROM nobel WHERE
yr = 1980 AND subject <> 'Chemistry' AND subject <> 'Medicine'
--10.
--Show year, subject, and name of people who won a 'Medicine' prize
--in an early year (before 1910, not including 1910)
--together with winners of a 'Literature' prize in a later year (after 2004, including 2004)
SELECT yr,subject,winner FROM nobel WHERE
(yr < 1910 AND subject = 'Medicine') OR (yr>=2004 AND subject = 'Literature')
--11.
--Find all details of the prize won by PETER GRÜNBERG
SELECT * FROM nobel
WHERE
winner = 'PETER GRÜNBERG'
--12.
--Find all details of the prize won by EUGENE O'NEILL
SELECT * FROM nobel
WHERE
winner = 'EUGENE O''NEILL'
--13.
--Knights in order
--List the winners, year and subject where the winner starts
--with Sir. Show the the most recent first, then by name order.
SELECT winner,yr,subject FROM nobel WHERE
winner LIKE 'SIR%' ORDER BY yr DESC, winner
--14.
--The expression subject IN ('Chemistry','Physics') can be used as a value - it will be 0 or 1.
--Show the 1984 winners and subject ordered by subject
--and winner name; but list Chemistry and Physics last.
SELECT winner, subject
FROM nobel
WHERE yr=1984
ORDER BY
CASE WHEN subject IN ('Chemistry','Physics') THEN 1 ELSE 0 END,subject,winner | true |
fd2d88292fe8ce37501539bf016b27719b59e405 | SQL | naomiwhidden/innovation_challenge_testing | /redonkulator_app/db/demo.sql | UTF-8 | 5,295 | 3.734375 | 4 | [] | no_license | -- User logs into the website for the first time, creates self in users table
insert into users (email, edipi, display_name, phone)
VALUES ('christopher.breen@usmc.mil', '1111111111', 'Breen MGySgt Christopher P', '619-701-2017');
-- User creates a a new exercise
insert into exercises (exercise, evolution, start_date, end_date)
VALUES ('MEFEX', '21.1', '2020-11-13', '2020-11-18');
-- User adds their own unit to the db
insert into units (uic, short_name, long_name, mcc, ruc, type)
VALUES ('M20129', 'CE III MEF', 'Command Element III MEF', '000', '20381', 'Inf Bn');
-- auto-generate own permissions entry for self on first unit
insert into permissions (unit_id, exercise_id, user_id)
VALUES ((select id from units where uic = 'M20129'),
(select id from exercises where exercise = 'MEFEX' and evolution = '21.1'),
(select id from users where email = 'christopher.breen@usmc.mil'));
-- add second logistician
insert into users (email)
VALUES ('jon.smith@usmc.mil');
insert into permissions (unit_id, exercise_id, parent_user_id, user_id)
VALUES ((select id from units where uic = 'M20129'),
(select id from exercises where exercise = 'MEFEX' and evolution = '21.1'),
(select id from users where email = 'christopher.breen@usmc.mil'),
(select id from users where email = 'jon.smith@usmc.mil'));
-- create adam smith in users table
insert into users (email)
VALUES ('adam.smith@usmc.mil');
-- adding smith to exercise with invalid parent succeeds as parent allows null; must first get id of current user
-- and ensure a non-null id is obtained before continuing insertion with current user as parent.
insert into permissions (unit_id, exercise_id, parent_user_id, user_id)
VALUES ((select id from units where uic = 'M20129'),
(select id from exercises where exercise = 'MEFEX' and evolution = '21.1'),
(select id from users where email = 'no_exist@mail.mil'),
(select id from users where email = 'adam.smith@usmc.mil'));
-- cleanup above erroneous entry
delete
from permissions
where user_id = (select id from users where email = 'adam.smith@usmc.mil');
-- add non-existent user fails. Must insert email into users table as part of pipeline for creating new permission.
insert into permissions (unit_id, exercise_id, parent_user_id, user_id)
VALUES ((select id from units where uic = 'M20129'),
(select id from exercises where exercise = 'MEFEX' and evolution = '21.1'),
(select id from users where email = 'christopher.breen@usmc.mil'),
(select id from users where email = 'no_exist@usmc.mil'));
-- successfully add existing user into permissions with current user as parent.
insert into permissions (unit_id, exercise_id, parent_user_id, user_id)
VALUES ((select id from units where uic = 'M20129'),
(select id from exercises where exercise = 'MEFEX' and evolution = '21.1'),
(select id from users where email = 'christopher.breen@usmc.mil'),
(select id from users where email = 'adam.smith@usmc.mil'));
-- populate unit EDL with generic inventory (new/edit unit page). Vision: generic inventory becomes baseline inventory
-- from TFSMS, GCSS, CLC2S, etc. A unit starts out by replicating OUR best assumption of what they should have, then
-- they can add/modify/delete their actual EDL as they see fit. At any time (someone screws it up too bad), they could
-- revert back to our best guess. Best guess (generic_inventory) could be updated regularly with newly published TO&E's
-- or other source data.
insert into unit_edl (unit_id, equipment_id, quantity) ((select '1', equipment_id, quantity
from generic_edl
where unit_type = 'Inf Bn'));
-- add CAB unit
insert into units (uic, short_name, long_name, mcc, ruc, type)
VALUES ('M12345', '1st CAB', '1st Combat Assault Battallion', '001', '20382', 'CAB');
-- add generic inventory to CAB
insert into unit_edl (unit_id, equipment_id, quantity) ((select '2', equipment_id, quantity
from generic_edl
where unit_type = 'CAB'));
-- populate climates: Conventional Hot Tropical, Conventional Hot Arid, Conventional Temperate, Conventional Cold
-- Integrated (CBRN wpn use anticipated) Hot Tropical, etc...
insert into climates (climate)
VALUES ('CHT'),
('CHA'),
('CT'),
('CC'),
('IHT'),
('IHA'),
('IT'),
('IC');
-- thought: if this app is used by higher-level OPT planners prior to detailed planning, there may not be any
-- logistician names to associate with units until some time after planning has begun. We may want to default to best
-- guess for planning factors, human resources, and equip edl. When a local unit logO
-- planning factors
insert into exercise_unit_planning_factors (unit_id, exercise_id, aslt_rom, aslt_op_hours, sustain_rom,
sustain_op_hours, climate_id, min_class_one_water_gal,
sustain_class_one_water_gals)
VALUES ('1', '1', 3.0, 18.0, 3.0, 12.0, (select id from climates where climate = 'CT'), 2.0, 7.0);
-- UI diagram modified to allow for personnel to be added to as many locations as needed (and custom location names).
-- i.e. AE, AFOE, etc.
-- TODO:validate all On Update/Delete constraints
| true |
b407db3993ea1c32b0acfa64713a040aabe65b56 | SQL | TheChanec/mcs.repository | /Database/dbo/Stored Procedures/Procs2/mcs_ResetInvoiceToBeResentToNewInvoiceByWorkOrderNum.sql | UTF-8 | 396 | 2.984375 | 3 | [] | no_license | create procedure dbo.mcs_ResetInvoiceToBeResentToNewInvoiceByWorkOrderNum @work_order_num bigint
as
update mcs_output_files
set mcs_output_files.new_inv_extract_flag = null
from mcs_output_files
inner join wo_invc
on wo_invc.wo_invc_id = mcs_output_files.wo_invc_id
inner join work_orders
on work_orders.wo_id = wo_invc.wo_id
and work_orders.work_order_num = @work_order_num
| true |
7c1b143c7edcece7748afae1aec6d27868d508bd | SQL | pablobergna/TPDATOS | /PRACTICA/Gestion de Datos - Ejercicios/PracticaSQL/08.sql | ISO-8859-1 | 599 | 3.96875 | 4 | [] | no_license | SELECT e.d_elemento, (SELECT TOP 1 SUM(s.canitdad)
FROM dbo.STOCK s JOIN dbo.DEPOSITO d ON d.id_deposito = s.id_deposito
WHERE s.id_elemento = e.id_elemento
GROUP BY d.id_deposito
ORDER BY SUM(s.canitdad) DESC) AS 'Stock en el depsito que ms tiene'
FROM dbo.ELEMENTO e JOIN dbo.PRODUCTO p ON e.id_elemento = p.id_elemento
WHERE (SELECT COUNT(DISTINCT id_deposito) FROM dbo.DEPOSITO)
= (SELECT COUNT(DISTINCT d.id_deposito) FROM dbo.DEPOSITO d JOIN dbo.STOCK s ON d.id_deposito = s.id_deposito WHERE s.id_elemento = e.id_elemento)
GROUP BY e.id_elemento, e.d_elemento | true |
833ed6b31e901be54cf4bac896b631c104b11a88 | SQL | ParsianInsuranceGIT/sanam | /queries/Delete Karmozd.sql | UTF-8 | 1,267 | 3.234375 | 3 | [] | no_license | -------------------------------------Report-------------------------------------
--select count(kargst.karmozd_amount),sum(kargst.karmozd_amount),
-- krnama.namayande_id,krnama.amount ,
-- crdbt.amount_long as credebit_amount,krnama.id as karmozd_namayande_id, crdbt.id as credebit_id
--from tbl_karmozd_ghest kargst
--join tbl_ghest gst on kargst.ghest_id = gst.id
--join tbl_karmozd_namayande krnama on krnama.id=kargst.karmozd_namayande_id
--join tbl_credebit crdbt on crdbt.id = krnama.credebit_id
--join tbl_ghestBandi gstbndi on gst.ghestbandi_id = gstbndi.id
--join tbl_bimename b on gstbndi.bimename_id = b.bimename_id
--join tbl_pishnehad p on p.bimename_bimename_id = b.bimename_id
--where p.options is null and p.namayande_poshtiban_id is null
--group by krnama.namayande_id, krnama.amount, crdbt.amount_long, krnama.id, crdbt.id --and p.namayande_id=515040
-----------------------------------DELETE---------------------------------------
DELETE FROM tbl_karmozd_ghest;
DELETE FROM tbl_karmozd_namayande;
DELETE FROM tbl_credebit WHERE credebit_type='PARDAKHT_KARMOZD' or credebit_type='BARGASHT_KARMOZD';
--
update tbl_ghest
set karmozd_paid=null
, karmozd_real=null;
DELETE FROM tbl_karmozd ;
update tbl_bimename set bimename_karmozd=null; | true |
f4039d49966ccd0a87da5e11e26daf3175ad9a3b | SQL | wsigma21/sql_exercises | /introduction/question46.sql | UTF-8 | 391 | 3.390625 | 3 | [] | no_license | -- 副問い合わせを使って全体の平均身長と各ポジションの平均身長を抽出する。
-- select (select position,avg(height) from players group by position)
-- ans
-- 2列目はavg(height)でないと各ポジションの平均身長にならないよね?
select position,avg(height), (select avg(height) from players) as avg_height
from players
group by position
; | true |
25b657faa789e83ccb6e79121462f3bceacda8e0 | SQL | hkq325800/book | /book_empty.sql | UTF-8 | 9,129 | 3.359375 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : apartment
Source Server Version : 50620
Source Host : localhost:3306
Source Database : book
Target Server Type : MYSQL
Target Server Version : 50620
File Encoding : 65001
Date: 2014-12-29 08:38:20
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `bookactivity`
-- ----------------------------
DROP TABLE IF EXISTS `bookactivity`;
CREATE TABLE `bookactivity` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`act_period` varchar(255) NOT NULL COMMENT '活动时间段',
`act_budget` int(11) NOT NULL COMMENT '活动预算',
`act_status` varchar(255) NOT NULL COMMENT '活动状态',
`created_at` date NOT NULL COMMENT '创建日期',
`updated_at` date NOT NULL COMMENT '更新时间',
`act_cost` float DEFAULT NULL COMMENT '活动花费',
`act_message` varchar(255) DEFAULT NULL COMMENT '活动公示',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of bookactivity
-- ----------------------------
-- ----------------------------
-- Table structure for `bookbasic`
-- ----------------------------
DROP TABLE IF EXISTS `bookbasic`;
CREATE TABLE `bookbasic` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '书类编号',
`book_isbn` varchar(255) NOT NULL COMMENT '唯一isbn',
`book_name` varchar(255) NOT NULL COMMENT '书本名称',
`book_author` varchar(255) NOT NULL DEFAULT '未知' COMMENT '书本作者',
`book_pub` varchar(255) DEFAULT NULL COMMENT '出版版次',
`book_type` varchar(255) NOT NULL COMMENT '书本类型',
`book_edit` varchar(255) DEFAULT NULL COMMENT '出版社团',
`book_price` float(11,1) NOT NULL DEFAULT '0.0' COMMENT '书本价格',
`book_pic` text NOT NULL COMMENT '书图片url',
`book_link` text COMMENT '书相关url',
`book_info` text COMMENT '书本简介',
`favour` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数目',
`deleted_at` timestamp(6) NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of bookbasic
-- ----------------------------
-- ----------------------------
-- Table structure for `bookcirculate`
-- ----------------------------
DROP TABLE IF EXISTS `bookcirculate`;
CREATE TABLE `bookcirculate` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`book_kind` int(11) NOT NULL,
`book_id` int(11) NOT NULL COMMENT '与书关联',
`user_id` int(11) NOT NULL COMMENT '用户关联',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`deleted_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of bookcirculate
-- ----------------------------
-- ----------------------------
-- Table structure for `booklike`
-- ----------------------------
DROP TABLE IF EXISTS `booklike`;
CREATE TABLE `booklike` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`book_kind` int(11) NOT NULL COMMENT '与类关联',
`user_id` int(11) NOT NULL COMMENT '与人关联',
`deleted_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of booklike
-- ----------------------------
-- ----------------------------
-- Table structure for `booklist`
-- ----------------------------
DROP TABLE IF EXISTS `booklist`;
CREATE TABLE `booklist` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '清单编号',
`book_kind` int(11) NOT NULL COMMENT '与类关联',
`book_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '录入时间',
`book_status` varchar(255) NOT NULL DEFAULT '未被借' COMMENT '书本状态',
`act_id` int(11) NOT NULL DEFAULT '0' COMMENT '活动相关',
`deleted_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of booklist
-- ----------------------------
-- ----------------------------
-- Table structure for `bookmessage`
-- ----------------------------
DROP TABLE IF EXISTS `bookmessage`;
CREATE TABLE `bookmessage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`book_kind` int(11) NOT NULL COMMENT '与类关联',
`user_id` int(11) NOT NULL COMMENT '与人关联',
`user_message` varchar(255) NOT NULL COMMENT '留言信息',
`created_at` date NOT NULL COMMENT '创建日期',
`updated_at` date NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of bookmessage
-- ----------------------------
-- ----------------------------
-- Table structure for `recommend`
-- ----------------------------
DROP TABLE IF EXISTS `recommend`;
CREATE TABLE `recommend` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '推荐编号',
`user_id` int(11) NOT NULL COMMENT '与人关联',
`book_kind` int(11) NOT NULL COMMENT '与类关联',
`rec_reason` varchar(255) NOT NULL COMMENT '推荐理由',
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
`buy_link` text NOT NULL COMMENT '购买链接',
`rec_type` varchar(255) NOT NULL COMMENT '推荐类别',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of recommend
-- ----------------------------
-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
`user_id` int(11) NOT NULL COMMENT '用户学号',
`user_name` varchar(255) NOT NULL COMMENT '用户姓名',
`user_password` varchar(255) NOT NULL COMMENT '用户密码',
`user_rank` varchar(255) NOT NULL DEFAULT '普通用户' COMMENT '用户等级',
`remember_token` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', '11101018', '李智', '1a48d1844d6ca6b456dd931d227f9843', '普通用户', null);
INSERT INTO `user` VALUES ('2', '12108129', '吴伟', '25946b36d3d2b1473b13492f4f3761b7', '普通用户', null);
INSERT INTO `user` VALUES ('3', '12108135', '张坚革', 'c52ab205539e00d8ac9e5117235fb6d3', '普通用户', null);
INSERT INTO `user` VALUES ('4', '12108139', '郑齐阳', '3bb9f156e763d3313a1527b1046cd99e', '普通用户', null);
INSERT INTO `user` VALUES ('5', '12108201', '白林林', '06267320e3540d239e2b14140b6cc67b', '普通用户', null);
INSERT INTO `user` VALUES ('6', '12108203', '彭雅丽', 'ca91f19d6d4f72aba7e085faf9a4caca', '普通用户', null);
INSERT INTO `user` VALUES ('7', '12108206', '边涛', 'c9b866aad15452c1b9901c2911ff5afb', '普通用户', null);
INSERT INTO `user` VALUES ('8', '12108208', '陈浩', 'e5d723350c7164a530769048b7547c96', '普通用户', null);
INSERT INTO `user` VALUES ('9', '12108209', '陈露耿', '41ca4c23cd320607c3fdfba9cc9ffdb5', '普通用户', null);
INSERT INTO `user` VALUES ('10', '12108210', '陈轲', 'eaa449211dd0cf977a026ebcdf2f3fe9', '普通用户', null);
INSERT INTO `user` VALUES ('11', '12108211', '段鹏飞', '2880067adbe0aca9e828e647b1569ddc', '普通用户', null);
INSERT INTO `user` VALUES ('12', '12108216', '李金祥', 'd6962e4c46547fc647cb2d9189e8b74c', '普通用户', null);
INSERT INTO `user` VALUES ('13', '12108222', '沈之川', 'ac677272ad2b6480bc834aa15a681e3c', '普通用户', null);
INSERT INTO `user` VALUES ('14', '12108227', '熊君睿', '0e44b4c6c34dc8ce18c01770219ca1e1', '普通用户', null);
INSERT INTO `user` VALUES ('15', '12108230', '章晨昱', '84b1df4354bdce1324009d97073e3856', '普通用户', null);
INSERT INTO `user` VALUES ('16', '12108234', '张旭', 'fec6b9b77656406c09ef0c06017f252a', '普通用户', null);
INSERT INTO `user` VALUES ('17', '12108238', '钟云昶', '6da788b5325d4e487f38930e2cd90c08', '图书管理', null);
INSERT INTO `user` VALUES ('18', '12108305', '王雪莹', '12bb5766cc55ef0e09aa196e20959729', '普通用户', null);
INSERT INTO `user` VALUES ('19', '12108306', '曹平涛', 'c304fb8318c7a552a4e241e1b3c5c2dc', '普通用户', null);
INSERT INTO `user` VALUES ('20', '12108309', '程彦', '2f7a10e0faa742d8f5f4665d6e4f3e05', '普通用户', null);
INSERT INTO `user` VALUES ('21', '12108315', '刘宏志', '416418370ccae48a1a8861a78860902f', '普通用户', null);
INSERT INTO `user` VALUES ('22', '12108316', '刘铁', '770653b67a74cf253287e0536970c779', '普通用户', null);
INSERT INTO `user` VALUES ('23', '12108318', '罗鹏展', '2733b73426c8d43db20f607f886f51f7', '普通用户', null);
INSERT INTO `user` VALUES ('24', '12108327', '谢俊杰', 'b6c63bc373200d84c0020d7f5b7c6ef2', '购书管理', null);
INSERT INTO `user` VALUES ('25', '12108331', '许鹏飞', '5370b00a2b3f1a75512ee6facf57127d', '普通用户', null);
INSERT INTO `user` VALUES ('26', '12108413', '黄可庆', 'ca8e4dea8b6c7e5dffb81548989ea0b2', '普通用户', null);
| true |
00cd97f4ed0b53e814c984559c8c14ec772c3832 | SQL | polarbears-xzf/xzfgit | /zoeMonitor/checkup_report/content_project_info.sql | UTF-8 | 2,157 | 2.828125 | 3 | [] | no_license | -- Created in 2018.10.11 by polarbears
-- Copyright (c) 20xx, CHINA and/or affiliates.
-- All rights reserved.
-- Name:
-- content_project_info.sql
-- Description:
-- 基本说明
-- Relation:
-- 对象关联
-- Notes:
-- 基本注意事项
-- 修改 - (年-月-日) - 描述
--
-- =======================================
-- 项目基本信息
-- =======================================
-- 巡检系统名称
-- 操作系统版本
-- 数据库名称
-- 数据库版本
-- 数据库创建时间
-- 服务器ip信息
set markup html off
prompt <H3 class='zoecomm'> <center><a name="00002"></a> 项目基本信息 </center> </H3> <br>
--定义巡检系统
column systemname NEW_VALUE systemname noprint
select decode('&checkupSystem','his','HIS系统','emr','EMR系统','hdc','HDC系统','hip','HIP系统','其它系统') as "systemname" from dual;
--定义数据库名称
column db_name NEW_VALUE db_name noprint
select value as "db_name" from V$parameter where name='db_name';
--定义数据库版本
column banner NEW_VALUE db_version noprint
select banner as "banner" from v$version where banner like 'Oracle Database%';
--定义数据库创建时间
column dbcreate NEW_VALUE db_create noprint
select created as "dbcreate" from V$DATABASE;
--定义数据库大小
column db_size NEW_VALUE db_size noprint
select trunc(sum(bytes)/1024/1024/1024,2)||'G' as "db_size" from dba_data_files;
prompt <center> <table WIDTH=600 BORDER=1>
prompt <tr>
prompt <th> 属性 </th>
prompt <th> 属性值 </th>
prompt </tr>
prompt <tr>
prompt <td> 系统名称 </td>
prompt <td> &systemname </td>
prompt </tr>
prompt <tr>
prompt <td> 数据库名称 </td>
prompt <td> &db_name </td>
prompt </tr>
prompt <tr>
prompt <td> 数据库版本 </td>
prompt <td> &db_version </td>
prompt </tr>
prompt <tr>
prompt <td> 数据库创建时间</td>
prompt <td> &db_create </td>
prompt </tr>
prompt <tr>
prompt <td> 数据库大小</td>
prompt <td> &db_size </td>
prompt </tr>
prompt </table> </center> <br>
prompt <center> <a href="#top">Back to Top </a></center><br>
| true |
e4b1270db0d34a54698287480a7087ca50921b69 | SQL | jmakine/Tsoha-Bootstrap | /sql/add_test_data.sql | UTF-8 | 1,423 | 3.28125 | 3 | [] | no_license | -- Lisää INSERT INTO lauseet tähän tiedostoon
--Kayttaja -taulun testi-data
INSERT INTO Kayttaja(tunnus, salasana) VALUES ('jenni', 'penninenn');
--Luokka -taulun testi-data
INSERT INTO Luokka(nimi, luotu_pvm, kuvaus, luokka_id, kayttaja_id)
VALUES ('Arkiaskareet', NOW(), 'Tänne perus kotihommia, mm. siivoiluja, ostoksia ym. muistettavaa.', NULL, 1), -- id = 1
('Muutto', NOW(), 'Muuttoon liittyvät tehtävät.', NULL, 1), -- id = 2
('Luokka3', NOW(), 'Sisältää luokan4', NULL, 1), --id = 3
('Luokka4', NOW(), 'Sisältyy luokkaan 3', 3, 1); -- id = 4
--Tehtava -taulun testi-data
INSERT INTO Tehtava (nimi, deadline, luotu_pvm, kuvaus, tarkeys, luokka_id, kayttaja_id)
VALUES ('Maksa laskut', '15.11.2017', NOW(),'sähkö, netti, vuokra, visa,...', 'korkea', 1, 1),
('Pese ikkunat', NULL, NOW(), NULL, 'matala', 1, 1),
('Tee muuttoilmoitus', '30.11.2017', NOW(), NULL, 'korkea', 2, 1),
('Siirrä sähkösopimus', '25.11.2017', NOW(),'Nykyinen sopimus Fortumilla, kilpailuta ennen kun vaihdat.', 'neutraali', 2, 1),
('Varaa hammaslääkäri', NULL, NOW(),'09-123456789', NULL, NULL, 1),
('Käy kaupassa', '3.12.2017', NOW(), NULL ,NULL, NULL, 1),
('Testi1', '20.11.2017', NOW(), NULL, 'korkea', 3, 1),
('Testi2', NULL, NOW(),'123', 'matala', 3, 1),
('Testi3', '12.12.2017', NOW(),'diibadaa', NULL, 4, 1);
| true |
39fc2bff2ddbb965f6d80625a0c3ee506463fb55 | SQL | AbidRaza1/Querying-Adventure-works-database | /SQLQuery11.sql | UTF-8 | 1,419 | 3.546875 | 4 | [] | no_license |
SELECT MAX(UnitPrice) FROM SalesLT.SalesOrderDetail
SELECT * FROM SalesLT.Product
WHERE ListPrice >
(SELECT MAX(UnitPrice) FROM SalesLT.SalesOrderDetail)
SELECT CustomerID, SalesOrderID
FROM SalesLT.SalesOrderHeader AS S01
ORDER BY CustomerID, SalesOrderID
SELECT CustomerID, SalesOrderID, OrderDate
FROM SalesLT.SalesOrderHeader AS SO1
WHERE orderdate =
(SELECT MAX(orderdate)
FROM SalesLT.SalesOrderHeader)
SELECT CustomerID, SalesOrderID, OrderDate
FROM SalesLT.SalesOrderHeader AS SO1
WHERE orderdate =
(SELECT MAX(orderdate)
FROM SalesLT.SalesOrderHeader AS SO2
WHERE SO2.CustomerID = SO1.CustomerID)
ORDER BY CustomerID
SELECT *
FROM SalesLT.SalesOrderDetail
SELECT *
FROM SalesLT.Product
SELECT ProductID, Name, ListPrice
FROM SalesLT.Product
WHERE ProductID IN
-- select ProductID from the appropriate table
(SELECT ProductID FROM SalesLT.SalesOrderDetail
WHERE UnitPrice < 100)
AND ListPrice >= 100
ORDER BY ProductID;
-- select SalesOrderID, CustomerID, FirstName, LastName, TotalDue from the appropriate tables
sp_helptext'udfMaxUnitPrice'
SELECT SOH.SalesOrderID, MUP.MaxUnitPrice
FROM SalesLT.SalesOrderHeader as SOH
CROSS APPLY SalesLT.udfMaxUnitPrice(SOH.SalesPrderID) AS MUP
ORDER BY SOH.SalesOrderID
SELECT * FROM SalesLT.CustomerAddress
SELECT * FROM SalesLT.Address
| true |
f0ccf930aa1130ed6dab40d1a59c5b08ff22b0e8 | SQL | heartbeat007/sql_prac | /thirtythree.sql | UTF-8 | 415 | 3.65625 | 4 | [] | no_license | /*
Enter your query here.
THE CODE IS TRICKY LET ME EXPLAIN
THE QUESTION IS
Query the Western Longitude (LONG_W) for the largest Northern Latitude (LAT_N) in STATION that is less than 137.2345.
SELECT THE LONG_W FROM THE MAXIMUM VALUE OF THE LIST ,THE LIST WHICH IS LESS THAN 137.2345;
WE NEED A SUB QUARY
*/
SELECT ROUND(LONG_W,4) FROM STATION WHERE LAT_N=(SELECT MAX(LAT_N) FROM STATION WHERE LAT_N < 137.2345);
| true |
4d541c1915462d962aca8907adfb0ff0d3799f8f | SQL | nip3o/tddd43 | /lab1/lab1-contents.sql | UTF-8 | 547 | 2.921875 | 3 | [] | no_license |
INSERT INTO `Expert` (`id`, `name`, `email`)
VALUES
(1,'Niclas Olofsson','nicol271@student.liu.se'),
(2,'Holger Grenquist','holger@grenquist.se');
(3,'Arne Anka','arne@anka.se');
INSERT INTO `ExpertArea` (`id`, `description`, `parent`)
VALUES
(1,'Computer Science',NULL),
(2,'Databases',1),
(3,'SQL',2),
(4,'Programming',1);
INSERT INTO `Expertise` (`expert`, `expertArea`)
VALUES
(1,3),
(2,4);
INSERT INTO `Recommendation` (`id`, `justification`, `authorExpert`, `recommendedExpert`)
VALUES
(1,'He has completed the TDDD43 LAB 1',2,1),
(2,'Has given me a bar of chocolate',3,2);
| true |
02780558227a9bacf2bd9c249ab2f0072bcd9a43 | SQL | SandipDankhra/SQL | /Module_5/Exercise_1(Solution).sql | UTF-8 | 484 | 2.96875 | 3 | [] | no_license | use AdventureWorks
CREATE TABLE SALES.MEDIAOUTLET (
MEDIAOUTLETID INT NOT NULL PRIMARY KEY IDENTITY(1,1),
MEDIAOUTLETNAME NVARCHAR(40),
PRIMARYCONTACT NVARCHAR (50),
CITY NVARCHAR (50)
);
DROP TABLE SALES.MEDIAOUTLET;
CREATE TABLE SALES.PRINTMEDIAPLACEMENT(
PRINTMEDIAPLACEMENTID INT NOT NULL PRIMARY KEY IDENTITY(1,1),
MEDIAOUTLETID INT,
PLACEMENTDATE DATETIME,
PUBLICATIONDATE DATETIME,
RELATEDPRODUCTID INT,
PLACEMENTCOST DECIMAL(18,2)
);
DROP TABLE SALES.PRINTMEDIAPLACEMENT; | true |
e52981662412e0f32fc2a55017d84d85f6f5e88e | SQL | Peadz/MEDAS_1_19-20 | /TRAN Octavia/modele.sql | UTF-8 | 5,900 | 3.234375 | 3 | [
"CC0-1.0"
] | permissive | -- MySQL Script generated by MySQL Workbench
-- Wed Apr 22 21:58:41 2020
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `mydb` ;
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`Especes`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`Especes` ;
CREATE TABLE IF NOT EXISTS `mydb`.`Especes` (
`id_espece` INT NOT NULL,
`nom` VARCHAR(45) NOT NULL,
`description` LONGTEXT NULL,
PRIMARY KEY (`id_espece`),
UNIQUE INDEX `id_especes_UNIQUE` (`id_espece` ASC)
)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Secteurs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`Secteurs` ;
CREATE TABLE IF NOT EXISTS `mydb`.`Secteurs` (
`id_secteur` INT NOT NULL,
`nom` VARCHAR(45) NOT NULL,
`description` LONGTEXT NULL,
PRIMARY KEY (`id_secteur`),
UNIQUE INDEX `id_secteur_UNIQUE` (`id_secteur` ASC) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Enclos`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`Enclos` ;
CREATE TABLE IF NOT EXISTS `mydb`.`Enclos` (
`id_enclos` INT NOT NULL,
`superficie` INT NOT NULL,
`Animaux_id_animal` INT NOT NULL,
`Secteurs_id_secteur` INT NOT NULL,
PRIMARY KEY (`id_enclos`, `Animaux_id_animal`, `Secteurs_id_secteur`),
UNIQUE INDEX `id_enclos_UNIQUE` (`id_enclos` ASC) ,
INDEX `fk_Enclos_Secteurs1_idx` (`Secteurs_id_secteur` ASC) ,
CONSTRAINT `fk_Enclos_Secteurs1`
FOREIGN KEY (`Secteurs_id_secteur`)
REFERENCES `mydb`.`Secteurs` (`id_secteur`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Zoos`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`Zoos` ;
CREATE TABLE IF NOT EXISTS `mydb`.`Zoos` (
`id_zoo` INT NOT NULL,
`nom` VARCHAR(45) NOT NULL,
`pays` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id_zoo`),
UNIQUE INDEX `id_zoo_UNIQUE` (`id_zoo` ASC) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Animaux`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`Animaux` ;
CREATE TABLE IF NOT EXISTS `mydb`.`Animaux` (
`id_animal` INT NOT NULL,
`nom` VARCHAR(45) NOT NULL,
`date_naissance` DATE NOT NULL,
`sexe` TINYINT NOT NULL,
`taille` INT NOT NULL,
`Especes_id_espece` INT NOT NULL,
`Enclos_id_enclos1` INT NULL,
`Zoos_id_zoo_origine` INT NOT NULL,
`Zoos_id_zoo_courant` INT NOT NULL,
PRIMARY KEY (`id_animal`, `Especes_id_espece`),
UNIQUE INDEX `id_animal_UNIQUE` (`id_animal` ASC) ,
INDEX `fk_Animaux_Especes1_idx` (`Especes_id_espece` ASC) ,
INDEX `fk_Animaux_Enclos1_idx` (`Enclos_id_enclos1` ASC) ,
INDEX `fk_Animaux_Zoos2_idx` (`Zoos_id_zoo_origine` ASC) ,
INDEX `fk_Animaux_Zoos1_idx` (`Zoos_id_zoo_courant` ASC) ,
CONSTRAINT `fk_Animaux_Especes1`
FOREIGN KEY (`Especes_id_espece`)
REFERENCES `mydb`.`Especes` (`id_espece`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Animaux_Enclos1`
FOREIGN KEY (`Enclos_id_enclos1`)
REFERENCES `mydb`.`Enclos` (`id_enclos`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Animaux_Zoos2`
FOREIGN KEY (`Zoos_id_zoo_origine`)
REFERENCES `mydb`.`Zoos` (`id_zoo`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Animaux_Zoos1`
FOREIGN KEY (`Zoos_id_zoo_courant`)
REFERENCES `mydb`.`Zoos` (`id_zoo`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Soignants`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`Soignants` ;
CREATE TABLE IF NOT EXISTS `mydb`.`Soignants` (
`id_soignant` INT NOT NULL,
`nom` VARCHAR(45) NOT NULL,
`date_naissance` DATE NOT NULL,
`date_recrutement` DATE NOT NULL,
`date_expiration` DATE NULL,
PRIMARY KEY (`id_soignant`),
UNIQUE INDEX `id_soignant_UNIQUE` (`id_soignant` ASC) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Soignants_has_Animaux`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`Soignants_has_Animaux` ;
CREATE TABLE IF NOT EXISTS `mydb`.`Soignants_has_Animaux` (
`Soignants_id_soignant` INT NOT NULL,
`Animaux_id_animal` INT NOT NULL,
PRIMARY KEY (`Soignants_id_soignant`, `Animaux_id_animal`),
INDEX `fk_Soignants_has_Animaux_Animaux1_idx` (`Animaux_id_animal` ASC) ,
INDEX `fk_Soignants_has_Animaux_Soignants1_idx` (`Soignants_id_soignant` ASC) ,
CONSTRAINT `fk_Soignants_has_Animaux_Soignants1`
FOREIGN KEY (`Soignants_id_soignant`)
REFERENCES `mydb`.`Soignants` (`id_soignant`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Soignants_has_Animaux_Animaux1`
FOREIGN KEY (`Animaux_id_animal`)
REFERENCES `mydb`.`Animaux` (`id_animal`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true |
dbf3aabf949f732d2c0842a40dc48a3ca8c9d114 | SQL | vltsu/spring_crud | /src/main/resources/db/migration/V1__create_user_table.sql | UTF-8 | 322 | 2.546875 | 3 | [] | no_license | CREATE TABLE users (
email varchar(100) not null primary key,
name varchar(100) DEFAULT ''::character varying,
password varchar(100) not null,
image text,
enabled boolean NOT NULL DEFAULT false,
created_at timestamp(0) with time zone NOT NULL,
updated_at timestamp(0) with time zone NOT NULL
); | true |
0b5604e3c0875d8db9d18fd3bcec0ac8e3b83cf4 | SQL | fagoner/japser-demo-report | /db/sql/V1_0__init.sql | UTF-8 | 315 | 3 | 3 | [] | no_license | USE back;
CREATE TABLE IF NOT EXISTS `back`.`category`(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
created_at DATETIME NOT NULL,
active BOOLEAN NOT NULL,
PRIMARY KEY(id)
);
INSERT INTO back.category(name, created_at, active)
VALUES ("Demo Category", NOW(), 1);
| true |
d22ff7f74c6cadca2917cc30ce81067c86ab25d3 | SQL | KeishawnJohnson/projectTwo | /clothingtable.sql | UTF-8 | 1,100 | 3.84375 | 4 | [] | no_license | ### Schema
drop database outfits_db;
CREATE DATABASE outfits_db;
USE outfits_db;
#Table for outfits
#User has the ability to add up to 4 seasons for a specific item (Only the first one is mandatory)
#User is able to add up 4 occasions (fomral, work, athletic, casual)
#User can choose one of the following clothing types (top, bottom, shoes, accessory)
CREATE TABLE outfit
(
id int NOT NULL AUTO_INCREMENT,
type varchar(255) NOT NULL,
color VARCHAR(255) NOT NULL,
season VARCHAR(50) NOT NULL,
occasion VARCHAR(50) not null,
gender VARCHAR(50) NOT NULL,
url VARCHAR(50) ,
PRIMARY KEY (id)
);
INSERT INTO outfit (type, color, season, occasion, gender)
VALUES ('top', 'white', 'summer', 'work', 'male');
INSERT INTO outfit (type, color, season, occasion, gender)
VALUES ('top', 'black', 'spring', 'casual', 'male');
INSERT INTO outfit (type, color, season, occasion, gender)
VALUES ('bottom', 'Blue', 'summer', 'work', 'male');
INSERT INTO outfit (type, color, season, occasion, gender)
VALUES ('dress', 'black', 'winter', 'athletic', 'female');
select * from outfit
; | true |
cc144a67b2e568eae76445efbc2abd0098c96b39 | SQL | naichadadui/trivial-git | /src/main/resources/db/migration/V2__20180107_insert_questions.sql | UTF-8 | 1,444 | 2.703125 | 3 | [] | no_license | INSERT INTO `questions` VALUES (1, 1, '从抹香鲸体内提炼出的香料是', '龙涎香', '百里香', '沉水香', '麝香');
INSERT INTO `questions` VALUES (2, 1, '血管破裂时,血液中的什么物质会凝结成块,堵住破裂部分以止血?', '血小板', '红血球', '白血球', '血清');
INSERT INTO `questions` VALUES (3, 1, '在所有巨大的猛兽中,哪种动物的心脏最小?', '狮子', '老虎', '野猪', '猎豹');
INSERT INTO `questions` VALUES (4, 1, '鲸的心脏每小时跳动多少次?', '540次', '600次', '650次', '700次');
INSERT INTO `questions` VALUES (5, 1, '吸烟有害,烟草中毒性最大的物质是哪个?', '烟碱', '烟焦油', '亚硝胺', '砷');
INSERT INTO `questions` VALUES (6, 0, '奥林匹克运动会的发源地是', '古希腊', '古罗马', '古代中国', '古巴比伦');
INSERT INTO `questions` VALUES (7, 0, '下列体育项目哪项不是奥运会\"五项全能\"之一?', '跳高', '200米', '跳远', '1500米');
INSERT INTO `questions` VALUES (8, 0, '高尔夫球运动的运动场上共有多少个球洞?', '18个', '19个', '20个', '21个');
INSERT INTO `questions` VALUES (9, 0, '我国第一个获得世界冠军的是誰?', '容国团', '吴传玉', '郑凤荣', '陈镜开');
INSERT INTO `questions` VALUES (10, 0, '体操比赛中有四个动作以我国运动员的名字命名,其中鞍马是', '童非', '李宁', '李月久', '李小双'); | true |
c594df70db2a63f09f9a0d97a74eb018b8a4efcd | SQL | brunarafaela/aulas_laboratorio_banco_de_dados | /atividade05_correcao.sql | UTF-8 | 5,808 | 4 | 4 | [] | no_license | /******************************************************************************************
Atividade 05 - Escreva a instrução em SQL para responder às seguintes consultas:
1) Mostre o nome, e-mail dos alunos, nome do curso e turma, para os alunos
que fizeram cursos em que não se matricularam homens;
******************************************************************************************/
SELECT a.nome_aluno, a.email_aluno, c.id_curso, c.nome_curso, t.num_turma AS Turma
FROM aluno a JOIN matricula mt ON ( a.id_aluno = mt.id_aluno)
JOIN turma t ON ( mt.num_turma = t.num_turma AND mt.id_curso = t.id_curso)
JOIN curso c ON ( c.id_curso = t.id_curso)
WHERE mt.id_curso NOT IN (
SELECT mt.id_curso
FROM aluno a JOIN matricula mt
ON ( a.id_aluno = mt.id_aluno)
WHERE a.sexo_aluno = 'M' ) ;
/*** 2) Mostre o nome dos fabricantes de software que ainda não tem softwares usados em cursos.
Faça de três formas diferentes sendo uma com junção externa. ****/
-- juncao externa
SELECT fsw.nome_fabr, s.id_softw AS Software, usw.id_software AS Uso
FROM fabricante_softw fsw JOIN software s
ON s.id_fabr = fsw.id_fabr
LEFT JOIN uso_softwares_curso usw
ON usw.id_software = s.id_softw -- uso softw x softw
WHERE usw.id_software IS NULL ;
-- NOT IN
SELECT fsw.nome_fabr, s.id_softw AS Software
FROM fabricante_softw fsw, software s
WHERE s.id_fabr = fsw.id_fabr
AND s.id_softw NOT IN (
SELECT usw.id_software FROM uso_softwares_curso usw ) ; -- softwares usados
-- MINUS
SELECT fsw.nome_fabr
FROM fabricante_softw fsw, software s
WHERE s.id_fabr = fsw.id_fabr
AND s.id_softw IN (
SELECT s.id_softw FROM software s -- todos os softwares
MINUS
SELECT usw.id_software FROM uso_softwares_curso usw ) ; -- software usados
SELECT * FROM fabricante_softw fsw ;
SELECT * FROM uso_softwares_curso usw ;
SELECT * FROM software s ;
INSERT INTO software VALUES ( 'SAPR3', 'SAP R3', '3.1', 'Windows 10', 'SAP', 50) ;
/*** 3) Mostrar o nome do curso, valor do curso, turma, data de início e horário das aulas
para as turmas que ainda não começaram, mas não tem ninguém matriculado.
Mostre por extenso o horário da aula, por exemplo : SEGUNDA,QUARTA E SEXTA-FEIRA.
Use junção externa. Faça de duas formas : com DECODE e outra com CASE. ****/
INSERT INTO turma VALUES (2, 'DBA1', current_date + 20 , current_date + 50 , 50, 'Seg-Qua-Sex 19-22h',
750, 'Rebecca Stanfield', 'ATIVA' , 'OCP') ;
--DECODE
SELECT c.nome_curso, t.vl_curso As Valor, t.num_turma, t.dt_inicio AS Inicio, t.dt_termino AS Termino,
DECODE( UPPER(t.horario_aula), 'SEG-QUA-SEX' , 'SEGUNDA-QUARTA-SEXTA 19-22h',
'TER-QUI' , 'TERCA-QUINTA 19-22h') AS Horario, mt.id_aluno AS Matriculado
FROM curso c JOIN turma t ON ( c.id_curso = t.id_curso)
LEFT JOIN matricula mt ON ( mt.num_turma = t.num_turma AND mt.id_curso = t.id_curso)
WHERE t.dt_inicio > current_date
AND mt.id_aluno IS NULL ;
-- CASE
SELECT c.nome_curso, t.vl_curso As Valor, t.num_turma, t.dt_inicio AS Inicio, t.dt_termino AS Termino,
CASE
WHEN UPPER(t.horario_aula) LIKE 'SEG-QUA-SEX%' THEN 'SEGUNDA-QUARTA-SEXTA 19-22h'
WHEN UPPER(t.horario_aula) LIKE 'TER-QUI%' THEN 'TERCA-QUINTA 19-22h'
END AS Horario, mt.id_aluno AS Matriculado
FROM curso c JOIN turma t ON ( c.id_curso = t.id_curso)
LEFT JOIN matricula mt ON ( mt.num_turma = t.num_turma AND mt.id_curso = t.id_curso)
WHERE t.dt_inicio > current_date
AND mt.id_aluno IS NULL ;
/*** 4) Mostrar para os cursos de certificações 'PROFESSIONAL' as turmas que tem alunos matriculados
mas o curso ainda não aulas programadas: Nome do curso, nome da certificação, quantidade de aulas,
nome do aluno, sexo, código da turma, data de início e data prevista de término; ****/
SELECT c.nome_curso, ce.nome_cert, c.qtde_aulas, a.nome_aluno, a.sexo_aluno,
t.num_turma, t.dt_inicio AS Inicio, t.dt_termino AS Termino, au.id_curso AS Aula
FROM aluno a JOIN matricula mt ON ( a.id_aluno = mt.id_aluno)
JOIN turma t ON ( mt.num_turma = t.num_turma AND mt.id_curso = t.id_curso)
JOIN curso c ON ( c.id_curso = t.id_curso)
JOIN certificacao ce ON ( ce.id_cert = c.id_cert)
LEFT JOIN aula au ON ( au.id_curso = c.id_curso)
WHERE UPPER ( ce.nome_cert) LIKE '%PROFESSIONAL%'
AND au.id_curso IS NULL ;
/*** 5) Mostrar o nome do curso e a turma para os cursos que não são de certificações 'INSTRUCTOR'
e que tiveram mais de R$ 2mil de arrecadação na turma e com mais de 90% de preenchimento de vagas. ****/
SELECT t.id_curso, c.nome_curso, t.num_turma, SUM(mt.vl_pago) AS Arrecadacao, COUNT(mt.id_aluno) AS Matriculados
FROM aluno a JOIN matricula mt ON ( a.id_aluno = mt.id_aluno)
JOIN turma t ON ( mt.num_turma = t.num_turma AND mt.id_curso = t.id_curso)
JOIN curso c ON ( c.id_curso = t.id_curso)
JOIN certificacao ce ON ( ce.id_cert = c.id_cert)
WHERE UPPER ( ce.nome_cert) NOT LIKE '%INSTRUCTOR%'
GROUP BY t.id_curso, c.nome_curso, t.num_turma
HAVING SUM(mt.vl_pago) > 2000
AND COUNT(mt.id_aluno)/ ( SELECT MAX(t1.vagas) FROM turma t1
WHERE t1.num_turma = t.num_turma AND t1.id_curso = t.id_curso) >= 0.9 ; | true |
759a71b01d7084558ff489230bf97fb152a21496 | SQL | jimmyjzemoso/test_scripts | /script2.sql | UTF-8 | 1,614 | 4.09375 | 4 | [] | no_license |
INSERT INT0 udm_product
SELECT ${:udm_s_product::s.%1$s AS %1&S},
SELECT ${columns:udm_s_product:~Availability: COALESCE(dw.%1&s,sparse.%1&s AS %1&s},
CASE
WHEN COALESCE(sparse.Availability,0) > 0
THEN "Available"
ELSE "No"
END AS Availability,
CASE
WHEN (CASE
WHEN COALESCE(sparse.Availability,0) > 0
THEN "Available"
ELSE "No"
END AS Availability)<>COALESCE(dw.Availability,"")
AND
COALESCE(dw.Availability,"")<>""
THEN COALESCE(sparse.RowModified,dw.RowModified)+1
ELSE COALESCE(sparse.RowModified,dw.RowModified)
END AS RowModified
FROM udm_product dw
FULL OUTER JOIN
((SELECT ${:udm_s_product:~SourceProductNumber,c_colorname,productUrl: p.%1$s AS %1&S},
SUBSTRING(SourceProductNumber,4) AS SourceProductNumber,
t1.c_colorname as c_colorname,
CONCAT(t1.ProductUrl,"_",t1.c_colorname)
FROM udm_s_product) p
LEFT OUTER JOIN(
SELECT SourceProductColorNumber,
CASE
WHEN map_values (collect_max (COALESCE(c_colorname,''),CASE WHEN c_colorname IS NULL then 0L else RowModified END))[0]= 0L THEN NULL
ELSE map_keys (collect_max (COALESCE(c_colorname,''),CASE WHEN c_colorname IS NULL then 0L else RowModified END))[0]
END AS c_colorname
FROM (
SELECT SourceProductColorNumber,c_colorname,RowModified
FROM udm_s_c_productColor
UNION ALL
SELECT SourceProductColorNumber,c_colorname,RowModified
FROM udm_c_productColor)
GROUP BY SourceProductNumber) t1
ON p.SourceProductNumber = t1.SourceProductColorNumber)sparse
ON dw.SourceProductNumber = sparse.SourceProductNumber
)s
;
| true |
45a6f1f655eaa78910ad1706d0ba19a8d28a156d | SQL | ypfedotov/user-registry | /backend/src/main/resources/db/migration/V2__user_table.sql | UTF-8 | 312 | 2.734375 | 3 | [] | no_license | CREATE TYPE gender_type AS ENUM ('MALE', 'FEMALE');
CREATE TABLE userregistry.user (
id UUID PRIMARY KEY,
full_name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
username VARCHAR(255) NOT NULL UNIQUE,
date_of_birth DATE NULL,
gender gender_type NULL,
photo TEXT NULL
);
| true |
7b5da1efb1bd6c339fd3f6abe5f5ae03d22c39c1 | SQL | vinoth12940/StallionsCCNewSite | /src/main/resources/sqlScripts/scorecard-details.sql | UTF-8 | 3,378 | 3.46875 | 3 | [] | no_license | --
-- Table structure for Score card Details--
--
-- Stallions Score Card --
--
USE `stallionc_cricket_club`;
DROP TABLE IF EXISTS `stallions_scorecard`;
CREATE TABLE `stallions_scorecard` (
`score_card_id` int(11) NOT NULL,
`tournament_id` varchar(50) NOT NULL,
`playersSk` int(11) NOT NULL,
`match_id` varchar(50) NOT NULL,
`player_name` varchar(50) NOT NULL,
`player_role` varchar(50) NOT NULL,
`is_rested` tinyint(1) NOT NULL,
`comments` varchar(500) NOT NULL,
`batting_runs_scored` int(5),
`batting_balls_faced` int(5),
`batting_fours` int(5),
`batting_six` int(5),
`batting_how_out` varchar(50),
`batting_fielder_name` varchar(50),
`batting_Wicket_by_Bowler` varchar(15) ,
`batting_order_of_Wicket` int(5) ,
`batting_fall_of_Wicket` varchar(5) ,
`batting_wicket_on_over` float(5) ,
`bowling_spell_order` int(5) ,
`bowling_over` float(5) ,
`bowling_maiden` int(5),
`bowling_wicket` int(5),
`bowling_runs_conceded` int(5),
`bowling_wides` int(5),
`bowling_no_balls` int(5),
`fielding_catches_taken` int(5),
`fielding_catches_dropped` int(5),
`fielding_total_catches` int(5),
`fielding_WK_catches` int(5),
`fielding_WK_stumped` int(5),
`extras_byes` int(5),
`extras_leg_byes` int(5),
`extras_total_wides` int(5),
`extras_no_balls` int(5),
`stallions_total` int(5),
`match_key_note` varchar(5000),
PRIMARY KEY (`score_card_id`),
CONSTRAINT `stallions_scorecard_ibfk_1` FOREIGN KEY (`tournament_id`) REFERENCES `tournament_detail` (`tournament_id`),
CONSTRAINT `stallions_scorecard_ibfk_2` FOREIGN KEY (`playersSk`) REFERENCES `player_profile` (`playersSk`),
CONSTRAINT `stallions_scorecard_ibfk_3` FOREIGN KEY (`match_id`) REFERENCES `match_detail` (`match_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Opponent Score Card --
--
DROP TABLE IF EXISTS `opponent_scorecard`;
CREATE TABLE `opponent_scorecard` (
`score_card_id` int(11) NOT NULL,
`tournament_id` varchar(50) NOT NULL,
`match_id` varchar(50) NOT NULL,
`player_name` varchar(50) NOT NULL,
`player_role` varchar(50) NOT NULL,
`batting_runs_scored` int(5),
`batting_balls_faced` int(5),
`batting_fours` int(5),
`batting_six` int(5),
`batting_how_out` varchar(50),
`batting_fielder_name` varchar(50),
`batting_Wicket_by_Bowler` varchar(15) ,
`batting_order_of_Wicket` int(5) ,
`batting_fall_of_Wicket` varchar(5) ,
`batting_wicket_on_over` float(5) ,
`bowling_spell_order` int(5) ,
`bowling_over` float(5) ,
`bowling_maiden` int(5),
`bowling_wicket` int(5),
`bowling_runs_conceded` int(5),
`bowling_wides` int(5),
`bowling_no_balls` int(5),
`fielding_catches_taken` int(5),
`fielding_catches_dropped` int(5),
`fielding_total_catches` int(5),
`fielding_WK_catches` int(5),
`fielding_WK_stumped` int(5),
`extras_byes` int(5),
`extras_leg_byes` int(5),
`extras_total_wides` int(5),
`extras_no_balls` int(5),
`opponent_total` int(5),
`match_key_note` varchar(5000),
CONSTRAINT `opponent_scorecard_ibfk_1` FOREIGN KEY (`tournament_id`) REFERENCES `tournament_detail` (`tournament_id`),
CONSTRAINT `opponent_scorecard_ibfk_2` FOREIGN KEY (`score_card_id`) REFERENCES `stallions_scorecard` (`score_card_id`),
CONSTRAINT `opponent_scorecard_ibfk_3` FOREIGN KEY (`match_id`) REFERENCES `match_detail` (`match_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; | true |
019fb6902ebbde2f1bdcf44bf826a86f26c525e4 | SQL | Falmmer/juke-swgoh-bot | /data/struct-update.sql | UTF-8 | 289 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | ALTER TABLE `alliances`
ADD `creation_date` DATE NULL DEFAULT NULL AFTER `name`,
ADD `update_ts` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `creation_date`;
ALTER TABLE `guilds`
ADD `officerCount` INT(1) UNSIGNED NULL DEFAULT NULL AFTER `memberCount`;
| true |
c3779b6b3741de6149c80e62bffbb7a49588345b | SQL | livelykitten/ccc2019fasting | /create.sql | UTF-8 | 2,797 | 4 | 4 | [] | no_license | DROP DATABASE IF EXISTS 18fasting;
CREATE DATABASE 18fasting;
USE 18fasting;
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS Classes;
DROP TABLE IF EXISTS Users;
DROP TABLE If EXISTS Bible;
SET FOREIGN_KEY_CHECKS=1;
CREATE TABLE Bible_lecture_time (
blt_id int not null auto_increment,
start_time timestamp not null default CURRENT_TIMESTAMP,
end_time timestamp not null default CURRENT_TIMESTAMP,
PRIMARY KEY (blt_id)
);
CREATE TABLE Classes_lecture_time (
clt_id int not null auto_increment,
start_time timestamp not null default CURRENT_TIMESTAMP,
end_time timestamp not null default CURRENT_TIMESTAMP,
PRIMARY KEY (clt_id)
);
CREATE TABLE Classes (
cid int not null auto_increment,
title varchar(255) not null,
speaker varchar(255) not null,
max int not null,
current int not null,
details varchar(3000),
field varchar(255),
link varchar(255),
CHECK (current <= max),
CHECK (current >= 0),
PRIMARY KEY (cid)
);
CREATE TABLE Bible (
bid int not null auto_increment,
title varchar(255) not null,
speaker varchar(255) not null,
max int not null,
current int not null,
details varchar(3000),
link varchar(255),
CHECK (current <= max),
CHECK (current >= 0),
PRIMARY KEY (bid)
);
CREATE TABLE Users (
uid int not null auto_increment,
name varchar(255) not null,
password varchar(255) not null,
earth varchar(255) not null,
campus varchar(255) not null,
year varchar(255) not null,
cid int,
bid int,
PRIMARY KEY (uid),
FOREIGN KEY (cid) REFERENCES Classes(cid) ON DELETE SET NULL,
FOREIGN KEY (bid) REFERENCES Bible(bid) ON DELETE SET NULL
);
-- returns minutes left before the next lecture
CREATE OR REPLACE VIEW Classes_countdown AS
SELECT
MIN(IFNULL((
SELECT MIN(IF(c.start_time > NOW(), TIMESTAMPDIFF(MINUTE, NOW(), c.start_time), 0))
FROM Classes_lecture_time c
WHERE NOW() <= c.end_time
), 0))
AS countdown;
CREATE OR REPLACE VIEW Bible_countdown AS
SELECT
MIN(IFNULL((
SELECT MIN(IF(b.start_time > NOW(), TIMESTAMPDIFF(MINUTE, NOW(), b.start_time), 0))
FROM Bible_lecture_time b
WHERE NOW() <= b.end_time
), 0))
AS countdown;
delimiter |
CREATE TRIGGER registerClass BEFORE UPDATE ON Classes
FOR EACH ROW BEGIN
IF NEW.current > NEW.max or NEW.current < 0 THEN
SIGNAL SQLSTATE '45000';
END IF;
END;
|
delimiter ;
delimiter |
CREATE TRIGGER registerBible BEFORE UPDATE ON Bible
FOR EACH ROW BEGIN
IF NEW.current > NEW.max or NEW.current < 0 THEN
SIGNAL SQLSTATE '45000';
END IF;
END;
|
delimiter ;
ALTER DATABASE 18fasting CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE Classes CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE Bible CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE Users CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; | true |
66f4d0e467e3834dbd8028a38aa241b9d607e22c | SQL | markkimsal/cognifty | /setup/upgrades/0006_0007/03_change_defaults.mysql.sql | UTF-8 | 2,202 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive |
# MySQL Diff 1.3.3
#
# http://www.mysqldiff.com
# (c) 2001-2003 Lippe-Net Online-Service
#
# Create time: 13.01.2008 23:20
#
# --------------------------------------------------------
# Source info
# Host: localhost
# Database: cgn_006
# --------------------------------------------------------
# Target info
# Host: localhost
# Database: cognifty
# --------------------------------------------------------
#
ALTER TABLE `cgn_article_publish`
ALTER `cgn_content_id` SET DEFAULT '',
ALTER `cgn_content_version` SET DEFAULT '';
ALTER TABLE `cgn_article_section_link`
ALTER `cgn_article_section_id` SET DEFAULT '',
ALTER `cgn_article_publish_id` SET DEFAULT '';
ALTER TABLE `cgn_file_publish`
ALTER `cgn_content_id` SET DEFAULT '',
ALTER `cgn_content_version` SET DEFAULT '';
ALTER TABLE `cgn_group`
ALTER `active_on` SET DEFAULT '';
ALTER TABLE `cgn_image_publish`
ALTER `cgn_content_id` SET DEFAULT '',
ALTER `cgn_content_version` SET DEFAULT '';
ALTER TABLE `cgn_menu_item`
ALTER `cgn_menu_id` SET DEFAULT '',
ALTER `obj_id` SET DEFAULT '';
ALTER TABLE `cgn_metadata`
ALTER `cgn_content_publish_id` SET DEFAULT '';
ALTER TABLE `cgn_metadata_publish`
ALTER `cgn_content_id` SET DEFAULT '';
ALTER TABLE `cgn_mxq_channel`
MODIFY `channel_type` char(10) NOT NULL DEFAULT 'point';
#
# Fieldformat of
# cgn_mxq_channel.channel_type changed from varchar(10) NOT NULL DEFAULT 'ps' to char(10) NOT NULL DEFAULT 'point'.
# Possibly data modifications needed!
#
CREATE TABLE IF NOT EXISTS `cgn_sess` (
`cgn_sess_id` integer (11) unsigned NOT NULL auto_increment,
`cgn_sess_key` varchar (100) NOT NULL,
`saved_on` int (11) NOT NULL default 0,
`data` longtext NOT NULL,
PRIMARY KEY (cgn_sess_id)
);
CREATE INDEX cgn_sess_key_idx ON cgn_sess (cgn_sess_key);
ALTER TABLE `cgn_sess` COLLATE utf8_collate_ci;
ALTER TABLE `cgn_sess`
ADD `saved_on` int(11) NOT NULL DEFAULT '0' AFTER cgn_sess_key,
MODIFY `cgn_sess_key` varchar(100) NOT NULL DEFAULT '';
#
# Fieldformat of
# cgn_sess.cgn_sess_key changed from varchar(255) NOT NULL DEFAULT '' to varchar(100) NOT NULL DEFAULT ''.
# Possibly data modifications needed!
#
| true |
e866214808d911e6a666f4b5a286d4e5dd2a7884 | SQL | Beachwhale13/DojoAssignments | /SQL/erd_lessons/Untitled.sql | UTF-8 | 205 | 3.3125 | 3 | [] | no_license | SELECT countries.name, government_form FROM countries
JOIN cities ON countries.id = cities.country_id
WHERE government_form = "Constitutional Monarchy"
AND life_expectancy > 75
AND countries.capital > 200
| true |
31a0d436ea133e8efff67c7d65ed9ca9efcb9e43 | SQL | andrewajlouny/cosc4800 | /COMPANY.sql | UTF-8 | 4,206 | 3.25 | 3 | [] | no_license | CREATE TABLE EMPLOYEE (Fname varchar,
Minit CHAR,
Lname varchar,
Ssn int,
Bdate DATE,
Address varchar,
Sex CHAr,
Salary INT,
Super_ssn INT,
Dno INT);
CREATE TABLE DEPARTMENT (Dname VARChar,
Dnumber INT,
Mhr_ssn int,
Mgr_start_date DAte);
CREATE TABLE DEPT_LOCATIONS (Dnumber int,
Dlocation varchar);
CREATE TABLE WORKS_ON (Essn int,
Pno INT,
Hours float);
create table PROJECT (Pname varchar,
Pnumber int,
Plocation varchar,
Dnum int);
CREATE TABLE DEPENDENT (Essn int,
Dependent_name varchar,
Sex char,
Bdate DATe,
Relationship varchar);
INSERT INTO EMPLOYEE VALUES ("John", 'B', "Smith", 123456789, 1965-01-09, "731 Fondren, Houston, TX", 'M', 30000, 333445555, 5),
("Franklin", 'T', "Wong", 333445555, 1955-12-08, "638 Voss, Houston, TX", 'M', 40000, 888665555, 5),
("Alicia", 'J', "Zelaya", 999887777, 1968-01-19, "3321 Castle, Spring, TX", 'F', 25000, 987654321, 4),
("Jennifer", 'S', "Wallace", 987654321, 1941-06-20, "291 Berry, Bellaire, TX", 'F', 43000, 888665555, 4),
("Ramesh", 'K', "Narayan", 666884444, 1962-09-15, "975 Fire Oak, Humble, TX", 'M', 38000, 333445555, 5),
("Joyce", 'A', "English", 453453453, 1972-07-31, "5631 Rice, Houston, TX", 'F', 25000, 333445555, 5),
("Ahmad", 'V', "Jabbar", 987987987, 1969-03-29, "980 Dallas, Houston, TX", 'M', 25000, 987654321, 4),
("James", 'E', "Borg", 888665555, 1937-11-10, "450 Stone, Houston, TX", 'M', 55000, NULL, 1);
INSERT INTO DEPARTMENT VALUES ("Research", 5, 333445555, 1988-05-22),
("Administration", 4, 987654321, 1995-01-01),
("Headquarters", 1, 888665555, 1981-06-19)
INSERT INTO DEPT_LOCATIONS VALUES (1, "Houston"),
(4, "Stafford"),
(5, "Bellaire"),
(5, "Sugarland"),
(5, "Houston")
INSERT INTO WORKS_ON VALUES (123456789, 1, 32.5),
(123456789, 2, 7.5),
(666884444, 3, 40.0),
(453453453, 1, 20.0),
(453453453, 2, 20.0),
(333445555, 2, 10.0),
(333445555, 3, 10.0),
(333445555, 10, 10.0),
(333445555, 20, 10.0),
(999887777, 30, 30.0),
(999887777, 10, 10.0),
(987987987, 10, 35.0),
(987987987, 30, 5.0),
(987654321, 30, 20.0),
(987654321, 20, 15.0),
(888665555, 20, NULL)
INSERT INTO PROJECT VALUES ("ProductX", 1, "Bellaire", 5),
("ProductY", 2, "Sugarland", 5),
("ProductZ", 3, "Houston", 5),
("Computerization", 10, "Stafford", 4),
("Reorganization", 20, "Houston", 1),
("Newbenefits", 30, "Stafford", 4)
INSERT INTO DEPENDENT VALUES (333445555, "Alice", 'F', 1986-04-05, "Daughter"),
(333445555, "Theodore", 'M', 1983-10-25, "Son"),
(333445555, "Joy", 'F', 1958-05-03, "Spouse"),
(987654321, "Abner", 'M', 1942-02-28, "Spouse"),
(123456789, "Michael", 'M', 1988-01-04, "Son"),
(123456789, "Alice", 'F', 1988-12-30, "Daughter"),
(123456789, "Elizabeth", 'F', 1967-05-05, "Spouse")
| true |
8bda7e816723042076833c67a563d4354abc1fea | SQL | tekkosu/TheBusyBeavers | /ddl/ethicalEating.sql | UTF-8 | 1,622 | 3.90625 | 4 | [] | no_license | DROP TABLE IF EXISTS Users, Recipes, Recipes_Users, Recipes_Ingredients, Ingredients, EthicalIngredients, Ingredients_EthicalIngredients;
CREATE TABLE Users(
userID INT(50) NOT NULL AUTO_INCREMENT PRIMARY KEY,
userName varchar(70) NOT NULL,
userPassword varchar(70) NOT NULL,
CONSTRAINT UNIQUE (userName)
) ENGINE=INNODB;
CREATE TABLE Recipes(
recipeID INT(50) NOT NULL AUTO_INCREMENT PRIMARY KEY,
recipeName varchar(50) NOT NULL
) ENGINE=INNODB;
CREATE TABLE Recipes_Users(
userID INT(50) NOT NULL,
recipeID INT(50) NOT NULL,
FOREIGN KEY (recipeID) REFERENCES Recipes (recipeID),
FOREIGN KEY (userID) REFERENCES Users (userID),
PRIMARY KEY (userID, recipeID)
) ENGINE=INNODB;
CREATE TABLE Recipes_Ingredients(
recipeID INT(50) NOT NULL,
ingredientID INT(50) NOT NULL,
FOREIGN KEY (recipeID) REFERENCES Recipes (recipeID),
FOREIGN KEY (ingredientID) REFERENCES Ingredients (ingredientID),
PRIMARY KEY (recipeID, ingredientID)
) ENGINE=INNODB;
CREATE TABLE Ingredients(
ingredientID INT(50) NOT NULL AUTO_INCREMENT PRIMARY KEY,
ingredientName varchar(35) NOT NULL,
ethicalIssue varchar(100)
) ENGINE=INNODB;
CREATE TABLE EthicalIngredients(
ethicalIngredientID INT(50) NOT NULL AUTO_INCREMENT PRIMARY KEY,
ingredientName varchar(35) NOT NULL,
description varchar(100)
) ENGINE=INNODB;
CREATE TABLE Ingredients_EthicalIngredients(
ethicalIngredientID INT(50) NOT NULL,
ingredientID INT(50) NOT NULL,
FOREIGN KEY (ethicalIngredientID) REFERENCES EthicalIngredients (ethicalIngredientID),
FOREIGN KEY (ingredientID) REFERENCES Ingredients (ingredientID),
PRIMARY KEY (ethicalIngredientID, ingredientID)
) ENGINE=INNODB; | true |
2fd4e07e6af5fef628a31388ae459a0e39f4a351 | SQL | os94/MadCamp-Projects | /Week4_Gdvbs/Gdvbs_Gdvbs/Cart/product.sql | UTF-8 | 1,459 | 3 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `tbl_product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`image` varchar(255) NOT NULL,
`price` double(10,2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `tbl_product`
--
INSERT INTO `tbl_product` (`id`, `name`, `image`, `price`) VALUES
(1, 'Cap (Black)', 'Cap(Black).png', 20.00),
(2, 'Cap (White)', 'Cap(White).png', 20.00),
(3, 'Black Sweatshirt', 'Black Sweatshirt.png', 35.00),
(4, 'Sleeveless A (men)', 'Sleeveless A (men).png', 25.00),
(5, 'Sleeveless B (men)', 'Sleeveless B (men).png', 25.00),
(6, 'Sweatshirt A (men)', 'Sweatshirt A (men).png', 35.00),
(7, 'Sweatshirt B (men)', 'Sweatshirt B (men).png', 35.00),
(8, 'T-Shirt', 'T-Shirt.png', 20.00),
(9, 'T-Shirt (White)', 'T-Shirt (White).png', 17.00),
(10, 'Longsleeve A (women)', 'Longsleeve A (women).png', 30.00),
(11, 'Longsleeve B (women)', 'Longsleeve B (women).png', 30.00),
(12, 'Sweatshirt A (women)', 'Sweatshirt A (women).png', 35.00),
(13, 'Sweatshirt A (women)', 'Sweatshirt A (women).png', 35.00),
(14, '(One-piece) Dress', '(One-piece) Dress.png', 35.00),
(15, 'Pillow (A)', 'Pillow A.png', 13.00),
(16, 'Pillow (B)', 'Pillow B.png', 13.00),
(17, 'Pillow (C)', 'Pillow C.png', 13.00),
(18, 'Pillow (D)', 'Pillow D.png', 13.00),
(19, 'Mug Cup', 'Mug Cup.png', 10.00)
| true |
194422f553fc0eba710a7d0ece20da05f6a9b597 | SQL | sekrarange/mediaplayer | /database.sql | UTF-8 | 1,482 | 3.390625 | 3 | [
"MIT"
] | permissive | DROP DATABASE IF EXISTS mediaplayer;
CREATE DATABASE mediaplayer; -- luo tietokanta
USE mediaplayer; -- käytä tietokantaa
CREATE TABLE kayttaja (id INT PRIMARY KEY, tunnus VARCHAR(60), salasanatiiviste VARCHAR(60));
CREATE TABLE kappale (id INT PRIMARY KEY, pituus VARCHAR(20), artisti VARCHAR(50), genre VARCHAR(20), nimi VARCHAR(50), linkki VARCHAR(100));
CREATE TABLE soittolista (kappaleid INT, kayttajaid INT, FOREIGN KEY (kappaleid) REFERENCES kappale(id), FOREIGN KEY (kayttajaid) REFERENCES kayttaja(id));
INSERT INTO kayttaja VALUES(1, 'testi', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220');
INSERT INTO kappale VALUES (1, '3:51', 'matthew.pablo','','Soliloquy','http://opengameart.org/sites/default/files/Soliloquy_1.mp3');
INSERT INTO kappale VALUES (2, '3:27', 'brainiac256','','Arabesque','http://opengameart.org/sites/default/files/Arabesque.mp3');
INSERT INTO kappale VALUES (3, '0:56', 'syncopika','','Sad Orchestral BGM','http://opengameart.org/sites/default/files/sadorchestralbgm%28syncopika%29.wav');
INSERT INTO kappale VALUES (4, '2:13', 'Muciojad','','It`s my World','http://opengameart.org/sites/default/files/It%27s%20my%20world.mp3');
INSERT INTO kappale VALUES (5, '0:20', 'DijitaL','','Penguin Dance','http://opengameart.org/sites/default/files/penguin_dance.mp3');
INSERT INTO soittolista VALUES(3,1);
INSERT INTO soittolista VALUES(4,1);
INSERT INTO soittolista VALUES(2,1);
CREATE USER mediaplayer;
GRANT SELECT ON mediaplayer.* TO mediaplayer; | true |
b6d2a927f6234eab4566674a2d80d6b08bc084db | SQL | hyunsiks/mySQL | /SQL/20_뷰.sql | UHC | 1,556 | 3.921875 | 4 | [] | no_license | /*
# (View)
- ⺻ ̺ ̿ ̺
- ⺻ ̺ Ļ DBü
- 並 () ⺻ ̺ Ҽ ֵ ִ
# ϱ
CREATE [OR REPLACE] VIEW ̸
AS
[WITH CHECK OPTION | [WITH READ ONLY]];
- CREATE OR REPLACE : ̹ ϴ Ѵ. ٸ Ѵ.
- WITH CHECK OPTION : ش ϴ DML .(DML)
- WITH READ ONLY : ش SELECT .(DML)
*/
CREATE OR REPLACE VIEW dept30_view AS
( SELECT
employees.*
FROM
employees
WHERE
department_id = 30
);
drop view dept30_view;
SELECT * FROM dept30_view;
update dept30_view set first_name = 'Dan'
where first_name = 'Den';
INSERT INTO dept30_view
VALUES(1, 'Gildong', 'Hong', 'GHong','515-127-4444', sysdate, 'IT_PROG', 1000, null, 100, 70);
CREATE OR REPLACE VIEW dept80_view_check AS
( SELECT
employees.*
FROM
employees
WHERE
department_id = 80
)
WITH CHECK OPTION;
SELECT * FROM dept80_view_check;
--80 μ 鸸 ȸϴ ̱ 80 μͰõ DML ְԵȴ
INSERT INTO dept80_view_check
VALUES(3, 'Jaeong', 'Hong', 'JHong','515-127-4434', sysdate, 'IT_PROG', 1000, null, 100, 80);
| true |
6d625dbeff76395afe9e5cb42357ed4ef608548d | SQL | juanmvm1331/Sensores1 | /SQL/EJERCICIOS_SELECT.sql | UTF-8 | 1,111 | 3.921875 | 4 | [] | no_license | use PACKT_ONLINE_SHOP;
SELECT * FROM ProductCategories;
--
use PACKT_ONLINE_SHOP;
SELECT ProductCategoryID, ProductCategoryName
FROM ProductCategories;
--Apodar las columnas
SELECT ProductCategoryName AS CATEGORY, ProductCategoryID AS ID
FROM ProductCategories;
-- Ordenar la consulta
SELECT ProductCategoryName AS 'CATEGORY NAME', ProductCategoryID AS ID
FROM ProductCategories
ORDER BY ProductCategoryName ASC;
SELECT ProductCategoryName AS 'CATEGORY NAME', ProductCategoryID AS ID
FROM ProductCategories
ORDER BY 'CATEGORY NAME' DESC;
-- Tomar datos unicos (valores no repetidos)
SELECT *
FROM Customers;
SELECT DISTINCT FirstName, LastName
FROM Customers;
SELECT DISTINCT FirstName
FROM Customers;
-- Operaciones matematicas
SELECT ProductID, Quantity, UnitPrice, (Quantity*UnitPrice) AS
'Line Item Total'
FROM OrderItems;
-- Filtros
use PACKT_ONLINE_SHOP;
SELECT ProductName AS 'High-value Products', NetRetailPrice
FROM Products
WHERE NetRetailPrice > 14.99
--
SELECT ProductName,NetRetailPrice
FROM Products
WHERE NetRetailPrice BETWEEN 14.99 AND 50
ORDER BY NetRetailPrice;
| true |
3ebc2858b7cd6db4e194128af98cb941e81f88bb | SQL | dbeatty10/dbt-sqlite | /dbt/include/sqlite/macros/core_overrides.sql | UTF-8 | 443 | 2.640625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive |
{% macro ref(model_name) %}
{# override to strip off database, and return only schema.table #}
{% set rel = builtins.ref(model_name) %}
{% do return(rel.include(database=False)) %}
{% endmacro %}
{% macro source(source_name, model_name) %}
{# override to strip off database, and return only schema.table #}
{% set rel = builtins.source(source_name, model_name) %}
{% do return(rel.include(database=False)) %}
{% endmacro %} | true |
427201271707af0104eb689a95b1297dd9aa1490 | SQL | yesgosu/DataBase_hospital | /201412425_1113.sql | UTF-8 | 1,667 | 3.78125 | 4 | [] | no_license | SELECT name,sum(saleprice)
from customer, orders
where customer.custid=orders.custid
group by name
order by name;
alter table orders
add foreign KEY(bookid) REFERENCES book(bookid);
SELECT name,bookname,orderdate
from customer cu,orders od, book bk
where cu.custid=od.custid
and od.bookid=bk.bookid
and price=20000;
select stff.eno , stff.ename , stff.job , stff.manager
from employee stff, employee mgr
where stff.manager=mgr.eno and mgr.ename like 'BLAKE';
select name,saleprice
from customer cu left outer join
orders on cu.custid=orders.custid;
select bk.bookid, bk.bookname, od.orderid, od.orderdate
from book bk left outer join orders od
on bk.bookid=od.bookid
order by bk.bookid;
select bk.bookname, count(od.bookid)
from book bk left outer join orders od
on bk.bookid=od.bookid
group by bk.bookname;
select bk.publisher, count(od.bookid)
from book bk left outer join orders od
on bk.bookid=od.bookid
group by bk.publisher;
select dp.dno, dp.dname
from department dp,employee ep
where dp.dno=ep.dno and ep.ename = 'SCOTT';
select stff.ename, stff.job , stff.hiredate
from employee stff,employee mgr
where stff.manager=mgr.eno
and stff.hiredate<mgr.hiredate;
select cu.name, bk.bookname , od.orderdate
from customer cu , book bk, orders od
where cu.custid=od.custid
and od.bookid=bk.bookid
order by od.orderdate;
select * from dba_users;
create user dituser2
identified by ditdb20;
create user yesgosu
IDENTIFIED by ditdb20;
grant CREATE SESSION to dituser2;
grant select, update on customer to dituser2;
select * from SYSTEM.customor;
grant connect, RESOURCE to yesgosu;
| true |
cd7e14ad0ad0fc10e6cfaf4fc9ad5a8b91f030f7 | SQL | Tal-Four/SmartTimetable | /newdb.sql | UTF-8 | 21,265 | 3.0625 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 5.7.19-log - MySQL Community Server (GPL)
-- Server OS: Win32
-- HeidiSQL Version: 9.3.0.4984
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping structure for table smarttimetabledb.category
CREATE TABLE IF NOT EXISTS `category` (
`CategoryID` smallint(6) unsigned NOT NULL,
`UserID` smallint(6) unsigned NOT NULL,
`Name` varchar(15) NOT NULL,
`Modifier` float unsigned NOT NULL DEFAULT '1',
`TasksCompleted` int(11) unsigned NOT NULL DEFAULT '0',
`Colour` int(11) NOT NULL,
`Hidden` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`CategoryID`,`UserID`),
KEY `FK_category_user` (`UserID`),
CONSTRAINT `FK_category_user` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table smarttimetabledb.category: ~19 rows (approximately)
/*!40000 ALTER TABLE `category` DISABLE KEYS */;
REPLACE INTO `category` (`CategoryID`, `UserID`, `Name`, `Modifier`, `TasksCompleted`, `Colour`, `Hidden`) VALUES
(1, 2, 'a', 373.874, 11709, 0, b'0'),
(1, 3, 'd', 1, 0, 0, b'0'),
(1, 8, 'agdsg', 1, 0, -10066177, b'0'),
(2, 2, 'sassy', 1, 0, -6749953, b'0'),
(2, 8, 'jfgj', 1, 0, -52327, b'0'),
(3, 2, 'c', 1, 0, 0, b'0'),
(3, 8, 'kevin', 1, 0, -16777216, b'0'),
(4, 2, 'e', 1, 0, -3407770, b'0'),
(5, 2, 'green', 1.5, 0, -10027213, b'0'),
(6, 2, 'l', 1, 0, 0, b'0'),
(7, 2, 'updated', 1, 0, 0, b'0'),
(8, 2, '123', 1, 0, -10066177, b'0'),
(9, 2, '1234', 1, 0, -6684877, b'0'),
(10, 2, 'gshdzhg', 1, 0, -3355393, b'0'),
(11, 2, 'dshsfgj', 1, 0, -3342541, b'0'),
(12, 2, 'asd', 1, 0, -10092544, b'0'),
(13, 2, 'jhg', 1, 0, -1, b'0'),
(14, 2, 'Coursework', 1, 0, -3407872, b'0'),
(15, 2, 'new category', 1, 0, -13421569, b'0');
/*!40000 ALTER TABLE `category` ENABLE KEYS */;
-- Dumping structure for table smarttimetabledb.event
CREATE TABLE IF NOT EXISTS `event` (
`UserID` smallint(6) unsigned NOT NULL,
`EventID` smallint(6) unsigned NOT NULL,
`EventName` varchar(20) NOT NULL,
`Description` text,
`Date` date DEFAULT NULL,
`Day` int(11) unsigned DEFAULT NULL,
`Colour` int(11) NOT NULL,
`StartTime` float unsigned NOT NULL,
`Hidden` bit(1) NOT NULL DEFAULT b'0',
`EndTime` float unsigned NOT NULL,
PRIMARY KEY (`EventID`,`UserID`),
KEY `FK_UserID3_idx` (`UserID`),
CONSTRAINT `FK_event_user` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table smarttimetabledb.event: ~8 rows (approximately)
/*!40000 ALTER TABLE `event` DISABLE KEYS */;
REPLACE INTO `event` (`UserID`, `EventID`, `EventName`, `Description`, `Date`, `Day`, `Colour`, `StartTime`, `Hidden`, `EndTime`) VALUES
(2, 1, 's', '', NULL, 1, -16777216, 4, b'0', 5.5),
(3, 1, 'Test', 'uytg', NULL, 1, 1, 15, b'0', 16),
(2, 2, 'zfa', 'sfa', NULL, 4, -6750055, 2.5, b'0', 3.5),
(2, 3, 'ffff', 'asdfgh', NULL, 5, -13108, 1.5, b'0', 2.5),
(2, 4, '21552', '5252', NULL, 7, -6711040, 0, b'0', 0),
(2, 5, 'thu', 'thudesc', NULL, 4, -13434625, 4.5, b'0', 21.5),
(2, 6, 'eventtest', 'hfth', NULL, 1, -65536, 6, b'0', 6.5),
(2, 8, 'testdate', 'testdate', '2018-01-04', NULL, -26215, 3, b'0', 5);
/*!40000 ALTER TABLE `event` ENABLE KEYS */;
-- Dumping structure for table smarttimetabledb.task
CREATE TABLE IF NOT EXISTS `task` (
`UserID` smallint(6) unsigned NOT NULL,
`TaskID` smallint(6) unsigned NOT NULL,
`Name` varchar(20) NOT NULL,
`Description` text,
`CategoryID` smallint(6) unsigned NOT NULL,
`DateSet` date NOT NULL,
`DateDue` date NOT NULL,
`Colour` int(11) NOT NULL,
`Hidden` bit(1) NOT NULL DEFAULT b'0',
`TimeSet` float unsigned NOT NULL,
`TimeModified` float unsigned NOT NULL,
`TimeUsed` float unsigned NOT NULL DEFAULT '0',
`HighPriority` bit(1) NOT NULL DEFAULT b'0',
`SlotsAssigned` int(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`TaskID`,`UserID`),
KEY `task_CategoryID_idx` (`CategoryID`),
KEY `FK_UserID2_idx` (`UserID`),
CONSTRAINT `FK_task_category_2` FOREIGN KEY (`UserID`) REFERENCES `category` (`UserID`),
CONSTRAINT `FK_task_user` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table smarttimetabledb.task: ~6 rows (approximately)
/*!40000 ALTER TABLE `task` DISABLE KEYS */;
REPLACE INTO `task` (`UserID`, `TaskID`, `Name`, `Description`, `CategoryID`, `DateSet`, `DateDue`, `Colour`, `Hidden`, `TimeSet`, `TimeModified`, `TimeUsed`, `HighPriority`, `SlotsAssigned`) VALUES
(2, 1, 'Submit coursework', 'Finish and submit coursework', 14, '2018-03-19', '2018-04-06', -3407872, b'0', 20, 20, 0, b'0', 40),
(8, 1, 'watch kevin', 'self evident', 3, '2018-03-19', '2019-04-20', -6750055, b'0', 3, 3, 0, b'1', 0),
(2, 2, 'filler task', '', 2, '2018-03-19', '2018-06-20', -6749953, b'0', 0.5, 0.5, 0, b'0', 1),
(8, 2, 'hw', '', 1, '2018-03-19', '2018-10-21', -52480, b'0', 1, 1, 0, b'0', 0),
(2, 3, 'beep boop', 'arsd', 5, '2017-08-15', '2999-05-10', -39322, b'0', 1, 1.5, 0, b'0', 3),
(2, 4, 'yes', 'arsd', 5, '2017-08-15', '2999-05-10', -10027213, b'0', 1, 1.5, 0, b'0', 3),
(2, 5, 'test task', 'description', 12, '2018-03-19', '2019-06-20', -39322, b'0', 2, 2, 0, b'0', 0),
(2, 6, 'teest', '', 11, '2018-03-19', '2018-03-19', -39373, b'0', 45, 45, 0, b'1', 0),
(2, 7, 'test', '', 8, '2018-03-19', '2018-03-19', -10066177, b'0', 2, 2, 0, b'0', 0);
/*!40000 ALTER TABLE `task` ENABLE KEYS */;
-- Dumping structure for table smarttimetabledb.timetable
CREATE TABLE IF NOT EXISTS `timetable` (
`UserID` smallint(5) unsigned NOT NULL,
`TimetableID` smallint(5) unsigned NOT NULL,
`Hidden` bit(1) NOT NULL DEFAULT b'0',
`StartDay` date NOT NULL,
PRIMARY KEY (`UserID`,`TimetableID`),
CONSTRAINT `FK_timetable_user` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table smarttimetabledb.timetable: ~4 rows (approximately)
/*!40000 ALTER TABLE `timetable` DISABLE KEYS */;
REPLACE INTO `timetable` (`UserID`, `TimetableID`, `Hidden`, `StartDay`) VALUES
(2, 1, b'1', '2018-01-29'),
(2, 2, b'1', '2018-02-05'),
(2, 3, b'1', '2018-02-05'),
(2, 4, b'1', '2018-02-12'),
(2, 5, b'1', '2018-02-12'),
(2, 6, b'0', '2018-03-19');
/*!40000 ALTER TABLE `timetable` ENABLE KEYS */;
-- Dumping structure for table smarttimetabledb.timetableslot
CREATE TABLE IF NOT EXISTS `timetableslot` (
`UserID` smallint(5) unsigned NOT NULL,
`TimetableID` smallint(5) unsigned NOT NULL,
`Day` tinyint(3) unsigned NOT NULL,
`Time` int(10) unsigned NOT NULL,
`TaskID` smallint(5) unsigned DEFAULT NULL,
`EventID` smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (`UserID`,`TimetableID`,`Day`,`Time`),
KEY `FK_timetableslot_task` (`UserID`,`TaskID`),
KEY `FK_timetableslot_event` (`UserID`,`EventID`),
CONSTRAINT `FK_timetableslot_event` FOREIGN KEY (`UserID`, `EventID`) REFERENCES `event` (`UserID`, `EventID`),
CONSTRAINT `FK_timetableslot_task` FOREIGN KEY (`UserID`, `TaskID`) REFERENCES `task` (`UserID`, `TaskID`),
CONSTRAINT `FK_timetableslot_timetable` FOREIGN KEY (`UserID`, `TimetableID`) REFERENCES `timetable` (`UserID`, `TimetableID`),
CONSTRAINT `FK_timetableslot_user` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table smarttimetabledb.timetableslot: ~363 rows (approximately)
/*!40000 ALTER TABLE `timetableslot` DISABLE KEYS */;
REPLACE INTO `timetableslot` (`UserID`, `TimetableID`, `Day`, `Time`, `TaskID`, `EventID`) VALUES
(2, 1, 1, 8, NULL, 1),
(2, 1, 1, 9, NULL, 1),
(2, 1, 1, 10, NULL, 1),
(2, 1, 1, 11, NULL, 1),
(2, 1, 1, 12, NULL, 6),
(2, 1, 1, 13, NULL, 6),
(2, 1, 4, 5, NULL, 2),
(2, 1, 4, 6, NULL, 2),
(2, 1, 4, 7, NULL, 2),
(2, 1, 4, 9, NULL, 5),
(2, 1, 4, 10, NULL, 5),
(2, 1, 4, 11, NULL, 5),
(2, 1, 4, 12, NULL, 5),
(2, 1, 4, 13, NULL, 5),
(2, 1, 4, 14, NULL, 5),
(2, 1, 4, 15, NULL, 5),
(2, 1, 4, 16, NULL, 5),
(2, 1, 4, 17, NULL, 5),
(2, 1, 4, 18, NULL, 5),
(2, 1, 4, 19, NULL, 5),
(2, 1, 4, 20, NULL, 5),
(2, 1, 4, 21, NULL, 5),
(2, 1, 4, 22, NULL, 5),
(2, 1, 4, 23, NULL, 5),
(2, 1, 4, 24, NULL, 5),
(2, 1, 4, 25, NULL, 5),
(2, 1, 4, 26, NULL, 5),
(2, 1, 4, 27, NULL, 5),
(2, 1, 4, 28, NULL, 5),
(2, 1, 4, 29, NULL, 5),
(2, 1, 4, 30, NULL, 5),
(2, 1, 4, 31, NULL, 5),
(2, 1, 4, 32, NULL, 5),
(2, 1, 4, 33, NULL, 5),
(2, 1, 4, 34, NULL, 5),
(2, 1, 4, 35, NULL, 5),
(2, 1, 4, 36, NULL, 5),
(2, 1, 4, 37, NULL, 5),
(2, 1, 4, 38, NULL, 5),
(2, 1, 4, 39, NULL, 5),
(2, 1, 4, 40, NULL, 5),
(2, 1, 4, 41, NULL, 5),
(2, 1, 4, 42, NULL, 5),
(2, 1, 4, 43, NULL, 5),
(2, 1, 5, 3, NULL, 3),
(2, 1, 5, 4, NULL, 3),
(2, 1, 5, 5, NULL, 3),
(2, 1, 7, 0, NULL, 4),
(2, 2, 1, 8, NULL, 1),
(2, 2, 1, 9, NULL, 1),
(2, 2, 1, 10, NULL, 1),
(2, 2, 1, 11, NULL, 1),
(2, 2, 1, 12, NULL, 6),
(2, 2, 1, 13, NULL, 6),
(2, 2, 4, 5, NULL, 2),
(2, 2, 4, 6, NULL, 2),
(2, 2, 4, 7, NULL, 2),
(2, 2, 4, 9, NULL, 5),
(2, 2, 4, 10, NULL, 5),
(2, 2, 4, 11, NULL, 5),
(2, 2, 4, 12, NULL, 5),
(2, 2, 4, 13, NULL, 5),
(2, 2, 4, 14, NULL, 5),
(2, 2, 4, 15, NULL, 5),
(2, 2, 4, 16, NULL, 5),
(2, 2, 4, 17, NULL, 5),
(2, 2, 4, 18, NULL, 5),
(2, 2, 4, 19, NULL, 5),
(2, 2, 4, 20, NULL, 5),
(2, 2, 4, 21, NULL, 5),
(2, 2, 4, 22, NULL, 5),
(2, 2, 4, 23, NULL, 5),
(2, 2, 4, 24, NULL, 5),
(2, 2, 4, 25, NULL, 5),
(2, 2, 4, 26, NULL, 5),
(2, 2, 4, 27, NULL, 5),
(2, 2, 4, 28, NULL, 5),
(2, 2, 4, 29, NULL, 5),
(2, 2, 4, 30, NULL, 5),
(2, 2, 4, 31, NULL, 5),
(2, 2, 4, 32, NULL, 5),
(2, 2, 4, 33, NULL, 5),
(2, 2, 4, 34, NULL, 5),
(2, 2, 4, 35, NULL, 5),
(2, 2, 4, 36, NULL, 5),
(2, 2, 4, 37, NULL, 5),
(2, 2, 4, 38, NULL, 5),
(2, 2, 4, 39, NULL, 5),
(2, 2, 4, 40, NULL, 5),
(2, 2, 4, 41, NULL, 5),
(2, 2, 4, 42, NULL, 5),
(2, 2, 4, 43, NULL, 5),
(2, 2, 5, 3, NULL, 3),
(2, 2, 5, 4, NULL, 3),
(2, 2, 5, 5, NULL, 3),
(2, 2, 7, 0, NULL, 4),
(2, 3, 1, 8, NULL, 1),
(2, 3, 1, 9, NULL, 1),
(2, 3, 1, 10, NULL, 1),
(2, 3, 1, 11, NULL, 1),
(2, 3, 1, 12, NULL, 6),
(2, 3, 1, 13, NULL, 6),
(2, 3, 4, 5, NULL, 2),
(2, 3, 4, 6, NULL, 2),
(2, 3, 4, 7, NULL, 2),
(2, 3, 4, 9, NULL, 5),
(2, 3, 4, 10, NULL, 5),
(2, 3, 4, 11, NULL, 5),
(2, 3, 4, 12, NULL, 5),
(2, 3, 4, 13, NULL, 5),
(2, 3, 4, 14, NULL, 5),
(2, 3, 4, 15, NULL, 5),
(2, 3, 4, 16, NULL, 5),
(2, 3, 4, 17, NULL, 5),
(2, 3, 4, 18, NULL, 5),
(2, 3, 4, 19, NULL, 5),
(2, 3, 4, 20, NULL, 5),
(2, 3, 4, 21, NULL, 5),
(2, 3, 4, 22, NULL, 5),
(2, 3, 4, 23, NULL, 5),
(2, 3, 4, 24, NULL, 5),
(2, 3, 4, 25, NULL, 5),
(2, 3, 4, 26, NULL, 5),
(2, 3, 4, 27, NULL, 5),
(2, 3, 4, 28, NULL, 5),
(2, 3, 4, 29, NULL, 5),
(2, 3, 4, 30, NULL, 5),
(2, 3, 4, 31, NULL, 5),
(2, 3, 4, 32, NULL, 5),
(2, 3, 4, 33, NULL, 5),
(2, 3, 4, 34, NULL, 5),
(2, 3, 4, 35, NULL, 5),
(2, 3, 4, 36, NULL, 5),
(2, 3, 4, 37, NULL, 5),
(2, 3, 4, 38, NULL, 5),
(2, 3, 4, 39, NULL, 5),
(2, 3, 4, 40, NULL, 5),
(2, 3, 4, 41, NULL, 5),
(2, 3, 4, 42, NULL, 5),
(2, 3, 4, 43, NULL, 5),
(2, 3, 5, 3, NULL, 3),
(2, 3, 5, 4, NULL, 3),
(2, 3, 5, 5, NULL, 3),
(2, 3, 7, 0, NULL, 4),
(2, 4, 1, 8, NULL, 1),
(2, 4, 1, 9, NULL, 1),
(2, 4, 1, 10, NULL, 1),
(2, 4, 1, 11, NULL, 1),
(2, 4, 1, 12, NULL, 6),
(2, 4, 1, 13, NULL, 6),
(2, 4, 1, 23, 4, NULL),
(2, 4, 1, 24, 4, NULL),
(2, 4, 1, 27, 4, NULL),
(2, 4, 3, 18, 4, NULL),
(2, 4, 3, 24, 4, NULL),
(2, 4, 4, 5, NULL, 2),
(2, 4, 4, 6, NULL, 2),
(2, 4, 4, 7, NULL, 2),
(2, 4, 4, 9, NULL, 5),
(2, 4, 4, 10, NULL, 5),
(2, 4, 4, 11, NULL, 5),
(2, 4, 4, 12, NULL, 5),
(2, 4, 4, 13, NULL, 5),
(2, 4, 4, 14, NULL, 5),
(2, 4, 4, 15, NULL, 5),
(2, 4, 4, 16, NULL, 5),
(2, 4, 4, 17, NULL, 5),
(2, 4, 4, 18, NULL, 5),
(2, 4, 4, 19, NULL, 5),
(2, 4, 4, 20, NULL, 5),
(2, 4, 4, 21, NULL, 5),
(2, 4, 4, 22, NULL, 5),
(2, 4, 4, 23, NULL, 5),
(2, 4, 4, 24, NULL, 5),
(2, 4, 4, 25, NULL, 5),
(2, 4, 4, 26, NULL, 5),
(2, 4, 4, 27, NULL, 5),
(2, 4, 4, 28, NULL, 5),
(2, 4, 4, 29, NULL, 5),
(2, 4, 4, 30, NULL, 5),
(2, 4, 4, 31, NULL, 5),
(2, 4, 4, 32, NULL, 5),
(2, 4, 4, 33, NULL, 5),
(2, 4, 4, 34, NULL, 5),
(2, 4, 4, 35, NULL, 5),
(2, 4, 4, 36, NULL, 5),
(2, 4, 4, 37, NULL, 5),
(2, 4, 4, 38, NULL, 5),
(2, 4, 4, 39, NULL, 5),
(2, 4, 4, 40, NULL, 5),
(2, 4, 4, 41, NULL, 5),
(2, 4, 4, 42, NULL, 5),
(2, 4, 4, 43, NULL, 5),
(2, 4, 5, 3, NULL, 3),
(2, 4, 5, 4, NULL, 3),
(2, 4, 5, 5, NULL, 3),
(2, 4, 5, 17, 4, NULL),
(2, 4, 5, 19, 4, NULL),
(2, 4, 5, 28, 4, NULL),
(2, 4, 6, 17, 4, NULL),
(2, 4, 6, 18, 4, NULL),
(2, 4, 6, 24, 4, NULL),
(2, 4, 7, 0, NULL, 4),
(2, 4, 7, 26, 4, NULL),
(2, 4, 7, 28, 4, NULL),
(2, 5, 1, 8, NULL, 1),
(2, 5, 1, 9, NULL, 1),
(2, 5, 1, 10, NULL, 1),
(2, 5, 1, 11, NULL, 1),
(2, 5, 1, 12, NULL, 6),
(2, 5, 1, 13, NULL, 6),
(2, 5, 3, 26, 4, NULL),
(2, 5, 3, 27, 4, NULL),
(2, 5, 3, 34, 4, NULL),
(2, 5, 3, 40, 4, NULL),
(2, 5, 4, 5, NULL, 2),
(2, 5, 4, 6, NULL, 2),
(2, 5, 4, 7, NULL, 2),
(2, 5, 4, 9, NULL, 5),
(2, 5, 4, 10, NULL, 5),
(2, 5, 4, 11, NULL, 5),
(2, 5, 4, 12, NULL, 5),
(2, 5, 4, 13, NULL, 5),
(2, 5, 4, 14, NULL, 5),
(2, 5, 4, 15, NULL, 5),
(2, 5, 4, 16, NULL, 5),
(2, 5, 4, 17, NULL, 5),
(2, 5, 4, 18, NULL, 5),
(2, 5, 4, 19, NULL, 5),
(2, 5, 4, 20, NULL, 5),
(2, 5, 4, 21, NULL, 5),
(2, 5, 4, 22, NULL, 5),
(2, 5, 4, 23, NULL, 5),
(2, 5, 4, 24, NULL, 5),
(2, 5, 4, 25, NULL, 5),
(2, 5, 4, 26, NULL, 5),
(2, 5, 4, 27, NULL, 5),
(2, 5, 4, 28, NULL, 5),
(2, 5, 4, 29, NULL, 5),
(2, 5, 4, 30, NULL, 5),
(2, 5, 4, 31, NULL, 5),
(2, 5, 4, 32, NULL, 5),
(2, 5, 4, 33, NULL, 5),
(2, 5, 4, 34, NULL, 5),
(2, 5, 4, 35, NULL, 5),
(2, 5, 4, 36, NULL, 5),
(2, 5, 4, 37, NULL, 5),
(2, 5, 4, 38, NULL, 5),
(2, 5, 4, 39, NULL, 5),
(2, 5, 4, 40, NULL, 5),
(2, 5, 4, 41, NULL, 5),
(2, 5, 4, 42, NULL, 5),
(2, 5, 4, 43, NULL, 5),
(2, 5, 5, 3, NULL, 3),
(2, 5, 5, 4, NULL, 3),
(2, 5, 5, 5, NULL, 3),
(2, 5, 5, 27, 4, NULL),
(2, 5, 5, 32, 3, NULL),
(2, 5, 5, 40, 4, NULL),
(2, 5, 6, 14, 4, NULL),
(2, 5, 6, 15, 4, NULL),
(2, 5, 6, 22, 4, NULL),
(2, 5, 6, 32, 4, NULL),
(2, 5, 7, 0, NULL, 4),
(2, 5, 7, 14, 4, NULL),
(2, 5, 7, 17, 4, NULL),
(2, 5, 7, 32, 4, NULL),
(2, 5, 7, 34, 3, NULL),
(2, 6, 1, 8, NULL, 1),
(2, 6, 1, 9, NULL, 1),
(2, 6, 1, 10, NULL, 1),
(2, 6, 1, 11, NULL, 1),
(2, 6, 1, 12, NULL, 6),
(2, 6, 1, 13, NULL, 6),
(2, 6, 2, 18, 1, NULL),
(2, 6, 2, 19, 1, NULL),
(2, 6, 2, 20, 1, NULL),
(2, 6, 2, 21, 1, NULL),
(2, 6, 2, 23, 4, NULL),
(2, 6, 2, 25, 1, NULL),
(2, 6, 2, 26, 1, NULL),
(2, 6, 2, 29, 1, NULL),
(2, 6, 2, 30, 1, NULL),
(2, 6, 2, 31, 1, NULL),
(2, 6, 3, 18, 1, NULL),
(2, 6, 3, 19, 1, NULL),
(2, 6, 3, 20, 1, NULL),
(2, 6, 3, 21, 1, NULL),
(2, 6, 3, 24, 1, NULL),
(2, 6, 3, 25, 1, NULL),
(2, 6, 3, 26, 1, NULL),
(2, 6, 3, 31, 2, NULL),
(2, 6, 4, 5, NULL, 2),
(2, 6, 4, 6, NULL, 2),
(2, 6, 4, 7, NULL, 2),
(2, 6, 4, 9, NULL, 5),
(2, 6, 4, 10, NULL, 5),
(2, 6, 4, 11, NULL, 5),
(2, 6, 4, 12, NULL, 5),
(2, 6, 4, 13, NULL, 5),
(2, 6, 4, 14, NULL, 5),
(2, 6, 4, 15, NULL, 5),
(2, 6, 4, 16, NULL, 5),
(2, 6, 4, 17, NULL, 5),
(2, 6, 4, 18, NULL, 5),
(2, 6, 4, 19, NULL, 5),
(2, 6, 4, 20, NULL, 5),
(2, 6, 4, 21, NULL, 5),
(2, 6, 4, 22, NULL, 5),
(2, 6, 4, 23, NULL, 5),
(2, 6, 4, 24, NULL, 5),
(2, 6, 4, 25, NULL, 5),
(2, 6, 4, 26, NULL, 5),
(2, 6, 4, 27, NULL, 5),
(2, 6, 4, 28, NULL, 5),
(2, 6, 4, 29, NULL, 5),
(2, 6, 4, 30, NULL, 5),
(2, 6, 4, 31, NULL, 5),
(2, 6, 4, 32, NULL, 5),
(2, 6, 4, 33, NULL, 5),
(2, 6, 4, 34, NULL, 5),
(2, 6, 4, 35, NULL, 5),
(2, 6, 4, 36, NULL, 5),
(2, 6, 4, 37, NULL, 5),
(2, 6, 4, 38, NULL, 5),
(2, 6, 4, 39, NULL, 5),
(2, 6, 4, 40, NULL, 5),
(2, 6, 4, 41, NULL, 5),
(2, 6, 4, 42, NULL, 5),
(2, 6, 4, 43, NULL, 5),
(2, 6, 5, 3, NULL, 3),
(2, 6, 5, 4, NULL, 3),
(2, 6, 5, 5, NULL, 3),
(2, 6, 5, 18, 1, NULL),
(2, 6, 5, 19, 1, NULL),
(2, 6, 5, 23, 3, NULL),
(2, 6, 5, 24, 4, NULL),
(2, 6, 5, 25, 1, NULL),
(2, 6, 5, 26, 1, NULL),
(2, 6, 5, 28, 1, NULL),
(2, 6, 5, 29, 1, NULL),
(2, 6, 6, 18, 1, NULL),
(2, 6, 6, 19, 1, NULL),
(2, 6, 6, 20, 4, NULL),
(2, 6, 6, 23, 1, NULL),
(2, 6, 6, 24, 1, NULL),
(2, 6, 6, 25, 1, NULL),
(2, 6, 6, 26, 1, NULL),
(2, 6, 6, 28, 1, NULL),
(2, 6, 6, 29, 3, NULL),
(2, 6, 6, 30, 1, NULL),
(2, 6, 6, 31, 1, NULL),
(2, 6, 7, 0, NULL, 4),
(2, 6, 7, 18, 1, NULL),
(2, 6, 7, 19, 1, NULL),
(2, 6, 7, 20, 3, NULL),
(2, 6, 7, 21, 1, NULL),
(2, 6, 7, 23, 1, NULL),
(2, 6, 7, 24, 1, NULL),
(2, 6, 7, 25, 1, NULL),
(2, 6, 7, 26, 1, NULL),
(2, 6, 7, 28, 1, NULL),
(2, 6, 7, 30, 1, NULL);
/*!40000 ALTER TABLE `timetableslot` ENABLE KEYS */;
-- Dumping structure for table smarttimetabledb.user
CREATE TABLE IF NOT EXISTS `user` (
`UserID` smallint(6) unsigned NOT NULL,
`Username` varchar(15) NOT NULL,
`Password` varchar(15) DEFAULT NULL,
`Question` text NOT NULL,
`Answer` text NOT NULL,
PRIMARY KEY (`UserID`),
UNIQUE KEY `Username` (`Username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table smarttimetabledb.user: ~8 rows (approximately)
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
REPLACE INTO `user` (`UserID`, `Username`, `Password`, `Question`, `Answer`) VALUES
(1, 'asdf', 'asdf', '', ''),
(2, 'sas', '', 'when life gives you lemons what do you make', 'lemonade'),
(3, 'as', '123', '', ''),
(4, 'qwerty', '', '', ''),
(5, 'account1', 'pass1', 'q1', 'a1'),
(6, 'account2', 'pass2', 'q2', 'a2'),
(7, 'account4', 'pass4', 'q4', 'a4'),
(8, 'jimmy', 'superpasS', 'who is kevin', 'brother');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
-- Dumping structure for trigger smarttimetabledb.check_event_date_day_mutually_exclusive_on_insert
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `check_event_date_day_mutually_exclusive_on_insert` BEFORE INSERT ON `event` FOR EACH ROW BEGIN
IF (NEW.`Day` IS NOT NULL AND NEW.`Date` IS NOT NULL) OR (NEW.`Day` IS NULL AND NEW.`Date` IS NULL) THEN
SIGNAL SQLSTATE VALUE '45000'
SET MESSAGE_TEXT = 'Either Day or Date must have a value and the other must be null.';
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger smarttimetabledb.check_event_date_day_mutually_exclusive_on_update
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `check_event_date_day_mutually_exclusive_on_update` BEFORE UPDATE ON `event` FOR EACH ROW BEGIN
IF (NEW.`Day` IS NOT NULL AND NEW.`Date` IS NOT NULL) OR (NEW.`Day` IS NULL AND NEW.`Date` IS NULL) THEN
SIGNAL SQLSTATE VALUE '45000'
SET MESSAGE_TEXT = 'Either Day or Date must have a value and the other must be null.';
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger smarttimetabledb.check_task_or_event_id_mutually_exclusive_insert
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `check_task_or_event_id_mutually_exclusive_insert` BEFORE INSERT ON `timetableslot` FOR EACH ROW BEGIN
IF (NEW.`EventID` IS NOT NULL AND NEW.`TaskID` IS NOT NULL) OR (NEW.`EventID` IS NULL AND NEW.`TaskID` IS NULL) THEN
SIGNAL SQLSTATE VALUE '45000'
SET MESSAGE_TEXT = 'Either TaskID or EventID must have a value and the other must be null.';
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger smarttimetabledb.check_task_or_event_id_mutually_exclusive_on_update
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `check_task_or_event_id_mutually_exclusive_on_update` BEFORE UPDATE ON `timetableslot` FOR EACH ROW BEGIN
IF (NEW.`EventID` IS NOT NULL AND NEW.`TaskID` IS NOT NULL) OR (NEW.`EventID` IS NULL AND NEW.`TaskID` IS NULL) THEN
SIGNAL SQLSTATE VALUE '45000'
SET MESSAGE_TEXT = 'Either TaskID or EventID must have a value and the other must be null.';
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
629b393ba9c776644a7f59f4b2cb2141d30932a1 | SQL | hbopereira/Anp-Api | /src/main/resources/db/migration/V16__criar_e_registrar_grupo_subgrupo.sql | UTF-8 | 923 | 2.765625 | 3 | [] | no_license | CREATE TABLE grupo (
id BIGINT(20) PRIMARY KEY AUTO_INCREMENT,
nome VARCHAR(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO grupo (id, nome) VALUES(1, 'Acessorios');
INSERT INTO grupo (id, nome) VALUES(2, 'Bebidas');
INSERT INTO grupo (id, nome) VALUES(3, 'Lanches');
CREATE TABLE subgrupo (
id BIGINT(20) PRIMARY KEY AUTO_INCREMENT,
nome VARCHAR(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO subgrupo (id, nome) VALUES (1, 'Eletronico');
INSERT INTO subgrupo (id, nome) VALUES (2, 'Presentes');
INSERT INTO subgrupo (id, nome) VALUES (3, 'Feminino');
INSERT INTO subgrupo (id, nome) VALUES (4, 'Infantis');
INSERT INTO subgrupo (id, nome) VALUES (5, 'Cerveja');
INSERT INTO subgrupo (id, nome) VALUES (6, 'Refrigerante');
INSERT INTO subgrupo (id, nome) VALUES (7, 'Suco');
INSERT INTO subgrupo (id, nome) VALUES (8, 'Fritos');
INSERT INTO subgrupo (id, nome) VALUES (9, 'Assados'); | true |
60d9eda8a52a9a5bffc6311c3c8d45ca493dde03 | SQL | syn-RussellFord/SynProjects | /A3MySQL/MySql.sql | UTF-8 | 6,358 | 3.65625 | 4 | [] | no_license | CREATE SCHEMA IF NOT EXISTS pcdb DEFAULT CHARACTER SET utf8;
USE pcdb;
/*
======
Create Tables
======
*/
CREATE TABLE IF NOT EXISTS cond (
condID INT NOT NULL AUTO_INCREMENT,
condName CHAR(20) NULL,
PRIMARY KEY (condID)
);
CREATE TABLE IF NOT EXISTS era (
eraID INT NOT NULL AUTO_INCREMENT,
eraName CHAR(20) NULL,
PRIMARY KEY (eraID)
);
CREATE TABLE IF NOT EXISTS postcard (
pcID INT NOT NULL AUTO_INCREMENT,
title VARCHAR(45) NOT NULL,
description VARCHAR(200) NULL,
isColor TINYINT NOT NULL,
condID INT NOT NULL,
eraID INT NOT NULL,
PRIMARY KEY (pcID),
CONSTRAINT fkPostcardCond
FOREIGN KEY (condID)
REFERENCES cond (condID),
CONSTRAINT fkPostcardEra
FOREIGN KEY (eraID)
REFERENCES era (eraID)
);
CREATE TABLE IF NOT EXISTS purchase (
pcID INT NOT NULL,
purcPrice FLOAT(10,2) NULL,
purcDate DATE NULL,
PRIMARY KEY (pcID),
CONSTRAINT fkPurchasePostcard
FOREIGN KEY (pcID)
REFERENCES postcard (pcID)
);
CREATE TABLE IF NOT EXISTS theme (
themeID INT NOT NULL AUTO_INCREMENT,
themeName CHAR(15) NULL,
PRIMARY KEY (themeID)
);
CREATE TABLE IF NOT EXISTS pcthemes (
pcthemeID INT NOT NULL AUTO_INCREMENT,
pcID INT NOT NULL,
themeID INT NOT NULL,
PRIMARY KEY (pcthemeID),
CONSTRAINT fkPcthemesPostcard
FOREIGN KEY (pcID)
REFERENCES postcard (pcID),
CONSTRAINT fkPcthemesTheme
FOREIGN KEY (themeID)
REFERENCES theme (themeID)
);
/*
=====
Insert Data
=====
*/
INSERT INTO cond (condID, condName)
VALUES (null, 'Poor'), (null, 'Acceptable'), (null, 'Good'), (null, 'Very Good'), (null, 'Mint');
INSERT INTO era (eraID, eraName)
VALUES (null, 'Golden'),
(null, 'Silver'),
(null, 'Modern');
INSERT INTO postcard (pcID, title, description, isColor, condID, eraID)
VALUES (null, 'New York-1929', 'Depicts the Statue of Liberty', 0, 2, 1),
(null, 'New York-1929', 'Depicts the Statue of Liberty', 0, 5, 1),
(null, 'Flowers in Spring-1978', 'Depicts a woman running through a field of flowers', 1, 4, 3),
(null, 'Elvis Is Back-1960', 'Depicts Elvis Presley portrait from the album of the same name', 1, 5, 2),
(null, 'Elvis Is Back-1960', 'Depicts Elvis Presley portrait from the album of the same name', 1, 3, 2),
(null, 'Obama Hope-2009', 'Depicts Barrack Obama Hope poster by Shepard Fairey', 1, 4, 3),
(null, 'White City Chicago-1886', 'Depicts White City in Chicago', 1, 1, 1),
(null, 'Obama Hope-2009', 'Depicts Barrack Obama Hope poster by Shepard Fairey', 1, 2, 3),
(null, 'White City Chicago-1886', 'Depicts White City in Chicago', 1, 4, 1),
(null, 'Cats Trimming Hedges-1998', 'Depicts cats cutting a hedge in the shape of a Sphynx', 0, 5, 3);
INSERT INTO purchase (pcID, purcPrice, purcDate)
VALUES (1, 20.25, '1998-10-01'),
(2, 125.00, '1999-01-12'),
(3, 58.00, '1999-01-12'),
(4, 39.48, '1999-01-12'),
(5, 2.45, '1999-03-15'),
(6, 1.50, '2009-06-12'),
(7, 150.90, '2009-12-25'),
(8, 1.00, '2010-01-01'),
(9, 1250.75, '2010-01-01'),
(10, 1337.69, '2011-10-20');
INSERT INTO theme (themeID, themeName)
VALUES (null, 'nature'),
(null, 'buildings'),
(null, 'people');
INSERT INTO pcthemes (pcthemeID, pcID, themeID)
VALUES (null, 1, 2),
(null, 2, 2),
(null, 3, 1),
(null, 3, 3),
(null, 4, 3),
(null, 5, 3),
(null, 6, 3),
(null, 7, 2),
(null, 8, 3),
(null, 9, 2),
(null, 10, 1),
(null, 10, 2),
(null, 10, 3);
/*
=====
Queries
=====
*/
-- a > All the Postcards in the Collection
SELECT pcID, title
FROM postcard;
-- b > Number of Postcards in the Collection
SELECT COUNT(pcID)
FROM postcard;
-- c > Unique Postcards in the Collection
SELECT DISTINCT(title)
FROM postcard;
-- d > Duplicate Postcards in the Collection
SELECT title
FROM postcard
GROUP BY title
HAVING count(title) > 1;
-- e > Postcards Purchased after 2000 with Theme of People
SELECT postcard.pcID, postcard.title, purchase.purcDate
FROM postcard
INNER JOIN purchase
ON postcard.pcID = purchase.pcID
INNER JOIN pcthemes
ON postcard.pcID = pcthemes.pcID
WHERE themeID = '3'
AND purcDate > '1999-12-31';
-- f > Postcards from the Golden Era with Theme of People or Buildings
SELECT postcard.pcID, postcard.title
FROM postcard
INNER JOIN era
ON postcard.eraID = era.eraID
INNER JOIN pcthemes
ON postcard.pcID = pcthemes.pcID
WHERE themeID = '2'
OR themeID = '3'
AND eraName = 'golden';
-- g > Postcards with More than One Theme
SELECT postcard.pcID, postcard.title
FROM postcard
INNER JOIN pcthemes
ON postcard.pcID = pcthemes.pcID
GROUP BY pcID
HAVING count(themeID) > 1;
-- h > Total Cost of Silver Era Postcards
SELECT SUM(purchase.purcPrice), era.eraName
FROM postcard
INNER JOIN purchase
ON postcard.pcID = purchase.pcID
INNER JOIN era
ON postcard.eraID = era.eraID
WHERE eraName = 'silver';
-- i > Average Price from Each Era
SELECT AVG(purchase.purcPrice), cond.condName
FROM postcard
INNER JOIN purchase
ON postcard.pcID = purchase.pcID
INNER JOIN cond
ON postcard.condID = cond.condID
GROUP BY condName;
-- j > Largest Amount of Money for a Card Not in Poor Condition
SELECT MAX(purchase.purcPrice), cond.condName
FROM postcard
INNER JOIN purchase
ON postcard.pcID = purchase.pcID
INNER JOIN cond
ON postcard.condID = cond.condID
GROUP BY condName
HAVING condName != 'Poor'
LIMIT 1;
/*
=====
Views
=====
*/
-- a > Postcard Title / Purchase Price / Condition
CREATE VIEW PriceVsCondition AS
SELECT postcard.title, purchase.purcPrice, cond.condName
FROM postcard
INNER JOIN purchase
ON postcard.pcID = purchase.pcID
INNER JOIN cond
ON postcard.condID = cond.condID;
-- b > Postcard Title / Theme / Era
CREATE VIEW ThemeVsEra AS
SELECT postcard.title, theme.themeName, era.eraName
FROM postcard
INNER JOIN pcthemes
ON postcard.pcID = pcthemes.pcID
INNER JOIN theme
ON pcthemes.themeID = theme.themeID
INNER JOIN era
ON postcard.eraID = era.eraID;
-- c > Average Cost per Unique Card / Theme
CREATE VIEW AverageCostVsTheme
SELECT DISTINCT(postcard.title), AVG(purchase.purcPrice), theme.themeName
FROM postcard
INNER JOIN purchase
ON postcard.pcID = purchase.pcID
INNER JOIN pcthemes
ON postcard.pcID = pcthemes.pcID
INNER JOIN theme
ON pcthemes.themeID = theme.themeID
GROUP BY postcard.title, theme.themeName; | true |
7fc9240eee072d2b86cf8721ca6bbf99e0c92d96 | SQL | tetsu0329/morada | /payment/_transaction_withdata_tc_db.sql | UTF-8 | 5,310 | 3 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Nov 14, 2017 at 05:05 PM
-- Server version: 5.7.19
-- PHP Version: 5.6.31
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: `id3592378_tc_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `itemtransactiontable`
--
DROP TABLE IF EXISTS `itemtransactiontable`;
CREATE TABLE IF NOT EXISTS `itemtransactiontable` (
`transactionID` int(11) NOT NULL,
`productID` int(11) NOT NULL,
`qty` int(11) NOT NULL,
`price` decimal(10,2) NOT NULL,
`size` varchar(32) NOT NULL,
`note` varchar(512) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `itemtransactiontable`
--
INSERT INTO `itemtransactiontable` (`transactionID`, `productID`, `qty`, `price`, `size`, `note`) VALUES
(1, 1, 1, '1000.00', 'Small', ''),
(1, 7, 1, '1200.00', 'Small', ''),
(1, 6, 2, '500.00', 'Medium', ''),
(2, 2, 3, '200.00', 'XL', ''),
(3, 4, 1, '3999.00', 'Large', ''),
(4, 4, 1, '3999.00', 'Small', ''),
(5, 6, 1, '500.00', 'Medium', ''),
(6, 7, 1, '1200.00', 'Large', '');
-- --------------------------------------------------------
--
-- Table structure for table `paypalpaymenttable`
--
DROP TABLE IF EXISTS `paypalpaymenttable`;
CREATE TABLE IF NOT EXISTS `paypalpaymenttable` (
`paypalTransactionID` varchar(32) NOT NULL,
`transactionTime` varchar(32) NOT NULL,
`transactionToken` varchar(32) NOT NULL,
`transactionStatus` varchar(32) NOT NULL,
`transactionAmount` varchar(64) NOT NULL,
`payerPaypalId` varchar(32) NOT NULL DEFAULT '',
`payerStatus` varchar(32) NOT NULL DEFAULT '',
`buyerName` varchar(512) NOT NULL,
`buyerEmail` varchar(512) NOT NULL,
`buyerShipToName` varchar(512) NOT NULL,
`buyerAddress` varchar(1000) NOT NULL,
PRIMARY KEY (`paypalTransactionID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `paypalpaymenttable`
--
INSERT INTO `paypalpaymenttable` (`paypalTransactionID`, `transactionTime`, `transactionToken`, `transactionStatus`, `transactionAmount`, `payerPaypalId`, `payerStatus`, `buyerName`, `buyerEmail`, `buyerShipToName`, `buyerAddress`) VALUES
('4EE14458Y9656654E', '2017-11-14T16:50:49Z', 'EC-95E06393WB214263V', 'Completed', 'PHP 3485.00', 'UG6T9HA4ZA324', 'verified', 'test buyer', 'me-buyer@patlo.tech', 'test buyer', '1 Main St, San Jose, CA, 95131, US'),
('53K51038BA707320L', '2017-11-14T16:51:59Z', 'EC-0BB87610WU605644P', 'Completed', 'PHP 780.00', 'UG6T9HA4ZA324', 'verified', 'test buyer', 'me-buyer@patlo.tech', 'test buyer', '1 Main St, San Jose, CA, 95131, US'),
('0SS78784UX0861742', '2017-11-14T16:54:41Z', 'EC-7MN86062Y5166452D', 'Completed', 'PHP 4179.00', 'UG6T9HA4ZA324', 'verified', 'test buyer', 'me-buyer@patlo.tech', 'test buyer', '1 Main St, San Jose, CA, 95131, US'),
('162374795U429581W', '2017-11-14T17:03:05Z', 'EC-6BN88471HU7538438', 'Completed', 'PHP 1380.00', 'UG6T9HA4ZA324', 'verified', 'test buyer', 'me-buyer@patlo.tech', 'test buyer', '1 Main St, San Jose, CA, 95131, US');
-- --------------------------------------------------------
--
-- Table structure for table `transactiontable`
--
DROP TABLE IF EXISTS `transactiontable`;
CREATE TABLE IF NOT EXISTS `transactiontable` (
`transactionID` int(11) NOT NULL AUTO_INCREMENT,
`userID` int(11) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`transactionStatus` varchar(32) NOT NULL DEFAULT 'CANCELLED' COMMENT 'CANCELLED or PAID or PENDING or DELIVERED',
`paymentMethod` varchar(32) NOT NULL DEFAULT 'CANCELLED' COMMENT 'CANCELLED or PAYPAL or BANK_DEPOSIT',
`paypalTransactionID` varchar(32) DEFAULT NULL,
`totalAmount` decimal(10,2) NOT NULL,
`itemAmount` decimal(10,2) NOT NULL DEFAULT '0.00',
`shippingFeeAmount` decimal(10,2) NOT NULL DEFAULT '0.00',
`note` varchar(512) DEFAULT NULL,
PRIMARY KEY (`transactionID`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `transactiontable`
--
INSERT INTO `transactiontable` (`transactionID`, `userID`, `timestamp`, `transactionStatus`, `paymentMethod`, `paypalTransactionID`, `totalAmount`, `itemAmount`, `shippingFeeAmount`, `note`) VALUES
(1, 10, '2017-11-14 16:50:50', 'PAID', 'PAYPAL', '4EE14458Y9656654E', '3485.00', '3200.00', '285.00', ''),
(2, 10, '2017-11-14 16:52:00', 'PAID', 'PAYPAL', '53K51038BA707320L', '780.00', '600.00', '180.00', ''),
(3, 10, '2017-11-14 16:53:11', 'PENDING', 'BANK_DEPOSIT', '', '4179.00', '3999.00', '180.00', ''),
(4, 10, '2017-11-14 16:54:42', 'PAID', 'PAYPAL', '0SS78784UX0861742', '4179.00', '3999.00', '180.00', ''),
(5, 10, '2017-11-14 16:57:21', 'PENDING', 'BANK_DEPOSIT', '', '680.00', '500.00', '180.00', ''),
(6, 10, '2017-11-14 17:03:05', 'PAID', 'PAYPAL', '162374795U429581W', '1380.00', '1200.00', '180.00', '');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
725541b76107670abd7ca437f6f942ff83571162 | SQL | imanelahrach/javaJbdc | /comptebanquedb.sql | UTF-8 | 293 | 2.734375 | 3 | [] | no_license | create table compte
(
id int auto_increment
primary key,
personne_id int default 0 not null,
solde double null
);
create table personne
(
cin int auto_increment
primary key,
nom varchar(50) null,
prenom varchar(50) null
);
| true |
8148e2f19639079b052c884cc301a1697cb8e3fc | SQL | QPC-github/oss-analysis-census2-prototype | /load_runtime_counts.sql | UTF-8 | 528 | 3.59375 | 4 | [
"CC-BY-4.0",
"MIT",
"CC-BY-3.0",
"CC0-1.0"
] | permissive | DROP TABLE IF EXISTS runtime_counts;
CREATE TABLE runtime_counts
(
ID serial,
dep_count int,
dep_id int,
dep_name text,
platform text,
PRIMARY KEY(id)
);
CREATE INDEX ON runtime_counts (dep_count);
CREATE INDEX ON runtime_counts (dep_id, dep_name);
\copy runtime_counts(dep_count, dep_id, dep_name) FROM 'runtime_deps_traversed_dependent_counts.csv' CSV HEADER;
UPDATE runtime_counts c
SET
dep_name = d.dep_name,
platform = d.platform
FROM deps_by_id d
WHERE
c.dep_id = d.dep_id;
| true |
b060a122f145e7c26eb9c630bae4954e2f73e230 | SQL | FJiayang/VANTEN_for_Oracle | /Oracle.sql | GB18030 | 78,490 | 2.703125 | 3 | [] | no_license | --------------------------------------------------------
-- ļѴ - ڶ-ʮ-19-2017
--------------------------------------------------------
--------------------------------------------------------
-- DDL for Table ADMINISTRATOR_JOB
--------------------------------------------------------
CREATE TABLE "C##ROOT"."ADMINISTRATOR_JOB"
( "ADMINJOB" VARCHAR2(20 BYTE),
"ADMINDUTY" VARCHAR2(600 BYTE) DEFAULT NULL
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table ADMINSTRATOR_RECORD
--------------------------------------------------------
CREATE TABLE "C##ROOT"."ADMINSTRATOR_RECORD"
( "ADMINNO" CHAR(12 BYTE),
"ADMINNAME" VARCHAR2(20 BYTE),
"ADMINSEX" CHAR(4 BYTE),
"ADMINJOB" VARCHAR2(50 BYTE)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table COUNTER
--------------------------------------------------------
CREATE TABLE "C##ROOT"."COUNTER"
( "VISITCOUNT" NUMBER(11,0) DEFAULT '0'
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table IPLIST
--------------------------------------------------------
CREATE TABLE "C##ROOT"."IPLIST"
( "IP" VARCHAR2(30 BYTE),
"COL_TIMES" VARCHAR2(30 BYTE) DEFAULT NULL,
"USERNAME" VARCHAR2(20 BYTE) DEFAULT NULL
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table TB_COMMENT
--------------------------------------------------------
CREATE TABLE "C##ROOT"."TB_COMMENT"
( "COL_COMMENTID" NUMBER(11,0),
"COL_COMMENT" VARCHAR2(255 BYTE),
"COL_USERNAME" VARCHAR2(255 BYTE) DEFAULT NULL,
"COL_TIME" DATE DEFAULT NULL,
"COL_SUBID" NUMBER(11,0) DEFAULT NULL
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table TB_DOCFILE
--------------------------------------------------------
CREATE TABLE "C##ROOT"."TB_DOCFILE"
( "EMPID" NUMBER(11,0),
"EMPJOB" VARCHAR2(50 BYTE),
"EMPNAME" VARCHAR2(20 BYTE),
"EMPSEX" VARCHAR2(4 BYTE),
"EMPNATION" VARCHAR2(40 BYTE),
"EMPNATIVE" VARCHAR2(40 BYTE),
"EMPSCHOOL" VARCHAR2(40 BYTE),
"EMPDEPT" VARCHAR2(40 BYTE),
"EMPMAJOR" VARCHAR2(40 BYTE),
"EMPBIRTHDAY" VARCHAR2(40 BYTE),
"EMPQQ" VARCHAR2(40 BYTE),
"EMPEMAIL" VARCHAR2(80 BYTE),
"EMPPHONENUM" VARCHAR2(40 BYTE),
"EMPADRESS" VARCHAR2(255 BYTE),
"EMPRESUME" VARCHAR2(600 BYTE),
"EMPREMARK" VARCHAR2(600 BYTE),
"EDI_NAME" VARCHAR2(20 BYTE)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table TB_NEWS
--------------------------------------------------------
CREATE TABLE "C##ROOT"."TB_NEWS"
( "NEWSID" NUMBER(11,0),
"NEWTITLE" VARCHAR2(80 BYTE) DEFAULT NULL,
"NEWSTEXT" VARCHAR2(600 BYTE),
"NEWSFROM" VARCHAR2(20 BYTE) DEFAULT NULL,
"ADDTIME" TIMESTAMP (4) DEFAULT sysdate
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table TB_SEND
--------------------------------------------------------
CREATE TABLE "C##ROOT"."TB_SEND"
( "COL_ID" NUMBER(37,0),
"COL_SUBJECT" VARCHAR2(255 BYTE),
"COL_CONTENT" VARCHAR2(255 BYTE),
"COL_FLAG" NUMBER(11,0) DEFAULT 0,
"COL_USERNAME" VARCHAR2(255 BYTE) DEFAULT NULL,
"COL_TIME" DATE,
"COL_UPDATETIME" DATE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table TB_USER
--------------------------------------------------------
CREATE TABLE "C##ROOT"."TB_USER"
( "USERNAME" VARCHAR2(60 BYTE),
"PASSWORD" VARCHAR2(60 BYTE) DEFAULT NULL,
"EMAIL" VARCHAR2(60 BYTE) DEFAULT NULL,
"PHONENUM" CHAR(18 BYTE) DEFAULT NULL,
"VIP" NUMBER(4,0) DEFAULT 0,
"ADMINISTRATOR" NUMBER(4,0) DEFAULT 0
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
--------------------------------------------------------
-- DDL for Table X2_RESOURSE
--------------------------------------------------------
CREATE TABLE "C##ROOT"."X2_RESOURSE"
( "COL_RESNAME" VARCHAR2(100 BYTE),
"COL_SIZE" VARCHAR2(30 BYTE),
"COL_UPLOADTIME" DATE,
"COL_DOWNLOADTIMES" NUMBER(11,0) DEFAULT 0,
"COL_LINK" VARCHAR2(255 BYTE)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DB_SCHOOL" ;
REM INSERTING into C##ROOT.ADMINISTRATOR_JOB
SET DEFINE OFF;
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('Ŀ',' ĿΪĿijɹִиˣʵĹĿʵȫȡɱα֤ȫĿˮƽҲɳΪִˡĿĿŶӵ쵼ߣĿҪְԤ㷶Χڰʱʵ쵼ĿСȫĿݣʹͻ⡣');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('ĵԱ','𱾹˾ļռ鵵ͳһ鵵ά밲ȫǾв鿼ֵıŵշļڲʹͻ¼ȾΪռΧӦ鵵ʱճıļȵķԼչ鵵ܣ֤鵵ȫķ㣻ϸѺļշǼǹأȷļࡣ');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('зԱ','ʦǾ߱ǿĵоۺѯרҵԱöԺͶ鷽ռйϢݴͷγɱԹͻ߲οҪȷĿƵ鷽ѼйϢϣƵʾгƣָѵԱԤ飻֯ʵʩʵص飻ݴͷд棻γɵȡ');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('ϵͳԱ','ûСϵͳϵṹܡܵķƹĿĿ̹Ŀļƻ벢ָʦϵͳϸƺͿӦҵ⣻ûֲᡢЭͻϵͳӲƽ̨İװʵʩƶĿĵʽдĿ淶Ҫĵ');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('ģԱ','ģԱʵϾվƣǿͻͿ֪֮վģʽӪ˼·ûȺʹϰߡվĹܵȵȻڣվܹˮƽĸߵ;վܺӪģʽʱЧԺ;ԡģԱͨɾḻݿԱΡ');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('Ա','ĿϸơڲԵ֯ʵʩЭĿԱͬͻйͨõĿͻϵСĿԷԷϤսĿĿʱеʵĽ飻άشĽ״ΰװԡݸӡûѵĿƹ㡣');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('Ա',' ҵϰϳΪվվơҪǣҳơݸվûȺ˼ӱи߶ĴƣҳŻʹûԻռͷûµ');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('Թʦ','дԼƻ滮ϸIJԷдݲԼƻάԻִвԹύԱ档дڲԵԶԽűؼ¼ԽдIJԱصļĵԲзֵϸȷλ뿪ԱȱݽԲƷĽһĽĽ飬ĽǷԲԽܽͳƷԲԽи٣');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('Ӳʦ','ռƻɷϹҪӲƷҪϤг飻ƶװƻܹѡװҪӲ豸ܺáװΧ豸װüϵͳӲΧ豸ֵļӲϡ');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('ݿԱ',' ݿƣֶΡؼֶΣӼݿľ־ɾ淶ݿûĹڶԹԱҪûģݿԱ涨ûȨΪͬûԴݿԱܹΪͬݿϵͳû涨ͬķȨޣԱݿⲻδȨķʺƻ');
Insert into C##ROOT.ADMINISTRATOR_JOB (ADMINJOB,ADMINDUTY) values ('ͻԱ',' ͻԱָ¿ͻ˿빫˾λ֮йͨϢЭԱҪУʱʿͻʱ棬ϱ۲ݷʽЭͻϿ⣻ͻϵͻϵͻDZڿͻзʣñ沢ϱ');
REM INSERTING into C##ROOT.ADMINSTRATOR_RECORD
SET DEFINE OFF;
Insert into C##ROOT.ADMINSTRATOR_RECORD (ADMINNO,ADMINNAME,ADMINSEX,ADMINJOB) values ('15251101205 ','ѩ','Ů ','зԱ');
Insert into C##ROOT.ADMINSTRATOR_RECORD (ADMINNO,ADMINNAME,ADMINSEX,ADMINJOB) values ('15251101219 ','',' ','ģԱ');
Insert into C##ROOT.ADMINSTRATOR_RECORD (ADMINNO,ADMINNAME,ADMINSEX,ADMINJOB) values ('15251101208 ','Ī',' ','ģԱ');
Insert into C##ROOT.ADMINSTRATOR_RECORD (ADMINNO,ADMINNAME,ADMINSEX,ADMINJOB) values ('15251101201 ','',' ','Ա');
Insert into C##ROOT.ADMINSTRATOR_RECORD (ADMINNO,ADMINNAME,ADMINSEX,ADMINJOB) values ('15251101238 ','',' ','Ŀ');
REM INSERTING into C##ROOT.COUNTER
SET DEFINE OFF;
Insert into C##ROOT.COUNTER (VISITCOUNT) values (469);
REM INSERTING into C##ROOT.IPLIST
SET DEFINE OFF;
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 19:24:19','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-18 19:26:26','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-11-18 19:32:54','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-11-18 20:00:15','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-11-18 20:01:45','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-11-18 20:02:21','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-11-18 20:19:39','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 20:30:37','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 21:01:40','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-19 12:43:44','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-19 16:15:57','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-19 18:15:23','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-19 18:31:56','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-11-19 21:22:22','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-19 21:22:45','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-11-19 21:23:17','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-19 21:49:13','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-19 22:00:31','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-19 22:43:42','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-19 22:48:03','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-19 22:49:45','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-20 12:19:10','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-20 13:07:39','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 13:15:35','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('14.16.191.177','2017-11-20 13:23:25','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 13:26:33','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 14:27:15','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 14:29:54','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-20 15:13:26','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 15:24:26','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 16:11:10','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 16:41:40','FJY');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 16:52:33','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 18:13:07','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 18:13:36','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('112.97.57.57','2017-11-20 18:21:13','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('112.97.57.57','2017-11-20 18:21:56','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-20 18:23:37','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-11-20 18:44:26','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.18.33.125','2017-11-20 20:28:23','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.18.33.125','2017-11-20 20:30:15','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 23:04:17','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 23:11:32','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 23:22:11','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 23:27:25','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-20 23:39:19','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.46','2017-11-21 01:19:41','˽');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.46','2017-11-21 01:22:34','˽');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 07:43:31','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-11-21 07:44:35','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 08:20:49','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 08:34:02','FJY');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('183.6.91.67','2017-11-21 09:11:04','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 09:13:26','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 10:12:46','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 11:22:04','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 12:58:43','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-11-21 13:21:01','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 18:29:32','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 18:35:00','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 19:04:21','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 19:20:35','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 19:43:50','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 19:48:14','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 19:48:55','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.30','2017-11-21 20:30:35','ּ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 20:57:53','ojbk');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 20:59:30','ojbk');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 21:00:45','ojbk');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 21:04:36','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 21:05:01','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 21:05:44','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 21:06:52','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 21:07:27','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-21 23:19:19','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-22 00:01:28','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.18','2017-11-28 23:10:35','ѩ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-11-29 07:44:44','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-01 13:08:45','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-01 22:54:55','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-12-01 23:42:23','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-05 10:43:57','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-12-07 16:48:37','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-07 17:07:15','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-12-08 10:34:16','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-09 23:59:25','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-12-10 00:04:39','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-12-11 19:31:03','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 21:28:33','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.22.12.73','2017-12-13 21:33:37','ѩ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 21:33:55','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:04:36','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:05:47','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:06:20','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:06:43','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:06:51','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:07:02','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:07:16','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:08:10','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:09:04','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:09:34','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.7','2017-12-13 22:20:59','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:34:02','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:40:19','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-12-13 22:40:30','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.18','2017-12-13 22:40:43','ѩ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:53:36','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 23:03:35','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-12-18 22:39:40','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-12-18 23:13:03','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-12-18 23:15:30','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-12-19 10:40:11','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-28 23:17:02','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.18','2017-11-28 23:19:27','ѩ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-28 23:21:05','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-28 23:28:31','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-28 23:29:37','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.18','2017-11-28 23:35:10','ѩ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-11-29 16:20:35','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-11-29 16:21:44','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-29 18:31:07','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-29 20:21:29','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 21:42:05','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.22.12.73','2017-12-13 21:42:09','ѩ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:11:32','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:14:01','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:14:39','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:15:12','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:15:31','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:15:48','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:18:28','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:20:55','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-28 20:21:34','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-04 12:45:14','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-07 18:20:34','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-10 08:37:55','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-10 11:15:57','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 21:52:57','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:03:01','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:03:47','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-13 22:18:08','Ī');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-12-13 22:24:04','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-12-14 13:03:20','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-12-18 23:20:38','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-12-18 23:23:07','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.167.22','2017-12-18 23:28:33','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('192.168.1.232','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('192.168.1.232','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('192.168.1.232','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('192.168.1.232','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('192.168.1.232','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('192.168.1.232','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','0',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','Wed Oct 11 12:37:35 CST 2017',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-11 12:44:24',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-11 12:55:22',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-11 13:03:14',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-11 13:06:29',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-11 21:28:51',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-11 21:31:34',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-11 21:31:53',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-11 21:53:02',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-12 10:11:36',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-12 12:00:13',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-12 12:01:32',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-12 17:07:41',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-12 17:07:57',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-13 12:17:15',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.27','2017-10-13 12:30:32',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.27','2017-10-13 12:31:01',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.27','2017-10-13 12:31:04',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.27','2017-10-13 12:31:14',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.27','2017-10-13 12:31:19',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.27','2017-10-13 12:31:39',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.27','2017-10-13 12:31:48',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.27','2017-10-13 12:31:50',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.18.33.4','2017-10-13 15:34:27',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.18.33.4','2017-10-13 15:36:05',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.36','2017-10-13 21:00:31',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 21:49:05',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 21:59:11',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.36','2017-10-13 21:59:36',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.36','2017-10-13 22:01:27',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.36','2017-10-13 22:01:52',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 22:05:02',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 22:05:58',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 22:06:53',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 22:10:11',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 22:47:19',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 22:52:45',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 23:04:33',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 23:09:04',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 23:10:26',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.36','2017-10-13 23:19:01',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 23:21:43',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-13 23:22:21',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-13 23:23:02',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-13 23:28:47',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-13 23:30:22',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:40:13',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:44:29',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:47:34',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:48:11',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:50:00',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:50:30',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:50:53',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:51:22',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:51:49',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:52:31',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:52:57',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:54:51',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:57:08',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:57:50',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:58:19',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:58:53',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 17:59:38',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 18:00:21',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 18:00:53',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 18:01:21',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 18:04:47',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.35','2017-10-14 18:13:16',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:18:52',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:21:47',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:23:00',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:23:34',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:23:36',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:35:54',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:35:58',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:36:07',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:36:12',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:37:40',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:37:42',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:37:46',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:37:49',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:40:42',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:41:20',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:42:23',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:45:32',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:46:16',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:46:50',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:48:17',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:48:50',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:48:53',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:50:36',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:50:46',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:53:30',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 21:54:07',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 22:03:19',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-14 22:13:11',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-14 22:15:32',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-14 22:15:43',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-14 22:16:10',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 09:51:18',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 09:51:34',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 09:52:52',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 09:53:27',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 09:55:01',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 09:58:34',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:05:02',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:16:55',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:16:58',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:19:01',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:33:59',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:41:54',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:42:29',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:43:51',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:44:23',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:44:34',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:44:54',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-15 10:52:33',null);
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-19 22:06:08','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-23 22:46:50','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-23 22:48:01','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-23 22:58:51','???');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-23 23:00:03','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-23 23:04:26','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 08:54:12','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 09:11:28','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 09:11:39','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 09:12:57','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 11:55:08','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 15:02:38','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 15:16:17','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 18:51:21','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 19:12:22','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 20:28:34','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 20:50:43','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 20:55:23','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 20:58:13','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 20:58:42','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 21:46:06','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('192.168.1.172','2017-10-24 22:08:32','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 22:20:42','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-24 22:23:23','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 22:33:24','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-24 22:36:43','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-24 22:48:16','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 22:49:12','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.37','2017-10-24 22:58:18','˽');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-10-24 23:00:53','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 23:01:58','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-24 23:03:38','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-24 23:06:17','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-24 23:07:13','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-10-24 23:09:56','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.36','2017-10-24 23:11:26','С껨');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-24 23:11:49','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.36','2017-10-24 23:12:16','С껨');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.23','2017-10-24 23:12:43','в');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.37','2017-10-24 23:13:56','˽');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.23','2017-10-24 23:14:24','в');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-24 23:17:30','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.36','2017-10-24 23:20:00','С껨');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-24 23:21:51','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-24 23:26:57','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-24 23:26:58','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-24 23:27:23','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-24 23:47:08','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-24 23:50:27','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-24 23:55:42','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-25 00:04:43','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 08:50:31','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 08:51:12','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 08:52:07','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 08:52:39','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 08:54:00','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 09:00:34','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 09:01:39','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 09:02:07','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 09:03:22','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 09:03:44','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 12:21:42','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 12:22:07','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-25 12:22:58','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 12:32:03','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-25 12:56:26','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-25 13:01:25','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 20:57:59','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 20:58:31','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:06:24','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:07:34','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:08:08','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:08:50','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:11:51','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:19:31','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:22:47','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:28:37','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:28:50','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:29:51','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 21:30:21','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 22:34:31','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 22:46:17','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 22:46:37','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 22:47:03','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 22:49:45','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 22:50:01','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 22:51:10','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 22:55:25','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 23:03:21','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-25 23:04:22','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-25 23:14:08','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-25 23:14:43','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-25 23:15:05','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-25 23:56:51','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-26 10:16:28','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 18:49:54','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-10-29 18:50:59','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 18:53:14','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.32','2017-10-29 18:59:05','mgq');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 19:06:49','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 19:17:23','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 19:27:18','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 19:56:09','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 19:58:19','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 19:59:30','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 20:03:57','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-29 20:06:26','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-29 20:09:33','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 20:15:04','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-29 22:07:57','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-29 22:23:07','ldn');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-29 22:27:54','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-29 22:29:50','ldnn');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-29 22:30:49','ldnn');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-29 23:11:33','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-10-29 23:32:25','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-29 23:35:31','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-29 23:38:44','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-29 23:40:47','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-30 07:21:32','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-30 13:27:04','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-30 14:38:38','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.18.33.29','2017-10-30 17:33:11','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.18.33.29','2017-10-30 17:33:28','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.18.33.29','2017-10-30 17:33:50','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.18.33.29','2017-10-30 17:34:37','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-30 21:19:15','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-30 21:52:04','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-10-30 22:20:23','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-30 22:33:40','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.8','2017-10-30 23:05:15','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-10-30 23:13:15','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-10-30 23:14:45','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.30','2017-10-30 23:22:10','Ŀ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.30','2017-10-30 23:28:01','Ŀ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.30','2017-10-30 23:31:50','Ŀ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.30','2017-10-30 23:38:13','ּ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.30','2017-10-30 23:39:16','ּ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.30','2017-10-30 23:41:06','Ŀ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.30','2017-10-30 23:44:04','Ŀ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-10-31 07:28:28','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.22.6.71','2017-10-31 09:04:55','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.22.9.211','2017-10-31 11:43:38','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-01 18:45:53','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-01 18:52:18','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-01 19:09:17','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-01 19:09:25','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-02 12:38:02','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-02 12:43:03','FJY');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-02 12:52:26','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-03 12:10:30','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-03 12:15:43','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-03 12:53:58','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-03 12:55:01','FJY');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-03 13:00:07','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-03 13:08:28','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.19','2017-11-03 13:22:26','SHIMIN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-03 13:23:49','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-03 13:42:35','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.19','2017-11-03 14:11:15','SHIMIN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.8','2017-11-03 14:27:38','LDN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.198.19','2017-11-03 14:39:00','SHIMIN');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.28.199.39','2017-11-03 15:01:45','ാ');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.13','2017-11-03 21:43:48','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-03 21:47:27','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-03 23:12:07','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.25.152.26','2017-11-04 07:34:45','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('172.22.1.229','2017-11-04 10:14:51','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('127.0.0.1','2017-11-09 17:13:47','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-11 22:37:22','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-11 23:13:18','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-11 23:29:56','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-11 23:31:53','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-11 23:35:32','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-12 09:51:30','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-12 10:26:07','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-12 12:40:48','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-12 20:28:14','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-12 21:03:48','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-13 12:14:39','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-14 22:06:14','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 19:55:08','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 20:07:05','');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 20:22:02','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 20:28:06','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 21:22:45','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 21:30:08','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 21:49:46','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 21:51:46','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 21:54:15','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 22:01:28','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 22:37:51','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 22:55:41','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 23:13:59','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-15 23:22:12','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 10:31:03','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 10:45:51','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 10:46:16','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 15:41:44','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 16:32:41','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 18:21:36','admin');
Insert into C##ROOT.IPLIST (IP,COL_TIMES,USERNAME) values ('0:0:0:0:0:0:0:1','2017-11-18 19:05:38','admin');
REM INSERTING into C##ROOT.TB_COMMENT
SET DEFINE OFF;
Insert into C##ROOT.TB_COMMENT (COL_COMMENTID,COL_COMMENT,COL_USERNAME,COL_TIME,COL_SUBID) values (32,'','admin',to_date('27-11-17','DD-MON-RR'),25);
Insert into C##ROOT.TB_COMMENT (COL_COMMENTID,COL_COMMENT,COL_USERNAME,COL_TIME,COL_SUBID) values (69,'1','admin',to_date('28-11-17','DD-MON-RR'),25);
Insert into C##ROOT.TB_COMMENT (COL_COMMENTID,COL_COMMENT,COL_USERNAME,COL_TIME,COL_SUBID) values (24,'1','',to_date('12-11-17','DD-MON-RR'),18);
Insert into C##ROOT.TB_COMMENT (COL_COMMENTID,COL_COMMENT,COL_USERNAME,COL_TIME,COL_SUBID) values (29,'¬ȣാŰ飬','admin',to_date('20-11-17','DD-MON-RR'),23);
Insert into C##ROOT.TB_COMMENT (COL_COMMENTID,COL_COMMENT,COL_USERNAME,COL_TIME,COL_SUBID) values (31,'俣¼棬Ұ','admin',to_date('20-11-17','DD-MON-RR'),23);
Insert into C##ROOT.TB_COMMENT (COL_COMMENTID,COL_COMMENT,COL_USERNAME,COL_TIME,COL_SUBID) values (32,'ʣ','admin',to_date('20-11-17','DD-MON-RR'),23);
Insert into C##ROOT.TB_COMMENT (COL_COMMENTID,COL_COMMENT,COL_USERNAME,COL_TIME,COL_SUBID) values (34,'ʱ','admin',to_date('20-11-17','DD-MON-RR'),26);
REM INSERTING into C##ROOT.TB_DOCFILE
SET DEFINE OFF;
Insert into C##ROOT.TB_DOCFILE (EMPID,EMPJOB,EMPNAME,EMPSEX,EMPNATION,EMPNATIVE,EMPSCHOOL,EMPDEPT,EMPMAJOR,EMPBIRTHDAY,EMPQQ,EMPEMAIL,EMPPHONENUM,EMPADRESS,EMPRESUME,EMPREMARK,EDI_NAME) values (3,'Ա','','','','㶫Ƹ','㶫ƾѧ','Ϣ','Ź','2000-07-12','962864309','962864309@qq.com','17520468642','й','Ա','Ա','mgq');
Insert into C##ROOT.TB_DOCFILE (EMPID,EMPJOB,EMPNAME,EMPSEX,EMPNATION,EMPNATIVE,EMPSCHOOL,EMPDEPT,EMPMAJOR,EMPBIRTHDAY,EMPQQ,EMPEMAIL,EMPPHONENUM,EMPADRESS,EMPRESUME,EMPREMARK,EDI_NAME) values (4,'зԱ','ѩ','Ů','','㶫ʡ','㶫ƾѧ','ϢѧԺ','ϢϢϵͳ','2017-12-13','1106407810','1106407810@qq.com','1','1','1','1','ѩ');
Insert into C##ROOT.TB_DOCFILE (EMPID,EMPJOB,EMPNAME,EMPSEX,EMPNATION,EMPNATIVE,EMPSCHOOL,EMPDEPT,EMPMAJOR,EMPBIRTHDAY,EMPQQ,EMPEMAIL,EMPPHONENUM,EMPADRESS,EMPRESUME,EMPREMARK,EDI_NAME) values (2,'ģԱ','','','','㶫','㶫ƾѧ','ϢѧԺ','ϢϢϵͳ','1996/07/15','1013338945','1013338945@qq.com','13822476952','㶫»','','','');
Insert into C##ROOT.TB_DOCFILE (EMPID,EMPJOB,EMPNAME,EMPSEX,EMPNATION,EMPNATIVE,EMPSCHOOL,EMPDEPT,EMPMAJOR,EMPBIRTHDAY,EMPQQ,EMPEMAIL,EMPPHONENUM,EMPADRESS,EMPRESUME,EMPREMARK,EDI_NAME) values (1,'Ŀ','','','','Դ','㶫ƾѧ','ϢѧԺ','ϢϢϵͳ',null,'1186032234','fjy8018@gmail.com','13536292949','㶫ƾѧ25','','','admin');
REM INSERTING into C##ROOT.TB_NEWS
SET DEFINE OFF;
Insert into C##ROOT.TB_NEWS (NEWSID,NEWTITLE,NEWSTEXT,NEWSFROM,ADDTIME) values (4,'վֱ֧ӷʣ','Ƽʹʣٶȸ\r\nhttp://172.25.152.8:8087/xz1_v1.1/index.html\r\n\r\nʹµַ\r\nhttp://myserver8018.free.ngrok.cc/xz1_v1.1/index.html','admin',to_timestamp('20-11-17 07.25.04.000000000 ','DD-MON-RR HH.MI.SSXFF AM'));
Insert into C##ROOT.TB_NEWS (NEWSID,NEWTITLE,NEWSTEXT,NEWSFROM,ADDTIME) values (5,'ڸµ','1̳飬öɾ 2۴ģҿԷ 3ӹŰ 4Ӹ˵','admin',to_timestamp('20-11-17 07.27.08.000000000 ','DD-MON-RR HH.MI.SSXFF AM'));
Insert into C##ROOT.TB_NEWS (NEWSID,NEWTITLE,NEWSTEXT,NEWSFROM,ADDTIME) values (6,'λ찴²в','Ŷ-Ӹ˵-дϢ','admin',to_timestamp('20-11-17 07.28.11.000000000 ','DD-MON-RR HH.MI.SSXFF AM'));
REM INSERTING into C##ROOT.TB_SEND
SET DEFINE OFF;
Insert into C##ROOT.TB_SEND (COL_ID,COL_SUBJECT,COL_CONTENT,COL_FLAG,COL_USERNAME,COL_TIME,COL_UPDATETIME) values (18,'','emmm',0,'',to_date('12-11-17','DD-MON-RR'),to_date('28-11-17','DD-MON-RR'));
Insert into C##ROOT.TB_SEND (COL_ID,COL_SUBJECT,COL_CONTENT,COL_FLAG,COL_USERNAME,COL_TIME,COL_UPDATETIME) values (24,'ռ','ʲôͽֱͺ',1,'admin',to_date('20-11-17','DD-MON-RR'),to_date('28-11-17','DD-MON-RR'));
Insert into C##ROOT.TB_SEND (COL_ID,COL_SUBJECT,COL_CONTENT,COL_FLAG,COL_USERNAME,COL_TIME,COL_UPDATETIME) values (25,'վٴȶУͨ','ģԼڶԱŬǸң̳ţ棬Ȱ飬ͨ',0,'admin',to_date('20-11-17','DD-MON-RR'),to_date('19-12-17','DD-MON-RR'));
Insert into C##ROOT.TB_SEND (COL_ID,COL_SUBJECT,COL_CONTENT,COL_FLAG,COL_USERNAME,COL_TIME,COL_UPDATETIME) values (26,'ҵ','',0,'',to_date('20-11-17','DD-MON-RR'),to_date('20-11-17','DD-MON-RR'));
REM INSERTING into C##ROOT.X2_RESOURSE
SET DEFINE OFF;
Insert into C##ROOT.X2_RESOURSE (COL_RESNAME,COL_SIZE,COL_UPLOADTIME,COL_DOWNLOADTIMES,COL_LINK) values ('ReadMe.txt','1KB',to_date('09-10-17','DD-MON-RR'),0,'resource/ReadMe.txt');
Insert into C##ROOT.X2_RESOURSE (COL_RESNAME,COL_SIZE,COL_UPLOADTIME,COL_DOWNLOADTIMES,COL_LINK) values ('linux.x64_11gR2_database_1of2','1.15GB',to_date('09-10-17','DD-MON-RR'),0,'resource/linux.x64_11gR2_database_1of2.zip');
Insert into C##ROOT.X2_RESOURSE (COL_RESNAME,COL_SIZE,COL_UPLOADTIME,COL_DOWNLOADTIMES,COL_LINK) values ('linux.x64_11gR2_database_2of2','1.03GB',to_date('09-10-17','DD-MON-RR'),0,'resource/linux.x64_11gR2_database_2of2.zip');
Insert into C##ROOT.X2_RESOURSE (COL_RESNAME,COL_SIZE,COL_UPLOADTIME,COL_DOWNLOADTIMES,COL_LINK) values ('XPϵͳ','601MB',to_date('09-10-17','DD-MON-RR'),0,'resource/zh-hans_windows_xp_professional_with_service_pack_3_x86_cd_x14-80404.iso');
Insert into C##ROOT.X2_RESOURSE (COL_RESNAME,COL_SIZE,COL_UPLOADTIME,COL_DOWNLOADTIMES,COL_LINK) values ('Ͼ糡21 ƺ','1019M',to_date('10-10-17','DD-MON-RR'),0,'resource/[WMSUB][Detective Conan][Movie_21_ka ra ku re na i no love letter][BDRIP][GB][720P].mp4');
Insert into C##ROOT.X2_RESOURSE (COL_RESNAME,COL_SIZE,COL_UPLOADTIME,COL_DOWNLOADTIMES,COL_LINK) values ('MySQL+PHP˰','209MB',to_date('11-10-17','DD-MON-RR'),0,'resource/wampserver3.0.6_x64_apache2.4.23_mysql5.7.14_php5.6.25-7.0.10.exe');
Insert into C##ROOT.X2_RESOURSE (COL_RESNAME,COL_SIZE,COL_UPLOADTIME,COL_DOWNLOADTIMES,COL_LINK) values ('Ͼ糡21 ƺ1080Pˮӡ','1.92G',to_date('11-10-17','DD-MON-RR'),0,'resource/[WMSUB][Detective Conan][Movie_21_ka ra ku re na i no love letter][BDRIP][GB][1080P].mp4');
Insert into C##ROOT.X2_RESOURSE (COL_RESNAME,COL_SIZE,COL_UPLOADTIME,COL_DOWNLOADTIMES,COL_LINK) values ('CentOS','4.21G',to_date('11-10-17','DD-MON-RR'),0,'resource/CentOS-7-x86_64-DVD-1708.iso');
--------------------------------------------------------
-- Constraints for Table ADMINISTRATOR_JOB
--------------------------------------------------------
ALTER TABLE "C##ROOT"."ADMINISTRATOR_JOB" MODIFY ("ADMINJOB" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table ADMINSTRATOR_RECORD
--------------------------------------------------------
ALTER TABLE "C##ROOT"."ADMINSTRATOR_RECORD" MODIFY ("ADMINNO" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."ADMINSTRATOR_RECORD" MODIFY ("ADMINNAME" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."ADMINSTRATOR_RECORD" MODIFY ("ADMINSEX" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."ADMINSTRATOR_RECORD" MODIFY ("ADMINJOB" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table COUNTER
--------------------------------------------------------
ALTER TABLE "C##ROOT"."COUNTER" MODIFY ("VISITCOUNT" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table IPLIST
--------------------------------------------------------
ALTER TABLE "C##ROOT"."IPLIST" MODIFY ("IP" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table TB_COMMENT
--------------------------------------------------------
ALTER TABLE "C##ROOT"."TB_COMMENT" MODIFY ("COL_COMMENTID" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table TB_DOCFILE
--------------------------------------------------------
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPID" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPJOB" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPNAME" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPSEX" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPNATION" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPNATIVE" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPSCHOOL" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPDEPT" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPMAJOR" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPQQ" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPEMAIL" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPPHONENUM" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPADRESS" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPRESUME" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EMPREMARK" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_DOCFILE" MODIFY ("EDI_NAME" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table TB_NEWS
--------------------------------------------------------
ALTER TABLE "C##ROOT"."TB_NEWS" MODIFY ("NEWSID" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_NEWS" MODIFY ("ADDTIME" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table TB_SEND
--------------------------------------------------------
ALTER TABLE "C##ROOT"."TB_SEND" MODIFY ("COL_ID" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_SEND" MODIFY ("COL_SUBJECT" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_SEND" MODIFY ("COL_CONTENT" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_SEND" MODIFY ("COL_TIME" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_SEND" MODIFY ("COL_UPDATETIME" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table TB_USER
--------------------------------------------------------
ALTER TABLE "C##ROOT"."TB_USER" MODIFY ("USERNAME" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_USER" MODIFY ("VIP" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."TB_USER" MODIFY ("ADMINISTRATOR" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table X2_RESOURSE
--------------------------------------------------------
ALTER TABLE "C##ROOT"."X2_RESOURSE" MODIFY ("COL_RESNAME" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."X2_RESOURSE" MODIFY ("COL_SIZE" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."X2_RESOURSE" MODIFY ("COL_UPLOADTIME" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."X2_RESOURSE" MODIFY ("COL_DOWNLOADTIMES" NOT NULL ENABLE);
ALTER TABLE "C##ROOT"."X2_RESOURSE" MODIFY ("COL_LINK" NOT NULL ENABLE);
--------------------------------------------------------
-- DDL for Trigger ADMINJOB_SECURE1
--------------------------------------------------------
CREATE OR REPLACE EDITIONABLE TRIGGER "C##ROOT"."ADMINJOB_SECURE1"
BEFORE INSERT OR UPDATE OR DELETE
ON ADMINISTRATOR_JOB
BEGIN
IF to_char(SYSDATE,'DY')=''
THEN
RAISE_APPLICATION_ERROR(-20600,'ĩĸλŶ');
END IF;
END;
/
ALTER TRIGGER "C##ROOT"."ADMINJOB_SECURE1" ENABLE;
| true |
ffe119756bc5c3cd27369e0afe4687e3d9f39f05 | SQL | cgallego/getdata_getInfo | /testdatabase/SQLbiomatrix/test.sql | UTF-8 | 1,949 | 2.625 | 3 | [] | no_license | SELECT
tbl_pt_mri_cad_record.cad_pt_no_txt,
tbl_pt_mri_cad_record.latest_mutation_status_int,
tbl_pt_mri_cad_record.pt_id,
tbl_pt_exam.exam_dt_datetime,
tbl_pt_exam.a_number_txt,
tbl_pt_exam.mri_cad_status_txt,
tbl_pt_procedure.proc_dt_datetime,
tbl_pt_procedure.proc_side_int,
tbl_pt_procedure.proc_source_int,
tbl_pt_procedure.proc_guid_int,
tbl_pt_procedure.proc_tp_int,
tbl_pt_pathology.pt_procedure_id,
tbl_pt_pathology.cytology_int,
tbl_pt_pathology.histop_core_biopsy_benign_yn,
tbl_pt_pathology.histop_core_biopsy_high_risk_yn,
tbl_pt_pathology.histop_tp_isc_yn,
tbl_pt_pathology.histop_tp_ic_yn,
tbl_pt_pathology.tumr_site_int,
tbl_pt_pathology.tumr_size_width_double,
tbl_pt_pathology.tumr_size_height_double,
tbl_pt_pathology.tumr_size_depth_double,
tbl_pt_pathology.tumr_grade_int,
tbl_pt_pathology.tumr_stage_curr_stage_clin_int,
tbl_pt_exam_finding.mri_mass_yn,
tbl_pt_exam_finding.mri_nonmass_yn,
tbl_pt_exam_finding.mri_foci_yn,
tbl_pt_exam.pt_exam_id,
tbl_pt_exam_finding.size_x_double,
tbl_pt_exam_finding.size_y_double,
tbl_pt_exam_finding.size_z_double,
tbl_pt_exam_finding.mri_dce_init_enh_int,
tbl_pt_exam_finding.mri_dce_delay_enh_int,
tbl_pt_exam_finding.curve_int,
tbl_pt_exam_finding.mri_mass_margin_int,
tbl_pt_exam_finding.mammo_n_mri_mass_shape_int,
tbl_pt_exam_finding.pt_exam_finding_id,
tbl_pt_exam.exam_tp_int
FROM
public.tbl_pt_mri_cad_record,
public.tbl_pt_exam,
public.tbl_pt_procedure,
public.tbl_pt_pathology,
public.tbl_pt_exam_finding
WHERE
tbl_pt_mri_cad_record.pt_id = tbl_pt_exam.pt_id AND
tbl_pt_exam.pt_id = tbl_pt_procedure.pt_id AND
tbl_pt_procedure.pt_procedure_id = tbl_pt_pathology.pt_procedure_id AND
tbl_pt_exam_finding.pt_exam_id = tbl_pt_exam.pt_exam_id AND
tbl_pt_mri_cad_record.cad_pt_no_txt = '0114' AND
tbl_pt_exam.exam_dt_datetime = '2011-10-02';
| true |
c71b6117a7c7ad0f8483ff8180e972b4ef85acde | SQL | ggjyp/CMSDemo | /src/main/resources/sql/cms.sql | UTF-8 | 939 | 3.25 | 3 | [] | no_license | /*
Source Host : localhost:3306
Source Database : cms
*/
-- ----------------------------
-- Table structure for user
-- ----------------------------
create table user
(
id int not null primary key auto_increment,
username varchar(30) not null unique,
password char(20) not null,
status int not null
)CHARACTER SET 'utf8'
COLLATE 'utf8_general_ci';
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (1, 'jyp', '123456', 0);
INSERT INTO `user` VALUES (2, 'admin', '123456', 0);
INSERT INTO `user` VALUES (3, 'ly', '123456', 1);
INSERT INTO `user` VALUES (4, 'ghost', '123456', 2);
CREATE TABLE role(
id TINYINT PRIMARY KEY AUTO_INCREMENT comment '角色表 ID',
rolename VARCHAR(20) NOT NULL comment '角色名称',
role_string VARCHAR(20) NOT NULL comment '角色字符串'
)engine=innodb auto_increment=1 DEFAULT charset=utf8 comment='角色信息表';
| true |
a01e87304345c50b2bcfd85928b4f4d7db8980e8 | SQL | bravers/Ushimitsu | /lesson8/8_2.sql | UTF-8 | 1,709 | 2.921875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Хост: localhost:3306
-- Время создания: Июл 18 2019 г., 05:34
-- Версия сервера: 5.7.26-0ubuntu0.18.04.1
-- Версия PHP: 7.2.19-0ubuntu0.18.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- База данных: `anton_test_db`
--
-- --------------------------------------------------------
--
-- Структура таблицы `8_2`
--
CREATE TABLE `8_2` (
`id` int(10) UNSIGNED NOT NULL,
`number` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `8_2`
--
INSERT INTO `8_2` (`id`, `number`) VALUES
(1, '79181111111'),
(2, '79181111112'),
(3, '79181111113'),
(4, '79181111114'),
(5, '79181111115'),
(6, '79181111116'),
(7, '79181111117'),
(8, '79181111118'),
(9, '79181111119'),
(10, '79181111120');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `8_2`
--
ALTER TABLE `8_2`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `8_2`
--
ALTER TABLE `8_2`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
28df1a126d3bcae761ae1407ca045c19708c0eb4 | SQL | oehrlis/oradba | /sql/tvd_hr/tvd_hr_popul.sql | UTF-8 | 12,124 | 2.953125 | 3 | [
"Apache-2.0",
"UPL-1.0"
] | permissive | --------------------------------------------------------------------------------
-- OraDBA - Oracle Database Infrastructur and Security, 5630 Muri, Switzerland
--------------------------------------------------------------------------------
-- Name......: tvd_hr_popul.sql
-- Author....: Stefan Oehrli (oes) stefan.oehrli@oradba.ch
-- Editor....: Stefan Oehrli
-- Date......: 2018.10.24
-- Revision..:
-- Purpose...: Populate TVD_HR schema
-- Notes.....:
-- Reference.: SYS (or grant manually to a DBA)
-- License...: Licensed under the Universal Permissive License v 1.0 as
-- shown at http://oss.oracle.com/licenses/upl.
--------------------------------------------------------------------------------
-- Modified..:
-- see git revision history for more information on changes/updates
--------------------------------------------------------------------------------
SET VERIFY OFF
ALTER SESSION SET NLS_LANGUAGE=American;
--------------------------------------------------------------------------------
-- insert data into the REGIONS table
Prompt ****** Populating REGIONS table ....
INSERT INTO regions VALUES ( 1, 'Europe' );
INSERT INTO regions VALUES ( 2, 'Americas' );
INSERT INTO regions VALUES ( 3, 'Asia' );
INSERT INTO regions VALUES ( 4, 'Middle East and Africa' );
--------------------------------------------------------------------------------
-- insert data into the COUNTRIES table
Prompt ****** Populating COUNTIRES table ....
INSERT INTO countries VALUES ( 'IT', 'Italy' , 1 );
INSERT INTO countries VALUES ( 'JP', 'Japan' , 3 );
INSERT INTO countries VALUES ( 'US', 'United States of America' , 2 );
INSERT INTO countries VALUES ( 'CA', 'Canada' , 2 );
INSERT INTO countries VALUES ( 'CN', 'China' , 3 );
INSERT INTO countries VALUES ( 'IN', 'India' , 3 );
INSERT INTO countries VALUES ( 'AU', 'Australia' , 3 );
INSERT INTO countries VALUES ( 'ZW', 'Zimbabwe' , 4 );
INSERT INTO countries VALUES ( 'SG', 'Singapore' , 3 );
INSERT INTO countries VALUES ( 'UK', 'United Kingdom' , 1 );
INSERT INTO countries VALUES ( 'FR', 'France' , 1 );
INSERT INTO countries VALUES ( 'DE', 'Germany' , 1 );
INSERT INTO countries VALUES ( 'ZM', 'Zambia' , 4 );
INSERT INTO countries VALUES ( 'EG', 'Egypt' , 4 );
INSERT INTO countries VALUES ( 'BR', 'Brazil' , 2 );
INSERT INTO countries VALUES ( 'CH', 'Switzerland' , 1 );
INSERT INTO countries VALUES ( 'NL', 'Netherlands' , 1 );
INSERT INTO countries VALUES ( 'MX', 'Mexico' , 2 );
INSERT INTO countries VALUES ( 'KW', 'Kuwait' , 4 );
INSERT INTO countries VALUES ( 'IL', 'Israel' , 4 );
INSERT INTO countries VALUES ( 'DK', 'Denmark' , 1 );
INSERT INTO countries VALUES ( 'ML', 'Malaysia' , 3 );
INSERT INTO countries VALUES ( 'NG', 'Nigeria' , 4 );
INSERT INTO countries VALUES ( 'AR', 'Argentina' , 2 );
INSERT INTO countries VALUES ( 'BE', 'Belgium' , 1 );
--------------------------------------------------------------------------------
-- insert data into the LOCATIONS table
Prompt ****** Populating LOCATIONS table ....
INSERT INTO locations VALUES ( 1000 , '1297 Via Cola di Rie', '00989', 'Roma', NULL, 'IT');
INSERT INTO locations VALUES ( 1100 , '93091 Calle della Testa' , '10934' , 'Venice' , NULL , 'IT');
INSERT INTO locations VALUES ( 1200 , '2017 Shinjuku-ku' , '1689' , 'Tokyo' , 'Tokyo Prefecture' , 'JP');
INSERT INTO locations VALUES ( 1300 , '9450 Kamiya-cho' , '6823' , 'Hiroshima' , NULL , 'JP');
INSERT INTO locations VALUES ( 1400 , '2014 Jabberwocky Rd' , '26192' , 'Southlake' , 'Texas' , 'US');
INSERT INTO locations VALUES ( 1500 , '2011 Interiors Blvd' , '99236' , 'South San Francisco' , 'California' , 'US');
INSERT INTO locations VALUES ( 1600 , '2007 Zagora St' , '50090' , 'South Brunswick' , 'New Jersey' , 'US');
INSERT INTO locations VALUES ( 1700 , '2004 Charade Rd' , '98199' , 'Seattle' , 'Washington' , 'US');
INSERT INTO locations VALUES ( 1800 , '147 Spadina Ave' , 'M5V 2L7' , 'Toronto' , 'Ontario' , 'CA');
INSERT INTO locations VALUES ( 1900 , '6092 Boxwood St' , 'YSW 9T2' , 'Whitehorse' , 'Yukon' , 'CA');
INSERT INTO locations VALUES ( 2000 , '40-5-12 Laogianggen' , '190518' , 'Beijing' , NULL , 'CN');
INSERT INTO locations VALUES ( 2100 , '1298 Vileparle (E)' , '490231' , 'Bombay' , 'Maharashtra' , 'IN');
INSERT INTO locations VALUES ( 2200 , '12-98 Victoria Street' , '2901' , 'Sydney' , 'New South Wales' , 'AU');
INSERT INTO locations VALUES ( 2300 , '198 Clementi North' , '540198' , 'Singapore' , NULL , 'SG');
INSERT INTO locations VALUES ( 2400 , '8204 Arthur St' , NULL , 'London' , NULL , 'UK');
INSERT INTO locations VALUES ( 2500 , 'Magdalen Centre, The Oxford Science Park' , 'OX9 9ZB' , 'Oxford' , 'Oxford' , 'UK');
INSERT INTO locations VALUES ( 2600 , '9702 Chester Road' , '09629850293' , 'Stretford' , 'Manchester' , 'UK');
INSERT INTO locations VALUES ( 2700 , 'Schwanthalerstr. 7031' , '80925' , 'Munich' , 'Bavaria' , 'DE');
INSERT INTO locations VALUES ( 2800 , 'Rua Frei Caneca 1360 ' , '01307-002' , 'Sao Paulo' , 'Sao Paulo' , 'BR');
INSERT INTO locations VALUES ( 2900 , '20 Rue des Corps-Saints' , '1730' , 'Geneva' , 'Geneve' , 'CH');
INSERT INTO locations VALUES ( 3000 , 'Murtenstrasse 921' , '3095' , 'Bern' , 'BE' , 'CH');
INSERT INTO locations VALUES ( 3100 , 'Pieter Breughelstraat 837' , '3029SK' , 'Utrecht' , 'Utrecht' , 'NL');
INSERT INTO locations VALUES ( 3200 , 'Mariano Escobedo 9991' , '11932' , 'Mexico City' , 'Distrito Federal,' , 'MX');
--------------------------------------------------------------------------------
-- insert data into the DEPARTMENTS table
Prompt ****** Populating DEPARTMENTS table ....
-- disable integrity constraint to EMPLOYEES to load data
ALTER TABLE departments
DISABLE CONSTRAINT dept_mgr_fk;
INSERT INTO departments VALUES ( 10, 'Senior Management' , 100, 3000);
INSERT INTO departments VALUES ( 20, 'Accounting' , 200, 3000);
INSERT INTO departments VALUES ( 30, 'Research' , 300, 3000);
INSERT INTO departments VALUES ( 40, 'Sales' , 400, 3000);
INSERT INTO departments VALUES ( 50, 'Operations' , 500, 3000);
INSERT INTO departments VALUES ( 60 , 'Information Technology' , 600, 3000);
INSERT INTO departments VALUES ( 61 , 'IT Support' , NULL, 3000);
INSERT INTO departments VALUES ( 62 , 'IT Helpdesk' , NULL, 3000);
INSERT INTO departments VALUES ( 70 , 'Human Resources' , 700, 3000);
--------------------------------------------------------------------------------
-- insert data into the JOBS table
Prompt ****** Populating JOBS table ....
INSERT INTO jobs VALUES ( 'SM_PRES', 'President', 20080, 40000);
INSERT INTO jobs VALUES ( 'AC_MGR', 'Accounting Manager', 8200, 16000);
INSERT INTO jobs VALUES ( 'AC_CLERK', 'Accounting Clerk', 4200, 9000);
INSERT INTO jobs VALUES ( 'RD_MGR', 'Research Manager', 8000, 15000);
INSERT INTO jobs VALUES ( 'RD_CLERK', 'Research Clerk', 4000, 9000);
INSERT INTO jobs VALUES ( 'RD_ENG', 'Research Engineer', 4000, 10000);
INSERT INTO jobs VALUES ( 'SA_MGR', 'Sales Manager', 10000, 20080);
INSERT INTO jobs VALUES ( 'SA_REP', 'Sales Representative', 6000, 12008);
INSERT INTO jobs VALUES ( 'OP_MGR', 'Operation Manager', 6000, 10000);
INSERT INTO jobs VALUES ( 'OP_AGENT', 'Agent', 4000, 10000);
INSERT INTO jobs VALUES ( 'IT_MGR', 'IT Manager', 6000, 10000);
INSERT INTO jobs VALUES ( 'IT_DEV', 'IT Developer', 4000, 10000);
INSERT INTO jobs VALUES ( 'IT_ADM', 'IT Administrator', 4000, 10000);
INSERT INTO jobs VALUES ( 'HR_MGR', 'Human Resources Manager', 6000, 10000);
INSERT INTO jobs VALUES ( 'HR_REP', 'Human Resources Representative', 4000, 9000);
--------------------------------------------------------------------------------
-- insert data into the EMPLOYEES table
Prompt ****** Populating EMPLOYEES table ....
INSERT INTO employees VALUES ( 100, 'Ben', 'King', 'ben.king@trivadislabs.com', '515.123.4567', TO_DATE('17.06.03', 'dd-MM-yyyy'), 'SM_PRES', 24000, NULL, NULL, 10);
INSERT INTO employees VALUES ( 200, 'Jim', 'Clark', 'jim.clark@trivadislabs.com', '515.123.4568', TO_DATE('21.09.05', 'dd-MM-yyyy'), 'AC_MGR', 17000, NULL, 100, 20);
INSERT INTO employees VALUES ( 201, 'John', 'Miller', 'john.miller@trivadislabs.com', '515.123.4569', TO_DATE('13.01.01', 'dd-MM-yyyy'), 'AC_CLERK', 17000, NULL, 200, 20);
INSERT INTO employees VALUES ( 300, 'Ernst', 'Blofeld', 'ernst.blofeld@trivadislabs.com', '590.423.4567', TO_DATE('03.01.06', 'dd-MM-yyyy'), 'RD_MGR', 9000, NULL, 100, 30);
INSERT INTO employees VALUES ( 301, 'Ford', 'Prefect', 'ford.prefect@trivadislabs.com', '590.423.4568', TO_DATE('21.05.07', 'dd-MM-yyyy'), 'RD_CLERK', 6000, NULL, 300, 30);
INSERT INTO employees VALUES ( 302, 'Douglas', 'Adams', 'douglas.adams@trivadislabs.com', '590.423.4569', TO_DATE('25.06.05', 'dd-MM-yyyy'), 'RD_CLERK', 4800, NULL, 300, 30);
INSERT INTO employees VALUES ( 303, 'Paul', 'Smith', 'paul.smith@trivadislabs.com', '590.423.4560', TO_DATE('05.02.06', 'dd-MM-yyyy'), 'RD_ENG', 4800, NULL, 300, 30);
INSERT INTO employees VALUES ( 304, 'James', 'Scott', 'james.scott@trivadislabs.com', '590.423.5567', TO_DATE('07.02.07', 'dd-MM-yyyy'), 'RD_ENG', 4200, NULL, 300, 30);
INSERT INTO employees VALUES ( 400, 'Eve', 'Moneypenny', 'eve.moneypenny@trivadislabs.com', '515.124.4569', TO_DATE('17.08.02', 'dd-MM-yyyy'), 'SA_MGR', 12008, 0.3, 100, 40);
INSERT INTO employees VALUES ( 401, 'Paul', 'Ward', 'paul.ward@trivadislabs.com', '515.124.4169', TO_DATE('16.08.02', 'dd-MM-yyyy'), 'SA_REP', 9000, 0.3, 400, 40);
INSERT INTO employees VALUES ( 402, 'Arthur', 'Dent', 'arthur.dent@trivadislabs.com', '515.124.4269', TO_DATE('28.09.05', 'dd-MM-yyyy'), 'SA_REP', 8200, 0.3, 400, 40);
INSERT INTO employees VALUES ( 403, 'Monica', 'Blake', 'monica.blake@trivadislabs.com', '515.124.4369', TO_DATE('30.09.05', 'dd-MM-yyyy'), 'SA_REP', 7700, 0.2, 400, 40);
INSERT INTO employees VALUES ( 500, 'Felix', 'Leitner', 'felix.leitner@trivadislabs.com', '515.124.4567', TO_DATE('07.12.07', 'dd-MM-yyyy'), 'OP_MGR', 6900, NULL, 100, 50);
INSERT INTO employees VALUES ( 501, 'Andy', 'Renton', 'andy.renton@trivadislabs.com', '515.127.4561', TO_DATE('07.12.02', 'dd-MM-yyyy'), 'OP_AGENT', 11000, NULL, 500, 50);
INSERT INTO employees VALUES ( 502, 'Jason', 'Walters', 'jason .walters@trivadislabs.com', '515.127.4562', TO_DATE('18.05.03', 'dd-MM-yyyy'), 'OP_AGENT', 3100, NULL, 500, 50);
INSERT INTO employees VALUES ( 503, 'James', 'Bond', 'james.bond@trivadislabs.com', '515.127.4563', TO_DATE('24.12.05', 'dd-MM-yyyy'), 'OP_AGENT', 2900, NULL, 500, 50);
INSERT INTO employees VALUES ( 600, 'Ian', 'Fleming', 'ian.fleming@trivadislabs.com', '515.127.4564', TO_DATE('24.07.05', 'dd-MM-yyyy'), 'IT_MGR', 2800, NULL, 100, 60);
INSERT INTO employees VALUES ( 601, 'John', 'Gartner', 'john.gartner@trivadislabs.com', '515.127.4565', TO_DATE('15.11.06', 'dd-MM-yyyy'), 'IT_DEV', 2600, NULL, 600, 60);
INSERT INTO employees VALUES ( 602, 'Eugen', 'Tanner', 'eugen.tanner@trivadislabs.com', '515.127.4566', TO_DATE('10.08.07', 'dd-MM-yyyy'), 'IT_ADM', 2500, NULL, 600, 60);
INSERT INTO employees VALUES ( 700, 'Honey', 'Rider', 'honey.rider@trivadislabs.com', '650.123.1234', TO_DATE('18.07.04', 'dd-MM-yyyy'), 'HR_MGR', 8000, NULL, 100, 70);
INSERT INTO employees VALUES ( 701, 'Vesper', 'Lynd', 'vesper.lynd@trivadislabs.com', '650.123.2234', TO_DATE('10.04.05', 'dd-MM-yyyy'), 'HR_REP', 8200, NULL, 700, 70);
-- enable integrity constraint to DEPARTMENTS
ALTER TABLE departments ENABLE CONSTRAINT dept_mgr_fk;
COMMIT;
-- EOF ------------------------------------------------------------------------- | true |
68ebef9555662a1ff33455ebcb2f9e878d984e67 | SQL | tronhammer/satanbarbara.com | /resources/db/mysql/sb.events.sql | UTF-8 | 1,725 | 3.375 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `satanbarbara`.`events` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`created` TIMESTAMP NOT NULL DEFAULT NOW(),
`creator_id` INT(11) NOT NULL,
`type_id` INT(11) NOT NULL,
`title` VARCHAR(255) NOT NULL,
`subtitle` VARCHAR(255) NOT NULL DEFAULT "",
`description` TEXT NOT NULL DEFAULT "",
`location` VARCHAR(255) NOT NULL,
`date` DATE NOT NULL,
`start_time` TIMESTAMP NOT NULL,
`end_time` TIMESTAMP NOT NULL,
`ages` ENUM("all", "18", "21", "not sure") NOT NULL,
`venue` VARCHAR(255) NOT NULL,
`venue_type_id` INT(11) NOT NULL,
`price` VARCHAR(128) NOT NULL DEFAULT "not sure",
`genre_id` INT(11) NOT NULL,
`eventlist_id` INT(11) NOT NULL,
`map_uri` VARCHAR(1028) NOT NULL DEFAULT "https://maps.google.com/",
`ticket_uri` VARCHAR(1028) NOT NULL DEFAULT "not sure",
`promocode` VARCHAR(128) NOT NULL DEFAULT "",
`archived` BOOLEAN NOT NULL DEFAULT 0,
`deleted` BOOLEAN NOT NULL DEFAULT 0,
FOREIGN KEY (`creator_id`) REFERENCES `accounts`(`id`),
FOREIGN KEY (`type_id`) REFERENCES `descriptors`(`id`),
FOREIGN KEY (`venue_type_id`) REFERENCES `descriptors`(`id`),
FOREIGN KEY (`genre_id`) REFERENCES `descriptors`(`id`),
PRIMARY KEY (`id`)
) ENGINE=`InnoDB` DEFAULT CHARSET=`utf8` COLLATE=`utf8_unicode_ci` AUTO_INCREMENT=1;
INSERT INTO `satanbarbara`.`events` (
`creator_id`,
`title`,
`location`,
`ages`,
`venue`,
`price`,
`date`,
`start_time`,
`end_time`,
`type_id`,
`venue_type_id`,
`genre_id`
) values (
1,
"Test",
"test place",
"18",
"house party",
"12.50",
NOW(),
NOW(),
NOW(),
1,
1,
1
); | true |
9d9291216a3998ec4d2401eae62d0da1ed3c99bd | SQL | Joaquin6/vw-stripe | /common/libs/db/scripts/includePrivateLabelItems.sql | UTF-8 | 648 | 2.890625 | 3 | [] | no_license | SELECT *
FROM public.item
WHERE (TYPE IN ('wheel',
'tire',
'accessory')
AND specification ->> 'private_label_item' = '0')
UNION
SELECT *
FROM public.item
WHERE (TYPE IN ('wheel',
'tire',
'accessory')
AND specification ->> 'private_label_item' = '1')
AND ((specification ->> 'private_label_customer_1' = $1)
OR (specification ->> 'private_label_customer_2' = $1)
OR (specification ->> 'private_label_customer_3' = $1)
OR (specification ->> 'private_label_customer_4' = $1)
OR (specification ->> 'private_label_customer_5' = $1))
ORDER BY id; | true |
4cb24428df751b022ce1245575e392af7285a015 | SQL | tahmaz/c | /Components/components.sql | UTF-8 | 362 | 2.890625 | 3 | [] | no_license | CREATE TABLE test.components(
ID INT NOT NULL AUTO_INCREMENT,
NAME VARCHAR(30),
TYPE VARCHAR(20),
COUNT smallint(15),
LOCATION VARCHAR(20),
LINK VARCHAR(200),
DESCRIPTION mediumtext,
PRIMARY KEY(ID)
);
drop table components;
TRUNCATE TABLE components;
Insert into test.components(NAME,TYPE,COUNT) VALUES('2N5551S','TRANSISTOR',1);
select * from components;
| true |
bda66f499443c93d05f6b0c09966705a09ab3d28 | SQL | christopher-kwon/codetech | /src/main/resources/sql/table/user_report.sql | UTF-8 | 2,099 | 3.84375 | 4 | [] | no_license | drop table user_report cascade constraints;
create table user_report
(
user_report_id number(6) primary key,
report_subject varchar2(50) not null,
report_content varchar2(200) not null,
created_at date default sysdate,
updated_at date default sysdate,
report_status number(1) default 1 not null,
reporter number(6) not null,
reported_user number(6) not null,
constraint fk_user_report_status foreign key (report_status) references report_status (report_status_id),
constraint fk_user_report_reporter foreign key (reporter) references users (user_id),
constraint fk_user_report_reported_user foreign key (reported_user) references users (user_id)
);
select *
from user_report;
-- 유저가 유저 신고
INSERT INTO USER_REPORT
(user_report_id, report_subject, report_content, report_status, reporter, reported_user)
VALUES
(1, '유저가 유저를 신고합니다.', '사실 구라에요', 1, 10, 15);
INSERT INTO USER_REPORT
(user_report_id, report_subject, report_content, report_status, reporter, reported_user)
VALUES
(2, '유저가 유저를 신고합니다.', '사실 구라에요 무야~호!', 1, 11, 14);
INSERT INTO USER_REPORT
(user_report_id, report_subject, report_content, report_status, reporter, reported_user)
VALUES
(3, '유저가 유저를 신고합니다.', '사실 구라에요 라고 할 뻔ㅋ', 1, 12, 13);
-- 가게가 유저 신고
INSERT INTO USER_REPORT
(user_report_id, report_subject, report_content, report_status, reporter, reported_user)
VALUES
(4, '가게가 유저를 신고합니다.', '사실 구라에요', 1, 3, 15);
INSERT INTO USER_REPORT
(user_report_id, report_subject, report_content, report_status, reporter, reported_user)
VALUES
(5, '가게가 유저를 신고합니다.', '사실 구라에요 무야~호!', 1, 3, 14);
INSERT INTO USER_REPORT
(user_report_id, report_subject, report_content, report_status, reporter, reported_user)
VALUES
(6, '가게가 유저를 신고합니다.', '사실 구라에요 라고 할 뻔ㅋ', 1, 3, 13);
commit; | true |
708b91b2da42d549af30bdf134574914d02ea262 | SQL | minervaliste/Project-Week-2-Barcelona | /your-project/Queries_extract_tables_per_district_and_year.sql | UTF-8 | 1,124 | 3.953125 | 4 | [] | no_license | USE p2_population;
-- Immigrant age ranges per district and year (percentage)
SELECT a.year, sub_q.district_name, a.age, ((sum(a.immigrants)/sub_q.total_immigrants)*100) AS immigrants_percentage
FROM age AS a
JOIN (SELECT a1.year, d.neig_code, d.district_name, sum(a1.immigrants) as total_immigrants
FROM age AS a1
LEFT JOIN district AS d ON d.neig_code = a1.neig_code
GROUP BY d.district_name, a1.year) sub_q ON a.neig_code = sub_q.neig_code AND a.year = sub_q.year
GROUP BY sub_q.district_name, a.age, a.year
ORDER BY a.year DESC, sub_q.district_name, a.age ASC;
-- Immigrant gender per district and year (percentage)
SELECT g.year, sub_q.district_name, g.gender, ((sum(g.immigrants)/sub_q.total_immigrants)*100) AS immigrants_percentage
FROM gender AS g
JOIN (SELECT g1.year, d.neig_code, d.district_name, sum(g1.immigrants) as total_immigrants
FROM gender AS g1
LEFT JOIN district AS d ON d.neig_code = g1.neig_code
GROUP BY d.district_name, g1.year) sub_q ON g.neig_code = sub_q.neig_code AND g.year = sub_q.year
GROUP BY sub_q.district_name, g.gender, g.year
ORDER BY g.year DESC, sub_q.district_name, g.gender ASC; | true |
114c019865b3e3ee1bbda9022e6024723c1c3ba8 | SQL | comeRodriguez/relational-databases-project | /VIEWS.sql | UTF-8 | 3,838 | 3.984375 | 4 | [] | no_license | DROP VIEW IF EXISTS MauvaisEtat;
DROP VIEW IF EXISTS LivresDispo;
DROP VIEW IF EXISTS FilmsDispo;
DROP VIEW IF EXISTS EnregistrementsDispo;
DROP VIEW IF EXISTS EmpruntEnCours;
DROP VIEW IF EXISTS LivresLesPlusEmpruntes;
DROP VIEW IF EXISTS GrandsRetardataires;
DROP VIEW IF EXISTS retard;
/*Lors de notre passage au JSON, les tables suivantes ne pourront pas être créés au niveau du SQL, car les attributs auquelles elles font référence sont en JSON. Cependant, une version équivalente pourra être reproduite en applicatif */
--DROP VIEW IF EXISTS AuteursLesPlusLus;
--DROP VIEW IF EXISTS Blacklist;
/* l'attribut blacklist étant contenu dans l'attribut JSON personne, cette table devra être créée au niveau applicatif
-- Comptes blacklisté
CREATE VIEW Blacklist (login, nom, prenom)
AS
SELECT login, nom, prenom
FROM Adherent, Compte
WHERE Adherent.Blacklist AND Adherent.idAdherent = Compte.adherent;
*/
-- Exemplaire déteriores
CREATE VIEW MauvaisEtat (idExemplaire, login, dateRetour, Montant, Rembourse)
AS
SELECT idExemplaire, login, dateRetour, Remboursement, dateRemboursement IS NULL AS Rembourse
FROM Adherent, Pret, Deterioration
WHERE Pret.emprunteur = Adherent.login AND Deterioration.idPret = Pret.idPret;
--Documents qui peuvent être empruntes (disponibles et en bon état)
CREATE VIEW LivresDispo (idExemplaire,codeLivre,titre)
AS
SELECT idExemplaire, codeLivre, titre
FROM exemplaire, livre
WHERE livre IS NOT NULL AND codeLivre = livre AND disponibilite AND bonEtat;
CREATE VIEW FilmsDispo (idExemplaire,codeFilm,titre)
AS
SELECT idExemplaire, codeFilm, titre
FROM exemplaire, film
WHERE film IS NOT NULL AND codeFilm = film AND disponibilite AND bonEtat;
CREATE VIEW EnregistrementsDispo (idExemplaire,codeEnregistrement,titre)
AS
SELECT idExemplaire, codeEnregistrement, titre
FROM exemplaire, enregistrement
WHERE enregistrement IS NOT NULL AND codeEnregistrement = enregistrement AND disponibilite AND bonEtat;
-- Documents qui sont empruntés
-- Les plus empruntés
-- Jointure gauche pour ajouter au classement les livres qui n'ont jamais été empruntés
-- View similaire pour film et enregistrement (il suffit de remplacer les references à livre par les autres)
CREATE VIEW LivresLesPlusEmpruntes(idExemplaire,codeLivre,titre,nEmprunt)
AS
SELECT e.idExemplaire, codeLivre, titre, COUNT(ep.idExemplaire) as nEmprunt
FROM exemplaire e
INNER JOIN livre l
ON e.livre = l.codeLivre
LEFT JOIN exemplairePret ep
ON e.idExemplaire = ep.idExemplaire
GROUP BY e.idExemplaire, l.codeLivre, titre
ORDER BY nEmprunt DESC, e.idExemplaire;
-- Listes des utilisateurs qui ont/ont eu des retards pour rendre des prêts
CREATE VIEW GrandsRetardataires(idAdherent,login,nRetard)
AS
SELECT emprunteur, login, COUNT(emprunteur) as nRetard
FROM Pret, compte
WHERE
CASE WHEN (dateRetour IS NOT NULL) THEN dateRetour - dateEmprunt > duree
ELSE CURRENT_DATE - dateEmprunt > duree
END
AND emprunteur = Adherent
GROUP BY emprunteur, login
ORDER BY nRetard DESC;
CREATE VIEW retard AS
SELECT idPret, dateemprunt, dateRetour, emprunteur, duree, CASE
WHEN dateRetour IS NOT NULL THEN dateRetour-dateEmprunt
ELSE CURRENT_DATE - dateEmprunt
END
AS dureeTotale
FROM pret pr WHERE
(SELECT CASE
WHEN dateRetour IS NOT NULL THEN dateRetour-dateEmprunt
ELSE CURRENT_DATE - dateEmprunt
END
FROM pret WHERE idPret = pr.idPret) > duree;
/* Auteur devenant un attribut JSON de livre, cette table devra être crée au niveau applicatif
CREATE VIEW AuteursLesPlusLus(Auteur,nom,prenom,nEmprunt)
AS
SELECT idAuteur, nom, prenom, count(idAuteur) as nEmprunt
FROM exemplairePret ep, exemplaire e, livreAuteur la, contributeur c
WHERE
e.livre IS NOT NULL AND
e.livre = la.codeLivre AND
ep.idExemplaire = e.idExemplaire AND
c.idContributeur = la.idAuteur
GROUP BY idAuteur, nom, prenom
ORDER BY nEmprunt DESC;
*/
| true |
b31e32862c542a867affb828d0e387b06429520e | SQL | RevaLipton/TEWork | /java-final-capstone-team-brewery-finder/final-capstone/back-end/java/database/beersBrewsBattlestarGalactica.sql | UTF-8 | 5,086 | 3.34375 | 3 | [] | no_license | DROP TABLE IF EXISTS beers cascade;
DROP TABLE IF EXISTS beerbrewery cascade;
DROP TABLE IF EXISTS beertypes cascade;
DROP TABLE IF EXISTS beertyperelator cascade;
DROP TABLE IF EXISTS reviews cascade;
DROP TABLE IF EXISTS beersreviews cascade;
DROP TABLE IF EXISTS usersbreweries cascade;
DROP TABLE IF EXISTS breweries cascade;
CREATE TABLE breweries(
id SERIAL,
brewery_name VARCHAR(64),
history VARCHAR(3600),
open_from VARCHAR(16),
open_to VARCHAR(16),
days_open VARCHAR(16),
address VARCHAR(64),
PRIMARY KEY(id)
);
CREATE TABLE usersbreweries(
id SERIAL,
userid int,
breweryid int,
CONSTRAINT usersbreweries_pkey PRIMARY KEY (userid, breweryid)
);
CREATE TABLE beertypes(
typeid SERIAL,
type varchar(32),
description varchar(128),
PRIMARY KEY(typeid)
);
CREATE TABLE beers(
beerid SERIAL,
name varchar(32),
image varchar(256),
description varchar(256),
abv varchar(12),
type int,
CONSTRAINT pk_beerid PRIMARY KEY(beerid),
FOREIGN KEY(type) REFERENCES beertypes(typeid)
);
CREATE TABLE reviews(
reviewid serial,
rating int,
review varchar(3600),
primary key(reviewid)
);
CREATE TABLE beersreviews(
beerid int REFERENCES beers(beerid),
reviewid int REFERENCES reviews(reviewid),
CONSTRAINT beersreviews_pkey PRIMARY KEY (beerid, reviewid)
);
CREATE TABLE beerbrewery(
breweryid int REFERENCES breweries(id),
beerid int REFERENCES beers(beerid),
CONSTRAINT beerbrewery_pkey PRIMARY KEY(breweryid, beerid)
);
CREATE TABLE beertyperelator(
typeid int REFERENCES beertypes(typeid),
beerid int REFERENCES beers(beerid),
CONSTRAINT beertyperelator_pkey PRIMARY KEY(typeid, beerid)
);
INSERT INTO beertypes (type, description) VALUES ('IPA', 'Imperial Pale Ale'); -- 1
INSERT INTO beertypes (type, description) VALUES ('Ale', 'Something'); -- 2
INSERT INTO beertypes (type, description) VALUES ('Pilsner', 'Pils'); -- 3
INSERT INTO beertypes (type, description) VALUES ('Lager', 'For loggers'); -- 4
INSERT INTO beertypes (type, description) VALUES ('Sour', 'Pucker up'); -- 5
INSERT INTO beertypes (type, description) VALUES ('Wheat', 'Smooth'); -- 6
INSERT INTO beertypes (type, description) VALUES ('Fruit', 'tooty'); -- 7
INSERT INTO beers (name, image, description, type) VALUES ('Stella Artois', 'www.stella.com', 'has its own special glass', 3);
INSERT INTO beers (name, image, description, type) VALUES ('Pile Driver', 'www.pdbeer.com', 'Drives it home', 1);
INSERT INTO beers (name, image, description, type) VALUES ('Warhead', 'www.supersour.com', 'Will get your lips twisted', 5);
INSERT INTO beers (name, image, description, type) VALUES ('Ale', 'www.ale.com', 'Its an ale', 2);
INSERT INTO beers (name, image, description, type) VALUES ('Coors', 'www.coors.com', 'Ride the bullet', 4);
INSERT INTO beers (name, image, description, type) VALUES ('Bud', 'www.budweiser.com', 'Standard american swill', 2);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (1, 1);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (1, 2);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (1, 3);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (2, 2);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (2, 3);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (3, 1);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (3, 2);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (3, 3);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (4, 1);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (4, 3);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (5, 1);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (5, 2);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (5, 3);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (6, 1);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (6, 2);
INSERT INTO beerbrewery (beerid, breweryid) VALUES (6, 3);
INSERT INTO beertyperelator (beerid, typeid) VALUES (1, 3);
INSERT INTO beertyperelator (beerid, typeid) VALUES (2, 1);
INSERT INTO beertyperelator (beerid, typeid) VALUES (3, 5);
INSERT INTO beertyperelator (beerid, typeid) VALUES (4, 2);
INSERT INTO beertyperelator (beerid, typeid) VALUES (5, 4);
INSERT INTO beertyperelator (beerid, typeid) VALUES (6, 2);
UPDATE beers SET abv = '5.5' WHERE beerid = 1;
UPDATE beers SET abv = '2.4' WHERE beerid = 2;
UPDATE beers SET abv = '7.9' WHERE beerid = 3;
UPDATE beers SET abv = '1.5' WHERE beerid = 4;
UPDATE beers SET abv = '3.4' WHERE beerid = 5;
UPDATE beers SET abv = '4.0' WHERE beerid = 6;
SELECT * FROM beers b
INNER JOIN beerbrewery bb
ON bb.beerid = b.beerid
INNER JOIN breweries brew
ON bb.breweryid = brew.id
WHERE brew.brewery_name = 'this';
SELECT * FROM beerbrewery;
SELECT * FROM beertyperelator;
SELECT * FROM beertypes;
Select id from breweries where brewery_name = 'two';
INSERT INTO reviews (rating, review) VALUES (4,'it was bitter');
INSERT INTO beersreviews(reviewid, beerid) VALUES (1, 1);
| true |
37ed8fe169522f409ce2bd293f6cd94de2d542de | SQL | 3omar3allam/Movies-Database-Model | /script.sql | UTF-8 | 5,774 | 3.546875 | 4 | [] | no_license | -- MySQL Script generated by MySQL Workbench
-- Mon 10 Dec 2018 04:19:52 PM EET
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema Movies
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema Movies
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `Movies` ;
USE `Movies` ;
-- -----------------------------------------------------
-- Table `Movies`.`award`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Movies`.`award` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`year` YEAR(4) NOT NULL,
`type` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `award_idx` (`id` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Movies`.`claims`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Movies`.`claims` (
`person_id` INT(11) NULL,
`award_id` INT(11) NOT NULL,
`movie_id` INT(11) NOT NULL,
PRIMARY KEY (`award_id`),
INDEX `award_idx` (`award_id` ASC),
INDEX `person_idx` (`person_id` ASC),
INDEX `movie_idx` (`movie_id` ASC),
CONSTRAINT `winner_person`
FOREIGN KEY (`person_id`)
REFERENCES `Movies`.`person` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
CONSTRAINT `claimed_award`
FOREIGN KEY (`award_id`)
REFERENCES `Movies`.`award` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
CONSTRAINT `winner_movie`
FOREIGN KEY (`movie_id`)
REFERENCES `Movies`.`movie` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Movies`.`genre`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Movies`.`genre` (
`name` ENUM('action', 'adventure', 'comedy', 'drama', 'historical', 'horror', 'musicals/dance', 'romance', 'rom-com', 'sci-fi', 'war', 'westerns') NOT NULL,
PRIMARY KEY (`name`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Movies`.`movie`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Movies`.`movie` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(256) CHARACTER SET 'cp1256' NOT NULL,
`year` YEAR(4) NOT NULL,
`director_id` INT(11) NOT NULL,
`rating` ENUM('G', 'PG', 'PG-13', 'R', 'NC-17') NULL DEFAULT NULL,
`writer_id` INT(11) NOT NULL,
`producer_id` INT(11) NOT NULL,
PRIMARY KEY (`id`, `writer_id`, `director_id`, `producer_id`),
UNIQUE INDEX `movie_idx` (`id` ASC),
INDEX `director_idx` (`director_id` ASC),
INDEX `writer_idx` (`writer_id` ASC),
INDEX `producer_idx` (`producer_id` ASC),
CONSTRAINT `director`
FOREIGN KEY (`director_id`)
REFERENCES `Movies`.`person` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
CONSTRAINT `writer`
FOREIGN KEY (`writer_id`)
REFERENCES `Movies`.`person` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
CONSTRAINT `producer`
FOREIGN KEY (`producer_id`)
REFERENCES `Movies`.`person` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Movies`.`movie_genre`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Movies`.`movie_genre` (
`movie_id` INT(11) NOT NULL,
`genre_name` ENUM('action', 'adventure', 'comedy', 'drama', 'historical', 'horror', 'musicals/dance', 'romance', 'rom-com', 'sci-fi', 'war', 'westerns') NOT NULL,
PRIMARY KEY (`movie_id`, `genre_name`),
INDEX `genre_idx` (`genre_name` ASC),
INDEX `movie_idx` (`movie_id` ASC),
CONSTRAINT `movie_of_this_genre`
FOREIGN KEY (`movie_id`)
REFERENCES `Movies`.`movie` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `genre`
FOREIGN KEY (`genre_name`)
REFERENCES `Movies`.`genre` (`name`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Movies`.`movie_staff`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Movies`.`movie_staff` (
`actor_id` INT(11) NOT NULL,
`movie_id` INT(11) NOT NULL,
`salary` INT UNSIGNED NULL,
PRIMARY KEY (`movie_id`, `actor_id`),
INDEX `acts_in_idx` (`movie_id` ASC),
INDEX `acted_by_idx` (`actor_id` ASC),
CONSTRAINT `working_actor`
FOREIGN KEY (`actor_id`)
REFERENCES `Movies`.`person` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
CONSTRAINT `movie_acting_on`
FOREIGN KEY (`movie_id`)
REFERENCES `Movies`.`movie` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Movies`.`person`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Movies`.`person` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(45) NOT NULL,
`last_name` VARCHAR(45) NOT NULL,
`doB` DATE NULL DEFAULT NULL,
`poB` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `person_idx` (`id` ASC))
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true |
bf67bbec4ebc758ceeeba72266fb404024d4d15b | SQL | knuber/hc_comp | /SQL/DB2/DB2 for i/FFSBGLR1_GJ.sql | UTF-8 | 6,309 | 3.390625 | 3 | [] | no_license | CREATE OR REPLACE PROCEDURE RLARP.SB_GJ_R1 (
IN vPERD VARCHAR(4)
)
DYNAMIC RESULT SETS 1
LANGUAGE SQL
SPECIFIC RLARP.SB_GJ_R1
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
SET OPTION ALWBLK = *ALLREAD ,
ALWCPYDTA = *OPTIMIZE ,
COMMIT = *NONE ,
DECRESULT = (31, 31, 00) ,
DFTRDBCOL = *NONE ,
DYNDFTCOL = *NO ,
DYNUSRPRF = *USER ,
SRTSEQ = *HEX
BEGIN
------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE V_ERROR INTEGER ;
DECLARE MSG_VAR VARCHAR ( 255 ) ;
DECLARE RETRN_STATUS INTEGER ;
DECLARE C1 CURSOR WITH RETURN TO CLIENT FOR SELECT * FROM TABLE(RLARP.FN_ISB(vPERD)) AS X;
DECLARE EXIT HANDLER FOR SQLEXCEPTION --,SQLWARNING
BEGIN
SET V_ERROR = SQLCODE ;
GET DIAGNOSTICS RETRN_STATUS = RETURN_STATUS ;
IF ( V_ERROR IS NULL ) OR ( V_ERROR <> 0 AND V_ERROR <> 466 ) OR ( RETRN_STATUS > 3 )
THEN
SET MSG_VAR = 'PROC: ' || 'RLARP.SB_UD' || ', ' || COALESCE ( MSG_VAR , '' ) || ', SQLCODE: ' || CHAR ( V_ERROR ) || ', PARAMS: ';
--ROLLBACK;
--COMMIT;
SET RETRN_STATUS = - 1;
SIGNAL SQLSTATE '75001' SET MESSAGE_TEXT = MSG_VAR ;
ELSE
SET V_ERROR = 0 ;
END IF ;
END ;
------------------------------------------------------------------------------------------------------------------------------------------------------
DELETE FROM RLARP.FFSBGLR1 WHERE PERD = vPERD AND SUBSTR(MODULE,1,2) IN ('GJ','RJ','OS','AU');
------------------------------------------------------------------------------------------------------------------------------------------------------
DELETE FROM RLARP.FFSBGLWF;
------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT INTO
RLARP.FFSBGLWF
SELECT
DKSRCE||DKQUAL ,
DIGITS(DKBTC#) , DIGITS(DKFSYY)||DIGITS(DKFSPR) AS PERD,
CHAR(DKTDAT) ,
CHAR(DKPDAT) ,
DIGITS(DKACC#) ,
DKAMT ,
DKPJNM ,
DKFUT4 ,
DKREV ,
'JOURNAL ENTRY' AS CUSMOD,
DKADDD AS CUSKEY1,
'BATCH DESCR' AS CUSKEY1D,
DKREFD AS CUSKEY2,
'LINE DESCR' AS CUSKEY2D,
DKKEYN AS CUSKEY3,
'BATCH' AS CUSKEY3D,
DKREF# AS CUSKEY4,
'JOUNAL' AS CUSKEY4D,
'' AS CUSVEND,
DKBCUS AS CUSCUST, DIGITS(DKRCID) AS RECID
FROM
LGDAT.GTRAN GTRAN
WHERE
DKFSYR = 20 AND
DIGITS(DKFSYY)||DIGITS(DKFSPR) = vPERD AND
DKSRCE IN ('GJ','RJ','OS','AU')
UNION ALL
SELECT
DKSRCE||DKQUAL ,
DIGITS(DKBTC#) , DIGITS(DKFSYY)||DIGITS(DKFSPR) AS PERD,
CHAR(DKTDAT) ,
CHAR(DKPDAT) ,
DIGITS(DKACC#) ,
DKAMT ,
DKPJNM ,
DKFUT4 ,
DKREV ,
'JOURNAL ENTRY' AS CUSMOD,
DKADDD AS CUSKEY1,
'BATCH DESCR' AS CUSKEY1D,
DKREFD AS CUSKEY2,
'LINE DESCR' AS CUSKEY2D,
DKKEYN AS CUSKEY3,
'BATCH' AS CUSKEY3D,
DKREF# AS CUSKEY4,
'JOUNAL' AS CUSKEY4D,
'' AS CUSVEND,
DKBCUS AS CUSCUST, DIGITS(DKRCID) AS RECID
FROM
LGDAT.GTLYN GTRAN
WHERE
DKFSYR = 20 AND
DIGITS(DKFSYY)||DIGITS(DKFSPR) = vPERD AND
DKSRCE IN ('GJ','RJ','OS','AU')
UNION ALL
SELECT
DKSRCE||DKQUAL ,
DIGITS(DKBTC#) , DIGITS(DKFSYY)||DIGITS(DKFSPR) AS PERD,
CHAR(DKTDAT) ,
CHAR(DKPDAT) ,
DIGITS(DKACC#) ,
DKAMT ,
DKPJNM ,
DKFUT4 ,
DKREV ,
'JOURNAL ENTRY' AS CUSMOD,
DKADDD AS CUSKEY1,
'BATCH DESCR' AS CUSKEY1D,
DKREFD AS CUSKEY2,
'LINE DESCR' AS CUSKEY2D,
DKKEYN AS CUSKEY3,
'BATCH' AS CUSKEY3D,
DKREF# AS CUSKEY4,
'JOUNAL' AS CUSKEY4D,
'' AS CUSVEND,
DKBCUS AS CUSCUST, DIGITS(DKRCID) AS RECID
FROM
LGDAT.GNYTR GTRAN
WHERE
DKFSYR = 20 AND
DIGITS(DKFSYY)||DIGITS(DKFSPR) = vPERD AND
DKSRCE IN ('GJ','RJ','OS','AU');
------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT INTO
RLARP.FFSBGLR1_E
SELECT
W.MODULE,
W.BATCH,
W.PERD,
W.TDATE,
W.PDATE,
W.ACCT,
SUM(W.AMT) AMT,
W.PROJ,
W.USRN,
W.REV,
W.CUSMOD,
W.CUSKEY1,
W.CUSKEY1D,
W.CUSKEY2,
W.CUSKEY2D,
W.CUSKEY3,
W.CUSKEY3D,
W.CUSKEY4,
W.CUSKEY4D,
W.CUSVEND,
W.CUSCUST,
W.RECID
FROM
RLARP.FFSBGLWF W
EXCEPTION JOIN RLARP.FFSBGLR1 F ON
W.PERD = F.PERD AND
W.MODULE = F.MODULE AND
W.CUSMOD = F.CUSMOD AND
W.ACCT = F.ACCT AND
W.BATCH = F.BATCH AND
W.PDATE = F.PDATE AND
W.PROJ = F.PROJ AND
W.CUSKEY1 = F.CUSKEY1 AND
W.CUSKEY2 = F.CUSKEY2 AND
W.CUSKEY3 = F.CUSKEY3 AND
W.CUSKEY4 = F.CUSKEY4 AND
W.CUSVEND = F.CUSVEND AND
W.CUSCUST = F.CUSCUST AND
W.RECID = F.RECID
GROUP BY
W.MODULE,
W.BATCH,
W.PERD,
W.TDATE,
W.PDATE,
W.ACCT,
W.PROJ,
W.USRN,
W.REV,
W.CUSMOD,
W.CUSKEY1,
W.CUSKEY1D,
W.CUSKEY2,
W.CUSKEY2D,
W.CUSKEY3,
W.CUSKEY3D,
W.CUSKEY4,
W.CUSKEY4D,
W.CUSVEND,
W.CUSCUST,
W.RECID;
------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT INTO
RLARP.FFSBGLR1
SELECT
W.MODULE,
W.BATCH,
W.PERD,
W.TDATE,
W.PDATE,
W.ACCT,
SUM(W.AMT) AMT,
W.PROJ,
W.USRN,
W.REV,
W.CUSMOD,
W.CUSKEY1,
W.CUSKEY1D,
W.CUSKEY2,
W.CUSKEY2D,
W.CUSKEY3,
W.CUSKEY3D,
W.CUSKEY4,
W.CUSKEY4D,
W.CUSVEND,
W.CUSCUST,
W.RECID
FROM
RLARP.FFSBGLWF W
EXCEPTION JOIN RLARP.FFSBGLR1 F ON
W.PERD = F.PERD AND
W.MODULE = F.MODULE AND
W.CUSMOD = F.CUSMOD AND
W.ACCT = F.ACCT AND
W.BATCH = F.BATCH AND
W.PDATE = F.PDATE AND
W.PROJ = F.PROJ AND
W.CUSKEY1 = F.CUSKEY1 AND
W.CUSKEY2 = F.CUSKEY2 AND
W.CUSKEY3 = F.CUSKEY3 AND
W.CUSKEY4 = F.CUSKEY4 AND
W.CUSVEND = F.CUSVEND AND
W.CUSCUST = F.CUSCUST AND
W.RECID = F.RECID
GROUP BY
W.MODULE,
W.BATCH,
W.PERD,
W.TDATE,
W.PDATE,
W.ACCT,
W.PROJ,
W.USRN,
W.REV,
W.CUSMOD,
W.CUSKEY1,
W.CUSKEY1D,
W.CUSKEY2,
W.CUSKEY2D,
W.CUSKEY3,
W.CUSKEY3D,
W.CUSKEY4,
W.CUSKEY4D,
W.CUSVEND,
W.CUSCUST,
W.RECID;
OPEN C1;
END; | true |
5801da24d58676e3fb8c437302ad0911e6b5346d | SQL | arnielcasile/todolist | /todolist.sql | UTF-8 | 4,326 | 3.203125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 25, 2021 at 09:53 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.3.25
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `todolist`
--
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2021_06_24_083002_create_todo_lists_table', 1);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `todo_lists`
--
CREATE TABLE `todo_lists` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`completion_datetime` datetime DEFAULT NULL,
`deadline_datetime` datetime DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `todo_lists`
--
INSERT INTO `todo_lists` (`id`, `name`, `completion_datetime`, `deadline_datetime`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Technical Exam', NULL, '2021-06-25 16:00:00', '2021-06-25 07:49:12', '2021-06-25 07:49:12', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Arniel', 'admin@admin.com', '$2y$10$YXELgeRj7J5/YoPJ8o5zk.wTXeeWDb9MzZBWwFsTW1Q/6k70OpxrG', 'n1cqCKFxERBdZ5cX0GhqxMS3tpwHgM7svrn3bZZ2RgvVBH4XKqP8CgcrnrHB', '2021-06-25 07:47:58', '2021-06-25 07:47:58');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `todo_lists`
--
ALTER TABLE `todo_lists`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `todo_lists`
--
ALTER TABLE `todo_lists`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
ce0ba90dcda07a4524d25f9d5cf7718c5d0ab8f9 | SQL | tncrazvan/php_socket_io | /utils/database/dump/glorep_shared.sql | UTF-8 | 16,301 | 3.171875 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Versione server: 10.1.33-MariaDB - mariadb.org binary distribution
-- S.O. server: Win32
-- HeidiSQL Versione: 9.5.0.5196
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dump della struttura del database glorep_shared
CREATE DATABASE IF NOT EXISTS `glorep_shared` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `glorep_shared`;
-- Dump della struttura di tabella glorep_shared.lo_category
CREATE TABLE IF NOT EXISTS `lo_category` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Categoria_LO` int(11) NOT NULL COMMENT 'Refers to the category'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Technical capabilities necessary for using this learning...';
-- Dump dei dati della tabella glorep_shared.lo_category: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_category` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_category` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_contribute
CREATE TABLE IF NOT EXISTS `lo_contribute` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Role` varchar(50) NOT NULL COMMENT 'Kind of contribution.',
`Entity` varchar(1000) DEFAULT NULL COMMENT 'The identification of and information about entities contributing to this learnin object.',
`Date` varchar(20) DEFAULT NULL COMMENT 'The date of contribution.',
PRIMARY KEY (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_contribute_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Those Entities that have contibuted to the state of this...';
-- Dump dei dati della tabella glorep_shared.lo_contribute: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_contribute` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_contribute` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_educational
CREATE TABLE IF NOT EXISTS `lo_educational` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`InteractivityType` varchar(200) NOT NULL COMMENT 'Predominant mode of learning supported by this learning object.',
`LearningResourceType` varchar(200) NOT NULL COMMENT 'Specific kind of learning object.',
`InteractivityLevel` varchar(200) NOT NULL COMMENT 'The degree of interactivity characterizing this learning object.',
`SemanticDensity` varchar(200) NOT NULL COMMENT 'The degree of concisness of a learning object.',
`IntendedEndUserRole` varchar(200) NOT NULL COMMENT 'Principal users for which this learning object was designed.',
`Context` varchar(200) NOT NULL COMMENT 'The principal environment within which the learning and use of this learning object intended to take place.',
`TypicalAgeRange` varchar(1000) DEFAULT NULL COMMENT 'Age of the typical intended user.',
`Difficulty` varchar(200) NOT NULL COMMENT 'How hard it is to work with this learning object.',
`TypicalLearningTime` varchar(50) DEFAULT NULL COMMENT 'Time takes to work with this learning object.',
`edu_Description` varchar(1000) DEFAULT NULL COMMENT 'Comments on how this learning object is to be used.',
`edu_Language` varchar(100) DEFAULT NULL COMMENT 'The language used by the typical intended user.',
PRIMARY KEY (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_educational_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Technical capabilities necessary for using this learning...';
-- Dump dei dati della tabella glorep_shared.lo_educational: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_educational` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_educational` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_federation
CREATE TABLE IF NOT EXISTS `lo_federation` (
`ServerName` varchar(20) NOT NULL COMMENT 'A list of name of federated',
`ServerAddress` varchar(250) NOT NULL COMMENT 'A list of federated address',
`N_Lo` int(11) NOT NULL DEFAULT '0' COMMENT 'Number of Node.',
`TimeUpd` int(11) NOT NULL DEFAULT '0' COMMENT 'Time for sinc.',
PRIMARY KEY (`ServerName`),
UNIQUE KEY `ServerName` (`ServerName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Contains special Learning Object properties';
-- Dump dei dati della tabella glorep_shared.lo_federation: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_federation` DISABLE KEYS */;
INSERT INTO `lo_federation` (`ServerName`, `ServerAddress`, `N_Lo`, `TimeUpd`) VALUES
('unipg', '127.0.0.1', 0, 1532009456);
/*!40000 ALTER TABLE `lo_federation` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_file
CREATE TABLE IF NOT EXISTS `lo_file` (
`Id_Lo` int(10) unsigned NOT NULL,
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`url` varchar(255) NOT NULL COMMENT 'The server path where the file is located.',
`filename` varchar(255) NOT NULL COMMENT 'Name of the file.',
`filesize` varchar(255) NOT NULL COMMENT 'Size of the file.',
`filemime` varchar(255) NOT NULL COMMENT 'Name of the file.',
PRIMARY KEY (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_file_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Learning Object files';
-- Dump dei dati della tabella glorep_shared.lo_file: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_file` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_file` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_general
CREATE TABLE IF NOT EXISTS `lo_general` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Title` varchar(1000) DEFAULT NULL COMMENT 'Title of this Learning Object',
`Language` varchar(100) DEFAULT NULL COMMENT 'Language of this learning object.',
`Description` varchar(2000) DEFAULT NULL COMMENT 'Description of this Learning Object',
`Keyword` varchar(1000) DEFAULT NULL COMMENT 'Keyword of this Learning Object',
`Coverage` varchar(1000) DEFAULT NULL COMMENT 'Coverage of this learning object.',
`Structure` varchar(1000) DEFAULT NULL COMMENT 'Structure of this learning object.',
`Aggregation_Level` tinyint(4) DEFAULT NULL COMMENT 'Aggregation Level of this learning object.',
`Deleted` varchar(5) NOT NULL DEFAULT 'no' COMMENT 'set a yes if this learning object is deleted',
`TimeUpd` int(11) NOT NULL DEFAULT '0' COMMENT 'Time for sinc.',
PRIMARY KEY (`id`),
UNIQUE KEY `node_id` (`Id_Lo`,`Id_Fd`),
KEY `Id_Lo_Id_Fd` (`Id_Lo`,`Id_Fd`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Contains special Learning Object properties';
-- Dump dei dati della tabella glorep_shared.lo_general: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_general` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_general` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_identifier
CREATE TABLE IF NOT EXISTS `lo_identifier` (
`Id_Identifier` int(10) unsigned NOT NULL COMMENT 'A globally unique refers to a learning object.',
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Catalog` varchar(1000) NOT NULL COMMENT 'The name or designator of the identifications or cataloging scheme for this entry. A namespace scheme.',
`Entry` varchar(1000) NOT NULL COMMENT 'The value of the identifier within the identification or cataloging scheme that designates or identifies the target learning object. A namespace specific string.',
`TimeUpd` int(11) NOT NULL DEFAULT '0' COMMENT 'Time for sinc.',
PRIMARY KEY (`Id_Identifier`),
KEY `FK_lo_identifier_lo_general` (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_identifier_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='a globally unique label that identifies the target...';
-- Dump dei dati della tabella glorep_shared.lo_identifier: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_identifier` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_identifier` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_lifecycle
CREATE TABLE IF NOT EXISTS `lo_lifecycle` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Version` varchar(50) DEFAULT NULL COMMENT 'The version of the Learning Object.',
`Status` varchar(50) NOT NULL COMMENT 'The status or condition of the Learning Object.',
PRIMARY KEY (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_lifecycle_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Contains the story and the current state of the Learning...';
-- Dump dei dati della tabella glorep_shared.lo_lifecycle: ~1 rows (circa)
/*!40000 ALTER TABLE `lo_lifecycle` DISABLE KEYS */;
INSERT INTO `lo_lifecycle` (`Id_Lo`, `Id_Fd`, `Version`, `Status`) VALUES
(2, 'unige', '1', 'final'),
(2, 'unipg', '1', 'final');
/*!40000 ALTER TABLE `lo_lifecycle` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_metadata
CREATE TABLE IF NOT EXISTS `lo_metadata` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`MetadataSchema` varchar(30) DEFAULT NULL COMMENT 'Name and version of the authoritative specificationused to create this metadata istance.',
`Language` varchar(100) DEFAULT NULL COMMENT 'Language of this metadata istance.',
PRIMARY KEY (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_metadata_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='The category describes the metadata itself.';
-- Dump dei dati della tabella glorep_shared.lo_metadata: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_metadata` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_metadata` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_orcomposite
CREATE TABLE IF NOT EXISTS `lo_orcomposite` (
`Id_Composite` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Type` varchar(1000) DEFAULT NULL COMMENT 'Technology required to use this learning object.',
`Name` varchar(1000) DEFAULT NULL COMMENT 'Name of the required technology to use this learning object.',
`MinimumVersion` varchar(30) DEFAULT NULL COMMENT 'Lowest possible version of the required technology to use this learning object.',
`MaximumVersion` varchar(30) DEFAULT NULL COMMENT 'Highest possible version of the required technology to use this learning object.',
PRIMARY KEY (`Id_Composite`),
UNIQUE KEY `Id_Composite` (`Id_Composite`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Technical capabilities necessary for using this learning...';
-- Dump dei dati della tabella glorep_shared.lo_orcomposite: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_orcomposite` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_orcomposite` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_relation
CREATE TABLE IF NOT EXISTS `lo_relation` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Id_Target` int(10) unsigned NOT NULL COMMENT 'A globally unique refers to a learning object.',
`kind` varchar(200) NOT NULL COMMENT 'Describe the nature of the relationship between this learning object and the target learning object',
`TimeUpd` int(11) NOT NULL DEFAULT '0' COMMENT 'Time for sinc.',
PRIMARY KEY (`Id_Target`,`Id_Lo`,`Id_Fd`),
KEY `FK_lo_relation_lo_general` (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_relation_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='a globally unique label that identifies the target...';
-- Dump dei dati della tabella glorep_shared.lo_relation: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_relation` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_relation` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_requirement
CREATE TABLE IF NOT EXISTS `lo_requirement` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Id_Composite` int(10) unsigned NOT NULL COMMENT 'Technology required to use this learning object.',
PRIMARY KEY (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_requirement_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Technical capabilities necessary for using this learning...';
-- Dump dei dati della tabella glorep_shared.lo_requirement: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_requirement` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_requirement` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_rights
CREATE TABLE IF NOT EXISTS `lo_rights` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Cost` varchar(5) NOT NULL COMMENT 'Whether use of this learning object requires payment.',
`Copyright` varchar(5) NOT NULL COMMENT 'Whether copyright or other restriction apply to the use of this learning object.',
`rights_Description` varchar(1000) NOT NULL COMMENT 'Comments on the conditions of use of this learning object.',
PRIMARY KEY (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_rights_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Intellectual property rights and condition for use this...';
-- Dump dei dati della tabella glorep_shared.lo_rights: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_rights` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_rights` ENABLE KEYS */;
-- Dump della struttura di tabella glorep_shared.lo_technical
CREATE TABLE IF NOT EXISTS `lo_technical` (
`Id_Lo` int(10) unsigned NOT NULL COMMENT 'Refers to a Node Id.',
`Id_Fd` varchar(255) NOT NULL COMMENT 'A federation-unique ID.',
`Format` varchar(40) DEFAULT NULL COMMENT 'Technical datatypes of the learning object.',
`Size` varchar(30) DEFAULT NULL COMMENT 'The size of the digital learning object in bytes.',
`Location` varchar(1000) DEFAULT NULL COMMENT 'A string (URI or URL) that is used to access this learning object.',
`InstallationRemarks` varchar(1000) DEFAULT NULL COMMENT 'Description of how to install this learning object.',
`OtherPlatformRequirements` varchar(1000) DEFAULT NULL COMMENT 'Information about other software and hardware requirements.',
`Duration` varchar(50) DEFAULT NULL COMMENT 'Time a continuous learning object takes when played at intended speed.',
PRIMARY KEY (`Id_Lo`,`Id_Fd`),
CONSTRAINT `FK_lo_technical_lo_general` FOREIGN KEY (`Id_Lo`, `Id_Fd`) REFERENCES `lo_general` (`Id_Lo`, `Id_Fd`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Technical requirements and characteristics of the...';
-- Dump dei dati della tabella glorep_shared.lo_technical: ~0 rows (circa)
/*!40000 ALTER TABLE `lo_technical` DISABLE KEYS */;
/*!40000 ALTER TABLE `lo_technical` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
1a6238466bb45688dd047df001226e2e922d5c20 | SQL | khidji/finalproject | /database/create_db.sql | UTF-8 | 1,947 | 3.5 | 4 | [] | no_license |
USE `finalproject`;
CREATE TABLE `users` (
`pseudo` VARCHAR(60) UNIQUE NOT NULL PRIMARY KEY,
`first_name` VARCHAR(60) NOT NULL,
`last_name` VARCHAR(100) NOT NULL,
`phone` VARCHAR(10) NOT NULL,
`address` VARCHAR(255) NOT NULL,
`city` VARCHAR(100) NOT NULL,
`country` VARCHAR(70) NOT NULL,
`postal_code` VARCHAR(5) NOT NULL,
`email` VARCHAR(255) UNIQUE NOT NULL,
`password` VARCHAR(255) NOT NULL,
`is_admin` BOOLEAN DEFAULT false,
`created_at` DATETIME DEFAULT NOW(),
`updated_at` DATETIME
);
CREATE TABLE `categories` (
`id` INTEGER AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(150) UNIQUE NOT NULL,
`created_at` DATETIME DEFAULT NOW(),
`updated_at` DATETIME
);
CREATE TABLE `posts` (
`id` INTEGER AUTO_INCREMENT PRIMARY KEY,
`content` TEXT NOT NULL,
`image_url` TEXT,
`title` TEXT NOT NULL,
`user` VARCHAR(60) NOT NULL REFERENCES `users`(`pseudo`) ON DELETE CASCADE ON UPDATE CASCADE,
`category_id` INTEGER NOT NULL,
FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`),
`created_at` DATETIME DEFAULT NOW(),
`updated_at` DATETIME
);
CREATE TABLE `comments` (
`id` INTEGER AUTO_INCREMENT PRIMARY KEY,
`content` TEXT NOT NULL,
`user` VARCHAR(60) NOT NULL REFERENCES `users`(`pseudo`) ON DELETE CASCADE ON UPDATE CASCADE,
`post_id` INTEGER NOT NULL REFERENCES `posts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
`created_at` DATETIME DEFAULT NOW(),
);
INSERT INTO `users` (
`pseudo`,
`first_name`,
`last_name`,
`phone`,
`address`,
`city`,
`country`,
`postal_code`,
`email`,
`password`,
`is_admin`
)
VALUES ('testeur',
'John',
'Doe',
'0123456789',
'4 rue du test',
'testville',
'testpays',
'75001',
'test@test.com',
'$2y$14$MvQ8WCwDVeJbr36FUzP32.dn6hWOVVVR6rbe8mNX9NiFsr9WDFAeW',
TRUE
);
INSERT INTO `categories` (`name`)
VALUES ('HTML'),
('CSS'),
('JAVASCRIPT'),
('PHP'),
('AUTRES');
| true |
02cd63ce42b71230db7fffba9a48b0a84ef1b94f | SQL | bourn404/foundation-framework | /sql/db-setup.sql | UTF-8 | 2,947 | 3.703125 | 4 | [] | no_license | drop table if exists perms cascade;
create table perms (
id serial not null primary key
,category varchar(60)
,slug varchar(255) not null unique
,name varchar(60) not null
,description TEXT
,parent int references perms(id) on delete cascade
);
insert into perms (category, slug, name, description) values
('Administration','manage_system_settings','Manage System Settings','User can edit API keys and other system-wide settings.'),
('Contacts','view_contacts','View Contacts','User can view the contacts list.'),
('Contacts','manage_contacts','Make/Receive Calls','User can make and receive calls through the browser interface.'),
('Contacts','make_receive_calls','Make/Receive Calls','User can make and receive calls through the browser interface.'),
('Contacts','edit_own_contact_info','Edit Own Contact Info', 'Contacts with their own accounts can modify their contact info (i.e. email, phone).'),
('Permissions','manage_groups', 'Manage Groups', 'User can create/delete user groups and assign permissions to groups.'),
('Permissions','assign_groups', 'Assign Users to Groups', 'User can edit the user group of other users.');
drop table if exists user_groups cascade;
create table user_groups (
id serial not null primary key
,name varchar(60) not null
,is_built_in boolean default false -- Prevent role from being deleted in frontend
,is_super boolean default false
,is_default boolean unique -- Default for all new accounts
);
insert into user_groups (name, is_built_in, is_super, is_default) values
('Super Admin', true, true, null), -- Has all permission because is_super
('Registered User', true, false, true); -- Default for newly registered accounts
drop table if exists user_group_perms cascade;
create table user_group_perms (
user_group_id int references user_groups(id) on delete cascade
,perm_id int references perms(id) on delete cascade
,primary key(user_group_id,perm_id)
);
drop table if exists users cascade;
create table users (
id serial not null primary key
,firstname varchar(60) not null
,lastname varchar(60)
,user_group_id int references user_groups(id)
,company varchar(255)
,email varchar(255)
,password varchar(255)
,phone varchar(255)
,website varchar(255)
,is_contact boolean default true
);
insert into users (firstname, lastname, user_group_id, company, email, phone, website) values
('Carson','Fairbourn',(SELECT id FROM user_groups WHERE is_super = true),'Foundation Framework', 'bourn404@gmail.com', '385-281-3675','https://www.carsonfairbourn.com');
drop table if exists calls cascade;
create table calls (
id serial not null primary key
,uid varchar(255) not null -- twilio identifier
,status varchar(25) not null default 'ringing'
,from_number varchar(25) not null -- phone number
,from_user int references users(id)
,to_number varchar(25) not null -- phone number
,to_user int references users(id)
,duration int not null
,notes text
,recording varchar(255)
,created timestamp default CURRENT_TIMESTAMP
);
| true |
2b0809dfde3cd2335956644220a3fa96cb36c9d0 | SQL | Esteban131197/Proyecto-3_D2 | /restapi/mysql/db.sql | UTF-8 | 410 | 2.875 | 3 | [] | no_license | CREATE DATABASE IF NOT EXISTS Got ;
USE Got;
CREATE TABLE usuarios (
id INT (11) NOT NULL AUTO_INCREMENT,
name VARCHAR(45) DEFAULT NULL,
repositorio VARCHAR(45) DEFAULT NULL,
commitdescripcion VARCHAR(45) DEFAULT NULL,
visualizaciondocumento longblob,
PRIMARY KEY(id)
);
SELECT * FROM usuarios;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin'; | true |
9e7174f36189c74385bba188dca32277c507c7aa | SQL | ashminbhandari/resource_mgmt | /src/main/resources/initializeDB.sql | UTF-8 | 3,756 | 3.59375 | 4 | [] | no_license | CREATE DATABASE IF NOT EXISTS `resource_mgmt`;
USE `resource_mgmt`;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `resource`;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `resource`
(
`resource_id` int NOT NULL AUTO_INCREMENT,
`resource_name` TEXT,
`resource_code` int,
PRIMARY KEY (`resource_id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARSET = latin1;
LOCK TABLES `resource` WRITE;
INSERT INTO `resource`
VALUES (0, 'Procurement and Contracting Requirements', 000000),
(1, 'General Requirements', 010000),
(2, 'Existing Conditions', 020000),
(3, 'Concrete', 030000),
(4, 'Masonry', 040000),
(5, 'Metals', 050000),
(66, 'Wood, Plastics, and Composites', 060000),
(7, 'Thermal and Moisture Protection', 070000),
(8, 'Openings', 080000),
(9, 'Finishes', 090000),
(10, 'Specialities', 100000),
(11, 'Equipment', 110000),
(12, 'Furnishings', 120000),
(13, 'Special Construction', 130000),
(14, 'Conveying Equipment', 140000);
UNLOCK TABLES;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `project`;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `project`
(
`project_id` int NOT NULL AUTO_INCREMENT,
`project_name` TEXT,
PRIMARY KEY (`project_id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARSET = latin1;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `project_resource`;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `project_resource`
(
`project_resource_id` int NOT NULL AUTO_INCREMENT,
`project` int,
`resource` int,
PRIMARY KEY (`project_resource_id`),
FOREIGN KEY (`project`) references project (project_id),
FOREIGN KEY (`resource`) references resource (resource_id)
) ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARSET = latin1;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `user_profile`;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `user_profile`
(
`user_profile_id` int NOT NULL AUTO_INCREMENT,
`user_type` TEXT,
PRIMARY KEY (`user_profile_id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARSET = latin1;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `user`;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `user`
(
`user_id` int NOT NULL AUTO_INCREMENT,
`user_username` TEXT,
`user_password` TEXT,
`user_profile_id` int,
PRIMARY KEY (`user_id`),
FOREIGN KEY (`user_profile_id`) references user_profile (`user_profile_id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARSET = latin1;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `column_added`;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `column_added`
(
`column_added_name` VARCHAR(700),
PRIMARY KEY (column_added_name)
)
ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARSET = latin1;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `column_added_row_value`;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `column_added_row_value`
(
`column_added_row_value_id` int NOT NULL AUTO_INCREMENT,
`resource_id` int,
`column_added_name` VARCHAR(700) not null,
PRIMARY KEY (`column_added_row_value_id`),
FOREIGN KEY (`column_added_name`) references column_added(`column_added_name`),
FOREIGN KEY (`resource_id`) references resource (`resource_id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARSET = latin1;
ALTER TABLE `column_added_row_value` ADD UNIQUE `unique_index`(`column_added_name`, `resource_id`);
create table itlize_user_profile
(
id int null,
type int null
);
INSERT IGNORE INTO `resource_mgmt`.`itlize_user_profile` (`id`, `type`) VALUES ('1', 'ADMIN');
INSERT IGNORE INTO `resource_mgmt`.`itlize_user_profile` (`id`, `type`) VALUES ('2', 'USER');
| true |
5c5a7f505faab28728f9769110bcaa3ec34a183b | SQL | kprzekwas/project_bd | /init_tables.sql | UTF-8 | 3,529 | 3.765625 | 4 | [] | no_license | use kprzekwas
CREATE TABLE pojazd (
id_pojazdu int IDENTITY(1,1) PRIMARY KEY,
id_modelu int,
id_rodzaju int,
id_koloru int,
rok_produkcji int,
nr_vin varchar(25) UNIQUE not null,
przebieg BIGINT not null,
data_przyjecia date not null,
cena MONEY not null,
)
CREATE TABLE marki (
id_marki int IDENTITY(1,1) PRIMARY KEY,
nazwa_marki VARCHAR(30) not NULL,
kraj_pochodzenia VARCHAR (30) not null,
)
CREATE TABLE kolor (
id_koloru int IDENTITY(1,1) PRIMARY KEY,
nazwa_koloru VARCHAR(20) not NULL,
)
CREATE TABLE model (
id_modelu int IDENTITY(1,1) PRIMARY KEY,
nazwa_modelu VARCHAR(30) not NULL,
id_marki int, --klucz obcy marki
)
CREATE TABLE rodzaj (
id_rodzaju int IDENTITY(1,1) PRIMARY KEY,
rodzaj_pojazdu VARCHAR(30) not NULL,
)
--dodawanie kluczy obcych do encji pojazd
ALTER TABLE pojazd ADD CONSTRAINT kolor_pojazd_fk FOREIGN KEY (id_koloru) REFERENCES kolor(id_koloru)
ALTER TABLE pojazd ADD CONSTRAINT model_pojazd_fk FOREIGN KEY (id_modelu) REFERENCES model(id_modelu)
ALTER TABLE pojazd ADD CONSTRAINT rodzaj_pojazd_fk FOREIGN KEY (id_rodzaju) REFERENCES rodzaj(id_rodzaju)
ALTER TABLE model ADD CONSTRAINT marki_model_fk FOREIGN KEY (id_marki) REFERENCES marki(id_marki)
--Tworzenie encji klient
CREATE TABLE klient (
id_klienta int IDENTITY(1,1) PRIMARY KEY,
id_adres int,
imie varchar(30) not null,
Nazwisko varchar(50) not null,
PESEL char(11) not null,
NIP varchar(20),
telefon varchar(20) not null,
email varchar(50),
)
--tworzenie encji adres
CREATE TABLE adres (
id_adres int IDENTITY(1,1) PRIMARY KEY,
ulica VARCHAR(25) not null,
numer_budynku int not null,
numer_mieszkania int,
kod VARCHAR(10) not null,
miasto VARCHAR (30)
)
--tworzenie klucza obcego encji klient (jeden do wielu, ponieważ dwóch lub wiecej klientów/pracowników mogą mieć ten sam adres)
ALTER TABLE klient add constraint adres_klient_fk foreign key (id_adres) references adres(id_adres)
--tworzenie encji pracownik
CREATE TABLE pracownik (
id_pracownika int IDENTITY(1,1) PRIMARY KEY,
id_adres int,
imie varchar(30) not null,
nazwisko varchar(50) not null,
PESEL char(11) not null,
telefon varchar(20) not null,
wyplata MONEY,
premia BIT DEFAULT 0,
email varchar(50),
data_przyjecia DATE,
)
-- klucz obcy dla adresu pracownika (jeden do wielu, ponieważ dwóch lub wiecej klientów/pracowników mogą mieć ten sam adres)
ALTER TABLE pracownik ADD CONSTRAINT adres_pracownik_fk FOREIGN KEY (id_adres) REFERENCES adres(id_adres) ON DELETE CASCADE
--towrzenie encji transakcja
CREATE TABLE transakcja(
id_transakcji int IDENTITY(1,1) PRIMARY KEY,
id_pracownika int,
id_klienta int,
id_pojazdu int,
rodzaj_transakcji VARCHAR(15) not null,
kwota MONEY,
data_transakcji DATE,
)
--zakładanie klucza obcego dla encji transakcja
ALTER TABLE transakcja ADD CONSTRAINT pracownik_transakcja_fk FOREIGN KEY (id_pracownika) REFERENCES pracownik(id_pracownika) ON DELETE CASCADE
ALTER TABLE transakcja ADD CONSTRAINT klient_transakcja_fk FOREIGN KEY (id_klienta) REFERENCES klient(id_klienta) ON DELETE CASCADE
ALTER TABLE transakcja ADD CONSTRAINT pojazd_transakcja_fk FOREIGN KEY (id_pojazdu) REFERENCES pojazd(id_pojazdu) ON DELETE CASCADE
--towrzenie encji faktura wraz z tworzeniem kluczy obcych
CREATE TABLE faktura (
id_faktury int IDENTITY(1,1) PRIMARY KEY,
nr_faktury int UNIQUE not null,
id_transakcji int CONSTRAINT transakcja_faktura_fk foreign key (id_transakcji) references transakcja(id_transakcji),
data_wystawienia date,
)
| true |
e9ab84a8566d9d6c33cf2c38b800209bec09401f | SQL | tavo1981/phpbar | /libs/scripts/concursospub.sql | UTF-8 | 2,321 | 3.375 | 3 | [] | no_license | -----------------------------------------------------
----- Tabela concursos_publicos ---------------------
-----------------------------------------------------
create table concursos_publicos (
con_id serial not null primary key,
con_nome varchar(75) not null,
con_edital varchar not null,
con_valor decimal(10,2),
con_dtpub date not null,
con_dtsai date not null,
con_dtinscrini date,
con_dtinscrfim date
);
create index concursos_publicos_con_dtpub on concursos_publicos (con_dtpub);
create index concursos_publicos_con_dtsai on concursos_publicos (con_dtsai);
-----------------------------------------------------
----- Tabela concursos_documentos -------------------
-----------------------------------------------------
create table concursos_documentos(
doc_conid integer not null,
doc_nome varchar(50) not null
);
create index concursos_documentos_doc_conid on concursos_documentos (doc_conid);
alter table concursos_documentos add constraint concursos_documentos_doc_conid_fk
foreign key (doc_conid) references concursos_publicos (con_id);
-----------------------------------------------------
----- Tabela concursos_cargos---- -------------------
-----------------------------------------------------
create table concursos_cargos (
car_conid integer not null,
car_descr varchar(50) not null,
car_numvagas integer not null
);
create index concursos_cargos_car_conid on concursos_cargos (car_conid);
alter table concursos_cargos add constraint concursos_cargos_car_conid_fk
foreign key (car_conid) references concursos_publicos (con_id);
-----------------------------------------------------
----- Tabela evento_princ ---------------------------
-----------------------------------------------------
create table evento_princ(
evp_id serial not null primary key,
evp_nome varchar(35),
evp_dtentrada date not null,
evp_dtsaida date not null,
evp_imagem varchar(50)
);
-----------------------------------------------------
----- Tabela lista_saponline ------------------------
-----------------------------------------------------
create table lista_saponline(
sol_id serial not null primary key,
sol_email varchar(255) not null unique,
sol_nome varchar(70),
sol_dtcad date
); | true |
671da0cc2d499e08392ccdf419e4be3546a311b1 | SQL | SAKET1102/SQL_Interview_Query | /Nth_Highest_Salary.sql | UTF-8 | 1,813 | 4.4375 | 4 | [] | no_license | create Database students;
use students;
CREATE TABLE sales
(
employee VARCHAR(50),
"date" DATE,
sale INT
);
INSERT INTO sales VALUES ('odin', '2017-03-01', 200),
('odin', '2017-04-01', 300),
('odin', '2017-05-01', 400),
('thor', '2017-03-01', 400),
('thor', '2017-04-01', 300),
('thor', '2017-05-01', 500);
select * from sales;
SELECT employee, SUM(sale) FROM sales GROUP BY employee;
SELECT employee, date, sale, SUM(sale) OVER (PARTITION BY employee) AS sum FROM sales;
select len('123456778912345678912345678912');
use students;
CREATE TABLE Employee
(
emp_id int,
employee_name VARCHAR(50),
salary INT,
dept_id int
);
INSERT INTO Employee VALUES (1111, 'SAKET', 200,12),
(1112, 'RAJ', 400,13),
(1113, 'PREETI', 800,14),
(1114, 'SHUBHAM', 1000,15),
(1115, 'DEEPA', 1500,16),
(1116, 'NISHA', 3000,17),
(1117, 'PAPU', 1580,18);
select * from Employee order by salary desc;
select * from Employee where salary = (select max(salary) from Employee);
--Option1-----Using Corelated SubQuery--
select * from Employee EMP1
where 2 = (select count(distinct salary) from Employee EMP2 where EMP2.salary >= EMP1.salary);
--Option2--Using Dense Rank Functions..
select employee_name,salary from (
select employee_name,salary,DENSE_RANK() over(order by salary desc) as Ranking from Employee) as A
where Ranking = 2;--Same thing we need to do for all salary like 3rd highset and 4th highest salary.
---Option3---Using top clause--
select top 1 employee_name,salary from ( select distinct top 2 employee_name,salary from Employee order by salary desc) A
order by salary ASC ;
| true |
354e839b4d02e9a1fa6c28e745c16369d26b8280 | SQL | saratonite/PDO_Tuts | /src/SQL_Files/users.sql | UTF-8 | 1,992 | 2.84375 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 19, 2014 at 06:10 PM
-- Server version: 5.5.27
-- PHP Version: 5.4.7
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `test`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=100 ;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `email`, `name`, `created_at`, `updated_at`) VALUES
(93, 'sarath@email.com', 'sarath', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(94, 'email_1399819354@email.com', 'Someone1399819354', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(95, 'email_1399819421@email.com', 'Someone1399819421', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(96, 'email_1400002487@email.com', 'Someone1400002487', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(97, 'email_1400089391@email.com', 'Someone1400089391', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(98, 'email_1400089392@email.com', 'Someone1400089392', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(99, 'email_1400089393@email.com', 'Someone1400089393', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
8745e3d0de8a5326762e99b7183b745773388d92 | SQL | sid77320/Projet_Immo | /database/immo.sql | UTF-8 | 8,192 | 3.015625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.4.12
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Mar 08 Décembre 2015 à 16:15
-- Version du serveur : 5.6.25
-- Version de PHP : 5.6.11
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 : `immo`
--
-- --------------------------------------------------------
--
-- Structure de la table `annoncessauvegardees`
--
CREATE TABLE IF NOT EXISTS `annoncessauvegardees` (
`id_locataire` int(11) NOT NULL,
`id_bien` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `bien`
--
CREATE TABLE IF NOT EXISTS `bien` (
`id` int(11) NOT NULL,
`titre` varchar(100) NOT NULL,
`ville` varchar(100) NOT NULL,
`quartier` varchar(100) NOT NULL,
`surface` int(11) NOT NULL,
`descriptif` text NOT NULL,
`pieces` enum('1','2','3','4','5 et +') NOT NULL,
`type` enum('appartement','maison','','') NOT NULL,
`loyer` int(11) NOT NULL,
`id_proprio` int(11) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=latin1;
--
-- Contenu de la table `bien`
--
INSERT INTO `bien` (`id`, `titre`, `ville`, `quartier`, `surface`, `descriptif`, `pieces`, `type`, `loyer`, `id_proprio`) VALUES
(39, 'Appart ', 'Paris', 'Montorgueil', 64, 'Super appart', '3', 'appartement', 1800, 0),
(40, 'Petit studio', 'Lyon', 'Bellecour', 18, 'C''est vraiment petit', '1', 'appartement', 1200, 0),
(41, 'Petit studio', 'Toulouse', 'Rose', 75, 'Super appart', '3', 'appartement', 1400, 0),
(42, 'ttt', 'Dunkerque', 'Briques rouges', 15, 'Super nul', '1', 'appartement', 400, 0),
(43, 'ddd', 'Roubaix', '', 40, '', '2', 'appartement', 1000, 0),
(44, 'Louviers', 'Louviers', 'hh', 70, '', '1', 'appartement', 1400, 0),
(45, 'test', '', '', 0, '', '1', 'appartement', 0, 0),
(46, 'test', '', '', 0, '', '1', 'appartement', 0, 0),
(47, 'L''appart de Roger', 'Paris', 'Montmartre', 23, 'Le tres joli appart de Roro', '1', 'appartement', 956, 4);
-- --------------------------------------------------------
--
-- Structure de la table `candidatures`
--
CREATE TABLE IF NOT EXISTS `candidatures` (
`id_locataire` int(11) NOT NULL,
`id__bien` int(11) NOT NULL,
`dateCandidature` date NOT NULL,
`reponseProprio` enum('En cours','Oui','Non','') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `locataire`
--
CREATE TABLE IF NOT EXISTS `locataire` (
`id` int(11) NOT NULL,
`nom` varchar(50) NOT NULL,
`prenom` varchar(50) NOT NULL,
`adresse` varchar(255) NOT NULL,
`cp` varchar(5) NOT NULL,
`ville` varchar(80) NOT NULL,
`tel_fixe` varchar(10) NOT NULL,
`tel_portable` varchar(10) NOT NULL,
`email` varchar(80) NOT NULL,
`password` varchar(255) NOT NULL,
`ressources` int(11) NOT NULL,
`fichePaie` text NOT NULL,
`CNI` text NOT NULL,
`ficheImpots` text NOT NULL,
`RIB` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
--
-- Contenu de la table `locataire`
--
INSERT INTO `locataire` (`id`, `nom`, `prenom`, `adresse`, `cp`, `ville`, `tel_fixe`, `tel_portable`, `email`, `password`, `ressources`, `fichePaie`, `CNI`, `ficheImpots`, `RIB`) VALUES
(9, 'fonfec', 'sophie', '12 rue des fleurs', '76000', 'rouen', '6', '0605040302', 'sophiefonfec@hotmail.fr', '$2y$10$wfKu5nGzJFE.O8SJIjO5wu5lzNoWE5HoMnSBxB84RBt/CFA3.xfku', 2500, '1449563155_exemple-bulletin-de-paie.jpg', '1449563155_cni.jpg', '1449563155_impot.gif', '1449563155_rib.gif');
-- --------------------------------------------------------
--
-- Structure de la table `messagerie`
--
CREATE TABLE IF NOT EXISTS `messagerie` (
`id` int(11) NOT NULL,
`message` text NOT NULL,
`titre` varchar(255) NOT NULL,
`id_exp` int(11) NOT NULL,
`id_dest` int(11) NOT NULL,
`id_bien` int(11) NOT NULL,
`dateHeure` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `photos`
--
CREATE TABLE IF NOT EXISTS `photos` (
`id` int(11) NOT NULL,
`bien_id` int(11) NOT NULL,
`photo` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1;
--
-- Contenu de la table `photos`
--
INSERT INTO `photos` (`id`, `bien_id`, `photo`) VALUES
(6, 39, '1449585222_308va01.jpg'),
(7, 39, '1449585222_2012-05-APPARTEMENT-PARIS-PERSPECTIVE-4.jpg'),
(8, 40, '1449585285_308va01.jpg'),
(9, 40, '1449585285_2012-05-APPARTEMENT-PARIS-PERSPECTIVE-4.jpg'),
(10, 40, '1449585285_mg_2932.jpg'),
(11, 41, '1449585442_308va01.jpg'),
(12, 41, '1449585442_2012-05-APPARTEMENT-PARIS-PERSPECTIVE-4.jpg'),
(13, 41, '1449585442_cni.jpg'),
(14, 41, '1449585442_mg_2932.jpg'),
(15, 41, '1449585442_'),
(16, 42, '1449585640_308va01.jpg'),
(17, 42, '1449585640_2012-05-APPARTEMENT-PARIS-PERSPECTIVE-4.jpg'),
(18, 42, '1449585640_cni.jpg'),
(19, 42, '1449585640_mg_2932.jpg'),
(20, 42, '1449585640_'),
(21, 43, '1449585972_19971.jpg'),
(22, 43, '1449585972_appartement-deux-pieces-cannes.jpg'),
(23, 43, '1449585972_renovation-appartement2.jpg'),
(24, 44, '1449586013_19971.jpg'),
(25, 44, '1449586013_appartement-deux-pieces-cannes.jpg'),
(26, 44, '1449586013_cni.jpg'),
(27, 44, '1449586013_renovation-appartement2.jpg'),
(28, 45, '1449586106_'),
(29, 46, '1449586133_'),
(30, 47, '1449587353_19971.jpg'),
(31, 47, '1449587353_appartement-deux-pieces-cannes.jpg');
-- --------------------------------------------------------
--
-- Structure de la table `proprietaire`
--
CREATE TABLE IF NOT EXISTS `proprietaire` (
`id` int(11) NOT NULL,
`nom` varchar(50) NOT NULL,
`prenom` varchar(50) NOT NULL,
`adresse` varchar(255) NOT NULL,
`cp` varchar(5) NOT NULL,
`ville` varchar(80) NOT NULL,
`tel_fixe` varchar(10) NOT NULL,
`tel_portable` varchar(10) NOT NULL,
`email` varchar(80) NOT NULL,
`password` varchar(255) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Contenu de la table `proprietaire`
--
INSERT INTO `proprietaire` (`id`, `nom`, `prenom`, `adresse`, `cp`, `ville`, `tel_fixe`, `tel_portable`, `email`, `password`) VALUES
(1, 'dupont', 'michel', '5 rue de la paix', '75001', 'paris', '0102030405', '0607080910', 'mdupont@free.fr', '$2y$10$Fw4RMyP3vUNIyo.7Y1AJ1.YFnBS5gp7YCjsJGcqFkKlsj8oOlocei'),
(3, 'DURAND', 'Patrick', '10 rue des carmes', '27000', 'Evreux', '0235646464', '0635646464', 'pdurand@gmail.com', '$2y$10$oDIgAxgTmTPMP7jSwcnamOYrTrIcRMGw7Y9cCg9FeI0IXVcKtpXSi'),
(4, 'HANIN', 'Roger', '16 rue Montmartre', '75016', 'Paris', '0156565656', '0656565656', 'rhanin@gmail.com', '$2y$10$izLXx4P47984SPPOsWAe9eHluQHW2ChFGa6/6CUej0qghH778xLn6');
--
-- Index pour les tables exportées
--
--
-- Index pour la table `bien`
--
ALTER TABLE `bien`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `locataire`
--
ALTER TABLE `locataire`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`);
--
-- Index pour la table `messagerie`
--
ALTER TABLE `messagerie`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `photos`
--
ALTER TABLE `photos`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `proprietaire`
--
ALTER TABLE `proprietaire`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `bien`
--
ALTER TABLE `bien`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=48;
--
-- AUTO_INCREMENT pour la table `locataire`
--
ALTER TABLE `locataire`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT pour la table `messagerie`
--
ALTER TABLE `messagerie`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `photos`
--
ALTER TABLE `photos`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=32;
--
-- AUTO_INCREMENT pour la table `proprietaire`
--
ALTER TABLE `proprietaire`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
81afa9d6fdb8ba201d7be0b56296840de146847a | SQL | WiduriComputerCommunity/workshop-2018-extensions | /wcc_workshop_2018.sql | UTF-8 | 1,104 | 2.875 | 3 | [
"MIT"
] | permissive | -- 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 `pengajar`;
CREATE TABLE `pengajar` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`no_hp` varchar(20) NOT NULL,
`tgl_ngajar` date NOT NULL,
`materi` varchar(30) NOT NULL,
`peran` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `unf`;
CREATE TABLE `unf` (
`nim` varchar(50) NOT NULL,
`nama` varchar(50) NOT NULL,
`email` varchar(200) NOT NULL,
`phone` varchar(50) NOT NULL,
`laundry` int(11) NOT NULL,
`pwa` int(11) NOT NULL,
`metode` varchar(50) NOT NULL,
`tanggal` date NOT NULL,
`penerima` varchar(50) DEFAULT NULL,
`nomor_rekening` varchar(50) DEFAULT NULL,
`atas_nama` varchar(50) DEFAULT NULL,
`status` varchar(50) NOT NULL,
`kehadiran_laundry` int(11) NOT NULL DEFAULT '0',
`kehadiran_pwa` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- 2020-02-22 10:50:51
| true |
9bb5b4ed613409dc490c053a37c625fac285c23e | SQL | andrewp-as-is/sqlite-examples | /SQL/UPDATE/WHERE EXISTS.sql | UTF-8 | 351 | 3.421875 | 3 | [
"Unlicense"
] | permissive | CREATE TABLE t1 (id TEXT PRIMARY KEY,value TEXT);
CREATE TABLE t2 (id TEXT PRIMARY KEY,value TEXT);
INSERT INTO t1 VALUES (1,'value1'), (2,'value2');
INSERT INTO t2 VALUES (1,'new_value1'), (2,'new_value2');
UPDATE t1
SET value = (SELECT t2.value FROM t2 WHERE t2.id = t1.id )
WHERE EXISTS (SELECT * FROM t2 WHERE t2.id = t1.id);
SELECT * FROM t1;
| true |
65b3fd27a8b13819e9a8f32f9834a464d6ce9c87 | SQL | UCLALibrary/sql-scripts | /ArchivistsToolkit/Haynes Finding Aid AT-35.sql | UTF-8 | 5,389 | 4.21875 | 4 | [] | no_license | create view AT35_Report as
-- Top level resource data, with extra fields to allow unions with lower-level component data
with level0 as (
select
r.resourceId
, null as resourceComponentId
, null as parentResourceComponentId
, r.title
, r.dateExpression
, r.resourceLevel
, 0 as sequenceNumber
, r.resourceidentifier1 + ' ' + r.resourceidentifier2 as refId
, 0 as levelNumber
from Resources r
where r.resourceidentifier1 = 'LSC'
and r.resourceidentifier2 = '1241'
)
, level1 as (
select
rc1.resourceId
, rc1.resourceComponentId
, rc1.parentResourceComponentId
, rc1.title
, rc1.dateExpression
, rc1.resourceLevel
, rc1.sequenceNumber
, '' as refId
, 1 as levelNumber
from ResourcesComponents rc1
-- level 1 components link to resources on resourceId, not (parent)resourceComponentId
where rc1.resourceId in (select resourceId from level0)
)
, level2 as (
select
rc2.resourceId
, rc2.resourceComponentId
, rc2.parentResourceComponentId
, rc2.title
, rc2.dateExpression
, rc2.resourceLevel
, rc2.sequenceNumber
, '' as refId
, 2 as levelNumber
from ResourcesComponents rc2
-- level 2+ components link to parent components on (parent)resourceComponentId, not resourceId
where rc2.parentResourceComponentId in (select resourceComponentId from level1)
)
, level3 as (
select
rc3.resourceId
, rc3.resourceComponentId
, rc3.parentResourceComponentId
, rc3.title
, rc3.dateExpression
, rc3.resourceLevel
, rc3.sequenceNumber
, '' as refId
, 3 as levelNumber
from ResourcesComponents rc3
-- level 2+ components link to parent components on (parent)resourceComponentId, not resourceId
where rc3.parentResourceComponentId in (select resourceComponentId from level2)
)
, level4 as (
select
rc4.resourceId
, rc4.resourceComponentId
, rc4.parentResourceComponentId
, rc4.title
, rc4.dateExpression
, rc4.resourceLevel
, rc4.sequenceNumber
, '' as refId
, 4 as levelNumber
from ResourcesComponents rc4
-- level 2+ components link to parent components on (parent)resourceComponentId, not resourceId
where rc4.parentResourceComponentId in (select resourceComponentId from level3)
)
, all_data as (
select * from level0
union all
select * from level1
union all
select * from level2
union all
select * from level3
union all
select * from level4
)
select * from all_data
;
-- End view definition
-- Series (component) level
select
v.levelNumber
, v.sequenceNumber
, v.title as seriesTitle
, v.dateExpression
, nt.notesEtcLabel -- use the standard consistent label, not the resource-specific override
--, n.title as noteTitle
, replace(cast(n.noteContent as varchar(max)), char(10), '') as noteContent
from at35_report v
left outer join ArchDescriptionRepeatingData n -- notes
on v.resourceComponentId = n.resourceComponentId
left outer join NotesEtcTypes nt
on n.notesEtcTypeId = nt.notesEtcTypeId
and nt.notesEtcLabel in ('Scope and Content', 'Physical Description', 'Physical Characteristics and Technical Requirements')
where v.resourceLevel = 'series'
--and nt.notesEtcLabel in ('Scope and Content', 'Physical Description', 'Physical Characteristics and Technical Requirements')
order by v.levelNumber, v.sequenceNumber, cast(v.title as varchar)
;
-- Sub-series (component) level
select
v.levelNumber
, v.sequenceNumber
, v.title as subseriesTitle
, v.dateExpression
, nt.notesEtcLabel -- use the standard consistent label, not the resource-specific override
--, n.title as noteTitle
, replace(cast(n.noteContent as varchar(max)), char(10), '') as noteContent
from at35_report v
left outer join ArchDescriptionRepeatingData n -- notes
on v.resourceComponentId = n.resourceComponentId
left outer join NotesEtcTypes nt
on n.notesEtcTypeId = nt.notesEtcTypeId
where v.resourceLevel = 'subseries'
--and nt.notesEtcLabel in ('Scope and Content', 'Physical Description', 'Physical Characteristics and Technical Requirements')
order by v.levelNumber, v.sequenceNumber, cast(v.title as varchar)
;
-- File (component) level
-- Different data for files
select
v.levelNumber
, v.sequenceNumber
, v.title as fileTitle
, v.dateExpression
--, adi.instanceType
, case
when adi.container1NumericIndicator is not null then coalesce(adi.container1Type, '') + ' ' + cast(adi.container1NumericIndicator as varchar(10))
else ''
end as instance_label_1
, case
when adi.container2NumericIndicator is not null then coalesce(adi.container2Type, '') + ' ' + cast(adi.container2NumericIndicator as varchar(10))
else ''
end as instance_label_2
, case
when adi.container3NumericIndicator is not null then coalesce(adi.container3Type, '') + ' ' + cast(adi.container3NumericIndicator as varchar(10))
else ''
end as instance_label_3
, nt.notesEtcLabel -- use the standard consistent label, not the resource-specific override
--, n.title as noteTitle
, replace(cast(n.noteContent as varchar(max)), char(10), '') as noteContent
from at35_report v
inner join ArchDescriptionInstances adi on v.resourceComponentId = adi.resourceComponentId
left outer join ArchDescriptionRepeatingData n -- notes
on v.resourceComponentId = n.resourceComponentId
left outer join NotesEtcTypes nt
on n.notesEtcTypeId = nt.notesEtcTypeId
where v.resourceLevel = 'file'
--and nt.notesEtcLabel in ('Scope and Content', 'Physical Description', 'General note')
order by v.levelNumber, v.sequenceNumber, cast(v.title as varchar)
;
drop view at35_report;
| true |
54a581f6de2fbfd453b6a38d5a94cccf615d94fe | SQL | panne027/CSCI5715 | /Lab/lab3/Part A, B, _ C/lab3_partB.sql | UTF-8 | 1,778 | 4.09375 | 4 | [] | no_license | /* CSCI 5715 Fall 2020 */
/* Lab 3 11/16/2020 */
/*
Group 1: Matthew Eagon
Harish Panneer Selvam
*/
/*---------------------------------------------------------------------------*/
/* Output Options */
set echo on
set trimspool on
set pagesize 24
set linesize 100
/* Part B: Recursive Queries */
spool lab3_partB.txt
-- List airports can be arrived from "Sun Valley/Hailey/Ketchum, ID" (AIRPORT_ID: 15041) with at most one stop?
with arrivals_from_SunValleyID (start_node_id, end_node_id, search_depth) as (
select start_node_id, end_node_id, 0 search_depth from airport_link$ where start_node_id = 15041
union all select lnk.start_node_id, lnk.end_node_id, arv.search_depth+1
from arrivals_from_SunValleyID arv, airport_link$ lnk
where arv.end_node_id = lnk.start_node_id and arv.search_depth = 0)
select distinct lst.airport_name, lst.airport_id from arrivals_from_SunValleyID arv, airport_list lst
where search_depth <= 1 and arv.end_node_id = lst.airport_id;
-- List the least number of stops is needed flying from "Honolulu, HI" (AIRPORT_ID: 12173) to "New York, NY" (AIRPORT_ID: 12953)
-- Note: Limits depth of search to 2 for now to avoid cycles and reduce computation time.
with HonaluluHI_to_NewYorkNY (start_node_id, end_node_id, num_stops) as (
select start_node_id, end_node_id, 0 num_stops from airport_link$ where start_node_id = 12173
union all select lnk.start_node_id, lnk.end_node_id, hny.num_stops+1
from HonaluluHI_to_NewYorkNY hny, airport_link$ lnk
where hny.end_node_id = lnk.start_node_id and hny.start_node_id <> lnk.start_node_id and hny.num_stops <= 2)
select min(num_stops) as min_stops_Honalulu_to_NewYork from HonaluluHI_to_NewYorkNY where end_node_id = 12953;
spool off
| true |
248e58b6f752b5c0983915639d50900f7b8c7de1 | SQL | g1165713/cellfish-lite | /config/schema.sql | UTF-8 | 704 | 3.25 | 3 | [] | no_license |
CREATE TABLE messages (
id TEXT PRIMARY KEY,
name TEXT,
email TEXT,
subject TEXT,
message TEXT,
created_at INTEGER
);
CREATE TABLE users (
username TEXT PRIMARY KEY,
password TEXT
);
CREATE TABLE images (
hash TEXT PRIMARY KEY,
dataurl TEXT
);
CREATE TABLE posts (
id TEXT PRIMARY KEY,
title TEXT,
content TEXT,
image TEXT,
created_at INTEGER,
updated_at INTEGER
);
CREATE TABLE likes (
post TEXT,
username TEXT,
PRIMARY KEY (post, username)
);
CREATE TABLE comments (
id TEXT PRIMARY KEY,
parent TEXT,
username TEXT,
content TEXT,
created_at INTEGER
);
INSERT INTO users VALUES ( 'admin', 'admin' );
| true |
0a77642fe47a0636bc8ebf7b2df95504eb0e4599 | SQL | lai3d/Oracle_PLSQL_Learning | /SQL_for_Beginners_07_the-group-by-clause-and-having-clause.sql | UTF-8 | 5,251 | 3.71875 | 4 | [] | no_license | -- https://oracle-base.com/articles/misc/sql-for-beginners-the-group-by-clause-and-having-clause
-------------------------------------- GROUP BY Clause ------------------------------------------
SELECT COUNT(*) AS employee_count,
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM employees e;
SELECT e.department_id,
COUNT(*) AS employee_count,
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM employees e
GROUP BY e.department_id
ORDER BY e.department_id;
SELECT e.department_id,
e.job,
COUNT(*) AS employee_count,
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM employees e
GROUP BY e.department_id, e.job -- all non-aggregate columns must be included in the GROUP BY clause.
ORDER BY e.department_id, e.job;
-------------------------------------- Joins ------------------------------------------
SELECT d.department_name,
COUNT(*) AS employee_count,
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM departments d
JOIN employees e ON d.department_id = e.department_id
GROUP BY d.department_name
ORDER BY d.department_name;
SELECT d.department_name,
COUNT(*) AS employee_count, --
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM departments d
LEFT OUTER JOIN employees e ON d.department_id = e.department_id
GROUP BY d.department_name
ORDER BY d.department_name;
select d.department_name, e.employee_id
from departments d
left outer join employees e on d.department_id = e.department_id
order by d.DEPARTMENT_NAME;
SELECT d.department_name,
COUNT(e.employee_id) AS employee_count, -- NULL values are not counted
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM departments d
LEFT OUTER JOIN employees e ON d.department_id = e.department_id
GROUP BY d.department_name
ORDER BY d.department_name;
-------------------------------------- HAVING Clause ------------------------------------------
SELECT d.department_name, e.job,
COUNT(e.employee_id) AS employee_count,
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM departments d
LEFT OUTER JOIN employees e ON d.department_id = e.department_id
GROUP BY d.department_name, e.job
ORDER BY d.department_name, e.job;
SELECT d.department_name, e.job,
COUNT(e.employee_id) AS employee_count,
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM departments d
LEFT OUTER JOIN employees e ON d.department_id = e.department_id
GROUP BY d.department_name, e.job
HAVING COUNT(e.employee_id) > 1 -- You can think of it as a WHERE clause for the GROUP BY clause.
ORDER BY d.department_name, e.job;
SELECT COUNT(e.employee_id) AS employee_count,
AVG(e.salary) AS avg_salary,
SUM(e.salary) AS sum_salary
FROM departments d
LEFT OUTER JOIN employees e ON d.department_id = e.department_id
HAVING COUNT(e.employee_id) > 2 -- it is possible to have a HAVING clause without a GROUP BY clause
ORDER BY d.department_name, e.job;
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------
-------------------------------------- ------------------------------------------ | true |
62ed232e2cfd893029560aeedf8171014933125f | SQL | Zakinator123/Gear-Tracker | /database-migrations/sql/V0__baseline_schema_migration.sql | UTF-8 | 4,350 | 3.28125 | 3 | [
"MIT"
] | permissive | -- MySQL dump 10.13 Distrib 5.7.23, for Linux (x86_64)
--
-- Host: mysql Database: inventory
-- ------------------------------------------------------
-- Server version 5.7.23
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Create 'gearmaster' user used by application
--
create user '${GEAR_TRACKER_DB_USER}'@'%' identified by '${GEAR_TRACKER_DB_PASSWORD}';
GRANT ALL ON inventory.* to '${GEAR_TRACKER_DB_USER}'@'%';
--
-- Table structure for table `authenticator`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `authenticator` (
`token` varchar(96) NOT NULL,
`userid` int(11) DEFAULT NULL,
`creation_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`token`),
UNIQUE KEY `userid` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `checkout`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `checkout` (
`checkout_id` int(11) NOT NULL AUTO_INCREMENT,
`gear_uid` mediumint(9) DEFAULT NULL,
`checkout_notes` varchar(255) DEFAULT NULL,
`check_in_notes` varchar(255) DEFAULT NULL,
`date_checked_in` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`date_due` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`officer_out` varchar(100) DEFAULT NULL,
`officer_in` varchar(100) DEFAULT NULL,
`checkout_status` int(11) DEFAULT NULL,
`member_uid` int(11) DEFAULT NULL,
`member_name` varchar(100) DEFAULT NULL,
`date_checked_out` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`checkout_id`),
KEY `gear_uid` (`gear_uid`),
CONSTRAINT `checkout_ibfk_1` FOREIGN KEY (`gear_uid`) REFERENCES `gear` (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=1887 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `gear`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `gear` (
`number` int(11) DEFAULT NULL,
`item` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`condition_level` int(11) DEFAULT NULL,
`status_level` int(11) DEFAULT NULL,
`notes` varchar(255) DEFAULT NULL,
`Image_url` varchar(255) DEFAULT NULL,
`uid` mediumint(9) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=1519 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-01-16 23:50:10
| true |
8bf7934f60932c2a5d334075e68b8751392cbf01 | SQL | NicolasRomeroF/TareaDBD | /consultas.sql | UTF-8 | 2,666 | 4.0625 | 4 | [] | no_license | --CONSULTA 1
SELECT ars.id_sello, count(*)
FROM artista_sello ars, artista a, generos_artista ga, genero g
WHERE ars.id_artista = a.id_artista AND ars.fecha_termino > '01-01-2017' AND ga.id_genero = g.id_genero AND ga.id_artista = a.id_artista AND g.nombre = 'Indie'
GROUP BY ars.id_sello;
--CONSULTA 2
DROP VIEW IF EXISTS sello_cantidad;
DROP VIEW IF EXISTS sellos_2017;
CREATE VIEW sellos_2017 AS SELECT id_sello, id_artista
FROM ARTISTA_SELLO AR
WHERE fecha_termino > '01-01-2017';
CREATE VIEW sello_cantidad AS SELECT id_sello, count(*)
FROM sellos_2017
GROUP BY id_sello;
SELECT id_sello
FROM sello_cantidad
WHERE count=(SELECT max(count)
FROM sello_cantidad);
--CONSULTA 3
DROP VIEW IF EXISTS lista_cantidad;
DROP VIEW IF EXISTS artistas_considerados_favoritos;
CREATE VIEW artistas_considerados_favoritos AS SELECT DISTINCT a.nombre, c.nombre AS nombre_cancion
FROM artista a, artistas_favoritos af, album al, cancion c
WHERE a.id_artista = af.id_artista AND a.id_artista = al.id_artista AND c.id_album = al.id_album;
CREATE VIEW lista_cantidad AS SELECT nombre, count(*)
FROM artistas_considerados_favoritos
GROUP BY nombre;
SELECT *
FROM lista_cantidad
WHERE count=(SELECT min(count)
FROM lista_cantidad);
--CONSULTA 5
SELECT DISTINCT LR.nombre_usuario
FROM LISTA_COMPARTIDA LC, LISTA_REPRODUCCION LR
WHERE LC.id_lista = LR.id_lista;
--CONSULTA 7
DROP VIEW IF EXISTS artista_cantidad;
DROP VIEW IF EXISTS artista_2017;
CREATE VIEW artista_2017 AS SELECT id_sello, id_artista
FROM ARTISTA_SELLO AR
WHERE fecha_inicio < '01-01-2017';
CREATE VIEW artista_cantidad AS SELECT id_artista, count(*)
FROM artista_2017
GROUP BY id_artista;
SELECT id_artista
FROM artista_cantidad
WHERE count=(SELECT max(count)
FROM artista_cantidad);
--CONSULTA 8
DROP VIEW IF EXISTS lista_cantidad;
DROP VIEW IF EXISTS lista_compartida_cancion;
CREATE VIEW lista_compartida_cancion AS SELECT DISTINCT LC.id_lista, CL.id_cancion
FROM LISTA_COMPARTIDA LC, LISTA_REPRODUCCION LR, CANCIONES_LISTA CL
WHERE LC.id_lista = LR.id_lista AND CL.id_lista = LC.id_lista
GROUP BY LC.id_lista, CL.id_cancion;
CREATE VIEW lista_cantidad AS SELECT id_lista, count(*)
FROM lista_compartida_cancion
GROUP BY id_lista;
SELECT id_lista
FROM lista_cantidad
WHERE count=(SELECT max(count)
FROM lista_cantidad);
--CONSULTA 9
SELECT count(*)
FROM usuario U, artistas_favoritos AF, genero G, generos_artista GA
WHERE U.pais = 'Chile' AND U.nombre_usuario = AF.nombre_usuario
AND AF.id_artista = GA.id_artista AND GA.id_genero = G.id_genero
AND G.nombre = 'Rock';
--CONSULTA 10
SELECT DISTINCT a.nombre
FROM artista a, artistas_favoritos af
WHERE a.id_artista = af.id_artista; | true |
954e18f164c4ac8e77bf90c384575e472fb619cb | SQL | magrai/URBAN-MV-VIE_UniBw_Study2_DB | /v_q_pasa_t1_vs_t2.sql | UTF-8 | 1,280 | 3.1875 | 3 | [] | no_license | DROP VIEW IF EXISTS v_q_pasa_t1_vs_t2 CASCADE;
CREATE VIEW v_q_pasa_t1_vs_t2 AS
SELECT
"public".v_condfinder.subid,
"public".v_condfinder.cond,
"public".v_q_pasa_t1_scores.pasa_threat as pasa_threat_t1,
"public".v_q_pasa_t2_scores.pasa_threat as pasa_threat_t2,
"public".v_q_pasa_t1_scores.pasa_challenge as pasa_challenge_t1,
"public".v_q_pasa_t2_scores.pasa_challenge as pasa_challenge_t2,
"public".v_q_pasa_t1_scores.pasa_challenge_v2 as pasa_challenge_v2_t1,
"public".v_q_pasa_t2_scores.pasa_challenge_v2 as pasa_challenge_v2_t2,
"public".v_q_pasa_t1_scores.pasa_pa as pasa_pa_t1,
"public".v_q_pasa_t2_scores.pasa_pa as pasa_pa_t2,
"public".v_q_pasa_t1_scores.pasa_pa_v2 as pasa_pa_v2_t1,
"public".v_q_pasa_t2_scores.pasa_pa_v2 as pasa_pa_v2_t2,
"public".v_q_pasa_t1_scores.pasa_pa_rel as pasa_pa_rel_t1,
"public".v_q_pasa_t2_scores.pasa_pa_rel as pasa_pa_rel_t2,
"public".v_q_pasa_t1_scores.pasa_pa_rel_v2 as pasa_pa_rel_v2_t1,
"public".v_q_pasa_t2_scores.pasa_pa_rel_v2 as pasa_pa_rel_v2_t2
FROM
"public".v_condfinder
INNER JOIN "public".v_q_pasa_t1_scores ON "public".v_condfinder.subid = "public".v_q_pasa_t1_scores.subid
INNER JOIN "public".v_q_pasa_t2_scores ON "public".v_q_pasa_t1_scores.subid = "public".v_q_pasa_t2_scores.subid
ORDER BY
"public".v_condfinder.cond
| true |
8561809b04f2379117992f3db9d4afada7e51407 | SQL | fazalul92/crowd-requirements | /src/main/resources/insert_static_data.sql | UTF-8 | 4,694 | 3.5 | 4 | [] | no_license | /*insert into spotcheck_question(name, question, options, options_type, answer) values
('which_not_sns', 'Which of the following is not a social network site?', 'Facebook,Google Plus,Windows,Twitter', 'radio', 'Windows'),
('which_not_browser', 'Which of the following is not a Web browser?', 'PowerPoint,Chrome,Internet Explorer,Safari', 'radio', 'PowerPoint'),
('which_not_mobileOs', 'Which of the following is not a mobile operating system', 'Android,Oracle,Blackberry,iOS', 'radio', 'Oracle');
*/
--
-- Dumping data for table `presurvey_questions`
--
LOCK TABLES `presurvey_questions` WRITE;
/*!40000 ALTER TABLE `presurvey_questions` DISABLE KEYS */;
INSERT INTO `presurvey_questions` VALUES (1, 'What is your gender?', 'multiple_choice', 'Male|Female|Other'),
(2, 'Which of the following categories includes your age?', 'multiple_choice', '18 to 24|25 to 34|35 to 45|45 to 54|55 or older'),
(3, 'What is the highest level of school you have completed or the highest degree you have received?', 'multiple_choice', 'Less than high school degree|High school degree or equivalent (e.g., GED)|Some college but no degree|Bachelor degree|Graduate degree'),
(4, 'If you went to college, what was your major?', 'text', 'For example, computer science, mechanical engineering, psychology, music, law, etc.'),
(5, 'Have you worked for a technology company?', 'multiple_choice', 'No|Yes; for less than a year|Yes; for one to five years|Yes; for more than five years'),
(6, 'How do you rate your familiarity of concepts related to Computer Science, Information Techonology, and Computer Netowrks?', 'multiple_choice', 'Very low|Low|Medium|High|Very high'),
(7, 'How do you rate your familiarity of concepts related to Smart Homes, Smart Cities, and Internet of Things?', 'multiple_choice', 'Very low|Low|Medium|High|Very high'),
(8, 'Do you use any Smart Home technologies at your home?', 'multiple_choice', 'Yes|No|Not sure'),
(9, 'Please use the text box below if you need to clarify any of your answers above', 'text', 'Optional clarifications');
/*!40000 ALTER TABLE `presurvey_questions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `creativity_questions`
--
LOCK TABLES `creativity_questions` WRITE;
/*!40000 ALTER TABLE `creativity_questions` DISABLE KEYS */;
INSERT INTO `creativity_questions` VALUES
(1,'Capable'),
(2,'Artificial'),
(3,'Clever'),
(4,'Cautious'),
(5,'Confident'),
(6,'Egotistical'),
(7,'Commonplace'),
(8,'Humourous'),
(9,'Conservative'),
(10,'Individualistic'),
(11,'Conventional'),
(12,'Informal'),
(13,'Dissatisfied'),
(14,'Insightful'),
(15,'Suspicious'),
(16,'Honest'),
(17,'Intelligent'),
(18,'Well mannered'),
(19,'Wide interests'),
(20,'Inventive'),
(21,'Original'),
(22,'Narrow interests'),
(23,'Reflective'),
(24,'Sincere'),
(25,'Resourceful'),
(26,'Self-confident'),
(27,'Sexy'),
(28,'Submissive'),
(29,'Snobbish'),
(30,'Unconventional');
/*!40000 ALTER TABLE `creativity_questions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `personality_questions`
--
LOCK TABLES `personality_questions` WRITE;
/*!40000 ALTER TABLE `personality_questions` DISABLE KEYS */;
INSERT INTO `personality_questions` VALUES
(1,'Am the life of the party'),
(2,'Sympathize with others\' feelings'),
(3,'Get chores done right away'),
(4,'Have frequent mood swings'),
(5,'Have a vivid imagination'),
(6,'Don\'t talk a lot'),
(7,'Am not interested in other people\'s problems'),
(8,'Often forget to put things back in their proper place'),
(9,'Am relaxed most of the time'),
(10,'Am not interested in abstract ideas'),
(11,'Talk to a lot of different people at parties'),
(12,'Feel others\' emotions'),
(13,'Like order'),
(14,'Get upset easily'),
(15,'Have difficulty understanding abstract ideas'),
(16,'Keep in the background'),
(17,'Am not really interested in others'),
(18,'Make a mess of things'),
(19,'Seldom feel blue'),
(20,'Do not have a good imagination');
/*!40000 ALTER TABLE `personality_questions` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `postsurvey_questions` WRITE;
/*!40000 ALTER TABLE `presurvey_questions` DISABLE KEYS */;
INSERT INTO `postsurvey_questions` VALUES (1, 'How long did the main tasks (excluding pre and post surveys) take?', 'text_required', 'duration in hours:minutes, e.g., 00:30 for thirty minutes'),
(2, 'How do you rate the difficulty of main tasks?', 'multiple_choice', 'Very easy|Easy|Medium|High|Very high'),
(3, 'Please provide any additional comments you have below', 'text', 'Optional comments');
/*!40000 ALTER TABLE `presurvey_questions` ENABLE KEYS */;
UNLOCK TABLES;
| true |
70055708ba796ec869f5a94cf8fad2bdee15caf1 | SQL | shaneconn860/sql-fpl | /joins.sql | UTF-8 | 161 | 2.90625 | 3 | [] | no_license | #Basicjoin
select a.player_name, a.team, b.assists
from player_basics a
inner join player_stats b
on a.player_name = b.player_name
where position = 'Defender';
| true |
8a0ade61b752f0774b920379dfb6b5f318e9f384 | SQL | kiosowski/Database | /Projects/DatabaseBasics/BuiltInFunctions/BuiltInFunction/3.sql | UTF-8 | 109 | 2.78125 | 3 | [] | no_license | SELECT FirstName FROM Employees
WHERE DepartmentID IN(3,10)
AND DATEPART(YEAR,HireDate) BETWEEN 1995 AND 2005 | true |
c9bdef00d50908c59491e0f48bbaa0cc1abf2f6e | SQL | jsheridanwells/chinook-sql-practice | /top_agent.sql | UTF-8 | 372 | 3.875 | 4 | [] | no_license | -- Which sales agent made the most in sales over all?
SELECT FirstName, LastName, MAX(TotalSales)
FROM (
SELECT Employee.FirstName AS FirstName, Employee.LastName AS LastName,
SUM (Invoice.Total) AS TotalSales
FROM Employee
JOIN Customer ON Customer.SupportRepId = Employee.EmployeeId
JOIN Invoice ON Customer.CustomerId = Invoice.CustomerId
GROUP BY Employee.EmployeeId
) | true |
a587441255804d370d393e5bb989e8a6fc2881b9 | SQL | hernan-alperin/urbix | /trilenium/2015-1er-cuat.sql | UTF-8 | 2,285 | 3.609375 | 4 | [] | no_license | create or replace function dia_semana(date) returns
text as'
select case extract(dow from $1)
when 1 then ''Lunes''
when 2 then ''Martes''
when 3 then ''Miercoles''
when 4 then ''Jueves''
when 5 then ''Viernes''
when 6 then ''Sabado''
else ''Domingo''
end;
' language 'sql' immutable;
drop table feriados;
create table feriados (feriado date);
copy feriados from stdin;
'2015-01-01'
'2015-02-17'
'2015-03-24'
'2015-04-02'
'2015-05-01'
'2015-05-25'
'2015-06-20'
'2015-07-09'
'2015-08-17'
\.
create or replace function feriado(date) returns
text as'
select case when ($1 in (select * from feriados)) then ''S''
else ''N''
end;
' language 'sql' immutable;
set search_path to urbix, public;
drop view v_meassures;
create view v_meassures as
select feriado(date(time)) as feriado,
dia_semana(date(time)) as dia,
to_char(time,'DD/MM/YY') as fecha,
to_char(time,'HH:00') as periodo,
*
from
(select time, data as "4"
from bkn_result
where '2015-01-01' <= time and time <= '2015-05-01'
and variable_id = 4) as f4
full join
(select time, data as "5"
from bkn_result
where '2015-01-01' <= time and time <= '2015-05-01'
and variable_id = 5) as f5
using (time)
full join
(select time, data as "6"
from bkn_result
where '2015-01-01' <= time and time <= '2015-05-01'
and variable_id = 6) as f6
using (time)
full join
(select time, data as "7"
from bkn_result
where '2015-01-01' <= time and time <= '2015-05-01'
and variable_id = 7) as f7
using (time)
full join
(select time, data as "8"
from bkn_result
where '2015-01-01' <= time and time <= '2015-05-01'
and variable_id = 8) as f8
using (time)
full join
(select time, data as "9"
from bkn_result
where '2015-01-01' <= time and time <= '2015-05-01'
and variable_id = 9) as f9
using (time)
full join
(select time, data as "10"
from bkn_result
where '2015-01-01' <= time and time <= '2015-05-01'
and variable_id = 10) as f10
using (time)
full join
(select time, data as "11"
from bkn_result
where '2015-01-01' <= time and time <= '2015-05-01'
and variable_id = 11) as f11
using (time)
order by time
;
copy (select * from v_meassures) to stdout;
| true |
c545faa5be7dcc2b0b9297368bb7884c07c56053 | SQL | kalkanli/321_1 | /q8.sql | UTF-8 | 748 | 4.625 | 5 | [] | no_license | SELECT team.team_id, team.short_name, team.full_name, ROUND(SUM(CAST(track.clim AS float)*track.total_laps/1000), 3) AS total_driven
FROM Teams team, Drivers driver, Tracks track
WHERE
((track.lap_recorder=team.driver_one AND driver.driver_id=team.driver_one AND driver.country_of_birth<>"England")
OR (track.lap_recorder=team.driver_two AND driver.driver_id=team.driver_two AND driver.country_of_birth<>"England"))
GROUP BY team.team_id
HAVING total_driven>500
ORDER BY total_driven ASC
-- This query selects the teams with at least one driver being a lap recorder.
-- Teams that have 2 drivers being a lap recorder are listed two times for each driver.
-- After that we group our table by team_id and sum the total driven of each team. | true |
f882d8592e8776bbb21d63b19e7e4d4862692849 | SQL | rkammer/production-sql | /views/location_type_get_list.sql | UTF-8 | 940 | 3.359375 | 3 | [] | no_license | CREATE OR REPLACE VIEW location_type_get_list(
location_type_id,
location_type_name,
location_type_created,
location_type_created_by,
location_type_updated,
location_type_updated_by,
location_type_status
) AS
SELECT location_type.id AS location_type_id,
location_type.name AS location_type_name,
DATE_FORMAT(location_type.created,'%m/%d/%Y %H:%i:%S') AS location_type_created,
location_type.created_by AS location_type_created_by,
DATE_FORMAT(location_type.updated,'%m/%d/%Y %H:%i:%S') AS location_type_updated,
location_type.updated_by AS location_type_updated_by,
location_type.status AS location_type_status
FROM location_type AS location_type; | true |
80760a4c07f27297da079e2fca2a57fa50bc88b5 | SQL | paramorel/propet-backend | /resources/db/migration/V1_1__create_animal_type_table.sql | UTF-8 | 180 | 2.546875 | 3 | [] | no_license | CREATE TABLE "Animal Type" (
"type_id" serial NOT NULL,
"type_name" VARCHAR(30) NOT NULL,
CONSTRAINT "Animal Type_pk" PRIMARY KEY ("type_id")
) WITH (
OIDS=FALSE
); | true |
7651b7f94bec9126df38e58dd4a8495a3f0c294d | SQL | microcomet/readcore | /backend/doc/sql_operate.sql | UTF-8 | 608 | 3.21875 | 3 | [
"MIT"
] | permissive | # 创建数据库
create database if not exists clean_read_toggle character set utf8 collate utf8_general_ci;
# 将某一数据库上的所有权限都赋给某一用户
grant all on clean_read_toggle.* to 'cleaner'@'%';
# 查询当前数据库支持的所有character set和配套对应字符集的默认collate(排序规则)
# show charset;
create database if not exists clean_read character set utf8 collate utf8_general_ci;
truncate table clean_read.book;
truncate table clean_read.book_category;
truncate table clean_read.chapter;
truncate table clean_read.user;
truncate table clean_read.volume; | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.