text stringlengths 6 9.38M |
|---|
drop schema unified cascade;
create schema unified;
create table unified.D_labels as select label_id, name from discog.labels;
create table unified.D_releases_labels as select label_id, release_id from discog.releases_labels;
create table unified.D_genres as select genre_id, name from discog.genres;
create table unified.D_releases_genres as select genre_id, release_id from discog.releases_genres;
create table unified.D_releases_formats as select release_id, format_type from discog.releases_formats;
create table unified.D_releases_artists as select release_id, artist_id from discog.releases_artists;
create table unified.D_releases_MB_release as select status, language, artist_credit, release_group, release_id as d_id, id as mb_id, mb.name, title, num_tracks, released, country, mb.year from musicbrainz.release mb, discog.releases d
where mb.name = d.title;
create table unified.MB_artist_credit_name as select artist_credit as artist_credit_id, artist as mb_artist_id, name from musicbrainz.artist_credit_name;
create table unified.MB_artist_credit_junction as select id as artist_credit_id, artist_count, name from musicbrainz.artist_credit;
create table unified.MB_D_artist as select area, tist_id as d_artist_id, id as mb_artist_name_id, gender, type as mb_artist_type_id, mb.name from musicbrainz.artist mb, discog.artists d
where mb.name = d.name;
create table unified.MB_gender as select id as gender_id, name from musicbrainz.gender;
create table unified.MB_release_status as select id as release_status_id, name from musicbrainz.release_status;
create table unified.MB_release_packaging as select id as release_packaging_id, name from musicbrainz.release_packaging;
create table unified.MB_language as select id as language_id, name from musicbrainz.language;
create table unified.MB_release_alias as select id as release_alias_id, release as release_id, type as release_alias_type_id, sort_name, name from musicbrainz.release_alias;
create table unified.MB_release_alias_type as select id as release_alias_type_id, name from musicbrainz.release_alias_type;
create table unified.MB_release_group as select id as release_group_id, artist_credit as artist_credit_id, type as release_group_type_id, name from musicbrainz.release_group;
create table unified.MB_artist_type as select id as artist_type_id, name from musicbrainz.artist_type;
create table unified.MB_artist_alias as select id as artist_alias_id, artist as artist_id, type as artist_alias_type_id, sort_name, name from musicbrainz.artist_alias;
create table unified.MB_artist_alias_type as select id as artist_alias_type_id, name from musicbrainz.artist_alias_type;
create table unified.mb_area as select id as area_id, type as area_type_id, name from musicbrainz.area;
create table unified.mb_area_type as select id as area_type_id, name from musicbrainz.area_type;
create table unified.mb_area_alias as select id as area_alias_id, area as area_id, type as area_alias_type_id, name from musicbrainz.area_alias;
create table unified.mb_area_alias_type as select id as area_alias_type_id, name from musicbrainz.area_alias_type;
|
SELECT
category,
COUNT(category)
FROM
store
GROUP BY
category;
|
-- 레시피 화면
select id, name, small_image_location, calorie, carbohydrate, protein, fat, natrium from food where id = 387;
select * from food_recipe where food_id = 387 order by ord asc;
select * from food_ingredients where food_id = 387;
|
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1
Source Server Version : 50532
Source Host : 127.0.0.1:3306
Source Database : dropship
Target Server Type : MYSQL
Target Server Version : 50532
File Encoding : 65001
Date: 2018-07-25 17:05:28
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`pk_category` int(255) NOT NULL AUTO_INCREMENT,
`category` varchar(255) NOT NULL,
PRIMARY KEY (`pk_category`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of category
-- ----------------------------
INSERT INTO `category` VALUES ('1', 'Shawl');
INSERT INTO `category` VALUES ('2', 'Bawal');
INSERT INTO `category` VALUES ('99', '- Choose Category-');
-- ----------------------------
-- Table structure for color
-- ----------------------------
DROP TABLE IF EXISTS `color`;
CREATE TABLE `color` (
`pk_color` int(255) NOT NULL AUTO_INCREMENT,
`color` varchar(255) NOT NULL,
PRIMARY KEY (`pk_color`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of color
-- ----------------------------
INSERT INTO `color` VALUES ('1', 'Black');
INSERT INTO `color` VALUES ('2', 'Orchid');
INSERT INTO `color` VALUES ('3', 'Lavender');
INSERT INTO `color` VALUES ('4', 'Dark Beige');
INSERT INTO `color` VALUES ('5', 'Raw Umber');
INSERT INTO `color` VALUES ('6', 'Coral Blue');
INSERT INTO `color` VALUES ('7', 'Salmon');
INSERT INTO `color` VALUES ('8', 'Dusty Rose');
INSERT INTO `color` VALUES ('9', 'Olive');
INSERT INTO `color` VALUES ('10', 'Sky Blue');
INSERT INTO `color` VALUES ('11', 'Mustard');
INSERT INTO `color` VALUES ('12', 'Marroon');
INSERT INTO `color` VALUES ('13', 'Peach');
INSERT INTO `color` VALUES ('14', 'Soft Yellow');
INSERT INTO `color` VALUES ('15', 'Dark Purple');
INSERT INTO `color` VALUES ('16', 'Mix');
INSERT INTO `color` VALUES ('17', 'Soft Grey');
INSERT INTO `color` VALUES ('18', 'Blue Black');
INSERT INTO `color` VALUES ('99', '- Choose Design -');
-- ----------------------------
-- Table structure for design
-- ----------------------------
DROP TABLE IF EXISTS `design`;
CREATE TABLE `design` (
`pk_design` int(255) NOT NULL AUTO_INCREMENT,
`design` varchar(255) NOT NULL,
PRIMARY KEY (`pk_design`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of design
-- ----------------------------
INSERT INTO `design` VALUES ('1', 'Plain');
INSERT INTO `design` VALUES ('2', 'Land');
INSERT INTO `design` VALUES ('3', 'Pattern');
INSERT INTO `design` VALUES ('4', 'Floral');
INSERT INTO `design` VALUES ('5', 'Abstract');
INSERT INTO `design` VALUES ('6', 'Monochrome');
INSERT INTO `design` VALUES ('7', 'Lace');
INSERT INTO `design` VALUES ('8', 'Beads');
INSERT INTO `design` VALUES ('9', 'Army');
INSERT INTO `design` VALUES ('99', '- Choose Design -');
-- ----------------------------
-- Table structure for material
-- ----------------------------
DROP TABLE IF EXISTS `material`;
CREATE TABLE `material` (
`pk_material` int(255) NOT NULL AUTO_INCREMENT,
`material` varchar(255) NOT NULL,
PRIMARY KEY (`pk_material`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of material
-- ----------------------------
INSERT INTO `material` VALUES ('1', 'Cotton');
INSERT INTO `material` VALUES ('2', 'Chiffon');
INSERT INTO `material` VALUES ('3', 'Bubble Chiffon');
INSERT INTO `material` VALUES ('4', 'Satin');
INSERT INTO `material` VALUES ('5', 'Satin Matte');
INSERT INTO `material` VALUES ('99', '- Choose Material -');
-- ----------------------------
-- Table structure for orders
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
`pk_orders` int(255) NOT NULL AUTO_INCREMENT,
`oCode` varchar(255) NOT NULL,
`pk_product` varchar(255) NOT NULL,
`quantity` varchar(255) NOT NULL,
`priceA` varchar(255) NOT NULL,
`priceD` varchar(255) NOT NULL,
`pk_receipt` varchar(255) NOT NULL,
`pk_users` varchar(255) NOT NULL,
`indexs` varchar(255) NOT NULL,
`price1` varchar(255) NOT NULL,
`priceN` varchar(255) NOT NULL,
PRIMARY KEY (`pk_orders`)
) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of orders
-- ----------------------------
INSERT INTO `orders` VALUES ('15', '', '7', '4', '160.00', '180.00', '19', '3', '1', '60', '240.00');
INSERT INTO `orders` VALUES ('16', '', '8', '2', '80.00', '90.00', '20', '2', '1', '50', '100.00');
INSERT INTO `orders` VALUES ('17', '', '11', '2', '80.00', '90.00', '20', '2', '2', '50', '100.00');
INSERT INTO `orders` VALUES ('18', '', '3', '3', '120.00', '135.00', '21', '2', '1', '48', '144.00');
INSERT INTO `orders` VALUES ('19', '', '3', '5', '200.00', '225.00', '21', '2', '2', '48', '240.00');
INSERT INTO `orders` VALUES ('20', '', '5', '3', '120.00', '135.00', '21', '2', '3', '48', '144.00');
INSERT INTO `orders` VALUES ('21', '', '4', '1', '40.00', '45.00', '22', '2', '1', '50', '50.00');
INSERT INTO `orders` VALUES ('22', '', '8', '2', '80.00', '90.00', '22', '2', '2', '50', '100.00');
INSERT INTO `orders` VALUES ('23', '', '26', '3', '45.00', '60.00', '22', '2', '3', '30', '90.00');
INSERT INTO `orders` VALUES ('24', '', '6', '1', '40.00', '45.00', '23', '2', '1', '50', '50.00');
INSERT INTO `orders` VALUES ('25', '', '14', '5', '250.00', '275.00', '24', '2', '1', '63', '315.00');
INSERT INTO `orders` VALUES ('26', '', '15', '1', '50.00', '55.00', '25', '2', '1', '63', '63.00');
INSERT INTO `orders` VALUES ('27', '', '24', '2', '30.00', '40.00', '26', '2', '1', '25', '50.00');
INSERT INTO `orders` VALUES ('28', '', '9', '1', '40.00', '45.00', '27', '4', '1', '50', '50.00');
INSERT INTO `orders` VALUES ('29', '', '21', '1', '50.00', '55.00', '27', '4', '2', '60', '60.00');
INSERT INTO `orders` VALUES ('30', '', '5', '1', '40.00', '45.00', '27', '4', '3', '50', '50.00');
INSERT INTO `orders` VALUES ('31', '', '20', '1', '50.00', '55.00', '27', '4', '4', '60', '60.00');
INSERT INTO `orders` VALUES ('32', '', '14', '1', '50.00', '55.00', '27', '4', '5', '60', '60.00');
INSERT INTO `orders` VALUES ('33', '', '17', '5', '250.00', '275.00', '28', '4', '1', '60', '300.00');
INSERT INTO `orders` VALUES ('34', '', '7', '6', '240.00', '270.00', '29', '4', '1', '55', '330.00');
INSERT INTO `orders` VALUES ('35', '', '18', '3', '150.00', '165.00', '29', '4', '2', '63', '189.00');
INSERT INTO `orders` VALUES ('36', '', '21', '2', '100.00', '110.00', '30', '5', '1', '60', '120.00');
INSERT INTO `orders` VALUES ('37', '', '8', '3', '120.00', '135.00', '31', '5', '1', '50', '150.00');
INSERT INTO `orders` VALUES ('38', '', '11', '3', '120.00', '135.00', '31', '5', '2', '50', '150.00');
INSERT INTO `orders` VALUES ('39', '', '4', '5', '200.00', '225.00', '32', '5', '1', '50', '250.00');
INSERT INTO `orders` VALUES ('40', '', '15', '4', '200.00', '220.00', '33', '5', '1', '63', '252.00');
INSERT INTO `orders` VALUES ('41', '', '7', '1', '40.00', '45.00', '34', '5', '1', '50', '50.00');
INSERT INTO `orders` VALUES ('42', '', '20', '1', '50.00', '55.00', '34', '5', '2', '60', '60.00');
INSERT INTO `orders` VALUES ('43', '', '24', '1', '15.00', '20.00', '34', '5', '3', '30', '30.00');
INSERT INTO `orders` VALUES ('44', '', '3', '4', '160.00', '180.00', '35', '5', '1', '50', '200.00');
INSERT INTO `orders` VALUES ('45', '', '3', '4', '160.00', '180.00', '35', '5', '2', '55', '220.00');
INSERT INTO `orders` VALUES ('46', '', '4', '2', '80.00', '90.00', '36', '2', '1', '50', '100.00');
INSERT INTO `orders` VALUES ('47', '', '3', '2', '80.00', '90.00', '37', '2', '1', '50', '100.00');
|
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 03, 2020 at 08:03 AM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.1.33
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_srgs`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_course`
--
CREATE TABLE `tbl_course` (
`nm_courseid` int(11) NOT NULL,
`sz_coursename` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tbl_course`
--
INSERT INTO `tbl_course` (`nm_courseid`, `sz_coursename`) VALUES
(2, 'IMCA'),
(3, 'MBA'),
(4, 'bba'),
(5, 'MSC.IT');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_result`
--
CREATE TABLE `tbl_result` (
`nm_resultid` int(11) NOT NULL,
`nm_studentid` int(11) NOT NULL,
`nm_subid1` int(11) NOT NULL,
`nm_subid2` int(11) NOT NULL,
`nm_subid3` int(11) NOT NULL,
`nm_subid4` int(11) NOT NULL,
`nm_subid5` int(11) NOT NULL,
`nm_sub1_mark` int(11) NOT NULL,
`nm_sub2_mark` int(11) NOT NULL,
`nm_sub3_mark` int(11) NOT NULL,
`nm_sub4_mark` int(11) NOT NULL,
`nm_sub5_mark` int(11) NOT NULL,
`nm_total` int(11) NOT NULL,
`nm_persantage` int(11) NOT NULL,
`nm_result` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tbl_result`
--
INSERT INTO `tbl_result` (`nm_resultid`, `nm_studentid`, `nm_subid1`, `nm_subid2`, `nm_subid3`, `nm_subid4`, `nm_subid5`, `nm_sub1_mark`, `nm_sub2_mark`, `nm_sub3_mark`, `nm_sub4_mark`, `nm_sub5_mark`, `nm_total`, `nm_persantage`, `nm_result`) VALUES
(1, 1, 1, 5, 7, 4, 6, 70, 75, 65, 85, 80, 375, 75, 1),
(4, 3, 8, 9, 11, 12, 10, 70, 82, 56, 78, 91, 377, 75, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_sem`
--
CREATE TABLE `tbl_sem` (
`nm_semid` int(11) NOT NULL,
`nm_courseid` int(11) NOT NULL,
`nm_sem` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tbl_sem`
--
INSERT INTO `tbl_sem` (`nm_semid`, `nm_courseid`, `nm_sem`) VALUES
(1, 2, 5),
(2, 2, 4),
(3, 2, 2),
(4, 4, 2),
(7, 4, 1),
(8, 3, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_student`
--
CREATE TABLE `tbl_student` (
`nm_studentid` int(11) NOT NULL,
`sz_name` varchar(50) NOT NULL,
`nm_semid` int(11) NOT NULL,
`sz_email` varchar(50) NOT NULL,
`nm_contact` bigint(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tbl_student`
--
INSERT INTO `tbl_student` (`nm_studentid`, `sz_name`, `nm_semid`, `sz_email`, `nm_contact`) VALUES
(1, 'Jigar Vakil', 1, 'gglisggl@gmail.com', 9824619885),
(3, 'Nitya Kansara', 8, 'nityakansara16@gmail.com', 7405551900);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_subject`
--
CREATE TABLE `tbl_subject` (
`nm_subjectid` int(11) NOT NULL,
`nm_semid` int(11) NOT NULL,
`sz_subjectname` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tbl_subject`
--
INSERT INTO `tbl_subject` (`nm_subjectid`, `nm_semid`, `sz_subjectname`) VALUES
(1, 1, 'Android'),
(4, 1, 'PHP'),
(5, 1, 'DS'),
(6, 1, 'SE'),
(7, 1, 'JAVA'),
(8, 8, 'Business Fundamentals'),
(9, 8, 'Business Growth'),
(10, 8, 'Organizational Behaviour'),
(11, 8, 'Financial Accounting'),
(12, 8, 'Marketing Management');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbl_course`
--
ALTER TABLE `tbl_course`
ADD PRIMARY KEY (`nm_courseid`);
--
-- Indexes for table `tbl_result`
--
ALTER TABLE `tbl_result`
ADD PRIMARY KEY (`nm_resultid`),
ADD KEY `nm_studentid` (`nm_studentid`),
ADD KEY `nm_subid1` (`nm_subid1`),
ADD KEY `nm_subid2` (`nm_subid2`),
ADD KEY `nm_subid3` (`nm_subid3`),
ADD KEY `nm_subid4` (`nm_subid4`),
ADD KEY `nm_subid5` (`nm_subid5`);
--
-- Indexes for table `tbl_sem`
--
ALTER TABLE `tbl_sem`
ADD PRIMARY KEY (`nm_semid`),
ADD KEY `nm_courseid` (`nm_courseid`);
--
-- Indexes for table `tbl_student`
--
ALTER TABLE `tbl_student`
ADD PRIMARY KEY (`nm_studentid`),
ADD KEY `nm_semid` (`nm_semid`);
--
-- Indexes for table `tbl_subject`
--
ALTER TABLE `tbl_subject`
ADD PRIMARY KEY (`nm_subjectid`),
ADD KEY `nm_semid` (`nm_semid`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tbl_course`
--
ALTER TABLE `tbl_course`
MODIFY `nm_courseid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tbl_result`
--
ALTER TABLE `tbl_result`
MODIFY `nm_resultid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tbl_sem`
--
ALTER TABLE `tbl_sem`
MODIFY `nm_semid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tbl_student`
--
ALTER TABLE `tbl_student`
MODIFY `nm_studentid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tbl_subject`
--
ALTER TABLE `tbl_subject`
MODIFY `nm_subjectid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `tbl_result`
--
ALTER TABLE `tbl_result`
ADD CONSTRAINT `r1` FOREIGN KEY (`nm_studentid`) REFERENCES `tbl_student` (`nm_studentid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `r2` FOREIGN KEY (`nm_subid1`) REFERENCES `tbl_subject` (`nm_subjectid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `r3` FOREIGN KEY (`nm_subid2`) REFERENCES `tbl_subject` (`nm_subjectid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `r4` FOREIGN KEY (`nm_subid3`) REFERENCES `tbl_subject` (`nm_subjectid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `r5` FOREIGN KEY (`nm_subid4`) REFERENCES `tbl_subject` (`nm_subjectid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `r6` FOREIGN KEY (`nm_subid5`) REFERENCES `tbl_subject` (`nm_subjectid`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `tbl_sem`
--
ALTER TABLE `tbl_sem`
ADD CONSTRAINT `a` FOREIGN KEY (`nm_courseid`) REFERENCES `tbl_course` (`nm_courseid`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `tbl_student`
--
ALTER TABLE `tbl_student`
ADD CONSTRAINT `aaa` FOREIGN KEY (`nm_semid`) REFERENCES `tbl_sem` (`nm_semid`);
--
-- Constraints for table `tbl_subject`
--
ALTER TABLE `tbl_subject`
ADD CONSTRAINT `aa` FOREIGN KEY (`nm_semid`) REFERENCES `tbl_sem` (`nm_semid`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- 用户表
create table iam_user
(
id bigint comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
org_id bigint default 0 not null comment '组织ID',
user_num varchar(20) not null comment '用户编号',
realname varchar(50) not null comment '真实姓名',
gender varchar(10) not null comment '性别',
birthdate date null comment '出生日期',
mobile_phone varchar(20) null comment '手机号',
email varchar(50) null comment 'Email',
avatar_url varchar(200) null comment '头像地址',
status varchar(10) default 'A' not null comment '状态',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间'
)AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '系统用户';
-- 索引
create index idx_iam_user_1 on iam_user (org_id);
create index idx_iam_user_2 on iam_user (mobile_phone);
create index idx_iam_user_num on iam_user (user_num);
create index idx_iam_user_tenant on iam_user (tenant_id);
-- 账号表
create table iam_account
(
id bigint COMMENT 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
user_type varchar(100) default 'IamUser' not null comment '用户类型',
user_id bigint not null comment '用户ID',
auth_type varchar(20) default 'PWD' not null comment '认证方式',
auth_account varchar(100) not null comment '用户名',
auth_secret varchar(100) null comment '密码',
secret_salt varchar(32) null comment '加密盐',
status varchar(10) default 'A' not null comment '用户状态',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间'
) AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '登录账号';
-- 创建索引
create index idx_iam_account on iam_account(auth_account, auth_type, user_type);
create index idx_iam_account_tenant on iam_account (tenant_id);
-- 角色表
create table iam_role
(
id bigint comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
name varchar(50) not null comment '名称',
code varchar(50) not null comment '编码',
description varchar(100) null comment '备注',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
update_time datetime null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间'
)AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '角色';
-- 创建索引
create index idx_iam_role_tenant on iam_role (tenant_id);
-- 用户角色表
create table iam_user_role
(
id bigint auto_increment comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
user_type varchar(100) default 'IamUser' not null comment '用户类型',
user_id bigint not null comment '用户ID',
role_id bigint not null comment '角色ID',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间'
)AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '用户角色关联';
-- 索引
create index idx_iam_user_role on iam_user_role (user_type, user_id);
create index idx_iam_user_role_tenant on iam_user_role (tenant_id);
-- 前端资源权限表
create table iam_resource_permission
(
id bigint auto_increment comment 'ID' primary key,
parent_id bigint default 0 not null comment '父级资源',
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
app_module varchar(50) null comment '应用模块',
display_type varchar(20) not null comment '展现类型',
display_name varchar(100) not null comment '显示名称',
resource_code varchar(100) null comment '权限编码',
permission_code varchar(200) null comment '权限编码',
sort_id bigint null comment '排序号',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间'
)AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '资源权限';
-- 索引
create index idx_iam_resource_permission on iam_resource_permission (parent_id);
create index idx_iam_resource_permission_tenant on iam_resource_permission (tenant_id);
-- 角色-权限
create table iam_role_resource
(
id bigint auto_increment comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
role_id bigint not null comment '角色ID',
resource_id bigint not null comment '资源ID',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间'
)AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '角色资源';
-- 索引
create index idx_iam_role_resource on iam_role_resource (role_id, resource_id);
create index idx_iam_role_resource_tenant on iam_role_resource (tenant_id);
-- 登录日志表
create table iam_login_trace
(
id bigint auto_increment comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
user_type varchar(100) default 'IamUser' not null comment '用户类型',
user_id bigint not null comment '用户ID',
auth_type varchar(20) default 'PWD' not null comment '认证方式',
auth_account varchar(100) not null comment '用户名',
ip_address varchar(50) null comment 'IP',
user_agent varchar(200) null comment '客户端信息',
is_success tinyint(1) default 0 not null comment '是否成功',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间'
) AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '登录日志';
-- 创建索引
create index idx_iam_login_trace on iam_login_trace (user_type, user_id);
create index idx_iam_login_trace_2 on iam_login_trace (auth_account);
create index idx_iam_login_trace_tenant on iam_login_trace (tenant_id);
-- 操作日志表
create table iam_operation_log
(
id bigint auto_increment comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
app_module varchar(50) null comment '应用模块',
business_obj varchar(100) not null comment '业务对象',
operation varchar(100) not null comment '操作描述',
user_type varchar(100) default 'IamUser' null comment '用户类型',
user_id bigint null comment '用户ID',
user_realname varchar(100) null comment '用户姓名',
request_uri varchar(500) not null comment '请求URI',
request_method varchar(20) not null comment '请求方式',
request_params varchar(1000) null comment '请求参数',
request_ip varchar(50) null comment 'IP',
status_code smallint default 0 not null comment '状态码',
error_msg varchar(1000) null comment '异常信息',
is_deleted tinyint(1) null comment '删除标记',
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间'
)
AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '操作日志';
-- 创建索引
create index idx_iam_operation_log on iam_operation_log (user_type, user_id);
create index idx_iam_operation_log_tenant on iam_operation_log (tenant_id);
-- 组织表
create table iam_org
(
id bigint comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
parent_id bigint default 0 not null comment '上级ID',
top_org_id bigint default 0 not null comment '企业ID',
name varchar(100) not null comment '名称',
short_name varchar(50) not null comment '短名称',
type varchar(100) default 'DEPT' not null comment '组织类别',
code varchar(50) not null comment '编码',
manager_id bigint default 0 not null comment '负责人ID',
depth smallint(6) default 1 not null comment '层级',
sort_id bigint null comment '排序号',
status varchar(10) default 'A' not null comment '状态',
org_comment varchar(200) COMMENT '备注',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间'
)
comment '组织';
create index idx_iam_org on iam_org (parent_id);
create index idx_iam_org_tenant on iam_org (tenant_id);
-- 岗位
create table iam_position
(
id bigint comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
name varchar(100) not null comment '名称',
code varchar(50) not null comment '编码',
is_virtual tinyint(1) default 0 not null comment '是否虚拟岗',
grade_name varchar(50) null comment '职级头衔',
grade_value varchar(30) default '0' null comment '职级',
data_permission_type varchar(20) default 'SELF' null comment '数据权限类型',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间'
)
comment '岗位';
create index idx_iam_position on iam_position (code);
create index idx_iam_position_tenant on iam_position (tenant_id);
-- 用户岗位
create table iam_user_position
(
id bigint auto_increment comment 'ID' primary key,
tenant_id bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
user_type varchar(100) default 'IamUser' not null comment '用户类型',
user_id bigint not null comment '用户ID',
org_id bigint default 0 not null comment '组织ID',
position_id bigint not null comment '岗位ID',
is_primary_position tinyint(1) default 1 not null comment '是否主岗',
is_deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间'
)
comment '用户岗位关联';
create index idx_iam_user_position on iam_user_position (user_type, user_id);
create index idx_iam_user_position_2 on iam_user_position (org_id, position_id);
-- 系统配置表
CREATE TABLE `system_config`
(
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户ID',
`type` varchar(50) CHARACTER SET utf8 NOT NULL COMMENT '类型',
`prop` varchar(50) CHARACTER SET utf8 NOT NULL COMMENT '属性',
`value` varchar(255) CHARACTER SET utf8 NULL DEFAULT NULL COMMENT '属性值',
`is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '删除标记',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_system_config_tenant_id` (`tenant_id`) USING BTREE,
INDEX `idx_system_config` (`type`, `prop`) USING BTREE
) AUTO_INCREMENT = 10000
DEFAULT CHARSET = utf8 COMMENT = '系统配置';
|
-- no, the tables and field's abbreviations stay: i don't like them too, but i
-- need to avoid both reserved words _and_ backticks nightmares.
-- i'll be forced to use backtitis in the databases inserted, but not in this.
-- obs: with the actual IDEs with colors, make no sense to differentiate
-- anything with uppercases and lowercases, so i use underlines: they are
-- harmless and enforce readability and cleanliness as no other way.
create user if not exists 'mauro'@'localhost' identified by 'mauro123';
grant all on mauro.* to 'mauro'@'localhost';
drop database if exists mauro_db;
create database mauro_db;
use mauro_db;
create table dbs (
dbs_name varchar(32) not null,
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name)
) engine=myisam;
create table tbls (
dbs_name varchar(32) not null,
tbl_name varchar(32) not null,
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,tbl_name)
) engine=myisam;
create table cols (
dbs_name varchar(32) not null,
tbl_name varchar(32) not null,
seq_in_tbl integer not null auto_increment,
col_name varchar(32) not null,
col_type enum(
'integer','int','smallint','tinyint','mediumint','bigint',
'decimal','numeric','float','double','bit',
'date','datetime','timestamp','time','year',
'char','varchar','binary','varbinary',
'tinytext','text','mediumtext','longtext',
'tinyblob','blob','mediumblob','longblob',
'enum','set',
'json'
) not null,
col_length integer,
col_dec integer,
col_values varchar(256),
col_default varchar(32),
col_extra varchar(32),
col_nullable boolean,
col_form_title varchar(32) not null default col_name,
col_table_title varchar(32) not null default col_name,
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,tbl_name,seq_in_tbl),
unique key (dbs_name,tbl_name,col_name),
key (dbs_name,col_name,tbl_name)
) engine=myisam;
create table idxs (
dbs_name varchar(32) not null,
tbl_name varchar(32) not null,
idx_name varchar(32) not null,
idx_type enum('primary','unique','key') not null default 'key',
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,tbl_name,idx_name)
) engine=myisam;
create table idx_cols (
dbs_name varchar(32) not null,
tbl_name varchar(32) not null,
idx_name varchar(32) not null,
seq_in_idx integer not null auto_increment,
col_name varchar(32) not null,
asc_desc enum('A','D') not null default 'A',
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,tbl_name,idx_name,seq_in_idx),
key (dbs_name,col_name,tbl_name)
) engine=myisam;
-- --------------------------------------------------------------------------------------------------------------------
create table routes (
dbs_name varchar(32) not null,
route_name varchar(32) not null,
route_path varchar(128) not null,
file_name varchar(32) not null,
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,route__name)
) engine=myisam;
create table route_parms (
dbs_name varchar(32) not null,
route_name varchar(32) not null,
seq_in_route integer not null auto_increment,
parm_name varchar(32) not null,
parm_type enum(
'integer','int','smallint','tinyint','mediumint','bigint',
'decimal','numeric','float','double','bit',
'date','datetime','timestamp','time','year',
'char','varchar','binary','varbinary',
'tinytext','text','mediumtext','longtext',
'tinyblob','blob','mediumblob','longblob',
'enum','set',
'json'
) not null,
parm_length integer,
parm_dec integer,
parm_values varchar(256),
parm_default varchar(32),
parm_min_value varchar(32),
parm_max_value varchar(32),
parm_is_required boolean not null default false,
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,route__name,seq_in_route)
) engine=myisam;
-- --------------------------------------------------------------------------------------------------------------------
create table menus (
dbs_name varchar(32) not null,
menu_name varchar(32) not null,
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,menu__name)
) engine=myisam;
create table menu_items (
dbs_name varchar(32) not null,
menu_name varchar(32) not null,
seq_in_menu integer not null auto_increment,
item_name varchar(32) not null,
route_name varchar(32),
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,menu__name,seq_in_menu)
) engine=myisam;
-- --------------------------------------------------------------------------------------------------------------------
create table aliases (
dbs_name varchar(32) not null,
tbl_name_1 varchar(32) not null,
col_name_1 varchar(32) not null,
tbl_name_2 varchar(32) not null,
col_name_2 varchar(32) not null,
ins_at timestamp not null default current_timestamp,
upd_at timestamp not null default current_timestamp on update current_timestamp,
primary key (dbs_name,tbl_name_1,col_name_1,tbl_name_2,col_name_2),
unique key (dbs_name,tbl_name_1,tbl_name_2),
key (dbs_name,tbl_name_2,col_name_2,tbl_name_1,col_name_1)
) engine=myisam;
|
-- Lab2
-- John Gnanasekaran
-- ID# 1532263
DROP SCHEMA Lab2 CASCADE;
CREATE SCHEMA Lab2;
CREATE TABLE ChirpUsers (
userID INTEGER PRIMARY KEY,
userPassword CHARACTER(8) NOT NULL,
userName VARCHAR(30) NOT NULL,
joinDate date,
address VARCHAR(30),
education CHARACTER(1),
income DECIMAL(10,2),
spouseID INTEGER,
active BOOLEAN,
UNIQUE (userName,spouseID,joinDate,address)
);
CREATE TABLE ChirpPosts (
posterID INTEGER,
postNum INTEGER,
thePost VARCHAR(44) NOT NULL,
censored BOOLEAN,
postDate DATE,
PRIMARY KEY(posterID,postNum)
);
CREATE TABLE ChirpFollowers (
userID INTEGER,
followerID INTEGER,
followStartDate DATE,
PRIMARY KEY(userID,followerID)
);
CREATE TABLE ChirpReads (
posterID INTEGER,
postNum INTEGER,
postReader INTEGER,
timesRead INTEGER,
latestReadDate DATE,
PRIMARY KEY(posterID,postNum,postReader)
);
|
/*a*/
select jc.name from "Jobs".job_category as jc;
/*b*/
select jc."name",COUNT(*) from "Jobs".job j
inner join "Jobs".job_category jc on jc.id = j.job_category_id
inner join "Process".process pc on pc.id = j.process_id
inner join "Recruiter".application_evaluation ae on ae.recruiter_id = pc.recruiter_i
GROUP BY jc."name",ae."hired"
HAVING ae.hired=0::bit;
/*c*/
select jp."name" from "Jobs".job j
inner join "Jobs".job_position jp on jp.id = j.job_position_id
inner join "Applicant".application a on a.jobs_id = j.id
where a.applicant_id = '5deb6ea4-6ca8-4b6e-a7f0-d4f7335668bf';
select a.applicant_id from "Jobs".job j
inner join "Jobs".job_position jp on jp.id = j.job_position_id
inner join "Applicant".application a on a.jobs_id = j.id
GROUP BY a.applicant_id
HAVING count(*)=0;
/*e*/
select o."name", jp."name" from "Jobs".job j
full outer join "Jobs".job_position jp on jp.id = j.job_position_id
full outer join "Jobs".organization o on o.id = j.organizations_id;
/*f*/
select a2.first_name , a2.last_name , a2.summary , a2.email , a2.phone from "Jobs".job j
inner join "Applicant".application a on a.jobs_id = j.id
inner join "Applicant".applicant a2 on a2.id = a.applicant_id
inner join "Applicant".application_document ad on ad.application_id = a.id
inner join "Applicant"."document" d on d.id = ad.document_id
where d."document" is not null;
/*g*/
/*h*/
select in2.pass Interview , a2.pass Test from "Applicant".application a
inner join "Interview".application_test at on at.application_id = a.id
inner join "Interview".interview i on i.application_id = a.id
inner join "Interview".answers a2 on a2.application_test = at.id
inner join "Interview".interview_note in2 on in2.interview_id = i.id
where a.applicant_id = '5deb6ea4-6ca8-4b6e-a7f0-d4f7335668bf';
/*j*/
select jp."name" , count(*) from "Jobs".job j
inner join "Jobs".job_platform jp on jp.id = j.job_platform_id
GROUP BY jp.id;
|
# Запрос для добавления информации в БД:
# Существующий список категорий
INSERT INTO
categories
(name,
alias)
VALUES
('Доски и лыжи', 'boards'),
('Крепления', 'attachment'),
('Ботинки', 'boots'),
('Одежда', 'clothing'),
('Инструменты', 'tools'),
('Разное', 'other');
# Запрос для добавления информации в БД:
# Придумайте пару пользователей
INSERT INTO
users (
reg_time,
email,
username,
password,
avatar,
contact
)
VALUES
(
'2018-11-20 12:00:00',
'adam@foobar.me',
'Adam',
'1111',
'avatar.jpg',
'МСК, Ленинградское ш., 14 км, аутлет Fashion House'
),
(
'2018-11-25 18:03:12',
'eve@foobar.me',
'Eve',
'2222',
NULL,
'Сочи, с. Эсто-Садок, ул. Горная карусель, д.3'
),
(
'2018-11-29 02:46:26',
'leo@foobar.me',
'Лёня',
'3333',
NULL,
'vk'
),
(
'2018-12-01 12:43:36',
'nick@foobar.me',
'Коля',
'4444',
NULL,
'Somwhere over the rainbow'
),
(
'2018-12-03 19:25:41',
'kath@foobar.me',
'Kath',
'5555',
NULL,
'Петрозаводск'
),
(
'2018-12-05 22:53:24',
'seva@foobar.me',
'Seva',
'6666',
NULL,
'Москва, ВДНХ'
),
(
'2018-12-20 13:59:10',
'eighth@foobar.me',
'Eighth',
'8888',
'5c1b840e0c0a7.jpeg',
'TARDIS'
);
# Запрос для добавления информации в БД:
# Существующий список объявлений
INSERT INTO
lots
SET
start_time = '2018-11-21 15:34:59',
product = '2014 Rossignol District Snowboard',
description = 'Размер 159 см. Эта доска отлично подойдёт как для обычного склона, так и для парка, а также для обучения. За устойчивость и стабильность отвечает стандартный прогиб, он гарантирует жесткую хватку кантов. Высокие рокеры Amptek Auto-Turn обеспечивают легкость управления доской и четкое вхождение в повороты.',
image = 'uploads/lot-1.jpg',
opening_price = 10999,
closing_time = '2019-03-25 19:00:00',
price_increment = 50,
seller_id = 1,
category_id = 1;
INSERT INTO
lots
SET
start_time = '2018-11-21 15:50:23',
product = 'DC Ply Mens 2016/2017 Snowboard',
description = '147 см. Отличный щелчок, скошенный кант, хороший контроль.',
image = 'uploads/lot-2.jpg',
opening_price = 159999,
closing_time = '2019-03-25 19:00:00',
price_increment = 99,
seller_id = 1,
category_id = 1;
INSERT INTO
lots
SET
start_time = '2018-11-30 21:46:25',
product = 'Крепления Union Contact Pro 2015 года размер L/XL',
description = 'Универсальные крепления весом всего 720 грамм. Отлетела краска на местах где металл',
image = 'uploads/lot-3.jpg',
opening_price = 8000,
closing_time = '2019-03-21 23:50:00',
price_increment = 30,
seller_id = 2,
category_id = 2;
INSERT INTO
lots
SET
start_time = '2018-12-01 10:29:33',
product = 'Ботинки для сноуборда DC Mutiny Charocal',
description = 'Размер 9US. Традиционная шнуровка. Уровень катания: продвинутый. Жесткость: 8. Созданы для фристайла',
image = 'uploads/lot-4.jpg',
opening_price = 10999,
closing_time = '2019-03-28 10:00:00',
price_increment = 5,
seller_id = 1,
category_id = 3;
INSERT INTO
lots
SET
start_time = '2018-12-03 23:24:07',
product = 'Куртка для сноуборда DC Mutiny Charocal',
description = 'С бирками. Материал- синтетический оксфорд, cтандартный крой',
image = 'uploads/lot-5.jpg',
opening_price = 7500,
closing_time = '2019-04-10 12:30:00',
price_increment = 10,
seller_id = 2,
category_id = 4;
INSERT INTO
lots
SET
start_time = '2018-12-01 14:43:45',
product = 'Маска Oakley Canopy',
description = 'Узкая оправа, и большая линза сферической формы, что позволяет иметь широчайший периферический обзор и отличную видимость. А благодаря наилучшей оптике, Вы будете иметь высокую четкость и хорошую видимость. Маска никогда не запотевает, для этого предусмотрена специальная система вентиляции.',
image = 'uploads/lot-6.jpg',
opening_price = 5400,
closing_time = '2019-03-30 15:00:00',
price_increment = 50,
seller_id = 4,
category_id = 6;
INSERT INTO
lots
SET
start_time = '2018-12-18 21:32:03',
product = 'Горные лыжи Nordica Soul Rider 87',
description = 'Парковые лыжи с игровой геометрией и хорошим отскоком. Конструкция Energy Frame включает в себя деревянный сердечник и слои карбона. 87 талия имеет большую стабильность, чем 84. Лыжи отлично контролируются на больших скоростях и на больших пролетах.',
image = 'uploads/5c1948cd5974e.png',
opening_price = 25000,
closing_time = '2019-03-01 00:00:00',
price_increment = 300,
seller_id = 1,
category_id = 1;
INSERT INTO
lots
SET
start_time = '2018-12-18 23:52:37',
product = 'Детский зимний шлем Alpina',
description = 'Горнолыжный шлем Alpina Carat обязательно понравится детям. При этом он отвечает всем стандартам безопасности.',
image = 'uploads/5c196c25949bb.png',
opening_price = 3000,
closing_time = '2019-03-20 19:00:00',
price_increment = 50,
seller_id = 3,
category_id = 6;
INSERT INTO
lots
SET
start_time = '2018-12-18 23:53:19',
product = 'Ремнабор для нейлоновых тканей',
description = 'Применяется для починки дыр и разрывов силиконо-нейлоновых палаток, рюкзаков и верхней одежды, герметизации швов, восстановления защитного покрытия ткани. Единственное средство, которое приклеивается к силиконо-нейлоновой поверхности.',
image = 'uploads/5c196c4f0bcb8.jpg',
opening_price = 100,
closing_time = '2019-03-20 19:00:00',
price_increment = 15,
seller_id = 1,
category_id = 5;
INSERT INTO
lots
SET
start_time = '2018-12-21 21:00:16',
product = 'Шапка Airblaster',
description = 'one size',
image = 'uploads/5c1d38408b75f.jpeg',
opening_price = 700,
closing_time = '2019-03-20 18:00:00',
price_increment = 100,
seller_id = 6,
category_id = 4;
INSERT INTO
lots
SET
start_time = '2018-12-21 21:05:02',
product = 'Сноуборд WINTERLAND 2019',
description = 'Размер 154\r\nЖенский\r\nБренд Rome SDS',
image = 'uploads/5c1d395eae696.jpeg',
opening_price = 35000,
closing_time = '2019-04-20 19:00:00',
price_increment = 1000,
seller_id = 5,
category_id = 1;
# Запрос для добавления информации в БД:
# Добавьте пару ставок для любого объявления
INSERT INTO
bids(`create_time`, `amount`, `buyer_id`, `lot_id`)
VALUES
('2018-11-29 02:51:34', 11049, 3, 1),
('2018-11-30 13:23:06', 11099, 2, 1),
('2018-12-01 01:23:33', 8030, 1, 3),
('2018-12-01 13:02:18', 1104, 4, 4),
('2018-12-06 15:04:58', 7510, 6, 5);
# Запрос для получения всех категорий;
SELECT name FROM categories;
# Запрос на получение самых новых, открытых лотов.
# Каждый лот должен включать название, стартовую цену, ссылку на изображение, цену, название категории;
SELECT
lots.product,
lots.opening_price,
lots.image,
categories.name
FROM
lots
INNER JOIN categories ON categories.id = lots.category_id
WHERE
lots.closing_time > CURRENT_TIMESTAMP()
ORDER BY
lots.start_time DESC;
# Запрос показа лота по его id. Плюс название категории, к которой принадлежит лот
SELECT
lots.product,
categories.name
FROM
lots
INNER JOIN categories ON lots.category_id = categories.id
WHERE
lots.id = 1;
# Запрос для обновления названия лота по его идентификатору;
UPDATE
lots
SET
product = 'Новая куртка DC Mutiny Charocal'
WHERE
id = 5;
# Запрос на получение списка самых свежих ставок для лота по его идентификатору;
SELECT
*
FROM
bids
WHERE
lot_id = 1
ORDER BY
create_time DESC;
# Запрос на добавление новой колонки в существующую таблицу;
ALTER TABLE categories
ADD COLUMN alias VARCHAR(255) NOT NULL AFTER name;
# Запрос на добавление данных в новую колонку существующей таблицы;
UPDATE categories
SET alias = 'boards'
WHERE name = 'Доски и лыжи';
UPDATE categories
SET alias = 'attachment'
WHERE name = 'Крепления';
UPDATE categories
SET alias = 'boots'
WHERE name = 'Ботинки';
UPDATE categories
SET alias = 'clothing'
WHERE name = 'Одежда';
UPDATE categories
SET alias = 'tools'
WHERE name = 'Инструменты';
UPDATE categories
SET alias = 'other'
WHERE name = 'Разное';
|
CREATE DATABASE Otomi;
USE Otomi;
CREATE TABLE users(
username varchar(20) NOT NULL PRIMARY KEY,
password varchar(32) NOT NULL,
privilege integer NOT NULL DEFAULT -1,
status integer NOT NULL DEFAULT 1,
name varchar(150) NOT NULL,
email varchar(100) NOT NULL,
other_data varchar(50) NOT NULL,
user_hash varchar(32) NOT NULL,
change_pwd integer NOT NULL DEFAULT 1,
created timestamp NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE sessions(
session_id char(128) UNIQUE NOT NULL,
atime timestamp NOT NULL default current_timestamp,
data text
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE logs(
id_log integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
username varchar(20) NOT NULL,
ip varchar(16) NOT NULL,
access timestamp NOT NULL,
FOREIGN KEY (username) REFERENCES users(username)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
create table clientes(
id_cliente integer not null PRIMARY KEY AUTO_INCREMENT,
nombre varchar(30) not null,
apellido_pa varchar(30) not null,
apellido_ma varchar(30) not null,
telefono varchar(30) not null,
email varchar(50) not null,
utl varchar(200) not null,
);
create table cabeza(
palabra_uno varchar(50) primary key,
palabra_dos varchar(50) not null,
palabra_tres varchar(50) not null,
palabra_cuatro varchar(50)not null,
p1_otomi varchar(50) not null,
p2_otomi varchar(50) not null,
p3_otomi varchar(50) not null,
p4_otomi varchar(50) not null);
INSERT INTO users (username, password, privilege, status, name, email, other_data, user_hash, change_pwd)
VALUES ('admin',MD5(concat('admin', 'kuorra_key')), 0, 1, 'Admin', 'admin@gmail.com','TIC:SI', MD5(concat('admin', 'kuorra_key', '2016/06/04')), 0),
('guess',MD5(concat('guess', 'kuorra_key')), 1, 1, 'Guess', 'guess@gmail.com','TIC:SI', MD5(concat('guess', 'kuorra_key','2016/06/04')), 0);
SELECT * FROM users;
SELECT * FROM sessions;
CREATE USER 'root'@'localhost' IDENTIFIED BY 'kuorra.2018';
GRANT ALL PRIVILEGES ON webservice_aj.* TO 'root'@'localhost';
FLUSH PRIVILEGES;
|
select * from transactions,keyword_tag where detail like CONCAT("%",keyword_tag.keyword,"%") AND
|
# 去重,默认是显示全部,distinct去重
select distinct class_id
from student;
# 查询学生表中所有的信息
select *
from student;
# 查询学生表中所有的学号和姓名,别名可以用as 也可以不写
select stu_no as number,stu_name name
from student;
# 统计有多少个学生,聚合函数除了count 还有max min avg sum
select count(*)
from student;
# from,查询学生为曹操的所在的班级是哪个班
select class_name
from student join class c on student.class_id = c.class_id
where stu_name = "曹操"
# where对数据源进行过滤
/*
1.比较运算符:< > = <= >= !=(<>)
2.like: %(任意长度任意字符) _(一个长度任意字符)
3.in 或者 not in :在不在集合里面
*/
# 查询学生id不等2的学生信息
select *
from student
where stu_id != 2;
# 查询姓袁的学生的信息
select *
from student
where stu_name like "袁%";
# 查询姓袁 名字有3个字的学生的信息
select *
from student
where stu_name like "袁__";
# 查询学生id为1,4,5的学生信息
select *
from student
where stu_id in (1,4,5);
# 查询stu_name 不是 曹操 袁绍 袁术 的学生信息
select *
from student
where stu_name not in ("曹操","袁绍","袁术");
# 查询id是1-3之间的学生,包含1和3
select *
from student
where stu_id between 1 and 3;
# 查询id不是1-3之间的学生
select *
from student
where stu_id not between 1 and 3;
# 查询没有班级的学生
select *
from student
where class_id is null;
# 查询有班级的学生
select *
from student
where class_id is not null;
# 查询每个班的学生人数
select class_id,count(*)
from student
group by class_id;
# 插入money字段
alter table student add money decimal(20,2)
# 修改money的值
update student set student.money = 10000
# 查询每个班级的零花钱的平均值
select class_id,avg(money)
from student
group by class_id;
# 查询班级零花钱平均值大于30000的班级
select class_id,avg(money)
from student
group by class_id
having avg(money) > 30000;
# 查询每个班的学生姓名,group_concat(字段名):将分组之后的字段中的内容,组合成一个字符串
select group_concat(stu_name),class_id
from student
group by class_id;
# 按零花钱排序,desc 降序,默认升序
select *
from student
order by money desc;
# 对多个字段排序
select *
from student
order by class_id,money desc;
# 查询最有钱的3个同学,limit 起始索引(默认是0),显示条数
select *
from student
group by money desc
limit 3;
# union连表查询,默认会去重,加上all就不会了
(select *
from student)
union all
(select *
from student);
# union使用order by之后必须使用limit
(select *
from student
order by money limit 100)
union all
(select *
from student
order by stu_id limit 100); |
CREATE PROCEDURE sp_list_rec_Claims ( @CustomerID nvarchar(15),
@FROMDATE DATETIME,
@TODATE DATETIME)
AS
SELECT ClaimsNoteReceived.ClaimId, ClaimsNoteReceived.ClaimDate,
ClaimsNoteReceived.CustomerID, Customer.Company_Name,ClaimsNoteReceived.ClaimId,
ClaimsNoteReceived.Status,0, ClaimsNoteReceived.ClaimValue
FROM ClaimsNoteReceived, Customer
WHERE ClaimsNoteReceived.CustomerID LIKE @CustomerID AND
ClaimsNoteReceived.ClaimDate BETWEEN @FROMDATE AND @TODATE AND
ClaimsNoteReceived.CustomerID = Customer.CustomerID
ORDER BY Customer.Company_Name, ClaimsNoteReceived.ClaimDate
|
CREATE TABLE todos
"id" serial,
"todos" varchar(255),
"completed" boolean,
primary key("id")); |
DROP TABLE Jumun_detail CASCADE CONSTRAINTS;
DROP TABLE Comments CASCADE CONSTRAINTS;
DROP TABLE CompanyProduct CASCADE CONSTRAINTS;
DROP TABLE Card CASCADE CONSTRAINTS;
DROP TABLE Jumun CASCADE CONSTRAINTS;
DROP TABLE Cart CASCADE CONSTRAINTS;
DROP TABLE Product CASCADE CONSTRAINTS;
DROP TABLE Userinfo CASCADE CONSTRAINTS;
DROP TABLE Address CASCADE CONSTRAINTS;
/**********************************/
/* Table Name: Address */
/**********************************/
CREATE TABLE Address(
address_no NUMBER(10) NULL PRIMARY KEY,
address_Zcode NUMBER(10) NOT NULL ,
address_streetOrlot VARCHAR2(100) NOT NULL,
address_info VARCHAR2(255) NOT NULL,
user_no NUMBER(10) NULL ,
FOREIGN KEY (user_no) REFERENCES Userinfo (user_no) on delete cascade
);
DROP SEQUENCE Address_address_no_SEQ;
CREATE SEQUENCE Address_address_no_SEQ NOMAXVALUE NOCACHE NOORDER NOCYCLE;
/**********************************/
/* Table Name: Userinfo */
/**********************************/
CREATE TABLE Userinfo(
user_no NUMBER(10) NULL PRIMARY KEY,
user_name VARCHAR2(30) NOT NULL,
user_id VARCHAR2(50) NOT NULL,
user_password VARCHAR2(50) NOT NULL,
user_email VARCHAR2(255) NOT NULL
);
DROP SEQUENCE Userinfo_user_no_SEQ;
CREATE SEQUENCE Userinfo_user_no_SEQ NOMAXVALUE NOCACHE NOORDER NOCYCLE;
/**********************************/
/* Table Name: Product */
/**********************************/
CREATE TABLE Product(
product_no NUMBER(10) NULL PRIMARY KEY,
product_name VARCHAR2(1000) NOT NULL,
product_desc VARCHAR2(1000) NOT NULL,
product_price NUMBER(30) NOT NULL,
product_seller VARCHAR2(30) NOT NULL,
product_date DATE default sysdate NOT NULL,
product_category VARCHAR2(100) NOT NULL,
product_image VARCHAR2(255) NOT NULL
);
DROP SEQUENCE Product_product_no_SEQ;
CREATE SEQUENCE Product_product_no_SEQ NOMAXVALUE NOCACHE NOORDER NOCYCLE;
/**********************************/
/* Table Name: Cart */
/**********************************/
CREATE TABLE Cart(
Cart_no NUMBER(10) NULL PRIMARY KEY,
user_no NUMBER(10) NULL ,
product_no NUMBER(10) NULL ,
FOREIGN KEY (user_no) REFERENCES Userinfo (user_no) on delete cascade,
FOREIGN KEY (product_no) REFERENCES Product (product_no)
);
DROP SEQUENCE Cart_Cart_no_SEQ;
CREATE SEQUENCE Cart_Cart_no_SEQ NOMAXVALUE NOCACHE NOORDER NOCYCLE;
/**********************************/
/* Table Name: Jumun */
/**********************************/
CREATE TABLE Jumun(
j_no NUMBER(10) NULL PRIMARY KEY,
J_date DATE default sysdate NOT NULL,
user_no NUMBER(10) NULL ,
FOREIGN KEY (user_no) REFERENCES Userinfo (user_no) on delete cascade
);
DROP SEQUENCE Jumun_j_no_SEQ;
CREATE SEQUENCE Jumun_j_no_SEQ NOMAXVALUE NOCACHE NOORDER NOCYCLE;
/**********************************/
/* Table Name: Card */
/**********************************/
CREATE TABLE Card(
card_no VARCHAR2(50) NULL PRIMARY KEY,
card_cvc NUMBER(10) NOT NULL,
card_deadline VARCHAR2(50) NOT NULL,
card_password NUMBER(10) NOT NULL,
card_password2 VARCHAR2(50) NOT NULL,
user_no NUMBER(10) NULL ,
FOREIGN KEY (user_no) REFERENCES Userinfo (user_no) on delete cascade
);
/**********************************/
/* Table Name: CompanyProduct */
/**********************************/
CREATE TABLE CompanyProduct(
companyProduct_no NUMBER(10) NULL PRIMARY KEY,
companyProduct_name VARCHAR2(100) NOT NULL,
companyProduct_desc VARCHAR2(1000) NOT NULL,
companyProduct_price VARCHAR2(100) NOT NULL,
companyProduct_content VARCHAR2(4000) NOT NULL,
companyProduct_date DATE default sysdate NOT NULL,
user_no NUMBER(10) NULL ,
FOREIGN KEY (user_no) REFERENCES Userinfo (user_no) on delete cascade
);
/**********************************/
/* Table Name: Comments */
/**********************************/
CREATE TABLE Comments(
comments_no NUMBER(10) NULL PRIMARY KEY,
comments_date DATE default sysdate NOT NULL,
comments_content VARCHAR2(2000) NOT NULL,
comments_star NUMBER(10) NOT NULL,
comments_group_no NUMBER(10) NOT NULL,
comments_step NUMBER(10) NOT NULL,
comments_depth NUMBER(10) NOT NULL,
userproduct_no NUMBER(10) NULL ,
product_no NUMBER(10) NULL ,
board_no NUMBER(10) NULL ,
user_no NUMBER(10) NULL
FOREIGN KEY (product_no) REFERENCES Product (product_no),
FOREIGN KEY (board_no) REFERENCES Board (board_no) on delete cascade,
FOREIGN KEY (userproduct_no) REFERENCES UserProduct (userproduct_no) on delete cascade,
FOREIGN KEY (user_no) REFERENCES UserInfo (user_no) on delete cascade
);
DROP SEQUENCE Comments_comments_no_SEQ;
CREATE SEQUENCE Comments_comments_no_SEQ NOMAXVALUE NOCACHE NOORDER NOCYCLE;
/**********************************/
/* Table Name: Jumun_detail */
/**********************************/
CREATE TABLE Jumun_detail(
jd_no NUMBER(10) NULL PRIMARY KEY,
product_no NUMBER(10) NULL ,
j_no NUMBER(10) NULL ,
FOREIGN KEY (product_no) REFERENCES Product (product_no),
FOREIGN KEY (j_no) REFERENCES Jumun (j_no) on delete cascade
);
DROP SEQUENCE Jumun_detail_jd_no_SEQ;
CREATE SEQUENCE Jumun_detail_jd_no_SEQ NOMAXVALUE NOCACHE NOORDER NOCYCLE;
|
select trim(rat.nm_rat) as ramo_atividade,
gem.nm_gem as grupo_empresarial,
emp.nm_emp as empresa,
crt.cd_crt as cartao,
cun.nr_cpf_cnpj_cun as cpf,
to_char(hfe.dt_dps_hfe, 'mm/yyyy') as mes,
trim(tdp.nm_tdp) as tipo_deposito,
sum(rdp.vl_dep_rdp) as valor_depositado
from sc_opr.tbl_crt crt
inner join sc_cad.tbl_fnc fnc on crt.cd_fnc = fnc.cd_fnc
inner join sc_cad.tbl_cun cun on fnc.cd_cun = cun.cd_cun
inner join sc_cad.tbl_emp emp on fnc.cd_emp = emp.cd_emp
inner join sc_cad.tbl_gem gem on emp.cd_gem = gem.cd_gem
inner join sc_cad.tbl_rat rat on emp.cd_rat = rat.cd_rat
inner join sc_adp.tbl_rdp rdp on crt.cd_crt = rdp.cd_crt
inner join sc_adp.tbl_hfe hfe on rdp.cd_hfe = hfe.cd_hfe
inner join sc_adp.tbl_tdp tdp on rdp.cd_tdp = tdp.cd_tdp
where hfe.dt_dps_hfe >= '2019-01-01'
and hfe.st_hfe = 5 --situação depositado do arquivo de depósito
and rdp.st_rdp = 5 --situação depositado do registro de depósito
--and crt.cd_crt = 60586876660144
group by trim(rat.nm_rat), gem.nm_gem, emp.nm_emp, crt.cd_crt, cun.nr_cpf_cnpj_cun, to_char(hfe.dt_dps_hfe, 'mm/yyyy'), tdp.nm_tdp
order by cartao, mes, tipo_deposito;
select *--coalesce(max(cd_hlm), -1)
from sc_opr.tbl_hlm
where cd_crt = 60586876660144
and cd_tlt = 1
--and dt_inc_usr < '2019-02-02';
order by dt_inc_usr
select sc_opr.get_limite_concedido_tempo(60586876660144, 2, '2019-02-01')
--select auxiliares
select * from sc_opr.tbl_top order by nm_top
select * from sc_adp.tbl_rdp limit 10
select * from sc_fcr.tbl_fcr limit 10
select * from sc_opr.tbl_lmt limit 10
select * from sc_fcr.tbl_fcr_tlt where cd_fcr = 915473
select * from sc_cad.tbl_dmn where nm_cmp_dmn like '%TSC%'
select * from sc_adp.tbl_hfe limit 10 order by nm_top
|
-- Users(user_id, name, membership_type)
-- DBCC CHECKIDENT (Orders, RESEED, 0)
INSERT INTO Users VALUES('Muhammad Salleh', 'Gold');
INSERT INTO Users VALUES('Joshen Lim', 'Gold');
INSERT INTO Users VALUES('James Ng', 'Silver');
INSERT INTO Users VALUES('Kenneth', 'Silver');
INSERT INTO Users VALUES('Bryan', 'Bronze');
INSERT INTO Users VALUES('Jia Ying', 'Silver');
INSERT INTO Users VALUES('Christopher', 'Bronze');
INSERT INTO Users VALUES('Cedric', 'Gold');
INSERT INTO Users VALUES('Julia', 'Silver');
INSERT INTO Users VALUES('Mila', 'Silver');
INSERT INTO Users VALUES('Alex', 'Gold');
INSERT INTO Users VALUES('Bruce', 'Bronze');
INSERT INTO Users VALUES('Carrie', 'Bronze');
INSERT INTO Users VALUES('Dennis','Bronze');
INSERT INTO Users VALUES('Eileen','Bronze');
INSERT INTO Users VALUES('Felicia','Silver');
INSERT INTO Users VALUES('Gary','Silver');
INSERT INTO Users VALUES('Harvey','Bronze');
INSERT INTO Users VALUES('Ivy','Bronze');
|
--Comment : 주석
/*
SQL 명령을 입력할때 명령이 끝났다라는 것을 알리기 위해 ; 붙여준다.
Ctrl + Enter : 현재 커서가 있는 곳의 명령문을 DBMS로 보내고 결과를 받기
*/
-------------------------------------------------------------------------------
-- select(대소문자 상관없음) 키워드는 from 절을 포함하는 명령문 형태로 작성을 하며
-- DBMS가 보관하고 있는 데이터를 table형식으로 보여달라 라는 명령
-- DBMS의 DML(Database Manuplation Lang)중에서 Read(조회)를 수행하는 명령
-- CRUD 중에서 R : Read, Retrive를 수행하는 명령문
-------------------------------------------------------------------------------
-- 현재 오라클에 접속된 사용자(sys)가 관리하는 table들이 있는데
-- 그중에서 tab이라는 이름의 table정보를 가져와서 나에게 보여달라
-- 오라클의 tab table은 현재 접속된 사용자가 관리하는
-- DB Object(객체)들의 정보를 보관하고 있는 table
SELECT * FROM tab;
-------------------------------------------------------------------------------
-- 오라클 system 데이터 사전의 자세한 정보를 보관하는 table
select * from all_all_tables;
-------------------------------------------------------------------------------
-- SQL 명령문을 통해서 DB 객체를 만들고 삭제하고, 데이터를 추가, 변경, 삭제를 수행할텐데
-- sys사용자로 접속을 하게 되면 중요한 정보를 잘못 삭제, 변경할 우려가 있기 때문에
-- 실습을 위해서 사용자를 생성하여 수행을 할것이다.
-- 사용자를 추가하는 순서
-- 1. table Space : 데이터를 저장할 물리적 공간을 설정
-- 2. User : 사용자를 생성하고, 물리적 저장공간과 연결
-------------------------------------------------------------------------------
-- TABLE SPACE 생성(CREATE)
-- TABLE SPACE는 오라클에서 DATA를 저장할 물리적 공간을 설정하는 것
-- myTs : 앞으로 SQL을 통해서 사용할 TableSpace의 Alias(이름)
-- '../myTs.dbf' : 저장할 파일이름
-- size : 오라클에서는 성능의 효율성을 주기 위해 일단 빈 공간을 일정부분 설정한다.
-- 크기는 최초에 저장할 데이터의 크기등을 계산하여 설계하고 설정 한다.
-- 너무 작으면, 효율성이 떨어지고, 너무 크면 불필요한 공간을 낭비한다.
-- 오라클 xe(Express Edition)에서는 table Space의 최대 크기를 11G 제한한다.
-- 만약 Size 10G로 지정하고, 용량이 초과되어 AUTO NEXT로 추가가 되는 경우
-- 전체 Size가 11G를 넘어서면 오류가 나면서 더이상 데이터를 저장할수 없게 된다.
-- AUTO.. NEXT : 만약 초기에 지정한 SIZE 공간에 데이터가 가득하면 자동으로
-- 용량을 늘려서 저장할수 있도록 만들어라
-- SIZE의 1M : 기본크기를 1024 * 1024 BYTE 크기로 지정하라 // SIZE를 지정할때 1MB라고 하지않는다.
-- NEXT 500K : 자동으로 확장(늘리기)를 1024 * 500 크기로 설정 // "
-- CREATE로 시작되는 명령문 : DDL(Data definition Lang) : 데이터 선언, 생성(추가와는 다름)
CREATE TABLESPACE myTS
DATAFILE 'C:/bizwork/workspace/Oracle_Data/myTS.dbf'
SIZE 1m AUTOEXTEND ON NEXT 500K;
-------------------------------------------------------------------------------
-- 질의작성기에서 코드를 작성할때 약속
-- DBMS의 SQL문은 특별한 일부 경우를 제외하고 대소문자 구별을 하지 않는다.
-- DBMS, SQL, 오라클과 관련된 키워드는 모두 대문자로 작성할것
-- 변수, 값, 내용은 소문자로 사용하며 특별히 대소문자를 구분해야하는 경우는 별도로 공지
-------------------------------------------------------------------------------
-- DROP : DDL 명령의 CREATE와 반대되는 개념의 명령문
-- DROP 명령은 데이터를 물리적으로 완전 삭제하는 개념이므로 매우 신중하게 사용해야 한다.
DROP TABLESPACE myTs -- myTs tableSpace를 삭제하면서
INCLUDING CONTENTS AND DATAFILES -- 연관된 정보와 data file도 같이 삭제하고
CASCADE CONSTRAINTS; -- 그리고 설정된 권한, 역할 등이 있으면 그들도 같이 삭제하라
-------------------------------------------------------------------------------
-- 위에서 생성한 TableSpace를 관리하며, 데이터를 조작할 사용하자를 생성
CREATE USER user1 IDENTIFIED BY 1234 -- 사용자 ID를 user1으로 설정하고 초기 비번을 1234로 설정
DEFAULT TABLESPACE myTs;
-------------------------------------------------------------------------------
-- DCL : Data control Lang.
-- 새로 생성된 user1에게 권한을 부여하기
GRANT CONNECT TO user1; -- user1이 로그인만 할수 있도록 권한(역할) 부여
REVOKE CONNECT FROM user1; -- user1이 로그인할수 있는 권한을 제거
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--user1이 로그인을 수행하고, 최소한으로 데이터들을 관리할수 있도록 권한을 부여
-- Resource : 오라클에서 User에게 줄수 있는 권한중 상당히 많은 일을 수행할수 있는 권한
-- 현재 시스템에 설치된 모든 TableSpace를 대상으로 무제한(TableSpace가 허용하는 범위) 저장
-- Resource 권하는 Standard, Enterprice DBMS에서는 함부로 부여해서는 안된다.
-- CONNECT 와 RESOURCE 권한을 부여하게 되면 거의 DBA 수준의 권한을 갖게 된다.
GRANT CONNECT,RESOURCE TO user1;
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- 권한을 세부적으로 부여하는 것은 실무상에서 매우 필요하며 중요한 일이다.
-- 하지만 학습하는 입장에서 GRANT 부여하는데 너무 많은 노력을 쏟으면 피곤하니
-- xe 버전에서는 사용자에게 DBA 권한을 부여하고, 실습을 진행한다.
-- Login 권한과 table 생성할수 있는 권한
GRANT CONNECT,CREATE TABLE TO user1;
-- Login권한, table 생성권한, 학생정보 테이블에 데이터를 추가할수 있는 권한
GRANT CONNECT, CREATE TABLE, INSERT TABLE 학생정보 TO user1;
-- Login, table 생성, 학생정보 추가, 학생정보 조회
GRANT CONNECT, CREATE TABLE, INSERT TABLE 학생정보, SELECT TABLE 학생정보 TO user1;
-------------------------------------------------------------------------------
-- DBA 권한(Roll)은 sysDBA보다 한단계 낮은 권한 등급을 가지며
-- 일반적으로 자신이 생선한 Table등 DB Object에만 접근하여 명령을 수행한다.
GRANT DBA to USER1;
-------------------------------------------------------------------------------
|
#standardSQL
SELECT PARSE_DATE('%Y%m%d', '20170714') AS order_date
, order_category
, COUNT(1) AS order_count
FROM `dwprj1.ods3.orders_20*`
WHERE _TABLE_SUFFIX = SUBSTR('20170714', 3)
GROUP BY 1, 2
|
create table pegawai (
id INT PRIMARY KEY AUTO_INCREMENT,
nip VARCHAR(20) NOT NULL,
nama VARCHAR(255) NOT NULL
) Engine=InnoDB; |
CREATE ALIAS IF NOT EXISTS FTL_INIT FOR "org.h2.fulltext.FullTextLucene.init";
CALL FTL_INIT();
CREATE TABLE FILES_INFO(
ID IDENTITY PRIMARY KEY,
PATH VARCHAR(1024),
LAST_MODIFIED_TIME BIGINT,
LAST_MODIFIED_TIME_TEXT VARCHAR(255),
SIZE BIGINT
);
--INSERT INTO PEX (PEX_ID, DEBTOR_FIRST_NAME) VALUES(1, 'Hello World');
--INSERT INTO TEST VALUES(1, 'Hello World');
--INSERT INTO TEST VALUES(2, 'Hello World1');
--INSERT INTO TEST VALUES(3, 'Dupa');
--CREATE TABLE TEST_TEMP(ID INT PRIMARY KEY, NAME VARCHAR);
--CALL FTL_CREATE_INDEX('PUBLIC', 'TEST_TEMP', NULL);
--DROP TABLE TEST;
--ALTER TABLE TEST_TEMP RENAME TO TEST;
--CALL FTL_REINDEX();
--FTL_CREATE_INDEX(schemaNameString, tableNameString, columnListString)
--FTL_SEARCH(queryString, limitInt, offsetInt): result set
--FTL_REINDEX()
--FTL_DROP_ALL()
-- |
#sql('_getAllSupplierList')
SELECT
id AS gysbm,
company AS gysmc,
(CASE insourceid
WHEN 1
THEN '厂家'
WHEN 2
THEN '经销商'
WHEN 3
THEN '特殊渠道'
ELSE '无' END) AS gyslb,
'T' AS jslx,
'Y' AS gyszt,
company_jc AS zjm,
convert(VARCHAR(32), adddate, 120) AS zcsj
FROM Ok3w_qudao
#end |
CREATE TABLE Users (id SERIAL, firstname varchar, lastname varchar, email varchar, password varchar) ;
INSERT INTO Requests (firstname, lastname, email, password)
VALUES ('Sinmi','John', 'sinmiloluwasunday@yahoo.com','test');
CREATE TABLE Requests (ID SERIAL, title varchar, description varchar, category varchar, image varchar, status varchar, dated date, userId REFERENCES users(id);
INSERT INTO Requests (title, description, category, image, status, dated)
VALUES ('Faulty Fan','we have a fault', 'electrical','' ,'approved','2018-12-13'),
('Faulty Fan','we have a fault', 'electrical','' ,'approved','2018-12-13'),
('Faulty Fan','we have a fault', 'mechanical','' ,'disapproved','2018-12-13'),
('Faulty Fan','we have a fault', 'physical','' ,'disapproved','2018-12-13'),
('Faulty Fan','we have a fault', 'electrical','' ,'resolved','2018-12-13'),
('Faulty Fan','we have a fault', 'electrical','' ,'resolved','2018-12-13'),
('Faulty Fan','we have a fault', 'electrical','' ,'pending','2018-12-13'),
('Faulty Fan','we have a fault', 'electrical','' ,'pending','2018-12-13');
|
CREATE TABLE User
(id integer primary key not null auto_increment,
mail varchar(80) UNIQUE,
encrypted_password varchar(80) not null,
salt varchar(10) not null,
facebookmail varchar(30) unique,
firstname varchar(20) not null,
lastname varchar(40) not null,
phonenumber varchar(30),
created_at datetime,
updated_at datetime null
);
CREATE TABLE Friend
(id1 integer not null references User(id) on delete cascade,
id2 integer not null references User on delete cascade,
created_at datetime not null,
primary key(id1, id2)
);
CREATE TABLE Challenge
(id integer primary key not null auto_increment,
challenger integer not null references User(id) on delete set null,
challenged integer not null references User(id) on delete set null,
title varchar(100) not null,
text varchar(1000) not null,
completed integer default 0,
started datetime not null,
finished datetime,
privacy integer,
confirmed integer default 0,
delivered integer default 0
);
CREATE TABLE Vote
(id integer primary key not null auto_increment,
challenge integer not null references Challenge(id) on delete set null,
voter integer not null references User(id) on delete set null,
created_at datetime not null,
type integer not null
);
create table Devices
(
id integer primary key not null auto_increment,
registration_id integer not null,
owner integer not null references User(id) on delete cascade
); |
CREATE Procedure sp_get_SchemeDetail_rec (@SchemeID INT)
as
Select StartValue,EndValue,FreeValue,FreeItem = Case
When Not Exists(Select Alias from Items Where Alias = schemeitems_rec.freeItem) Then
N'' Else (Select Product_Code from Items Where Alias = schemeitems_rec.freeItem) End, FromItem, ToItem
from SchemeItems_rec where schemeID=@SchemeID order by startvalue asc
|
-- phpMyAdmin SQL Dump
-- version 4.4.12
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 27, 2016 at 03:36 AM
-- Server version: 5.6.25
-- PHP Version: 5.5.27
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: `filemanager`
--
-- --------------------------------------------------------
--
-- Table structure for table `accounts`
--
CREATE TABLE IF NOT EXISTS `accounts` (
`id` int(11) NOT NULL,
`username` varchar(32) NOT NULL,
`password` varchar(129) NOT NULL,
`email` varchar(256) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `files`
--
CREATE TABLE IF NOT EXISTS `files` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
`path` varchar(256) NOT NULL,
`name` varchar(128) NOT NULL,
`fileid` varchar(16) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `accounts`
--
ALTER TABLE `accounts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `files`
--
ALTER TABLE `files`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `accounts`
--
ALTER TABLE `accounts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `files`
--
ALTER TABLE `files`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE DATABASE nodelogin;
USE nodelogin;
CREATE TABLE accounts(
id int(11) NOT NULL AUTO_INCREMENT,
username varchar(50) NOT NULL,
password varchar(255) NOT NULL,
email varchar(100) NOT NULL,
primary key(id)
);
INSERT INTO accounts(id, username, password, email) VALUES (1, 'test', 'test', 'test@test.com');
INSERT INTO accounts(id, username, password, email) VALUES (2, 'test2', 'test2', 'test2@test.com');
select * from accounts; |
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 09-Dez-2018 às 04:32
-- Versão do servidor: 10.1.32-MariaDB
-- PHP Version: 7.2.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: `biblioteca`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `cadastro`
--
CREATE TABLE `cadastro` (
`nome` varchar(255) NOT NULL,
`matricula` varchar(20) NOT NULL,
`dataNasc` date NOT NULL,
`email` varchar(255) NOT NULL,
`telefone` varchar(30) NOT NULL,
`celular` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `cadastro`
--
INSERT INTO `cadastro` (`nome`, `matricula`, `dataNasc`, `email`, `telefone`, `celular`) VALUES
('daaaaaaaaaaaaa', '11111', '0000-00-00', 'fafaga@gm.com', '(66)56565656', NULL),
('Mateus', '216463545', '0000-00-00', 'mateusbispo@gmail.com', '(16)57465546', NULL),
('testando', '222222', '0000-00-00', 'teste@testando.com', '(55)55555555', NULL),
('sasa', '6666666', '0000-00-00', 'dada@gmail.com', '(66)66666666', '(66)666666666'),
('dsda', '66666666', '0000-00-00', 'sasa@gmail.com', '(66)66666666', NULL),
('ijdia', '6666666666', '0000-00-00', 'siaj@gmail.com', '(66)66666666', NULL),
('dada', '9999999999', '0000-00-00', 'adad@gmail.com', '(21)99999999', '(21)999999999'),
('KEVIN', 'DADJA', '0000-00-00', 'sasff@gmail.com', '(99)99999999', NULL),
('teste', 'teste', '0000-00-00', 'teste@teste.com', '(21)22222222', NULL),
('11616', 'wwq', '0000-00-00', 'sadfart@', '(33)33333333', NULL);
-- --------------------------------------------------------
--
-- Estrutura da tabela `emprestimo`
--
CREATE TABLE `emprestimo` (
`matricula` varchar(20) NOT NULL,
`isbn` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estrutura da tabela `entrada`
--
CREATE TABLE `entrada` (
`nome` varchar(255) NOT NULL,
`matricula` varchar(30) NOT NULL,
`dataNasc` date NOT NULL,
`email` varchar(255) NOT NULL,
`telefone` varchar(20) NOT NULL,
`celular` varchar(30) DEFAULT NULL,
`titulo` varchar(255) DEFAULT NULL,
`autor` varchar(255) DEFAULT NULL,
`isbn` varchar(20) NOT NULL,
`genero` varchar(30) NOT NULL,
`dataEmprestimo` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estrutura da tabela `generos`
--
CREATE TABLE `generos` (
`genero` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `generos`
--
INSERT INTO `generos` (`genero`) VALUES
('Acadêmico'),
('Biografia'),
('dada'),
('Drama'),
('Ficção'),
('Infanto-Juvenil'),
('Romance'),
('Terror'),
('Thriller'),
('Young Adult');
-- --------------------------------------------------------
--
-- Estrutura da tabela `livros`
--
CREATE TABLE `livros` (
`titulo` varchar(255) DEFAULT NULL,
`autor` varchar(255) DEFAULT NULL,
`isbn` varchar(20) NOT NULL,
`genero` varchar(30) DEFAULT NULL,
`subgenero` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `livros`
--
INSERT INTO `livros` (`titulo`, `autor`, `isbn`, `genero`, `subgenero`) VALUES
(NULL, NULL, '0102030306', 'Acadêmico', 'Linguagem SQL'),
(NULL, NULL, '0102263065', 'Acadêmico', 'Linguagem C'),
(NULL, NULL, '0120510590', 'Acadêmico', 'Física'),
(NULL, NULL, '0365865989', 'Acadêmico', 'POO'),
(NULL, NULL, '09080796756', 'Thriller', NULL),
(NULL, NULL, '1254638656', 'Acadêmico', 'POO'),
(NULL, NULL, '1414558251158', 'Infanto-Juvenil', NULL),
(NULL, NULL, '1447582693', 'Ficção', 'Fantástica'),
(NULL, NULL, '1645946269', 'Acadêmico', 'Administração'),
('1746', 'Ouvidoria', '1746', 'Acadêmico', 'Administração'),
(NULL, NULL, '26331269441', 'Ficção', 'Científica'),
(NULL, NULL, '3652414636', 'Acadêmico', 'Inglês'),
(NULL, NULL, '3695524654', 'Ficção', 'Fantástica'),
(NULL, NULL, '4656522659', 'Ficção', 'Científica'),
(NULL, NULL, '5232562325', 'Acadêmico', 'POO'),
(NULL, NULL, '5352352525', 'Ficção', 'Histórica'),
(NULL, NULL, '9858745265', 'Acadêmico', 'Física');
-- --------------------------------------------------------
--
-- Estrutura da tabela `subgeneros`
--
CREATE TABLE `subgeneros` (
`generos` varchar(50) NOT NULL,
`subg` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `subgeneros`
--
INSERT INTO `subgeneros` (`generos`, `subg`) VALUES
('Acadêmico', 'Administração'),
('Acadêmico', 'Física'),
('Acadêmico', 'Francês'),
('Acadêmico', 'Inglês'),
('Acadêmico', 'Linguagem C'),
('Acadêmico', 'Linguagem PHP'),
('Acadêmico', 'Linguagem SQL'),
('Acadêmico', 'POO'),
('Ficção', 'Científica'),
('Ficção', 'Fantástica'),
('Ficção', 'Histórica');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cadastro`
--
ALTER TABLE `cadastro`
ADD PRIMARY KEY (`matricula`);
--
-- Indexes for table `emprestimo`
--
ALTER TABLE `emprestimo`
ADD PRIMARY KEY (`matricula`,`isbn`);
--
-- Indexes for table `generos`
--
ALTER TABLE `generos`
ADD PRIMARY KEY (`genero`);
--
-- Indexes for table `livros`
--
ALTER TABLE `livros`
ADD PRIMARY KEY (`isbn`);
--
-- Indexes for table `subgeneros`
--
ALTER TABLE `subgeneros`
ADD PRIMARY KEY (`generos`,`subg`);
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `subgeneros`
--
ALTER TABLE `subgeneros`
ADD CONSTRAINT `subgeneros_ibfk_1` FOREIGN KEY (`generos`) REFERENCES `generos` (`genero`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 07-04-2019 a las 16:43:28
-- Versión del servidor: 10.1.38-MariaDB
-- Versión de PHP: 7.1.27
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `cursophp`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `jobs`
--
CREATE TABLE `jobs` (
`id` int(11) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`visible` tinyint(1) NOT NULL,
`months` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`logo` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `jobs`
--
INSERT INTO `jobs` (`id`, `title`, `description`, `visible`, `months`, `created_at`, `updated_at`, `logo`) VALUES
(1, 'Titulo 1', 'Descripción 1', 0, 0, '2019-04-01 23:29:08', '2019-04-01 23:29:08', NULL),
(2, 'PHP Developer', 'This is an awesome job!!!', 0, 0, '2019-04-01 23:44:51', '2019-04-01 23:44:51', NULL),
(3, 'Python Dev', 'This is an awesome job!!!', 0, 0, '2019-04-01 23:44:57', '2019-04-01 23:44:57', NULL),
(4, 'Devops', 'This is an awesome job!!!', 0, 0, '2019-04-01 23:46:28', '2019-04-01 23:46:28', NULL),
(5, 'NodeJS Dev', 'This is an awesome job!!!', 0, 0, '2019-04-01 23:46:35', '2019-04-01 23:46:35', NULL),
(6, 'Frontend Dev', 'This is an awesome job!!!', 0, 0, '2019-04-01 23:46:43', '2019-04-01 23:46:43', NULL),
(7, 'Python DEv', 'Python DEv', 0, 0, '2019-04-07 06:57:23', '2019-04-07 06:57:23', NULL),
(8, 'job XSS', '<script>alert(\"Hola\");</script>', 0, 0, '2019-04-07 07:08:39', '2019-04-07 07:08:39', NULL),
(9, 'nuevo trabajo', 'nuevo trabajo', 0, 0, '2019-04-07 08:32:44', '2019-04-07 08:32:44', NULL),
(13, 'Full Stack Developer', 'Soy el mejor Full Stack Developer', 0, 0, '2019-04-07 15:28:37', '2019-04-07 15:28:37', '4af319148a3435f8f1d1ef91290e2cc9721bd5cc.jpg');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `projects`
--
CREATE TABLE `projects` (
`id` int(11) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`visible` tinyint(1) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `projects`
--
INSERT INTO `projects` (`id`, `title`, `description`, `visible`, `created_at`, `updated_at`) VALUES
(1, 'Project X', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Eius earum corporis at accusamus quisquam hic quos vel? Tenetur, ullam veniam consequatur esse quod cum, quam cupiditate assumenda natus maiores aperiam.', 0, '2019-04-02 00:01:57', '2019-04-02 00:01:57'),
(2, 'Project Y', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Eius earum corporis at accusamus quisquam hic quos vel? Tenetur, ullam veniam consequatur esse quod cum, quam cupiditate assumenda natus maiores aperiam.', 0, '2019-04-02 00:03:24', '2019-04-02 00:03:24');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `created_at`, `updated_at`) VALUES
(1, 'jaidenmeiden', '$2y$10$k8DqlH2bPL4HO6/LvF6emu6yvki7wKNF9lYFup9vtK.1nzy/e.0TC', '2019-04-07 16:38:41', '2019-04-07 16:38:41');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `jobs`
--
ALTER TABLE `jobs`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `projects`
--
ALTER TABLE `projects`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `jobs`
--
ALTER TABLE `jobs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT de la tabla `projects`
--
ALTER TABLE `projects`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
select
pokemon_types.pokemon_id,
pokemon_name,
pokemon_type,
pokemon_stats.name move_name,
total_damage
from
/data/pokemon_types.csv pokemon_types
join /data/pokemon.csv pokemon_stats on pokemon_types.pokemon_type = pokemon_stats.type
where
pokemon_name = 'Squirtle'
or (
pokemon_name = 'Wartortle'
and id in (31, 32)
);
|
<PROBLEMSET 01> JULY 31,2018
SUBMITTED BY nivetha.seenivasan
Hotel (Hotel_No, Name, City)
create table Hotel(Hotel_No text PRIMARY KEY,Name text,City text);
Insert into Hotel values('H111','Empire Hotel','New York');
Insert into Hotel values ('H235','Park Place','New York');
Insert into Hotel values('H432','Brownstone Hotel','Toronto');
Insert into Hotel values('H498','James Plaza','Totonto');
Insert into Hotel values('H193','Devon Hotel','Boston');
Insert into Hotel values('H437','Clairmont Hotel','Boston');
Room (Room_No, @Hotel_No, Type, Price)
create table Room(Room_No text,Hotel_No text references Hotel(Hotel_No),Type text,Price text,Constraint pk_key PRIMARY KEY(Room_No,Hotel_No));
Insert into Room values('313','H111','S',145.00);
Insert into Room values('412','H111','N',145.00);
Insert into Room values('1267','H235','N',175.00);
Insert into Room values('1289','H235','N',195.00);
Insert into Room values('876','H432','S','124.00);
Booking (@Hotel_No, @Guest_No, Date_From, Date_To, @Room_No)
create table Booking(Hotel_No text references Room(Hotel_No),Guest_No text references Guest(Guest_No),Date_From text,Date_To text,Room_No text references Room(Room_No),Constraint pk_key PRIMARY KEY(Hotel_No,Guest_no,Room_No));
INSERT INTO BOOKING VALUES('H111','G256','10-AUG-99','15-AUG-99',412);
INSERT INTO BOOKING VALUES('H111','G367','18-AUG-99','21-AUG-99',412);
INSERT INTO BOOKING VALUES('H235','G879','05-SEP-99','12-SEP-99',1267);
INSERT INTO BOOKING VALUES('H498','G230','15-SEP-99','18-SEP-99',467);
INSERT INTO BOOKING VALUES('H498','G256','30-NOV-99','02-DEC-99',345);
INSERT INTO BOOKING VALUES('H498','G467','03-NOV-99','05-NOV-99',345);
INSERT INTO BOOKING VALUES('H193','G190','15-NOV-99','19-NOV-99',1001);
INSERT INTO BOOKING VALUES('H193','G367','12-SEP-99','14-SEP-99',1001);
INSERT INTO BOOKING VALUES('H193','G367','01-OCT-99','06-OCT-99',1201);
INSERT INTO BOOKING VALUES('H437','G190','04-OCT-99','06-OCT-99',223);
INSERT INTO BOOKING VALUES('H437','G879','14-SEP-99','17-SEP-99',223);
Guest (Guest_No, Name, City)
create table Guest(Guest_No text PRIMARY KEY,Name text,City text);
INSERT INTO GUEST VALUES('G256','ADAM WAYNE','PITTSBURGH');
INSERT INTO GUEST VALUES('G367','TARA CUMMINGS','BALTIMORE');
INSERT INTO GUEST VALUES('G879','VANESSA PARRY','PITTSBURGH');
INSERT INTO GUEST VALUES('G230','TOM HANCOCK','PHILADELPHIA');
INSERT INTO GUEST VALUES('G467','ROBERT SWIFT','ATLANTA');
INSERT INTO GUEST VALUES('G190','EDWARD CANE','BALTIMORE');
1.List full details of all hotels.
select a.Hotel_No,a.Name,a.City,b.Room_No,b.Type,b.Price from Hotel a inner join Room b ON a.Hotel_No=b.Hotel_No;
H111|Empire Hotel|New York|313|S|145
H111|Empire Hotel|New York|412|N|145
H235|Park Place|New York|1267|N|175
H235|Park Place|New York|1289|N|195
H432|Brownstone Hotel|Toronto|876|S|124
H432|Brownstone Hotel|Toronto|898|S|124
H498|James Plaza|Totonto|345|N|160
H498|James Plaza|Totonto|467|N|180
H193|Devon Hotel|Boston|1001|S|150
H193|Devon Hotel|Boston|1201|N|175
H437|Clairmont Hotel|Boston|257|N|140
H437|Clairmont Hotel|Boston|223|N|155
RECORD COUNT-12
2.List full details of all hotels in New York.
select a.Hotel_No,a.Name,a.City,b.Room_No,b.Type,b.Price from Hotel a inner join Room b where a.Hotel_No=b.Hotel_No and a.City='New York';
H111|Empire Hotel|New York|313|S|145
H111|Empire Hotel|New York|412|N|145
H235|Park Place|New York|1267|N|175
H235|Park Place|New York|1289|N|195
RECORD COUNT-4
3.List the names and cities of all guests, ordered according to their cities.
select * from GUEST order by City;
G467|ROBERT SWIFT|ATLANTA
G367|TARA CUMMINGS|BALTIMORE
G190|EDWARD CANE|BALTIMORE
G230|TOM HANCOCK|PHILADELPHIA
G256|ADAM WAYNE|PITTSBURGH
G879|VANESSA PARRY|PITTSBURGH
RECORD COUNT-6
4.List all details for non-smoking rooms in ascending order of price.
select * from Room where Type='N' order by Price;
257|H437|N|140
412|H111|N|145
223|H437|N|155
345|H498|N|160
1267|H235|N|175
1201|H193|N|175
467|H498|N|180
1289|H235|N|195
RECORD COUNT-8
5.List the number of hotels there are.
select count(Hotel_No) as COUNT from Hotel;
6
RECORD COUNT-1
6.List the cities in which guests live. Each city should be listed only once.
select distinct City from Guest;
PITTSBURGH
BALTIMORE
PHILADELPHIA
ATLANTA
RECORD COUNT-4
7.List the average price of a room.
select Type,avg(PRICE) as AVERAGE_PRICE from Room Group By Type;
N|165.625
S|135.75
RECORD COUNT-2
8.List hotel names, their room numbers, and the type of that room.
select a.Hotel_No,a.Name,b.Room_No,b.Type from Hotel a inner join Room b ON a.Hotel_No=b.Hotel_No;
H111|Empire Hotel|313|S
H111|Empire Hotel|412|N
H235|Park Place|1267|N
H235|Park Place|1289|N
H432|Brownstone Hotel|876|S
H432|Brownstone Hotel|898|S
H498|James Plaza|345|N
H498|James Plaza|467|N
H193|Devon Hotel|1001|S
H193|Devon Hotel|1201|N
H437|Clairmont Hotel|257|N
H437|Clairmont Hotel|223|N
RECORD COUNT-12
9.List the hotel names, booking dates, and room numbers for all hotels in New York.
Select b.Name,a.Date_From,a.Date_To,a.Room_No,b.City from Booking a inner join Hotel b where a.Hotel_No=b.Hotel_No and b.City='New York';
Empire Hotel|10-AUG-99|15-AUG-99|412|New York
Empire Hotel|18-AUG-99|21-AUG-99|412|New York
Park Place|05-SEP-99|12-SEP-99|1267|New York
RECORD COUNT-3
10.What is the number of bookings that started in the month of September?
Select * from Booking where Date_from Like '%SEP%';
H235|G879|05-SEP-99|12-SEP-99|1267
H498|G230|15-SEP-99|18-SEP-99|467
H193|G367|12-SEP-99|14-SEP-99|1001
RECORD COUNT-3
11.List the names and cities of guests who began a stay in New York in August.
select b.Hotel_No,h.Name,b.Room_No,b.Guest_No,g.Name,g.City,b.Date_From,b.Date_To from Booking b inner join Hotel h inner join Guest g where b.Hotel_No=h.Hotel_No and h.City='New York' and b.Guest_No=g.Guest_No and b.Date_From Like '%AUG%';
H111|Empire Hotel|412|G256|ADAM WAYNE|PITTSBURGH|10-AUG-99|15-AUG-99
H111|Empire Hotel|412|G367|TARA CUMMINGS|BALTIMORE|18-AUG-99|21-AUG-99
RECORD COUNT-2
12.List the hotel names and room numbers of any hotel rooms that have not been booked.
select h.Hotel_No,h.Name,r.Room_No from Hotel h inner join Room r on h.Hotel_No=r.Hotel_No where r.Room_No not in (select distinct Room_No from Booking);
H235|Park Place|1289
H437|Clairmont Hotel|257
H111|Empire Hotel|313
H432|Brownstone Hotel|876
H432|Brownstone Hotel|898
RECORD COUNT-5
13.List the hotel name and city of the hotel with the highest priced room.
select h.Hotel_No,h.Name,max(r.Price) from Hotel h inner Join Room r on h.Hotel_No=r.Hotel_No;
H235|Park Place|195
RECORD COUNT-1
14.List hotel names, room numbers, cities, and prices for hotels that have rooms with prices lower than the lowest priced room in a Boston hotel.
select h.Hotel_No,h.Name,r.Room_No,min(Price) from Room r inner join Hotel h on r.Hotel_No=h.Hotel_No where h.City='Boston';
H437|Clairmont Hotel|257|140
RECORD COUNT-1
15.List the average price of a room grouped by city.
select h.Hotel_No,h.Name,r.Room_No,avg(Price) from Room r inner join Hotel h on r.Hotel_No=h.Hotel_No group by City;
H437|Clairmont Hotel|223|155.0
H235|Park Place|1289|165.0
H432|Brownstone Hotel|898|124.0
H498|James Plaza|467|170.0
RECORD COUNT-4
|
CREATE TABLE players (
P_ID INTEGER PRIMARY KEY AUTOINCREMENT,
first_name varchar,
last_name varchar,
birth date,
country varchar,
height decimal,
weight decimal,
photo blob,
team_id INTEGER);
CREATE TABLE goals (
G_ID INTEGER PRIMARY KEY AUTOINCREMENT,
minute time,
player_id INTEGER,
match_id INTEGER,
type string
);
CREATE TABLE teams (
T_ID INTEGER PRIMARY KEY AUTOINCREMENT,
title varchar,
city varchar,
emblem blob,
season date,
win decimal,
draw decimal,
lost decimal
);
CREATE TABLE staff (
S_ID INTEGER PRIMARY KEY AUTOINCREMENT,
player_id INTEGER,
position string,
season date,
team_id INTEGER);
CREATE TABLE matches (
M_ID INTEGER PRIMARY KEY AUTOINCREMENT,
home_team_id INTEGER,
guest_team_id INTEGER,
score_home decimal,
score_guest decimal,
round decimal,
season decimal,
datem datetime,
location varchar);
CREATE TABLE penalties (
match_id INTEGER,
player_id INTEGER,
minute time,
red boolean,
yellow boolean,
caution boolean
);
|
--ALTER VIEW BG_Shipping_$_And_Lbs_By_Loc AS
--Created: 05/11/12 By: BG
--Last Updated: 5/11/12 By: BG
--Purpose: Report for shipping $ and lbs by location
--Last Change: --
SELECT OH.ord_no,
CASE WHEN MAX(PP.LOC) IS NULL THEN MAX(OL.loc)
ELSE MAX(PP.loc)
END AS LOC,
CASE WHEN (SUM(pp.weight) IS NULL AND SUM(OL.weight) = 0) THEN SUM(OL.qty_to_ship * 50)
WHEN (SUM(pp.weight) IS NULL) THEN SUM(OL.weight)
WHEN (SUM(bl.carrier_cd_weight) = 0 OR SUM(bl.carrier_cd_weight) IS NULL) THEN SUM(pp.weight)
ELSE SUM(bl.carrier_cd_weight)
END [Lbs],
CASE WHEN SUM(pp.qty) IS NULL THEN SUM(OL.qty_to_ship)
ELSE SUM(pp.qty)
END AS UNITS,
OH.tot_sls_amt AS [$],
CASE WHEN MAX(OH.ord_Dt_Shipped) IS NULL THEN MAX(OH.inv_dt)
ELSE MAX(OH.ord_dt_shipped)
END AS [Shipped_Dt]
FROM (SELECT SUM(OH.tot_sls_amt) AS [tot_sls_amt], OH.ord_no, MAX(ord_dt_shipped) AS ord_dt_Shipped, MAX(inv_dt) AS inv_Dt
FROM oehdrhst_Sql OH WITH (NOLOCK)
GROUP BY OH.ord_no) AS OH
JOIN
(SELECT SUM(qty_to_ship) AS qty_to_ship, ord_no, SUM(unit_weight*qty_to_ship) AS weight, loc
FROM oelinhst_Sql WITH (NOLOCK)
WHERE loc IN ('MDC','WS','PS','MS')
GROUP BY ord_no, loc) AS OL ON OH.ord_no = OL.ord_no
LEFT OUTER JOIN
(SELECT SUM(qty) AS qty, SUM(weight) AS weight, ord_no, pp.shipment, PP.loc, MAX(ship_dt) AS Ship_dt
FROM dbo.wsPikPak PP WITH(NOLOCK)
GROUP BY ord_no, pp.shipment, pp.loc) AS PP ON OH.ord_no = PP.ord_no
LEFT OUTER JOIN dbo.wsShipment SHP WITH (NOLOCK) ON PP.Shipment = SHP.Shipment
LEFT OUTER JOIN dbo.oebolfil_sql BL WITH (NOLOCK) ON SHP.bol_no = BL.bol_no
WHERE (OH.ord_dt_shipped > '01/01/2012' OR (ord_dt_shipped IS NULL AND OH.inv_dt > '01/01/2012'))
--AND OH.ord_dt_shipped > '01/01/2012'
AND OL.qty_to_ship > 0
AND (PP.LOC IN ('MDC', 'WS', 'PS', 'MS') OR (PP.loc IS NULL AND OH.ord_no IN (SELECT ord_no FROM oelinhst_sql WHERE loc IN ('MDC','WS','PS','MS'))))
--AND OH.ord_no = ' 3002228'
GROUP BY OH.ord_no, OH.tot_sls_amt, OH.ord_Dt_Shipped
|
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50712
Source Host : localhost:3306
Source Database : BoJu
Target Server Type : MYSQL
Target Server Version : 50712
File Encoding : 65001
Date: 2016-10-17 12:45:39
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `account_reportgroup_mapping`
-- ----------------------------
DROP TABLE IF EXISTS `account_reportgroup_mapping`;
CREATE TABLE `account_reportgroup_mapping` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
`AccountID` bigint(20) NOT NULL,
`GroupID` bigint(20) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of account_reportgroup_mapping
-- ----------------------------
|
select count(distinct `c1`) as `cnt`
from `empty` |
-- Jul 29, 2008 4:04:35 PM CDT
-- Default comment for updating dictionary
UPDATE AD_Column SET AD_Reference_ID=18, AD_Reference_Value_ID=130,Updated=TO_DATE('2008-07-29 16:04:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=56179
;
-- Jul 29, 2008 4:05:00 PM CDT
-- Default comment for updating dictionary
UPDATE AD_Column SET AD_Val_Rule_ID=104,Updated=TO_DATE('2008-07-29 16:05:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55055
;
|
select
wk,
count(*)
from
bitmp.tmamiya_order_defect_customer_segmentation_pre
group by 1 |
truncate table cir.direction_map;
truncate table cir.location_map;
truncate table cir.contact_call;
truncate table cir.contact_status;
truncate table cir.contact;
truncate table cir.apps_report_parameter;
truncate table cir.apps_report;
truncate table cir.possible_value;
truncate table cir.meeting_place;
truncate table cir.territory;
truncate table cir.service_group;
truncate table cir.congregation;
alter table cir.apps_report_parameter alter column id restart with 1;
alter table cir.apps_report alter column id restart with 1;
alter table cir.congregation alter column id restart with 1;
alter table cir.contact alter column id restart with 1;
alter table cir.contact_call alter column id restart with 1;
alter table cir.contact_status alter column id restart with 1;
alter table cir.direction_map alter column id restart with 1;
alter table cir.location_map alter column id restart with 1;
alter table cir.meeting_place alter column id restart with 1;
alter table cir.possible_value alter column id restart with 1;
alter table cir.service_group alter column id restart with 1;
alter table cir.territory alter column id restart with 1;
commit; |
/*USE beadndo_o09ctq;*/
/*1,*/
SELECT alkalmazott.Nev
FROM alkalmazott
INNER JOIN bolt ON bolt.UzletID=alkalmazott.UzletID
WHERE alkalmazott.UzletID='002';
/*2,*/
SELECT bolt.Telefonszam FROM bolt WHERE bolt.Varos='Budapest';
/*3,*/
SELECT COUNT(jatekszoftver_raktar.Minoseg) FROM jatekszoftver_raktar WHERE jatekszoftver_raktar.Minoseg='0';
/*4,*/
SELECT COUNT(jatekszoftver.Ar) FROM jatekszoftver WHERE jatekszoftver.Ar>12000;
/*5,*/
SELECT raktar.UzletID, SUM(raktar.ElerhetoDarab) AS darab
FROM raktar
GROUP BY raktar.UzletID
ORDER BY darab DESC;
/*6,*/
SELECT jatekszoftver.Cim, jatekplatform.Platform
FROM jatekszoftver
INNER JOIN jatekplatform ON jatekszoftver.termekID=jatekplatform.TermekID
WHERE jatekplatform.Platform IS NOT NULL;
/*7,*/
SELECT COUNT(jatekszoftver.termekID) FROM jatekszoftver WHERE jatekszoftver.KorHatar='7';
/*8,*/
SELECT TID FROM tranzakciok WHERE Osszeg=(SELECT MAX(tranzakciok.Osszeg) FROM tranzakciok);
/*9,*/
SELECT SUM(tranzakciok.Osszeg) FROM tranzakciok WHERE MONTH(tranzakciok.Datum)=11 AND YEAR(tranzakciok.Datum)=2020;
/*10,*/
SELECT jatekszoftver.Cim, SUM(raktar.ElerhetoDarab) AS darab
FROM jatekszoftver
INNER JOIN raktar ON jatekszoftver.termekID=raktar.TermekID
GROUP BY raktar.TermekID
ORDER BY darab LIMIT 5;
|
###文章分页查询 带模糊查询功能
#sql("getPage")
SELECT * FROM dms_article
WHERE (
dms_article.title LIKE #para(searchKey)
)
AND
dms_article.create_time BETWEEN #para(dateStartStr) AND #para(dateEndStr)
#if(sortName!=null)
ORDER BY #(sortName)
#(sortOrder)
#else
ORDER BY create_time
DESC
#end
#end
###获取文章用户
#sql("getUser")
SELECT * FROM dms_user
WHERE dms_user.id = ?
#end
###根据URL 查找文章
#sql("findByUrl")
SELECT * FROM dms_article
WHERE dms_article.url = ?
#end
###获取所有置顶文章
#sql("getTopArticleList")
SELECT *
FROM dms_article
WHERE dms_article.is_top = 'on'
GROUP BY dms_article.create_time
#end
###根据用户id获取所有文章
#sql("findByUId")
SELECT *
FROM dms_article
WHERE dms_article.uid = ?
GROUP BY dms_article.create_time
#end
|
# INSERT INTO Vehicle VALUES('JDO682', '90JERN34F9DF3450F', 'Holden', 'Commodore', 2008, 5, 'Petrol', NULL, 'C');
# INSERT INTO Vehicle VALUES('AKJ424', '8Y2340JDSNKL9HGS9', 'BCI', 'Fleetmaster 55', 2010, 87, 'Diesel', 'Fire extinguisher, 5 tents, 3 kayaks', 'MR');
# INSERT INTO Vehicle VALUES('EIU112', 'SPG4VLEHSDZ98U454', 'Scania', 'K230UB', 2007, 64, 'Diesel', NULL, 'MR');
# INSERT INTO Vehicle VALUES('TPO652', '90S8U449S8G9K5N8L', 'Scania', 'K320UB', 2010, 53, 'Diesel', NULL, 'HR');
# INSERT INTO Vehicle VALUES('MCN687', 'T3NF8S0D99l9FK6V5', 'BCI', 'Proma', 2011, 35, 'Diesel', 'Fire extinguisher', 'LR');
INSERT INTO Vehicle VALUES('GH2314', '98DF65SG46SDA1S2D', 'Benz', 'Series1', 2012, 80, 'Diesel', 'Microphone', 'C');
INSERT INTO Vehicle VALUES('AL8123', 'ASDFA745613246SDF', 'Honda', 'ZX1', 2008, 45, 'Petrol', NULL, 'HR');
INSERT INTO Vehicle VALUES('WE7879', 'FGHE7R8H79E8RG421', 'Toyota', 'COACH', 2015, 5, 'Petrol', NULL, 'C');
INSERT INTO Vehicle VALUES('SD5461', '7J9ER79E79RH4E6RG', 'Honda', 'ZX1S', 1991, 13, 'Diesel', 'Fire Extinguisher', 'HR');
INSERT INTO Vehicle VALUES('EW2534', '9R7H9ER66WE5F3V2V', 'Volkswagen', 'Airbus', 2011, 50, 'Diesel', NULL, 'MR');
INSERT INTO Vehicle VALUES('TQ4646', 'WE9T78W9E7T979W7E', 'BMW', 'Primer', 2000, 24, 'Diesel', 'Stereo DVD Player', 'LR');
# INSERT INTO Tour VALUES('021', 'Twelve Apostles Drive', 'A drive along the Great Ocean Road to the Twelve Apostles', 28, NULL);
# INSERT INTO Tour VALUES('047', 'Northeast Wineries Tour', 'A tour to various wineries in North East Victoria', 32, NULL);
# INSERT INTO Tour VALUES('055', 'Melbourne Sightseeing', 'A drive along the Great Ocean Road to the Twelve Apostles', 3.5, 'C:\Documents\Route_Maps\Melbourne_Sightseeing.png');
INSERT INTO Trip VALUES('004572', '055', 'EIU112', '2016-05-15', 62,100,80);
INSERT INTO Trip VALUES('004640', '055', 'EIU112', '2016-06-23', 62,200,150);
INSERT INTO Trip VALUES('343271', '021', 'JDO682', '2016-12-04', 3, 400,250);
INSERT INTO Trip VALUES('167005', '047', 'TPO652', '2016-10-20', 51, 120,80);
INSERT INTO Itinerary VALUES('055', 001, '000342', 'Guided tour around the CBD', 'Lunch on Lygon Street');
INSERT INTO Itinerary VALUES('047', 001, '000599', 'Wine tasting at Pizzini''s', 'Lunch at Pizzini''s');
INSERT INTO Trip_Booking VALUES('004564', '004572', '2016-08-15', 100);
INSERT INTO Trip_Booking VALUES('007214', '167005', '2016-05-27', 500);
INSERT INTO Trip_Booking VALUES('008050', '343271', '2016-11-01', 150);
INSERT INTO Customer VALUES('031642', 'Freddie', NULL, 'Khan', 500, 'Waverly Road', 'Chadstone', 3555, 'fred.khan@holmesglen.edu.au', NULL);
INSERT INTO Customer VALUES('001484', 'William', 'B', 'Pitt', 200, 'St. Kilda Road', 'St. Kilda', 3147, 'bill.pitt@gmail.com', 0351806451);
INSERT INTO Customer_Booking VALUES('004564', '031642',2,2);
INSERT INTO Customer_Booking VALUES('007214', '001484',1,0);
INSERT INTO Customer_Booking VALUES('008050', '001484',2,0);
INSERT INTO Customer_Review VALUES('004572', '031642', 5, 'Excellent trip, I will be booking with you guys again next year!', 'The whole trip was very reasonably priced.', 'None!');
INSERT INTO Customer_Review VALUES('167005', '001484', 3, 'It was okay, not as good as Kontiki', 'Staff were nice', 'The food was rubbish');
INSERT INTO Customer_Review VALUES('343271', '001484', 4, 'Better than the last one', 'Staff were nice like last time and the food was better', 'The tour bus was too noisy');
|
create schema if not exists `test-backend-vinicius`;
use `test-backend-vinicius`;
create table if not exists months (
id_month tinyint unsigned primary key auto_increment,
name varchar(30) not null
);
create table if not exists categories (
id_category tinyint unsigned primary key auto_increment,
name varchar(80) not null
);
create table if not exists list_items (
id_list_items int unsigned primary key auto_increment,
id_mouth tinyint unsigned not null,
id_category tinyint unsigned not null,
name_item varchar(80) not null,
quantity mediumint not null,
created_at timestamp not null,
updated_at timestamp not null
);
alter table list_items
add constraint list_items_id_month_foreign
foreign key (id_mouth) references months(id_month);
alter table list_items
add constraint list_items_id_category_foreign
foreign key (id_category) references categories(id_category);
insert months (
name
) value ('Janeiro'),
('Fevereiro'),
('Março'),
('Abril'),
('Maio'),
('Junho'),
('Julho'),
('Agosto'),
('Setembro'),
('Outubro'),
('Novembro'),
('Dezembro');
insert categories(
name
) values ('Alimentos'),
('Higiene'),
('Limpeza'); |
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1
-- Généré le : mar. 11 mai 2021 à 20:13
-- Version du serveur : 10.4.17-MariaDB
-- Version de PHP : 8.0.2
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 */;
--
-- Base de données : `projet-cesi`
--
DELIMITER $$
--
-- Procédures
--
CREATE DEFINER=`root`@`localhost` PROCEDURE `aff_article` (IN `id` INT) BEGIN
UPDATE bloggy.articles set vues = vues+1 where idArticles=id;
SELECT * FROM bloggy.articles where idArticles=id;
END$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Structure de la table `accessibilite`
--
CREATE TABLE `accessibilite` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `accessibilite`
--
INSERT INTO `accessibilite` (`id`, `libelle`) VALUES
(1, 'Ressource privée'),
(2, 'Ressource publique');
-- --------------------------------------------------------
--
-- Structure de la table `categorie`
--
CREATE TABLE `categorie` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `categorie`
--
INSERT INTO `categorie` (`id`, `libelle`) VALUES
(1, 'Communication'),
(2, 'Cultures'),
(3, 'Développement personnel'),
(4, 'Intelligence émotionnelle'),
(5, 'Loisirs'),
(6, 'Monde professionnel'),
(7, 'Parentalité'),
(8, 'Qualité de vie'),
(9, 'Recherche de sens'),
(10, 'Santé physique'),
(11, 'Santé phsychique'),
(12, 'Spiritualité'),
(13, 'Vie affective');
-- --------------------------------------------------------
--
-- Structure de la table `commentaire`
--
CREATE TABLE `commentaire` (
`id` int(11) NOT NULL,
`auteur_id` int(11) NOT NULL,
`etat_commentaire_id` int(11) NOT NULL,
`ressource_id` int(11) NOT NULL,
`commentaire_parent_id` int(11) DEFAULT NULL,
`contenu` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `commentaire`
--
INSERT INTO `commentaire` (`id`, `auteur_id`, `etat_commentaire_id`, `ressource_id`, `commentaire_parent_id`, `contenu`, `date`) VALUES
(1, 5, 2, 10, NULL, 'rerum voluptatem praesentium', '1977-03-22 06:19:47'),
(2, 6, 2, 31, NULL, 'alias architecto non', '1998-11-30 17:25:05'),
(3, 5, 2, 49, 2, 'quasi consequatur id', '1981-04-13 00:09:13'),
(4, 8, 2, 8, NULL, 'assumenda nesciunt nam', '1975-03-22 11:40:49'),
(5, 5, 1, 11, NULL, 'voluptatibus laborum dolorem', '2010-03-18 03:04:54'),
(6, 3, 1, 20, 1, 'aliquam eveniet omnis', '2001-06-08 18:29:55'),
(7, 9, 3, 45, 5, 'praesentium in excepturi', '1998-08-30 22:39:48'),
(8, 7, 3, 45, 7, 'dolorem est velit', '2009-08-08 14:48:20'),
(9, 8, 2, 28, 7, 'nihil voluptas ullam', '2011-06-10 22:00:09'),
(10, 7, 1, 1, NULL, 'autem quos temporibus', '1996-06-06 05:57:55');
-- --------------------------------------------------------
--
-- Structure de la table `consultation_exploitation`
--
CREATE TABLE `consultation_exploitation` (
`id` int(11) NOT NULL,
`utilisateur_id` int(11) NOT NULL,
`operation_id` int(11) NOT NULL,
`ressource_id` int(11) NOT NULL,
`date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `consultation_exploitation`
--
INSERT INTO `consultation_exploitation` (`id`, `utilisateur_id`, `operation_id`, `ressource_id`, `date`) VALUES
(1, 10, 2, 19, '2013-11-06 01:56:10'),
(2, 7, 1, 31, '2011-06-22 04:13:53'),
(3, 6, 1, 34, '1987-03-28 21:13:51'),
(4, 8, 1, 40, '1991-05-07 10:21:11'),
(5, 2, 2, 11, '1982-10-14 21:09:04'),
(6, 6, 2, 6, '1973-12-15 11:52:21'),
(7, 7, 2, 4, '1993-10-01 19:47:50'),
(8, 3, 2, 30, '2020-08-07 07:56:43'),
(9, 3, 2, 20, '1996-07-25 07:40:52'),
(10, 4, 1, 16, '2013-10-17 11:45:51'),
(11, 11, 1, 38, '2021-03-07 23:31:29'),
(12, 11, 1, 38, '2021-03-08 20:44:29'),
(13, 11, 1, 38, '2021-03-13 18:52:41'),
(14, 11, 2, 38, '2021-03-13 18:53:54'),
(15, 11, 1, 30, '2021-03-13 20:07:08'),
(16, 11, 1, 38, '2021-03-21 11:32:19'),
(17, 11, 1, 38, '2021-03-23 21:02:42'),
(18, 11, 1, 38, '2021-03-26 22:02:02'),
(19, 12, 1, 38, '2021-04-12 16:08:09');
-- --------------------------------------------------------
--
-- Structure de la table `etat_commentaire`
--
CREATE TABLE `etat_commentaire` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `etat_commentaire`
--
INSERT INTO `etat_commentaire` (`id`, `libelle`) VALUES
(1, 'Validé'),
(2, 'Modéré'),
(3, 'A modérer');
-- --------------------------------------------------------
--
-- Structure de la table `operation`
--
CREATE TABLE `operation` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `operation`
--
INSERT INTO `operation` (`id`, `libelle`) VALUES
(1, 'Consultation'),
(2, 'Exploitation');
-- --------------------------------------------------------
--
-- Structure de la table `recherche`
--
CREATE TABLE `recherche` (
`id` int(11) NOT NULL,
`utilisateur_id` int(11) DEFAULT NULL,
`date` datetime NOT NULL,
`contenu` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `recherche`
--
INSERT INTO `recherche` (`id`, `utilisateur_id`, `date`, `contenu`) VALUES
(1, 9, '1993-04-15 00:30:38', 'quisquam qui impedit'),
(2, 4, '1998-04-23 08:28:30', 'sit ut recusandae'),
(3, 3, '1982-01-23 11:10:20', 'ad dignissimos omnis'),
(4, 6, '1977-02-17 13:03:05', 'magnam id velit'),
(5, 7, '1988-04-06 04:12:38', 'in asperiores illum'),
(6, 8, '1982-11-20 13:41:49', 'ullam dolores veniam'),
(7, 6, '2010-11-10 09:19:12', 'ipsum voluptatem tempore'),
(8, 7, '1976-01-04 18:53:55', 'ullam quaerat tempora'),
(9, 7, '2020-07-16 10:14:47', 'quis aut illo'),
(10, 5, '2019-02-17 00:15:46', 'dolor alias illo'),
(11, NULL, '2021-03-06 21:32:16', 'corru');
-- --------------------------------------------------------
--
-- Structure de la table `recherche_categorie`
--
CREATE TABLE `recherche_categorie` (
`recherche_id` int(11) NOT NULL,
`categorie_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `recherche_categorie`
--
INSERT INTO `recherche_categorie` (`recherche_id`, `categorie_id`) VALUES
(1, 1),
(1, 13),
(2, 5),
(2, 6),
(2, 9),
(2, 10),
(3, 1),
(3, 2),
(3, 6),
(3, 7),
(3, 8),
(3, 9),
(3, 10),
(3, 11),
(3, 12),
(3, 13),
(4, 2),
(4, 3),
(4, 4),
(4, 5),
(4, 8),
(4, 9),
(4, 10),
(4, 11),
(4, 12),
(4, 13),
(5, 9),
(6, 1),
(6, 2),
(6, 3),
(6, 4),
(6, 5),
(6, 6),
(6, 7),
(6, 8),
(6, 9),
(6, 10),
(6, 12),
(6, 13),
(7, 10),
(7, 13),
(8, 1),
(8, 2),
(8, 3),
(8, 4),
(8, 5),
(8, 6),
(8, 7),
(8, 8),
(8, 9),
(8, 12),
(8, 13),
(9, 1),
(9, 2),
(9, 3),
(9, 4),
(9, 5),
(9, 6),
(9, 7),
(9, 8),
(9, 9),
(9, 10),
(9, 11),
(9, 12),
(9, 13);
-- --------------------------------------------------------
--
-- Structure de la table `recherche_type_relation`
--
CREATE TABLE `recherche_type_relation` (
`recherche_id` int(11) NOT NULL,
`type_relation_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `recherche_type_relation`
--
INSERT INTO `recherche_type_relation` (`recherche_id`, `type_relation_id`) VALUES
(1, 1),
(1, 2),
(1, 3),
(1, 4),
(1, 5),
(1, 6),
(2, 2),
(2, 6),
(3, 2),
(3, 3),
(3, 5),
(4, 1),
(4, 2),
(4, 3),
(4, 4),
(4, 5),
(4, 6),
(5, 1),
(5, 2),
(5, 3),
(5, 4),
(5, 5),
(5, 6),
(6, 3),
(6, 4),
(6, 5),
(6, 6),
(7, 1),
(7, 2),
(7, 3),
(7, 4),
(7, 5),
(7, 6),
(8, 1),
(8, 2),
(8, 4),
(8, 5),
(8, 6),
(9, 2),
(10, 1);
-- --------------------------------------------------------
--
-- Structure de la table `recherche_type_ressource`
--
CREATE TABLE `recherche_type_ressource` (
`recherche_id` int(11) NOT NULL,
`type_ressource_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `recherche_type_ressource`
--
INSERT INTO `recherche_type_ressource` (`recherche_id`, `type_ressource_id`) VALUES
(1, 4),
(1, 7),
(1, 8),
(2, 1),
(2, 3),
(2, 5),
(2, 7),
(2, 8),
(4, 1),
(4, 3),
(4, 7),
(5, 1),
(5, 2),
(5, 4),
(5, 5),
(5, 6),
(5, 7),
(5, 8),
(7, 1),
(7, 3),
(7, 4),
(7, 6),
(7, 7),
(7, 8),
(8, 1),
(8, 2),
(8, 4),
(8, 5),
(8, 6),
(8, 7),
(8, 8),
(9, 3),
(9, 4),
(9, 5),
(9, 6),
(9, 7),
(9, 8),
(10, 1),
(10, 3),
(10, 4),
(10, 5),
(10, 6),
(10, 7),
(10, 8);
-- --------------------------------------------------------
--
-- Structure de la table `ressource`
--
CREATE TABLE `ressource` (
`id` int(11) NOT NULL,
`categorie_id` int(11) NOT NULL,
`accessibilite_id` int(11) NOT NULL,
`auteur_id` int(11) NOT NULL,
`statut_ressource_id` int(11) NOT NULL,
`type_ressource_id` int(11) NOT NULL,
`titre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lien_serveur` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`date_creation` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `ressource`
--
INSERT INTO `ressource` (`id`, `categorie_id`, `accessibilite_id`, `auteur_id`, `statut_ressource_id`, `type_ressource_id`, `titre`, `lien_serveur`, `date_creation`) VALUES
(1, 1, 2, 2, 2, 4, 'architecto exercitationem est', '0fbf650b9101adfbe6e9ea3568600c5d.png', '2016-03-14 00:00:00'),
(2, 10, 2, 7, 2, 3, 'non reprehenderit sit', 'https://bodin.fr/occaecati-impedit-debitis-quia-quod-pariatur-optio-eos.html', '2016-06-12 00:00:00'),
(3, 3, 2, 4, 3, 8, 'aliquam et laborum', 'https://andre.org/et-consequatur-quibusdam-consequatur.html', '1987-10-14 06:34:28'),
(4, 13, 1, 6, 1, 6, 'laboriosam accusantium autem', 'https://www.legrand.net/tempore-aperiam-voluptas-laudantium-pariatur-perspiciatis-voluptatem', '2006-09-30 01:48:31'),
(5, 11, 2, 9, 4, 4, 'qui cumque quidem', 'http://www.labbe.fr/eum-incidunt-qui-temporibus-eaque-eum.html', '1997-11-28 05:50:02'),
(6, 12, 1, 6, 3, 2, 'dolores aut accusantium', 'https://www.pascal.com/quia-in-minus-error-odio-maxime-sint-dolores-quaerat', '2011-11-30 19:18:06'),
(7, 1, 2, 5, 2, 3, 'consequatur nam soluta', 'https://david.com/dignissimos-sequi-hic-sit-velit-libero-est.html', '1989-09-12 04:32:36'),
(8, 2, 2, 5, 4, 5, 'nam veniam dolore', 'http://www.lopes.fr/officiis-minima-nisi-eos-sunt.html', '1992-07-15 09:46:08'),
(9, 9, 1, 10, 2, 8, 'fugit veniam ea', 'https://www.fischer.fr/tempora-at-est-fuga-illum-tempora-et', '2013-11-01 06:41:33'),
(10, 6, 1, 10, 1, 7, 'quo voluptas sunt', 'http://www.guerin.fr/', '1990-03-06 16:03:24'),
(11, 12, 1, 2, 2, 4, 'qui repellendus rerum', 'http://barre.com/esse-unde-nulla-at-ut-cumque-pariatur.html', '2013-08-23 10:46:40'),
(12, 1, 1, 1, 2, 5, 'fugiat dolores architecto', 'https://boulay.com/aliquid-enim-ullam-ut-et.html', '1979-03-26 07:53:04'),
(13, 8, 2, 4, 2, 8, 'cumque deserunt sunt', 'https://wagner.net/non-placeat-dolorem-accusamus-harum-dolores-voluptatem.html', '2011-09-13 23:31:50'),
(14, 7, 1, 7, 1, 4, 'repellat est atque', 'http://www.rocher.com/ab-reiciendis-voluptatibus-deserunt-commodi-dolorem', '2010-05-10 04:34:42'),
(15, 11, 1, 6, 3, 8, 'soluta ex voluptatem', 'http://www.legros.com/dolore-quia-assumenda-autem-et-dolor-sequi-inventore', '2000-10-31 09:07:40'),
(16, 11, 1, 6, 2, 7, 'et nemo omnis', 'http://marin.fr/nesciunt-sint-in-cumque-modi-dolor-quia.html', '2000-01-28 02:39:54'),
(17, 13, 1, 3, 2, 2, 'esse et in', 'http://www.legall.org/et-in-voluptatum-quia-et-et-dolorum-blanditiis', '1998-11-24 16:35:57'),
(18, 7, 1, 4, 2, 2, 'aliquid architecto rerum', 'http://www.richard.net/labore-sapiente-mollitia-autem-voluptatum-sed-nobis-quia.html', '2009-01-16 05:18:45'),
(19, 1, 2, 10, 3, 5, 'vero eligendi voluptatum', 'https://diallo.com/sit-qui-ullam-tempora-nam-cupiditate-eum-et.html', '1981-02-04 19:43:43'),
(20, 7, 2, 1, 4, 6, 'dolorum at culpa', 'http://www.bonnet.org/', '1990-01-31 03:33:49'),
(21, 9, 1, 6, 1, 8, 'ut modi tempora', 'http://monnier.net/totam-quisquam-enim-deserunt-quasi-quia', '1974-05-14 07:40:31'),
(22, 9, 2, 5, 1, 3, 'libero quia eos', 'http://berger.fr/quasi-at-accusantium-impedit-repellat-ad-et-quidem', '1977-04-17 11:49:59'),
(23, 2, 1, 8, 4, 8, 'necessitatibus consequatur labore', 'http://www.dufour.com/recusandae-et-repellat-placeat-repellat-repudiandae-odio-voluptas-quas', '1984-04-14 18:29:31'),
(24, 6, 1, 4, 4, 4, 'culpa ut aut', 'http://www.roussel.fr/maxime-tempore-maxime-facere-quisquam-dolores.html', '1978-06-13 23:52:25'),
(25, 4, 2, 4, 1, 4, 'delectus qui eum', 'http://www.caron.com/', '1975-02-16 00:15:32'),
(26, 1, 1, 5, 1, 6, 'vero est in', 'http://www.traore.com/consequatur-molestiae-nesciunt-quos-voluptatem', '1971-03-20 23:07:31'),
(27, 6, 1, 8, 1, 1, 'ipsa pariatur recusandae', 'https://www.jacques.fr/facilis-adipisci-quia-veritatis-quidem', '1976-11-20 05:02:05'),
(28, 7, 2, 9, 3, 3, 'modi a quia', 'http://lelievre.fr/dolorem-numquam-tempore-cumque-ex-quis-inventore-consequuntur.html', '1992-07-24 11:37:34'),
(29, 4, 1, 8, 2, 6, 'et cupiditate et', 'https://www.leblanc.com/repudiandae-nobis-harum-impedit-magnam', '1970-08-01 15:37:14'),
(30, 9, 2, 8, 4, 3, 'tempore aut vel', 'http://www.julien.fr/a-fuga-earum-id-nisi-eveniet-sapiente.html', '1971-02-01 19:48:57'),
(31, 9, 2, 8, 2, 6, 'facilis animi placeat', 'http://devaux.com/qui-sit-quas-doloremque-aut-eum-in-molestiae', '1980-10-27 14:35:17'),
(32, 13, 1, 4, 2, 2, 'et beatae sed', 'http://joseph.fr/voluptas-dolorem-officia-sit-culpa-voluptatem', '1998-01-10 10:24:49'),
(33, 5, 1, 9, 1, 4, 'exercitationem et ut', 'http://www.voisin.org/', '1977-11-13 02:29:01'),
(34, 6, 1, 8, 4, 5, 'aspernatur sit a', 'http://lamy.net/', '1997-07-27 17:23:20'),
(35, 4, 2, 3, 3, 8, 'ab doloribus exercitationem', 'http://www.gomez.fr/distinctio-molestias-quos-sint-non-iusto-sit-ut', '2017-07-24 16:34:45'),
(36, 1, 1, 5, 3, 8, 'asperiores et quisquam', 'http://www.blondel.fr/fugit-dolor-sint-asperiores-animi-dolorum', '1988-05-17 21:44:53'),
(37, 10, 1, 10, 3, 7, 'mollitia quisquam error', 'http://www.martineau.fr/magnam-maiores-et-rerum-porro-atque.html', '2002-01-03 11:37:13'),
(38, 3, 2, 1, 2, 4, 'vel corrupti quis', 'http://www.hebert.fr/repellendus-consequuntur-et-tenetur-animi-ex', '2018-06-24 17:41:27'),
(39, 11, 1, 5, 4, 7, 'dicta delectus ducimus', 'https://www.robin.com/iusto-quam-magni-ad', '1978-10-28 10:22:40'),
(40, 4, 2, 6, 4, 4, 'laboriosam ducimus maxime', 'http://costa.fr/provident-aspernatur-quidem-ea-quo-tempora-rerum-ipsam-rerum.html', '2019-12-21 23:07:17'),
(41, 12, 2, 2, 3, 4, 'quis voluptatibus quis', 'https://jacques.fr/omnis-quos-repudiandae-maiores-aut-corporis-consectetur-velit.html', '1982-12-05 04:35:16'),
(42, 4, 1, 3, 1, 3, 'officia vel voluptas', 'https://dupuis.fr/excepturi-magnam-corporis-minus-quos.html', '1989-03-06 21:06:55'),
(43, 8, 1, 10, 2, 5, 'maiores et sit', 'http://www.guillon.com/porro-et-nemo-cupiditate-odit-ut', '2001-12-16 20:09:45'),
(44, 5, 1, 8, 1, 1, 'voluptas rem distinctio', 'https://www.bourdon.com/eaque-placeat-molestiae-voluptas', '1975-03-26 16:30:23'),
(45, 1, 2, 6, 4, 7, 'vel sint aut', 'http://www.royer.fr/', '2000-11-02 18:15:27'),
(46, 10, 1, 1, 2, 5, 'voluptas ut explicabo', 'http://renard.fr/autem-repellat-sed-officia-quod-dolorum', '2019-11-04 01:43:48'),
(47, 4, 1, 9, 2, 5, 'est possimus vel', 'https://www.pages.fr/consequatur-natus-optio-maxime-et', '1981-01-07 07:46:50'),
(48, 12, 2, 6, 3, 1, 'ex dolores quisquam', 'https://www.thierry.com/qui-et-dignissimos-molestiae-architecto-veritatis-illo', '2009-09-28 06:13:35'),
(49, 1, 2, 2, 1, 7, 'autem ex libero', 'http://henry.net/consectetur-sapiente-vel-alias-rem-magnam', '1995-12-22 12:15:27'),
(50, 5, 2, 5, 3, 6, 'corporis velit illum', 'https://hardy.fr/eligendi-nemo-molestias-aut-cumque.html', '1986-02-04 21:14:38');
-- --------------------------------------------------------
--
-- Structure de la table `ressource_type_relation`
--
CREATE TABLE `ressource_type_relation` (
`ressource_id` int(11) NOT NULL,
`type_relation_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `ressource_type_relation`
--
INSERT INTO `ressource_type_relation` (`ressource_id`, `type_relation_id`) VALUES
(1, 6),
(2, 4),
(2, 5),
(3, 1),
(4, 6),
(5, 1),
(5, 2),
(5, 3),
(5, 5),
(6, 3),
(7, 4),
(7, 6),
(8, 1),
(8, 2),
(8, 3),
(8, 4),
(8, 5),
(8, 6),
(9, 1),
(9, 2),
(9, 5),
(9, 6),
(10, 1),
(11, 6),
(12, 2),
(13, 1),
(13, 5),
(14, 1),
(14, 6),
(15, 1),
(15, 2),
(15, 4),
(15, 5),
(15, 6),
(16, 4),
(16, 6),
(17, 1),
(17, 2),
(17, 3),
(17, 4),
(17, 5),
(17, 6),
(18, 2),
(18, 4),
(18, 5),
(18, 6),
(19, 1),
(19, 2),
(19, 3),
(19, 4),
(19, 6),
(20, 5),
(21, 1),
(21, 2),
(21, 3),
(21, 5),
(21, 6),
(22, 1),
(22, 2),
(22, 4),
(22, 5),
(22, 6),
(23, 2),
(23, 3),
(23, 4),
(23, 5),
(23, 6),
(24, 1),
(24, 2),
(24, 3),
(24, 4),
(24, 5),
(24, 6),
(25, 1),
(25, 2),
(25, 3),
(25, 4),
(25, 5),
(25, 6),
(26, 1),
(26, 4),
(27, 1),
(27, 2),
(27, 3),
(27, 4),
(27, 5),
(27, 6),
(28, 2),
(28, 5),
(28, 6),
(29, 2),
(29, 3),
(29, 4),
(29, 5),
(30, 1),
(30, 4),
(31, 1),
(31, 2),
(31, 3),
(31, 4),
(31, 5),
(32, 2),
(32, 3),
(32, 4),
(32, 6),
(33, 1),
(33, 2),
(33, 4),
(33, 5),
(33, 6),
(34, 2),
(35, 5),
(36, 2),
(36, 5),
(37, 2),
(38, 2),
(38, 3),
(38, 4),
(39, 2),
(39, 3),
(40, 2),
(40, 3),
(40, 6),
(41, 3),
(41, 4),
(42, 1),
(42, 2),
(42, 5),
(42, 6),
(43, 1),
(43, 6),
(44, 1),
(44, 2),
(44, 3),
(44, 5),
(44, 6),
(45, 1),
(45, 4),
(45, 5),
(45, 6),
(46, 2),
(46, 4),
(46, 5),
(46, 6),
(47, 1),
(47, 4),
(47, 6),
(48, 2),
(49, 2),
(49, 4),
(49, 6),
(50, 2),
(50, 3),
(50, 4),
(50, 5),
(50, 6);
-- --------------------------------------------------------
--
-- Structure de la table `role`
--
CREATE TABLE `role` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `role`
--
INSERT INTO `role` (`id`, `libelle`) VALUES
(1, 'Citoyen connecté'),
(2, 'Modérateur'),
(3, 'Administrateur ressource'),
(4, 'Super administrateur'),
(5, 'DEV');
-- --------------------------------------------------------
--
-- Structure de la table `statut_compte`
--
CREATE TABLE `statut_compte` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `statut_compte`
--
INSERT INTO `statut_compte` (`id`, `libelle`) VALUES
(1, 'Actif'),
(2, 'Désactivé');
-- --------------------------------------------------------
--
-- Structure de la table `statut_ressource`
--
CREATE TABLE `statut_ressource` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `statut_ressource`
--
INSERT INTO `statut_ressource` (`id`, `libelle`) VALUES
(1, 'En attente de validation'),
(2, 'Validée'),
(3, 'Suspendue'),
(4, 'Refusée');
-- --------------------------------------------------------
--
-- Structure de la table `type_relation`
--
CREATE TABLE `type_relation` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `type_relation`
--
INSERT INTO `type_relation` (`id`, `libelle`) VALUES
(1, 'Soi'),
(2, 'Conjoints'),
(3, 'Famille : enfants / parents / fratrie'),
(4, 'Professionnelle : collègues / collaborateurs / managers'),
(5, 'Amis et communautés'),
(6, 'Inconnus');
-- --------------------------------------------------------
--
-- Structure de la table `type_ressource`
--
CREATE TABLE `type_ressource` (
`id` int(11) NOT NULL,
`libelle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `type_ressource`
--
INSERT INTO `type_ressource` (`id`, `libelle`) VALUES
(1, 'Activité / Jeu à réaliser'),
(2, 'Article'),
(3, 'Carte défi'),
(4, 'Cours au format PDF'),
(5, 'Exercice / Atelier'),
(6, 'Fiche de lecture'),
(7, 'Jeu en ligne'),
(8, 'Vidéo');
-- --------------------------------------------------------
--
-- Structure de la table `utilisateur`
--
CREATE TABLE `utilisateur` (
`id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
`statut_compte_id` int(11) NOT NULL,
`email` varchar(180) COLLATE utf8mb4_unicode_ci NOT NULL,
`roles` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`roles`)),
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`nom` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`prenom` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`numero_departement` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`pseudo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `utilisateur`
--
INSERT INTO `utilisateur` (`id`, `role_id`, `statut_compte_id`, `email`, `roles`, `password`, `nom`, `prenom`, `numero_departement`, `pseudo`) VALUES
(1, 4, 2, 'fbenoit@sfr.fr', '[\"ROLE_SUPERADMIN\"]', '$2y$13$FXVlOq/oQl5qdEUl14Z5r.UqHoNIlO8MYBsX1/kqb5K7w35SFpjBK', 'Bertrand', 'Leveque', '91', 'lamy.noel'),
(2, 4, 1, 'vincent96@thibault.com', '[\"ROLE_SUPERADMIN\"]', '$2y$13$pYD2DM8ySPv2QlH3.n/d..XNYxd1hc8WUFsUIxrFSawix/j0ugGde', 'Catherine', 'Diallo', '01', 'cousin.gregoire'),
(3, 3, 1, 'dumas.elise@langlois.com', '[\"ROLE_ADMIN\"]', '$2y$13$a4MptxzL883.WDjAD.uV2uTxYGrHY1VA6cysqJDQ5xOEp2E7Knpp2', 'Martine', 'Laurent', '77', 'cecile.guillet'),
(4, 1, 1, 'mlebrun@dasilva.fr', '[\"ROLE_USER\"]', '$2y$13$t0S7bm1.Mf8R.CAReAUy4.SEa.z0f/Gfelcb8J2zqEOUjL/Mx9mj6', 'Corinne', 'Lucas', '93', 'btraore'),
(5, 1, 2, 'zoe09@arnaud.com', '[\"ROLE_USER\"]', '$2y$13$V1wRoA8W/un3oSXytNQeoOoB31Qb5KQZV6JqQ6J761xzgBPPSz7Aa', 'Honoré', 'Joubert', '61', 'yves17'),
(6, 1, 1, 'cit@ex.com', '[\"ROLE_USER\"]', '$2y$13$/.nFwm7zgePRjYtzlzbnOOQxPEmCDMx7d0jzcL23YBqaIW27TH3Xi', 'Guillaume', 'Renaud', '34', 'berger.jacqueline'),
(7, 2, 1, 'mod@ex.com', '[\"ROLE_MODERATEUR\"]', '$2y$13$Jk.Se9HV6nALTjiG3Xi4jOVhOmpaPmUGz7ra5LnbLVirrmEs97iCe', 'Isaac', 'Leblanc', '972', 'fdescamps'),
(8, 3, 1, 'adm@ex.com', '[\"ROLE_ADMIN\"]', '$2y$13$iPAgdsACb5aKFT7prlAk.eqwgEEVS0AcYmLTRjb0CpEh012xxQW4y', 'Valentine', 'Ollivier', '93', 'tristan67'),
(9, 4, 1, 'sup@ex.com', '[\"ROLE_SUPERADMIN\"]', '$2y$13$UUp1idxwI1qUA4r3tDr2O.l/IKCFdnWTCAIC2AsrO/xA2t7VVEzoi', 'Luc', 'Ferrand', '05', 'adam.gregoire'),
(10, 5, 1, 'dev@ex.com', '[\"ROLE_DEV\"]', '$2y$13$jPfdwx13Kf2RJB2VyPhEQOd9bcM76GvrGRp9R/OESbbL.KtLEUg7G', 'Étienne', 'Hamon', '41', 'eugene.langlois'),
(11, 1, 1, 'alp@gmail.com', '[]', '$2y$13$TaIhV3Uyt0ZR3e59FxF8N.YUwltQRQfcUUuyFa9S73pesxHpReVua', 'alp', 'er', '13', 'alp'),
(12, 1, 1, 'user1@gmail.fr', '[]', '$2y$13$wkfWilFJ1/aZ5N58CQNe/eYc94M5si8V9kbI9y94M25ST9Pbh3Q/u', 'user', '1', '13', 'user1');
-- --------------------------------------------------------
--
-- Structure de la table `utilisateur_ressources_de_cote`
--
CREATE TABLE `utilisateur_ressources_de_cote` (
`utilisateur_id` int(11) NOT NULL,
`ressource_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `utilisateur_ressources_de_cote`
--
INSERT INTO `utilisateur_ressources_de_cote` (`utilisateur_id`, `ressource_id`) VALUES
(11, 38);
-- --------------------------------------------------------
--
-- Structure de la table `utilisateur_ressources_favorites`
--
CREATE TABLE `utilisateur_ressources_favorites` (
`utilisateur_id` int(11) NOT NULL,
`ressource_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `accessibilite`
--
ALTER TABLE `accessibilite`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `categorie`
--
ALTER TABLE `categorie`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`idCategories`);
--
-- Index pour la table `commentaire`
--
ALTER TABLE `commentaire`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_67F068BC60BB6FE6` (`auteur_id`),
ADD KEY `IDX_67F068BC3EC718C` (`etat_commentaire_id`),
ADD KEY `IDX_67F068BCFC6CD52A` (`ressource_id`),
ADD KEY `IDX_67F068BCFDED4547` (`commentaire_parent_id`);
--
-- Index pour la table `consultation_exploitation`
--
ALTER TABLE `consultation_exploitation`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_E86D2FD5FB88E14F` (`utilisateur_id`),
ADD KEY `IDX_E86D2FD544AC3583` (`operation_id`),
ADD KEY `IDX_E86D2FD5FC6CD52A` (`ressource_id`);
--
-- Index pour la table `etat_commentaire`
--
ALTER TABLE `etat_commentaire`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `operation`
--
ALTER TABLE `operation`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `recherche`
--
ALTER TABLE `recherche`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_B4271B46FB88E14F` (`utilisateur_id`);
--
-- Index pour la table `recherche_categorie`
--
ALTER TABLE `recherche_categorie`
ADD PRIMARY KEY (`recherche_id`,`categorie_id`),
ADD KEY `IDX_9E59DC9E1E6A4A07` (`recherche_id`),
ADD KEY `IDX_9E59DC9EBCF5E72D` (`categorie_id`);
--
-- Index pour la table `recherche_type_relation`
--
ALTER TABLE `recherche_type_relation`
ADD PRIMARY KEY (`recherche_id`,`type_relation_id`),
ADD KEY `IDX_6968BAD31E6A4A07` (`recherche_id`),
ADD KEY `IDX_6968BAD3794F46CA` (`type_relation_id`);
--
-- Index pour la table `recherche_type_ressource`
--
ALTER TABLE `recherche_type_ressource`
ADD PRIMARY KEY (`recherche_id`,`type_ressource_id`),
ADD KEY `IDX_834EDEE31E6A4A07` (`recherche_id`),
ADD KEY `IDX_834EDEE37B2F6F2F` (`type_ressource_id`);
--
-- Index pour la table `ressource`
--
ALTER TABLE `ressource`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_939F4544BCF5E72D` (`categorie_id`),
ADD KEY `IDX_939F45449521C487` (`accessibilite_id`),
ADD KEY `IDX_939F454460BB6FE6` (`auteur_id`),
ADD KEY `IDX_939F4544531F6715` (`statut_ressource_id`),
ADD KEY `IDX_939F45447B2F6F2F` (`type_ressource_id`);
--
-- Index pour la table `ressource_type_relation`
--
ALTER TABLE `ressource_type_relation`
ADD PRIMARY KEY (`ressource_id`,`type_relation_id`),
ADD KEY `IDX_A62FF0F1FC6CD52A` (`ressource_id`),
ADD KEY `IDX_A62FF0F1794F46CA` (`type_relation_id`);
--
-- Index pour la table `role`
--
ALTER TABLE `role`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `statut_compte`
--
ALTER TABLE `statut_compte`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `statut_ressource`
--
ALTER TABLE `statut_ressource`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `type_relation`
--
ALTER TABLE `type_relation`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `type_ressource`
--
ALTER TABLE `type_ressource`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `utilisateur`
--
ALTER TABLE `utilisateur`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `UNIQ_1D1C63B3E7927C74` (`email`),
ADD UNIQUE KEY `UNIQ_1D1C63B386CC499D` (`pseudo`),
ADD KEY `IDX_1D1C63B3D60322AC` (`role_id`),
ADD KEY `IDX_1D1C63B3536BF3E2` (`statut_compte_id`);
--
-- Index pour la table `utilisateur_ressources_de_cote`
--
ALTER TABLE `utilisateur_ressources_de_cote`
ADD PRIMARY KEY (`utilisateur_id`,`ressource_id`),
ADD KEY `IDX_8E6E694EFB88E14F` (`utilisateur_id`),
ADD KEY `IDX_8E6E694EFC6CD52A` (`ressource_id`);
--
-- Index pour la table `utilisateur_ressources_favorites`
--
ALTER TABLE `utilisateur_ressources_favorites`
ADD PRIMARY KEY (`utilisateur_id`,`ressource_id`),
ADD KEY `IDX_6A7717FCFB88E14F` (`utilisateur_id`),
ADD KEY `IDX_6A7717FCFC6CD52A` (`ressource_id`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `accessibilite`
--
ALTER TABLE `accessibilite`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `categorie`
--
ALTER TABLE `categorie`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT pour la table `categories`
--
ALTER TABLE `categories`
MODIFY `idCategories` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT pour la table `commentaire`
--
ALTER TABLE `commentaire`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT pour la table `consultation_exploitation`
--
ALTER TABLE `consultation_exploitation`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT pour la table `etat_commentaire`
--
ALTER TABLE `etat_commentaire`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `operation`
--
ALTER TABLE `operation`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `recherche`
--
ALTER TABLE `recherche`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT pour la table `ressource`
--
ALTER TABLE `ressource`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51;
--
-- AUTO_INCREMENT pour la table `role`
--
ALTER TABLE `role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT pour la table `statut_compte`
--
ALTER TABLE `statut_compte`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `statut_ressource`
--
ALTER TABLE `statut_ressource`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT pour la table `type_relation`
--
ALTER TABLE `type_relation`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT pour la table `type_ressource`
--
ALTER TABLE `type_ressource`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT pour la table `utilisateur`
--
ALTER TABLE `utilisateur`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `commentaire`
--
ALTER TABLE `commentaire`
ADD CONSTRAINT `FK_67F068BC3EC718C` FOREIGN KEY (`etat_commentaire_id`) REFERENCES `etat_commentaire` (`id`),
ADD CONSTRAINT `FK_67F068BC60BB6FE6` FOREIGN KEY (`auteur_id`) REFERENCES `utilisateur` (`id`),
ADD CONSTRAINT `FK_67F068BCFC6CD52A` FOREIGN KEY (`ressource_id`) REFERENCES `ressource` (`id`),
ADD CONSTRAINT `FK_67F068BCFDED4547` FOREIGN KEY (`commentaire_parent_id`) REFERENCES `commentaire` (`id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `consultation_exploitation`
--
ALTER TABLE `consultation_exploitation`
ADD CONSTRAINT `FK_E86D2FD544AC3583` FOREIGN KEY (`operation_id`) REFERENCES `operation` (`id`),
ADD CONSTRAINT `FK_E86D2FD5FB88E14F` FOREIGN KEY (`utilisateur_id`) REFERENCES `utilisateur` (`id`),
ADD CONSTRAINT `FK_E86D2FD5FC6CD52A` FOREIGN KEY (`ressource_id`) REFERENCES `ressource` (`id`);
--
-- Contraintes pour la table `recherche`
--
ALTER TABLE `recherche`
ADD CONSTRAINT `FK_B4271B46FB88E14F` FOREIGN KEY (`utilisateur_id`) REFERENCES `utilisateur` (`id`);
--
-- Contraintes pour la table `recherche_categorie`
--
ALTER TABLE `recherche_categorie`
ADD CONSTRAINT `FK_9E59DC9E1E6A4A07` FOREIGN KEY (`recherche_id`) REFERENCES `recherche` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_9E59DC9EBCF5E72D` FOREIGN KEY (`categorie_id`) REFERENCES `categorie` (`id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `recherche_type_relation`
--
ALTER TABLE `recherche_type_relation`
ADD CONSTRAINT `FK_6968BAD31E6A4A07` FOREIGN KEY (`recherche_id`) REFERENCES `recherche` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_6968BAD3794F46CA` FOREIGN KEY (`type_relation_id`) REFERENCES `type_relation` (`id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `recherche_type_ressource`
--
ALTER TABLE `recherche_type_ressource`
ADD CONSTRAINT `FK_834EDEE31E6A4A07` FOREIGN KEY (`recherche_id`) REFERENCES `recherche` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_834EDEE37B2F6F2F` FOREIGN KEY (`type_ressource_id`) REFERENCES `type_ressource` (`id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `ressource`
--
ALTER TABLE `ressource`
ADD CONSTRAINT `FK_939F4544531F6715` FOREIGN KEY (`statut_ressource_id`) REFERENCES `statut_ressource` (`id`),
ADD CONSTRAINT `FK_939F454460BB6FE6` FOREIGN KEY (`auteur_id`) REFERENCES `utilisateur` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_939F45447B2F6F2F` FOREIGN KEY (`type_ressource_id`) REFERENCES `type_ressource` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_939F45449521C487` FOREIGN KEY (`accessibilite_id`) REFERENCES `accessibilite` (`id`),
ADD CONSTRAINT `FK_939F4544BCF5E72D` FOREIGN KEY (`categorie_id`) REFERENCES `categorie` (`id`);
--
-- Contraintes pour la table `ressource_type_relation`
--
ALTER TABLE `ressource_type_relation`
ADD CONSTRAINT `FK_A62FF0F1794F46CA` FOREIGN KEY (`type_relation_id`) REFERENCES `type_relation` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_A62FF0F1FC6CD52A` FOREIGN KEY (`ressource_id`) REFERENCES `ressource` (`id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `utilisateur`
--
ALTER TABLE `utilisateur`
ADD CONSTRAINT `FK_1D1C63B3536BF3E2` FOREIGN KEY (`statut_compte_id`) REFERENCES `statut_compte` (`id`),
ADD CONSTRAINT `FK_1D1C63B3D60322AC` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`);
--
-- Contraintes pour la table `utilisateur_ressources_de_cote`
--
ALTER TABLE `utilisateur_ressources_de_cote`
ADD CONSTRAINT `FK_8E6E694EFB88E14F` FOREIGN KEY (`utilisateur_id`) REFERENCES `utilisateur` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_8E6E694EFC6CD52A` FOREIGN KEY (`ressource_id`) REFERENCES `ressource` (`id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `utilisateur_ressources_favorites`
--
ALTER TABLE `utilisateur_ressources_favorites`
ADD CONSTRAINT `FK_6A7717FCFB88E14F` FOREIGN KEY (`utilisateur_id`) REFERENCES `utilisateur` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_6A7717FCFC6CD52A` FOREIGN KEY (`ressource_id`) REFERENCES `ressource` (`id`) ON DELETE CASCADE;
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 */;
|
/*==============================================================*/
/* DBMS name: Sybase SQL Anywhere 12 */
/* Created on: 2020/7/13 20:47:30 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role='FK_ADDRESS_RELATIONS_USERLIST') then
alter table Address
delete foreign key FK_ADDRESS_RELATIONS_USERLIST
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_COUPON_RELATIONS_USERLIST') then
alter table Coupon
delete foreign key FK_COUPON_RELATIONS_USERLIST
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_PRODUCT_RELATIONS_PRODUCT_') then
alter table Product
delete foreign key FK_PRODUCT_RELATIONS_PRODUCT_
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_PRODUCT__RELATIONS_PRODUCT') then
alter table Product_suggestion
delete foreign key FK_PRODUCT__RELATIONS_PRODUCT
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_SYSTEMUS_RELATIONS_SYSTEMUS') then
alter table SystemUser_buy
delete foreign key FK_SYSTEMUS_RELATIONS_SYSTEMUS
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DISTCOUN_RELATIONS_PRODUCT') then
alter table distcount_time
delete foreign key FK_DISTCOUN_RELATIONS_PRODUCT
end if;
drop index if exists Address.Relationship_4_FK;
drop index if exists Address.Address_PK;
drop table if exists Address;
drop index if exists Coupon.Relationship_8_FK;
drop index if exists Coupon.Coupon_PK;
drop table if exists Coupon;
drop index if exists Menu.Menu_PK;
drop table if exists Menu;
drop index if exists Menu_step.Menu_step_PK;
drop table if exists Menu_step;
drop index if exists Order_product.Order_product_PK;
drop table if exists Order_product;
drop index if exists Product.Relationship_1_FK;
drop index if exists Product.Product_PK;
drop table if exists Product;
drop index if exists Product_Evaluation.Product_Evaluation_PK;
drop table if exists Product_Evaluation;
drop index if exists Product_suggestion.Relationship_3_FK;
drop table if exists Product_suggestion;
drop index if exists Product_type.Product_type_PK;
drop table if exists Product_type;
drop index if exists SystemUser.SystemUser_PK;
drop table if exists SystemUser;
drop index if exists SystemUser_buy.Relationship_7_FK;
drop index if exists SystemUser_buy.SystemUser_buy_PK;
drop table if exists SystemUser_buy;
drop index if exists UserList.UserList_PK;
drop table if exists UserList;
drop index if exists distcount_time.Relationship_6_FK;
drop index if exists distcount_time.distcount_time_PK;
drop table if exists distcount_time;
drop index if exists full_distcount.full_distcount_PK;
drop table if exists full_distcount;
/*==============================================================*/
/* Table: Address */
/*==============================================================*/
create table Address
(
Address_id integer not null,
User_id varchar(20) null,
Address_province varchar(25) null,
Address_city varchar(25) null,
Address_area varchar(25) null,
Address_person varchar(25) null,
Address_tel varchar(25) null,
constraint PK_ADDRESS primary key (Address_id)
);
/*==============================================================*/
/* Index: Address_PK */
/*==============================================================*/
create unique index Address_PK on Address (
Address_id ASC
);
/*==============================================================*/
/* Index: Relationship_4_FK */
/*==============================================================*/
create index Relationship_4_FK on Address (
User_id ASC
);
/*==============================================================*/
/* Table: Coupon */
/*==============================================================*/
create table Coupon
(
Coupon_id integer not null,
User_id varchar(20) null,
Coupon_statement varchar(255) null,
Coupon_between float null,
Coupon_sub float null,
Coupon_start_time timestamp null,
Coupon_end_time timestamp null,
Coupon_used_time timestamp null,
constraint PK_COUPON primary key (Coupon_id)
);
/*==============================================================*/
/* Index: Coupon_PK */
/*==============================================================*/
create unique index Coupon_PK on Coupon (
Coupon_id ASC
);
/*==============================================================*/
/* Index: Relationship_8_FK */
/*==============================================================*/
create index Relationship_8_FK on Coupon (
User_id ASC
);
/*==============================================================*/
/* Table: Menu */
/*==============================================================*/
create table Menu
(
Menu_id integer not null,
Menu_name varchar(20) null,
constraint PK_MENU primary key (Menu_id)
);
/*==============================================================*/
/* Index: Menu_PK */
/*==============================================================*/
create unique index Menu_PK on Menu (
Menu_id ASC
);
/*==============================================================*/
/* Table: Menu_step */
/*==============================================================*/
create table Menu_step
(
Menu_step_id integer not null,
Menu_step_menuid integer null,
Menu_step_product varchar(255) null,
Menu_statement varchar(255) null,
constraint PK_MENU_STEP primary key (Menu_step_id)
);
/*==============================================================*/
/* Index: Menu_step_PK */
/*==============================================================*/
create unique index Menu_step_PK on Menu_step (
Menu_step_id ASC
);
/*==============================================================*/
/* Table: Order_product */
/*==============================================================*/
create table Order_product
(
Oder_info_Order_id integer not null,
Order_info_product_id integer null,
Oder_info_User_id varchar(20) null,
Order_info_count integer null,
Order_info_discount_time_id integer null,
Oder_info_begin_price float null,
Oder_info_end_price float null,
Oder_info_coupon_id integer null,
Oder_info_fulldiscount_ID integer null,
Oder_info_plantime timestamp null,
Order_info_finishtime timestamp null,
Oder_info_address_id integer null,
Oder_info_statement varchar(255) null,
Order_info_evatime integer null,
constraint PK_ORDER_PRODUCT primary key (Oder_info_Order_id)
);
/*==============================================================*/
/* Index: Order_product_PK */
/*==============================================================*/
create unique index Order_product_PK on Order_product (
Oder_info_Order_id ASC
);
/*==============================================================*/
/* Table: Product */
/*==============================================================*/
create table Product
(
Product_id integer not null,
Product_type_id integer null,
Product_name varchar(20) null,
Product_price float null,
Product_vip_price float null,
Product_stock integer null,
Product_format varchar(20) null,
Product_statement varchar(255) null,
constraint PK_PRODUCT primary key (Product_id)
);
/*==============================================================*/
/* Index: Product_PK */
/*==============================================================*/
create unique index Product_PK on Product (
Product_id ASC
);
/*==============================================================*/
/* Index: Relationship_1_FK */
/*==============================================================*/
create index Relationship_1_FK on Product (
Product_type_id ASC
);
/*==============================================================*/
/* Table: Product_Evaluation */
/*==============================================================*/
create table Product_Evaluation
(
Product_Evaluation_id integer not null,
Product_Evaluation_user_id varchar(20) null,
Product_Evaluation_product_id integer null,
Product_Evaluation_time timestamp null,
Product_Evaluation_level integer null,
Product_Evaluation_imag varchar(255) null,
constraint PK_PRODUCT_EVALUATION primary key (Product_Evaluation_id)
);
/*==============================================================*/
/* Index: Product_Evaluation_PK */
/*==============================================================*/
create unique index Product_Evaluation_PK on Product_Evaluation (
Product_Evaluation_id ASC
);
/*==============================================================*/
/* Table: Product_suggestion */
/*==============================================================*/
create table Product_suggestion
(
Product_id integer null,
Product_suggestion varchar(255) null
);
/*==============================================================*/
/* Index: Relationship_3_FK */
/*==============================================================*/
create index Relationship_3_FK on Product_suggestion (
Product_id ASC
);
/*==============================================================*/
/* Table: Product_type */
/*==============================================================*/
create table Product_type
(
Product_type_id integer not null,
Product_type_name varchar(50) null,
Product_type_statement varchar(255) null,
constraint PK_PRODUCT_TYPE primary key (Product_type_id)
);
/*==============================================================*/
/* Index: Product_type_PK */
/*==============================================================*/
create unique index Product_type_PK on Product_type (
Product_type_id ASC
);
/*==============================================================*/
/* Table: SystemUser */
/*==============================================================*/
create table SystemUser
(
SystemUser_id varchar(20) not null,
SystemUser_name varchar(20) null,
SystemUser_pwd varchar(50) null,
constraint PK_SYSTEMUSER primary key (SystemUser_id)
);
/*==============================================================*/
/* Index: SystemUser_PK */
/*==============================================================*/
create unique index SystemUser_PK on SystemUser (
SystemUser_id ASC
);
/*==============================================================*/
/* Table: SystemUser_buy */
/*==============================================================*/
create table SystemUser_buy
(
SystemUser_buy_id integer not null,
SystemUser_id varchar(20) null,
SystemUser_buy_product_id integer null,
SystemUser_buy_count integer null,
SystemUser_buy_statement varchar(20) null,
constraint PK_SYSTEMUSER_BUY primary key (SystemUser_buy_id)
);
/*==============================================================*/
/* Index: SystemUser_buy_PK */
/*==============================================================*/
create unique index SystemUser_buy_PK on SystemUser_buy (
SystemUser_buy_id ASC
);
/*==============================================================*/
/* Index: Relationship_7_FK */
/*==============================================================*/
create index Relationship_7_FK on SystemUser_buy (
SystemUser_id ASC
);
/*==============================================================*/
/* Table: UserList */
/*==============================================================*/
create table UserList
(
User_id varchar(20) not null,
User_name varchar(20) null,
User_sex varchar(20) null,
User_pwd varchar(20) null,
User_tel varchar(11) null,
User_email varchar(50) null,
User_city varchar(20) null,
User_reg_time timestamp null,
User_end_time timestamp null,
User_vip integer null,
User_sumpay float null,
constraint PK_USERLIST primary key (User_id)
);
/*==============================================================*/
/* Index: UserList_PK */
/*==============================================================*/
create unique index UserList_PK on UserList (
User_id ASC
);
/*==============================================================*/
/* Table: distcount_time */
/*==============================================================*/
create table distcount_time
(
distcount_time_id integer not null,
Product_id integer null,
distcount_time_price float null,
distcount_time_count integer null,
distcount_time_begin_time timestamp null,
distcount_time_end_time timestamp null,
constraint PK_DISTCOUNT_TIME primary key (distcount_time_id)
);
/*==============================================================*/
/* Index: distcount_time_PK */
/*==============================================================*/
create unique index distcount_time_PK on distcount_time (
distcount_time_id ASC
);
/*==============================================================*/
/* Index: Relationship_6_FK */
/*==============================================================*/
create index Relationship_6_FK on distcount_time (
Product_id ASC
);
/*==============================================================*/
/* Table: full_distcount */
/*==============================================================*/
create table full_distcount
(
full_distcount_id integer not null,
full_distcount_product_id integer null,
full_distcount_between float null,
full_distcount_disctount float null,
full_distcount_begin_time timestamp null,
full_distcount_end_time timestamp null,
full_distcount_STATEMENT varchar(255) null,
constraint PK_FULL_DISTCOUNT primary key (full_distcount_id)
);
/*==============================================================*/
/* Index: full_distcount_PK */
/*==============================================================*/
create unique index full_distcount_PK on full_distcount (
full_distcount_id ASC
);
alter table Address
add constraint FK_ADDRESS_RELATIONS_USERLIST foreign key (User_id)
references UserList (User_id)
on update restrict
on delete restrict;
alter table Coupon
add constraint FK_COUPON_RELATIONS_USERLIST foreign key (User_id)
references UserList (User_id)
on update restrict
on delete restrict;
alter table Product
add constraint FK_PRODUCT_RELATIONS_PRODUCT_ foreign key (Product_type_id)
references Product_type (Product_type_id)
on update restrict
on delete restrict;
alter table Product_suggestion
add constraint FK_PRODUCT__RELATIONS_PRODUCT foreign key (Product_id)
references Product (Product_id)
on update restrict
on delete restrict;
alter table SystemUser_buy
add constraint FK_SYSTEMUS_RELATIONS_SYSTEMUS foreign key (SystemUser_id)
references SystemUser (SystemUser_id)
on update restrict
on delete restrict;
alter table distcount_time
add constraint FK_DISTCOUN_RELATIONS_PRODUCT foreign key (Product_id)
references Product (Product_id)
on update restrict
on delete restrict;
|
-- Deletar o processo da lista de histórico
DELETE HP.* FROM `tb_historico_processo` HP
INNER JOIN `tb_cad_protocolo` CP ON (`CP`.`id_cad_protocolo` = HP.`id_cad_protocolo`)
WHERE
CP.NUM_PROCESSO = '9243900/2004';
DELETE CP.* FROM `tb_cad_protocolo` CP
WHERE
CP.NUM_PROCESSO = '9243900/2004'; |
script card.js
set sqlformat card
select * from hr.employees;
|
-- Mangler mange felter i "Observation"
CREATE TABLE Observation
(
id uniqueidentifier NOT NULL PRIMARY KEY,
[status] nvarchar(255) NOT NULL,
code_CodeableConcept uniqueidentifier NOT NULL FOREIGN KEY REFERENCES CodeableConcept(id),
subject_Reference uniqueidentifier FOREIGN KEY REFERENCES Reference(id)
-- category
-- focus
-- performer
-- referenceRange
-- Mangler feltene:
-- basedOn: Reference[0..*]
-- partOf: Reference[0..*]
-- encounter: Reference[0..1]
-- effective[x]: Type[0..1]
-- issued: instant[0..1]
-- value[x]: Type[0..1]
-- dataAbsentReason: CodeableConcept[0..1]
-- interpretation: CodeableConcept[0..*]
-- note: Annotation[0..*]
-- bodySite: CodeableConcept[0..1]
-- method: CodeableConcept[0..1]
-- specimen: Reference[0..1]
-- device: Reference[0..1]
-- hasMember: Reference[0..*]
-- derivedFrom: Reference[0..*]
);
CREATE TABLE ObservationCategory
(
id_Observation uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Observation(id),
id_CodeableConcept uniqueidentifier NOT NULL FOREIGN KEY REFERENCES CodeableConcept(id),
CONSTRAINT PK_ObservationCategory PRIMARY KEY (id_Observation, id_CodeableConcept)
);
CREATE TABLE ObservationFocus
(
id_Observation uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Observation(id),
id_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id),
CONSTRAINT PK_ObservationFocus PRIMARY KEY (id_Observation, id_Reference)
);
CREATE TABLE ObservationPerformer
(
id_Observation uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Observation(id),
id_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id),
CONSTRAINT PK_ObservationPerformer PRIMARY KEY (id_Observation, id_Reference)
);
-- Hjelpetabeller og tilhørende referanser
CREATE TABLE ObservationComponent_HT
(
id uniqueidentifier NOT NULL PRIMARY KEY,
code_CodeableConcept uniqueidentifier NOT NULL FOREIGN KEY REFERENCES CodeableConcept(id),
-- value: Type[0..1]
dataAbsentReason_CodeableConcept uniqueidentifier NOT NULL FOREIGN KEY REFERENCES CodeableConcept(id),
);
CREATE TABLE ObservationComponent_HTInterpretation
(
id_ObservationComponent_HT uniqueidentifier NOT NULL FOREIGN KEY REFERENCES ObservationComponent_HT(id),
id_CodeableConcept uniqueidentifier NOT NULL FOREIGN KEY REFERENCES CodeableConcept(id),
CONSTRAINT PK_ObservationComponent_HTInterpretation PRIMARY KEY (id_CodeableConcept, id_ObservationComponent_HT)
);
CREATE TABLE ObservationComponent
(
id_Observation uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Observation(id),
id_ObservationComponent_HT uniqueidentifier NOT NULL FOREIGN KEY REFERENCES ObservationComponent_HT(id),
CONSTRAINT PK_ObservationComponent PRIMARY KEY (id_Observation, id_ObservationComponent_HT)
);
CREATE TABLE ObservationReferenceRange_HT
(
id uniqueidentifier NOT NULL PRIMARY KEY,
low_Quantity uniqueidentifier FOREIGN KEY REFERENCES Quantity(id),
high_Quantity uniqueidentifier FOREIGN KEY REFERENCES Quantity(id),
type_CodeableConcept uniqueidentifier FOREIGN KEY REFERENCES CodeableConcept(id),
age_low_Quantity uniqueidentifier FOREIGN KEY REFERENCES Quantity(id),
age_high_Quantity uniqueidentifier FOREIGN KEY REFERENCES Quantity(id),
[text] nvarchar(255)
);
CREATE TABLE ObservationReferenceRange_HTAppliesTo
(
id_ObservationReferenceRange_HT uniqueidentifier NOT NULL FOREIGN KEY REFERENCES ObservationReferenceRange_HT(id),
id_CodeableConcept uniqueidentifier NOT NULL FOREIGN KEY REFERENCES CodeableConcept(id),
CONSTRAINT PK_ObservationReferenceRange_HTAppliesTo PRIMARY KEY (id_ObservationReferenceRange_HT, id_CodeableConcept)
);
CREATE TABLE ObservationReferenceRange
(
id_Observation uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Observation(id),
id_ObservationReferenceRange_HT uniqueidentifier NOT NULL FOREIGN KEY REFERENCES ObservationReferenceRange_HT(id),
CONSTRAINT PK_ObservationReferenceRange PRIMARY KEY (id_Observation, id_ObservationReferenceRange_HT)
);
CREATE TABLE ObservationComponent_HTReferenceRange
(
id_ObservationComponent_HT uniqueidentifier NOT NULL FOREIGN KEY REFERENCES ObservationComponent_HT(id),
id_ObservationReferenceRange_HT uniqueidentifier NOT NULL FOREIGN KEY REFERENCES ObservationReferenceRange_HT(id),
CONSTRAINT PK_ObservationComponent_HTReferenceRange PRIMARY KEY (id_ObservationComponent_HT, id_ObservationReferenceRange_HT)
);
|
-- phpMyAdmin SQL Dump
-- version 4.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 10, 2017 at 04:58 AM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 7.0.9
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: `larabook_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `buku`
--
CREATE TABLE `buku` (
`id_buku` int(11) NOT NULL,
`judul` varchar(225) NOT NULL,
`noisbn` varchar(225) NOT NULL,
`penulis` varchar(225) NOT NULL,
`penerbit` varchar(225) NOT NULL,
`tahun` year(4) NOT NULL,
`stok` varchar(3) NOT NULL,
`harga_pokok` varchar(225) NOT NULL,
`harga_jual` varchar(225) NOT NULL,
`ppn` varchar(225) NOT NULL,
`diskon` varchar(225) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `buku`
--
INSERT INTO `buku` (`id_buku`, `judul`, `noisbn`, `penulis`, `penerbit`, `tahun`, `stok`, `harga_pokok`, `harga_jual`, `ppn`, `diskon`) VALUES
(1, 'Bikin Framework PHP', '978-602-6231-00-0', 'DAVID NAIESTA', 'Lokomedia', 2013, '10', '50000', '60000', '0.5', '10%'),
(2, 'Jago Wordpress', '978-602-02-5185-1', 'Andy Krisianto', 'KOMPUTINDO', 2012, '5', '30000', '37000', '0.5', '0'),
(3, 'LOLOS SBMPTN', '231-424-3435-23-2', 'Haris Munandar', 'Hello Pelajar', 2017, '3', '120000', '150000', '0', '50%'),
(4, 'Kamus Saku Jepang', '231-231-2241-23-3', 'Toni Rahmat', 'Jaya Baya', 2016, '10', '35000', '55000', '0.5', '25%');
-- --------------------------------------------------------
--
-- Table structure for table `distributor`
--
CREATE TABLE `distributor` (
`id_distributor` int(11) NOT NULL,
`nama_distributor` varchar(225) NOT NULL,
`alamat` varchar(225) NOT NULL,
`telepon` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `kasir`
--
CREATE TABLE `kasir` (
`id_kasir` int(11) NOT NULL,
`nama` varchar(225) NOT NULL,
`alamat` varchar(225) NOT NULL,
`telepon` varchar(20) NOT NULL,
`status` varchar(225) NOT NULL,
`username` varchar(225) NOT NULL,
`password` varchar(225) NOT NULL,
`akses` enum('1','2') NOT NULL DEFAULT '2' COMMENT '1=admin, 2=petugas'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `kasir`
--
INSERT INTO `kasir` (`id_kasir`, `nama`, `alamat`, `telepon`, `status`, `username`, `password`, `akses`) VALUES
(1, 'Toni Budiman', 'JL.Arif Rahman Hakim No. 45', '0823-1633-9402', 'Pemilik Toko', 'admin', '21232f297a57a5a743894a0e4a801fc3', '1');
-- --------------------------------------------------------
--
-- Table structure for table `pasok`
--
CREATE TABLE `pasok` (
`id_pasok` int(11) NOT NULL,
`id_distributor` int(11) NOT NULL,
`id_buku` int(11) NOT NULL,
`jumlah` varchar(12) NOT NULL,
`tanggal` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `penjualan`
--
CREATE TABLE `penjualan` (
`id_penjualan` int(11) NOT NULL,
`id_buku` int(11) NOT NULL,
`id_kasir` int(11) NOT NULL,
`jumlah` varchar(225) NOT NULL,
`total` varchar(225) NOT NULL,
`tanggal` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `buku`
--
ALTER TABLE `buku`
ADD PRIMARY KEY (`id_buku`);
--
-- Indexes for table `distributor`
--
ALTER TABLE `distributor`
ADD PRIMARY KEY (`id_distributor`);
--
-- Indexes for table `kasir`
--
ALTER TABLE `kasir`
ADD PRIMARY KEY (`id_kasir`);
--
-- Indexes for table `pasok`
--
ALTER TABLE `pasok`
ADD PRIMARY KEY (`id_pasok`);
--
-- Indexes for table `penjualan`
--
ALTER TABLE `penjualan`
ADD PRIMARY KEY (`id_buku`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `buku`
--
ALTER TABLE `buku`
MODIFY `id_buku` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `distributor`
--
ALTER TABLE `distributor`
MODIFY `id_distributor` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `kasir`
--
ALTER TABLE `kasir`
MODIFY `id_kasir` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `pasok`
--
ALTER TABLE `pasok`
MODIFY `id_pasok` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `penjualan`
--
ALTER TABLE `penjualan`
MODIFY `id_buku` int(11) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
Create procedure sp_get_GRNItems_RecdInvoice_MUOM(@GRN_ID int)
as
select Batch_Products.Product_Code as "Code", Items.ProductName as "Name",
Batch_Products.UOMQty as "Qty",
Case IsNull(Batch_Products.Free, 0) When 1 Then 0 Else IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, 0, 0, 0, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 0, 0, Batch_Products.UOM),Batch_Products.UOMPrice) End as "Price",
0 as "BatchCode", Batch_Products.Batch_Number as "Batch",
Batch_Products.Expiry as "Expiry",
Case Batch_Products.Free When 1 Then 0 Else Items.PTS End as "PTS",
Case Batch_Products.Free When 1 Then 0 Else Items.PTR End as "PTR",
Case Batch_Products.Free When 1 Then 0 Else Items.ECP End as "ECP",
Case IsNull(Batch_Products.Free, 0) When 1 Then 0 Else IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, 0, 0, 0, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 1, IsNull(Vendors.Locality, 1), Batch_Products.UOM ),
Case IsNull(Vendors.Locality, 1)
When 1 then
Tax.Percentage
Else
ISNULL(Tax.CST_Percentage, 0)
End) End as "Tax Suffered",
Batch_Products.PKD as "Packaging Date", Batch_Products.Free as "Free",
Case Batch_Products.Free When 1 Then 0 Else Items.Company_Price End as "Special Price",
-- IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
-- Batch_Products.Product_Code, 0, Batch_Products.PTS, Batch_Products.PTR,
-- Batch_Products.ECP, Batch_Products.Batch_Number,
-- Batch_Products.Expiry, Batch_Products.PKD, 2, IsNull(Vendors.Locality, 1), Batch_Products.UOM),
-- 0) as "Item Discount%",
(Case When
IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, Batch_Products.PTS, Batch_Products.PTR,
Batch_Products.ECP, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 2, IsNull(Vendors.Locality, 1), Batch_Products.UOM), 0) = 0
Then
(Case when isNull(Free,0)=1 then 0
Else
(Select Max(IsNull(DiscountPercentage,0)) From InvoiceDetailReceived Where Product_Code = Batch_Products.Product_Code And
InvoiceId = GRNAbstract.RecdInvoiceid)
end
)
-- (Select IsNull(DiscountValue,0) From InvoiceDetailReceived Where Product_Code = Batch_Products.Product_Code And
-- InvoiceId = GRNAbstract.RecdInvoiceid)
Else
IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, Batch_Products.PTS, Batch_Products.PTR,
Batch_Products.ECP, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 2, IsNull(Vendors.Locality, 1), Batch_Products.UOM),
0)End) As "Item Discount%",
dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, 0, 0, 0, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 1, IsNull(Vendors.Locality, 1), Batch_Products.UOM) as "TaxPercentage",
UOM.Description as "UOM", Batch_Products.UOM as "UOMID",
------ THIS FIELD IS USED FOR SORTING GRNITEMS IN THE BILL DO NOT USE FOR ANY OTHER PURPOSE-
Batch_Products.Batch_Code,batch_products.grntaxid
--------------------------------------------------------------------------------------------
from Items
inner join ItemCategories on Items.CategoryID = ItemCategories.CategoryID
inner join Batch_Products on Batch_Products.Product_Code = Items.Product_Code
inner join GRNAbstract on GRNAbstract.GRNID = @GRN_ID
inner join Vendors on GRNAbstract.VendorID = Vendors.VendorID
left outer join Tax on Items.TaxSuffered = Tax.Tax_Code
left outer join UOM on Batch_Products.UOM = UOM.UOM
where
ItemCategories.Price_Option = 0 and
Batch_Products.GRN_ID = @GRN_ID and
Batch_Products.QuantityReceived > 0 and
Batch_Products.UOMQty > 0
UNION ALL
select Batch_Products.Product_Code as "Code",
Items.ProductName as "Name",
Batch_Products.UOMQty as "Qty",
Case IsNull(Batch_Products.Free, 0) When 1 Then 0 Else IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 1, Batch_Products.PTS, Batch_Products.PTR, Batch_Products.ECP,
Batch_Products.Batch_Number, Batch_Products.Expiry, Batch_Products.PKD, 0, 0, Batch_Products.UOM),
Batch_Products.UOMPrice)End as "Price",
Batch_Products.Batch_Code as "BatchCode", Batch_Products.Batch_Number as "Batch",
Batch_Products.Expiry as "Expiry",
Case Batch_Products.Free When 1 Then 0 Else Batch_Products.PTS End as "PTS",
Case Batch_Products.Free When 1 Then 0 Else Batch_Products.PTR End as "PTR",
Case Batch_Products.Free When 1 Then 0 Else Batch_Products.ECP End as "ECP",
Case IsNull(Batch_Products.Free, 0) When 1 Then 0 Else IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, Batch_Products.PTS, Batch_Products.PTR,
Batch_Products.ECP, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 1, IsNull(Vendors.Locality, 1), Batch_Products.UOM),
Case IsNull(Vendors.Locality, 1)
When 1 then
Tax.Percentage
Else
ISNULL(Tax.CST_Percentage, 0)
End) End as "Tax Suffered",
Batch_Products.PKD as "Packaging Date", Batch_Products.Free as "Free",
Case Batch_Products.Free When 1 Then 0 Else Batch_Products.Company_Price End as "Special Price",
-- IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
-- Batch_Products.Product_Code, 0, Batch_Products.PTS, Batch_Products.PTR,
-- Batch_Products.ECP, Batch_Products.Batch_Number,
-- Batch_Products.Expiry, Batch_Products.PKD, 2, IsNull(Vendors.Locality, 1), Batch_Products.UOM),
-- 0) as "Item Discount%",
(Case When
IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, Batch_Products.PTS, Batch_Products.PTR,
Batch_Products.ECP, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 2, IsNull(Vendors.Locality, 1), Batch_Products.UOM), 0) = 0
Then
(
Case when IsNull(Free,0)=1 then 0
Else
(Select max(IsNull(DiscountPercentage,0)) From InvoiceDetailReceived Where Product_Code = Batch_Products.Product_Code And
InvoiceId = GRNAbstract.RecdInvoiceid)
end
)
Else
IsNull(dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, Batch_Products.PTS, Batch_Products.PTR,
Batch_Products.ECP, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 2, IsNull(Vendors.Locality, 1), Batch_Products.UOM),
0)End) As "Item Discount%",
dbo.sp_get_recd_invoice_batchdetails_MUOM(GRNAbstract.RecdInvoiceID,
Batch_Products.Product_Code, 0, 0, 0, 0, Batch_Products.Batch_Number,
Batch_Products.Expiry, Batch_Products.PKD, 1, IsNull(Vendors.Locality, 1), Batch_Products.UOM) as "TaxPercentage",
UOM.Description as "UOM", Batch_Products.UOM as "UOMID",
------ THIS FIELD IS USED FOR SORTING GRNITEMS IN THE BILL DO NOT USE FOR ANY OTHER PURPOSE-
Batch_Products.Batch_Code,batch_products.grntaxid
--------------------------------------------------------------------------------------------
from Batch_Products
inner join Items on Batch_Products.Product_Code = Items.Product_Code
inner join ItemCategories on Items.CategoryID = ItemCategories.CategoryID
left outer join Tax on Items.TaxSuffered = Tax.Tax_Code
inner join GRNAbstract on GRNAbstract.GRNID = @GRN_ID
inner join Vendors on GRNAbstract.VendorID = Vendors.VendorID
left outer join UOM on Batch_Products.UOM = UOM.UOM
--,
--InvoiceDetailReceived IDR
where Batch_Products.GRN_ID = @GRN_ID and
-- IDR.Product_Code = Batch_Products.Product_Code And
-- IDR.InvoiceId = GRNAbstract.RecdInvoiceid and
Batch_Products.Product_Code In (Select Product_Code From InvoiceDetailReceived) And
GRNAbstract.RecdInvoiceid In (Select InvoiceId From InvoiceDetailReceived) And
ItemCategories.Price_Option = 1 and
Batch_Products.QuantityReceived > 0 and
Batch_Products.UOMQty > 0
Order By Batch_Products.Batch_Code
|
CREATE SEQUENCE IF NOT EXISTS "WithNan_id_seq";
CREATE TABLE "public"."WithNan" (
"id" int4 NOT NULL DEFAULT nextval('"WithNan_id_seq"'::regclass),
"num" float8 NOT NULL,
PRIMARY KEY ("id")
);
INSERT INTO "public"."WithNan" ("id", "num") VALUES
('1', '1'),
('2', 'NaN');
|
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: May 16, 2019 at 06:44 PM
-- Server version: 10.1.34-MariaDB
-- 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 */;
--
-- Database: `restaurant`
--
-- --------------------------------------------------------
--
-- Table structure for table `dishes`
--
CREATE TABLE `dishes` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`price` int(11) NOT NULL,
`enabled` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `dishes`
--
INSERT INTO `dishes` (`id`, `name`, `price`, `enabled`) VALUES
(1, 'Beef Curry', 2000, 1),
(2, 'Chicken Curry', 2500, 1),
(3, 'Pork Curry', 3000, 1);
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE `orders` (
`id` int(11) NOT NULL,
`table_id` int(11) NOT NULL,
`dish_id` int(11) NOT NULL,
`price` int(11) NOT NULL,
`count` int(11) NOT NULL,
`enabled` tinyint(1) NOT NULL DEFAULT '1',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `orders`
--
INSERT INTO `orders` (`id`, `table_id`, `dish_id`, `price`, `count`, `enabled`, `created_at`) VALUES
(1, 2, 1, 2000, 3, 1, '2019-05-16 10:28:33'),
(2, 2, 2, 2000, 2, 1, '2019-05-16 10:28:33'),
(3, 1, 2, 2000, 2, 1, '2019-05-16 10:28:33'),
(4, 1, 2, 2000, 5, 1, '2019-05-14 17:30:00');
-- --------------------------------------------------------
--
-- Table structure for table `tables`
--
CREATE TABLE `tables` (
`id` int(11) NOT NULL,
`enabled` tinyint(1) NOT NULL,
`charge` int(11) NOT NULL,
`chairs` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `tables`
--
INSERT INTO `tables` (`id`, `enabled`, `charge`, `chairs`) VALUES
(1, 1, 100, 4),
(2, 1, 2000, 6),
(3, 0, 3000, 8);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`enabled` tinyint(1) NOT NULL,
`role` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `enabled`, `role`) VALUES
(1, 'aa', '123', 1, 2);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `dishes`
--
ALTER TABLE `dishes`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tables`
--
ALTER TABLE `tables`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `dishes`
--
ALTER TABLE `dishes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tables`
--
ALTER TABLE `tables`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: May 14, 2018 at 05:44 PM
-- Server version: 5.6.38
-- PHP Version: 7.2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `artworkio`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`id` int(11) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(0, 'meto', 'meto'),
(1, 'admin', 'admin');
-- --------------------------------------------------------
--
-- Table structure for table `art`
--
CREATE TABLE `art` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`artistid` int(11) DEFAULT NULL,
`typeid` int(11) DEFAULT NULL,
`create_atid` int(11) DEFAULT NULL,
`show_atid` int(11) DEFAULT NULL,
`category_id` int(11) DEFAULT NULL,
`imagePath` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `art`
--
INSERT INTO `art` (`id`, `name`, `artistid`, `typeid`, `create_atid`, `show_atid`, `category_id`, `imagePath`) VALUES
(1, '', 1, 1, 1, 1, 2, 'images/r1.jpg'),
(2, '', 2, 2, 2, 2, 3, 'images/r2.jpg'),
(3, '', 3, 2, 3, 3, 1, 'images/r3.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `artist`
--
CREATE TABLE `artist` (
`id` int(11) NOT NULL,
`first_name` varchar(40) DEFAULT NULL,
`surname` varchar(40) DEFAULT NULL,
`birthday` date DEFAULT NULL,
`nation` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `artist`
--
INSERT INTO `artist` (`id`, `first_name`, `surname`, `birthday`, `nation`) VALUES
(1, 'J. C.', ' Dahl', '1788-02-24', 'Norvec'),
(2, 'Salvador', ' Dali', '1904-01-23', 'Ispanya'),
(3, 'Michelangelo', ' ', '1483-01-01', 'Italya');
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE `category` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `category`
--
INSERT INTO `category` (`id`, `name`) VALUES
(1, 'Heykel'),
(2, 'Resim'),
(3, 'Seramik'),
(5, 'metin');
-- --------------------------------------------------------
--
-- Table structure for table `create_at`
--
CREATE TABLE `create_at` (
`id` int(11) NOT NULL,
`create_date` decimal(2,0) DEFAULT NULL,
`create_month` decimal(2,0) DEFAULT NULL,
`create_year` decimal(4,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `create_at`
--
INSERT INTO `create_at` (`id`, `create_date`, `create_month`, `create_year`) VALUES
(1, '1', '1', '1826'),
(2, '1', '1', '1931'),
(3, '1', '1', '1501'),
(4, '5', '3', '1995'),
(5, '3', '5', '1995');
-- --------------------------------------------------------
--
-- Table structure for table `score`
--
CREATE TABLE `score` (
`id` int(11) NOT NULL,
`scores` float DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`art_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `score`
--
INSERT INTO `score` (`id`, `scores`, `user_id`, `art_id`) VALUES
(103, 0, 9, 1),
(104, 0, 9, 2),
(105, 0, 9, 3),
(106, 3, 10, 1),
(107, 1, 10, 2),
(108, 3, 10, 3),
(109, 4, 11, 1),
(110, 2, 11, 2),
(111, 5, 11, 3);
-- --------------------------------------------------------
--
-- Table structure for table `show_at`
--
CREATE TABLE `show_at` (
`id` int(11) NOT NULL,
`name` varchar(40) DEFAULT NULL,
`nation` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `show_at`
--
INSERT INTO `show_at` (`id`, `name`, `nation`) VALUES
(1, 'Frankfurt am Main', 'Almanya'),
(2, 'Barcelona Museum Of Dali', 'Ispanya'),
(3, 'Palazzo Vecchio', 'Italya'),
(4, 'mememem', 'osman');
-- --------------------------------------------------------
--
-- Table structure for table `type`
--
CREATE TABLE `type` (
`id` int(11) NOT NULL,
`title` varchar(80) DEFAULT NULL,
`start_year` decimal(4,0) DEFAULT NULL,
`end_year` decimal(4,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `type`
--
INSERT INTO `type` (`id`, `title`, `start_year`, `end_year`) VALUES
(1, 'romantizm', '1810', '1850'),
(2, 'naturalizm', '1890', '1923'),
(3, 'realizm', '1830', '1870'),
(4, 'empresyonizm', '1877', '1950'),
(5, 'postempresyonizm', '1839', '1906'),
(7, 'meememememem', '1995', '2018'),
(8, 'metin', '2018', '2018');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`first_name` varchar(40) DEFAULT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`trn_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `first_name`, `email`, `password`, `trn_date`) VALUES
(1, 'okyanus', '', 'okyanus', '0000-00-00 00:00:00'),
(2, 'oki', 'oki@a', 'e210b2d4726eb89e951f1952be84c02f', '2018-05-12 14:29:31'),
(3, 'ali', 'ali@we', '86318e52f5ed4801abe1d13d509443de', '2018-05-12 15:15:41'),
(4, 'tutu', 'tutu@i', 'bdb8c008fa551ba75f8481963f2201da', '2018-05-12 18:10:49'),
(5, 'yuki', 'yuki@i', '8b72529ec356bfa60828b4da6c2cc610', '2018-05-13 07:56:55'),
(6, 'yuyu', 'yuyu@y', 'f34d07b202eaeadf913468e95d7fcb86', '2018-05-13 08:28:13'),
(7, 'huhu', 'huhu@h', 'f3c2cefc1f3b082a56f52902484ca511', '2018-05-13 08:39:52'),
(8, 'yuoy', 'yuoy@y', 'bee7f3df8cc396c2b8dfe2d2c7d78c65', '2018-05-13 08:41:43'),
(9, 'yuoy', 'yuoy@y', 'bee7f3df8cc396c2b8dfe2d2c7d78c65', '2018-05-13 08:42:32'),
(10, 'yuoy2', 'yuoy@y', 'c6146cd64f6890ee70953b5ae774d74c', '2018-05-13 08:42:40'),
(11, 'tuan', 'tuan@2', 'd6b8cc42803ea100735c719f1d7f5e11', '2018-05-13 09:06:46');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `art`
--
ALTER TABLE `art`
ADD PRIMARY KEY (`id`),
ADD KEY `artistid` (`artistid`),
ADD KEY `typeid` (`typeid`),
ADD KEY `create_atid` (`create_atid`),
ADD KEY `show_atid` (`show_atid`),
ADD KEY `art_ibfk_5` (`category_id`);
--
-- Indexes for table `artist`
--
ALTER TABLE `artist`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `create_at`
--
ALTER TABLE `create_at`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `score`
--
ALTER TABLE `score`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`),
ADD KEY `art_id` (`art_id`);
--
-- Indexes for table `show_at`
--
ALTER TABLE `show_at`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `type`
--
ALTER TABLE `type`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `art`
--
ALTER TABLE `art`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;
--
-- AUTO_INCREMENT for table `artist`
--
ALTER TABLE `artist`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `create_at`
--
ALTER TABLE `create_at`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `score`
--
ALTER TABLE `score`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=112;
--
-- AUTO_INCREMENT for table `show_at`
--
ALTER TABLE `show_at`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `type`
--
ALTER TABLE `type`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `art`
--
ALTER TABLE `art`
ADD CONSTRAINT `art_ibfk_1` FOREIGN KEY (`artistid`) REFERENCES `artist` (`id`),
ADD CONSTRAINT `art_ibfk_2` FOREIGN KEY (`typeid`) REFERENCES `type` (`id`),
ADD CONSTRAINT `art_ibfk_3` FOREIGN KEY (`create_atid`) REFERENCES `create_at` (`id`),
ADD CONSTRAINT `art_ibfk_4` FOREIGN KEY (`show_atid`) REFERENCES `show_at` (`id`),
ADD CONSTRAINT `art_ibfk_5` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`);
--
-- Constraints for table `score`
--
ALTER TABLE `score`
ADD CONSTRAINT `score_ibfk_2` FOREIGN KEY (`art_id`) REFERENCES `art` (`id`),
ADD CONSTRAINT `score_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
|
select gobun, goname, gotel
from gogek
where regexp_like (goname, '^.¹Î');
select gobun, goname, gotel
from gogek
where regexp_like (gotel, '[7]{2}');
|
alter table employee add accountNumber varchar(50);
alter table employee add bankCode varchar(50);
|
//REGLA DE NEGOCIO 4
BEGIN
PRUEBAS_PRODUCTOS.INICIALIZAR;
PRUEBAS_STOCKPRODUCTOPUBLICO.INICIALIZAR;
PRUEBAS_STOCKPRODUCTOALMACEN.INICIALIZAR;
DELETE FROM LINEAFACTURA;
ADD_STOCKPRODUCTOPUBLICO(10, 0);
ADD_STOCKPRODUCTOALMACEN(NULL,NULL,NULL);
ADD_PRODUCTO(1234,'QUESO','SECO',4.55, '31', '6');
ADD_LINEAFACTURA(4.55,1,'UNO',1234,NULL);
END;
/
SELECT * FROM STOCKPRODUCTOPUBLICO; |
LOAD CSV WITH HEADERS FROM "file:///person_groups.csv" AS row
MERGE (group:Entity:Org:Group { name: row.group })
WITH group, row
MATCH (person:Entity:Org:Person { id: row.login })
CALL apoc.merge.relationship(person, row.relation, {}, {}, group) YIELD rel
RETURN rel
|
drop database if exists FitnessDatabase;
create database FitnessDatabase character set utf8mb4;
use FitnessDatabase;
create table Klijent(
sifra int not null primary key auto_increment,
Ime varchar(20) not null,
Prezime varchar(20) not null,
Spol char(1) not null,
Dob int(2) not null,
Visina char(5) not null,
Masa varchar(5) not null,
BrojTjednihTreninga int(1) not null,
Trener int,
Gym int
);
create table Trener(
sifra int not null primary key auto_increment ,
Ime varchar(20) not null,
Prezime varchar(20) not null,
Spol char(1) not null,
Iskustvo varchar(20) not null,
BrojKlijenata int,
Vrsta varchar(20) not null,
Email varchar(30) not null,
SocialMedia varchar(100),
FitnessCompany int
);
create table Trening(
sifra int not null primary key auto_increment ,
Naziv varchar(20) not null,
Trajanje varchar(20) not null,
Odmor varchar(20) not null,
BrojPonavljanja varchar(15) not null,
TjednihTreninga int(5)not null,
Trener int ,
Klijent int
);
create table Prehrana(
sifra int not null primary key auto_increment,
Klijent int not null, #FK
Vrsta varchar(20) not null,
TjedniTroskovi decimal(10,2)
);
create table FitnessCompany(
sifra int not null primary key auto_increment,
Naziv varchar(30) not null,
Osnutak datetime,
Opis text ,
BrojKlijenata int(10),
Kontakt varchar(30)not null,
Drzava varchar(15)
);
create table FitnessProizvodi(
sifra int not null primary key auto_increment,
Naziv varchar(50) not null,
Opis varchar(200),
Cijena decimal(10,2) not null,
Kolicina varchar(15) not null,
Proizvodac int not null #FK
);
create table Gym(
sifra int not null primary key auto_increment,
Naziv varchar(30) not null,
Grad varchar(15),
Drzava varchar(15) not null,
RadnoVrijeme varchar(15) not null,
BrojKlijenata int
);
create table Cilj(
sifra int not null primary key auto_increment,
ZeljenaKilaza int(4) not null,
ZeljeniBodyFat varchar(10),
ZeljeniMuscleMass varchar(10),
Klijent int not null
);
alter table Cilj add foreign key(Klijent) references Klijent(sifra);
alter table Klijent add foreign key(Gym) references Gym(sifra);
alter table FitnessProizvodi add foreign key(Proizvodac) references FitnessCompany(sifra);
alter table Trener add foreign key(FitnessCompany) references FitnessCompany(sifra);
alter table Trening add foreign key(Klijent) references Klijent(sifra);
alter table Klijent add foreign key(Trener) references Trener(sifra);
alter table Prehrana add foreign key(Klijent) references Klijent(sifra);
alter table Trening add foreign key(Trener) references Trener(sifra);
insert into FitnessCompany(sifra,Naziv,Osnutak,BrojKlijenata,Kontakt,Drzava)
values (null,'5%Nutrition','2015-06-09','1350','5percentbusiness@gmail.com','USA'),(null,'RogueFitness','2017-07-07','2200','roguebusiness@gmail.com','USA'),
(null,'Proteka','2014-06-19','132','protekabusiness@gmail.com','Hrvatska');
insert into trener(sifra,Ime,Prezime,Spol,Iskustvo,BrojKlijenata,Vrsta,Email,FitnessCompany)
values (null,'Richard','Piana','M','25godina','150','TrenerSnage','richpiana@gmail.com',1),
(null,'Jeff','Cavaliere','M','20godina','95','KondicijskiTrener','jeffcav@gmail.com',2),(null,'Eva','Rusan','Ž','15godina','15','KondicijskiTrener','evarusan@gmail.com',3)
,(null,'Petar','Stipić','M','8godina','13','TrenerSnage','stipic@gmail.com',3),(null,'Oleksii','Novikov','M','5godina','25','Strongman','onovikov@gmail.com',2)
,(null,'Filip','Horvat','M','5godina','7','ClassicPhiTrener','filiph@gmail.com',1);
insert into Gym(sifra,Naziv,Grad,Drzava,RadnoVrijeme,BrojKlijenata)
values (null,'Gyms4you','Osijek','Hrvatska','0-24h/7','3000');
insert into klijent(sifra,Ime,Prezime,Spol,Dob,Visina,Masa,BrojTjednihTreninga,Trener,Gym)
values(null,'Tin','Jeger','M','22','180cm','75kg','5',4,1),(null,'Valentin','Mikić','M','24','183cm','90kg','5',1,1),(null,'Marin','Amidžić','M','24','179cm','83kg','7',5,1);
select * from gym;
select * from fitnesscompany;
select * from trening;
select * from klijent;
select * from trener;
select * from prehrana;
select * from fitnessproizvodi;
insert into FitnessProizvodi(sifra,Naziv,Cijena,Kolicina,Proizvodac)
values (null,'5150 PreWorkout','1.00','Sample',1),(null,'ShakeTime RealFood Protein','44.99','2kg',1),(null,'JointDefender Kapsule','36.99','36kapsula',1),
(null,'StandardGoldWhey','100.00','5kg',1),(null,'Kazein','88.45','2.54kg',3),(null,'Kreatin','44.44','2.54kg',3);
insert into prehrana(sifra,Klijent,Vrsta,TjedniTroskovi)
values (null,1,'DobijanjeKilaze','100.00');
select * from trener;
select * from trening;
select * from klijent;
insert into trening(sifra,Naziv,Trajanje,Odmor,BrojPonavljanja,TjednihTreninga,Trener,Klijent)
values(null,'TreningPrsa','2h','4min','4-8','2',1,3),(null,'TreningLeda','2h','4min','8-12','2',1,3)
,(null,'TreningNoge','1h','2min','10-12','1',1,3),(null,'TreningRuke','1.5h','1.5min','12-16','1',1,3),
(null,'Weakside','WeaksideH','WeaksideMIN','WeaksideREPS','1',1,3);
insert into trening(sifra,Naziv,Trajanje,Odmor,BrojPonavljanja,TjednihTreninga,Trener,Klijent)
values (null,'TreningPrsa','1.5h','1min','12-14','1',4,1);
select a.naziv , a.TjednihTreninga
from trening a inner join klijent b on a.klijent=b.sifra where b.sifra=3;
|
CREATE OR REPLACE VIEW V_YZZFCGBYJSDE107 AS
(
SELECT JSDE107,SUM(DE181) AS ZFCGJE FROM ZB006MX
WHERE CZDE012=1
GROUP BY JSDE107);
|
INSERT INTO burgers (burger_name)
VALUES ('Double Original Cheese Burger'),
('Lean Beef Sliders on Sourdough'),
('Southwest Black Bean Burger with Special Sauce'),
('Philly Cheese Steak Burger'),
('Portabella Delite Burger'); |
DROP TABLE IF EXISTS `user_info`;
CREATE TABLE `user_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`phone` varchar(20) NOT NULL,
`email` varchar(255) NOT NULL,
`nick_name` varchar(40) NOT NULL,
`password` varchar(255) NOT NULL,
`real_name` varchar(255) NOT NULL,
`register_time` datetime(0) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
|
CREATE TABLE `hint` (
`hintid` int(11) NOT NULL AUTO_INCREMENT,
`xcoord` int(11) DEFAULT NULL,
`ycoord` int(11) DEFAULT NULL,
`distance` double DEFAULT NULL,
`imageurl` varchar(100) DEFAULT NULL,
PRIMARY KEY (`hintid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
CREATE TABLE clientebola(
codigo int default(nextval('bola'))
);
|
select pos.title, ccppt.* from company_candidate_position_position_types ccppt with(NOLOCK)
join position_position_types ppt with(NOLOCK) on (ccppt.Position_Position_Type_Id=ppt.Position_Position_Type_Id)
join positions pos with(NOLOCK) on (ppt.position_id=pos.Position_Id)
where ccppt.company_candidate_id = 38046405
select csv.Candidate_Screening_Version_Id, csv.Status, csv.num_points, csv.passed, screening_date, csv.last_updated_date, csv.has_resume, csv.has_cover_letter, csv.is_file_upload_pending, sv.Screening_Version_Id, scr.Screening_Id, scr.screening_name, scr.is_universal_screening from candidate_screening_versions csv with(NOLOCK)
join screening_versions sv with(NOLOCK) on (sv.Screening_Version_Id=csv.Screening_Version_Id)
join screenings scr with(NOLOCK) on (scr.Screening_Id = sv.Screening_Id)
where csv.candidate_id = 29241834
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 24-11-2016 a las 15:06:46
-- Versión del servidor: 10.1.16-MariaDB
-- Versión de PHP: 5.5.38
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `baseclientes`
--
CREATE DATABASE IF NOT EXISTS `baseclientes` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `baseclientes`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `baseclientes`
--
CREATE TABLE `baseclientes` (
`nrodecuenta` int(20) DEFAULT NULL,
`dni` int(20) DEFAULT NULL,
`cartera` int(10) DEFAULT NULL,
`saldo` float(20,2) DEFAULT NULL,
`mora` int(5) DEFAULT NULL,
`diasatraso` int(10) DEFAULT NULL,
`domicilio` varchar(150) DEFAULT NULL,
`codpostal` varchar(10) DEFAULT NULL,
`distribuidor` varchar(100) DEFAULT NULL,
`distribuidorfinal` varchar(100) DEFAULT NULL,
`telefono` int(20) DEFAULT NULL,
`pagominimo` float(20,2) DEFAULT NULL,
`dnv` float(20,2) DEFAULT NULL,
`pagosdelmes` float(20,2) DEFAULT NULL,
`excluido` varchar(50) DEFAULT NULL,
`pagominimo1` float(20,2) DEFAULT NULL,
`pagominimo2` float(20,2) DEFAULT NULL,
`pagominimo3` float(20,2) DEFAULT NULL,
`domiciliopostal` varchar(150) DEFAULT NULL,
`codpostal2` int(5) DEFAULT NULL,
`distribuidorpostal` varchar(50) DEFAULT NULL,
`numerotarjeta` bigint(25) DEFAULT NULL,
`vencimientotarjeta` varchar(10) DEFAULT NULL,
`apellido` varchar(15) DEFAULT NULL,
`nombre` varchar(15) DEFAULT NULL,
`fechanacimiento` varchar(15) DEFAULT NULL,
`sexo` varchar(5) DEFAULT NULL,
`estadocivil` varchar(10) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`cuil` int(20) DEFAULT NULL,
`telefono2` int(20) DEFAULT NULL,
`quieregrup` varchar(5) DEFAULT NULL,
`refi` varchar(20) DEFAULT NULL,
`importerefi` float(20,2) DEFAULT NULL,
`quiereenviopostal` varchar(5) DEFAULT NULL,
`resumenonline` varchar(5) DEFAULT NULL,
`localidad` varchar(20) DEFAULT NULL,
`estadodesc` varchar(20) DEFAULT NULL,
`fechacambioestado` varchar(20) DEFAULT NULL,
`importeultimopago` float(20,2) DEFAULT NULL,
`fechaultimopago` varchar(10) DEFAULT NULL,
`categoriascore` varchar(15) DEFAULT NULL,
`vencimientolote` varchar(15) DEFAULT NULL,
`clasificacionmatriz` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TABLE `shipments` (
`id` varchar(36) NOT NULL,
`shipment_number` varchar(100) NOT NULL,
`sender_id` varchar(36),
`recipient_id` varchar(36),
`route_id` varchar(36) DEFAULT NULL,
`arrival_delayed` tinyint(1) unsigned NOT NULL DEFAULT '0',
`departure_delayed` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
/*Part 1*/
/*1. How many country in each continent, have life expectancy greater than 70?*/
USE world;
SELECT country.Continent AS continent, count(country.Continent) AS total_country, country.LifeExpectancy as life_expectancy FROM country
WHERE LifeExpectancy > 70
GROUP BY Continent;
/*2. How many country in each continent have life expectancy between 60 and 70?*/
USE world;
SELECT country.Continent AS continent, count(country.Continent) AS total_country, country.LifeExpectancy as life_expectancy FROM country
WHERE LifeExpectancy > 60 AND LifeExpectancy < 70
GROUP BY Continent;
/*3. How many country have life expectancy greater than 75?*/
USE world;
SELECT country.Name AS country, country.LifeExpectancy as life_expectancy FROM country
WHERE LifeExpectancy > 75;
/*4. How many country have life expectancy less than 40?*/
USE world;
SELECT country.Name AS country, country.LifeExpectancy as life_expectancy FROM country
WHERE LifeExpectancy < 40;
/*5 How many people live in the top 10 country with the most population?*/
USE world;
SELECT country.Name AS country, country.Population as population FROM country
ORDER BY Population DESC LIMIT 10;
/*6. According to the world database, how many people are there in the world?*/
USE world;
SELECT sum(country.Population) AS world_population FROM country;
/*7. Show results for continents where it shows the continent name and the total population. Only show results where the total_population for the continent is more than 500,000,000. If. the continent doesn't have 500,000,000 people, do NOT show the result.*/
USE world;
SELECT country.Continent AS continent, sum(country.Population) AS total_population FROM country
GROUP BY continent
HAVING total_population > 500000000;
/*8. Show results of all continents that has average life expectancy for the continent to be less than 71. Show each of these continent name, how many country there are in each of the continent, total population for the continent, as well as the life expectancy of this continent. For example, as Europe and North America both have continent life expectancy greater than 71, these continents shouldn't show up in your sql results.*/
USE world;
SELECT country.Continent AS continent, count(country.Name) AS total_country, SUM(country.Population) AS total_population, AVG(country.LifeExpectancy) AS average_life_expectancy FROM country
GROUP BY continent
HAVING average_life_expectancy < 71;
/*Part 2*/
/*How many cities are there for each of the country? Show the total city count for each country where you display the full country name.*/
USE world;
SELECT country.Name AS country, count(city.Name) AS number_of_cities FROM country
LEFT JOIN city ON country.Code = city.CountryCode
GROUP BY country;
/*For each language, find out how many country speak each language.*/
USE world;
SELECT countrylanguage.Language AS language, COUNT(country.Name) AS number_of_countries FROM countrylanguage
LEFT JOIN country ON countrylanguage.CountryCode = country.Code
GROUP BY language;
/*For each language, find out how many country use that language as the official language.*/
USE world;
SELECT countrylanguage.Language AS language, COUNT(country.Name) AS number_of_countries, countrylanguage.IsOfficial FROM countrylanguage
LEFT JOIN country ON countrylanguage.CountryCode = country.Code
WHERE countrylanguage.IsOfficial = 'T'
GROUP BY language;
/*For each continent, find out how many cities there are (according to this database) and the average population of the cities for each continent. */
USE world;
SELECT country.Continent as continent, COUNT(city.Name) AS number_of_cities, AVG(city.Population) AS average_cities_population FROM country
LEFT JOIN city ON country.Code = city.CountryCode
GROUP BY continent;
/*For example, for continent A, have it state the number of cities for that continent, and the average city population for that continent.
(Advanced) Find out how many people in the world speak each language. Make sure the total sum of. this number is comparable to the total population in the */
USE world;
SELECT countrylanguage.Language, SUM(country.Population*countrylanguage.Percentage)/100 AS total_population from countrylanguage
LEFT JOIN country ON country.Code = countrylanguage.CountryCode
GROUP BY Language
ORDER BY total_population DESC;
|
-- SQL is intended for postgres SQL
-- initial user is:
-- username: meiben
-- password: Eiben1
DROP TABLE IF EXISTS "user";
CREATE TABLE "user" (
id serial PRIMARY KEY,
username varchar(50) NOT NULL,
name_first varchar(50) NOT NULL,
name_last varchar(50) NOT NULL,
password_hash varchar(255) NOT NULL,
password_reset_token varchar(255),
email varchar(50) NOT NULL,
auth_key varchar(32) NOT NULL,
status smallint NOT NULL DEFAULT 10,
date_created timestamp without time zone NOT NULL,
date_updated timestamp without time zone NOT NULL,
usertype smallint NOT NULL DEFAULT 20,
CONSTRAINT user_email_key UNIQUE (email),
CONSTRAINT user_username_key UNIQUE (username)
); |
/*
工厂付款
*/
delimiter $
drop trigger if exists Tgr_Payments_AfterInsert $
create trigger Tgr_Payments_AfterInsert after insert
on Payments
for each row
begin
/*定义变量*/
declare sNewID varchar(255);
set sNewID=new.ID;
call Proc_ApplyForPayments_Payments_UnPaiedAmount(sNewID);-- 付款申请-工厂付款
end$
delimiter ; |
/*
Navicat Premium Data Transfer
Source Server : lokal
Source Server Type : MySQL
Source Server Version : 100411
Source Host : localhost:3306
Source Schema : huda
Target Server Type : MySQL
Target Server Version : 100411
File Encoding : 65001
Date: 09/05/2020 00:51:10
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for budget
-- ----------------------------
DROP TABLE IF EXISTS `budget`;
CREATE TABLE `budget` (
`id` int(35) NOT NULL AUTO_INCREMENT,
`sort_by` int(20) NULL DEFAULT NULL,
`kd_rek` int(5) NULL DEFAULT NULL COMMENT '= id table rekening',
`name` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`cost` decimal(12, 0) NOT NULL,
`qty1` int(23) NULL DEFAULT NULL,
`unit1` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`qty2` int(23) NULL DEFAULT NULL,
`unit2` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`description` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`created_at` timestamp(0) NOT NULL DEFAULT current_timestamp(0) ON UPDATE CURRENT_TIMESTAMP(0),
`updated_at` timestamp(0) NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 48 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of budget
-- ----------------------------
INSERT INTO `budget` VALUES (1, 1, 10, 'Ketua', 150000, 1, 'Orang', 9, 'Bulan', 'Keterangan', '2020-04-16 21:22:38', '2020-04-16 16:11:10');
INSERT INTO `budget` VALUES (2, 2, 10, 'Wakil Ketua', 100000, 1, 'Orang', 9, 'Bulan', 'Keterangan', '2020-04-16 21:22:40', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (3, 3, 10, 'Bendahara', 100000, 2, 'Orang', 9, 'Bulan', '', '2020-04-16 16:44:28', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (4, 4, 10, 'Sekertaris', 100000, 2, 'Orang', 9, 'Bulan', '', '2020-04-16 16:46:51', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (7, 1, 12, 'Tunjangan Hari Raya', 17000000, 1, 'Kali', 0, '', '', '2020-04-16 17:42:15', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (8, 1, 13, 'Imam Sholat', 900000, 1, 'Kali', 0, '', '', '2020-04-16 17:42:56', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (9, 1, 8, 'Sewa Tanah Wakaf', 16000000, 5, 'Bahu', 1, 'Musim', '', '2020-04-17 17:02:31', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (10, 1, 9, 'Kotak Amal Masjid', 6000000, 9, 'Bulan', 0, '', '', '2020-04-24 15:26:10', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (12, 1, 14, 'Bindex kwitansi', 80000, 1, 'Pack', 0, '', '', '2020-04-24 16:31:50', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (13, 2, 14, 'Bindex File', 80000, 1, 'Pack', 0, '', '', '2020-04-24 16:32:21', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (14, 3, 14, 'Buku kas', 25000, 1, 'Pack', 0, '', '', '2020-04-24 16:33:04', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (15, 4, 14, 'Buku folio', 25000, 1, 'Pack', 0, '', '', '2020-04-24 16:33:47', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (16, 5, 14, 'Kertas A4', 90000, 1, 'Rim', 0, '', '', '2020-04-24 16:34:18', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (17, 6, 14, 'Fotocopy', 100000, 9, 'Bulan', 0, '', '', '2020-04-24 22:10:52', '2020-04-24 17:10:52');
INSERT INTO `budget` VALUES (18, 1, 15, 'Biaya rumah tangga masjid', 500000, 4, 'Bulan', 0, '', 'Galon air mineral, gula, kopi, sabun cuci, sabun pel, pembersih toilet, dll', '2020-04-24 16:37:35', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (19, 2, 15, 'Pemeliharaan komputer dan printer', 50000, 9, 'Bulan', 0, '', '', '2020-04-24 22:11:29', '2020-04-24 17:11:29');
INSERT INTO `budget` VALUES (20, 3, 15, 'Listrik', 150000, 9, 'Bulan', 0, '', '', '2020-04-24 22:12:05', '2020-04-24 17:12:05');
INSERT INTO `budget` VALUES (21, 1, 42, 'Marbot', 1125000, 2, 'Orang', 9, 'Bulan', '', '2020-04-24 16:59:13', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (22, 2, 42, 'Imam sholat rawatib', 500000, 3, 'Orang', 9, 'Bulan', '', '2020-04-24 17:00:12', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (23, 1, 16, 'Pembagian undangan', 100000, 9, 'Bulan', 0, '', '', '2020-04-24 17:06:51', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (24, 1, 17, 'Komputer', 5000000, 1, 'Paket', 0, '', '', '2020-04-24 17:07:38', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (25, 2, 17, 'Printer', 3000000, 1, 'Paket', 0, '', '', '2020-04-24 17:08:15', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (26, 1, 19, 'Sholat Jum\'at', 600000, 9, 'Bulan', 0, '', '', '2020-04-24 17:21:07', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (27, 1, 24, 'Maulid Nabi Muhammad SAW', 10000000, 1, 'Paket', 0, '', '', '2020-04-24 17:21:53', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (28, 2, 24, 'Isra Miraj Nabi Muhammad SAW', 0, 1, 'Paket', 0, '', '', '2020-04-24 17:22:47', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (29, 1, 25, 'Dzikrul Ghofilin 40 Hari', 0, 1, 'Paket', 0, '', '', '2020-04-24 17:23:37', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (30, 2, 25, 'Dzikrul Ghofilin malam jum\'at', 375000, 1, 'Bulan', 0, '', '', '2020-04-24 17:24:47', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (31, 1, 26, 'Pengajian Rutin', 375000, 1, 'Periode', 0, '', '', '2020-04-24 17:26:10', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (32, 1, 27, 'Nuzulul Qur\'an', 300000, 1, 'Periode', 0, '', '', '2020-04-24 17:26:37', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (33, 1, 28, 'Haul Masjid', 300000, 1, 'Periode', 0, '', '', '2020-04-24 17:27:16', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (34, 1, 29, 'Rebo Wekasan', 100000, 9, 'Bulan', 0, '', '', '2020-04-24 17:28:26', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (35, 1, 30, 'Musyawarah Internal Pengurus DKM', 200000, 9, 'Bulan', 0, '', '', '2020-04-24 17:29:14', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (36, 1, 31, 'Musyawarah DKM', 300000, 4, 'Bulan', 0, '', '', '2020-04-24 17:29:42', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (37, 1, 32, 'Pembelian alat kebersihan masjid', 100000, 9, 'Bulan', 0, '', '', '2020-04-25 00:38:29', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (38, 1, 33, 'Pemeliharaan lampu dan alat2 listrik', 200000, 9, 'Bulan', 0, '', '', '2020-04-25 00:39:15', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (39, 1, 34, 'Pemeliharaan alat pengeras suara', 200000, 9, 'Bulan', 0, '', '', '2020-04-25 00:39:47', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (40, 1, 35, 'Pemeliharaan pompa air, kran air, dll', 200000, 9, 'Bulan', 0, '', '', '2020-04-25 00:40:33', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (41, 1, 36, 'Biaya tak terduga', 10000000, 1, 'Periode', 0, '', '', '2020-04-25 00:41:16', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (42, 1, 43, 'Biaya perawatan komputer', 50000, 8, 'Bulan', 0, '', '', '2020-04-25 00:46:47', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (43, 2, 43, 'Pengecatan Bedug', 5000000, 1, 'Periode', 0, '', '', '2020-04-25 00:47:36', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (44, 1, 41, 'Perbaikan keramik dinding', 5000000, 1, 'Periode', 0, '', '', '2020-04-25 00:48:41', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (45, 2, 41, 'Pengecatan pintu masjid', 5000000, 1, 'Periode', 0, '', 'Pintu bagian utara', '2020-04-25 00:49:57', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (46, 1, 40, 'Penambahan tanaman dan dekorasi', 5000000, 1, 'Periode', 0, '', '', '2020-04-25 00:51:55', '0000-00-00 00:00:00');
INSERT INTO `budget` VALUES (47, 1, 44, 'Sisa Kas Tahun 2019', 20017500, 1, 'Periode', 0, '', '', '2020-05-08 18:55:49', '0000-00-00 00:00:00');
-- ----------------------------
-- Table structure for inventory
-- ----------------------------
DROP TABLE IF EXISTS `inventory`;
CREATE TABLE `inventory` (
`id` int(35) NOT NULL,
`name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`price` decimal(12, 2) NULL DEFAULT NULL,
`date_buy` date NULL DEFAULT NULL,
`qty` int(10) NULL DEFAULT NULL,
`condition` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'Kondisi (SB=Sangat Bagus, B=Bagus, R=Rusak',
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
`deleted_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of inventory
-- ----------------------------
-- ----------------------------
-- Table structure for invited_guests
-- ----------------------------
DROP TABLE IF EXISTS `invited_guests`;
CREATE TABLE `invited_guests` (
`id` int(35) NOT NULL AUTO_INCREMENT,
`name` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`address` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
`deleted_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of invited_guests
-- ----------------------------
INSERT INTO `invited_guests` VALUES (1, 'Orang 1', 'Alamat 1', NULL, NULL, NULL);
INSERT INTO `invited_guests` VALUES (2, 'Orang 2 ', 'Alamat 2', NULL, NULL, NULL);
INSERT INTO `invited_guests` VALUES (3, 'Orang 3', 'Alamat 3', NULL, NULL, NULL);
INSERT INTO `invited_guests` VALUES (4, 'Orang 4', 'Alamat 4', NULL, NULL, NULL);
INSERT INTO `invited_guests` VALUES (5, 'Orang 5', 'Alamat 5', NULL, NULL, NULL);
INSERT INTO `invited_guests` VALUES (6, 'Alamul Huda', 'Cikalong Krajan 1', '2020-05-08 17:08:49', '2020-05-08 17:09:46', NULL);
-- ----------------------------
-- Table structure for kategori
-- ----------------------------
DROP TABLE IF EXISTS `kategori`;
CREATE TABLE `kategori` (
`id` int(35) NOT NULL AUTO_INCREMENT,
`name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`type` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'P=Pendapatan, B=Belanja',
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
`deleted_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of kategori
-- ----------------------------
INSERT INTO `kategori` VALUES (1, 'Kas Awal', 'P', '0000-00-00 00:00:00', NULL, NULL);
INSERT INTO `kategori` VALUES (3, 'Insentif Pegawai', 'B', NULL, '2020-04-12 09:32:46', NULL);
INSERT INTO `kategori` VALUES (11, 'sd', 'B', '2020-04-12 17:45:30', NULL, NULL);
INSERT INTO `kategori` VALUES (12, 'sdds', 'B', '2020-04-12 17:46:17', NULL, NULL);
INSERT INTO `kategori` VALUES (13, 'sad', 'B', '2020-04-12 17:46:52', NULL, NULL);
-- ----------------------------
-- Table structure for m_jumat
-- ----------------------------
DROP TABLE IF EXISTS `m_jumat`;
CREATE TABLE `m_jumat` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`month` int(2) NOT NULL,
`date_start` date NULL DEFAULT NULL,
`date_end` date NULL DEFAULT NULL,
`no` int(10) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of m_jumat
-- ----------------------------
INSERT INTO `m_jumat` VALUES (1, 4, '2020-03-27', '2020-04-02', 1);
INSERT INTO `m_jumat` VALUES (2, 4, '2020-04-03', '2020-04-09', 2);
INSERT INTO `m_jumat` VALUES (3, 4, '2020-04-10', '2020-04-16', 3);
INSERT INTO `m_jumat` VALUES (4, 4, '2020-04-17', '2020-04-23', 4);
INSERT INTO `m_jumat` VALUES (5, 4, '2020-04-24', '2020-04-30', 5);
INSERT INTO `m_jumat` VALUES (6, 5, '2020-05-01', '2020-05-07', 1);
INSERT INTO `m_jumat` VALUES (7, 5, '2020-05-08', '2020-05-14', 2);
INSERT INTO `m_jumat` VALUES (8, 5, '2020-05-15', '2020-05-21', 3);
INSERT INTO `m_jumat` VALUES (9, 5, '2020-05-22', '2020-05-28', 4);
INSERT INTO `m_jumat` VALUES (10, 6, '2020-05-29', '2020-06-04', 1);
INSERT INTO `m_jumat` VALUES (11, 6, '2020-06-05', '2020-06-11', 2);
INSERT INTO `m_jumat` VALUES (12, 6, '2020-06-12', '2020-06-18', 3);
INSERT INTO `m_jumat` VALUES (13, 6, '2020-06-19', '2020-06-25', 4);
INSERT INTO `m_jumat` VALUES (14, 7, '2020-06-25', '2020-07-02', 1);
INSERT INTO `m_jumat` VALUES (15, 7, '2020-07-03', '2020-07-09', 2);
INSERT INTO `m_jumat` VALUES (16, 7, '2020-07-10', '2020-07-16', 3);
INSERT INTO `m_jumat` VALUES (17, 7, '2020-07-17', '2020-07-23', 4);
INSERT INTO `m_jumat` VALUES (18, 7, '2020-07-24', '2020-07-30', 5);
INSERT INTO `m_jumat` VALUES (19, 8, '2020-07-31', '2020-08-06', 1);
INSERT INTO `m_jumat` VALUES (20, 8, '2020-08-07', '2020-08-13', 2);
INSERT INTO `m_jumat` VALUES (21, 8, '2020-08-14', '2020-08-20', 3);
INSERT INTO `m_jumat` VALUES (22, 8, '2020-08-21', '2020-08-27', 4);
-- ----------------------------
-- Table structure for mail_content
-- ----------------------------
DROP TABLE IF EXISTS `mail_content`;
CREATE TABLE `mail_content` (
`id` int(23) NOT NULL AUTO_INCREMENT,
`type` varchar(30) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT 'header or footer',
`content` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`created_at` timestamp(0) NOT NULL DEFAULT current_timestamp(0) ON UPDATE CURRENT_TIMESTAMP(0),
`updated_at` timestamp(0) NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of mail_content
-- ----------------------------
-- ----------------------------
-- Table structure for mail_in
-- ----------------------------
DROP TABLE IF EXISTS `mail_in`;
CREATE TABLE `mail_in` (
`id` int(23) NOT NULL AUTO_INCREMENT,
`no_mail` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`date` date NULL DEFAULT NULL,
`type` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`address` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`description` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`file` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NOT NULL DEFAULT current_timestamp(0) ON UPDATE CURRENT_TIMESTAMP(0),
`updated_at` timestamp(0) NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of mail_in
-- ----------------------------
-- ----------------------------
-- Table structure for mail_out
-- ----------------------------
DROP TABLE IF EXISTS `mail_out`;
CREATE TABLE `mail_out` (
`id` int(23) NOT NULL AUTO_INCREMENT,
`no_mail` varchar(3) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`type` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`date` date NULL DEFAULT NULL,
`day` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`location` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`time` time(0) NULL DEFAULT NULL,
`time_desc` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`guest` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT 'id in table invited_guests',
`header1` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`header2` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`footer1` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of mail_out
-- ----------------------------
INSERT INTO `mail_out` VALUES (1, '001', '02', '2020-04-21', 'Senin', 'Pengajian Hidayatul Mubtadiien', '18:30:00', 'ba\'da Sholat Magrib', '1,2,3,4,5', 'Teriring salam dan Do\'a semoga Allah SWT merahmati dan meridhoi Kita semua dan selalu sukses dalam melaksanakan aktifitas sehari-hari. Aamiin', 'Dengan kerendahan hati kami mengundang Bapak-bapak dan Saudara-saudara untuk dapat hadir nama acara, insyaAllah akan dilaksanakan pada :', 'Demikian undangan ini kami sampaikan, mengingat pentingnya acara ini dimohon hadir tepat pada waktunya.\r\nAtas perhatian dan kehadirannya Kami ucapkan terimakasih,', '2020-04-20 10:06:22', '2020-04-20 10:38:18');
INSERT INTO `mail_out` VALUES (2, '002', '02', '2020-04-23', 'Selasa', 'Masjid Jamie Nurul Hikmah', '10:30:00', '', '2, 3, 4', 'Teriring salam dan Do\'a semoga Allah SWT merahmati dan meridhoi Kita semua dan selalu sukses dalam melaksanakan aktifitas sehari-hari. Aamiin', 'Dengan kerendahan hati kami mengundang Bapak-bapak dan Saudara-saudara untuk dapat hadir nama acara, insyaAllah akan dilaksanakan pada :', 'Demikian undangan ini kami sampaikan, mengingat pentingnya acara ini dimohon hadir tepat pada waktunya.\r\nAtas perhatian dan kehadirannya Kami ucapkan terimakasih.', '2020-04-23 18:23:26', '2020-05-08 16:55:58');
-- ----------------------------
-- Table structure for mail_type
-- ----------------------------
DROP TABLE IF EXISTS `mail_type`;
CREATE TABLE `mail_type` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`no` varchar(2) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`name` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`header1` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`header2` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`footer1` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 31 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of mail_type
-- ----------------------------
INSERT INTO `mail_type` VALUES (16, '01', 'Keputusan', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (17, '02', 'Undangan', 'Teriring salam dan Do\'a semoga Allah SWT merahmati dan meridhoi Kita semua dan selalu sukses dalam melaksanakan aktifitas sehari-hari. Aamiin', 'Dengan kerendahan hati kami mengundang Bapak-bapak dan Saudara-saudara untuk dapat hadir nama acara, insyaAllah akan dilaksanakan pada :', 'Demikian undangan ini kami sampaikan, mengingat pentingnya acara ini dimohon hadir tepat pada waktunya.\r\nAtas perhatian dan kehadirannya Kami ucapkan terimakasih.');
INSERT INTO `mail_type` VALUES (18, '03', 'Permohonan', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (19, '04', 'Pemberitahuan', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (20, '05', 'Peminjaman', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (21, '06', 'Pernyataan', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (22, '07', 'Mandat', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (23, '08', 'Tugas', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (24, '09', 'Keterangan', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (25, '10', 'Rekomendasi', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (26, '11', 'Balasan', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (27, '12', 'Perintah Perjalanan Dinas', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (28, '13', 'Sertifikat', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (29, '14', 'Perjanjian Kerja', NULL, NULL, NULL);
INSERT INTO `mail_type` VALUES (30, '15', 'Pengantar', NULL, NULL, NULL);
-- ----------------------------
-- Table structure for menu
-- ----------------------------
DROP TABLE IF EXISTS `menu`;
CREATE TABLE `menu` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`title` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`url` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT '#',
`parent` int(10) NULL DEFAULT NULL,
`sort_by` int(10) NULL DEFAULT NULL,
`icon` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`is_active` float NULL DEFAULT 0 COMMENT '1=Active, 0=Non Active',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of menu
-- ----------------------------
INSERT INTO `menu` VALUES (1, 'dashboard', 'Dashboard', 'home', NULL, 1, 'icon-home', 1);
INSERT INTO `menu` VALUES (2, 'anggaran', 'Anggaran', 'anggaran', NULL, 2, 'icon-layers', 1);
INSERT INTO `menu` VALUES (3, 'transaksi', 'Transaksi', '#', NULL, 3, 'icon-dollar-sign', 1);
INSERT INTO `menu` VALUES (4, 'pendapatan', 'Pendapatan', 'keuangan/pendapatan', 3, 1, NULL, 1);
INSERT INTO `menu` VALUES (5, 'pengeluaran', 'Pengeluaran', 'keuangan/pengeluaran', 3, 2, NULL, 1);
INSERT INTO `menu` VALUES (6, 'inventaris', 'Inventaris', '#', NULL, 4, 'icon-server', 0);
INSERT INTO `menu` VALUES (7, 'laporan', 'Laporan', '#', NULL, 6, 'icon-book', 1);
INSERT INTO `menu` VALUES (8, 'buku_kas', 'Buku Kas', 'laporan/keuangan/buku_kas', 7, 1, NULL, 1);
INSERT INTO `menu` VALUES (9, 'pendapatan', 'Pendapatan', 'laporan/pendapatan', 7, 2, NULL, 0);
INSERT INTO `menu` VALUES (10, 'pengeluaran', 'Pengeluaran', 'laporan/pengeluaran', 7, 3, NULL, 0);
INSERT INTO `menu` VALUES (11, 'apbm', 'APBM', 'laporan/anggaran/apbm', 7, 4, NULL, 1);
INSERT INTO `menu` VALUES (12, 'struktur_organisasi', 'Struktur Organisasi', '#', NULL, 7, 'icon-users', 0);
INSERT INTO `menu` VALUES (13, 'master_data', 'Master Data', '#', NULL, 8, 'icon-grid', 1);
INSERT INTO `menu` VALUES (14, 'kategori', 'Kategori', 'master/kategori', 13, 1, NULL, 0);
INSERT INTO `menu` VALUES (15, 'rekening', 'Rekening', '#', 13, 2, NULL, 1);
INSERT INTO `menu` VALUES (16, 'rekening1', 'Rekening 1', 'master/rekening/rekening1', 15, 1, NULL, 1);
INSERT INTO `menu` VALUES (17, 'rekening2', 'Rekening 2', 'master/rekening/rekening2', 15, 2, NULL, 1);
INSERT INTO `menu` VALUES (18, 'rekening3', 'Rekening 3', 'master/rekening/rekening', 15, 3, NULL, 1);
INSERT INTO `menu` VALUES (19, 'disposisi', 'Disposisi', '#', NULL, 5, 'icon-mail', 1);
INSERT INTO `menu` VALUES (20, 'surat_masuk', 'Surat Masuk', 'disposisi/surat_masuk', 19, 1, NULL, 1);
INSERT INTO `menu` VALUES (21, 'surat_keluar', 'Surat Keluar', 'disposisi/surat_keluar', 19, 2, NULL, 1);
INSERT INTO `menu` VALUES (22, 'tamu_undangan', 'Tamu Undangan', 'disposisi/tamu_undangan', 13, 3, NULL, 1);
INSERT INTO `menu` VALUES (23, 'jumat', 'Jum\'at', 'laporan/keuangan/jumat', 7, 5, NULL, 1);
INSERT INTO `menu` VALUES (24, 'rekap_jumat', 'Rekap Jum\'at', 'laporan/keuangan/rekap_jumat', 7, 6, NULL, 1);
INSERT INTO `menu` VALUES (25, 'realisasi_anggaran', 'Realisasi Anggaran', 'coming_soon', 7, 7, NULL, 1);
INSERT INTO `menu` VALUES (26, 'integrasi', 'Integrasi APBM', 'keuangan/integrasi', 3, 3, NULL, 1);
-- ----------------------------
-- Table structure for mosque
-- ----------------------------
DROP TABLE IF EXISTS `mosque`;
CREATE TABLE `mosque` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'untuk login',
`ketua_dkm` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sekertaris` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`bendahara` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`phone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`fax` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`website` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
`deleted_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of mosque
-- ----------------------------
INSERT INTO `mosque` VALUES (4, 'mjnh', 'KH.Marullah Marhab', 'Alim Sujatmiko', 'Hari Nugraha', 'Jamie Nurul Hikmah', 'Jl.Syekh Quro No.185, Cikalong, Cilamaya Wetan, Kab.Karawang, Jawa Barat 40374', NULL, NULL, NULL, NULL, '2020-04-07 05:32:57', NULL, NULL);
-- ----------------------------
-- Table structure for rek1
-- ----------------------------
DROP TABLE IF EXISTS `rek1`;
CREATE TABLE `rek1` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT current_timestamp(0),
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of rek1
-- ----------------------------
INSERT INTO `rek1` VALUES (1, 'Pendapatan', NULL, NULL);
INSERT INTO `rek1` VALUES (2, 'Biaya', NULL, '2020-04-15 15:28:06');
-- ----------------------------
-- Table structure for rek2
-- ----------------------------
DROP TABLE IF EXISTS `rek2`;
CREATE TABLE `rek2` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`kd_rek1` int(10) NULL DEFAULT NULL,
`kd_rek2` int(10) NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of rek2
-- ----------------------------
INSERT INTO `rek2` VALUES (1, 'Pendapatan Rutin', 1, 1, '2020-04-14 20:45:05', NULL);
INSERT INTO `rek2` VALUES (2, 'Insentif', 2, 1, '2020-04-14 20:45:40', NULL);
INSERT INTO `rek2` VALUES (3, 'Administrasi & Umum', 2, 2, '2020-04-15 15:25:33', NULL);
INSERT INTO `rek2` VALUES (4, 'Transport', 2, 3, '2020-04-15 15:25:52', NULL);
INSERT INTO `rek2` VALUES (5, 'Perlengkapan / Inventaris Masjid', 2, 4, '2020-04-15 15:26:21', NULL);
INSERT INTO `rek2` VALUES (6, 'Kegiatan Rutin DKM', 2, 5, '2020-04-15 15:27:04', NULL);
INSERT INTO `rek2` VALUES (7, 'Biaya Lain-lain', 2, 6, '2020-04-15 15:27:45', NULL);
INSERT INTO `rek2` VALUES (8, 'Rehabilitasi Bangunan Masjid', 2, 7, '2020-04-15 15:29:44', NULL);
INSERT INTO `rek2` VALUES (9, 'Pendapatan Lain-lain', 1, 2, '2020-04-24 15:20:49', NULL);
INSERT INTO `rek2` VALUES (10, 'Sisa Kas', 1, 3, '2020-05-08 18:52:30', '2020-05-08 18:59:14');
-- ----------------------------
-- Table structure for rekening
-- ----------------------------
DROP TABLE IF EXISTS `rekening`;
CREATE TABLE `rekening` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`kd_rek1` int(3) NULL DEFAULT NULL,
`kd_rek2` int(3) NULL DEFAULT NULL,
`kd_rek3` int(3) NULL DEFAULT NULL,
`name` varchar(150) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NOT NULL DEFAULT current_timestamp(0) ON UPDATE CURRENT_TIMESTAMP(0),
`updated_at` timestamp(0) NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of rekening
-- ----------------------------
INSERT INTO `rekening` VALUES (8, 1, 1, 1, 'Tanah Wakaf', '2020-04-14 20:46:32', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (9, 1, 1, 2, 'Jariah Masjid', '2020-04-24 20:23:53', '2020-04-24 15:23:53');
INSERT INTO `rekening` VALUES (10, 2, 1, 1, 'Pengurus DKM', '2020-04-16 09:07:35', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (12, 2, 1, 3, 'Tunjangan Hari Raya', '2020-04-16 09:07:37', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (13, 2, 1, 4, 'Imam Tarawih', '2020-04-16 09:07:44', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (14, 2, 2, 1, 'Administrasi', '2020-04-24 20:51:16', '2020-04-24 15:51:16');
INSERT INTO `rekening` VALUES (15, 2, 2, 2, 'Umum', '2020-04-24 20:51:36', '2020-04-24 15:51:36');
INSERT INTO `rekening` VALUES (16, 2, 3, 1, 'Transport', '2020-04-24 21:03:19', '2020-04-24 16:03:19');
INSERT INTO `rekening` VALUES (17, 2, 4, 1, 'Perlengkapan', '2020-04-24 21:04:00', '2020-04-24 16:04:00');
INSERT INTO `rekening` VALUES (18, 2, 4, 2, 'Inventaris', '2020-04-24 21:04:12', '2020-04-24 16:04:12');
INSERT INTO `rekening` VALUES (19, 2, 5, 1, 'Sholat Jum\'at', '2020-04-24 21:04:28', '2020-04-24 16:04:28');
INSERT INTO `rekening` VALUES (24, 2, 5, 2, 'Peringatan Hari Besar Islam', '2020-04-24 21:05:01', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (25, 2, 5, 3, 'Dzikrul Ghofilin', '2020-04-24 21:05:04', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (26, 2, 5, 4, 'Pengajian Rutin', '2020-04-24 16:06:54', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (27, 2, 5, 5, 'Nuzulul Qur\'an', '2020-04-24 16:07:13', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (28, 2, 5, 6, 'Haul Masjid', '2020-04-24 16:07:27', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (29, 2, 5, 7, 'Rebo Wekasan', '2020-04-24 16:14:36', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (30, 2, 5, 8, 'Musyawarah Internal Pengurus DKM', '2020-04-24 16:15:22', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (31, 2, 5, 9, 'Musyawarah DKM', '2020-04-24 16:15:37', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (32, 2, 6, 1, 'Pembelian Alat Kebersihan Masjid', '2020-04-24 16:16:10', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (33, 2, 6, 2, 'Pemeliharaan lampu dan alat-alat listrik', '2020-04-24 16:16:38', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (34, 2, 6, 3, 'Pemeliharaan alat pengeras suara', '2020-04-24 16:17:01', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (35, 2, 6, 4, 'Pemeliharaan pompa air, kran air, dll', '2020-04-24 16:17:49', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (36, 2, 6, 5, 'Biaya tak terduga', '2020-04-24 16:18:03', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (37, 2, 6, 6, 'Kegiatan Lain-lain', '2020-04-24 16:18:36', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (38, 2, 6, 7, 'Kegiatan irema', '2020-04-24 16:18:47', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (39, 2, 6, 8, 'Kegiatan Bazis', '2020-04-24 16:19:02', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (40, 2, 7, 1, 'Taman Masjid', '2020-04-24 16:23:07', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (41, 2, 7, 2, 'Bangunan Masjid', '2020-04-24 16:23:40', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (42, 2, 1, 5, 'Pengurus Masjid', '2020-04-24 16:57:02', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (43, 2, 6, 9, 'Pemeliharaan inventaris masjid', '2020-04-25 00:45:36', '0000-00-00 00:00:00');
INSERT INTO `rekening` VALUES (44, 1, 3, 1, 'Sisa Kas Tahun Lalu', '2020-05-08 18:53:20', '0000-00-00 00:00:00');
-- ----------------------------
-- Table structure for transaction
-- ----------------------------
DROP TABLE IF EXISTS `transaction`;
CREATE TABLE `transaction` (
`id` int(25) NOT NULL AUTO_INCREMENT,
`no_kas` char(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`id_budget` int(25) NULL DEFAULT NULL COMMENT 'id table budget',
`date` date NULL DEFAULT NULL,
`debet` decimal(12, 0) NULL,
`kredit` decimal(12, 0) NULL,
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`user_id` int(25) NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
`deleted_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 139 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of transaction
-- ----------------------------
INSERT INTO `transaction` VALUES (75, '00001', 47, '2020-04-01', 20017500, 0, 'Sisa Kas Tahun Lalu', 4, NULL, '2020-05-08 18:57:11', NULL);
INSERT INTO `transaction` VALUES (76, '00002', NULL, '2020-04-01', 0, 150000, 'Biaya musyawarah DKM', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (77, '00003', NULL, '2020-04-02', 0, 50000, 'ATK Pengurus DKM', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (78, '00004', NULL, '2020-04-02', 0, 30000, 'Imam Dzikrul Ghofilin', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (79, '00005', NULL, '2020-04-03', 0, 125000, 'Petugas Jumat', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (80, '00006', NULL, '2020-04-03', 1519000, 0, 'Jariah Jumat Ke-1', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (81, '00007', NULL, '2020-04-03', 0, 89000, 'Pengharum dan pembersih ruangan masjid', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (82, '00008', NULL, '2020-04-07', 0, 2250000, 'Insentif marebot bulan April 2020', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (83, '00009', NULL, '2020-04-08', 0, 70500, 'Transport survey konveksi', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (84, '00010', NULL, '2020-04-09', 0, 100000, 'Musyawarah IREMA', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (85, '00011', NULL, '2020-04-09', 0, 30000, 'Imam Dzikrul Ghofilin', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (86, '00012', NULL, '2020-04-10', 0, 125000, 'Petugas Jumat', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (87, '00013', NULL, '2020-04-10', 1230000, 0, 'Jariah Jumat Ke-2', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (88, '00014', NULL, '2020-04-10', 0, 48000, 'Pengharum dan pembersih ruangan masjid', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (89, '00015', NULL, '2020-04-10', 0, 51000, 'Pembelian ATK Irema', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (90, '00016', NULL, '2020-04-10', 0, 250000, 'Loundry karpet, mukena dan sajadah masjid', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (91, '00017', NULL, '2020-04-10', 0, 70000, 'Konsumsi Kegiatan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (92, '00018', NULL, '2020-04-10', 0, 200000, 'Musyawarah pembahasan RAPB', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (93, '00019', NULL, '2020-04-12', 0, 940000, 'Pengecatan Bedug', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (94, '00020', NULL, '2020-04-12', 0, 468000, 'Perbaikan Kran', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (95, '00021', NULL, '2020-04-12', 0, 100000, 'Konsumsi Kegiatan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (96, '00022', NULL, '2020-04-12', 0, 4500000, 'DP Konveksi', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (97, '00023', NULL, '2020-04-12', 0, 60000, 'Transport', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (98, '00024', NULL, '2020-04-12', 0, 960000, 'Pembelian bunga', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (99, '00025', NULL, '2020-04-13', 0, 100000, 'Transport', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (100, '00026', NULL, '2020-04-13', 0, 160000, 'Konsumsi Kegiatan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (101, '00027', NULL, '2020-04-13', 0, 25000, 'srabut baja', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (102, '00028', NULL, '2020-04-13', 0, 100000, 'BON Amil Yuti', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (103, '00029', NULL, '2020-04-14', 0, 235000, 'Pasir 1 becak dan semen 1 zak', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (104, '00030', NULL, '2020-04-14', 0, 300000, 'Ongkos Tukang 2 org', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (105, '00031', NULL, '2020-04-15', 0, 55000, 'Semen 1 zak', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (106, '00032', NULL, '2020-04-15', 0, 155000, 'Ongkos becak + bata 200 pcs', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (107, '00033', NULL, '2020-04-15', 0, 90000, 'Sarapan dan makan siang kegiatan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (108, '00034', NULL, '2020-04-15', 0, 110000, 'Ongkos kenek pembantu', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (109, '00035', NULL, '2020-04-15', 0, 49000, 'Gembok dan cat pilok', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (110, '00036', NULL, '2020-04-16', 0, 1108000, 'Pembelian peralatan listrik dan lampu I', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (111, '00037', NULL, '2020-04-16', 0, 187000, 'Cat dekor dan paku', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (112, '00038', NULL, '2020-04-16', 0, 110000, 'Konsumsi Kegiatan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (113, '00039', NULL, '2020-04-16', 0, 30000, 'Imam Dzikrul Ghofilin', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (114, '00040', NULL, '2020-04-17', 0, 125000, 'Petugas Jumat', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (115, '00041', NULL, '2020-04-17', 1245000, 0, 'Jariah jumat ke-3', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (116, '00042', NULL, '2020-04-17', 0, 222500, 'Konsumsi Kegiatan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (117, '00043', NULL, '2020-04-17', 0, 1200000, 'Imam Rawatib Maret-April 2020', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (118, '00044', NULL, '2020-04-17', 0, 200000, 'Insentif DKM Maret-April 2020', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (119, '00045', NULL, '2020-04-17', 0, 1000000, 'Biaya tukang listrik', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (120, '00046', NULL, '2020-04-17', 0, 1000000, 'BON Amil Yuti', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (121, '00047', NULL, '2020-04-17', 700000, 0, 'Dana tanah wakaf dari BpkSubandi', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (122, '00048', NULL, '2020-04-18', 0, 664000, 'Pembelian peralatan listrik dan lampu II', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (123, '00049', NULL, '2020-04-19', 0, 117000, 'Konsumsi Kegiatan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (124, '00050', NULL, '2020-04-20', 0, 30000, 'Trasnport ke konveksi anggota IREMA', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (125, '00051', NULL, '2020-04-21', 0, 50000, 'Konsumsi Kegiatan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (126, '00052', NULL, '2020-04-21', 0, 92000, 'Pembelian keramik', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (127, '00053', NULL, '2020-04-22', 0, 600000, 'Pembuatan banner Ramadhan dan Hari raya', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (128, '00054', NULL, '2020-04-22', 0, 20000, 'Transport', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (129, '00055', NULL, '2020-04-22', 0, 400000, 'Pembelian bahan material pasir dan semen', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (130, '00056', NULL, '2020-04-22', 0, 1000000, 'Biaya tukang dekor', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (131, '00057', NULL, '2020-04-22', 0, 100000, 'Musyawarah sambut ramadhan', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (132, '00058', NULL, '2020-04-23', 0, 200000, 'Pembelian perlengkapan sholat tarawih', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (133, '00059', NULL, '2020-04-24', 0, 125000, 'Petugas Jumat', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (134, '00060', NULL, '2020-04-24', 1502000, 0, 'Jariah Jumat ke-4', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (135, '00061', NULL, '2020-04-24', 0, 28000, 'Bon Warung', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (136, '00062', NULL, '2020-04-29', 0, 199000, 'Biaya Listrik', NULL, NULL, NULL, NULL);
INSERT INTO `transaction` VALUES (137, '00063', 41, '2020-04-30', 0, 200000, 'Pembuatan Kotak Amal (4 buah)', 4, NULL, '2020-05-06 19:29:56', NULL);
INSERT INTO `transaction` VALUES (138, '00064', NULL, '2020-04-30', 0, 66000, 'Biaya Haul Masjid', NULL, NULL, NULL, NULL);
-- ----------------------------
-- Table structure for unit
-- ----------------------------
DROP TABLE IF EXISTS `unit`;
CREATE TABLE `unit` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`name` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NOT NULL DEFAULT current_timestamp(0) ON UPDATE CURRENT_TIMESTAMP(0),
`updated_at` timestamp(0) NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of unit
-- ----------------------------
INSERT INTO `unit` VALUES (1, 'Orang', '2020-04-16 09:36:36', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (2, 'Bulan', '2020-04-16 09:36:39', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (3, 'Pack', '2020-04-16 09:36:42', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (4, 'Set', '2020-04-16 09:36:51', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (5, 'Rim', '2020-04-16 09:37:05', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (6, 'Buah', '2020-04-16 09:37:13', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (7, 'Kg', '2020-04-16 09:37:21', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (8, 'Paket', '2020-04-16 22:39:33', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (9, 'Kali', '2020-04-16 22:39:39', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (10, 'Bahu', '2020-04-17 22:00:34', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (11, 'Musim', '2020-04-17 22:01:26', '0000-00-00 00:00:00');
INSERT INTO `unit` VALUES (12, 'Periode', '2020-04-24 22:25:24', '0000-00-00 00:00:00');
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(25) NOT NULL AUTO_INCREMENT,
`mosque_id` int(25) NULL DEFAULT NULL,
`group_id` int(25) NULL DEFAULT NULL,
`username` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`password` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`image` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`last_login` timestamp(0) NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
`deleted_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (4, 4, 1, 'alam', '$P$B3fyQDUQLGDYAumaE9XDlUzMTXJFnR.', 'alam_endraw@yahoo.com', 'Alamul Huda', 'https://res.cloudinary.com/dwohvljcs/image/upload/v1588778909/mjnh/26720aef6b7701407122ea6ef8eeb0fb.png.png', NULL, '2020-05-08 19:01:58', '2020-04-07 05:32:57', '2020-05-08 19:01:58', NULL);
INSERT INTO `user` VALUES (5, 4, 2, 'hari', '$P$BkIC9JXGpyxoOLMPrpGJP2RHvFQnEE1', NULL, 'Hari Nugraha', '', NULL, '2020-05-07 16:56:48', '2020-05-04 18:19:17', '2020-05-07 16:56:49', NULL);
INSERT INTO `user` VALUES (6, 4, 3, 'sekertaris', '$P$BRDE8s/JfFB6jhne92VHzyaO6rc5Et.', NULL, 'Alim Sujatmiko', NULL, NULL, '2020-05-07 04:00:10', '2020-05-07 03:56:15', '2020-05-07 04:00:10', NULL);
-- ----------------------------
-- Table structure for user_group
-- ----------------------------
DROP TABLE IF EXISTS `user_group`;
CREATE TABLE `user_group` (
`id` int(25) NOT NULL AUTO_INCREMENT,
`mosque_id` int(25) NULL DEFAULT NULL,
`name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`title` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`privileges` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT 'menampung data menu dalam bentuk json {\"menu\":[\"1\",\"2\"]}',
`created_at` timestamp(0) NULL DEFAULT NULL,
`update_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user_group
-- ----------------------------
INSERT INTO `user_group` VALUES (1, 4, 'admin', 'Admin', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26', NULL, NULL);
INSERT INTO `user_group` VALUES (2, 4, 'bendahara', 'Bendahara', '1,3,4,5,7,8,9,10,23,24', NULL, NULL);
INSERT INTO `user_group` VALUES (3, 4, 'sekertaris', 'Sekertaris', '1,3,4,5,7,8,9,10,11,23,24,26', NULL, NULL);
-- ----------------------------
-- Procedure structure for buku_kas
-- ----------------------------
DROP PROCEDURE IF EXISTS `buku_kas`;
delimiter ;;
CREATE PROCEDURE `buku_kas`(`v_bln` INT)
BEGIN
SELECT ''AS no_kas,''AS DATE,'Sisa Kas' AS DESCRIPTION,IF(cost>0,cost,0)AS debet,IF(cost<0,cost,0)AS kredit FROM(
SELECT (SUM(debet)-SUM(kredit))cost FROM TRANSACTION WHERE MONTH(DATE)<v_bln
)zz
UNION
SELECT no_kas,DATE,DESCRIPTION,debet,kredit FROM TRANSACTION WHERE MONTH(DATE)=v_bln;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for dashboard
-- ----------------------------
DROP PROCEDURE IF EXISTS `dashboard`;
delimiter ;;
CREATE PROCEDURE `dashboard`()
BEGIN
SELECT sum(debet)as debet,sum(kredit)as kredit,sum(all_debet)as all_debet,sum(debet_lalu)as debet_lalu,sum(kredit_lalu)as kredit_lalu,sum(all_kredit)as all_kredit
from(
SELECT sum(debet)as debet, sum(kredit)as kredit, 0 as all_debet, 0 as debet_lalu, 0 as kredit_lalu, 0 as all_kredit
from transaction where month(date) = MONTH(now())
union
SELECT 0, 0, 0, sum(debet), sum(kredit), 0
from transaction where month(date) = MONTH(now())-1
union
SELECT 0, 0, sum(debet), 0, 0, sum(kredit)
from transaction
)zx;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for rekap_jumat
-- ----------------------------
DROP PROCEDURE IF EXISTS `rekap_jumat`;
delimiter ;;
CREATE PROCEDURE `rekap_jumat`(mnth int)
BEGIN
SELECT id,
concat("JUM'AT KE ", t.no) as name,
(SELECT sum(debet) from transaction where date BETWEEN t.date_start and t.date_end)as debet,
(SELECT sum(kredit) from transaction where date BETWEEN t.date_start and t.date_end)as kredit
from m_jumat t where month=mnth;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for rep_budget
-- ----------------------------
DROP PROCEDURE IF EXISTS `rep_budget`;
delimiter ;;
CREATE PROCEDURE `rep_budget`()
BEGIN
SELECT * FROM(
SELECT 'T'AS sts,ri.id AS kd_rek,ri.name,0 AS cost,''AS unit,SUM(cost*qty1*(IF(qty2>0, qty2, 1))) AS total,''AS description
FROM budget b LEFT JOIN rekening r ON b.kd_rek=r.id
LEFT JOIN rek1 ri ON r.kd_rek1=ri.id
GROUP BY r.kd_rek1
UNION
SELECT 'T'AS sts,CONCAT(r.kd_rek1,'.',r.kd_rek2)AS kd_rek,ri.name,0 AS cost,''AS unit,SUM(cost*qty1*(IF(qty2>0, qty2, 1))) AS total,''AS DESCRIPTION
FROM budget b LEFT JOIN rekening r ON b.kd_rek=r.id
LEFT JOIN rek2 ri ON r.kd_rek1=ri.kd_rek1 AND r.kd_rek2=ri.kd_rek2
GROUP BY r.kd_rek1,r.kd_rek2
UNION
SELECT 'T'AS sts,CONCAT(kd_rek1,'.',kd_rek2,'.',kd_rek3)AS kd_rek,r.NAME,0 AS cost,''AS unit,SUM(cost*qty1*(IF(qty2>0, qty2, 1))) AS total,''AS DESCRIPTION
FROM budget b LEFT JOIN rekening r ON b.kd_rek=r.id GROUP BY r.kd_rek1,r.kd_rek2,r.kd_rek3
UNION
SELECT 'T'AS sts,CONCAT(r.kd_rek1,'.',r.kd_rek2,'.',r.kd_rek3,'.',sort_by)AS kd_rek,b.name,cost,
CONCAT(qty1,' ',unit1, CASE WHEN qty2=0 THEN '' ELSE CONCAT(' / ',qty2,' ',unit2) END)AS unit,(cost*qty1*(IF(qty2>0, qty2, 1)))AS total,DESCRIPTION
FROM budget b LEFT JOIN rekening r ON b.kd_rek=r.id
UNION
SELECT 'H1'AS sts,CONCAT(r.kd_rek1,'.999')AS kd_rek,CONCAT('Total ',ri.name)AS NAME,0 AS cost,''AS unit,SUM(cost*qty1*(IF(qty2>0, qty2, 1))) AS total,''AS DESCRIPTION
FROM budget b LEFT JOIN rekening r ON b.kd_rek=r.id
LEFT JOIN rek1 ri ON r.kd_rek1=ri.id
GROUP BY r.kd_rek1
UNION
SELECT 'H'AS sts,CONCAT(r.kd_rek1,'.9999')AS kd_rek,' 'AS NAME,0 AS cost,0 AS unit,0 AS total,''AS DESCRIPTION
FROM budget b LEFT JOIN rekening r ON b.kd_rek=r.id GROUP BY r.kd_rek1
union
SELECT sts,kd_rek,NAME,cost,unit,(SUM(debet)-SUM(kredit))AS total,DESCRIPTION FROM(
SELECT 'H1'AS sts,'8.999' AS kd_rek,'Surplus / (Defisit)'AS NAME,0 AS cost,''AS unit,
IF(ri.id=1,SUM(cost*qty1*(IF(qty2>0, qty2, 1))),0)AS debet,
IF(ri.id=2,SUM(cost*qty1*(IF(qty2>0, qty2, 1))),0)AS kredit,
''AS DESCRIPTION
FROM budget b LEFT JOIN rekening r ON b.kd_rek=r.id
LEFT JOIN rek1 ri ON r.kd_rek1=ri.id
GROUP BY r.kd_rek1
)zx
)zx ORDER BY kd_rek;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for rep_jumat
-- ----------------------------
DROP PROCEDURE IF EXISTS `rep_jumat`;
delimiter ;;
CREATE PROCEDURE `rep_jumat`(d_start date,d_end date,d_start_be date,d_end_be date)
BEGIN
SELECT date,description,debet,kredit from transaction where date between d_start and d_end
union
SELECT '','Total Transaksi Jumat Ini',sum(debet)as debet,sum(kredit)as kredit from transaction where date between d_start and d_end
union
SELECT '','Total Transaksi Jumat Lalu',sum(debet)as debet,sum(kredit)as kredit from transaction where date between d_start_be and d_end_be
union
SELECT '','Total Transaksi s/d Jumat Ini',sum(debet)as debet,sum(kredit)as kredit from transaction where date <=d_end;
END
;;
delimiter ;
SET FOREIGN_KEY_CHECKS = 1;
|
-- Put phone number in 3rd values' slot below if you'd like to test out the text reminders feature.
INSERT INTO users (username, password, phone_num) VALUES ("user1", "password", 1234567890);
INSERT INTO users (username, password) VALUES ("user2", "password");
INSERT INTO posts (user_id, main_content, addl_content, date) VALUES (1, "This is where the body of the main post goes. It has a max length of 255 characters.", "This is where any additional content goes. There is no length restriction for this part.", "2014-09-19");
INSERT INTO posts (user_id, main_content, addl_content, date) VALUES (2, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec finibus, ex quis dictum sollicitudin, nulla lectus hendrerit orci, ac porta nunc eros venenatis ante. Donec congue sem ac tortor sollicitudin iaculis. Nullam aliquet odio et ante sagittis sed.", "This demonstrates the max length allowable in the main content section.", "2014-09-19");
INSERT INTO posts (user_id, main_content, date) VALUES (1, "This post doesn't have any additional content.", "2014-09-19"); |
INSERT INTO public.groups VALUES('assessmentuser');
INSERT INTO public.users_groups VALUES('admin','assessmentuser');
|
select posts.*, users.user_name, users.profile_img
from posts
join users on users.user_id = posts.users_id
order by post_likes desc
limit 4; |
CREATE SEARCH INDEX if not exists ON bank.customer with columns address_line1
,city
,email_address
,first_name
,full_name
,last_name
,middle_name
,government_id
,government_id_type
,phone_numbers
,state_abbreviation
,zipcode
,custaccounts
;
CREATE SEARCH INDEX if not exists ON bank.transaction with columns tranPostDt
,merchantName
,merchantCtgyDesc
,cardNum
;
|
# patch_48_49_c.sql
#
# title: regulatory_support_removal
#
# description:
# regulatory tables to be removed from database (now done by func gen)
DELETE object_xref FROM object_xref where ensembl_object_type = "regulatory_factor";
DELETE object_xref FROM object_xref where ensembl_object_type = "regulatory_feature";
ALTER TABLE object_xref CHANGE COLUMN ensembl_object_type
ensembl_object_type ENUM('RawContig', 'Transcript', 'Gene',
'Translation');
DROP TABLE regulatory_factor;
DROP TABLE regulatory_factor_coding;
DROP TABLE regulatory_feature;
DROP TABLE regulatory_feature_object;
DROP TABLE regulatory_search_region;
# patch identifier
INSERT INTO meta (meta_key, meta_value) VALUES ('patch', 'patch_48_49_c.sql|regulatory_support_removal');
|
/*
SQLyog Community v13.0.1 (64 bit)
MySQL - 5.7.19 : Database - gruhudhyog
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`gruhudhyog` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `gruhudhyog`;
/*Table structure for table `tbl_brand` */
DROP TABLE IF EXISTS `tbl_brand`;
CREATE TABLE `tbl_brand` (
`brandPk` bigint(20) NOT NULL AUTO_INCREMENT,
`productFk` bigint(20) DEFAULT NULL,
`brandName` varchar(30) DEFAULT NULL,
`createdBy` bigint(20) DEFAULT NULL,
`createdOn` datetime DEFAULT NULL,
PRIMARY KEY (`brandPk`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_brand` */
insert into `tbl_brand`(`brandPk`,`productFk`,`brandName`,`createdBy`,`createdOn`) values
(8,1,'jeans',2,'2019-03-11 00:00:00'),
(9,10,'aaaaaa',2,'2019-03-11 18:47:36'),
(13,1,'aaaaaa',1,'2019-03-11 18:58:58');
/*Table structure for table `tbl_cart` */
DROP TABLE IF EXISTS `tbl_cart`;
CREATE TABLE `tbl_cart` (
`cartPK` bigint(20) NOT NULL AUTO_INCREMENT,
`productFK` bigint(20) DEFAULT NULL,
`quantity` int(11) DEFAULT NULL,
`isOrder` tinyint(1) DEFAULT NULL,
`isActive` tinyint(1) DEFAULT NULL,
`createdDate` date DEFAULT NULL,
`createdBy` bigint(20) DEFAULT NULL,
`totalPrice` double DEFAULT NULL,
PRIMARY KEY (`cartPK`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_cart` */
insert into `tbl_cart`(`cartPK`,`productFK`,`quantity`,`isOrder`,`isActive`,`createdDate`,`createdBy`,`totalPrice`) values
(32,40,1,0,1,'2019-03-19',1,569),
(35,42,1,0,1,'2019-03-19',1,2323),
(39,37,1,0,1,'2019-03-19',1,159),
(40,38,1,0,1,'2019-03-19',1,45),
(41,35,1,0,1,'2019-03-19',1,152),
(42,36,1,0,1,'2019-03-26',1,60),
(43,37,1,0,1,'2019-03-27',1,159),
(44,37,1,0,1,'2019-03-27',1,159),
(45,37,1,0,1,'2019-03-27',1,159),
(46,37,1,0,1,'2019-03-27',1,159),
(47,37,1,0,1,'2019-03-27',1,159),
(48,37,1,0,1,'2019-03-27',1,159),
(49,41,1,0,1,'2019-03-27',1,569);
/*Table structure for table `tbl_category` */
DROP TABLE IF EXISTS `tbl_category`;
CREATE TABLE `tbl_category` (
`categoryPK` bigint(20) NOT NULL AUTO_INCREMENT,
`categoryName` varchar(30) DEFAULT NULL,
`createdBy` bigint(20) DEFAULT NULL,
`createdOn` datetime DEFAULT NULL,
PRIMARY KEY (`categoryPK`)
) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_category` */
insert into `tbl_category`(`categoryPK`,`categoryName`,`createdBy`,`createdOn`) values
(1,'Snacks',2,'2019-03-07 00:00:00'),
(3,'Cloths',1,'2019-03-07 00:00:00'),
(4,'Art Work',2,'2019-03-07 00:00:00'),
(6,'Dairy Farm',2,'2019-03-07 00:00:00'),
(5,'Nursery',2,'2019-03-07 00:00:00'),
(8,'njknjkdc',2,'2019-03-12 18:20:45'),
(7,'njknjkdc',2,'2019-03-12 18:20:47'),
(9,'njknjkdc',2,'2019-03-12 18:20:48'),
(10,'njknjkdc',2,'2019-03-12 18:20:49'),
(11,'njknjkdc',2,'2019-03-12 18:20:51'),
(12,'njknjkdc',2,'2019-03-12 18:21:04');
/*Table structure for table `tbl_paymentsmethod` */
DROP TABLE IF EXISTS `tbl_paymentsmethod`;
CREATE TABLE `tbl_paymentsmethod` (
`paymentmethodPk` bigint(20) NOT NULL AUTO_INCREMENT,
`mathodName` varchar(30) DEFAULT NULL,
PRIMARY KEY (`paymentmethodPk`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_paymentsmethod` */
insert into `tbl_paymentsmethod`(`paymentmethodPk`,`mathodName`) values
(1,'Cash On Deivery');
/*Table structure for table `tbl_product` */
DROP TABLE IF EXISTS `tbl_product`;
CREATE TABLE `tbl_product` (
`productPK` bigint(20) NOT NULL AUTO_INCREMENT,
`categoryFK` bigint(20) DEFAULT NULL,
`productName` varchar(30) DEFAULT NULL,
`productPrice` double DEFAULT NULL,
`discount` varchar(30) DEFAULT NULL,
`productStock` int(20) DEFAULT NULL,
`productDiscription` varchar(300) DEFAULT NULL,
`createdBy` bigint(30) DEFAULT NULL,
`createdOn` date DEFAULT '0000-00-00',
PRIMARY KEY (`productPK`)
) ENGINE=MyISAM AUTO_INCREMENT=45 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_product` */
insert into `tbl_product`(`productPK`,`categoryFK`,`productName`,`productPrice`,`discount`,`productStock`,`productDiscription`,`createdBy`,`createdOn`) values
(1,3,'Khakhra',200,'0',2,'1',1,'2019-03-07'),
(6,3,'jeans',123,'0',12,'asda',1,'2019-03-11'),
(7,3,'top',123,'0',12,'asda',1,'2019-03-11'),
(8,3,'jeans',12334,'0',123,'qweqeqw',1,'2019-03-11'),
(9,3,'jeans',12334,'0',123,'qeqweqwe',2,'2019-03-11'),
(10,3,'tops',12334,'0',2,'dwqe',2,'2019-03-11'),
(11,3,'tops',12334,'0',2,'dwqe',2,'2019-03-11'),
(18,3,'jeans',1233,'0',3,'wqrewrw',1,'2019-03-11'),
(19,3,'cefer',123,'0',2,'hgh',1,'2019-03-11'),
(39,4,'pateto',51,'45',23,'csvcsvfv',2,'2019-03-14'),
(38,3,'cdcsd',45,'1',25,'dcsdcsdcc',2,'2019-03-14'),
(37,3,'shirt',159,'45',50,'good quality',2,'2019-03-14'),
(36,4,'sketch',60,'56',10,'deddwd',2,'2019-03-14'),
(35,1,'pateto',152,'5',15,'xqwxqwx',2,'2019-03-14'),
(34,5,'dcd',40,'5',80,'csdcsdc',2,'2019-03-14'),
(33,6,'milk',20,'5',20,'testy',2,'2019-03-14'),
(40,1,'cdcsd',569,'45',56,'vdfvfv',2,'2019-03-14'),
(41,3,'patola',569,'45',23,'nnnnnnnnnn',2,'2019-03-14'),
(42,4,'k.kl.l',2323,'56',56,'bm,jhjh',2,'2019-03-14'),
(43,1,'mamra',20,'1',20,'nxjjnxjskndj',2,'2019-03-14'),
(44,1,'mamra',20,'1',20,'nxjjnxjskndj',2,'2019-03-14');
/*Table structure for table `tbl_productimagemapping` */
DROP TABLE IF EXISTS `tbl_productimagemapping`;
CREATE TABLE `tbl_productimagemapping` (
`adminProductImagePk` bigint(20) NOT NULL AUTO_INCREMENT,
`adminProductFk` bigint(20) DEFAULT NULL,
`imagePath` varchar(500) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`createdBy` bigint(20) DEFAULT NULL,
PRIMARY KEY (`adminProductImagePk`)
) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_productimagemapping` */
insert into `tbl_productimagemapping`(`adminProductImagePk`,`adminProductFk`,`imagePath`,`createdDate`,`createdBy`) values
(9,6,'\\home\\gruhudhyog\\ProductImages\\Cloths\\jeans\\f478e9a0-81d3-42b6-a697-ed17fbdbb016.jpg','2019-03-11 00:00:00',2),
(10,7,'\\home\\gruhudhyog\\ProductImages\\Cloths\\jeans\\3434d9f2-10c4-4e60-9ff4-64e54a682405.jpg','2019-03-11 00:00:00',2),
(11,8,'\\home\\gruhudhyog\\ProductImages\\Cloths\\jeans\\0f59187b-9496-4fe8-879f-d73d40938cf8.jpg','2019-03-11 00:00:00',2),
(12,9,'\\home\\gruhudhyog\\ProductImages\\Cloths\\jeans\\4f1b30c5-0117-4498-bc0a-828a1064d4ad.jpg','2019-03-11 00:00:00',2),
(13,17,'\\home\\gruhudhyog\\ProductImages\\Cloths\\jeans\\564bcf89-cfda-4b97-af0c-5b3387fa08fa.jpg','2019-03-11 00:00:00',2),
(14,17,'\\home\\gruhudhyog\\ProductImages\\Cloths\\jeans\\7772be76-bee5-418e-bc16-c82db2b5cd48.jpg','2019-03-11 00:00:00',2),
(17,18,'\\home\\gruhudhyog\\ProductImages\\Cloths\\jeans\\be57d38d-637d-49e7-b2f3-9276bee7cf1e.jpg','2019-03-11 00:00:00',1),
(18,19,'\\home\\gruhudhyog\\ProductImages\\Snacks\\wafers\\4cd8bd30-7f31-4d6b-8c29-943235600a79.png','2019-03-11 17:54:06',1),
(19,20,'\\home\\gruhudhyog\\ProductImages\\Snacks\\tops\\21f181cf-ec82-470f-91bf-af44d4085176.png','2019-03-11 18:09:51',2),
(20,33,'\\home\\gruhudhyog\\ProductImages\\Dairy Farm\\milk\\4b6edbc4-f234-4dfc-be57-f5c36dd02fda.jpg','2019-03-14 13:00:12',2),
(21,34,'\\home\\gruhudhyog\\ProductImages\\Nursery\\dcd\\14cd01b3-9842-4426-b193-5cfc9149290b.jpg','2019-03-14 13:01:16',2),
(22,35,'\\home\\gruhudhyog\\ProductImages\\Snacks\\pateto\\124e640c-d705-4686-8549-0ebda35ed0cf.jpg','2019-03-14 13:01:52',2),
(23,36,'\\home\\gruhudhyog\\ProductImages\\Art Work\\sketch\\a393561f-cd82-496b-ad52-71bae30e4e71.jpg','2019-03-14 13:03:35',2),
(24,37,'\\home\\gruhudhyog\\ProductImages\\Cloths\\shirt\\43bb6cce-384b-4627-9d6d-bb0be66a0f7d.jpg','2019-03-14 13:04:14',2),
(25,38,'\\home\\gruhudhyog\\ProductImages\\Cloths\\cdcsd\\0ec22c03-7807-4f3d-ae18-800cc701af88.jpg','2019-03-14 13:04:48',2),
(26,39,'\\home\\gruhudhyog\\ProductImages\\Art Work\\pateto\\1d324564-86c4-40ec-a537-115f876ed320.jpg','2019-03-14 13:05:23',2),
(27,40,'\\home\\gruhudhyog\\ProductImages\\Snacks\\cdcsd\\3c99118a-3226-4961-ae16-36de275ea633.jpg','2019-03-14 13:05:55',2),
(28,41,'\\home\\gruhudhyog\\ProductImages\\Cloths\\patola\\290ac26f-6453-43d0-9dc9-92fdf35bbb50.jpg','2019-03-14 13:08:09',2),
(29,42,'\\home\\gruhudhyog\\ProductImages\\Art Work\\k.kl.l\\b25d6a76-40e0-4f40-9ec0-fdb1d9626d05.jpg','2019-03-14 13:08:39',2),
(30,43,'\\home\\gruhudhyog\\ProductImages\\Snacks\\mamra\\1e56997c-03f7-45f9-b162-67d7459bd9f5.jpg','2019-03-14 15:04:12',2),
(31,44,'\\home\\gruhudhyog\\ProductImages\\Snacks\\mamra\\d8a3c1a2-0a1f-414e-b4d4-4f31b3ff41d8.jpg','2019-03-14 15:04:12',2),
(32,43,'\\home\\gruhudhyog\\ProductImages\\Snacks\\mamra\\23a104a4-7844-43e7-a1b1-afd38cdee5f4.jpg','2019-03-14 15:04:12',2),
(33,44,'\\home\\gruhudhyog\\ProductImages\\Snacks\\mamra\\83935021-a6ff-4bc8-88e5-f45407112dde.jpg','2019-03-14 15:04:12',2);
/*Table structure for table `tbl_shipping` */
DROP TABLE IF EXISTS `tbl_shipping`;
CREATE TABLE `tbl_shipping` (
`shippingPK` bigint(20) NOT NULL AUTO_INCREMENT,
`firstName` varchar(30) DEFAULT NULL,
`lastName` varchar(30) DEFAULT NULL,
`email` varchar(30) DEFAULT NULL,
`contactNumber` varchar(30) DEFAULT NULL,
`address` varchar(30) DEFAULT NULL,
`country` varchar(20) DEFAULT NULL,
`state` varchar(20) DEFAULT NULL,
`city` varchar(20) DEFAULT NULL,
`postcode` int(20) DEFAULT NULL,
`createdBy` bigint(20) DEFAULT NULL,
`createdOn` date DEFAULT NULL,
PRIMARY KEY (`shippingPK`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_shipping` */
insert into `tbl_shipping`(`shippingPK`,`firstName`,`lastName`,`email`,`contactNumber`,`address`,`country`,`state`,`city`,`postcode`,`createdBy`,`createdOn`) values
(11,'Yashvi','Aghara','yashvi@gmail.com','346556','hiiiii test','IN','ML','qawsqw',34253456,1,'2019-03-26'),
(13,'Yashvi','Aghara','yashvi@gmail.com','346556','wdjwqn','IN','GJ','qawsqw',34253456,1,'2019-03-26');
/*Table structure for table `tbl_user` */
DROP TABLE IF EXISTS `tbl_user`;
CREATE TABLE `tbl_user` (
`userid` bigint(20) NOT NULL AUTO_INCREMENT,
`first_name` varchar(20) DEFAULT NULL,
`last_name` varchar(20) DEFAULT NULL,
`email_address` varchar(40) DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`phonenumber` bigint(20) DEFAULT NULL,
`roleFK` bigint(20) DEFAULT NULL,
`createdDate` date DEFAULT NULL,
PRIMARY KEY (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_user` */
insert into `tbl_user`(`userid`,`first_name`,`last_name`,`email_address`,`password`,`phonenumber`,`roleFK`,`createdDate`) values
(1,'vikas','hingu','vikas34@bnjkvn.com','vikas',1213546789,3,NULL),
(2,'admin','admin','admin123@gmail.com','123',9825434543,1,NULL);
/*Table structure for table `tbl_userrole` */
DROP TABLE IF EXISTS `tbl_userrole`;
CREATE TABLE `tbl_userrole` (
`rolePK` bigint(20) NOT NULL AUTO_INCREMENT,
`roleName` varchar(30) DEFAULT NULL,
`isActive` int(20) DEFAULT NULL,
PRIMARY KEY (`rolePK`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_userrole` */
insert into `tbl_userrole`(`rolePK`,`roleName`,`isActive`) values
(1,'admin',1),
(2,'seller',1),
(3,'user',1);
/*Table structure for table `tblpayment` */
DROP TABLE IF EXISTS `tblpayment`;
CREATE TABLE `tblpayment` (
`paymentPk` bigint(20) NOT NULL AUTO_INCREMENT,
`paymentmethodFk` bigint(30) DEFAULT NULL,
`createdOn` date DEFAULT NULL,
`createdBy` bigint(20) DEFAULT NULL,
PRIMARY KEY (`paymentPk`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*Data for the table `tblpayment` */
insert into `tblpayment`(`paymentPk`,`paymentmethodFk`,`createdOn`,`createdBy`) values
(10,1,'2019-03-27',1);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
-- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
--
-- Host: localhost Database: mobileonline
-- ------------------------------------------------------
-- 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 `account`
--
DROP TABLE IF EXISTS `account`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `account` (
`ID` int(11) NOT NULL,
`USERNAME` varchar(45) DEFAULT NULL,
`EMAIL` varchar(45) DEFAULT NULL,
`PASSWORD` varchar(45) DEFAULT NULL,
`ROLE_ID` int(11) DEFAULT NULL,
`CREATE_TIME` date DEFAULT NULL,
`LAST_ACCESS` date DEFAULT NULL,
`ACTIVE` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `FK_ACCOUNT_ROLE_idx` (`ROLE_ID`),
CONSTRAINT `FK_ACCOUNT_ROLE` FOREIGN KEY (`ROLE_ID`) REFERENCES `role` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `account`
--
LOCK TABLES `account` WRITE;
/*!40000 ALTER TABLE `account` DISABLE KEYS */;
INSERT INTO `account` VALUES (1,'nbduc1996','nbduc1996@gmail.com','1234',1,NULL,NULL,1),(2,'ducit196','ducit196@gmail.com','1234',1,NULL,NULL,1),(3,'oco','oc','oc',1,'2018-01-01',NULL,0),(4,'dddd','ddd','dsd',2,NULL,NULL,NULL),(5,'dsdsd','dsdsdsd','sdsds',2,NULL,NULL,NULL),(6,'lam96','ocho123','1234',2,NULL,NULL,NULL);
/*!40000 ALTER TABLE `account` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `address`
--
DROP TABLE IF EXISTS `address`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `address` (
`ID` int(11) NOT NULL,
`SECTION` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`ROAD` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`TOWN` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`DISTRICT` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`CITY` varchar(45) COLLATE utf8_danish_ci DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_danish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `address`
--
LOCK TABLES `address` WRITE;
/*!40000 ALTER TABLE `address` DISABLE KEYS */;
INSERT INTO `address` VALUES (1,'7','Song Phuong','Hoai Duc','Ha Noi','Ha Noi');
/*!40000 ALTER TABLE `address` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `attribute`
--
DROP TABLE IF EXISTS `attribute`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `attribute` (
`ID` int(11) NOT NULL,
`NAME` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `attribute`
--
LOCK TABLES `attribute` WRITE;
/*!40000 ALTER TABLE `attribute` DISABLE KEYS */;
INSERT INTO `attribute` VALUES (1,'Color'),(2,'Size'),(3,'Weight');
/*!40000 ALTER TABLE `attribute` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `attribute_value`
--
DROP TABLE IF EXISTS `attribute_value`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `attribute_value` (
`ID` int(11) NOT NULL,
`NAME` varchar(45) DEFAULT NULL,
`ATTRIBUTE_ID` int(11) NOT NULL,
PRIMARY KEY (`ID`,`ATTRIBUTE_ID`),
KEY `fk_ATTRIBUTE_VALUE_ATTRIBUTE1_idx` (`ATTRIBUTE_ID`),
CONSTRAINT `fk_ATTRIBUTE_VALUE_ATTRIBUTE1` FOREIGN KEY (`ATTRIBUTE_ID`) REFERENCES `attribute` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `attribute_value`
--
LOCK TABLES `attribute_value` WRITE;
/*!40000 ALTER TABLE `attribute_value` DISABLE KEYS */;
INSERT INTO `attribute_value` VALUES (1,'Red',1),(2,'Green',1),(3,'Blue',1),(4,'Yellow',1),(5,'White',1),(6,'X',2),(7,'XL',2),(8,'XXL',2);
/*!40000 ALTER TABLE `attribute_value` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `category`
--
DROP TABLE IF EXISTS `category`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `category` (
`ID` int(11) NOT NULL,
`NAME` varchar(45) DEFAULT NULL,
`PARENT_CATEGORY_ID` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `fk_CATEGORY_CATEGORY_idx` (`PARENT_CATEGORY_ID`),
CONSTRAINT `fk_CATEGORY_CATEGORY` FOREIGN KEY (`PARENT_CATEGORY_ID`) REFERENCES `category` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `category`
--
LOCK TABLES `category` WRITE;
/*!40000 ALTER TABLE `category` DISABLE KEYS */;
INSERT INTO `category` VALUES (0,'Root',NULL),(1,'Điện thoại',0),(2,'Máy tính bảng',0),(3,'Laptop',0),(4,'Phụ kiện',0),(5,'Samsung galaxy',1),(6,'Zen phone',1),(7,'Iphone',1),(8,'Red mi',1),(9,'Ipad',2);
/*!40000 ALTER TABLE `category` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `coupon`
--
DROP TABLE IF EXISTS `coupon`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `coupon` (
`ID` int(11) NOT NULL,
`CODE` varchar(45) DEFAULT NULL,
`SALE` float DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` date DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `coupon`
--
LOCK TABLES `coupon` WRITE;
/*!40000 ALTER TABLE `coupon` DISABLE KEYS */;
/*!40000 ALTER TABLE `coupon` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `customer`
--
DROP TABLE IF EXISTS `customer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `customer` (
`ID` int(11) NOT NULL,
`FIRST_NAME` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`MIDDLE_NAME` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`LAST_NAME` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`GENDR` int(11) DEFAULT NULL,
`BIRTH_DAY` date DEFAULT NULL,
`PHONE` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`ACCOUNT_ID` int(11) DEFAULT NULL,
`ADDRESS_ID` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `fk_CUSTOMER_ACCOUNT1_idx` (`ACCOUNT_ID`),
KEY `fk_CUSTOMER_ADDRESS1_idx` (`ADDRESS_ID`),
CONSTRAINT `fk_CUSTOMER_ACCOUNT1` FOREIGN KEY (`ACCOUNT_ID`) REFERENCES `account` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_CUSTOMER_ADDRESS1` FOREIGN KEY (`ADDRESS_ID`) REFERENCES `address` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_danish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `customer`
--
LOCK TABLES `customer` WRITE;
/*!40000 ALTER TABLE `customer` DISABLE KEYS */;
INSERT INTO `customer` VALUES (1,'NGUYEN','BA','DUC',1,'2018-01-01','01245673',1,1),(2,'Nguyen','Viet','Lam',1,'2018-11-12','2534343',NULL,NULL);
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `employee`
--
DROP TABLE IF EXISTS `employee`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `employee` (
`ID` int(11) NOT NULL,
`FIRST_NAME` varchar(45) DEFAULT NULL,
`MIDDLE_NAME` varchar(45) DEFAULT NULL,
`LAST_NAME` varchar(45) DEFAULT NULL,
`GENDER` int(11) DEFAULT NULL,
`BIRTH_DAY` varchar(45) DEFAULT NULL,
`PHONE` varchar(45) DEFAULT NULL,
`SALARY` float DEFAULT NULL,
`ACCOUNT_ID` int(11) NOT NULL,
`ADDRESS_ID` int(11) NOT NULL,
PRIMARY KEY (`ID`),
KEY `fk_EMPLOYEE_ACCOUNT1_idx` (`ACCOUNT_ID`),
KEY `fk_EMPLOYEE_ADDRESS1_idx` (`ADDRESS_ID`),
CONSTRAINT `fk_EMPLOYEE_ACCOUNT1` FOREIGN KEY (`ACCOUNT_ID`) REFERENCES `account` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_EMPLOYEE_ADDRESS1` FOREIGN KEY (`ADDRESS_ID`) REFERENCES `address` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `employee`
--
LOCK TABLES `employee` WRITE;
/*!40000 ALTER TABLE `employee` DISABLE KEYS */;
/*!40000 ALTER TABLE `employee` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `manufacturer`
--
DROP TABLE IF EXISTS `manufacturer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `manufacturer` (
`ID` int(11) NOT NULL,
`NAME` varchar(45) DEFAULT NULL,
`IMAGE` varchar(45) DEFAULT NULL,
`DESCRIPTION` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `manufacturer`
--
LOCK TABLES `manufacturer` WRITE;
/*!40000 ALTER TABLE `manufacturer` DISABLE KEYS */;
INSERT INTO `manufacturer` VALUES (1,'Samsung',NULL,NULL),(2,'Apple',NULL,NULL),(3,'Xiaomi',NULL,NULL),(4,'Asus',NULL,NULL);
/*!40000 ALTER TABLE `manufacturer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `order`
--
DROP TABLE IF EXISTS `order`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `order` (
`ID` int(11) NOT NULL,
`DATE_ORDER` date DEFAULT NULL,
`PAYMENT_TYPE` int(11) DEFAULT NULL,
`STATUS` int(11) DEFAULT NULL,
`COUPON_ID` int(11) DEFAULT NULL,
`SHIPPING_ID` int(11) DEFAULT NULL,
`CUSTOMER_ID` int(11) NOT NULL,
`TAX_ID` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `fk_ORDER_COUPON1_idx` (`COUPON_ID`),
KEY `fk_ORDER_SHIPPING1_idx` (`SHIPPING_ID`),
KEY `fk_ORDER_CUSTOMER1_idx` (`CUSTOMER_ID`),
KEY `FK_ORDER_TAX_idx` (`TAX_ID`),
CONSTRAINT `FK_ORDER_TAX` FOREIGN KEY (`TAX_ID`) REFERENCES `tax` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_ORDER_COUPON1` FOREIGN KEY (`COUPON_ID`) REFERENCES `coupon` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_ORDER_CUSTOMER1` FOREIGN KEY (`CUSTOMER_ID`) REFERENCES `customer` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_ORDER_SHIPPING1` FOREIGN KEY (`SHIPPING_ID`) REFERENCES `shipping` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `order`
--
LOCK TABLES `order` WRITE;
/*!40000 ALTER TABLE `order` DISABLE KEYS */;
/*!40000 ALTER TABLE `order` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `order_detail`
--
DROP TABLE IF EXISTS `order_detail`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `order_detail` (
`ORDER_ID` int(11) NOT NULL,
`PRODUCT_ID` int(11) NOT NULL,
`ATTRIBUTE` varchar(45) DEFAULT NULL,
`QUANTITY` int(11) DEFAULT NULL,
PRIMARY KEY (`ORDER_ID`,`PRODUCT_ID`),
KEY `FK_ORDER_DETAIL_PRODUCT_idx` (`PRODUCT_ID`),
CONSTRAINT `FK_ORDER_DETAIL_ORDER` FOREIGN KEY (`ORDER_ID`) REFERENCES `order` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_ORDER_DETAIL_PRODUCT` FOREIGN KEY (`PRODUCT_ID`) REFERENCES `product` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `order_detail`
--
LOCK TABLES `order_detail` WRITE;
/*!40000 ALTER TABLE `order_detail` DISABLE KEYS */;
/*!40000 ALTER TABLE `order_detail` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `product`
--
DROP TABLE IF EXISTS `product`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product` (
`ID` int(11) NOT NULL,
`NAME` varchar(45) DEFAULT NULL,
`DESCRIPTION` varchar(45) DEFAULT NULL,
`THUMBAI` varchar(45) DEFAULT NULL,
`PRICE` float DEFAULT NULL,
`LENGTH` float DEFAULT NULL,
`WIDTH` float DEFAULT NULL,
`HEIGHT` float DEFAULT NULL,
`MANUFACTURER_ID` int(11) NOT NULL,
`CATEGORY_ID` int(11) NOT NULL,
PRIMARY KEY (`ID`),
KEY `fk_PRODUCT_MANUFACTURER1_idx` (`MANUFACTURER_ID`),
KEY `fk_PRODUCT_CATEGORY1_idx` (`CATEGORY_ID`),
CONSTRAINT `fk_PRODUCT_CATEGORY1` FOREIGN KEY (`CATEGORY_ID`) REFERENCES `category` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_PRODUCT_MANUFACTURER1` FOREIGN KEY (`MANUFACTURER_ID`) REFERENCES `manufacturer` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `product`
--
LOCK TABLES `product` WRITE;
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` VALUES (1,'Galaxynote8','a','images/home/product4.jpg',12,1,1,1,1,5),(2,'Galaxynote9','b','images/home/product1.jpg',34,1,1,1,1,5),(3,'Galaxy j7 prime','c','images/home/product2.jpg',12,1,1,1,1,5),(4,'Galaxy j3 prime','d','images/home/product3.jpg',23,1,1,1,1,5),(5,'Galaxy j1 pro','e','images/home/product1.jpg',34,1,1,1,1,6);
/*!40000 ALTER TABLE `product` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `product_attribute`
--
DROP TABLE IF EXISTS `product_attribute`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product_attribute` (
`ID` int(11) NOT NULL,
`PRODUCT_ID` int(11) NOT NULL,
`ATTRIBUTE_VALUE_ID` int(11) NOT NULL,
`AMOUNT` int(11) DEFAULT NULL,
`ADDITIONAL_PRICE` float DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `fk_PRODUCT_ATTRIBUTE_ATTRIBUTE_VALUE1_idx` (`ATTRIBUTE_VALUE_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `product_attribute`
--
LOCK TABLES `product_attribute` WRITE;
/*!40000 ALTER TABLE `product_attribute` DISABLE KEYS */;
INSERT INTO `product_attribute` VALUES (1,1,1,1,123.5),(2,1,2,1,234.3);
/*!40000 ALTER TABLE `product_attribute` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `product_review`
--
DROP TABLE IF EXISTS `product_review`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product_review` (
`ID` int(11) NOT NULL,
`REVIEW_RATING` int(11) DEFAULT NULL,
`REVIEW_DATE` date DEFAULT NULL,
`REVIEW_CONTENT` varchar(45) DEFAULT NULL,
`PRODUCT_ID` int(11) NOT NULL,
`CUSTOMER_ID` int(11) NOT NULL,
PRIMARY KEY (`ID`),
KEY `fk_PRODUCT_REVIEW_PRODUCT1_idx` (`PRODUCT_ID`),
KEY `fk_PRODUCT_REVIEW_CUSTOMER1_idx` (`CUSTOMER_ID`),
CONSTRAINT `fk_PRODUCT_REVIEW_CUSTOMER1` FOREIGN KEY (`CUSTOMER_ID`) REFERENCES `customer` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_PRODUCT_REVIEW_PRODUCT1` FOREIGN KEY (`PRODUCT_ID`) REFERENCES `product` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `product_review`
--
LOCK TABLES `product_review` WRITE;
/*!40000 ALTER TABLE `product_review` DISABLE KEYS */;
/*!40000 ALTER TABLE `product_review` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `role`
--
DROP TABLE IF EXISTS `role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role` (
`ID` int(11) NOT NULL,
`ROLE` int(11) DEFAULT NULL,
`DESCRIPTION` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `role`
--
LOCK TABLES `role` WRITE;
/*!40000 ALTER TABLE `role` DISABLE KEYS */;
INSERT INTO `role` VALUES (1,1,'Customer'),(2,2,'Admin');
/*!40000 ALTER TABLE `role` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `shipping`
--
DROP TABLE IF EXISTS `shipping`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shipping` (
`ID` int(11) NOT NULL,
`SHIPPING_TYPE` int(11) DEFAULT NULL,
`SHIPPING_COST` float DEFAULT NULL,
`ADDRESS_ID` int(11) NOT NULL,
PRIMARY KEY (`ID`),
KEY `fk_SHIPPING_ADDRESS1_idx` (`ADDRESS_ID`),
CONSTRAINT `fk_SHIPPING_ADDRESS1` FOREIGN KEY (`ADDRESS_ID`) REFERENCES `address` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `shipping`
--
LOCK TABLES `shipping` WRITE;
/*!40000 ALTER TABLE `shipping` DISABLE KEYS */;
/*!40000 ALTER TABLE `shipping` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `shopping_cart`
--
DROP TABLE IF EXISTS `shopping_cart`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shopping_cart` (
`ID` int(11) NOT NULL,
`CREATE_ON` date DEFAULT NULL,
`STATUS` int(11) DEFAULT NULL,
`CUSTOMER_ID` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `FK_SHOPPING_CART_PRODUCT_idx` (`CUSTOMER_ID`),
CONSTRAINT `FK_SHOPPING_CART_PRODUCT` FOREIGN KEY (`CUSTOMER_ID`) REFERENCES `product` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `shopping_cart`
--
LOCK TABLES `shopping_cart` WRITE;
/*!40000 ALTER TABLE `shopping_cart` DISABLE KEYS */;
/*!40000 ALTER TABLE `shopping_cart` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `shopping_cart_detail`
--
DROP TABLE IF EXISTS `shopping_cart_detail`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shopping_cart_detail` (
`SHOPPING_CART_ID` int(11) NOT NULL,
`PRODUCT_ID` int(11) NOT NULL,
`ATTRIBUTE` varchar(45) DEFAULT NULL,
`QUANTITY` int(11) DEFAULT NULL,
PRIMARY KEY (`SHOPPING_CART_ID`,`PRODUCT_ID`),
KEY `FK_SHOPPING_CART_DETAIL_PRODUCT_idx` (`PRODUCT_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `shopping_cart_detail`
--
LOCK TABLES `shopping_cart_detail` WRITE;
/*!40000 ALTER TABLE `shopping_cart_detail` DISABLE KEYS */;
/*!40000 ALTER TABLE `shopping_cart_detail` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tax`
--
DROP TABLE IF EXISTS `tax`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tax` (
`ID` int(11) NOT NULL,
`TYPE` varchar(45) DEFAULT NULL,
`PERCENTAGE` float DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tax`
--
LOCK TABLES `tax` WRITE;
/*!40000 ALTER TABLE `tax` DISABLE KEYS */;
/*!40000 ALTER TABLE `tax` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping routines for database 'mobileonline'
--
/*!50003 DROP PROCEDURE IF EXISTS `PROC_ACCOUNT_CHECK_LOGIN` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_ACCOUNT_CHECK_LOGIN`(
IN USERNAME varchar(45),
IN PASSWORD varchar(45)
)
BEGIN
SELECT *
FROM ACCOUNT
WHERE ACCOUNT.USERNAME = USERNAME AND ACCOUNT.PASSWORD = PASSWORD AND ACCOUNT.ACTIVE = 1;
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 `PROC_ACCOUNT_INSERT` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_ACCOUNT_INSERT`(
IN ID INT,
IN USERNAME VARCHAR(45),
IN EMAIL VARCHAR(45),
IN PASSWORD VARCHAR(45),
IN ROLE_ID INT,
IN CREATE_TIME DATE,
IN ACTIVE INT
)
BEGIN
INSERT INTO ACCOUNT(ACCOUNT.ID, ACCOUNT.USERNAME, ACCOUNT.EMAIL, ACCOUNT.PASSWORD,
ACCOUNT.ROLE_ID, ACCOUNT.CREATE_TIME, ACCOUNT.ACTIVE)
VALUES(ID, USERNAME, EMAIL, PASSWORD, ROLE_ID, CREATE_TIME, ACTIVE);
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 `PROC_ACCOUNT_SELECT_ALL` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_ACCOUNT_SELECT_ALL`()
BEGIN
SELECT * FROM ACCOUNT;
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 `PROC_ACCOUNT_SELECT_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_ACCOUNT_SELECT_BY_ID`(
IN ID INT
)
BEGIN
SELECT * FROM ACCOUNT WHERE ACCOUNT.ID = ID;
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 `PROC_ADDRESS_SELECT_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_ADDRESS_SELECT_BY_ID`(
IN ADDRESS_ID INT
)
BEGIN
SELECT *
FROM ADDRESS
WHERE ADDRESS.ID = ADDRESS_ID;
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 `PROC_ATTRIBUTE_SELECT_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_ATTRIBUTE_SELECT_BY_ID`(
IN ID INT
)
BEGIN
SELECT *
FROM ATTRIBUTE
WHERE ATTRIBUTE.ID = ID;
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 `PROC_ATTRIBUTE_VALUE_SELECT_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_ATTRIBUTE_VALUE_SELECT_BY_ID`(
IN ID INT
)
BEGIN
SELECT *
FROM ATTRIBUTE_VALUE
WHERE ATTRIBUTE_VALUE.ID = ID;
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 `PROC_CATEGORY_SELECT_ALL_CHILDREN_BY_PARENT` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_CATEGORY_SELECT_ALL_CHILDREN_BY_PARENT`(
IN PARENT_ID INT
)
BEGIN
SELECT *
FROM CATEGORY
WHERE PARENT_CATEGORY_ID = PARENT_ID;
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 `PROC_CATEGORY_SELECT_ALL_PARENT_CATEGORY` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_CATEGORY_SELECT_ALL_PARENT_CATEGORY`()
BEGIN
SELECT *
FROM CATEGORY
WHERE PARENT_CATEGORY_ID = '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 */ ;
/*!50003 DROP PROCEDURE IF EXISTS `PROC_CATEGORY_SELECT_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_CATEGORY_SELECT_BY_ID`(
IN ID INT
)
BEGIN
SELECT *
FROM CATEGORY
WHERE CATEGORY.ID = ID;
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 `PROC_CUSTOMER_SELECT_BY_ACCOUNT_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_CUSTOMER_SELECT_BY_ACCOUNT_ID`(
IN ACCOUNT_ID INT
)
BEGIN
SELECT *
FROM CUSTOMER
WHERE CUSTOMER.ACCOUNT_ID = ACCOUNT_ID;
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 `PROC_CUSTOMER_SELECT_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_CUSTOMER_SELECT_BY_ID`(
IN CUSTOMER_ID INT
)
BEGIN
SELECT *
FROM CUSTOMER
WHERE CUSTOMER.ID = CUSTOMER_ID;
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 `PROC_MANUFACTURER_GET_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_MANUFACTURER_GET_BY_ID`(
IN ID INT
)
BEGIN
SELECT *
FROM MANUFACTURER
WHERE MANUFACTURER.ID = ID;
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 `PROC_PRODUCT_ATTRIBUTE_SELECT_BY_PRODUCT_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_PRODUCT_ATTRIBUTE_SELECT_BY_PRODUCT_ID`(
IN PRODUCT_ID INT
)
BEGIN
SELECT *
FROM PRODUCT_ATTRIBUTE
WHERE PRODUCT_ATTRIBUTE.PRODUCT_ID = PRODUCT_ID;
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 `PROC_PRODUCT_SELECT_BY_CATEGORY` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_PRODUCT_SELECT_BY_CATEGORY`(
IN CATEGORY_ID INT
)
BEGIN
SELECT *
FROM PRODUCT
WHERE PRODUCT.CATEGORY_ID = CATEGORY_ID;
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 `PROC_PRODUCT_SELECT_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_PRODUCT_SELECT_BY_ID`(
IN ID INT
)
BEGIN
SELECT *
FROM PRODUCT
WHERE PRODUCT.ID = ID;
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 `PROC_ROLE_SELECT_BY_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_ROLE_SELECT_BY_ID`(
IN ID INT
)
BEGIN
SELECT * FROM ROLE WHERE ROLE.ID = ID;
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 `PROC_SELECT_BY_ACCOUNT_ID` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_SELECT_BY_ACCOUNT_ID`(
IN ACCOUNT_ID INT
)
BEGIN
SELECT *
FROM CUSTOMER
WHERE CUSTOMER.ACCOUNT_ID = ACCOUNT_ID;
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 `PROC_SHOPPING_CART_DETAIL_INSERT` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_SHOPPING_CART_DETAIL_INSERT`(
IN SHOPPING_CART_ID INT,
IN PRODUCT_ID INT,
IN ATTRIBUTE VARCHAR(45),
IN QUANTITY INT
)
BEGIN
INSERT
INTO SHOPPING_CART_DETAIL
VALUES (SHOPPING_CART_ID, PRODUCT_ID, ATTRIBUTE, QUANTITY);
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 `PROC_SHOPPING_CART_INSERT` */;
/*!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 ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PROC_SHOPPING_CART_INSERT`(
IN ID INT,
IN CREATE_ON DATE,
IN _STATUS INT,
IN CUSTOMER_ID INT
)
BEGIN
INSERT
INTO SHOPPING_CART
VALUES(ID, CREATE_ON, _STATUS, CUSTOMER_ID);
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 2018-04-13 14:16:05
|
/*
Name: Home Hero Impressions by Branch june 21
Data source: 4
Created By: Admin
Last Update At: 2016-06-23T17:49:16.740839+00:00
*/
SELECT H_Lis.marketingGroup_name AS Marketing_group,
H_Lis.brokerage_name AS Brokerage,
nvl(H_Lis.agent_name,"--") AS Agent,
H_Lis.branch_name AS Branch,
H_Lis.Listing_id AS Listing_id,
nvl(H_Lis.listing_address,H_Lis_address.street_address) AS Listing_address,
count(*) AS Impressions
FROM
(SELECT post_prop34,
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal, " month(TIMESTAMP(CONCAT(REPLACE(table_id,"_","-"),"-01"))) >= month(DATE('{{startdate}}')) and month(TIMESTAMP(CONCAT(REPLACE(table_id,"_","-"),"-01"))) <= month(DATE('{{enddate}}')) "))
WHERE DATE(date_time) >= DATE('{{startdate}}')
AND DATE(date_time) <= DATE('{{enddate}}')
AND date(date_time) >= date('2016-05-04')
AND post_prop33 = 'MG_HomeHero_Impressions') v
LEFT OUTER JOIN [djomniture:devspark.MG_Hierarchy_Listing] AS H_Lis ON H_Lis.listing_id = v.post_prop34
LEFT OUTER JOIN [djomniture:devspark.MG_Listing_Address] AS H_Lis_address ON H_Lis.listing_id = H_Lis_address.id
WHERE H_Lis.branch_id = '{{branch_id}}'
AND H_Lis.brokerage_id = '{{brokerage_id}}'
AND H_Lis.marketingGroup_id = '{{mgid}}'
GROUP BY Branch,
Agent,
Listing_address,
Marketing_group,
Listing_id,
Brokerage
ORDER BY Impressions DESC
|
{% macro ref(model_name) %}
{% set dbt_model_test_enabled = env_var('DBT_MODEL_TEST_ENABLED', False) %}
{% set dbt_model_test_identifier_prefix = env_var('DBT_MODEL_TEST_IDENTIFIER_PREFIX', '') %}
{{ log("Running custom:ref " ~ model_name) }}
{% if dbt_model_test_enabled == '1' %}
{{ log("DBT_MODEL_TEST: model test enabled") }}
{% set rel = builtins.ref(model_name) %}
{%
set newrel = rel.replace_path(
identifier=dbt_model_test_identifier_prefix + model_name
)
%}
{% do return(newrel) %}
{% else %}
{{ log("DBT_MODEL_TEST: model test disabled") }}
{% do return(builtins.ref(model_name)) %}
{% endif %}
{% endmacro %}
{% macro source(source_name, table_name) %}
{% set dbt_model_test_enabled = env_var('DBT_MODEL_TEST_ENABLED', False) %}
{% set dbt_model_test_database = env_var('DBT_MODEL_TEST_DATABASE', '') %}
{% set dbt_model_test_schema = env_var('DBT_MODEL_TEST_SCHEMA', '') %}
{% set dbt_model_test_identifier_prefix = env_var('DBT_MODEL_TEST_IDENTIFIER_PREFIX', '') %}
{{ log("Running custom:source " ~ source_name ~ "." ~ table_name) }}
{% if dbt_model_test_enabled == '1' %}
{{ log("DBT_MODEL_TEST: model test enabled") }}
{% set rel = builtins.source(source_name, table_name) %}
{%
set newrel = rel.replace_path(
database=dbt_model_test_database,
schema=dbt_model_test_schema,
identifier=dbt_model_test_identifier_prefix + table_name
)
%}
{% do return(newrel) %}
{% else %}
{{ log("DBT_MODEL_TEST: model test disabled") }}
{% do return(builtins.source(source_name, table_name)) %}
{% endif %}
{% endmacro %}
|
DROP procedure IF EXISTS `bsp_editar_cliente`;
DELIMITER $$
CREATE PROCEDURE `bsp_editar_cliente`(
pIdCliente int,
pApellidos varchar(60),
pNombres varchar(60),
pDNI int(11),
pFechaNac date,
pEmail varchar(50),
pTelefono varchar(30),
pDireccion varchar(45),
pCiudad varchar(45),
pProvincia varchar(45),
pSexo CHAR(1),
pComentarios varchar(255)
)
SALIR:BEGIN
/*
Permite modificar un cliente existente.
Devuelve 1 o el mensaje de error en Mensaje.
*/
-- Manejo de error en la transacción
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
SHOW ERRORS;
-- SELECT 'Error en la transacción. Contáctese con el administrador.' Mensaje;
ROLLBACK;
END;
-- Controla que no exista un documento con el mismo numero
IF NOT EXISTS(SELECT IdCliente FROM clientes WHERE IdCliente = pIdCliente) THEN
SELECT 'Cliente inexistente' AS Mensaje;
LEAVE SALIR;
END IF;
START TRANSACTION;
UPDATE Personas SET Apellidos = pApellidos WHERE IdPersona = pIdCliente;
UPDATE Personas SET Nombres = pNombres WHERE IdPersona = pIdCliente;
UPDATE Personas SET DNI = pDNI WHERE IdPersona = pIdCliente;
UPDATE Personas SET FechaNac = pFechaNac WHERE IdPersona = pIdCliente;
UPDATE Personas SET Email = pEmail WHERE IdPersona = pIdCliente;
UPDATE Personas SET Telefono = pTelefono WHERE IdPersona = pIdCliente;
UPDATE Personas SET Direccion = pDireccion WHERE IdPersona = pIdCliente;
UPDATE Personas SET Ciudad = pCiudad WHERE IdPersona = pIdCliente;
UPDATE Personas SET Provincia = pProvincia WHERE IdPersona = pIdCliente;
UPDATE Personas SET Sexo = pSexo WHERE IdPersona = pIdCliente;
UPDATE Personas SET EstadoPer = pEstadoPer WHERE IdPersona = pIdCliente;
UPDATE Personas SET Comentarios = pComentarios WHERE IdPersona = pIdCliente;
SELECT 'Ok';
COMMIT;
END$$
DELIMITER ; |
/*
Navicat MySQL Data Transfer
Source Server : charles
Source Server Version : 50534
Source Host : localhost:3306
Source Database : test
Target Server Type : MYSQL
Target Server Version : 50534
File Encoding : 65001
Date: 2014-07-05 12:09:41
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`id` smallint(6) NOT NULL AUTO_INCREMENT,
`role_name` varchar(10) NOT NULL,
`role_level` smallint(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=gbk;
-- ----------------------------
-- Records of role
-- ----------------------------
INSERT INTO `role` VALUES ('1', 'admin', '0');
INSERT INTO `role` VALUES ('2', 'superuser', '1');
INSERT INTO `role` VALUES ('3', 'visitor', '2');
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` smallint(6) NOT NULL AUTO_INCREMENT,
`name` varchar(10) NOT NULL,
`passwd` varchar(20) NOT NULL,
`role_id` smallint(6) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `pk_user_role` (`role_id`),
CONSTRAINT `pk_user_role` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=gbk;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('6', 'admin', 'admin', '1');
INSERT INTO `user` VALUES ('7', 'admin', 'admin', '1');
INSERT INTO `user` VALUES ('8', 'admin', 'admin', '1');
INSERT INTO `user` VALUES ('9', 'admin', 'admin', '1');
INSERT INTO `user` VALUES ('10', 'admin', 'admin', '1');
INSERT INTO `user` VALUES ('11', 'admin', 'admin', '1');
|
USE test;
INSERT INTO login (username) VALUES ('jean.dupond@gmail.com');
|
USE ECommerce;
INSERT INTO Lojas (NomeLoja)
VALUES ('SENAI Store');
INSERT INTO Categorias (NomeCategoria, IDLoja)
VALUES ('Cursos', 1), ('Acessórios', 1);
INSERT INTO Subcategorias (NomeSubcategoria, IDCategoria)
VALUES ('Informática Básica', 1), ('Desenvolvimento', 1), ('Meio Ambiente', 2);
INSERT INTO Produtos (NomeProduto, Valor, IDSubcategoria)
VALUES ('Excel Básico', 400, 1) , ('CSharp Médio', 500, 1), ('Jaqueta', 100, 2);
INSERT INTO Clientes (NomeCliente)
VALUES ('Matheus'), ('Dioguera');
INSERT INTO Pedidos (NrPedido, DataPedido, StatusPedido, IDCliente)
VALUES (5365, '03/02/2020', 'Em Andamento', 1), (2425, '02/02/2020', 'Entregue', 2)
INSERT INTO PedidosProdutos (IDPedido, IDProduto)
VALUES (1, 2), (2, 1); |
--
-- PostgreSQL database dump
--
-- Dumped from database version 10.4
-- Dumped by pg_dump version 10.4
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: alumno_tbl; Type: TABLE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.alumno_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.alumno_id_seq OWNER TO postgres;
CREATE TABLE public.alumno_tbl (
id integer DEFAULT nextval('public.alumno_id_seq'::regclass) NOT NULL,
name character varying(30) NOT NULL,
lastname character varying(30) NOT NULL,
dni integer NOT NULL,
afiliado integer,
dateadded date,
domicilio character varying(50),
telefono numeric,
celular numeric,
estadocivil character varying(25),
grupofliar integer,
estudios character varying(35),
area character varying(35),
funcion character varying(35),
categoria character varying(35),
agrupamiento character varying(35)
);
ALTER TABLE public.alumno_tbl OWNER TO postgres;
--
-- Name: alumno_tbl_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
--
-- Name: alumno_tbl_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
--
-- Name: comprobante_tbl; Type: TABLE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.comprobante_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.comprobante_id_seq OWNER TO postgres;
CREATE TABLE public.comprobante_tbl (
id integer DEFAULT nextval('public.comprobante_id_seq'::regclass) NOT NULL,
legajo integer NOT NULL,
concept text NOT NULL,
unit_amount numeric NOT NULL,
total_amount numeric NOT NULL,
id_alumno integer NOT NULL,
estado integer DEFAULT 0,
dateadded date,
datepayed date,
novedad text
);
ALTER TABLE public.comprobante_tbl OWNER TO postgres;
--
-- Name: comprobante_tbl_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
--
-- Name: comprobante_tbl_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
--
-- Name: config_tbl; Type: TABLE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.config_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.config_id_seq OWNER TO postgres;
CREATE TABLE public.config_tbl (
id integer DEFAULT nextval('public.config_id_seq'::regclass) NOT NULL,
valorcuota integer,
cuenta integer
);
ALTER TABLE public.config_tbl OWNER TO postgres;
--
-- Name: config_tbl_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
--
-- Name: config_tbl_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
--
-- Name: user_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.user_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.user_id_seq OWNER TO postgres;
--
-- Name: user_tbl; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.user_tbl (
id integer DEFAULT nextval('public.user_id_seq'::regclass) NOT NULL,
username character varying(15) NOT NULL,
password text NOT NULL,
email character varying(30) NOT NULL,
type character varying(15) NOT NULL
);
ALTER TABLE public.user_tbl OWNER TO postgres;
--
-- Name: alumno_tbl id; Type: DEFAULT; Schema: public; Owner: postgres
--
--
-- PostgreSQL database dump complete
--
|
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM SELECT on dba_ tables
REM ------------------------------------------------------------------------
REM PURPOSE:
REM Show tablespace files
REM ------------------------------------------------------------------------
set linesize 80
set pages 100
set feedback off
col tablespace_name for a15 head "TS Name"
col file_name for a50 head "File Name"
col free_space for 9,999.99 head "Free MB"
col MB for 9,999 head "Tot|(MB)"
break on tablespace_name skip 1
compute sum of MB on tablespace_name
SELECT ddf.tablespace_name, file_name, (sum(dfs.bytes)/1024/1024) free_space,
(ddf.bytes/1024/1024) MB
FROM dba_data_files ddf, dba_free_space dfs
WHERE ddf.file_id=dfs.file_id (+)
GROUP BY ddf.tablespace_name, file_name, ddf.bytes
ORDER BY ddf.tablespace_name
;
prompt
exit
|
INSERT INTO solution_type(solution_type_id, description, title) VALUES (0, 'Builder', 'Builder');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (1, 'Bricklayer', 'Bricklayer');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (2, 'Carpet Fitter', 'Carpet Fitter');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (3, 'Caterer', 'Caterer');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (4, 'Chimney Sweep', 'Chimney Sweep');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (5, 'Cleaner', 'Cleaner');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (6, 'Electrician', 'Electrician');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (7, 'Gardener', 'Gardener');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (8, 'Glazier', 'Glazier');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (9, 'Joiner', 'Joiner');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (10, 'Kitchen Fitter', 'Kitchen Fitter');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (11, 'Landscape Gardener', 'Landscape Gardener');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (12, 'Locksmith', 'Locksmith');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (13, 'Painter and Decorator', 'Painter and Decorator');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (14, 'Plasterer', 'Plasterer');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (15, 'Plumber', 'Plumber');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (16, 'Printer', 'Printer');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (17, 'Roofer', 'Roofer');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (18, 'Tiler', 'Tiler');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (19, 'Tree Surgeon', 'Tree Surgeon');
INSERT INTO solution_type(solution_type_id, description, title) VALUES (20, 'Window Cleaner', 'Window Cleaner');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (21, 'Baker', 'Baker');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (22, 'Hairstylist', 'Hairstylist');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (23, 'Bartender', 'Bartender');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (24, 'Blacksmith', 'Blacksmith');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (25, 'Pastry chef', 'Pastry chef');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (26, 'Piano tuner', 'Piano tuner');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (27, 'Steeplejack', 'Steeplejack');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (28, 'Stonemason', 'Stonemason');
-- INSERT INTO solution_type(solution_type_id, description, title) VALUES (29, 'Welder', 'Welder');
/* solution_task_type */
INSERT INTO solution_task_type(solution_task_type_id, description, title, solution_type_id) VALUES (50, 'Test', 'Task Type #1', 0);
INSERT INTO solution_task_type(solution_task_type_id, description, title, solution_type_id) VALUES (51, 'Test', 'Task Type #2', 0);
INSERT INTO solution_task_type(solution_task_type_id, description, title, solution_type_id) VALUES (52, 'Test', 'Task Type #3', 0);
INSERT INTO solution_task_type(solution_task_type_id, description, title, solution_type_id) VALUES (60, 'Test', 'Test Task Type #1', 1);
INSERT INTO solution_task_type(solution_task_type_id, description, title, solution_type_id) VALUES (61, 'Test', 'Test Task Type #2', 1);
INSERT INTO solution_task_type(solution_task_type_id, description, title, solution_type_id) VALUES (62, 'Test', 'Test Task Type #3', 1);
/* solution_task_job_type */
INSERT INTO solution_task_job_type(solution_task_job_type_id, description, title, solution_task_type_id) VALUES (60, 'Test', 'Test', 50);
INSERT INTO solution_task_job_type(solution_task_job_type_id, description, title, solution_task_type_id) VALUES (61, 'Test', 'Test', 50);
INSERT INTO solution_task_job_type(solution_task_job_type_id, description, title, solution_task_type_id) VALUES (62, 'Test', 'Test', 50);
INSERT INTO solution_task_job_type(solution_task_job_type_id, description, title, solution_task_type_id) VALUES (70, 'Test', 'Test', 60);
INSERT INTO solution_task_job_type(solution_task_job_type_id, description, title, solution_task_type_id) VALUES (71, 'Test', 'Test', 60);
INSERT INTO solution_task_job_type(solution_task_job_type_id, description, title, solution_task_type_id) VALUES (72, 'Test', 'Test', 60);
|
REGISTRATION:
-------------
CREATE TABLE ADMINS
(
ADMIN_ID BIGINT(10) NOT NULL,
EMAIL_ID VARCHAR(50) NOT NULL,
PWD VARCHAR(50) NOT NULL,
STATUS INT(1) NOT NULL,
IS_FTL INT(1) NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT ADMINS_PK PRIMARY KEY (ADMIN_ID),
CONSTRAINT ADMINS_EMAILID_UNIQUE UNIQUE (EMAIL_ID)
);
CREATE TABLE ADMIN_DETAILS
(
ADMIN_NAME VARCHAR(25) NOT NULL,
ADMIN_MOBILE VARCHAR(10) NOT NULL,
OFFICE_LANDLINE VARCHAR(15) NULL,
ADMIN_ADDRESS VARCHAR(100) NULL,
ADMIN_ST_OR_UT INT(4) NOT NULL,
GSTIN_NO VARCHAR(20) NOT NULL,
EFFECTIVE_DATE BIGINT NULL,
CREATED_BY BIGINT(10) NOT NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT ADMIN_DETAILS_PK PRIMARY KEY (CREATED_BY),
CONSTRAINT ADMIN_DETAILS_STORUT_FK FOREIGN KEY (ADMIN_ST_OR_UT) REFERENCES STATES_AND_UT_ENUM(ID)
);
CREATE TABLE ACCOUNT_ACTIVATION (
ADMIN_ID BIGINT(10) NOT NULL,
REQUEST_TYPE INT(1) NOT NULL,
ACTIVATION_CODE VARCHAR(50) NOT NULL,
CREATED_DATE BIGINT NULL,
CONSTRAINT ACCOUNT_ACTIVATION_PK PRIMARY KEY (ADMIN_ID,REQUEST_TYPE)
);
CREATE TABLE USER_DETAILS (
USER_ID BIGINT(10) NOT NULL,
PWD VARCHAR(50) NOT NULL,
USER_NAME VARCHAR(25) NOT NULL,
USER_MOBILE VARCHAR(10) NOT NULL,
USER_ADDRESS VARCHAR(100) NOT NULL,
USER_EMAIL VARCHAR(50) NULL,
STATUS INT(1) NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT USER_DETAILS_PK PRIMARY KEY (USER_ID)
);
ALTER TABLE USER_DETAILS MODIFY COLUMN USER_ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE USER_DETAILS AUTO_INCREMENT=1000001;
alter table user_details change id USER_ID BIGINT(10) NOT NULL;
SELECT * FROM USER_DETAILS WHERE CREATED_BY=1212121212 AND DELETED=0;
select * from user_details;
update user_details set status =1 where user_id=111111;
-------------
CREATE TABLE CVO_DATA (
ID BIGINT(10) NOT NULL,
CVO_NAME VARCHAR(50) NOT NULL,
CVO_ADDRESS VARCHAR(100) NOT NULL,
CVO_CONTACT VARCHAR(15) NOT NULL,
CVO_CAT INT(1) NOT NULL,
IS_GST_REG INT(1) NOT NULL,
CVO_TIN VARCHAR(20) NULL,
CVO_EMAIL VARCHAR(50) NULL,
CVO_PAN VARCHAR(15) NULL,
OBAL VARCHAR(13) NOT NULL,
CBAL VARCHAR(13) NOT NULL,
EBAL VARCHAR(13) NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT CVO_DATA_PK PRIMARY KEY (ID)
);
ALTER TABLE CVO_DATA MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE CVO_DATA AUTO_INCREMENT=1000001;
SELECT * FROM CVO_DATA;
CREATE TABLE CVO_BALANCE_DATA (
ID BIGINT(10) NOT NULL AUTO_INCREMENT,
REF_ID BIGINT(10) NOT NULL,
CVOFLAG INT(1) NOT NULL,
INV_REF_NO VARCHAR(30) NOT NULL,
INV_DATE BIGINT(20) NOT NULL,
TRANS_TYPE INT(1) NOT NULL,
CVO_CAT INT(1) NOT NULL,
CVO_REFID BIGINT(10) NOT NULL,
AMOUNT VARCHAR(13) NOT NULL,
CBAL_AMOUNT VARCHAR(20) NOT NULL,
DISCOUNT VARCHAR(10) NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT CVO_BALANCE_DATA_PK PRIMARY KEY (ID)
);
SELECT * FROM CVO_BALANCE_DATA;
CREATE TABLE BANK_DATA (
ID BIGINT(10) NOT NULL,
BANK_CODE VARCHAR(20) NULL,
BANK_NAME VARCHAR(25) NOT NULL,
BANK_ACC_NO VARCHAR(20) NOT NULL,
BANK_BRANCH VARCHAR(50) NULL,
BANK_IFSC_CODE VARCHAR(15) NULL,
ACC_OB DECIMAL(13,2) NOT NULL,
ACC_CB DECIMAL(13,2) NOT NULL,
BANK_ADDR VARCHAR(250) NULL,
OD_AND_LOAN_ACCEPTABLE_BAL VARCHAR(13) NOT NULL DEFAULT "NA",
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT BANK_DATA_PK PRIMARY KEY (ID)
);
ALTER TABLE BANK_DATA MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE BANK_DATA AUTO_INCREMENT=1000001;
SELECT * FROM BANK_DATA;
CREATE TABLE FLEET_DATA (
ID BIGINT(10) NOT NULL,
VEHICLE_NO VARCHAR(10) NOT NULL,
VEHICLE_MAKE VARCHAR(25) NOT NULL,
VEHICLE_TYPE INT(1) NOT NULL,
VEHICLE_USUAGE INT(1) NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT FLEET_DATA_PK PRIMARY KEY (ID)
);
ALTER TABLE FLEET_DATA MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE FLEET_DATA AUTO_INCREMENT=1000001;
SELECT * FROM FLEET_DATA ;
UPDATE FLEET_DATA SET CREATED_BY=1212121212 WHERE ID=1000001;
SELECT * FROM STAFF_DATA;
CREATE TABLE QUOTATIONS (
ID BIGINT NOT NULL,
SR_NO VARCHAR(30) NOT NULL,
QTN_DATE BIGINT NOT NULL,
CUSTOMER_ID BIGINT NOT NULL,
STAFF_ID BIGINT NOT NULL,
QTN_AMOUNT VARCHAR(13) NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT QUOTATIONS_PK PRIMARY KEY (ID)
);
ALTER TABLE QUOTATIONS MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE QUOTATIONS AUTO_INCREMENT=1000001;
CREATE TABLE QUOTATION_DETAILS (
ID BIGINT(10) NOT NULL,
QTN_ID BIGINT NOT NULL,
JOB_ID VARCHAR(25) NOT NULL,
PI_NUMBER BIGINT(10) NOT NULL,
BILL_NUMBER BIGINT(10) NOT NULL,
PROD_CODE BIGINT(10) NOT NULL,
RAW_MATERIALS INT(4) NOT NULL,
QUANTITY INT(5) NOT NULL,
UNIT_TYPE INT(1) NOT NULL,
UNIT_RATE VARCHAR(8) NOT NULL,
DISC_UNIT_RATE VARCHAR(8) NOT NULL,
BASIC_AMOUNT VARCHAR(10) NOT NULL,
CUSTOMER_FILENAME VARCHAR(25) NOT NULL,
IGST_AMOUNT VARCHAR(10) NOT NULL,
SGST_AMOUNT VARCHAR(10) NOT NULL,
CGST_AMOUNT VARCHAR(10) NOT NULL,
PROD_AMOUNT VARCHAR(10) NOT NULL,
FOOT_NOTES VARCHAR(100) NOT NULL,
VATP VARCHAR(5) NOT NULL,
CONSTRAINT QUOTATION_DETAILS_PK PRIMARY KEY (ID),
CONSTRAINT QUOTATION_DETAILS_FK FOREIGN KEY (QTN_ID) REFERENCES QUOTATIONS(ID)
);
ALTER TABLE QUOTATION_DETAILS MODIFY COLUMN JOB_ID VARCHAR(25) null;
ALTER TABLE QUOTATION_DETAILS MODIFY COLUMN PI_NUMBER BIGINT(10) null;
ALTER TABLE QUOTATION_DETAILS MODIFY COLUMN BILL_NUMBER BIGINT(10) NULL;
ALTER TABLE QUOTATION_DETAILS MODIFY COLUMN RAW_MATERIALS INT(4) NULL;
ALTER TABLE QUOTATION_DETAILS MODIFY COLUMN UNIT_TYPE INT(1) NULL;
ALTER TABLE QUOTATION_DETAILS MODIFY COLUMN CUSTOMER_FILENAME VARCHAR(25) NULL;
ALTER TABLE QUOTATION_DETAILS AUTO_INCREMENT=1000001;
ALTER TABLE QUOTATION_DETAILS add VATP VARCHAR(5) NOT NULL;
CREATE TABLE PRODUCT_CATEGORY_DATA (
ID INT(4) NOT NULL,
CAT_CODE VARCHAR(8) NOT NULL,
CAT_NAME VARCHAR(25) NOT NULL,
CAT_DESC VARCHAR(60) NOT NULL,
CAT_TYPE INT(1) NOT NULL,
DELETED INT(1) NOT NULL,
CONSTRAINT PRODUCT_CATEGORY_DATA_PK PRIMARY KEY (ID)
);
/*
CREATE TABLE PRODUCT_DATA (
ID BIGINT(10) NOT NULL,
PROD_CODE INT(4) NOT NULL,
RAWMAT_CODE INT(4) NOT NULL,
UNIT_TYPE INT(1) NOT NULL,
UNITS INT(1) NOT NULL,
GSTP VARCHAR(5) NOT NULL,
SECURITY_DEPOSIT VARCHAR(8) NOT NULL,
OP_STOCK INT NOT NULL,
LANDING_RATE VARCHAR(8) NOT NULL,
SELLING_RATE VARCHAR(8) NOT NULL,
EFFECTIVE_DATE BIGINT NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT PRODUCT_MASTER_PK PRIMARY KEY (ID)
);
ALTER TABLE PRODUCT_DATA MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE PRODUCT_DATA AUTO_INCREMENT=1000001;
*/
CREATE TABLE PRODUCT_DATA (
ID BIGINT(10) NOT NULL,
PROD_CODE INT(4) NOT NULL,
RAWMAT_CODE INT(4) NOT NULL,
UNIT_TYPE INT(1) NOT NULL,
UNITS INT(1) NOT NULL,
GSTP VARCHAR(5) NOT NULL,
OPENING_STOCK INT(4) NOT NULL,
CURRENT_STOCK INT(4) NOT NULL,
PURCHASE_PRICE VARCHAR(8) NOT NULL,
EFFECTIVE_DATE BIGINT NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT PRODUCT_MASTER_PK PRIMARY KEY (ID)
);
ALTER TABLE PRODUCT_DATA MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE PRODUCT_DATA AUTO_INCREMENT=1000001;
alter table PRODUCT_DATA modify prod_code int(20);
/*
CREATE TABLE ADMIN_STOCK_DATA (
ID BIGINT(10) NOT NULL,
REF_ID BIGINT(10) NOT NULL, -- ID of the transaction of corresponding module
STOCK_FLAG INT(1) NOT NULL DEFAULT 0, -- FLAG for the module
INV_NO VARCHAR(30) NOT NULL,
TRANS_DATE BIGINT NOT NULL,
TRANS_TYPE INT(1) NOT NULL,
PROD_CODE INT(2) NOT NULL,
RAWMAT_CODE INT(2) NOT NULL,
STOCK_UNITS INT(4) NOT NULL,
UNIT_TYPE INT(1) NOT NULL,
CVO_ID BIGINT NOT NULL,
DISCOUNT VARCHAR(8) NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT ADMIN_STOCK_DATA_PK PRIMARY KEY (ID)
);
ALTER TABLE ADMIN_STOCK_DATA MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE ADMIN_STOCK_DATA AUTO_INCREMENT=1000001;
*/
CREATE TABLE ADMIN_STOCK_DATA (
ID BIGINT(10) NOT NULL,
REF_ID BIGINT(10) NOT NULL, -- ID of the transaction of corresponding module
STOCK_FLAG INT(1) NOT NULL DEFAULT 0, -- FLAG for the module
INV_NO VARCHAR(30) NOT NULL,
TRANS_DATE BIGINT NOT NULL,
TRANS_TYPE INT(1) NOT NULL,
PROD_CODE INT(2) NOT NULL,
RAWMAT_CODE INT(2) NOT NULL,
STOCK_UNITS INT(4) NOT NULL,
UNIT_TYPE INT(1) NOT NULL,
CVO_ID BIGINT NOT NULL,
DISCOUNT VARCHAR(8) NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT ADMIN_STOCK_DATA_PK PRIMARY KEY (ID)
);
ALTER TABLE ADMIN_STOCK_DATA MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE ADMIN_STOCK_DATA AUTO_INCREMENT=1000001;
CREATE TABLE PRODUCT_PRICES_DATA (
ID BIGINT(10) NOT NULL,
PROD_CODE INT(4) NOT NULL,
BASE_PRICE VARCHAR(8) NOT NULL,
SGST_PRICE VARCHAR(8) NOT NULL,
CGST_PRICE VARCHAR(8) NOT NULL,
RSP VARCHAR(8) NOT NULL,
MONTH INT(2) NOT NULL,
YEAR INT(4) NOT NULL,
CREATED_BY BIGINT(10) NULL,
CREATED_DATE BIGINT NULL,
MODIFIED_BY BIGINT(10) NULL,
MODIFIED_DATE BIGINT NULL,
VERSION INT(1) NULL,
DELETED INT(1) NULL,
CONSTRAINT PRODUCT_PRICES_MASTER_PK PRIMARY KEY (ID)
);
ALTER TABLE PRODUCT_PRICES_DATA MODIFY COLUMN ID BIGINT(10) AUTO_INCREMENT;
ALTER TABLE PRODUCT_PRICES_DATA AUTO_INCREMENT=1000001;
CREATE TABLE AGENCY_SERIAL_NOS (
SI_SNO INT(5) NULL,
CS_SNO INT(5) NULL,
PR_SNO INT(5) NULL,
SR_SNO INT(5) NULL,
QT_SNO INT(5) NULL,
DC_SNO INT(5) NULL,
RCPTS_SNO INT(5) NULL,
PMTS_SNO INT(5) NULL,
BT_SNO INT(5) NULL,
CN_SNO INT(5) NULL,
DN_SNO INT(5) NULL,
FY INT(5) NULL,
CREATED_BY BIGINT(10) NOT NULL,
CONSTRAINT AGENCY_SERIAL_NO_PK PRIMARY KEY (CREATED_BY)
); |
library ChronicPainConcepts version '1.0.0'
// ## Value sets ##
// List value sets used by the artifact. The links to the Value Set Authority Center (VSAC) point to the latest
// expansion of each value set available.
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.37/expansion)
valueset "Conditions associated with chronic pain": '2.16.840.1.113762.1.4.1032.37'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.34/expansion)
valueset "Opioid Pain Medications": '2.16.840.1.113762.1.4.1032.34'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.54/expansion)
valueset "Adjuvant Analgesic Medications": '2.16.840.1.113762.1.4.1032.54'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.105.12.1007/expansion)
valueset "Major Depression": '2.16.840.1.113883.3.464.1003.105.12.1007'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.600.143/expansion)
valueset "Depression Diagnosis ICD9": '2.16.840.1.113883.3.600.143'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.52/expansion)
valueset "Anxiety": '2.16.840.1.113762.1.4.1032.52'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.1240.2017.3.2.1015/expansion)
valueset "Anxiety Disorders ICD9": '2.16.840.1.113883.3.1240.2017.3.2.1015'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.106.12.1004/expansion)
valueset "Substance use disorder": '2.16.840.1.113883.3.464.1003.106.12.1004'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.106.11.1010/expansion)
valueset "Substance Abuse": '2.16.840.1.113883.3.464.1003.106.11.1010'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.102/expansion)
valueset "Suicide Attempt": '2.16.840.1.113762.1.4.1032.102'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.53/expansion)
valueset "Sleep-disordered breathing": '2.16.840.1.113762.1.4.1032.53'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.109.12.1028/expansion)
valueset "Kidney Failure": '2.16.840.1.113883.3.464.1003.109.12.1028'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.199.12.1035/expansion)
valueset "Chronic Liver Disease": '2.16.840.1.113883.3.464.1003.199.12.1035'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1047.42/expansion)
valueset "Liver Disease": '2.16.840.1.113762.1.4.1047.42'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.378/expansion)
valueset "Pregnancy": '2.16.840.1.113883.3.526.3.378'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.80/expansion)
valueset "Pregnancy (New ICD10 codes published in 2018 or later)": '2.16.840.1.113762.1.4.1032.80'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.26/expansion)
valueset "Non opioid pain medications": '2.16.840.1.113762.1.4.1032.26'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.36/expansion)
valueset "Non pharmacologic treatments for chronic pain": '2.16.840.1.113762.1.4.1032.36'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.55/expansion)
valueset "Risk assessments relevant to pain management": '2.16.840.1.113762.1.4.1032.55'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.43/expansion)
valueset "Benzodiazepine medications": '2.16.840.1.113762.1.4.1032.43'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.42/expansion)
valueset "Naloxone medications": '2.16.840.1.113762.1.4.1032.42'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.28/expansion)
valueset "Urine drug screen for pain management": '2.16.840.1.113762.1.4.1032.28'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.44/expansion)
valueset "Stool softeners and laxatives": '2.16.840.1.113762.1.4.1032.44'
|
/*
Post-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the post-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
/* Users */
SET IDENTITY_INSERT Users ON
INSERT INTO Users(UserId, Username, Password, Email, IsActive, DateCreated) VALUES(1, 'admin', 'DD94709528BB1C83D08F3088D4043F4742891F4F', 'admin@jones.blog', 1, GETDATE())
INSERT INTO Users(UserId, Username, Password, Email, IsActive, DateCreated) VALUES(2, 'Preston', '114F50D8456A44AE0ABE67AFF9A11F4CF5487029', 'psmak4@gmail.com', 1, GETDATE())
SET IDENTITY_INSERT Users OFF
/* Posts */
SET IDENTITY_INSERT Posts ON
INSERT INTO Posts(PostId, UserId, Title, Content, Status, DateCreated) VALUES(1, 2, 'Test Post 1', 'Here is the sample content for this post.', 'Published', GETDATE())
INSERT INTO Posts(PostId, UserId, Title, Content, Status, DateCreated) VALUES(2, 1, 'Test Post 2', 'Here is the sample content for this post.', 'Published', GETDATE())
INSERT INTO Posts(PostId, UserId, Title, Content, Status, DateCreated) VALUES(3, 2, 'Test Post 3', 'Here is the sample content for this post.', 'Draft', GETDATE())
SET IDENTITY_INSERT Posts OFF
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
CREATE DATABASE IF NOT EXISTS `bird_system` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `bird_system`;
CREATE TABLE IF NOT EXISTS `birdhistory` (
`round` int(11) NOT NULL,
`player1` int(11) NOT NULL,
`player2` int(11) NOT NULL,
`player3` int(11) NOT NULL,
`player4` int(11) NOT NULL,
`createUser` varchar(20) NOT NULL,
`createDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `discussrecord` (
`comment` varchar(100) NOT NULL,
`createUser` varchar(20) NOT NULL,
`createDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
UPDATE npc_template SET gfxID=10020,sex=0 WHERE id=40009; |
CREATE TABLE [Staging].[TradeHistory] (
[PortfolioID] INT NOT NULL,
[BrokerID] INT NOT NULL,
[Code] NVARCHAR(10) NOT NULL,
[Company] NVARCHAR(255) NOT NULL,
[Type] NVARCHAR(10) NOT NULL,
[Quantity] INT NOT NULL,
[UnitPrice] DECIMAL NOT NULL,
[TradeValue] DECIMAL NOT NULL,
[Brokerage_inc_GST] DECIMAL NOT NULL,
[GST] DECIMAL NOT NULL,
[ContractNote] NVARCHAR(50) NOT NULL,
[TotalValue] DECIMAL NOT NULL,
CONSTRAINT [PK_TradeHistory] PRIMARY KEY ([PortfolioID], [BrokerID]),
CONSTRAINT [FK_TradeHistory_Portfolio] FOREIGN KEY ([PortfolioID]) REFERENCES [Portfolio].[PortfolioDetails]([PortfolioID]),
CONSTRAINT [FK_TradeHistory_Broker] FOREIGN KEY ([BrokerID]) REFERENCES [Reference].[Broker]([BrokerID])
); |
--student: Diana Rachvak
--1. What are the top ten countries by economic activity (Gross National Product - ‘gnp’).
SELECT gnp AS top_ten_gnp FROM country ORDER BY gnp desc LIMIT 10;
--2. What are the top ten countries by GNP per capita?
SELECT gnp AS top_gnp_per_capita FROM country
ORDER BY gnp/NULLIF(population, 0) desc LIMIT 10;
--3. What are the ten most densely populated countries, and ten least
--densely populated countries?
SELECT name, population AS most_populated FROM country
ORDER BY population desc LIMIT 10;
SELECT name, population AS least_populated FROM country
ORDER BY population asc LIMIT 10;
--4(1). What different forms of government are represented in this data?
SELECT DISTINCT governmentform AS forms_of_gvmnt FROM country;
--4(2). Which forms of government are most frequent?
SELECT governmentform, COUNT(governmentform) AS frequent_gvmnt_forms
FROM country
GROUP BY governmentform
ORDER BY frequent_gvmnt_forms DESC LIMIT 10;
--5. Which countries have the highest life expectancy?
SELECT name, lifeexpectancy FROM country
WHERE lifeexpectancy!=NULL OR lifeexpectancy!=0
ORDER BY lifeexpectancy desc LIMIT 10;
--6. What are the top ten countries by total population, and what is the official language spoken there?
--this is first option (will print out only CHINA)
SELECT country.name, country.population, countrylanguage."language"
FROM country
INNER JOIN countrylanguage
ON country.code = countrylanguage.countrycode
ORDER BY country.population desc LIMIT 10;
--will print 10 different countries
SELECT DISTINCT country.name, country.population, countrylanguage."language"
FROM country
INNER JOIN countrylanguage
ON country.code = countrylanguage.countrycode LIMIT 10;
--7. What are the top ten most populated cities – along with which country they are in, and what continent they are on?
SELECT city.name AS city_name, city.population AS city_population,
country.name AS country_name, country.continent
FROM city
INNER JOIN country ON city.countrycode = country.code
ORDER BY city.population desc LIMIT 10;
--8. What is the official language of the top ten cities you found in Question #7?
SELECT c.name AS city_name, c.population AS city_population, cl."language", co.name AS country_name, co.continent
FROM city c
INNER JOIN country co ON c.countrycode = co.code
INNER JOIN countrylanguage cl ON c.countrycode = cl.countrycode WHERE cl.isofficial = true
ORDER BY 2 DESC LIMIT 10;
--9. Which of the cities from Question #7 are capitals of their country?
SELECT c.name AS city_name, c.population AS city_population,
co.name AS country_name, co.continent
FROM city c
INNER JOIN country co ON c.countrycode = co.code
WHERE co.capital IN (SELECT capital FROM country)
ORDER BY c.population desc LIMIT 10;
--10. For the cities found in Question#9, what percentage of the country’s population lives in the capital city?
SELECT c.name AS city_name, co.name AS country_name, co.continent,
c.population AS city_population,
((CAST(c.population AS float)/co.population)*100):: NUMERIC(10,2)
AS pct_capital_population
FROM city c
INNER JOIN country co ON c.countrycode = co.code
WHERE co.capital IN (SELECT capital FROM country)
ORDER BY c.population desc LIMIT 10;
|
CREATE DATABASE `employeedb` /*!40100 DEFAULT CHARACTER SET utf8 */;
CREATE TABLE `employee` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`department` varchar(100) NOT NULL,
`phone` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
-- phpMyAdmin SQL Dump
-- version 4.7.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Sep 04, 2019 at 06:29 AM
-- Server version: 5.7.24
-- PHP Version: 7.2.19
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: `dragongold`
--
-- --------------------------------------------------------
--
-- Table structure for table `sections`
--
CREATE TABLE `sections` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`language_id` int(10) UNSIGNED NOT NULL,
`page_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `sections`
--
INSERT INTO `sections` (`id`, `name`, `content`, `language_id`, `page_id`, `created_at`, `updated_at`) VALUES
(1, 'home_header_title', 'The LEGEND of DRAGONGOLD.', 1, 1, NULL, '2019-08-31 08:03:28'),
(2, 'home_header_title', 'SPAN Big data - big profits.', 3, 1, NULL, NULL),
(3, 'home_header_subtitle', 'The DRAGONGOLD system uses AI algorithms and big data tech in order to generate patterns used in high frequency trading.', 1, 1, NULL, '2019-08-31 08:09:38'),
(4, 'home_header_ahead', 'The DRAGONGOLD is ahead of any competitors in speed, thereby extracting the maximum profit from each trade transaction.', 1, 1, NULL, NULL),
(5, 'home_header_speed', '0.495', 1, 1, NULL, NULL),
(6, 'home_market_text', 'The DRAGONGOLD system works with all market Trang s, bullish, bearish or sideways.\r\nThe DRAGONGOLD neural network calculates hundreds of patterns per minute and finds the most profitable entry point into the market.', 1, 1, NULL, '2019-08-31 08:13:46'),
(7, 'home_market_title', 'Bulls or Bears - DRAGONS conquer all', 1, 1, NULL, '2019-08-31 08:11:01'),
(8, 'home_partner_title', 'DRAGONS look after their partners', 1, 1, NULL, '2019-08-31 08:12:22'),
(9, 'home_partner_text', 'The DRAGONGOLD partner program offers both fixed bonuses provided by partner investments at five levels and up to <span> $ 167.200</span> bonus in DRAGONGOLD LEADERSHIP PROGRAM.', 1, 1, NULL, '2019-08-31 08:15:06'),
(10, 'home_advantage_head', 'DRAGONGOLD advantages', 1, 1, NULL, NULL),
(11, 'home_advantage_subhead', 'We are the undisputed market leaders.', 1, 1, NULL, NULL),
(12, 'home_service1_title', 'Maximum profit', 1, 1, NULL, NULL),
(13, 'home_service1_text', 'Your investments with Gains give you 3% guaranteed daily net income.', 1, 1, NULL, NULL),
(14, 'home_service2_title', 'Daily income within a year', 1, 1, NULL, NULL),
(15, 'home_service2_text', 'Having invested once, your income goes to your wallet daily within 365 days', 1, 1, NULL, NULL),
(16, 'home_service3_title', 'Unique affiliate program', 1, 1, NULL, NULL),
(17, 'home_service3_text', ' A unique bonus system, which consists of 5 stages.', 1, 1, NULL, NULL),
(18, 'home_advantage_footer', 'We prioritize business goals that machine learning excels at achieving. We create accurate datasets by building apps that make it easy to collect better data. And we write algorithms that learn from best decision makers and deliver targeted decision guidance in real time.', 1, 1, NULL, NULL),
(19, 'home_ai_title1', 'Uniqueness of technology', 1, 1, NULL, NULL),
(20, 'home_ai_title2', 'DRAGONGOLD uses the full potential of AI', 1, 1, NULL, NULL),
(21, 'home_ai_text1', 'The DRAGONGOLD system processes gigabytes of data daily to build effective work patterns for any market situation.', 1, 1, NULL, NULL),
(22, 'home_ai_text2', 'The human factor is completely excluded. Based on patterns, historical data and news, DRAGONGOLD just does its job and makes it 1000 times more effective than a human.', 1, 1, NULL, NULL),
(23, 'home_ai_pro1', 'Gathering information takes seconds', 1, 1, NULL, NULL),
(24, 'home_ai_pro2', 'Takes into account all factors and scenarios', 1, 1, NULL, NULL),
(25, 'home_ai_pro4', 'Flashing right decision making', 1, 1, NULL, NULL),
(26, 'home_ai_pro3', 'Uses history and patterns', 1, 1, NULL, NULL),
(28, 'home_ai_con1', 'Long search and data collecting', 1, 1, NULL, NULL),
(29, 'home_ai_con2', 'Does not take into account many factors', 1, 1, NULL, NULL),
(30, 'home_ai_con3', 'Provides one or two options', 1, 1, NULL, NULL),
(31, 'home_ai_con4', 'Subject to fear, greed, avidity', 1, 1, NULL, NULL),
(32, 'home_use_title', 'Usability', 1, 1, NULL, NULL),
(33, 'home_use_subtitle', 'Controlling your investments from anywhere in the world.', 1, 1, NULL, NULL),
(34, 'home_use_text', 'The DRAGONGOLD system allows access to investments from any place in the world that has an Internet connection. Replenish the balance of investments, get accruals and withdraw money. It\'s simple. The platform is optimized for all mobile and stationary devices. ', 1, 1, NULL, NULL),
(35, 'home_use_title2', 'Usability', 1, 1, NULL, NULL),
(36, 'home_use_subtitle2', 'Convenient personal office for investors.', 1, 1, NULL, NULL),
(37, 'home_use_text2', 'Manage your investments, keep track of your account statistics and account security. Keep track of new partners in the team and get notifications of bonuses using a convenient control panel.', 1, 1, NULL, NULL),
(38, 'home_time_title', 'Time to operate.', 1, 1, NULL, NULL),
(39, 'home_time_subtitle', 'Start earning income today by creating an account in the DRAGONGOLD platform.', 1, 1, NULL, NULL),
(40, 'home_time_text', 'The registration procedure is simple, and it will not take you more than 2 minutes of time.', 1, 1, NULL, NULL),
(41, 'about_work_dim_title', 'How does it work?', 1, 2, NULL, NULL),
(42, 'about_work_bold_title', 'Our AI systems learn to create patterns, taking into account any market conditions.', 1, 2, NULL, NULL),
(43, 'about_work_content', 'DRAGON GOLD AI SYSTEMS is not a simple trading robot, script, or indicator. DRAGON GOLD AI SYSTEMS is a software package based on a neural network and artificial intelligence, which consists of three main modules:', 1, 2, NULL, NULL),
(44, 'about_analytic_title', 'DRAGON GOLD Research and Analytics', 1, 2, NULL, NULL),
(45, 'about_analytic_content', 'The DRAGON GOLG R & A module explores historical and real-time data, the size of markets in a given period, candlestick patterns and price-action scenarios, making up a constantly updated foundation for the next module - DRAGON GOLD Pattern Builder', 1, 2, NULL, NULL),
(46, 'about_partterns_title', 'GAINS Pattern Builder', 1, 2, NULL, NULL),
(47, 'about_patterns_content', 'The GRAGON GOLD pattern builder module acquires an array of data from the first module and processes them, finding matches and patterns in the asset price behavior, creating trading patterns in real time. Patterns are transferred to the next module - GRAGON GOLD Trade Station', 1, 2, NULL, NULL),
(48, 'about_trade_title', 'DRAGON GOLD Trade Station', 1, 2, NULL, NULL),
(49, 'about_trade_content', 'The DRAGON GOLD Trade Station module downloads patterns from the previous module and looks for the most suitable and profitable entry points into the market, taking into account all factors, such as liquidity, news noise, the number of open positions and the depth of the \"glass\".', 1, 2, NULL, NULL),
(50, 'about_algorithm_dim_title', 'Work algorithm', 1, 2, NULL, NULL),
(51, 'about_algorithm_bold_title', 'Look at DRAGON GOLD AI SYSTEMS from the inside.', 1, 2, NULL, NULL),
(52, 'about_algorithm_content', 'From data collection to justified entry into the market based on dozens of criteria - GRAGON GOLD AI SYSTEMS is a completely autonomous artificial intelligence that processes incredibly large amounts of data in a minimal amount of time, thereby bringing a stable and high income.', 1, 2, NULL, NULL),
(53, 'about_scheme_1', 'Historical data and archive of quotations', 1, 2, NULL, NULL),
(54, 'about_scheme_2', 'Real-time data and fundamental analysys', 1, 2, NULL, NULL),
(55, 'about_scheme_3', 'Price-action analysis and information about market volumes', 1, 2, NULL, NULL),
(56, 'about_scheme_4', 'DRAGON GOLD Research and Analytics', 1, 2, NULL, NULL),
(57, 'about_scheme_5', 'Compliance analysis and search for patterns', 1, 2, NULL, NULL),
(58, 'about_scheme_6', 'DRAGON GOLD Pattern Builder', 1, 2, NULL, NULL),
(59, 'about_scheme_7', 'Creating new patterns and optimizing current ones', 1, 2, NULL, NULL),
(60, 'about_scheme_8', 'Search for matches with patterns and analysis of market entry points', 1, 2, NULL, NULL),
(61, 'about_scheme_9', 'DRAGON GOLD Trade Station', 1, 2, NULL, NULL),
(62, 'about_scheme_10', 'Risk assessment and money management optimization', 1, 2, NULL, NULL),
(63, 'about_scheme_11', 'Entering market and making profit', 1, 2, NULL, NULL),
(64, 'about_ai_dim_title', 'Artificial Intelligence in Action.', 1, 2, NULL, NULL),
(65, 'about_ai_bold_title', 'DRAGON GOLD AI SYSTEMS is a new milestone in the world of high-frequency trading.', 1, 2, NULL, NULL),
(66, 'about_ai_content', 'DRAGON GOLD AI SYSTEMS replaces a whole staff of experienced traders. Not even a state, but as many as 50 states of traders. If the entire population of Geneva were engaged in trading, GRAGON GOLD could easily replace it.', 1, 2, NULL, NULL),
(67, 'about_oview_title_1', 'Super-fast work', 1, 2, NULL, NULL),
(68, 'about_oview_content_1', 'For 1 minute, DRAGON GOLD analyzes information, for the study of which, a person would would have needed years.', 1, 2, NULL, NULL),
(69, 'about_oview_title_2', 'High and positive mathematical expectation of profit', 1, 2, NULL, NULL),
(70, 'about_oview_content_2', 'Mathematical expectation and profit factor ensure stable profit for us and our investors.', 1, 2, NULL, NULL),
(71, 'about_oview_title_3', 'Absence of the human factor in the work', 1, 2, NULL, NULL),
(72, 'about_oview_content_3', 'AI * has neither fear, nor greed, nor any external factors. Only cold calculation and action', 1, 2, NULL, NULL),
(73, 'about_foot_note', '* AI - Artificial intellect, on the basis of which DRAGON GOLD was created.', 1, 2, NULL, NULL),
(74, 'home_header_title', 'grandes ganancias', 4, 1, NULL, NULL),
(76, 'investors_bold_title', 'Our AI systems provide the highest return and safety of your investments.', 1, 3, NULL, NULL),
(77, 'investors_content', 'DRAGON GOLD AI SYSTEMS provides investors with one of the highest ROIs on the market.<br>\r\n Quick turnaround allows us to get a stable and high profit without significant loads on the capital of investors.', 1, 3, NULL, NULL),
(82, 'investors_calc_title', 'Calculate your income', 1, 3, NULL, NULL),
(90, 'inv_income_dim', 'A bit of a help for your success', 1, 3, NULL, NULL),
(91, 'inv_income_bold', 'Stable income every day.', 1, 3, NULL, NULL),
(92, 'inv_income_p1', 'Our platform is aimed at diversifying the risks of investors as much as possible and making profit on the principle “More often and more qualitatively”. More than 5000 transactions every day are made using our artificial intelligence systems, bringing us and our investors the maximum profit in any market.', 1, 3, NULL, NULL),
(93, 'inv_income_p2', 'Using our platform, you can always be sure about the safety of your funds, because even in order to make one transaction a hundred of analytical operations are performed.', 1, 3, NULL, NULL),
(94, 'create_btn_txt', 'Create a DRAGON GOLD account', 1, 3, NULL, NULL),
(95, 'inv_stat_dim', 'DRAGON GOLD AI SYSTEMS in numbers', 1, 3, NULL, NULL),
(96, 'inv_stat_bold', 'Platform statistics', 1, 3, NULL, NULL),
(102, 'aff_bonus_dim', 'Linear Bonus System', 1, 4, NULL, NULL),
(103, 'aff_bonus_title', 'Dragon Gold Affiliate program.', 1, 4, NULL, NULL),
(104, 'aff_bonus_p1', 'Get bonuses from deposits 5 levels deep with the Dragon Gold affiliate program.', 1, 4, NULL, NULL),
(105, 'aff_bonus_p2', 'To participate in the Dragon Gold affiliate program, you need:', 1, 4, NULL, NULL),
(106, 'register', 'Register', 1, 4, NULL, NULL),
(107, 'platform', 'platform', 1, 4, NULL, NULL),
(108, 'aff_bonus_list1', 'Get your personal affiliate link for invitations', 1, 4, NULL, NULL),
(109, 'aff_bonus_list2', 'Post the affiliate link on your website, or share it in the social networks', 1, 4, NULL, NULL),
(110, 'aff_bonus_p3', 'As soon as your partner registers with your link and makes a deposit, you will immediately receive a bonus to the account with which the deposit was made.', 1, 4, NULL, NULL),
(111, 'aff_prog_title', 'Dragon Gold Affiliate program partner bonuses:', 1, 4, NULL, NULL),
(127, 'rep_bonus_dim', 'Advanced Linear Bonus System', 1, 4, NULL, NULL),
(128, 'rep_bonus_title', 'Dragon Gold Representative program.', 1, 4, NULL, NULL),
(129, 'rep_bonus_content', 'Become the company`s representative and get increased affiliate income in the system of linear bonuses. The Dragon Gold Representative program opens up new profit horizons for you! In order to obtain the status of a representative, you need to fill out a special representative form.', 1, 4, NULL, NULL),
(130, 'become_a_rep', 'Become a representative', 1, 4, NULL, NULL),
(131, 'rep_bonus_title', 'Dragon Gold Representative program affiliate Bonuses:', 1, 4, NULL, NULL),
(146, 'rep_list_title', 'List of representatives DRAGON GOLD SYSTEMS', 1, 4, NULL, NULL),
(147, 'country', 'Country', 1, 4, NULL, NULL),
(148, 'rep', 'Representative', 1, 4, NULL, NULL),
(149, 'contact', 'Contact details', 1, 4, NULL, NULL),
(150, 'affiliate_dim', 'Innovative bonus system from the depth of the structure.', 1, 4, NULL, NULL),
(151, 'affiliate_title', 'Dragon Gold Leadership program.', 1, 4, NULL, NULL),
(152, 'affiliate_content', 'A multi-level Dragon Gold Leadership Program bonus program was developed specifically for active investors of the platform. As your team grows, you will receive ranks, for each of which you are entitled to a fixed reward, depending on the size of the structure.', 1, 4, NULL, NULL),
(153, 'cond_table', 'Program conditions table', 1, 4, NULL, NULL),
(154, 'depth_title', 'Let\'s take a closer look, and consider what Dragon Gold bonuses offer partners.', 1, 4, NULL, NULL),
(156, 'top_screen', 'Share your knowledge', 1, 5, NULL, NULL),
(157, 'top_want', 'Want to become', 1, 5, NULL, NULL),
(158, 'top_speaker', 'DRAGON GOLD speaker?', 1, 5, NULL, NULL),
(159, 'webinar_fill', 'Fill out the form of the speaker', 1, 5, NULL, NULL),
(160, 'become_speaker', 'Become a speaker', 1, 5, NULL, NULL),
(161, 'dont_miss', 'Don\'t miss the next webinar', 1, 5, NULL, NULL),
(162, 'next_webinar', 'The next webinar will be very soon!', 1, 5, NULL, NULL),
(163, 'tab_title', 'Be the first to host a webinar!', 1, 5, NULL, NULL),
(164, 'tab_content', 'Dear investors, a webinar center has been launched on our platform, where anyone can apply for a host webinar! If you have something to tell other users, make a presentation of our platform and just find new partners - fill out ', 1, 5, NULL, NULL),
(165, 'apply', 'this application', 1, 5, NULL, NULL),
(166, 'scrn_title_small', 'Tell the whole world about us and get paid for it!', 1, 6, NULL, NULL),
(167, 'scrn_title_big', 'Dragon Gold Bounty program', 1, 6, NULL, NULL),
(168, 'scrn_title_subp', '$10 000', 1, 6, NULL, NULL),
(170, 'scrn_content', 'The Dragon Gold Bonus program is the great opportunity to receive a reward by performing the simple steps, that is necessary to popularize the project.', 1, 6, NULL, NULL),
(174, 'bounty_title_small', 'Make a video review of our company or video review of our cooperation with you.', 1, 6, NULL, NULL),
(175, 'bounty_title_big', 'YouTube', 1, 6, NULL, NULL),
(176, 'bounty_title_sub', 'UP TO $100', 1, 6, NULL, NULL),
(177, 'bounty_text', 'The duration of the video should be - 1 - 15 minutes.', 1, 6, NULL, NULL),
(178, 'min_bonus', 'Min. bonus - ', 1, 6, NULL, NULL),
(179, 'per_video', '$5 per video.', 1, 6, NULL, NULL),
(180, 'max_bonus', 'Max. bonus -', 1, 6, NULL, NULL),
(181, 'per_video2', '$100*.', 1, 6, NULL, NULL),
(182, 'youtube_channel', 'Your YouTube channel should have been created more than 3 months ago.', 1, 6, NULL, NULL),
(183, 'num_of_subc', 'The number of subscribers should exceed 500 people.', 1, 6, NULL, NULL),
(184, 'your_channel', 'Your channel and video should be publicly available.', 1, 6, NULL, NULL),
(185, 'video_review', 'Video review should be on your channel more than 5 days.', 1, 6, NULL, NULL),
(186, 'title_video', 'The title of the video must contain the keyword “Dragon Gold.Systems”.', 1, 6, NULL, NULL),
(187, 'get_paid', 'You can get paid only for 1 video per 10 days.', 1, 6, NULL, NULL),
(188, 'place_desc_top', 'Place in the description your referral link to our project.', 1, 6, NULL, NULL),
(189, 'link_example', 'Example of the link', 1, 6, NULL, NULL),
(190, 'more_subscribers', '* The more subscribers on the channel you have, the better bonus you will receive.', 1, 6, NULL, NULL),
(191, 'youtube_owner', 'If you are the owner of a large YouTube channel and want to take part in the bounty - write to us via the', 1, 6, NULL, NULL),
(192, 'contact_form', 'contact form.', 1, 6, NULL, NULL),
(193, 'submit_video', 'Submit your Youtube video', 1, 6, NULL, NULL),
(194, 'retweet_news', 'Retweet news from the official Twitter page to your personal page.', 1, 6, NULL, NULL),
(195, 'retweet_title_big', 'Twitter', 1, 6, NULL, NULL),
(196, 'retweet_title_sub', '$ 1 per tweet/retweet', 1, 6, NULL, NULL),
(197, 'bonus', 'Bonus -', 1, 6, NULL, NULL),
(198, 'tweet_bonus', '$1 per tweet/retweet', 1, 6, NULL, NULL),
(199, 'tw_bullet1', 'Your Twitter account should have been created more than 1 month ago.', 1, 6, NULL, NULL),
(200, 'tw_bullet2', 'The number of followers should exceed 300 people.', 1, 6, NULL, NULL),
(201, 'tw_bullet3', 'Your account and messages should be publicly available.', 1, 6, NULL, NULL),
(202, 'tw__bullet4', 'Retweet must be published on your page more than 3 days.', 1, 6, NULL, NULL),
(203, 'twitter_owner', ' If you are the owner of a large Twitter account and want to take part in the bounty - write to us via the', 1, 6, NULL, NULL),
(204, 'submit_retweet', 'Submit your retweet', 1, 6, NULL, NULL),
(205, 'bitcoin_small', 'Add your referral link with the Dragon Gold.systems project in your profile signatures on the forum', 1, 6, NULL, NULL),
(206, 'bitcoin_big', 'BITCOINTALK', 1, 6, NULL, NULL),
(207, 'bitcoin_sub', 'UP TO 0,015 BTC', 1, 6, NULL, NULL),
(208, 'bitcoin_sup', 'per 10 days', 1, 6, NULL, NULL),
(209, 'bit_bullet1', 'You will receive bonus after 10 days from the moment of your post.', 1, 6, NULL, NULL),
(210, 'bit_bullet2', 'The application for participation in the bonus program can be sent every 10 days.', 1, 6, NULL, NULL),
(211, 'bit_bullet3', 'Payment for performing tasks in Bitcoins.', 1, 6, NULL, NULL),
(212, 'bit_rank', 'In accordance with your rank on BitcoinTalk, you can get the following bonuses:', 1, 6, NULL, NULL),
(214, 'member_bonus', '(Bonus - 0.0015 per 10 days)', 1, 6, NULL, NULL),
(216, 'full_bonus', '(Bonus - 0,0020 per 10 days)', 1, 6, NULL, NULL),
(218, 'senior_bonus', '(Bonus - 0,0030 per 10 days)', 1, 6, NULL, NULL),
(220, 'hero_bonus', '(Bonus - 0.0070 per 10 days)', 1, 6, NULL, NULL),
(222, 'legendary_bonus', '(Bonus - 0,015 per 10 days)', 1, 6, NULL, NULL),
(232, 'whats_new', 'What`s new?', 1, 8, NULL, NULL),
(233, 'platform_news', 'Platform news', 1, 8, NULL, NULL),
(234, 'home_header_title', 'The LEGEND of DRAGONGOLD.', 2, 1, '2019-08-31 08:20:21', '2019-08-31 08:20:21');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `sections`
--
ALTER TABLE `sections`
ADD PRIMARY KEY (`id`),
ADD KEY `sections_language_id_foreign` (`language_id`),
ADD KEY `sections_page_id_foreign` (`page_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `sections`
--
ALTER TABLE `sections`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=235;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `sections`
--
ALTER TABLE `sections`
ADD CONSTRAINT `sections_language_id_foreign` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`),
ADD CONSTRAINT `sections_page_id_foreign` FOREIGN KEY (`page_id`) REFERENCES `pages` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
create database ashmishop;
use ashmishop;
Create table user(
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name varchar(40),
email varchar(40),
pass varchar(40)
);
create table products(
id int unsigned auto_increment primary key,
product_name varchar(40),
price float,
product_detials varchar(255)
);
create table total(
id int unsigned auto_increment primary key,
user_id varchar(40),
product_id int,
product_name varchar(30)
);
create table cart(
id int unsigned auto_increment primary key,
user_id int,
product_id int
);
insert into products (product_name,price) values ("painting1",700);
insert into products (product_name,price) values ("painting2",500);
insert into products (product_name,price) values ("painting3",300);
insert into products (product_name,price) values ("painting4",500);
insert into products (product_name,price) values ("painting5",200);
insert into user (name,email,pass) values ('swetha','swetha@mail.com','123');
insert into user (name,email,pass) values ('nivetha','nivetha@mail.com','123');
insert into user (name,email,pass) values ('anusha','anusha@mail.com','123');
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_GetSupportingDocument]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[prc_CWI_GetSupportingDocument]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_GetSupportingDocument]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
/*******************************************************************
* PROCEDURE: prc_CWI_GetSupportingDocument
* Purpose : This PROC would be called TO get the supporting document for Id
* Invoked from : SupportingDocument.ascx
* CREATED: MohanKumar Sundaram
* MODIFICATION HISTORY
* DATE AUTHOR DESCRIPTION
**********************************************************************
Execution example :
prc_CWI_GetSupportingDocument 1
**********************************************************************
*/
CREATE PROCEDURE [dbo].[prc_CWI_GetSupportingDocument]
@ID int
AS
SELECT
SD.Id,
SD.Title,
SD.ObjectID,
SD.ObjectLookupID as CategoryID,
DocCategoryId,
LU.LookupName as ''DocumentCategory'',
U.Names as ''Author'',
SD.[Version],
SD.Summary,
SD.IsShared,
SD.FilePath,
SD.CreatedOn,
SD.ModifiedBy,
SD.ModifiedOn,
SD.CreatedBy AuthorID,
ISNULL(Tags,'''') Tags
FROM
CWI_SupportingDocument AS SD
INNER JOIN CWI_User AS U
ON SD.CreatedBy=U.ID
LEFT JOIN CWI_DocCategory DC
ON DC.Id = SD.DocCategoryId
LEFT JOIN [Lookup] as LU
ON DC.DoctypeLookupID=LU.Id
WHERE
SD.Id = @ID
AND SD.IsDelete=0
'
END
GO
|
----Éó¼ÆÏà¹Ø±í
create or replace view v1_xtyskm as
select
de011 ysnf ,
2 lx ,
jsde040 kmlx,
de082 kmdm,
de081 kmmc,
0 dwid ,
0 dwbs ,
0 qzbs ,
jsde017 jbbs,
jsde901 pyzjf,
0 kmtjbz
from cs081
union
select
de011 ysnf ,
4 lx,
jsde040 kmlx ,
de084 kmdm ,
de083 kmmc,
0 dwid,
0 dwbs ,
0 qzbs ,
jsde017 jbbs ,
jsde901 pyzjf ,
nvl(jsde029,0) kmtjbz
from cs083 a ;
|
USE sakila;
-- 1. Utilizando a tabela sakila.payment, monte uma function que retorna a quantidade total de pagamentos feitos até o momento por um determinado customer_id.
DELIMITER $$
CREATE FUNCTION RetornaTotalDePagamentoDeUmCliente(id INT)
RETURNS DECIMAL READS SQL DATA
BEGIN
DECLARE total DECIMAL;
SELECT COUNT(*)
FROM payment
WHERE customer_id = id
INTO total;
RETURN total;
END $$
DELIMITER ;
SELECT RetornaTotalDePagamentoDeUmCliente(1);
-- 2. Crie uma function que, dado o parâmetro de entrada inventory_id, retorna o nome do filme vinculado ao registro de inventário com esse id.
DELIMITER $$
CREATE FUNCTION RetornaFilmePeloIdDoInventario(inventory_id INT)
RETURNS VARCHAR(500) READS SQL DATA
BEGIN
DECLARE filme VARCHAR(500);
SELECT f.title
FROM film AS f
INNER JOIN inventory AS i
ON f.film_id = i.film_id
WHERE i.inventory_id = inventory_id
INTO filme;
RETURN filme;
END $$
DELIMITER ;
SELECT RetornaFilmePeloIdDoInventario(1);
-- 3. Crie uma function que receba uma determinada categoria de filme em formato de texto (ex: 'Action', 'Horror') e retorna a quantidade total de filmes registrados nessa categoria.
DELIMITER $$
CREATE FUNCTION CalculaQuantidadeDeFilmesPorCategoria(categoria VARCHAR(100))
RETURNS INT READS SQL DATA
BEGIN
DECLARE quantidade INT;
SELECT COUNT(*)
FROM category AS c
INNER JOIN film_category AS fc
ON c.category_id = fc.category_id
WHERE c.name = categoria
INTO quantidade;
RETURN quantidade;
END $$
DELIMITER ;
SELECT CalculaQuantidadeDeFilmesPorCategoria('Action');
|
-- These are gotten from the Parent Form ... spreadsheet that Janice sent:
-- this file should be idempotent.
-- use autoapp_test;
-- need to have Hugh in the system.
insert into `user`(user_id, full_name, email) values(7, 'HughKB', 'hugh@domain.com')
on duplicate key update email = email;
-- this is the only configuration at the moment
replace into configuration values(
1, -- configuration_id
7, -- user_id
20,20,40,40,50,50,50,50,50,40,40,20, -- isf values
10, -- significant_cgm_value
40, -- command_timeout_mins
20, -- no_pump_data_interval
20, -- no_cgm_data_interval
30, -- awaiting_new_cycle_interval
10, -- time_delay_hybrid_control
120, -- bolus_interval_mins defines anchor bolus
30, -- topup_interval_mins
240, -- max_bolus_interval_mins
15, -- single_bolus_max
45 -- running_bolus_max
);
-- PK is the first field
replace into glucose_range_type_ref(glucose_range_type_id,glucose_range_type) values
(1, 'low'),
(2, 'in_range'),
(3, 'high');
-- glucose ranges. PK is first field, 2nd field is FK to glucose_range_type_ref, so this is defined after
replace into glucose_range(glucose_range_id,glucose_range_type_id,lower_bound,upper_bound)
values
(1,1,0,69),
(2,2,70,125),
(3,3,126,1000),
(4,1,0,72),
(5,2,73,130),
(6,3,131,1000);
-- two modes: night and day. range_ids are FK to glucose range, so this is defined after that
replace into mode(mode_id,name,user_id,is_active,is_default,low_range_id,in_range_id,high_range_id,cgm_target)
values
(1,'night',7,true,true,1,1,1,100),
(2,'day',7,false,false,2,2,2,100);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.