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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d6f78a7c49778bd42609bc19a61137955dd875d8 | SQL | pandeyanuradha/Jeevan-Daan | /Backend/tables/alltables.sql | UTF-8 | 7,581 | 3.078125 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `patient` (
`pid` INT AUTO_INCREMENT NOT NULL,
`first_name` VARCHAR(255) NOT NULL,
`last_name` VARCHAR(255),
`time_of_death` DATETIME,
`agreement` TINYINT(1) DEFAULT '0' NOT NULL,
`braindead` TINYINT(1) DEFAULT '0' NOT NULL,
`icuid` INT,
`did` INT,
`password` VARCHAR(255) NOT NULL,
`pulse` INT,
`temp` INT,
`blood_pressure_dis` INT,
`blood_pressure_sys`INT,
`comorbidity_status` TEXT,
`breathing_rate` INT,
`blood_group` VARCHAR(3) NOT NULL,
`gender` VARCHAR(1) NOT NULL,
`admission_date` DATETIME,
`city` VARCHAR(255),
`state`VARCHAR(255),
`pincode`VARCHAR(255),
`street`VARCHAR(255),
`house_number`VARCHAR(255),
`reasons`VARCHAR(255),
`dob` DATE,
CONSTRAINT PK_Patient PRIMARY KEY (pid),
CONSTRAINT FK_ICU FOREIGN KEY (icuid) REFERENCES icu(icuid),
CONSTRAINT FK_Doctor FOREIGN KEY (did) REFERENCES doctor(did)
);
/*
*/
/*
1st
*/
CREATE TABLE IF NOT EXISTS `icu` (
`icuid` INT AUTO_INCREMENT NOT NULL,
`hospital_name` VARCHAR(255) NOT NULL,
`capacity` INT,
`icu_type` INT,
`registration_no` VARCHAR(255) NOT NULL,
`city` VARCHAR(255),
`state`VARCHAR(255),
`pincode`VARCHAR(255),
`street`VARCHAR(255),
`house_number`VARCHAR(255),
CONSTRAINT PK_ICU PRIMARY KEY (icuid)
);
/*
INSERT INTO icu values(0,'apex',50,2,'098654','delhi','delhi','124001','second','1358');
INSERT INTO icu values(1,'apex1',49,3,'098623','moradabad','moradabad','124003','third','1222');
INSERT INTO icu values(2,'apex2',48,4,'098635','patiala','patiala','124004','fourth','1111');
INSERT INTO icu values(3,'apex3',47,5,'098453','chandigarh','chandigarh','124005','fifth','1000');
INSERT INTO icu values(4,'apex4',46,6,'098354','mumbai','mumbai','124006','sixth','0999');
INSERT INTO icu values(5,'apex5',45,7,'098643','bangalore','bangalore','124007','seventh','1819');
*/
/*
2nd
*/
CREATE TABLE IF NOT EXISTS `icuphone` (
`contact_no` VARCHAR(50) NOT NULL,
`icuid` INT,
CONSTRAINT PK_ICUDOC PRIMARY KEY (contact_no),
CONSTRAINT FK_ICU2 FOREIGN KEY (icuid) REFERENCES icu(icuid)
);
/*
INSERT INTO icuphone values('8279804883',1);
INSERT INTO icuphone values('8279893823',2);
INSERT INTO icuphone values('8579804823',3);
INSERT INTO icuphone values('8229804823',4);
INSERT INTO icuphone values('8233887923',5);
*/
/*
3rd
*/
CREATE TABLE IF NOT EXISTS `department` (
`dept_id` INT AUTO_INCREMENT NOT NULL,
`dept_name` VARCHAR(255) NOT NULL,
`capacity` INT NOT NULL,
CONSTRAINT PK_DEPARTMENT PRIMARY KEY (dept_id,dept_name)
);
/*
INSERT INTO department values(1,'Radiology',50);
INSERT INTO department values(2,'Anaesthesia',50);
INSERT INTO department values(3,'Ophthalmology',50);
INSERT INTO department values(4,'Neonatology',50);
INSERT INTO department values(5,'Neurology',50);
*/
/*
4th
*/
CREATE TABLE IF NOT EXISTS `doctor`(
`did` INT,
`post` VARCHAR(40),
`dob` DATE,
`first_name` VARCHAR(40),
`last_name` VARCHAR(40),
`gender` VARCHAR(3),
`dept_id` INT,
`password` VARCHAR(50),
CONSTRAINT PK_Doctor PRIMARY KEY (did),
CONSTRAINT FK_Dept FOREIGN KEY (dept_id) REFERENCES department(dept_id)
);
/*
INSERT INTO doctor values(1,'Sr. Doctor','2017-06-15','alice','skitzi','M',1,'iamyou');
INSERT INTO doctor values(2,'Jr. Doctor','2013-02-13','madam','tussad','F',2,'youisme');
INSERT INTO doctor values(3,'Sr. Doctor','2001-06-15','monke','patel','M',3,'meisyou');
INSERT INTO doctor values(4,'Sr. Doctor','2002-01-19','andkda','skndn','F',4,'isyoume');
INSERT INTO doctor values(5,'Jr. Doctor','2002-03-19','anuradha','pandey','F',5,'wtfisthis');
*/
/*
5th
*/
CREATE TABLE IF NOT EXISTS `docphone` (
`phone_no` VARCHAR(50) NOT NULL,
`did` INT,
CONSTRAINT PK_docphone PRIMARY KEY (phone_no),
CONSTRAINT FK_did FOREIGN KEY (did) REFERENCES doctor(did)
);
/*
INSERT INTO docphone values('9279804883',1);
INSERT INTO docphone values('9271204823',2);
INSERT INTO docphone values('9271224823',3);
INSERT INTO docphone values('9281644823',4);
INSERT INTO docphone values('9279537923',5);
*/
/*
6th
*/
CREATE TABLE IF NOT EXISTS `icudoc` (
`did` INT,
`icuid` INT,
CONSTRAINT PK_ICUDOC PRIMARY KEY (did,icuid),
CONSTRAINT FK_ICU3 FOREIGN KEY (icuid) REFERENCES icu(icuid),
CONSTRAINT FK_Doctor FOREIGN KEY (did) REFERENCES doctor(did)
);
/*
INSERT INTO icudoc values(1,1);
INSERT INTO icudoc values(2,2);
INSERT INTO icudoc values(3,3);
INSERT INTO icudoc values(4,4);
INSERT INTO icudoc values(5,5);
*/
/*
7th
*/
CREATE TABLE IF NOT EXISTS `patient` (
`pid` INT AUTO_INCREMENT NOT NULL,
`first_name` VARCHAR(255) NOT NULL,
`last_name` VARCHAR(255),
`time_of_death` DATETIME,
`agreement` TINYINT(1) DEFAULT '0' NOT NULL,
`braindead` TINYINT(1) DEFAULT '0' NOT NULL,
`icuid` INT,
`did` INT,
`password` VARCHAR(255) NOT NULL,
`pulse` INT,
`temp` INT,
`blood_pressure_dis` INT,
`blood_pressure_sys`INT,
`comorbidity_status` TEXT,
`breathing_rate` INT,
`blood_group` VARCHAR(3) NOT NULL,
`gender` VARCHAR(1) NOT NULL,
`admission_date` DATETIME,
`city` VARCHAR(255),
`state`VARCHAR(255),
`pincode`VARCHAR(255),
`street`VARCHAR(255),
`house_number`VARCHAR(255),
`reasons`VARCHAR(255),
`dob` DATE,
CONSTRAINT PK_Patient PRIMARY KEY (pid),
CONSTRAINT FK_ICU FOREIGN KEY (icuid) REFERENCES icu(icuid),
CONSTRAINT FK_Doctor1 FOREIGN KEY (did) REFERENCES doctor(did)
);
/*
INSERT INTO patient values(1,'a','b','1991-12-31 12:59:59',1,0,4,3,'password0',72,95,80,116,'NONE',12,'A+','M','9999-12-31 23:59:59','a','f','124001','second','1111','none','2017-06-15');
INSERT INTO patient values(2,'b','e','1999-11-03 12:59:59',0,1,4,3,'password1',73,96,81,117,'NONE',13,'B+','F','9999-12-31 23:59:59','b','g','124002','second','1158','none','2017-06-15');
INSERT INTO patient values(3,'c','f','2001-11-03 12:59:59',s,1,4,3,'password2',74,97,82,118,'NONE',14,'AB+','F','9999-12-31 23:59:59','c','h','124003','second','1352','none','2017-06-15');
INSERT INTO patient values(4,'d','g','2003-08-08 12:59:59',0,1,4,3,'password3',75,98,83,119,'NONE',15,'O+','M','9999-12-31 23:59:59','d','i','124004','second','1882','none','2017-06-15');
INSERT INTO patient values(5,'e','h','1978-07-09 12:59:59',0,0,4,3,'password4',76,99,84,120,'NONE',16,'A-','M','9999-12-31 23:59:59','e','j','124005','second','0029','none','2017-06-15');
*/
/*
8th
*/
CREATE TABLE IF NOT EXISTS `patientphone` (
`phone_no` VARCHAR(50) NOT NULL,
`pid` INT,
CONSTRAINT PK_patient_phone PRIMARY KEY (phone_no),
CONSTRAINT FK_pid FOREIGN KEY (pid) REFERENCES patient(pid)
);
/*
INSERT INTO patientphone values('7279879483',1);
INSERT INTO patientphone values('7272998393',2);
INSERT INTO patientphone values('9812804823',3);
INSERT INTO patientphone values('8138804823',4);
INSERT INTO patientphone values('7092887923',5);
*/
/*
9th
*/
create table `organ`(
`organid` INT,
`quantity` INT,
`organ_name` VARCHAR(20),
CONSTRAINT PK_Organ PRIMARY KEY (organid)
);
/*
INSERT INTO organ values(1,2,'a');
INSERT INTO organ values(2,2,'b');
INSERT INTO organ values(3,3,'c');
INSERT INTO organ values(4,3,'d');
*/ | true |
9e20d5db8feebc4fa56361899c798c3acbd336f9 | SQL | mohantyabhijit/mindkart | /sql-queries/create-table-user.sql | UTF-8 | 409 | 2.84375 | 3 | [] | no_license | CREATE TABLE [User] (
UserId INT NOT NULL IDENTITY(1,1),
FirstName VARCHAR(50) NOT NULL,
LastName VARCHAR(50) NOT NULL,
UserEmail VARCHAR(30) NOT NULL,
UserPhoneNo VARCHAR(20) NOT NULL,
UserAddress VARCHAR(200) NOT NULL,
UserState VARCHAR(20) NOT NULL,
UserCity VARCHAR(50) NOT NULL,
UserZip VARCHAR(10) NOT NULL,
PRIMARY KEY(UserId),
OrderId INT FOREIGN KEY REFERENCES
OrderDetail(OrderId)
);
| true |
f9e0e298f8afd7de232fef83c04629f24670e7d7 | SQL | social-inn/Reviews | /database_SDC/cassandra_schema.cql | UTF-8 | 902 | 3.328125 | 3 | [] | no_license | CREATE KEYSPACE reviews
WITH REPLICATION = {
'class' : 'SimpleStrategy',
'replication_factor' : 1
};
USE KEYSPACE reviews;
DROP TABLE IF EXISTS reviews;
CREATE TABLE reviews (
review_id INT,
room_id INT ,
username VARCHAR ,
gender INT ,
profilepicnum INT ,
reviewdate VARCHAR ,
sentence VARCHAR,
accuracy_rating DECIMAL,
communication_rating DECIMAL,
cleanliness_rating DECIMAL,
location_rating DECIMAL,
check_in_rating DECIMAL,
value_rating DECIMAL,
overall_rating DECIMAL,
PRIMARY KEY (review_id)
);
COPY reviews (review_id, room_id, username, gender, profilePicNum, reviewdate, sentence, accuracy_rating, communication_rating, cleanliness_rating, location_rating, check_in_rating, value_rating, overall_rating) FROM '/Users/mattviolet/Desktop/Reviews/sample.csv' WITH HEADER = true;
CREATE INDEX room_idx ON reviews.reviews (room_id);
tracing on; | true |
7f0fee2b09195971bac255dc4fd5520986daabd1 | SQL | damienlenoir/moderator | /commentaires.sql | UTF-8 | 2,516 | 3.203125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 22, 2016 at 12:11 AM
-- Server version: 5.7.14
-- PHP Version: 5.6.25
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `sosamazon`
--
-- --------------------------------------------------------
--
-- Table structure for table `commentaires`
--
CREATE TABLE `commentaires` (
`id` int(11) NOT NULL,
`id_article` varchar(50) NOT NULL,
`auteur` varchar(255) NOT NULL,
`commentaire` text NOT NULL,
`date` date NOT NULL,
`verif` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `commentaires`
--
INSERT INTO `commentaires` (`id`, `id_article`, `auteur`, `commentaire`, `date`, `verif`) VALUES
(1, 'ouverture', 'inconnu', 'Super article, merci', '2016-11-18', 1),
(4, 'buybox', 'Georges', 'Merci pour votre aide, j\'ai maintenant la buybox pour tous mes articles', '2016-11-11', 1),
(5, 'pao', 'Maxime', 'Interessant, je sais maintenant comment rédiger un PAO', '2016-11-09', 1),
(18, 'ouverture', 'kiki', 'sympa cet article pour ouvrir un compte', '2016-11-21', 1),
(7, 'ouverture', 'Steph', 'cool', '2016-11-01', 0),
(8, 'ouverture', 'Steph', 'cool', '2016-11-01', 1),
(17, 'az', 'test', 'test', '2016-11-21', 0),
(10, 'ouverture', 'clément', 'interressant', '2016-11-20', 1),
(11, 'ouverture', 'bobo', 'YOLO', '2016-11-20', 0),
(12, 'ouverture', 'Mimie', 'C\'est nul ! ', '2016-11-20', 0),
(13, 'autoentrepreneur', 'kagoude', 'Merci pour cet article :)', '2016-11-20', 0),
(14, 'adresses', 'Pedro', 'très utile, merci', '2016-11-20', 1),
(15, 'adresses', 'Christophe', 'fabuleux', '2016-11-20', 0),
(16, 'typeevaluation', 'Steeve', 'bon article', '2016-11-20', 0);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `commentaires`
--
ALTER TABLE `commentaires`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `commentaires`
--
ALTER TABLE `commentaires`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
/*!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 |
4f8d59e3bfe58cc7390a4dfff1065233b221eb18 | SQL | chinadayi/zlcgroup | /form/install.sql | UTF-8 | 1,072 | 3 | 3 | [] | no_license | DROP TABLE IF EXISTS `retengcms_form`;
CREATE TABLE `retengcms_form` (
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`table` varchar(30) NOT NULL,
`siteid` smallint(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `retengcms_form_fields`;
CREATE TABLE `retengcms_form_fields` (
`id` int(6) NOT NULL AUTO_INCREMENT,
`form` varchar(80) NOT NULL,
`formid` int(6) NOT NULL,
`name` varchar(64) NOT NULL,
`enname` varchar(32) NOT NULL,
`tips` varchar(80) NOT NULL,
`unit` varchar(32) NOT NULL,
`options` text NOT NULL,
`default` varchar(255) NOT NULL,
`regex` varchar(80) NOT NULL,
`css` varchar(32) NOT NULL,
`length` varchar(8) NOT NULL,
`orderby` int(6) NOT NULL,
`disabled` tinyint(1) NOT NULL DEFAULT '0',
`cantdelete` tinyint(1) NOT NULL DEFAULT '0',
`adminonly` tinyint(1) NOT NULL DEFAULT '0',
`siteid` smallint(4) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `formid` (`formid`),
KEY `siteid` (`siteid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; | true |
a8d8a06241552465fd3e98c73972314842463fc9 | SQL | angel-aleksandrov06/SoftUni-Engineering-CSharp | /Databases Basics - MS SQL Server/Exams/ExamPreparation1/09. FullInfo.sql | UTF-8 | 460 | 4.0625 | 4 | [] | no_license | SELECT (FirstName + ' ' + LastName) AS [Full Name],
pl.[Name] AS [Plane Name],
(f.Origin + ' - ' + f.Destination) AS [Trip],
lt.Type AS [Luggage Type]
FROM Passengers p
JOIN Tickets t
ON t.PassengerId = p.Id
JOIN Flights f
ON t.FlightId = F.Id
JOIN Planes pl
ON f.PlaneId = pl.Id
JOIN Luggages l
ON t.LuggageId = l.Id
JOIN LuggageTypes lt
ON l.LuggageTypeId = lt.Id
ORDER BY [Full Name], [Plane Name], f.Origin, f.Destination, [Luggage Type] | true |
39c4058d153ac88730774ebbdc879afc68555f08 | SQL | RubenBranco/AD2018 | /tv_series_manager/server/schema.sql | UTF-8 | 959 | 3.90625 | 4 | [
"MIT"
] | permissive | PRAGMA foreign_keys = ON;
CREATE TABLE users (
id INTEGER PRIMARY KEY,
name VARCHAR(128),
username VARCHAR(64),
password VARCHAR(64)
);
CREATE TABLE classification (
id INTEGER PRIMARY KEY,
initials VARCHAR(10),
description TEXT
);
CREATE TABLE category (
id INTEGER PRIMARY KEY,
name VARCHAR(20),
description TEXT
);
CREATE TABLE list_series (
user_id INTEGER,
classification_id INTEGER,
serie_id INTEGER,
PRIMARY KEY (USER_ID, SERIE_ID),
FOREIGN KEY(user_id) REFERENCES users(id),
FOREIGN KEY(classification_id) REFERENCES classification(id),
FOREIGN KEY(serie_id) REFERENCES serie(id)
);
CREATE TABLE serie (
id INTEGER PRIMARY KEY,
name VARCHAR(20),
start_date DATE,
synopse TEXT,
category_id INTEGER,
FOREIGN KEY(category_id) REFERENCES category(id)
);
CREATE TABLE episode (
id INTEGER PRIMARY KEY,
name TEXT,
decription TEXT,
serie_id INTEGER,
FOREIGN KEY(serie_id) REFERENCES serie(id)
); | true |
e67053e012e9a0c5cc71ecf9ddc5a56b6bb0d47b | SQL | crate/crate-demo | /gce-coreos/schema.sql | UTF-8 | 647 | 3.28125 | 3 | [] | no_license | -- users
DROP TABLE users;
CREATE TABLE users (
username STRING PRIMARY KEY,
name STRING,
address STRING INDEX USING FULLTEXT,
date_of_birth TIMESTAMP,
date_joined TIMESTAMP,
month_partition STRING PRIMARY KEY
) CLUSTERED INTO 4 shards
PARTITIONED BY (month_partition)
WITH (number_of_replicas = 0, refresh_interval = 0);
-- steps
DROP TABLE steps;
CREATE TABLE steps (
username STRING,
ts TIMESTAMP,
num_steps INTEGER,
month_partition STRING,
payload OBJECT(dynamic)
) CLUSTERED BY (username) INTO 4 shards
PARTITIONED BY (month_partition)
WITH (number_of_replicas = 0, refresh_interval = 0);
| true |
9f101e6347b136f2f40ddf3c2e51e68721f0df37 | SQL | leongold/ovirt-engine | /packaging/dbscripts/upgrade/03_06_0370_gluster_georep_tables.sql | UTF-8 | 2,359 | 3.65625 | 4 | [
"Apache-2.0"
] | permissive | -- Add gluster_georep_session table
CREATE TABLE gluster_georep_session
(
session_id UUID NOT NULL,
master_volume_id UUID NOT NULL,
session_key VARCHAR(150) NOT NULL,
slave_host_uuid UUID,
slave_host_name VARCHAR(50),
slave_volume_id UUID,
slave_volume_name VARCHAR(50),
status VARCHAR,
_create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP,
_update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP,
CONSTRAINT pk_gluster_georep_session PRIMARY KEY(session_id)
) WITH OIDS;
CREATE UNIQUE INDEX IDX_gluster_georep_session_unique ON gluster_georep_session(master_volume_id, session_key);
-- Add gluster_georep_config
CREATE TABLE gluster_georep_config
(
session_id UUID NOT NULL,
config_key VARCHAR(50),
config_value VARCHAR(50),
_update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP,
CONSTRAINT pk_gluster_georep_config PRIMARY KEY(session_id, config_key)
) WITH OIDS;
-- Add gluster_georep_session_details table
CREATE TABLE gluster_georep_session_details
(
session_id UUID NOT NULL,
master_brick_id UUID NOT NULL,
slave_host_uuid UUID,
slave_host_name VARCHAR(50) NOT NULL,
status VARCHAR(20),
checkpoint_status VARCHAR(20),
crawl_status VARCHAR(20),
files_synced BIGINT,
files_pending BIGINT,
bytes_pending BIGINT,
deletes_pending BIGINT,
files_skipped BIGINT,
_update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP,
CONSTRAINT pk_gluster_georep_session_details PRIMARY KEY(session_id, master_brick_id)
) WITH OIDS;
ALTER TABLE ONLY gluster_georep_config
ADD CONSTRAINT fk_gluster_georep_config_session_id FOREIGN KEY (session_id) REFERENCES
gluster_georep_session(session_id) ON DELETE CASCADE;
ALTER TABLE ONLY gluster_georep_session_details
ADD CONSTRAINT fk_gluster_georep_details_session_id FOREIGN KEY (session_id) REFERENCES
gluster_georep_session(session_id) ON DELETE CASCADE;
ALTER TABLE ONLY gluster_georep_session_details
ADD CONSTRAINT fk_gluster_georep_details_brick_id FOREIGN KEY (master_brick_id) REFERENCES
gluster_volume_bricks(id) ON DELETE CASCADE;
ALTER TABLE ONLY gluster_georep_session
ADD CONSTRAINT fk_gluster_georep_session_vol_id FOREIGN KEY (master_volume_id) REFERENCES
gluster_volumes(id) ON DELETE CASCADE;
| true |
12fbf3eed241b64defcbec934960c8fe76858c8c | SQL | robjlong/data-check | /DataIntegrityCheck.DB/data_testing/Stored Procedures/DeleteQueryAssignment.sql | UTF-8 | 2,130 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | -- [data_testing].[DeleteQueryAssignment]
--
--
--
--
--
--
-- EXEC [data_testing].[DeleteQueryAssignment]
--
--------------------------------------------------------------------------------
-- Change History
--------------------------------------------------------------------------------
-- Version Date Author Description
-- ------- ---------- ----------- ------------------------------------
-- 1.0 TALAVANT\rob.long Initial Creation
--------------------------------------------------------------------------------
CREATE PROCEDURE [data_testing].[DeleteQueryAssignment]
@ServerName VARCHAR(150)
, @DatabaseName VARCHAR(150)
, @QueryName VARCHAR(150)
AS
BEGIN
SET NOCOUNT ON;
--------------------------------------------------------------------------------------------------
-- DELETE TestExecutionResult
--------------------------------------------------------------------------------------------------
DELETE tr
FROM [DataCheck].[data_testing].[TestAssignment] ta
JOIN data_testing.QueryDefinition q ON q.QueryDefinitionId = ta.QueryDefinitionId
JOIN data_testing.ConnectionDefinition c ON c.ConnectionId = ta.ConnectionId
JOIN data_testing.TestExecutionResult tr ON tr.TestAssignmentId = ta.TestAssignmentId
WHERE c.ServerName = @ServerName
AND c.DatabaseName = @DatabaseName
AND q.Name = @QueryName;
--------------------------------------------------------------------------------------------------
-- DELETE TestAssignment
--------------------------------------------------------------------------------------------------
DELETE ta
FROM [DataCheck].[data_testing].[TestAssignment] ta
JOIN data_testing.QueryDefinition q ON q.QueryDefinitionId = ta.QueryDefinitionId
JOIN data_testing.ConnectionDefinition c ON c.ConnectionId = ta.ConnectionId
WHERE c.ServerName = @ServerName
AND c.DatabaseName = @DatabaseName
AND q.Name = @QueryName;
END; | true |
d667278c5cbbe8fe326dadcdf025cacecbce7c3f | SQL | Rashld/SQL | /stepic_sql/1_3_05.sql | UTF-8 | 754 | 3.65625 | 4 | [] | no_license | Исходные данные
База данных магазина `store_simple` состоит из одной таблицы `store` следующей структуры:
CREATE TABLE IF NOT EXISTS `store_simple`.`store` (
`product_name` VARCHAR(255) NULL,
`category` VARCHAR(255) NULL,
`price` DECIMAL(18,2) NULL,
`sold_num` INT NULL)
ENGINE = InnoDB;
Задание
Выведите количество товаров в каждой категории. Результат должен содержать два столбца:
название категории,
количество товаров в данной категории.
select category
, count(product_name) product_name_cnt
from store
group by category;
| true |
b46fe4b664c7c84be309f963b05e6980dec170fd | SQL | majoflosa/simulation-3 | /helo/db/getPostImagesQuery.sql | UTF-8 | 171 | 3.28125 | 3 | [] | no_license | SELECT i.image_url, u.username, p.title, p.content FROM posts p
JOIN helo_images i ON i.post_id = p.id
JOIN helo_users u ON u.id = p.author_id
WHERE p.id = $1; | true |
34a891ac47689eb645d04f1ecf988f809681b21d | SQL | hdlxt/SpringDataJpaDemo | /demo.sql | UTF-8 | 870 | 2.609375 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1
Source Server Version : 50721
Source Host : localhost:3306
Source Database : demo
Target Server Type : MYSQL
Target Server Version : 50721
File Encoding : 65001
Date: 2019-01-26 13:42:10
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for t_user
-- ----------------------------
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`number` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_user
-- ----------------------------
INSERT INTO `t_user` VALUES ('2', 'lxt', null);
INSERT INTO `t_user` VALUES ('3', 'lxt', null);
| true |
235d0bbf64581a2a80bfc26845c56c8659054901 | SQL | CUBRID/cubrid-testcases | /sql/_27_banana_qa/issue_5765_timezone_support/_02_type_conversions/_01_explicit_conversion/cases/_01_dt_to_collection.sql | UTF-8 | 1,954 | 3.578125 | 4 | [
"BSD-3-Clause"
] | permissive | --cast DATETIME(L)TZ columns to collection data types
drop table if exists tz_test;
create table tz_test(id int, ts datetime, dtltz datetime with local time zone, dttz datetime with time zone);
set timezone 'UTC';
insert into tz_test values(1, datetimeltz'2019-01-02 12:00:01.999', datetimetz'2019-01-02 12:00:01.999', datetimetz'2019-01-02 12:00:01.999');
insert into tz_test values(2, datetimeltz'2019-01-02 12:00:01.999 -10:00', datetimetz'2019-01-02 12:00:01.999 -10:00', datetimetz'2019-01-02 12:00:01.999 -10:00');
insert into tz_test values(3, datetimeltz'2019-01-02 12:00:01.999 +8:00', datetimetz'2019-01-02 12:00:01.999 +8:00', datetimetz'2019-01-02 12:00:01.999 +8:00');
insert into tz_test values(4, datetimeltz'2019-01-02 12:00:01.999 Asia/Tokyo', datetimetz'2019-01-02 12:00:01.999 Asia/Tokyo', datetimetz'2019-01-02 12:00:01.999 Asia/Tokyo');
--test: cast ts column to collection types
select id, cast(ts as set(datetime)) from tz_test order by 1;
select id, cast(ts as multiset(datetime with local time zone)) from tz_test order by 1;
select id, cast(ts as list(datetime)) from tz_test order by 1;
select id, cast(ts as sequence(datetime with time zone)) from tz_test order by 1;
--test: cast dtltz column to collection types
select id, cast(dtltz as set(datetime)) from tz_test order by 1;
select id, cast(dtltz as multiset(datetime with local time zone)) from tz_test order by 1;
select id, cast(dtltz as list(datetime)) from tz_test order by 1;
select id, cast(dtltz as sequence(datetime with time zone)) from tz_test order by 1;
--test: cast dttz column to collection types
select id, cast(dttz as set(datetime)) from tz_test order by 1;
select id, cast(dttz as multiset(datetime with local time zone)) from tz_test order by 1;
select id, cast(dttz as list(datetime)) from tz_test order by 1;
select id, cast(dttz as sequence(datetime with time zone)) from tz_test order by 1;
drop table tz_test;
set timezone 'Asia/Seoul';
| true |
bbbfb9c932a02bafdee2de1a6be605704cb39245 | SQL | ThierryStPierre/ProjetAECWeb | /SQL/Evenement.sql | UTF-8 | 698 | 2.75 | 3 | [] | no_license | create table Evenement (
ID_Evenement int NOT NULL AUTO_INCREMENT,
ID_PersonneBut int,
ID_PersonnePasse1 int,
ID_PersonnePasse2 int,
ID_Partie int NOT NULL,
ID_PersonnePenalite int,
ID_PersonneTire int,
UNIQUE(ID_Evenement),
PRIMARY KEY (ID_Evenement),
FOREIGN KEY(ID_PersonneBut) REFERENCES Personne(ID_Personne),
FOREIGN KEY(ID_PersonnePasse1) REFERENCES Personne(ID_Personne),
FOREIGN KEY(ID_PersonnePasse1) REFERENCES Personne(ID_Personne),
FOREIGN KEY(ID_PersonnePenalite) REFERENCES Personne(ID_Personne),
FOREIGN KEY(ID_PersonneTire) REFERENCES Personne(ID_Personne),
FOREIGN KEY(ID_Partie) REFERENCES Partie(ID_Partie)
);
| true |
6f7acdd5ecae135f55e31d339f5f9e84781acaa2 | SQL | lennonprado/postgres-db-crud | /G19_Creacion.sql | UTF-8 | 14,890 | 3.21875 | 3 | [] | no_license | -- TUDAI 2017
-- TRABAJO PRACTICO ESPECIAL
-- BASES DE DATOS
-- Eduardo Bravo y Marcelo Prado
-- table: GR19_Categoria
CREATE TABLE GR19_Categoria (
cdoCategoria varchar(20) NOT NULL,
cdoDisciplina varchar(10) NOT NULL,
descripcion varchar(200) NOT NULL,
edadMinima int NOT NULL,
edadMaxima int NOT NULL,
CONSTRAINT PK_GR19_categoria PRIMARY KEY (cdoCategoria,cdoDisciplina)
);
-- table: GR19_ClasificacionCompetencia
CREATE TABLE GR19_ClasificacionCompetencia (
idCompetencia int NOT NULL,
tipoDoc varchar(3) NOT NULL,
nroDoc int NOT NULL,
puestoGeneral varchar(50) NOT NULL,
puntosGeneral int NOT NULL,
puestoCategoria varchar(50) NOT NULL,
puntosCategoria int NOT NULL,
CONSTRAINT PK_GR19_ClasificacionCompetencia PRIMARY KEY (idCompetencia,tipoDoc,nroDoc)
);
-- table: GR19_Competencia
CREATE TABLE GR19_Competencia (
idCompetencia int NOT NULL,
cdoDisciplina varchar(10) NOT NULL,
nombre varchar(500) NOT NULL,
fecha timestamp NULL,
nombreLugar varchar(500) NOT NULL,
nombreLocalidad varchar(500) NOT NULL,
organizador varchar(500) NOT NULL,
individual bit(1) NOT NULL,
fechaLimiteInscripcion timestamp NULL,
cantJueces int NOT NULL,
coberturaTV bit(1) NOT NULL,
mapa text NULL,
web varchar(4000) NULL,
CONSTRAINT PK_GR19_competencia PRIMARY KEY (idCompetencia)
);
-- table: GR19_Deportista
CREATE TABLE GR19_Deportista (
tipoDoc varchar(3) NOT NULL,
nroDoc int NOT NULL,
federado bit(1) NOT NULL,
fechaUltimaFederacion timestamp NULL,
nroLicencia varchar(20) NULL,
cdoCategoria varchar(20) NOT NULL,
cdoDisciplina varchar(10) NOT NULL,
cdoFederacion varchar(50) NULL,
cdoDisciplinaFederacion varchar(10) NULL,
CONSTRAINT PK_GR19_Deportista PRIMARY KEY (tipoDoc,nroDoc)
);
-- table: GR19_Disciplina
CREATE TABLE GR19_Disciplina (
cdoDisciplina varchar(10) NOT NULL,
nombre varchar(100) NOT NULL,
descripcion text NOT NULL,
CONSTRAINT PK_GR19_Disciplina PRIMARY KEY (cdoDisciplina)
);
-- table: GR19_Equipo
CREATE TABLE GR19_Equipo (
id int NOT NULL,
nombre varchar(100) NOT NULL,
fechaAlta timestamp NOT NULL,
CONSTRAINT PK_GR19_Equipo PRIMARY KEY (id)
);
-- table: GR19_EquipoDeportista
CREATE TABLE GR19_EquipoDeportista (
id int NOT NULL,
tipoDoc varchar(3) NOT NULL,
nroDoc int NOT NULL,
CONSTRAINT PK_GR19_EquipoDeportista PRIMARY KEY (id,tipoDoc,nroDoc)
);
-- table: GR19_Federacion
CREATE TABLE GR19_Federacion (
cdoFederacion varchar(50) NOT NULL,
cdoDisciplina varchar(10) NOT NULL,
nombre varchar(100) NOT NULL,
anioCreacion int NULL,
cantAfiliados int NULL,
CONSTRAINT PK_GR19_Federacion PRIMARY KEY (cdoFederacion,cdoDisciplina)
);
-- table: GR19_Inscripcion
CREATE TABLE GR19_Inscripcion (
id int NOT NULL,
tipoDoc varchar(3) NULL,
nroDoc int NULL,
Equipo_id int NULL,
idCompetencia int NOT NULL,
fecha timestamp NULL,
CONSTRAINT PK_GR19_Inscripcion PRIMARY KEY (id)
);
-- table: GR19_Juez
CREATE TABLE GR19_Juez (
tipoDoc varchar(3) NOT NULL,
nroDoc int NOT NULL,
oficial bit(1) NOT NULL,
nroLicencia varchar(20) NULL,
CONSTRAINT PK_GR19_Juez PRIMARY KEY (tipoDoc,nroDoc)
);
-- table: GR19_JuezCompetencia
CREATE TABLE GR19_JuezCompetencia (
idCompetencia int NOT NULL,
tipoDoc varchar(3) NOT NULL,
nroDoc int NOT NULL,
CONSTRAINT PK_GR19_JuezCompetencia PRIMARY KEY (idCompetencia,tipoDoc,nroDoc)
);
-- table: GR19_Persona
CREATE TABLE GR19_Persona (
tipoDoc varchar(3) NOT NULL,
nroDoc int NOT NULL,
nombre varchar(100) NOT NULL,
apellido varchar(100) NOT NULL,
direccion varchar(250) NOT NULL,
nombreLocalidad varchar(250) NOT NULL,
celular varchar(20) NOT NULL,
sexo char(1) NOT NULL,
mail varchar(100) NULL,
tipo char(1) NOT NULL,
fechaNacimiento timestamp NOT NULL,
CONSTRAINT PK_GR19_Persona PRIMARY KEY (tipoDoc,nroDoc)
);
-- foreign keys
-- Reference: FK_GR19_ClasificacionCompetencia_Competencia (table: GR19_ClasificacionCompetencia)
ALTER TABLE GR19_ClasificacionCompetencia ADD CONSTRAINT FK_GR19_ClasificacionCompetencia_Competencia
FOREIGN KEY (idCompetencia)
REFERENCES GR19_Competencia (idCompetencia)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_ClasificacionCompetencia_Deportista (table: GR19_ClasificacionCompetencia)
ALTER TABLE GR19_ClasificacionCompetencia ADD CONSTRAINT FK_GR19_ClasificacionCompetencia_Deportista
FOREIGN KEY (tipoDoc, nroDoc)
REFERENCES GR19_Deportista (tipoDoc, nroDoc)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Competencia_Disciplina (table: GR19_Competencia)
ALTER TABLE GR19_Competencia ADD CONSTRAINT FK_GR19_Competencia_Disciplina
FOREIGN KEY (cdoDisciplina)
REFERENCES GR19_Disciplina (cdoDisciplina)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Deportista_Categoria (table: GR19_Deportista)
ALTER TABLE GR19_Deportista ADD CONSTRAINT FK_GR19_Deportista_Categoria
FOREIGN KEY (cdoCategoria, cdoDisciplina)
REFERENCES GR19_Categoria (cdoCategoria, cdoDisciplina)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Deportista_Federacion (table: GR19_Deportista)
ALTER TABLE GR19_Deportista ADD CONSTRAINT FK_GR19_Deportista_Federacion
FOREIGN KEY (cdoFederacion, cdoDisciplinaFederacion)
REFERENCES GR19_Federacion (cdoFederacion, cdoDisciplina)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Deportista_Persona (table: GR19_Deportista)
ALTER TABLE GR19_Deportista ADD CONSTRAINT FK_GR19_Deportista_Persona
FOREIGN KEY (tipoDoc, nroDoc)
REFERENCES GR19_Persona (tipoDoc, nroDoc)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_EquipoDeportista_Deportista (table: GR19_EquipoDeportista)
ALTER TABLE GR19_EquipoDeportista ADD CONSTRAINT FK_GR19_EquipoDeportista_Deportista
FOREIGN KEY (tipoDoc, nroDoc)
REFERENCES GR19_Deportista (tipoDoc, nroDoc)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_EquipoDeportista_Equipo (table: GR19_EquipoDeportista)
ALTER TABLE GR19_EquipoDeportista ADD CONSTRAINT FK_GR19_EquipoDeportista_Equipo
FOREIGN KEY (id)
REFERENCES GR19_Equipo (id)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Federacion_Disciplina (table: GR19_Federacion)
ALTER TABLE GR19_Federacion ADD CONSTRAINT FK_GR19_Federacion_Disciplina
FOREIGN KEY (cdoDisciplina)
REFERENCES GR19_Disciplina (cdoDisciplina)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Inscripcion_Competencia (table: GR19_Inscripcion)
ALTER TABLE GR19_Inscripcion ADD CONSTRAINT FK_GR19_Inscripcion_Competencia
FOREIGN KEY (idCompetencia)
REFERENCES GR19_Competencia (idCompetencia)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Inscripcion_Deportista (table: GR19_Inscripcion)
ALTER TABLE GR19_Inscripcion ADD CONSTRAINT FK_GR19_Inscripcion_Deportista
FOREIGN KEY (tipoDoc, nroDoc)
REFERENCES GR19_Deportista (tipoDoc, nroDoc)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Inscripcion_Equipo (table: GR19_Inscripcion)
ALTER TABLE GR19_Inscripcion ADD CONSTRAINT FK_GR19_Inscripcion_Equipo
FOREIGN KEY (Equipo_id)
REFERENCES GR19_Equipo (id)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_JuezCompetencia_Competencia (table: GR19_JuezCompetencia)
ALTER TABLE GR19_JuezCompetencia ADD CONSTRAINT FK_GR19_JuezCompetencia_Competencia
FOREIGN KEY (idCompetencia)
REFERENCES GR19_Competencia (idCompetencia)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_JuezCompetencia_Juez (table: GR19_JuezCompetencia)
ALTER TABLE GR19_JuezCompetencia ADD CONSTRAINT FK_GR19_JuezCompetencia_Juez
FOREIGN KEY (tipoDoc, nroDoc)
REFERENCES GR19_Juez (tipoDoc, nroDoc)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_Juez_Persona (table: GR19_Juez)
ALTER TABLE GR19_Juez ADD CONSTRAINT FK_GR19_Juez_Persona
FOREIGN KEY (tipoDoc, nroDoc)
REFERENCES GR19_Persona (tipoDoc, nroDoc)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
-- Reference: FK_GR19_categoria_disciplina (table: GR19_Categoria)
ALTER TABLE GR19_Categoria ADD CONSTRAINT FK_GR19_categoria_disciplina
FOREIGN KEY (cdoDisciplina)
REFERENCES GR19_Disciplina (cdoDisciplina)
NOT DEFERRABLE
INITIALLY IMMEDIATE
;
------ inserts
--
--
--
--
-- Data for Name: GR19_disciplina; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_disciplina VALUES ('FUT', 'Fulbol 11', 'Fultbol 11');
INSERT INTO GR19_disciplina VALUES ('Tenis', 'Tenis Men', 'Tenis singler men');
INSERT INTO GR19_disciplina VALUES ('Pad', 'Paddel', 'Padel por equipo');
INSERT INTO GR19_disciplina VALUES ('FUT2', 'Futbol', 'Futbol 11');
INSERT INTO GR19_disciplina VALUES ('FUT1', 'Futbol', 'Futbol 5');
INSERT INTO GR19_disciplina VALUES ('TEN1', 'Tenis', 'Tenis single');
INSERT INTO GR19_disciplina VALUES ('TEN2', 'Tenis', 'Tenis dobles');
--
-- Data for Name: GR19_categoria; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_categoria VALUES ('Seniorf', 'FUT', 'Senior-futbol', 21, 31);
INSERT INTO GR19_categoria VALUES ('Juvenilt', 'Tenis', 'Juvenil-Tenis', 10, 20);
INSERT INTO GR19_categoria VALUES ('Seniort', 'Tenis', 'Senior-Tenis
', 21, 31);
INSERT INTO GR19_categoria VALUES ('juvenilf', 'FUT', 'Juvenil-Futbol', 10, 20);
INSERT INTO GR19_categoria VALUES ('SeniorF', 'FUT1', 'Senior-futbol', 21, 31);
INSERT INTO GR19_categoria VALUES ('JuvenilT', 'TEN1', 'Juvenil-Tenis', 10, 20);
INSERT INTO GR19_categoria VALUES ('SeniorT', 'TEN2', 'Senior-Tenis', 21, 31);
INSERT INTO GR19_categoria VALUES ('JuvenilF', 'FUT1', 'Juvenil-Futbol', 10, 20);
--
-- Data for Name: GR19_competencia; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_competencia VALUES (11, 'FUT','Futbol', '2017-06-09 00:00:00', 'Futbol', 'Fl', 'bol', B'1', '2017-06-09 00:00:00', 3,'1', 'e3e3', '3e3e');
INSERT INTO GR19_competencia VALUES (12, 'Tenis', 'tenes de noche', '2017-06-15 00:00:00', 'uncas', 'tandil', 'edu', B'1', '2017-06-16 00:00:00', 2,'1', '', '');
INSERT INTO GR19_competencia VALUES (1, 'FUT2', 'Futbol nocturno', '2017-06-09 00:00:00', 'campus', 'tandil', 'unicen', B'0', '2017-06-15 00:00:00', 3,'0', NULL, NULL);
INSERT INTO GR19_competencia VALUES (13, 'TEN2', 'tenes de dia', '2017-06-15 00:00:00', 'uncas', 'tandil', 'edu', B'1', '2017-06-16 00:00:00', 2,'1', '', '');
INSERT INTO GR19_competencia VALUES (14, 'TEN1', 'tenes de tarde', '2017-06-15 00:00:00', 'uncas', 'tandil', 'edu', B'1', '2017-06-16 00:00:00', 2,'1', '', '');
--
-- Data for Name: GR19_federacion; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_federacion VALUES ('PSTA', 'FUT', 'PASTA - futbol', 2010, 100);
INSERT INTO GR19_federacion VALUES ('SASTA', 'FUT', 'socias ... Futbol
', 2013, 120);
INSERT INTO GR19_federacion VALUES ('TEn', 'Tenis', 'FETENis', 2014, 300);
INSERT INTO GR19_federacion VALUES ('FEDFUT1', 'FUT1', 'Federacion de futbol 1', 2010, 200);
INSERT INTO GR19_federacion VALUES ('FEDFUT2', 'FUT1', 'Federacion de futbol 2', 2000, 120);
INSERT INTO GR19_federacion VALUES ('FEDFUT3', 'FUT2', 'Federacion de futbol 3', 2010, 10);
INSERT INTO GR19_federacion VALUES ('FEDFUT4', 'FUT2', 'Federacion de futbol 4', 2010, 230);
INSERT INTO GR19_federacion VALUES ('FEDTEN1', 'TEN1', 'Federacion de tenis 1', 2010, 200);
INSERT INTO GR19_federacion VALUES ('FEDTEN2', 'TEN1', 'Federacion de tenis 2', 2000, 120);
INSERT INTO GR19_federacion VALUES ('FEDTEN3', 'TEN2', 'Federacion de tenis 1', 2010, 200);
INSERT INTO GR19_federacion VALUES ('FEDTEN4', 'TEN2', 'Federacion de tenis 3', 2010, 10);
--
-- Data for Name: GR19_persona; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_persona VALUES ('dni', 20, 'sss', 'ssss', 'ss', 'sss', 'sss', 'f', 'ss', '1', '2001-01-01 00:00:00');
INSERT INTO GR19_persona VALUES ('dni', 3029291, 'marcelo', 'prado', '', '', '', 'm', '', '1', '1980-05-09 00:00:00');
INSERT INTO GR19_persona VALUES ('dni', 29587447, 'Eduardo', 'bravo', '', '', '', 'M', '', 'q', '1982-02-09 00:00:00');
INSERT INTO GR19_persona VALUES ('dni', 34587447, 'Pedro', 'bravo', '', '', '', 'M', '', 'q', '1998-04-11 00:00:00');
INSERT INTO GR19_persona VALUES ('dni', 43587447, 'Simon', 'bravo', '', '', '', 'M', '', 'q', '1999-03-01 00:00:00');
--
-- Data for Name: GR19_deportista; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_deportista VALUES ('dni', 20, B'1', '2017-06-22 00:00:00', '222', 'Seniorf', 'FUT', 'PSTA', 'FUT');
INSERT INTO GR19_deportista VALUES ('dni', 29587447, B'1', '2017-06-02 00:00:00', '111111', 'Seniorf', 'FUT', 'PSTA', 'FUT');
INSERT INTO GR19_deportista VALUES ('dni', 3029291, B'0', NULL, NULL, 'juvenilf', 'FUT', 'SASTA', 'FUT');
INSERT INTO GR19_deportista VALUES ('dni', 43587447, B'0', NULL, NULL, 'juvenilf', 'FUT', 'SASTA', 'FUT');
INSERT INTO GR19_deportista VALUES ('dni', 34587447, B'0', NULL, NULL, 'juvenilf', 'FUT', 'SASTA', 'FUT');
--
-- Data for Name: GR19_clasificacioncompetencia; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
--
-- Data for Name: GR19_equipo; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_equipo VALUES (2, 'TenisMar', '2011-02-21 00:00:00');
INSERT INTO GR19_equipo VALUES (1, 'Futmagic', '2001-01-01 00:00:00');
INSERT INTO GR19_equipo VALUES (3, 'losfunda', '2001-01-01 00:00:00');
INSERT INTO GR19_equipo VALUES (4, 'heroes', '2001-01-01 00:00:00');
INSERT INTO GR19_equipo VALUES (5, 'distint', '2001-01-01 00:00:00');
--
-- Data for Name: GR19_equipodeportista; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_equipodeportista VALUES (1, 'dni', 29587447);
INSERT INTO GR19_equipodeportista VALUES (1, 'dni', 20);
--
-- Data for Name: GR19_inscripcion; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_inscripcion VALUES (11, 'dni', 20, NULL, 12, '2017-06-09 00:00:00');
INSERT INTO GR19_inscripcion VALUES (12, 'dni', 29587447, NULL, 12, '2017-06-15 00:00:00');
INSERT INTO GR19_inscripcion VALUES (13, NULL, NULL, 1, 12, '2017-06-09 00:00:00');
--
-- Data for Name: GR19_juez; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_juez VALUES ('dni', 34587447, B'0', NULL);
INSERT INTO GR19_juez VALUES ('dni', 43587447, B'1', '234424');
--
-- Data for Name: GR19_juezcompetencia; Type: TABLE DATA; Schema: unc_246449; Owner: unc_246449
--
INSERT INTO GR19_juezcompetencia VALUES (1, 'dni', 43587447);
INSERT INTO GR19_juezcompetencia VALUES (1, 'dni', 34587447);
--
-- PostgreSQL database dump complete
--
| true |
28f8a81684b2d4d53093341a0fc107613fd50469 | SQL | ariansadri/SQL_Challenge | /queries_hw.sql | UTF-8 | 3,170 | 4.625 | 5 | [] | no_license | -- queries for hw
-- 1. List the following details of each employee: employee number, last name, first name, gender, and salary.
select e.emp_no as "Employee Number",
e.last_name as "Last Name",
e.first_name as "First Name",
e.gender as "Gender",
s.salary as "Salary"
from employees as e
inner join salaries as s
on e.emp_no = s.emp_no;
-- 2. list employees who were hired in 1987.
select * from employees;
select emp_no as "Employee Number",
first_name as "First Name",
last_name as "Last Name",
hire_date as "Hire Date"
from employees
where substring (hire_date,1,4) = '1987';
-- 3. List the manager of each department with the following information: department number, department name,
-- the manager's employee number, last name, first name, and start and end employment dates.
select * from dept_manager;
select * from employees;
select * from departments;
select d.dept_no as "Department Number",
d.dept_name as "Department Name",
e.emp_no as "Employee Number",
e.last_name as "Last Name",
e.first_name as "First Name",
m.from_date as "Start Date",
m.to_date as "Last Day"
from departments as d
inner join dept_manager as m
on d.dept_no= m.dept_no
inner join employees as e
on e.emp_no = m.emp_no
order by d.dept_no;
-- 4. List the department of each employee with the following information:
-- employee number, last name, first name, and department name.
select * from employees;
select * from departments;
select * from dept_emp;
select e.emp_no as "Employee Number",
e.last_name as "Last Name",
e.first_name as "First Name",
d.dept_name as "Department Name"
from departments as d
inner join dept_emp as de
on d.dept_no = de.dept_no
inner join employees as e
on e.emp_no = de.emp_no
order by e.emp_no;
-- 5. List all employees whose first name is "Duangkaew" and last names begin with "P."
select * from employees;
select *
from employees
where (first_name = 'Duangkaew') and substring(last_name,1,1) = 'P'
order by last_name;
-- 6. List all employees in the Sales department,
-- including their employee number, last name, first name, and department name.
select * from departments;
select * from employees;
select * from dept_emp;
select e.emp_no as "Employee Number",
e.last_name as "Last Name",
e.first_name as "First Name",
d.dept_name as "Department Name"
from dept_emp as de
inner join departments as d
on d.dept_no = de.dept_no
inner join employees as e
on e.emp_no = de.emp_no
where de.dept_no = 'd007'
order by e.emp_no;
-- 7. List all employees in the Sales and Development departments,
-- including their employee number, last name, first name, and department name.
select e.emp_no as "Employee Number",
e.last_name as "Last Name",
e.first_name as "First Name",
d.dept_name as "Department Name"
from dept_emp as de
inner join departments as d
on d.dept_no = de.dept_no
inner join employees as e
on e.emp_no = de.emp_no
where (de.dept_no = 'd007') or (de.dept_no = 'd005')
order by e.emp_no;
-- 8. In ascending order, list the frequency count of employee last names, i.e., how many employees share each last name.
select last_name as "Last Names", count(last_name) as "Count"
from employees
group by last_name
order by count(last_name) asc; | true |
467fc1c3f5611ec3c5ce45b82e899e5fa98e3606 | SQL | SevkiBekir/Gozcu | /gozcuApp/db/eLearningProject.sql | UTF-8 | 31,757 | 3.15625 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.6.6
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jan 27, 2017 at 02:24 AM
-- Server version: 5.7.17
-- PHP Version: 5.6.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `eLearningProject`
--
-- --------------------------------------------------------
--
-- Table structure for table `bills`
--
CREATE TABLE `bills` (
`id` int(11) NOT NULL,
`billNo` varchar(10) COLLATE utf8_turkish_ci DEFAULT NULL,
`courseId` int(11) DEFAULT NULL,
`userId` int(11) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `catagories`
--
CREATE TABLE `catagories` (
`id` int(11) NOT NULL,
`name` varchar(30) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `catagories`
--
INSERT INTO `catagories` (`id`, `name`) VALUES
(1, 'Bilgisayar Bilimi'),
(2, 'Matematik');
-- --------------------------------------------------------
--
-- Table structure for table `chapters`
--
CREATE TABLE `chapters` (
`id` int(11) NOT NULL,
`name` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`no` int(11) DEFAULT NULL,
`courseId` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `chapters`
--
INSERT INTO `chapters` (`id`, `name`, `no`, `courseId`) VALUES
(1, 'Giriş', 1, 1),
(2, 'C\'de Döngüler', 2, 1);
-- --------------------------------------------------------
--
-- Table structure for table `cities`
--
CREATE TABLE `cities` (
`id` int(11) NOT NULL,
`name` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE `comments` (
`id` int(11) NOT NULL,
`userId` int(11) DEFAULT NULL,
`permission` int(11) DEFAULT NULL,
`courseId` int(11) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`updatedDate` datetime DEFAULT NULL,
`isActive` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `courseDetails`
--
CREATE TABLE `courseDetails` (
`id` int(11) NOT NULL,
`courseId` int(11) DEFAULT NULL,
`summary` varchar(1000) COLLATE utf8_turkish_ci DEFAULT NULL,
`objectives` varchar(1000) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `courseDetails`
--
INSERT INTO `courseDetails` (`id`, `courseId`, `summary`, `objectives`) VALUES
(1, 1, 'C ye girişi dersidir.', '<li> c yi öğrenmek </li>'),
(2, 2, 'kalkülüs dersidir', 'kalkülüs öğrenmek'),
(3, 3, 'Kalkülüs 2 dersidir', 'Kalkülüs 2 öğrenmek');
-- --------------------------------------------------------
--
-- Table structure for table `courses`
--
CREATE TABLE `courses` (
`id` int(11) NOT NULL,
`name` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`instructorId` int(11) DEFAULT NULL,
`catagoryId` int(11) DEFAULT NULL,
`price` varchar(10) COLLATE utf8_turkish_ci DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`updatedDate` datetime DEFAULT NULL,
`isActive` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `courses`
--
INSERT INTO `courses` (`id`, `name`, `instructorId`, `catagoryId`, `price`, `createdDate`, `updatedDate`, `isActive`) VALUES
(1, 'C\'ye Giriş', 1, 1, '100', '2017-01-27 01:41:14', '2017-01-27 01:41:14', 1),
(2, 'Kalkulüs', 1, 2, '50', '2017-01-27 02:37:42', '2017-01-27 02:37:42', 1),
(3, 'Kalkulüs 2', 1, 2, '50', '2017-01-27 02:39:30', '2017-01-27 02:39:30', 1);
-- --------------------------------------------------------
--
-- Table structure for table `courseToUser`
--
CREATE TABLE `courseToUser` (
`id` int(11) NOT NULL,
`courseId` int(11) DEFAULT NULL,
`userId` int(11) DEFAULT NULL,
`date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `discussions`
--
CREATE TABLE `discussions` (
`id` int(11) NOT NULL,
`userId` int(11) DEFAULT NULL,
`courseId` int(11) DEFAULT NULL,
`title` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`createdDate` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `documents`
--
CREATE TABLE `documents` (
`id` int(11) NOT NULL,
`documentTypeId` int(11) DEFAULT NULL,
`courseId` int(11) DEFAULT NULL,
`lessonId` int(11) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`uploadedDate` datetime DEFAULT NULL,
`explanation` varchar(300) COLLATE utf8_turkish_ci DEFAULT NULL,
`name` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`isAsset` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `documentTypes`
--
CREATE TABLE `documentTypes` (
`id` int(11) NOT NULL,
`name` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `documentTypes`
--
INSERT INTO `documentTypes` (`id`, `name`) VALUES
(1, '.mp4');
-- --------------------------------------------------------
--
-- Table structure for table `educationLevels`
--
CREATE TABLE `educationLevels` (
`id` int(11) NOT NULL,
`name` varchar(30) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `educationLevels`
--
INSERT INTO `educationLevels` (`id`, `name`) VALUES
(1, 'Lisans'),
(2, 'Yüksek Lisans');
-- --------------------------------------------------------
--
-- Table structure for table `examProcess`
--
CREATE TABLE `examProcess` (
`id` int(11) NOT NULL,
`userId` int(11) DEFAULT NULL,
`chapterId` int(11) DEFAULT NULL,
`isSuccess` int(11) DEFAULT NULL,
`Grade` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `exams`
--
CREATE TABLE `exams` (
`id` int(11) NOT NULL,
`questionId` int(11) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`updatedDate` datetime DEFAULT NULL,
`InstructorId` int(11) DEFAULT NULL,
`chapterId` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `examTypes`
--
CREATE TABLE `examTypes` (
`id` int(11) NOT NULL,
`name` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `IPTables`
--
CREATE TABLE `IPTables` (
`id` int(11) NOT NULL,
`userId` int(11) DEFAULT NULL,
`IP` varchar(15) COLLATE utf8_turkish_ci DEFAULT NULL,
`where` varchar(100) COLLATE utf8_turkish_ci DEFAULT NULL,
`date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `lessonLegends`
--
CREATE TABLE `lessonLegends` (
`id` int(11) NOT NULL,
`name` varchar(30) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `lessonLegends`
--
INSERT INTO `lessonLegends` (`id`, `name`) VALUES
(1, 'Başlanılmadı'),
(2, 'Devam Ediyor'),
(3, 'Tamamlandı');
-- --------------------------------------------------------
--
-- Table structure for table `lessonProgress`
--
CREATE TABLE `lessonProgress` (
`id` int(11) NOT NULL,
`userId` int(11) DEFAULT NULL,
`lessonId` int(11) DEFAULT NULL,
`lessonLegendId` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `lessons`
--
CREATE TABLE `lessons` (
`id` int(11) NOT NULL,
`chapterId` int(11) DEFAULT NULL,
`name` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`duration` varchar(10) COLLATE utf8_turkish_ci DEFAULT NULL,
`typeId` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `lessons`
--
INSERT INTO `lessons` (`id`, `chapterId`, `name`, `duration`, `typeId`) VALUES
(1, 1, 'Programlama Dilleri Nedir', '30', 1),
(2, 1, 'Kurulum', '15', 1),
(4, 2, 'Merhaba Dünya', '10', 1);
-- --------------------------------------------------------
--
-- Table structure for table `links`
--
CREATE TABLE `links` (
`id` int(11) NOT NULL,
`lessonId` int(11) DEFAULT NULL,
`courseId` int(11) DEFAULT NULL,
`catagoryId` int(11) DEFAULT NULL,
`name` varchar(50) COLLATE utf8_turkish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `links`
--
INSERT INTO `links` (`id`, `lessonId`, `courseId`, `catagoryId`, `name`) VALUES
(1, 0, 1, 0, 'C-ye-Giris'),
(2, 0, 2, 0, 'Kalkulus'),
(3, 0, 3, 0, 'Kalkulus-2'),
(4, 0, NULL, 1, 'Bilgisayar-Bilimi'),
(5, 0, NULL, 2, 'Matematik'),
(40, 1, 1, NULL, 'Programlama-Dilleri-Nedir'),
(41, 2, 1, NULL, 'Kurulum'),
(42, 4, 1, NULL, 'Merhaba-Dunya');
-- --------------------------------------------------------
--
-- Table structure for table `occupations`
--
CREATE TABLE `occupations` (
`id` int(11) NOT NULL,
`name` varchar(30) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `occupations`
--
INSERT INTO `occupations` (`id`, `name`) VALUES
(1, 'Mühendis'),
(2, 'Öğretmen');
-- --------------------------------------------------------
--
-- Table structure for table `paymentProcess`
--
CREATE TABLE `paymentProcess` (
`id` int(11) NOT NULL,
`userId` int(11) DEFAULT NULL,
`courseId` int(11) DEFAULT NULL,
`situation` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` int(11) NOT NULL,
`userId` int(11) DEFAULT NULL,
`discussionId` int(11) DEFAULT NULL,
`createdDate` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`updatedDate` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`content` varchar(2000) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE `questions` (
`id` int(11) NOT NULL,
`question` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`correctAnswer` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`duration` int(11) DEFAULT NULL,
`examTypeId` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `ratings`
--
CREATE TABLE `ratings` (
`id` int(11) NOT NULL,
`courseId` int(11) DEFAULT NULL,
`stars` varchar(1) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `ratings`
--
INSERT INTO `ratings` (`id`, `courseId`, `stars`) VALUES
(1, 1, '5'),
(2, 2, '2'),
(3, 3, '3');
-- --------------------------------------------------------
--
-- Table structure for table `sems`
--
CREATE TABLE `sems` (
`id` int(11) NOT NULL,
`personalName` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`personalSurname` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`email` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`telephone` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`universityId` int(11) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`updatedDate` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tags`
--
CREATE TABLE `tags` (
`id` int(11) NOT NULL,
`lessonId` int(11) DEFAULT NULL,
`name` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `universities`
--
CREATE TABLE `universities` (
`id` int(11) NOT NULL,
`name` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`cityId` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
-- --------------------------------------------------------
--
-- Table structure for table `userDetails`
--
CREATE TABLE `userDetails` (
`userId` int(11) DEFAULT NULL,
`age` varchar(2) COLLATE utf8_turkish_ci DEFAULT NULL,
`phone` varchar(15) COLLATE utf8_turkish_ci DEFAULT NULL,
`typeId` int(11) DEFAULT NULL,
`occupationId` int(11) DEFAULT NULL,
`educationId` int(11) DEFAULT NULL,
`fbUserName` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`twUserName` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`about` varchar(1000) COLLATE utf8_turkish_ci DEFAULT NULL,
`profileImageURL` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`tcNo` varchar(11) COLLATE utf8_turkish_ci DEFAULT NULL,
`address` varchar(1000) COLLATE utf8_turkish_ci DEFAULT NULL,
`gender` varchar(1) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `userDetails`
--
INSERT INTO `userDetails` (`userId`, `age`, `phone`, `typeId`, `occupationId`, `educationId`, `fbUserName`, `twUserName`, `about`, `profileImageURL`, `tcNo`, `address`, `gender`) VALUES
(1, '24', NULL, 3, 1, 2, NULL, NULL, NULL, NULL, NULL, NULL, 'E');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`firstname` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`lastname` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL,
`username` varchar(50) COLLATE utf8_turkish_ci NOT NULL,
`email` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL,
`password` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`updatedDate` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `firstname`, `lastname`, `username`, `email`, `password`, `createdDate`, `updatedDate`) VALUES
(1, 'Sevki', 'Kocadag', 'bekirsevki', 'bekirsevki@gmail.com', 'c4ca4238a0b923820dcc509a6f75849b', '2017-01-26 15:09:02', '2017-01-26 15:09:02'),
(2, 'a', 'b', 'a', 'a@a.com', 'c4ca4238a0b923820dcc509a6f75849b', '2017-01-26 15:39:57', '2017-01-26 15:39:57'),
(3, 'b', 'b', 'b', 'b@b.com', 'c4ca4238a0b923820dcc509a6f75849b', '2017-01-26 15:58:13', '2017-01-26 15:58:13');
-- --------------------------------------------------------
--
-- Table structure for table `userTypes`
--
CREATE TABLE `userTypes` (
`id` int(11) NOT NULL,
`name` varchar(20) COLLATE utf8_turkish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Dumping data for table `userTypes`
--
INSERT INTO `userTypes` (`id`, `name`) VALUES
(1, 'Kullanıcı'),
(2, 'Eğitmen'),
(3, 'Yönetici');
-- --------------------------------------------------------
--
-- Table structure for table `views`
--
CREATE TABLE `views` (
`id` int(11) NOT NULL,
`viewerId` int(11) DEFAULT NULL,
`documentId` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `bills`
--
ALTER TABLE `bills`
ADD PRIMARY KEY (`id`),
ADD KEY `fUserId_idx` (`userId`),
ADD KEY `fCourseId_idx` (`courseId`);
--
-- Indexes for table `catagories`
--
ALTER TABLE `catagories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `chapters`
--
ALTER TABLE `chapters`
ADD PRIMARY KEY (`id`),
ADD KEY `fCourseId_idx` (`courseId`);
--
-- Indexes for table `cities`
--
ALTER TABLE `cities`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`),
ADD KEY `fUserId_idx` (`userId`),
ADD KEY `fCourseId_idx` (`courseId`);
--
-- Indexes for table `courseDetails`
--
ALTER TABLE `courseDetails`
ADD PRIMARY KEY (`id`),
ADD KEY `fCourseId_idx` (`courseId`);
--
-- Indexes for table `courses`
--
ALTER TABLE `courses`
ADD PRIMARY KEY (`id`),
ADD KEY `fCatagoryId_idx` (`catagoryId`),
ADD KEY `fInstructorId_idx` (`instructorId`);
--
-- Indexes for table `courseToUser`
--
ALTER TABLE `courseToUser`
ADD PRIMARY KEY (`id`),
ADD KEY `fUserId_idx` (`userId`),
ADD KEY `fCourseId_idx` (`courseId`);
--
-- Indexes for table `discussions`
--
ALTER TABLE `discussions`
ADD PRIMARY KEY (`id`),
ADD KEY `fUserId_idx` (`userId`),
ADD KEY `fCourseId_idx` (`courseId`);
--
-- Indexes for table `documents`
--
ALTER TABLE `documents`
ADD PRIMARY KEY (`id`),
ADD KEY `fLessonId_idx` (`lessonId`),
ADD KEY `fDocumentTypeId_idx` (`documentTypeId`),
ADD KEY `fCourseId_doc_idx` (`courseId`);
--
-- Indexes for table `documentTypes`
--
ALTER TABLE `documentTypes`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `educationLevels`
--
ALTER TABLE `educationLevels`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `examProcess`
--
ALTER TABLE `examProcess`
ADD PRIMARY KEY (`id`),
ADD KEY `ChapterId_idx` (`chapterId`),
ADD KEY `fUserId_idx` (`userId`);
--
-- Indexes for table `exams`
--
ALTER TABLE `exams`
ADD PRIMARY KEY (`id`),
ADD KEY `fInstructorId_idx` (`questionId`),
ADD KEY `fChapterId_idx` (`chapterId`);
--
-- Indexes for table `examTypes`
--
ALTER TABLE `examTypes`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `IPTables`
--
ALTER TABLE `IPTables`
ADD PRIMARY KEY (`id`),
ADD KEY `fUserId_idx` (`userId`);
--
-- Indexes for table `lessonLegends`
--
ALTER TABLE `lessonLegends`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `lessonProgress`
--
ALTER TABLE `lessonProgress`
ADD PRIMARY KEY (`id`),
ADD KEY `fLessenLegendId_idx` (`lessonLegendId`),
ADD KEY `fLessonId_idx` (`lessonId`),
ADD KEY `fUserId_idx` (`userId`);
--
-- Indexes for table `lessons`
--
ALTER TABLE `lessons`
ADD PRIMARY KEY (`id`),
ADD KEY `fChapterId_idx` (`chapterId`),
ADD KEY `fLessonTypeId_idx` (`typeId`);
--
-- Indexes for table `links`
--
ALTER TABLE `links`
ADD PRIMARY KEY (`id`),
ADD KEY `fL_Course` (`courseId`);
--
-- Indexes for table `occupations`
--
ALTER TABLE `occupations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `paymentProcess`
--
ALTER TABLE `paymentProcess`
ADD PRIMARY KEY (`id`),
ADD KEY `fCourseId_idx` (`courseId`),
ADD KEY `fUserId_idx` (`userId`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`),
ADD KEY `fUserId_idx` (`userId`),
ADD KEY `fDisscussionId_idx` (`discussionId`);
--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
ADD PRIMARY KEY (`id`),
ADD KEY `fExamTypeId_idx` (`examTypeId`);
--
-- Indexes for table `ratings`
--
ALTER TABLE `ratings`
ADD PRIMARY KEY (`id`),
ADD KEY `fCourseId_idx` (`courseId`);
--
-- Indexes for table `sems`
--
ALTER TABLE `sems`
ADD PRIMARY KEY (`id`),
ADD KEY `fUniversity_idx` (`universityId`);
--
-- Indexes for table `tags`
--
ALTER TABLE `tags`
ADD PRIMARY KEY (`id`),
ADD KEY `fLessonId_t_idx` (`lessonId`);
--
-- Indexes for table `universities`
--
ALTER TABLE `universities`
ADD PRIMARY KEY (`id`),
ADD KEY `fCity_idx` (`cityId`);
--
-- Indexes for table `userDetails`
--
ALTER TABLE `userDetails`
ADD KEY `fOccupation_idx` (`occupationId`),
ADD KEY `fEducationLevelId_idx` (`educationId`),
ADD KEY `fUserId_idx` (`userId`),
ADD KEY `fUserTypeId_idx` (`typeId`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `userTypes`
--
ALTER TABLE `userTypes`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `views`
--
ALTER TABLE `views`
ADD PRIMARY KEY (`id`),
ADD KEY `fViewerId_idx` (`viewerId`),
ADD KEY `fDocumentId_idx` (`documentId`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `bills`
--
ALTER TABLE `bills`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `catagories`
--
ALTER TABLE `catagories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `chapters`
--
ALTER TABLE `chapters`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `cities`
--
ALTER TABLE `cities`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `courseDetails`
--
ALTER TABLE `courseDetails`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `courses`
--
ALTER TABLE `courses`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `courseToUser`
--
ALTER TABLE `courseToUser`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `discussions`
--
ALTER TABLE `discussions`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `documentTypes`
--
ALTER TABLE `documentTypes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `educationLevels`
--
ALTER TABLE `educationLevels`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `examProcess`
--
ALTER TABLE `examProcess`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `exams`
--
ALTER TABLE `exams`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `examTypes`
--
ALTER TABLE `examTypes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `IPTables`
--
ALTER TABLE `IPTables`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `lessonLegends`
--
ALTER TABLE `lessonLegends`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `lessonProgress`
--
ALTER TABLE `lessonProgress`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `lessons`
--
ALTER TABLE `lessons`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `links`
--
ALTER TABLE `links`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=43;
--
-- AUTO_INCREMENT for table `occupations`
--
ALTER TABLE `occupations`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `paymentProcess`
--
ALTER TABLE `paymentProcess`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `ratings`
--
ALTER TABLE `ratings`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `sems`
--
ALTER TABLE `sems`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tags`
--
ALTER TABLE `tags`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `universities`
--
ALTER TABLE `universities`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `userTypes`
--
ALTER TABLE `userTypes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `views`
--
ALTER TABLE `views`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `bills`
--
ALTER TABLE `bills`
ADD CONSTRAINT `fCourseId_bill` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_bill` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `chapters`
--
ALTER TABLE `chapters`
ADD CONSTRAINT `fCourseId_chapters` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `comments`
--
ALTER TABLE `comments`
ADD CONSTRAINT `fCourseId_comments` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_comments` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `courseDetails`
--
ALTER TABLE `courseDetails`
ADD CONSTRAINT `fCourseId_courseDetails` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `courses`
--
ALTER TABLE `courses`
ADD CONSTRAINT `fCatagoryId_courses` FOREIGN KEY (`catagoryId`) REFERENCES `catagories` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fInstructorId_courses` FOREIGN KEY (`instructorId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `courseToUser`
--
ALTER TABLE `courseToUser`
ADD CONSTRAINT `fCourseId_c2u` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_c2u` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `discussions`
--
ALTER TABLE `discussions`
ADD CONSTRAINT `fCourseId_discussions` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_discussions` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `documents`
--
ALTER TABLE `documents`
ADD CONSTRAINT `fCourseId_doc` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fDocumentTypeId_doc` FOREIGN KEY (`documentTypeId`) REFERENCES `documentTypes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fLessonId_doc` FOREIGN KEY (`lessonId`) REFERENCES `lessons` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `examProcess`
--
ALTER TABLE `examProcess`
ADD CONSTRAINT `ChapterId_examProcess` FOREIGN KEY (`chapterId`) REFERENCES `chapters` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_examProcess` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `exams`
--
ALTER TABLE `exams`
ADD CONSTRAINT `fChapterId_exams` FOREIGN KEY (`chapterId`) REFERENCES `chapters` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fInstructorId_exams` FOREIGN KEY (`questionId`) REFERENCES `questions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `IPTables`
--
ALTER TABLE `IPTables`
ADD CONSTRAINT `fUserId_IP` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `lessonProgress`
--
ALTER TABLE `lessonProgress`
ADD CONSTRAINT `fLessenLegendId_lessonProgress` FOREIGN KEY (`lessonLegendId`) REFERENCES `lessonLegends` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fLessonId_lessonProgress` FOREIGN KEY (`lessonId`) REFERENCES `lessons` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_lessonProgress` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `lessons`
--
ALTER TABLE `lessons`
ADD CONSTRAINT `fChapterId_lessons` FOREIGN KEY (`chapterId`) REFERENCES `chapters` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fLessonTypeId_lessons` FOREIGN KEY (`typeId`) REFERENCES `documentTypes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `paymentProcess`
--
ALTER TABLE `paymentProcess`
ADD CONSTRAINT `fCourseId_paymentProcess` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_paymentProcess` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `posts`
--
ALTER TABLE `posts`
ADD CONSTRAINT `fDisscussionId_posts` FOREIGN KEY (`discussionId`) REFERENCES `discussions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_posts` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `questions`
--
ALTER TABLE `questions`
ADD CONSTRAINT `fExamTypeId_questions` FOREIGN KEY (`examTypeId`) REFERENCES `examTypes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `ratings`
--
ALTER TABLE `ratings`
ADD CONSTRAINT `fCourseId_ratings` FOREIGN KEY (`courseId`) REFERENCES `courses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `sems`
--
ALTER TABLE `sems`
ADD CONSTRAINT `fUniversity_sems` FOREIGN KEY (`universityId`) REFERENCES `universities` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `tags`
--
ALTER TABLE `tags`
ADD CONSTRAINT `fLessonId_t` FOREIGN KEY (`lessonId`) REFERENCES `lessons` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `universities`
--
ALTER TABLE `universities`
ADD CONSTRAINT `fCity_universities` FOREIGN KEY (`cityId`) REFERENCES `cities` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `userDetails`
--
ALTER TABLE `userDetails`
ADD CONSTRAINT `fEducationLevelId_uD` FOREIGN KEY (`educationId`) REFERENCES `educationLevels` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fOccupationId_uD` FOREIGN KEY (`occupationId`) REFERENCES `occupations` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserId_uD` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fUserTypeId_uD` FOREIGN KEY (`typeId`) REFERENCES `userTypes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `views`
--
ALTER TABLE `views`
ADD CONSTRAINT `fDocumentId_v` FOREIGN KEY (`documentId`) REFERENCES `documents` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fViewerId_v` FOREIGN KEY (`viewerId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
/*!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 |
c2292317f5fd8df21656f156b61ebfb5a9c0c47e | SQL | CodeLoverss/spoilYou | /sql/adopt.sql | UTF-8 | 1,386 | 3.046875 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50562
Source Host : 127.0.0.1:3306
Source Database : pet
Target Server Type : MYSQL
Target Server Version : 50562
File Encoding : 65001
Date: 2020-07-23 08:30:49
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for adopt
-- ----------------------------
DROP TABLE IF EXISTS `adopt`;
CREATE TABLE `adopt` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`pet_id` int(11) DEFAULT NULL,
`petname` varchar(255) DEFAULT NULL,
`state` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of adopt
-- ----------------------------
INSERT INTO `adopt` VALUES ('1', '1', '123', '6', '狸花猫', '����');
INSERT INTO `adopt` VALUES ('2', '1', '123', '5', '暹罗猫', '申请');
INSERT INTO `adopt` VALUES ('3', '1', '123', '8', '金吉拉猫', '申请');
INSERT INTO `adopt` VALUES ('4', '1', '123', '12', '金毛寻回犬', '申请');
INSERT INTO `adopt` VALUES ('5', '1', '123', '15', '蝴蝶犬', '领养');
INSERT INTO `adopt` VALUES ('6', '1', '123', '19', '贵宾犬', '拒绝');
INSERT INTO `adopt` VALUES ('7', '1', '123', '21', '越南大肚猪', '申请');
| true |
d647d4cdd7dffb689400c9167b24e579c1d340d7 | SQL | microsoft/Nonprofit_Data_Warehouse_Quickstart | /NonprofitDataWarehouseQuickstart/Warehouse/Warehouse/External/Tables/External Tables/External.IATITransaction.sql | UTF-8 | 1,685 | 2.609375 | 3 | [
"MIT"
] | permissive | -- Copyright (c) Microsoft Corporation.
-- Licensed under the MIT License.
CREATE EXTERNAL TABLE [External].[IATITransaction]
(
[iati-identifier] NVARCHAR(200) NOT NULL,
[default-currency] NVARCHAR(200) NULL,
[transaction_aid-type] NVARCHAR(200) NULL,
[transaction_disbursement-channel] NVARCHAR(200) NULL,
[transaction_description_narrative] NVARCHAR(4000) NULL,
[transaction_flow-type] NVARCHAR(200) NULL,
[transaction_provider-org_provider-activity-id] NVARCHAR(200) NULL,
[transaction_provider-org_ref] NVARCHAR(200) NULL,
[transaction-provider-org-type] NVARCHAR(200) NULL,
[transaction_provider-org] NVARCHAR(200) NULL,
[transaction_receiver-org_receiver-activity-id] NVARCHAR(200) NULL,
[transaction_receiver-org_ref] NVARCHAR(200) NULL,
[transaction_receiver-org-type] NVARCHAR(200) NULL,
[transaction_receiver-org] NVARCHAR(200) NULL,
[transaction-recipient-country] NVARCHAR(200) NULL,
[transaction_recipient-region] NVARCHAR(200) NULL,
[transaction-sector] NVARCHAR(200) NULL,
[transaction-sector-category] NVARCHAR(200) NULL,
[transaction_tied-status] NVARCHAR(200) NULL,
[transaction_transaction-date_iso-date] NVARCHAR(200) NULL,
[transaction-type] NVARCHAR(200) NULL,
[transaction_value_currency] NVARCHAR(200) NULL,
[transaction_value-date] NVARCHAR(200) NULL,
[transaction_value] NVARCHAR(200) NULL
)
WITH
(
LOCATION = '/RAW/IATI/Transaction/',
DATA_SOURCE = ExternalDataSourceADLS,
FILE_FORMAT = ExternalFileFormatParquet,
REJECT_TYPE = VALUE,
REJECT_VALUE = 0
); | true |
2860d13dff2fdff4cf1ccff0f48af883ee8949c3 | SQL | stoversa/node_storefront | /schema.sql | UTF-8 | 754 | 3.578125 | 4 | [
"MIT"
] | permissive | DROP DATABASE IF EXISTS bamazon;
CREATE DATABASE bamazon;
USE bamazon;
CREATE TABLE products (
item_id INT AUTO_INCREMENT NOT NULL, -- item_id unique id for each product
product_name VARCHAR(100) NOT NULL, -- product_name Name of product
department_name VARCHAR(100) NOT NULL, -- department_name
price DECIMAL(14,2) NOT NULL, -- price cost to customer
stock_quantity INT default 0, -- how much of the product is available in stores
product_sales INT default 0, -- records how many purchases have been made
PRIMARY KEY (item_id)
);
CREATE TABLE departments (
department_id INT AUTO_INCREMENT NOT NULL,
department_name VARCHAR(100),
over_head_costs DECIMAL(14,2), -- A dummy number you set for each department
PRIMARY KEY (department_id)
); | true |
07067b4fc4c680e7c60522b5fd09d3dfe3e51cbd | SQL | awayjin/JavaScript | /sql/base-tech/01.db-sql/Product.sql | UTF-8 | 3,557 | 4.03125 | 4 | [] | no_license |
drop table Product;
CREATE TABLE Product
(product_id CHAR(4) NOT NULL,
product_name VARCHAR(100) NOT NULL,
product_type VARCHAR(32) NOT NULL,
sale_price INTEGER ,
purchase_price INTEGER ,
regist_date DATE ,
PRIMARY KEY (product_id));
START TRANSACTION;
INSERT INTO Product VALUES ('0001', 'T恤衫', '衣服',
1000, 500, '2009-09-20');
INSERT INTO Product VALUES ('0002', '打孔器', '办公用品',
500, 320, '2009-09-11');
INSERT INTO Product VALUES ('0003', '运动T恤', '衣服',
4000, 2800, NULL);
INSERT INTO Product VALUES ('0004', '菜刀', '厨房用具',
3000, 2800, '2009-09-20');
INSERT INTO Product VALUES ('0005', '高压锅', '厨房用具',
6800, 5000, '2009-01-15');
INSERT INTO Product VALUES ('0006', '叉子', '厨房用具',
500, NULL, '2009-09-20');
INSERT INTO Product VALUES ('0007', '擦菜板', '厨房用具',
880, 790, '2008-04-28');
INSERT INTO Product VALUES ('0008', '圆珠笔', '办公用品',
100, NULL,'2009-11-11');
COMMIT;
-- CREATE DATABASE myshop;
USE myshop;
drop table Product;
CREATE TABLE Product (
product_id CHAR ( 4 ) NOT NULL,
product_name VARCHAR ( 100 ) NOT NULL,
product_type VARCHAR ( 32 ) NOT NULL,
sale_price INTEGER,
purchase_price INTEGER,
regist_date Date,
PRIMARY KEY ( product_id )
);
ALTER TABLE Product ADD COLUMN ( demo_alter VARCHAR ( 20 ) NOT NULL );
ALTER TABLE Product ADD COLUMN ( product_name_pinyin VARCHAR ( 100 ) );
ALTER TABLE Product DROP COLUMN demo;
ALTER TABLE Product DROP COLUMN product_name_pinyin
-- START TRANSACTION;
START TRANSACTION;
INSERT INTO Product
VALUES
( '0002', 'T恤衫', '衣服', 2000, 600, '2008-10-05' ) ;
COMMIT;
INSERT INTO Product
VALUES
( '0004', '菜刀', '厨房用具', 2000, 500, '2009-09-20' );
ALTER TABLE Product DROP COLUMN demo_alter;
rename table product to pro_demo;
rename table pro_demo to Product;
SELECT * from Product where product_type='厨房用具';
SELECT * FROM Product;
SELECT purchase_price, product_id, product_name, purchase_price FROM Product;
INSERT INTO Product VALUES('0005', '筷子', '厨房用具', 20, 4, '2019-10-06');
-- 为列设定别名
-- SELECT product_id AS id, sale_price AS "价格" FROM Product;
SELECT product_id AS id, sale_price AS '价格' FROM Product;
-- 书写常数
SELECT
'商品' AS string, 38 as number, '2019-10-03' as date, product_id, product_name
FROM Product;
-- 从结果中删除重复行
SELECT distinct product_type FROM Product;
SELECT distinct purchase_price FROM Product;
-- 执行结果所示, product_type 列为 '厨房用具',同时
-- regist_date 列为 '2009-09-20'的两条数据被合并成了一条
SELECT distinct product_type, regist_date FROM Product;
SELECT distinct product_type, regist_date, product_id FROM Product;
-- where 子句
SELECT * FROM Product WHERE product_type = '衣服';
SELECT product_type, product_name, product_id
FROM Product
WHERE product_type = '衣服';
/* 从结果删除重复行 */
SELECT distinct product_type from Product;
-- 2.2 算术运算符和比较运算符
SELECT *, sale_price * 2 as 'sale_price_*2' FROM Product;
SELECT sale_price * 3 FROM Product;
SELECT *, (sale_price * 2 + 2 - 1 ) / 2 as 'sale_price_*2' FROM Product;
SELECT *, sale_price * NULL as 'sale_price_*2' FROM Product;
SELECT (200+100) * 3 AS calculation;
-- 不等于
select *, sale_price - 1000 FROM Product where sale_price <> 500;
SELECT * FROM Product;
SELECT * FROM Product
WHERE product_type = '办公用品'
AND (regist_date = '2009-09-11'
OR regist_date = '2009-09-20');
| true |
140d8001112b0b0652bc1955a33d1eb4d06a37cb | SQL | Shachi1/Plagiarism_check_with_distributed_database | /Server/delete.sql | UTF-8 | 504 | 3.296875 | 3 | [] | no_license | SET SERVEROUTPUT ON;
SET VERIFY OFF;
DECLARE
source_code SourceCode.code%TYPE;
del_id integer := &delete_id;
BEGIN
DELETE FROM SourceCode WHERE id = del_id;
DELETE FROM CodeInfo1@site1 WHERE id = del_id;
DELETE FROM CodeInfo2@site1 WHERE id = del_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No such row.');
END;
/
commit;
select * from SourceCode natural join (select * from CodeInfo1@site1 union select * from CodeInfo2@site1); | true |
6c0f839a76be4bc1aed6a426c6797f3678c2fe10 | SQL | michaelprince3/Tracking-Student-Exercises | /studentexercises.sql | UTF-8 | 2,251 | 4.15625 | 4 | [] | no_license | --Use the INSERT INTO SQL statement to create...
--3 cohorts
--5 exercises
--3 instructors
--7 students (don't put all students in the same cohort)
--Assign 2 exercises to each student
--example
-- INSERT INTO Affiliation VALUES (null, 'Justice League');
-- INSERT INTO Affiliation VALUES (null, 'X-Men');
-- INSERT INTO Superhero
-- SELECT null, 'Super Dude', 'M', 'Bubba Farlo', Affiliation_Id
-- FROM Affiliation
-- WHERE Name = 'Justice League';
-- SELECT * FROM Affiliation;
INSERT INTO Cohort (name)
VALUES ('36');
INSERT INTO Cohort (name)
VALUES ('34');
INSERT INTO Cohort (name)
VALUES ('35');
INSERT INTO Exercises (name, language)
VALUES ('Intro to React', 'React');
INSERT INTO Exercises (name, language)
VALUES ('Intro to Python', 'Python');
INSERT INTO Exercises (name, language)
VALUES ('Intro to C#', 'C#');
INSERT INTO Exercises (name, language)
VALUES ('Intro to JavaScript', 'JavaScript');
INSERT INTO Exercises (name, language)
VALUES ('How to Survive a Bootcamp', 'English');
INSERT INTO Instructor (first_name, last_name, slack_handle, cohort_id)
VALUES ('James', 'Smith', '@James', 1);
INSERT INTO Instructor (first_name, last_name, slack_handle, cohort_id)
VALUES ('John', 'Long', '@john', 2),
('Joseph', 'Brown', '@joseph', 3);
INSERT INTO Instructor (first_name, last_name, slack_handle, cohort_id)
VALUES ('Georgia', 'Lane', '@georgia', 3),
('Lelia', 'Grant', '@lelia', 3);
INSERT INTO Student (first_name, last_name, slack_handle, cohort_id)
VALUES ('Jane', 'Brownlee', '@jane', 2),
('Annie', 'Lee', '@anne', 1),
('Sam', 'Grant', '@sam', 3),
('James', 'Sacrey', '@james', 1),
('Mary', 'Rose', '@mary', 3),
('Jorge', 'Villalobos', '@jorge', 2),
('Russell', 'Kincade', '@russell', 2);
INSERT INTO Student_Exercises (student_id, exercises_id)
VALUES (1, 1),
(1, 2),
(2, 3),
(2, 4),
(3, 5),
(3, 1),
(4, 1),
(4, 2),
(5, 3),
(5, 4),
(6, 5),
(6, 1),
(7, 2),
(7, 3);
UPDATE Exercises
SET name = 'Intro to Python'
WHERE exercises_id = 2;
UPDATE Exercises
SET language = 'Python'
WHERE exercises_id = 2;
SELECT
e.exercises_id,
e.name,
s.student_id,
s.first_name,
s.last_name
FROM Exercises e
JOIN Student_Exercises se ON se.exercises_id = e.exercises_id
JOIN Student s ON s.student_id = se.student_id; | true |
fd0aa17dca75af67eb3d5bd560a68e20a8e8eb4e | SQL | 305810827/InformationPlatform_WeChat | /demo.sql | UTF-8 | 12,841 | 2.609375 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : mysql
Source Server Version : 50725
Source Host : localhost:3306
Source Database : demo
Target Server Type : MYSQL
Target Server Version : 50725
File Encoding : 65001
Date: 2019-05-17 16:33:08
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for tb_admin
-- ----------------------------
DROP TABLE IF EXISTS `tb_admin`;
CREATE TABLE `tb_admin` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`role` varchar(255) DEFAULT NULL,
`imageUrl` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_admin
-- ----------------------------
INSERT INTO `tb_admin` VALUES ('2', 'superAdmin', '12345', 'laughing', 'superAdmin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('3', 'admin1', '12345', 'en', 'admin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('4', '123', '12345', '11', 'admin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('5', '1234', '12345', '321', 'admin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('6', '12345', '12345', '222', 'admin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('7', '321', '12345', '333', 'admin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('8', '4321', '12345', '2222', 'admin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('9', '54321', '12345', '666', 'admin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('10', '11111', '12345', '777', 'admin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
INSERT INTO `tb_admin` VALUES ('11', 'super', 'super', '111', 'superAdmin', 'http://localhost:8080/image/article/b7cc3066603d4490896dcbb0ea03ed16.jpg');
-- ----------------------------
-- Table structure for tb_article
-- ----------------------------
DROP TABLE IF EXISTS `tb_article`;
CREATE TABLE `tb_article` (
`article_id` int(4) NOT NULL AUTO_INCREMENT,
`article_title` varchar(255) NOT NULL,
`article_desc` varchar(255) NOT NULL,
`create_time` datetime DEFAULT NULL,
`image_url` varchar(255) DEFAULT NULL,
`article_content` longtext NOT NULL,
`article_classify` varchar(255) NOT NULL,
`collect_count` int(20) DEFAULT NULL,
PRIMARY KEY (`article_id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_article
-- ----------------------------
INSERT INTO `tb_article` VALUES ('23', '123213', '123', '2019-05-11 10:59:40', 'http://localhost:8080/image/article/8388ad85c6aa4114ae4e91be98dc5dd3.jpg', '<p>2132131123</p>', '#科技', '0');
INSERT INTO `tb_article` VALUES ('24', '213', '123', '2019-05-11 11:01:14', 'http://localhost:8080/image/article/99253f0e6448460fbc226b1c6528bfed.jpg', '<p>1232131</p>', '#科技', '0');
INSERT INTO `tb_article` VALUES ('25', '123', '12321', '2019-05-11 11:01:35', 'http://localhost:8080/image/article/4b802fc2507346f5a693b2fad7721bb7.jpg', '<p>123213</p>', '#游戏', '0');
INSERT INTO `tb_article` VALUES ('26', '如果你累了,就去旅行吧', '风景可以治愈人的心灵', '2019-05-11 11:02:50', 'http://localhost:8080/image/article/2ac0494fda7f4efb9cef78824a874b01.png', '<p><span style=\"color: rgb(25, 25, 25);\">风景可以治愈人的心灵,当生活总被各种琐事填满,内心总是闷闷不乐的时候你是不是该出去走走了。</span></p><p><br></p><p><span style=\"color: rgb(25, 25, 25);\">一次真正的旅行,不是去到某一个景点留下到此一游的纪念照。而是融入那里,用心体会自己生活圈子之外的精彩。</span></p><p><br></p><p><span style=\"color: rgb(25, 25, 25);\">把自己放空,来到崭新的地方,也许走着走着便释怀了,许多烦恼和压力也都烟消云散。</span></p><p><br></p><p><span style=\"color: rgb(25, 25, 25);\">一次纯粹的旅行,是在新的地方新的环境下,重拾希望,获得一个崭新的自己。</span></p>', '#旅行', '0');
INSERT INTO `tb_article` VALUES ('27', '滴滴将在全国增加2000名司机服务顾问', '滴滴出行联合创始人、CTO张博做客《北大汇丰创讲堂》', '2019-05-11 11:04:26', 'http://localhost:8080/image/article/af324390bc8346ed8653c7177a5409ce.png', '<p><span style=\"color: rgb(51, 51, 51);\">张博在分享中回忆了加入滴滴的“那些事”。2012年,有两个重要的决策改变了自己的人生轨迹。一个是决定从百度离开,开始创业;第二个是加入滴滴。</span></p><p><br></p><p><span style=\"color: rgb(51, 51, 51);\">2012年,张博坚信,智能手机和移动互联网网络的重大发展,一定会带来上层应用的繁荣,这也让他下定决心离开百度转而寻求合伙人一起创业。</span></p><p><br></p><p><span style=\"color: rgb(51, 51, 51);\">创业的第一个项目失败后,张博一个人背着书包到威海闭关了一周。期间张博一直在思考两个问题:接下来的路该怎么走?如果要创业该做什么?</span></p><p><span style=\"color: rgb(51, 51, 51);\">大众、高频、刚需和有用户口碑传播的场景,是张博当时最看重的四个关键要素。张博认为,目标用户群是大众的需求还是小众的需求,决定了创业天花板的高低;用户需求是否高频决定了用户的留存;而刚需的定义是企业的产品或者服务创造的价值是可衡量、可持续、可防御;当企业的产品或者服务真正触及用户痛点的时候,用户口碑传播能起到的效果会比任何广告都管用。</span></p>', '#社会', '1');
INSERT INTO `tb_article` VALUES ('28', '耗资千万却不求盈利 《隐形守护者》这么做真值得吗?', '一款真人实拍的剧情交互游戏《隐形守护者》走进了玩家们的视野', '2019-05-11 11:05:31', 'http://localhost:8080/image/article/33b60bad99364b95b86a42b22aa1087c.png', '<p><span style=\"color: rgb(67, 74, 84);\">最近,一款真人实拍的剧情交互游戏《隐形守护者》走进了玩家们的视野,它讲述的是发生在民国时期的一场惊心动魄的谍战故事。由于这款游戏剧情紧密,演员表演出色,因此深受玩家好评,迄今Steam的好评率一直稳居在90%以上,在影视爱好者聚集的豆瓣也获得了9.3分。</span></p>', '#游戏', '1');
-- ----------------------------
-- Table structure for tb_classify
-- ----------------------------
DROP TABLE IF EXISTS `tb_classify`;
CREATE TABLE `tb_classify` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`classify_name` varchar(255) DEFAULT NULL,
`image` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_classify
-- ----------------------------
INSERT INTO `tb_classify` VALUES ('3', '#社会', 'http://localhost:8080/image/classify/c4b57093e7ac40c7a214b2e24926892d.jpg');
INSERT INTO `tb_classify` VALUES ('9', '#科技', 'http://localhost:8080/image/classify/ad6286a585b746ff869042bcfae25884.jpg');
INSERT INTO `tb_classify` VALUES ('13', '#游戏', 'http://localhost:8080/image/classify//86ad5dc587154675bbaaec660d26c508.jpg');
INSERT INTO `tb_classify` VALUES ('14', '#旅行', 'http://localhost:8080/image/classify//446e1fa939e54807a3aceff2c3c308b4.jpg');
-- ----------------------------
-- Table structure for tb_comment
-- ----------------------------
DROP TABLE IF EXISTS `tb_comment`;
CREATE TABLE `tb_comment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`wx_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
`article_id` int(11) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
`points_count` int(20) DEFAULT NULL,
`date` datetime DEFAULT NULL,
`wx_head` varchar(255) DEFAULT NULL,
`open_id` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_comment
-- ----------------------------
INSERT INTO `tb_comment` VALUES ('30', '许演杰?', '28', '阿瑟东', '0', '2019-05-11 11:27:30', 'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJicJOgXTJ2xjPv4jfa67AXrFh7ysOrhSBHY9eibAktH9Vib2Oqth6cEnqc5KQlQ6cOaHO3uYceZQwHQ/132', 'oDSvi5NBQeeHzqcdSR4KYJiy7lQk');
INSERT INTO `tb_comment` VALUES ('31', '许演杰?', '28', '***', '1', '2019-05-11 11:27:37', 'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJicJOgXTJ2xjPv4jfa67AXrFh7ysOrhSBHY9eibAktH9Vib2Oqth6cEnqc5KQlQ6cOaHO3uYceZQwHQ/132', 'oDSvi5NBQeeHzqcdSR4KYJiy7lQk');
INSERT INTO `tb_comment` VALUES ('32', '许演杰?', '27', '213', '0', '2019-05-11 11:54:48', 'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJicJOgXTJ2xjPv4jfa67AXrFh7ysOrhSBHY9eibAktH9Vib2Oqth6cEnqc5KQlQ6cOaHO3uYceZQwHQ/132', 'oDSvi5NBQeeHzqcdSR4KYJiy7lQk');
INSERT INTO `tb_comment` VALUES ('33', '许演杰?', '27', '***', '1', '2019-05-11 11:55:05', 'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJicJOgXTJ2xjPv4jfa67AXrFh7ysOrhSBHY9eibAktH9Vib2Oqth6cEnqc5KQlQ6cOaHO3uYceZQwHQ/132', 'oDSvi5NBQeeHzqcdSR4KYJiy7lQk');
INSERT INTO `tb_comment` VALUES ('34', '许演杰?', '24', '***', '0', '2019-05-11 11:57:36', 'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJicJOgXTJ2xjPv4jfa67AXrFh7ysOrhSBHY9eibAktH9Vib2Oqth6cEnqc5KQlQ6cOaHO3uYceZQwHQ/132', 'oDSvi5NBQeeHzqcdSR4KYJiy7lQk');
-- ----------------------------
-- Table structure for tb_history
-- ----------------------------
DROP TABLE IF EXISTS `tb_history`;
CREATE TABLE `tb_history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`history_title` varchar(255) NOT NULL,
`history_desc` varchar(255) NOT NULL,
`year` int(5) NOT NULL,
`history_url` varchar(255) DEFAULT NULL,
`history_content` varchar(255) NOT NULL,
`month` int(5) NOT NULL,
`day` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_history
-- ----------------------------
INSERT INTO `tb_history` VALUES ('1', '222', '222', '2019', '3', '12', '3', '5');
INSERT INTO `tb_history` VALUES ('2', '222', '222', '2019', '3', '12', '4', '30');
-- ----------------------------
-- Table structure for tb_permission
-- ----------------------------
DROP TABLE IF EXISTS `tb_permission`;
CREATE TABLE `tb_permission` (
`id` int(11) NOT NULL,
`key` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`permission` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_permission
-- ----------------------------
-- ----------------------------
-- Table structure for tb_sensitive
-- ----------------------------
DROP TABLE IF EXISTS `tb_sensitive`;
CREATE TABLE `tb_sensitive` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`word` varchar(255) NOT NULL,
`time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_sensitive
-- ----------------------------
INSERT INTO `tb_sensitive` VALUES ('2', '去你的', '2019-05-06 13:27:13');
INSERT INTO `tb_sensitive` VALUES ('5', '法轮功', '2019-05-06 13:27:02');
INSERT INTO `tb_sensitive` VALUES ('6', '苏大强', '2019-05-11 11:57:18');
-- ----------------------------
-- Table structure for tb_user
-- ----------------------------
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`WeChat_sex` varchar(255) DEFAULT NULL,
`WeChat_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
`WeChat_head` varchar(255) DEFAULT NULL,
`WeChat_openid` varchar(255) NOT NULL,
`comment_praise` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `WeChat_openid` (`WeChat_openid`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_user
-- ----------------------------
INSERT INTO `tb_user` VALUES ('1', '3', '2', '1', '12345', '');
INSERT INTO `tb_user` VALUES ('9', '112', '222', '333', '', null);
INSERT INTO `tb_user` VALUES ('8', '男性', '许演杰?', 'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJicJOgXTJ2xjPv4jfa67AXrFh7ysOrhSBHY9eibAktH9Vib2Oqth6cEnqc5KQlQ6cOaHO3uYceZQwHQ/132', 'oDSvi5NBQeeHzqcdSR4KYJiy7lQk', '31,,33');
| true |
4980e68dd3e616d6385f7b2824d199439f3d1cb6 | SQL | 394286006/minn-pojo | /src/main/resources/sql/sysbaseshrio.sql | UTF-8 | 8,203 | 2.765625 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.6.19, for osx10.7 (i386)
--
-- Host: 127.0.0.1 Database: sys_base
-- ------------------------------------------------------
-- Server version 5.6.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 */;
--
-- Table structure for table `dictionary`
--
DROP TABLE IF EXISTS `dictionary`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dictionary` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name_zh` varchar(100) DEFAULT NULL,
`name_en` varchar(100) DEFAULT NULL,
`mkey` varchar(45) DEFAULT NULL,
`val` varchar(45) DEFAULT NULL,
`sort` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `menu`
--
DROP TABLE IF EXISTS `menu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `menu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name_zh` varchar(200) DEFAULT NULL,
`name_en` varchar(200) DEFAULT NULL,
`pid` int(11) DEFAULT NULL,
`url` varchar(500) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`sort` int(11) DEFAULT NULL,
`code` varchar(50) DEFAULT NULL,
`urltype` int(11) DEFAULT NULL,
`active` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `operator_log`
--
DROP TABLE IF EXISTS `operator_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `operator_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`user_ip` varchar(255) DEFAULT NULL,
`operator_date` datetime DEFAULT NULL,
`res_id` varchar(100) DEFAULT NULL,
`signature` varchar(500) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `operator_log_detail`
--
DROP TABLE IF EXISTS `operator_log_detail`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `operator_log_detail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`operator_log_id` int(11) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`val` varchar(100) DEFAULT NULL,
`mkey` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=361 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `resource`
--
DROP TABLE IF EXISTS `resource`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `resource` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name_en` varchar(45) DEFAULT NULL,
`name_zh` varchar(45) DEFAULT NULL,
`url` varchar(200) DEFAULT NULL,
`pid` int(11) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`sort` int(11) DEFAULT NULL,
`code` varchar(45) DEFAULT NULL,
`urltype` int(11) DEFAULT NULL,
`active` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role`
--
DROP TABLE IF EXISTS `role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name_en` varchar(100) DEFAULT NULL,
`name_zh` varchar(100) DEFAULT NULL,
`code` varchar(100) DEFAULT NULL,
`active` int(11) DEFAULT NULL,
`comment` varchar(45) DEFAULT NULL,
`sort` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role_resource`
--
DROP TABLE IF EXISTS `role_resource`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role_resource` (
`role_id` int(11) NOT NULL,
`resource_id` int(11) NOT NULL,
PRIMARY KEY (`role_id`,`resource_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`pwd` varchar(100) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`loginType` int(11) DEFAULT NULL,
`active` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_role`
--
DROP TABLE IF EXISTS `user_role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_role` (
`user_id` int(11) NOT NULL,
`role_id` varchar(45) NOT NULL,
PRIMARY KEY (`user_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary view structure for view `v_dictionary`
--
DROP TABLE IF EXISTS `v_dictionary`;
/*!50001 DROP VIEW IF EXISTS `v_dictionary`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `v_dictionary` AS SELECT
1 AS `mkey`,
1 AS `val`,
1 AS `name_en`,
1 AS `name_zh`,
1 AS `sort`*/;
SET character_set_client = @saved_cs_client;
--
-- Dumping routines for database 'sys_base'
--
--
-- Final view structure for view `v_dictionary`
--
/*!50001 DROP VIEW IF EXISTS `v_dictionary`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_dictionary` AS select `dictionary`.`mkey` AS `mkey`,`dictionary`.`val` AS `val`,`dictionary`.`name_en` AS `name_en`,`dictionary`.`name_zh` AS `name_zh`,`dictionary`.`name_zh` AS `sort` from `dictionary` union select 'RESOURCECODE' AS `mkey`,`resource`.`code` AS `val`,`resource`.`name_en` AS `name_en`,`resource`.`name_zh` AS `name_zh`,`resource`.`sort` AS `sort` from `resource` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!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 2015-12-05 16:40:56
| true |
654d975019f72f68f525d1ac705d6cc83c7c0986 | SQL | gicadmin/allo | /PHENIX/Packages/CTY_PACK.sql | UTF-8 | 1,530 | 2.734375 | 3 | [] | no_license | CREATE OR REPLACE PACKAGE phenix.CTY_PACK IS
PROCEDURE INIT_RECORD_PROC(
p_rec OUT NOCOPY contact_types%ROWTYPE);
FUNCTION GET_FULL_FUNC(
p_cty_code IN contact_types.cty_code%TYPE,
p_tcy_rec OUT NOCOPY contact_types%ROWTYPE)
RETURN BOOLEAN;
FUNCTION GET_VARCHAR_COLUMN_FUNC(
p_cty_code IN contact_types.cty_code%TYPE,
p_column_name IN VARCHAR2,
p_raise IN BOOLEAN DEFAULT TRUE)
RETURN VARCHAR2;
FUNCTION GET_VARCHAR_ALT_COLUMN_FUNC(
p_cty_code IN contact_types.cty_code%TYPE,
p_column_name IN VARCHAR2,
p_alt_column_name IN VARCHAR2,
p_language IN VARCHAR2 DEFAULT 'F',
p_raise IN BOOLEAN DEFAULT TRUE)
RETURN VARCHAR2;
FUNCTION DELETE_FUNC(
p_cty_code IN contact_types.cty_code%TYPE)
RETURN NUMBER;
PROCEDURE CHECK_DEPENDENCIES_PROC(
p_cty_code IN contact_types.cty_code%TYPE);
PROCEDURE INSERT_PROC(
p_cty_code IN contact_types.cty_code%TYPE,
p_cty_description IN contact_types.cty_description%TYPE,
p_cty_alt_description IN contact_types.cty_alt_description%TYPE DEFAULT NULL);
PROCEDURE INSERT_PROC(
p_rec IN OUT NOCOPY contact_types%ROWTYPE);
END CTY_PACK;
/ | true |
5784a2ba806b5d9c97aab3640d83d975f2c91f09 | SQL | ArrettB/omni-workspace | /servicetrax/dbscripts/views/JOB_PAYCODE_VIEW_V.sql | UTF-8 | 574 | 3.375 | 3 | [] | no_license | CREATE VIEW dbo.JOB_PAYCODE_VIEW_V AS SELECT dbo.JOBS.JOB_ID, dbo.ORG_GP_TABLES.VIEW_NAME AS PAYCODE_VIEW_NAME
FROM dbo.CUSTOMERS INNER JOIN dbo.JOBS ON dbo.CUSTOMERS.CUSTOMER_ID = dbo.JOBS.CUSTOMER_ID
INNER JOIN dbo.ORGANIZATIONS ON dbo.CUSTOMERS.ORGANIZATION_ID = dbo.ORGANIZATIONS.Organization_ID
INNER JOIN dbo.ORG_GP_TABLES ON dbo.ORGANIZATIONS.Organization_ID = dbo.ORG_GP_TABLES.ORG_ID
INNER JOIN dbo.GREAT_PLAINS_TABLES ON dbo.ORG_GP_TABLES.TABLE_ID = dbo.GREAT_PLAINS_TABLES.TABLE_ID
WHERE (dbo.GREAT_PLAINS_TABLES.TABLE_NAME = 'item_pay_codes_view')
| true |
53d0c577061c884a11e64a73b9a460577e1644c6 | SQL | mblasiak/PLSQL | /lab_4/task_5.sql | UTF-8 | 1,206 | 3.28125 | 3 | [] | no_license | select * from pudelka natural join zawartosc join czekoladki using(idczekoladki) where idczekoladki='d09';
select distinct on (p.nazwa) p.nazwa, c.nazwa from pudelka p natural join zawartosc join czekoladki c using(idczekoladki) where c.nazwa similar to 'S%';
select * from pudelka p natural join zawartosc z join czekoladki c using(idczekoladki) where z.sztuk>=4;
select distinct on (p.nazwa) * from pudelka p natural join zawartosc z join czekoladki c using(idczekoladki) where c.nadzienie='truskawki';
select * from pudelka p natural join zawartosc z join czekoladki c using(idczekoladki) where c.czekolada!='gorzka';
select p.nazwa from pudelka p natural join zawartosc z join czekoladki c using(idczekoladki) where z.sztuk>2 and c.nazwa='Gorzka truskawkowa';
select p.nazwa from pudelka p natural join zawartosc z join czekoladki c using(idczekoladki) except
select p.nazwa pudelka p natural join zawartosc z join czekoladki c using(idczekoladki) where c.orzechy is not Null;
select p.nazwa from pudelka p natural join zawartosc z join czekoladki c using(idczekoladki)
intersect
select p.nazwa from pudelka p natural join zawartosc z join czekoladki c using(idczekoladki) where c.nadzienie is Null;
| true |
cb1d4ed567402b2790a2a5be16cd90a54c583a55 | SQL | yaneg-ru/2020-11-otus-spring-Zolotarev | /HW05/src/main/resources/db/migration/V1/V1__init_db.sql | UTF-8 | 554 | 3.453125 | 3 | [] | no_license | create TABLE IF NOT EXISTS author
(
id bigint NOT NULL,
name varchar(128) NOT NULL,
PRIMARY KEY (id)
);
create TABLE IF NOT EXISTS genre
(
id bigint NOT NULL,
name varchar(128) NOT NULL,
PRIMARY KEY (id)
);
create TABLE IF NOT EXISTS book
(
id bigint NOT NULL,
author_id bigint NOT NULL,
genre_id bigint NOT NULL,
name varchar(255) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (author_id) REFERENCES author (id),
FOREIGN KEY (genre_id) REFERENCES genre (id)
); | true |
90ce24afbb21aaa1aea4e3ab151699cc19d6a510 | SQL | danteay/inai | /src/main/resources/SQL/get_success.sql | UTF-8 | 381 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | SELECT
descripcion Descripcion,
(SELECT
Sum ( nvl( de.Respuesta,0))
FROM DET_EVAL_FRACCIONES de
WHERE de.EVALUACION_FRACCION_ID = ef.EVALUACION_FRACCION_ID
) Valor
FROM EVALUACIONES_FRACCIONES ef, ARTICULOS_FRACCIONES af
WHERE ef.ARTICULO_FRACCION_ID = af.ARTICULO_FRACCION_ID
AND EVALUACION_ID = 7601
AND af.ARTICULO_ID = 23
ORDER BY numero; | true |
336da32124c85602c22df427ea30ac9b0deb9390 | SQL | shensam/rust-realworld-example-app | /migrations/2018-07-17-171835_create_follows/up.sql | UTF-8 | 403 | 3.640625 | 4 | [] | no_license | CREATE TABLE follows (
follower_id INTEGER UNSIGNED NOT NULL,
followed_id INTEGER UNSIGNED NOT NULL,
created_at bigint(20) unsigned NOT NULL DEFAULT 0,
updated_at bigint(20) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (follower_id, followed_id),
FOREIGN KEY (follower_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (followed_id) REFERENCES users(id) ON DELETE CASCADE
) | true |
82a8449e6f97643f88e2fd1e59f9ce8cd6a2670b | SQL | hyc-666/project | /stu_exer/stums/sql/stu.sql | UTF-8 | 1,093 | 2.78125 | 3 | [] | no_license | drop database if exists stums;
create database stums;
use stums;
create table s_student(
`s_id` int primary key auto_increment,
`s_number` varchar(11),
`s_name` varchar(40),
`s_password` varchar(60),
`s_college` varchar(150),
`s_class` varchar(160)
);
-- 插入测试数据
insert into s_student(`s_id`,`s_number`,`s_name`,`s_password`)
values(501,'41709040102','张三丰','user501');
-- id编号从500以后开始,0用作root用户,1-500用作管理员账户
insert into s_student(`s_id`,`s_number`,`s_name`,`s_password`)
values(null,'41709040107','步惊云','user502');
insert into s_student(`s_id`,`s_number`,`s_name`,`s_password`)
values(null,'41709040111','张无忌','user503');
insert into s_student(`s_id`,`s_number`,`s_name`,`s_password`)
values(null,'41709040114','乔峰','user504');
insert into s_student(`s_id`,`s_number`,`s_name`,`s_password`)
values(null,'41709040158','令狐冲','user505');
insert into s_student(`s_id`,`s_number`,`s_name`,`s_password`)
values(null,'41709040209','岳不群','user506');
select * from s_student; | true |
fe8d40b4e71047f483dce5a8a2c35c01fd485f89 | SQL | Kyrugaa/M307Prep | /sql/cars.sql | UTF-8 | 774 | 3.15625 | 3 | [] | no_license | DROP DATABASE IF EXISTS car_db;
CREATE DATABASE car_db;
USE car_db;
DROP USER IF EXISTS USER 'cars'@'%';
CREATE USER 'cars'@'%' IDENTIFIED BY 'cars';
GRANT SELECT ON car_db.* TO 'cars'@'%';
FLUSH PRIVILEGES;
CREATE TABLE auto (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
marke VARCHAR(45) NOT NULL,
modell VARCHAR(45) NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO auto VALUES
(1,"VW","Lupo"),
(2,"VW","Polo"),
(3,"VW","Golf"),
(4,"VW","Passat"),
(5,"Audi","A3"),
(6,"Audi","A4"),
(7,"Audi","A5"),
(8,"Audi","A6"),
(9,"Audi","A8"),
(10,"Renault","Twingo"),
(11,"Renault","Clio"),
(12,"Renault","Kangoo"),
(13,"Renault","Captur"),
(14,"Renault","Megane"),
(15,"Subaru","Impreza"),
(16,"Subaru","Legacy"),
(17,"Subaru","Forester"),
(18,"Subaru","Acent"),
(19,"Subaru","Outback");
| true |
d2b6a9146d3d95b587e0a329b1e0c1912e9b7929 | SQL | bbfans/graduate | /data/zh_user.sql | UTF-8 | 2,974 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | -- MySQL dump 10.13 Distrib 5.7.11, for osx10.11 (x86_64)
--
-- Host: localhost Database: graduate
-- ------------------------------------------------------
-- Server version 5.7.11
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `zh_user`
--
DROP TABLE IF EXISTS `zh_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zh_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`sfz` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_zh_user_sfz` (`sfz`),
UNIQUE KEY `uq_zh_user_telephone` (`telephone`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `zh_user`
--
LOCK TABLES `zh_user` WRITE;
/*!40000 ALTER TABLE `zh_user` DISABLE KEYS */;
INSERT INTO `zh_user` VALUES (3,'111111111111111111',' 王五一','1231231'),(5,'222222222222222222','李四','1231232'),(6,'333333333333333333','老六','1231233'),(10,'444444444444444444','袁世凯','1231234'),(11,'555555555555555555','溥仪','1231235'),(12,'666666666666666666','孝庄','1231236'),(13,'777777777777777777','康熙','1231237'),(14,'888888888888888888','福临','1231238'),(17,'9999999999999999999','努尔哈赤','1231239'),(18,'9998887771611843775','皇太极','12312310'),(19,'88395068162536749500','马化腾','12312311'),(20,'123123123123123123','测试','1231238888'),(22,'991239912939129391239','张三','1235533445745634'),(23,'110110110110','陈永仁','1877277277272'),(24,'123123123123123123123123','张五','1879992112'),(25,'111111111111111112','张六','11111111112'),(28,'111111111111111113','张天','11111111111');
/*!40000 ALTER TABLE `zh_user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-06-09 20:55:13
| true |
583079922c2aba6280ce598d3a32e8cc92f7e9d0 | SQL | patdaman/dlR_ManageMachineVars | /DevOps/Tables/MachineConfigVars.sql | UTF-8 | 499 | 3.4375 | 3 | [] | no_license | CREATE TABLE [config].[MachineConfigVars] (
[appConfigVariable_id] INT NOT NULL,
[machine_id] INT NOT NULL,
CONSTRAINT [PK_MachineConfigVars] PRIMARY KEY CLUSTERED ([appConfigVariable_id] ASC, [machine_id] ASC),
CONSTRAINT [FK_MachineConfigVars_ConfigVariables] FOREIGN KEY ([appConfigVariable_id]) REFERENCES [config].[ConfigVariables] ([id]),
CONSTRAINT [FK_MachineConfigVars_MachineConfigVars] FOREIGN KEY ([machine_id]) REFERENCES [config].[Machines] ([id])
);
| true |
dac63f5a4f303493f5034da35720d618a1eeae8c | SQL | geovanitec/ProyectoIndividualHoteleria | /Traslado/BD/inserts.sql | UTF-8 | 2,389 | 3.578125 | 4 | [] | no_license | use hotelSanCarlos;
insert into tipoCuenta values ('1', 'Activo','A');
insert into tipoCuenta values ('2', 'Activo Corriente','A');
insert into tipoCuenta values ('3', 'Pasivo ','A');
insert into tipoCuenta values ('4', 'Pasivo Corriente','A');
insert into cuenta values ('1', 'impuesto','1','0','0','0','A','1');
insert into cuenta values ('2', 'impuesto2','1','0','0','0','A','1');
insert into cuenta values ('3', 'impuesto3','1','0','0','0','A','1');
insert into tipoPoliza values ('1','Poliza Ingresos', 'A');
insert into tipoPoliza values ('2','Poliza Egresos', 'A');
insert into tipoPoliza values ('3','Poliza Total', 'A');
insert into tipoOperacion values ('1', 'Debe', 'A');
insert into tipoOperacion values ('2', 'Haber', 'A');
insert into polizaEncabezado values ('1', '2021-10-1', '1');
insert into polizaEncabezado values ('2', '2021-10-2', '1');
insert into polizaEncabezado values ('3', '2021-10-3', '1');
insert into polizaDetalle values ('1', '2021-10-1', '1', '450', '1', 'impuesto');
insert into polizaDetalle values ('1', '2021-10-1', '2', '450', '2', 'impuesto');
insert into polizaDetalle values ('2', '2021-10-2','1', '100', '1', 'impuesto');
insert into polizaDetalle values ('2', '2021-10-2','2', '100', '2', 'impuesto');
insert into polizaDetalle values ('3', '2021-10-3', '1', '84.50', '1', 'impuesto');
insert into polizaDetalle values ('3', '2021-10-3','2', '84.50', '2', 'impuesto');
insert into polizaDetalle values ('2', '2021-10-4','2', '1000', '2', 'impuesto husped');
insert into polizaDetalle values ('2', '2021-10-4','2', '1000', '1', 'impuesto husped');
insert into polizaDetalle values ('1', '2021-10-3','3', '200', '2', 'impuesto');
-- select * from polizaDetalle ORDER BY length(idPolizaEncabezado ) ASC;
-- select * from polizaEncabezado order by length (idPolizaEncabezado) DESC limit 1;
-- esta ordena el digito no importando si es integer o varchar y lo detecta
-- SELECT (idPolizaEncabezado * 1) as `idPolizaEncabezado` from polizaEncabezado order by (idPolizaEncabezado) DESC limit 1;
-- pruebas
select * from polizaEncabezado order by idPolizaEncabezado desc limit 1;
-- select idPolizaEncabezado from polizaEncabezado
select * from polizaEncabezado;
select * from polizaDetalle;
-- select sum(saldo) from polizaDetalle where concepto like '%mpuesto %' and idTipoOperacion = '2' and fechaPoliza between "2021-10-1" and "2021-10-1";
| true |
3221f5e311ece88b4bf40edadaeb662db285f13c | SQL | DeyanDanailov/MS-SQL-Server | /ExamPreparation/Databases MSSQL Server Exam - 27 Jun 2020/10.Missing Parts.sql | UTF-8 | 451 | 3.9375 | 4 | [
"MIT"
] | permissive | SELECT *
FROM
(SELECT p.PartId,
P.Description,
SUM(pn.Quantity) AS Required,
SUM(p.StockQty) AS [In Stock],
SUM(op.Quantity) AS [Ordered]
FROM Parts p
JOIN OrderParts op ON op.PartId = p.PartId
JOIN Orders o ON o.OrderId = op.OrderId
JOIN Jobs j ON j.JobId = o.JobId
JOIN PartsNeeded pn ON pn.PartId = p.PartId
WHERE j.Status <> 'Finished'
GROUP BY p.PartId, p.Description) AS K
WHERE K.Required > K.[In Stock]
ORDER BY K.PartId | true |
b00c5f1d87534dfe33c1f71df849d1d6401fee93 | SQL | vldcher/amis_cassandra | /Chernenko/lab4/lab4.cql | UTF-8 | 7,209 | 3.671875 | 4 | [] | no_license |
drop table if exists "airport";
//
create table if not exists "airport"(
airport text,
planes SET<text>,
plane_isleave boolean,
primary Key (airport)
);
DROP TABLE IF EXISTS "user_expences";
CREATE TABLE "user_expences" (
user_name text,
user_balance float static,
service_code int,
service_description text,
service_iswish boolean,
service_price float,
PRIMARY KEY (user_name, service_code)
);
DROP TABLE IF EXISTS "wish_list";
CREATE TABLE "wish_list" (
flight_id int,
flight_price float,
flight_from text,
flight_to text,
flight_iswish boolean,
PRIMARY KEY (flight_id)
);
INSERT INTO "wish_list" (flight_id, flight_price, flight_from, flight_to, flight_iswish)
VALUES (1, 25, 'Kiev', 'Paris', false );
INSERT INTO "wish_list" (flight_id, flight_price, flight_from, flight_to, flight_iswish)
VALUES (2, 45, 'Lviv', 'Moscow', true );
INSERT INTO "wish_list" (flight_id, flight_price, flight_from, flight_to, flight_iswish)
VALUES (3, 550, 'Kiev', 'New-York', false );
SELECT * FROM "wish_list";
BEGIN BATCH
INSERT INTO "user_expences" (user_name, user_balance) VALUES ('user1', 50) IF NOT EXISTS;
INSERT INTO "user_expences" (user_name, service_code, service_description, service_iswish, service_price)
VALUES ('user1', 3, 'wash car', false, 25.40);
INSERT INTO "user_expences" (user_name, service_code, service_description, service_iswish, service_price)
VALUES ('user1', 2, 'watch film', false, 10);
INSERT INTO "user_expences" (user_name, service_code, service_description, service_iswish, service_price)
VALUES ('user1', 1, 'fly abroad', true, 45);
APPLY BATCH;
SELECT * FROM "user_expences";
//find out current balance
SELECT DISTINCT user_balance FROM "user_expences" WHERE user_name='user1';
BEGIN BATCH
UPDATE "user_expences" SET service_iswish=false
WHERE user_name='user1' AND service_code = 1;
UPDATE "user_expences" SET service_iswish=true
WHERE user_name='user1' AND service_code = 2;
UPDATE "user_expences" SET service_iswish=false
WHERE user_name='user1' AND service_code = 3;
UPDATE "user_expences"
SET user_balance = 40
WHERE user_name='user1' IF user_balance=50;
APPLY BATCH;
SELECT * FROM "user_expences";
////////////////////////////////
DROP TABLE IF EXISTS flying_info;
CREATE TABLE IF NOT EXISTS flying_info(
airport text,
day int,
arrived int,
departured int,
user_name text,
count counter,
PRIMARY KEY((airport),day,arrived,departured, user_name)
);
//date
UPDATE flying_info SET count=count+20 WHERE airport='SmthAirport'
AND day=20151221
AND arrived=1
AND departured=12
AND user_name = 'Bob';
UPDATE flying_info SET count=count+50 WHERE airport='SmthAirport'
AND day=20151221
AND arrived=2
AND departured=11
AND user_name = 'Bob';
UPDATE flying_info SET count=count+93 WHERE airport='SmthAirport'
AND day=20151221
AND arrived=3
AND departured=10
AND user_name = 'Bob';
//date
UPDATE flying_info SET count=count+10 WHERE airport='SmthAirport'
AND day=20151222
AND arrived=4
AND departured=9
AND user_name = 'Ann';
UPDATE flying_info SET count=count+74 WHERE airport='SmthAirport'
AND day=20151222
AND arrived=5
AND departured=8
AND user_name = 'Ann';
UPDATE flying_info SET count=count+24 WHERE airport='SmthAirport'
AND day=20151222
AND arrived=6
AND departured=7
AND user_name = 'Carl';
//date
UPDATE flying_info SET count=count+35 WHERE airport='SmthAirport'
AND day=20151223
AND arrived=7
AND departured=6
AND user_name = 'Carl';
UPDATE flying_info SET count=count+26 WHERE airport='SmthAirport'
AND day=20151223
AND arrived=8
AND departured=5
AND user_name = 'John';
UPDATE flying_info SET count=count+131 WHERE airport='SmthAirport'
AND day=20151223
AND arrived=9
AND departured=4
AND user_name = 'Bob';
SELECT * FROM flying_info;
//count arrived planes
CREATE OR REPLACE FUNCTION flyingCounter(state map<int,bigint>, arrived int, count counter)
RETURNS NULL ON NULL INPUT
RETURNS map<int,bigint>
LANGUAGE java
AS $$
if(state.containsKey(arrived)) {
state.put(arrived, (Long)state.get(arrived) + count);
} else {
state.put(arrived, count);
}
return state;
$$;
CREATE OR REPLACE AGGREGATE groupCountByArrived(int, counter)
SFUNC flyingCounter
STYPE map<int,bigint>
INITCOND {};
SELECT groupCountByArrived(arrived,count)
FROM flying_info
WHERE airport='SmthAirport'
AND day>=20151221 AND day<=20151223;
//count departured planes
CREATE OR REPLACE FUNCTION flyingCounter(state map<int,bigint>, departured int, count counter)
RETURNS NULL ON NULL INPUT
RETURNS map<int,bigint>
LANGUAGE java
AS $$
if(state.containsKey(departured)) {
state.put(departured, (Long)state.get(departured) + count);
} else {
state.put(departured, count);
}
return state;
$$;
CREATE OR REPLACE AGGREGATE groupCountByDepartured(int, counter)
SFUNC flyingCounter
STYPE map<int,bigint>
INITCOND {};
SELECT groupCountByDepartured(departured,count)
FROM flying_info
WHERE airport='SmthAirport'
AND day>=20151221 AND day<=20151223;
///////final function for arrived
CREATE OR REPLACE FUNCTION countArrived(state map<int,bigint>)
RETURNS NULL ON NULL INPUT
RETURNS bigint
LANGUAGE java
AS $$
if(state.containsKey("arrived")) {
return (Long)state.get("arrived");
} else {
return 0L;
}$$;
CREATE OR REPLACE AGGREGATE groupCountByArrived(int, counter)
SFUNC flyingCounter
STYPE map<int,bigint>
FINALFUNC countArrived
INITCOND {};
SELECT groupCountByArrived(arrived,count)
FROM flying_info
WHERE airport='SmthAirport'
AND day>=20151221 AND day<=20151223;
-----------------------------------------------------
///////final function for departured
CREATE OR REPLACE FUNCTION countArrived(state map<int,bigint>)
RETURNS NULL ON NULL INPUT
RETURNS bigint
LANGUAGE java
AS $$
if(state.containsKey("arrived")) {
return (Long)state.get("arrived");
} else {
return 0L;
}$$;
CREATE OR REPLACE AGGREGATE groupCountByArrived(int, counter)
SFUNC flyingCounter
STYPE map<int,bigint>
FINALFUNC countArrived
INITCOND {};
SELECT groupCountByArrived(arrived,count)
FROM flying_info
WHERE airport='SmthAirport'
AND day>=20151221 AND day<=20151223;
///////////////////
CREATE OR REPLACE FUNCTION countDeparturedState(state map<int, frozen<set<int>>>, airport_id int, user_name text)
CALLED ON NULL INPUT
RETURNS tuple<int, frozen<set<int>>>
LANGUAGE java
AS $$
<INTEGER>Set aiports = new Set<INTEGET>();
if (state.containsKey(user_name)) {
state.put(user_name, flying_info.add(airport));
}
return state;
$$;
CREATE OR REPLACE FUNCTION countDeparturedFinal (state map<int,frozen<set<int>>)
CALLED ON NULL INPUT
RETURNS map<int, int>
LANGUAGE java
AS $$
for (int i=0; i < state.size(); i++){
state.put(user_name, i);
}
return state;
$$;
CREATE OR REPLACE AGGREGATE countAirport(int, int)
SFUNC countDeparturedState
STYPE tuple<int, frozen<set<int>>>
INITCOND (0, 0);
SELECT countBank(airport, user_name) from flying_info;
| true |
8788c73fa5043a7db9b1372f2256d5fb48b9eb4d | SQL | pansophism/joblist | /conf/evolutions/default/1.sql | UTF-8 | 1,099 | 2.8125 | 3 | [] | no_license | # --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table company (
id bigint auto_increment not null,
name varchar(255),
address varchar(255),
zip_code integer,
constraint pk_company primary key (id))
;
create table post (
id bigint auto_increment not null,
user_id bigint,
company_id bigint,
title varchar(255),
content varchar(255),
date datetime,
applied bigint,
constraint pk_post primary key (id))
;
create table user (
id bigint auto_increment not null,
user_name varchar(255),
address varchar(255),
zip_code integer,
constraint pk_user primary key (id))
;
# --- !Downs
SET FOREIGN_KEY_CHECKS=0;
drop table company;
drop table post;
drop table user;
SET FOREIGN_KEY_CHECKS=1;
| true |
016a7628afaa4b48feee7f35ef1f14bffd590062 | SQL | Aaron-Usher/Capstone-2017 | /SnackOverFlowDB/Old Stuff/create/scriptFiles/sp_create_vehicle.prc | UTF-8 | 835 | 3.265625 | 3 | [] | no_license | USE [SnackOverflowDB]
GO
IF EXISTS(SELECT * FROM sys.objects WHERE type = 'P' AND name = 'sp_create_vehicle')
BEGIN
DROP PROCEDURE sp_create_vehicle
Print '' print ' *** dropping procedure sp_create_vehicle'
End
GO
Print '' print ' *** creating procedure sp_create_vehicle'
GO
Create PROCEDURE sp_create_vehicle
(
@VIN[NVARCHAR](20),
@MAKE[NVARCHAR](15),
@MODEL[NVARCHAR](20),
@MILEAGE[INT],
@YEAR[NVARCHAR](4),
@COLOR[NVARCHAR](20),
@ACTIVE[BIT],
@LATEST_REPAIR_DATE[DATE]= NULL,
@LAST_DRIVER_ID[INT]= NULL,
@VEHICLE_TYPE_ID[NVARCHAR](50)
)
AS
BEGIN
INSERT INTO VEHICLE (VIN, MAKE, MODEL, MILEAGE, YEAR, COLOR, ACTIVE, LATEST_REPAIR_DATE, LAST_DRIVER_ID, VEHICLE_TYPE_ID)
VALUES
(@VIN, @MAKE, @MODEL, @MILEAGE, @YEAR, @COLOR, @ACTIVE, @LATEST_REPAIR_DATE, @LAST_DRIVER_ID, @VEHICLE_TYPE_ID);
SET NOCOUNT OFF
SELECT @@identity
END
| true |
5dbc60a298b5f0f7ec94a9a0c1afa68a7be6e033 | SQL | Yavoric/javapart | /4B.sql | UTF-8 | 372 | 3.671875 | 4 | [] | no_license | /*sql requests for the selection of the following data:
all mobile numbers of the selected subscriber*/
SELECT
a.first_name, a.last_name, p.number
FROM
abonent a,
phone_book p,
operator o,
operator_number op
WHERE
a.abonent_id = 8
AND a.abonent_id = p.abonent_id
AND o.operator_id = op.operator_id
AND op.number = p.number | true |
8d70ce653471b55c74be711dea1cd01ce45b535d | SQL | andyukovegor/SpringDemo-ifbs | /stuff/db/210326_Init_structure.sql | UTF-8 | 1,108 | 3.15625 | 3 | [] | no_license | --
-- Table structure for table `car_brand`
--
DROP TABLE IF EXISTS `car_brand`;
CREATE TABLE `car_brand` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL DEFAULT 'None',
`url` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `car_brand`
--
LOCK TABLES `car_brand` WRITE;
INSERT INTO `car_brand` VALUES (1,'Lada','www.lada.com'),(2,'BMW','www.bmw.com'),(3,'Kia','www.kia.com'),(4,'Tesla','www.tesla.com');
UNLOCK TABLES;
--
-- Table structure for table `car_model`
--
DROP TABLE IF EXISTS `car_model`;
CREATE TABLE `car_model` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`car_brand_id` int(11) NOT NULL,
`name` varchar(64) DEFAULT NULL,
`productionDate` year(4) DEFAULT NULL,
`price` float DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `car_model`
--
LOCK TABLES `car_model` WRITE;
INSERT INTO `car_model` VALUES (1,1,'Kalina',2010,400.5),(2,1,'Largus',2005,900),(3,3,'Optima',2014,1200.8);
UNLOCK TABLES;
| true |
80ca19e41ebaf61affa7e33f8b437791eef53efa | SQL | nielsutrecht/grub | /modules/diary/src/test/resources/sql/create.sql | UTF-8 | 437 | 3.8125 | 4 | [
"MIT"
] | permissive | CREATE TABLE IF NOT EXISTS meals (id UUID PRIMARY KEY);
CREATE TABLE IF NOT EXISTS users(id UUID PRIMARY KEY);
CREATE TABLE IF NOT EXISTS user_meals (
user_id UUID NOT NULL,
meal_id UUID NOT NULL,
date DATE NOT NULL,
time VARCHAR(10) NOT NULL,
amount DOUBLE NOT NULL,
PRIMARY KEY (user_id, meal_id, date, time),
FOREIGN KEY (user_id) references users(id),
FOREIGN KEY (meal_id) references meals(id),
);
| true |
5e2904df40a07e5fd9b77194e8ea756056052593 | SQL | adharshr/FlightsDB | /setup.sql | UTF-8 | 389 | 2.9375 | 3 | [] | no_license | /*
Adharsh Ranganathan
5/22/17
CSE 414 - HW7
*/
CREATE TABLE Customer (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
handle VARCHAR(25) NOT NULL,
password VARCHAR(25) NOT NULL,
UNIQUE(handle)
);
CREATE TABLE Reservation (
customer INTEGER REFERENCES Customer,
fid INTEGER REFERENCES Flights NOT NULL,
PRIMARY KEY(fid, customer)
);
INSERT INTO Customer VALUES(12, 'adharsh', 'aranga', '1234'); | true |
b436638f6db599c604358b611b65d69249205744 | SQL | MaLiN2223/SeriesHandler | /Script1.sql | UTF-8 | 1,015 | 3.46875 | 3 | [
"MIT"
] | permissive | CREATE TABLE UserPermissions(
id TINYINT PRIMARY KEY IDENTITY (1,1),
name NVARCHAR(100) UNIQUE,
);
CREATE TABLE Users (
id INT PRIMARY KEY IDENTITY (1, 1),
username NVARCHAR(100) UNIQUE NOT NULL,
password VARBINARY(20) NOT NULL,
password_salt CHAR(25) NOT NULL,
permission TINYINT FOREIGN KEY REFERENCES UserPermissions (id),
name NVARCHAR(64) NOT NULL,
surname NVARCHAR(64) NOT NULL,
email NVARCHAR(150) UNIQUE NOT NULL
);
CREATE TABLE Series(
id INT PRIMARY KEY IDENTITY (1,1),
startDate DATETIME NOT NULL,
endDate DATETIME,
title VARCHAR(150),
description VARCHAR(MAX)
);
CREATE TABLE InternalErrors (
id INT IDENTITY (1, 1) NOT NULL PRIMARY KEY,
error_name NVARCHAR(64) NOT NULL,
error_time DATETIME NOT NULL,
message NVARCHAR(3000),
stack_trace NVARCHAR(1000) NOT NULL,
context NVARCHAR(900) NOT NULL,
inner_message NVARCHAR(400),
);
| true |
81980e258aabd77d3f40caa7f701bd66a954670a | SQL | codefollower/HSQLDB-Research | /test-src/org/hsqldb/jdbc/resources/sql/TestSelfMultiGrants.txt | UTF-8 | 2,792 | 3.59375 | 4 | [] | no_license | /*s*/DROP USER peon1;
/*s*/DROP USER peon2;
/*s*/DROP USER peon3;
/*s*/DROP ROLE r1;
/*s*/DROP ROLE r2;
/*s*/DROP ROLE r3;
/*s*/DROP ROLE r12;
DROP TABLE t1 IF exists;
DROP TABLE t2 IF exists;
DROP TABLE t3 IF exists;
DROP TABLE t4 IF exists;
CREATE TABLE t1(i int);
CREATE TABLE t2(i int);
CREATE TABLE t3(i int);
CREATE TABLE t4(i int);
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(2);
INSERT INTO t3 VALUES(3);
INSERT INTO t4 VALUES(4);
COMMIT;
CREATE USER peon1 PASSWORD password;
CREATE USER peon2 PASSWORD password;
CREATE USER peon3 PASSWORD password;
/*u0*/GRANT CHANGE_AUTHORIZATION TO peon1;
/*u0*/GRANT CHANGE_AUTHORIZATION TO peon2;
/*u0*/GRANT CHANGE_AUTHORIZATION TO peon3;
/*u0*/CREATE ROLE r1;
/*u0*/CREATE ROLE r2;
/*u0*/CREATE ROLE r3;
/*u0*/CREATE ROLE r12;
/*u0*/GRANT ALL ON t1 TO r1;
/*u0*/GRANT ALL ON t1 TO r12;
/*u0*/GRANT ALL ON t2 TO r2;
/*u0*/GRANT ALL ON t2 TO r12;
/*u0*/GRANT ALL ON t3 TO r3;
-- Can't mix right-grants and role-grants
/*e*/GRANT r1, SELECT ON t1 TO peon1;
/*e*/GRANT SELECT ON t1, r1 TO peon1;
/*u0*/GRANT SELECT, INSERT ON t1 TO peon1;
/*u0*/GRANT r2, r3 TO peon2;
/*u0*/GRANT r12 TO peon3;
CONNECT USER peon1 PASSWORD password;
/*c1*/SELECT * FROM t1;
/*e*/SELECT * FROM t2;
/*e*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
CONNECT USER peon2 PASSWORD password;
/*e*/SELECT * FROM t1;
/*c1*/SELECT * FROM t2;
/*c1*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
CONNECT USER peon3 PASSWORD password;
/*c1*/SELECT * FROM t1;
/*c1*/SELECT * FROM t2;
/*e*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
CONNECT USER sa PASSWORD "";
/*u0*/GRANT r2 TO peon1;
/*u0*/GRANT r3 TO r12; -- r12 held by peon3. Nest r3 into it too.
/*u0*/GRANT SELECT ON t1 TO peon2;
CONNECT USER peon1 PASSWORD password;
/*c1*/SELECT * FROM t1;
/*c1*/SELECT * FROM t2;
/*e*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
CONNECT USER peon2 PASSWORD password;
/*c1*/SELECT * FROM t1;
/*c1*/SELECT * FROM t2;
/*c1*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
CONNECT USER peon3 PASSWORD password;
/*c1*/SELECT * FROM t1;
/*c1*/SELECT * FROM t2;
/*c1*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
-- Access to t3 has been granted only through r3, either directly or
-- indirectly (the latter through nesting r3 in another role).
CONNECT USER sa PASSWORD "";
DROP ROLE r3;
CONNECT USER peon1 PASSWORD password;
/*c1*/SELECT * FROM t1;
/*c1*/SELECT * FROM t2;
/*e*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
CONNECT USER peon2 PASSWORD password;
/*c1*/SELECT * FROM t1;
/*c1*/SELECT * FROM t2;
/*e*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
CONNECT USER peon3 PASSWORD password;
/*c1*/SELECT * FROM t1;
/*c1*/SELECT * FROM t2;
/*e*/SELECT * FROM t3;
/*e*/SELECT * FROM t4;
| true |
c51795e08aa51dc9efd44afc7cd7c994bbbb10b3 | SQL | tanjianhui/schedule-demo | /doc/db/mysql.sql | UTF-8 | 8,225 | 3.890625 | 4 | [] | no_license | drop table if exists dea_developer_account;
drop table if exists sda_store_developer_account;
drop table if exists tas_task;
drop table if exists sch_scheduler;
drop table if exists scl_scheduler_log;
drop table if exists job_job;
drop table if exists joe_job_error;
create table dea_developer_account
(
dea_id int not null auto_increment comment '主键',
platform_id int not null comment '平台主键 1-Amazon 2-eBay',
account_info varchar(2000) not null comment '开发者账号信息(格式:JSON)',
concurrency int not null default 0 comment '并发数限制 0-无限制',
create_by varchar(20) not null comment '创建人',
create_time timestamp not null comment '创建时间',
last_update_by varchar(20) comment '最后修改人',
last_update_time timestamp comment '最后修改时间',
primary key(dea_id)
) engine=innodb comment '开发者账号';
create table sda_store_developer_account
(
sda_id int not null auto_increment comment '主键',
str_id int not null comment '店铺主键',
dea_id int not null comment '开发者账号主键',
create_by varchar(20) not null comment '创建人',
create_time timestamp not null comment '创建时间',
last_update_by varchar(20) comment '最后修改人',
last_update_time timestamp comment '最后修改时间',
primary key(sda_id),
unique(str_id)
) engine=innodb comment '店铺开发者账号';
create table tas_task
(
tas_id int not null auto_increment comment '主键',
name varchar(50) not null comment '任务名称',
estimate_cost_time int not null comment '预计花费时间(单位:分钟)',
estimate_max_cost_time int not null comment '预计最大花费时间(单位:分钟)',
priority int not null comment '优先级 取值范围1-10,1最低,10最高,默认为5。',
concurrency varchar(1) not null comment '能否并发执行 0-否 1-是',
retry_rule varchar(2000) not null comment '重试规则(格式:JSON)',
remark varchar(100) comment '备注',
create_by varchar(20) not null comment '创建人',
create_time timestamp not null comment '创建时间',
last_update_by varchar(20) comment '最后修改人',
last_update_time timestamp comment '最后修改时间',
primary key(tas_id)
) engine=innodb comment '任务';
create table sch_scheduler
(
sch_id int not null auto_increment comment '主键',
tas_id int comment '任务主键',
operation varchar(1) not null comment '操作类型 1-新增 2-暂停 3-恢复',
name varchar(50) not null comment '名称',
cron_expression varchar(100) not null comment 'cron表达式',
status varchar(1) not null comment '状态 0-未生效 1-已生效',
remark varchar(100) comment '备注',
create_by varchar(20) not null comment '创建人',
create_time timestamp not null comment '创建时间',
last_update_by varchar(20) comment '最后修改人',
last_update_time timestamp comment '最后修改时间',
primary key (sch_id)
) engine=innodb comment '调度器';
create table scl_scheduler_log
(
scl_id int not null auto_increment comment '主键',
sch_id int not null comment '调度器主键',
status varchar(1) not null comment '状态 1-执行中 2-成功 3-失败',
error_message varchar(2000) comment '错误信息',
create_by varchar(20) not null comment '创建人',
create_time timestamp not null comment '创建时间',
last_update_by varchar(20) comment '最后修改人',
last_update_time timestamp comment '最后修改时间',
primary key (scl_id)
) engine=innodb comment '调度器执行日志';
create table job_job
(
job_id int not null auto_increment comment '主键',
tas_id int not null comment '任务主键',
str_id int not null comment '店铺主键',
dea_id int not null comment '开发者账号主键',
pla_id int not null comment '平台主键',
business_parameter varchar(2000) comment '业务参数 格式:JSON',
start_time timestamp not null comment '开始时间',
complete_time timestamp comment '完成时间',
estimate_complete_time timestamp not null comment '预计完成时间',
estimate_longest_complete_time timestamp not null comment '最大预计完成时间',
priority int not null comment '优先级 取值范围1-10,1最低,10最高,默认为5。',
fail_counter int not null comment '失败次数',
next_run_time timestamp not null comment '下次执行时间 默认为创建时间',
status varchar(1) not null comment '状态 1-New 2-Initial 3-Processing 4-Timeout 5-Done 6-Fail 7-Killed',
remark varchar(2000) comment '备注',
create_by varchar(20) not null comment '创建人',
create_time timestamp not null comment '创建时间',
last_update_by varchar(20) comment '最后修改人',
last_update_time timestamp comment '最后修改时间',
primary key (job_id)
) engine=innodb comment '作业';
create table joe_job_error
(
joe_id int not null auto_increment comment '主键',
job_id int not null comment '作业监控主键',
error_message varchar(2000) comment '错误信息',
create_by varchar(20) not null comment '创建人',
create_time timestamp not null comment '创建时间',
last_update_by varchar(20) comment '最后修改人',
last_update_time timestamp comment '最后修改时间',
primary key(joe_id)
) engine=innodb comment '作业错误';
DELETE FROM tas_task;
INSERT INTO tas_task
(name, estimate_cost_time, estimate_max_cost_time, priority, concurrency, retry_rule, remark, create_by, create_time)
VALUES ('库存同步', 5, 10, 5, '0',
'[{"failCountFloor":1,"failCountUpper":3,"retryInterval":1},{"failCountFloor":4,"failCountUpper":6,"retryInterval":5},{"failCountFloor":7,"failCountUpper":9,"retryInterval":10}]',
'', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'stockSync';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (1, '1', 'stockSync', '0 0/15 * * * ?', '0', '', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'amazonCheck';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (null, '1', 'amazonCheck', '0 * * * * ?', '0', '', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'amazonSubmitProduct';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (null, '1', 'amazonSubmitProduct', '0 0/2 * * * ?', '0', '', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'amazonSubmitProductImage';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (null, '1', 'amazonSubmitProductImage', '0 0/2 * * * ?', '0', '', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'amazonSubmitProductRelationship';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (null, '1', 'amazonSubmitProductRelationship', '0 0/2 * * * ?', '0', '', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'amazonSubmitInventory';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (null, '1', 'amazonSubmitInventory', '0 0/2 * * * ?', '0', '', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'amazonSubmitFulfillment';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (null, '1', 'amazonSubmitFulfillment', '0 0/2 * * * ?', '0', '', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'amazonRecoverExecution';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (null, '1', 'amazonRecoverExecution', '0 0/2 * * * ?', '0', '', 'admin', current_timestamp);
DELETE FROM sch_scheduler where name = 'amazonRecoverExecutionTimeBy';
INSERT INTO sch_scheduler
(tas_id, operation, name, cron_expression, status, remark, create_by, create_time)
VALUES (null, '1', 'amazonRecoverExecutionTimeBy', '0 * * * * ?', '0', '', 'admin', current_timestamp);
| true |
babd673167c991966cf2eb049fde2aef6cc1557b | SQL | DanielMassato/Projeto-Entity | /Projeto-Entity/5_LINQ/4_ConsultaAlteraProdutos_LINQ_Resolvido/CRIA_USUARIOS.sql | ISO-8859-2 | 404 | 3 | 3 | [] | no_license | USE PEDIDOS
CREATE TABLE USUARIOS
(
ID_USER INT IDENTITY,
NOME VARCHAR(30),
USER_LOGIN VARCHAR(10),
USER_PWS VARCHAR(10),
NIVEL SMALLINT,
CONSTRAINT PK_USUARIOS PRIMARY KEY (ID_USER)
)
ALTER TABLE USUARIOS ADD
CONSTRAINT UQ_USUARIOS_USER_LOGIN UNIQUE(USER_LOGIN)
INSERT INTO USUARIOS
VALUES ('CARLOS MAGNO', 'magno', 'magno', 100),
('z mane', 'ze', 'ze', 10)
SELECT * FROM USUARIOS | true |
39835e2854c9a972ad37f76dfea2614fc0f13c77 | SQL | jqcoffey/qwebmon | /queries/queries.sql | UTF-8 | 517 | 4.46875 | 4 | [
"Apache-2.0"
] | permissive | select gender, count(0) from employees group by gender;
select emp_no, count(0), max(salary) from salaries group by emp_no order by max(salary) desc limit 2;
SELECT
d.dept_name,
max(s.salary)
FROM
employees e
LEFT JOIN current_dept_emp cde
ON cde.emp_no = e.emp_no
LEFT JOIN (select emp_no, max(salary) as salary from salaries group by emp_no) s
ON s.emp_no = e.emp_no
LEFT JOIN departments d
ON d.dept_no = cde.dept_no
GROUP BY
d.dept_name
ORDER BY
max(s.salary) DESC
LIMIT
2;
| true |
df400e130f726ab057a90d3dff0026bb660e2860 | SQL | wahello/crmDuende | /server/src/main/webapp/migrations/V4_create_table_purchasesdetail.sql | UTF-8 | 1,041 | 3.71875 | 4 | [] | no_license | -- Nombre de la tabla --> Table: public.purchasesdetail
-- Esta parte se descomenta despues de la segunda corrida del programa
DROP TABLE public.purchasesdetail;
CREATE TABLE public.purchasesdetail
(
purdetailid bigint NOT NULL DEFAULT nextval('purchasesdetail_purdetailid_seq'::regclass),
purid bigint NOT NULL,
productid bigint NOT NULL,
cost character varying(100) COLLATE pg_catalog."default",
sales_price character varying(100) COLLATE pg_catalog."default",
count integer NOT NULL,
CONSTRAINT purchasesdetail_pkey PRIMARY KEY (purdetailid),
CONSTRAINT rel_purDetail_product FOREIGN KEY (productid)
REFERENCES public.products (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT rel_purDetail_purchases FOREIGN KEY (purid)
REFERENCES public.purchases (purid) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.purchasesdetail
OWNER to postgres;
#Creada por María Mercedes Retolaza Reyna | true |
9dcd837ba3a6383ff8aefac9991d53af9eaadc47 | SQL | psharif/bamazon | /SQL_SCHEMA/bamazon.sql | UTF-8 | 1,235 | 3.546875 | 4 | [] | no_license | DROP DATABASE IF EXISTS bamazon;
CREATE DATABASE bamazon;
USE bamazon;
CREATE TABLE products(
item_id INT NOT NULL AUTO_INCREMENT,
product_name VARCHAR(45) NULL,
department_name VARCHAR(45) NULL,
price DECIMAL(10,2) NULL,
stock_quantity INT NULL,
product_sales DECIMAL(10,2) NULL DEFAULT 0,
PRIMARY KEY (item_id)
);
CREATE TABLE departments(
department_id INT NOT NULL AUTO_INCREMENT,
department_name VARCHAR(45) NULL,
over_head_costs DECIMAL(10,2) NULL,
PRIMARY KEY (department_id)
);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Electronic Keyboard", "Electronics", 50.99, 2),
("Tap Shoes", "Clothing", 69.50, 4),
("Heart Pendant", "Jewelry", 49.99, 5),
("Robot", "Toys", 100.00, 10),
("Kangaroo Jammies", "Clothing", 24.99, 25),
("Mini Pool Table", "Toys", 60.00, 3),
("Laptop", "Electronics", 450.00, 10),
("Chef Hat", "Clothing", 50.00, 7),
("Cricket Earrings", "Jewelry", 25.99, 8),
("Hulk Feet", "Toys", 21.50, 6);
INSERT INTO departments (department_name, over_head_costs)
VALUES ("Electronics", 200),
("Clothing", 300),
("Jewelry", 400),
("Toys", 100); | true |
7e8dd585eab4554ed5d9625acf5ae1e3137dd449 | SQL | ainifeiyuan/copy2.0 | /app/weixin/model/wxnumber.sql | UTF-8 | 1,584 | 2.921875 | 3 | [
"MIT"
] | permissive | /*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50726
Source Host : localhost:3306
Source Database : thinkgrab
Target Server Type : MYSQL
Target Server Version : 50726
File Encoding : 65001
Date: 2020-06-03 11:24:17
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `wxnumber`
-- ----------------------------
DROP TABLE IF EXISTS `wxnumber`;
CREATE TABLE `wxnumber` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '微信号自增id',
`uid` int(11) NOT NULL COMMENT '添加管理员id',
`gid` int(11) NOT NULL COMMENT '添加组id',
`number` char(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '123456' COMMENT '微信号',
`name` char(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '微信名称',
`imgurl` char(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '二维码',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=91 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of wxnumber
-- ----------------------------
INSERT INTO `wxnumber` VALUES ('85', '1', '20', '121231132', '测试1', '');
INSERT INTO `wxnumber` VALUES ('89', '1', '22', '12313231321313', '测试redis1', '');
INSERT INTO `wxnumber` VALUES ('79', '1', '16', '123131313213', '策划书redis', '');
INSERT INTO `wxnumber` VALUES ('84', '1', '20', '131332', '测试2', '');
INSERT INTO `wxnumber` VALUES ('78', '1', '16', '123131313213', '测试redis', '');
INSERT INTO `wxnumber` VALUES ('90', '1', '22', '123132465454', '测试redis2', '');
| true |
06ee7ae8fbeb6dac7859ad49639edebdb2128ba2 | SQL | Yuele-Ji/HackerRank-SQL | /*Weather Observation Station 5.sql | UTF-8 | 183 | 3.140625 | 3 | [] | no_license | SELECT *
FROM (
SELECT CITY,LENGTH(CITY)
FROM STATION
ORDER BY 2, 1
LIMIT 1) MIN_CITY
UNION
SELECT *
FROM (
SELECT CITY,LENGTH(CITY)
FROM STATION
ORDER BY 2 DESC, 1
LIMIT 1) MAX_CITY
| true |
6c8f391dc082cb935f2b447c4551b82bb919e910 | SQL | shybkoi/WMS-Demo | /sql/161201-4-FIRSTINCOME.sql | UTF-8 | 5,628 | 3.53125 | 4 | [] | no_license |
SET TERM ^ ;
CREATE OR ALTER procedure WH_INCOMEFG_BYSTACK (
TASKID type of column WM_TASK.TASKID,
STACKID type of column SITE.SITEID,
WARESID type of column GWARES.WARESID,
MODELID type of column MODEL_STACK.MODELID,
LINEID type of column FG_PRODLINES.ID_PRODLINE,
PRODUCERID type of column OBJECT.OBJID,
PCNT type of R_NUMBER,
PQ type of R_DOUBLE,
PRODUCTDATE type of R_DATE,
BESTBEFOREDATE type of R_DATE,
IDUSER type of R_ID,
DTBEG type of R_DATETIME = current_timestamp)
AS
declare variable i type of R_NUMBER;
declare variable WHID type of column OBJECT.objid;
declare variable ZONEID type of column SITEZONE.zoneid;
declare variable MANID type of column MAN.manid;
declare variable PNUMBER type of column PALLET.number;
declare variable PBARCODE type of column PALLET.barcode;
declare variable wmsid type of column WM_SESSION.sessionid;
declare variable taskwaresid type of column wm_task_wares.taskwaresid;
declare variable ptypeid_finishgood type of column pallet_type.id;
declare variable palletid type of column PALLET.palletid;
declare variable wlincomeid type of column wareslotincomes.id;
declare variable wlotid type of column WARESLOT.wlotid;
declare variable docid type of column DOCUMENT.docid;
declare variable docid_fundincome type of column DOCUMENT.docid;
declare variable cargoid type of column CARGO.cargoid;
declare variable spCode type of column sitespecies.code;
declare variable fundincomesubtype type of column DOCSUBTYPE.code;
declare variable WUBDAYS type of R_QUANTITY;
begin
if (:pq is NULL) then
exception exc_wh_wrongamount;
select sp.code
from site s
left join sitespecies sp on sp.sitespeciesid = s.sitespeciesid
where s.siteid = :stackid
into :spCode;
if (:spcode not in ('STACK', 'B')) then
exception exc_wh_wrongsitetype;
if (:bestbeforedate is NULL) then
begin
select cast(rcU.data as double precision)*g.usebydate
from gwares g
left join r_choice rcU on rcU.chtype='P' and rcU.code=g.ubdtype
where g.waresid = :waresid
into :wubdays;
if (:wubdays is NULL) then
exception exc_wh_wrongdate;
bestbeforedate = dateadd(cast(:wubdays as integer) DAY to :productdate);
end
select t.docid
from wm_task t
where t.taskid = :taskid
into :docid;
select wh.zoneid, wh.whid, wh.manid
from wh_user_infoshort(:iduser) wh
into :zoneid, :whid, :manid;
select pl.fundincomesubtype
from fg_prodlines pl
where pl.id_prodline = :lineid
into :fundincomesubtype;
execute procedure WH_INCOMEFG_BYPALLET_FUNDINCOME(:producerid, :whid, :waresid, :productdate, :pq*:pcnt, :fundincomesubtype)
returning_values :docid_fundincome;
update or insert into docbond ( DOCBONDTID, DOC1ID, DOC2ID)
values ( (select dbt.docbondtid from docbondtype dbt where dbt.code = 'FUNDINCOME'), :docid_fundincome, :docid)
matching (DOCBONDTID, DOC1ID, DOC2ID);
select k.sid
from k_get_user_wmsessionid(:manid, 'M') k
into :wmsid;
select wh.id
from wh_paltypeid_finishgood wh
into :ptypeid_finishgood;
update or insert into wareslot(objid, zoneid, waresid, productdate, status)
values(:whid, :zoneid, :waresid, :productdate, '1')
matching(objid, zoneid, waresid, productdate)
returning wlotid
into :wlotid;
update or insert into wareslotincomes(docid, wlotid)
values(:docid, :wlotid)
matching(docid, wlotid)
returning id
into :wlincomeid;
if (:spcode = 'STACK') then
insert into site_stack(siteid, modelid, waresid, productdate, bestbeforedate)
values( :stackid, :modelid, :waresid, :productdate, :bestbeforedate);
i = 0;
while (i < :pcnt) do
begin
insert into pallet_finishprint (manid, prodlineid, waresid, productdate, quantity, bestbeforedate, producerid)
values (:manid, :lineid, :waresid, :productdate, :pq, :bestbeforedate, :producerid)
returning number, barcode
into :pnumber, :pbarcode;
insert into pallet(ptypeid, barcode, number, siteid, zoneid, objid, status)
values(:ptypeid_finishgood, :pbarcode, :pnumber, :stackid, :zoneid, :whid, '0')
returning palletid
into :palletid;
insert into wm_task_pallet(taskid, palletid, status)
values(:taskid, :palletid, '2');
select tw.taskwaresid
from wm_task_wares tw
where tw.taskid = :taskid
and tw.waresid = :waresid
into :taskwaresid;
if (:taskwaresid is Null) then
insert into wm_task_wares(taskid, waresid, status, wm_sessionid, successscan, quantity, begintime)
values(:taskid, :waresid, '1', :wmsid, :pq, :pq, :dtbeg)
returning taskwaresid
into :taskwaresid;
else
update wm_task_wares tw
set tw.status='2',
tw.successscan = coalesce(tw.successscan,0.000) + :pq,
tw.quantity = coalesce(tw.quantity,0.000) + :pq,
tw.begintime = :dtbeg,
tw.endtime = current_timestamp,
tw.wm_sessionid = :wmsid
where tw.taskwaresid = :taskwaresid;
insert into wm_task_lot(palletid, wlotid, taskwaresid, chgwli, wlincomeid, quantity, wm_sessionid)
values(:palletid, :wlotid, :taskwaresid, '1', :wlincomeid, :pq, :wmsid);
execute procedure k_get_cargoid(:docid, :waresid)
returning_values :cargoid;
if (:cargoid is NULL) then
insert into cargo(document, waresid, amount, price)
values(:docid, :waresid, :pq, 0.000);
else
update cargo cg
set cg.amount = cg.amount + :pq
where cg.cargoid = :cargoid;
i = :i + 1;
end
end^
SET TERM ; ^
| true |
8fc0d15cb542eea90ddc35eb4f05c0f84734c8cc | SQL | The-Ark-Informatics/ark | /ark-database/db-scripts/patch/1.2.0b/20150415_add_more_to_initial_revision.sql | UTF-8 | 1,893 | 2.859375 | 3 | [] | no_license | USE `audit`;
SET @REV = 1;
INSERT INTO `aud_link_study_studysite` (`ID`, `REV`, `REVTYPE`, `STUDY_ID`, `STUDY_SITE_ID`)
select `ID`, @REV, 0, `STUDY_ID`, `STUDY_SITE_ID` from `study`.`link_study_studysite`;
INSERT INTO `aud_link_study_substudy` (`ID`, `REV`, `REVTYPE`, `STUDY_ID`, `SUB_STUDY_ID`)
select `ID`, @REV, 0, `STUDY_ID`, `SUB_STUDY_ID` from `study`.`link_study_substudy`;
INSERT INTO `aud_lss_pipeline` (`ID`, `REV`, `REVTYPE`, `LSS_ID`, `PIPELINE_ID`)
select `ID`, @REV, 0, `LSS_ID`, `PIPELINE_ID` from `geno`.`lss_pipeline`;
INSERT INTO `aud_pipeline` (`ID`, `REV`, `REVTYPE`, `DESCRIPTION`, `NAME`, `STUDY_ID`)
select `ID`, @REV, 0, `DESCRIPTION`, `NAME`, `STUDY_ID` from `geno`.`pipeline`;
INSERT INTO `aud_process` (`ID`, `REV`, `REVTYPE`, `DESCRIPTION`, `END_TIME`, `NAME`, `START_TIME`, `COMMAND_ID`, `PIPELINE_ID`)
select `ID`, @REV, 0, `DESCRIPTION`, `END_TIME`, `NAME`, `START_TIME`, `COMMAND_ID`, `PIPELINE_ID` from `geno`.`process`;
INSERT INTO `aud_process_input` (`ID`, `REV`, `REVTYPE`, `INPUT_FILE_HASH`, `INPUT_FILE_LOCATION`, `INPUT_FILE_TYPE`, `INPUT_KEPT`, `INPUT_SERVER`, `PROCESS_ID`)
select `ID`, @REV, 0, `INPUT_FILE_HASH`, `INPUT_FILE_LOCATION`, `INPUT_FILE_TYPE`, `INPUT_KEPT`, `INPUT_SERVER`, `PROCESS_ID` from `geno`.`process_input`;
INSERT INTO `aud_process_output` (`ID`, `REV`, `REVTYPE`, `OUTPUT_FILE_HASH`, `OUTPUT_FILE_LOCATION`, `OUTPUT_FILE_TYPE`, `OUTPUT_KEPT`, `OUTPUT_SERVER`, `PROCESS_ID`)
select `ID`, @REV, 0, `OUTPUT_FILE_HASH`, `OUTPUT_FILE_LOCATION`, `OUTPUT_FILE_TYPE`, `OUTPUT_KEPT`, `OUTPUT_SERVER`, `PROCESS_ID` from `geno`.`process_output`;
INSERT INTO `aud_study_pedigree_config` (`ID`, `REV`, `REVTYPE`, `AGE_ALLOWED`, `DOB_ALLOWED`, `STATUS_ALLOWED`, `CUSTOM_FIELD_ID`, `STUDY_ID`)
select `ID`, @REV, 0, `AGE_ALLOWED`, `DOB_ALLOWED`, `STATUS_ALLOWED`, `CUSTOM_FIELD_ID`, `STUDY_ID` from `study`.`study_pedigree_config`;
| true |
5b7cd6c339a529fcc7cab0e846c75d9dd95acaeb | SQL | nortonlifelock/aegis | /init/migrations/1576692824_sweeping_exceptions.up.sql | UTF-8 | 1,365 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | ALTER TABLE `Ignore` MODIFY COLUMN DeviceID INT NULL;
ALTER TABLE `IgnoreAudit` MODIFY COLUMN DeviceID INT NULL;
ALTER TABLE `Ignore` ADD COLUMN OSRegex VARCHAR(100) NULL AFTER DeviceID;
ALTER TABLE `IgnoreAudit` ADD COLUMN OSRegex VARCHAR(100) NULL AFTER DeviceID;
DROP TRIGGER IgnoreAuditCreateTrigger;
DROP TRIGGER IgnoreAuditUpdateTrigger;
DROP TRIGGER IgnoreAuditDeleteTrigger;
CREATE TRIGGER IgnoreAuditCreateTrigger BEFORE INSERT ON `Ignore`
FOR EACH ROW
INSERT INTO `IgnoreAudit` select new.ID, new.SourceID, new.OrganizationID, new.TypeId, new.VulnerabilityId, new.DeviceId, new.OSRegex, new.DueDate, new.Approval, new.Active, new.Port, new.DBCreatedDate, new.DBUpdatedDate, 'CREATE', NOW();
CREATE TRIGGER IgnoreAuditUpdateTrigger AFTER UPDATE ON `Ignore`
FOR EACH ROW
INSERT INTO `IgnoreAudit` SELECT new.ID, new.SourceID, new.OrganizationID, new.TypeId, new.VulnerabilityId, new.DeviceId, new.OSRegex, new.DueDate, new.Approval, new.Active, new.Port, new.DBCreatedDate, new.DBUpdatedDate, 'UPDATE', NOW();
CREATE TRIGGER IgnoreAuditDeleteTrigger BEFORE DELETE ON `Ignore`
FOR EACH ROW
INSERT INTO `IgnoreAudit` SELECT old.ID, old.SourceID, old.OrganizationID, old.TypeId, old.VulnerabilityId, old.DeviceId, old.OSRegex, old.DueDate, old.Approval, old.Active, old.Port, old.DBCreatedDate, old.DBUpdatedDate, 'DELETE', NOW(); | true |
0518d7ed28795f8bcfb6855d1daf06908b713410 | SQL | emanuelanechei/Oracle-Email-Reports | /sql/highrise-RD_FINAL.sql | UTF-8 | 869 | 3.609375 | 4 | [] | no_license | select a.segment1
,c.subinventory_code
,c.on_hand_qty
,date_received
from mtl_system_items_b a
,apps.mtl_item_locations_kfv b
, (
select moqd.inventory_item_id
,moqd.organization_id
,moqd.subinventory_code
,moqd.locator_id
,sum(primary_transaction_quantity) on_hand_qty
,max(date_received) date_received
from mtl_onhand_quantities_detail moqd
group by moqd.inventory_item_id
,moqd.organization_id
,moqd.subinventory_code
,moqd.locator_id
) c
where a.organization_id = c.organization_id
and a.inventory_item_id = c.inventory_item_id
and a.organization_id = 85
and c.organization_id = b.organization_id (+)
and c.locator_id = b.inventory_location_id (+)
and c.subinventory_code = 'RD FINAL'
order by date_received asc | true |
30f2a1ad45e29f903c900d7ae1257c311d0714a9 | SQL | alifahfathonah/BengkelKu | /Dbase/dbservice.sql | UTF-8 | 6,153 | 2.796875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 24, 2019 at 05:50 PM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.0
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: `dbservice`
--
-- --------------------------------------------------------
--
-- Table structure for table `barang`
--
CREATE TABLE `barang` (
`kd_barang` varchar(15) NOT NULL,
`nm_barang` varchar(200) NOT NULL,
`harga_jual` int(10) NOT NULL,
`diskon` int(3) NOT NULL,
`stok` int(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang`
--
INSERT INTO `barang` (`kd_barang`, `nm_barang`, `harga_jual`, `diskon`, `stok`) VALUES
('10', 'Ban ', 80000, 0, 0),
('07084323', 'knalpot', 200000, 0, 5),
('9', 'Spion', 61000, 0, 0),
('8', 'has cnmsa', 60000, 0, 4),
('13', 'Oli B5', 45000, 0, 24),
('7', 'Oli B6', 50000, 0, 9),
('5', 'nfsfn', 35000, 0, 11),
('4', 'Oli 89', 45000, 0, 3),
('3', 'Oli B4', 70000, 10, 2),
('1', 'Oli Top 1', 90000, 10, 2),
('2', 'Oli E2', 40000, 0, 24),
('11', 'sm dfjvnjfd', 60000, 0, 18),
('12', 'sjfbs sdfjbsk', 100000, 0, 10);
-- --------------------------------------------------------
--
-- Table structure for table `jasaservice`
--
CREATE TABLE `jasaservice` (
`kd_jasa` varchar(15) NOT NULL,
`nama_jasa` varchar(100) NOT NULL,
`harga` int(10) NOT NULL,
`diskon` int(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `jasaservice`
--
INSERT INTO `jasaservice` (`kd_jasa`, `nama_jasa`, `harga`, `diskon`) VALUES
('72814', 'Ganti Oli belakang dan depan', 7500, 10),
('24234', 'Service roda dua yang rusak', 67000, 10),
('76512', 'ganti spion', 20000, 0),
('761578', 'ganti ruji', 25000, 0),
('77777', 'ganti gigi', 30000, 10),
('1231', '30', 500000, 25),
('07084233', 'ganti knalpot', 45000, 20);
-- --------------------------------------------------------
--
-- Table structure for table `transaksi`
--
CREATE TABLE `transaksi` (
`no_invoice` varchar(10) NOT NULL,
`tanggal` date NOT NULL,
`namaPelanggan` varchar(225) NOT NULL,
`no_polisi` varchar(12) NOT NULL,
`totalharga` int(11) NOT NULL,
`status` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `transaksi`
--
INSERT INTO `transaksi` (`no_invoice`, `tanggal`, `namaPelanggan`, `no_polisi`, `totalharga`, `status`) VALUES
('77', '2019-05-04', '11', '11', 0, 1),
('54', '2019-05-04', 'ol', 'vf', 0, 1),
('07081617', '2019-05-07', 'ilya', 'BN 567 N', 206300, 0),
('24054645', '0000-00-00', 'alfred', '23456', 614000, 1),
('07013428', '2019-05-07', 'al', '231', 110300, 1),
('07084411', '2019-05-07', 'Al', 'BN 3636 N', 125300, 1),
('07080818', '2019-05-07', 'ali', 'N 77 K5', 130000, 0);
-- --------------------------------------------------------
--
-- Table structure for table `transaksi_item`
--
CREATE TABLE `transaksi_item` (
`id` int(5) NOT NULL,
`no_invoice` varchar(10) NOT NULL,
`kode` varchar(15) NOT NULL,
`jenis_transaksi` varchar(1) NOT NULL,
`jumlah` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `transaksi_item`
--
INSERT INTO `transaksi_item` (`id`, `no_invoice`, `kode`, `jenis_transaksi`, `jumlah`) VALUES
(174, '7081617', '24234', '1', 1),
(160, '7013428', '24234', '1', 1),
(159, '7013428', '7', '0', 1),
(175, '7081617', '76512', '1', 1),
(91, '54', '72814', '1', 1),
(92, '54', '24234', '1', 1),
(93, '54', '7', '0', 1),
(94, '77', '77777', '1', 1),
(96, '77', '2', '0', 2),
(166, '7014428', '13', '0', 1),
(165, '7014428', '1231', '1', 1),
(178, '7084411', '24234', '1', 1),
(179, '7084411', '76512', '1', 1),
(180, '7084411', '7084323', '0', 1),
(181, '7084411', '13', '0', 1),
(182, '24054645', '76512', '1', 1),
(183, '24054645', '77777', '1', 1),
(184, '24054645', '1', '0', 7),
(177, '7081617', '1', '0', 1),
(176, '7081617', '4', '0', 1),
(173, '7080818', '4', '0', 2),
(172, '7080818', '76512', '1', 1),
(171, '7080818', '76512', '1', 1);
--
-- Triggers `transaksi_item`
--
DELIMITER $$
CREATE TRIGGER `penambahan stok` AFTER DELETE ON `transaksi_item` FOR EACH ROW BEGIN
UPDATE barang set barang.stok = barang.stok + OLD.jumlah where barang.kd_barang = OLD.kode;
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `pengurangan stok` AFTER INSERT ON `transaksi_item` FOR EACH ROW BEGIN
UPDATE barang SET barang.stok = barang.stok - new.jumlah WHERE barang.kd_barang = NEW.kode;
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`userid` varchar(20) NOT NULL,
`password` varchar(200) NOT NULL,
`nama` varchar(100) NOT NULL,
`level` enum('kasir','admin') NOT NULL DEFAULT 'kasir'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`userid`, `password`, `nama`, `level`) VALUES
('admin', '123', 'Wahyu', 'admin');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `barang`
--
ALTER TABLE `barang`
ADD PRIMARY KEY (`kd_barang`);
--
-- Indexes for table `jasaservice`
--
ALTER TABLE `jasaservice`
ADD PRIMARY KEY (`kd_jasa`);
--
-- Indexes for table `transaksi`
--
ALTER TABLE `transaksi`
ADD PRIMARY KEY (`no_invoice`);
--
-- Indexes for table `transaksi_item`
--
ALTER TABLE `transaksi_item`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`userid`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `transaksi_item`
--
ALTER TABLE `transaksi_item`
MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=185;
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 |
ef69fb4ab3170a80963e5b4fa7ce80f3cc0035e6 | SQL | LoreenaLiu/Jianghu_data_edit | /altertable.sql | UTF-8 | 1,867 | 3.828125 | 4 | [] | no_license |
-- 把几个商家加入分类alter
insert into user_cate (user_id,cate_id) values (5002,8), (5003,19),(5004,22),(5005,32),(5006,26),(5007,19),(5008,15);
select * from hobbies;
show triggers;
-- set up trigger of update hobbies category name reference to categories table
set sql_safe_updates = 0; -- set up safe update mode
update hobbies inner join (select name, id from categories) cate on
hobbies.cate_id=cate.id set hobbies.category_name=cate.name; -- test
DELIMITER $$
CREATE TRIGGER after_hobbies_update
AFTER UPDATE ON hobbies
FOR EACH ROW
BEGIN
update hobbies inner join (select name, id from categories) cate
on hobbies.cate_id=cate.id set hobbies.category_name=cate.name;
END$$
DELIMITER ; -- create the trigger
show triggers; -- show the trigger list
-- delete 391
/* edit the constraint of comments hobbie_id */
ALTER TABLE comments DROP FOREIGN KEY `comments_hobby_id_foreign` ;
ALTER TABLE comments
ADD CONSTRAINT `comments_hobby_id_foreign`
FOREIGN KEY (`hobby_id` )
REFERENCES hobbies (`id` )
ON DELETE CASCADE
ON UPDATE RESTRICT;
/* edit the constraint of like hobbie_id */
ALTER TABLE likes DROP FOREIGN KEY `likes_hobby_id_foreign` ;
ALTER TABLE likes
ADD CONSTRAINT `likes_hobby_id_foreign`
FOREIGN KEY (`hobby_id` )
REFERENCES hobbies (`id` )
ON DELETE CASCADE
ON UPDATE RESTRICT;
delete from activities where id = 343;
delete from hobbies where id in(392,393,394,395,396,397,398,399,400);
show triggers;
drop trigger after_hobbies_update;
-- 19/11/2018
/* edit the constraint of comments_target_user_foreign */
ALTER TABLE meljianghu_main.comments DROP FOREIGN KEY `comments_target_user_foreign` ;
ALTER TABLE meljianghu_main.comments
ADD CONSTRAINT `comments_target_user_foreign`
FOREIGN KEY (`target_user` )
REFERENCES users (`id` )
ON DELETE CASCADE
ON UPDATE RESTRICT;
| true |
fc80d71092283830b48b05c0162bd02899cb8b1a | SQL | hikaru2025/xmodule | /xmodule-examples-clickhouse/xmodule-examples-clickhouse-samples/src/test/resources/stackoverflow_user.sql | UTF-8 | 518 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | CREATE TABLE stackoverflow_user
(
id UInt64,
name String,
reputation UInt32,
websiteUrl String,
location String,
aboutMe String,
views UInt32,
upVotes UInt32,
downVotes UInt32,
profileImageUrl String,
lastAccessTime DateTime,
createTime DateTime,
createDate Date DEFAULT toDate(createTime)
)
ENGINE = MergeTree()
PARTITION BY toYYYYMMDD(createDate)
ORDER BY (id, name, reputation, location, views, upVotes, downVotes, lastAccessTime, createTime); | true |
a583cd826a7bfae88e78219e7653081e61543e00 | SQL | RonNakata/bamazon | /schema.sql | UTF-8 | 314 | 3.140625 | 3 | [] | no_license | DROP DATABASE IF EXISTS bamazonDB;
CREATE database bamazonDB;
USE bamazonDB;
CREATE TABLE products (
item_id INT(7) AUTO_INCREMENT NOT NULL,
product_name VARCHAR(24) NOT NULL,
department_name VARCHAR(12) NOT NULL,
price DECIMAL(7,2) NOT NULL,
stock_quantity INT(5) NOT NULL,
PRIMARY KEY (item_id)
);
| true |
fd400bdeb7447a28a8d8ecb173df2ea2ab7f14c9 | SQL | xmalmorthen/estadisticosGob | /wsPHP/wsAPIEstadisticosGob/projectResources/database/dbestadisticosgob.sql | UTF-8 | 4,282 | 3.28125 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50723
Source Host : localhost:3306
Source Database : dbestadisticosgob
Target Server Type : MYSQL
Target Server Version : 50723
File Encoding : 65001
Date: 2019-04-01 16:25:21
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for cadependencias
-- ----------------------------
DROP TABLE IF EXISTS `cadependencias`;
CREATE TABLE `cadependencias` (
`id` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
`nombre` varchar(500) NOT NULL,
`fIns` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`fAct` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`idRefService` varchar(15) NOT NULL COMMENT 'Id original proveniente del servicio\r\n\r\nhttp://www.tramitesyservicios.col.gob.mx/retys_rest/index.php/retys/getDependencias/format/xml\r\n\r\n"Id_Ads"',
PRIMARY KEY (`id`),
KEY `idx_id` (`id`),
KEY `idx_idRefService` (`idRefService`),
KEY `idx_nombre` (`nombre`),
FULLTEXT KEY `idx_ft_nombre` (`nombre`)
) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for cakioscos
-- ----------------------------
DROP TABLE IF EXISTS `cakioscos`;
CREATE TABLE `cakioscos` (
`id` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
`nombre` varchar(500) NOT NULL,
`fIns` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`fAct` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'Id original proveniente del servicio\r\n\r\nhttps://www.secfin.col.gob.mx/wsKioscos/index.php/apiV1/obtener/kioscos.json\r\n\r\nid_kiosco\r\n\r\n',
`idRefService` int(11) NOT NULL COMMENT 'Id original proveniente del servicio\r\n\r\nhttps://www.secfin.col.gob.mx/wsKioscos/index.php/apiV1/obtener/kioscos.json',
PRIMARY KEY (`id`),
KEY `idx_id` (`id`),
KEY `idx_nombre` (`nombre`),
KEY `idx_idRefService` (`idRefService`) USING HASH,
FULLTEXT KEY `idx_ft_nombre` (`nombre`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for catramites
-- ----------------------------
DROP TABLE IF EXISTS `catramites`;
CREATE TABLE `catramites` (
`id` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
`nombre` varchar(500) NOT NULL,
`tipoTramite` tinyint(4) NOT NULL COMMENT '1 = línea\r\n2 = tramite o servicio',
`fIns` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`fAct` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`idRefService` int(11) NOT NULL COMMENT 'Id original proveniente del servicio\r\n\r\nhttp://www.openapis.col.gob.mx/serviciosenlinea/index.php/rest/getTramite/9/format/json\r\n\r\nhttp://www.tramitesyservicios.col.gob.mx/retys_rest/index.php/retys/getTramite/format/xml?idTramite=1422\r\n\r\n',
PRIMARY KEY (`id`),
KEY `idx_id` (`id`) USING BTREE,
KEY `idx_nombre` (`nombre`) USING BTREE,
KEY `idx_idRefService` (`idRefService`) USING BTREE,
FULLTEXT KEY `idx_ft_nombre` (`nombre`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for maregistrotramites
-- ----------------------------
DROP TABLE IF EXISTS `maregistrotramites`;
CREATE TABLE `maregistrotramites` (
`id` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
`idTramite` int(10) unsigned zerofill NOT NULL,
`idKiosco` int(10) unsigned zerofill DEFAULT NULL,
`idDependencia` int(10) unsigned zerofill DEFAULT NULL,
`cveEntidad` varchar(40) DEFAULT NULL,
`cveMunicipios` varchar(40) DEFAULT NULL,
`cveLocalidades` varchar(40) DEFAULT NULL,
`fIns` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `fk_Tramite` (`idTramite`),
KEY `fk_kioscos` (`idKiosco`),
KEY `fk_dependencia` (`idDependencia`),
CONSTRAINT `fk_Tramite` FOREIGN KEY (`idTramite`) REFERENCES `catramites` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_dependencia` FOREIGN KEY (`idDependencia`) REFERENCES `cadependencias` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_kioscos` FOREIGN KEY (`idKiosco`) REFERENCES `cakioscos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
| true |
7682e25dca9554df55a0fc485b8571bdd67883c7 | SQL | DePalmaJared91/Bamazon | /bamazon.sql | UTF-8 | 1,072 | 3.640625 | 4 | [] | no_license | DROP DATABASE IF EXISTS bamazon_db;
CREATE DATABASE bamazon_db;
USE bamazon_db;
CREATE TABLE products
item_id INTEGER(11) NOT NULL AUTO_INCREMENT,
product_name VARCHAR(30) NOT NULL,
department_name INTEGER (11) NOT NULL,
price DECIMAL (10,2) NOT NULL,
stock_quantity INTEGER(1000) NOT NULL,
PRIMARY KEY ('item_id'),
KEY department_id ('department_id')
SELECT * FROM products;
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ('SK Lacrosse Stick', 'Athletics', 109.99, 500),
('STX Lacrosse Shaft', 'Athletics', 99.99, 250),
('Jordan Shoes', 'Athletics', 150.99, 200),
('Wilson Volleyball', 'Athletics', 29.99, 1000),
('Rabil5 Lacrosse Head', 'Athletics', 109.99, 350),
('UA Curry Shoes', 'Athletics', 139.99, 300),
('Brine f55 Shaft', 'Athletics', 121.99, 125),
('Nikola Jokic Jersey', 'Athletics', 109.99, 400),
('baseball bat', 'Athletics', 89.99, 125),
('baseball glove', 'Athletics', 69.99, 55);
DELETE t1 FROM products t1
INNER JOIN products t2
WHERE t1.item_id < t2.item_id AND t1.product_name = t2.product_name;
| true |
fcd541b46c137f1e0cf35a3c3cd5d421d0496d0f | SQL | hkcyl123/JSP | /ks.sql | UTF-8 | 3,868 | 3.6875 | 4 | [] | no_license | drop database if exists ks;
create database ks;
use ks;
CREATE TABLE User (
UID INT NOT NULL PRIMARY KEY AUTO_INCREMENT , #用户ID
Uname VARCHAR(15) NOT NULL UNIQUE , #用户名
password VARCHAR(20) NOT NULL , #密码
UEmail VARCHAR(20) NOT NULL , #电子邮箱
UBirthday VARCHAR(20) NOT NULL , #生日
USex VARCHAR(4) NOT NULL , #性别
USatement VARCHAR(45) NULL #用户备注
);
CREATE TABLE bbssession (
SID INT NOT NULL PRIMARY KEY AUTO_INCREMENT , #板块ID
Sname VARCHAR(45) NOT NULL , #板块名称
UID INT NOT NULL , #版主ID
STopicCount INT NOT NULL , #发帖数
constraint fk_1 foreign key(UID) references User(UID) );
CREATE TABLE bbstopic (
TID INT NOT NULL PRIMARY KEY AUTO_INCREMENT , #发帖表ID
SID INT NOT NULL , #板块ID
UID INT NOT NULL , #发帖人ID
ReplyCount INT NOT NULL , #回复数
Topic VARCHAR(50) NOT NULL , #标题
TCountents VARCHAR(100) NOT NULL , #正文
TTime VARCHAR(20) NOT NULL , #时间
constraint fk_2 foreign key(UID) references User(UID) ,
constraint fk_3 foreign key(SID) references bbssession(SID));
CREATE TABLE bbsreply (
RID INT NOT NULL PRIMARY KEY AUTO_INCREMENT , #跟帖表ID
TID INT NOT NULL , #主贴ID
UID INT NOT NULL , #跟帖人ID
RContent VARCHAR(100) NOT NULL , #跟帖内容
RTime VARCHAR(20) NOT NULL , #回帖时间
constraint fk_4 foreign key(TID) references bbstopic(TID) ,
constraint fk_5 foreign key(UID) references User(UID));
create view v1 as select
bbstopic.TID as TID ,
bbstopic.SID as SID ,
user.Uname as Uname ,
bbstopic. ReplyCount as ReplyCount ,
bbstopic.Topic as Topic ,
bbstopic.TCountents as TCountents ,
bbstopic.TTime as Time
FROM bbstopic , user
WHERE bbstopic.UID = user.UID ;
create view v2 as select
bbsreply.RID as RID ,
bbsreply.TID as TID ,
user.Uname as Uname ,
bbsreply. RContent as RContent ,
bbsreply.RTime as RTime
FROM bbsreply , user
WHERE bbsreply.UID = user.UID ;
INSERT INTO user
VALUES ("1","黄凯成","123","123","123","123","123") ;
INSERT INTO user
VALUES ("2","郑佳东","123","123","123","123","123") ;
INSERT INTO user
VALUES ("3","祝祯浩","123","123","123","123","123") ;
INSERT INTO user
VALUES ("4","王茂俊","123","123","123","123","123") ;
INSERT INTO user
VALUES ("5","555","123","123","123","123","123") ;
INSERT INTO bbssession
VALUES ("1","C","1","123") ;
INSERT INTO bbssession
VALUES ("2","Java","2","123") ;
INSERT INTO bbssession
VALUES ("3","Web","3","123") ;
INSERT INTO bbssession
VALUES ("4","Python","4","123") ;
INSERT INTO bbssession
VALUES ("5","Andriod","5","123") ;
INSERT INTO bbstopic
VALUES ("1","1","1","123","123","123","123") ;
INSERT INTO bbstopic
VALUES ("2","2","2","123","123","123","123") ;
INSERT INTO bbstopic
VALUES ("3","3","3","123","123","123","123") ;
INSERT INTO bbstopic
VALUES ("4","4","4","123","123","123","123") ;
INSERT INTO bbstopic
VALUES ("5","5","5","123","123","123","123") ;
INSERT INTO bbsreply
VALUES ("1","1","1","123","123") ;
INSERT INTO bbsreply
VALUES ("2","2","2","123","123") ;
INSERT INTO bbsreply
VALUES ("3","3","3","123","123") ;
INSERT INTO bbsreply
VALUES ("4","4","4","123","123") ;
INSERT INTO bbsreply
VALUES ("5","5","5","123","123") ; | true |
0270b49f6b9cad4421babc8609eea50d5167a804 | SQL | benamrou/GOLDEYC | /80.GOLD Alerts/804.Interfaces/N3_MVTIN.sql | UTF-8 | 1,457 | 3.453125 | 3 | [] | no_license | select mi3donord as "Code entrepot",
mi3datmvt as "Date mvt",
mi3codinv as "Code utilsateur",
mi3codcli as "Code tier",
mi3qteuvc as "Qte",
mi3numorc as "Num mvt",
mi3cproin as "Code article",
mi3ilogis as "VL",
tsobdesc as "Libelle",
nvl((select TPARLIBL from stoentre, cfdendoc, cfdenfac, tra_parpostes where tparcmag = 0 and tpartabl = 224 and tparpost = efaetat and langue = 'FR' and lpad(sernusr,7,'0') = lpad(to_char(mi3numorc),7,'0') and edccexcde = sercexcde and edcndoc = sercinrec and edcrfou = efarfou and rownum = 1 ), 'Non receptionee ou article inexistant BRV') as "Etat BRV",
nvl((select SUM (NVL(storeai,0) + NVL(storeal,0) - NVL(storeav,0) + NVL(storeae,0) + NVL(storeac,0) - NVL(storear,0)) CINR from stocouch where stosite = mi3donord and stocinr = artcinr), 0) as "Stock dispo UVC"
from n3_mvtin e, artrac, tra_strucobj
where mi3cproin = artcexr
and tsobcint = artcinr
and langue = 'FR'
and exists (select 1
from tmc_n3_mvtin h
where e.mi3numorc = h.mi3numorc
--and e.mi3nolign = h.mi3nolign
--and e.mi3bdlfou = h.mi3bdlfou
and e.mi3codcli = h.mi3codcli
and e.mi3cproin = h.mi3cproin
and e.mi3datmvt = h.mi3datmvt
and h.tmc_OPERATION = 'INS'
and h.tmc_datetime < sysdate - 1 / (24))
order by mi3datmvt, mi3numorc, mi3nolign, mi3cproin | true |
7cc70794534484322af33aadb65de4d4c66c09ba | SQL | kenny08gt/bases2Proyecto | /random/g4/sp_grupo4.sql | UTF-8 | 8,614 | 3.15625 | 3 | [] | no_license | BEGIN
DECLARE done INT DEFAULT 0;
declare current_id int;
declare c_usuario varchar(30);
declare c_nombre_us varchar(30);
declare c_apellido varchar(30);
declare c_rol int;
declare c_password varchar(20);
declare c_correo varchar(40);
declare c_comentario int;
declare c_contenido varchar(250);
declare c_calificacion int;
declare c_servicio int;
declare c_nombre_est varchar(40);
declare c_establecimiento int;
declare c_tipoest_est int;
declare c_posicion varchar (40);
declare c_tiponombre varchar (40);
declare c_oficial int;
declare c_punteo_est int;
declare c_longitud float(10,10);
declare c_latitud float(10,10);
declare c_caracteristica int;
declare c_nombre_car varchar(20);
declare c_duracion varchar(10);
declare c_categoria int;
declare c_nombre_cat varchar(20);
declare c_dimension int;
declare c_nombre_dim varchar(20);
declare c_reserva int;
declare c_fecha datetime;
declare c_usuario_res int;
declare c_servicio_res int;
declare c_nombre_ser varchar(20);
declare c_dimension_cat int;
declare c_prereserva int;
declare uppre_cur cursor for select distinct reserva, servicio_res from grupo4 where reserva is not null;
declare upcat_cur cursor for select distinct servicio_detser, caracteristica_detser from grupo4 where servicio_detser is not null;
declare cate2_cur cursor for select distinct categoria, dimension_cat from grupo4 where categoria is not null;
declare cal2_cur cursor for select distinct calificacion from grupo4 where calificacion is not null;
declare estser_cur cursor for select distinct establecimiento_ser, tiposer_ser from grupo4 where establecimiento_ser is not null;
declare dimest_cur cursor for select distinct dimension_dimest, establecimiento_dimenst from grupo4 where dimension_dimest is not null;
declare servicio_cur cursor for select distinct servicio,nombre_ser from grupo4 where servicio is not null;
declare reserva_cur cursor for select distinct reserva, fecha, usuario_res,servicio_res from grupo4 where reserva is not null;
declare dim_cur cursor for select distinct dimension, nombre_dim from grupo4 where dimension is not null;
declare cate_cur cursor for select distinct categoria, nombre_cat from grupo4 where categoria is not null;
declare cara_cur cursor for select distinct caracteristica, nombre_car, duracion from grupo4 where caracteristica is not null;
declare establecimiento_cur cursor for select distinct establecimiento,nombre_est,tipoest_est,posicion,nombre_tipest,oficial,punteo_est from grupo4 where establecimiento is not null and tipoest_est=tipo_establecimiento;
declare calificacion_cur cursor for select distinct calificacion,punteo_cal,servicio_cal,comentario_cal from grupo4 where calificacion is not null;
declare cur cursor for select distinct id_usuario,usuario,nombre_us,apellido,rol,password from grupo4 WHERE id_usuario IS NOT NULL;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
open cur;
set done = 0;
start_loop: loop
fetch cur into current_id,c_usuario,c_nombre_us,c_apellido,c_rol,c_password;
IF done = 1 THEN
LEAVE start_loop;
END IF;
set current_id=current_id+100;
set c_nombre_us=CONCAT(c_nombre_us," ",c_apellido);
set c_correo=CONCAT(c_usuario,'_',c_apellido,'@correo.com');
insert into usuario (id_usuario,Nombre,correo,telefono,Rol,id_establecimiento,password) values (current_id,c_nombre_us,c_correo,112233,'normal',NULL,c_password);
end loop;
close cur;
open calificacion_cur;
set done=0;
calificacion_loop: loop
fetch calificacion_cur into c_comentario,c_calificacion,c_servicio,c_contenido;
IF done = 1 THEN
LEAVE calificacion_loop;
END IF;
set c_comentario=c_comentario+100;
insert into comentario (id_comentario,contenido,calificacion) values (c_comentario,c_contenido,c_calificacion);
end loop;
close calificacion_cur;
open establecimiento_cur;
set done=0;
esta_loop:loop
fetch establecimiento_cur into c_establecimiento,c_nombre_est,c_tipoest_est, c_posicion,c_tiponombre,c_oficial,c_punteo_est;
IF done = 1 THEN
LEAVE esta_loop;
END IF;
set c_establecimiento=c_establecimiento+100;
select SUBSTRING_INDEX(c_posicion,',',-1) into c_longitud;
select SUBSTRING_INDEX(c_posicion,',',1) into c_latitud;
insert into establecimiento (id_establecimiento,nombre,tipo,longitud,latitud,oficial,calificacion_general) values(c_establecimiento,c_nombre_est,c_tiponombre,c_longitud+0,c_latitud+0,c_oficial,c_punteo_est);
end loop;
close establecimiento_cur;
open cara_cur;
set done = 0;
cara_loop: loop
fetch cara_cur into c_caracteristica, c_nombre_car,c_duracion;
IF done = 1 THEN
LEAVE cara_loop;
END IF;
set c_caracteristica=c_caracteristica+100;
insert into caracteristica (id_caracteristica,nombre,valor) values (c_caracteristica,c_nombre_car,c_duracion);
end loop;
close cara_cur;
open cate_cur;
set done = 0;
cate_loop: loop
fetch cate_cur into c_categoria, c_nombre_cat;
IF done = 1 THEN
LEAVE cate_loop;
END IF;
set c_categoria=c_categoria+100;
insert into categoria (id_categoria,nombre) values (c_categoria,c_nombre_cat);
end loop;
close cate_cur;
open dim_cur;
set done = 0;
dim_loop: loop
fetch dim_cur into c_dimension, c_nombre_dim;
IF done = 1 THEN
LEAVE dim_loop;
END IF;
set c_dimension=c_dimension+100;
insert into dimension (id_dimension,nombre) values (c_dimension,c_nombre_dim);
end loop;
close dim_cur;
open reserva_cur;
set done = 0;
reserva_loop: loop
fetch reserva_cur into c_reserva, c_fecha,c_usuario_res,c_servicio_res;
IF done = 1 THEN
LEAVE reserva_loop;
END IF;
set c_reserva=c_reserva+100;
select id_usuario from (select distinct id_usuario,usuario from grupo4 where id_usuario is not null and usuario =(select distinct usuario from (select distinct reserva,usuario_res as 'usuario' from grupo4 where reserva is not null )aw) )awe into c_usuario_res;
set c_usuario_res=c_usuario_res+100;
insert into prereserva (id_preresrva,horayfecha,id_usuario) values (c_reserva,c_fecha,c_usuario_res);
end loop;
close reserva_cur;
open servicio_cur;
set done = 0;
servicio_loop: loop
fetch servicio_cur into c_servicio, c_nombre_ser;
IF done = 1 THEN
LEAVE servicio_loop;
END IF;
set c_servicio=c_servicio+100;
insert into servicio (id_servicio,nombre) values (c_servicio,c_nombre_ser);
end loop;
close servicio_cur;
open dimest_cur;
set done = 0;
dimest_loop: loop
fetch dimest_cur into c_dimension,c_establecimiento;
IF done = 1 THEN
LEAVE dimest_loop;
END IF;
set c_dimension=c_dimension+100;
set c_establecimiento=c_establecimiento+100;
insert into establecimiento_dimension (id_establecimiento,id_dimension) values (c_establecimiento,c_dimension);
end loop;
close dimest_cur;
open estser_cur;
set done = 0;
estser_loop: loop
fetch estser_cur into c_establecimiento,c_servicio;
IF done = 1 THEN
LEAVE estser_loop;
END IF;
set c_servicio=c_servicio+100;
set c_establecimiento=c_establecimiento+100;
insert into establecimiento_servicio (id_establecimiento,id_servicio) values (c_establecimiento,c_servicio);
end loop;
close estser_cur;
set done = 0;
open cal2_cur;
start_loop: loop
fetch cal2_cur into c_calificacion;
IF done = 1 THEN
LEAVE start_loop;
END IF;
set c_calificacion=c_calificacion+100;
call update_comentario(c_calificacion);
end loop;
close cal2_cur;
open cate2_cur;
set done = 0;
cate2_loop: loop
fetch cate2_cur into c_categoria,c_dimension_cat;
IF done = 1 THEN
LEAVE cate2_loop;
END IF;
set c_categoria=c_categoria+100;
set c_dimension_cat=c_dimension_cat+100;
update establecimiento_dimension set id_categoria=c_categoria where id_dimension=c_dimension_cat;
end loop;
close cate2_cur;
open upcat_cur;
set done = 0;
upcat_loop: loop
fetch upcat_cur into c_servicio,c_caracteristica;
IF done = 1 THEN
LEAVE upcat_loop;
END IF;
set c_servicio=c_servicio+100;
set c_caracteristica=c_caracteristica+100;
update caracteristica set id_servicio=c_servicio where id_caracteristica=c_caracteristica;
end loop;
close upcat_cur;
open uppre_cur;
set done = 0;
uppre_loop: loop
fetch uppre_cur into c_prereserva,c_servicio;
IF done = 1 THEN
LEAVE uppre_loop;
END IF;
set c_prereserva=c_prereserva+100;
set c_servicio=c_servicio+100;
update prereserva set id_establecimiento_servicio=(select id_establecimiento_servicio from establecimiento_servicio where id_servicio=c_servicio limit 1) where id_preresrva=c_prereserva;
end loop;
close uppre_cur;
END
| true |
1fe2c276bc2c3fd817ae1685bfb41a8b9cacf468 | SQL | AlinaGomeniuc/Data-Base | /Lab4/CodeSQL/SQLQuery_ex13.sql | UTF-8 | 274 | 3.1875 | 3 | [] | no_license | SELECT DISTINCT Disciplina
FROM discipline
INNER JOIN studenti_reusita
ON discipline.Id_Disciplina = studenti_reusita.Id_Disciplina
INNER JOIN studenti
ON studenti_reusita.Id_Student = studenti.Id_Student
WHERE Nume_Student = 'Florea'
AND Prenume_Student = 'Ioan' | true |
d26da7962f0193302a70a96ba8f2fbd41347ea28 | SQL | thanhth89/sample_module_atb | /sample_atb.sql | UTF-8 | 1,669 | 3.25 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : wdn_local
Source Server Version : 50505
Source Host : localhost:3306
Source Database : sample_atb
Target Server Type : MYSQL
Target Server Version : 50505
File Encoding : 65001
Date: 2019-03-22 11:07:18
*/
CREATE DATABASE sample_atb;
USE sample_atb;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for amount
-- ----------------------------
DROP TABLE IF EXISTS `amount`;
CREATE TABLE `amount` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`msisdn` varchar(25) NOT NULL,
`money` int(10) NOT NULL,
`created_time` datetime DEFAULT NULL,
`updated_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `msisdn` (`msisdn`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
-- ----------------------------
-- Records of amount
-- ----------------------------
INSERT INTO `amount` VALUES ('1', '84369803686', '45000', '2019-03-22 01:31:45', '2019-03-22 01:31:45');
-- ----------------------------
-- Table structure for transaction
-- ----------------------------
DROP TABLE IF EXISTS `transaction`;
CREATE TABLE `transaction` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`request_id` varchar(50) NOT NULL,
`msisdn` varchar(25) NOT NULL,
`action` varchar(10) NOT NULL,
`price` int(10) NOT NULL,
`created_time` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `msisdn` (`msisdn`) USING BTREE,
KEY `request_id` (`request_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
-- ----------------------------
-- Records of transaction
-- ----------------------------
| true |
5d51ce98c1fd1a8edf368f0ba6bdcf9efc89c741 | SQL | UknowYunmo/SQL-STUDY | /index/002 - 인덱스 원리, 힌트.sql | UHC | 4,363 | 3.765625 | 4 | [] | no_license | ͺ̽ ε(INDEX) ˾ƾ ϴ :
ε ˾ƾ ˻ ְ, ӵ ſ ſ ߿ϴ.
20 ---> 0.01 : SQL Ʃ
0.1 ---> 0.01 : SQL Ʃ --> ε ϰ, Ȱ ־Ѵ.
ε : ÷ + rowid ( row ּ )
+ ÷ Ǿִ.
** 뷮 Ͱ ִ ȯ濡 SQL ߴµ
ʹ ٸ ݵ ȹ Ȯؼ full table scan ߴ, index scan ߴ Ȯ ؾѴ.
SQL տ explain plan for ̰
ȹ Ȯϴ table ȸ.
explain plan for
select ename, sal
from emp
where ename='SCOTT'
select * from table(dbms_xplan.display);
ڼ INDEX RANGE SCAN Ȯ ִ.
FULL TABLE SCAN SCOTT ˻ϱ EMP ̺ ó ĵߴٴ ̴.
ȹ Ƽ μ ִµ
μ ΰȭ Ǿ ִ.
explain plan for
select /*+ index(emp emp_ename) */ ename, sal
from emp
where ename='SCOTT';
/*+ ȹ ϴ ɾ */ -->> Ʈ
emp ̺ ִ emp_ename ε ؼ ˻ ض
Ʈ ༭ Ƽ .
**[[[+ ʵ !!]]]
: ̺ ε ϰ, ̺ ˻ϴµ 3000 ̸ ˻
create index emp_sal
on emp(sal);
select ename, sal
from emp
where sal = 3000;
select * from table(dbms_xplan.display); ( ȹ Ȯ )
* Ŭصΰ F10 ȹ Ȯ ִ.
** ε ϱ
select ename, sal
from emp
where ename='BLAKE';
Ϲ ε SQL full table scan̴.
ֳϸ SCOTT ִ ˷ ϴ ϱ .
SCOTT ϱ.
ݸ
INDEX scan ABCD Ǿֱ BLAKE A ãƼ ã , ROWID .
ü ̺ ROWID ִ ÷ ȯѴ.
index scan ̺ DZ ȯ ξ .
ε о
1. > ' '
2. >= 0
3. ¥ <= to_date('9999/12/31','RRRR/MM/DD')
WHERE ־ ε ü о ִ.
ε ˸ SQL Ʃ ִµ ϳ
order by ʰ ĵ ִٴ ̴.
order by ϸ ˻ .
ü Ѵٴ ð ɸ
: ̸ ϱ
1. order by
select ename, sal
from emp
order by sal asc;
2. ε
select ename, sal
from emp
where sal>0;
3. Ʈ ( ε ʾҴٸ )
select /*+ index_asc(emp emp_sal) */ ename, sal
from emp
where sal>=0;
** ε ؼ ĵ
where ݵ ش ÷ ˻ϴ ־ϰ,
Ʈ شٸ Ȯϰ ĵ ִ.
/*+ index_asc(̺ ε̸) */
/*+ index_desc(̺ ε̸) */
: ̸ ϴ ϱ (ε )
select /*+ index_desc(emp emp_sal) */ ename, sal
from emp
where sal>=0;
: Ի ֱ ̸ Ի ϱ
select /*+ index_desc(emp emp_hiredate) */ ename, hiredate
from emp
where hiredate<= to_date('9999/12/31','RRRR/MM/DD') | true |
b1de1be0333a88a6ae94f1bccb797c545416c957 | SQL | taepodong1101/apex | /top_tablespace_usage.sql | UTF-8 | 504 | 3.625 | 4 | [] | no_license | select d.tablespace_name "TABLESPACE",
sum(d.bytes)/1048576 "SIZE(M)",
sum(d.bytes)/1048576 - b.FREESPCE "USEDSIZE(M)",
b.FREESPCE "FREE SPACE(M)",
100 -(round((FREESPCE/(sum(d.bytes)/1048576))*100)) "USED(%)"
FROM dba_data_files d,
(SELECT round(sum(f.bytes)/1048576,2) FREESPCE,
f.tablespace_name Tablespc
FROM dba_free_space f
GROUP BY f.tablespace_name) b
WHERE d.tablespace_name = b.Tablespc
group by d.tablespace_name,b.FREESPCE | true |
46615df349ef34b3b93f3843320fb4a3c78835ed | SQL | muntaza/Open_Persediaan | /sql1_persediaan/persediaan_rinci_sql/persediaan_barang4_halong.sql | UTF-8 | 377 | 2.734375 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | DROP VIEW IF EXISTS view_persediaan_barang4_halong;
CREATE VIEW view_persediaan_barang4_halong AS
SELECT
*,
saldo * harga AS jumlah_harga
FROM
view_persediaan_barang3_halong
WHERE
1 = 1 AND
saldo > 0 AND
id_skpd = 35;
GRANT ALL PRIVILEGES ON view_persediaan_barang4_halong TO lap_halong;
REVOKE INSERT, UPDATE, DELETE ON view_persediaan_barang4_halong FROM lap_halong;
| true |
4f657edcaa218a60180e58f02f49ab44d4fab60d | SQL | FabiMacedo/Academia_Marketdata | /Aulas/Aula30_15-07-21/Mão na massa em Grupo - Procedure.sql | ISO-8859-1 | 795 | 3.65625 | 4 | [
"MIT"
] | permissive | --Mo na massa em Grupo - Procedure
--Coloque seu BD em uso
USE fabiana
/*Crie uma procedure SP_COMPRAS no seu BD que:
*Cria uma tabela TB_VENDAS com as vendas dos X ltimos
dias (quantidade passada por parmetro)
* Lembre-se de excluir a tabela, caso ela j exista
Execute a procedure com parmetro de 30 dias;
Execute a procedure com parmetro de 60 dias;
Execute a procedure com parmetro de 90 dias;*/
CREATE PROCEDURE SP_COMPRAS @QTDE_DIAS_VENDAS INT
AS
BEGIN
DROP TABLE IF EXISTS fabiana.TB_VENDAS
SELECT *
INTO TB_VENDAS
FROM DB_MADA_VAREJO..TB_VENDA
WHERE DATEDIFF(DAY,DT_VENDA,GETDATE()) <= @QTDE_DIAS_VENDAS
END
select * from TB_VENDAS
EXECUTE fabiana.DBO.SP_COMPRAS 30
EXECUTE fabiana.DBO.SP_COMPRAS 60
EXECUTE fabiana.DBO.SP_COMPRAS 90
| true |
8f1e2751b797bb3c0a9db7c1ffc21dbe95bbb4bc | SQL | BOYER5303/SQL1-Afternoon | /init.sql | UTF-8 | 939 | 4.03125 | 4 | [] | no_license | --Create Statement
CREATE TABLE students (
id SERIAL PRIMARY KEY,
name TEXT,
email VARCHAR(32)
);
-- Insert Statement
INSERT INTO students (name, email)
VALUES
('Spongebob', 'squarepants@devmtn.com'),
('Jason', 'jason@boyer.com'),
('Plankton', 'plankton@plankton.com'),
('Sandy', 'squirrel@texas.com');
-- Select All (sql commands upper, everything else lower (w/ snake case asfda_asdf)
SELECT * FROM students;
-- Select Some
SELECT name, email FROM students;
WHERE name = 'Jason';
WHERE id > 2;
WHERE id >= 2 AND name = "Jason";
SELECT * FROM customer
WHERE country IN ('USA', 'Mexico', 'Canada');
SELECT SUM(unit_price) FROM invoice_line;
SELECT COUNT(*) FROM students;
-- Update Statement
UPDATE students
SET name = 'Pinhead Larry'
WHERE id = 2;
--Ordered Return
SELECT * FROM students ORDER BY id;
-- Delete Statement
DELETE FROM students
WHERE id = 4;
-- Delete Whole Table (IF Exists not necessary)
DROP TABLE IF EXISTS students;
-- Mini
SELECT * FROM artist; | true |
c962f54062a5379aafca6a7aa71d7a0c4b85c1d7 | SQL | bellmit/flexdb | /2.HOST/3.Procedure/td0025.sql | UTF-8 | 24,288 | 3.1875 | 3 | [] | no_license | CREATE OR REPLACE PROCEDURE td0025(
PV_REFCURSOR IN OUT PKG_REPORT.REF_CURSOR,
OPT IN VARCHAR2,
BRID IN VARCHAR2,
F_DATE IN VARCHAR2,
T_DATE IN VARCHAR2,
CUSTODYCD IN VARCHAR2,
TLTXCD IN VARCHAR2,
ACCTNO IN VARCHAR2
)
IS
-- MODIFICATION HISTORY
-- Bao cao tinh trang no qua han
-- PERSON DATE COMMENTS
-- DUNGNH 24-MAR-2011 CREATED
-- CUONGTD 19-JUL-2011 MODIFIED
-- CHAUNH 16-NOV-2012 repaired many things, carefull when change order of case when
-- --------- ------ -------------------------------------------
V_STROPTION VARCHAR2 (5); -- A: ALL; B: BRANCH; S: SUB-BRANCH
V_STRBRID VARCHAR2 (4); -- USED WHEN V_NUMOPTION > 0
V_FROMDATE DATE;
V_TODATE DATE;
V_CUSTODYCD VARCHAR2 (10);
V_STRACCTNO VARCHAR2 (30);
V_STRTLTXCD VARCHAR2 (10);
-- DECLARE PROGRAM VARIABLES AS SHOWN ABOVE
BEGIN
V_STROPTION := OPT;
IF (V_STROPTION <> 'A') AND (BRID <> 'ALL')
THEN
V_STRBRID := BRID;
ELSE
V_STRBRID := '%%';
END IF;
-- GET REPORT'S PARAMETERS
if(upper(CUSTODYCD) <> 'ALL') then
V_CUSTODYCD := CUSTODYCD;
else
V_CUSTODYCD := '%';
end if;
if(upper(ACCTNO) <> 'ALL') then
V_STRACCTNO := ACCTNO;
else
V_STRACCTNO := '%';
end if;
if(upper(TLTXCD) <> 'ALL') then
V_STRTLTXCD := TLTXCD;
else
V_STRTLTXCD := '%';
end if;
V_FROMDATE := to_date(F_DATE,'dd/mm/yyyy');
V_TODATE := to_date(T_DATE,'dd/mm/yyyy');
-- GET REPORT'S DATA
OPEN PV_REFCURSOR
FOR
SELECT opndate, txdate, txnum, tltxcd, acctno, afacctno, fullname,actype, msgamt, frdate, todate,intrate,NAMT,INTAVLAMT,intamt, custodycd,
( case when a.tltxcd = '1600' then
(case when txdate < todate and txdate >= frdate then
'Tat toan mon HTLS '||acctno||' tra goc va lai ve tai khoan '||afacctno||' lai suat KKH'
else 'Tat toan mon HTLS '||acctno||' tra goc va lai ve tai khoan '||afacctno||' lai suat '||currintrate||' %'
end)
when a.tltxcd = '1610' then
(
case when autornd = 'Y' then
(case when txdate < todate and txdate >=frdate then
'Tat toan mon HTLS '||acctno||' tra lai ve tai khoan '||afacctno||' lai suat KKH'
else 'Tat toan mon HTLS '||acctno||' tra lai ve tai khoan '||afacctno||' lai suat '||currintrate||' %'
end)
else
(case when txdate < todate and txdate >=frdate then
'Tat toan mon HTLS '||acctno||' tra goc va lai ve tai khoan '||afacctno||' lai suat KKH'
else 'Tat toan mon HTLS '||acctno||' tra goc va lai ve tai khoan '||afacctno||' lai suat '||currintrate||' %'
end)
end
)
when a.tltxcd = '1620' then
'Tat toan mon HTLS '||acctno||' tra goc ve tai khoan '||afacctno
when a.tltxcd = '1630' then
'Gia han mon HTLS ' ||acctno|| ' , lai suat '||intrate||' %'
else to_char(a.txdesc)
end
) txdesc,
cdcontent
FROM
(--1670
select td.txdate, td.txnum, td.tltxcd, td.acctno, td.afacctno, td.fullname, td.custodycd, td.actype, td.msgamt, td.opndate , td.frdate, td.todate,
(case when td.schdtype = 'F' then td.intrate else nvl(SCHM.intrate,td.intrate) end) intrate,
0 NAMT,
(
CASE WHEN td.todate > V_TODATE then round(td.msgamt*(td.todate-td.frdate)*
(case when td.schdtype = 'F' then td.intrate else nvl(SCHM.intrate,td.intrate) end)/(100*360))
else 0 end
) INTAVLAMT,
0 intamt, td.txdesc txdesc, td.cdcontent, td.autornd,
0 currintrate
from
(
select tl.txdate, tl.txnum, tl.tltxcd, TD.acctno, td.afacctno, cf.fullname, cf.custodycd,
td.actype, tl.msgamt, td.opndate , td.frdate, td.todate, td.intrate, td.tdterm,td.autornd,
td.orgamt, td.schdtype, tl.txdesc, (td.tdterm || ' ' || al.cdcontent) cdcontent
from
(
SELECT * FROM TLLOG WHERE TLTXCD = '1670' and txdate BETWEEN V_FROMDATE and V_TODATE
and DELTD <> 'Y' --and tltxcd like V_STRTLTXCD
UNION ALL
SELECT * FROM TLLOGALL WHERE TLTXCD = '1670' and txdate BETWEEN V_FROMDATE and V_TODATE
and DELTD <> 'Y' -- and tltxcd like V_STRTLTXCD
) TL,
(
select td.txdate, td.txnum, td.acctno, td.afacctno, td.actype, td.autornd,td.orgamt, td.balance , td.opndate, td.frdate,
td.todate, td.intrate , td.tdterm, td.schdtype, td.termcd
from
(
select tdmast.txdate, tdmast.txnum, tdmast.acctno, tdmast.afacctno, tdmast.actype, tdmast.orgamt, tdmast.balance, tdmast.opndate,tdmast.deltd,
tdmast.frdate, (SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= TODATE AND HOLIDAY = 'N') todate, tdmast.intrate, tdmast.tdterm, tdmast.schdtype, tdmast.termcd , tdmast.autornd
from tdmast, cfmast cf, afmast af where tdmast.acctno like V_STRACCTNO AND cf.custid = af.custid and afacctno = af.acctno AND cf.custodycd like V_CUSTODYCD
union all
select tdmasthist.txdate, tdmasthist.txnum, tdmasthist.acctno, tdmasthist.afacctno, tdmasthist.actype, tdmasthist.orgamt, tdmasthist.balance, tdmasthist.opndate,tdmasthist.deltd,
tdmasthist.frdate, (SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= TODATE AND HOLIDAY = 'N') todate, tdmasthist.intrate, tdmasthist.tdterm, tdmasthist.schdtype, tdmasthist.termcd , tdmasthist.autornd
from tdmasthist, cfmast cf, afmast af where af.custid = cf.custid AND tdmasthist.acctno like V_STRACCTNO and afacctno = af.acctno AND cf.custodycd like V_CUSTODYCD
) td where td.deltd <>'Y' and opndate = frdate
) TD,
afmast af,
cfmast cf,
allcode al
where tl.txnum = td.txnum
and tl.txdate = td.txdate
and td.afacctno = af.acctno
and af.custid = cf.custid
and td.acctno like V_STRACCTNO
and cf.custodycd like V_CUSTODYCD
and al.cdtype = 'TD' and al.cdname = 'TERMCD'
and td.termcd = al.cdval
--AND CF.CAREBY IN (SELECT TLGRP.GRPID FROM TLGRPUSERS TLGRP WHERE TLID = V_STRCAREBY)
) td
left join
( select DISTINCT * from (
select tdmstschm.refautoid, tdmstschm.acctno, tdmstschm.intrate, framt ,toamt, frterm,toterm ,tdmast.frdate ,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= tdmast.todate AND HOLIDAY = 'N') todate
from tdmstschm , tdmast , cfmast cf, afmast af
where tdmstschm.acctno = tdmast.acctno AND cf.custid = af.custid
and tdmast.acctno like V_STRACCTNO and tdmast.afacctno = af.acctno AND cf.custodycd like V_CUSTODYCD
union all
select tdmstschmhist.refautoid, tdmstschmhist.acctno, tdmstschmhist.intrate, framt ,toamt, frterm,toterm ,tdmstschmhist.frdate ,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= tdmstschmhist.todate AND HOLIDAY = 'N') todate
from tdmstschmhist
where tdmstschmhist.acctno like V_STRACCTNO)
)
SCHM
on td.acctno = SCHM.acctno(+)
and td.orgamt >= SCHM.framt(+)
and td.orgamt < SCHM.toamt(+)
and td.tdterm >= SCHM.FRTERM(+)
and td.tdterm < SCHM.toterm(+)
and td.txdate >= SCHM.frdate(+)
and td.txdate < SCHM.todate(+)
UNION ALL
--1600
select td.txdate, td.txnum, td.tltxcd, td.acctno, td.afacctno, td.fullname, td.custodycd,
td.actype, org msgamt,td.opndate , td.frdate, td.todate,
(case when td.schdtype = 'F' then td.intrate else nvl(SCHM.intrate,td.intrate) end) intrate,
TD.namt NAMT, 0 INTAVLAMT, TD.intpaid intamt, td.txdesc, td.cdcontent,td.autornd,
(case when td.txdate >= td.todate then
(case when td.schdtype = 'F' then td.intrate else nvl(SCHM.intrate,td.intrate) end)
else 0 end ) currintrate
FROM
( SELECT txdate, txnum, tltxcd, txdesc, acctno, afacctno, fullname,
custodycd, actype, opndate, min(frdate) frdate, min(todate) todate,
intpaid, namt, intrate, orgamt, schdtype, min(tdterm) tdterm, min(cdcontent) cdcontent, autornd, flintrate, minbrterm, termcd,
org
FROM
( select tr.txdate, tr.txnum, tr.tltxcd, tr.txdesc, mst.acctno, mst.afacctno, mst.fullname, mst.custodycd,
mst.tdtype actype, mst.opndate , mst.frdate frdate, mst.todate todate,
tr.INTPAID intpaid, tr.NAMT namt, mst.intrate, main.msgamt orgamt,
mst.schdtype, mst.tdterm, mst.cdcontent , mst.autornd,mst.flintrate ,mst.minbrterm,mst.termcd,
main.msgamt - sum(div.namt) org
from
(
select td.actype tdtype,-- tl.grpname careby,
td.acctno, af.acctno afacctno, cf.fullname, cf.custodycd, td.opndate,
td.orgamt, td.balance, td.frdate, td.intrate, -- cf.careby carebyid,
td.autornd,td.flintrate,td.minbrterm,td.termcd,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= td.TODATE AND HOLIDAY = 'N') todate,
(td.tdterm || ' ' || al.cdcontent) cdcontent, cf.careby carebyid,
af.actype aftype, td.schdtype, td.tdterm
from (select * from tdmast union select * from tdmasthist) td,
afmast af,
cfmast cf,
allcode al -- , tlgroups tl
where td.afacctno = af.acctno
and af.custid = cf.custid
and al.cdtype = 'TD' and al.cdname = 'TERMCD'
and td.DELTD <>'Y'
and td.termcd = al.cdval
--and cf.careby = tl.grpid
--AND cf.careby IN (SELECT TLGRP.GRPID FROM TLGRPUSERS TLGRP WHERE TLID = V_STRCAREBY)
and td.acctno LIKE V_STRACCTNO and cf.custodycd like V_CUSTODYCD
)
mst,
(
SELECT TR.ACCTNO, tr.txdate, tr.txnum,
sum(case when APP.FIELD = 'BALANCE' then (CASE WHEN APP.TXTYPE = 'D' THEN TR.NAMT ELSE -TR.NAMT END)
else 0 end) NAMT,
sum(case when APP.FIELD = 'INTPAID' then (CASE WHEN APP.TXTYPE = 'D' THEN -TR.NAMT ELSE TR.NAMT END)
else 0 end) INTPAID,
tl.txdesc, tl.tltxcd
FROM (SELECT * FROM TDTRAN UNION ALL SELECT * FROM TDTRANA) TR,
(select * from tllog union all select * from tllogall) tl,
V_APPMAP_BY_TLTXCD APP
WHERE TR.NAMT > 0 AND tr.DELTD <> 'Y'
AND TR.TXNUM = TL.TXNUM
AND TR.TXDATE = TL.TXDATE
AND APP.tltxcd = TL.TLTXCD
AND TR.TXCD = APP.APPTXCD
AND APP.FIELD in ('BALANCE','INTPAID')
AND APP.APPTYPE = 'TD'
AND tr.txdate BETWEEN V_FROMDATE and V_TODATE
--and tl.tltxcd like V_STRTLTXCD
and tr.acctno like V_STRACCTNO
group by TR.ACCTNO, tr.txdate, tr.txnum, tl.txdesc, tl.tltxcd
) TR,
--so tien goc ban dau
(SELECT tl.msgamt, td.acctno FROM vw_tllog_all tl, tdmast td
WHERE tltxcd = '1670' AND td.txdate = tl.txdate AND td.txnum = tl.txnum AND tl.msgacct = td.afacctno
AND td.acctno like V_STRACCTNO
) main,
-- tinh so luong tien thay doi qua tung giao dich
(
SELECT a.msgacct, a.txdate, a.txnum, a.tltxcd,
CASE WHEN ty.intduecd = 'N' THEN a.namt
ELSE
(
CASE --giao dich 1610 tat toan toan bo hoac nhap lai vao goc, neu balance = 0 thi la nhap lai vao goc
WHEN a.tltxcd = '1610' AND a.namt = 0 THEN -a.INTPAID
WHEN a.tltxcd = '1610' AND a.namt <> 0 THEN a.namt
--giao 1600 lai khong bi tru vao goc nen khong tinh goc
WHEN a.tltxcd = '1600' THEN a.namt
--cac giao dich rut tien khac
ELSE a.NAMT + a.INTPAID
END )
END NAMT
FROM (
SELECT tl.msgacct, tl.txdate, tl.txnum, tl.tltxcd,
sum(case when APP.FIELD = 'BALANCE' then (CASE WHEN APP.TXTYPE = 'D' THEN TRan.NAMT ELSE -TRan.NAMT END)
else 0 end) NAMT,
sum(case when APP.FIELD = 'INTPAID' then (CASE WHEN APP.TXTYPE = 'D' THEN -TRan.NAMT ELSE TRan.NAMT END)
else 0 end) INTPAID
FROM vw_tllog_all tl ,(SELECT * FROM tdtran UNION ALL SELECT * FROM tdtrana) tran, v_appmap_by_tltxcd app
WHERE tl.msgacct like V_STRACCTNO
AND tran.txdate = tl.txdate AND tran.txnum = tl.txnum
AND app.apptype = 'TD' AND app.apptxcd = tran.txcd AND app.tltxcd = tl.tltxcd
AND app.field IN ('BALANCE','INTPAID')
GROUP BY tl.msgacct, tl.txdate, tl.txnum, tl.tltxcd
ORDER BY tl.txdate, tl.txnum
) a, tdmast td, tdtype ty
WHERE td.actype = ty.actype AND a.msgacct = td.acctno
) div
where mst.acctno = tr.acctno
AND main.acctno = tr.acctno
AND tr.acctno = div.msgacct
and tr.txnum >= (case when tr.txdate = div.txdate then div.txnum
when tr.txdate < div.txdate then '9999999999'
else '0' end )
AND CASE --cac giao dich binh thuong
WHEN tr.txdate < mst.todate AND tr.txdate > mst.frdate THEN 1
--giao dich 1610 co ngay giao dich bang ngay tat toan
WHEN tr.tltxcd = '1610' AND tr.txdate = mst.todate THEN 1
--ngay giao dich = ngay tat toan thi giao dich 1620 hoac 1600 chay tu dong
WHEN tr.txdate = mst.todate THEN CASE WHEN tr.tltxcd = '1620' THEN 1
WHEN tr.tltxcd = '1600' /*AND tr.txnum LIKE '99%'*/ THEN 1
END
--ngay giao dich bang ngay gia han, giao dich 1600 khong phai tu dong
WHEN tr.txdate = mst.frdate AND tr.tltxcd = '1600' AND tr.txnum NOT LIKE '99%' THEN 1
--giao dich 1620 khi ngay gia han bang ngay giao dich, se gay ra lap, nen phai lay group min(frdate) min(todate)
WHEN tr.tltxcd = '1620' AND tr.txdate = mst.frdate THEN 1
ELSE 0 END = 1
and mst.acctno like V_STRACCTNO
and mst.custodycd like V_CUSTODYCD
group BY tr.txdate , tr.txnum, tr.tltxcd, tr.txdesc, mst.acctno, mst.afacctno, mst.fullname, mst.custodycd,
mst.tdtype , mst.opndate ,
tr.INTPAID , tr.NAMT , mst.intrate, mst.frdate , mst.todate,
mst.schdtype, mst.tdterm, mst.cdcontent , mst.autornd,mst.flintrate ,mst.minbrterm,mst.termcd,main.msgamt
)
GROUP BY txdate, txnum, tltxcd, txdesc, acctno, afacctno, fullname,
custodycd, actype, opndate,
intpaid, namt, intrate, orgamt, schdtype, autornd, flintrate, minbrterm, termcd,
org
ORDER BY txdate, txnum
) TD
left join
( select DISTINCT * from (
select tdmstschm.refautoid, tdmstschm.acctno, tdmstschm.intrate, framt ,toamt, frterm,toterm ,tdmast.frdate ,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= tdmast.todate AND HOLIDAY = 'N') todate
from tdmstschm , tdmast, cfmast cf, afmast af
where tdmstschm.acctno = tdmast.acctno AND cf.custid = af.custid
and tdmast.acctno like V_STRACCTNO and tdmast.afacctno = af.acctno AND cf.custodycd like V_CUSTODYCD
union all
select tdmstschmhist.refautoid, tdmstschmhist.acctno, tdmstschmhist.intrate, framt ,toamt, frterm,toterm ,tdmstschmhist.frdate ,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= tdmstschmhist.todate AND HOLIDAY = 'N') todate
from tdmstschmhist
where tdmstschmhist.acctno like V_STRACCTNO )
) SCHM
on td.acctno = SCHM.acctno(+)
and td.orgamt >= SCHM.framt(+)
and td.orgamt < SCHM.toamt(+)
and td.tdterm >= SCHM.FRTERM(+)
and td.tdterm < SCHM.toterm(+)
and td.txdate > SCHM.frdate(+)
and td.txdate <= SCHM.todate(+)
UNION
--1630
SELECT td.txdate, tl.txnum,tltxcd,td.acctno,td.afacctno,fullname, custodycd,td.ACTYPE , msgamt , td.opndate , td.frdate,td.todate,
(case when td.schdtype = 'F' then td.intrate else nvl(SCHM.intrate,td.intrate) end) intrate ,
--tyintrate intrate,
0 namt,
(
CASE WHEN td.todate > V_TODATE
THEN round(msgamt *(td.todate-td.frdate)*
--(case when schdtype = 'F' then tdintrate else nvl(intrate1,tdintrate)
(case when td.schdtype = 'F' then td.intrate else nvl(SCHM.intrate,td.intrate)
end)/(100*360)) ELSE 0 END
) intavlamt,
0 intamt,txdesc,
(td.tdterm ||' '|| td.cdcontent) cdcontent ,
autornd,
0 currintrate
--,schdtype,tdintrate,intrate1
FROM
(
SELECT td.* , tdroot.intrate , tdroot.tdterm , tdroot.opndate ,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000' AND SBDATE >= ( td.frdate + tdroot.tdterm) AND HOLIDAY = 'N') todate
FROM
(
SELECT (SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000' AND SBDATE >= TD.TODATE AND HOLIDAY = 'N') txdate,
tltxcd,TD.acctno,TD.afacctno,CF.fullname, cf.custodycd,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000' AND SBDATE >= TD.TODATE AND HOLIDAY = 'N') frdate,
-- (SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000' AND SBDATE >= ((SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
-- AND SBDATE >= TD.TODATE AND HOLIDAY = 'N')+ td.tdterm) AND HOLIDAY = 'N') todate,
td.balance msgamt,
--td.tdterm,
td.schdtype ,
--td.intrate ,
txdesc, td.autornd , td.actype , al.cdcontent
FROM TDMASTHIST TD, TLTX , afmast af , cfmast cf,allcode al
WHERE TLTX.TLTXCD = '1630'
and td.DELTD <>'Y'
and td.afacctno = af.acctno
and af.custid = cf.custid
and al.cdtype = 'TD'
and al.cdname = 'TERMCD'
and td.termcd = al.cdval
and td.acctno LIKE V_STRACCTNO
and cf.custodycd LIKE V_CUSTODYCD
and td.balance<>0
AND (SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000' AND SBDATE >= td.TODATE AND HOLIDAY = 'N') BETWEEN V_FROMDATE and V_TODATE
--AND cf.careby IN (SELECT TLGRP.GRPID FROM TLGRPUSERS TLGRP WHERE TLID = V_STRCAREBY)
) td,
(
select tdmasthist.acctno ,tdmasthist.orgamt,tdmasthist.balance,tdmasthist.intrate,tdmasthist.frdate,tdmasthist.tdterm,tdmasthist.opndate,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000' AND SBDATE >= TODATE AND HOLIDAY = 'N') todate
from tdmasthist, cfmast cf, afmast af WHERE cf.custid = af.custid AND tdmasthist.acctno LIKE V_STRACCTNO and afacctno = af.acctno AND cf.custodycd like V_CUSTODYCD
union all
select tdmast.acctno ,tdmast.orgamt,tdmast.balance,tdmast.intrate,tdmast.frdate,tdmast.tdterm,tdmast.opndate,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000' AND SBDATE >= TODATE AND HOLIDAY = 'N') todate
from tdmast, afmast af, cfmast cf where tdmast.acctno LIKE V_STRACCTNO and cf.custid = af.custid and afacctno = af.acctno AND cf.custodycd like V_CUSTODYCD
) tdroot
where td.frdate = tdroot.frdate(+)
--and td.todate = tdroot.todate
and td.acctno = tdroot.acctno(+)
) TD
LEFT JOIN
(
SELECT tl.txdate, tl.txnum, tl.msgacct FROM vw_tllog_all tl WHERE tltxcd = '1630'
) tl
ON td.txdate = tl.txdate AND td.acctno = tl.msgacct
left join
( select DISTINCT * from (
select tdmstschm.refautoid, tdmstschm.acctno, tdmstschm.intrate, framt ,toamt, frterm,toterm ,tdmast.frdate ,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= tdmast.todate AND HOLIDAY = 'N') todate
from tdmstschm , tdmast, cfmast cf, afmast af
where tdmstschm.acctno = tdmast.acctno AND cf.custid = af.custid
and tdmast.acctno like V_STRACCTNO and tdmast.afacctno = af.acctno AND cf.custodycd like V_CUSTODYCD
union all
select tdmstschmhist.refautoid, tdmstschmhist.acctno, tdmstschmhist.intrate, framt ,toamt, frterm,toterm ,tdmstschmhist.frdate ,
(SELECT min(sbdate) FROM SBCLDR WHERE CLDRTYPE = '000'
AND SBDATE >= tdmstschmhist.todate AND HOLIDAY = 'N') todate
from tdmstschmhist
where tdmstschmhist.acctno like V_STRACCTNO )
)
SCHM
on td.acctno = SCHM.acctno
and td.msgamt >= SCHM.framt
and td.msgamt < SCHM.toamt
and td.tdterm >= SCHM.FRTERM
and td.tdterm < SCHM.toterm
and td.txdate >= SCHM.frdate
and td.txdate < SCHM.todate
)a
WHERE tltxcd LIKE V_STRTLTXCD
AND custodycd LIKE V_CUSTODYCD
ORDER BY custodycd, afacctno, acctno,TXDATE,txnum--, opndate
;
EXCEPTION
WHEN OTHERS
THEN
RETURN;
END; -- PROCEDURE
/
| true |
6d7fa982566cbb1cb093d0747ce8d3b1be0f020c | SQL | cb-adithyaks/Adithya | /week3/Day4/triggers.sql | UTF-8 | 1,944 | 4.34375 | 4 | [] | no_license | /*
creating and using triggers
*/
/* 1) Add a column average to the table marks*/
alter table marks add column average float(5,2) not null after grade;
update marks set average=((quarterly+half_yearly+annual)/3);
/* 2) Write a trigger to calculate the average marks for the subject whenever any insert/update happens in the columns quarterly, half_yearly and annual in the table 'marks'*/
delimiter //
drop trigger if exists average_trigger ;
create trigger average_trigger
before update on marks
for each row
begin
set new.average=((new.annual+new.half_yearly+new.quarterly)/3);
end; //
drop trigger if exists average_trigger_1 ;
create trigger average_trigger_1
after insert on marks
for each row
begin
set new.average=((new.annual+new.half_yearly+new.quarterly)/3);
end; //
delimiter ;
/* 3)Rename the column name from medal_won to medal_received in the table medals */
/* Add a column medal_received to the table medals */
alter table medals add column medal_received varchar(10) after medal_won;
/*Write a trigger to copy the values to both the columns(medal_won and medal_received) whenever any of these columns inserted/updated */
delimiter //
drop trigger if exists medals_update_trigger;
create trigger medals_update_trigger
before update on medals
for each row
begin
if(new.medal_won <=> old.medal_won) then
set new.medal_received=new.medal_won;
elseif(new.medal_received <> old.medal_received) then
set new.medal_won=new.medal_received;
end if;
end;//
drop trigger if exists medals_insert_trigger;
create trigger medals_insert_trigger
before insert on medals
for each row
begin
if(new.medal_won <=> null) then
set new.medal_received=new.medal_won;
elseif(new.medal_received is not null) then
set new.medal_won=new.medal_received;
end if;
end;//
delimiter ;
/*Drop the column medal_won */
alter table medals drop column medal_won;
| true |
f025b28a6acea89a447f6461d92c2d0432805c7e | SQL | sandrorosevel/GDI-Loja_de_Jogo | /scripts sql/povoamento/insercao_contas.sql | UTF-8 | 3,054 | 2.515625 | 3 | [] | no_license | --Inserção Conta-Clientes
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Lucas Yule', 'lucasyule@email.com', 'zxczxc');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Vinicius', 'vinicius@email.com', 'asdasd');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('João Marcos', 'jm@email.com', 'qweqwe');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Sandro', 'sandro@email.com', 'xcvxcv');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Tavares', 'tavares@email.com', 'sdfsdf');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Gilvanice Vilar Barsosa',
'gilvanice@email.com',
'uX5w8Nvkpr)i'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Aldemar Laporte Werling',
'aldemar.werling@geradornv.com.br',
'L7&qE4FaeCoq'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Leandro Borralho dos Santos',
'leandro.santos@geradornv.com.br',
'=RM7$(&(94c'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Manoel Correia Leandro',
'manoel.leandro@geradornv.com.br',
'Nk8(s6(KEerx'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Kevin Monteiro Peçanha',
'kevin.pecanha@geradornv.com.br',
'_RGQsM=p&je0'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Tatiana Carvel Leal',
'tatiana.leal@geradornv.com.br',
'=jn3@E9dJJqN'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Luciana Venancio Trindade',
'luciana.trindade@geradornv.com.br',
'C5tPb6ROY$cv'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Salvador Geraldo Mota',
'salvador.mota@geradornv.com.br',
'#Gv=SeUnW@kN'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Fredericko Bragança Felizardo',
'fredericko.felizardo@geradornv.com.br',
'E#YR29y$@4aN'
);
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(
'Robson Malaquias Teodoro',
'robson.teodoro@geradornv.com.br',
'UE3PM5ffyYjv'
);
--Inserção Conta-Distribuidoras
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('EA Games', 'eagames@email.com', 'eagames1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Rockstar', 'rockstar@email.com', 'rockstar1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Ubisoft', 'ubisoft@email.com', 'ubisoft1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Nintendo', 'nintendo@email.com', 'nintendo1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Sony', 'sony@email.com', 'sony1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Activision', 'actvision@email.com', 'activision1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Square Enix', 'squareenix@email.com', 'square1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Tencent', 'tencent@email.com', 'tencent1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Sega', 'sega@email.com', 'sega1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Konami', 'konami@email.com', 'konami1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Microsoft', 'microsoft@email.com', 'microsoft1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Capcom', 'capcom@email.com', 'capcom1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Take-Two', 'taketwo@email.com', 'taketwo1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Riot Games', 'riot@email.com', 'riot1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
(' Blizzard', 'blizzard@email.com', 'blizard1');
INSERT INTO
ContaLoja (nome, email, senha)
VALUES
('Apple', 'apple@email.com', 'apple1'); | true |
1f2696a8f14bc8597739eea39c299bccb3d22628 | SQL | 4evernoob/Spring-boot-example | /dbschema.sql | UTF-8 | 763 | 3.234375 | 3 | [] | no_license | -- Dumping database structure for concretepage
CREATE DATABASE IF NOT EXISTS `concretepage`;
USE `concretepage`;
-- Dumping structure for table concretepage.articles
CREATE TABLE IF NOT EXISTS `articles` (
`article_id` int(5) NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL,
`category` varchar(100) NOT NULL,
PRIMARY KEY (`article_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
-- Dumping data for table concretepage.articles: ~3 rows (approximately)
INSERT INTO `articles` VALUES (20,'how to c','programming awful'),
(22,'how to js','basic'),
(24,'how not to die','slowly'),
(25,'live or die for dumb people','selfhelp'),
(26,'How not to program','programming'),
(27,'C for cats','Cats'),
(28,'I was a big pony','Children books');
| true |
1d5f03f2ce2395c08ca0b49a6cd0f0a669b80296 | SQL | goknsh/threads | /server/api/v1/db.sql | UTF-8 | 1,677 | 3.484375 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `users` (
`id` int NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`pass` longtext NOT NULL,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `domains` (
`id` int NOT NULL AUTO_INCREMENT,
`domain` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `domain` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `deleted@domain.tld` (
`domain` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`status` int(255) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `deleted@domain.tld`(`domain`, `name`, `status`) VALUES ('deleted@domain.tld', 'Deleted Comment', 2);
INSERT INTO `users`(`email`, `pass`, `name`) VALUES ('deleted@domain.tld', 'Deleted', 'Deleted Comment');
-- CREATE TABLE IF NOT EXISTS `user_$id` (
-- `comment_id` int NOT NULL AUTO_INCREMENT,
-- `domain_id` varchar(255) NOT NULL,
-- `url_id` varchar(255) NOT NULL,
-- `thread` varchar(255) NOT NULL,
-- PRIMARY KEY (`id`),
-- UNIQUE KEY `id` (`id`)
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- CREATE TABLE IF NOT EXISTS `domain_id` (
-- `url_id` int NOT NULL AUTO_INCREMENT,
-- `date` timestamp DEFAULT CURRENT_TIMESTAMP,
-- `thread` varchar(255) NOT NULL,
-- `email` varchar(255) NOT NULL,
-- `name` varchar(255) NOT NULL,
-- `url` longtext NOT NULL,
-- `comment` longtext NOT NULL,
-- PRIMARY KEY (`id`),
-- UNIQUE KEY `id` (`id`)
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | true |
215e96de8145db2dd334739521c293c325c597ed | SQL | hefeng6500/mysql-lesson | /11.update.sql | UTF-8 | 869 | 3.5 | 4 | [] | no_license | SHOW DATABASES;
DROP DATABASE IF EXISTS mysql_test;
CREATE DATABASE IF NOT EXISTS mysql_test;
USE mysql_test;
SHOW TABLES;
DROP TABLE IF EXISTS student1;
CREATE TABLE student1 (id int, name VARCHAR(20), age INT, sex char(1), birthday DATE, address VARCHAR(200), math DOUBLE, english DOUBLE);
DESC student1;
INSERT INTO student1 (id, name, age, sex, birthday, address, math, english) VALUES (1, "hefeng6500", 28, 1, '2021-02-02', "北京市", 19, 88.5);
INSERT INTO student1 (id, name, age, sex, birthday, address, math, english) VALUES (1, "兰亭古墨", 30, 1, '2020-02-02', "深圳市", 60, 50.5);
-- 更新数据表
-- 更新所有数据的某列的数据
UPDATE student1 SET age = 28;
-- 带条件更新
UPDATE student1 SET sex = 1 WHERE name = 'hefeng6500';
UPDATE student1 SET sex = 1, address = '南京市' WHERE name = 'hefeng6500';
SELECT * FROM student1; | true |
8cd569f1e741786a53f2f185c8401c07953f8741 | SQL | sonidwisusanto08/Perpustakaan_Sonidwisusanto | /perpustakaan/perpustakaan.sql | UTF-8 | 3,207 | 3.015625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 08 Jul 2019 pada 11.40
-- Versi Server: 10.1.21-MariaDB
-- PHP Version: 7.1.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 */;
--
-- Database: `perpustakaan`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `buku`
--
CREATE TABLE `buku` (
`id_buku` int(11) NOT NULL,
`id_kategori` varchar(255) NOT NULL,
`judul` varchar(255) NOT NULL,
`penerbit` varchar(255) NOT NULL,
`penulis` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `buku`
--
INSERT INTO `buku` (`id_buku`, `id_kategori`, `judul`, `penerbit`, `penulis`) VALUES
(1, '2', 'Bahasa', 'mamamas', 'jaja');
-- --------------------------------------------------------
--
-- Struktur dari tabel `kategori`
--
CREATE TABLE `kategori` (
`id_kategori` int(15) NOT NULL,
`kategori` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `kategori`
--
INSERT INTO `kategori` (`id_kategori`, `kategori`) VALUES
(1, 'pendidikan'),
(2, 'novel');
-- --------------------------------------------------------
--
-- Struktur dari tabel `penerbit`
--
CREATE TABLE `penerbit` (
`id_penerbit` int(11) NOT NULL,
`penerbit` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `penerbit`
--
INSERT INTO `penerbit` (`id_penerbit`, `penerbit`) VALUES
(2, 'ghtrh'),
(3, 'sssssssssddddddddd');
-- --------------------------------------------------------
--
-- Struktur dari tabel `penulis`
--
CREATE TABLE `penulis` (
`id_penulis` int(11) NOT NULL,
`penulis` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `penulis`
--
INSERT INTO `penulis` (`id_penulis`, `penulis`) VALUES
(1, 'dddd'),
(2, 'sssss');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `buku`
--
ALTER TABLE `buku`
ADD PRIMARY KEY (`id_buku`);
--
-- Indexes for table `kategori`
--
ALTER TABLE `kategori`
ADD PRIMARY KEY (`id_kategori`);
--
-- Indexes for table `penerbit`
--
ALTER TABLE `penerbit`
ADD PRIMARY KEY (`id_penerbit`);
--
-- Indexes for table `penulis`
--
ALTER TABLE `penulis`
ADD PRIMARY KEY (`id_penulis`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `buku`
--
ALTER TABLE `buku`
MODIFY `id_buku` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `penerbit`
--
ALTER TABLE `penerbit`
MODIFY `id_penerbit` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `penulis`
--
ALTER TABLE `penulis`
MODIFY `id_penulis` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
/*!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 |
ff3b9e7a652c8056b96004d3abc0b736630f04e4 | SQL | hacyrakcorp/nf | /nf (1).sql | UTF-8 | 15,330 | 3.21875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.4.1
-- http://www.phpmyadmin.net
--
-- Client : localhost
-- Généré le : Lun 19 Février 2018 à 09:38
-- Version du serveur : 5.7.11
-- Version de PHP : 7.1.10
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 : `nf`
--
-- --------------------------------------------------------
--
-- Structure de la table `code_analytique`
--
CREATE TABLE `code_analytique` (
`id` int(11) NOT NULL,
`libelle` varchar(72) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `code_analytique`
--
INSERT INTO `code_analytique` (`id`, `libelle`) VALUES
(100, 'F.G 100'),
(200, 'BTS CPI'),
(500, 'BTS TC');
-- --------------------------------------------------------
--
-- Structure de la table `etat`
--
CREATE TABLE `etat` (
`id` int(11) NOT NULL,
`libelle` varchar(72) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `etat`
--
INSERT INTO `etat` (`id`, `libelle`) VALUES
(1, 'brouillon'),
(2, 'soumise'),
(3, 'prise en charge'),
(4, 'traitée');
-- --------------------------------------------------------
--
-- Structure de la table `historique_connection`
--
CREATE TABLE `historique_connection` (
`id` int(11) NOT NULL,
`date_tentative` date DEFAULT NULL,
`id_utilisateur` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `historique_connection`
--
INSERT INTO `historique_connection` (`id`, `date_tentative`, `id_utilisateur`) VALUES
(1, '2018-01-25', 5);
-- --------------------------------------------------------
--
-- Structure de la table `historique_etat`
--
CREATE TABLE `historique_etat` (
`id` int(11) NOT NULL,
`date_etat` date NOT NULL,
`id_etat` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `historique_note_frais`
--
CREATE TABLE `historique_note_frais` (
`id` int(11) NOT NULL,
`date_note_frais` varchar(25) DEFAULT NULL,
`id_note_frais` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `historique_note_frais`
--
INSERT INTO `historique_note_frais` (`id`, `date_note_frais`, `id_note_frais`) VALUES
(1, '2018-01-28 08:41:16', 63);
-- --------------------------------------------------------
--
-- Structure de la table `historique_reglement`
--
CREATE TABLE `historique_reglement` (
`id` int(11) NOT NULL,
`date_reglement` date NOT NULL,
`id_note_frais` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `historique_reglement`
--
INSERT INTO `historique_reglement` (`id`, `date_reglement`, `id_note_frais`) VALUES
(1, '2018-01-01', 44);
-- --------------------------------------------------------
--
-- Structure de la table `ligne_frais`
--
CREATE TABLE `ligne_frais` (
`id` int(11) NOT NULL,
`date_ligne` date DEFAULT NULL,
`object` varchar(255) DEFAULT NULL,
`lieu` varchar(72) DEFAULT NULL,
`id_note_frais` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `ligne_frais`
--
INSERT INTO `ligne_frais` (`id`, `date_ligne`, `object`, `lieu`, `id_note_frais`) VALUES
(1, '2017-12-24', 'Autoroute', 'Pertuis', 35),
(2, '2017-12-06', 'Repas', 'Pertuis', 35),
(3, '2017-12-01', 'Essence', 'Aix-en-Provence', 44),
(10, '2017-08-05', 'test', 'Vitrolles', 39),
(13, '2017-08-08', 'test', 'Rognac', 39),
(14, '2017-08-09', 'test2', 'Plan d\'Orgon', 39),
(17, '2018-01-02', 'TEST2', 'Pertuis', 39),
(18, '2018-01-01', 'TEST', 'Cavaillon', 39);
-- --------------------------------------------------------
--
-- Structure de la table `nature_frais`
--
CREATE TABLE `nature_frais` (
`id` int(11) NOT NULL,
`libelle` varchar(72) DEFAULT NULL,
`type_valeur` varchar(72) DEFAULT NULL,
`unite` varchar(72) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `nature_frais`
--
INSERT INTO `nature_frais` (`id`, `libelle`, `type_valeur`, `unite`) VALUES
(1, 'Restaurant', '1', '€'),
(2, 'Hotel', '1', '€'),
(3, 'Autoroute', '1', '€'),
(4, 'Parking', '1', '€'),
(5, 'Divers', '1', '€'),
(6, 'Kilomètre', '2', 'Km');
-- --------------------------------------------------------
--
-- Structure de la table `note_frais`
--
CREATE TABLE `note_frais` (
`id` int(11) NOT NULL,
`mois_annee` varchar(25) NOT NULL,
`mode_reglement` varchar(72) DEFAULT NULL,
`numero_cheque` varchar(25) NOT NULL,
`banque` varchar(72) DEFAULT NULL,
`avance` decimal(15,3) DEFAULT NULL,
`net_a_payer` decimal(15,3) DEFAULT NULL,
`id_utilisateur` int(11) DEFAULT NULL,
`id_etat` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `note_frais`
--
INSERT INTO `note_frais` (`id`, `mois_annee`, `mode_reglement`, `numero_cheque`, `banque`, `avance`, `net_a_payer`, `id_utilisateur`, `id_etat`) VALUES
(35, '2017-06', NULL, '', NULL, NULL, NULL, 2, 1),
(39, '2017-09', NULL, '', NULL, NULL, NULL, 2, 1),
(40, '2017-03', NULL, '', NULL, NULL, NULL, 2, 2),
(43, '2017-02', NULL, '', NULL, NULL, NULL, 2, 2),
(44, '2017-07', 'Cheque', '12345', 'LaPoste', NULL, NULL, 2, 3),
(63, '2016-10', NULL, '', NULL, NULL, NULL, 2, 1);
--
-- Déclencheurs `note_frais`
--
DELIMITER $$
CREATE TRIGGER `before_insert_nf` BEFORE INSERT ON `note_frais` FOR EACH ROW BEGIN
IF (STR_TO_DATE(NEW.mois_annee,'%Y-%m') > sysdate())
THEN
signal sqlstate '45000' set message_text = 'Impossible d'enregistrer une date avenir.';
END IF;
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `before_update_nf` BEFORE UPDATE ON `note_frais` FOR EACH ROW BEGIN
IF (STR_TO_DATE(NEW.mois_annee,'%Y-%m') > sysdate())
THEN
signal sqlstate '45000' set message_text = 'Impossible d'enregistrer une date avenir.';
END IF;
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Structure de la table `service`
--
CREATE TABLE `service` (
`id` int(11) NOT NULL,
`libelle` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `service`
--
INSERT INTO `service` (`id`, `libelle`) VALUES
(1, 'pédagogie'),
(2, 'administratif'),
(3, 'CID');
-- --------------------------------------------------------
--
-- Structure de la table `statut`
--
CREATE TABLE `statut` (
`id` int(11) NOT NULL,
`libelle` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `statut`
--
INSERT INTO `statut` (`id`, `libelle`) VALUES
(1, 'administrateur'),
(2, 'salarié'),
(3, 'externe'),
(4, 'comptabilité');
-- --------------------------------------------------------
--
-- Structure de la table `utilisateur`
--
CREATE TABLE `utilisateur` (
`id` int(11) NOT NULL,
`nom` varchar(72) DEFAULT NULL,
`prenom` varchar(72) DEFAULT NULL,
`login` varchar(72) DEFAULT NULL,
`mdp` varchar(72) DEFAULT NULL,
`tentative_connection` int(11) DEFAULT NULL,
`code_mdp_oublie` varchar(25) DEFAULT NULL,
`confirme_code` tinyint(1) DEFAULT NULL,
`date_expiration_code` date DEFAULT NULL,
`bloque` tinyint(1) DEFAULT '0',
`id_statut` int(11) DEFAULT NULL,
`id_service` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `utilisateur`
--
INSERT INTO `utilisateur` (`id`, `nom`, `prenom`, `login`, `mdp`, `tentative_connection`, `code_mdp_oublie`, `confirme_code`, `date_expiration_code`, `bloque`, `id_statut`, `id_service`) VALUES
(1, 'test', 'admin', 'c.mollusk@gmail.com', 'a5239517e4715c74276e4b4c8e6bcc7c637a0f27', NULL, NULL, NULL, NULL, 0, 1, 1),
(2, 'test', 'declarant', 'dtest@gmail.com', '5bb1993e339e52b4ec84f0de2f6c51532ae08883', NULL, NULL, NULL, NULL, 0, 2, 2),
(3, 'test', 'compta', 'ctest@gmail.com', '014b4d83fe9ef4e5b47da5675a2ba52e71210a2a', NULL, NULL, NULL, NULL, 0, 4, 2),
(5, 'test2', 'externe', 'etest2@gmail.com', 'bcbb8733a4b206ec25c0cffc9289388788e7afdf', NULL, NULL, NULL, NULL, NULL, 3, 2),
(7, 'test2', 'salarie', 'stest2@gmail.com', '7c38f604c01aee817d54510529c47e1e535d1994', NULL, NULL, NULL, NULL, NULL, 2, 1),
(8, 'test2', 'compta', 'ctest2@gmailcom', '3e63a3a8a35ec0e8d4763d02ea9657bcf9282d2f', NULL, NULL, NULL, NULL, 0, 4, 2),
(9, 'Aliaga', 'cecile', 'cecile.aliaga@gmail.com', '64c304dd89e6d3ce0c1a46e081ad6b6b3f83df5a', NULL, NULL, NULL, NULL, NULL, 1, 1);
--
-- Déclencheurs `utilisateur`
--
DELIMITER $$
CREATE TRIGGER `before_insert_utilisateur` BEFORE INSERT ON `utilisateur` FOR EACH ROW BEGIN
IF (NEW.bloque IS NULL)
THEN
SET NEW.bloque = 0;
END IF;
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `before_update_blocage` BEFORE UPDATE ON `utilisateur` FOR EACH ROW BEGIN
IF NEW.tentative_connection = 4
THEN
SET NEW.bloque = 1;
END IF;
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Structure de la table `valeur_frais`
--
CREATE TABLE `valeur_frais` (
`valeur` float DEFAULT NULL,
`id_nature_frais` int(11) NOT NULL,
`id_ligne_frais` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `valeur_frais`
--
INSERT INTO `valeur_frais` (`valeur`, `id_nature_frais`, `id_ligne_frais`) VALUES
(20, 1, 13),
(10, 1, 14),
(18, 1, 18),
(25, 2, 17),
(10, 3, 10),
(1.8, 3, 13),
(4.2, 3, 14),
(4, 3, 18),
(7.8, 4, 14),
(8.75, 4, 17),
(15, 5, 10),
(5, 5, 14),
(2, 6, 18);
--
-- Index pour les tables exportées
--
--
-- Index pour la table `code_analytique`
--
ALTER TABLE `code_analytique`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `etat`
--
ALTER TABLE `etat`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `historique_connection`
--
ALTER TABLE `historique_connection`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_historique_connection_id_utilisateur` (`id_utilisateur`);
--
-- Index pour la table `historique_etat`
--
ALTER TABLE `historique_etat`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_historique_etat_id_etat` (`id_etat`);
--
-- Index pour la table `historique_note_frais`
--
ALTER TABLE `historique_note_frais`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_historique_note_frais_id_note_frais` (`id_note_frais`);
--
-- Index pour la table `historique_reglement`
--
ALTER TABLE `historique_reglement`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_historique_reglement_id_note_frais` (`id_note_frais`);
--
-- Index pour la table `ligne_frais`
--
ALTER TABLE `ligne_frais`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_ligne_frais_id_note_frais` (`id_note_frais`);
--
-- Index pour la table `nature_frais`
--
ALTER TABLE `nature_frais`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `note_frais`
--
ALTER TABLE `note_frais`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_note_frais_id_utilisateur` (`id_utilisateur`),
ADD KEY `FK_note_frais_id_etat` (`id_etat`);
--
-- Index pour la table `service`
--
ALTER TABLE `service`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `statut`
--
ALTER TABLE `statut`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `utilisateur`
--
ALTER TABLE `utilisateur`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_utilisateur_id_statut` (`id_statut`),
ADD KEY `FK_utilisateur_id_service` (`id_service`);
--
-- Index pour la table `valeur_frais`
--
ALTER TABLE `valeur_frais`
ADD PRIMARY KEY (`id_nature_frais`,`id_ligne_frais`),
ADD KEY `FK_valeur_frais_id_ligne_frais` (`id_ligne_frais`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `code_analytique`
--
ALTER TABLE `code_analytique`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=501;
--
-- AUTO_INCREMENT pour la table `etat`
--
ALTER TABLE `etat`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT pour la table `historique_connection`
--
ALTER TABLE `historique_connection`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT pour la table `historique_etat`
--
ALTER TABLE `historique_etat`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `historique_note_frais`
--
ALTER TABLE `historique_note_frais`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT pour la table `historique_reglement`
--
ALTER TABLE `historique_reglement`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT pour la table `ligne_frais`
--
ALTER TABLE `ligne_frais`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT pour la table `nature_frais`
--
ALTER TABLE `nature_frais`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT pour la table `note_frais`
--
ALTER TABLE `note_frais`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=64;
--
-- AUTO_INCREMENT pour la table `service`
--
ALTER TABLE `service`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `statut`
--
ALTER TABLE `statut`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT pour la table `utilisateur`
--
ALTER TABLE `utilisateur`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `historique_connection`
--
ALTER TABLE `historique_connection`
ADD CONSTRAINT `FK_historique_connection_id_utilisateur` FOREIGN KEY (`id_utilisateur`) REFERENCES `utilisateur` (`id`);
--
-- Contraintes pour la table `historique_etat`
--
ALTER TABLE `historique_etat`
ADD CONSTRAINT `FK_historique_etat_id_etat` FOREIGN KEY (`id_etat`) REFERENCES `etat` (`id`);
--
-- Contraintes pour la table `historique_note_frais`
--
ALTER TABLE `historique_note_frais`
ADD CONSTRAINT `FK_historique_note_frais_id_note_frais` FOREIGN KEY (`id_note_frais`) REFERENCES `note_frais` (`id`);
--
-- Contraintes pour la table `historique_reglement`
--
ALTER TABLE `historique_reglement`
ADD CONSTRAINT `FK_historique_reglement_id_note_frais` FOREIGN KEY (`id_note_frais`) REFERENCES `note_frais` (`id`);
--
-- Contraintes pour la table `ligne_frais`
--
ALTER TABLE `ligne_frais`
ADD CONSTRAINT `FK_ligne_frais_id_note_frais` FOREIGN KEY (`id_note_frais`) REFERENCES `note_frais` (`id`);
--
-- Contraintes pour la table `note_frais`
--
ALTER TABLE `note_frais`
ADD CONSTRAINT `FK_note_frais_id_etat` FOREIGN KEY (`id_etat`) REFERENCES `etat` (`id`),
ADD CONSTRAINT `FK_note_frais_id_utilisateur` FOREIGN KEY (`id_utilisateur`) REFERENCES `utilisateur` (`id`);
--
-- Contraintes pour la table `utilisateur`
--
ALTER TABLE `utilisateur`
ADD CONSTRAINT `FK_utilisateur_id_service` FOREIGN KEY (`id_service`) REFERENCES `service` (`id`),
ADD CONSTRAINT `FK_utilisateur_id_statut` FOREIGN KEY (`id_statut`) REFERENCES `statut` (`id`);
--
-- Contraintes pour la table `valeur_frais`
--
ALTER TABLE `valeur_frais`
ADD CONSTRAINT `FK_valeur_frais_id_ligne_frais` FOREIGN KEY (`id_ligne_frais`) REFERENCES `ligne_frais` (`id`),
ADD CONSTRAINT `FK_valeur_frais_id_nature_frais` FOREIGN KEY (`id_nature_frais`) REFERENCES `nature_frais` (`id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
76f452ad965f7b37d177f779ca9120fb284786a8 | SQL | luciofassio/intranet-saint-martin | /aggiorna_db_oratorio.sql | UTF-8 | 2,608 | 3.09375 | 3 | [] | no_license | --
-- Definition of table `tblcapitolicontabilita`
--
DROP TABLE IF EXISTS `tblcapitolicontabilita`;
CREATE TABLE `tblcapitolicontabilita` (
`IdCapitolo` INTEGER NOT NULL auto_increment,
`SiglaCapitolo` VARCHAR(3) NOT NULL,
`Capitolo` VARCHAR(45) NOT NULL,
PRIMARY KEY (`IdCapitolo`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Tabella per la gestione dei capitoli di contabilita';
--
-- Dumping data for table `tblcapitolicontabilita`
--
INSERT INTO `tblcapitolicontabilita`
(`IdCapitolo`,`SiglaCapitolo`,`Capitolo`)
VALUES
(1,'RIS','Ristorazione'),
(2,'MTC','Materiali Di Consumo'),
(3,'SEG','Segreteria'),
(4,'ABB','Abbigliamento'),
(5,'IER','Iscrizioni Estate Ragazzi'),
(6,'IOR','Iscrizioni Oratorio'),
(7,'FMC','Farmacia'),
(8,'SPE','Spettacoli'),
(9,'CTB','Contributi');
--
-- Definition of table `tblvocicontabilita`
--
DROP TABLE IF EXISTS `tblvocicontabilita`;
CREATE TABLE `tblvocicontabilita` (
`IdVoci` INTEGER NOT NULL auto_increment,
`Voce` VARCHAR(45) NOT NULL,
`IdCapitolo` INTEGER NOT NULL,
`Movimentazione` VARCHAR(2) NOT NULL,
PRIMARY KEY (`IdVoci`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Tabella per la gestione delle voci di contabilita';
--
-- Dumping data for table `tblvocicontabilita`
--
INSERT INTO `tblvocicontabilita` (`IdVoci`,`Voce`,`IdCapitolo`,`Movimentazione`) VALUES
(1,'Toner',2,'U'),
(2,'Risme Carta A4',2,'U'),
(3,'Merende',1,'EU'),
(4,'Cappellini',4,'U'),
(5,'Magliette',4,'U'),
(6,'Valori Bollati',3,'EU'),
(7,'Pranzi Cene',1,'EU'),
(8,'Bollette Telecom',3,'U'),
(9,'Bollette Teletu',3,'U'),
(10,'Sms (Mobyt)',3,'U'),
(11,'Porta Pass',2,'U'),
(12,'Collarini Porta Pass',2,'U'),
(13,'Iscrizioni Estate Ragazzi',5,'EU'),
(14,'Iscrizioni Oratorio',6,'EU'),
(15,'Garze sterili',7,'U'),
(16,'Service Audio Luci',8,'U'),
(17,'Spettacoli Confezionati',8,'U'),
(18,'Siae',9,'U'),
(19,'Legge regionale Oratori',9,'E'),
(20,'Cinque Per Mille',9,'E'),
(21,'Progetti',9,'E'),
(22,'Offerte',9,'E'),
(23,'Risme Carta A3',2,'U');
--
-- Definition of table `tblcontabilita`
--
DROP TABLE IF EXISTS `tblcontabilita`;
CREATE TABLE `tblcontabilita` (
`IdContabilita` INTEGER NOT NULL auto_increment,
`DataOperazione` DATETIME,
`Contabilita` VARCHAR(2),
`IdCapitolo` INTEGER NOT NULL,
`IdVoce` INTEGER NOT NULL,
`Operazione` VARCHAR(1) NOT NULL,
`Importo` DECIMAL(10,2) NOT NULL DEFAULT '0.00',
PRIMARY KEY (`IdContabilita`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Tabella per la gestione della contabilita';
| true |
21ad5cac2028308dd8029d42e1eba475c7a460e2 | SQL | madhurivaishnav/SALTWEB | /SALT_NewDesign/Database/Procedure/dbo.prcQuiz_GetModuleIDByToolbookID.PRC | UTF-8 | 766 | 3.3125 | 3 | [] | no_license | SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[prcQuiz_GetModuleIDByToolbookID]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
/*
Summary:
Parameters: @ToolbookID varchar(50)
Returns: integer
Called By: ToolbookListener.aspx
Calls: None
Remarks: Raises an error if the parameter is null
Author: Peter Kneale
Date Created: 9th of February 2004
Modification History
-----------------------------------------------------------
v# Author Date Description
#1 GB 9/2/04 Coding standards
*/
CREATE Procedure [prcQuiz_GetModuleIDByToolbookID]
(
@ToolbookID varchar(50) = null -- Toolbook ID
)
As
Select
ModuleID
From
tblQuiz
Where
ToolbookID = @ToolBookID
'
END
GO
| true |
b3322a921ddc14911e1cfecb0c44d0ab8e32e9c9 | SQL | aldrix/magvd_imdb | /imdb_data/5.queries_datawarehouse.sql | UTF-8 | 3,733 | 4.03125 | 4 | [] | no_license | -- //-------------------------------------------------------------------//
-- //----------- FREQUENT QUERIES IN DATA WAREHOUSE ----------------//
-- //-------------------------------------------------------------------//
-- 589847
SELECT COUNT(*) FROM pro.dim_actors;
-- 205019
SELECT COUNT(*) FROM pro.dim_directors;
-- 2246
SELECT COUNT(*) FROM pro.dim_genres;
-- 547688
SELECT COUNT(*) FROM pro.dim_titles;
-- 3312406
SELECT COUNT(*) FROM pro.fact_rating;
-- //-------------------------------------------------------------------//
-- QUERY 1
-- Actores cuyas películas han sido
-- mejor valoradas junto con la calificación media de sus películas
WITH best AS( SELECT a.primary_name, a.actor_id, r.average_rating
FROM pro.fact_rating r
JOIN pro.dim_actors a ON a.actor_id = r.actor_id
WHERE a.primary_name != 'Unknown' and r.average_rating != 0
GROUP BY a.primary_name, a.actor_id, r.average_rating
ORDER BY r.average_rating DESC
)
SELECT a.primary_name AS actor , SUM(r.average_rating * r.num_votes)/SUM(r.num_votes) AS calificacion_media
FROM best a
LEFT JOIN pro.fact_rating r ON a.actor_id = r.actor_id
WHERE r.average_rating != 0
GROUP BY a.actor_id, a.primary_name, a.actor_id
ORDER BY calificacion_media DESC
-- LIMIT 200 -- Indicar el numero de actors
;
-- //-------------------------------------------------------------------//
-- QUERY 2
-- Las películas más votadas por los usuarios indicando el número de votos recibidos
-- y la puntuación media
SELECT t.original_title, r.num_votes, SUM(r.average_rating * r.num_votes)/SUM(r.num_votes) AS puntuación_media
FROM pro.fact_rating r
JOIN pro.dim_titles t ON t.title_id = r.title_id
WHERE num_votes != 0
GROUP BY t.original_title, r.num_votes
ORDER BY r.num_votes DESC
-- LIMIT 10
;
-- //-------------------------------------------------------------------//
-- QUERY 3
-- La media de puntuaciones por género
-- I Consideramos todos los generos de la pelicula
SELECT t.genres, SUM(r.average_rating * r.num_votes)/SUM(r.num_votes) AS puntuación_media, count(t.genres)
FROM pro.fact_rating r
JOIN pro.dim_genres t ON t.genres_id = r.genres_id
WHERE num_votes != 0
GROUP BY t.genres
ORDER BY puntuación_media DESC
;
-- II Consideramos solo el genero principal
SELECT t.genres1, SUM(r.average_rating * r.num_votes)/SUM(r.num_votes) AS puntuación_media, count(t.genres)
FROM pro.fact_rating r
JOIN pro.dim_genres t ON t.genres_id = r.genres_id
WHERE num_votes != 0
GROUP BY t.genres1
ORDER BY puntuación_media DESC
-- LIMIT 10
;
-- //-------------------------------------------------------------------//
-- QUERY 4
-- El número de películas de cada género estrenadas en un periodo determinado
SELECT t.genres1, tt.release_year, count(tt.title_id) as movie_totals
FROM pro.fact_rating r
JOIN pro.dim_genres t ON t.genres_id = r.genres_id
JOIN PRO.dim_titles tt ON tt.title_id = r.title_id
WHERE num_votes != 0 and tt.release_year is not null
GROUP BY t.genres1, tt.release_year
ORDER BY movie_totals DESC
;
-- Valoraciones mínima, promedio y máxima de una película o alguno de sus atributos.
-- Valoración promedio de los usuarios para las películas por Productora, Director, Género y Actores.
-- Número de valoraciones de usuarios emitidas por Título, Género, Director, Productora, Actor.
-- Actores cuyas películas han sido mejor valoradas junto con la calificación media de sus películas.
-- Películas más votadas por los Usuarios indicando el número de votos recibidos y la puntuación media.
-- Número de películas de cada Género estrenadas en un periodo determinado.
| true |
caa0538e5a89475cfbafd757439f9fc4423aa99c | SQL | fanfzj/example | /online_ks/data/db_online.sql | UTF-8 | 3,484 | 2.921875 | 3 | [] | no_license | # Host: localhost (Version: 5.5.34)
# Date: 2014-01-12 22:51:56
# Generator: MySQL-Front 5.3 (Build 4.43)
/*!40101 SET NAMES utf8 */;
#
# Structure for table "tb_admin"
#
CREATE TABLE `tb_admin` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '用户名',
`pwd` varchar(50) NOT NULL DEFAULT '' COMMENT '密码',
PRIMARY KEY (`Id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=gb2312 COMMENT='管理员表';
#
# Data for table "tb_admin"
#
INSERT INTO `tb_admin` VALUES (1,'root','root');
#
# Structure for table "tb_kt"
#
CREATE TABLE `tb_kt` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`kt_lb` varchar(100) NOT NULL DEFAULT '' COMMENT '试卷',
`kt_lx` int(11) NOT NULL DEFAULT '0' COMMENT '类型',
`kt_small_lb` varchar(255) NOT NULL DEFAULT '' COMMENT '套题',
`kt_id` varchar(20) NOT NULL DEFAULT 'kt_',
`kt_nr` varchar(255) NOT NULL DEFAULT '' COMMENT '内容',
`kt_fs` int(11) NOT NULL DEFAULT '10' COMMENT '分数',
`kt_daan` varchar(255) DEFAULT '' COMMENT '答案',
`kt_zqdaan` varchar(255) NOT NULL DEFAULT '' COMMENT '正确答案',
PRIMARY KEY (`Id`)
) ENGINE=MyISAM AUTO_INCREMENT=55 DEFAULT CHARSET=gb2312 COMMENT='考题';
#
# Data for table "tb_kt"
#
INSERT INTO `tb_kt` VALUES (1,'测试',0,'第一套题','kt_01','单选测试',10,'A.a*B.b','A.a'),(2,'测试',1,'第一套题','kt_11','多选测试',10,'A.a*B.b','A.a*B.b'),(3,'测试',2,'第一套题','kt_21','简答测试',10,'','A.a'),(4,'测试',3,'第一套题','kt_31','论述测试',10,'','A.a'),(5,'测试',0,'第一套题','kt_02','测试1',10,'A.测试1*B.测试2','A.测试1'),(6,'测试',0,'第一套题','kt_03','测试3',10,'A.测试1*B.测试2','B.测试2'),(7,'测试',2,'第一套题','kt_22','简单测试2',10,'','撒的撒打算'),(53,'测试',2,'第一套题','kt_23','简答测试4',10,'','按时打算打算的大神');
#
# Structure for table "tb_ktlb"
#
CREATE TABLE `tb_ktlb` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ktlb` varchar(50) NOT NULL DEFAULT '' COMMENT '考题列表',
PRIMARY KEY (`Id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=gb2312 COMMENT='考题列表';
#
# Data for table "tb_ktlb"
#
INSERT INTO `tb_ktlb` VALUES (5,'测试2'),(6,'测试'),(8,'1'),(9,'a'),(10,'A'),(13,'啊');
#
# Structure for table "tb_user"
#
CREATE TABLE `tb_user` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(100) NOT NULL DEFAULT '' COMMENT '姓名',
`pass` varchar(50) NOT NULL DEFAULT '' COMMENT '密码',
`tel` varchar(13) NOT NULL DEFAULT '0' COMMENT '电话号吗',
`address` varchar(200) NOT NULL DEFAULT '' COMMENT '地址',
`number` varchar(10) NOT NULL DEFAULT '' COMMENT '准考证号',
PRIMARY KEY (`Id`)
) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=gb2312 COMMENT='考生信息表';
#
# Data for table "tb_user"
#
INSERT INTO `tb_user` VALUES (19,'范志俊','1234','021-63730691','上海','2012021039');
#
# Structure for table "tb_user_grade"
#
CREATE TABLE `tb_user_grade` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`number` int(11) NOT NULL DEFAULT '0' COMMENT '准考证号',
`examsubject` varchar(100) NOT NULL DEFAULT '' COMMENT '科目',
`grade` int(11) NOT NULL DEFAULT '0' COMMENT '分数',
`datetime` datetime DEFAULT NULL COMMENT '考试时间',
PRIMARY KEY (`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=gb2312;
#
# Data for table "tb_user_grade"
#
INSERT INTO `tb_user_grade` VALUES (4,2012021039,'测试',40,'2014-01-12 22:32:33');
| true |
d2d9634ada2888f5c22b0aa8670ec93f8ffb8001 | SQL | artouiros/spring-security-registration-login-example | /src/main/resources/db.sql | UTF-8 | 2,520 | 3.25 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 3.5.5
-- http://www.phpmyadmin.net
--
-- Хост: 127.0.0.1
-- Время создания: Июл 17 2016 г., 08:04
-- Версия сервера: 5.5.49-0ubuntu0.14.04.1
-- Версия PHP: 5.3.28
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 */;
--
-- База данных: `accounts`
--
CREATE DATABASE IF NOT EXISTS `accounts` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `accounts`;
-- --------------------------------------------------------
--
-- Структура таблицы `role`
--
DROP TABLE IF EXISTS `role`;
CREATE TABLE IF NOT EXISTS `role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Дамп данных таблицы `role`
--
INSERT INTO `role` (`id`, `name`) VALUES
(1, 'ROLE_USER');
-- --------------------------------------------------------
--
-- Структура таблицы `user`
--
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
-- --------------------------------------------------------
--
-- Структура таблицы `user_role`
--
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE IF NOT EXISTS `user_role` (
`user_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
PRIMARY KEY (`user_id`,`role_id`),
KEY `fk_user_role_roleid_idx` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Ограничения внешнего ключа сохраненных таблиц
--
--
-- Ограничения внешнего ключа таблицы `user_role`
--
ALTER TABLE `user_role`
ADD CONSTRAINT `fk_user_role_roleid` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_user_role_userid` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
74bacf9359e0c0cdf8b06d94fe641ab3e897f1a3 | SQL | MaggieFan2018/SQL_Exercises | /LeetCode/Window Function/1077. 项目员工 III.sql | UTF-8 | 245 | 3.890625 | 4 | [] | no_license | SELECT project_id, employee_id
FROM
(
SELECT p.project_id, p.employee_id, e.experience_years, RANK() OVER(PARTITION BY p.project_id ORDER BY e.experience_years DESC) RK
FROM Project p
LEFT JOIN Employee e
USING(employee_id)
) t
WHERE RK = 1;
| true |
206a04775f0a70120fd0ce7731dfeb6dca7bcaa1 | SQL | raeyx/Leetcode-exercise | /shortest-distance-in-a-line/shortest-distance-in-a-line.sql | UTF-8 | 93 | 3.28125 | 3 | [] | no_license | SELECT MIN(ABS(p1.x - p2.x)) AS shortest
FROM point p1
INNER JOIN point p2
ON p1.x != p2.x;
| true |
f2ac25c06a760c28fa6c9cc8a6aff1f475c6418b | SQL | zq111/vn-server2 | /resource/sql/farmwork1.sql | UTF-8 | 3,451 | 3.234375 | 3 | [] | no_license | /*
SQLyog v12.2.6 (64 bit)
MySQL - 5.5.62 : Database - farmwork1
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`farmwork1` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `farmwork1`;
/*Table structure for table `t_system_menu` */
DROP TABLE IF EXISTS `t_system_menu`;
CREATE TABLE `t_system_menu` (
`uuid` varchar(40) NOT NULL COMMENT '这是注释',
`is_leaf` varchar(40) DEFAULT NULL,
`level` int(11) DEFAULT NULL COMMENT '这是注释',
`menu_icon` varchar(40) DEFAULT NULL COMMENT '这是注释',
`menu_name` varchar(40) DEFAULT NULL COMMENT '这是注释',
`menu_remark` varchar(40) DEFAULT NULL,
`menu_url` varchar(40) DEFAULT NULL COMMENT '这是注释',
`parent_uuid` varchar(40) DEFAULT NULL,
`sort_num` int(11) DEFAULT NULL COMMENT '这是注释',
`create_date` datetime DEFAULT NULL,
`delete_date` datetime DEFAULT NULL,
`is_delete` varchar(40) DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Table structure for table `t_system_menu_user` */
DROP TABLE IF EXISTS `t_system_menu_user`;
CREATE TABLE `t_system_menu_user` (
`user_uuid` varchar(40) NOT NULL,
`menu_uuid` varchar(40) NOT NULL,
`uuid` varchar(40) NOT NULL,
`create_date` datetime DEFAULT NULL,
`delete_date` datetime DEFAULT NULL,
`is_delete` varchar(40) DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
PRIMARY KEY (`user_uuid`,`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Table structure for table `t_system_record` */
DROP TABLE IF EXISTS `t_system_record`;
CREATE TABLE `t_system_record` (
`uuid` varchar(40) NOT NULL,
`create_date` datetime DEFAULT NULL,
`delete_date` datetime DEFAULT NULL,
`is_delete` int(11) DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`channel` varchar(40) DEFAULT NULL,
`cost_time` varchar(40) DEFAULT NULL,
`memberuuid` varchar(40) DEFAULT NULL,
`method` varchar(40) DEFAULT NULL,
`module` varchar(40) DEFAULT NULL,
`req_data` varchar(400) DEFAULT NULL,
`resp_data` varchar(15000) DEFAULT NULL,
`source_ip` varchar(40) DEFAULT NULL,
`status` varchar(5) DEFAULT NULL,
PRIMARY KEY (`uuid`),
KEY `INDEX_RECORD_CHANNLE` (`channel`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Table structure for table `t_system_user` */
DROP TABLE IF EXISTS `t_system_user`;
CREATE TABLE `t_system_user` (
`uuid` varchar(40) NOT NULL,
`in_use` varchar(20) DEFAULT NULL,
`mobile` varchar(20) DEFAULT NULL,
`password` varchar(40) DEFAULT NULL,
`username` varchar(40) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`delete_date` datetime DEFAULT NULL,
`is_delete` varchar(40) DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
| true |
7fe03844c55a06a657742c5838ec299c141b4bd3 | SQL | haiaunht/Springboot-Hibernate-RESTfulAPIs | /java-web-rsvp/target/classes/db/migration/V1__create_participants.sql | UTF-8 | 485 | 3.15625 | 3 | [] | no_license | CREATE TABLE events (
id SERIAL PRIMARY KEY ,
title VARCHAR(255) NOT NULL ,
street VARCHAR(355) NOT NULL ,
city VARCHAR(255) NOT NULL ,
state VARCHAR(2) NOT NULL ,
postal_code VARCHAR(255) NOT NULL
);
CREATE TABLE participants (
id SERIAL PRIMARY KEY ,
first_name VARCHAR(255) NOT NULL ,
last_name VARCHAR(255) NOT NULL ,
email VARCHAR(255) NOT NULL ,
phone VARCHAR(15) NOT NULL ,
contact_type VARCHAR(255) NOT NULL,
event_id INTEGER REFERENCES events(id)
); | true |
d07f7ba13127cc65f4de66e84cb3738a4be4a903 | SQL | marcoputon/Apolice | /src/main/resources/db/migration/V004_create_table_beneficiario.sql | UTF-8 | 344 | 2.703125 | 3 | [
"MIT"
] | permissive | CREATE TABLE beneficiario (
id bigint(20) NOT NULL AUTO_INCREMENT,
documento text DEFAULT NULL,
nome varchar(100) NOT NULL,
valor bigint(20) NOT NULL,
id_apolice bigint(20) NOT NULL,
PRIMARY KEY (id),
KEY beneficiario_FK (id_apolice),
CONSTRAINT beneficiario_FK FOREIGN KEY (id_apolice) REFERENCES apolice (id)
) | true |
6701da7da06e3ee3e4a6d46dba96544dbb8044c9 | SQL | anton-manin/BookmarkManager | /db.sql | UTF-8 | 1,674 | 3.765625 | 4 | [] | no_license | CREATE TABLE `bookmark`.`USERS` (
`NICKNAME` varchar(25) NOT NULL,
`EMAIL` varchar(45) NOT NULL,
`PASSWORD` varchar(1024) NOT NULL,
`ENABLED` TINYINT(1) NOT NULL,
PRIMARY KEY(`EMAIL`),
UNIQUE KEY uni_email (`EMAIL`)
)Engine=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `bookmark`.`USER_ROLES` (
`USER_ROLE_ID` int(11) NOT NULL AUTO_INCREMENT,
`EMAIL` varchar(45) NOT NULL,
`ROLE` varchar(45) NOT NULL,
PRIMARY KEY(`USER_ROLE_ID`),
UNIQUE KEY uni_email_role (`ROLE`, `EMAIL`),
KEY fk_email_idx(`EMAIL`),
CONSTRAINT fk_email FOREIGN KEY (`EMAIL`) REFERENCES `bookmark`.`USERS`(`EMAIL`)
)Engine=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `bookmark`.`PERSISTENT_LOGINS` (
`USERNAME` varchar(64) not null,
`SERIES` varchar(64) not null,
`TOKEN` varchar(64) not null,
`LAST_USED` timestamp not null,
PRIMARY KEY (`SERIES`)
)Engine=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `bookmark`.`FOLDER` (
`FOLDER_ID` int(10) NOT NULL AUTO_INCREMENT,
`NAME` varchar(45) NOT NULL,
`PARENT_ID` int(10),
`USERNAME` varchar(64) NOT NULL,
PRIMARY KEY(`FOLDER_ID`),
CONSTRAINT `fk_parent_id` FOREIGN KEY(`PARENT_ID`) REFERENCES `FOLDER`(`FOLDER_ID`),
CONSTRAINT `fk_username` FOREIGN KEY(`USERNAME`) REFERENCES `USERS`(`EMAIL`)
) Engine=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `bookmark`.`BOOKMARK` (
`BOOKMARK_ID` int(10) NOT NULL AUTO_INCREMENT,
`DESCRIPTION` varchar(200) NOT NULL,
`URL` varchar(1024) NOT NULL,
`FOLDER_ID` int(10) NOT NULL,
PRIMARY KEY(`BOOKMARK_ID`),
CONSTRAINT fk_folder_id FOREIGN KEY(`FOLDER_ID`) REFERENCES `FOLDER`(`FOLDER_ID`)
)Engine=InnoDB DEFAULT CHARSET=utf8; | true |
5f7c7545ce15276c373ffe047d62bbf9f143d5ff | SQL | stajun/digital | /SQL/SQL5일차.sql | UTF-8 | 2,127 | 4.40625 | 4 | [] | no_license | /*
select 속성명1, 속성명2, ..., 속성명n from 테이블A
join 테이블B
on 테이블A.속성a = 테이블B.속성b;
*/
-- 속성a의 값은 속성b의 값이거나 null이어야한다.
-- 속성b의 값은 속성a의 값이거나 null이어야한다.
/*
select 보고싶은속성명 from 테이블;
select 보고싶은속성명 from 테이블 where 검색조건;
*/
-- 수강을 하고 있는 수강생들의 학번과 이름을 출력하는 쿼리문(중복 불가)
select * from attend;
select distinct at_st_num, st_name
from attend
join student
on at_st_num = st_num;
-- 2020123001학번 학생이 수강한 강의번호를 출력하는 쿼리문
select at_co_num from attend where at_st_num = 2020123001;
-- 2020123001학번 학생이 수강한 강의시간표를 출력하는 쿼리문
select co_timetable from attend
join course on co_num = at_co_num
where at_st_num = 2020123001;
-- 2020123001학번 학생이 2020년 2학기에 수강한 강의시간표를 출력하는 쿼리문
select co_timetable from attend
join course on co_num = at_co_num
where at_st_num = 2020123001
and co_year = 2020
and co_term = 2;
-- 2020123001학번 학생이 2020년 2학기에 수강한 과목명을 출력하는 쿼리문
select su_title from attend
join course on co_num = at_co_num
join `subject` on su_num = co_su_num
where at_st_num = 2020123001
and co_year = 2020
and co_term = 2;
-- 교수번호가 2010160001인 교수님의 지도 학생학번을 출력하는 쿼리문
select gu_st_num from guide where gu_pr_num = 2010160001;
-- 교수번호가 2010160001인 교수님의 지도 학생이름을 출력하는 쿼리문
select st_num, st_name from guide
join student on gu_st_num = st_num
where gu_pr_num = 2010160001;
-- 교수번호가 2010160001인 교수님의 지도 학생이름과 교수명을 출력하는 쿼리문
select pr_name as '교수명', st_num as '학생학번', st_name as '학생명'
from guide
join student on gu_st_num = st_num
join professor on gu_pr_num = pr_num
where gu_pr_num = 2010160001;
| true |
2f4c396eca20c8f1b6996e325f87678533b6ca24 | SQL | bellmit/BIGR | /BIGRDatabase/Scripts/Maint/sga_stats.sql | UTF-8 | 4,471 | 3.984375 | 4 | [] | no_license | set lines 100 pages 40
column object_name format a30
column owner format a15
column object_type format a10
column POOL format a15
prompt ***** Free memory in shared pool *****
select * from v$sgastat
order by pool, name
/
prompt ***** Data dictionary cache hit ratio *****
select sum(gets) "Gets", sum(getmisses) "Misses",
(1-(sum(getmisses)/(sum(gets) + sum(getmisses)))) * 100 "HitRate"
from v$rowcache
/
prompt ***** Library cache hit ratio *****
select sum(pins) Executions, sum(pinhits) "Execution Hits",
((sum(pinhits) / sum(pins)) * 100) phitrat,
sum(reloads) Misses,
((sum(pins) / (sum(pins) + sum(reloads))) * 100) hitrat
from v$librarycache
/
prompt ***** Check hit ratio on DB block buffers *****
select (1-(sum(decode(name,'physical reads',value,0))/
(sum(decode(name,'db block gets',value,0)) +
(sum(decode(name,'consistent gets',value,0)))))) * 100
"Read Hit Ratio"
from v$sysstat
/
prompt ***** Check the number of cursors per session ****
select user_name, sid, count(*)
from v$open_cursor
group by user_name, sid
order by count(*) desc;
prompt ***** Check status of DB block buffers in x$bh *****
select decode(status,'free','FREE',
'xcur','EXCLUSIVE',
'scur','SHARED CURRENT',
'cr','CONSISTANT READ',
'read','BEING READ',
'mrec','MEDIA RECOVERY',
'irec','INSTANCE RECOVERY',
'OTHER') "CURRENT STATUS",
count(*) "COUNT"
from v_$bh
group by status order by 2 desc
/
--select decode(state,0,'FREE',1,decode(lrba_seq, 0, 'AVAILABLE','BEING USED'),
--3, 'BEING USED',state) "BLOCK STATUS", count(*) from x$bh
--group by decode(state,0,'FREE',1,decode(lrba_seq, 0, 'AVAILABLE','BEING USED'),
--3, 'BEING USED',state)
--/
prompt ***** Utilization of buffers by pool - summary (SYS and SYSTEM not included) *****
select bpd.bp_name "POOL",
bpd.bp_size "POOL SIZE",
obj.owner,
count(*) "NUM BLOCKS",
round((count(*)/bpd.bp_size)*100,2) "PCT USAGE"
from sys.x$kcbwds wds,
sys.x$kcbwbpd bpd,
sys.x$bh bh,
(select owner, data_object_id
from sys.dba_objects
group by owner, data_object_id) obj
where bh.set_ds = wds.addr
and wds.set_id between bpd.bp_lo_sid and bpd.bp_hi_sid
and bpd.bp_size > 0
and bh.obj = obj.data_object_id
group by rollup(bpd.bp_name, bpd.bp_size, obj.owner)
/
prompt ***** Utilization of buffers by pool - detail (SYS and SYSTEM not included) *****
select bpd.bp_name "POOL",
obj.owner,
obj.object_type,
obj.object_name,
count(*) "NUM BLOCKS",
sum(bh.tch) "TOUCH"
from sys.x$kcbwds wds,
sys.x$kcbwbpd bpd,
sys.x$bh bh,
sys.dba_objects obj
where bh.obj <> 2
and bh.set_ds = wds.addr
and wds.set_id between bpd.bp_lo_sid and bpd.bp_hi_sid
and bpd.bp_size > 0
and bh.obj = obj.data_object_id
and obj.owner not in ('SYS','SYSTEM')
and bh.tch > 10
group by bpd.bp_name, obj.owner, obj.object_type, obj.object_name
order by 1,6
/
prompt ***** Gross-level instance stats on PGA memory usage *****
--This view provides instance-level statistics on the PGA memory usage and the automatic PGA memory manager.
SELECT * FROM V$PGASTAT;
prompt ***** Work areas executed in PGA memory size levels - detail *****
--This view shows the number of work areas executed with optimal memory size, one- pass memory size,
--and multi-pass memory size since instance start-up. Statistics in this view are subdivided into buckets
--that are defined by the optimal memory requirement of the work area. Each bucket is identified by a range of optimal
--memory requirements specified by the values of the columns LOW_OPTIMAL_SIZE and HIGH_OPTIMAL_SIZE.
SELECT LOW_OPTIMAL_SIZE/1024 low_kb,
(HIGH_OPTIMAL_SIZE+1)/1024 high_kb,
optimal_executions,
onepass_executions,
multipasses_executions
FROM v$sql_workarea_histogram
WHERE total_executions != 0;
prompt ***** PGA_TARGET_ADVICE statistics *****
--V$PGA_TARGET_ADVICE view predicts how the statistics cache hit percentage and over allocation count in V$PGASTAT
--will be impacted if you change the value of the initialization parameter PGA_AGGREGATE_TARGET. The following select
--statement can be used to find this information
SELECT round(PGA_TARGET_FOR_ESTIMATE/1024/1024) target_mb,
ESTD_PGA_CACHE_HIT_PERCENTAGE cache_hit_perc,
ESTD_OVERALLOC_COUNT
FROM v$pga_target_advice;
prompt *****************************END OF SGA STATS*************************************
| true |
4f7ca55f0abba973b98a54f253396467e03eb832 | SQL | mukeshpal/NODE-ChatServerAndClient | /Database/ChatServerDB.sql | UTF-8 | 3,608 | 3.0625 | 3 | [] | no_license | CREATE DATABASE IF NOT EXISTS `chatserver` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `chatserver`;
-- MySQL dump 10.13 Distrib 5.5.16, for Win32 (x86)
--
-- Host: localhost Database: chatserver
-- ------------------------------------------------------
-- Server version 5.5.16
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `lookupmessages`
--
DROP TABLE IF EXISTS `lookupmessages`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lookupmessages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`message` varchar(45) DEFAULT NULL,
`code` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `chathistory`
--
DROP TABLE IF EXISTS `chathistory`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chathistory` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`users` varchar(145) DEFAULT NULL,
`text` text,
`timestamp` datetime DEFAULT NULL,
`LastModifiedDate` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) DEFAULT NULL,
`UserName` varchar(45) DEFAULT NULL,
`Password` varchar(45) DEFAULT NULL,
`MobileNo` varchar(45) DEFAULT NULL,
`Email` varchar(45) DEFAULT NULL,
`Status` int(11) DEFAULT NULL,
`IsDeleted` int(11) DEFAULT NULL,
`CreatedDate` datetime DEFAULT NULL,
`LastLoggedInDate` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `errorresponse`
--
DROP TABLE IF EXISTS `errorresponse`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `errorresponse` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`detail` varchar(45) DEFAULT NULL,
`dateTimeStamp` datetime DEFAULT NULL,
`deviceType` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2014-05-05 13:07:43
| true |
e18694a00b271e7ca13807d79f7ac832236a65b4 | SQL | wangpengcheng123/wang | /src/main/java/m03/d30/wuzhen/returnBook.sql | UTF-8 | 474 | 2.6875 | 3 | [] | no_license | DROP PROCEDURE returnbook;
DELIMITER ;;
CREATE PROCEDURE returnbook(IN rname1 VARCHAR(30))
BEGIN
INSERT INTO penalty VALUES('09','003','2018-03-20',1,4.6);
UPDATE borrow SET returndate=NOW() WHERE rid=(SELECT rid FROM reader WHERE rname=rname1);
UPDATE reader SET lendnum=lendnum-1 WHERE rname=rname1;
UPDATE book SET bcount=bcount+1 WHERE bid=(SELECT nif FROM borrow WHERE rid=(SELECT rid FROM reader WHERE rname=rname1));
END
;;
DELIMITER ;
CALL returnbook('刘冰冰');
| true |
6000b5576a94660d797b95ec6347ce043e3c34a7 | SQL | Goular/LaravelModule | /数据库备份/2017-08-25-144600.sql | UTF-8 | 63,816 | 3.25 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 2017-08-25 14:44:28
-- 服务器版本: 10.1.21-MariaDB
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `laravel54`
--
-- --------------------------------------------------------
--
-- 表的结构 `admin_permissions`
--
CREATE TABLE `admin_permissions` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_permissions`
--
INSERT INTO `admin_permissions` (`id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'system', '系统管理', '2017-08-15 08:00:22', '2017-08-15 08:00:22'),
(2, 'post', '文章管理', '2017-08-15 08:01:07', '2017-08-15 08:01:07'),
(3, 'topic', '专题管理', '2017-08-15 09:21:19', '2017-08-15 09:21:19'),
(4, 'notice', '通知管理', '2017-08-15 09:21:43', '2017-08-15 09:21:43');
-- --------------------------------------------------------
--
-- 表的结构 `admin_permission_role`
--
CREATE TABLE `admin_permission_role` (
`id` int(10) UNSIGNED NOT NULL,
`permission_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_permission_role`
--
INSERT INTO `admin_permission_role` (`id`, `permission_id`, `role_id`, `created_at`, `updated_at`) VALUES
(3, 2, 1, NULL, NULL),
(4, 1, 1, NULL, NULL),
(5, 3, 1, NULL, NULL),
(6, 4, 1, NULL, NULL),
(7, 2, 2, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_roles`
--
CREATE TABLE `admin_roles` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_roles`
--
INSERT INTO `admin_roles` (`id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(1, '全权限管理员', '附上,全权限管理员', '2017-08-15 08:01:47', '2017-08-15 08:01:47'),
(2, '文章管理员', '附上,文章管理员', '2017-08-15 08:02:33', '2017-08-15 08:02:33');
-- --------------------------------------------------------
--
-- 表的结构 `admin_role_user`
--
CREATE TABLE `admin_role_user` (
`id` int(10) UNSIGNED NOT NULL,
`role_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_role_user`
--
INSERT INTO `admin_role_user` (`id`, `role_id`, `user_id`, `created_at`, `updated_at`) VALUES
(3, 1, 1, NULL, NULL),
(4, 2, 2, NULL, NULL),
(5, 1, 2, NULL, NULL),
(6, 2, 22, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_users`
--
CREATE TABLE `admin_users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_users`
--
INSERT INTO `admin_users` (`id`, `name`, `password`, `created_at`, `updated_at`) VALUES
(1, 'test1', '$2y$10$ikeNyR7tiO5GPjo5Y2srEO5YsfACuR5ZaCeoTVjuznWHDgm9PuiIG', '2017-08-13 13:44:44', '2017-08-13 13:44:44'),
(2, 'Alex Greenholt', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(3, 'Bradford Bogan', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(4, 'Russ Haag Jr.', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(5, 'Dr. Jacinthe Swift', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(6, 'Ms. Ophelia Heidenreich PhD', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(7, 'Nikita Klein', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(8, 'Mrs. Leslie O\'Conner', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(9, 'Abbey Weimann', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(10, 'Danny Bergnaum', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(11, 'Kory Turcotte', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(12, 'Ephraim Monahan', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(13, 'Miss Janet Kub', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(14, 'Prof. Herbert Langworth II', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(15, 'Pascale Schultz', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(16, 'Mrs. May Pacocha', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(17, 'Dr. Alexis Heathcote', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(18, 'Corene Wuckert', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(19, 'Mr. Victor Altenwerth', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(20, 'Fredrick Russel', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(21, 'Peter Orn', '$2y$10$fABOVzF1jKAFfdMUNCnhxONvknDW7lvzCvmj9wN0bscvwrh.sFg2O', '2017-08-14 02:42:44', '2017-08-14 02:42:44'),
(22, 'test2', '$2y$10$jsP6nVNjVQl2fkXzKZe07eIaNv.LInXNzEzC7FWQ6yv4TLv3GS0Ey', '2017-08-14 03:26:31', '2017-08-14 03:26:31'),
(23, 'test3', '$2y$10$KXY92dy3nx6m2Xqfn9ClMOhml92wo6LdkNDyPwoTrmgLIxWTZ5CnG', '2017-08-15 07:50:34', '2017-08-15 07:50:34'),
(24, 'test5', '$2y$10$cgNL56FfrCxlc/qEHkL4n.50PDGUQuxTw1X1lsPdysPjZZg.C7EEK', '2017-08-15 07:58:27', '2017-08-15 07:58:27');
-- --------------------------------------------------------
--
-- 表的结构 `comments`
--
CREATE TABLE `comments` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`post_id` int(11) NOT NULL DEFAULT '0',
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `comments`
--
INSERT INTO `comments` (`id`, `user_id`, `post_id`, `content`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '创传来利好凌乱', '2017-08-09 06:26:01', '2017-08-09 06:26:01'),
(2, 1, 1, '进出口打死俺看了弄咯', '2017-08-09 06:45:34', '2017-08-09 06:45:34'),
(3, 1, 1, 'dsfsdfds', '2017-08-09 13:12:34', '2017-08-09 13:12:34');
-- --------------------------------------------------------
--
-- 表的结构 `fans`
--
CREATE TABLE `fans` (
`id` int(10) UNSIGNED NOT NULL,
`fan_id` int(11) NOT NULL DEFAULT '0',
`star_id` int(11) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `fans`
--
INSERT INTO `fans` (`id`, `fan_id`, `star_id`, `created_at`, `updated_at`) VALUES
(17, 1, 2, '2017-08-10 16:00:00', '2017-08-10 16:00:00'),
(19, 3, 1, '2017-08-10 16:00:00', '2017-08-10 16:00:00'),
(21, 1, 5, '2017-08-11 07:59:33', '2017-08-11 07:59:33');
-- --------------------------------------------------------
--
-- 表的结构 `jobs`
--
CREATE TABLE `jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`queue` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`attempts` tinyint(3) UNSIGNED NOT NULL,
`reserved_at` int(10) UNSIGNED DEFAULT NULL,
`available_at` int(10) UNSIGNED NOT NULL,
`created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `jobs`
--
INSERT INTO `jobs` (`id`, `queue`, `payload`, `attempts`, `reserved_at`, `available_at`, `created_at`) VALUES
(1, 'default', '{\"displayName\":\"App\\\\Jobs\\\\FileAppendContent\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"timeout\":null,\"data\":{\"commandName\":\"App\\\\Jobs\\\\FileAppendContent\",\"command\":\"O:26:\\\"App\\\\Jobs\\\\FileAppendContent\\\":5:{s:7:\\\"content\\\";s:19:\\\"\\u7231\\u5947\\u827aVIP\\u4f1a\\u5458.\\\";s:6:\\\"\\u0000*\\u0000job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;}\"}}', 0, NULL, 1503389347, 1503389347),
(2, 'default', '{\"displayName\":\"App\\\\Jobs\\\\FileAppendContent\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"timeout\":null,\"data\":{\"commandName\":\"App\\\\Jobs\\\\FileAppendContent\",\"command\":\"O:26:\\\"App\\\\Jobs\\\\FileAppendContent\\\":5:{s:7:\\\"content\\\";s:19:\\\"\\u7231\\u5947\\u827aVIP\\u4f1a\\u5458.\\\";s:6:\\\"\\u0000*\\u0000job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;}\"}}', 0, NULL, 1503389358, 1503389358),
(3, 'default', '{\"displayName\":\"App\\\\Jobs\\\\FileAppendContent\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"timeout\":null,\"data\":{\"commandName\":\"App\\\\Jobs\\\\FileAppendContent\",\"command\":\"O:26:\\\"App\\\\Jobs\\\\FileAppendContent\\\":5:{s:7:\\\"content\\\";s:19:\\\"\\u7231\\u5947\\u827aVIP\\u4f1a\\u5458.\\\";s:6:\\\"\\u0000*\\u0000job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;}\"}}', 0, NULL, 1503389361, 1503389361),
(4, 'default', '{\"displayName\":\"App\\\\Jobs\\\\FileAppendContent\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"timeout\":null,\"data\":{\"commandName\":\"App\\\\Jobs\\\\FileAppendContent\",\"command\":\"O:26:\\\"App\\\\Jobs\\\\FileAppendContent\\\":5:{s:7:\\\"content\\\";s:19:\\\"\\u7231\\u5947\\u827aVIP\\u4f1a\\u5458.\\\";s:6:\\\"\\u0000*\\u0000job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;}\"}}', 0, NULL, 1503389362, 1503389362),
(5, 'default', '{\"displayName\":\"App\\\\Jobs\\\\FileAppendContent\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"timeout\":null,\"data\":{\"commandName\":\"App\\\\Jobs\\\\FileAppendContent\",\"command\":\"O:26:\\\"App\\\\Jobs\\\\FileAppendContent\\\":5:{s:7:\\\"content\\\";s:19:\\\"\\u7231\\u5947\\u827aVIP\\u4f1a\\u5458.\\\";s:6:\\\"\\u0000*\\u0000job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;}\"}}', 0, NULL, 1503389381, 1503389381),
(6, 'default', '{\"displayName\":\"App\\\\Jobs\\\\FileAppendContent\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":null,\"timeout\":null,\"data\":{\"commandName\":\"App\\\\Jobs\\\\FileAppendContent\",\"command\":\"O:26:\\\"App\\\\Jobs\\\\FileAppendContent\\\":5:{s:7:\\\"content\\\";s:19:\\\"\\u7231\\u5947\\u827aVIP\\u4f1a\\u5458.\\\";s:6:\\\"\\u0000*\\u0000job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:5:\\\"delay\\\";N;}\"}}', 0, NULL, 1503389389, 1503389389);
-- --------------------------------------------------------
--
-- 表的结构 `lessons`
--
CREATE TABLE `lessons` (
`id` int(10) UNSIGNED NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`body` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`free` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `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, '2017_07_30_141107_create_posts_table', 1),
(4, '2017_08_09_101834_create_comments_table', 2),
(5, '2017_08_09_144729_create_zans_table', 3),
(6, '2017_08_10_142455_create_fans_table', 4),
(7, '2017_08_11_222848_create_topics_table', 5),
(8, '2017_08_11_222923_create_post_topics_table', 5),
(9, '2017_08_13_105446_create_admin_users_table', 6),
(10, '2017_08_14_131404_alter_posts_table', 7),
(11, '2017_08_15_102741_create_rbac_table', 8),
(12, '2017_08_16_091444_create_notice_table', 9),
(13, '2017_08_16_113115_create_jobs_table', 10),
(14, '2017_08_21_232821_create_tinyurls_table', 11),
(15, '2017_08_22_095850_alter_shortend_to_tinyurls_table', 12),
(16, '2017_08_22_103544_delete_shortend_to_tinyurls_table', 13),
(17, '2017_08_22_103752_alter_shortend_to_tinyurls_table_2', 14),
(18, '2017_08_25_143629_create_lesson_table', 15);
-- --------------------------------------------------------
--
-- 表的结构 `notices`
--
CREATE TABLE `notices` (
`id` int(10) UNSIGNED NOT NULL,
`title` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`content` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `notices`
--
INSERT INTO `notices` (`id`, `title`, `content`, `created_at`, `updated_at`) VALUES
(2, '这是测试通知1', '测试通知1--内容', '2017-08-16 02:34:32', '2017-08-16 02:34:32'),
(3, '这是测试队列通知1', '这是测试队列通知1--内容详情', '2017-08-16 03:52:10', '2017-08-16 03:52:10'),
(4, 'dddddd', '基础上都ill绿绿绿', '2017-08-16 04:11:38', '2017-08-16 04:11:38'),
(5, '红男绿女', '123336655889', '2017-08-16 04:17:46', '2017-08-16 04:17:46');
-- --------------------------------------------------------
--
-- 表的结构 `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `posts`
--
CREATE TABLE `posts` (
`id` int(10) UNSIGNED NOT NULL,
`title` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`status` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `posts`
--
INSERT INTO `posts` (`id`, `title`, `content`, `user_id`, `created_at`, `updated_at`, `status`) VALUES
(1, '13365大声道', '<p>速度速度所多</p>', 1, '2017-08-08 15:15:34', '2017-08-08 15:15:34', 0),
(2, 'Ipsum consequatur ut nostrum accusantium inventore est.', 'Autem et ut molestiae repellat et. Blanditiis quia vero tempora voluptatem mollitia commodi. Voluptatem perspiciatis ipsa vel voluptas. Voluptate saepe deleniti ut voluptatem. Mollitia sed molestiae minima dolorem. Iure vel maiores fuga odit error tempore. Nesciunt aperiam dicta perspiciatis maxime. Dolores est qui ad voluptatem. Soluta fugit ea veniam consequuntur temporibus quo aut dolores. Laudantium consectetur nihil quidem possimus pariatur earum voluptatem. Sequi ducimus nihil quisquam est. Debitis provident dolorem aut ad voluptate cumque. Nostrum nesciunt magnam enim quis. Maiores iure delectus ratione placeat.', 1, '2017-08-10 02:20:21', '2017-08-10 02:20:21', 0),
(3, 'Voluptates quia ex magnam aut consequatur minus magnam.', 'Consequuntur sint voluptatem dolore quas veritatis. In occaecati veritatis exercitationem. Ut maiores ea eligendi quaerat praesentium fugiat vitae animi. Rerum unde sit corporis culpa sed. Optio earum repellendus animi blanditiis commodi est. Consectetur maiores laboriosam vitae fugiat reprehenderit quam aperiam. Voluptatum maiores excepturi dolorem velit qui sint temporibus.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(4, 'Non tempore provident vel ut libero debitis ipsam.', 'Sint occaecati ad sunt. Totam magni autem possimus est. Modi fuga ex similique error totam aliquid. Consectetur dolores porro porro ratione. Aliquam optio libero odit incidunt aut. Ad fugiat quod praesentium a provident quia dolor esse. Enim provident blanditiis fugiat aut. Explicabo autem ab vel unde omnis. Pariatur nesciunt dolor ratione aut labore aut.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(5, 'Maxime dolor esse aliquam et.', 'Laboriosam qui non deserunt fugit tempore. Eum voluptates necessitatibus enim quia. Qui itaque incidunt nam quidem. A sunt recusandae quam quidem repudiandae dolor. Aliquid deleniti numquam molestias assumenda deleniti. Consequatur molestiae iste id magni sequi magni consequatur. Consequatur vitae quos provident magnam. Vel deserunt voluptas cupiditate. Rem dolor saepe veniam repellendus et cum.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(6, 'Hic minus voluptatem corrupti deleniti enim.', 'Voluptatibus minima minus nemo eaque repellendus quidem. Voluptate tenetur veniam atque. Aperiam maiores asperiores placeat esse modi nostrum laudantium. Placeat molestias vitae dolorem qui. Delectus sit sit autem qui. Dolorem quasi nam sequi nisi aut nisi et. Quaerat mollitia itaque fugit quisquam et dolorem. Ut non dolores accusantium sed sit et consectetur.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(7, 'Distinctio rerum fuga necessitatibus voluptatibus id dolores rem sunt.', 'Quisquam odit voluptatem animi minus sit. Voluptatem et illo hic neque sit voluptatibus blanditiis. Exercitationem ad impedit aut id dolor dolores. Quo ad vitae quis nihil tempora officia. Consequatur dolorem ducimus quia ratione. Minus id voluptatem nisi porro qui aut consequatur. Sed dolores molestias molestiae et vitae sapiente impedit. Fugit autem ut beatae. Et totam quo voluptas temporibus consequatur qui eveniet. Ipsa vel necessitatibus iusto tempora. Facilis assumenda et distinctio et quam commodi repellat. Exercitationem rerum excepturi voluptatem.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(8, 'Id et iste non molestias qui vel.', 'Aut iste fugit delectus natus eos. Fuga pariatur quis est aut. Qui itaque ad qui non asperiores dolore minima consequatur. Modi voluptates rerum quos sunt. Qui aut assumenda numquam dolorum pariatur. Aut qui eaque distinctio inventore omnis consequatur. Asperiores hic maiores sed velit asperiores sit. Sequi omnis fugit totam aut repellendus. Sit rerum quaerat harum quos. Aut fuga eveniet ea totam aut. Eius et praesentium sed hic velit dolor maxime.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(9, 'Officiis nemo repudiandae est illum sed accusantium molestiae.', 'Consequatur excepturi excepturi fugiat ut quas cum. Qui autem debitis quis qui. Maxime ducimus atque est modi commodi dolores. Qui eos eos ut voluptatem atque. Libero harum debitis voluptatem accusantium omnis et dolor. Libero molestiae deserunt velit atque officia aut esse. Et cum dicta laudantium maiores. Natus quisquam aliquid fuga asperiores qui dolor. Vero enim eos voluptate illum laboriosam aut. Tempore est maxime ipsa et ut repellendus iure.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(10, 'Cum iusto voluptates repellat officia aut in veritatis ducimus.', 'Est eligendi quo illo quia cumque sapiente. Error maiores provident et necessitatibus. Culpa voluptate est magnam eum. Dicta eius placeat et quas voluptas dolor fuga. Sapiente earum doloremque atque ut necessitatibus nostrum sunt. In facere aut asperiores harum omnis. Sed labore fugit est fugiat.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(11, 'Et et et aliquid.', 'Aut exercitationem quisquam est enim qui. Reiciendis et aut ad sit animi consectetur dolore. Omnis et expedita nam voluptatem. Quidem possimus iusto dolorum facilis dolore et voluptate quis. Qui quis quaerat officiis iure nisi velit. Voluptates blanditiis possimus ea fuga. Repellat sed quisquam et delectus eos perspiciatis quo. Et ut commodi qui et quod in. Eaque nulla illum vel reiciendis dignissimos. Saepe dicta ex mollitia laborum. Alias ea nobis quia eligendi eligendi veniam pariatur accusantium. Expedita vel omnis corrupti.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(12, 'Praesentium debitis velit architecto ipsa.', 'Eos fugit neque odit magnam voluptas fugit quidem. Quia maxime eos omnis iste est. Vel quia dolor dicta non aliquid. Itaque aliquid qui aperiam delectus repellat reiciendis. Atque maiores tempore quidem. Iste deleniti sit suscipit. Eum et voluptatibus facilis quisquam ad qui. Consequuntur voluptatem illum numquam est est explicabo ad. Quibusdam soluta esse assumenda impedit modi et ullam.', 1, '2017-08-10 02:20:22', '2017-08-10 02:20:22', 0),
(13, 'Aut aliquid quo dolorem iste odio vel magnam.', 'Labore cupiditate quas id ducimus unde corrupti sed. Qui accusantium corrupti temporibus totam voluptas quo. Molestias nisi non voluptas. Totam corrupti maxime atque veniam at et. Dolores ea voluptatem vel excepturi amet. Ea ut iure aut. Atque enim officiis porro quibusdam. Dolorem quis eveniet amet dolore rem. Magnam aut magni rerum in quaerat possimus odit. Quibusdam velit quo sed non laudantium et rerum. Est est sint maiores qui quam esse pariatur. Eaque ad adipisci tenetur quasi non praesentium ipsam sint.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(14, 'Neque nulla omnis inventore animi voluptate rerum quis.', 'Illum tenetur quia fugit itaque ad accusamus ea ut. Alias aperiam nisi asperiores mollitia ducimus ut numquam. Excepturi aliquam minus sit fugiat ducimus. Qui necessitatibus ab dignissimos illum excepturi iure ratione est. Corrupti consequatur deleniti praesentium quidem aut explicabo vel. Eos maxime consectetur odit cumque voluptatem dolor dolor labore. Quam ut illo dolor reprehenderit. Voluptas reprehenderit non sit voluptatem aspernatur. Quas porro veniam eveniet assumenda id. Reprehenderit ut qui repellat delectus expedita ea. Libero est ut reprehenderit eius omnis voluptatem facere. Ipsa ut quae quam dolorem ab. Dolorum aliquid voluptatem esse quod exercitationem at. Autem et et unde nisi.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(15, 'Et dicta sunt nisi rerum aut doloribus magnam.', 'Corporis voluptatem ut consequatur ut odit sit. Corrupti perferendis aliquid qui facilis quod quidem. Ipsam velit placeat quaerat dolore rerum animi. Incidunt rerum ut id quidem dolor aut tenetur ad. Facere porro eum ut. Eaque distinctio optio repellendus est deleniti ipsam. Et dolorem recusandae autem sint maxime. Ut enim aspernatur totam aliquam. Doloribus laboriosam itaque et non eaque sint sequi enim. Neque odit dignissimos sequi.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(16, 'Consequuntur et quis ea id.', 'Temporibus nihil aut nisi ducimus et quis. Quo est consequuntur voluptatem velit voluptatum. Quidem doloremque non nam aperiam nihil qui cumque dolor. Ut enim laborum explicabo ipsam ut ipsam. Consectetur et sint reprehenderit veritatis repudiandae maxime pariatur voluptatem. Tenetur similique id laborum et non cupiditate. Quidem ex ipsa facere voluptatem. Itaque fuga nam omnis quidem et adipisci. Inventore similique ea hic temporibus. Consequatur et qui aut et soluta dolorem nulla aut. Molestiae ad consequatur et eligendi vel qui dolor. Id nostrum beatae praesentium excepturi. Ea assumenda at adipisci ad.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(17, 'Eveniet eos debitis delectus repudiandae voluptatem voluptatem amet.', 'Natus iusto at non voluptates. Illo minima dolor non tempore numquam necessitatibus. Ea officiis reprehenderit consequatur et. Autem commodi consequatur natus ut reiciendis ducimus. Explicabo nihil voluptate autem deserunt omnis dignissimos in. Qui voluptas rerum temporibus magni odit expedita. Nihil accusantium excepturi ab ipsam sunt. Fuga eum quidem autem quo minus odit eum. Accusamus autem magni est eos omnis necessitatibus pariatur. Molestiae quasi voluptas cupiditate reprehenderit rerum nam facere. Amet sint maxime molestias laboriosam. Corrupti nulla eveniet inventore totam odit. Qui eum quia repudiandae ipsum molestiae dolor.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(18, 'Aut quam quibusdam optio.', 'Et qui optio quas non. Est aut quos veritatis ut minima aperiam. Et incidunt totam nemo necessitatibus necessitatibus voluptate. Natus occaecati magni temporibus ut et quo. Facere ut repudiandae qui et ipsa repellat ea. Eos exercitationem est cupiditate fuga repudiandae. Voluptatem eos consectetur eum commodi earum aut quis. Laborum iste est iste ipsa quos vitae. Et dignissimos illo consequatur. Corrupti sit neque nulla tempora aliquam. Eum facilis et ab qui. Totam sequi voluptas excepturi quae ut.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(19, 'Exercitationem ipsam necessitatibus fugit minima soluta dolorem.', 'Rerum qui quidem maiores nesciunt voluptates magnam ut. Beatae vel consequuntur nihil iure. Illum voluptatem et eum libero. Quis quia illo tempore non vel labore nisi. Tempora veniam eos cumque. Laboriosam qui vel et qui quas. Alias quia vitae ipsa dolor dolore aliquam quod.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(20, 'Aut nulla est officiis maiores.', 'Quia minus sed tempora omnis aliquam aliquam quos. Explicabo quia molestiae fugit ab repellat in. Et voluptatem et eligendi a provident recusandae. Praesentium aspernatur explicabo expedita possimus molestiae. Eaque deserunt id et id amet animi est. Assumenda commodi consequatur at atque recusandae amet consequatur. Rerum dolorem explicabo similique ut et quas magnam. A voluptatum non quisquam possimus quia dolor.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(21, 'Aut rem totam quas eos eligendi.', 'Omnis quaerat est expedita velit ut molestiae rerum voluptatem. Sit omnis consectetur atque magnam consequatur. Cumque deserunt repudiandae qui accusamus est molestiae occaecati. Sit rerum excepturi quia. Laboriosam eos accusantium dolorem in. Cumque consequatur non fugiat et eos illum assumenda nulla. Laborum ut voluptatem aut voluptatibus. Odit mollitia sit perspiciatis voluptatibus optio id et quasi. Amet eum esse maiores dolores nostrum facilis harum. Sit sint qui aut delectus. Totam tenetur eaque suscipit. Consequatur doloribus ad voluptatem autem cum. Maiores blanditiis sed consequuntur doloribus voluptates praesentium.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(22, 'Sed repellat quia eveniet earum sint vel suscipit harum.', 'Porro excepturi harum fuga consequuntur omnis et. Voluptas harum tempora incidunt et tempore suscipit. Et ab quo et voluptas voluptate quia. Aut reiciendis velit id eum officia non. Quaerat veritatis nulla placeat id id dolorem totam. Asperiores quos numquam officia magnam. Aut soluta quam quasi voluptatem sit. In est consequuntur est voluptatem. Quis laboriosam quisquam distinctio sapiente. Natus eum delectus consequatur quia dolorem impedit. Ut quia neque magnam esse vero corporis.', 1, '2017-08-10 02:20:23', '2017-08-10 02:20:23', 0),
(23, 'Vel dolores ipsa fugiat totam minima voluptatibus recusandae.', 'Qui rerum error enim et. Sit qui repellat dolores et. Expedita quia asperiores fuga similique in laudantium. Non est et nihil blanditiis. Cumque eaque assumenda et. Ut officia et aut numquam aut. Velit autem sint et consequatur ut sit. In omnis voluptates et distinctio. Saepe iste eligendi vero numquam a sunt.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(24, 'Expedita sit quis aut.', 'Sint qui quae id quidem natus provident. Enim placeat ut eveniet voluptates. Pariatur labore repellat voluptas ullam. Architecto sit consequuntur odit maxime et consequatur. Qui qui sit illo fugit. Minima tempora nihil dolorem sequi repellat. Earum est hic dolorum voluptatem. Ipsam veniam a omnis cumque. Sunt et voluptatem sunt culpa consectetur. Quas voluptatem omnis culpa modi fuga. Soluta ratione soluta consectetur impedit ratione fuga. Asperiores inventore dolore et. Voluptatem autem velit consectetur quia tempore et. Soluta impedit est sit nihil.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(25, 'Quo quae deleniti occaecati omnis perferendis esse.', 'Hic est laudantium dolore consequatur eos ut. Dignissimos ut possimus corrupti odio ipsa ut ut dolorem. Modi recusandae molestias est repudiandae expedita maxime vero. Tempora sit consequatur eum cupiditate repudiandae atque. Repellat reprehenderit voluptatem qui quas. Iste eos similique commodi eum aut quis quam. Sapiente perferendis aut facilis quasi quibusdam velit ipsam dolor. Neque sed alias nisi excepturi.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(26, 'Eos esse praesentium necessitatibus ipsum quidem aperiam quia est.', 'Consequatur blanditiis architecto qui et facere quo. Repellat optio molestiae ad voluptate voluptatem. Consequatur voluptatem doloremque et eius eaque dignissimos fugit. Quibusdam eaque enim rem vel. Ex officiis non veniam atque. Repudiandae laboriosam velit non aut quis. Sapiente placeat modi doloribus officia. Impedit vitae dolorum dicta aut ab quo reprehenderit.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(27, 'Dolores doloremque ab ex nesciunt et at.', 'Minima commodi quia quasi qui natus minus. Doloribus temporibus labore labore deserunt suscipit cum. Ex vitae aut voluptatibus. Eum qui est aut architecto voluptas soluta. Qui est consequatur cum nobis rem corporis. Atque possimus at hic cupiditate. Eius eius fugiat enim dolorem repudiandae aspernatur sunt. Dolorum fuga sunt incidunt qui officia placeat. Hic autem dolor non consequatur cumque.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(28, 'Harum repellat nostrum dolorem est consequatur.', 'Sunt ab possimus tempore consequatur. Sed minus dolores fugit et laborum illum debitis. Consequatur numquam aut itaque atque omnis magni ipsa perferendis. Facilis numquam aut distinctio aut modi aut at non. Sit voluptates vel tempore suscipit harum labore. Id assumenda porro cupiditate qui vel et. Natus rerum ducimus alias velit. Corrupti illum vel eaque a optio voluptate.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(29, 'Id rerum harum veritatis nesciunt est.', 'Sit minus consequatur doloremque in nobis tempore. Expedita sunt exercitationem nam est. Vel ratione magni veniam pariatur. Labore et earum esse nisi. Distinctio sed eum adipisci officiis et. Dolorem quibusdam natus debitis id ratione et aut. Vitae nobis natus doloribus et rem. Ipsam error perferendis culpa iure cum ut. Numquam eligendi fugiat animi amet natus nulla aperiam. Nemo in excepturi laborum ullam quaerat est id qui. Voluptates ut saepe quibusdam aut error autem. Rerum et illo voluptas aut.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(30, 'Ex in voluptatem quia quas aspernatur.', 'Quisquam magni ipsam optio qui sit dolorum illo consequatur. Placeat sint odit est quaerat et expedita soluta. Nobis sed nobis quia veritatis nam vero quis eos. Perferendis minus deserunt nisi corrupti in laborum ea amet. Facere quae excepturi ea autem voluptatem distinctio. Dignissimos deserunt aut culpa et et. Maiores dolores minima rem et recusandae corporis aut. Aut praesentium assumenda fugiat. Quo expedita consequatur nam quis voluptas ex quo. Vero et inventore tempora labore repudiandae non. Aut similique magni rerum dolores reprehenderit. Atque expedita et aut. Voluptas nemo architecto vel consequuntur et error.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(31, 'Similique aut explicabo et possimus blanditiis reiciendis cupiditate debitis.', 'Repellendus unde fugit quia. Et qui atque et sunt doloremque. Repudiandae sapiente nihil qui hic doloremque explicabo. Sunt consequuntur quod laboriosam quisquam rerum qui. Quia culpa consequatur est neque. Aliquam asperiores odit necessitatibus aut. Dolores sit ipsam est tempore molestias atque. Vel expedita labore et et. Et quidem in in dignissimos dolorum blanditiis dolores. Esse voluptas tempora minus.', 1, '2017-08-10 02:20:24', '2017-08-10 02:20:24', 0),
(32, 'Est neque iure ut et unde quasi et.', 'Doloremque iste voluptas ipsa accusantium beatae et praesentium ut. Est necessitatibus illo ea cumque est culpa veritatis. Accusantium sint beatae nobis maxime est nam. Dolorem ex ut dolores optio. Libero quaerat nulla modi molestiae in eaque vel. Nisi et eos veniam quisquam labore tempore. Temporibus rerum aliquid necessitatibus blanditiis maiores eum. Et nobis officia est voluptas cum omnis. Quaerat vel ipsum ipsam aliquam. Nostrum suscipit quam consequatur quia delectus sint. Aut id porro fugiat doloribus enim voluptatem. Illum est accusantium facere rerum repudiandae omnis expedita minima. Quisquam rerum at eius est. In ea illo ad velit provident eum quas.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(33, 'Nemo aspernatur sapiente reiciendis aliquid consequuntur ipsa voluptatum.', 'Dignissimos aliquam et optio et sequi suscipit asperiores. Vel quis qui quasi numquam aut. Qui amet qui saepe qui qui fuga magnam facilis. Cumque adipisci explicabo id quia neque odit eum. Harum et cupiditate explicabo maiores ipsum placeat. Assumenda maxime non et assumenda. Excepturi ipsum tenetur et expedita libero laudantium. Tempora veritatis sit facere qui voluptate. Consequatur molestiae reprehenderit ea veritatis aliquam eos veritatis commodi. Et porro in voluptate adipisci porro iste. Aliquid autem quia voluptatem delectus repudiandae. Sint voluptatibus accusamus voluptatem et consequatur. Quia non ipsa deleniti sit.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(34, 'Quia nobis sit illo at velit ab perferendis.', 'Quis aut perspiciatis tenetur consequatur. Fuga commodi et nostrum enim dolorem dolores. Atque nihil aut et aspernatur in et quas. A ex voluptatem aperiam aspernatur excepturi doloribus. Labore quam cum dolores id. Quibusdam dolor voluptate sit iusto. Repellendus corporis voluptas beatae consequuntur et. Quis sed non velit necessitatibus accusamus qui. Dolor quasi sed dicta perferendis deleniti maxime suscipit consequuntur. Mollitia odit cum similique totam assumenda fugiat.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(35, 'Eos eos saepe veniam dolorem doloremque odit voluptas.', 'Saepe ut vitae magni quae quia. Hic sed maxime labore est sunt. Aperiam vel id fugit corporis consequatur. Impedit ut voluptate reprehenderit reprehenderit ipsam. Nobis ipsam praesentium et sed culpa tempore. Dicta deserunt incidunt ut saepe vel fuga sint. Consequuntur excepturi commodi animi dicta. Ea amet voluptas voluptas culpa. Temporibus molestiae enim et ut laboriosam est et. Optio impedit eum unde.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(36, 'Omnis accusantium ea quia suscipit expedita.', 'Sapiente laudantium cupiditate quae alias architecto suscipit. Temporibus rem ea eaque dolore quia corrupti dolorem nihil. At illo dolorum magni nemo. Et ipsum aut omnis dolores molestiae reiciendis. Alias dolor doloribus quas perferendis itaque laboriosam. Quia ad ducimus alias vel suscipit debitis nulla est. Sed atque mollitia non quo. Non consequatur a perferendis sed voluptas quidem. Voluptas officia omnis iure sed. Aut dignissimos earum sit ducimus. Omnis harum possimus quia aspernatur. Dolor fuga sit modi cumque doloremque ab nesciunt.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(37, 'Culpa et deserunt laudantium natus beatae velit.', 'Necessitatibus sit ab nemo omnis non. Aut et consequatur rerum illum dignissimos. Ipsum hic veniam corporis asperiores fugiat praesentium quam. Necessitatibus debitis deserunt nemo enim soluta illo. Modi ea porro voluptates nam aspernatur cum. Ex quisquam labore quod consequatur nam omnis eius. Aspernatur quod ut recusandae laboriosam dolor voluptas est. Ipsum nesciunt sequi doloremque autem minus dolorum accusamus ipsam. Animi asperiores itaque qui est. Voluptas molestiae sed numquam voluptatum magni aut officiis. A ut vel explicabo omnis.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(38, 'Et quia dicta quia et et.', 'Nemo quia temporibus molestiae est et. Nam ut aut qui molestias. Aut ut sit eaque molestias officia ut error. Qui cum rerum accusantium provident magnam voluptate. Laborum et impedit explicabo quae molestiae quisquam iste autem. Et ut autem corrupti optio optio aliquam. Porro eaque quam fugiat sed maiores aut. Est voluptatem nesciunt et possimus eos ut.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(39, 'Nam mollitia nemo est placeat omnis porro quia.', 'Natus iusto suscipit quidem quo fugiat ad laboriosam. Esse dolorem aspernatur fugiat voluptas aut quo et. Aliquam amet ducimus hic facere non ut nostrum. Beatae non doloribus aspernatur sit nihil et. Maiores velit et delectus veniam nesciunt. Et autem quo et. Provident aut perspiciatis similique est qui. Modi doloremque recusandae natus velit aliquam ab id.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(40, 'Mollitia facere non magnam inventore.', 'Voluptate repellat nam occaecati voluptatibus aspernatur quam. Veniam sint ea reiciendis rerum eos eos sit. Sint nihil ullam amet ab aut odit non. Est pariatur voluptate voluptatem qui nesciunt est. Et rerum quia dolorem enim ad ea voluptate unde. Animi eos molestias odit rerum sapiente. Nisi odio eum et explicabo impedit reiciendis id. Omnis assumenda eaque error veritatis iusto.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(41, 'Veritatis aut quia distinctio nostrum ut quasi ea.', 'Non nobis id dolor. Non perferendis voluptas incidunt ut excepturi. Sint quod vel omnis nihil. Quas voluptas voluptates rem at sit maxime officiis. Molestiae libero voluptatibus quam molestiae eaque adipisci nostrum. Magnam laboriosam pariatur est perferendis at laborum. Quidem consequatur eius doloremque qui ducimus.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(42, 'Consequatur fugit sit sed sed fuga.', 'Odio sequi facilis dolorem impedit. Maxime soluta omnis rem voluptatem. Et sequi deserunt dolores. Doloremque et repudiandae possimus inventore aspernatur hic. Quisquam ratione dolore iste veniam. Eum fugiat dicta corporis ullam repellat dignissimos rem. Corrupti totam dolore porro autem sapiente sequi velit. Et quidem molestiae dolorum molestiae. Aspernatur quaerat at in quod ut. Quis quasi sunt sit asperiores iure. Dolores eius odio quia eveniet officiis.', 1, '2017-08-10 02:20:25', '2017-08-10 02:20:25', 0),
(43, 'Est neque nihil omnis vel at fuga.', 'Est vero iure sit voluptate ut. Sed sed molestiae sed culpa sunt aut sit. Ipsum sint neque reiciendis maiores voluptatem nulla libero. Sequi officiis in amet doloribus. Molestiae doloribus aliquam explicabo quisquam vel non voluptates sit. Fuga ex ut ducimus. Distinctio occaecati ea assumenda officia et. Natus labore cupiditate aut non vitae ut eius. In fuga ratione est assumenda quia similique provident. Ut enim minima dolorem et perferendis. Accusantium beatae doloribus error. Quae tenetur amet eum necessitatibus sequi laboriosam expedita nesciunt. Repellendus et aliquam autem beatae voluptatem. Accusamus expedita ea odio soluta autem enim.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(44, 'Voluptas eum nemo laborum quis.', 'Veniam odio delectus consequatur est consequatur atque. Tenetur et perferendis deserunt aspernatur numquam. Velit exercitationem quasi quo rerum dicta est similique. Sit consequatur perferendis repudiandae minima magni. Sit vel ut eligendi possimus. Repellendus fuga et laudantium laboriosam aliquid aperiam. Quidem earum consequatur adipisci occaecati rerum et sed eos. Ea aut harum maxime consequatur sit quae. Et dolor voluptatum id provident. Perferendis ut at porro molestiae laboriosam. Voluptatem ducimus eius expedita ex voluptatum rerum.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(45, 'Aliquam est est fuga laboriosam quidem quidem nihil.', 'Iure veniam ea et quo quia ut aut. Et laboriosam architecto qui molestiae. Aut esse ab necessitatibus asperiores beatae a non. Ullam et quia dolore repudiandae aut inventore sapiente est. Accusantium qui accusamus dolores est quas laboriosam assumenda. Consequatur quo deleniti blanditiis repudiandae eum. Eaque molestias nam expedita laudantium animi. Nesciunt est voluptatem in. Ea voluptate magni qui dolorem voluptatem.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(46, 'Ipsa totam beatae dolorem.', 'Repudiandae deleniti ea odit similique. Deleniti dolore est velit doloribus assumenda. Labore perferendis quia minus vitae reprehenderit occaecati possimus. Autem ut voluptas quis enim qui ducimus. Voluptatibus officiis vero placeat. Rem alias error nulla atque. Quos sunt sed quam ducimus et non. Qui placeat odit omnis vero. Commodi quasi aut est. Iusto nihil ipsam consectetur quas deleniti reprehenderit qui. Rerum iure aliquam vel minus est similique.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(47, 'Et enim sint consequatur ut et.', 'Similique iure ipsum recusandae quos. Alias maiores explicabo repudiandae. Rerum quo vitae quia neque. Id et fugiat dolores odit alias dolor et. Quidem minima eos dolores. Atque tenetur quia qui qui molestiae repellat. Necessitatibus perferendis eum nobis qui dolore vitae. Voluptatem esse odit voluptas qui. Sit doloribus aliquam minima reiciendis. Tenetur enim aut aut eligendi modi qui. Est est cumque aperiam asperiores. Architecto eius provident nisi aliquam amet nam.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(48, 'Minima aut placeat unde libero reiciendis beatae sed.', 'Nesciunt in aut adipisci vero consequuntur. Quasi beatae molestiae non ipsa voluptate itaque totam. Dolorem explicabo dolor nesciunt aliquam omnis et. Nihil quam aut ut et vel. Ut nihil praesentium enim. Vel maxime ipsa maiores magni. Optio maxime dolore qui neque quaerat eligendi eum. Aliquid nemo adipisci quia aut. Enim id dolores ab nemo vitae blanditiis. Vel numquam placeat voluptas. Eos unde porro necessitatibus sint quia.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(49, 'Aut rerum nisi quia quod culpa mollitia est.', 'Eligendi est assumenda dolorem dolor veritatis perferendis. Et officia corporis harum odit magnam. Optio minima repudiandae non eum perferendis a sed provident. Voluptates aut neque incidunt omnis earum ut. Perspiciatis magnam rerum qui occaecati. Voluptatum veniam nihil odit quibusdam dolorum. Rem qui dolor aut iste praesentium. Sed quae ad et natus facilis ad enim culpa. Sapiente expedita eum commodi in itaque enim sint. Dolorem ipsam perferendis voluptatibus molestias. Dolor aut voluptas repudiandae pariatur ab molestias est. Deleniti magnam minima est quisquam.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(50, 'Et mollitia similique exercitationem quidem.', 'Et est quis qui quos dolorem ea mollitia qui. Temporibus autem iusto dignissimos rem. Molestias ut qui nisi. Voluptatum qui perferendis non illo molestiae quo. Dolores nemo temporibus expedita est consequatur. Voluptatum ab dolorem suscipit et velit. Consequatur pariatur commodi deleniti. Reiciendis iste ullam ullam unde mollitia asperiores maxime esse. Debitis est repellendus laborum libero rerum reiciendis amet.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(51, 'Facilis suscipit ea eligendi eos qui voluptatem.', 'Hic molestiae quam autem atque et recusandae alias quo. Et illum rerum sed eligendi quo. Necessitatibus laborum quis debitis deleniti et. Omnis impedit aperiam quia a nobis inventore ut. Enim quis eveniet sit odit et in. Porro deleniti nihil blanditiis vel ratione voluptas. Voluptatem id autem nihil consequatur velit rerum harum.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(52, 'Blanditiis sunt vero necessitatibus eos officiis esse.', 'Voluptatem at fugiat vel. Tenetur impedit ipsum reprehenderit nesciunt quisquam et. Reiciendis non adipisci eum vel accusamus. Doloremque saepe et dolore tempore sed deleniti quia. Eum aliquam temporibus ad sequi quo. Nesciunt magnam debitis explicabo. Numquam praesentium totam consequatur praesentium commodi suscipit recusandae. Voluptatem laudantium non mollitia illo nihil. Quibusdam voluptas quis molestias eum quia est. Soluta hic modi molestiae sed. Sunt tempore qui nihil sint voluptas. Totam placeat dolor sunt accusantium cupiditate magnam. Ab aliquid eum possimus aut placeat ad.', 1, '2017-08-10 02:20:26', '2017-08-10 02:20:26', 0),
(53, 'Expedita corporis facere officiis amet nostrum dolorem cum.', 'Non voluptas itaque veritatis dolor aut aliquid. A porro itaque recusandae rerum. Fugit dolor necessitatibus itaque voluptatem. Debitis et at iure. Consequatur dolor ipsa dolores modi dolor ut reiciendis nihil. Qui ratione vel rerum eos itaque earum nesciunt. Sit omnis in eum quo rerum dolor enim. Natus sed voluptates fugiat quam voluptas aut totam. Iusto temporibus laborum temporibus exercitationem. Voluptatem hic voluptatem veniam. Ratione nihil autem animi repellendus inventore nesciunt ullam. Rerum voluptates assumenda autem. Quia omnis possimus vero molestias.', 1, '2017-08-10 02:20:27', '2017-08-14 07:03:48', 1),
(54, 'Sint ratione nam cumque magnam voluptatem.', 'Quos aut non sed totam. Dolore quo alias et praesentium et sit et sit. Ut voluptas rerum quas velit. Et fugit qui et omnis nemo aut quas nisi. Sed nihil molestiae autem quo. Cumque commodi laboriosam sint. Velit dolorem est illo voluptas. Facilis reprehenderit quod voluptas quo voluptas. Enim provident odio tempora magnam. Commodi voluptate cum animi modi laudantium ut cupiditate. Quos tempore illum quia totam. Deserunt similique maiores molestias vitae sint esse.', 1, '2017-08-10 02:20:27', '2017-08-10 02:20:27', 0),
(55, 'Iste mollitia molestiae voluptas facere.', 'Ea unde qui rerum quibusdam. Assumenda quas eius harum. Ut est quo aspernatur qui repellat enim reprehenderit. Voluptatem debitis deserunt autem reiciendis. Et blanditiis et excepturi earum beatae perferendis quaerat omnis. Aut est totam facilis eaque sint voluptas. Iusto dolorem dolores aut est consequuntur explicabo fugiat. Est sed asperiores est et blanditiis quam. Qui provident impedit ipsam praesentium voluptatibus optio. Consectetur architecto quas ut rerum omnis voluptates at.', 1, '2017-08-10 02:20:27', '2017-08-10 02:20:27', 0),
(56, 'Mollitia assumenda quia temporibus id assumenda sunt.', 'Quasi voluptatem voluptatum impedit velit. Accusantium dolorum eum sunt nesciunt. Dolores qui deserunt voluptatem itaque dolor assumenda iste. Suscipit eius optio veniam. Libero quasi hic voluptas nihil laborum. Saepe atque tempora non quia. Ea dignissimos consequatur velit culpa odit mollitia. Animi nemo debitis fugit quia nobis maxime. Exercitationem aut et et rem. Ipsum et quo modi rem vitae ea. Dolores nulla consequuntur nobis accusantium similique.', 1, '2017-08-10 02:20:27', '2017-08-10 02:20:27', 0),
(57, 'Eveniet pariatur earum dolores qui cumque veritatis qui atque.', 'Iste ab perferendis recusandae qui dolores. Et commodi iure perferendis incidunt qui vel saepe. Voluptatibus debitis quam laudantium placeat non. Aut voluptas adipisci dolore hic. Ipsa architecto est possimus esse consequatur. Tempora vel sit quo. Vitae excepturi dolorem nisi. Deserunt esse iusto sed. Tenetur sit in sit ab. Omnis praesentium reprehenderit id est sit. Et voluptate incidunt quod et rem.', 1, '2017-08-10 02:20:27', '2017-08-10 02:20:27', 0),
(58, 'Suscipit aliquid fuga quasi consequatur.', 'Odit et exercitationem et eos est eaque. Dolorum officiis fugiat a dolores dolor quia. Aperiam reiciendis doloremque et qui. Earum error voluptatem non sit earum quasi mollitia. Voluptatem modi autem aut doloremque iste eveniet et. Doloribus delectus perferendis dolores ut. Aut similique itaque accusantium distinctio natus alias vel. Numquam ipsa laborum non aut in delectus. Consectetur nemo voluptatem tempore in hic doloremque temporibus aut. Et facilis neque necessitatibus porro praesentium possimus quo. Quo voluptas aliquid ipsam aut maxime corporis soluta. Facere eveniet excepturi quis.', 1, '2017-08-10 02:20:27', '2017-08-10 02:20:27', 0),
(59, 'Praesentium hic inventore distinctio commodi impedit.', 'Odit alias aut omnis numquam odit sed necessitatibus ut. Nisi itaque ex suscipit totam. Consequatur quo ut veritatis dolorum quia doloribus. Omnis dolor repellendus adipisci rerum aperiam quam porro. Optio vel rerum et quo impedit sed expedita. Beatae ex aliquid voluptas. Distinctio enim quod accusantium voluptas distinctio. Suscipit et voluptas molestias officia. Amet sed adipisci et dolorem aliquam. Provident dolorem et blanditiis non. In nihil qui magnam dolore quasi occaecati ea. Labore ut sed id praesentium aut ut.', 1, '2017-08-10 02:20:27', '2017-08-10 02:20:27', 0),
(60, 'Dolore et quo numquam nam.', 'Consectetur ut voluptatem autem vel consequatur pariatur rerum. Doloremque qui et quia laboriosam. Suscipit qui minus rerum. Dolor hic quia facere qui tempora aut. Officiis dolorum sint eaque et ut. Vitae possimus veritatis nihil qui sit tenetur minus. Numquam quas odio saepe est.', 1, '2017-08-10 02:20:27', '2017-08-10 02:20:27', 0),
(61, 'Molestiae odit sed dolor molestiae.', 'Cum et molestiae minima architecto voluptatem neque qui dolorum. Nisi inventore delectus illo molestiae consectetur voluptatem aut. Vitae debitis ipsum ipsa. Adipisci facilis nihil soluta voluptatem asperiores voluptatibus. Non error exercitationem magnam animi facilis. Est aliquid suscipit expedita velit quia provident. Necessitatibus provident distinctio ipsam voluptatem error aut. Eum veniam velit unde corporis asperiores. Ut eveniet aut qui autem incidunt corporis non. Totam possimus molestiae omnis alias. Non laudantium quia ipsum voluptas. Modi sit voluptas modi qui molestiae.', 1, '2017-08-10 02:20:27', '2017-08-10 02:20:27', 0),
(62, '富力4-2苏宁 恒丰客场3-0胜申花', '北京时间8月9日19点35,中超联赛第21轮打响,广州富力主场4-2完胜江苏苏宁,取得联赛4连胜。第2分钟R马丁内斯杀入禁区一记弧线球兜射命中,上半场补时阶段卢琳门前垫射扳平比分,第55分钟扎哈维左路内切至禁区线右脚抽入世界波将比分反超,第62分钟唐淼助攻肖智头球扩大比分,第72分钟雷纳尔迪尼奥禁区内打死角锦上添花,第89分钟马丁内斯禁区内低射远角得手。</p><p> “土豪金”的越秀山是当前中超最被热议的话题,富力在“土豪金”氛围中的近4个主场取得全胜,更是火力全开打入18球,扎哈维本赛季入球数已提升到22球。苏宁近5轮2胜3平形成持续抢分,积分提升到18分已同降级区拉开3分距离,本赛季前9个客场苏宁1胜5平3负(打入10球失16球)。中超交锋史上富力对苏宁4胜5平2负,富力主场对苏宁2胜3平保持不败;本赛季首回合较量富力客场2-1战胜苏宁,扎哈维梅开二度。</p><p> 富力方面陈志钊结束禁赛替补待命,苏宁方面特谢拉休战,R马搭档穆坎乔,汪嵩首发迎战旧主。开场仅仅2分钟客场作战的江苏苏宁队就取得梦幻开局——吉翔中路斜传,马丁内斯禁区左侧面对2人防守,突然人缝中右脚兜射远角,皮球直挂球门死角,1-0!</p>\n<script>(sinaads = window.sinaads || []).push({element: document.getElementById(\"Sina_Plista_AD\")});</script>\n<ins></ins><p> 第13分钟,拉米雷斯前场断球极速前进,直塞到小禁区右侧,穆坎乔插上跟进一脚抽射,程月磊飞身一挡,用长臂把球扑出底线。汪嵩主罚右侧角球弧线球给到禁区,前点马丁内斯头球一甩,黄征宇将球挡出底线。第19分钟姜志鹏后场一记斜传,禁区前沿卢琳头球摆渡,扎哈维插上甩开防守抹入禁区,面对门将的抽射滑门而出。第24分钟,姜志鹏左路下底突破后搓传门前,卢琳抢点甩头攻门,皮球又一次意外打偏。第28分钟,扎哈维远距离直接发炮,一记爆射打飞</p>', 1, '2017-08-10 02:22:55', '2017-08-14 07:03:43', 0),
(63, '释放是离婚后的能耐临港', '<p>独守空房了几十块龙卷风看电视剧分类看电视剧分手的距离咖啡机的数量</p>', 1, '2017-08-11 03:29:40', '2017-08-11 03:29:40', 0);
-- --------------------------------------------------------
--
-- 表的结构 `post_topics`
--
CREATE TABLE `post_topics` (
`id` int(10) UNSIGNED NOT NULL,
`post_id` int(11) NOT NULL DEFAULT '0',
`topic_id` int(11) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `post_topics`
--
INSERT INTO `post_topics` (`id`, `post_id`, `topic_id`, `created_at`, `updated_at`) VALUES
(1, 2, 1, '2017-08-12 07:52:21', '2017-08-12 07:52:21'),
(2, 3, 1, '2017-08-12 07:52:21', '2017-08-12 07:52:21'),
(3, 5, 1, '2017-08-12 07:52:21', '2017-08-12 07:52:21'),
(4, 1, 3, '2017-08-12 07:52:34', '2017-08-12 07:52:34'),
(5, 62, 3, '2017-08-12 07:52:34', '2017-08-12 07:52:34'),
(6, 63, 3, '2017-08-12 07:52:34', '2017-08-12 07:52:34');
-- --------------------------------------------------------
--
-- 表的结构 `tiny_urls`
--
CREATE TABLE `tiny_urls` (
`id` int(10) UNSIGNED NOT NULL,
`url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`shortUrl` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `tiny_urls`
--
INSERT INTO `tiny_urls` (`id`, `url`, `shortUrl`, `created_at`, `updated_at`) VALUES
(1, 'http://www.ifeng.com', 'http://6du.in/0ixB0Q', '2017-08-22 02:44:05', '2017-08-22 02:44:05'),
(2, 'http://www.114la.com/', 'http://6du.in/0j1K5OL', '2017-08-22 02:46:53', '2017-08-22 02:46:53'),
(3, 'http://www.ifeng.com/', 'http://6du.in/0j1K5PQ', '2017-08-22 03:34:02', '2017-08-22 03:34:02');
-- --------------------------------------------------------
--
-- 表的结构 `topics`
--
CREATE TABLE `topics` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `topics`
--
INSERT INTO `topics` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, '旅游', '2017-08-12 01:49:01', '2017-08-12 01:49:01'),
(2, '文学', '2017-08-12 01:49:01', '2017-08-12 01:49:01'),
(3, 'NBA', '2017-08-12 01:49:01', '2017-08-12 01:49:01');
-- --------------------------------------------------------
--
-- 表的结构 `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'root', 'root@163.com', '$2y$10$lYHBfgf/65.XRA/rRwWE1eaH2uGiY0uEj56qGYWGzHDfLHCD9eEV6', 'DNRTWxx83GQmLMUidDC5OeRIFX4njl9jKXlsw0f7vqadeneG7s0eN6LycpzU', '2017-08-08 07:00:55', '2017-08-08 07:00:55'),
(2, 'root2', 'root@1633.com', '$2y$10$R1LXOyIt4tOenungazejHOXub41pf.nH5SS/TOW7izZSorBuIJsXO', NULL, '2017-08-08 15:52:57', '2017-08-08 15:52:57'),
(3, 'goular', 'goular@163.com', '$2y$10$R1LXOyIt4tOenungazejHOXub41pf.nH5SS/TOW7izZSorBuIJsXO', NULL, '2017-08-10 16:00:00', '2017-08-10 16:00:00'),
(5, 'goular2', 'goular1@163.com', '$2y$10$R1LXOyIt4tOenungazejHOXub41pf.nH5SS/TOW7izZSorBuIJsXO', NULL, '2017-08-10 16:00:00', '2017-08-10 16:00:00');
-- --------------------------------------------------------
--
-- 表的结构 `user_notice`
--
CREATE TABLE `user_notice` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`notice_id` int(11) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `user_notice`
--
INSERT INTO `user_notice` (`id`, `user_id`, `notice_id`, `created_at`, `updated_at`) VALUES
(1, 1, 2, '2017-08-15 16:00:00', '2017-08-15 16:00:00'),
(2, 1, 3, NULL, NULL),
(3, 2, 3, NULL, NULL),
(4, 3, 3, NULL, NULL),
(5, 5, 3, NULL, NULL),
(6, 1, 4, NULL, NULL),
(7, 2, 4, NULL, NULL),
(8, 3, 4, NULL, NULL),
(9, 5, 4, NULL, NULL),
(10, 1, 5, NULL, NULL),
(11, 2, 5, NULL, NULL),
(12, 3, 5, NULL, NULL),
(13, 5, 5, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `zans`
--
CREATE TABLE `zans` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`post_id` int(11) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `zans`
--
INSERT INTO `zans` (`id`, `user_id`, `post_id`, `created_at`, `updated_at`) VALUES
(2, 1, 1, '2017-08-09 07:17:12', '2017-08-09 07:17:12'),
(3, 1, 63, '2017-08-11 03:33:33', '2017-08-11 03:33:33');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin_permissions`
--
ALTER TABLE `admin_permissions`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `admin_permission_role`
--
ALTER TABLE `admin_permission_role`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `admin_roles`
--
ALTER TABLE `admin_roles`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `admin_role_user`
--
ALTER TABLE `admin_role_user`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `admin_users`
--
ALTER TABLE `admin_users`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `fans`
--
ALTER TABLE `fans`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
ADD PRIMARY KEY (`id`),
ADD KEY `jobs_queue_reserved_at_index` (`queue`,`reserved_at`);
--
-- Indexes for table `lessons`
--
ALTER TABLE `lessons`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `notices`
--
ALTER TABLE `notices`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `post_topics`
--
ALTER TABLE `post_topics`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tiny_urls`
--
ALTER TABLE `tiny_urls`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `topics`
--
ALTER TABLE `topics`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- Indexes for table `user_notice`
--
ALTER TABLE `user_notice`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `zans`
--
ALTER TABLE `zans`
ADD PRIMARY KEY (`id`);
--
-- 在导出的表使用AUTO_INCREMENT
--
--
-- 使用表AUTO_INCREMENT `admin_permissions`
--
ALTER TABLE `admin_permissions`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- 使用表AUTO_INCREMENT `admin_permission_role`
--
ALTER TABLE `admin_permission_role`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- 使用表AUTO_INCREMENT `admin_roles`
--
ALTER TABLE `admin_roles`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- 使用表AUTO_INCREMENT `admin_role_user`
--
ALTER TABLE `admin_role_user`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- 使用表AUTO_INCREMENT `admin_users`
--
ALTER TABLE `admin_users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- 使用表AUTO_INCREMENT `comments`
--
ALTER TABLE `comments`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- 使用表AUTO_INCREMENT `fans`
--
ALTER TABLE `fans`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- 使用表AUTO_INCREMENT `jobs`
--
ALTER TABLE `jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- 使用表AUTO_INCREMENT `lessons`
--
ALTER TABLE `lessons`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- 使用表AUTO_INCREMENT `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- 使用表AUTO_INCREMENT `notices`
--
ALTER TABLE `notices`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- 使用表AUTO_INCREMENT `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=64;
--
-- 使用表AUTO_INCREMENT `post_topics`
--
ALTER TABLE `post_topics`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- 使用表AUTO_INCREMENT `tiny_urls`
--
ALTER TABLE `tiny_urls`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- 使用表AUTO_INCREMENT `topics`
--
ALTER TABLE `topics`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- 使用表AUTO_INCREMENT `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- 使用表AUTO_INCREMENT `user_notice`
--
ALTER TABLE `user_notice`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- 使用表AUTO_INCREMENT `zans`
--
ALTER TABLE `zans`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
/*!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 |
59128e49b856134c89b79e338334b8ee91244e4d | SQL | kamacasta/SQL-Employee-Tracker | /db/seeds.sql | UTF-8 | 455 | 3.34375 | 3 | [] | no_license | USE employeeConnection;
-- Department
INSERT INTO department(name)
VALUES ('Engineer'),('Management'),('HR'),('Sales')
-- Role
INSERT INTO role(title, salary, department_id)
VALUES ('Management', 150000, 1),('Engineer', 125000, 2),('Sales', 110000, 3),('HR', 75000, 4)
-- Employee
INSERT INTO employee(first_name, last_name, role_id)
VALUES ('Kama', 'Casta', 1, NULL),('Rick', 'Sanchez', 2, NULL),('Morty', 'Smith', 3, NULL),('MR', 'MEESEKS', 4, NULL) | true |
fb2d39435ea5c07fdcf23993e1546cf64e7b6306 | SQL | vmase001/FUI_Assigments | /Database/SQLQueries/q2.sql | UTF-8 | 97 | 2.71875 | 3 | [] | no_license | select ssn, fname, lname
from employee
where dno = 5
group by employee.ssn
having salary >= 35000 | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.