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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0e5b252dc93e6e4d48f15bb083fc7439d8ff82b5
|
SQL
|
pfatcat/checkbook
|
/src/data/create_schema.sql
|
UTF-8
| 1,127
| 4
| 4
|
[] |
no_license
|
DROP TABLE IF EXISTS transactions;
DROP TABLE IF EXISTS payee_lookup;
DROP TABLE IF EXISTS payees;
DROP TABLE IF EXISTS categories;
PRAGMA foreign_keys = ON;
CREATE TABLE categories
(id UUID PRIMARY KEY,
name VARCHAR(255) UNIQUE,
inserted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
--create default category record
INSERT INTO categories
(id, name)
SELECT 'f74a549c-3d46-4efd-95bb-935c642b649b', 'Uncategorized';
CREATE TABLE payees (
id TEXT PRIMARY KEY,
name TEXT UNIQUE,
default_category_id TEXT,
inserted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(default_category_id) REFERENCES categories(id)
);
CREATE TABLE payee_lookup (
id TEXT PRIMARY KEY,
payee_id TEXT,
reference_name TEXT UNIQUE,
inserted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(payee_id) REFERENCES payees(id)
);
CREATE TABLE transactions (
id TEXT PRIMARY KEY,
transaction_date TEXT,
payee_id TEXT,
memo TEXT,
category_id TEXT,
amount REAL,
reference_code TEXT UNIQUE,
inserted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(payee_id) REFERENCES payees(id),
FOREIGN KEY(category_id) REFERENCES categories(id)
);
COMMIT;
| true
|
50776a7fb009df5223ccfc06d492a764f5c69b46
|
SQL
|
saumy1110/ftp01
|
/database/database.ddl
|
UTF-8
| 536
| 3.25
| 3
|
[] |
no_license
|
-- change this to your team id
use FTP01;
-- comment this line for the very first time
drop table if exists EMPLOYEE;
-- create the table
create table EMPLOYEE (EMP_ID int primary key);
--Update the table
UPDATE EMPLOYEE SET EMP_ID=1005 WHERE EMP_ID=1000;
--to SELECT the table
SELECT * FROM EMPLOYEE;
--delete the table
DELETE FROM EMPLOYEE WHERE EMP_ID=2000;
--examples of creating the new databases
CREATE DATABASE FTP1;
CREATE USER 'FTP1'@'localhost' IDENTIFIED BY 'FTP1';
GRANT ALL ON FTP01.* TO 'FTP01'@'localhost';
| true
|
d6e6832b06f1b8ec579cfe668fef8298f0492581
|
SQL
|
PrachiGupta/Contact-Application
|
/src/main/resources/migrations/1536672202-create-contacts.sql
|
UTF-8
| 510
| 3.1875
| 3
|
[] |
no_license
|
--liquibase formatted sql
--changeset john_doe:1536672202
CREATE TABLE `contacts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(50) NOT NULL DEFAULT '',
`name` varchar(100) DEFAULT NULL,
`type` varchar(10) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`created_at` bigint(20) NOT NULL,
`updated_at` bigint(20) NOT NULL,
version INT(11) UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--rollback drop table contacts
| true
|
2c8210362130a59153bdfdcb90b43956bd5a86af
|
SQL
|
mrkaptep/lifestailend
|
/db/post/get_tag_for_post.sql
|
UTF-8
| 459
| 2.953125
| 3
|
[] |
no_license
|
SELECT
tailend_posts.post_id,
tailend_posts.author_id,
tailend_posts.date_created,
tailend_posts.title,
tailend_posts.content,
post_tags.tag_id,
tailend_tags.tag
FROM tailend_posts
JOIN post_tags on tailend_posts.post_id = post_tags.post_id
JOIN tailend_tags on tailend_tags.tag_id = post_tags.tag_id
-- SELECT * FROM tailend_posts
-- join post_tags on tailend_posts.post_id = post_tags.post_id
-- join tailend_tags on tailend_tags.tag_id = post_tags.tag_id
| true
|
d38b2ffbe0412a0e9410cef42e4f7f60eba80d30
|
SQL
|
czbone/magic3
|
/include/sql/update/2010071301_to_2010072301.sql
|
UTF-8
| 2,188
| 2.640625
| 3
|
[] |
no_license
|
-- *
-- * バージョンアップ用スクリプト
-- *
-- * PHP versions 5
-- *
-- * LICENSE: This source file is licensed under the terms of the GNU General Public License.
-- *
-- * @package Magic3 Framework
-- * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
-- * @copyright Copyright 2006-2010 Magic3 Project.
-- * @license http://www.gnu.org/copyleft/gpl.html GPL License
-- * @version SVN: $Id: 2010071301_to_2010072301.sql 3427 2010-07-26 03:47:18Z fishbone $
-- * @link http://www.magic3.org
-- *
-- --------------------------------------------------------------------------------------------------
-- バージョンアップ用スクリプト
-- --------------------------------------------------------------------------------------------------
-- *** システムベーステーブル ***
-- ウィジェット情報マスター(管理用)
INSERT INTO _widgets
(wd_id, wd_name, wd_author, wd_copyright, wd_license, wd_official_level, wd_available, wd_editable, wd_initialized, wd_launch_index, wd_install_dt, wd_create_dt) VALUES
('admin_menu3', '管理用メニュー3', 'Naoki Hirata', 'Magic3.org', 'GPL', 10, false, false, true, 100, now(), now());
-- ウィジェット情報マスター(PC用)
DELETE FROM _widgets WHERE wd_id = 'pretty_photo';
INSERT INTO _widgets
(wd_id, wd_name, wd_version, wd_author, wd_copyright, wd_license, wd_official_level, wd_description, wd_add_script_lib, wd_add_script_lib_a, wd_read_scripts, wd_read_css, wd_available, wd_editable, wd_has_admin, wd_enable_operation, wd_use_instance_def, wd_initialized, wd_launch_index, wd_cache_type, wd_view_control_type, wd_install_dt, wd_create_dt) VALUES
('pretty_photo', 'プリティフォト', '2.0.0', 'Naoki Hirata', 'Magic3.org', 'GPL', 10, 'サムネール表示した画像を拡大します。', 'jquery.prettyphoto', 'jquery.tablednd,jquery.prettyphoto', false, false, true, true, true, true, true, true, 0, 3, 1, now(), now());
| true
|
7a60807cd72d9e8363699a9afca972e478949ef5
|
SQL
|
paolino/mootzoo
|
/schema.sql
|
UTF-8
| 1,397
| 3.703125
| 4
|
[
"MIT"
] |
permissive
|
CREATE TABLE users (
id integer primary key autoincrement not null,
email text not null,
login text unique,
inviter integer references users,
vote integer
);
CREATE TABLE messages (
id integer primary key autoincrement not null,
message text not null,
user integer not null references users(id),
type integer not null,
parent integer references messages(id),
conversation integer,
vote integer not null default 0,
data string not null default (datetime('now'))
);
create table conversations (
id integer primary key autoincrement not null,
tail integer not null references messages(id) ,
head integer not null references messages(id) ,
count integer not null
);
CREATE TABLE voting (
message integer references messages(id) on delete cascade,
user integer references users(id),
unique (message,user)
);
CREATE TABLE store (
message integer references messages(id) on delete cascade,
user integer references users(id),
unique (message,user)
);
CREATE INDEX voting1 on voting (message,user);
CREATE INDEX voting2 on voting (message);
CREATE INDEX store1 on store (message,user);
CREATE INDEX store2 on store (user);
CREATE INDEX store3 on store (message);
| true
|
86071efea6c322332f96643e6f29f164f603fff7
|
SQL
|
Partanennn/WebOhjelmoinninHarkkaTy-
|
/SQL/Database.sql
|
UTF-8
| 1,590
| 3.953125
| 4
|
[] |
no_license
|
CREATE DATABASE kanta;
USE kanta;
-- Käyttäjien tietokanta
CREATE TABLE kanta.users
(
username varChar(20) NOT NULL PRIMARY KEY,
pass varChar(20) NOT NULL,
name varChar(40) NOT NULL,
streetAddress varChar(80),
city varChar(40),
email varChar(60),
role varChar(20) NOT NULL DEFAULT "user"
)
ENGINE = InnoDB;
-- Omistajien tietokanta
CREATE TABLE kanta.owners
(
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varChar(40) NOT NULL
)
ENGINE = InnoDB;
-- Kategorioiden tietokanta
CREATE TABLE kanta.categories
(
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
category varChar(20) NOT NULL
)
ENGINE = InnoDB;
CREATE TABLE kanta.status
(
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
status varChar(20) NOT NULL
)
ENGINE = InnoDB;
-- Laitteiden tietokanta
CREATE TABLE kanta.machines
(
serial_number int NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varChar(40) NOT NULL,
model varChar(40) NOT NULL,
brand varChar(40) NOT NULL,
description_text varChar(200) DEFAULT "Tyhja",
location varChar(80) NOT NULL,
owner int NOT NULL,
category int NOT NULL,
status int DEFAULT 2,
borrower varChar(20),
start_day DATE,
end_day DATE,
deleted int DEFAULT 1,
CONSTRAINT machines_borrower_fk FOREIGN KEY (borrower) REFERENCES users(username),
CONSTRAINT machines_status_fk FOREIGN KEY (status) REFERENCES status(id),
CONSTRAINT machines_owner_fk FOREIGN KEY (owner) REFERENCES owners(id),
CONSTRAINT machines_category_fk FOREIGN KEY (category) REFERENCES categories(id)
)
ENGINE = InnoDB;
| true
|
6293a13979013baa8083f9600256e0ccf24fdd1a
|
SQL
|
TERRANZ/terramail
|
/init.sql
|
UTF-8
| 5,523
| 2.984375
| 3
|
[] |
no_license
|
CREATE DATABASE IF NOT EXISTS `terramail` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `terramail`;
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: localhost Database: terramail
-- ------------------------------------------------------
-- Server version 5.7.17-log
/*!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 `attachment_entity`
--
DROP TABLE IF EXISTS `attachment_entity`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `attachment_entity` (
`id` varchar(35) NOT NULL,
`body` longblob,
`file_name` varchar(255) DEFAULT NULL,
`message_id` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `attachment_entity`
--
LOCK TABLES `attachment_entity` WRITE;
/*!40000 ALTER TABLE `attachment_entity` DISABLE KEYS */;
/*!40000 ALTER TABLE `attachment_entity` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `folder_entity`
--
DROP TABLE IF EXISTS `folder_entity`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `folder_entity` (
`id` varchar(35) NOT NULL,
`deleted` bit(1) DEFAULT NULL,
`full_name` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`parent_folder_id` varchar(255) DEFAULT NULL,
`unread_messages` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `folder_entity`
--
LOCK TABLES `folder_entity` WRITE;
/*!40000 ALTER TABLE `folder_entity` DISABLE KEYS */;
/*!40000 ALTER TABLE `folder_entity` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `message_entity`
--
DROP TABLE IF EXISTS `message_entity`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `message_entity` (
`id` varchar(32) NOT NULL,
`create_date` bigint(20) DEFAULT NULL,
`folder_id` varchar(255) DEFAULT NULL,
`from_address` longtext,
`headers` longtext,
`message_body` longtext,
`subject` longtext,
`to_address` longtext,
PRIMARY KEY (`id`),
KEY `IDXqg0ibctuceoyb7gji1ucuyd27` (`create_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `message_entity`
--
LOCK TABLES `message_entity` WRITE;
/*!40000 ALTER TABLE `message_entity` DISABLE KEYS */;
/*!40000 ALTER TABLE `message_entity` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER insert_fulltext
AFTER INSERT ON message_entity
FOR EACH ROW
INSERT INTO messages_fts VALUES (NEW.id, NEW.`subject`, NEW.`message_body`) */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `messages_fts`
--
DROP TABLE IF EXISTS `messages_fts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `messages_fts` (
`id` varchar(32) NOT NULL,
`subject` text,
`body` text,
PRIMARY KEY (`id`),
FULLTEXT KEY `subj_fts` (`subject`),
FULLTEXT KEY `body_fts` (`body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `messages_fts`
--
LOCK TABLES `messages_fts` WRITE;
/*!40000 ALTER TABLE `messages_fts` DISABLE KEYS */;
/*!40000 ALTER TABLE `messages_fts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping events for database 'terramail'
--
--
-- Dumping routines for database 'terramail'
--
/*!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 2017-05-02 16:43:45
| true
|
6a09da9b43d4be9cc71a864084cbceb1c94262ed
|
SQL
|
CaiShiJun/spring-boot2.0-test001
|
/gitee-mr_beany-mySpringBoot/sql_script/sys_perm.sql
|
UTF-8
| 1,457
| 3.078125
| 3
|
[] |
no_license
|
/*
Navicat MySQL Data Transfer
Source Server : localhostDB
Source Server Version : 50720
Source Host : localhost:3306
Source Database : demo
Target Server Type : MYSQL
Target Server Version : 50720
File Encoding : 65001
Date: 2018-07-31 22:40:28
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for sys_perm
-- ----------------------------
DROP TABLE IF EXISTS `sys_perm`;
CREATE TABLE `sys_perm` (
`id` varchar(36) NOT NULL,
`perm_name` varchar(255) DEFAULT NULL COMMENT '权限名称',
`perm_desc` varchar(255) DEFAULT NULL COMMENT '权限描述',
`perm_value` varchar(255) DEFAULT NULL COMMENT '权限值',
`create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`is_disable` int(1) DEFAULT NULL COMMENT '是否禁用',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of sys_perm
-- ----------------------------
INSERT INTO `sys_perm` VALUES ('1', '创建', '创建权限', 'create', '2018-05-26 00:39:16', null, '0');
INSERT INTO `sys_perm` VALUES ('2', '删除', '删除权限', 'delete', '2018-05-26 00:39:39', null, '0');
INSERT INTO `sys_perm` VALUES ('3', '修改', '修改权限', 'update', '2018-05-26 00:39:58', null, '0');
INSERT INTO `sys_perm` VALUES ('4', '查询', '查询权限', 'select', '2018-05-26 00:40:16', null, '0');
| true
|
7bb11296462375147406f92894b8e3d881234ed1
|
SQL
|
dev-seahouse/imfweb
|
/sql/Dump20140201-2-nodata.sql
|
UTF-8
| 8,489
| 3.15625
| 3
|
[] |
no_license
|
CREATE DATABASE IF NOT EXISTS `fyp_imf` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `fyp_imf`;
-- MySQL dump 10.13 Distrib 5.6.11, for Win32 (x86)
--
-- Host: localhost Database: fyp_imf
-- ------------------------------------------------------
-- Server version 5.6.12-log
/*!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 `category_t`
--
DROP TABLE IF EXISTS `category_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `category_t` (
`CategoryID` int(10) NOT NULL AUTO_INCREMENT,
`CategoryName` varchar(100) NOT NULL,
PRIMARY KEY (`CategoryID`),
UNIQUE KEY `CategoryID_UNIQUE` (`CategoryID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `hotel_t`
--
DROP TABLE IF EXISTS `hotel_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `hotel_t` (
`HotelID` int(10) NOT NULL AUTO_INCREMENT,
`HotelName` varchar(100) NOT NULL,
`HotelAddress` varchar(100) NOT NULL,
`HotelContactNo` int(10) NOT NULL,
`HotelLatitude` varchar(100) NOT NULL,
`HotelLongitude` varchar(100) NOT NULL,
`HotelCardinal` varchar(10) NOT NULL,
`UserID` int(10) NOT NULL,
PRIMARY KEY (`HotelID`),
UNIQUE KEY `HotelID_UNIQUE` (`HotelID`),
KEY `fk_hotel_t_1` (`UserID`),
CONSTRAINT `fk_hotel_t_1` FOREIGN KEY (`UserID`) REFERENCES `user_t` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `job_t`
--
DROP TABLE IF EXISTS `job_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `job_t` (
`JobID` int(10) NOT NULL AUTO_INCREMENT,
`HotelID` int(10) NOT NULL,
`CategoryID` int(10) NOT NULL,
`ScopeID` int(10) NOT NULL,
`JobDate` date NOT NULL,
`JobStartTime` datetime NOT NULL,
`JobEndTime` datetime NOT NULL,
`JobEstHours` int(10) NOT NULL,
`JobSlotVacancy` int(10) NOT NULL,
`JobSlotVacLeft` int(10) NOT NULL,
`JobRate` varchar(10) NOT NULL,
`JobMinEBRHours` varchar(100) DEFAULT NULL,
`JobEBR` varchar(10) DEFAULT NULL,
`OverRunEndDateTime` datetime DEFAULT NULL,
`OverRunEstHours` varchar(10) DEFAULT NULL,
`JobStatus` int(1) NOT NULL,
PRIMARY KEY (`JobID`),
UNIQUE KEY `JobID_UNIQUE` (`JobID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `jobapplicant_t`
--
DROP TABLE IF EXISTS `jobapplicant_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `jobapplicant_t` (
`JobAppID` int(10) NOT NULL AUTO_INCREMENT,
`JobID` int(10) NOT NULL,
`UserID` int(10) NOT NULL,
`MarkAsPresent` char(1) NOT NULL,
`ExpHours` int(10) NOT NULL,
`FeedbackRating` int(1) DEFAULT NULL,
`FeedbackComment` varchar(1000) DEFAULT NULL,
`CancelReason` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`JobAppID`),
UNIQUE KEY `JobAppID_UNIQUE` (`JobAppID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mobilesession_t`
--
DROP TABLE IF EXISTS `mobilesession_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mobilesession_t` (
`MobileSessionID` int(10) NOT NULL AUTO_INCREMENT,
`UserID` int(10) NOT NULL,
`IMFToken` varchar(100) NOT NULL,
PRIMARY KEY (`MobileSessionID`),
UNIQUE KEY `MobileSessionID_UNIQUE` (`MobileSessionID`),
UNIQUE KEY `UserID_UNIQUE` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role_t`
--
DROP TABLE IF EXISTS `role_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role_t` (
`RoleID` int(10) NOT NULL AUTO_INCREMENT,
`RoleName` varchar(100) NOT NULL,
PRIMARY KEY (`RoleID`),
UNIQUE KEY `RoleID_UNIQUE` (`RoleID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `scope_t`
--
DROP TABLE IF EXISTS `scope_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `scope_t` (
`ScopeID` int(10) NOT NULL AUTO_INCREMENT,
`ScopeName` varchar(100) NOT NULL,
`ScopeDesc` varchar(10000) NOT NULL,
`CategoryID` int(10) NOT NULL,
PRIMARY KEY (`ScopeID`),
UNIQUE KEY `ScopeID_UNIQUE` (`ScopeID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_t`
--
DROP TABLE IF EXISTS `user_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_t` (
`UserID` int(10) NOT NULL AUTO_INCREMENT,
`RoleID` int(10) NOT NULL,
`Username` varchar(100) NOT NULL,
`Firstname` varchar(100) NOT NULL,
`Lastname` varchar(100) NOT NULL,
`Gender` char(1) NOT NULL,
`NRIC` varchar(10) NOT NULL,
`DateOfBirth` date NOT NULL,
`MobileNo` int(10) NOT NULL,
`Email` varchar(100) NOT NULL,
`Password` varchar(100) NOT NULL,
`IMFPin` int(10) NOT NULL,
`SpokenLang` varchar(100) DEFAULT NULL,
`SpokenLangOther` varchar(100) DEFAULT NULL,
PRIMARY KEY (`UserID`),
UNIQUE KEY `UserID_UNIQUE` (`UserID`),
UNIQUE KEY `Email_UNIQUE` (`Email`),
UNIQUE KEY `Username_UNIQUE` (`Username`),
UNIQUE KEY `NRIC_UNIQUE` (`NRIC`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping routines for database 'fyp_imf'
--
/*!50003 DROP PROCEDURE IF EXISTS `regUser` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `regUser`(
IN user_name varchar(50),
IN password varchar(255),
IN email varchar(50),
IN company_name varchar(50),
IN company_address varchar(64),
In user_random varchar(10),
IN company_contact int(10),
IN company_lat varchar(100),
IN company_long varchar(100)
)
BEGIN
insert into user_t (RoleID,Username,Password,Email,Firstname, Lastname, Gender, NRIC, DateOfBirth, MobileNo,IMFpin)
values (3,user_name,password,email,'-','-','-',user_random,curdate(),'000000',0000);
IF ROW_COUNT()>0
THEN insert into hotel_t (UserID,HotelName,HotelAddress,HotelContactNo,HotelLatitude,HotelLongitude,HotelCardinal)
values(LAST_INSERT_ID(),company_name,company_address,company_contact,company_lat,company_long,"-");
END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 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 2014-02-01 16:43:29
| true
|
d17dfc6a54763520f201f611ec9894afc2040cb6
|
SQL
|
huatuostudio/SQLScripts
|
/ShrinkFile.sql
|
UTF-8
| 647
| 2.9375
| 3
|
[] |
no_license
|
# Shrink DB files
# Update [your_db_name]
ALTER DATABASE [your_db_name]
SET RECOVERY SIMPLE;
CHECKPOINT;
-- shrink the log file to 200MB
DBCC SHRINKFILE (your_db_name_log,200);
--- define the initial size to 200MB as well.. CHANGE it as per your needs!
ALTER DATABASE [your_db_name]
MODIFY FILE (NAME=your_db_name_LOGICAL_log,SIZE=200MB,MAXSIZE=UNLIMITED,FILEGROWTH=100MB);
--Optional if you want the database in full recovery mode
--for point in time recovery going forward
ALTER DATABASE [your_db_name]
SET RECOVERY FULL;
--- Take full backup to establish log chain
-- take log backups to help truncate the log file and keep it manageable
| true
|
e90f7830f64e5adb22dfdd5780a2630d5ff3bf3e
|
SQL
|
rsoledade/Project_CreditRelease
|
/LiberacaoCredito/Scripts-DB/ListarClientesQueAtrasaram10Dias.sql
|
UTF-8
| 450
| 3.84375
| 4
|
[] |
no_license
|
SELECT
Cli.Nome, Cli.UF, Cli.Celular, Par.DataVencimento,
Fin.TipoFinanciamento, Fin.ValorTotal, Fin.QuantidadeParcelas,
Par.NumeroParcela, Par.ValorParcela, Par.DataPagamento
FROM
Clientes Cli
INNER JOIN Financiamentos Fin ON Cli.Id = Fin.IdCliente
INNER JOIN Parcelas Par ON Fin.Id = Par.IdFinanciamento
WHERE
(Par.DataPagamento > DATEADD(DAY, 10, Par.DataVencimento))
AND Fin.ValorTotal > 10000
ORDER BY
Par.DataVencimento
| true
|
a586ec03b27e3fc6c7a4aa9ee927cf368ff3ef7e
|
SQL
|
FaizalMulki/Fastag-Publish
|
/fastag-15-6-2020.sql
|
UTF-8
| 17,784
| 3.15625
| 3
|
[] |
no_license
|
CREATE DATABASE IF NOT EXISTS `fastag` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `fastag`;
-- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64)
--
-- Host: localhost Database: fastag
-- ------------------------------------------------------
-- Server version 8.0.19
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `document`
--
DROP TABLE IF EXISTS `document`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `document` (
`Id` int NOT NULL AUTO_INCREMENT,
`DocumentName` varchar(1250) DEFAULT NULL,
`DocumentType` varchar(1250) DEFAULT NULL,
`Extension` varchar(1250) DEFAULT NULL,
`DocumentPath` varchar(5545) DEFAULT NULL,
`Documents` mediumblob,
`ReferenceId` int DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `ForeignReference_idx` (`ReferenceId`),
CONSTRAINT `registration_document_id` FOREIGN KEY (`ReferenceId`) REFERENCES `registration` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `document`
--
LOCK TABLES `document` WRITE;
/*!40000 ALTER TABLE `document` DISABLE KEYS */;
/*!40000 ALTER TABLE `document` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `registration`
--
DROP TABLE IF EXISTS `registration`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `registration` (
`Id` int NOT NULL AUTO_INCREMENT,
`FirstName` varchar(255) DEFAULT NULL,
`LastName` varchar(255) DEFAULT NULL,
`Email` varchar(145) DEFAULT NULL,
`Phone` varchar(45) DEFAULT NULL,
`Mobile` varchar(45) DEFAULT NULL,
`DeliveryAddress` varchar(1500) DEFAULT NULL,
`VehicleTypeId` int DEFAULT NULL,
`VehicleRegNo` varchar(150) DEFAULT NULL,
`SecurityDeposit` decimal(10,0) DEFAULT NULL,
`FastagFee` decimal(10,0) DEFAULT NULL,
`MinimumBalanceDeposit` decimal(10,0) DEFAULT NULL,
`Others` decimal(10,0) DEFAULT NULL,
`TotalPayable` decimal(10,0) DEFAULT NULL,
`IsDeleted` bit(1) DEFAULT NULL,
`CreatedBy` varchar(500) DEFAULT NULL,
`CreatedDate` datetime DEFAULT NULL,
`ModifiedBy` varchar(500) DEFAULT NULL,
`ModifiedDate` datetime DEFAULT NULL,
`ReferenceNumber` varchar(300) DEFAULT NULL,
`PaymentType` varchar(45) DEFAULT NULL,
`FromAccountNumber` varchar(45) DEFAULT NULL,
`ToAccountNumber` varchar(45) DEFAULT NULL,
`BranchCode` varchar(45) DEFAULT NULL,
`FatherName` varchar(500) DEFAULT NULL,
`DOB` datetime DEFAULT NULL,
`FinacleTransNumber` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `vehicle_registartion_id_idx` (`VehicleTypeId`),
CONSTRAINT `vehicle_registartion_id` FOREIGN KEY (`VehicleTypeId`) REFERENCES `vehicletype` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `registration`
--
LOCK TABLES `registration` WRITE;
/*!40000 ALTER TABLE `registration` DISABLE KEYS */;
INSERT IGNORE INTO `registration` (`Id`, `FirstName`, `LastName`, `Email`, `Phone`, `Mobile`, `DeliveryAddress`, `VehicleTypeId`, `VehicleRegNo`, `SecurityDeposit`, `FastagFee`, `MinimumBalanceDeposit`, `Others`, `TotalPayable`, `IsDeleted`, `CreatedBy`, `CreatedDate`, `ModifiedBy`, `ModifiedDate`, `ReferenceNumber`, `PaymentType`, `FromAccountNumber`, `ToAccountNumber`, `BranchCode`, `FatherName`, `DOB`, `FinacleTransNumber`) VALUES (44,'dsfdsf','dsff',NULL,NULL,'dsfdsf','xczxcz',7,'sdsfsd',5,5,5,5,20,_binary '\0','admin','2020-06-13 15:57:09',NULL,NULL,'0001130620201','Transfer','zczxc','dsfsd',NULL,NULL,NULL,'123');
/*!40000 ALTER TABLE `registration` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `setting`
--
DROP TABLE IF EXISTS `setting`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `setting` (
`Id` int NOT NULL AUTO_INCREMENT,
`VehicleTypeId` int DEFAULT NULL,
`RefundableSecurityDeposit` decimal(10,0) DEFAULT NULL,
`FastagFee` decimal(10,0) DEFAULT NULL,
`MinimumBalanceWalletDeposit` decimal(10,0) DEFAULT NULL,
`Others` decimal(10,0) DEFAULT NULL,
`IsDeleted` tinyint DEFAULT '0',
`CreatedBy` varchar(500) DEFAULT NULL,
`CreatedDate` datetime DEFAULT CURRENT_TIMESTAMP,
`ModifiedDate` datetime DEFAULT NULL,
`ModifiedBy` varchar(500) DEFAULT NULL,
`EffectiveFrom` datetime DEFAULT NULL,
`EffectiveTo` datetime DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `VehicleTypeReference_idx` (`VehicleTypeId`),
CONSTRAINT `VehicleTypeReference` FOREIGN KEY (`VehicleTypeId`) REFERENCES `vehicletype` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `setting`
--
LOCK TABLES `setting` WRITE;
/*!40000 ALTER TABLE `setting` DISABLE KEYS */;
INSERT IGNORE INTO `setting` (`Id`, `VehicleTypeId`, `RefundableSecurityDeposit`, `FastagFee`, `MinimumBalanceWalletDeposit`, `Others`, `IsDeleted`, `CreatedBy`, `CreatedDate`, `ModifiedDate`, `ModifiedBy`, `EffectiveFrom`, `EffectiveTo`) VALUES (9,7,4,4,4,4,0,'admin','2020-06-13 13:57:39',NULL,NULL,'2020-06-04 00:00:00','2020-06-18 00:00:00'),(10,7,5,5,5,5,0,'admin','2020-06-13 14:09:02',NULL,NULL,'2020-06-19 00:00:00','2020-06-20 00:00:00'),(11,9,4,3,1,7,0,'admin','2020-06-13 14:14:59',NULL,NULL,'2020-06-04 00:00:00','2020-06-16 00:00:00');
/*!40000 ALTER TABLE `setting` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `vehicletype`
--
DROP TABLE IF EXISTS `vehicletype`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `vehicletype` (
`Id` int NOT NULL AUTO_INCREMENT,
`Type` varchar(150) DEFAULT NULL,
`Code` varchar(150) DEFAULT NULL,
`IsDeleted` tinyint DEFAULT NULL,
`CreatedBy` varchar(250) DEFAULT NULL,
`CreatedDate` datetime DEFAULT NULL,
`ModifiedBy` varchar(250) DEFAULT NULL,
`ModifiedDate` datetime DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `vehicletype`
--
LOCK TABLES `vehicletype` WRITE;
/*!40000 ALTER TABLE `vehicletype` DISABLE KEYS */;
INSERT IGNORE INTO `vehicletype` (`Id`, `Type`, `Code`, `IsDeleted`, `CreatedBy`, `CreatedDate`, `ModifiedBy`, `ModifiedDate`) VALUES (7,'Car',NULL,0,'admin','2020-06-04 14:36:37',NULL,'0001-01-01 00:00:00'),(8,'Jeep',NULL,1,'admin','2020-06-04 15:38:56',NULL,'0001-01-01 00:00:00'),(9,'jeep',NULL,0,'admin','2020-06-13 13:32:03',NULL,'0001-01-01 00:00:00');
/*!40000 ALTER TABLE `vehicletype` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping routines for database 'fastag'
--
/*!50003 DROP PROCEDURE IF EXISTS `CheckDataWithinDateRange` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckDataWithinDateRange`(
IN VehicleTypeId INT,
IN EffectiveFrom varchar(200),
IN EffectiveTo varchar(200))
BEGIN
Select * from setting s where s.IsDeleted = 0 and s.VehicleTypeId= VehicleTypeId and (s.EffectiveFrom >= EffectiveFrom or s.EffectiveTo <= EffectiveTo);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAllRegisterdItems` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAllRegisterdItems`(
IN Search varchar(1000),
IN p_iPageIndex INT,
IN p_iPageSize INT,
OUT p_iTotalCount INT
)
BEGIN
SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY ID DESC) AS RowNumber ,r.*,v.Type as VehicleType from fastag.registration r
inner join fastag.vehicletype v on v.Id=r.VehicleTypeId
where r.isdeleted=0
and ( r.FirstName LIKE CONCAT ('%', Search, '%')
OR r.LastName LIKE CONCAT ('%', Search, '%') OR r.Email LIKE CONCAT ('%', Search, '%') OR r.Mobile LIKE CONCAT ('%', Search, '%') OR r.ReferenceNumber LIKE CONCAT ('%', Search, '%') OR v.Type LIKE CONCAT ('%', Search, '%') OR r.CreatedBy LIKE CONCAT ('%', Search, '%')
or Search is null)
)
A
WHERE RowNumber BETWEEN ((p_iPageIndex*p_iPageSize)-p_iPageSize+1) AND (p_iPageIndex*p_iPageSize);
SET p_iTotalCount = (SELECT COUNT(*) from fastag.registration r
inner join fastag.vehicletype v on v.Id=r.VehicleTypeId
where r.isdeleted=0
and ( r.FirstName LIKE CONCAT ('%', Search, '%')
OR r.LastName LIKE CONCAT ('%', Search, '%') OR r.Email LIKE CONCAT ('%', Search, '%') OR r.Mobile LIKE CONCAT ('%', Search, '%') OR r.ReferenceNumber LIKE CONCAT ('%', Search, '%') OR v.Type LIKE CONCAT ('%', Search, '%') OR r.CreatedBy LIKE CONCAT ('%', Search, '%')
or Search is null)
);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAllSettings` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAllSettings`(
IN Search varchar(1000),
IN p_iPageIndex INT,
IN p_iPageSize INT,
OUT p_iTotalCount INT
)
BEGIN
SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY ID DESC) AS RowNumber ,s.*,v.Type as VehicleType from fastag.setting s
inner join fastag.vehicletype v on s.VehicleTypeId=v.Id
where s.isdeleted=0
and (s.RefundableSecurityDeposit LIKE CONCAT ('%', Search, '%')
OR s.MinimumBalanceWalletDeposit LIKE CONCAT ('%', Search, '%') OR s.Others LIKE CONCAT ('%', Search, '%') OR s.CreatedBy LIKE CONCAT ('%', Search, '%')
or Search is null)
)
A
WHERE RowNumber BETWEEN ((p_iPageIndex*p_iPageSize)-p_iPageSize+1) AND (p_iPageIndex*p_iPageSize);
SET p_iTotalCount = (SELECT COUNT(*) from fastag.setting s where s.isdeleted=0
and
(s.RefundableSecurityDeposit LIKE CONCAT ('%', Search, '%') OR s.FastagFee LIKE CONCAT ('%', Search, '%') OR s.MinimumBalanceWalletDeposit LIKE CONCAT ('%', Search, '%') OR s.Others LIKE CONCAT ('%', Search, '%') OR s.CreatedBy LIKE CONCAT ('%', Search, '%')
or Search is null)
);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAllVehicles` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAllVehicles`(
IN Search varchar(1000),
IN p_iPageIndex INT,
IN p_iPageSize INT,
OUT p_iTotalCount INT )
BEGIN
SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY ID DESC) AS RowNumber ,vt.* from fastag.vehicletype vt
where vt.isdeleted=0
and ( vt.Type LIKE CONCAT ('%', Search, '%')
OR vt.CreatedBy LIKE CONCAT ('%', Search, '%')
or Search is null)
)
A
WHERE RowNumber BETWEEN ((p_iPageIndex*p_iPageSize)-p_iPageSize+1) AND (p_iPageIndex*p_iPageSize);
SET p_iTotalCount = (SELECT COUNT(*) from fastag.vehicletype vt where vt.isdeleted=0
and ( vt.Type LIKE CONCAT ('%', Search, '%')
OR vt.CreatedBy LIKE CONCAT ('%', Search, '%')
or Search is null)
);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `GetDashBoardCount` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetDashBoardCount`(
/*IN IsSuperAdmin varchar(150),
IN CreatedBy varchar(250)*/
)
BEGIN
/*IF IsSuperAdmin = 'True' THEN*/
select count(r.Id) As TotalReg,SUM(r.TotalPayable) as TotalAmount from fastag.registration r where r.isdeleted=0;
/*else
select count(statusid) As Total,s.name from notification.messagedetail md inner join notification.message m on m.Id=md.messageid inner join notification.status s on s.id = md.statusid where m.isdeleted=0 and md.isdeleted=0 and m.createdby=CreatedBy or md.createdby=CreatedBy group by statusid;
END If;*/
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `GetRegisteredItemById` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetRegisteredItemById`(
IN Id INT
)
BEGIN
SELECT r.*,v.Type as VehicleType from fastag.registration r
inner join fastag.vehicletype v on v.Id=r.VehicleTypeId
where r.Id=Id and r.isdeleted=0 ;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 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 2020-06-15 11:05:14
| true
|
2879ba3fdcd6c762c5ec2f8e594ffa837bd7a9e6
|
SQL
|
DerekTBillings/Airmans_Attic
|
/Database/Table Script Update.sql
|
UTF-8
| 845
| 3.6875
| 4
|
[] |
no_license
|
CREATE TABLE admin_levels (
Admin_Level int AUTO_INCREMENT,
Admin_Level_Name Varchar(50) NOT NULL,
PRIMARY KEY(Admin_Level)
);
INSERT INTO admin_levels (Admin_Level, Admin_Level_Name)
Values (null, 'Admin'),
(null, 'Key Holder');
ALTER TABLE admin_accounts
ADD COLUMN Admin_Level int,
ADD CONSTRAINT fk_admin_level
FOREIGN KEY Admin_Level(Admin_Level)
REFERENCES admin_levels(Admin_Level),
ADD COLUMN Username Varchar(50),
ADD COLUMN Password Varchar(50);
ALTER TABLE raffle_item
ADD COLUMN Date_To_Raffle DATE;
CREATE TABLE people_in_raffle (
Raffle_Id int NOT NULL,
Person_Id int NOT NULL,
Raffle_Status Varchar(50),
FOREIGN KEY(Raffle_Id) REFERENCES raffle_item(Raffle_Id),
FOREIGN KEY(Person_Id) REFERENCES person(Person_Id)
);
INSERT INTO system_values(Category, Value)
VALUES ('Item recency days', '30');
| true
|
50aa78b9dac54c5afcb4029e2467cd8baed9bc4d
|
SQL
|
ggslyman/Super-Street-Fighter-IV-Arcade-Edition-Lobby-System
|
/libs/cakephp/apps/ssf4ae/sql/ssf4ae_entries.sql
|
UTF-8
| 1,469
| 2.953125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 3.3.10.3
-- http://www.phpmyadmin.net
--
-- ホスト: mysql122.db.sakura.ne.jp
-- 生成時間: 2011 年 9 月 11 日 23:33
-- サーバのバージョン: 5.1.51
-- PHP のバージョン: 5.2.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!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 */;
--
-- データベース: `vash`
--
-- --------------------------------------------------------
--
-- テーブルの構造 `ssf4ae_entries`
--
CREATE TABLE IF NOT EXISTS `ssf4ae_entries` (
`ssf4ae_entry_id` int(11) NOT NULL AUTO_INCREMENT,
`game_id` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
`platform` int(11) NOT NULL,
`nickname` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
`messenger_type` int(11) NOT NULL,
`messenger_id` text COLLATE utf8_unicode_ci NOT NULL,
`playerpoint` int(11) DEFAULT NULL,
`comment` text COLLATE utf8_unicode_ci NOT NULL,
`start_datetime` timestamp NULL DEFAULT NULL,
`end_datetime` timestamp NULL DEFAULT NULL,
`password` text COLLATE utf8_unicode_ci,
`delete_flag` int(11) NOT NULL DEFAULT '0',
`created` timestamp NULL DEFAULT NULL,
`modified` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`ssf4ae_entry_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=69 ;
| true
|
206596b63483df96b2933896918357143881f3e6
|
SQL
|
jrodriguez-infostecnologia/InfosPadelma
|
/Infos.Padelma.BD/dbo/Stored Procedures/Procs2/spSeleccionaNumeroDocumentoExistenteNominaDetalle.sql
|
UTF-8
| 349
| 2.6875
| 3
|
[] |
no_license
|
CREATE PROCEDURE spSeleccionaNumeroDocumentoExistenteNominaDetalle
@Año int = 2016,
@Periodo int = 13,
@Empresa int = 1,
@Tipo varchar(50) = 'LQC'
AS
BEGIN
SELECT DISTINCT vLiq.numero
FROM
vLiquidacionDefinitivaReal vLiq
WHERE vLiq.empresa = @Empresa
AND vLiq.año = @Año
AND vLiq.noPeriodo = @Periodo
AND vLiq.tipo = @Tipo;
END
| true
|
3614d0c8b07ccf7598182f6e1bce09aecbddd4bf
|
SQL
|
uva-linklab/powerblade
|
/sql/create_tables.sql
|
UTF-8
| 6,183
| 3.8125
| 4
|
[] |
no_license
|
# Basic table creation stuff
# Only to be run once, but saved for records
# Create dat_blink table
CREATE TABLE dat_blink
(id int(11) not null auto_increment, gatewayMAC char(12), deviceMAC char(12),
curMot tinyint(1), advMot tinyint(1), minMot tinyint(1),
timestamp datetime,
primary key (id), index(gatewayMAC), index(deviceMAC), index(timestamp));
describe dat_blink;
# Create dat_gnd_truth table
CREATE TABLE dat_gnd_truth
(id int(11) not null auto_increment, location int(1), dayst datetime, energy decimal(8,2),
primary key (id), index(location), index(dayst), index locTime (location, dayst));
# Addition of remTime column to inf tables
alter table inf_pb_lookup add column remTime datetime after startTime;
alter table inf_gw_lookup add column remTime datetime after startTime;
alter table inf_light_lookup add column remTime datetime after startTime;
alter table inf_blink_lookup add column remTime datetime after startTime;
# Final results table - when a long running query is run, the user has the option to store the results
# The most recent entry for each device is used in the final energy calculations
create table final_results
(id int(11) not null auto_increment, addedDate datetime,
deviceMAC char(12), deviceName varchar(50), location int(1), category varchar(30), deviceType varchar(30),
avgEnergy decimal(24,4), stdEnergy decimal(24,4), totEnergy decimal(24,4), avgPower decimal(24,4),
primary key (id), index (deviceMAC));
alter table final_gnd add column endDate date after startDate;
alter table final_gnd add column truthDays int(11) after duration;
alter table final_gnd add column totMeas decimal(24,4) after missingDays;
alter table final_gnd change totEnergy totGnd decimal(24,4);
# This is the parallel table to final_results, used to store a reference to the data in final_results
create table final_gnd
(id int(11) not null auto_increment, addedDate datetime,
location int(1), startDate date, duration int(11), missingDays int(11), totEnergy decimal(24,4),
primary key (id), index (location));
# Deltas table
create table dat_delta (id int(11) not null auto_increment, dayst datetime, deviceMAC char(12),
ct5 int(11), spk5 int(11), ct10 int(11), spk10 int(11), ct15 int(11), spk15 int(11),
ct25 int(11), spk25 int(11), ct50 int(11), spk50 int(11), ct75 int(11), spk75 int(11),
ct100 int(11), spk100 int(11), ct150 int(11), spk150 int(11), ct250 int(11), spk250 int(11),
ct500 int(11), spk500 int(11), primary key (id), index (dayst), index (deviceMAC), index devDay (deviceMAC, dayst));
# Complete vector table (should have been combined with deltas but wasnt)
create table dat_vector (id int(11) not null auto_increment, dayst datetime, deviceMAC char(12),
avgPwr decimal(12,6), varPwr decimal(12,6), maxPwr decimal(8,2), minPwr decimal(8,2), count int(11), duty decimal(8,6),
ct5 int(11), spk5 int(11), ct10 int(11), spk10 int(11), ct15 int(11), spk15 int(11),
ct25 int(11), spk25 int(11), ct50 int(11), spk50 int(11), ct75 int(11), spk75 int(11),
ct100 int(11), spk100 int(11), ct150 int(11), spk150 int(11), ct250 int(11), spk250 int(11),
ct500 int(11), spk500 int(11),
deviceType varchar(30),
primary key (id), index (dayst), index (deviceMAC), index devDay (deviceMAC, dayst));
# Complete vector table with occupancy (directly combined with deltas)
create table dat_occ_vector (id int(11) not null auto_increment, dayst datetime, deviceMAC char(12),
avgPwr decimal(12,6), varPwr decimal(12,6), maxPwr decimal(8,2), minPwr decimal(8,2), count int(11), duty decimal(8,6),
crossCorr decimal(8,2), pOcc decimal(8,2),
ct5 int(11), spk5 int(11), ct10 int(11), spk10 int(11), ct15 int(11), spk15 int(11),
ct25 int(11), spk25 int(11), ct50 int(11), spk50 int(11), ct75 int(11), spk75 int(11),
ct100 int(11), spk100 int(11), ct150 int(11), spk150 int(11), ct250 int(11), spk250 int(11),
ct500 int(11), spk500 int(11),
deviceType varchar(30),
primary key (id), index (dayst), index (deviceMAC), index devDay (deviceMAC, dayst));
# Fault vector table
create table dat_fault_vector (id int(11) not null auto_increment, minTs datetime, deviceMAC char(12), deviceName varchar(50), tag varchar(50),
avgPwr decimal(12,6), varPwr decimal(12,6), maxPwr decimal(8,2), minPwr decimal(8,2),
ct5 int(11), spk5 int(11), ct10 int(11), spk10 int(11), ct15 int(11), spk15 int(11),
ct25 int(11), spk25 int(11), ct50 int(11), spk50 int(11), ct75 int(11), spk75 int(11),
ct100 int(11), spk100 int(11), ct150 int(11), spk150 int(11), ct250 int(11), spk250 int(11),
ct500 int(11), spk500 int(11),
broken int(11),
primary key (id), index (minTs), index (deviceMAC), index devMin (deviceMAC, minTs));
describe dat_blink;
# Occupancy tables
create table dat_occ_blink (id int(11) not null auto_increment,
deviceMAC char(12), room varchar(50), tsMin datetime, minMot int(11),
primary key (id), index (deviceMAC));
create table dat_occ_pb (id int(11) not null auto_increment,
deviceMAC char(12), room varchar(50), tsMin datetime, avgPower decimal(12,6),
primary key (id), index (deviceMAC));
rename table dat_occ_blink to dat_occ_blink_bak;
rename table dat_occ_pb to dat_occ_pb_bak;
create table dat_occ_corr (id int(11) not null auto_increment,
deviceMAC char(12), deviceName varchar(50), location int(1), room varchar(50),
crossCorr decimal(12,2), pOcc decimal(12,2),
primary key (id), index (deviceMAC));
create table dat_dev_corr (id int(11) not null auto_increment,
testMAC char(12), activeMAC char(12), location int(1), room varchar(50),
crossCorr decimal(12,2), pOcc decimal(12,2),
primary key (id), index (testMAC));
create table dat_inter_vector (id int(11) not null auto_increment, deviceMAC char(12),
computer_monitor decimal(5,2), coffee_maker decimal(5,2), television decimal(5,2), blowdryer decimal(5,2),
toaster decimal(5,2), fridge decimal(5,2), microwave decimal(5,2), phone_charger decimal(5,2),
curling_iron decimal(5,2), lamp decimal(5,2), fan decimal(5,2), laptop_computer decimal(5,2),
exterior_lighting decimal(5,2), router_modem decimal(5,2), cable_box decimal(5,2), blender decimal(5,2),
primary key (id), index(deviceMAC));
# Other useful stuff:
# to "delete from": SET SQL_SAFE_UPDATES = 0;
| true
|
9c208dff10e0a75ff4523dc8cf9dff741dc0d7ad
|
SQL
|
Carlos222Cuellar/java_rest
|
/parcial/postgres/posts.sql
|
UTF-8
| 33,221
| 2.859375
| 3
|
[
"MIT"
] |
permissive
|
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.4
-- Dumped by pg_dump version 9.6.4
-- Started on 2017-11-23 17:13:02 CST
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 2329 (class 1262 OID 17982)
-- Name: posts; Type: DATABASE; Schema: -; Owner: mortal2017
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 1 (class 3079 OID 12393)
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- TOC entry 2331 (class 0 OID 0)
-- Dependencies: 1
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 185 (class 1259 OID 17983)
-- Name: categoria; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE categoria (
id_categoria integer NOT NULL,
nombre character varying(150) NOT NULL,
activo boolean DEFAULT true,
descripcion text
);
ALTER TABLE categoria OWNER TO mortal2017;
--
-- TOC entry 186 (class 1259 OID 17990)
-- Name: categoria_id_categoria_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE categoria_id_categoria_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE categoria_id_categoria_seq OWNER TO mortal2017;
--
-- TOC entry 2332 (class 0 OID 0)
-- Dependencies: 186
-- Name: categoria_id_categoria_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE categoria_id_categoria_seq OWNED BY categoria.id_categoria;
--
-- TOC entry 187 (class 1259 OID 17992)
-- Name: cometario; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE cometario (
id_comentario integer NOT NULL,
id_post integer,
fecha timestamp without time zone NOT NULL,
id_usuario integer NOT NULL,
comentario text,
aprobado boolean DEFAULT false
);
ALTER TABLE cometario OWNER TO mortal2017;
--
-- TOC entry 188 (class 1259 OID 17999)
-- Name: cometario_id_comentario_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE cometario_id_comentario_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE cometario_id_comentario_seq OWNER TO mortal2017;
--
-- TOC entry 2333 (class 0 OID 0)
-- Dependencies: 188
-- Name: cometario_id_comentario_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE cometario_id_comentario_seq OWNED BY cometario.id_comentario;
--
-- TOC entry 189 (class 1259 OID 18001)
-- Name: meta; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE meta (
id_meta integer NOT NULL,
nombre character varying(150) NOT NULL,
activo boolean DEFAULT true,
descripcion text
);
ALTER TABLE meta OWNER TO mortal2017;
--
-- TOC entry 190 (class 1259 OID 18008)
-- Name: meta_id_meta_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE meta_id_meta_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE meta_id_meta_seq OWNER TO mortal2017;
--
-- TOC entry 2334 (class 0 OID 0)
-- Dependencies: 190
-- Name: meta_id_meta_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE meta_id_meta_seq OWNED BY meta.id_meta;
--
-- TOC entry 191 (class 1259 OID 18010)
-- Name: paso; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE paso (
id_paso integer NOT NULL,
id_tipo_paso integer,
id_categoria integer,
id_rol integer,
nombre character varying(150) NOT NULL,
comentarios text
);
ALTER TABLE paso OWNER TO mortal2017;
--
-- TOC entry 192 (class 1259 OID 18016)
-- Name: paso_id_paso_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE paso_id_paso_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE paso_id_paso_seq OWNER TO mortal2017;
--
-- TOC entry 2335 (class 0 OID 0)
-- Dependencies: 192
-- Name: paso_id_paso_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE paso_id_paso_seq OWNED BY paso.id_paso;
--
-- TOC entry 193 (class 1259 OID 18018)
-- Name: post; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE post (
id_post integer NOT NULL,
id_tipo_post integer,
id_categoria integer,
fecha timestamp without time zone NOT NULL,
aprobacion_comentarios boolean DEFAULT false,
titulo character varying(150) NOT NULL,
descripcion text
);
ALTER TABLE post OWNER TO mortal2017;
--
-- TOC entry 194 (class 1259 OID 18025)
-- Name: post_id_post_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE post_id_post_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE post_id_post_seq OWNER TO mortal2017;
--
-- TOC entry 2336 (class 0 OID 0)
-- Dependencies: 194
-- Name: post_id_post_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE post_id_post_seq OWNED BY post.id_post;
--
-- TOC entry 195 (class 1259 OID 18027)
-- Name: post_meta; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE post_meta (
id_post integer NOT NULL,
id_meta integer NOT NULL
);
ALTER TABLE post_meta OWNER TO mortal2017;
--
-- TOC entry 196 (class 1259 OID 18030)
-- Name: post_paso; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE post_paso (
id_post integer NOT NULL,
id_paso integer NOT NULL,
id_usuario integer,
id_categoria integer,
id_rol integer,
aprobado boolean DEFAULT false,
comentarios text
);
ALTER TABLE post_paso OWNER TO mortal2017;
--
-- TOC entry 197 (class 1259 OID 18037)
-- Name: post_seccion; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE post_seccion (
id_post integer NOT NULL,
id_seccion integer NOT NULL,
valor text NOT NULL
);
ALTER TABLE post_seccion OWNER TO mortal2017;
--
-- TOC entry 198 (class 1259 OID 18043)
-- Name: rol; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE rol (
id_rol integer NOT NULL,
nombre character varying(150) NOT NULL,
activo boolean DEFAULT true,
descripcion text
);
ALTER TABLE rol OWNER TO mortal2017;
--
-- TOC entry 199 (class 1259 OID 18050)
-- Name: rol_categoria; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE rol_categoria (
id_rol integer NOT NULL,
id_categoria integer NOT NULL,
activo boolean DEFAULT true
);
ALTER TABLE rol_categoria OWNER TO mortal2017;
--
-- TOC entry 200 (class 1259 OID 18054)
-- Name: rol_id_rol_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE rol_id_rol_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE rol_id_rol_seq OWNER TO mortal2017;
--
-- TOC entry 2337 (class 0 OID 0)
-- Dependencies: 200
-- Name: rol_id_rol_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE rol_id_rol_seq OWNED BY rol.id_rol;
--
-- TOC entry 201 (class 1259 OID 18056)
-- Name: seccion; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE seccion (
id_seccion integer NOT NULL,
id_tipo_seccion integer,
nombre character varying(150) NOT NULL,
activo boolean DEFAULT true,
descripcion text
);
ALTER TABLE seccion OWNER TO mortal2017;
--
-- TOC entry 202 (class 1259 OID 18063)
-- Name: seccion_id_seccion_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE seccion_id_seccion_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE seccion_id_seccion_seq OWNER TO mortal2017;
--
-- TOC entry 2338 (class 0 OID 0)
-- Dependencies: 202
-- Name: seccion_id_seccion_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE seccion_id_seccion_seq OWNED BY seccion.id_seccion;
--
-- TOC entry 203 (class 1259 OID 18065)
-- Name: tipo_paso; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE tipo_paso (
id_tipo_paso integer NOT NULL,
nombre character varying(150) NOT NULL,
activo boolean DEFAULT true,
descripcion text
);
ALTER TABLE tipo_paso OWNER TO mortal2017;
--
-- TOC entry 204 (class 1259 OID 18072)
-- Name: tipo_paso_id_tipo_paso_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE tipo_paso_id_tipo_paso_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE tipo_paso_id_tipo_paso_seq OWNER TO mortal2017;
--
-- TOC entry 2339 (class 0 OID 0)
-- Dependencies: 204
-- Name: tipo_paso_id_tipo_paso_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE tipo_paso_id_tipo_paso_seq OWNED BY tipo_paso.id_tipo_paso;
--
-- TOC entry 205 (class 1259 OID 18074)
-- Name: tipo_post; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE tipo_post (
id_tipo_post integer NOT NULL,
nombre character varying(150) NOT NULL,
activo boolean DEFAULT true,
descripcion text
);
ALTER TABLE tipo_post OWNER TO mortal2017;
--
-- TOC entry 206 (class 1259 OID 18081)
-- Name: tipo_post_id_tipo_post_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE tipo_post_id_tipo_post_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE tipo_post_id_tipo_post_seq OWNER TO mortal2017;
--
-- TOC entry 2340 (class 0 OID 0)
-- Dependencies: 206
-- Name: tipo_post_id_tipo_post_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE tipo_post_id_tipo_post_seq OWNED BY tipo_post.id_tipo_post;
--
-- TOC entry 207 (class 1259 OID 18083)
-- Name: tipo_post_seccion; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE tipo_post_seccion (
id_seccion integer NOT NULL,
id_tipo_post integer NOT NULL,
activo boolean DEFAULT true,
obligatorio boolean DEFAULT false,
peso integer DEFAULT 0 NOT NULL
);
ALTER TABLE tipo_post_seccion OWNER TO mortal2017;
--
-- TOC entry 208 (class 1259 OID 18089)
-- Name: tipo_seccion; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE tipo_seccion (
id_tipo_seccion integer NOT NULL,
nombre character varying(150) NOT NULL,
activo boolean DEFAULT true,
descripcion text
);
ALTER TABLE tipo_seccion OWNER TO mortal2017;
--
-- TOC entry 209 (class 1259 OID 18096)
-- Name: tipo_seccion_id_tipo_seccion_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE tipo_seccion_id_tipo_seccion_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE tipo_seccion_id_tipo_seccion_seq OWNER TO mortal2017;
--
-- TOC entry 2341 (class 0 OID 0)
-- Dependencies: 209
-- Name: tipo_seccion_id_tipo_seccion_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE tipo_seccion_id_tipo_seccion_seq OWNED BY tipo_seccion.id_tipo_seccion;
--
-- TOC entry 210 (class 1259 OID 18098)
-- Name: usuario; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE usuario (
id_usuario integer NOT NULL,
apellidos character varying(150) NOT NULL,
nombres character varying(150) NOT NULL,
fecha_nacimiento date NOT NULL,
activo boolean DEFAULT true,
comentarios text,
username character varying(50) NOT NULL,
password character varying(50) NOT NULL
);
ALTER TABLE usuario OWNER TO mortal2017;
--
-- TOC entry 211 (class 1259 OID 18105)
-- Name: usuario_id_usuario_seq; Type: SEQUENCE; Schema: public; Owner: mortal2017
--
CREATE SEQUENCE usuario_id_usuario_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE usuario_id_usuario_seq OWNER TO mortal2017;
--
-- TOC entry 2342 (class 0 OID 0)
-- Dependencies: 211
-- Name: usuario_id_usuario_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: mortal2017
--
ALTER SEQUENCE usuario_id_usuario_seq OWNED BY usuario.id_usuario;
--
-- TOC entry 212 (class 1259 OID 18107)
-- Name: usuario_rol_categoria; Type: TABLE; Schema: public; Owner: mortal2017
--
CREATE TABLE usuario_rol_categoria (
id_usuario integer NOT NULL,
id_categoria integer NOT NULL,
id_rol integer NOT NULL,
activo boolean DEFAULT true
);
ALTER TABLE usuario_rol_categoria OWNER TO mortal2017;
--
-- TOC entry 2103 (class 2604 OID 18111)
-- Name: categoria id_categoria; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY categoria ALTER COLUMN id_categoria SET DEFAULT nextval('categoria_id_categoria_seq'::regclass);
--
-- TOC entry 2105 (class 2604 OID 18112)
-- Name: cometario id_comentario; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY cometario ALTER COLUMN id_comentario SET DEFAULT nextval('cometario_id_comentario_seq'::regclass);
--
-- TOC entry 2107 (class 2604 OID 18113)
-- Name: meta id_meta; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY meta ALTER COLUMN id_meta SET DEFAULT nextval('meta_id_meta_seq'::regclass);
--
-- TOC entry 2108 (class 2604 OID 18114)
-- Name: paso id_paso; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY paso ALTER COLUMN id_paso SET DEFAULT nextval('paso_id_paso_seq'::regclass);
--
-- TOC entry 2110 (class 2604 OID 18115)
-- Name: post id_post; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post ALTER COLUMN id_post SET DEFAULT nextval('post_id_post_seq'::regclass);
--
-- TOC entry 2113 (class 2604 OID 18116)
-- Name: rol id_rol; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY rol ALTER COLUMN id_rol SET DEFAULT nextval('rol_id_rol_seq'::regclass);
--
-- TOC entry 2116 (class 2604 OID 18117)
-- Name: seccion id_seccion; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY seccion ALTER COLUMN id_seccion SET DEFAULT nextval('seccion_id_seccion_seq'::regclass);
--
-- TOC entry 2118 (class 2604 OID 18118)
-- Name: tipo_paso id_tipo_paso; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_paso ALTER COLUMN id_tipo_paso SET DEFAULT nextval('tipo_paso_id_tipo_paso_seq'::regclass);
--
-- TOC entry 2120 (class 2604 OID 18119)
-- Name: tipo_post id_tipo_post; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_post ALTER COLUMN id_tipo_post SET DEFAULT nextval('tipo_post_id_tipo_post_seq'::regclass);
--
-- TOC entry 2125 (class 2604 OID 18120)
-- Name: tipo_seccion id_tipo_seccion; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_seccion ALTER COLUMN id_tipo_seccion SET DEFAULT nextval('tipo_seccion_id_tipo_seccion_seq'::regclass);
--
-- TOC entry 2127 (class 2604 OID 18121)
-- Name: usuario id_usuario; Type: DEFAULT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY usuario ALTER COLUMN id_usuario SET DEFAULT nextval('usuario_id_usuario_seq'::regclass);
--
-- TOC entry 2297 (class 0 OID 17983)
-- Dependencies: 185
-- Data for Name: categoria; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO categoria VALUES (1, 'ingenieria en sistemas', true, 'los meros buenos');
INSERT INTO categoria VALUES (2, 'ingenieria industrial', true, 'los caes mal');
INSERT INTO categoria VALUES (3, 'ingenieria civil', false, 'caen mas o menos');
--
-- TOC entry 2343 (class 0 OID 0)
-- Dependencies: 186
-- Name: categoria_id_categoria_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('categoria_id_categoria_seq', 1, false);
--
-- TOC entry 2299 (class 0 OID 17992)
-- Dependencies: 187
-- Data for Name: cometario; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO cometario VALUES (1, 1, '2017-09-09 00:00:00', 1, 'mis amigos', true);
INSERT INTO cometario VALUES (2, 2, '2017-10-09 00:00:00', 2, 'probando base de datos', true);
INSERT INTO cometario VALUES (3, 1, '2017-01-01 00:00:00', 1, 'que bonita morrita', true);
--
-- TOC entry 2344 (class 0 OID 0)
-- Dependencies: 188
-- Name: cometario_id_comentario_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('cometario_id_comentario_seq', 2, true);
--
-- TOC entry 2301 (class 0 OID 18001)
-- Dependencies: 189
-- Data for Name: meta; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO meta VALUES (1, 'mas like', true, 'se cumplio ');
INSERT INTO meta VALUES (2, 'menos like', true, 'no se cumplio');
--
-- TOC entry 2345 (class 0 OID 0)
-- Dependencies: 190
-- Name: meta_id_meta_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('meta_id_meta_seq', 1, false);
--
-- TOC entry 2303 (class 0 OID 18010)
-- Dependencies: 191
-- Data for Name: paso; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO paso VALUES (1, 1, 1, 1, 'aprobado', 'ya se hizo la validacion');
INSERT INTO paso VALUES (2, 2, 2, 2, 'no aprobado', 'nno se realizo la aprobacion');
--
-- TOC entry 2346 (class 0 OID 0)
-- Dependencies: 192
-- Name: paso_id_paso_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('paso_id_paso_seq', 1, false);
--
-- TOC entry 2305 (class 0 OID 18018)
-- Dependencies: 193
-- Data for Name: post; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO post VALUES (1, 1, 1, '2017-09-09 00:00:00', true, 'publico', NULL);
INSERT INTO post VALUES (2, 2, 2, '2017-09-10 00:00:00', true, 'privado', NULL);
INSERT INTO post VALUES (5, 1, 1, '2017-02-10 00:00:00', true, 'holis', NULL);
--
-- TOC entry 2347 (class 0 OID 0)
-- Dependencies: 194
-- Name: post_id_post_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('post_id_post_seq', 5, true);
--
-- TOC entry 2307 (class 0 OID 18027)
-- Dependencies: 195
-- Data for Name: post_meta; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO post_meta VALUES (1, 1);
INSERT INTO post_meta VALUES (2, 2);
--
-- TOC entry 2308 (class 0 OID 18030)
-- Dependencies: 196
-- Data for Name: post_paso; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO post_paso VALUES (1, 1, 1, 1, 1, true, 'ya se hizo la aprobacion');
INSERT INTO post_paso VALUES (2, 2, 2, 2, 2, false, 'nno se hizo la aprobacion');
INSERT INTO post_paso VALUES (5, 1, 1, 1, 1, true, NULL);
--
-- TOC entry 2309 (class 0 OID 18037)
-- Dependencies: 197
-- Data for Name: post_seccion; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO post_seccion VALUES (1, 1001, '20');
INSERT INTO post_seccion VALUES (2, 1002, '10');
--
-- TOC entry 2310 (class 0 OID 18043)
-- Dependencies: 198
-- Data for Name: rol; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO rol VALUES (1, 'karen', true, 'permisos');
INSERT INTO rol VALUES (2, 'mauricio', true, 'mas permisos');
INSERT INTO rol VALUES (3, 'julio', true, 'mas o menos ');
--
-- TOC entry 2311 (class 0 OID 18050)
-- Dependencies: 199
-- Data for Name: rol_categoria; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO rol_categoria VALUES (1, 1, true);
INSERT INTO rol_categoria VALUES (2, 2, true);
INSERT INTO rol_categoria VALUES (3, 3, true);
--
-- TOC entry 2348 (class 0 OID 0)
-- Dependencies: 200
-- Name: rol_id_rol_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('rol_id_rol_seq', 1, false);
--
-- TOC entry 2313 (class 0 OID 18056)
-- Dependencies: 201
-- Data for Name: seccion; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO seccion VALUES (1001, 100, 'ciencias', true, 'ciencias');
INSERT INTO seccion VALUES (1002, 101, 'politicas', true, 'manosos');
INSERT INTO seccion VALUES (1003, 102, 'tecnologia', true, 'amantes de lo electronicos');
--
-- TOC entry 2349 (class 0 OID 0)
-- Dependencies: 202
-- Name: seccion_id_seccion_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('seccion_id_seccion_seq', 1, false);
--
-- TOC entry 2315 (class 0 OID 18065)
-- Dependencies: 203
-- Data for Name: tipo_paso; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO tipo_paso VALUES (1, 'validado', true, 'se ha validado la publicacion');
INSERT INTO tipo_paso VALUES (2, 'no validado', true, 'nno se valido su publicacion');
--
-- TOC entry 2350 (class 0 OID 0)
-- Dependencies: 204
-- Name: tipo_paso_id_tipo_paso_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('tipo_paso_id_tipo_paso_seq', 1, false);
--
-- TOC entry 2317 (class 0 OID 18074)
-- Dependencies: 205
-- Data for Name: tipo_post; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO tipo_post VALUES (1, 'publico', true, 'publicacion para todos');
INSERT INTO tipo_post VALUES (2, 'privado', true, 'ssolo para amigos');
INSERT INTO tipo_post VALUES (3, 'mejores amigos', true, 'solo para la lista de mejores amigos');
INSERT INTO tipo_post VALUES (4, 'jola mundo', true, 'un hola mundo muy bonito');
INSERT INTO tipo_post VALUES (5, 'Aloh', false, 'ME mordi la uña weh');
INSERT INTO tipo_post VALUES (6, 'hola', false, 'que tal :)');
INSERT INTO tipo_post VALUES (7, ' ', false, '');
INSERT INTO tipo_post VALUES (8, 'juela weh', false, 'dawdsa');
--
-- TOC entry 2351 (class 0 OID 0)
-- Dependencies: 206
-- Name: tipo_post_id_tipo_post_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('tipo_post_id_tipo_post_seq', 8, true);
--
-- TOC entry 2319 (class 0 OID 18083)
-- Dependencies: 207
-- Data for Name: tipo_post_seccion; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO tipo_post_seccion VALUES (1001, 1, true, true, 20);
INSERT INTO tipo_post_seccion VALUES (1002, 2, true, false, 21);
INSERT INTO tipo_post_seccion VALUES (1003, 3, true, true, 22);
INSERT INTO tipo_post_seccion VALUES (1001, 2, true, false, 10);
--
-- TOC entry 2320 (class 0 OID 18089)
-- Dependencies: 208
-- Data for Name: tipo_seccion; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO tipo_seccion VALUES (100, 'noticias', true, 'para el publico en general');
INSERT INTO tipo_seccion VALUES (101, 'ciencias', true, 'para los amantes de cosas cientificas');
INSERT INTO tipo_seccion VALUES (102, 'politica', true, 'ppara los manosos');
--
-- TOC entry 2352 (class 0 OID 0)
-- Dependencies: 209
-- Name: tipo_seccion_id_tipo_seccion_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('tipo_seccion_id_tipo_seccion_seq', 1, false);
--
-- TOC entry 2322 (class 0 OID 18098)
-- Dependencies: 210
-- Data for Name: usuario; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO usuario VALUES (1, 'flores quintanilla', 'karen idalia', '1993-12-05', true, 'usuario derecho a postear', 'mamasota', '1234');
INSERT INTO usuario VALUES (2, 'flores quintanilla', 'marian nataly', '1996-09-05', true, 'usuario normal', 'naty', 'naty123');
INSERT INTO usuario VALUES (3, 'flores quintanilla', 'mario edwin', '1997-04-13', false, 'usuario casi normal ', 'mariobueno', 'papasote');
--
-- TOC entry 2353 (class 0 OID 0)
-- Dependencies: 211
-- Name: usuario_id_usuario_seq; Type: SEQUENCE SET; Schema: public; Owner: mortal2017
--
SELECT pg_catalog.setval('usuario_id_usuario_seq', 1, false);
--
-- TOC entry 2324 (class 0 OID 18107)
-- Dependencies: 212
-- Data for Name: usuario_rol_categoria; Type: TABLE DATA; Schema: public; Owner: mortal2017
--
INSERT INTO usuario_rol_categoria VALUES (1, 1, 1, true);
INSERT INTO usuario_rol_categoria VALUES (2, 2, 2, true);
INSERT INTO usuario_rol_categoria VALUES (3, 3, 3, false);
--
-- TOC entry 2130 (class 2606 OID 18123)
-- Name: categoria pk_categoria; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY categoria
ADD CONSTRAINT pk_categoria PRIMARY KEY (id_categoria);
--
-- TOC entry 2132 (class 2606 OID 18125)
-- Name: cometario pk_comentario; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY cometario
ADD CONSTRAINT pk_comentario PRIMARY KEY (id_comentario);
--
-- TOC entry 2134 (class 2606 OID 18127)
-- Name: meta pk_meta; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY meta
ADD CONSTRAINT pk_meta PRIMARY KEY (id_meta);
--
-- TOC entry 2136 (class 2606 OID 18129)
-- Name: paso pk_paso; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY paso
ADD CONSTRAINT pk_paso PRIMARY KEY (id_paso);
--
-- TOC entry 2138 (class 2606 OID 18131)
-- Name: post pk_post; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post
ADD CONSTRAINT pk_post PRIMARY KEY (id_post);
--
-- TOC entry 2146 (class 2606 OID 18133)
-- Name: rol pk_rol; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY rol
ADD CONSTRAINT pk_rol PRIMARY KEY (id_rol);
--
-- TOC entry 2150 (class 2606 OID 18135)
-- Name: seccion pk_seccion; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY seccion
ADD CONSTRAINT pk_seccion PRIMARY KEY (id_seccion);
--
-- TOC entry 2152 (class 2606 OID 18137)
-- Name: tipo_paso pk_tipo_paso; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_paso
ADD CONSTRAINT pk_tipo_paso PRIMARY KEY (id_tipo_paso);
--
-- TOC entry 2154 (class 2606 OID 18139)
-- Name: tipo_post pk_tipo_post; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_post
ADD CONSTRAINT pk_tipo_post PRIMARY KEY (id_tipo_post);
--
-- TOC entry 2158 (class 2606 OID 18141)
-- Name: tipo_seccion pk_tipo_seccion; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_seccion
ADD CONSTRAINT pk_tipo_seccion PRIMARY KEY (id_tipo_seccion);
--
-- TOC entry 2160 (class 2606 OID 18143)
-- Name: usuario pk_usuario; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY usuario
ADD CONSTRAINT pk_usuario PRIMARY KEY (id_usuario);
--
-- TOC entry 2140 (class 2606 OID 18145)
-- Name: post_meta post_meta_pk; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post_meta
ADD CONSTRAINT post_meta_pk PRIMARY KEY (id_post, id_meta);
--
-- TOC entry 2142 (class 2606 OID 18147)
-- Name: post_paso post_paso_pk; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post_paso
ADD CONSTRAINT post_paso_pk PRIMARY KEY (id_paso, id_post);
--
-- TOC entry 2144 (class 2606 OID 18149)
-- Name: post_seccion post_seccion_pk; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post_seccion
ADD CONSTRAINT post_seccion_pk PRIMARY KEY (id_post, id_seccion);
--
-- TOC entry 2148 (class 2606 OID 18151)
-- Name: rol_categoria rol_categoria_pk; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY rol_categoria
ADD CONSTRAINT rol_categoria_pk PRIMARY KEY (id_categoria, id_rol);
--
-- TOC entry 2156 (class 2606 OID 18153)
-- Name: tipo_post_seccion tipo_post_seccion_pk; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_post_seccion
ADD CONSTRAINT tipo_post_seccion_pk PRIMARY KEY (id_seccion, id_tipo_post);
--
-- TOC entry 2162 (class 2606 OID 18155)
-- Name: usuario_rol_categoria usuario_rol_categoria_pk; Type: CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY usuario_rol_categoria
ADD CONSTRAINT usuario_rol_categoria_pk PRIMARY KEY (id_usuario, id_categoria, id_rol);
--
-- TOC entry 2173 (class 2606 OID 18156)
-- Name: rol_categoria categoria_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY rol_categoria
ADD CONSTRAINT categoria_fk FOREIGN KEY (id_categoria) REFERENCES categoria(id_categoria) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2166 (class 2606 OID 18161)
-- Name: post categoria_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post
ADD CONSTRAINT categoria_fk FOREIGN KEY (id_categoria) REFERENCES categoria(id_categoria) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2168 (class 2606 OID 18166)
-- Name: post_meta meta_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post_meta
ADD CONSTRAINT meta_fk FOREIGN KEY (id_meta) REFERENCES meta(id_meta) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2170 (class 2606 OID 18171)
-- Name: post_paso paso_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post_paso
ADD CONSTRAINT paso_fk FOREIGN KEY (id_paso) REFERENCES paso(id_paso) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2171 (class 2606 OID 18176)
-- Name: post_paso post_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post_paso
ADD CONSTRAINT post_fk FOREIGN KEY (id_post) REFERENCES post(id_post) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2172 (class 2606 OID 18181)
-- Name: post_seccion post_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post_seccion
ADD CONSTRAINT post_fk FOREIGN KEY (id_post) REFERENCES post(id_post) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2169 (class 2606 OID 18186)
-- Name: post_meta post_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post_meta
ADD CONSTRAINT post_fk FOREIGN KEY (id_post) REFERENCES post(id_post) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2163 (class 2606 OID 18191)
-- Name: cometario post_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY cometario
ADD CONSTRAINT post_fk FOREIGN KEY (id_post) REFERENCES post(id_post) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2178 (class 2606 OID 18196)
-- Name: usuario_rol_categoria rol_categoria_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY usuario_rol_categoria
ADD CONSTRAINT rol_categoria_fk FOREIGN KEY (id_categoria, id_rol) REFERENCES rol_categoria(id_categoria, id_rol) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2164 (class 2606 OID 18201)
-- Name: paso rol_categoria_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY paso
ADD CONSTRAINT rol_categoria_fk FOREIGN KEY (id_categoria, id_rol) REFERENCES rol_categoria(id_categoria, id_rol) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2174 (class 2606 OID 18206)
-- Name: rol_categoria rol_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY rol_categoria
ADD CONSTRAINT rol_fk FOREIGN KEY (id_rol) REFERENCES rol(id_rol) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2176 (class 2606 OID 18211)
-- Name: tipo_post_seccion seccion_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_post_seccion
ADD CONSTRAINT seccion_fk FOREIGN KEY (id_seccion) REFERENCES seccion(id_seccion) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2165 (class 2606 OID 18216)
-- Name: paso tipo_paso_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY paso
ADD CONSTRAINT tipo_paso_fk FOREIGN KEY (id_tipo_paso) REFERENCES tipo_paso(id_tipo_paso) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2167 (class 2606 OID 18221)
-- Name: post tipo_post_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY post
ADD CONSTRAINT tipo_post_fk FOREIGN KEY (id_tipo_post) REFERENCES tipo_post(id_tipo_post) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2177 (class 2606 OID 18226)
-- Name: tipo_post_seccion tipo_post_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY tipo_post_seccion
ADD CONSTRAINT tipo_post_fk FOREIGN KEY (id_tipo_post) REFERENCES tipo_post(id_tipo_post) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2175 (class 2606 OID 18231)
-- Name: seccion tipo_seccion_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY seccion
ADD CONSTRAINT tipo_seccion_fk FOREIGN KEY (id_tipo_seccion) REFERENCES tipo_seccion(id_tipo_seccion) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
--
-- TOC entry 2179 (class 2606 OID 18236)
-- Name: usuario_rol_categoria usuario_fk; Type: FK CONSTRAINT; Schema: public; Owner: mortal2017
--
ALTER TABLE ONLY usuario_rol_categoria
ADD CONSTRAINT usuario_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id_usuario) MATCH FULL ON UPDATE CASCADE ON DELETE SET NULL;
-- Completed on 2017-11-23 17:13:04 CST
--
-- PostgreSQL database dump complete
--
| true
|
018b147df8163a70fa78da3cc45ed4679b575c04
|
SQL
|
thibaultvanc/migration-tool
|
/database/seeds_initials/sql/country.sql
|
UTF-8
| 13,902
| 2.65625
| 3
|
[
"MIT"
] |
permissive
|
INSERT INTO `PLAY_country` (`id_country`, `id_currency`, `name`, `iso`, `indicative`, `relevance`, `region`, `is_state`) VALUES
(1, 2, 'Afghanistan', 'AF', '93', 0.00, 'asia', 0),
(2, 34, 'Åland Islands', 'AX', '358', 0.00, 'europe', 0),
(3, 1, 'Albania', 'AL', '355', 0.00, 'europe', 0),
(4, NULL, 'Algeria', 'DZ', '213', 0.00, 'africa', 0),
(5, 106, 'American Samoa', 'AS', '1684', 0.50, 'oceania', 0),
(6, 34, 'Andorra', 'AD', '376', 0.50, 'europe', 0),
(7, NULL, 'Angola', 'AO', '244', 0.00, 'africa', 0),
(8, 30, 'Anguilla', 'AI', '1264', 0.50, 'america', 0),
(9, NULL, 'Antarctica', 'AQ', '672', 0.00, '', 0),
(10, 30, 'Antigua and Barbuda', 'AG', '1268', 0.50, 'america', 0),
(11, 3, 'Argentina', 'AR', '54', 0.00, 'america', 0),
(12, NULL, 'Armenia', 'AM', '374', 0.00, 'asia', 0),
(13, 4, 'Aruba', 'AW', '297', 0.50, 'america', 0),
(15, 5, 'Australia', 'AU', '61', 1.50, 'oceania', 1),
(16, 34, 'Austria', 'AT', '43', 0.00, 'europe', 1),
(17, 6, 'Azerbaijan', 'AZ', '994', 0.00, 'asia', 0),
(18, 7, 'Bahamas', 'BS', '1242', 0.00, 'america', 0),
(19, NULL, 'Bahrain', 'BH', '973', 0.00, 'asia', 0),
(20, NULL, 'Bangladesh', 'BD', '880', 2.00, 'asia', 0),
(21, 8, 'Barbados', 'BB', '1246', 0.00, 'america', 0),
(22, 9, 'Belarus', 'BY', '375', 0.00, 'europe', 0),
(23, 34, 'Belgium', 'BE', '32', 1.50, 'europe', 0),
(24, 10, 'Belize', 'BZ', '501', 0.00, 'america', 0),
(25, NULL, 'Benin', 'BJ', '229', 0.00, 'africa', 0),
(26, 11, 'Bermuda', 'BM', '1441', 0.50, 'america', 0),
(27, NULL, 'Bhutan', 'BT', '975', 0.00, 'asia', 0),
(28, NULL, 'Bolivia', 'BO', '591', 0.00, 'america', 0),
(29, 13, 'Bosnia and Herzegovina', 'BA', '387', 0.00, 'europe', 0),
(30, 14, 'Botswana', 'BW', '267', 0.00, 'africa', 0),
(31, 75, 'Bouvet Island', 'BV', '47', 0.00, '', 0),
(32, 16, 'Brazil', 'BR', '55', 2.00, 'america', 1),
(33, 106, 'British Indian Ocean Territory', 'IO', '246', 0.00, 'africa', 0),
(34, 106, 'British Virgin Islands', 'VG', '1284', 0.50, 'america', 0),
(35, 17, 'Brunei', 'BN', '673', 0.00, 'asia', 0),
(36, 15, 'Bulgaria', 'BG', '359', 0.00, 'europe', 0),
(37, NULL, 'Burkina Faso', 'BF', '226', 0.00, 'africa', 0),
(38, NULL, 'Burundi', 'BI', '257', 0.00, 'africa', 0),
(39, 18, 'Cambodia', 'KH', '855', 0.00, 'asia', 0),
(40, NULL, 'Cameroon', 'CM', '237', 0.00, 'africa', 0),
(41, 19, 'Canada', 'CA', '1', 2.00, 'america', 0),
(42, NULL, 'Cape Verde', 'CV', '238', 0.00, 'africa', 0),
(43, 20, 'Cayman Islands', 'KY', '1345', 0.50, 'america', 0),
(44, NULL, 'Central african Republic', 'CF', '236', 0.00, 'africa', 0),
(45, NULL, 'Chad', 'TD', '235', 0.00, 'africa', 0),
(46, NULL, 'Chile', 'CL', '56', 0.00, 'america', 0),
(47, 22, 'China', 'CN', '86', 0.00, 'asia', 0),
(48, 5, 'Christmas Island', 'CX', '61', 0.50, 'oceania', 0),
(49, 5, 'Cocos (Keeling) Islands', 'CC', '61', 0.00, 'oceania', 0),
(50, 23, 'Colombia', 'CO', '57', 0.00, 'america', 0),
(51, NULL, 'Comoros', 'KM', '269', 0.00, 'africa', 0),
(52, NULL, 'Republic of the Congo', 'CG', '242', 0.00, 'africa', 0),
(53, NULL, 'Democratic Republic of the Congo', 'CD', '243', 0.00, 'africa', 0),
(54, 72, 'Cook Islands', 'CK', '682', 0.50, 'oceania', 0),
(55, 24, 'Costa Rica', 'CR', '506', 0.00, 'america', 0),
(56, 25, 'Croatia', 'HR', '385', 0.00, 'europe', 0),
(57, NULL, 'Cuba', 'CU', '53', 0.00, 'america', 0),
(58, 34, 'Cyprus', 'CY', '357', 0.00, 'europe', 0),
(59, 27, 'Czech Republic', 'CZ', '420', 0.00, 'europe', 0),
(60, 28, 'Denmark', 'DK', '45', 1.50, 'europe', 0),
(61, NULL, 'Djibouti', 'DJ', '253', 0.00, 'africa', 0),
(62, 30, 'Dominica', 'DM', '1767', 0.50, 'america', 0),
(63, 29, 'Dominican Republic', 'DO', '1809', 0.00, 'america', 0),
(64, 106, 'Ecuador', 'EC', '593', 0.00, 'america', 0),
(65, 31, 'Egypt', 'EG', '20', 1.50, 'africa', 0),
(66, NULL, 'El Salvador', 'SV', '503', 0.00, 'america', 0),
(67, NULL, 'Equatorial Guinea', 'GQ', '240', 0.00, 'africa', 0),
(68, NULL, 'Eritrea', 'ER', '291', 0.00, 'africa', 0),
(69, 34, 'Estonia', 'EE', '372', 0.00, 'europe', 0),
(70, NULL, 'Ethiopia', 'ET', '251', 0.00, 'africa', 0),
(71, 35, 'Falkland Islands', 'FK', '500', 0.50, 'america', 0),
(72, 28, 'Faroe Islands', 'FO', '298', 0.50, 'europe', 0),
(73, 36, 'Fiji', 'FJ', '679', 0.00, 'oceania', 0),
(74, 34, 'Finland', 'FI', '358', 0.50, 'europe', 0),
(75, 34, 'France', 'FR', '33', 2.50, 'europe', 0),
(76, 34, 'French Guiana', 'GF', '594', 0.00, 'america', 0),
(77, NULL, 'French Polynesia', 'PF', '689', 0.00, 'oceania', 0),
(78, 34, 'French Southern and Antarctic Lands', 'TF', '262', 0.00, '', 0),
(79, NULL, 'Gabon', 'GA', '241', 0.00, 'africa', 0),
(80, NULL, 'Gambia', 'GM', '220', 0.00, 'africa', 0),
(81, NULL, 'Georgia', 'GE', '995', 0.00, 'asia', 0),
(82, 34, 'Germany', 'DE', '49', 3.00, 'europe', 1),
(83, NULL, 'Ghana', 'GH', '233', 0.00, 'africa', 0),
(84, 38, 'Gibraltar', 'GI', '350', 0.50, 'europe', 0),
(85, 34, 'Greece', 'GR', '30', 1.50, 'europe', 0),
(86, 28, 'Greenland', 'GL', '299', 0.50, 'america', 0),
(87, 30, 'Grenada', 'GD', '1473', 0.00, 'america', 0),
(88, 34, 'Guadeloupe', 'GP', '590', 0.00, 'america', 0),
(89, 106, 'Guam', 'GU', '1671', 0.00, 'oceania', 0),
(90, 39, 'Guatemala', 'GT', '502', 0.00, 'america', 0),
(91, 105, 'Guernsey', 'GG', '44', 0.50, 'europe', 0),
(92, NULL, 'Guinea', 'GN', '224', 0.00, 'africa', 0),
(93, NULL, 'Guinea-Bissau', 'GW', '245', 0.00, 'africa', 0),
(94, 41, 'Guyana', 'GY', '592', 0.00, 'america', 0),
(95, NULL, 'Haiti', 'HT', '509', 0.00, 'america', 0),
(96, 5, 'Heard Island and McDonald Islands', 'HM', '61', 0.00, '', 0),
(97, 34, 'Vatican City', 'VA', '39066', 0.50, 'europe', 0),
(98, 42, 'Honduras', 'HN', '504', 0.00, 'america', 0),
(99, 43, 'Hong Kong', 'HK', '852', 0.00, 'asia', 0),
(100, 44, 'Hungary', 'HU', '36', 0.00, 'europe', 0),
(101, 45, 'Iceland', 'IS', '354', 0.00, 'europe', 0),
(102, 46, 'India', 'IN', '91', 3.00, 'asia', 1),
(103, 47, 'Indonesia', 'ID', '62', 2.00, 'asia', 0),
(104, NULL, 'Ivory Coast', 'CI', '225', 0.00, 'africa', 0),
(105, 48, 'Iran', 'IR', '98', 0.00, 'asia', 0),
(106, NULL, 'Iraq', 'IQ', '964', 0.00, 'asia', 0),
(107, 34, 'Ireland', 'IE', '353', 1.20, 'europe', 0),
(108, 105, 'Isle of Man', 'IM', '44', 0.50, 'europe', 0),
(109, 50, 'Israel', 'IL', '972', 0.00, 'asia', 0),
(110, 34, 'Italy', 'IT', '39', 2.00, 'europe', 0),
(111, 51, 'Jamaica', 'JM', '1876', 0.00, 'america', 0),
(112, 52, 'Japan', 'JP', '81', 2.50, 'asia', 0),
(113, 105, 'Jersey', 'JE', '44', 0.50, 'europe', 0),
(114, NULL, 'Jordan', 'JO', '962', 0.00, 'asia', 0),
(115, 54, 'Kazakhstan', 'KZ', '76', 0.00, 'asia', 0),
(116, NULL, 'Kenya', 'KE', '254', 0.00, 'africa', 0),
(117, 5, 'Kiribati', 'KI', '686', 0.00, 'oceania', 0),
(118, NULL, 'Kuwait', 'KW', '965', 0.00, 'asia', 0),
(119, 57, 'Kyrgyzstan', 'KG', '996', 0.00, 'asia', 0),
(120, 58, 'Laos', 'LA', '856', 0.00, 'asia', 0),
(121, 34, 'Latvia', 'LV', '371', 0.00, 'europe', 0),
(122, 60, 'Lebanon', 'LB', '961', 0.00, 'asia', 0),
(123, NULL, 'Lesotho', 'LS', '266', 0.00, 'africa', 0),
(124, 61, 'Liberia', 'LR', '231', 0.00, 'africa', 0),
(125, NULL, 'Libya', 'LY', '218', 0.00, 'africa', 0),
(126, 96, 'Liechtenstein', 'LI', '423', 0.00, 'europe', 0),
(127, 62, 'Lithuania', 'LT', '370', 0.00, 'europe', 0),
(128, 34, 'Luxembourg', 'LU', '352', 0.00, 'europe', 0),
(129, NULL, 'Macau', 'MO', '853', 0.00, 'asia', 0),
(130, 63, 'Macedonia', 'MK', '389', 0.00, 'europe', 0),
(131, NULL, 'Madagascar', 'MG', '261', 0.00, 'africa', 0),
(132, NULL, 'Malawi', 'MW', '265', 0.00, 'africa', 0),
(133, 64, 'Malaysia', 'MY', '60', 0.00, 'asia', 1),
(134, NULL, 'Maldives', 'MV', '960', 0.00, 'asia', 0),
(135, NULL, 'Mali', 'ML', '223', 0.00, 'africa', 0),
(136, 34, 'Malta', 'MT', '356', 0.00, 'europe', 0),
(137, 106, 'Marshall Islands', 'MH', '692', 0.50, 'oceania', 0),
(138, 34, 'Martinique', 'MQ', '596', 0.00, 'america', 0),
(139, NULL, 'Mauritania', 'MR', '222', 0.00, 'africa', 0),
(140, 65, 'Mauritius', 'MU', '230', 0.00, 'africa', 0),
(141, 34, 'Mayotte', 'YT', '262', 0.00, 'africa', 0),
(142, 66, 'Mexico', 'MX', '52', 1.50, 'america', 1),
(143, 106, 'Micronesia', 'FM', '691', 0.00, 'oceania', 0),
(144, NULL, 'Moldova', 'MD', '373', 0.00, 'europe', 0),
(145, 34, 'Monaco', 'MC', '377', 0.00, 'europe', 0),
(146, 67, 'Mongolia', 'MN', '976', 0.00, 'asia', 0),
(147, 34, 'Montenegro', 'ME', '382', 0.00, 'europe', 0),
(148, 30, 'Montserrat', 'MS', '1664', 0.50, 'america', 0),
(149, NULL, 'Morocco', 'MA', '212', 0.00, 'africa', 0),
(150, 68, 'Mozambique', 'MZ', '258', 0.00, 'africa', 0),
(151, NULL, 'Myanmar', 'MM', '95', 0.00, 'asia', 0),
(152, NULL, 'Namibia', 'NA', '264', 0.00, 'africa', 0),
(153, 5, 'Nauru', 'NR', '674', 0.50, 'oceania', 0),
(154, 70, 'Nepal', 'NP', '977', 0.00, 'asia', 0),
(155, 34, 'Netherlands', 'NL', '31', 1.50, 'europe', 0),
(156, NULL, 'New Caledonia', 'NC', '687', 0.50, 'oceania', 0),
(157, 72, 'New Zealand', 'NZ', '64', 1.00, 'oceania', 0),
(158, 73, 'Nicaragua', 'NI', '505', 0.00, 'america', 0),
(159, NULL, 'Niger', 'NE', '227', 0.00, 'africa', 0),
(160, 74, 'Nigeria', 'NG', '234', 1.50, 'africa', 0),
(161, 72, 'Niue', 'NU', '683', 0.50, 'oceania', 0),
(162, 5, 'Norfolk Island', 'NF', '672', 0.50, 'oceania', 0),
(163, 55, 'North Korea', 'KP', '850', 0.00, 'asia', 0),
(164, 106, 'Northern Mariana Islands', 'MP', '1670', 0.50, 'oceania', 0),
(165, 75, 'Norway', 'NO', '47', 1.50, 'europe', 0),
(166, 76, 'Oman', 'OM', '968', 0.00, 'asia', 0),
(167, 77, 'Pakistan', 'PK', '92', 2.00, 'asia', 0),
(168, 106, 'Palau', 'PW', '680', 0.50, 'oceania', 0),
(169, 50, 'Palestine', 'PS', '970', 0.00, 'asia', 0),
(170, NULL, 'Panama', 'PA', '507', 0.00, 'america', 0),
(171, NULL, 'Papua New Guinea', 'PG', '675', 0.00, 'oceania', 0),
(172, 79, 'Paraguay', 'PY', '595', 0.00, 'america', 0),
(173, 80, 'Peru', 'PE', '51', 0.00, 'america', 0),
(174, 81, 'Philippines', 'PH', '63', 1.50, 'asia', 0),
(175, 72, 'Pitcairn Islands', 'PN', '64', 0.50, 'oceania', 0),
(176, 82, 'Poland', 'PL', '48', 1.25, 'europe', 0),
(177, 34, 'Portugal', 'PT', '351', 1.50, 'europe', 0),
(178, 106, 'Puerto Rico', 'PR', '1787', 0.00, 'america', 0),
(179, 83, 'Qatar', 'QA', '974', 0.00, 'asia', 0),
(180, 34, 'Réunion', 'RE', '262', 0.00, 'africa', 0),
(181, 84, 'Romania', 'RO', '40', 0.00, 'europe', 0),
(182, 85, 'Russia', 'RU', '7', 2.50, 'europe', 0),
(183, NULL, 'Rwanda', 'RW', '250', 0.00, 'africa', 0),
(184, 34, 'Saint Barthélemy', 'BL', '590', 0.00, 'america', 0),
(185, 86, 'Saint Helena', 'SH', '290', 0.00, 'africa', 0),
(186, 30, 'Saint Kitts and Nevis', 'KN', '1869', 0.00, 'america', 0),
(187, 30, 'Saint Lucia', 'LC', '1758', 0.00, 'america', 0),
(188, 34, 'Saint Martin', 'MF', '590', 0.00, 'america', 0),
(189, 34, 'Saint Pierre and Miquelon', 'PM', '508', 0.00, 'america', 0),
(190, 30, 'Saint Vincent and the Grenadines', 'VC', '1784', 0.00, 'america', 0),
(191, NULL, 'Samoa', 'WS', '685', 0.00, 'oceania', 0),
(192, 34, 'San Marino', 'SM', '378', 0.00, 'europe', 0),
(193, NULL, 'São Tomé and Príncipe', 'ST', '239', 0.00, 'africa', 0),
(194, 87, 'Saudi Arabia', 'SA', '966', 0.00, 'asia', 0),
(195, NULL, 'Senegal', 'SN', '221', 0.00, 'africa', 0),
(196, 88, 'Serbia', 'RS', '381', 0.00, 'europe', 0),
(197, 89, 'Seychelles', 'SC', '248', 0.50, 'africa', 0),
(198, NULL, 'Sierra Leone', 'SL', '232', 0.00, 'africa', 0),
(199, 90, 'Singapore', 'SG', '65', 0.00, 'asia', 0),
(200, 34, 'Slovakia', 'SK', '421', 0.00, 'europe', 0),
(201, 34, 'Slovenia', 'SI', '386', 0.00, 'europe', 0),
(202, NULL, 'Solomon Islands', 'SB', '677', 0.00, 'oceania', 0),
(203, 92, 'Somalia', 'SO', '252', 0.00, 'africa', 0),
(204, 93, 'South africa', 'ZA', '27', 0.00, 'africa', 0),
(205, 105, 'South Georgia', 'GS', '500', 0.00, 'america', 0),
(206, 56, 'South Korea', 'KR', '82', 1.50, 'asia', 0),
(207, 34, 'Spain', 'ES', '34', 2.00, 'europe', 0),
(208, 94, 'Sri Lanka', 'LK', '94', 0.00, 'asia', 0),
(209, NULL, 'Sudan', 'SD', '249', 0.00, 'africa', 0),
(210, 97, 'Suriname', 'SR', '597', 0.00, 'america', 0),
(211, 75, 'Svalbard and Jan Mayen', 'SJ', '4779', 0.50, 'europe', 0),
(212, NULL, 'Swaziland', 'SZ', '268', 0.00, 'africa', 0),
(213, 95, 'Sweden', 'SE', '46', 1.50, 'europe', 0),
(214, NULL, 'Switzerland', 'CH', '41', 1.50, 'europe', 1),
(215, 98, 'Syria', 'SY', '963', 0.00, 'asia', 0),
(216, 99, 'Taiwan', 'TW', '886', 0.00, 'asia', 0),
(217, NULL, 'Tajikistan', 'TJ', '992', 0.00, 'asia', 0),
(218, NULL, 'Tanzania', 'TZ', '255', 0.00, 'africa', 0),
(219, 100, 'Thailand', 'TH', '66', 0.00, 'asia', 0),
(220, 106, 'Timor-Leste', 'TL', '670', 0.00, 'asia', 0),
(221, NULL, 'Togo', 'TG', '228', 0.00, 'africa', 0),
(222, 72, 'Tokelau', 'TK', '690', 0.50, 'oceania', 0),
(223, NULL, 'Tonga', 'TO', '676', 0.00, 'oceania', 0),
(224, 101, 'Trinidad and Tobago', 'TT', '1868', 0.00, 'america', 0),
(225, NULL, 'Tunisia', 'TN', '216', 0.00, 'africa', 0),
(226, NULL, 'Turkey', 'TR', '90', 0.00, 'asia', 0),
(227, NULL, 'Turkmenistan', 'TM', '993', 0.00, 'asia', 0),
(228, 106, 'Turks and Caicos Islands', 'TC', '1649', 0.50, 'america', 0),
(229, 5, 'Tuvalu', 'TV', '688', 0.50, 'oceania', 0),
(230, NULL, 'Uganda', 'UG', '256', 0.00, 'africa', 0),
(231, 104, 'Ukraine', 'UA', '380', 0.00, 'europe', 0),
(232, NULL, 'United Arab Emirates', 'AE', '971', 0.00, 'asia', 0),
(233, 105, 'United Kingdom', 'GB', '44', 2.50, 'europe', 0),
(234, NULL, 'United States', 'US', '1', 3.50, 'america', 1),
(235, 106, 'United States Minor Outlying Islands', 'UM', '699', 0.00, 'america', 0),
(236, 106, 'United States Virgin Islands', 'VI', '1340', 0.50, 'america', 0),
(237, NULL, 'Uruguay', 'UY', '598', 0.00, 'america', 0),
(238, 108, 'Uzbekistan', 'UZ', '998', 0.00, 'asia', 0),
(239, NULL, 'Vanuatu', 'VU', '678', 0.00, 'oceania', 0),
(240, 109, 'Venezuela', 'VE', '58', 0.00, 'america', 1),
(241, 110, 'Vietnam', 'VN', '84', 1.50, 'asia', 0),
(242, NULL, 'Wallis and Futuna', 'WF', '681', 0.50, 'oceania', 0),
(243, NULL, 'Western Sahara', 'EH', '212', 0.00, 'africa', 0),
(244, 111, 'Yemen', 'YE', '967', 0.00, 'asia', 0),
(245, NULL, 'Zambia', 'ZM', '260', 0.00, 'africa', 0),
(246, NULL, 'Zimbabwe', 'ZW', '263', 0.00, 'africa', 0);
| true
|
1163dacaf6aaeac7de37fe52318f5c3b8eb9a709
|
SQL
|
kz3r/ppf-resetada
|
/src/main/resources/db/migration/postgresql/V1_0_0__core_ddl.sql
|
UTF-8
| 684
| 3.8125
| 4
|
[] |
no_license
|
CREATE TABLE playlist (
id VARCHAR PRIMARY KEY,
href VARCHAR NOT NULL,
name VARCHAR NOT NULL
);
CREATE TABLE track_log (
id VARCHAR NOT NULL,
name VARCHAR NOT NULL,
playlist_id VARCHAR NOT NULL,
artist_id VARCHAR NOT NULL,
artist_name VARCHAR NOT NULL,
album_id VARCHAR NOT NULL,
album_name VARCHAR NOT NULL,
duration BIGINT NOT NULL,
explicit bool NOT NULL,
added_by VARCHAR NOT NULL,
added_at timestamptz NOT NULL,
CONSTRAINT pk_track_log_id PRIMARY KEY (id, added_at),
CONSTRAINT fk_track_log_playlist FOREIGN KEY (playlist_id) REFERENCES playlist(id)
);
CREATE INDEX added_at_idx_desc ON track_log (added_at DESC);
| true
|
2b297e8c972cdb23e08e8b88294a96bab2ac7ece
|
SQL
|
bognarpeter/BI2019W-G53
|
/Assignment_1/task 2/etl/ETL_Product.sql
|
UTF-8
| 641
| 3.15625
| 3
|
[] |
no_license
|
INSERT INTO `BI_OLAP_53`.`DM_Product`
SELECT
P.`ProductID`,
P.`ProductNumber`,
P.`Name`,
P.`ProductModelName`,
P.`StandardCost`,
P.`ListPrice`,
PC1.`Name`,
PC2.`Name`,
P.`SellStartDate`,
P.`SellEndDate`,
P.`DiscontinuedDate`,
P.`Size`,
P.`Weight`,
IF(PC2.`Name`='Bikes' OR P.`ProductCategoryID` = 16 OR P.`ProductCategoryID` = 18 OR P.`ProductCategoryID` = 20, true, false)
FROM `BI_OLTP_53`.`TB_Product` AS P
JOIN `BI_OLTP_53`.`TB_ProductCategory` AS PC1
ON P.ProductCategoryID = PC1.ProductCategoryID
JOIN `BI_OLTP_53`.`TB_ProductCategory` AS PC2
ON PC1.ParentProductCategoryID = PC2.ProductCategoryID;
| true
|
42310dcacb16765b456fc669dafda33d696b2ae9
|
SQL
|
guillez/ramas
|
/sql/ddl/20_Tablas/sge_elemento.sql
|
ISO-8859-2
| 772
| 2.859375
| 3
|
[] |
no_license
|
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- SIU-Kolla 4 - Mdulo de Gestin de Encuestas
-- Versin 4.3
-- Tabla: sge_elemento
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TABLE IF EXISTS sge_elemento;
CREATE TABLE sge_elemento
(
elemento INTEGER NOT NULL DEFAULT nextval('sge_elemento_seq'::text) ,
elemento_externo Varchar(100),
url_img Varchar(127),
descripcion Text NOT NULL,
unidad_gestion Varchar NOT NULL,
sistema Integer
);
-- ALTER TABLE sge_elemento DROP CONSTRAINT pk_sge_elemento;
ALTER TABLE sge_elemento ADD CONSTRAINT pk_sge_elemento PRIMARY KEY (elemento);
-- ++++++++++++++++++++++++++ Fin tabla sge_elemento +++++++++++++++++++++++++++++
| true
|
4077004459ff17eec43d2deb7c7348e3ec4a4ace
|
SQL
|
sailyshah/Stock-market-analysis
|
/Assignment-stock market analysis-Saily Shah.sql
|
UTF-8
| 12,740
| 4.40625
| 4
|
[] |
no_license
|
create schema `assignment`;
### Use schema named 'assignment'
use `assignment`;
### Imported all the CSV files using "MySQL for excel" option in Excel
# Date column has been assigned as primary key in the excel before importing the dataset in MySQL
# created tables are named as bajaj_auto, eicher_motors, hero_motocorp, infosys, tcs & tvs_motors
-- ------------------------------------EDA-----------------------------------------
### checking Bajaj Auto stock data
# Checking the columns and data types
desc bajaj_auto;
# Count of rows
select count(*) from bajaj_auto;
# Glimpse of data
select * from bajaj_auto limit 5;
### checking Eicher Motors stock data
# Checking the columns and data types
desc eicher_motors;
# Count of rows
select count(*) from eicher_motors;
# Glimpse of data
select * from eicher_motors limit 5;
### checking Hero Motorcorp stock data
# Checking the columns and data types
desc hero_motocorp;
# Count of rows
select count(*) from hero_motocorp;
# Glimpse of data
select * from hero_motocorp limit 5;
### checking Infosys stock data
# Checking the columns and data types
desc infosys;
# Count of rows
select count(*) from infosys;
# Glimpse of data
select * from infosys limit 5;
### checking TCS stock data
# Checking the columns and data types
desc tcs;
# Count of rows
select count(*) from tcs;
# Glimpse of data
select * from tcs limit 5;
### checking TVS_Motors stock data
# Checking the columns and data types
desc tvs_motors;
# Count of rows
select count(*) from tvs_motors;
# Glimpse of data
select * from tvs_motors limit 5;
-- --------------------------- Expected Result = 1 ---------------------------------
####### RESULT 1 = Create a table containing date, close price, MA for 20 & 50 days.#######
### Create new tables for each stock
create table bajaj1 (
`date` date,
`close_price` decimal(10,2),
`MA20` decimal(10,2),
`MA50` decimal(10,2) ,
`row_num` integer
);
create table eicher1 like bajaj1;
create table hero1 like bajaj1;
create table infosys1 like bajaj1;
create table tcs1 like bajaj1;
Create table tvs1 like bajaj1;
-- ## Insert values into the table to include 20 DAY and 50 DAY Moving Averages columns
# For bajaj_auto stocks
insert into bajaj1 (Date, close_price,MA20, MA50,row_num)
select Date,close_price,
avg(close_price) over (order by date asc rows 19 preceding) as 'MA20',
avg(close_price) over (order by date asc rows 49 preceding) as 'MA50',
ROW_NUMBER() OVER (ORDER BY Date) as row_num
from bajaj_auto
order by Date;
-- Removing the avg values calculated for the 1st 20 rows in MA20 and for 1st 50 rows in MA50
UPDATE bajaj1
SET MA20 = NULL
WHERE
row_num < 20;
UPDATE bajaj1
SET MA50 = NULL
WHERE
row_num < 50;
-- We no longer require the column with row numbers. Let us drop it.
alter table bajaj1
drop column row_num;
# For Eicher_Motor stocks
insert into eicher1 (Date, close_price,MA20, MA50,row_num)
select Date,close_price,
avg(close_price) over (order by date asc rows 19 preceding) as 'MA20',
avg(close_price) over (order by date asc rows 49 preceding) as 'MA50',
ROW_NUMBER() OVER (ORDER BY Date) as row_num
from eicher_motors
order by Date;
-- Removing the avg values calculated for the 1st 20 rows in MA20 and for 1st 50 rows in MA50
UPDATE eicher1
SET MA20 = NULL
WHERE
row_num < 20;
UPDATE eicher1
SET MA50 = NULL
WHERE
row_num < 50;
-- We no longer require the column with row numbers. Let us drop it.
alter table eicher1
drop column row_num;
# For hero_motorcorp stocks
insert into hero1 (Date, close_price,MA20, MA50,row_num)
select Date,close_price,
avg(close_price) over (order by date asc rows 19 preceding) as 'MA20',
avg(close_price) over (order by date asc rows 49 preceding) as 'MA50',
ROW_NUMBER() OVER (ORDER BY Date) as row_num
from hero_motocorp
order by Date;
-- Removing the avg values calculated for the 1st 20 rows in MA20 and for 1st 50 rows in MA50
UPDATE hero1
SET MA20 = NULL
WHERE
row_num < 20;
UPDATE hero1
SET MA50 = NULL
WHERE
row_num < 50;
-- We no longer require the column with row numbers. Let us drop it.
alter table hero1
drop column row_num;
# For infosys stocks
insert into infosys1 (Date, close_price,MA20, MA50,row_num)
select Date,close_price,
avg(close_price) over (order by date asc rows 19 preceding) as 'MA20',
avg(close_price) over (order by date asc rows 49 preceding) as 'MA50',
ROW_NUMBER() OVER (ORDER BY Date) as row_num
from infosys
order by Date;
-- Removing the avg values calculated for the 1st 20 rows in MA20 and for 1st 50 rows in MA50
UPDATE infosys1
SET MA20 = NULL
WHERE
row_num < 20;
UPDATE infosys1
SET MA50 = NULL
WHERE
row_num < 50;
-- We no longer require the column with row numbers. Let us drop it.
alter table infosys1
drop column row_num;
# For tcs stocks
insert into tcs1 (Date, close_price,MA20, MA50,row_num)
select Date,close_price,
avg(close_price) over (order by date asc rows 19 preceding) as 'MA20',
avg(close_price) over (order by date asc rows 49 preceding) as 'MA50',
row_number() over (order by date) as 'row_num'
from tcs
order by Date;
-- Removing the avg values calculated for the 1st 20 rows in MA20 and for 1st 50 rows in MA50
UPDATE tcs1
SET MA20 = NULL
WHERE
row_num < 20;
UPDATE tcs1
SET MA50 = NULL
WHERE
row_num < 50;
-- We no longer require the column with row numbers. Let us drop it.
alter table tcs1
drop column row_num;
# For tvs_motors stocks
insert into tvs1 (Date, close_price,MA20, MA50,row_num)
select Date,close_price,
avg(close_price) over (order by date asc rows 19 preceding) as 'MA20',
avg(close_price) over (order by date asc rows 49 preceding) as 'MA50',
row_number() over (order by date) as 'row_num'
from tvs_motors
order by Date;
-- Removing the avg values calculated for the 1st 20 rows in MA20 and for 1st 50 rows in MA50
UPDATE tvs1
SET MA20 = NULL
WHERE
row_num < 20;
UPDATE tvs1
SET MA50 = NULL
WHERE
row_num < 50;
-- We no longer require the column with row numbers. Let us drop it.
alter table tvs1
drop column row_num;
-- view values inserted in each table
select * from bajaj1;
select * from eicher1;
select * from hero1;
select * from infosys1;
select * from tcs1;
select * from tvs1;
-- --------------------------- Expected Result = 2 ---------------------------------
####### RESULT 2 = Create a Master table with cllose prices of all the stocks #######
create table master_table as
( select date,b.Close_Price as 'Bajaj',t.Close_Price as 'TCS',v.Close_Price as 'TVS',i.Close_Price as 'Infosys', e.Close_Price as 'Eicher',h.Close_Price as 'Hero'
from bajaj1 b inner join eicher1 e using(date)
inner join hero1 h using(date)
inner join infosys1 i using(date)
inner join tcs1 t using(date)
inner join tvs1 v using(date));
## Glimpse of Master Table
select *
from master_table;
-- --------------------------- Expected Result = 3 ---------------------------------
####### RESULT 3 = Creating table with signal information #######
# Signal will be updated only on 'crossing points' whenever 20_Day_MA crosses 50_Day_MA
# Crossing points can be checked by using lag function
# Signal is updated on 'crosssing points' based on following condition:
-- # if 20_Day_MA > 50_Day_MA than Buy
-- # if 20_Day_MA < 50_Day_MA than Sell
-- # else Hold
# Setting the first 49 rows signal as 'NA' (Not applicable) in all tables , as MA50
-- is only valid from the 50th row onwards and hence signals starting from the 50th row alone will be valid
## Creating bajaj2
create view raw_file1 as
select *, ROW_NUMBER() OVER (ORDER BY Date) RowNumber
from bajaj1;
create table bajaj2
(select Date,Close_Price,
CASE
when RowNumber < 50 then 'NA' # Ignoring the first 49 rows
when MA20 > MA50 and (lag(MA20,1) over (order by date)) < (lag(MA50,1) over (order by date))
then 'Buy'
when MA20 < MA50 and (lag(MA20,1) over (order by date)) > (lag(MA50,1) over (order by date))
then 'Sell'
else 'Hold'
END as 'Signal'
from raw_file1);
# Creating eicher2
create view raw_file2 as
select *, ROW_NUMBER() OVER (ORDER BY Date) RowNumber
from eicher1;
create table eicher2
(select Date, Close_Price,
CASE
when RowNumber < 50 then 'NA' # Ignoring the first 49 rows
when MA20 > MA50 and (lag(MA20,1) over (order by date)) < (lag(MA50,1) over (order by date))
then 'Buy'
when MA20 < MA50 and (lag(MA20,1) over (order by date)) > (lag(MA50,1) over (order by date))
then 'Sell'
else 'Hold'
END as 'Signal'
from raw_file2);
# Creating hero2
create view raw_file3 as
select *, ROW_NUMBER() OVER (ORDER BY Date) RowNumber
from hero1;
create table hero2
(select Date, Close_Price,
CASE
when RowNumber < 50 then 'NA' # Ignoring the first 49 rows
when MA20 > MA50 and (lag(MA20,1) over (order by date)) < (lag(MA50,1) over (order by date))
then 'Buy'
when MA20 < MA50 and (lag(MA20,1) over (order by date)) > (lag(MA50,1) over (order by date))
then 'Sell'
else 'Hold'
END as 'Signal'
from raw_file3);
# Creating infosys2
create view raw_file4 as
select *, ROW_NUMBER() OVER (ORDER BY Date) RowNumber
from infosys1;
create table infosys2
(select Date, Close_Price,
CASE
when RowNumber < 50 then 'NA' # Ignoring the first 49 rows
when MA20 > MA50 and (lag(MA20,1) over (order by date)) < (lag(MA50,1) over (order by date))
then 'Buy'
when MA20 < MA50 and (lag(MA20,1) over (order by date)) > (lag(MA50,1) over (order by date))
then 'Sell'
else 'Hold'
END as 'Signal'
from raw_file4);
# Creating tcs2
create view raw_file5 as
select *, ROW_NUMBER() OVER (ORDER BY Date) RowNumber
from tcs1;
create table tcs2
(select Date, Close_Price,
CASE
when RowNumber < 50 then 'NA' # Ignoring the first 49 rows
when MA20 > MA50 and (lag(MA20,1) over (order by date)) < (lag(MA50,1) over (order by date))
then 'Buy'
when MA20 < MA50 and (lag(MA20,1) over (order by date)) > (lag(MA50,1) over (order by date))
then 'Sell'
else 'Hold'
END as 'Signal'
from raw_file5);
# Creating TVS2
create view raw_file6 as
select *, ROW_NUMBER() OVER (ORDER BY Date) RowNumber
from tvs1;
create table tvs2
(select Date, Close_Price,
CASE
when RowNumber < 50 then 'NA' # Ignoring the first 49 rows
when MA20 > MA50 and (lag(MA20,1) over (order by date)) < (lag(MA50,1) over (order by date))
then 'Buy'
when MA20 < MA50 and (lag(MA20,1) over (order by date)) > (lag(MA50,1) over (order by date))
then 'Sell'
else 'Hold'
END as 'Signal'
from raw_file6);
### Getting Glimpse of all the newly created signal tables
select * from bajaj2;
select * from eicher2;
select * from infosys2;
select * from hero2;
select * from tcs2;
select * from tvs2;
-- --------------------------- Expected Result = 4 ---------------------------------
####### RESULT 4 = Creating a user defined function for bajaj stock #######
## Function should take 'date' as input and returns the signal(Buy/Sell/Hold) for that particular day
delimiter $$
create function signal_bajaj (d date)
returns varchar(15) deterministic
begin
declare Trade_Signal varchar(15);
select `Signal`
from bajaj2
where date=d into Trade_Signal;
return Trade_Signal ;
end
$$ delimiter ;
-- Sample query to generate a signal
select signal_bajaj('2018-06-21') as Trade_signal;
## Results 5 - Queries used to help in drawing the Inferences from the stock analysis
-- For Bajaj
select date, close_price
from bajaj2
where `signal` = 'Buy'
order by close_price
limit 1;
select date, close_price
from bajaj2
where `signal` = 'Sell'
order by close_price desc
limit 1;
-- For Eicher
select date, close_price
from eicher2
where `signal` = 'Buy'
order by close_price
limit 1;
select date, close_price
from eicher2
where `signal` = 'Sell'
order by close_price desc
limit 1;
-- For Hero
select date, close_price
from hero2
where `signal` = 'Buy'
order by close_price
limit 1;
select date, close_price
from hero2
where `signal` = 'Sell'
order by close_price desc
limit 1;
-- For Infosys
select date, close_price
from infosys2
where `signal` = 'Buy'
order by close_price
limit 1;
select date, close_price
from infosys2
where `signal` = 'Sell'
order by close_price desc
limit 1;
-- For TCS
select date, close_price
from tcs2
where `signal` = 'Buy'
order by close_price
limit 1;
select date, close_price
from tcs2
where `signal` = 'Sell'
order by close_price desc
limit 1;
-- For TVS
select date, close_price
from tvs2
where `signal` = 'Buy'
order by close_price
limit 1;
select date, close_price
from tvs2
where `signal` = 'Sell'
order by close_price desc
limit 1;
| true
|
befd3a25f46d5230280f800b0021033a26e7436f
|
SQL
|
jordanmoritz/covid-19-tracking
|
/dbt_covid_tracking/macros/test_malformed_country_code.sql
|
UTF-8
| 399
| 3.15625
| 3
|
[] |
no_license
|
{% macro test_malformed_country_code(model, column_name) %}
with malformed_country_code as (
select
{{ column_name }} as codes
from
{{ model }}
where
{{ column_name }} != 'CNG1925'
and length({{ column_name }}) != 3
group by
{{ column_name }}
having
count(codes) > 1
)
select count(*) from malformed_country_code
{% endmacro %}
| true
|
3565159b9e1b06e699ec1e708c4ade9eb5c32b46
|
SQL
|
QuangThoai/quangthoai.github.io
|
/PHP/Week_5/FrameWork/database/database_user.sql
|
UTF-8
| 3,740
| 3.109375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Máy chủ: 127.0.0.1
-- Thời gian đã tạo: Th3 18, 2019 lúc 09:32 AM
-- Phiên bản máy phục vụ: 10.1.31-MariaDB
-- Phiên bản PHP: 7.2.3
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 */;
--
-- Cơ sở dữ liệu: `database_user`
--
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `classes`
--
CREATE TABLE `classes` (
`name` char(11) COLLATE utf8_unicode_ci NOT NULL,
`num_of_students` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `sessions`
--
CREATE TABLE `sessions` (
`id` char(128) COLLATE latin1_bin NOT NULL,
`set_time` char(10) COLLATE latin1_bin NOT NULL,
`data` text COLLATE latin1_bin NOT NULL,
`session_key` char(128) COLLATE latin1_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
--
-- Đang đổ dữ liệu cho bảng `sessions`
--
INSERT INTO `sessions` (`id`, `set_time`, `data`, `session_key`) VALUES
('user', '1552897620', 'À¥u%½{+w‡A$<˜¨”§”o£»ú¸J¤¢]îõ¤ð¬ò²¥\'<<>“#Z€', '1022386f5c0706c4ac6ecbd96c42b8f231a8e0153e2f302c854d6e6535dd4e69d65f427a10557be33b9f6eeeef2bf2ab324d179eea2525cf06d5ba1c39d2252f');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `students`
--
CREATE TABLE `students` (
`id` int(11) NOT NULL,
`student_name` char(255) COLLATE utf8_unicode_ci NOT NULL,
`class_name` char(11) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(200) NOT NULL,
`password` varchar(100) NOT NULL,
`email` varchar(200) NOT NULL,
`birthday` varchar(15) CHARACTER SET utf16 NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Đang đổ dữ liệu cho bảng `user`
--
INSERT INTO `user` (`id`, `username`, `password`, `email`, `birthday`) VALUES
(57, 'quangthoai', '$2y$10$.dq0ZDYrHONwhm8F1uKide.JXB0uJR83ewruUnjzIWa/3tHyfsTZO', 'tranquang@gmail.com', '1997-03-01');
--
-- Chỉ mục cho các bảng đã đổ
--
--
-- Chỉ mục cho bảng `classes`
--
ALTER TABLE `classes`
ADD PRIMARY KEY (`name`);
--
-- Chỉ mục cho bảng `sessions`
--
ALTER TABLE `sessions`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`id`),
ADD KEY `class_name` (`class_name`);
--
-- Chỉ mục cho bảng `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT cho các bảng đã đổ
--
--
-- AUTO_INCREMENT cho bảng `students`
--
ALTER TABLE `students`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT cho bảng `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59;
--
-- Các ràng buộc cho các bảng đã đổ
--
--
-- Các ràng buộc cho bảng `students`
--
ALTER TABLE `students`
ADD CONSTRAINT `students_ibfk_1` FOREIGN KEY (`class_name`) REFERENCES `classes` (`name`);
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
|
6de8eb186e82de760ed054a8a609e913f940d2b5
|
SQL
|
mundodron/arduino-bot-aurelio
|
/Querys/~ebA732.sql
|
UTF-8
| 1,220
| 2.734375
| 3
|
[] |
no_license
|
-- CENARIO;CONTA_COBRANCA;ACCOUNT;SUBSCR_NO;INSTANCIA;FAT_ATUAL;COMPONENTE_ID;COMPONENTE;COMENTARIO
-- C4 Produto Faltando;999988501203;2794447;5780198;999988501203;199493114;30492;GVT Ilimitado Total - Franquia LDN
SELECT *
FROM G0023421SQL.GVT_VAL_PLANO A
WHERE A.PLANO = (SELECT PLANO FROM g0023421sql.GVT_VAL_PLANO WHERE COMPONENT_ID = 30492)
AND A.TIPOELEMENTO = 'RC - Instancia'
and A.COMPONENT_ID not in (30491) --Verificar, o caso de type_code = 6 ignorar por enquanto.
AND NOT EXISTS
(SELECT 1
FROM bill_invoice_detail CPC,
bill_invoice BB
WHERE BB.ACCOUNT_NO = 2794447
AND CPC.BILL_REF_NO = 199493114
AND CPC.BILL_REF_NO = BB.BILL_REF_NO
AND CPC.SUBSCR_NO = 5780198
AND CPC.TYPE_CODE = 2
AND CPC.BILL_REF_RESETS = BB.BILL_REF_RESETS
AND CPC.BILL_REF_RESETS = 0
AND A.COMPONENT_ID = CPC.COMPONENT_ID);
| true
|
f23f12730d29e1dc936140a2897a4e1109c75a62
|
SQL
|
B4129/sql-pratice
|
/answer/B/LEVEL4/39.sql
|
UTF-8
| 495
| 3.34375
| 3
|
[] |
no_license
|
select 商品コード,
商品名,
単価,
(case
when 単価 < 3000 then 'S'
when 単価 >= 3000 and 単価 < 10000 then 'M'
when 単価 >= 10000 then 'L'
end) as 販売価格ランク,
商品区分 || ':' ||
case 商品区分
when '1' then '衣類'
when '2' then '靴'
when '3' then '雑貨'
when '9' then '未分類' end as 商品区分
from 商品
| true
|
1d3d8acdb3edc12ae70272d6ff0ec24d73c6a791
|
SQL
|
mastukino/Purchase
|
/inventori.sql
|
UTF-8
| 59,457
| 3.109375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 14, 2021 at 01:27 PM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.4.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `inventori`
--
-- --------------------------------------------------------
--
-- Table structure for table `barang_keluar`
--
CREATE TABLE `barang_keluar` (
`id` int(11) NOT NULL,
`kode_barang` varchar(100) NOT NULL,
`nama_barang` varchar(100) NOT NULL,
`tujuan` varchar(100) NOT NULL,
`tanggal` varchar(100) NOT NULL,
`operator` varchar(100) NOT NULL,
`nominal` int(15) NOT NULL,
`stok` int(5) NOT NULL,
`satuan` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang_keluar`
--
INSERT INTO `barang_keluar` (`id`, `kode_barang`, `nama_barang`, `tujuan`, `tanggal`, `operator`, `nominal`, `stok`, `satuan`) VALUES
(2, 'B-01', 'Laptop', 'Batam', '2020-06-23', 'Aldin', 0, 0, ''),
(3, 'B-03', 'Komputer', 'Batam', '2020-06-24', 'Aldin', 0, 0, '');
-- --------------------------------------------------------
--
-- Table structure for table `barang_masuk`
--
CREATE TABLE `barang_masuk` (
`id` int(11) NOT NULL,
`kode_barang` varchar(4) NOT NULL,
`nama_barang` varchar(50) NOT NULL,
`kapal` varchar(15) NOT NULL,
`supplier` varchar(30) NOT NULL,
`tanggal` varchar(15) NOT NULL,
`nominal` int(15) NOT NULL,
`stok` int(5) NOT NULL,
`satuan` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang_masuk`
--
INSERT INTO `barang_masuk` (`id`, `kode_barang`, `nama_barang`, `kapal`, `supplier`, `tanggal`, `nominal`, `stok`, `satuan`) VALUES
(1, 'B001', 'Injection Pump Test', 'MENTARI 1, TB ', 'Nanang', '2020-01-01', 1200000, 1, 'Unit'),
(2, 'B002', 'Kunci Inggris', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 120000, 1, 'PCS'),
(3, 'B003', 'Pompa Stainless Air Laut Dan Mata Bor', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 2269000, 1, 'Unit'),
(4, 'B004', 'Isi Roll Minyak', 'Bengkel', 'Nanang', '2020-01-02', 12000, 2, 'PCS'),
(5, 'B005', 'Tiner Botol', 'Bengkel', 'Nanang', '2020-01-02', 10000, 490, 'ML'),
(6, 'B006', 'Kaca Las Bening', 'Bengkel', 'Nanang', '2020-01-02', 4000, 1, 'PCS'),
(7, 'B007', 'Kaca Las Hitam No. 11', 'Bengkel', 'Nanang', '2020-01-02', 12000, 1, 'PCS'),
(8, 'B008', 'Bearing 6003', 'MENTARI 1, TB ', 'Nanang', '2020-01-02', 15000, 1, 'PCS'),
(9, 'B009', 'Mata Gerinda Tebal', 'MENTARI 1, TB ', 'Nanang', '2020-01-02', 40000, 5, 'PCS'),
(10, 'B010', 'Oil Seal C502', 'MENTARI 1, TB ', 'Nanang', '2020-01-02', 25000, 1, 'PCS'),
(11, 'B011', 'Tiner Bhtb', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 6000, 2, 'SET'),
(12, 'B012', 'Radiator Hose', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 150000, 1, 'LGH'),
(13, 'B013', 'Super Clamp', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 140000, 4, 'PCS'),
(14, 'B014', 'Pully A1 X 3,5\"', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 110000, 1, 'PCS'),
(15, 'B015', 'Nipel Kuningan', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 90000, 0, 'PCS'),
(16, 'B016', 'O-Ring', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 30000, 2, 'PCS'),
(17, 'B017', 'Drill Bit 9 Mm', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 60000, 1, 'PCS'),
(18, 'B018', 'Elbow 90 Sch 80 1\"', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 75000, 5, 'PCS'),
(19, 'B019', 'Baut B304', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 20000, 20, 'SET'),
(20, 'B020', 'Elbow 90 Sch 80 1. 1/2\"', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 120000, 6, 'PCS'),
(21, 'B021', 'Hose Niple Giv 1\"', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 30000, 2, 'PCS'),
(22, 'B022', 'Elbow 90 Sch 40 3/4\"', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 166000, 2, 'PCS'),
(23, 'B023', 'Rantai Gearbox Chani Coupons', 'PUTRA 1, TB', 'Nanang', '2020-01-02', 440000, 1, 'EA'),
(24, 'B024', 'Oil Sae 40', 'ELISYAH 1 , TB', 'PT. Rusel Victory Nusantara', '2020-01-06', 4500000, 1, 'DRUM'),
(25, 'B025', 'Repair Stang Rod/Piston', 'PATIH II , TB', 'Nanang', '2020-01-10', 3500000, 1, 'PCS'),
(26, 'B026', 'Filter', 'ELISYAH 1 , TB', 'Nanang', '2020-01-10', 1120000, 4, 'PCS'),
(27, 'B027', 'Filter', 'PUTRA BES 005, ', 'Nanang', '2020-01-10', 1120000, 4, 'PCS'),
(28, 'B028', 'Speed Control 3044196', 'ELISYAH 1 , TB', 'Nanang', '2020-01-10', 4000000, 1, 'PCS'),
(29, 'B029', 'Actuator', 'ELISYAH 1 , TB', 'Nanang', '2020-01-10', 4800000, 1, 'PCS'),
(30, 'B030', 'Bearing Ruller(Besar)', 'ELISYAH 1 , TB', 'Nanang', '2020-01-10', 560000, 2, 'PCS'),
(31, 'B031', 'Bearing Ruller(Kecil)', 'ELISYAH 1 , TB', 'Nanang', '2020-01-10', 540000, 2, 'PCS'),
(32, 'B032', 'Elbow S40 2\"', 'MENTARI 1, TB ', 'Nanang', '2020-01-13', 90000, 6, 'PCS'),
(33, 'B033', 'Elbow S0 1\"', 'MENTARI 1, TB ', 'Nanang', '2020-01-13', 9000, 1, 'PCS'),
(34, 'B034', 'Kawat Las Rb 26-3.2m', 'MENTARI 1, TB ', 'Nanang', '2020-01-13', 132500, 5, 'PCS'),
(35, 'B035', 'Mata Gerinda ', 'MENTARI 1, TB ', 'Nanang', '2020-01-13', 100000, 0, 'PCS'),
(36, 'B036', 'Filter Ff-105', 'ELISYAH 1 , TB', 'Nanang', '2020-01-13', 360000, 4, 'PCS'),
(37, 'B037', 'Kain Lap/Majun', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 180000, 20, 'KG'),
(38, 'B038', 'Filter Oili', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 100000, 2, 'PCS'),
(39, 'B039', 'Fuel Filter', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 90000, 2, 'PCS'),
(40, 'B040', 'Aki N-100', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 1450000, 1, 'PCS'),
(41, 'B041', 'Obeng Amplas.Dll', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 410000, 0, 'PCS'),
(42, 'B042', 'Besi', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 480000, 40, 'KG'),
(43, 'B043', 'Sarung Tangan', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 25000, 1, 'LUSIN'),
(44, 'B044', 'Sims Plate 0,25 Mm', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 96000, 30, 'CM'),
(45, 'B045', 'Elbow Sch 80 2\" 90', 'PUTRA 1, TB', 'Nanang', '2020-01-13', 80000, 2, 'PCS'),
(46, 'B046', 'Pressure Gaurge Oil', 'PUTRA BES 005, ', 'Nanang', '2020-01-14', 600000, 2, 'PCS'),
(47, 'B047', 'Thermometer', 'PUTRA BES 005, ', 'Nanang', '2020-01-14', 500000, 2, 'PCS'),
(48, 'B048', 'Real Oil Seal 3909410 6bt', 'ELISYAH 1 ,TB', 'Nanang', '2020-01-14', 500000, 1, 'PCS'),
(49, 'B049', 'Oil Jet Nozzle 3014404 Cummins Nt855', 'ELISYAH 1 ,TB', 'Nanang', '2020-01-14', 450000, 3, 'PCS'),
(50, 'B050', 'Silicone Gasket Red R-288/65of/85gram Richerbond', 'ELISYAH 1 ,TB', 'Nanang', '2020-01-14', 35000, 1, 'PCS'),
(51, 'B051', 'Batere N 200', 'PUTRA 1, TB', 'Nanang', '2020-01-14', 4400000, 2, 'PCS'),
(52, 'B052', 'Gasket Tba 0.8', 'PUTRA 1, TB', 'Nanang', '2020-01-14', 120000, 1, 'PCS'),
(53, 'B053', 'Gas Lpg', 'FRANSISCUS 01, ', 'Nanang', '2020-01-14', 137000, 1, 'TABUNG'),
(54, 'B054', 'Bolt Unf 7/16 X 2\"', 'ELISYAH 1,TB', 'Nanang', '2020-01-14', 20000, 10, 'PCS'),
(55, 'B055', 'Bolt Unf 7/16 X 3.1/2\"', 'ELISYAH 1,TB', 'Nanang', '2020-01-14', 32000, 10, 'PCS'),
(56, 'B056', 'Bolt Unf 7/16 X1.1/2\"', 'ELISYAH 1,TB', 'Nanang', '2020-01-14', 15000, 10, 'PCS'),
(57, 'B057', 'Bolt Unf 5/16 X 3/4\"', 'ELISYAH 1,TB', 'Nanang', '2020-01-14', 5000, 10, 'PCS'),
(58, 'B058', 'Adaptor 3/4 X 3/8 Degree', 'PUTRA BES 005, ', 'Nanang', '2020-01-14', 70000, 2, 'PCS'),
(59, 'B059', 'Mechanical Seal 15 Mm', 'MENTARI 1, TB ', 'Nanang', '2020-01-14', 180000, 1, 'PCS'),
(60, 'B060', 'Kapur Plat', 'PUTRA 1, TB', 'Nanang', '2020-01-14', 10000, 5, 'PCS'),
(61, 'B061', 'Besi Siku', 'PUTRA 1, TB', 'Nanang', '2020-01-14', 6000, 12, 'PCS'),
(62, 'B062', 'Baut B304 12 X 20 ', 'PUTRA 1, TB', 'Nanang', '2020-01-14', 5000, 2, 'PCS'),
(63, 'B063', 'Baut B304 12 X 70', 'PUTRA 1, TB', 'Nanang', '2020-01-14', 36000, 4, 'PCS'),
(64, 'B064', 'Las Aluminium', 'PUTRA 1, TB', 'Nanang', '2020-01-14', 150000, 2, 'PCS'),
(65, 'B065', 'Crank Shaff 3049024', 'ELISYAH I, TB', 'Nanang', '2020-01-16', 7000000, 1, 'PCS'),
(66, 'B066', 'Catridge Turbo', 'FRANSISCUS 01, ', 'Nanang', '2020-01-22', 16000000, 1, 'UNIT'),
(67, 'B067', 'Linggis 90 Cm', 'ELISYAH II, TB', 'Sofyan', '2020-01-27', 60000, 1, 'PCS'),
(68, 'B068', 'Sarung Tangan', 'ELISYAH II, TB', 'Sofyan', '2020-01-27', 40000, 1, 'LUSIN'),
(69, 'B069', 'Kuas Supra 3\"', 'ELISYAH II, TB', 'Sofyan', '2020-01-27', 20000, 1, 'PCS'),
(70, 'B070', 'Pahat Beron', 'ELISYAH II, TB', 'Sofyan', '2020-01-27', 30000, 1, 'PCS'),
(71, 'B071', 'Gasket Head 6135', 'SUKSES 1200, TB', 'CV. Bangun Cipta Kaji', '2020-01-30', 900000, 3, 'PCS'),
(72, 'B072', 'Ring Piston', 'SUKSES 1200, TB', 'CV. Bangun Cipta Kaji', '2020-01-30', 2520000, 6, 'SET'),
(73, 'B073', 'Nozzle 150s437d', 'SUKSES 1200, TB', 'CV. Bangun Cipta Kaji', '2020-01-30', 2580000, 6, 'PCS'),
(74, 'B074', 'Gas 12 Kg', 'PATIH II , TB', 'Nanang', '2020-01-30', 150000, 1, 'PCS'),
(75, 'B075', 'Brush Kuningan 8 Baris', 'Bengkel', 'Nanang', '2020-01-30', 10000, 1, 'PCS'),
(76, 'B076', 'Meteran Asaki 3 M', 'Bengkel', 'Nanang', '2020-01-30', 15000, 1, 'PCS'),
(77, 'B077', 'Brush Kawat', 'Bengkel', 'Nanang', '2020-01-30', 12000, 1, 'PCS'),
(78, 'B078', 'Gagang Shock', 'Bengkel', 'Nanang', '2020-01-30', 75000, 1, 'PCS'),
(79, 'B079', 'H-2702 Hf Sakura', 'BAHTERA ABADI,L', 'Nanang', '2020-01-30', 364000, 4, 'PCS'),
(80, 'B080', 'Kepala Aki', 'PUTRA 1, TB', 'Nanang', '2020-01-30', 70000, 2, 'SET'),
(81, 'B081', 'Selotip', 'PUTRA 1, TB', 'Nanang', '2020-01-30', 20000, 1, 'DUS'),
(82, 'B082', 'Detergent Boom', 'FRANSISCUS 01, ', 'Nanang', '2020-01-30', 52000, 1, 'DUS'),
(83, 'B083', 'Bearing 6204', 'FRANSISCUS 01, ', 'Nanang', '2020-01-30', 40000, 2, 'PCS'),
(84, 'B084', 'Baut B6304', 'FRANSISCUS 01, ', 'Nanang', '2020-01-30', 100000, 4, 'PCS'),
(85, 'B085', 'Filter Ff-105', 'ITA LESTARI V ', 'Nanang', '2020-01-30', 360000, 4, 'PCS'),
(86, 'B086', 'Racor 2020', 'ITA LESTARI V ', 'Nanang', '2020-01-30', 420000, 4, 'PCS'),
(87, 'B087', 'Lf 777', 'ITA LESTARI V ', 'Nanang', '2020-01-30', 700000, 4, 'PCS'),
(88, 'B088', 'Lf 70', 'ITA LESTARI V ', 'Nanang', '2020-01-30', 700000, 4, 'PCS'),
(89, 'B089', 'C 5703', 'ITA LESTARI V ', 'Nanang', '2020-01-30', 360000, 4, 'PCS'),
(90, 'B090', 'Lem Silikon', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 50000, 5, 'PCS'),
(91, 'B091', 'Lem Dexton', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 20000, 1, 'PCS'),
(92, 'B092', 'Water Pump S6a-2', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 2500000, 2, 'PCS'),
(93, 'B093', 'Seal Os 457211', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 100000, 1, 'PCS'),
(94, 'B094', 'Radiator Hose 1 1/ 4\" X 36\" Sunflex', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 220000, 1, 'LGH'),
(95, 'B095', 'Hose Clamp 1 34\" S/S', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 30000, 2, 'PCS'),
(96, 'B096', 'Naoprana Kabel', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 187500, 15, 'METER'),
(97, 'B097', 'Copper Pipe 5/16\" X 25 Cm C/W Nut (2 Ea)', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 75000, 1, 'LGT'),
(98, 'B098', 'Hose Clips 2\"', 'MENTARI 1, TB', 'Nanang', '2020-01-30', 50000, 5, 'EA'),
(99, 'B099', 'Elbow 90 Deg L/R C/S A234 Wpb S80 2.1/2\" Aff', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 55000, 1, 'PCS'),
(100, 'B100', 'Kawat Las China 3,2 Mm', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 400000, 20, 'KG'),
(101, 'B101', 'Pipe Seamless S/C Sch 80 X 6 M4\"', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 1600000, 1, 'LGHT'),
(102, 'B102', 'Pipe Seamless S/C Sch 80 X 6 M3\"', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 1120000, 1, 'LGHT'),
(103, 'B103', 'Pipe Seamless S/C Sch 80 X 6 M 2.1/2\"', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 640000, 1, 'LGHT'),
(104, 'B104', 'Plff Flange Ss400 10k X 4\" Aff', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 480000, 6, 'PCS'),
(105, 'B105', 'Plff Flange Ss400 10k X 3\" Aff', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 390000, 6, 'PCS'),
(106, 'B106', 'Plff Flange Ss400 10k X 2.1/2 \" Aff', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 104000, 2, 'PCS'),
(107, 'B107', 'Con Red C/S A 234 Wpb S80 3\" X 2.1/2\"', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 75000, 1, 'PCS'),
(108, 'B108', 'Con Red C/S A 234 Wpb S80 4\" X 3\"', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 90000, 1, 'PCS'),
(109, 'B109', 'Elbow 90 Deg L/R C/S A234 Wpb S80 4\" Aff', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 500000, 4, 'PCS'),
(110, 'B110', 'Elbow 90 Deg L/R C/S A234 Wpb S80 3\" Aff', 'ELISYAH II, TB', 'Nanang', '2020-01-30', 260000, 4, 'PCS'),
(111, 'B111', 'Terpal 6m', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 60000, 6, 'METER'),
(112, 'B112', 'Colokan Las', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 150000, 2, 'PCS'),
(113, 'B113', 'Sealing Compund', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 95000, 1, 'PCS'),
(114, 'B114', 'Ambril Pasta Cheemaco Ambril Pasta', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 35000, 1, 'PCS'),
(115, 'B115', 'Pressure Gaurge 2.1/2\" X 1/4\" 1000 Kg', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 380000, 1, 'PCS'),
(116, 'B116', 'Bearing 6305', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 120000, 1, 'PCS'),
(117, 'B117', 'Seal Tape 1/2\"', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 5000, 1, 'ROLL'),
(118, 'B118', 'Heemacon', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 30000, 1, 'PCS'),
(119, 'B119', 'Elbow 90 Deg L/R C/S A234 Wpb S40 2.1/2\" Aff', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 160000, 4, 'PCS'),
(120, 'B120', 'Elbow 90 Deg L/R C/S A234 Wpb S40 6\" Aff', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 880000, 4, 'PCS'),
(121, 'B121', 'Besi', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 23920000, 2392, 'KG'),
(122, 'B122', 'Sarung Tangan', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 105000, 3, 'PCS'),
(123, 'B123', 'Kawat Las', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 450000, 1, 'BOX'),
(124, 'B124', 'Tabung Oksigen', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 800000, 4, 'PCS'),
(125, 'B125', 'Besi', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 2130000, 213, 'KG'),
(126, 'B126', 'Sling', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 200000, 20, 'METER'),
(127, 'B127', 'Kuku Macan', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 8000, 4, 'PCS'),
(128, 'B128', 'Besi Siku', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 450000, 45, 'KG'),
(129, 'B129', 'Botol Angin', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 1000000, 5, 'BOTOL'),
(130, 'B130', 'Kawat Las', 'SUKSES 1200, TB', 'Nanang', '2020-01-30', 150000, 2, 'PCS'),
(131, 'B131', 'Engine Cummins', 'GIANT, TB', 'PT. Tobacon', '2020-01-30', 610000000, 1, 'UNIT'),
(132, 'B132', '1 unit Towing Hock model TH-15T', 'SUKSES 1200, TB', 'Nanang', '2020-02-04', 15525000, 1, 'UNIT'),
(133, 'B133', 'Engine Mitsubishi', 'BAHTERA ABADI,L', 'CV. Sinar Harapan', '2020-02-05', 35000000, 1, 'SET'),
(134, 'B134', 'Water Cooler Cummins M/E Material Stainless', 'ITA LESTARIV, T', 'CV. Bangun Cipta Kaji', '2020-02-06', 9500000, 1, 'UNIT'),
(135, 'B135', 'Water Cooler CH A/E Material Stainless', 'ITA LESTARIV, T', 'Nanang', '2020-02-06', 2700000, 1, 'UNIT'),
(136, 'B136', 'Besi Plat dan pipa', 'SUKSES 1200, TB', 'Nanang', '2020-02-10', 2170000, 217, 'KG'),
(137, 'B137', 'Kawat las 4.0 mm', 'SUKSES 1200, TB', 'Nanang', '2020-02-10', 600000, 4, 'MM'),
(138, 'B138', 'Kawat las 3.0 mm', 'SUKSES 1200, TB', 'Nanang', '2020-02-10', 750000, 3, 'MM'),
(139, 'B139', 'Hand pump Oil Semitory 1\"', 'PUTRA BES 005, ', 'Nanang', '2020-02-11', 1400000, 2, 'PCS'),
(140, 'B140', 'Lampu Halogen Pus line 500W Phillips', 'BAHTERA ABADI,L', 'Nanang', '2020-02-11', 58000, 2, 'PCS'),
(141, 'B141', 'Kuas 2\"', 'BAHTERA ABADI,L', 'Nanang', '2020-02-11', 10000, 2, 'PCS'),
(142, 'B142', 'Ring Pas', 'BAHTERA ABADI,L', 'Nanang', '2020-02-11', 30000, 1, 'PCS'),
(143, 'B143', 'Ultimeg Red spray ', 'BAHTERA ABADI,L', 'Nanang', '2020-02-11', 420000, 3, 'EA'),
(144, 'B144', 'pressure Gaurge', 'ELISYAH II, TB', 'Nanang', '2020-02-11', 180000, 1, 'PCS'),
(145, 'B145', 'Back up Ring ', 'ELISYAH II, TB', 'Nanang', '2020-02-11', 46000, 1, 'PCS'),
(146, 'B146', 'O-Ring P & G P135', 'ELISYAH II, TB', 'Nanang', '2020-02-11', 35000, 1, 'PCS'),
(147, 'B147', 'Ampere HZ Meter Nidax', 'ELISYAH II, TB', 'Nanang', '2020-02-11', 250000, 1, 'PCS'),
(148, 'B148', 'Kunci shock 314 x 27 mm', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 75000, 1, 'PCS'),
(149, 'B149', 'Senter Cas SYTV 172', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 30000, 1, 'PCS'),
(150, 'B150', 'Senter Cas SYTV 169', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 30000, 1, 'PCS'),
(151, 'B151', 'Kain Majun', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 150000, 2, 'KG'),
(152, 'B152', 'Selang Benang 1\"', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 72000, 6, 'PCS'),
(153, 'B153', 'Klem 1/4', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 32000, 8, 'PCS'),
(154, 'B154', 'Ember( tempat chemical)', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 100000, 1, 'PCS'),
(155, 'B155', 'Feel Belt', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 100000, 3, 'PCS'),
(156, 'B156', 'Fan Belting', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 100000, 1, 'PCS'),
(157, 'B157', 'Fan Belting', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 80000, 1, 'PCS'),
(158, 'B158', 'O-Ring Uter', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 15000, 1, 'PCS'),
(159, 'B159', 'Motor Electric Cleaner ', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 1350000, 1, 'PAIL'),
(160, 'B160', 'Kunci 8-32', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 300000, 1, 'SET'),
(161, 'B161', 'Seal Tip', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 20000, 1, 'ROLL'),
(162, 'B162', 'Kepala Aki', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 70000, 2, 'SET'),
(163, 'B163', 'Valve Kuningan 1\"', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 110000, 1, 'PCS'),
(164, 'B164', 'Hose R2T-3/8 x 130 cm Fitting Banjo ,Fitting Elbow', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 250000, 1, 'LGT'),
(165, 'B165', 'Hose radiator 1\" x 150 cm', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 247000, 1, 'LGT'),
(166, 'B166', 'Clamp 31-34', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 64000, 0, 'EA'),
(167, 'B167', 'Rust Remover', 'SUKSES 1200, TB', 'Nanang', '2020-02-11', 813000, 20, 'LITER'),
(168, 'B168', 'Repair dinamo stater', 'BAHTERA ABADI,L', 'Nanang', '2020-02-11', 750000, 1, 'UNIT'),
(169, 'B169', 'Repair dinamo stater', 'PUTRA BES 005, ', 'Nanang', '2020-02-11', 1000000, 1, 'UNIT'),
(170, 'B170', 'Wire Hose', 'BENGKEL', 'Sofyan', '2020-02-12', 50000, 2, 'METER'),
(171, 'B171', 'hose clamp', 'PATIH II, TB', 'Tony T,pak', '2020-02-18', 16000, 2, 'PCS'),
(172, 'B172', 'Metal duduk, metal Jalan,Trush bearing, Boring Lin', 'ITA LESTARIV, T', 'Nanang', '2020-02-19', 100000000, 10, 'PCS'),
(173, 'B173', 'Beli papan( buat Valet Cooler)', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 150000, 0, 'PCS'),
(174, 'B174', 'Tee SCH 40 1.1/4\"', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 35000, 1, 'PCS'),
(175, 'B175', 'Elbow SCH 40 1.1/4\"', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 45000, 3, 'PCS'),
(176, 'B176', 'Kertas paking TBA 1 mm', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 330000, 2, 'METER'),
(177, 'B177', 'Kacamata', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 20000, 1, 'PCS'),
(178, 'B178', 'Sarung Tangan Katun', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 30000, 1, 'LUSIN'),
(179, 'B179', 'Strip', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 60000, 6, 'KG'),
(180, 'B180', 'hand Taps 12 mm x 1.75 SKF/SKC', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 40000, 1, 'PCS'),
(181, 'B181', 'Snap Ring A022', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 24000, 8, 'PCS'),
(182, 'B182', 'Air aki', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 200000, 1, 'LITER'),
(183, 'B183', 'Baut UNC 8 mm x 25', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 32000, 16, 'PCS'),
(184, 'B184', 'Elbow SCH 80 1/4\"', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 100000, 5, 'PCS'),
(185, 'B185', 'Paking Merah', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 380000, 1, 'METER'),
(186, 'B186', 'Kawat Sling', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 50000, 10, 'METER'),
(187, 'B187', 'Klemp Sling', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 10000, 4, 'PCS'),
(188, 'B188', 'Katrol', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 10000, 2, 'PCS'),
(189, 'B189', 'Rubber Sheet 4 mm 50kg/roll', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 80000, 1, 'METER'),
(190, 'B190', 'Hand Tap 5/8 UNF', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 140000, 1, 'SET'),
(191, 'B191', 'Hand Tap M12 x 1.75', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 100000, 1, 'SET'),
(192, 'B192', 'Kawat Las 3.2 mm', 'SUKSES 1200, TB', 'Nanang', '2020-02-19', 350000, 10, 'KG'),
(193, 'B193', 'Seal 220 x 255 x 16', 'ELISYAH II, TB', 'Nanang', '2020-02-19', 4640000, 1, 'PCS'),
(194, 'B194', 'Pipa', 'SUKSES 1200, TB', 'Sofyan', '2020-02-19', 54000, 6, 'KG'),
(195, 'B195', 'Hose Radiator 1.5/8\"', 'SUKSES 1200, TB', 'Sofyan', '2020-02-19', 705000, 3, 'METER'),
(196, 'B196', 'Hose clips 2.1/2\"', 'SUKSES 1200, TB', 'Sofyan', '2020-02-19', 260000, 20, 'EA'),
(197, 'B197', 'Propeller Diameter 2000 mm', 'ELISYAH II, TB', 'PT. Metalindo Nan Sukses', '2020-02-24', 28000000, 2, 'UNIT'),
(198, 'B198', 'Oli Sae 40', 'ELISYAH II, TB', 'PT. Rusel Victory Nusantara', '2020-02-24', 27000000, 6, 'DRUM'),
(199, 'B199', 'Oli Sae 40', 'ELISYAH II, TB', 'PT. Rusel Victory Nusantara', '2020-02-24', 4500000, 1, 'DRUM'),
(200, 'B200', 'Oli Sae 40', 'ELISYAH II, TB', 'PT. Rusel Victory Nusantara', '2020-02-24', 4500000, 1, 'DRUM'),
(201, 'B201', 'Oli Sae 40', 'ITA LESTARIV, T', 'Doddy S/Nanang', '2020-02-24', 5395000, 1, 'DRUM'),
(202, 'B202', 'Oring z peller', 'ELISYAH II, TB', 'CV. Mandiri Karet', '2020-02-24', 3750000, 5, 'UNIT'),
(203, 'B203', 'valve gate Cast Iron', 'ELISYAH II, TB', 'Nanang', '2020-02-24', 1600000, 1, 'PCS'),
(204, 'B204', 'Dinabolt M16 x 4\"', 'ELISYAH II, TB', 'Nanang', '2020-02-24', 54000, 6, 'PCS'),
(205, 'B205', 'Head Gasket Cummins KTA 19', 'ITA LESTARIV, T', 'Nanang', '2020-02-24', 4800000, 6, 'PCS'),
(206, 'B206', 'Oring Liner Cummins KTA 19', 'ITA LESTARIV, T', 'Nanang', '2020-02-24', 2400000, 6, 'SET'),
(207, 'B207', 'Liner', 'ITA LESTARIV, T', 'PT. Putra Jaya Baru', '2020-02-27', 15000000, 6, 'PCS'),
(208, 'B208', 'Cat pilox', 'BENGKEL', 'Syamsul', '2020-02-28', 35000, 1, 'KG'),
(209, 'B209', 'Dp Drat', 'BENGKEL', 'Syamsul', '2020-02-28', 10000, 2, 'PCS'),
(210, 'B210', 'Baut BHTB 12 x 25', 'BENGKEL', 'Syamsul', '2020-02-28', 13000, 10, 'SET'),
(211, 'B211', 'Baut BHTB 14 x 50', 'BENGKEL', 'Syamsul', '2020-02-28', 20000, 8, 'SET'),
(212, 'B212', 'Plat & Plang', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 90000, 1, 'PCS'),
(213, 'B213', 'Baut', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 35000, 1, 'PCS'),
(214, 'B214', 'Filter Racor 2020', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 400000, 4, 'PCS'),
(215, 'B215', 'Filter Minyak Ft 105', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 400000, 4, 'PCS'),
(216, 'B216', 'Filter Lf 777', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 465000, 3, 'PCS'),
(217, 'B217', 'Filter 5712', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 350000, 2, 'PCS'),
(218, 'B218', 'Filter Minyak Jx 60', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 700000, 4, 'PCS'),
(219, 'B219', 'Tutup Radiator', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 50000, 1, 'PCS'),
(220, 'B220', 'Gasket Yanmar 155', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 100000, 1, 'PCS'),
(221, 'B221', 'Tutup Oil', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 50000, 1, 'PCS'),
(222, 'B222', 'Mesin Charge Batre ', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 700000, 1, 'PCS'),
(223, 'B223', 'Kain Majun', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 85000, 10, 'PCS'),
(224, 'B224', 'Stamp Kapal', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 30000, 1, 'PCS'),
(225, 'B225', 'Kunci Ring 14\"', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 20000, 1, 'PCS'),
(226, 'B226', 'Tutup Oli', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 50000, 1, 'PCS'),
(227, 'B227', 'Amplas ', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 30000, 3, 'PCS'),
(228, 'B228', 'Lem Rud', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 75000, 5, 'PCS'),
(229, 'B229', 'Amplas', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 15000, 1, 'PCS'),
(230, 'B230', 'Air Aki', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 400000, 40, 'LITER'),
(231, 'B231', 'Segel', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 234000, 13, 'PCS'),
(232, 'B232', 'Segel 1/2', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 180000, 12, 'PCS'),
(233, 'B233', 'Rinso', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 200000, 1, 'DUS'),
(234, 'B234', 'Gerinda Bros', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 25000, 1, 'PCS'),
(235, 'B235', 'Tali Nylon 24 M', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 480000, 16, 'METER'),
(236, 'B236', 'Sarung Tangan', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 60000, 1, 'LUSIN'),
(237, 'B237', 'Lakban Hitam', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 40000, 2, 'PCS'),
(238, 'B238', 'Batu Gerinda Bross', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 45000, 1, 'PCS'),
(239, 'B239', 'Ban Dapra', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 1200000, 0, 'PCS'),
(240, 'B240', 'Tali C\'6', 'ITA LESTARI V, ', 'Nanang/Dody S.', '2020-03-02', 1300000, 40, 'METER'),
(241, 'B241', 'Core After Cooler Cumminds Kta 19', 'ITA LESTARI V, ', 'PT. Putra Jaya Baru', '2020-03-02', 9500000, 1, 'PCS'),
(242, 'B242', 'Gasket Rkr Level Covering Cummins Kta 19', 'ITA LESTARI V, ', 'PT. Putra Jaya Baru', '2020-03-02', 600000, 6, 'PCS'),
(243, 'B243', 'Gasket After Cooler Housing Cummins Kta 19', 'ITA LESTARI V, ', 'PT. Putra Jaya Baru', '2020-03-02', 600000, 2, 'PCS'),
(244, 'B244', 'Test Pump Nozzle & Socket', 'BENGKEL', 'Sofyan', '2020-03-02', 1600000, 1, 'PCS'),
(245, 'B245', 'Water Cooler Ch 900', 'ITA LESTARI V, ', 'CV. Bangun Cipra Kaji', '2020-03-03', 9500000, 1, 'UNIT'),
(246, 'B246', 'D Bridge 50a (5) - Bodi Kcl', 'PUTRA BES 005,T', 'CV. Jaya Elektronik', '2020-03-04', 32000, 2, 'PCS'),
(247, 'B247', 'Oxygen', 'BENGKEL', 'Nanang ', '2020-03-04', 400000, 2, 'TABUNG'),
(248, 'B248', 'Pleng', 'BENGKEL', 'Nanang ', '2020-03-04', 255000, 17, 'KG'),
(249, 'B249', 'Jarum Keras', 'BENGKEL', 'Nanang ', '2020-03-04', 100000, 3, 'PCS'),
(250, 'B250', 'Rice Cooker', 'SUKSES 1200,TB', 'Nanang', '2020-03-06', 250000, 1, 'PCS'),
(251, 'B251', 'Rice Cooker', 'ELISYAH II, TB', 'Nanang', '2020-03-06', 250000, 1, 'PCS'),
(252, 'B252', 'Glue Epoxy', 'ELISYAH II, TB', 'Nanang', '2020-03-06', 179000, 2, 'PCS'),
(253, 'B253', 'Buat Vallet Peti', 'ITA LESTARI V, ', 'Nanang', '2020-03-06', 200000, 1, 'PCS'),
(254, 'B254', 'Stamp Kapal (Deck Mesin)', 'ELISYAH II, TB', 'Dedy', '2020-03-06', 300000, 2, 'PCS'),
(255, 'B255', 'Norchem', 'PUTRA BES 005,T', 'Nanang', '2020-03-07', 1400000, 1, 'PAIL'),
(256, 'B256', 'Hose R1 T-1/4 X 74 Cm C/W Fitting Straight Jic Fit', 'ELISYAH I, TB', 'Nanang', '2020-03-07', 130000, 1, 'LGT'),
(258, 'B258', 'Oring P15 Size 2.4\" 14.8 (Viton 75)', 'ELISYAH I, TB', 'Nanang', '2020-03-07', 9000, 3, 'PCS'),
(259, 'B259', 'Oring P15 Size 3.5\" 31.7 (Viton 75)', 'ELISYAH I, TB', 'Nanang', '2020-03-07', 14000, 2, 'PCS'),
(260, 'B260', 'Oring Size 3\"14 Fkm75 Grind Brown (Ost)', 'ELISYAH I, TB', 'Nanang', '2020-03-07', 10000, 2, 'PCS'),
(261, 'B261', 'Oring 2-133 Size 2.62\" 13.94 (Viton 75) Brown', 'ELISYAH I, TB', 'Nanang', '2020-03-07', 10000, 2, 'PCS'),
(262, 'B262', 'Epoxy Glue Pc Marine', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 268500, 3, 'PCS'),
(263, 'B263', 'Majun', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 70000, 1, 'GONI'),
(264, 'B264', 'Silikon Red', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 60000, 5, 'PCS'),
(265, 'B265', 'Karet Kuningan', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 90000, 5, 'PCS'),
(266, 'B266', 'Lim Switch', 'FRANSISCUS I, T', 'Nanang', '2020-03-07', 560000, 1, 'PCS'),
(267, 'B267', 'Lim Switch', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 75000, 1, 'LEMBAR'),
(268, 'B268', 'Bross', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 100000, 0, 'PCS'),
(269, 'B269', 'Red Packing', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 200000, 1, 'SHEET'),
(270, 'B270', 'Packing', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 280000, 1, 'ROLL'),
(271, 'B271', 'Bross Gerinda', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 30000, 2, 'PCS'),
(272, 'B272', 'Kotak Chemical', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 1800000, 1, 'PCS'),
(273, 'B273', 'Baut Bhtb 12x 60', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 30000, 20, 'PCS'),
(274, 'B274', 'Nbk M12', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 20000, 50, 'PCS'),
(275, 'B275', 'Bhtg', 'ELISYAH II, TB', 'Nanang', '2020-03-07', 3000, 0, 'PCS'),
(276, 'B276', 'Tv Merk Samsung 32\"', 'SECAPA', 'Nanang', '2020-03-07', 1750000, 1, 'PCS'),
(277, 'B277', 'Pipa', 'SECAPA', 'Nanang', '2020-03-07', 110000, 11, 'KG'),
(278, 'B278', 'Pipa 3/4', 'SECAPA', 'Nanang', '2020-03-07', 10000, 1, 'KG'),
(279, 'B279', 'Jarum Keras', 'SECAPA', 'Nanang', '2020-03-07', 210000, 3, 'PCS'),
(280, 'B280', 'Clamp Half Saddle 3/4', 'SECAPA', 'Nanang', '2020-03-07', 39000, 30, 'PCS'),
(281, 'B281', 'Clamp Saddle Bi Pvc', 'SECAPA', 'Nanang', '2020-03-07', 6000, 3, 'PCS'),
(282, 'B282', 'Pipa Proman Putih', 'SECAPA', 'Nanang', '2020-03-07', 10000, 1, 'BATANG'),
(283, 'B283', 'Kabel Lub 50-10', 'SECAPA', 'Nanang', '2020-03-07', 12000, 2, 'PCS'),
(284, 'B284', 'Clamp B Bw 70 M', 'SECAPA', 'Nanang', '2020-03-07', 44000, 2, 'PCS'),
(285, 'B285', 'Kabel Lub 50-10', 'SECAPA', 'Nanang', '2020-03-07', 12000, 2, 'PCS'),
(286, 'B286', 'Clamp B Bw 70 M', 'SECAPA', 'Nanang', '2020-03-07', 44000, 2, 'PCS'),
(287, 'B287', 'Clamp B Bw 70 M', 'SECAPA', 'Nanang', '2020-03-07', 10000, 1, 'BUNGKUS'),
(288, 'B288', 'Scrub 8x1 Putih', 'SECAPA', 'Nanang', '2020-03-07', 12000, 4, 'BUNGKUS'),
(289, 'B289', 'Unitape', 'SECAPA', 'Nanang', '2020-03-07', 20000, 4, 'BUNGKUS'),
(290, 'B290', 'Duet Gland 15 Mm X 100 Mm', 'SECAPA', 'Nanang', '2020-03-07', 58000, 1, 'PCS'),
(291, 'B291', 'Silicone Botol Clear', 'SECAPA', 'Nanang', '2020-03-07', 35000, 1, 'PCS'),
(292, 'B292', 'Stick Copparod', 'SECAPA', 'Nanang', '2020-03-07', 35000, 1, 'PCS');
-- --------------------------------------------------------
--
-- Table structure for table `gudang`
--
CREATE TABLE `gudang` (
`id` int(11) NOT NULL,
`kode_barang` varchar(4) NOT NULL,
`nama_barang` varchar(50) NOT NULL,
`kapal` varchar(10) NOT NULL,
`supplier` varchar(30) NOT NULL,
`tanggal` varchar(15) NOT NULL,
`nominal` int(15) NOT NULL,
`stok` int(5) NOT NULL,
`satuan` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `gudang`
--
INSERT INTO `gudang` (`id`, `kode_barang`, `nama_barang`, `kapal`, `supplier`, `tanggal`, `nominal`, `stok`, `satuan`) VALUES
(1, 'B001', 'Injection Pump Test', 'MENTARI 1,', 'Nanang', '2020-01-01', 1200000, 1, 'Unit'),
(2, 'B002', 'Kunci Inggris', 'PUTRA 1, T', 'Nanang', '2020-01-02', 120000, 1, 'PCS'),
(3, 'B003', 'Pompa Stainless Air Laut Dan Mata Bor', 'PUTRA 1, T', 'Nanang', '2020-01-02', 2269000, 1, 'Unit'),
(4, 'B004', 'Isi Roll Minyak', 'Bengkel', 'Nanang', '2020-01-02', 12000, 2, 'PCS'),
(5, 'B005', 'Tiner Botol', 'Bengkel', 'Nanang', '2020-01-02', 10000, 490, 'ML'),
(6, 'B006', 'Kaca Las Bening', 'Bengkel', 'Nanang', '2020-01-02', 4000, 1, 'PCS'),
(7, 'B007', 'Kaca Las Hitam No. 11', 'Bengkel', 'Nanang', '2020-01-02', 12000, 1, 'PCS'),
(8, 'B008', 'Bearing 6003', 'MENTARI 1,', 'Nanang', '2020-01-02', 15000, 1, 'PCS'),
(9, 'B009', 'Mata Gerinda Tebal', 'MENTARI 1,', 'Nanang', '2020-01-02', 40000, 5, 'PCS'),
(10, 'B010', 'Oil Seal C502', 'MENTARI 1,', 'Nanang', '2020-01-02', 25000, 1, 'PCS'),
(11, 'B011', 'Tiner Bhtb', 'PUTRA 1, T', 'Nanang', '2020-01-02', 6000, 2, 'SET'),
(12, 'B012', 'Radiator Hose', 'PUTRA 1, T', 'Nanang', '2020-01-02', 150000, 1, 'LGH'),
(13, 'B013', 'Super Clamp', 'PUTRA 1, T', 'Nanang', '2020-01-02', 140000, 4, 'PCS'),
(14, 'B014', 'Pully A1 X 3,5\"', 'PUTRA 1, T', 'Nanang', '2020-01-02', 110000, 1, 'PCS'),
(15, 'B015', 'Nipel Kuningan', 'PUTRA 1, T', 'Nanang', '2020-01-02', 90000, 0, 'PCS'),
(16, 'B016', 'O-Ring', 'PUTRA 1, T', 'Nanang', '2020-01-02', 30000, 2, 'PCS'),
(17, 'B017', 'Drill Bit 9 Mm', 'PUTRA 1, T', 'Nanang', '2020-01-02', 60000, 1, 'PCS'),
(18, 'B018', 'Elbow 90 Sch 80 1\"', 'PUTRA 1, T', 'Nanang', '2020-01-02', 75000, 5, 'PCS'),
(19, 'B019', 'Baut B304', 'PUTRA 1, T', 'Nanang', '2020-01-02', 20000, 20, 'SET'),
(20, 'B020', 'Elbow 90 Sch 80 1. 1/2\"', 'PUTRA 1, T', 'Nanang', '2020-01-02', 120000, 6, 'PCS'),
(21, 'B021', 'Hose Niple Giv 1\"', 'PUTRA 1, T', 'Nanang', '2020-01-02', 30000, 2, 'PCS'),
(22, 'B022', 'Elbow 90 Sch 40 3/4\"', 'PUTRA 1, T', 'Nanang', '2020-01-02', 166000, 2, 'PCS'),
(23, 'B023', 'Rantai Gearbox Chani Coupons', 'PUTRA 1, T', 'Nanang', '2020-01-02', 440000, 1, 'EA'),
(24, 'B024', 'Oil Sae 40', 'ELISYAH 1 ', 'PT. Rusel Victory Nusantara', '2020-01-06', 4500000, 1, 'DRUM'),
(25, 'B025', 'Repair Stang Rod/Piston', 'PATIH II ,', 'Nanang', '2020-01-10', 3500000, 1, 'PCS'),
(26, 'B026', 'Filter', 'ELISYAH 1 ', 'Nanang', '2020-01-10', 1120000, 4, 'PCS'),
(27, 'B027', 'Filter', 'PUTRA BES ', 'Nanang', '2020-01-10', 1120000, 4, 'PCS'),
(28, 'B028', 'Speed Control 3044196', 'ELISYAH 1 ', 'Nanang', '2020-01-10', 4000000, 1, 'PCS'),
(29, 'B029', 'Actuator', 'ELISYAH 1 ', 'Nanang', '2020-01-10', 4800000, 1, 'PCS'),
(30, 'B030', 'Bearing Ruller(Besar)', 'ELISYAH 1 ', 'Nanang', '2020-01-10', 560000, 2, 'PCS'),
(31, 'B031', 'Bearing Ruller(Kecil)', 'ELISYAH 1 ', 'Nanang', '2020-01-10', 540000, 2, 'PCS'),
(32, 'B032', 'Elbow S40 2\"', 'MENTARI 1,', 'Nanang', '2020-01-13', 90000, 6, 'PCS'),
(33, 'B033', 'Elbow S0 1\"', 'MENTARI 1,', 'Nanang', '2020-01-13', 9000, 1, 'PCS'),
(34, 'B034', 'Kawat Las Rb 26-3.2m', 'MENTARI 1,', 'Nanang', '2020-01-13', 132500, 5, 'PCS'),
(35, 'B035', 'Mata Gerinda ', 'MENTARI 1,', 'Nanang', '2020-01-13', 100000, 0, 'PCS'),
(36, 'B036', 'Filter Ff-105', 'ELISYAH 1 ', 'Nanang', '2020-01-13', 360000, 4, 'PCS'),
(37, 'B037', 'Kain Lap/Majun', 'PUTRA 1, T', 'Nanang', '2020-01-13', 180000, 20, 'KG'),
(38, 'B038', 'Filter Oili', 'PUTRA 1, T', 'Nanang', '2020-01-13', 100000, 2, 'PCS'),
(39, 'B039', 'Fuel Filter', 'PUTRA 1, T', 'Nanang', '2020-01-13', 90000, 2, 'PCS'),
(40, 'B040', 'Aki N-100', 'PUTRA 1, T', 'Nanang', '2020-01-13', 1450000, 1, 'PCS'),
(41, 'B041', 'Obeng Amplas.Dll', 'PUTRA 1, T', 'Nanang', '2020-01-13', 410000, 0, 'PCS'),
(42, 'B042', 'Besi', 'PUTRA 1, T', 'Nanang', '2020-01-13', 480000, 40, 'KG'),
(43, 'B043', 'Sarung Tangan', 'PUTRA 1, T', 'Nanang', '2020-01-13', 25000, 1, 'LUSIN'),
(44, 'B044', 'Sims Plate 0,25 Mm', 'PUTRA 1, T', 'Nanang', '2020-01-13', 96000, 30, 'CM'),
(45, 'B045', 'Elbow Sch 80 2\" 90', 'PUTRA 1, T', 'Nanang', '2020-01-13', 80000, 2, 'PCS'),
(46, 'B046', 'Pressure Gaurge Oil', 'PUTRA BES ', 'Nanang', '2020-01-14', 600000, 2, 'PCS'),
(47, 'B047', 'Thermometer', 'PUTRA BES ', 'Nanang', '2020-01-14', 500000, 2, 'PCS'),
(48, 'B048', 'Real Oil Seal 3909410 6bt', 'ELISYAH 1 ', 'Nanang', '2020-01-14', 500000, 1, 'PCS'),
(49, 'B049', 'Oil Jet Nozzle 3014404 Cummins Nt855', 'ELISYAH 1 ', 'Nanang', '2020-01-14', 450000, 3, 'PCS'),
(50, 'B050', 'Silicone Gasket Red R-288/65of/85gram Richerbond', 'ELISYAH 1 ', 'Nanang', '2020-01-14', 35000, 1, 'PCS'),
(51, 'B051', 'Batere N 200', 'PUTRA 1, T', 'Nanang', '2020-01-14', 4400000, 2, 'PCS'),
(52, 'B052', 'Gasket Tba 0.8', 'PUTRA 1, T', 'Nanang', '2020-01-14', 120000, 1, 'PCS'),
(53, 'B053', 'Gas Lpg', 'FRANSISCUS', 'Nanang', '2020-01-14', 137000, 1, 'TABUNG'),
(54, 'B054', 'Bolt Unf 7/16 X 2\"', 'ELISYAH 1,', 'Nanang', '2020-01-14', 20000, 10, 'PCS'),
(55, 'B055', 'Bolt Unf 7/16 X 3.1/2\"', 'ELISYAH 1,', 'Nanang', '2020-01-14', 32000, 10, 'PCS'),
(56, 'B056', 'Bolt Unf 7/16 X1.1/2\"', 'ELISYAH 1,', 'Nanang', '2020-01-14', 15000, 10, 'PCS'),
(57, 'B057', 'Bolt Unf 5/16 X 3/4\"', 'ELISYAH 1,', 'Nanang', '2020-01-14', 5000, 10, 'PCS'),
(58, 'B058', 'Adaptor 3/4 X 3/8 Degree', 'PUTRA BES ', 'Nanang', '2020-01-14', 70000, 2, 'PCS'),
(59, 'B059', 'Mechanical Seal 15 Mm', 'MENTARI 1,', 'Nanang', '2020-01-14', 180000, 1, 'PCS'),
(60, 'B060', 'Kapur Plat', 'PUTRA 1, T', 'Nanang', '2020-01-14', 10000, 5, 'PCS'),
(61, 'B061', 'Besi Siku', 'PUTRA 1, T', 'Nanang', '2020-01-14', 6000, 12, 'PCS'),
(62, 'B062', 'Baut B304 12 X 20 ', 'PUTRA 1, T', 'Nanang', '2020-01-14', 5000, 2, 'PCS'),
(63, 'B063', 'Baut B304 12 X 70', 'PUTRA 1, T', 'Nanang', '2020-01-14', 36000, 4, 'PCS'),
(64, 'B064', 'Las Aluminium', 'PUTRA 1, T', 'Nanang', '2020-01-14', 150000, 2, 'PCS'),
(65, 'B065', 'Crank Shaff 3049024', 'ELISYAH I,', 'Nanang', '2020-01-16', 7000000, 1, 'PCS'),
(66, 'B066', 'Catridge Turbo', 'FRANSISCUS', 'Nanang', '2020-01-22', 16000000, 1, 'UNIT'),
(67, 'B067', 'Linggis 90 Cm', 'ELISYAH II', 'Sofyan', '2020-01-27', 60000, 1, 'PCS'),
(68, 'B068', 'Sarung Tangan', 'ELISYAH II', 'Sofyan', '2020-01-27', 40000, 1, 'LUSIN'),
(69, 'B069', 'Kuas Supra 3\"', 'ELISYAH II', 'Sofyan', '2020-01-27', 20000, 1, 'PCS'),
(70, 'B070', 'Pahat Beron', 'ELISYAH II', 'Sofyan', '2020-01-27', 30000, 1, 'PCS'),
(71, 'B071', 'Gasket Head 6135', 'SUKSES 120', 'CV. Bangun Cipta Kaji', '2020-01-30', 900000, 3, 'PCS'),
(72, 'B072', 'Ring Piston', 'SUKSES 120', 'CV. Bangun Cipta Kaji', '2020-01-30', 2520000, 6, 'SET'),
(73, 'B073', 'Nozzle 150s437d', 'SUKSES 120', 'CV. Bangun Cipta Kaji', '2020-01-30', 2580000, 6, 'PCS'),
(74, 'B074', 'Gas 12 Kg', 'PATIH II ,', 'Nanang', '2020-01-30', 150000, 1, 'PCS'),
(75, 'B075', 'Brush Kuningan 8 Baris', 'Bengkel', 'Nanang', '2020-01-30', 10000, 1, 'PCS'),
(76, 'B076', 'Meteran Asaki 3 M', 'Bengkel', 'Nanang', '2020-01-30', 15000, 1, 'PCS'),
(77, 'B077', 'Brush Kawat', 'Bengkel', 'Nanang', '2020-01-30', 12000, 1, 'PCS'),
(78, 'B078', 'Gagang Shock', 'Bengkel', 'Nanang', '2020-01-30', 75000, 1, 'PCS'),
(79, 'B079', 'H-2702 Hf Sakura', 'BAHTERA AB', 'Nanang', '2020-01-30', 364000, 4, 'PCS'),
(80, 'B080', 'Kepala Aki', 'PUTRA 1, T', 'Nanang', '2020-01-30', 70000, 2, 'SET'),
(81, 'B081', 'Selotip', 'PUTRA 1, T', 'Nanang', '2020-01-30', 20000, 1, 'DUS'),
(82, 'B082', 'Detergent Boom', 'FRANSISCUS', 'Nanang', '2020-01-30', 52000, 1, 'DUS'),
(83, 'B083', 'Bearing 6204', 'FRANSISCUS', 'Nanang', '2020-01-30', 40000, 2, 'PCS'),
(84, 'B084', 'Baut B6304', 'FRANSISCUS', 'Nanang', '2020-01-30', 100000, 4, 'PCS'),
(85, 'B085', 'Filter Ff-105', 'ITA LESTAR', 'Nanang', '2020-01-30', 360000, 4, 'PCS'),
(86, 'B086', 'Racor 2020', 'ITA LESTAR', 'Nanang', '2020-01-30', 420000, 4, 'PCS'),
(87, 'B087', 'Lf 777', 'ITA LESTAR', 'Nanang', '2020-01-30', 700000, 4, 'PCS'),
(88, 'B088', 'Lf 70', 'ITA LESTAR', 'Nanang', '2020-01-30', 700000, 4, 'PCS'),
(89, 'B089', 'C 5703', 'ITA LESTAR', 'Nanang', '2020-01-30', 360000, 4, 'PCS'),
(90, 'B090', 'Lem Silikon', 'MENTARI 1,', 'Nanang', '2020-01-30', 50000, 5, 'PCS'),
(91, 'B091', 'Lem Dexton', 'MENTARI 1,', 'Nanang', '2020-01-30', 20000, 1, 'PCS'),
(92, 'B092', 'Water Pump S6a-2', 'MENTARI 1,', 'Nanang', '2020-01-30', 2500000, 2, 'PCS'),
(93, 'B093', 'Seal Os 457211', 'MENTARI 1,', 'Nanang', '2020-01-30', 100000, 1, 'PCS'),
(94, 'B094', 'Radiator Hose 1 1/ 4\" X 36\" Sunflex', 'MENTARI 1,', 'Nanang', '2020-01-30', 220000, 1, 'LGH'),
(95, 'B095', 'Hose Clamp 1 34\" S/S', 'MENTARI 1,', 'Nanang', '2020-01-30', 30000, 2, 'PCS'),
(96, 'B096', 'Naoprana Kabel', 'MENTARI 1,', 'Nanang', '2020-01-30', 187500, 15, 'METER'),
(97, 'B097', 'Copper Pipe 5/16\" X 25 Cm C/W Nut (2 Ea)', 'MENTARI 1,', 'Nanang', '2020-01-30', 75000, 1, 'LGT'),
(98, 'B098', 'Hose Clips 2\"', 'MENTARI 1,', 'Nanang', '2020-01-30', 50000, 5, 'EA'),
(99, 'B099', 'Elbow 90 Deg L/R C/S A234 Wpb S80 2.1/2\" Aff', 'ELISYAH II', 'Nanang', '2020-01-30', 55000, 1, 'PCS'),
(100, 'B100', 'Kawat Las China 3,2 Mm', 'ELISYAH II', 'Nanang', '2020-01-30', 400000, 20, 'KG'),
(101, 'B101', 'Pipe Seamless S/C Sch 80 X 6 M4\"', 'ELISYAH II', 'Nanang', '2020-01-30', 1600000, 1, 'LGHT'),
(102, 'B102', 'Pipe Seamless S/C Sch 80 X 6 M3\"', 'ELISYAH II', 'Nanang', '2020-01-30', 1120000, 1, 'LGHT'),
(103, 'B103', 'Pipe Seamless S/C Sch 80 X 6 M 2.1/2\"', 'ELISYAH II', 'Nanang', '2020-01-30', 640000, 1, 'LGHT'),
(104, 'B104', 'Plff Flange Ss400 10k X 4\" Aff', 'ELISYAH II', 'Nanang', '2020-01-30', 480000, 6, 'PCS'),
(105, 'B105', 'Plff Flange Ss400 10k X 3\" Aff', 'ELISYAH II', 'Nanang', '2020-01-30', 390000, 6, 'PCS'),
(106, 'B106', 'Plff Flange Ss400 10k X 2.1/2 \" Aff', 'ELISYAH II', 'Nanang', '2020-01-30', 104000, 2, 'PCS'),
(107, 'B107', 'Con Red C/S A 234 Wpb S80 3\" X 2.1/2\"', 'ELISYAH II', 'Nanang', '2020-01-30', 75000, 1, 'PCS'),
(108, 'B108', 'Con Red C/S A 234 Wpb S80 4\" X 3\"', 'ELISYAH II', 'Nanang', '2020-01-30', 90000, 1, 'PCS'),
(109, 'B109', 'Elbow 90 Deg L/R C/S A234 Wpb S80 4\" Aff', 'ELISYAH II', 'Nanang', '2020-01-30', 500000, 4, 'PCS'),
(110, 'B110', 'Elbow 90 Deg L/R C/S A234 Wpb S80 3\" Aff', 'ELISYAH II', 'Nanang', '2020-01-30', 260000, 4, 'PCS'),
(111, 'B111', 'Terpal 6m', 'SUKSES 120', 'Nanang', '2020-01-30', 60000, 6, 'METER'),
(112, 'B112', 'Colokan Las', 'SUKSES 120', 'Nanang', '2020-01-30', 150000, 2, 'PCS'),
(113, 'B113', 'Sealing Compund', 'SUKSES 120', 'Nanang', '2020-01-30', 95000, 1, 'PCS'),
(114, 'B114', 'Ambril Pasta Cheemaco Ambril Pasta', 'SUKSES 120', 'Nanang', '2020-01-30', 35000, 1, 'PCS'),
(115, 'B115', 'Pressure Gaurge 2.1/2\" X 1/4\" 1000 Kg', 'SUKSES 120', 'Nanang', '2020-01-30', 380000, 1, 'PCS'),
(116, 'B116', 'Bearing 6305', 'SUKSES 120', 'Nanang', '2020-01-30', 120000, 1, 'PCS'),
(117, 'B117', 'Seal Tape 1/2\"', 'SUKSES 120', 'Nanang', '2020-01-30', 5000, 1, 'ROLL'),
(118, 'B118', 'Heemacon', 'SUKSES 120', 'Nanang', '2020-01-30', 30000, 1, 'PCS'),
(119, 'B119', 'Elbow 90 Deg L/R C/S A234 Wpb S40 2.1/2\" Aff', 'SUKSES 120', 'Nanang', '2020-01-30', 160000, 4, 'PCS'),
(120, 'B120', 'Elbow 90 Deg L/R C/S A234 Wpb S40 6\" Aff', 'SUKSES 120', 'Nanang', '2020-01-30', 880000, 4, 'PCS'),
(121, 'B121', 'Besi', 'SUKSES 120', 'Nanang', '2020-01-30', 23920000, 2392, 'KG'),
(122, 'B122', 'Sarung Tangan', 'SUKSES 120', 'Nanang', '2020-01-30', 105000, 3, 'PCS'),
(123, 'B123', 'Kawat Las', 'SUKSES 120', 'Nanang', '2020-01-30', 450000, 1, 'BOX'),
(124, 'B124', 'Tabung Oksigen', 'SUKSES 120', 'Nanang', '2020-01-30', 800000, 4, 'PCS'),
(125, 'B125', 'Besi', 'SUKSES 120', 'Nanang', '2020-01-30', 2130000, 213, 'KG'),
(126, 'B126', 'Sling', 'SUKSES 120', 'Nanang', '2020-01-30', 200000, 20, 'METER'),
(127, 'B127', 'Kuku Macan', 'SUKSES 120', 'Nanang', '2020-01-30', 8000, 4, 'PCS'),
(128, 'B128', 'Besi Siku', 'SUKSES 120', 'Nanang', '2020-01-30', 450000, 45, 'KG'),
(129, 'B129', 'Botol Angin', 'SUKSES 120', 'Nanang', '2020-01-30', 1000000, 5, 'BOTOL'),
(130, 'B130', 'Kawat Las', 'SUKSES 120', 'Nanang', '2020-01-30', 150000, 2, 'PCS'),
(131, 'B131', 'Engine Cummins', 'GIANT, TB', 'PT. Tobacon', '2020-01-30', 610000000, 1, 'UNIT'),
(132, 'B132', '1 unit Towing Hock model TH-15T', 'SUKSES 120', 'Nanang', '2020-02-04', 15525000, 1, 'UNIT'),
(133, 'B133', 'Engine Mitsubishi', 'BAHTERA AB', 'CV. Sinar Harapan', '2020-02-05', 35000000, 1, 'SET'),
(134, 'B134', 'Water Cooler Cummins M/E Material Stainless', 'ITA LESTAR', 'CV. Bangun Cipta Kaji', '2020-02-06', 9500000, 1, 'UNIT'),
(135, 'B135', 'Water Cooler CH A/E Material Stainless', 'ITA LESTAR', 'Nanang', '2020-02-06', 2700000, 1, 'UNIT'),
(136, 'B136', 'Besi Plat dan pipa', 'SUKSES 120', 'Nanang', '2020-02-10', 2170000, 217, 'KG'),
(137, 'B137', 'Kawat las 4.0 mm', 'SUKSES 120', 'Nanang', '2020-02-10', 600000, 4, 'MM'),
(138, 'B138', 'Kawat las 3.0 mm', 'SUKSES 120', 'Nanang', '2020-02-10', 750000, 3, 'MM'),
(139, 'B139', 'Hand pump Oil Semitory 1\"', 'PUTRA BES ', 'Nanang', '2020-02-11', 1400000, 2, 'PCS'),
(140, 'B140', 'Lampu Halogen Pus line 500W Phillips', 'BAHTERA AB', 'Nanang', '2020-02-11', 58000, 2, 'PCS'),
(141, 'B141', 'Kuas 2\"', 'BAHTERA AB', 'Nanang', '2020-02-11', 10000, 2, 'PCS'),
(142, 'B142', 'Ring Pas', 'BAHTERA AB', 'Nanang', '2020-02-11', 30000, 1, 'PCS'),
(143, 'B143', 'Ultimeg Red spray ', 'BAHTERA AB', 'Nanang', '2020-02-11', 420000, 3, 'EA'),
(144, 'B144', 'pressure Gaurge', 'ELISYAH II', 'Nanang', '2020-02-11', 180000, 1, 'PCS'),
(145, 'B145', 'Back up Ring ', 'ELISYAH II', 'Nanang', '2020-02-11', 46000, 1, 'PCS'),
(146, 'B146', 'O-Ring P & G P135', 'ELISYAH II', 'Nanang', '2020-02-11', 35000, 1, 'PCS'),
(147, 'B147', 'Ampere HZ Meter Nidax', 'ELISYAH II', 'Nanang', '2020-02-11', 250000, 1, 'PCS'),
(148, 'B148', 'Kunci shock 314 x 27 mm', 'SUKSES 120', 'Nanang', '2020-02-11', 75000, 1, 'PCS'),
(149, 'B149', 'Senter Cas SYTV 172', 'SUKSES 120', 'Nanang', '2020-02-11', 30000, 1, 'PCS'),
(150, 'B150', 'Senter Cas SYTV 169', 'SUKSES 120', 'Nanang', '2020-02-11', 30000, 1, 'PCS'),
(151, 'B151', 'Kain Majun', 'SUKSES 120', 'Nanang', '2020-02-11', 150000, 2, 'KG'),
(152, 'B152', 'Selang Benang 1\"', 'SUKSES 120', 'Nanang', '2020-02-11', 72000, 6, 'PCS'),
(153, 'B153', 'Klem 1/4', 'SUKSES 120', 'Nanang', '2020-02-11', 32000, 8, 'PCS'),
(154, 'B154', 'Ember( tempat chemical)', 'SUKSES 120', 'Nanang', '2020-02-11', 100000, 1, 'PCS'),
(155, 'B155', 'Feel Belt', 'SUKSES 120', 'Nanang', '2020-02-11', 100000, 3, 'PCS'),
(156, 'B156', 'Fan Belting', 'SUKSES 120', 'Nanang', '2020-02-11', 100000, 1, 'PCS'),
(157, 'B157', 'Fan Belting', 'SUKSES 120', 'Nanang', '2020-02-11', 80000, 1, 'PCS'),
(158, 'B158', 'O-Ring Uter', 'SUKSES 120', 'Nanang', '2020-02-11', 15000, 1, 'PCS'),
(159, 'B159', 'Motor Electric Cleaner ', 'SUKSES 120', 'Nanang', '2020-02-11', 1350000, 1, 'PAIL'),
(160, 'B160', 'Kunci 8-32', 'SUKSES 120', 'Nanang', '2020-02-11', 300000, 1, 'SET'),
(161, 'B161', 'Seal Tip', 'SUKSES 120', 'Nanang', '2020-02-11', 20000, 1, 'ROLL'),
(162, 'B162', 'Kepala Aki', 'SUKSES 120', 'Nanang', '2020-02-11', 70000, 2, 'SET'),
(163, 'B163', 'Valve Kuningan 1\"', 'SUKSES 120', 'Nanang', '2020-02-11', 110000, 1, 'PCS'),
(164, 'B164', 'Hose R2T-3/8 x 130 cm Fitting Banjo ,Fitting Elbow', 'SUKSES 120', 'Nanang', '2020-02-11', 250000, 1, 'LGT'),
(165, 'B165', 'Hose radiator 1\" x 150 cm', 'SUKSES 120', 'Nanang', '2020-02-11', 247000, 1, 'LGT'),
(166, 'B166', 'Clamp 31-34', 'SUKSES 120', 'Nanang', '2020-02-11', 64000, 0, 'EA'),
(167, 'B167', 'Rust Remover', 'SUKSES 120', 'Nanang', '2020-02-11', 813000, 20, 'LITER'),
(168, 'B168', 'Repair dinamo stater', 'BAHTERA AB', 'Nanang', '2020-02-11', 750000, 1, 'UNIT'),
(169, 'B169', 'Repair dinamo stater', 'PUTRA BES ', 'Nanang', '2020-02-11', 1000000, 1, 'UNIT'),
(170, 'B170', 'Wire Hose', 'BENGKEL', 'Sofyan', '2020-02-12', 50000, 2, 'METER'),
(171, 'B171', 'hose clamp', 'PATIH II, ', 'Tony T,pak', '2020-02-18', 16000, 2, 'PCS'),
(172, 'B172', 'Metal duduk, metal Jalan,Trush bearing, Boring Lin', 'ITA LESTAR', 'Nanang', '2020-02-19', 100000000, 10, 'PCS'),
(173, 'B173', 'Beli papan( buat Valet Cooler)', 'SUKSES 120', 'Nanang', '2020-02-19', 150000, 0, 'PCS'),
(174, 'B174', 'Tee SCH 40 1.1/4\"', 'SUKSES 120', 'Nanang', '2020-02-19', 35000, 1, 'PCS'),
(175, 'B175', 'Elbow SCH 40 1.1/4\"', 'SUKSES 120', 'Nanang', '2020-02-19', 45000, 3, 'PCS'),
(176, 'B176', 'Kertas paking TBA 1 mm', 'SUKSES 120', 'Nanang', '2020-02-19', 330000, 2, 'METER'),
(177, 'B177', 'Kacamata', 'SUKSES 120', 'Nanang', '2020-02-19', 20000, 1, 'PCS'),
(178, 'B178', 'Sarung Tangan Katun', 'SUKSES 120', 'Nanang', '2020-02-19', 30000, 1, 'LUSIN'),
(179, 'B179', 'Strip', 'SUKSES 120', 'Nanang', '2020-02-19', 60000, 6, 'KG'),
(180, 'B180', 'hand Taps 12 mm x 1.75 SKF/SKC', 'SUKSES 120', 'Nanang', '2020-02-19', 40000, 1, 'PCS'),
(181, 'B181', 'Snap Ring A022', 'SUKSES 120', 'Nanang', '2020-02-19', 24000, 8, 'PCS'),
(182, 'B182', 'Air aki', 'SUKSES 120', 'Nanang', '2020-02-19', 200000, 1, 'LITER'),
(183, 'B183', 'Baut UNC 8 mm x 25', 'SUKSES 120', 'Nanang', '2020-02-19', 32000, 16, 'PCS'),
(184, 'B184', 'Elbow SCH 80 1/4\"', 'SUKSES 120', 'Nanang', '2020-02-19', 100000, 5, 'PCS'),
(185, 'B185', 'Paking Merah', 'SUKSES 120', 'Nanang', '2020-02-19', 380000, 1, 'METER'),
(186, 'B186', 'Kawat Sling', 'SUKSES 120', 'Nanang', '2020-02-19', 50000, 10, 'METER'),
(187, 'B187', 'Klemp Sling', 'SUKSES 120', 'Nanang', '2020-02-19', 10000, 4, 'PCS'),
(188, 'B188', 'Katrol', 'SUKSES 120', 'Nanang', '2020-02-19', 10000, 2, 'PCS'),
(189, 'B189', 'Rubber Sheet 4 mm 50kg/roll', 'SUKSES 120', 'Nanang', '2020-02-19', 80000, 1, 'METER'),
(190, 'B190', 'Hand Tap 5/8 UNF', 'SUKSES 120', 'Nanang', '2020-02-19', 140000, 1, 'SET'),
(191, 'B191', 'Hand Tap M12 x 1.75', 'SUKSES 120', 'Nanang', '2020-02-19', 100000, 1, 'SET'),
(192, 'B192', 'Kawat Las 3.2 mm', 'SUKSES 120', 'Nanang', '2020-02-19', 350000, 10, 'KG'),
(193, 'B193', 'Seal 220 x 255 x 16', 'ELISYAH II', 'Nanang', '2020-02-19', 4640000, 1, 'PCS'),
(194, 'B194', 'Pipa', 'SUKSES 120', 'Sofyan', '2020-02-19', 54000, 6, 'KG'),
(195, 'B195', 'Hose Radiator 1.5/8\"', 'SUKSES 120', 'Sofyan', '2020-02-19', 705000, 3, 'METER'),
(196, 'B196', 'Hose clips 2.1/2\"', 'SUKSES 120', 'Sofyan', '2020-02-19', 260000, 20, 'EA'),
(197, 'B197', 'Propeller Diameter 2000 mm', 'ELISYAH II', 'PT. Metalindo Nan Sukses', '2020-02-24', 28000000, 2, 'UNIT'),
(198, 'B198', 'Oli Sae 40', 'ELISYAH II', 'PT. Rusel Victory Nusantara', '2020-02-24', 27000000, 6, 'DRUM'),
(199, 'B199', 'Oli Sae 40', 'ELISYAH II', 'PT. Rusel Victory Nusantara', '2020-02-24', 4500000, 1, 'DRUM'),
(200, 'B200', 'Oli Sae 40', 'ELISYAH II', 'PT. Rusel Victory Nusantara', '2020-02-24', 4500000, 1, 'DRUM'),
(201, 'B201', 'Oli Sae 40', 'ITA LESTAR', 'Doddy S/Nanang', '2020-02-24', 5395000, 1, 'DRUM'),
(202, 'B202', 'Oring z peller', 'ELISYAH II', 'CV. Mandiri Karet', '2020-02-24', 3750000, 5, 'UNIT'),
(203, 'B203', 'valve gate Cast Iron', 'ELISYAH II', 'Nanang', '2020-02-24', 1600000, 1, 'PCS'),
(204, 'B204', 'Dinabolt M16 x 4\"', 'ELISYAH II', 'Nanang', '2020-02-24', 54000, 6, 'PCS'),
(205, 'B205', 'Head Gasket Cummins KTA 19', 'ITA LESTAR', 'Nanang', '2020-02-24', 4800000, 6, 'PCS'),
(206, 'B206', 'Oring Liner Cummins KTA 19', 'ITA LESTAR', 'Nanang', '2020-02-24', 2400000, 6, 'SET'),
(207, 'B207', 'Liner', 'ITA LESTAR', 'PT. Putra Jaya Baru', '2020-02-27', 15000000, 6, 'PCS'),
(208, 'B208', 'Cat pilox', 'BENGKEL', 'Syamsul', '2020-02-28', 35000, 1, 'KG'),
(209, 'B209', 'Dp Drat', 'BENGKEL', 'Syamsul', '2020-02-28', 10000, 2, 'PCS'),
(210, 'B210', 'Baut BHTB 12 x 25', 'BENGKEL', 'Syamsul', '2020-02-28', 13000, 10, 'SET'),
(211, 'B211', 'Baut BHTB 14 x 50', 'BENGKEL', 'Syamsul', '2020-02-28', 20000, 8, 'SET'),
(212, 'B212', 'Plat & Plang', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 90000, 1, 'PCS'),
(213, 'B213', 'Baut', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 35000, 1, 'PCS'),
(214, 'B214', 'Filter Racor 2020', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 400000, 4, 'PCS'),
(215, 'B215', 'Filter Minyak Ft 105', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 400000, 4, 'PCS'),
(216, 'B216', 'Filter Lf 777', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 465000, 3, 'PCS'),
(217, 'B217', 'Filter 5712', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 350000, 2, 'PCS'),
(218, 'B218', 'Filter Minyak Jx 60', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 700000, 4, 'PCS'),
(219, 'B219', 'Tutup Radiator', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 50000, 1, 'PCS'),
(220, 'B220', 'Gasket Yanmar 155', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 100000, 1, 'PCS'),
(221, 'B221', 'Tutup Oil', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 50000, 1, 'PCS'),
(222, 'B222', 'Mesin Charge Batre ', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 700000, 1, 'PCS'),
(223, 'B223', 'Kain Majun', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 85000, 10, 'PCS'),
(224, 'B224', 'Stamp Kapal', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 30000, 1, 'PCS'),
(225, 'B225', 'Kunci Ring 14\"', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 20000, 1, 'PCS'),
(226, 'B226', 'Tutup Oli', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 50000, 1, 'PCS'),
(227, 'B227', 'Amplas ', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 30000, 3, 'PCS'),
(228, 'B228', 'Lem Rud', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 75000, 5, 'PCS'),
(229, 'B229', 'Amplas', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 15000, 1, 'PCS'),
(230, 'B230', 'Air Aki', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 400000, 40, 'LITER'),
(231, 'B231', 'Segel', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 234000, 13, 'PCS'),
(232, 'B232', 'Segel 1/2', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 180000, 12, 'PCS'),
(233, 'B233', 'Rinso', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 200000, 1, 'DUS'),
(234, 'B234', 'Gerinda Bros', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 25000, 1, 'PCS'),
(235, 'B235', 'Tali Nylon 24 M', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 480000, 16, 'METER'),
(236, 'B236', 'Sarung Tangan', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 60000, 1, 'LUSIN'),
(237, 'B237', 'Lakban Hitam', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 40000, 2, 'PCS'),
(238, 'B238', 'Batu Gerinda Bross', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 45000, 1, 'PCS'),
(239, 'B239', 'Ban Dapra', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 1200000, 0, 'PCS'),
(240, 'B240', 'Tali C\'6', 'ITA LESTAR', 'Nanang/Dody S.', '2020-03-02', 1300000, 40, 'METER'),
(241, 'B241', 'Core After Cooler Cumminds Kta 19', 'ITA LESTAR', 'PT. Putra Jaya Baru', '2020-03-02', 9500000, 1, 'PCS'),
(242, 'B242', 'Gasket Rkr Level Covering Cummins Kta 19', 'ITA LESTAR', 'PT. Putra Jaya Baru', '2020-03-02', 600000, 6, 'PCS'),
(243, 'B243', 'Gasket After Cooler Housing Cummins Kta 19', 'ITA LESTAR', 'PT. Putra Jaya Baru', '2020-03-02', 600000, 2, 'PCS'),
(244, 'B244', 'Test Pump Nozzle & Socket', 'BENGKEL', 'Sofyan', '2020-03-02', 1600000, 1, 'PCS'),
(245, 'B245', 'Water Cooler Ch 900', 'ITA LESTAR', 'CV. Bangun Cipra Kaji', '2020-03-03', 9500000, 1, 'UNIT'),
(246, 'B246', 'D Bridge 50a (5) - Bodi Kcl', 'PUTRA BES ', 'CV. Jaya Elektronik', '2020-03-04', 32000, 2, 'PCS'),
(247, 'B247', 'Oxygen', 'BENGKEL', 'Nanang ', '2020-03-04', 400000, 2, 'TABUNG'),
(248, 'B248', 'Pleng', 'BENGKEL', 'Nanang ', '2020-03-04', 255000, 17, 'KG'),
(249, 'B249', 'Jarum Keras', 'BENGKEL', 'Nanang ', '2020-03-04', 100000, 3, 'PCS'),
(250, 'B250', 'Rice Cooker', 'SUKSES 120', 'Nanang', '2020-03-06', 250000, 1, 'PCS'),
(251, 'B251', 'Rice Cooker', 'ELISYAH II', 'Nanang', '2020-03-06', 250000, 1, 'PCS'),
(252, 'B252', 'Glue Epoxy', 'ELISYAH II', 'Nanang', '2020-03-06', 179000, 2, 'PCS'),
(253, 'B253', 'Buat Vallet Peti', 'ITA LESTAR', 'Nanang', '2020-03-06', 200000, 1, 'PCS'),
(254, 'B254', 'Stamp Kapal (Deck Mesin)', 'ELISYAH II', 'Dedy', '2020-03-06', 300000, 2, 'PCS'),
(255, 'B255', 'Norchem', 'PUTRA BES ', 'Nanang', '2020-03-07', 1400000, 1, 'PAIL'),
(256, 'B256', 'Hose R1 T-1/4 X 74 Cm C/W Fitting Straight Jic Fit', 'ELISYAH I,', 'Nanang', '2020-03-07', 130000, 1, 'LGT'),
(258, 'B258', 'Oring P15 Size 2.4\" 14.8 (Viton 75)', 'ELISYAH I,', 'Nanang', '2020-03-07', 9000, 3, 'PCS'),
(259, 'B259', 'Oring P15 Size 3.5\" 31.7 (Viton 75)', 'ELISYAH I,', 'Nanang', '2020-03-07', 14000, 2, 'PCS'),
(260, 'B260', 'Oring Size 3\"14 Fkm75 Grind Brown (Ost)', 'ELISYAH I,', 'Nanang', '2020-03-07', 10000, 2, 'PCS'),
(261, 'B261', 'Oring 2-133 Size 2.62\" 13.94 (Viton 75) Brown', 'ELISYAH I,', 'Nanang', '2020-03-07', 10000, 2, 'PCS'),
(262, 'B262', 'Epoxy Glue Pc Marine', 'ELISYAH II', 'Nanang', '2020-03-07', 268500, 3, 'PCS'),
(263, 'B263', 'Majun', 'ELISYAH II', 'Nanang', '2020-03-07', 70000, 1, 'GONI'),
(264, 'B264', 'Silikon Red', 'ELISYAH II', 'Nanang', '2020-03-07', 60000, 5, 'PCS'),
(265, 'B265', 'Karet Kuningan', 'ELISYAH II', 'Nanang', '2020-03-07', 90000, 5, 'PCS'),
(266, 'B266', 'Lim Switch', 'FRANSISCUS', 'Nanang', '2020-03-07', 560000, 1, 'PCS'),
(267, 'B267', 'Lim Switch', 'ELISYAH II', 'Nanang', '2020-03-07', 75000, 1, 'LEMBAR'),
(268, 'B268', 'Bross', 'ELISYAH II', 'Nanang', '2020-03-07', 100000, 0, 'PCS'),
(269, 'B269', 'Red Packing', 'ELISYAH II', 'Nanang', '2020-03-07', 200000, 1, 'SHEET'),
(270, 'B270', 'Packing', 'ELISYAH II', 'Nanang', '2020-03-07', 280000, 1, 'ROLL'),
(271, 'B271', 'Bross Gerinda', 'ELISYAH II', 'Nanang', '2020-03-07', 30000, 2, 'PCS'),
(272, 'B272', 'Kotak Chemical', 'ELISYAH II', 'Nanang', '2020-03-07', 1800000, 1, 'PCS'),
(273, 'B273', 'Baut Bhtb 12x 60', 'ELISYAH II', 'Nanang', '2020-03-07', 30000, 20, 'PCS'),
(274, 'B274', 'Nbk M12', 'ELISYAH II', 'Nanang', '2020-03-07', 20000, 50, 'PCS'),
(275, 'B275', 'Bhtg', 'ELISYAH II', 'Nanang', '2020-03-07', 3000, 0, 'PCS'),
(276, 'B276', 'Tv Merk Samsung 32\"', 'SECAPA', 'Nanang', '2020-03-07', 1750000, 1, 'PCS'),
(277, 'B277', 'Pipa', 'SECAPA', 'Nanang', '2020-03-07', 110000, 11, 'KG'),
(278, 'B278', 'Pipa 3/4', 'SECAPA', 'Nanang', '2020-03-07', 10000, 1, 'KG'),
(279, 'B279', 'Jarum Keras', 'SECAPA', 'Nanang', '2020-03-07', 210000, 3, 'PCS'),
(280, 'B280', 'Clamp Half Saddle 3/4', 'SECAPA', 'Nanang', '2020-03-07', 39000, 30, 'PCS'),
(281, 'B281', 'Clamp Saddle Bi Pvc', 'SECAPA', 'Nanang', '2020-03-07', 6000, 3, 'PCS'),
(282, 'B282', 'Pipa Proman Putih', 'SECAPA', 'Nanang', '2020-03-07', 10000, 1, 'BATANG'),
(283, 'B283', 'Kabel Lub 50-10', 'SECAPA', 'Nanang', '2020-03-07', 12000, 2, 'PCS'),
(284, 'B284', 'Clamp B Bw 70 M', 'SECAPA', 'Nanang', '2020-03-07', 44000, 2, 'PCS'),
(285, 'B285', 'Kabel Lub 50-10', 'SECAPA', 'Nanang', '2020-03-07', 12000, 2, 'PCS'),
(286, 'B286', 'Clamp B Bw 70 M', 'SECAPA', 'Nanang', '2020-03-07', 44000, 2, 'PCS'),
(287, 'B287', 'Clamp B Bw 70 M', 'SECAPA', 'Nanang', '2020-03-07', 10000, 1, 'BUNGKUS'),
(288, 'B288', 'Scrub 8x1 Putih', 'SECAPA', 'Nanang', '2020-03-07', 12000, 4, 'BUNGKUS'),
(289, 'B289', 'Unitape', 'SECAPA', 'Nanang', '2020-03-07', 20000, 4, 'BUNGKUS'),
(290, 'B290', 'Duet Gland 15 Mm X 100 Mm', 'SECAPA', 'Nanang', '2020-03-07', 58000, 1, 'PCS'),
(291, 'B291', 'Silicone Botol Clear', 'SECAPA', 'Nanang', '2020-03-07', 35000, 1, 'PCS'),
(292, 'B292', 'Stick Copparod', 'SECAPA', 'Nanang', '2020-03-07', 35000, 1, 'PCS');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`nik` varchar(100) NOT NULL,
`nama` varchar(100) NOT NULL,
`alamat` varchar(200) NOT NULL,
`telepon` varchar(100) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`level` enum('admin','member') NOT NULL DEFAULT 'member',
`divisi` varchar(100) NOT NULL,
`loker` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `nik`, `nama`, `alamat`, `telepon`, `username`, `password`, `level`, `divisi`, `loker`) VALUES
(1, '001', 'Shasqia', 'Batam', '0877-1018-4858', 'Admin', 'Admin', 'admin', 'Admin', 'Admin'),
(2, '002', 'Uci Agustin', 'Batam', '0813-7228-7792', 'Admin', 'Admin', 'admin', 'Admin', 'Admin');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `barang_keluar`
--
ALTER TABLE `barang_keluar`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `barang_masuk`
--
ALTER TABLE `barang_masuk`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `gudang`
--
ALTER TABLE `gudang`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `barang_keluar`
--
ALTER TABLE `barang_keluar`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `barang_masuk`
--
ALTER TABLE `barang_masuk`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=293;
--
-- AUTO_INCREMENT for table `gudang`
--
ALTER TABLE `gudang`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=293;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
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
|
b454e6a95f72b5b2cc69aef537038d43a8979d83
|
SQL
|
NeuralNoise/animurecs
|
/dbv/data/schema/anime_lists.sql
|
UTF-8
| 676
| 3.3125
| 3
|
[] |
no_license
|
CREATE TABLE `anime_lists` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`anime_id` int(10) unsigned NOT NULL,
`time` datetime NOT NULL,
`status` tinyint(3) unsigned NOT NULL DEFAULT '0',
`score` tinyint(3) unsigned NOT NULL DEFAULT '0',
`episode` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `user_id,anime_id,time` (`user_id`,`anime_id`,`time`),
KEY `user_id,status,score` (`user_id`,`status`,`score`),
KEY `user_id,time` (`user_id`,`time`),
KEY `user_id,anime_id,score` (`user_id`,`anime_id`,`score`),
KEY `time` (`time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
| true
|
da7fe2ddccd597468880e8bc079446bd42b5a62d
|
SQL
|
jakeaharris/bluebottle_2018
|
/sql/solution_1.sql
|
UTF-8
| 783
| 3.9375
| 4
|
[] |
no_license
|
WITH temp_prod_sum AS (
SELECT
hourly_dry_bulb_temp,
item_name,
sum(net_quantity) as item_count
FROM hourly_weather w
JOIN morse_store_data s
ON 1=1
AND strftime('%d-%m-%Y %H', w.date) = strftime('%d-%m-%Y %H', s.order_date)
WHERE 1=1
AND w.hourly_dry_bulb_temp != ''
AND w.daily_avg_dry_bulb_temp = ''
GROUP BY hourly_dry_bulb_temp, item_name
)
SELECT *
FROM temp_prod_sum t1
WHERE 1=1
AND t1.item_count = (
SELECT max(item_count)
FROM temp_prod_sum t2
WHERE 1=1
AND t2.hourly_dry_bulb_temp = t1.hourly_dry_bulb_temp
)
AND t1.item_name = (
SELECT max(item_name)
FROM temp_prod_sum t2
WHERE 1=1
AND t2.hourly_dry_bulb_temp = t1.hourly_dry_bulb_temp
AND t2.item_count = t1.item_count
)
;
| true
|
444063810a484ed238f217dd45c8e3682e063771
|
SQL
|
jperitz/Kubernetes_Project2
|
/db/colors.sql
|
UTF-8
| 228
| 2.6875
| 3
|
[] |
no_license
|
CREATE DATABASE colors;
use colors;
CREATE TABLE fav_colors (
name VARCHAR(20),
color VARCHAR(10)
);
INSERT INTO fav_colors
(name, color)
VALUES
('Cynthia', 'blue'),
('Jonathan', 'green'),
('Richard', 'yellow');
| true
|
a402f212bc3fc3d3a9ac33b906b2d58147ac38f4
|
SQL
|
rubenorta/rest-api-demo
|
/app/config/database.sql
|
UTF-8
| 606
| 3.1875
| 3
|
[] |
no_license
|
SET NAMES 'utf-8';
CREATE DATABASE antevenio;
CREATE DATABASE antevenioTestdb;
CREATE USER 'antevenio'@'localhost' IDENTIFIED BY 'antevenio';
grant ALL ON antevenio.* TO 'antevenio'@'localhost';
grant ALL ON antevenioTestdb.* TO 'antevenio'@'localhost';
USE antevenio;
CREATE TABLE country (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(3) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
INSERT INTO country VALUES (1, 'España','ES');
INSERT INTO country VALUES (2, 'Italia','IT');
INSERT INTO country VALUES (3, 'Francia','FR');
| true
|
f0423e7883e71635afe2d49ccd066fd809b91359
|
SQL
|
viethoang1999/Thi-t-k-CSDL
|
/Hàng hóa.sql
|
UTF-8
| 1,056
| 3.3125
| 3
|
[] |
no_license
|
CREATE SCHEMA IF NOT EXISTS `db_hanghoa` DEFAULT CHARACTER SET utf8 ;
USE `db_hanghoa` ;
CREATE TABLE IF NOT EXISTS `db_hanghoa`.`MATHANG` (
`MH` INT NOT NULL AUTO_INCREMENT,
`TENHANG` VARCHAR(45) NULL,
`DVT` VARCHAR(45) NULL,
`SLHC` VARCHAR(45) NULL,
`GBHT` VARCHAR(45) NULL,
PRIMARY KEY (`MH`));
CREATE TABLE IF NOT EXISTS `db_hanghoa`.`PHIEUNHAP` (
`SP` INT NOT NULL,
`NGAYNHAP` VARCHAR(45) NULL,
`TNCC` VARCHAR(45) NULL,
`MATHANG_MH` INT NOT NULL,
PRIMARY KEY (`SP`),
INDEX `fk_PHIEUNHAP_MATHANG_idx` (`MATHANG_MH` ASC) VISIBLE,
CONSTRAINT `fk_PHIEUNHAP_MATHANG`
FOREIGN KEY (`MATHANG_MH`)
REFERENCES `db_hanghoa`.`MATHANG` (`MH`)
);
CREATE TABLE IF NOT EXISTS `db_hanghoa`.`HOADONXUAT` (
`SOHD` INT NOT NULL,
`NGAYBAN` VARCHAR(45) NULL,
`TENNGMH` VARCHAR(45) NULL,
`MATHANG_MH` INT NOT NULL,
PRIMARY KEY (`SOHD`),
INDEX `fk_HOADONXUAT_MATHANG1_idx` (`MATHANG_MH` ASC) VISIBLE,
CONSTRAINT `fk_HOADONXUAT_MATHANG1`
FOREIGN KEY (`MATHANG_MH`)
REFERENCES `db_hanghoa`.`MATHANG` (`MH`)
);
| true
|
5985cd8e27452c14d6681f3ed9019a92ad4449dc
|
SQL
|
AkosCzifra/ask-mate-python
|
/sample_data/askmatepart2-sample-data-demo-version.sql
|
UTF-8
| 13,369
| 3.21875
| 3
|
[] |
no_license
|
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.5.6
-- Dumped by pg_dump version 9.5.6
ALTER TABLE IF EXISTS ONLY public.question DROP CONSTRAINT IF EXISTS pk_question_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.answer DROP CONSTRAINT IF EXISTS pk_answer_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.answer DROP CONSTRAINT IF EXISTS fk_question_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.comment DROP CONSTRAINT IF EXISTS pk_comment_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.comment DROP CONSTRAINT IF EXISTS fk_question_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.comment DROP CONSTRAINT IF EXISTS fk_answer_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.question_tag DROP CONSTRAINT IF EXISTS pk_question_tag_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.question_tag DROP CONSTRAINT IF EXISTS fk_question_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.tag DROP CONSTRAINT IF EXISTS pk_tag_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.question_tag DROP CONSTRAINT IF EXISTS fk_tag_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.answer DROP CONSTRAINT IF EXISTS fk_user_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.question DROP CONSTRAINT IF EXISTS fk_user_id CASCADE;
ALTER TABLE IF EXISTS ONLY public.comment DROP CONSTRAINT IF EXISTS fk_user_id CASCADE;
DROP TABLE IF EXISTS public.question;
DROP SEQUENCE IF EXISTS public.question_id_seq;
CREATE TABLE question (
id serial NOT NULL,
submission_time timestamp without time zone,
view_number integer,
vote_number integer,
title text,
message text,
image text,
user_id integer
);
DROP TABLE IF EXISTS public.answer;
DROP SEQUENCE IF EXISTS public.answer_id_seq;
CREATE TABLE answer (
id serial NOT NULL,
submission_time timestamp without time zone,
vote_number integer,
question_id integer,
message text,
image text,
user_id integer
);
DROP TABLE IF EXISTS public.comment;
DROP SEQUENCE IF EXISTS public.comment_id_seq;
CREATE TABLE comment (
id serial NOT NULL,
question_id integer,
answer_id integer,
message text,
submission_time timestamp without time zone,
edited_count integer,
user_id integer
);
DROP TABLE IF EXISTS public.userdata;
DROP SEQUENCE IF EXISTS public.userdata_id_seq;
CREATE TABLE userdata (
id serial NOT NULL,
user_name text,
password text,
registration_date timestamp without time zone,
unique (user_name)
);
DROP TABLE IF EXISTS public.question_tag;
CREATE TABLE question_tag (
question_id integer NOT NULL,
tag_id integer NOT NULL
);
DROP TABLE IF EXISTS public.tag;
DROP SEQUENCE IF EXISTS public.tag_id_seq;
CREATE TABLE tag (
id serial NOT NULL,
name text,
unique (name)
);
ALTER TABLE ONLY userdata
ADD CONSTRAINT pk_userdata_id PRIMARY KEY (id);
ALTER TABLE ONLY comment
ADD CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES userdata(id);
ALTER TABLE ONLY answer
ADD CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES userdata(id);
ALTER TABLE ONLY question
ADD CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES userdata(id);
ALTER TABLE ONLY answer
ADD CONSTRAINT pk_answer_id PRIMARY KEY (id);
ALTER TABLE ONLY comment
ADD CONSTRAINT pk_comment_id PRIMARY KEY (id);
ALTER TABLE ONLY question
ADD CONSTRAINT pk_question_id PRIMARY KEY (id);
ALTER TABLE ONLY question_tag
ADD CONSTRAINT pk_question_tag_id PRIMARY KEY (question_id, tag_id);
ALTER TABLE ONLY tag
ADD CONSTRAINT pk_tag_id PRIMARY KEY (id);
ALTER TABLE ONLY comment
ADD CONSTRAINT fk_answer_id FOREIGN KEY (answer_id) REFERENCES answer(id) ON DELETE CASCADE;
ALTER TABLE ONLY answer
ADD CONSTRAINT fk_question_id FOREIGN KEY (question_id) REFERENCES question(id) ON DELETE CASCADE;
ALTER TABLE ONLY question_tag
ADD CONSTRAINT fk_question_id FOREIGN KEY (question_id) REFERENCES question(id) ON DELETE CASCADE;
ALTER TABLE ONLY comment
ADD CONSTRAINT fk_question_id FOREIGN KEY (question_id) REFERENCES question(id) ON DELETE CASCADE;
ALTER TABLE ONLY question_tag
ADD CONSTRAINT fk_tag_id FOREIGN KEY (tag_id) REFERENCES tag(id);
INSERT INTO userdata VALUES (1,'admin','$2b$12$RPuFU0GJX7lT.H.xWWsFd.DqDCkk2yN2.mgEoNddyoilN0FI.eU6q','0001-01-01 12:00:00');
INSERT INTO userdata VALUES (2,'alexadmin','$2b$12$SPYguIxuNd0XOHeAS/Q3FOA/hiIvjMvF.ye1x7DItWYZEYqYXhqFG','1994-09-26 08:30:15');
INSERT INTO userdata VALUES (3,'markadmin','$2b$12$4Q7C46iPJnOHj81ohppq2eKGVEn70GAXqUYWDQIsSY0gbn3PpDlUO','1998-01-14 20:38:53');
INSERT INTO userdata VALUES (4,'akosadmin','$2b$12$i0VnCZuf.yOt7IsMVTqhAu.EQH1aYAvgw/sZfWPZz8yEwN3NcJn2G','1994-04-16 13:42:41');
INSERT INTO userdata VALUES (5,'zoliadmin','$2b$12$pSiCtGgef.dZbBSdn4mGAOwIHWPLKATsu7vA592cw4CEIZhpBMrqW','1980-02-02 12:00:00');
SELECT pg_catalog.setval('userdata_id_seq', 5, true);
INSERT INTO question VALUES (0, '2019-05-16 08:29:41', 8, 123, 'Fusion M8s, Assemble!', 'Let me introduce you the team!', 'https://upload.wikimedia.org/wikipedia/commons/9/9a/M8_autopalya.png', 1);
INSERT INTO question VALUES (1, '2019-05-13 16:50:24', 15, 9, 'Git Workflow', 'The image is small, huh? Well, let''s see what can we do about it... ', 'http://www.kepfeltoltes.eu/images/2019/03/925Screenshot_from_2019_0.png',2);
INSERT INTO question VALUES (2, '2019-05-14 10:41:53', 22, 16, 'Used Technologies', 'Since JavaScript was still brand new for us, we barely used it. However we used some stuff we were familiar with:', 'https://www.justprotools.com.au/assets/full/559.jpg', 3);
INSERT INTO question VALUES (3, '2019-05-15 08:29:13', 14, 6, 'Hello Trello!', 'We used Trello. We felt like we could have used a more advanced project tracking application this is why we choose Trello.', 'https://upload.wikimedia.org/wikipedia/commons/a/a5/Trello_logo.png', 4);
INSERT INTO question VALUES (4, '2019-05-12 08:29:57', 11, 13, 'Challenges and difficulties', 'Every week has it''s challenges and this week is no exception. Let''s hear M8s, what was the biggest challenge for you? Also... is that a depression tag? Do we really need that? Please remove it for the demo!', 'https://www.cardmakingcircle.co.uk/images/challenges.jpg', 1);
INSERT INTO question VALUES (5, '2019-05-12 07:29:57', 5, 7, 'Future Plans', 'The week is over, but there is a long road ahead of us. What are your plans for next TW week?', 'https://thedailybird.org/wp-content/uploads/2019/02/download.jpg', 1);
SELECT pg_catalog.setval('question_id_seq', 5, true);
INSERT INTO answer VALUES (1, '2019-05-14 16:49:14', 8, 0, 'List your name here fast and let''s get this going!',null, 1);
INSERT INTO answer VALUES (2, '2019-05-14 14:42:54', -4, 0, 'Sorry m8s, I gotta go :(', 'https://www.thestampmaker.com/stock_rubber_stamp_images/SSS2_SAD_FACE.jpg',5);
INSERT INTO answer VALUES (3, '2019-05-15 16:49:12', 2, 1, 'Thank god we only took a few User Stories!',null, 4);
INSERT INTO answer VALUES (4, '2019-05-15 16:49:43', 4, 3, 'We finished with 7300/5700.','https://fowmedia.com/wp-content/uploads/2014/08/win-1024x1024.jpg', 4);
INSERT INTO answer VALUES (5, '2019-05-15 16:48:28', 3, 3, 'Also we did some extras: stabilized the website (caught all known errors with excepts), handled invalid links! Also handled all previous SQL deletes with DELETE ON CASCADE.',null, 4);
INSERT INTO answer VALUES (6, '2019-05-15 16:48:49', 2, 2, 'Git','http://ipengineer.net/wp-content/uploads/2015/04/git-logo.jpg?w=640', 3);
INSERT INTO answer VALUES (7, '2019-05-15 16:48:54', 5, 2, 'JavaScript','https://www.w3schools.com/whatis/img_js.png', 3);
INSERT INTO answer VALUES (8, '2019-05-15 16:48:12', 2, 2, 'Python','https://pluralsight.imgix.net/paths/python-7be70baaac.png', 3);
INSERT INTO answer VALUES (9, '2019-05-15 16:48:58', 3, 2, 'Jinja','https://quintagroup.com/cms/python/images/jinja2.png/@@images/919c2c3d-5b4e-4650-943a-b0df263f851b.png', 3);
INSERT INTO answer VALUES (10, '2019-05-15 16:48:12', 6, 2, 'CSS','https://pluralsight.imgix.net/paths/path-icons/css-c9b214f0d7.png', 3);
INSERT INTO answer VALUES (11, '2019-05-15 16:48:54', 3, 2, 'HTML','https://upload.wikimedia.org/wikipedia/commons/thumb/6/61/HTML5_logo_and_wordmark.svg/1200px-HTML5_logo_and_wordmark.svg.png', 3);
INSERT INTO answer VALUES (12, '2019-05-15 16:48:21', 6, 4, 'For the tags: implementing 2 forms in one html to a feature... it was annoying.',NULL, 4);
INSERT INTO answer VALUES (13, '2019-05-15 16:48:32', 4, 4, 'Handling errors, and designing/making the database was a pain in the a**. But the hardest was probably creating the registration - login. Fortunately i wan''t alone in that.',NULL, 2);
INSERT INTO answer VALUES (14, '2019-05-15 16:48:38', 7, 4, 'Trying JavaScript for the first time, in the last minute. Handling all errors was challenging and an interesting task.',NULL, 3);
INSERT INTO answer VALUES (15, '2019-05-15 16:48:38', 3, 5, 'Mastering JS and deepening SQL.',NULL, 4);
INSERT INTO answer VALUES (16, '2019-05-15 16:42:38', 3, 5, 'When learning next week, allocating at least 2-3 hours a day to study. For TW week I would like to practice as much JS as possible.',NULL, 3);
INSERT INTO answer VALUES (17, '2019-05-15 16:32:38', 3, 5, 'Definitely JavaScript and some proper CSS. Both are something I''m really not comfortable with.',NULL, 2);
SELECT pg_catalog.setval('answer_id_seq', 17, true);
INSERT INTO comment VALUES (1, NULL, 1, 'Hey it''s me Alex!', '2019-05-15 16:21:13', NULL, 2);
INSERT INTO comment VALUES (2, NULL, 1, 'Mark ready for duty!', '2019-05-15 16:32:41', NULL, 3);
INSERT INTO comment VALUES (3, NULL, 1, 'Hey folks, Ákos here!', '2019-05-15 16:43:22', NULL, 4);
INSERT INTO comment VALUES (4, NULL, 1, 'Zoli here!', '2019-05-13 10:51:53', NULL, 5);
INSERT INTO comment VALUES (5, NULL, 2, ':(', '2019-05-14 16:51:32', NULL, 2);
INSERT INTO comment VALUES (6, 1, NULL, 'Branches helped us a lot, they made merges so much simpler! We divided the tasks and made them all by wednesday, we even had time for extras and memes.', '2019-05-15 16:55:43', 1, 2);
INSERT INTO comment VALUES (7, NULL, 4, 'Accepted User Stories were: ' ||
'user registration - 1000 | ' ||
'user login - 1000 | ' ||
'bind questions to user - 700 | ' ||
'bind answers to user - 700 | ' ||
'tag page - 600 | ' ||
'user page - 900 | ' ||
'list users - 800 | ', '2019-05-15 16:55:59', NULL, 4);
INSERT INTO comment VALUES (8, NULL, 4, 'Extra User Stories were: ' ||
'bind the comment to user - 300 (600/2) | ' ||
'delete comments - 400 (800/2) | ' ||
'edit answer - 500 (1000/2) | ' ||
'edit comments - 400 (800/2) | ', '2019-05-15 16:54:12', NULL, 4);
INSERT INTO comment VALUES (9, NULL, 11, 'It is still fun, and because of Jinja it can be challenging.', '2017-05-02 16:55:00', NULL, 3);
INSERT INTO comment VALUES (10, NULL, 10, 'We decided to roll with last week''s CSS, added some minor tweeks.', '2017-05-02 16:55:00', NULL, 3);
INSERT INTO comment VALUES (11, NULL, 9, 'It was a deep dive. This week we used it to hide unwanted HTML blocks, like empty tables.', '2017-05-02 16:55:00', NULL, 2);
INSERT INTO comment VALUES (12, NULL, 8, 'Oh sweet Python! <3', '2017-05-02 16:55:00', NULL, 2);
INSERT INTO comment VALUES (13, NULL, 7, 'Unfamiliar, but powerful. We all are looking forward to master it!', '2017-05-02 16:55:00', NULL, 3);
INSERT INTO comment VALUES (14, NULL, 6, 'Branching was strange first, but we learned to love it fast.', '2017-05-02 16:55:00', NULL, 3);
INSERT INTO comment VALUES (15, NULL, 12, 'That part was confusing... but you solved it in the end!', '2017-05-02 16:55:00', NULL, 3);
INSERT INTO comment VALUES (16, NULL, 13, 'Yeah that wasn''t an easy one but we did it! :)', '2019-05-10 16:55:00', NULL, 3);
INSERT INTO comment VALUES (17, NULL, 14, 'But you rocked at it and made this whole demo possible (small pictures are big no-no) <3', '2019-05-11 16:55:11', NULL, 2);
INSERT INTO comment VALUES (18, NULL, 14, 'It was a glorious fight!', '2017-05-02 16:55:53', NULL, 4);
SELECT pg_catalog.setval('comment_id_seq', 18, true);
INSERT INTO tag VALUES (1, 'demo');
INSERT INTO tag VALUES (2, 'sql');
INSERT INTO tag VALUES (3, 'git');
INSERT INTO tag VALUES (4, 'trello');
INSERT INTO tag VALUES (5, 'tools');
INSERT INTO tag VALUES (6, 'challenge');
INSERT INTO tag VALUES (7, 'depression');
INSERT INTO tag VALUES (8, 'rest');
INSERT INTO tag VALUES (9, 'TGF');
SELECT pg_catalog.setval('tag_id_seq', 9, true);
INSERT INTO question_tag VALUES (0, 1);
INSERT INTO question_tag VALUES (1, 1);
INSERT INTO question_tag VALUES (1, 3);
INSERT INTO question_tag VALUES (2, 1);
INSERT INTO question_tag VALUES (2, 5);
INSERT INTO question_tag VALUES (3, 1);
INSERT INTO question_tag VALUES (3, 4);
INSERT INTO question_tag VALUES (3, 2);
INSERT INTO question_tag VALUES (4, 1);
INSERT INTO question_tag VALUES (4, 6);
INSERT INTO question_tag VALUES (4, 7);
INSERT INTO question_tag VALUES (5, 1);
INSERT INTO question_tag VALUES (5, 8);
INSERT INTO question_tag VALUES (5, 9);
| true
|
db0fa9a9625e74f64a7d7498da0683cba9a99f15
|
SQL
|
Magomedali/bitrix_chat
|
/social.chat/install/db/mysql/exists_new_msg.sql
|
UTF-8
| 230
| 2.828125
| 3
|
[] |
no_license
|
create function exists_new_msg (p_id int,p_msg int)
RETURNS int
DETERMINISTIC
BEGIN
declare v_c int default 0;
SELECT COUNT(1) INTO v_c FROM `ali_social_messages` WHERE `TOPIC_ID` = p_id AND `ID` > p_msg;
return v_c;
END;
| true
|
ea9b18e47bc2bf6f59beeba00f0e89ff27f14c0e
|
SQL
|
lizouzt/saas
|
/data/sql/postgres/inventory/tables/locations.sql
|
UTF-8
| 1,051
| 3.890625
| 4
|
[] |
no_license
|
/**
* locations table
*/
create table if not exists locations (
id uuid not null,
active boolean not null default false,
created_ts timestamp without time zone not null default(now() at time zone 'utc'),
client_id uuid not null,
facility_id uuid not null,
name varchar(100) not null,
floor_id varchar(100),
aisle_id varchar(100),
area_id varchar(100),
section_id varchar(100),
shelf_id varchar(100),
rack_id varchar(100),
level_id varchar(100),
bin_id varchar(100),
constraint pk_locations primary key (client_id, id),
constraint u_locations_1 unique (client_id, facility_id, floor_id, aisle_id, shelf_id, rack_id, level_id, bin_id),
constraint u_locations_2 unique (client_id, name),
constraint fk_locations_1 foreign key (client_id)
references clients.clients (id) on delete restrict on update restrict,
constraint fk_locations_2 foreign key (client_id, facility_id)
references inventory.facilities (client_id, id) on delete restrict on update restrict
);
| true
|
2e566ea16e1c96c27d06daf9c2a6d69b1e83e522
|
SQL
|
tcjwj2008/K3SystemCollection
|
/现金流量表.sql
|
UTF-8
| 2,956
| 3.1875
| 3
|
[] |
no_license
|
select c.* from ( select v.FVoucherID,v.FDate,Convert(VarChar,FYear) + '.' + Convert(VarChar,FPeriod) FPeriod1,g.FName + '-' + Convert(VarChar,v.FNumber) FNumber,e.FExplanation,e.FEntryID, a.FNumber FAcctNumber, a.FFullName FAcctName,e.FDC, e.FAmountFor,e.FAmount,e.FDetailID, c.FItemID, c.FSubItemID,r.FName FCurrency, case when c.FItemID <=0 and c.FSubitemID <=0 then null else c.FAmount end FCashAmount, c.FCashNumber + c.FCashName FCashItem,c.FCashSubNumber + c.FCashSubName FCashSubItem from t_voucherentry e left join (select t.FVoucherID,t.FEntryID, t.FItemID, t.FSubItemID,i.FNumber FCashNumber,i.FName FCashName,i1.FNumber FCashSubNumber,i1.FName FCashSubName,t.FAmount,t.FCurrencyID from t_cashflowbal t left join t_item i on t.FItemID=i.FItemID and i.FItemID <> 0 left join t_item i1 on t.FSubItemID=i1.FItemID and i1.FItemID <> 0,(Select
FBrNo,FvoucherID,FDate,FYear,FPeriod,
FGroupID,FNumber,FReference,FExplanation,FAttachments,
FEntryCount,FDebitTotal,FCreditTotal,FInternalInd,FChecked,
FPosted,FPreparerID,FCheckerID,FPosterID,FCashierID,
FHandler,FOwnerGroupID,FObjectName,FParameter,FSerialNum,
FTranType,FTransDate,FFrameWorkID,FApproveID,FFootNote,
UUID , FMODIFYTIME
From t_Voucher
Union All
Select
FBrNo,FvoucherID,FDate,FYear,FPeriod,
FGroupID,FNumber,FReference,FExplanation,FAttachments,
FEntryCount,FDebitTotal,FCreditTotal,FInternalInd,FChecked,
FPosted,FPreparerID,FCheckerID,FPosterID,FCashierID,
FHandler,FOwnerGroupID,FObjectName,FParameter,FSerialNum,
FTranType,FTransDate,FFrameWorkID,FApproveID,FFootNote,
UUID , FMODIFYTIME
From t_VoucherAdjust) v where t.FVoucherID = v.FVoucherID and v.FYear*100+v.FPeriod>=201909 and v.FYear*100+v.FPeriod<=201909) c on e.FVoucherID=c.FVoucherID and e.FEntryID=c.FEntryID , t_account a ,(Select
FBrNo,FvoucherID,FDate,FYear,FPeriod,
FGroupID,FNumber,FReference,FExplanation,FAttachments,
FEntryCount,FDebitTotal,FCreditTotal,FInternalInd,FChecked,
FPosted,FPreparerID,FCheckerID,FPosterID,FCashierID,
FHandler,FOwnerGroupID,FObjectName,FParameter,FSerialNum,
FTranType,FTransDate,FFrameWorkID,FApproveID,FFootNote,
UUID , FMODIFYTIME
From t_Voucher
Union All
Select
FBrNo,FvoucherID,FDate,FYear,FPeriod,
FGroupID,FNumber,FReference,FExplanation,FAttachments,
FEntryCount,FDebitTotal,FCreditTotal,FInternalInd,FChecked,
FPosted,FPreparerID,FCheckerID,FPosterID,FCashierID,
FHandler,FOwnerGroupID,FObjectName,FParameter,FSerialNum,
FTranType,FTransDate,FFrameWorkID,FApproveID,FFootNote,
UUID , FMODIFYTIME
From t_VoucherAdjust) v, t_vouchergroup g ,t_currency r where v.FYear*100+v.FPeriod>=201909 and v.FYear*100+v.FPeriod<=201909 and e.FCurrencyID=1 and e.FVoucherID=v.FVoucherID and e.FAccountID = a.FAccountID and v.FGroupID=g.FGroupID and e.FCurrencyID=r.FCurrencyID ) as c
select distinct fnumber from #Cashflow1436199 where (fcashitem is not null or fcashsubitem is not null)order by fnumber
drop table #Cashflow1436199
| true
|
611ec1d2f9a8de6ce6dadebccc78b9859cc10893
|
SQL
|
ijwfly/simple_billing_assignment
|
/migrations/sql/init.sql
|
UTF-8
| 968
| 3.859375
| 4
|
[] |
no_license
|
CREATE SCHEMA billing;
CREATE TYPE billing.transaction_status AS ENUM ('registered', 'completed', 'declined', 'error');
CREATE TYPE billing.direction AS ENUM('credit', 'debit');
CREATE TABLE billing.transaction
(
id bigserial PRIMARY KEY,
operation_id text NOT NULL,
wallet_id bigint NOT NULL,
status billing.transaction_status NOT NULL DEFAULT 'registered',
direction billing.direction NOT NULL,
amount bigint NOT NULL DEFAULT 0,
cdate timestamp WITH TIME ZONE NOT NULL default NOW(),
response_code integer
);
CREATE INDEX wallet_id_idx ON billing.transaction using hash(wallet_id);
CREATE INDEX operation_id_idx ON billing.transaction using hash(operation_id);
CREATE INDEX cdate_idx ON billing.transaction using btree(cdate);
CREATE TABLE billing.wallet
(
id bigserial PRIMARY KEY,
balance bigint NOT NULL DEFAULT 0,
user_id bigint NOT NULL
);
CREATE UNIQUE INDEX user_id_idx ON billing.wallet USING btree(user_id);
| true
|
79f527df2e69546e40fca4d35c15385ac5300b8c
|
SQL
|
JecoLantern/Portfolio-JBA-v2.0
|
/models/schema.sql
|
UTF-8
| 394
| 2.734375
| 3
|
[] |
no_license
|
DROP DATABASE IF EXISTS portfoliodb;
CREATE DATABASE portfoliodb;
USE portfoliodb;
CREATE TABLE ContactDB (
id INT(10) AUTO_INCREMENT NOT NULL,
firstname VARCHAR(255),
lastname VARCHAR(255),
email VARCHAR(255),
message MEDIUMTEXT,
createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY(id)
);
DROP DATABASE IF EXISTS testdb;
CREATE DATABASE testdb;
| true
|
442be62d3b40550072d7251144782a62791f9b69
|
SQL
|
silence-do-good/stress-test-Postgres-and-MySQL
|
/dump/high/day26/select1407.sql
|
UTF-8
| 262
| 2.984375
| 3
|
[] |
no_license
|
SELECT sen.name
FROM SENSOR sen, SENSOR_TYPE st, COVERAGE_INFRASTRUCTURE ci
WHERE sen.SENSOR_TYPE_ID=st.id AND st.name='WeMo' AND sen.id=ci.SENSOR_ID AND ci.INFRASTRUCTURE_ID=ANY(array['5074','2100_8','2222','3243','2038','3052','4062','3099','6210','4212'])
| true
|
b9becfd8a76e3e1e62d553abb7c37cbc6c2236ef
|
SQL
|
VladCincean/Piscine-PHP
|
/day_05/ex11/ex11.sql
|
UTF-8
| 234
| 3.53125
| 4
|
[] |
no_license
|
SELECT UPPER(fp.nom) AS 'NOM', fp.prenom, ab.prix
FROM fiche_personne AS fp
INNER JOIN membre AS me
ON fp.id_perso = me.id_fiche_perso
INNER JOIN abonnement ab
ON me.id_abo = ab.id_abo
WHERE ab.prix > 42
ORDER BY nom ASC, prenom ASC;
| true
|
c0bd377b9bec891c9eb59202050883a98da93387
|
SQL
|
gmgj/Personal
|
/gjtest/getPhoneCode.sql
|
UTF-8
| 279
| 2.890625
| 3
|
[] |
no_license
|
/*
*/
DROP FUNCTION IF EXISTS getPhoneCode;
DELIMITER $$
CREATE FUNCTION getPhoneCode
(phone varchar(99))
RETURNS varchar(99)
DETERMINISTIC
SQL SECURITY DEFINER
BEGIN
IF (LENGTH(phone) < 11) THEN
RETURN ' ';
END IF;
return SUBSTRING(phone, 5);
END $$
DELIMITER;
| true
|
70a245f5922e3d9a67bcebd53b88ce71ba8f21e2
|
SQL
|
Pubuduboteju/Mini-java-project
|
/vehicle_details.sql
|
UTF-8
| 2,109
| 2.984375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: May 07, 2018 at 12:10 PM
-- Server version: 5.7.19
-- PHP Version: 7.0.23
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: `vehicle_details`
--
-- --------------------------------------------------------
--
-- Table structure for table `register`
--
DROP TABLE IF EXISTS `register`;
CREATE TABLE IF NOT EXISTS `register` (
`userId` int(100) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
PRIMARY KEY (`userId`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `register`
--
INSERT INTO `register` (`userId`, `name`, `username`, `password`) VALUES
(1, 'Pubudu', 'pubudu', '123'),
(2, 'Pubudu', 'username', '123'),
(3, 'Rav', 'RR', '123'),
(4, 'Raj', 'raj', '123'),
(5, 'Pppp', 'p', '123');
-- --------------------------------------------------------
--
-- Table structure for table `vehicles`
--
DROP TABLE IF EXISTS `vehicles`;
CREATE TABLE IF NOT EXISTS `vehicles` (
`vehId` int(100) NOT NULL AUTO_INCREMENT,
`make` varchar(100) NOT NULL,
`model` varchar(100) NOT NULL,
`vehNumber` varchar(100) NOT NULL,
PRIMARY KEY (`vehId`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `vehicles`
--
INSERT INTO `vehicles` (`vehId`, `make`, `model`, `vehNumber`) VALUES
(1, 'Toyota', 'Axio', 'KP-1000'),
(2, 'Benz', 'E-Class', 'CAP-1010'),
(3, 'BMW', '520d', 'CAC-8888'),
(4, 'Tesla', 'Model S', 'CAA- 3030');
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
|
b970b4f7a2f0b5430a5fed943ec9f423a648bffd
|
SQL
|
BrunoCarvalho18/postgres-estudos
|
/sequencias.sql
|
UTF-8
| 625
| 3.46875
| 3
|
[] |
no_license
|
CREATE SEQUENCE eu_criei;
SELECT NEXTVAL('eu_criei');
CREATE TEMPORARY TABLE auto(
id INTEGER PRIMARY KEY DEFAULT NEXTVAL('eu_criei'),
nome VARCHAR(30) NOT NULL
);
DROP TABLE auto;
INSERT INTO auto(nome) VALUES('Bruno Carvalho');
INSERT INTO auto(id,nome) VALUES('Bruno Carvalho');
INSERT INTO auto(nome) VALUES('Outro nome');
SELECT * FROM auto;
CREATE TYPE CLASSIFICACAO AS ENUM('Livre','12_ANOS','14_ANOS','16_ANOS','18_ANOS')
CREATE TEMPORARY TABLE filme(
id SERIAL PRIMARY KEY,
nome VARCHAR(255) NOT NULL,
classificacao CLASSIFICACAO
);
INSERT INTO filme(nome,classificacao) VALUES('Bruno','Livre');
SELECT * FROM filme;
| true
|
341bedf6ca5b713cd58764e0c0c321b45c68efeb
|
SQL
|
MRIDULA-S/SQL
|
/update and delete.sql
|
UTF-8
| 547
| 3.34375
| 3
|
[] |
no_license
|
create database office;
use office;
create table employee
(
ID int NOT NULL auto_increment,
name varchar(20) NOT NULL,
age int NOT NULL,
address varchar(20) NOT NULL,
salary int NOT NULL,
primary key(ID)
);
insert into employee (name,age,address,salary) values ('Ramesh',32,'Ahmedabad',2000),
('Khilan',25,'Delhi',1500),
('kaushik',23,'Kota',2000),
('Chaitali',25,'Mumbai',6500),
('Hardik',27,'Bhopal',8500),
('Komal',22,'MP',4500),
('Muffy',24,'Indore',10000);
UPDATE employee SET address='MAHARASTRA' where name='Komal';
select * from employee;
| true
|
a859711dc72368d0d935111cbae92c36fe3b9d13
|
SQL
|
Lambert6/BYSJHL
|
/build/classes/zhangqq009.sql
|
UTF-8
| 10,213
| 3.234375
| 3
|
[] |
no_license
|
/*
Navicat MySQL Data Transfer
Source Server : zhangqiqi
Source Server Version : 50536
Source Host : localhost:3306
Source Database : zhangqq009
Target Server Type : MYSQL
Target Server Version : 50536
File Encoding : 65001
Date: 2017-11-06 13:49:24
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for assistance
-- ----------------------------
DROP TABLE IF EXISTS `assistance`;
CREATE TABLE `assistance` (
`a_id` int(11) NOT NULL AUTO_INCREMENT,
`a_name` varchar(255) DEFAULT NULL,
`a_sex` varchar(255) DEFAULT NULL,
`a_age` varchar(255) DEFAULT NULL,
`a_email` varchar(255) DEFAULT NULL,
`a_phone` varchar(255) DEFAULT NULL,
`a_address` varchar(255) DEFAULT NULL,
`a_nation` varchar(255) DEFAULT NULL,
`a_qq` varchar(255) DEFAULT NULL,
`a_dept` varchar(255) DEFAULT NULL,
`a_duty` varchar(255) DEFAULT NULL,
`a_salary` varchar(255) DEFAULT NULL,
`a_card` varchar(255) DEFAULT NULL,
`a_school` varchar(255) DEFAULT NULL,
`a_project` varchar(255) DEFAULT NULL,
PRIMARY KEY (`a_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of assistance
-- ----------------------------
INSERT INTO `assistance` VALUES ('3', '121312', '男', '12313', null, null, null, null, null, '销售部', '经理', null, null, null, null);
-- ----------------------------
-- Table structure for common
-- ----------------------------
DROP TABLE IF EXISTS `common`;
CREATE TABLE `common` (
`c_id` int(11) NOT NULL AUTO_INCREMENT,
`c_name` varchar(255) DEFAULT NULL,
`c_age` varchar(255) DEFAULT NULL,
`c_sex` varchar(255) DEFAULT NULL,
`c_email` varchar(255) DEFAULT NULL,
`c_phone` varchar(255) DEFAULT NULL,
`c_address` varchar(255) DEFAULT NULL,
`c_nation` varchar(255) DEFAULT NULL,
`c_qq` varchar(255) DEFAULT NULL,
`c_dept` varchar(255) DEFAULT NULL,
`c_duty` varchar(255) DEFAULT NULL,
`c_salary` varchar(255) DEFAULT NULL,
`c_card` varchar(255) DEFAULT NULL,
`c_bank` varchar(255) DEFAULT NULL,
`c_bankid` varchar(255) DEFAULT NULL,
`s_id` int(11) DEFAULT NULL,
PRIMARY KEY (`c_id`),
KEY `asd` (`s_id`),
CONSTRAINT `asd` FOREIGN KEY (`s_id`) REFERENCES `salary` (`s_id`)
) ENGINE=InnoDB AUTO_INCREMENT=245 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of common
-- ----------------------------
INSERT INTO `common` VALUES ('2', 'Jerry', '22', '女', '2321@asdas', '64655313', '加州', '美', '123123', '销售部', '经理', '2000', '312312', '中行', '3123123', '1');
INSERT INTO `common` VALUES ('17', '张三', '20', '女', '44555', '13524698654', '天津市西青区姚村', '汉', '656292855', '销售部', '经理', '2500', '412728156980563333', '中行', '6217000061236325887', null);
INSERT INTO `common` VALUES ('18', '鸭梨', '22', '女', '5656@qq.com', '12365498710', '中国台湾 高雄市', '汉族', '8989565623', '销售部', '经理', '6500', '412728895632142', '中行', '6217000061116598745', null);
INSERT INTO `common` VALUES ('227', '琦琦', '22', '男', '656@qq.com', '13116183366', '河南省周口市', '汉族', '6562928112', '行政部', '主管', '11220', '412728199506168877', '建行', '6217000065559874665', null);
INSERT INTO `common` VALUES ('228', '李cg', '23', '男', '9898@qq.com', '15698452145', '宁夏回族自治区银川市', '回族', '56987456', '研发部', '主管', '5600', '123456987456321', '中行', '123123123123', null);
INSERT INTO `common` VALUES ('229', '徐yk', '23', '男', '6565@qq.com', '13115186542', '河北省雄安新区', '汉族', '9895641223', '行政部', '主管', '6000', '123123123123123', '中行', '234353545454', null);
INSERT INTO `common` VALUES ('230', '白zp', '24', '男', '1007@qq.com', '6565987432', '河南省新乡市', '汉族', '12321312312', '财务部', '主管', '3123', '412765313213138', '中行', '234423435435543543', null);
INSERT INTO `common` VALUES ('231', '张y', '23', '男', '656233@qq.com', '12312', '天津市南开区', '汉族', '312312', '研发部', '主管', '123213', '124234234324324', '中行', '2342342453454', null);
INSERT INTO `common` VALUES ('233', '宋J', '22', '女', '6983@qq.com', '139864133', '山东省青岛市', '汉族', '98654123', '行政部', '主管', '6000', '412728165489782354', '中行', '1231231231231231', null);
INSERT INTO `common` VALUES ('234', '2', '2', '男', '2', null, null, '2', null, '销售部', '经理', null, null, '中行', null, null);
INSERT INTO `common` VALUES ('235', '2', '3', '女', '3', null, null, null, null, '销售部', '经理', null, null, '中行', null, null);
INSERT INTO `common` VALUES ('236', '3', '3', '男', '3', null, null, null, null, '销售部', '经理', null, null, '中行', null, null);
INSERT INTO `common` VALUES ('240', 'tom', '20', '女', '1007@qq.com', '12345678910', '天津市西情绪', '汉族', '651023', '研发部', '主管', '5600', '123213123123123', '农行', '1321231313', null);
INSERT INTO `common` VALUES ('241', '李四', '232', '女', '2323', '123123', '1231', '1321312', '123', '销售部', '经理', '1321', '131', '中行', '1321', null);
INSERT INTO `common` VALUES ('242', '白泽鹏', '123', '女', '123', '132', '123', '2131', '13', '销售部', '经理', '123', '231', '中行', '123', null);
INSERT INTO `common` VALUES ('243', '请问', '12312', '女', '123123', null, null, null, null, '销售部', '经理', null, null, '中行', null, null);
INSERT INTO `common` VALUES ('244', '蔷薇蔷薇', '123', '男', '1321', '1231', '132', '13231', '123', '销售部', '经理', null, null, '中行', null, null);
-- ----------------------------
-- Table structure for outsource
-- ----------------------------
DROP TABLE IF EXISTS `outsource`;
CREATE TABLE `outsource` (
`o_id` int(11) NOT NULL AUTO_INCREMENT,
`o_name` varchar(255) DEFAULT NULL,
`o_sex` varchar(255) DEFAULT NULL,
`o_age` varchar(255) DEFAULT NULL,
`o_email` varchar(255) DEFAULT NULL,
`o_phone` varchar(255) DEFAULT NULL,
`o_address` varchar(255) DEFAULT NULL,
`o_nation` varchar(255) DEFAULT NULL,
`o_qq` varchar(255) DEFAULT NULL,
`o_dept` varchar(255) DEFAULT NULL,
`o_duty` varchar(255) DEFAULT NULL,
`o_salary` varchar(255) DEFAULT NULL,
`o_card` varchar(255) DEFAULT NULL,
`o_buss` varchar(255) DEFAULT NULL,
`o_project` varchar(255) DEFAULT NULL,
PRIMARY KEY (`o_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3004 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of outsource
-- ----------------------------
INSERT INTO `outsource` VALUES ('3003', '3', '女', '3', '3', '3', '3', '3', '3', '研发部', '主管', '3', '3', '3', '3');
-- ----------------------------
-- Table structure for salary
-- ----------------------------
DROP TABLE IF EXISTS `salary`;
CREATE TABLE `salary` (
`s_id` int(11) DEFAULT NULL,
`s_base` varchar(255) DEFAULT NULL,
`s_addbase` varchar(255) DEFAULT NULL,
`s_traffic` varchar(255) DEFAULT NULL,
`s_phone` varchar(255) DEFAULT NULL,
`s_out` varchar(255) DEFAULT NULL,
`s_hos` varchar(255) DEFAULT NULL,
`s_job` varchar(255) DEFAULT NULL,
`s_house` varchar(255) DEFAULT NULL,
`c_id` int(11) DEFAULT NULL,
KEY `s_id` (`s_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of salary
-- ----------------------------
INSERT INTO `salary` VALUES ('1', '2', '2', '2', '2', '2', '2', '2', '2', null);
-- ----------------------------
-- Table structure for train
-- ----------------------------
DROP TABLE IF EXISTS `train`;
CREATE TABLE `train` (
`t_id` int(11) NOT NULL AUTO_INCREMENT,
`t_name` varchar(255) DEFAULT NULL,
`t_sex` varchar(255) DEFAULT NULL,
`t_age` varchar(255) DEFAULT NULL,
`t_email` varchar(255) DEFAULT NULL,
`t_phone` varchar(255) DEFAULT NULL,
`t_address` varchar(255) DEFAULT NULL,
`t_nation` varchar(255) DEFAULT NULL,
`t_qq` varchar(255) DEFAULT NULL,
`t_dept` varchar(255) DEFAULT NULL,
`t_duty` varchar(255) DEFAULT NULL,
`t_salary` varchar(10) DEFAULT NULL,
`t_card` varchar(255) DEFAULT NULL,
`t_bank` varchar(255) DEFAULT NULL,
`t_bankid` varchar(11) DEFAULT NULL,
PRIMARY KEY (`t_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2007 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of train
-- ----------------------------
INSERT INTO `train` VALUES ('2001', '222222222222222', '男', '1', '1', '1', '1', '1', '2', '销售部', '经理', '2', '2', '中行', '2');
INSERT INTO `train` VALUES ('2005', '1', '女', '1', '1', '1', '1', '1', '1', '研发部', '主管', '1', '1', '工行', '1');
INSERT INTO `train` VALUES ('2006', 'hucy', '男', '22', '1231@QQ', '13523456789', '天津市', '汉', '100721332', '销售部', '经理', '4111', '412728', '农行', '1');
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`password` varchar(255) DEFAULT NULL,
`mail` varchar(255) NOT NULL,
`position` varchar(255) NOT NULL,
`phone` varchar(255) NOT NULL,
`nickname` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=99925 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('77889', 'admin', '1234', '6562@qq.com', '管理员', '13116185698', 'QIQI');
INSERT INTO `user` VALUES ('99887', 'admin1', '222', '1107@qq.com', '管理员', '', '');
INSERT INTO `user` VALUES ('99888', 'zhangqq', 'happy', '5656@q.com', '人事专员', '', '');
INSERT INTO `user` VALUES ('99914', 'user1', '1234', '5555', '人事专员', '', '');
INSERT INTO `user` VALUES ('99916', 'qwe', '1234', '1007213323@qq.com', '人事专员', '', '');
INSERT INTO `user` VALUES ('99917', 'a6562928', '1234', '121321', 'null', '13116185566', '小志');
INSERT INTO `user` VALUES ('99923', 'user01', '1234', '656@qq.com', '管理员', '13112456987', 'aaa');
INSERT INTO `user` VALUES ('99924', 'user2', '1234', '65629@qq.com', 'null', '131256633', 'qiqi');
| true
|
0bfd162d823034e860880eb6b0cba8c1eba1c867
|
SQL
|
tesseract2048/machine
|
/machine-dao/src/main/resources/qunar.sql
|
UTF-8
| 5,250
| 3.375
| 3
|
[
"Apache-2.0"
] |
permissive
|
/*
Navicat MySQL Data Transfer
Source Server : 9localhost
Source Server Type : MySQL
Source Server Version : 50619
Source Host : localhost
Source Database : qunar
Target Server Type : MySQL
Target Server Version : 50619
File Encoding : utf-8
Date: 11/02/2015 00:50:42 AM
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `Machine`
-- ----------------------------
DROP TABLE IF EXISTS `Machine`;
CREATE TABLE `Machine` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`machine_print_mode` varchar(16) DEFAULT NULL,
`ip` varchar(64) DEFAULT NULL,
`province` varchar(16) DEFAULT NULL,
`city` varchar(64) DEFAULT NULL,
`station_info` varchar(64) DEFAULT NULL,
`login` tinyint(4) DEFAULT '0',
`group_number` tinyint(4) DEFAULT '0',
`ticket_mode` varchar(32) DEFAULT NULL,
`print_times` int(11) DEFAULT '0',
`suc_times` int(11) DEFAULT '0',
`failed_times` int(11) DEFAULT '0',
`scan_suc_times` int(11) DEFAULT '0',
`scan_failed_times` int(11) DEFAULT '0',
`paper_number` int(11) DEFAULT '0',
`paper_used` int(11) DEFAULT '0',
`user_id` varchar(64) DEFAULT NULL,
`version` varchar(32) DEFAULT NULL,
`pass_word` varchar(32) DEFAULT NULL,
`modify_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`create_time` timestamp NULL DEFAULT NULL,
`sync_time` datetime DEFAULT NULL,
`device_id` varchar(128) NOT NULL,
`sequence_number` int(11) NOT NULL,
`maintenance` int(11) DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `device_id` (`device_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `city`
-- ----------------------------
DROP TABLE IF EXISTS `city`;
CREATE TABLE `city` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`province` int(11) DEFAULT NULL,
`city_name` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for `identity_card`
-- ----------------------------
DROP TABLE IF EXISTS `identity_card`;
CREATE TABLE `identity_card` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`card_id` varchar(24) DEFAULT NULL COMMENT '身份证号',
`name` varchar(20) DEFAULT NULL COMMENT '姓名',
`nation` varchar(32) DEFAULT NULL COMMENT '民族',
`birth_date` datetime DEFAULT NULL COMMENT '出生日期',
`address` text COMMENT '地址',
`sex` tinyint(4) DEFAULT NULL COMMENT '性别',
`modify_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`create_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `identity_card_idx` (`card_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `machine_info`
-- ----------------------------
DROP TABLE IF EXISTS `machine_info`;
CREATE TABLE `machine_info` (
`id` int(11) NOT NULL,
`machine_id` bigint(20) DEFAULT NULL,
`print_mode` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for `province`
-- ----------------------------
DROP TABLE IF EXISTS `province`;
CREATE TABLE `province` (
`id` int(11) DEFAULT NULL,
`province` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for `station`
-- ----------------------------
DROP TABLE IF EXISTS `station`;
CREATE TABLE `station` (
`id` int(11) NOT NULL,
`station_name` varchar(30) DEFAULT NULL,
`city_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for `ticket_print_info`
-- ----------------------------
DROP TABLE IF EXISTS `ticket_print_info`;
CREATE TABLE `ticket_print_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ticket_id` varchar(128) NOT NULL,
`status` varchar(16) DEFAULT NULL,
`print_machine_id` varchar(32) DEFAULT NULL,
`modify_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`create_time` timestamp NULL DEFAULT NULL,
`print_id` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ticket_id_idx` (`ticket_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `shenzhen_ticket_info`;
CREATE TABLE `shenzhen_ticket_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ticket_number` varchar(64) DEFAULT NULL,
`line` varchar(128) DEFAULT NULL,
`take_place` varchar(64) DEFAULT NULL,
`destination` varchar(64) DEFAULT NULL,
`start_time` datetime,
`coach_type` varchar(32) DEFAULT NULL,
`seat_number` varchar(32) DEFAULT NULL,
`price` decimal(8,1),
`check_port_number` varchar(32) DEFAULT NULL,
`sell_ticket_place` varchar(32) DEFAULT NULL,
`coach_number` varchar(32) DEFAULT NULL,
`ticket_id` varchar(32) DEFAULT NULL,
`passenger_name` varchar(32) DEFAULT NULL,
`card_id` varchar(64) DEFAULT NULL,
`modify_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`create_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ticket_id_idx` (`ticket_number`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;
| true
|
fbdf077da02276250fb1dcc65abf34a9da052dcd
|
SQL
|
khansaawan/Indian-Premier-League-SQL-Queries
|
/IPL_Queries/IPL_28.sql
|
UTF-8
| 319
| 3.96875
| 4
|
[] |
no_license
|
-- Number of hosted matches season wise
SELECT
RANK() OVER ( ORDER BY Season.Season_Year ) As Season_Id,
Season.Season_Year ,
COUNT(*) As 'Hosted Matches'
FROM Match
INNER JOIN Season
ON Match.Season_Id = Season.Season_Id
GROUP BY GROUPING SETS ( Season.Season_Year , ())
ORDER BY Season_Id
| true
|
f5567f28cd61c54ae35634fdf6accfae16c45421
|
SQL
|
viniciusnascimento95/web_sistema_venda_simples_jsf
|
/web/Script banco/tecweb.sql
|
UTF-8
| 1,285
| 3.890625
| 4
|
[] |
no_license
|
create table cliente (
id serial not null,
nome varchar unique not null,
email varchar unique not null,
telefone varchar
);
select * from cliente;
create table fornecedor (
id serial not null,
nome varchar not null,
cnpj varchar not null,
email varchar not null,
telefone varchar not null,
endereco varchar not null
);
select * from fornecedor;
create table produto (
id serial not null,
nome varchar not null,
descricao varchar unique not null,
valor double precision not null,
modelo varchar not null,
quantidade integer not null,
fornecedor_id integer
);
SELECT * FROM produto;
drop table produto;
create table venda (
id serial not null,
cliente_id integer not null,
data_venda varchar not null,
valor_unitario decimal not null,
quantidade_unitaria integer
);
select * from venda;
create table detalhe_venda (
id serial not null,
venda_id integer not null,
produto_id integer not null,
valor_total double precision not null,
quantidade_total integer not null
);
select * from detalhe_venda;
--selec estoque
select p.id, p.descricao, (p.quantidade - dv.quantidade_total) as quantidade
from public.detalhe_venda as dv inner join public.produto p on p.id = dv.produto_id
where p.id = dv.produto_id;
| true
|
0dfe77c0aa8ab3c31556efd3e1279f5b2eb24e93
|
SQL
|
samshum90/GCU_MySQL
|
/top-level.sql
|
UTF-8
| 1,207
| 2.75
| 3
|
[] |
no_license
|
-- create database coursework;
use coursework;
select "1" as ``;
select "Inside script <top-level.sql>" as ``;
select "-----------------------------" as ``;
select "Switching the foreign keys ON/OFF" as ``;
--
-- If you have problems with legacy data in your database,
-- as a result of not cascading deletes in child tables,
-- then you can turn foreign_keys to OFF and call this script
-- a few times to ensure that your code drops tables appropiately.
-- Make sure to turn it ON again though to ensure your keys are
-- doing what they are there for.
--
-- Enable checks:
SET FOREIGN_KEY_CHECKS = 1;
SET GLOBAL local_infile = true;
--
select "2" as ``;
source create_suppliers.sql;
select "3" as ``;
source create_customers.sql;
select "4" as ``;
source create_customer_orders.sql;
select "5" as ``;
source create_products.sql;
select "6" as ``;
source create_customer_orders_products.sql;
select "7" as ``;
source load_suppliers_data.sql;
select "8" as ``;
source load_customers_data.sql;
select "9" as ``;
source load_customer_orders_data.sql
select "10" as ``;
source load_products_data.sql;
select "11" as ``;
source load_customer_orders_products_data.sql;
select "12" as ``;
source report.sql;
| true
|
e958d5c89452eb4493d792b8b5c034feb3db0974
|
SQL
|
madger/projektowanie_wspolbiezne
|
/projektowanie_wspolbiezne_db.sql
|
UTF-8
| 5,032
| 3.46875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Czas wygenerowania: 30 Kwi 2014, 01:47
-- Wersja serwera: 5.6.12-log
-- Wersja PHP: 5.4.12
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 */;
--
-- Baza danych: `projektowanie_wspolbiezne`
--
CREATE DATABASE IF NOT EXISTS `projektowanie_wspolbiezne` DEFAULT CHARACTER SET utf8 COLLATE utf8_polish_ci;
USE `projektowanie_wspolbiezne`;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `departaments`
--
CREATE TABLE IF NOT EXISTS `departaments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) CHARACTER SET utf16 COLLATE utf16_polish_ci NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=5 ;
--
-- Zrzut danych tabeli `departaments`
--
INSERT INTO `departaments` (`id`, `name`, `created`) VALUES
(1, 'Dział projektów', '2014-04-29 21:47:23'),
(2, 'Dział wdrożeń', '2014-04-29 21:47:37'),
(3, 'Dział produkcji', '2014-04-29 21:47:54'),
(4, 'Dział testów', '2014-04-29 21:48:03');
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `tasks`
--
CREATE TABLE IF NOT EXISTS `tasks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`departament_id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_polish_ci NOT NULL,
`description` varchar(200) COLLATE utf8_polish_ci NOT NULL,
`status` int(11) NOT NULL DEFAULT '1',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=12 ;
--
-- Zrzut danych tabeli `tasks`
--
INSERT INTO `tasks` (`id`, `user_id`, `departament_id`, `name`, `description`, `status`, `created`) VALUES
(1, 1, 1, 'Zadanie 1', 'Zaprojektowanie kubka', 5, '2014-04-29 22:25:31'),
(2, 1, 1, 'Podzadanie 1.1', 'Zaprojektowanie obudowy', 5, '2014-04-29 23:00:55'),
(3, 1, 1, 'Podzadanie 1.2', 'Zaprojektowanie uchwytu', 5, '2014-04-29 23:01:10'),
(5, 1, 1, 'Zadanie 2', 'Zaprojektowanie linii produkcyjnej', 4, '2014-04-29 23:33:41'),
(6, 1, 2, 'Zadanie 3', 'Wdrożenie linii produkcyjnej', 3, '2014-04-29 23:39:32'),
(7, 1, 3, 'Zadanie 4', 'Produkcja kubka', 2, '2014-04-29 23:49:29'),
(8, 1, 3, 'Podzadanie 4.1', 'Produkcja obudowy', 2, '2014-04-29 23:49:59'),
(9, 1, 3, 'Podzadanie 4.2', 'Produkcja i przytwierdzenie dna', 2, '2014-04-29 23:50:27'),
(10, 1, 3, 'Podzadanie 4.3', 'Produkcja i przytwierdzenie uchytu', 2, '2014-04-29 23:50:46'),
(11, 1, 4, 'Zadanie 5', 'Przetestowanie produktu', 1, '2014-04-29 23:55:16');
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `tasks_dependent_tasks`
--
CREATE TABLE IF NOT EXISTS `tasks_dependent_tasks` (
`task_id` int(11) NOT NULL,
`dependent_task_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
--
-- Zrzut danych tabeli `tasks_dependent_tasks`
--
INSERT INTO `tasks_dependent_tasks` (`task_id`, `dependent_task_id`) VALUES
(1, 5),
(5, 6),
(6, 7),
(8, 9),
(8, 10),
(7, 11);
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `tasks_subtasks`
--
CREATE TABLE IF NOT EXISTS `tasks_subtasks` (
`task_id` int(11) NOT NULL,
`subtask_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
--
-- Zrzut danych tabeli `tasks_subtasks`
--
INSERT INTO `tasks_subtasks` (`task_id`, `subtask_id`) VALUES
(1, 2),
(1, 3),
(1, 4),
(7, 8),
(7, 9),
(7, 10);
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(100) CHARACTER SET utf16 COLLATE utf16_polish_ci NOT NULL,
`password` varchar(100) CHARACTER SET utf16 COLLATE utf16_polish_ci NOT NULL,
`first_name` varchar(100) CHARACTER SET utf16 COLLATE utf16_polish_ci NOT NULL,
`last_name` varchar(100) CHARACTER SET utf16 COLLATE utf16_polish_ci NOT NULL,
`email` varchar(100) CHARACTER SET utf16 COLLATE utf16_polish_ci NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=2 ;
--
-- Zrzut danych tabeli `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `first_name`, `last_name`, `email`, `created`) VALUES
(1, 'corvus', 'pass', 'Maciej', 'Świątek', 'corvus.coelestis@gmail.com', '2014-04-29 21:14:15');
/*!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
|
68f7314f7f66a6f0efcccc44b0373519037607e6
|
SQL
|
AlenaTskh/Intellectual-Property-Infringement-Prediction-for-2021
|
/Advanced Data/HW4.sql
|
UTF-8
| 1,975
| 4.6875
| 5
|
[] |
no_license
|
use BI_Marathon_Alena;
Select * From product;
INSERT INTO product (product)
Values ('Facebook'),
('Instagram')
;
DELETE FROM product WHERE product_id in (3,4);
DELETE FROM product WHERE product_id in (5,6);
DELETE FROM product WHERE product_id in (7,8);
DELETE FROM product WHERE product_id in (9,10);
-- Finding Dublicates
-- 1
Select
date,
Count(*)
From temp_table
Group by date
Having Count(*) > 1;
-- 2
Select
product,
Count(*)
From product
Group by product
Having Count(*) > 1;
-- 3
WITH cte AS(
Select
product_id
,product
,ROW_NUMBER() OVER (
PARTITION BY
product
ORDER BY
product
) as row_num
From
product
)
SELECT *
FROM cte
WHERE row_num > 1
;
/* CASE WHEN queries
Add LOW MEDIUM AND HIGHT columns of copyright removal rate*/
SELECT
date
, CASE WHEN copyright_rr < 40 THEN copyright_rr END as 'LOW'
, CASE WHEN copyright_rr >=40 and copyright_rr < 80 THEN copyright_rr END as 'Medium'
, CASE WHEN copyright_rr >= 80 THEN copyright_rr END as 'HIGH'
FROM fact_removal_rate
;
/* NULLIF querie. Count in the copyright column how many not null falues */
SELECT * FROM fact_removal_rate;
SELECT COUNT(NULLIF(copyright_rr, 0)) as not_null FROM fact_removal_rate;
-- COALESCE querie. Relturn from product table the first not-null values
SELECT product_id, product, COALESCE(product, 'Facebook') as product_name
FROM product
;
-- DISTINCT querie. Return all unique dates in the temp_table
SELECT DISTINCT date
FROM temp_table;
-- LEAST/GREATEST querie. Create the colunm copyright_new where below 60 number should be equal 60. and higher the 72 should be equal 70.
SELECT *
FROM temp_table
Order by copyright_rr;
SELECT product, copyright_rr,
GREATEST(60, copyright_rr) copyright_new
FROM temp_table
Order by copyright_rr;
SELECT product, copyright_rr,
LEAST(72, copyright_rr) copyright_new
FROM temp_table
Order by copyright_rr DESC;
| true
|
ec8004e8fe3d12388e46d826758f2ef0f6cd2c0a
|
SQL
|
nathanmangrum/data
|
/Transaction-Products.sql
|
UTF-8
| 444
| 3.390625
| 3
|
[] |
no_license
|
CREATE TABLE transactionsProduct (
trans_id uuid NOT NULL,
product_id uuid NOT NULL,
quantity int NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone NOT NULL DEFAULT now(),
FOREIGN KEY (trans_id) REFERENCES transactions (id),
FOREIGN KEY (product_id) REFERENCES products (id),
CONSTRAINT transproduct_pkey PRIMARY KEY (trans_id, product_id)
) WITH (
OIDS=FALSE
);
| true
|
0d9c260659227ed7e6f179613b46ef07b2b2c938
|
SQL
|
gramundi/scripting
|
/sql/super_admin.sql
|
UTF-8
| 816
| 3.859375
| 4
|
[] |
no_license
|
--##Make a User Super Admin for all the Studies
set search_path to umgr;
--Clean Up the acces privileges fro the users
delete from user_role where user_id = (select user_id from users where user_name='giovanni.ramundi');
insert into user_role
(
select
(select user_id from users where user_name = 'giovanni.ramundi' LIMIT 1 ) as user_id,
study_id,1 as role_id from study WHERE is_active is true and study_name like 'PR%'
);
select user_name,role_name,study_name
from
users
inner join user_role using (user_id)
INNER JOIN study USING(study_id)
INNER JOIN role using(role_id)
where user_name like 'giovanni.ramundi'
select study_name,
(select user_id from users where user_name = 'giovanni.ramundi' LIMIT 1 ) as user_id,
study_id,1 as role_id from study
WHERE is_active is true
and study_name like 'PR%'
| true
|
2ac5c6c797140a4f27d68ac99318d896877d5a3a
|
SQL
|
jwmcconnell/alchemy-type-api
|
/postgres/seed/seed.sql
|
UTF-8
| 526
| 3
| 3
|
[] |
no_license
|
BEGIN TRANSACTION;
INSERT into users (name, email, joined)
values ('john', 'john@gmail.com', '2018-01-01');
INSERT into login (hash, email)
values ('$2a$10$0umiOSkXu//nmGjZxQZr9OEix8a89OjRRLA/PCFZJbOpN/juGpkAu', 'john@gmail.com');
INSERT into stats (user_id, passages, avg_wpm, avg_errors)
values ('1', '0', '0', '0');
INSERT into passages (title, content, description, created)
values ('Javascript Functions', 'This is a test passage.'||E'\n'||'This is a second line.', 'Practice typing Javascript functions!', '2018-01-01');
COMMIT;
| true
|
fba48013db03f5e478f3903cc64d70700051999a
|
SQL
|
davejlong/budget_tracker_demo
|
/db/data.sql
|
UTF-8
| 1,682
| 2.6875
| 3
|
[] |
no_license
|
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
--
-- Data for Name: budgets; Type: TABLE DATA; Schema: public; Owner: davejlong
--
COPY budgets (id, start_on, amount, created_at, updated_at) FROM stdin;
1 2014-07-01 100 2014-07-21 16:56:13.975976 2014-07-21 16:56:13.975976
2 2014-08-01 125 2014-07-21 16:56:22.901078 2014-07-21 16:56:22.901078
\.
--
-- Name: budgets_id_seq; Type: SEQUENCE SET; Schema: public; Owner: davejlong
--
SELECT pg_catalog.setval('budgets_id_seq', 2, true);
--
-- Data for Name: expenditures; Type: TABLE DATA; Schema: public; Owner: davejlong
--
COPY expenditures (id, spent_on, amount, description, created_at, updated_at) FROM stdin;
1 2014-07-21 25 Ruby on Rails book 2014-07-21 16:58:16.914894 2014-07-21 16:58:16.914894
2 2014-07-23 50 Dinner 2014-07-21 16:58:28.399698 2014-07-21 16:58:28.399698
3 2014-07-27 30 Gas 2014-07-21 16:58:43.49056 2014-07-21 16:58:43.49056
4 2014-08-21 125 Really good bottle of whiskey 2014-07-21 16:59:01.855508 2014-07-21 16:59:01.855508
5 2014-08-23 50 Client lunch 2014-07-21 16:59:23.245555 2014-07-21 16:59:23.245555
\.
--
-- Name: expenditures_id_seq; Type: SEQUENCE SET; Schema: public; Owner: davejlong
--
SELECT pg_catalog.setval('expenditures_id_seq', 5, true);
--
-- Data for Name: schema_migrations; Type: TABLE DATA; Schema: public; Owner: davejlong
--
COPY schema_migrations (version) FROM stdin;
20140721165035
20140721165113
\.
--
-- PostgreSQL database dump complete
--
| true
|
3495e753fe3c6d37d1f63acba8781798e40f989e
|
SQL
|
SeulkiDo/SemiProject
|
/SemiProject.sql
|
UTF-8
| 2,817
| 3.40625
| 3
|
[] |
no_license
|
create user semi identified by semi;
grant connect, resource to semi;
commit;
--------------------------------------------------------------------------------
create table members(
m_email varchar(30) primary key,
m_pw varchar(100),
m_name varchar(20) not null,
m_phone varchar(20),
m_zipcode varchar(20),
m_address1 varchar(100),
m_address2 varchar(100),
m_joindate timestamp default sysdate not null,
m_ipaddress varchar(20) not null,
m_admin char(1) check(m_admin in('y', 'n'))
);
--drop table members;
select * from members;
select m_name, m_email, m_phone from members where m_email='junhaeyong95@naver.com';
commit;
--------------------------------------------------------------------------------
create table board(
b_no number primary key,
b_title varchar(100) not null,
b_email varchar(30) not null,
b_writer varchar(20) not null,
b_amount number not null,
b_bank varchar(20) not null,
b_account varchar(30) not null,
b_due_date timestamp not null,
b_contents long not null,
b_viewcount number default 0,
b_writedate timestamp default sysdate not null,
b_recommend number default 0 not null,
b_sum_amount number default 0
);
--drop table board;
create sequence b_no_seq
start with 1
increment by 1
nocache
nomaxvalue;
--drop sequence b_no_seq;
select * from board;
commit;
--------------------------------------------------------------------------------
create table title_img(
t_b_no number not null,
t_fileName varchar(300) not null,
t_oriFileName varchar(300) not null,
t_filePath varchar(300) not null,
t_fileSize number not null
);
--drop table title_img;
create sequence t_fileSeq_seq
start with 1
increment by 1
nocache
nomaxvalue;
--drop sequence t_fileSeq_seq;
select * from title_img;
commit;
--------------------------------------------------------------------------------
create table payment(
p_b_no number not null,
p_name varchar(20) not null,
p_email varchar(30) not null,
p_phone varchar(20) not null,
p_amount number not null,
p_payment_date timestamp default sysdate not null
);
--drop table payment;
select * from payment;
commit;
--------------------------------------------------------------------------------
create table recommend(
r_email varchar(30) not null,
r_b_no number not null,
r_b_title varchar(100) not null
);
--drop table recommend;
select * from recommend;
commit;
--------------------------------------------------------------------------------
create table comments(
c_email varchar(30) not null,
c_name varchar(20) not null,
c_b_no number not null,
c_comment varchar(1000) not null,
c_write_date timestamp default sysdate not null
);
--drop table comments;
select * from comments;
commit;
| true
|
271cdc52b5b91449f5283d54b72768d51c118706
|
SQL
|
PavelWhiteTiger/Databasescourse
|
/7L/Task2.sql
|
UTF-8
| 332
| 3.375
| 3
|
[] |
no_license
|
use shop;
create table if not exists accounts(
id INT PRIMARY KEY,
name VARCHAR(255),
password varchar(255)
);
CREATE VIEW USERNAME
as select id,name
FROM accounts;
create user 'username_read'@'localhost' identified with sha256_password by'pass';
grant select on shop.username to 'username_read'@'localhost';
| true
|
9a05ec6ae48c201cff1726eccafec25384af33a2
|
SQL
|
DaviRP2018/database
|
/create_table.sql
|
UTF-8
| 1,319
| 3.03125
| 3
|
[] |
no_license
|
CREATE TABLE IF NOT EXISTS telegram.users (
id INT PRIMARY KEY,
is_bot BOOLEAN NOT NULL,
first_name VARCHAR(255) NOT NULL,
username VARCHAR(255) UNIQUE NOT NULL,
last_name VARCHAR(255),
language_code INT NOT NULL,
can_join_groups BOOLEAN,
can_read_all_group_messages BOOLEAN,
supports_inline_queries BOOLEAN,
date_joined TIMESTAMP NOT NULL
);
CREATE TABLE IF NOT EXISTS telegram.chat (
id INT PRIMARY KEY,
"type" VARCHAR(255) NOT NULL,
title VARCHAR(255),
username VARCHAR(255) UNIQUE NOT NULL,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255),
all_members_are_administrators BOOLEAN,
photo VARCHAR(255),
"description" TEXT,
invite_link VARCHAR,
pinned_message VARCHAR,
"permissions" VARCHAR,
slow_mode_delay VARCHAR,
sticker_set_name VARCHAR,
can_set_sticker_set BOOLEAN
);
| true
|
00a0c1e03547bb0b8a2f8d501fc292b3c9c6e117
|
SQL
|
IlyaLun/342717-doingsdone
|
/queries.sql
|
UTF-8
| 2,092
| 3.640625
| 4
|
[] |
no_license
|
# добавление категорий
INSERT INTO category (title, user_id) VALUES
('Входящие', '1'),
('Учеба', '1'),
('Работа', '1'),
('Домашние дела', '1'),
('Авто', '1');
# добавление пользователей
INSERT INTO users (email, name, password, date_registration) VALUES
('ignat.v@gmail.com', 'Игнат', '$2y$10$OqvsKHQwr0Wk6FMZDoHo1uHoXd4UdxJG/5UDtUiie00XaxMHrW8ka', CURDATE()),
('kitty_93@li.ru', 'Леночка', '2y$10$bWtSjUhwgggtxrnJ7rxmIe63ABubHQs0AS0hgnOo41IEdMHkYoSVa', CURDATE()),
('warrior07@mail.ru', 'Руслан', '$2y$10$2OxpEH7narYpkOT1H5cApezuzh10tZEEQ2axgFOaKW.55LxIJBgWW', CURDATE());
# добавление задач
INSERT INTO task (date_of_creation, date_of_completion, title, deadline, category_id, user_id) VALUES
(CURDATE(), NULL, 'Собеседование в IT компании', '2018-06-01', '3', '1'),
(CURDATE(), NULL, 'Выполнить тестовое задание', '2018-05-25', '3', '1'),
(CURDATE(), CURDATE(), 'Сделать задание первого раздела', '2017-04-21', '2', '1'),
(CURDATE(), NULL, 'Встреча с другом', '2017-08-30', '1', '1'),
(CURDATE(), NULL, 'Купить корм для кота', NULL, '4', '1'),
(CURDATE(), NULL, 'Заказать пиццу', NULL, '4', '1');
# получить список из всех проектов для одного пользователя;
SELECT title, deadline FROM task WHERE user_id = 1 ORDER by deadline;
# получить список из всех задач для одного проекта;
SELECT title, deadline FROM task WHERE category_id = 4 ORDER by deadline;
# пометить задачу как выполненную;
UPDATE task SET date_of_completion = CURDATE() WHERE id = 1;
# получить все задачи для завтрашнего дня;
SELECT title, deadline FROM task WHERE deadline = CURDATE() + INTERVAL 1 DAY;
# обновить название задачи по её идентификатору.
UPDATE task SET title = 'New title' WHERE id = 1;
| true
|
15b8fe55bc4b7a0f8dd9dd65dd4c4715822e1ed7
|
SQL
|
da99/megauni.alpha
|
/Server/Card/migrates/card_insert/00-create.sql
|
UTF-8
| 1,161
| 3.796875
| 4
|
[
"MIT"
] |
permissive
|
INSERT INTO link (
type_id,
owner_type_id, owner_id,
a_type_id, a_id,
b_type_id, b_id
)
VALUES (
IDS[1],
IDS[2], screen_name_id_if_owns_or_fail(USER_ID, SCREEN_NAME),
IDS[3], card_id_or_fail(USER_ID, A_ID),
IDS[4], screen_name_id_if_owns_or_fail(USER_ID, SCREEN_NAME)
);
CREATE PROCEDURE IF NOT EXISTS link_insert (
IN USER_ID INT,
IN TYPE_NAME VARCHAR(255),
IN A_ID INT,
IN SCREEN_NAME VARCHAR(255)
OUT LINK_ID INT
)
BEGIN
DECLARE IDS SMALLINT[];
IDS := name_to_type_ids(TYPE_NAME);
CASE IDS
WHEN name_to_type_ids('LINK | CARD, SCREEN_NAME') THEN
INSERT INTO link (
type_id,
owner_type_id, owner_id,
a_type_id, a_id,
b_type_id, b_id
)
VALUES (
IDS[1],
IDS[2], screen_name_id_if_owns_or_fail(USER_ID, SCREEN_NAME),
IDS[3], card_id_or_fail(USER_ID, A_ID),
IDS[4], screen_name_id_if_owns_or_fail(USER_ID, SCREEN_NAME)
) RETURNING link.id;
ELSE
RAISE EXCEPTION 'programmer_error: unknown link_insert type: %', TYPE_NAME;
END CASE;
SELECT id AS LAST_INSERT_ID() INTO LINK_ID;
END //
| true
|
f41fa58ff72688429334d89692dfe49fae16f14a
|
SQL
|
gsangeryee/overlapping
|
/overlapping.sql
|
UTF-8
| 245
| 2.765625
| 3
|
[] |
no_license
|
Select * From tables
Where (segment_start <= previous_start AND segment_end >= previous_start)
OR (segment_start >= previous_start AND segment_end <= previous_end)
OR (segment_start <= previous_end AND segment_end >= previous_end )
| true
|
e8917cd83cbe4b52367a31faf5617de39d6dcb34
|
SQL
|
qq57694878/study
|
/daily/database/oracle/execute immediate sql.sql
|
UTF-8
| 413
| 2.828125
| 3
|
[] |
no_license
|
create or replace procedure execsql
(
name varchar2
)
is
type org_type is table of t_org%rowtype;
v_orgdata org_type;
v_sql varchar2(4000);
begin
v_sql:=v_sql||'select * from t_org where name like :1';
execute immediate v_sql
bulk collect into v_orgdata
using '%'||name||'%';
for i in 1..v_orgdata.count
loop
dbms_output.put_line(v_orgdata(i).name||v_orgdata(i).id);
end loop;
end;
| true
|
3a4907cba65800d7a1e289257d1e5bc56e397274
|
SQL
|
provashish95/MVC
|
/db_student.sql
|
UTF-8
| 2,406
| 3.125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 03, 2020 at 09:43 PM
-- Server version: 10.1.40-MariaDB
-- PHP Version: 7.3.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `db_student`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_student`
--
CREATE TABLE `tbl_student` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL,
`dept` varchar(50) NOT NULL,
`age` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_student`
--
INSERT INTO `tbl_student` (`id`, `name`, `dept`, `age`) VALUES
(29, 'Nisha Das', 'Singer', 22),
(30, 'Tonmoy Roy pro', 'Accounting', 22),
(31, 'Kamrul Khan', 'Accounting', 50),
(36, 'Antu Das', 'Singer', 22),
(37, 'Shipan mallik', 'graphics', 22);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_teacher`
--
CREATE TABLE `tbl_teacher` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL,
`dept` varchar(50) NOT NULL,
`age` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_teacher`
--
INSERT INTO `tbl_teacher` (`id`, `name`, `dept`, `age`) VALUES
(1, 'Kanta Sri', 'CSE', 30),
(2, 'Delowar Jahan', 'English', 25),
(3, 'Kanta Sri', 'Physics', 30),
(4, 'Provashish Roy', 'www', 25);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbl_student`
--
ALTER TABLE `tbl_student`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_teacher`
--
ALTER TABLE `tbl_teacher`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tbl_student`
--
ALTER TABLE `tbl_student`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38;
--
-- AUTO_INCREMENT for table `tbl_teacher`
--
ALTER TABLE `tbl_teacher`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
7d14f724992ddfda303477061eb98f323327fdf6
|
SQL
|
Sowmya574/Cognizant-Early-Engagement
|
/SQL Programming/Buses based on Source and Destination/query.sql
|
UTF-8
| 424
| 3.84375
| 4
|
[] |
no_license
|
select distinct s1.bus_no,
b.bus_name
from schedule s1
inner join schedule s2 on s1.source = s2.destination
and s1.destination = s2.source
inner join buses b on s1.bus_no = b.bus_no
order by s1.bus_no;
select distinct s1.bus_no,
b.bus_name
from schedule s1,
schedule s2,
buses b
where s1.source = s2.destination
and s1.destination = s2.source
and s1.bus_no = b.bus_no
order by s1.bus_no;
| true
|
4ea09caf7a517f8eaf22f893300101dfc7ac0e7d
|
SQL
|
hubena/command.file
|
/SQL/用过的sql语句.sql
|
UTF-8
| 650
| 3.875
| 4
|
[] |
no_license
|
#建表:
create table test3.car (
id int auto_increment comment '车的ID',
carname varchar(25) not null comment '车名',
primary key (id),
unique index carname_idex (carname asc)
) comment = '车表';
insert into test3.car (carname) values('红色');
select * from test3.car;
create table carcolour (
colourID int comment '车颜色表',
colourName varchar(25) comment '车颜色',
constraint pk_colourID primary key (colourID), -- 给主键取名字没有用
constraint fk_colourID foreign key (colourID) references test3.car(id)
);
show create table test3.carcolour;
select version();
select * from test1.order
| true
|
093f826d0bac6b0c1159b24a9bf2d870ecdc77a5
|
SQL
|
dennishemken/ination
|
/Goldmine/main_contact_info.sql
|
UTF-8
| 3,284
| 2.578125
| 3
|
[] |
no_license
|
SELECT DISTINCT
"public"."new_contact_id"."contact_id",
"public"."contacts_export1"."COMMENTS"as "Internal Notes",
"public"."contacts_export1"."COMPANY" as "Company Name",
"public"."contacts_export1"."CONTACT",
"public"."contacts_export1"."DEAR",
"public"."contacts_export1"."DEPARTMENT",
"public"."contacts_export1"."KEY1" as "Primary SSN",
"public"."contacts_export1"."KEY2" as "Secondary SSN",
"public"."contacts_export1"."KEY3" as "Advisor",
"public"."contacts_export1"."KEY4" as "LPL RepID",
"public"."contacts_export1"."KEY5" as "LPL #",
"public"."contacts_export1"."LASTNAME" as "Last Name",
"public"."contacts_export1"."NOTES",
"public"."contacts_export1"."SECR",
"public"."contacts_export1"."SOURCE",
"public"."contacts_export1"."TITLE",
"public"."contacts_export1"."UBA_BDAY1" AS "Birthdate",
"public"."contacts_export1"."UBA_BDAY2" AS "Spouse Birthdate",
"public"."contacts_export1"."UBA_EMP1" AS "Employer",
"public"."contacts_export1"."UBA_EMP2" AS "Employer2",
"public"."contacts_export1"."UBA_EMPA1" AS "Employr Address",
"public"."contacts_export1"."UBA_EMPA2" AS "Employr Address2",
"public"."contacts_export1"."UBA_ID1" AS "Pri ID Type",
"public"."contacts_export1"."UBA_ID2" AS "Sec ID Type",
"public"."contacts_export1"."UBA_IDEXP1" AS "Primary ID Exp Date",
"public"."contacts_export1"."UBA_IDEXP2" AS "Secondary ID Exp Date",
"public"."contacts_export1"."UBA_IDNUM1" AS "Id Number 1",
"public"."contacts_export1"."UBA_IDNUM2" AS "ID Number 2",
"public"."contacts_export1"."UBA_INC" AS "Income",
"public"."contacts_export1"."UBA_INVOBJ" AS "Investment Objective",
"public"."contacts_export1"."UBA_ISS1" AS "Place of Issuance 1",
"public"."contacts_export1"."UBA_ISSUE2" AS "Place of Issuance 2",
"public"."contacts_export1"."UBA_LNW" AS "Liquid Net Worth",
"public"."contacts_export1"."UBA_MSTAT" AS "Marital",
"public"."contacts_export1"."UBA_NETW" AS "Net Worth",
"public"."contacts_export1"."UBA_OCCNA2" AS "Occup/Nature",
"public"."contacts_export1"."UBA_RATING" AS "Rating",
"public"."contacts_export1"."UBA_RFBY" AS "Referred By",
"public"."contacts_export1"."UBA_SAL2" AS "Salutation 2",
"public"."contacts_export1"."UBA_STATUS" AS "Client Status",
"public"."contacts_export1"."UBA_STDATE" AS "Date Became Client",
"public"."contacts_export1"."UBA_TAXBR" AS "Tax Bracket",
"public"."contacts_export1"."UCF_SUBSTA" AS "Sub-Status",
"public"."contacts_export1"."UCHARITY" AS "Charity",
"public"."contacts_export1"."UCOLLEGE" AS "College",
"public"."contacts_export1"."UCOLLEGE3" AS "College 3",
"public"."contacts_export2"."ULTCNEWS" AS "LTC News",
"public"."contacts_export2"."ULTMONEY" AS "Let's Talk Money",
"public"."contacts_export2"."UOPENHOUSE" AS "OpenHouse",
"public"."contacts_export2"."UTHNKSGIV" AS "Thanksgiving Card",
"public"."contacts_export2"."UWMC" AS "Market Commentary",
"public"."contacts_export2"."Web Site"
FROM
"public"."contacts_export1"
Inner Join "public"."contacts_export2" ON "public"."contacts_export2"."RECID" = "public"."contacts_export1"."RECID"
Inner Join "public"."new_contact_id" ON "public"."new_contact_id"."goldmine_recid" = "public"."contacts_export1"."RECID"
where "public"."contacts_export1"."RECID" not in
(
SELECT
"public"."ContSupp"."RECID"
FROM
"public"."ContSupp"
WHERE
"public"."ContSupp"."RECTYPE" = 'C'
)
| true
|
62e49657362ab39475ea923962b70a8df9eb7688
|
SQL
|
murari-goswami/bi
|
/ETL/DataVirtuality/views/ml/ml.article_age_distribution.sql
|
UTF-8
| 1,412
| 4.125
| 4
|
[] |
no_license
|
-- Name: ml.article_age_distribution
-- Created: 2015-04-24 18:23:47
-- Updated: 2015-04-24 18:23:47
CREATE VIEW ml.article_age_distribution AS
SELECT
am.article_id,
f.molor_mean_age,
f.molor_stddev_age,
f.model_mean_age,
f.model_stddev_age,
f.brand_mean_age,
f.brand_stddev_age
FROM
(SELECT
p.molor_id,
AVG(p.customer_age) OVER (PARTITION BY p.molor_id) AS molor_mean_age,
STDDEV_SAMP(p.customer_age) OVER (PARTITION BY p.molor_id) AS molor_stddev_age,
AVG(p.customer_age) OVER (PARTITION BY p.model_id) AS model_mean_age,
STDDEV_SAMP(p.customer_age) OVER (PARTITION BY p.model_id) AS model_stddev_age,
AVG(p.customer_age) OVER (PARTITION BY p.brand) AS brand_mean_age,
STDDEV_SAMP(p.customer_age) OVER (PARTITION BY p.brand) AS brand_stddev_age,
ROW_NUMBER() OVER (PARTITION BY p.molor_id ORDER BY p.molor_id DESC) AS rn
FROM
(SELECT
a.article_id,
m.molor_id,
c.customer_age,
a.article_brand AS brand,
a.article_model_id AS model_id
FROM bi.article AS a
LEFT JOIN bi.customer_order_articles AS coa
ON a.article_id = coa.article_id
LEFT JOIN bi.customer_order AS co
ON coa.order_id = co.order_id
LEFT JOIN bi.customer AS c
ON co.customer_id = c.customer_id
LEFT JOIN ml.article_molor AS m
ON m.article_id = a.article_id
WHERE coa.articles_kept > 0) AS p) AS f
JOIN ml.article_molor AS am
ON am.molor_id = f.molor_id
WHERE f.rn = 1
| true
|
bb73cbc3a52109423e8dc40046d0e4905d4d650b
|
SQL
|
siddhartha-Infy01/my-ref-code
|
/dbscripts/PRC/queryRecentlyAdded.sql
|
UTF-8
| 19,388
| 3.5
| 4
|
[] |
no_license
|
drop procedure if exists queryRecentlyAdded;
DELIMITER $$
CREATE PROCEDURE `queryRecentlyAdded`(nwid VARCHAR(25),time_param int,commodityids VARCHAR(25),locationids VARCHAR(25),occupationids VARCHAR(25))
BEGIN
DROP TABLE IF EXISTS _tmpshare;
CREATE TEMPORARY TABLE _tmpshare (nwtid varchar(25));
TRUNCATE TABLE _tmpshare;
INSERT INTO _tmpshare SELECT from_share FROM user_shares WHERE to_share = nwid AND share_item='people' AND auth_stat = 'A';
SET @vars = commodityids;
SET @vars := CONCAT("('", REPLACE(@vars, ",", "'),('"), "')");
DROP TABLE IF EXISTS _resultComm;
CREATE TEMPORARY TABLE _resultComm (field varchar(25) primary key);
TRUNCATE TABLE _resultComm;
SET @sql := CONCAT('INSERT INTO ', '_resultComm', ' VALUES ', @vars);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE IF EXISTS _resultComm1;
CREATE TEMPORARY TABLE _resultComm1 LIKE _resultComm;
REPEAT
TRUNCATE TABLE _resultComm1;
INSERT INTO _resultComm1 SELECT a.commodity_id
FROM commodities a JOIN _resultComm b ON b.field = a.parent_id;
INSERT IGNORE INTO _resultComm SELECT * FROM _resultComm1 ;
UNTIL ROW_COUNT() = 0
END REPEAT;
SET @vars = locationids;
SET @vars := CONCAT("('", REPLACE(@vars, ",", "'),('"), "')");
DROP TABLE IF EXISTS _resultLoc;
CREATE TEMPORARY TABLE _resultLoc (field varchar(25) primary key);
TRUNCATE TABLE _resultLoc;
SET @sql := CONCAT('INSERT INTO ', '_resultLoc', ' VALUES ', @vars);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE IF EXISTS _resultLoc1;
CREATE TEMPORARY TABLE _resultLoc1 LIKE _resultLoc;
REPEAT
TRUNCATE TABLE _resultLoc1;
INSERT INTO _resultLoc1 SELECT a.location_id
FROM locations a JOIN _resultLoc b ON b.field = a.parent_id;
INSERT IGNORE INTO _resultLoc SELECT * FROM _resultLoc1 ;
UNTIL ROW_COUNT() = 0
END REPEAT;
SET @vars = occupationids;
SET @vars := CONCAT("('", REPLACE(@vars, ",", "'),('"), "')");
DROP TABLE IF EXISTS _resultOcc;
CREATE TEMPORARY TABLE _resultOcc (field varchar(25) primary key);
TRUNCATE TABLE _resultOcc;
SET @sql := CONCAT('INSERT INTO ', '_resultOcc', ' VALUES ', @vars);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE IF EXISTS _resultOcc1;
CREATE TEMPORARY TABLE _resultOcc1 LIKE _resultLoc;
REPEAT
TRUNCATE TABLE _resultOcc1;
INSERT INTO _resultOcc1 SELECT a.occupation_id
FROM occupations a JOIN _resultOcc b ON b.field = a.parent_id;
INSERT IGNORE INTO _resultOcc SELECT * FROM _resultOcc1 ;
UNTIL ROW_COUNT() = 0
END REPEAT;
DROP TABLE IF EXISTS _tmp_people;
CREATE TEMPORARY TABLE _tmp_people ( `people_id` VARCHAR(50) NOT NULL DEFAULT '',
`first_name` VARCHAR(150) DEFAULT NULL,
`last_name` VARCHAR(150) DEFAULT NULL,
`nickname` VARCHAR(45) DEFAULT NULL,
`gender` VARCHAR(25) DEFAULT NULL,
`town` VARCHAR(25) DEFAULT NULL,
`country` VARCHAR(25) DEFAULT NULL,
`currency_id` VARCHAR(20) DEFAULT NULL,
`language_id` VARCHAR(20) DEFAULT NULL,
`msisdn` VARCHAR(25) DEFAULT NULL,
`email` VARCHAR(150) DEFAULT NULL,
`edit_flag` CHAR(2) NOT NULL,
`default_network_id` VARCHAR(25) NOT NULL DEFAULT '',
PRIMARY KEY (`people_id`));
DROP TABLE IF EXISTS _tmp_people1;
CREATE TEMPORARY TABLE _tmp_people1 ( `people_id` VARCHAR(50) NOT NULL DEFAULT '',
`first_name` VARCHAR(150) DEFAULT NULL,
`last_name` VARCHAR(150) DEFAULT NULL,
`nickname` VARCHAR(45) DEFAULT NULL,
`gender` VARCHAR(25) DEFAULT NULL,
`town` VARCHAR(25) DEFAULT NULL,
`country` VARCHAR(25) DEFAULT NULL,
`currency_id` VARCHAR(20) DEFAULT NULL,
`language_id` VARCHAR(20) DEFAULT NULL,
`msisdn` VARCHAR(25) DEFAULT NULL,
`email` VARCHAR(150) DEFAULT NULL,
`edit_flag` CHAR(2) NOT NULL,
`default_network_id` VARCHAR(25) NOT NULL DEFAULT '',
PRIMARY KEY (`people_id`));
DROP TABLE IF EXISTS _tmp_people2;
CREATE TEMPORARY TABLE _tmp_people2 ( `people_id` VARCHAR(50) NOT NULL DEFAULT '',
`first_name` VARCHAR(150) DEFAULT NULL,
`last_name` VARCHAR(150) DEFAULT NULL,
`nickname` VARCHAR(45) DEFAULT NULL,
`gender` VARCHAR(25) DEFAULT NULL,
`town` VARCHAR(25) DEFAULT NULL,
`country` VARCHAR(25) DEFAULT NULL,
`currency_id` VARCHAR(20) DEFAULT NULL,
`language_id` VARCHAR(20) DEFAULT NULL,
`msisdn` VARCHAR(25) DEFAULT NULL,
`email` VARCHAR(150) DEFAULT NULL,
`edit_flag` CHAR(2) NOT NULL,
`default_network_id` VARCHAR(25) NOT NULL DEFAULT '',
PRIMARY KEY (`people_id`));
TRUNCATE TABLE _tmp_people;
TRUNCATE TABLE _tmp_people1;
TRUNCATE TABLE _tmp_people2;
if commodityids !='' and locationids !='' and occupationids !='' then
INSERT IGNORE INTO _tmp_people SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_commodities u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.commodity_id in (select * from _resultComm) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_locations u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.location_id in (select * from _resultLoc) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people2 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_occupations u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.occupation_id in (select * from _resultOcc) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_commodities u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.commodity_id in (select * from _resultComm) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_locations u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.location_id in (select * from _resultLoc) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people2 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_occupations u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.occupation_id in (select * from _resultOcc) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
SELECT * FROM _tmp_people a,_tmp_people1 b,_tmp_people2 c where a.people_id=b.people_id and b.people_id=c.people_id and c.people_id=a.people_id;
elseif commodityids !='' and locationids !='' and occupationids='' then
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_commodities u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.commodity_id in (select * from _resultComm) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people2 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_locations u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.location_id in (select * from _resultLoc) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_commodities u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.commodity_id in (select * from _resultComm) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people2 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_locations u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.location_id in (select * from _resultLoc) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
SELECT * FROM _tmp_people1 a,_tmp_people2 b where a.people_id=b.people_id;
elseif locationids !='' and occupationids !='' and commodityids='' then
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_locations u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.location_id in (select * from _resultLoc) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people2 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_occupations u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.occupation_id in (select * from _resultOcc) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_locations u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.location_id in (select * from _resultLoc) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people2 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_occupations u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.occupation_id in (select * from _resultOcc) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
SELECT * FROM _tmp_people1 a,_tmp_people2 b where a.people_id=b.people_id;
elseif occupationids !='' and commodityids !='' and locationids='' then
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_commodities u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.commodity_id in (select * from _resultComm) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people2 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_occupations u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.occupation_id in (select * from _resultOcc) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_commodities u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.commodity_id in (select * from _resultComm) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people2 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_occupations u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.occupation_id in (select * from _resultOcc) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
SELECT * FROM _tmp_people1 a,_tmp_people2 b where a.people_id=b.people_id;
elseif commodityids !='' then
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_commodities u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.commodity_id in (select * from _resultComm) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_commodities u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.commodity_id in (select * from _resultComm) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
select * from _tmp_people1;
elseif locationids !='' then
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_locations u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.location_id in (select * from _resultLoc) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_locations u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.location_id in (select * from _resultLoc) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
select * from _tmp_people1;
elseif occupationids !='' then
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n,user_occupations u WHERE p.default_network_id=nwid and p.people_id=u.user_id and p.default_network_id=n.network_id and n.record_status='A' and u.occupation_id in (select * from _resultOcc) AND p.record_status='A'and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
INSERT IGNORE INTO _tmp_people1 SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n,user_occupations u WHERE p.default_network_id=n.network_id and p.people_id=u.user_id and n.record_status='A' and u.occupation_id in (select * from _resultOcc) and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day)) and p.default_network_id=u.network_id;
select * from _tmp_people1;
else
INSERT IGNORE INTO _tmp_people SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'Y',p.default_network_id FROM people p, Networks n WHERE p.default_network_id=nwid and p.default_network_id=n.network_id and n.record_status='A'AND p.record_status='A' and p.created_ts > date((sysdate() - interval time_param day));
INSERT IGNORE INTO _tmp_people SELECT p.people_id,p.first_name,p.last_name,p.nickname,p.gender,p.town,p.country,p.currency_id,p.language_id,p.msisdn,p.email,'N',p.default_network_id FROM people p, Networks n WHERE p.default_network_id=n.network_id and n.record_status='A' and p.default_network_id in ( select * from _tmpshare) and p.created_ts > date((sysdate() - interval time_param day));
SELECT * FROM _tmp_people;
end if;
END
| true
|
f117bfec51b7c5b14862ca603e1d6b227f2ddc09
|
SQL
|
Blake-Trapnell/Skillscheck3
|
/db/seed.sql
|
UTF-8
| 538
| 3.015625
| 3
|
[] |
no_license
|
CREATE table houses (
id serial primary key,
name VARCHAR(255)
address VARCHAR(255),
city VARCHAR(100),
state VARCHAR(2),
zip int,
img text
mortgage decimal
rent decimal
);
INSERT INTO houses (name, address, city, zipcode, state)
VALUES ('Pheasant Pointe 5 bed 3 bath', '553 Pheasant Pointe dr', 'Lehi', '84505', 'UT'),
('Triple crown 8 bed 5 bath white 4 floor', '2925 s 148 triple crown dr', 'Mapleton', '84664', 'UT'),
('Harvest Park 3 bed 2 bath 2 floor', '1523 e harvest park way', 'Mapleton', '84664', 'UT');
SELECT * FROM houses;
| true
|
e41bd58fedb66115ff82d019f98f8e8ec4dd8008
|
SQL
|
priyajain1312/PHP-CRUD
|
/contact_db.sql
|
UTF-8
| 2,581
| 3.3125
| 3
|
[] |
no_license
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
-- Database: `Contact_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `admins`
--
CREATE TABLE `admins` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`phone` varchar(15) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `contacts`
--
CREATE TABLE `contacts` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`phone` varchar(15) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `contacts`
--
INSERT INTO `contacts` (`id`, `name`, `email`, `password`, `phone`, `created`) VALUES
(1, 'Ahsan Saeed', 'ahsansaeed067@gmail.com', 'Vm0xMFlWbFdWWGhVYmxKWFltdHdVRlpzV21GWFJscHlWV3RLVUZWVU1Eaz0=', '03218878961', '2018-05-01 13:07:24');
-- --------------------------------------------------------
--
-- Table structure for table `contact1`
--
CREATE TABLE `nurses` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`phone` varchar(15) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `contact1`
--
INSERT INTO `contact1` (`id`, `name`, `email`, `password`, `phone`, `created`) VALUES
(1, 'Ahsan', 'ahsansaeed067@gmail.com', 'MTIzNDU=', '03218878961', '2018-06-27 13:39:31'),
(2, '2', 'ABC', 'WFla', '123456789', '2018-07-06 13:50:24'),
(3, 'Shehryar khan', 'shehryar@appryx.com', 'YXBwcnl4', '3433243243', '2018-07-06 18:12:35');
-- --------------------------------------------------------
-- Indexes for table `admins`
--
ALTER TABLE `admins`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `contacts`
--
ALTER TABLE `contacts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `contact1`
--
ALTER TABLE `contact1`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `contacts`
--
ALTER TABLE `contacts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `contact1`
--
ALTER TABLE `contact1`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
| true
|
d58a877677d7d1290abbdf26e51ed681a86ad590
|
SQL
|
nascimentolh/JBlueHeart-Source
|
/L2J_SunriseProject_Data/dist/tools/sql/sunrise_sql_files/hwid_info.sql
|
UTF-8
| 587
| 2.859375
| 3
|
[] |
no_license
|
-- ----------------------------
-- Table structure for `hwid_info`
-- ----------------------------
DROP TABLE IF EXISTS `hwid_info`;
CREATE TABLE `hwid_info` (
`HWID` varchar(32) NOT NULL DEFAULT '',
`WindowsCount` int(10) unsigned NOT NULL DEFAULT '1',
`Account` varchar(45) NOT NULL DEFAULT '',
`PlayerID` int(10) unsigned NOT NULL DEFAULT '0',
`LockType` enum('PLAYER_LOCK','ACCOUNT_LOCK','NONE') NOT NULL DEFAULT 'NONE',
PRIMARY KEY (`HWID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of hwid_info
-- ----------------------------
| true
|
374ff2c33539f4ab8a18b64070ed2b530d6ee325
|
SQL
|
tusharmaroo/ren16
|
/api/ren16.sql
|
UTF-8
| 2,102
| 3.359375
| 3
|
[] |
no_license
|
CREATE TABLE IF NOT EXISTS `Coordinators` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`email` varchar(100),
`eventid` int(11) NOT NULL,
`phone` varchar(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `EventCategories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`thumb` varchar(50) NOT NULL,
`coordinators` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
CREATE TABLE IF NOT EXISTS `EventDetails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`about` varchar(500) NOT NULL,
`rules` varchar(500) NOT NULL,
`fees` varchar(50) NOT NULL,
`thumbnail` varchar(100) NOT NULL,
`venue` varchar(250) NOT NULL,
`prize` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
CREATE TABLE IF NOT EXISTS `Events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`category` int(11) NOT NULL,
`type` int(2),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
CREATE TABLE IF NOT EXISTS `Registrations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`eventId` int(11) NOT NULL,
`userId` int(11) NOT NULL,
`teamname` varchar(50) NOT NULL,
`team` varchar(250) NOT NULL,
`time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `Users` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL,
`college` varchar(80) NOT NULL,
`city` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`contact` int(15) NOT NULL,
`dp` varchar(50) NOT NULL,
`password` varchar(100) NOT NULL,
`time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `Dashboard` (
`username` varchar(40) NOT NULL,
`password` varchar(100) NOT NULL,
`type` int(2) NOT NULL DEFAULT 0,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
| true
|
559741622772e74be05a67c12b822ca0891d25df
|
SQL
|
JorgeDuenasLerin/basesdedatos-dam1
|
/apuntes/3/trabajosCreacionTablas/Entraga_SQL_Jorge_Rodriguez_Martinez/Entraga SQL Jorge Rodriguez Martinez/1.sql
|
ISO-8859-1
| 3,479
| 3.734375
| 4
|
[] |
no_license
|
drop table acabado cascade constraints;
drop table acabado_coche cascade constraints;
drop table alquileres cascade constraints;
drop table categorias cascade constraints;
drop table cliente cascade constraints;
drop table coches cascade constraints;
drop table alquiler cascade constraints;
select table_name from tabs;
-- 1) ENTORNO DEL PROBLEMA --
-- Creacin de tablas y definicin de columnas --
create table cliente ( ipf varchar2 (10) NOT NULL,
nombre varchar2 (20) NOT NULL,
apellidos varchar2 (30) NOT NULL,
edad number (3) NOT NULL,
genero varchar2 (10) NOT NULL);
create table coches ( num_bastidor varchar2 (17) NOT NULL,
marca varchar2 (20) NOT NULL,
modelo varchar2 (20) NOT NULL,
color varchar2 (40) NOT NULL,
categoria varchar2 (20) NOT NULL,
matricula varchar2 (7) NOT NULL);
create table alquiler( id_alquiler number (5) NOT NULL,
num_bastidor varchar2 (17) NOT NULL,
recogida varchar2 (30) NOT NULL,
devolucion varchar2 (30) NOT NULL,
km_iniciales number (6) NOT NULL,
km_finales number (6) NOT NULL, -- Entiendo que en esta columna y en la de fecha fin en el caso de no haber devuelto el coche estableciendo el valor default --
fecha_inicio date NOT NULL, -- podemos intervenir para evitar nulos o incumplir restricciones pero por alguna razn que no consigo averiguar no funciona. --
fecha_fin date NOT NULL,
descuento number (10) NOT NULL);
create table categorias(
categoria varchar2 (20) NOT NULL,
precio number (6) NOT NULL);
create table acabado( id_acabado number (10) NOT NULL,
datos_acabado varchar2 (80) NOT NULL);
create table alquileres(
ipf varchar2 (10) NOT NULL,
id_alquiler number (10) NOT NULL);
create table acabado_coche(
num_bastidor varchar2 (17) NOT NULL,
id_acabado varchar2 (5) NOT NULL);
-- Especificacin de PKs --
alter table cliente add constraint cliente_pk primary key(ipf);
alter table coches add constraint coches_pk primary key(num_bastidor);
alter table alquiler add constraint alquiler_pk primary key(id_alquiler);
alter table categorias add constraint categorias_pk primary key(categoria);
alter table acabado add constraint acabados_pk primary key(id_acabado);
alter table alquileres add constraint alquileres_pk primary key(ipf, id_alquiler);
alter table acabado_coche add constraint acabado_coche_pk primary key(num_bastidor, id_acabado);
-- Especificacin de FKs --
alter table alquileres add constraint ipf_cliente_fk foreign key(ipf) references cliente(ipf);
alter table alquileres add constraint alquiler_id_fk foreign key(id_alquiler) references alquiler(id_alquiler);
alter table coches add constraint cat_fk foreign key(categoria) references categorias(categoria);
alter table alquiler add constraint coch_alq_fk foreign key(num_bastidor) references coches(num_bastidor);
alter table acabado_coche add constraint acabado_fk foreign key(id_acabado) references acabado(id_acabado);
alter table acabado_coche add constraint coch_bast_fk foreign key(num_bastidor) references coches(num_bastidor);
| true
|
b5288d4d868cd271424da23d2292f25ae4e9500b
|
SQL
|
echo511/TreeTraversal
|
/tests/_data/dump.sql
|
UTF-8
| 793
| 2.671875
| 3
|
[
"MIT"
] |
permissive
|
-- Adminer 4.2.5 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `tree`;
CREATE TABLE `tree` (
`title` varchar(255) COLLATE utf8_czech_ci NOT NULL,
`lft` int(11) NOT NULL,
`rgt` int(11) NOT NULL,
`dpt` int(11) NOT NULL,
`prt` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`additional` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
PRIMARY KEY (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
INSERT INTO `tree` (`title`, `lft`, `rgt`, `dpt`, `prt`) VALUES
('A', 1, 16, 0, NULL),
('B', 2, 3, 1, 'A'),
('C', 4, 13, 1, 'A'),
('D', 5, 6, 2, 'C'),
('E', 7, 12, 2, 'C'),
('F', 8, 9, 3, 'E'),
('G', 10, 11, 3, 'E'),
('H', 14, 15, 1, 'A');
-- 2016-08-23 20:50:55
| true
|
3a4f83c8e11a5d388b0ca307841941d1d673d692
|
SQL
|
arinpro/sql-server-administration-scripts
|
/Search_Plan_Cache/search_plan_cache_with_details.sql
|
UTF-8
| 1,264
| 4.0625
| 4
|
[] |
no_license
|
SELECT top 25
db.name AS [db_name],
qsts.creation_time,
qsts.last_execution_time,
qsts.execution_count,
qtxt.text AS [query_text],
CAST(CAST(qsts.total_worker_time AS DECIMAL)/CAST(qsts.execution_count AS DECIMAL) AS INT) AS [cpu_per_execution],
CAST(CAST(qsts.total_logical_reads AS DECIMAL)/CAST(qsts.execution_count AS DECIMAL) AS INT) AS [logical_reads_per_execution],
CAST(CAST(qsts.total_elapsed_time AS DECIMAL)/CAST(qsts.execution_count AS DECIMAL) AS INT) AS [elapsed_time_per_execution],
qsts.total_worker_time AS total_cpu_time,
qsts.max_worker_time AS max_cpu_time,
qsts.total_elapsed_time,
qsts.max_elapsed_time,
qsts.total_logical_reads,
qsts.max_logical_reads,
qsts.total_physical_reads,
qsts.max_physical_reads,
qpln.query_plan,
cpln.cacheobjtype,
cpln.objtype,
cpln.size_in_bytes
FROM sys.dm_exec_query_stats AS qsts
CROSS APPLY sys.dm_exec_sql_text(qsts.plan_handle) AS qtxt
CROSS APPLY sys.dm_exec_query_plan(qsts.plan_handle) AS qpln
INNER JOIN sys.databases as db
ON qtxt.dbid = db.database_id
INNER JOIN sys.dm_exec_cached_plans AS cpln
ON cpln.plan_handle = qsts.plan_handle
--WHERE qtxt.text LIKE '%part_of_query_text%' --uncomment line if searching for a specific query
ORDER BY qsts.last_execution_time DESC;
| true
|
d5995f14151242681e8a9d325a687670026979e7
|
SQL
|
OldChris/Bootstrap_Login_System
|
/mysql/db_init_script/build_session_db.sql
|
UTF-8
| 2,117
| 3.109375
| 3
|
[] |
no_license
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+01:00";
CREATE TABLE `users` (
`id` int(11) AUTO_INCREMENT,
`customerid` int(11) NOT NULL DEFAULT '0',
`name` varchar(255),
`email` varchar(255),
`role` varchar(255),
`password` varchar(255),
`code` mediumint(50),
`code_time` int(11),
`status` text,
`dt_created` DATETIME NOT NULL DEFAULT LOCALTIMESTAMP,
`dt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`dt_pwchanged` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`dt_lastlogin` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `users` (`id`, `customerid`, `name`, `email`, `role`, `password`, `code`, `code_time`, `status`) VALUES
(1, '0', 'Chris The Wizz', 'pa7rhm@gmail.com', 'user', '$2y$10$NYwxrTyUivdoK/i16uojguXSUzH2s/H.jvm4Pyrt4N3REB2fZWf12', '0', '0', 'verified');
CREATE TABLE `users_log` (
`id` int(6) NOT NULL AUTO_INCREMENT COMMENT 'A unique identifier for each record',
`logdatetime` datetime NOT NULL,
`ipaddress` varchar(40) NOT NULL COMMENT ' ip address of station or user logging in to website (for IPV6 length = 8*4 + 7)',
`hostname` varchar(64) NOT NULL,
`username` varchar(100) NOT NULL,
`status` varchar(80) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `users_log` (`id`, `logdatetime`, `ipaddress`, `hostname`, `username`, `status`) VALUES
(1, '2017-09-29 19:57:20', '85.148.100.4', 's55946404.adsl.online.nl', 'admin', 'logged out'),
(2, '2017-09-29 19:57:29', '85.148.100.4', 's55946404.adsl.online.nl', 'admin', 'login successfull'),
(3, '2017-09-30 04:08:39', '85.148.100.4', 's55946404.adsl.online.nl', 'admin', 'login successfull'),
(4, '2017-09-30 11:29:55', '85.148.100.4', 's55946404.adsl.online.nl', 'admin', 'login failure'),
(5, '2017-09-30 11:30:08', '85.148.100.4', 's55946404.adsl.online.nl', 'admin', 'login successfull'),
(6, '2017-10-01 04:54:14', '85.148.100.4', 's55946404.adsl.online.nl', 'admin', 'login successfull'),
(7, '2017-10-01 05:17:51', '85.148.100.4', 's55946404.adsl.online.nl', 'admin', 'logged out');
| true
|
752574c76f8dabc94b849c1c2808821828655ae2
|
SQL
|
GYSolver/shopping_centre
|
/SQL/review.sql
|
UTF-8
| 661
| 3.03125
| 3
|
[] |
no_license
|
CREATE TABLE `review` (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
order_id INT UNSIGNED NOT NULL,
user_id INT UNSIGNED NOT NULL,
username VARCHAR(50) NOT NULL DEFAULT '',
product_id INT UNSIGNED NOT NULL,
product_name VARCHAR(50) NOT NULL DEFAULT '',
product_specification VARCHAR(100) NOT NULL DEFAULT '',
general_review VARCHAR(50) NOT NULL DEFAULT '',
detailed_review VARCHAR(1000) NOT NULL DEFAULT '',
rating INT UNSIGNED NOT NULL DEFAULT 1 ,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
);
| true
|
7e0d7717802e01b05d28b9ea388eed060b951a1d
|
SQL
|
mozilla/marketing-analytics
|
/bqQueries/WIP/missingCampaignsTelemetry/compareFetchtoGA.sql
|
UTF-8
| 1,662
| 4.125
| 4
|
[] |
no_license
|
WITH data as(
SELECT
fetchData.Adname as fetchAdName,
adDetails.Device as device,
adDetails.OperatingSystem as OperatingSystem,
fetchData.vendorNetSpend as vendorNetSpend,
fetchData.downloadsGA as fetchDownloadsGA,
GA.content as gaContent,
GA.downloads as gaDownloads,
GA.nonFXDownloads as gaNonFXDownloads
FROM(
(SELECT
Adname,
SUM(vendorNetSpend) AS vendorNetSpend,
SUM(DownloadsGA) AS downloadsGA
FROM
`ga-mozilla-org-prod-001.fetch.fetch_deduped`
WHERE
Date >= '2018-06-01'
AND DATE <= '2018-06-30'
GROUP BY
1
ORDER BY 2 DESC) as fetchData
LEFT JOIN
(SELECT
content,
SUM(IF(downloads > 0,1,0)) as downloads,
SUM(IF(downloads > 0 AND browser != 'Firefox',1,0)) as nonFXDownloads
FROM (SELECT
date AS date,
fullVisitorId as visitorId,
visitNumber as visitNumber,
trafficSource.adcontent as content,
device.browser as browser,
SUM(IF (hits.eventInfo.eventAction = "Firefox Download",1,0)) as downloads
FROM
`ga-mozilla-org-prod-001.65789850.ga_sessions_*`,
UNNEST (hits) AS hits
WHERE
_TABLE_SUFFIX >= '20180601'
AND _TABLE_SUFFIX >= '20180630'
AND hits.type = 'EVENT'
AND hits.eventInfo.eventCategory IS NOT NULL
AND hits.eventInfo.eventLabel LIKE "Firefox for Desktop%"
GROUP BY
1,2,3,4,5)
GROUP BY 1
ORDER BY 2 DESC) as GA
ON fetchData.Adname = GA.content
LEFT JOIN
(SELECT
Adname,
Device,
OperatingSystem
FROM
`ga-mozilla-org-prod-001.fetch.fetch_deduped`
WHERE
Date >= '2018-06-01'
AND DATE <= '2018-06-30'
GROUP BY
1,2,3
ORDER BY 2 DESC) as adDetails
ON fetchData.Adname = adDetails.Adname))
SELECT * FROM data
WHERE gaContent IS NULL
AND device = 'Desktop'
ORDER BY vendorNetSpend DESC
| true
|
a316aacf152f2cdf5b72b6a08740dde056fbadc2
|
SQL
|
CasperPlatform/Node.js_SmartCar_API_Server
|
/db.sql
|
UTF-8
| 403
| 2.546875
| 3
|
[
"MIT"
] |
permissive
|
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE users(id INTEGER PRIMARY KEY, username VARCHAR(25), password blob, salt blob);
INSERT INTO "users" VALUES(1,'admin',X'64A4280C6F3FC3C43ECFDA04F7DEE96D2233ABFF92D387EFCA2EF51CBF4EE5C0',X'CDDAC7FC352A1BDDCFC01590A84A81196F2D0EC26ED0E7248B2C7552C962A5D1');
CREATE TABLE tokens (userId integer Primary Key, token blob, expiration timestamp);
COMMIT;
| true
|
4b540b481771e1c626c35cd8a97d3bb3f25a7436
|
SQL
|
zeamaria/BootcampX
|
/3_queries_group_by/average_completion_time.sql
|
UTF-8
| 252
| 3.640625
| 4
|
[] |
no_license
|
SELECT students.name as student, avg(average_assignment_duration.*) AS average_assignment_duration
FROM students
JOIN assignment_submissions ON student_id = students.id
WHERE end_date IS NULL
GROUP BY student
ORDER BY average_assignment_duration DESC;
| true
|
4edcfc5d851e5c7244103f93be5ebf46b35bd945
|
SQL
|
alejo4373/app-a-palooza-app
|
/server/db/schema.sql
|
UTF-8
| 526
| 3.53125
| 4
|
[] |
no_license
|
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR,
n_job_apps_goal INT,
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE TABLE job_applications (
id SERIAL PRIMARY KEY,
user_id INT REFERENCES users(id),
company_name VARCHAR,
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE TABLE session (
sid VARCHAR,
sess JSON NOT NULL,
expire TIMESTAMP(6) NOT NULL
) WITH (OIDS=FALSE);
ALTER TABLE session ADD CONSTRAINT "session_pkey" PRIMARY KEY ("sid");
CREATE INDEX "session_expire_idx" on session(expire)
| true
|
dd85059d906caa49bcee2522b24d4011bed2cd16
|
SQL
|
amit-k-s-pundir/computing-programming
|
/perl/web/catalyst-tutorials/CatalystTutorial/MyApp_Chapter9_FormHandler/MyApp/.svn/text-base/myapp03.sql.svn-base
|
UTF-8
| 212
| 2.53125
| 3
|
[] |
no_license
|
--
-- Add 'created' and 'updated' columns to 'book' table.
--
ALTER TABLE book ADD created TIMESTAMP;
ALTER TABLE book ADD updated TIMESTAMP;
UPDATE book SET created = DATETIME('NOW'), updated = DATETIME('NOW');
| true
|
1c34c67ada562c03a45be47b1a01464784b31d64
|
SQL
|
cgrutzmacher/students_db
|
/join_queries.sql
|
UTF-8
| 631
| 4.1875
| 4
|
[] |
no_license
|
SELECT s.name, cn.name from student s
LEFT OUTER JOIN coursesTaken ct ON s.id = ct.studentID
LEFT OUTER JOIN courseName cn ON ct.courseID = cn.id
ORDER BY s.name, cn.name;
SELECT s.name, COUNT(cn.name) AS 'Number of courses taken' FROM student s
LEFT OUTER JOIN coursesTaken ct ON s.id = ct.studentID
LEFT OUTER JOIN courseName cn ON ct.courseID = cn.id
GROUP BY s.name
ORDER BY s.name;
SELECT s.name, COUNT(cn.name) AS 'Number of courses taken' FROM student s
LEFT OUTER JOIN coursesTaken ct ON s.id = ct.studentID
LEFT OUTER JOIN courseName cn ON ct.courseID = cn.id
GROUP BY s.name
HAVING COUNT(cn.name) >= 3
ORDER BY s.name;
| true
|
3ac5e3a88661f120236c03b5cb82ef844eb3ca4f
|
SQL
|
JeremyDa/antdlib
|
/src/main/resources/database/antdlib-table.sql
|
UTF-8
| 5,815
| 3.1875
| 3
|
[] |
no_license
|
/*!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 */;
/*!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 */;
DROP TABLE IF EXISTS `exception`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `exception` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account` varchar(100) DEFAULT NULL,
`time` varchar(50) DEFAULT NULL,
`url` varchar(100) DEFAULT NULL,
`httpstatus` varchar(50) DEFAULT NULL,
`returnCode` varchar(10) DEFAULT NULL,
`returnMsg` text,
`stackTrace` text,
`param` text,
`levelid` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
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 COMMENT 'id',
`path` varchar(50) NOT NULL COMMENT '访问url',
`name` varchar(50) NOT NULL COMMENT '菜单名称',
`icon` varchar(20) DEFAULT NULL COMMENT '菜单图标',
`component` varchar(100) DEFAULT NULL COMMENT '组件路径',
`redirect` varchar(100) DEFAULT NULL COMMENT '重定向',
`parentid` int(11) NOT NULL COMMENT '上级菜单id',
`isoper` int(11) DEFAULT '0' COMMENT '是否为操作',
`hideInMenu` tinyint(1) DEFAULT '0' COMMENT '是否隐藏菜单',
`hideChildrenInMenu` tinyint(1) DEFAULT '0' COMMENT '是否隐藏子菜单',
`hideInBreadcrumb` tinyint(1) DEFAULT '0' COMMENT '隐藏面包屑',
`projectid` varchar(20) DEFAULT NULL COMMENT '项目id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=utf8 COMMENT='菜单';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `notice`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `notice` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`avatar` varchar(200) DEFAULT NULL,
`title` varchar(200) DEFAULT NULL,
`datetime` datetime DEFAULT NULL,
`description` varchar(200) DEFAULT NULL,
`type` varchar(20) DEFAULT NULL,
`clickClose` tinyint(1) DEFAULT NULL,
`status` varchar(20) DEFAULT NULL,
`extra` varchar(50) DEFAULT NULL,
`read` tinyint(1) DEFAULT '0',
`account` varchar(100) DEFAULT NULL,
`broadcast` tinyint(1) DEFAULT '0',
`from` varchar(50) DEFAULT NULL,
`issend` int(11) DEFAULT '0' COMMENT '1-已发送,0-未发送',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
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 COMMENT 'id',
`name` varchar(50) DEFAULT NULL COMMENT '角色名称',
`desc` varchar(100) DEFAULT NULL COMMENT '说明描述',
`levelid` varchar(100) DEFAULT NULL COMMENT '所属机构',
`projectid` varchar(20) DEFAULT NULL COMMENT '项目id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='角色表';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `rolemenu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `rolemenu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`roleid` int(11) DEFAULT NULL COMMENT '角色id',
`menuid` int(11) DEFAULT NULL COMMENT '菜单id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=187 DEFAULT CHARSET=utf8 COMMENT='角色菜单表';
/*!40101 SET character_set_client = @saved_cs_client */;
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 COMMENT 'id',
`account` varchar(100) DEFAULT NULL COMMENT '登录名',
`name` varchar(100) DEFAULT NULL COMMENT '用户昵称',
`roleid` int(11) DEFAULT NULL COMMENT '角色id',
`password` varchar(1000) DEFAULT '111fb4d92036323891a140cd49383f86' COMMENT '密码',
`state` int(11) DEFAULT NULL COMMENT '用户状态',
`levelid` varchar(200) DEFAULT '0' COMMENT '所属机构',
`phone` varchar(11) DEFAULT NULL COMMENT '联系电话',
`avatar` varchar(100) DEFAULT NULL COMMENT '头像',
PRIMARY KEY (`id`),
UNIQUE KEY `user_account_levelid_uindex` (`account`,`levelid`)
) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=utf8 COMMENT='用户表';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `version`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `version` (
`newest` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
| true
|
84127196c518971fc909560b3a6321845a3fa529
|
SQL
|
ElifKeles/Database-for-myShop
|
/project_updated.sql
|
UTF-8
| 14,687
| 3.4375
| 3
|
[] |
no_license
|
DROP DATABASE IF EXISTS `myShop`;
CREATE DATABASE `myShop`;
USE `myShop`;
SET NAMES utf8 ;
SET character_set_client = utf8mb4 ;
CREATE TABLE status
(
status_id INT PRIMARY KEY,
name VARCHAR(40)
);
INSERT INTO status VALUES(1, 'preparing');
INSERT INTO status VALUES(2, 'on the way');
INSERT INTO status VALUES(3, 'delivered');
CREATE TABLE brand
(
brand_id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(40)
);
INSERT INTO brand VALUES(1, 'Paper Company');
INSERT INTO brand VALUES(2, 'New Age Books');
INSERT INTO brand VALUES(3, 'Tech Zone');
INSERT INTO brand VALUES(4, 'Smart Roof');
INSERT INTO brand VALUES(5, 'Diamond');
INSERT INTO brand VALUES(6, 'Road Runners');
INSERT INTO brand VALUES(7, 'Wash');
INSERT INTO brand VALUES(8, 'FFood');
INSERT INTO brand VALUES(9, 'Starbucks');
INSERT INTO brand VALUES(10, 'Lego');
CREATE TABLE category
(
category_id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(40)
);
INSERT INTO category VALUES(1, 'stationery');
INSERT INTO category VALUES(2, 'book');
INSERT INTO category VALUES(3, 'technology');
INSERT INTO category VALUES(4, 'construction');
INSERT INTO category VALUES(5, 'accessory');
INSERT INTO category VALUES(6, 'shoe');
INSERT INTO category VALUES(7, 'cleaning');
INSERT INTO category VALUES(8, 'food');
INSERT INTO category VALUES(9, 'clothing');
INSERT INTO category VALUES(10, 'toy');
CREATE TABLE product
(
product_id INT PRIMARY KEY AUTO_INCREMENT,
category INT,
name VARCHAR(40),
brand_name VARCHAR(40),
FOREIGN KEY(category) REFERENCES category(category_id) ON DELETE SET NULL
);
INSERT INTO product VALUES(1, 1, 'pencils', 'Paper Company');
INSERT INTO product VALUES(2, 2, 'childrens books', 'New Age Books');
INSERT INTO product VALUES(3, 3, 'personal computer', 'Tech Zone');
INSERT INTO product VALUES(4, 4, 'clay', 'Smart Roof');
INSERT INTO product VALUES(5, 5, 'jewellery', 'Diamond');
INSERT INTO product VALUES(6, 6, 'running shoes', 'Road Runners');
INSERT INTO product VALUES(7, 7, 'detergent', 'Wash');
INSERT INTO product VALUES(8, 8, 'burger', 'FFood');
INSERT INTO product VALUES(9, 9, 'coffee', 'Starbucks');
INSERT INTO product VALUES(10, 10, 'lego', 'Lego');
CREATE TABLE product_price
(
product_id INT PRIMARY KEY,
price DECIMAL(6,2) NOT NULL
);
INSERT INTO product_price VALUES(1, 2);
INSERT INTO product_price VALUES(2, 5);
INSERT INTO product_price VALUES(3, 1500);
INSERT INTO product_price VALUES(4, 20);
INSERT INTO product_price VALUES(5, 20);
INSERT INTO product_price VALUES(6, 100);
INSERT INTO product_price VALUES(7, 10);
INSERT INTO product_price VALUES(8, 10);
INSERT INTO product_price VALUES(9, 100);
INSERT INTO product_price VALUES(10, 20);
CREATE TABLE product_quantity
(
product_id INT PRIMARY KEY,
quantity INT DEFAULT 1
);
INSERT INTO product_quantity VALUES(1, 100);
INSERT INTO product_quantity VALUES(2, 20);
INSERT INTO product_quantity VALUES(3, 20);
INSERT INTO product_quantity VALUES(4, 10);
INSERT INTO product_quantity VALUES(5, 100);
INSERT INTO product_quantity VALUES(6, 15);
INSERT INTO product_quantity VALUES(7, 100);
INSERT INTO product_quantity VALUES(8, 100);
INSERT INTO product_quantity VALUES(9, 10);
INSERT INTO product_quantity VALUES(10, 100);
CREATE TABLE employee
(
employee_id INT PRIMARY KEY ,
name VARCHAR(40),
surname VARCHAR(40),
birthday DATE,
phone VARCHAR(40),
salary INT
);
INSERT INTO employee VALUES(100, 'Sarah', 'Smith', '1968-02-19', '781-932-9754', 63996);
INSERT INTO employee VALUES(105, 'Clara', 'Brown', '1999-03-14', '804-427-9456', 110150);
INSERT INTO employee VALUES(303, 'Sam', 'Jackson', '1990-11-11', '719-724-7869', 94860);
INSERT INTO employee VALUES(401, 'Will', 'Blue', '1969-01-30', '407-231-8017', 52832);
INSERT INTO employee VALUES(598, 'Hailey', 'Grace', '1997-05-12', '312-480-8498', 32179);
INSERT INTO employee VALUES(688, 'Logan', 'Dawson', '1968-10-04', '615-641-4759', 77182);
INSERT INTO employee VALUES(771, 'Ann', 'Daniele', '1987-02-03', '941-527-3977', 67987);
INSERT INTO employee VALUES(101, 'Alex', 'Gordon', '1986-06-17', '559-181-3744', 119241);
INSERT INTO employee VALUES(900, 'George', 'Johnson', '1996-12-15', '404-246-3370', 62871);
INSERT INTO employee VALUES(102, 'Lisa', 'Woodson', '1987-07-14', NULL, 98926);
CREATE TABLE branch
(
branch_id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(40),
manager_id INT,
FOREIGN KEY(manager_id) REFERENCES employee(employee_id) ON DELETE SET NULL
);
INSERT INTO branch VALUES(1, 'New York', 101);
INSERT INTO branch VALUES(2, 'Buffalo', 102);
INSERT INTO branch VALUES(3, 'Chicago', 105);
CREATE TABLE employee_manager
(
employee_id INT PRIMARY KEY ,
manager_id INT,
FOREIGN KEY(manager_id) REFERENCES branch(manager_id)
);
INSERT INTO employee_manager VALUES(100, 105);
INSERT INTO employee_manager VALUES(105, NULL);
INSERT INTO employee_manager VALUES(303, 105);
INSERT INTO employee_manager VALUES(401, 105);
INSERT INTO employee_manager VALUES(598, 101);
INSERT INTO employee_manager VALUES(688, 101);
INSERT INTO employee_manager VALUES(771, 102);
INSERT INTO employee_manager VALUES(101, NULL);
INSERT INTO employee_manager VALUES(900, 102);
INSERT INTO employee_manager VALUES(102, NULL);
CREATE TABLE employee_branch
(
employee_id INT PRIMARY KEY ,
branch_id INT,
FOREIGN KEY(branch_id) REFERENCES branch(branch_id) ON DELETE SET NULL
);
INSERT INTO employee_branch VALUES(100, 3);
INSERT INTO employee_branch VALUES(105, 3);
INSERT INTO employee_branch VALUES(303, 3);
INSERT INTO employee_branch VALUES(401, 3);
INSERT INTO employee_branch VALUES(598, 1);
INSERT INTO employee_branch VALUES(688, 1);
INSERT INTO employee_branch VALUES(771, 2);
INSERT INTO employee_branch VALUES(101, 1);
INSERT INTO employee_branch VALUES(900, 2);
INSERT INTO employee_branch VALUES(102, 2);
CREATE TABLE customer
(
customer_id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(40),
surname VARCHAR(40),
birthday DATE,
phone VARCHAR(40),
address VARCHAR(40),
city VARCHAR(40),
state VARCHAR(40),
total_shopping INT
);
INSERT INTO customer VALUES(1, 'Julia', 'Williams', '1997-02-28', '579-161-3724', '0 Sage Terrace', 'Waltham', 'MA', 34);
INSERT INTO customer VALUES(2, 'Hayley', 'Wallace', '1999-10-24', '897-181-2135', '14187 Commercial Trail', 'Hampton', 'VA', 46);
INSERT INTO customer VALUES(3, 'Roger', 'Walker', '1988-07-21', '923-763-3741', '251 Springs Junction', 'Colorado Springs', 'CO', 19);
INSERT INTO customer VALUES(4, 'Jack', 'Kenneth', '1997-12-03', '561-182-9077', '30 Arapahoe Terrace', 'Orlando', 'FL', 1);
INSERT INTO customer VALUES(5, 'Edward', 'True', '1996-04-20', '908-243-7532', '5 Spohn Circle', 'Arlington', 'TX', 3);
INSERT INTO customer VALUES(6, 'Joe', 'Sparks', '1991-05-16', '887-156-9824', '34267 Glendale Parkway','Huntington','WV', 30 );
INSERT INTO customer VALUES(7, 'Taylor', 'Rose', '1994-09-30', '980-547-8743', '50 Lillian Crossing', 'Nashville', 'TN', 21);
INSERT INTO customer VALUES(8, 'Betty', 'James', '1998-01-11', '231-908-0909', '7 Manley Drive', 'Chicago', 'IL', 6);
INSERT INTO customer VALUES(9, 'Peter', 'Robinson', '1989-09-23', '332-652-9162', '520 Ohio Trail', 'Visalia', 'CA', 2);
INSERT INTO customer VALUES(10, 'Ketie', 'Thomas', '1967-11-19', '652-102-6790', '68 Lawn Avenue', 'Atlanta', 'GA', 5);
CREATE TABLE orders
(
order_id INT PRIMARY KEY AUTO_INCREMENT,
customer_id INT,
order_date DATE,
FOREIGN KEY(customer_id) REFERENCES customer(customer_id) ON DELETE SET NULL
);
INSERT INTO orders VALUES(1, 1, '2020-02-28' );
INSERT INTO orders VALUES(2, 2, '2020-01-03' );
INSERT INTO orders VALUES(3, 3, '2020-09-20' );
INSERT INTO orders VALUES(4, 4, '2021-01-29' );
INSERT INTO orders VALUES(5, 5, '2021-02-25' );
INSERT INTO orders VALUES(6, 6, '2020-05-08' );
INSERT INTO orders VALUES(7, 7, '2019-05-19' );
INSERT INTO orders VALUES(8, 8, '2020-06-22' );
INSERT INTO orders VALUES(9, 9, '2021-04-21' );
INSERT INTO orders VALUES(10, 10, '2021-01-05' );
CREATE TABLE order_status
(
order_id INT PRIMARY KEY,
status INT DEFAULT '1',
FOREIGN KEY(status) REFERENCES status(status_id)
);
INSERT INTO order_status VALUES(1, 3 );
INSERT INTO order_status VALUES(2, 3 );
INSERT INTO order_status VALUES(3, 3 );
INSERT INTO order_status VALUES(4, 2 );
INSERT INTO order_status VALUES(5, 1 );
INSERT INTO order_status VALUES(6, 3 );
INSERT INTO order_status VALUES(7, 3 );
INSERT INTO order_status VALUES(8, 3 );
INSERT INTO order_status VALUES(9, 1 );
INSERT INTO order_status VALUES(10, 2 );
CREATE TABLE invoice
(
invoice_id INT PRIMARY KEY AUTO_INCREMENT,
customer_id INT,
order_id INT,
FOREIGN KEY(customer_id) REFERENCES customer(customer_id) ON DELETE SET NULL,
FOREIGN KEY(order_id) REFERENCES orders(order_id) ON DELETE SET NULL
);
INSERT INTO invoice VALUES(1, 1, 1);
INSERT INTO invoice VALUES(2, 2, 2);
INSERT INTO invoice VALUES(3, 3, 3);
INSERT INTO invoice VALUES(4, 4, 4);
INSERT INTO invoice VALUES(5, 5, 5);
INSERT INTO invoice VALUES(6, 6, 6);
INSERT INTO invoice VALUES(7, 7, 7);
INSERT INTO invoice VALUES(8, 8, 8);
INSERT INTO invoice VALUES(9, 9, 9);
INSERT INTO invoice VALUES(10, 10, 10);
CREATE TABLE invoice_price
(
invoice_id INT PRIMARY KEY AUTO_INCREMENT,
total_price INT
);
INSERT INTO invoice_price VALUES(1, 2);
INSERT INTO invoice_price VALUES(2, 5);
INSERT INTO invoice_price VALUES(3, 1500);
INSERT INTO invoice_price VALUES(4, 20);
INSERT INTO invoice_price VALUES(5, 20);
INSERT INTO invoice_price VALUES(6, 100);
INSERT INTO invoice_price VALUES(7, 10);
INSERT INTO invoice_price VALUES(8, 10);
INSERT INTO invoice_price VALUES(9, 100);
INSERT INTO invoice_price VALUES(10, 20);
CREATE TABLE pays
(
payment_id INT PRIMARY KEY AUTO_INCREMENT,
customer_id INT,
order_id INT,
FOREIGN KEY(customer_id) REFERENCES customer(customer_id) ON DELETE SET NULL,
FOREIGN KEY(order_id) REFERENCES orders(order_id) ON DELETE SET NULL
);
INSERT INTO pays VALUES(1, 1, 1);
INSERT INTO pays VALUES(2, 2, 2);
INSERT INTO pays VALUES(3, 3, 3);
INSERT INTO pays VALUES(4, 4, 4);
INSERT INTO pays VALUES(5, 5, 5);
INSERT INTO pays VALUES(6, 6, 6);
INSERT INTO pays VALUES(7, 7, 7);
INSERT INTO pays VALUES(8, 8, 8);
INSERT INTO pays VALUES(9, 9, 9);
INSERT INTO pays VALUES(10, 10, 10);
CREATE TABLE pays_amount
(
payment_id INT PRIMARY KEY AUTO_INCREMENT,
amount INT
);
INSERT INTO pays_amount VALUES(1, 1);
INSERT INTO pays_amount VALUES(2, 1);
INSERT INTO pays_amount VALUES(3, 1);
INSERT INTO pays_amount VALUES(4, 1);
INSERT INTO pays_amount VALUES(5, 1);
INSERT INTO pays_amount VALUES(6, 1);
INSERT INTO pays_amount VALUES(7, 1);
INSERT INTO pays_amount VALUES(8, 1);
INSERT INTO pays_amount VALUES(9, 1);
INSERT INTO pays_amount VALUES(10, 1);
--VIEWS
--buff emp
CREATE VIEW Buffalo_Employees
AS
SELECT *
FROM employee_branch
WHERE
branch_id = 2
--managers
CREATE VIEW managers
AS
SELECT employee.employee_id, name, surname, birthday, phone, salary
FROM employee RIGHT JOIN employee_manager
ON employee.employee_id = employee_manager.manager_id;
--top customers
CREATE VIEW topCustomers
AS
SELECT *
FROM customer
WHERE
total_shopping > 20;
--delivered orders
CREATE VIEW deliveredOrders
AS
SELECT *
FROM order_status
WHERE
status = 3;
--books and stationery
CREATE VIEW booksAndStationery
AS
SELECT product_id, category, product.name, brand_name
FROM product
LEFT JOIN category
ON product.category= category.category_id
WHERE (category.name= 'stationery' OR category.name= 'book' )
UNION
SELECT product_id, category, product.name, brand_name
FROM product
RIGHT JOIN category
ON product.category= category.category_id
WHERE (category.name= 'stationery' OR category.name= 'book' );
--LEFT JOIN
--customers whose orders are 'on the way'
SELECT *
FROM customer
LEFT JOIN orders
ON customer.customer_id = orders.customer_id
LEFT JOIN order_status
ON orders.order_id = order_status.order_id
WHERE status= 2;
--RIGHT JOIN
--managers
SELECT *
FROM employee
RIGHT JOIN employee_manager
ON employee.employee_id = employee_manager.manager_id;
--OUTER JOIN
--books and stationery
SELECT product_id, category, product.name, brand_name
FROM product
LEFT JOIN category
ON product.category= category.category_id
WHERE (category.name= 'stationery' OR category.name= 'book' )
UNION
SELECT product_id, category, product.name, brand_name
FROM product
RIGHT JOIN category
ON product.category= category.category_id
WHERE (category.name= 'stationery' OR category.name= 'book' );
--TRIGGERS
CREATE TABLE trigger_test
(
message VARCHAR(100)
);
--test
INSERT INTO employee VALUES(501, 'Amy', 'Plath', '1988-12-13', '742-900-9124', 63944);
--update employee
DELIMITER $$
CREATE
TRIGGER update_employee
AFTER UPDATE
ON employee
FOR EACH ROW BEGIN
INSERT INTO trigger_test VALUES('An employee is updated int the database.' );
END$$
DELIMITER ;
--test
UPDATE employee
SET salary = 64000
WHERE employee_id = 501;
-- quantity--
DELIMITER $$
CREATE
TRIGGER update_quantity
AFTER UPDATE
ON product_quantity
FOR EACH ROW
BEGIN
INSERT INTO product_quantity SET product_id= old.product_id, quantity= old.quantity - 1;
END$$
DELIMITER ;
--update branch
DELIMITER $$
CREATE
TRIGGER add_branch
AFTER UPDATE
ON branch
FOR EACH ROW
BEGIN
IF
new.name != old.name OR new.manager_id != old.manager_id
THEN
INSERT INTO branch SET name = old.name, manager_id= old.manager_id;
END IF;
END$$
DELIMITER ;
--UPDATED AFTER REPORT
--updated as
--add employees
DELIMITER $$
CREATE
TRIGGER my_trigger
AFTER INSERT
ON employee
FOR EACH ROW BEGIN
INSERT INTO trigger_test VALUES('A new employee is added to database.' );
END$$
DELIMITER ;
--trigger
--delete employee
DELIMITER $$
CREATE
TRIGGER delete_employee
AFTER DELETE
ON employee
FOR EACH ROW BEGIN
INSERT INTO trigger_test VALUES('An employee is deleted from database.' );
END$$
DELIMITER ;
DELETE FROM employee WHERE employee_id= 503;
--updated as
--increment total shopping
--create a new invoice
DELIMITER $$
CREATE
TRIGGER update_shopping
AFTER INSERT
ON orders
FOR EACH ROW BEGIN
UPDATE customer SET total_shopping= total_shopping +1
WHERE customer_id= new.customer_id;
INSERT invoice(customer_id, order_id) values(new.customer_id, new.order_id);
END$$
DELIMITER ;
| true
|
65f02de24d9bc8a24cb3ac1ce874f3adae3c9667
|
SQL
|
GreyHumanBeing/Oracle_SQL
|
/4-Practica_DISTINCT.sql
|
UTF-8
| 149
| 2.703125
| 3
|
[] |
no_license
|
select distinct city
from locations;
select distinct department_id,
job_id
from employees
| true
|
801e382ef885649a67a526e9cf6c4905d138d3d7
|
SQL
|
LM-loleris/RobloxPrinter
|
/MYSQL_DATABASE.sql
|
UTF-8
| 6,365
| 3.015625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Mar 22, 2021 at 11:18 AM
-- Server version: 10.3.25-MariaDB-log
-- PHP Version: 7.4.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `RobloxPrinter`
--
-- --------------------------------------------------------
--
-- Table structure for table `AdminRequests`
--
CREATE TABLE `AdminRequests` (
`Id` int(11) NOT NULL,
`AdminId` int(11) NOT NULL,
`UserId` bigint(20) NOT NULL,
`Username` varchar(40) NOT NULL,
`Type` varchar(40) NOT NULL,
`Param` text NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`IsPrinted` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `Admins`
--
CREATE TABLE `Admins` (
`Id` int(11) NOT NULL,
`UserId` bigint(11) NOT NULL,
`PermissionLevel` int(11) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `BannedImages`
--
CREATE TABLE `BannedImages` (
`Id` int(11) NOT NULL,
`ImageId` bigint(20) NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `BannedUsers`
--
CREATE TABLE `BannedUsers` (
`Id` int(11) NOT NULL,
`UserId` bigint(20) NOT NULL,
`BannedForImageId` bigint(20) NOT NULL,
`AdminId` int(11) NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `ImageRequests`
--
CREATE TABLE `ImageRequests` (
`Id` int(11) NOT NULL,
`UserId` bigint(20) NOT NULL,
`Username` varchar(40) NOT NULL,
`ImageId` bigint(20) NOT NULL,
`RobuxPaid` int(11) NOT NULL DEFAULT 0,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`IsPrinted` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `PrinterConfig`
--
CREATE TABLE `PrinterConfig` (
`Id` int(11) NOT NULL,
`IsPrintingActive` tinyint(1) NOT NULL,
`IsStreamActive` tinyint(1) NOT NULL,
`IsScheduled` tinyint(1) NOT NULL,
`ScheduledStartTime` int(11) NOT NULL,
`ScheduledStopTime` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `PrinterSignal`
--
CREATE TABLE `PrinterSignal` (
`Id` int(11) NOT NULL,
`RestartApp` tinyint(1) NOT NULL,
`ShutdownApp` tinyint(1) NOT NULL,
`ShutdownDevice` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `PrinterStatus`
--
CREATE TABLE `PrinterStatus` (
`Id` int(11) NOT NULL,
`LastActive` bigint(20) NOT NULL DEFAULT 0,
`IsMaintenance` tinyint(1) NOT NULL DEFAULT 0,
`IsPaperLow` tinyint(1) NOT NULL,
`IsOn` tinyint(1) NOT NULL DEFAULT 0,
`IpLocal` text NOT NULL DEFAULT '0.0.0.0',
`IpPublic` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `SpecialRequests`
--
CREATE TABLE `SpecialRequests` (
`Id` int(11) NOT NULL,
`UserId` bigint(20) NOT NULL,
`Username` varchar(40) NOT NULL,
`Type` varchar(40) NOT NULL,
`Param` text NOT NULL,
`RobuxPaid` int(11) NOT NULL DEFAULT 0,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`IsPrinted` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `AdminRequests`
--
ALTER TABLE `AdminRequests`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `Admins`
--
ALTER TABLE `Admins`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `BannedImages`
--
ALTER TABLE `BannedImages`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `BannedUsers`
--
ALTER TABLE `BannedUsers`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `ImageRequests`
--
ALTER TABLE `ImageRequests`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `PrinterConfig`
--
ALTER TABLE `PrinterConfig`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `PrinterSignal`
--
ALTER TABLE `PrinterSignal`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `PrinterStatus`
--
ALTER TABLE `PrinterStatus`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `SpecialRequests`
--
ALTER TABLE `SpecialRequests`
ADD PRIMARY KEY (`Id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `AdminRequests`
--
ALTER TABLE `AdminRequests`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `Admins`
--
ALTER TABLE `Admins`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `BannedImages`
--
ALTER TABLE `BannedImages`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `BannedUsers`
--
ALTER TABLE `BannedUsers`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `ImageRequests`
--
ALTER TABLE `ImageRequests`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `PrinterConfig`
--
ALTER TABLE `PrinterConfig`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `PrinterSignal`
--
ALTER TABLE `PrinterSignal`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `PrinterStatus`
--
ALTER TABLE `PrinterStatus`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `SpecialRequests`
--
ALTER TABLE `SpecialRequests`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
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
|
46ab23d62467295e8cdabcbaef5cecda50ddff12
|
SQL
|
matthewrmettler/wikidelve
|
/db/queries/database_creation.sql
|
UTF-8
| 471
| 3.59375
| 4
|
[] |
no_license
|
CREATE TABLE entity (
id INTEGER PRIMARY KEY AUTOINCREMENT,
wiki_id INTEGER NOT NULL,
name text NOT NULL
);
CREATE UNIQUE INDEX idx_entity_wiki_id
ON entity (wiki_id);
CREATE TABLE entity_associations (
entity_id INTEGER PRIMARY KEY,
associated_ids text NOT NULL
);
CREATE TABLE lists (
list_id INTEGER PRIMARY KEY,
list_name text NOT NULL
);
CREATE TABLE list_associations (
list_id INTEGER PRIMARY KEY,
entity_id text NOT NULL
);
| true
|
6e7f0b7c05c991c0f11c0cc51807f060a8009f93
|
SQL
|
nicolassnider/ms_sql_server_2019_development
|
/Facturas/create_table_Pedido.sql
|
UTF-8
| 273
| 3.078125
| 3
|
[] |
no_license
|
use Facturas
create table Pedido(
id int identity(1,1) not null,
fecha smalldatetime,
dni varchar(10) not null,
constraint pk_pedido PRIMARY KEY(
id ASC
),
constraint fk_pedido_cliente FOREIGN KEY(
dni
) REFERENCES Cliente
)
| true
|
02b1f20df2c64ffbc3cc7e34d00513d06c1c39ad
|
SQL
|
carlos793/QuerySql
|
/1_Base_triggers.sql
|
ISO-8859-1
| 1,115
| 3.671875
| 4
|
[] |
no_license
|
USE CURSO
--DROP TABLE FUNC
CREATE TABLE FUNC (
MATRICULA INT IDENTITY(1,1) PRIMARY KEY,
NOME VARCHAR(30) NOT NULL,
SOBRENOME VARCHAR (30) NOT NULL,
ENDERECO VARCHAR (30) NOT NULL,
CIDADE VARCHAR (30) NOT NULL,
ESTADO VARCHAR (2) NOT NULL,
DATA_NASC DATETIME
) ;
insert into func values ('Steve','Morse','Rua 13','JUNDIAI','SP','1977-11-05')
insert into func values ('Joao','Pedro','Rua 14','SO PAULO','SP','1980-27-10')
insert into func values ('Maria','Clara','Rua 15','RIBERAO PRETO','SP','1985-05-05')
insert into func values ('Pedro','Luiz','Rua 16','CAMPINAS','SP','1990-12-09')
--SELECT * FROM FUNC
--DROP TABLE auditoria_salario
create table auditoria_salario (
matricula varchar(30) not null,
sal_antes decimal(10,2) not null,
sal_depois decimal(10,2) not null,
usuario varchar(20) not null,
data_atualizacao datetime not null
);
--DROP TABLE SALARIO
CREATE TABLE SALARIO
( matricula INT NOT NULL,
SALARIO DECIMAL(10,2) NOT NULL
);
insert into SALARIO values (1,1000)
insert into SALARIO values (2,1500)
insert into SALARIO values (3,2000)
insert into SALARIO values (4,2500)
| true
|
df89092c04b3fd8697cf2b6611f98e16725738c9
|
SQL
|
shahimian/module-activities-timer
|
/models/db.sql
|
UTF-8
| 2,125
| 3.375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: 2019-06-15 11:53:25
-- Server version: 5.7.25-cll-lve
-- PHP Version: 7.2.7
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 */;
--
-- Table structure for table `sit_activities`
--
CREATE TABLE `sit_activities` (
`activity_id` int(11) NOT NULL,
`user_id` bigint(20) DEFAULT NULL,
`name` text COLLATE utf8_persian_ci,
`value` int(11) DEFAULT NULL,
`iteration` int(11) DEFAULT NULL,
`break` int(11) DEFAULT NULL,
`total_iteration` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Table structure for table `sit_activities_scenario`
--
CREATE TABLE `sit_activities_scenario` (
`scenario_id` int(11) NOT NULL,
`user_id` bigint(20) DEFAULT NULL,
`name` text COLLATE utf8_persian_ci,
`scenario` text COLLATE utf8_persian_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Indexes for table `sit_activities`
--
ALTER TABLE `sit_activities`
ADD PRIMARY KEY (`activity_id`),
ADD KEY `user` (`user_id`);
--
-- Indexes for table `sit_activities_scenario`
--
ALTER TABLE `sit_activities_scenario`
ADD PRIMARY KEY (`scenario_id`),
ADD KEY `user` (`user_id`);
--
-- AUTO_INCREMENT for table `sit_activities`
--
ALTER TABLE `sit_activities`
MODIFY `activity_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sit_activities_scenario`
--
ALTER TABLE `sit_activities_scenario`
MODIFY `scenario_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for table `sit_activities`
--
ALTER TABLE `sit_activities`
ADD CONSTRAINT `user` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);
COMMIT;
| true
|
ea8c83e561aef7260ab523abf17d75ccd39ff984
|
SQL
|
zefredz/claroline-packages
|
/modules/ICEPC/setup/install.sql
|
UTF-8
| 1,180
| 3.0625
| 3
|
[] |
no_license
|
CREATE TABLE IF NOT EXISTS `__CL_MAIN__epc_user_data` (
`user_id` int(11) NOT NULL,
`noma` varchar(12) NOT NULL,
`sigle_anet` varchar(32) NOT NULL,
`other_data` text,
`last_sync` datetime DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM;
CREATE TABLE IF NOT EXISTS `__CL_MAIN__epc_class_data` (
`class_name` varchar(255) NOT NULL,
`last_sync` datetime DEFAULT '0000-00-00 00:00:00',
`last_error` datetime DEFAULT '0000-00-00 00:00:00',
`details` TEXT,
PRIMARY KEY (`class_name`)
) ENGINE=MyISAM;
CREATE TABLE IF NOT EXISTS `__CL_MAIN__epc_log` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`class_id` INT(11),
`class_name` varchar(255) NOT NULL,
`date` datetime DEFAULT '0000-00-00 00:00:00',
`action` VARCHAR(32) NOT NULL,
`course_id` VARCHAR(255),
`user_id` INT(11) NOT NULL,
`client_ip` VARCHAR(32) NOT NULL,
`client_forwarded_ip` VARCHAR(32),
`status` ENUM('log','success','error') NOT NULL,
`message` TEXT,
PRIMARY KEY (`id`),
KEY(`class_id`),
KEY(`class_name`),
KEY(`date`),
KEY(`course_id`),
KEY(`user_id`),
KEY(`status`)
) ENGINE=MyISAM;
| true
|
773dd27161852901ea3f82345b7fb688a600c535
|
SQL
|
georgetown-cset/unicorn-topics
|
/sql/selecting_ai_dimensions_publication_ids_top_organizations.sql
|
UTF-8
| 1,219
| 3.671875
| 4
|
[] |
no_license
|
-- get the ids and a little supplementary data for all the dimensions papers from the top organizations
CREATE OR REPLACE TABLE
project_unicorn.dimensions_publication_ids_top_organizations_052920 AS (
SELECT
-- get all the info we care about for these papers
unicorn.* EXCEPT (Grid_ID),
wos_subject,
mag_subject,
papers.* EXCEPT (grids),
FROM (
-- pull the paper id and their grid values from the dimensions publications table
SELECT
id,
grids
FROM
`gcp-cset-projects.project_unicorn.dimensions_publications_with_abstracts_052920`,
UNNEST(author_affiliations) AS author_affils,
UNNEST(author_affils.grid_ids) AS grids) AS papers
-- only pull the papers from top organizations
INNER JOIN (
SELECT
*
FROM
project_unicorn.top_organizations,
UNNEST(Grid_ID) AS gridval) AS unicorn
ON
papers.grids = unicorn.gridval
-- only pull the AI papers; add in some info from the AI paper dataset
INNER JOIN (
SELECT
ds_id,
wos_subject,
mag_subject,
arxiv_scibert_hit
FROM
project_unicorn.definitions_brief_082120) AS ai
ON
papers.id = ai.ds_id
WHERE
arxiv_scibert_hit=TRUE)
| true
|
7e28ee5abd7ab937698b44f79adc067a247077df
|
SQL
|
yesicanoemi/trascend-bi
|
/trascend-bi/StoredProcedures/Empleados/Modificar/ModificarEmpleado.sql
|
UTF-8
| 887
| 3.421875
| 3
|
[] |
no_license
|
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE ModificarEmpleado
-- Add the parameters for the stored procedure here
@id int,
@nombreEmpleado varchar(50),
@apellidoEmpleado varchar(50),
@numeroCta varchar(50),
@fechaNac datetime,
@sueldo float,
@cargo int,
@Estado int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.Empleado
SET Nombre = @nombreEmpleado,
Apellido = @apellidoEmpleado,
NumCuenta = @numeroCta,
IdCargo = @cargo,
FechaNac = @fechaNac,
Sueldo = @sueldo,
Estado = @Estado
where CIEmpleado = @id
END
| true
|
3200ac68b25fc4ca7f9d980fa4b846a32178c8c5
|
SQL
|
Alexdavv/GeoVocabs
|
/US Census/US_Census_voc.sql
|
UTF-8
| 6,146
| 4.0625
| 4
|
[] |
no_license
|
-- Creation of divisions temporary table with link to region
DROP TABLE IF EXISTS divisions;
CREATE TABLE divisions
(
gid int,
divisionce varchar(1),
affgeoid varchar(10),
geoid varchar(1),
name varchar(100),
lsad varchar(2),
aland double precision,
awater double precision,
region_code varchar(50)
);
-- Population of divisions temporary table with link to region
INSERT INTO divisions
SELECT gid,
divisionce,
affgeoid,
geoid,
name,
lsad,
aland,
awater,
CASE
WHEN name in ('New England' ,'Middle Atlantic')
THEN '0200000US1'
WHEN name in ('East North Central', 'West North Central')
THEN '0200000US2'
WHEN name in ('East South Central', 'West South Central', 'South Atlantic')
THEN '0200000US3'
WHEN name in ('Mountain', 'Pacific')
THEN '0200000US4'
END as region_code
FROM sources.cb_us_division_500k;
-- Creation of states temporary table with link to divisions
DROP TABLE IF EXISTS states;
CREATE TABLE states
(
state_concept_code varchar(50), --OSM concept_codes
division_concept_code varchar(50)
);
-- Population of states temporary table with link to divisions
INSERT INTO states
SELECT id,
CASE WHEN name in ('Connecticut', 'Maine', 'Massachusetts', 'New Hampshire', 'Rhode Island', 'Vermont')
THEN '0300000US1' --Division 1: New England
WHEN name in ('New Jersey', 'New York', 'Pennsylvania')
THEN '0300000US2' --Division 2: Middle Atlantic
WHEN name in ('Illinois', 'Indiana', 'Michigan', 'Ohio', 'Wisconsin')
THEN '0300000US3' --Division 3: East North Central
WHEN name in ('Iowa', 'Kansas', 'Minnesota', 'Missouri', 'Nebraska', 'North Dakota', 'South Dakota')
THEN '0300000US4' --Division 4: West North Central
WHEN name in ('Delaware', 'District of Columbia', 'Florida', 'Georgia', 'Maryland', 'North Carolina', 'South Carolina', 'Virginia', 'West Virginia')
THEN '0300000US5' --Division 5: South Atlantic
WHEN name in ('Alabama', 'Kentucky', 'Mississippi', 'Tennessee')
THEN '0300000US6' --Division 6: East South Central
WHEN name in ('Arkansas', 'Louisiana', 'Oklahoma', 'Texas')
THEN '0300000US7' --Division 7: West South Central
WHEN name in ('Arizona', 'Colorado', 'Idaho', 'Montana', 'Nevada', 'New Mexico', 'Utah', 'Wyoming')
THEN '0300000US8' --Division 8: Mountain
WHEN name in ('Alaska', 'California', 'Hawaii', 'Oregon', 'Washington')
THEN '0300000US9' --Division 9: Pacific
ELSE '0'
END as division_concept_code
FROM boundaries_hierarchy
WHERE country = 'USA'
AND adminlevel = 4;
-- Population of stages
-- Population of concept_stage
-- US Census regions
INSERT INTO concept_stage
SELECT NULL as concept_id,
name as concept_name,
'Geography' as domain_id,
'US Census' as vocabulary_id,
'US Census Region' as concept_class_id,
'S' as standard_concept,
affgeoid as concept_code,
TO_DATE('19700101','yyyymmdd') as valid_start_date,
TO_DATE('20991231','yyyymmdd') as valid_end_date,
null as invalid_reason
FROM sources.cb_us_region_500k;
-- US Census divisions
INSERT INTO concept_stage
SELECT NULL as concept_id,
name as concept_name,
'Geography' as domain_id,
'US Census' as vocabulary_id,
'US Census Division' as concept_class_id,
'S' as standard_concept,
affgeoid as concept_code,
TO_DATE('19700101','yyyymmdd') as valid_start_date,
TO_DATE('20991231','yyyymmdd') as valid_end_date,
null as invalid_reason
FROM sources.cb_us_division_500k;
-- Population of concept_synonym_stage
-- US Census regions
INSERT INTO concept_synonym_stage
SELECT NULL as synonym_concept_id,
'Region ' || geoid || ': ' || name as synonym_name,
affgeoid as synonym_concept_code,
'US Census' as synonym_vocabulary_id,
4180186 as language_concept_id
FROM sources.cb_us_region_500k;
-- US Census divisions
INSERT INTO concept_synonym_stage
SELECT NULL as synonym_concept_id,
'Division ' || geoid || ': ' || name as synonym_name,
affgeoid as synonym_concept_code,
'US Census' as synonym_vocabulary_id,
4180186 as language_concept_id
FROM sources.cb_us_division_500k;
--Population of concept_relationship_manual
-- US Census regions
INSERT INTO concept_relationship_manual
SELECT affgeoid as concept_code_1,
'148838' as concept_code_2, --United States
'US Census' as vocabulary_id_1,
'OSM' as vocabulary_id_2,
'Is a' as relationship_id,
TO_DATE('19700101','yyyymmdd') as valid_start_date,
TO_DATE('20991231','yyyymmdd') as valid_end_date,
NULL as invalid_reason
FROM sources.cb_us_region_500k;
-- US Census divisions
INSERT INTO concept_relationship_manual
SELECT affgeoid as concept_code_1,
region_code as concept_code_2,
'US Census' as vocabulary_id_1,
'US Census' as vocabulary_id_2,
'Is a' as relationship_id,
TO_DATE('19700101','yyyymmdd') as valid_start_date,
TO_DATE('20991231','yyyymmdd') as valid_end_date,
NULL as invalid_reason
FROM divisions;
-- US states
INSERT INTO concept_relationship_manual
SELECT state_concept_code as concept_code_1,
division_concept_code as concept_code_2,
'OSM' as vocabulary_id_1,
'US Census' as vocabulary_id_2,
'Is a' as relationship_id,
TO_DATE('19700101','yyyymmdd') as valid_start_date,
TO_DATE('20991231','yyyymmdd') as valid_end_date,
NULL as invalid_reason
FROM states
WHERE division_concept_code <> '0';
--Removing old OSM relationships between USA and target states
DELETE FROM concept_relationship_stage
WHERE concept_code_2 = '148838' --United States
AND concept_code_1 in (
SELECT state_concept_code
FROM states
WHERE division_concept_code <> '0'
);
--Clean up
DROP TABLE states;
DROP TABLE divisions;
| true
|
f5d9b901ff226e878f08f4f29763e006272cd5f1
|
SQL
|
PNNL-Comp-Mass-Spec/DBSchema_PgSQL_DMS
|
/dms/pc/pc.t_encrypted_collection_passphrases.sql
|
UTF-8
| 1,280
| 3.359375
| 3
|
[
"Apache-2.0"
] |
permissive
|
--
-- Name: t_encrypted_collection_passphrases; Type: TABLE; Schema: pc; Owner: d3l243
--
CREATE TABLE pc.t_encrypted_collection_passphrases (
passphrase_id integer NOT NULL,
passphrase public.citext NOT NULL,
protein_collection_id integer NOT NULL
);
ALTER TABLE pc.t_encrypted_collection_passphrases OWNER TO d3l243;
--
-- Name: t_encrypted_collection_passphrases_passphrase_id_seq; Type: SEQUENCE; Schema: pc; Owner: d3l243
--
ALTER TABLE pc.t_encrypted_collection_passphrases ALTER COLUMN passphrase_id ADD GENERATED ALWAYS AS IDENTITY (
SEQUENCE NAME pc.t_encrypted_collection_passphrases_passphrase_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: t_encrypted_collection_passphrases pk_t_encrypted_collection_passphrases; Type: CONSTRAINT; Schema: pc; Owner: d3l243
--
ALTER TABLE ONLY pc.t_encrypted_collection_passphrases
ADD CONSTRAINT pk_t_encrypted_collection_passphrases PRIMARY KEY (passphrase_id);
--
-- Name: TABLE t_encrypted_collection_passphrases; Type: ACL; Schema: pc; Owner: d3l243
--
GRANT SELECT ON TABLE pc.t_encrypted_collection_passphrases TO readaccess;
GRANT SELECT ON TABLE pc.t_encrypted_collection_passphrases TO writeaccess;
| true
|
03eb43cf80b716cffab0aefefd2ad30968771252
|
SQL
|
lishewen/WMS
|
/docs/初始化文件/清空数据库.sql
|
UTF-8
| 2,991
| 2.75
| 3
|
[
"MIT"
] |
permissive
|
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE IT_LocalDetail;
TRUNCATE TABLE IT_LocalMaterial;
TRUNCATE TABLE IT_RecordBook;
TRUNCATE TABLE TD_Allocate;
TRUNCATE TABLE TD_AllocateDetail;
TRUNCATE TABLE TD_Bad;
TRUNCATE TABLE TD_BadDetail;
TRUNCATE TABLE TD_Check;
TRUNCATE TABLE TD_CheckArea;
TRUNCATE TABLE TD_CheckData;
TRUNCATE TABLE TD_CheckMaterial;
TRUNCATE TABLE TD_InStorDetail;
TRUNCATE TABLE TD_InStorage;
TRUNCATE TABLE TD_Move;
TRUNCATE TABLE TD_MoveDetail;
TRUNCATE TABLE TD_OutStorDetail;
TRUNCATE TABLE TD_OutStorage;
TRUNCATE TABLE TD_Receiving
TRUNCATE TABLE TD_RecDetail
TRUNCATE TABLE TD_Send
TRUNCATE TABLE TD_SendDetail
TRUNCATE TABLE PB_Address;
TRUNCATE TABLE PB_AreaMaterial;
TRUNCATE TABLE PB_BarCode;
TRUNCATE TABLE PB_BarCodeSerial;
TRUNCATE TABLE PB_Customer;
TRUNCATE TABLE PB_Equipment;
TRUNCATE TABLE PB_FeedPoint;
TRUNCATE TABLE PB_Laneway;
TRUNCATE TABLE PB_LocalTray;
TRUNCATE TABLE PB_Location;
TRUNCATE TABLE PB_Material;
TRUNCATE TABLE PB_MaterialPoint;
TRUNCATE TABLE PB_MaterialType;
TRUNCATE TABLE PB_Measure;
TRUNCATE TABLE PB_Rack;
TRUNCATE TABLE PB_StorArea;
TRUNCATE TABLE PB_Storage;
TRUNCATE TABLE PB_Supplier;
TRUNCATE TABLE PB_Tray;
TRUNCATE TABLE PB_TrayMaterial;
TRUNCATE TABLE PB_TrayType;
TRUNCATE TABLE PB_TrayZone;
TRUNCATE TABLE PD_Plan;
TRUNCATE TABLE Base_BuildTest;
TRUNCATE TABLE Base_DbLink;
TRUNCATE TABLE Base_Department;
TRUNCATE TABLE Base_Role;
TRUNCATE TABLE Base_RoleAction;
TRUNCATE TABLE Base_User;
TRUNCATE TABLE Base_UserLog;
TRUNCATE TABLE Base_UserRole;
TRUNCATE TABLE Base_UserStor;
SET FOREIGN_KEY_CHECKS = 1;
INSERT INTO `Base_User`(`Id`, `CreateTime`, `CreatorId`, `Deleted`, `UserName`, `Password`, `RealName`, `Sex`, `Birthday`, `DepartmentId`) VALUES ('Admin', NOW(), 'Admin', 0, 'Admin', 'e10adc3949ba59abbe56e057f20f883e', '超级管理员', 1, '2020-01-01', NULL);
INSERT INTO `Base_Department`(`Id`, `CreateTime`, `CreatorId`, `Deleted`, `Name`, `ParentId`) VALUES ('1', NOW(), 'Admin', 0, '集团总部', NULL);
INSERT INTO `Base_Role`(`Id`, `CreateTime`, `CreatorId`, `Deleted`, `RoleName`) VALUES ('1', NOW(), NULL, 0, '超级管理员');
INSERT INTO `Base_RoleAction`(`Id`, `CreateTime`, `CreatorId`, `Deleted`, `RoleId`, `ActionId`)
SELECT CAST((@rownum :=@rownum+1) AS CHAR),NOW(),NULL,0,'1',Id FROM Base_Action t,(SELECT @rownum := 0) b ORDER BY t.Id;
INSERT INTO `Base_UserRole`(`Id`, `CreateTime`, `CreatorId`, `Deleted`, `UserId`, `RoleId`) VALUES ('1', NOW(), NULL, 0, 'Admin', '1');
INSERT INTO `PB_Storage`(`Id`, `Code`, `Name`, `Type`, `IsTray`, `IsZone`, `disable`, `IsDefault`, `Remarks`, `CreateTime`, `CreatorId`, `Deleted`) VALUES ('1', 'CK001', '默认仓库', 'Plane', 0, 0, 1, 0, NULL, NOW(), 'Admin', 0);
INSERT INTO `Base_UserStor`(`Id`, `UserId`, `StorId`, `IsDefault`, `CreateTime`, `CreatorId`, `Deleted`) VALUES ('1', '1', '1', 1, NOW(), 'Admin', 0);
INSERT INTO `PB_BarCodeSerial`(`Id`, `TypeId`, `ParaName`, `ParaValue`, `SerialNum`) VALUES ('1', '1265898274779303936', 'Serial', '', 1);
| true
|
b202b3197aed808e7fa33c8ff0cdc905d384197b
|
SQL
|
BerbeceAndrei/CarTrackerDatabase
|
/car_tracker_DDL.sql
|
UTF-8
| 3,128
| 3.5
| 4
|
[] |
no_license
|
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema car_trackerdb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema car_trackerdb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `car_trackerdb` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;
USE `car_trackerdb` ;
-- -----------------------------------------------------
-- Table `car_trackerdb`.`users`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `car_trackerdb`.`users` ;
CREATE TABLE IF NOT EXISTS `car_trackerdb`.`users` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(60) NOT NULL,
`last_name` VARCHAR(60) NOT NULL,
`email` VARCHAR(60) NOT NULL,
`password` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = InnoDB
AUTO_INCREMENT = 7
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
-- -----------------------------------------------------
-- Table `car_trackerdb`.`user_cars`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `car_trackerdb`.`user_cars` ;
CREATE TABLE IF NOT EXISTS `car_trackerdb`.`user_cars` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_user` INT(11) UNSIGNED NOT NULL,
`car_name` VARCHAR(45) NOT NULL,
`longitude` DOUBLE NULL DEFAULT NULL,
`latitude` DOUBLE NULL DEFAULT NULL,
`timestamp` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `user_to _car_idx` (`id_user` ASC),
CONSTRAINT `user_to _car`
FOREIGN KEY (`id_user`)
REFERENCES `car_trackerdb`.`users` (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
-- -----------------------------------------------------
-- Table `car_trackerdb`.`cars_history`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `car_trackerdb`.`cars_history` ;
CREATE TABLE IF NOT EXISTS `car_trackerdb`.`cars_history` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_car` INT(11) UNSIGNED NOT NULL,
`longitude` DOUBLE NULL DEFAULT NULL,
`latitude` DOUBLE NULL DEFAULT NULL,
`timestamp` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `idcar_history_idx` (`id_car` ASC),
CONSTRAINT `idcar_history`
FOREIGN KEY (`id_car`)
REFERENCES `car_trackerdb`.`user_cars` (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true
|
35aa0ae83af01c5d4671f3bc8c0e0dc5892d16a2
|
SQL
|
rajeshsaha782/Java-projects
|
/SuperShop-Project/group_3.sql
|
UTF-8
| 3,247
| 3.125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 01, 2017 at 09:33 PM
-- Server version: 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: `group_3`
--
-- --------------------------------------------------------
--
-- Table structure for table `adminstrator`
--
CREATE TABLE `adminstrator` (
`AID` varchar(5) NOT NULL,
`PASS` varchar(5) NOT NULL,
`NAME` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `adminstrator`
--
INSERT INTO `adminstrator` (`AID`, `PASS`, `NAME`) VALUES
('12345', '12345', 'Rajesh'),
('54321', '54321', 'Robi Ullah');
-- --------------------------------------------------------
--
-- Table structure for table `customer`
--
CREATE TABLE `customer` (
`CID` varchar(5) NOT NULL,
`PASS` varchar(5) NOT NULL,
`NAME` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `customer`
--
INSERT INTO `customer` (`CID`, `PASS`, `NAME`) VALUES
('1', '1', 'Efti'),
('2', '2', 'Reza'),
('w', '2', 'Rakib');
-- --------------------------------------------------------
--
-- Table structure for table `employee`
--
CREATE TABLE `employee` (
`EID` varchar(5) NOT NULL,
`PASS` varchar(5) NOT NULL,
`NAME` varchar(20) NOT NULL,
`SALARY` double(10,2) NOT NULL,
`DESIGNATION` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `employee`
--
INSERT INTO `employee` (`EID`, `PASS`, `NAME`, `SALARY`, `DESIGNATION`) VALUES
('1', '1', 'limon', 9500.00, 'Recieptionist'),
('2', '2', 'Efti', 100000.00, 'Casher'),
('3', '2', 'Reza', 50000.00, 'Sells Manager');
-- --------------------------------------------------------
--
-- Table structure for table `product`
--
CREATE TABLE `product` (
`PID` varchar(5) NOT NULL,
`PNAME` varchar(20) NOT NULL,
`COMPANY_NAME` varchar(20) NOT NULL,
`PRICE` double(6,2) NOT NULL,
`INVENTORY` int(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `product`
--
INSERT INTO `product` (`PID`, `PNAME`, `COMPANY_NAME`, `PRICE`, `INVENTORY`) VALUES
('11', 'DEW', 'DEW', 20.00, 50),
('12', 'LUX', 'LUX', 38.00, 20),
('13', 'MOJO', 'MOJO', 16.00, 30),
('14', 'MOJO', 'MOJO', 65.00, 7),
('15', 'FOGG', 'FOGG', 210.00, 25),
('16', 'DOVE', 'DOVE', 50.00, 33);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `adminstrator`
--
ALTER TABLE `adminstrator`
ADD PRIMARY KEY (`AID`);
--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
ADD PRIMARY KEY (`CID`);
--
-- Indexes for table `employee`
--
ALTER TABLE `employee`
ADD PRIMARY KEY (`EID`);
--
-- Indexes for table `product`
--
ALTER TABLE `product`
ADD PRIMARY KEY (`PID`);
/*!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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.