text stringlengths 6 9.38M |
|---|
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 20, 2018 at 05:51 AM
-- Server version: 10.1.34-MariaDB
-- PHP Version: 5.6.37
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: `hris`
--
-- --------------------------------------------------------
--
-- Table structure for table `employee`
--
CREATE TABLE `employee` (
`empid` char(15) NOT NULL,
`firstName` varchar(50) NOT NULL,
`lastName` varchar(50) NOT NULL,
`birthDate` date NOT NULL,
`gender` enum('Male','Female') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `employee`
--
INSERT INTO `employee` (`empid`, `firstName`, `lastName`, `birthDate`, `gender`) VALUES
('A.001', 'Agis', 'R Herdiana', '1996-06-14', 'Male');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `employee`
--
ALTER TABLE `employee`
ADD PRIMARY KEY (`empid`);
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 temp table to hold offensive stats
create temp table season_off_rankings
(
season_year smallint NOT NULL,
team_id character varying(3) NOT NULL,
avg bool,
off_pts double precision NOT NULL,
off_pass_yds double precision,
off_pass_tds double precision,
off_rush_yds double precision,
off_rush_tds double precision,
off_int double precision,
off_fumble double precision,
off_sack double precision
) on commit drop;
--Create temp table to hold defensive stats
create temp table season_def_rankings
(
season_year smallint NOT NULL,
team_id character varying(3) NOT NULL,
avg bool,
def_pts double precision NOT NULL,
def_pass_att double precision,
def_pass_cmp double precision,
def_pass_yds double precision,
def_pass_tds double precision,
def_int double precision,
def_rush_att double precision,
def_rush_yds double precision,
def_rush_tds double precision,
def_fumble double precision,
def_targets double precision,
def_rec double precision,
def_rec_yds double precision,
def_rec_tds double precision,
def_yac double precision,
def_sack double precision,
def_block double precision,
def_safety double precision,
def_tds double precision
) on commit drop;
--Insert season averages for each team into temp table
insert into season_off_rankings
(
season_year,
team_id,
avg,
off_pts,
off_pass_yds,
off_rush_yds,
off_pass_tds,
off_rush_tds,
off_int,
off_fumble,
off_sack
)
--Aggregate offensive stats for each game and
--Take the average to find season average
select g.season_year
, t0.team
, True
, 0
, round(avg(t0.off_pass_yds), 2) as off_pass_yds
, round(avg(t0.off_rush_yds), 2) as off_rush_yds
, round(avg(t0.off_pass_tds), 2) as off_pass_tds
, round(avg(t0.off_rush_tds), 2) as off_rush_tds
, round(avg(t0.off_int), 2) as off_int
, round(avg(t0.off_fumble), 2) as off_fumble
, round(avg(t0.off_sack), 2) as off_sack
from
(
--Aggregate offensive player stats for each game
select pp.gsis_id
, pp.team
, sum(pp.passing_yds) as off_pass_yds
, sum(pp.passing_tds) as off_pass_tds
, sum(pp.rushing_yds) as off_rush_yds
, sum(pp.rushing_tds) as off_rush_tds
, sum(pp.passing_int) as off_int
, sum(pp.fumbles_lost) as off_fumble
, sum(pp.passing_sk) as off_sack
from public.play_player as pp
group by pp.gsis_id, pp.team
) as t0
join public.game as g on g.gsis_id = t0.gsis_id
where g.season_type != 'Preseason'
group by g.season_year, t0.team;
--Updates the offensive points for each team
update season_off_rankings
set off_pts = round(t0.pts, 4)
from (
select g.season_year
, t.team_id
--Score can be either home or away
, sum(case when t.team_id = g.home_team then g.home_score else g.away_score end) * 1.0 / count(*) as pts
from public.team as t
join public.game as g on g.home_team = t.team_id or g.away_team = t.team_id
where g.finished = 't'
group by g.season_year, t.team_id
) as t0
where season_off_rankings.season_year = t0.season_year and season_off_rankings.team_id = t0.team_id;
insert into season_def_rankings
(
season_year
, team_id
, avg
, def_pts
, def_pass_att
, def_pass_cmp
, def_pass_yds
, def_pass_tds
, def_int
, def_rush_att
, def_rush_yds
, def_rush_tds
, def_fumble
, def_targets
, def_rec
, def_rec_yds
, def_rec_tds
, def_yac
, def_sack
, def_block
, def_safety
, def_tds
)
select g.season_year
, t.team_id
, True
, 0
, round(avg(t0.def_pass_att), 2) as def_pass_att
, round(avg(t0.def_pass_cmp), 2) as def_pass_cmp
, round(avg(t0.def_pass_yds), 2) as def_pass_yds
, round(avg(t0.def_pass_tds), 2) as def_pass_tds
, round(avg(t1.def_int), 4) as def_int
, round(avg(t0.def_rush_att), 2) as def_rush_att
, round(avg(t0.def_rush_yds), 2) as def_rush_yds
, round(avg(t0.def_rush_tds), 2) as def_rush_tds
, round(avg(t1.def_fumble), 4) as def_fumble
, round(avg(t0.def_targets), 2) as def_targets
, round(avg(t0.def_rec), 2) as def_rec
, round(avg(t0.def_rec_yds), 2) as def_rec_yds
, round(avg(t0.def_rec_tds), 2) as def_rec_tds
, round(avg(t0.def_yac), 2) as def_yac
, round(cast(avg(t1.def_sack) as numeric), 4) as def_sack
, round(avg(t1.def_block), 4) as def_block
, round(avg(t1.def_safety), 4) as def_safety
, round(avg(t1.def_tds), 4) as def_tds
from public.team as t
join public.game as g on t.team_id = g.away_team or t.team_id = g.home_team
join (
select pp.gsis_id
, pp.team
, sum(pp.passing_att) as def_pass_att
, sum(pp.passing_cmp) as def_pass_cmp
, sum(pp.passing_yds) as def_pass_yds
, sum(pp.passing_tds) as def_pass_tds
, sum(pp.rushing_att) as def_rush_att
, sum(pp.rushing_yds) as def_rush_yds
, sum(pp.rushing_tds) as def_rush_tds
, sum(pp.receiving_tar) as def_targets
, sum(pp.receiving_rec) as def_rec
, sum(pp.receiving_yds) as def_rec_yds
, sum(pp.receiving_tds) as def_rec_tds
, sum(pp.receiving_yac_yds) as def_yac
from public.play_player as pp
group by pp.gsis_id, pp.team
) as t0 on g.gsis_id = t0.gsis_id
and t0.team != t.team_id
join (
select pp.gsis_id
, pp.team
, sum(pp.defense_int) as def_int
, sum(pp.defense_frec) as def_fumble
, sum(pp.defense_sk) as def_sack
, sum(pp.defense_fgblk + pp.defense_puntblk + pp.defense_xpblk) as def_block
, sum(pp.defense_safe) as def_safety
, sum(pp.defense_frec_tds + pp.defense_int_tds + pp.defense_misc_tds + pp.kickret_tds + pp.puntret_tds) as def_tds
from public.play_player as pp
group by pp.gsis_id, pp.team
) as t1 on g.gsis_id = t1.gsis_id
and t1.team = t.team_id
group by g.season_year, t.team_id;
--Updates the defensive points for each team
update season_def_rankings
set def_pts = round(t0.pts, 4)
from (
select g.season_year
, t.team_id
--Score can be either home or away
, avg(case when t.team_id = g.home_team then g.away_score else g.home_score end) as pts
from public.team as t
join public.game as g on g.home_team = t.team_id or g.away_team = t.team_id
where g.finished = 't'
group by g.season_year, t.team_id
) as t0
where season_def_rankings.season_year = t0.season_year and season_def_rankings.team_id = t0.team_id;
--Updates the offensive stats for each team to be the amount of standard deviations away from the average
--Calculated by ((team_average - league_average) / league_std_deviation)
--More negative numbers are worse performing teams and more positive numbers are better performing
insert into season_off_rankings
(
season_year,
team_id,
avg,
off_pts,
off_pass_yds,
off_pass_tds,
off_rush_yds,
off_rush_tds,
off_int,
off_fumble,
off_sack
)
--Calculate offensive stats relative to league averages and standard deviations
select sor.season_year
, sor.team_id
, False
, round(cast( (sor.off_pts - avg.pts ) / std.pts as numeric), 4) as pts
, round(cast( (sor.off_pass_yds - avg.pass_yds ) / std.pass_yds as numeric), 4) as pass_yds
, round(cast( (sor.off_pass_tds - avg.pass_tds ) / std.pass_tds as numeric), 4) as pass_tds
, round(cast( (sor.off_rush_yds - avg.rush_yds ) / std.rush_yds as numeric), 4) as rush_yds
, round(cast( (sor.off_rush_tds - avg.rush_tds ) / std.rush_tds as numeric), 4) as rush_tds
, round(cast( (sor.off_int - avg.int ) / std.int as numeric), 4) as int
, round(cast( (sor.off_fumble - avg.fumble ) / std.fumble as numeric), 4) as fumble
, round(cast( (sor.off_sack - avg.sack ) / std.sack as numeric), 4) as sack
from season_off_rankings as sor
join (
--Calculate the standard deviation for each season
select season_year
, 'UNK'
, stddev(off_pts) as pts
, stddev(off_pass_yds) as pass_yds
, stddev(off_pass_tds) as pass_tds
, stddev(off_rush_yds) as rush_yds
, stddev(off_rush_tds) as rush_tds
, stddev(off_int) as int
, stddev(off_fumble) as fumble
, stddev(off_sack) as sack
from season_off_rankings
group by season_year
) as std on sor.season_year = std.season_year
join (
--Calculate the league average for each season
select season_year
, 'UNK'
, avg(off_pts) as pts
, avg(off_pass_yds) as pass_yds
, avg(off_pass_tds) as pass_tds
, avg(off_rush_yds) as rush_yds
, avg(off_rush_tds) as rush_tds
, avg(off_int) as int
, avg(off_fumble) as fumble
, avg(off_sack) as sack
from season_off_rankings
group by season_year
) as avg on sor.season_year = avg.season_year;
--Updates the offensive stats for each team to be the amount of standard deviations away from the average
--Calculated by ((team_average - league_average) / league_std_deviation)
--More negative numbers are worse performing teams and more positive numbers are better performing
insert into season_off_rankings
(
season_year,
team_id,
avg,
off_pts,
off_pass_yds,
off_pass_tds,
off_rush_yds,
off_rush_tds,
off_int,
off_fumble,
off_sack
)
--Calculate the standard deviation for each season
select season_year
, 'UNK'
, False
, round(cast(stddev(sor.off_pts) as numeric), 4)
, round(cast(stddev(sor.off_pass_yds) as numeric), 4)
, round(cast(stddev(sor.off_pass_tds) as numeric), 4)
, round(cast(stddev(sor.off_rush_yds) as numeric), 4)
, round(cast(stddev(sor.off_rush_tds) as numeric), 4)
, round(cast(stddev(sor.off_int) as numeric), 4)
, round(cast(stddev(sor.off_fumble) as numeric), 4)
, round(cast(stddev(sor.off_sack) as numeric), 4)
from season_off_rankings as sor
where sor.avg = True
group by sor.season_year;
--Updates the defensive stats for each team to be relative to the league average for the season
--Calculated by ((team_average - league_average) / league_std_deviation)
--More negative numbers are worse performing teams and more positive numbers are better performing
insert into season_def_rankings
(
season_year
, team_id
, avg
, def_pts
, def_pass_att
, def_pass_cmp
, def_pass_yds
, def_pass_tds
, def_int
, def_rush_att
, def_rush_yds
, def_rush_tds
, def_fumble
, def_targets
, def_rec
, def_rec_yds
, def_rec_tds
, def_yac
, def_sack
, def_block
, def_safety
, def_tds
)
--Calculate defensive stats relative to league averages
select sdr.season_year
, sdr.team_id
, False
, round(cast((sdr.def_pts - avg.pts) * 1.0 / std.pts as numeric), 4) as pts
, round(cast((sdr.def_pass_att - avg.pass_att) * 1.0 / std.pass_att as numeric), 4) as pass_att
, round(cast((sdr.def_pass_cmp - avg.pass_cmp) * 1.0 / std.pass_cmp as numeric), 4) as pass_cmp
, round(cast((sdr.def_pass_yds - avg.pass_yds) * 1.0 / std.pass_yds as numeric), 4) as pass_yds
, round(cast((sdr.def_pass_tds - avg.pass_tds) * 1.0 / std.pass_tds as numeric), 4) as pass_tds
, round(cast((sdr.def_int - avg.int) * 1.0 / std.int as numeric), 4) as int
, round(cast((sdr.def_rush_att - avg.rush_att) * 1.0 / std.rush_att as numeric), 4) as rush_att
, round(cast((sdr.def_rush_yds - avg.rush_yds) * 1.0 / std.rush_yds as numeric), 4) as rush_yds
, round(cast((sdr.def_rush_tds - avg.rush_tds) * 1.0 / std.rush_tds as numeric), 4) as rush_tds
, round(cast((sdr.def_fumble - avg.fumble) * 1.0 / std.fumble as numeric), 4) as fumble
, round(cast((sdr.def_targets - avg.targets) * 1.0 / std.targets as numeric), 4) as targets
, round(cast((sdr.def_rec - avg.rec) * 1.0 / std.rec as numeric), 4) as rec
, round(cast((sdr.def_rec_yds - avg.rec_yds) * 1.0 / std.rec_yds as numeric), 4) as rec_yds
, round(cast((sdr.def_rec_tds - avg.rec_tds) * 1.0 / std.rec_tds as numeric), 4) as rec_tds
, round(cast((sdr.def_yac - avg.yac) * 1.0 / std.yac as numeric), 4) as yac
, round(cast((sdr.def_sack - avg.sack) * 1.0 / std.sack as numeric), 4) as sack
, round(cast((sdr.def_block - avg.block) * 1.0 / std.block as numeric), 4) as block
, round(cast((sdr.def_safety - avg.safety) * 1.0 / std.safety as numeric), 4) as safety
, round(cast((sdr.def_tds - avg.tds) * 1.0 / std.tds as numeric), 4) as tds
from season_def_rankings as sdr
join (
--Calculate the standard dev for each season
select season_year
, stddev(def_pts) as pts
, stddev(def_pass_att) as pass_att
, stddev(def_pass_cmp) as pass_cmp
, stddev(def_pass_yds) as pass_yds
, stddev(def_pass_tds) as pass_tds
, stddev(def_int) as int
, stddev(def_rush_att) as rush_att
, stddev(def_rush_yds) as rush_yds
, stddev(def_rush_tds) as rush_tds
, stddev(def_fumble) as fumble
, stddev(def_targets) as targets
, stddev(def_rec) as rec
, stddev(def_rec_yds) as rec_yds
, stddev(def_rec_tds) as rec_tds
, stddev(def_yac) as yac
, stddev(def_sack) as sack
, stddev(def_block) as block
, stddev(def_safety) as safety
, stddev(def_tds) as tds
from season_def_rankings
group by season_year
) as std on std.season_year = sdr.season_year
join (
--Calculate the league average for each season
select season_year
, avg(def_pts) as pts
, avg(def_pass_att) as pass_att
, avg(def_pass_cmp) as pass_cmp
, avg(def_pass_yds) as pass_yds
, avg(def_pass_tds) as pass_tds
, avg(def_int) as int
, avg(def_rush_att) as rush_att
, avg(def_rush_yds) as rush_yds
, avg(def_rush_tds) as rush_tds
, avg(def_fumble) as fumble
, avg(def_targets) as targets
, avg(def_rec) as rec
, avg(def_rec_yds) as rec_yds
, avg(def_rec_tds) as rec_tds
, avg(def_yac) as yac
, avg(def_sack) as sack
, avg(def_block) as block
, avg(def_safety) as safety
, avg(def_tds) as tds
from season_def_rankings
group by season_year
) as avg on avg.season_year = sdr.season_year;
insert into season_def_rankings
(
season_year
, team_id
, avg
, def_pts
, def_pass_att
, def_pass_cmp
, def_pass_yds
, def_pass_tds
, def_int
, def_rush_att
, def_rush_yds
, def_rush_tds
, def_fumble
, def_targets
, def_rec
, def_rec_yds
, def_rec_tds
, def_yac
, def_sack
, def_block
, def_safety
, def_tds
)
select season_year
, 'UNK'
, False
, round(cast(stddev(sor.def_pts) as numeric), 4)
, round(cast(stddev(def_pass_att) as numeric), 4)
, round(cast(stddev(def_pass_cmp) as numeric), 4)
, round(cast(stddev(def_pass_yds) as numeric), 4)
, round(cast(stddev(def_pass_tds) as numeric), 4)
, round(cast(stddev(def_int) as numeric), 4)
, round(cast(stddev(def_rush_att) as numeric), 4)
, round(cast(stddev(def_rush_yds) as numeric), 4)
, round(cast(stddev(def_rush_tds) as numeric), 4)
, round(cast(stddev(def_fumble) as numeric), 4)
, round(cast(stddev(def_targets) as numeric), 4)
, round(cast(stddev(def_rec) as numeric), 4)
, round(cast(stddev(def_rec_yds) as numeric), 4)
, round(cast(stddev(def_rec_tds) as numeric), 4)
, round(cast(stddev(def_yac) as numeric), 4)
, round(cast(stddev(def_sack) as numeric), 4)
, round(cast(stddev(def_block) as numeric), 4)
, round(cast(stddev(def_safety) as numeric), 4)
, round(cast(stddev(def_tds) as numeric), 4)
from season_def_rankings as sor
where sor.avg = True
group by sor.season_year;
insert into public.season_rankings
(
season_year
, team_id
, avg
, off_pts
, off_pass_yds
, off_pass_tds
, off_rush_yds
, off_rush_tds
, off_int
, off_fumble
, off_sack
, def_pts
, def_pass_att
, def_pass_cmp
, def_pass_yds
, def_pass_tds
, def_int
, def_rush_att
, def_rush_yds
, def_rush_tds
, def_fumble
, def_targets
, def_rec
, def_rec_yds
, def_rec_tds
, def_yac
, def_sack
, def_block
, def_safety
, def_tds
)
select sor.season_year
, sor.team_id
, sor.avg
, sor.off_pts
, sor.off_pass_yds
, sor.off_pass_tds
, sor.off_rush_yds
, sor.off_rush_tds
, sor.off_int
, sor.off_fumble
, sor.off_sack
, sdr.def_pts
, sdr.def_pass_att
, sdr.def_pass_cmp
, sdr.def_pass_yds
, sdr.def_pass_tds
, sdr.def_int
, sdr.def_rush_att
, sdr.def_rush_yds
, sdr.def_rush_tds
, sdr.def_fumble
, sdr.def_targets
, sdr.def_rec
, sdr.def_rec_yds
, sdr.def_rec_tds
, sdr.def_yac
, sdr.def_sack
, sdr.def_block
, sdr.def_safety
, sdr.def_tds
from season_off_rankings as sor
join season_def_rankings as sdr on sor.team_id = sdr.team_id and sor.season_year = sdr.season_year and sor.avg = sdr.avg |
/*
Navicat Premium Data Transfer
Source Server Type : MySQL
Source Server Version : 80016
Source Host : localhost:3306
Source Schema : haima_master
Date: 03/09/2019 15:12:34
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for phalapi_user
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'UID',
`username` varchar(100) NOT NULL DEFAULT '' COMMENT '用户名',
`nickname` varchar(50) DEFAULT '' COMMENT '昵称',
`password` varchar(64) NOT NULL DEFAULT '' COMMENT '密码',
`salt` varchar(32) DEFAULT NULL COMMENT '随机加密因子',
`reg_time` int(11) DEFAULT '0' COMMENT '注册时间',
`avatar` varchar(255) DEFAULT '' COMMENT '头像',
`uuid` varchar(32) DEFAULT NULL COMMENT 'uuid',
`ext_info` json DEFAULT NULL COMMENT '用户扩展信息',
PRIMARY KEY (`id`),
UNIQUE KEY `username_unique_key` (`username`),
UNIQUE KEY `uuid_unique_key` (`uuid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_login_qq
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_login_qq` (
`id` bigint(10) NOT NULL AUTO_INCREMENT,
`qq_openid` varchar(28) DEFAULT '' COMMENT 'QQ的OPENID',
`qq_token` varchar(150) DEFAULT '' COMMENT 'QQ的TOKEN',
`qq_expires_in` int(10) DEFAULT '0' COMMENT 'QQ的失效时间',
`user_id` bigint(10) DEFAULT '0' COMMENT '绑定的用户ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_login_weixin
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_login_weixin` (
`id` bigint(10) NOT NULL AUTO_INCREMENT,
`wx_openid` varchar(28) DEFAULT '' COMMENT '微信OPENID',
`wx_token` varchar(150) DEFAULT '' COMMENT '微信TOKEN',
`wx_expires_in` int(10) DEFAULT '0' COMMENT '微信失效时间',
`user_id` bigint(10) DEFAULT '0' COMMENT '绑定的用户ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_0
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_0` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_1
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_1` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_2
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_2` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_3
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_3` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_4
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_4` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_5
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_5` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_6
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_6` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_7
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_7` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_8
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_8` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for phalapi_user_session_9
-- ----------------------------
CREATE TABLE IF NOT EXISTS `phalapi_user_session_9` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
`token` varchar(64) DEFAULT '' COMMENT '登录token',
`client` varchar(32) DEFAULT '' COMMENT '客户端来源',
`times` int(6) DEFAULT '0' COMMENT '登录次数',
`login_time` int(11) DEFAULT '0' COMMENT '登录时间',
`expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
`ext_data` text COMMENT 'json data here',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS user;
CREATE TABLE user
(
id BIGINT AUTO_INCREMENT,
twitter_id INT,
facebook_id INT,
image_url VARCHAR(100),
screen_name VARCHAR(20),
lang VARCHAR(10),
created_at DATETIME,
INDEX (twitter_id),
PRIMARY KEY (id)
) ENGINE=INNODB;;
SET FOREIGN_KEY_CHECKS=1;
/*
CREATE TABLE user (
`user_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARBINARY(32) NOT NULL,
`created` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (user_id),
UNIQUE KEY (name),
KEY (created)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
*/
|
/*
* Copyright (C) 2006 by JSC Telasi
* http://www.telasi.ge
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
SELECT
R.ID,
R.RECALC_NUMBER,
R.CUSTOMER,
R.ACCOUNT,
R.CREATE_DATE,
R.DESCRIPTION,
R.IS_CHANGED,
R.SAVE_DATE,
R.SAVE_PERSON SAVE_PERSON_ID,
R.ADVISOR ADVISOR_ID,
R.INIT_BALANCE,
R.FINAL_BALANCE,
C.ACCNUMB,
C.CUSTNAME,
A.ACCID,
TRIM(ST.STREETNAME) || ' ' || TRIM(ADRS.HOUSE) ADDRESS
FROM
RECUT.RECALC R, BS.CUSTOMER C, BS.ACCOUNT A,
BS.ADDRESS ADRS, BS.STREET ST
WHERE
R.CUSTOMER = C.CUSTKEY AND
A.ACCKEY = R.ACCOUNT AND
ADRS.PREMISEKEY = C.PREMISEKEY AND
ADRS.STREETKEY = ST.STREETKEY |
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 16, 2015 at 03:37 AM
-- Server version: 5.6.19-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `examportal`
--
-- --------------------------------------------------------
--
-- Table structure for table `answers`
--
CREATE TABLE IF NOT EXISTS `answers` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`schedule_id` bigint(20) DEFAULT NULL,
`question_paper_id` bigint(20) DEFAULT NULL,
`group_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`question_id` int(11) DEFAULT NULL,
`answer` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_answers_1_idx` (`question_paper_id`),
KEY `fk_answers_2_idx` (`schedule_id`),
KEY `fk_answers_3_idx` (`group_id`),
KEY `fk_answers_4_idx` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=89 ;
--
-- Dumping data for table `answers`
--
INSERT INTO `answers` (`id`, `schedule_id`, `question_paper_id`, `group_id`, `user_id`, `question_id`, `answer`) VALUES
(65, 80, 198, 75, 57, 140, 'C'),
(66, 80, 198, 75, 57, 141, 'B'),
(67, 80, 198, 75, 57, 142, 'B'),
(68, 80, 198, 75, 57, 143, ' asdasd'),
(69, 80, 198, 75, 57, 144, ' primary'),
(70, 80, 198, 75, 57, 145, ' dsdsdsds'),
(71, 83, 199, 71, 57, 146, 'D'),
(72, 83, 199, 71, 57, 147, ' dsdsdsdfdffd'),
(73, 83, 199, 71, 57, 148, 'B'),
(74, 83, 199, 71, 57, 149, 'D'),
(75, 83, 199, 71, 57, 150, 'A'),
(76, 83, 199, 71, 57, 151, 'A'),
(77, 84, 199, 75, 57, 146, 'A'),
(78, 84, 199, 75, 57, 147, ' vxcvxcvcvcvc'),
(79, 84, 199, 75, 57, 148, 'D'),
(80, 84, 199, 75, 57, 149, 'C'),
(81, 84, 199, 75, 57, 150, 'D'),
(82, 84, 199, 75, 57, 151, 'B'),
(83, 80, 198, 75, 54, 140, 'C'),
(84, 80, 198, 75, 54, 141, 'D'),
(85, 80, 198, 75, 54, 142, 'D'),
(86, 80, 198, 75, 54, 143, 'dfsdfsddsdssd '),
(87, 80, 198, 75, 54, 144, 'klklklklklk '),
(88, 80, 198, 75, 54, 145, ' lklklklklk');
-- --------------------------------------------------------
--
-- Table structure for table `groups`
--
CREATE TABLE IF NOT EXISTS `groups` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`creator_id` bigint(20) DEFAULT NULL,
`name` varchar(45) DEFAULT NULL,
`description` varchar(45) DEFAULT NULL,
`parent_group_id` int(11) NOT NULL,
`group_type_id` int(11) NOT NULL,
`time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_group_1_idx` (`creator_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=81 ;
--
-- Dumping data for table `groups`
--
INSERT INTO `groups` (`id`, `creator_id`, `name`, `description`, `parent_group_id`, `group_type_id`, `time`) VALUES
(71, 51, 'MSc(CA) 2014-16', 'Masters of Science in Computer Applications', 0, 0, '2015-10-15 20:04:10'),
(72, 51, 'MBA(IT) 2014-16', 'MBA in Information Technology', 0, 0, '2015-10-15 22:30:06'),
(74, 51, 'RDBMS', 'Semester 1 Relational Database Management Sys', 71, 0, '2015-10-15 22:31:41'),
(75, 51, 'JavaScript', 'Semester 1 (HTML , HTML 5 )', 71, 0, '2015-10-15 22:32:26'),
(76, 51, 'R Programming', 'Data Mining and Data Clustering', 71, 0, '2015-10-15 22:41:27'),
(77, 51, 'TCS', 'Aptitude Test', 0, 0, '2015-10-15 22:42:01'),
(78, 51, 'Wipro', 'Technical Test', 0, 0, '2015-10-15 22:42:21'),
(79, 51, 'BBA(IT)', 'Under Graduation Programme', 0, 0, '2015-10-15 22:43:01'),
(80, 51, 'SPM', 'Project Management Specialization', 72, 0, '2015-10-15 22:50:42');
-- --------------------------------------------------------
--
-- Table structure for table `group_type`
--
CREATE TABLE IF NOT EXISTS `group_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_type` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `question`
--
CREATE TABLE IF NOT EXISTS `question` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`question_paper_id` bigint(20) DEFAULT NULL,
`question` varchar(800) DEFAULT NULL,
`a` varchar(45) DEFAULT NULL,
`b` varchar(45) DEFAULT NULL,
`c` varchar(45) DEFAULT NULL,
`d` varchar(45) DEFAULT NULL,
`answer` varchar(1000) DEFAULT NULL,
`value` bigint(20) DEFAULT NULL,
`question_type` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_question_1_idx` (`question_paper_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=152 ;
--
-- Dumping data for table `question`
--
INSERT INTO `question` (`id`, `question_paper_id`, `question`, `a`, `b`, `c`, `d`, `answer`, `value`, `question_type`) VALUES
(140, 198, ' Consider the following snippet code\n\nvar string1 = â€123â€;\nvar intvalue = 123;\nalert( string1 + intvalue );\n\n\nThe Result will be', '123246', '246', '123123', 'Exception', 'C', 1, 1),
(141, 198, 'A function definition expression can be called', 'Function prototype', 'Function literal', 'Function definition', 'Function declaration', 'B', 1, 1),
(142, 198, 'The property of a primary expression is', 'stand-alone expressions', 'basic expressions containing all necessary fu', 'contains variable references alone', 'complex expressions', 'A', 1, 1),
(143, 198, 'The JavaScript’s syntax calling ( or executing ) a function or method is called', '', '', '', '', 'invocation Expression', 1, 2),
(144, 198, 'What kind of an expression is “new Point(2,3)â€', '', '', '', '', 'Object Creation Expression', 1, 2),
(145, 198, '“An expression that can legally appear on the left side of an assignment expression.†is a well known explanation for variables, properties of objects, and elements of arrays. They are called', '', '', '', '', 'Lvalue', 1, 2),
(146, 199, 'The behaviour of the instances present of a class inside a method is defined by', 'Method', 'Classes', 'Interfaces', 'Classes and Interfaces', 'B', 1, 1),
(147, 199, 'The keyword or the property that you use to refer to an object through which they were invoked i', '', '', '', '', 'this', 1, 2),
(148, 199, 'The basic difference between JavaScript and Java is', 'There is no difference', ' Functions are considered as fields', '. Variables are specific', 'functions are values, and there is no hard di', 'D', 1, 1),
(149, 199, 'The meaning for Augmenting classes is that', 'objects inherit prototype properties even in ', 'objects inherit prototype properties only in ', 'objects inherit prototype properties in stati', ' None of the mentioned', 'A', 1, 1),
(150, 199, ' The property of JSON() method is:', 'it can be invoked manually as object.JSON()', 'it will be automatically invoked by the compi', 'it is invoked automatically by the JSON.strin', ' it cannot be invoked in any form', 'C', 1, 1),
(151, 199, 'When a class B can extend another class A, we say that', 'A is the superclass and B is the subclass', ' B is the superclass and A is the subclass', '. Both A and B are the superclas', ' Both A and B are the subclass', 'A', 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `question_paper`
--
CREATE TABLE IF NOT EXISTS `question_paper` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`name` varchar(200) DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
`time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_question_paper_1_idx` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=200 ;
--
-- Dumping data for table `question_paper`
--
INSERT INTO `question_paper` (`id`, `user_id`, `name`, `description`, `time`) VALUES
(198, 51, 'Java Script Test 1', 'Expressions and Operators', '2015-10-15 22:59:57'),
(199, 51, 'JavaScript Exam2', 'Classes in JS', '2015-10-15 23:14:09');
-- --------------------------------------------------------
--
-- Table structure for table `role`
--
CREATE TABLE IF NOT EXISTS `role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
--
-- Dumping data for table `role`
--
INSERT INTO `role` (`id`, `name`) VALUES
(1, 'admin'),
(2, 'supervisor'),
(3, 'invigilator'),
(4, 'applicant'),
(5, 'undefined');
-- --------------------------------------------------------
--
-- Table structure for table `schedule`
--
CREATE TABLE IF NOT EXISTS `schedule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`creator_id` bigint(20) DEFAULT NULL,
`question_paper_id` bigint(20) DEFAULT NULL,
`group_id` bigint(20) DEFAULT NULL,
`start_time` datetime DEFAULT NULL,
`end_time` datetime DEFAULT NULL,
`time` time DEFAULT NULL,
`attempt` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_schedule_1_idx` (`group_id`),
KEY `fk_schedule_2_idx` (`question_paper_id`),
KEY `fk_schedule_3_idx` (`creator_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=85 ;
--
-- Dumping data for table `schedule`
--
INSERT INTO `schedule` (`id`, `creator_id`, `question_paper_id`, `group_id`, `start_time`, `end_time`, `time`, `attempt`) VALUES
(80, 51, 198, 75, '2015-10-15 23:21:00', '2015-10-16 23:22:00', '01:00:00', 0),
(83, 51, 199, 71, '2015-10-16 01:57:00', '2015-10-17 01:58:00', '01:00:00', 0),
(84, 51, 199, 75, '2015-10-16 02:00:00', '2015-10-17 02:01:00', '01:00:00', 0);
-- --------------------------------------------------------
--
-- Table structure for table `scores`
--
CREATE TABLE IF NOT EXISTS `scores` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`schedule_id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
`score` bigint(20) NOT NULL,
`start_time` datetime DEFAULT NULL,
`submit_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=88 ;
--
-- Dumping data for table `scores`
--
INSERT INTO `scores` (`id`, `schedule_id`, `user_id`, `score`, `start_time`, `submit_time`) VALUES
(84, 80, 57, 2, '2015-10-16 01:25:58', '2015-10-16 01:27:44'),
(85, 83, 57, 1, '2015-10-16 02:12:50', '2015-10-16 02:19:21'),
(86, 84, 57, 1, '2015-10-16 02:21:21', '2015-10-16 02:22:32'),
(87, 80, 54, 1, '2015-10-16 02:48:58', '2015-10-16 02:54:24');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`role_id` bigint(20) DEFAULT NULL,
`name` varchar(45) DEFAULT NULL,
`password` varchar(45) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`phone` varchar(45) DEFAULT NULL,
`time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
KEY `fk_user_1_idx` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=58 ;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `role_id`, `name`, `password`, `email`, `phone`, `time`) VALUES
(50, 1, 'kinnary raval', 'e10adc3949ba59abbe56e057f20f883e', 'ravalkinnary.ec@gmail.com', '9673658512', '2015-10-13 05:23:33'),
(51, 2, 'deep singh baweja', 'e10adc3949ba59abbe56e057f20f883e', 'deepwired@gmail.com', '7798143430', '2015-10-13 14:16:17'),
(54, 4, 'karan manshani', 'e10adc3949ba59abbe56e057f20f883e', 'karan@manshani.com', '7567560018', '2015-10-12 06:13:16'),
(57, 4, 'jay jayswal', 'e10adc3949ba59abbe56e057f20f883e', 'jjay2310@gmail.com', '9673658512', '2015-10-15 07:15:25');
-- --------------------------------------------------------
--
-- Table structure for table `user_group`
--
CREATE TABLE IF NOT EXISTS `user_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`group_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_user_group_1_idx` (`group_id`),
KEY `fk_user_group_2_idx` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=322 ;
--
-- Dumping data for table `user_group`
--
INSERT INTO `user_group` (`id`, `user_id`, `group_id`) VALUES
(318, 54, 71),
(319, 57, 71),
(320, 54, 75),
(321, 57, 75);
-- --------------------------------------------------------
--
-- Table structure for table `user_interaction`
--
CREATE TABLE IF NOT EXISTS `user_interaction` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sender_id` int(11) NOT NULL,
`message` varchar(255) NOT NULL,
`receiver_role_id` int(11) NOT NULL,
`receiver_id` int(11) NOT NULL,
`time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `user_interaction`
--
INSERT INTO `user_interaction` (`id`, `sender_id`, `message`, `receiver_role_id`, `receiver_id`, `time`) VALUES
(1, 54, 'hi kinn', 4, 50, NULL),
(2, 51, 'Regarding u : u r d best', 0, 0, '2015-10-15 00:17:45'),
(3, 51, 'Regarding Evaluation of Sem 1 Javascript Paper : Our faculty has asked questions out of scope. We request to inform about syllabus in detail from next time', 0, 0, '2015-10-16 02:42:32');
--
-- Constraints for dumped tables
--
--
-- Constraints for table `answers`
--
ALTER TABLE `answers`
ADD CONSTRAINT `fk_answers_1` FOREIGN KEY (`question_paper_id`) REFERENCES `question_paper` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_answers_2` FOREIGN KEY (`schedule_id`) REFERENCES `schedule` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_answers_3` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_answers_4` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `groups`
--
ALTER TABLE `groups`
ADD CONSTRAINT `fk_group_1` FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `question`
--
ALTER TABLE `question`
ADD CONSTRAINT `fk_question_1` FOREIGN KEY (`question_paper_id`) REFERENCES `question_paper` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `question_paper`
--
ALTER TABLE `question_paper`
ADD CONSTRAINT `fk_question_paper_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `schedule`
--
ALTER TABLE `schedule`
ADD CONSTRAINT `fk_schedule_1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_schedule_2` FOREIGN KEY (`question_paper_id`) REFERENCES `question_paper` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_schedule_3` FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `fk_user_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `user_group`
--
ALTER TABLE `user_group`
ADD CONSTRAINT `fk_user_group_1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_user_group_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
create table if not exists resource_master (
resource_id int AUTO_INCREMENT,
resource_name VARCHAR(100),
PRIMARY KEY (resource_id)
);
|
DROP TABLE IF EXISTS notebook;
CREATE TABLE notebook (_id integer primary key, heading text not null, description text not null, remove integer);
INSERT INTO notebook (heading, description, remove) VALUES("Note1", "Note 1: Android is the Linux Operative system.", 0);
INSERT INTO notebook (heading, description, remove) VALUES("Note2", "Note 2:", 0);
INSERT INTO notebook (heading, description, remove) VALUES("Note3", "Note 3:", 0);
|
/* Formatted on 21/07/2014 18:38:46 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_WRK_RAPP_DA_VAL_POS_AL
(
COD_STATO,
COD_ABI,
COD_NDG,
COD_SNDG,
COD_PROTOCOLLO_DELIBERA,
VAL_CNT_RAPPORTI,
VAL_ALERT,
VAL_CNT_DELIBERE,
FLG_ACC
)
AS
SELECT cod_stato,
cod_abi_cartolarizzato cod_abi,
cod_ndg,
cod_sndg,
SUBSTR (concs, 38, 17) AS cod_protocollo_delibera,
TO_NUMBER (SUBSTR (concs, 55)) val_cnt_rapporti,
'R' AS val_alert,
1 AS val_cnt_delibere,
DECODE (concs, TO_CHAR (NULL), 0, 1) AS flg_acc
FROM (SELECT uf.cod_stato,
uf.cod_abi_cartolarizzato,
uf.cod_ndg,
uf.cod_sndg,
(SELECT -- 04.10.2012 V3 - AGGIUNTA EXISTS SULLE STIME, DA OTTIMIZZARE SE POSSIBILE
-- 04.10.2012 V4 - RICOSTRUITA LOGICA CON JOIN SENZA T_MCRE0_APP_ALL_DATA, COD_STATO S SEMPRE A NULL
-- 12.10.2012 V4.1 - AGGIUNTE STIME EXTRA
-- 15.10.2012 V.4.2 TOLTE STIME EXTRA -- LA PAGINA DI EXTRA DELIBERA NON COMPORTA LA SCRITTURA NELLA STIME EXTRA
-- CREATA VISTA V_MCREI_MAX_STIME
DISTINCT
pr.cod_abi
|| pr.cod_ndg
|| pr.cod_sndg
|| pr.cod_protocollo_delibera
|| TO_CHAR (
COUNT (pr.cod_rapporto)
OVER (PARTITION BY pr.cod_abi, pr.cod_ndg))
FROM (SELECT DISTINCT ppcr.cod_abi,
ppcr.cod_ndg,
ppcr.cod_sndg,
ppcr.cod_rapporto,
ppcr.cod_protocollo_delibera
FROM (SELECT DISTINCT
pcr.cod_abi,
pcr.cod_ndg,
pcr.cod_sndg,
pcr.cod_rapporto,
s1.cod_protocollo_delibera,
SUM (
pcr.val_imp_utilizzato)
OVER (
PARTITION BY pcr.cod_abi,
pcr.cod_ndg,
pcr.cod_rapporto)
val_imp_utilizzato
FROM t_mcrei_app_rapporti_estero re,
t_mcrei_app_pcr_rapporti pcr,
V_MCREI_MAX_STIME s1,
T_MCRE0_APP_NATURA_FTECNICA ft
WHERE pcr.cod_abi = s1.cod_abi
AND pcr.cod_ndg = s1.cod_ndg
AND pcr.cod_abi = re.cod_abi(+)
AND pcr.cod_ndg = re.cod_ndg(+)
AND pcr.cod_rapporto =
re.cod_rapporto_estero(+)
AND re.cod_rapporto_estero IS NULL
AND PCR.COD_CLASSE_FT IS NOT NULL
AND PCR.cod_forma_tecnica =
ft.cod_ftecnica
-- AND PCR.COD_CLASSE_FT IN
-- ('CA', 'FI')
-- AND ft.cod_natura = '02'
AND ( PCR.COD_CLASSE_FT = 'FI'
OR ( PCR.COD_CLASSE_FT = 'CA'
AND ft.cod_natura = '02'))) ppcr
WHERE ppcr.val_imp_utilizzato > 0) pr,
--- (2) PCR A MENO DI RAPPORTI ESTERI E POS
V_MCREI_MAX_STIME2 s2
--- (2) STIME LIVELLO RAPPORTO INSIEMI CON MAX_DTA_STIMA
WHERE pr.cod_abi = s2.cod_abi(+)
AND pr.cod_ndg = s2.cod_ndg(+)
AND pr.cod_rapporto = s2.cod_rapporto(+)
AND PR.COD_PROTOCOLLO_DELIBERA =
S2.COD_PROTOCOLLO_DELIBERA(+)
AND s2.cod_rapporto IS NULL
AND pr.cod_abi = uf.cod_abi_cartolarizzato
AND pr.cod_ndg = uf.cod_ndg)
concs
FROM v_mcre0_app_upd_fields uf
WHERE flg_target = 'Y'
AND flg_outsourcing = 'Y'
AND uf.cod_stato = 'IN'
AND uf.id_utente IS NOT NULL
AND uf.id_utente != -1)
WHERE concs IS NOT NULL;
|
/*
Navicat MySQL Data Transfer
Source Server : root
Source Server Version : 80016
Source Host : localhost:3307
Source Database : mysql
Target Server Type : MYSQL
Target Server Version : 80016
File Encoding : 65001
Date: 2019-06-18 22:28:32
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for wc_menu_info
-- ----------------------------
DROP TABLE IF EXISTS `wc_menu_info`;
CREATE TABLE `wc_menu_info` (
`MENU_ID` int(10) NOT NULL AUTO_INCREMENT,
`MENU_URL` varchar(255) DEFAULT NULL,
`MENU_PID` int(10) DEFAULT NULL,
`MENU_ORDER` int(4) DEFAULT NULL,
`MENU_SHOW` char(1) NOT NULL,
`CREATE_TIME` date DEFAULT NULL,
`UPDATE_TIME` date DEFAULT NULL,
PRIMARY KEY (`MENU_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
SELECT
'alley lights out',
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.alley_lights_out_311
GROUP BY 1
UNION ALL
SELECT
'building_violations',
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.building_violations
GROUP BY 1
UNION ALL
SELECT
'crimes theft=' || CASE WHEN json_data::json->>'primary_type' IN ('THEFT', 'BURGLARY', 'ROBBERY', 'MOTOR VEHICLE THEFT') THEN 'theft' ELSE 'non-theft' END,
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.crimes
GROUP BY 1
UNION ALL
SELECT
'food inspections results=' || CAST(json_data::json->>'results' AS text),
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.food_inspections
WHERE
json_data::json->>'results' IN ('Pass', 'Fail', 'Pass w/ Conditions')
GROUP BY 1
UNION ALL
SELECT
'graffiti',
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.graffiti_311
GROUP BY 1
UNION ALL
SELECT
'liquor_licenses',
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.liquor_licenses
GROUP BY 1
UNION ALL
SELECT
'red light tickets',
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.redlight_tickets
GROUP BY 1
UNION ALL
SELECT
'sanitation requests',
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.sanitation_311
GROUP BY 1
UNION ALL
SELECT
'vacant gang/homeless=' || COALESCE(json_data::json->>'any_people_using_property_homeless_childen_gangs', 'false'),
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.vacant_311
GROUP BY 1
UNION ALL
SELECT
'tweets=' || CASE WHEN CAST(json_data::json->>'s_score' AS float) * CAST(json_data::json->>'s_magnitude' AS float) <= 0.25 THEN 'bad' WHEN CAST(json_data::json->>'s_score' AS float) * CAST(json_data::json->>'s_magnitude' AS float) >= 0.25 THEN 'good' END,
MIN(dt),
MAX(dt),
COUNT(*)
FROM datasets.tweets
WHERE
CAST(json_data::json->>'s_score' AS float) * CAST(json_data::json->>'s_magnitude' AS float) <= 0.25 OR
CAST(json_data::json->>'s_score' AS float) * CAST(json_data::json->>'s_magnitude' AS float) >= 0.25
GROUP BY 1 |
-- phpMyAdmin SQL Dump
-- version 4.2.11
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 28, 2015 at 03:40 PM
-- Server version: 5.6.21
-- PHP Version: 5.6.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `onlineShopping`
--
-- --------------------------------------------------------
--
-- Table structure for table `address`
--
CREATE TABLE IF NOT EXISTS `address` (
`AddID` int(11) NOT NULL,
`Street` varchar(200) DEFAULT NULL,
`City` varchar(100) DEFAULT NULL,
`State` varchar(100) NOT NULL,
`ZipCode` varchar(6) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=510 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `address`
--
INSERT INTO `address` (`AddID`, `Street`, `City`, `State`, `ZipCode`) VALUES
(500, 'c-503 saraswati vihar', 'new delhi', 'Delhi', '110034'),
(501, 'a-23 ranibagh', 'new delhi', 'Delhi', '110088'),
(502, 'b-45 purana kila', 'bikaner', 'Rajasthan', '313001'),
(503, 'd-12 husain sagar', 'sindh', 'Hyderabad', '500002'),
(504, 'Door No 737, Choultry Street', 'Ramanagram', 'Kerala', '320069'),
(505, 'Khans, St. Joseph’s Road', 'Bannimantap', 'Haryana', '112345'),
(506, 'CFTRI House', 'CFTRI', 'Delhi', '110069'),
(507, 'Vanarpet', 'Viveknagar', 'Bihar', '690004'),
(508, 'a-11, big door', 'Outhicamannii House', 'Kerala', '320014'),
(509, 'nd 29, kohat enclave, pitampura', 'new delhi', 'delhi', '110034');
-- --------------------------------------------------------
--
-- Table structure for table `basket`
--
CREATE TABLE IF NOT EXISTS `basket` (
`BID` int(11) NOT NULL,
`CID` int(11) DEFAULT NULL,
`NumProds` int(11) DEFAULT NULL,
`TotalCost` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `basketProds`
--
CREATE TABLE IF NOT EXISTS `basketProds` (
`BID` int(11) DEFAULT NULL,
`PID` int(11) DEFAULT NULL,
`Quatity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `comment`
--
CREATE TABLE IF NOT EXISTS `comment` (
`CommID` int(11) NOT NULL,
`CID` int(11) DEFAULT NULL,
`PID` int(11) DEFAULT NULL,
`Comment` varchar(500) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `comment`
--
INSERT INTO `comment` (`CommID`, `CID`, `PID`, `Comment`) VALUES
(101, 101, 13, 'awesome tennis cap!! '),
(102, 100, 12, 'this racquet is definitely worth the price!'),
(103, 102, 33, 'lost colour after a few washes, not worth the money!'),
(104, 104, 25, 'puma delivers what it promises, love the shoes!'),
(105, 101, 32, 'what a waste of money!'),
(106, 103, 36, 'the best ac in it''s price range!'),
(107, 105, 5, 'worthless piece of sh*t!'),
(108, 102, 9, 'good fit but average quality!'),
(109, 105, 25, 'cool shoes! though a bit overpriced!'),
(110, 103, 13, 'the quality is not up to the mark!'),
(111, 102, 25, 'the shoes tore after a few wears, wouldn''t recommend them to anyone!');
-- --------------------------------------------------------
--
-- Table structure for table `customer`
--
CREATE TABLE IF NOT EXISTS `customer` (
`CID` int(11) NOT NULL,
`CName` varchar(100) NOT NULL,
`CGender` varchar(1) DEFAULT NULL,
`CDOB` date DEFAULT NULL,
`CEmail` varchar(100) NOT NULL,
`CPass` varchar(100) NOT NULL,
`CMobileNo` varchar(15) DEFAULT NULL,
`BillingAddID` int(11) DEFAULT NULL,
`DeliveryAddID` int(11) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=106 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `customer`
--
INSERT INTO `customer` (`CID`, `CName`, `CGender`, `CDOB`, `CEmail`, `CPass`, `CMobileNo`, `BillingAddID`, `DeliveryAddID`) VALUES
(100, 'Akhilesh', 'M', '1994-09-04', 'akhilesh_alliswell@yahoo.com', 'abcd', '9911052855', 500, 500),
(101, 'Mayank', 'M', '1994-09-05', 'mayankjain94@yahoo.com', 'adbc', '9845632157', 501, 501),
(102, 'Aman', 'M', '1992-01-01', 'aman1123@gmail.com', 'pqrs', '9711881372', 502, 502),
(103, 'Akhil', 'M', '1993-10-10', 'akhilnsit12@gmail.com', 'wxyz', '9874563210', 503, 503),
(104, 'Anmol', 'M', '1994-01-01', 'anmolchugh19@yahoo.in', 'asdf', '9658742310', 504, 504),
(105, 'Udit', 'M', '1994-07-06', 'uditarora@gmail.com', 'asds', '9846516555', 509, 509);
-- --------------------------------------------------------
--
-- Table structure for table `orderedProduct`
--
CREATE TABLE IF NOT EXISTS `orderedProduct` (
`OrderID` int(11) NOT NULL DEFAULT '0',
`PID` int(11) NOT NULL DEFAULT '0',
`Quatity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `ordr`
--
CREATE TABLE IF NOT EXISTS `ordr` (
`OrderID` int(11) NOT NULL,
`CID` int(11) DEFAULT NULL,
`PurchaseDate` date NOT NULL,
`PaymentMode` varchar(20) DEFAULT NULL,
`OrderStatus` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `product`
--
CREATE TABLE IF NOT EXISTS `product` (
`PID` int(11) NOT NULL,
`PName` varchar(200) NOT NULL,
`PDesc` varchar(5000) DEFAULT NULL,
`PPrice` float NOT NULL,
`PImgSrc` varchar(500) DEFAULT NULL,
`PStock` int(11) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `product`
--
INSERT INTO `product` (`PID`, `PName`, `PDesc`, `PPrice`, `PImgSrc`, `PStock`) VALUES
(1, 'Samsung Galaxy S', NULL, 30000, 'http://cdn2.gsmarena.com/vv/bigpic/samsung-galaxy-s.jpg', 43),
(2, 'Alienware 17', NULL, 178000, 'http://www.notebookcheck.net/uploads/tx_nbc2/alienware_17_light1_s.jpg', 10),
(3, 'Kingston 8GB', NULL, 300, 'http://s0.static.mymemory.co.uk/images/product_shots/large_25007_1297702795.jpg', 100),
(4, 'Microsoft Geek400 Mouse', NULL, 1100, 'http://static3.shop.indiatimes.com/images/products/additional/original/B1064841_View_1/computers/keyboard-mouse/microsoft-wrls-mobile-mouse-1000.jpg', 25),
(5, 'Microsoft Geek400 Keyboard', NULL, 1500, 'http://blog.garethjmsaunders.co.uk/wp-content/uploads/2012/05/microsoft-intellitype-digital-pro-us.jpg', 25),
(6, 'LG Microwave Oven', NULL, 11000, 'http://www.pricepaaji.com/product_images/MJ3281BPG/520X315/LG-MJ3281BPG-32-Litres-Convection-Microwave-Oven8762.PNG', 30),
(7, 'Inalsa Mixer Grinder', NULL, 4000, 'http://www.inalsaappliances.com/inalsa_cms/productimages/PRD162-362012.jpg', 40),
(8, 'Cosco Football', NULL, 2200, 'http://stat.homeshop18.com/homeshop18/images/productImages/228/cosco-milano-football-medium_e7eed0200cae5484677fe275dcf35cfc.jpg', 110),
(9, 'Nivia Studs', NULL, 3000, 'http://sportspot.in/wordpress/wp-content/uploads/2014/04/Nivia-New-Ultra.jpeg', 50),
(10, 'MRF Bat', NULL, 12000, 'https://www.cricketmerchant.com/media/catalog/product/cache/1/image/600x547/9df78eab33525d08d6e5fb8d27136e95/m/r/mrf-players-special-virat-kohli.jpg', 30),
(11, 'Cosco Cricket Ball', NULL, 100, 'http://img6a.flixcart.com/image/ball/x/c/z/cosco-cricket-ball-cricket-275x275-imadcq32v34htkxq.jpeg', 123),
(12, 'Wilson Lawn Tennis Racquet', NULL, 6000, 'http://thesportmall.in/image/cache/data/372.1-600x600.jpg', 50),
(13, 'Wilson Lawn Tennis Cap', NULL, 600, 'http://ecx.images-amazon.com/images/I/31dHuhXfQGL._SY355_.jpg', 32),
(14, 'Levis Denim Jeans', NULL, 1200, 'http://www.polyvore.com/cgi/img-thing?.out=jpg&size=l&tid=35317992', 150),
(15, 'Levis Denim Jacket', NULL, 5200, 'http://www.upscalehype.com/wp-content/uploads/2010/05/LevisDenimjacket.jpg', 60),
(16, 'Calvin Klein Sweat Shirt', NULL, 2200, 'http://images.asos-media.com/inv/media/3/2/0/6/4186023/image3xl.jpg', 100),
(17, 'Timberland Shorts', NULL, 3200, 'http://www.cargopants.com/gallery/products/1133/big/1299793997_timberland_shorts_-_phantom.jpg', 78),
(18, 'Woodland Sneakers', NULL, 1800, 'http://ecx.images-amazon.com/images/I/815IN7zJ6tL._UL1500_.jpg', 89),
(19, 'Jack and Jones sandals', NULL, 700, 'http://images.shuperb.co.uk/images/products/zoom/1371834102-09324400.jpg', 78),
(20, 'Lacoste formal shoes', NULL, 2300, 'http://www.outfittrends.com/wp-content/uploads/2011/04/New-Lacost-Shoes-2011.jpg', 89),
(21, 'Titan Watch', NULL, 3000, 'http://titanworld.com/in/images/data/collections/PURPLE.png', 23),
(22, 'Gforce Watch', NULL, 3500, 'http://www.gshock.com/resource/img/products/watches/xlarge/GPW1000-1B_xlarge.png', 45),
(23, 'Nike studs', NULL, 5000, 'http://www.footballboots.co.uk/wp-content/uploads/2009/10/Nike-2.jpg', 34),
(25, 'Puma sports shoes', NULL, 4500, 'http://static2.shop.indiatimes.com/images/products/additional/original/B1822313_View_2/fashion/sports/puma-white-men-sports-shoes-pumasurge.jpg', 50),
(27, 'Philips vacuum Cleaner', NULL, 5000, NULL, 31),
(28, 'usha diplomat ceiling fan', NULL, 1079, 'http://img5a.flixcart.com/image/fan/b/x/k/usha-diplomat-400x400-imaeyaur25dejnba.jpeg', 320),
(29, 'Roadster Premium Slim Fit Men''s Trousers', NULL, 1528, 'http://img5a.flixcart.com/image/trouser/x/v/c/395938-roadster-28-400x400-imae56a6pufkmekz.jpeg', 10),
(30, 'Gritstones Solid Men''s Turtle Neck T-Shirt', NULL, 437, 'http://img6a.flixcart.com/image/t-shirt/d/z/w/gsfsrfplkt60054blk-gritstones-s-400x400-imadrwtjynzhefjz.jpeg', 15),
(31, 'Tuscan High power extension cord 4 Strip Surge Protector', NULL, 299, 'http://img6a.flixcart.com/image/surge-protector/k/z/c/tsc-040-tuscan-400x400-imaeyraznrrgxubt.jpeg', 51),
(32, 'Skullcandy S2IKDZ-101 Ink''d 2 Headphone', NULL, 1199, 'http://img6a.flixcart.com/image/headphone/x/t/f/skullcandy-s2ikdz-101-400x400-imaddgqhyqmuukv7.jpeg', 21),
(33, 'Bombay Dyeing Polycotton Printed Double Bedsheet', NULL, 895, 'http://img5a.flixcart.com/image/bedsheet/c/s/3/cs03mr75925001-bombay-dyeing-400x400-imae5zfzp5zf5gga.jpeg', 16),
(34, 'Karma Race and Dash', NULL, 949, 'http://img6a.flixcart.com/image/remote-control-toy/d/2/h/karma-race-and-dash-400x400-imae3yfhj7ukmgdd.jpeg', 35),
(35, 'Audio Technica ATH-ANC23 BK In-the-ear Noise Cancelling Headphone', NULL, 4699, 'http://img6a.flixcart.com/image/headphone/f/2/c/audio-technica-ath-anc23-bk-400x400-imadnyaztbmzq9xb.jpeg', 15),
(36, 'Blue Star 3HW18JB1 1.5 Ton 3 Star Split AC', NULL, 24490, 'http://img6a.flixcart.com/image/air-conditioner-new/f/g/y/1-5-blue-star-split-3hw18jb1-400x400-imadvupthanuzhz9.jpeg', 8);
-- --------------------------------------------------------
--
-- Table structure for table `rating`
--
CREATE TABLE IF NOT EXISTS `rating` (
`CID` int(11) NOT NULL DEFAULT '0',
`PID` int(11) NOT NULL DEFAULT '0',
`Value` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tag`
--
CREATE TABLE IF NOT EXISTS `tag` (
`TagID` int(11) NOT NULL,
`TagName` varchar(100) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=1123 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tag`
--
INSERT INTO `tag` (`TagID`, `TagName`) VALUES
(1007, 'alienware'),
(1030, 'ball'),
(1031, 'balls'),
(1028, 'bat'),
(1029, 'bats'),
(1115, 'calvin'),
(1114, 'calvinklein'),
(1035, 'cap'),
(1098, 'casual'),
(1121, 'cleaner'),
(1038, 'cloth'),
(1037, 'clothes'),
(1039, 'clothing'),
(1099, 'computer'),
(1034, 'cosco'),
(1027, 'cricket'),
(1043, 'denim'),
(1016, 'drive'),
(1000, 'electronics'),
(1025, 'football'),
(1013, 'footwear'),
(1094, 'formal'),
(1097, 'gforce'),
(1022, 'grinder'),
(1023, 'inalsa'),
(1089, 'jack'),
(1087, 'jackandjone'),
(1088, 'jackandjones'),
(1042, 'jacket'),
(1113, 'jackets'),
(1041, 'jean'),
(1040, 'jeans'),
(1090, 'jones'),
(1019, 'keyboard'),
(1008, 'kingston'),
(1009, 'kitchen'),
(1116, 'klein'),
(1117, 'klien'),
(1093, 'lacoste'),
(1006, 'laptop'),
(1012, 'lawn'),
(1010, 'lawntennis'),
(1112, 'levis'),
(1005, 'lg'),
(1018, 'microsoft'),
(1020, 'microwave'),
(1021, 'mixer'),
(1017, 'mouse'),
(1033, 'mrf'),
(1110, 'nike'),
(1032, 'nivia'),
(1024, 'oven'),
(1015, 'pendrive'),
(1119, 'philips'),
(1003, 'phone'),
(1111, 'puma'),
(1109, 'racquet'),
(1004, 'samsung'),
(1086, 'sandal'),
(1085, 'sandals'),
(1044, 'shirt'),
(1118, 'shirts'),
(1091, 'shoe'),
(1092, 'shoes'),
(1048, 'short'),
(1049, 'shorts'),
(1050, 'sneakers'),
(1100, 'sport'),
(1001, 'sports'),
(1101, 'stud'),
(1026, 'studs'),
(1045, 'sweat'),
(1046, 'sweatshirt'),
(1011, 'tennis'),
(1047, 'timberland'),
(1095, 'titan'),
(1120, 'vacuum'),
(1122, 'vacuumcleaner'),
(1096, 'watch'),
(1014, 'watches'),
(1103, 'wearable'),
(1002, 'wearables'),
(1036, 'wilson'),
(1084, 'woodland');
-- --------------------------------------------------------
--
-- Table structure for table `tagProduct`
--
CREATE TABLE IF NOT EXISTS `tagProduct` (
`PID` int(11) DEFAULT NULL,
`TagID` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tagProduct`
--
INSERT INTO `tagProduct` (`PID`, `TagID`) VALUES
(1, 1000),
(1, 1003),
(1, 1004),
(2, 1000),
(2, 1006),
(2, 1007),
(2, 1099),
(3, 1000),
(3, 1008),
(3, 1015),
(3, 1016),
(4, 1000),
(4, 1017),
(4, 1018),
(5, 1000),
(5, 1018),
(5, 1019),
(6, 1000),
(6, 1005),
(6, 1020),
(6, 1024),
(7, 1000),
(7, 1021),
(7, 1022),
(7, 1023),
(8, 1001),
(8, 1025),
(8, 1030),
(8, 1031),
(8, 1034),
(8, 1100),
(9, 1001),
(9, 1002),
(9, 1025),
(9, 1026),
(9, 1032),
(9, 1091),
(9, 1092),
(9, 1100),
(9, 1101),
(9, 1103),
(10, 1001),
(10, 1027),
(10, 1028),
(10, 1029),
(10, 1033),
(10, 1100),
(11, 1001),
(11, 1027),
(11, 1030),
(11, 1031),
(11, 1034),
(11, 1100),
(12, 1001),
(12, 1010),
(12, 1011),
(12, 1012),
(12, 1036),
(12, 1100),
(12, 1109),
(13, 1001),
(13, 1002),
(13, 1010),
(13, 1011),
(13, 1012),
(13, 1035),
(13, 1036),
(13, 1037),
(13, 1038),
(13, 1039),
(13, 1100),
(13, 1103),
(14, 1002),
(14, 1037),
(14, 1038),
(14, 1039),
(14, 1040),
(14, 1041),
(14, 1043),
(14, 1103),
(14, 1112),
(15, 1002),
(15, 1037),
(15, 1038),
(15, 1039),
(15, 1042),
(15, 1043),
(15, 1103),
(15, 1112),
(15, 1113),
(16, 1002),
(16, 1037),
(16, 1038),
(16, 1039),
(16, 1044),
(16, 1045),
(16, 1046),
(16, 1103),
(16, 1114),
(16, 1115),
(16, 1116),
(16, 1118),
(17, 1002),
(17, 1037),
(17, 1038),
(17, 1039),
(17, 1047),
(17, 1048),
(17, 1049),
(17, 1103),
(18, 1002),
(18, 1050),
(18, 1084),
(18, 1091),
(18, 1092),
(18, 1103),
(19, 1002),
(19, 1085),
(19, 1086),
(19, 1088),
(19, 1089),
(19, 1090),
(19, 1091),
(19, 1092),
(19, 1103),
(20, 1002),
(20, 1091),
(20, 1092),
(20, 1093),
(20, 1094),
(20, 1103),
(21, 1002),
(21, 1014),
(21, 1095),
(21, 1096),
(21, 1103),
(22, 1002),
(22, 1014),
(22, 1096),
(22, 1097),
(22, 1103),
(23, 1001),
(23, 1002),
(23, 1026),
(23, 1091),
(23, 1092),
(23, 1100),
(23, 1101),
(23, 1103),
(23, 1110),
(25, 1001),
(25, 1002),
(25, 1091),
(25, 1092),
(25, 1100),
(25, 1103),
(25, 1111),
(27, 1000),
(27, 1119),
(27, 1120),
(27, 1121),
(27, 1122);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `address`
--
ALTER TABLE `address`
ADD PRIMARY KEY (`AddID`);
--
-- Indexes for table `basket`
--
ALTER TABLE `basket`
ADD PRIMARY KEY (`BID`), ADD KEY `CID` (`CID`);
--
-- Indexes for table `basketProds`
--
ALTER TABLE `basketProds`
ADD KEY `BID` (`BID`), ADD KEY `PID` (`PID`);
--
-- Indexes for table `comment`
--
ALTER TABLE `comment`
ADD PRIMARY KEY (`CommID`), ADD KEY `CID` (`CID`), ADD KEY `PID` (`PID`);
--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
ADD PRIMARY KEY (`CID`), ADD UNIQUE KEY `CEmail` (`CEmail`), ADD KEY `BillingAddID` (`BillingAddID`), ADD KEY `DeliveryAddID` (`DeliveryAddID`);
--
-- Indexes for table `orderedProduct`
--
ALTER TABLE `orderedProduct`
ADD PRIMARY KEY (`OrderID`,`PID`), ADD KEY `PID` (`PID`);
--
-- Indexes for table `ordr`
--
ALTER TABLE `ordr`
ADD PRIMARY KEY (`OrderID`), ADD KEY `CID` (`CID`);
--
-- Indexes for table `product`
--
ALTER TABLE `product`
ADD PRIMARY KEY (`PID`);
--
-- Indexes for table `rating`
--
ALTER TABLE `rating`
ADD PRIMARY KEY (`CID`,`PID`), ADD KEY `PID` (`PID`);
--
-- Indexes for table `tag`
--
ALTER TABLE `tag`
ADD PRIMARY KEY (`TagID`), ADD UNIQUE KEY `TagName` (`TagName`), ADD KEY `TagName_2` (`TagName`);
--
-- Indexes for table `tagProduct`
--
ALTER TABLE `tagProduct`
ADD UNIQUE KEY `PID` (`PID`,`TagID`), ADD KEY `TagID` (`TagID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `address`
--
ALTER TABLE `address`
MODIFY `AddID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=510;
--
-- AUTO_INCREMENT for table `basket`
--
ALTER TABLE `basket`
MODIFY `BID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comment`
--
ALTER TABLE `comment`
MODIFY `CommID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=112;
--
-- AUTO_INCREMENT for table `customer`
--
ALTER TABLE `customer`
MODIFY `CID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=106;
--
-- AUTO_INCREMENT for table `ordr`
--
ALTER TABLE `ordr`
MODIFY `OrderID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `product`
--
ALTER TABLE `product`
MODIFY `PID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=37;
--
-- AUTO_INCREMENT for table `tag`
--
ALTER TABLE `tag`
MODIFY `TagID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1123;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `basket`
--
ALTER TABLE `basket`
ADD CONSTRAINT `basket_ibfk_1` FOREIGN KEY (`CID`) REFERENCES `customer` (`CID`);
--
-- Constraints for table `basketProds`
--
ALTER TABLE `basketProds`
ADD CONSTRAINT `basketProds_ibfk_1` FOREIGN KEY (`BID`) REFERENCES `basket` (`BID`),
ADD CONSTRAINT `basketProds_ibfk_2` FOREIGN KEY (`PID`) REFERENCES `product` (`PID`);
--
-- Constraints for table `comment`
--
ALTER TABLE `comment`
ADD CONSTRAINT `comment_ibfk_1` FOREIGN KEY (`CID`) REFERENCES `customer` (`CID`),
ADD CONSTRAINT `comment_ibfk_2` FOREIGN KEY (`PID`) REFERENCES `product` (`PID`);
--
-- Constraints for table `customer`
--
ALTER TABLE `customer`
ADD CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`BillingAddID`) REFERENCES `address` (`AddID`),
ADD CONSTRAINT `customer_ibfk_2` FOREIGN KEY (`DeliveryAddID`) REFERENCES `address` (`AddID`);
--
-- Constraints for table `orderedProduct`
--
ALTER TABLE `orderedProduct`
ADD CONSTRAINT `orderedProduct_ibfk_1` FOREIGN KEY (`OrderID`) REFERENCES `ordr` (`OrderID`),
ADD CONSTRAINT `orderedProduct_ibfk_2` FOREIGN KEY (`PID`) REFERENCES `product` (`PID`);
--
-- Constraints for table `ordr`
--
ALTER TABLE `ordr`
ADD CONSTRAINT `ordr_ibfk_1` FOREIGN KEY (`CID`) REFERENCES `customer` (`CID`);
--
-- Constraints for table `rating`
--
ALTER TABLE `rating`
ADD CONSTRAINT `rating_ibfk_1` FOREIGN KEY (`CID`) REFERENCES `customer` (`CID`),
ADD CONSTRAINT `rating_ibfk_2` FOREIGN KEY (`PID`) REFERENCES `product` (`PID`);
--
-- Constraints for table `tagProduct`
--
ALTER TABLE `tagProduct`
ADD CONSTRAINT `tagProduct_ibfk_1` FOREIGN KEY (`PID`) REFERENCES `product` (`PID`),
ADD CONSTRAINT `tagProduct_ibfk_2` FOREIGN KEY (`TagID`) REFERENCES `tag` (`TagID`);
/*!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 */;
|
--ICD9, AGE, SAPSI, SURVIVE/DIE FLAG
select id.SUBJECT_ID, id.SAPSI_FIRST, id.ICUSTAY_EXPIRE_FLG, id.ICUSTAY_ADMIT_AGE as AGE, ic.CODE, ic.DESCRIPTION
from MIMIC2V26.ICUSTAY_DETAIL id, MIMIC2V26.ICD9 ic
where id.SUBJECT_ID = ic.SUBJECT_ID
and id.HOSPITAL_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_CAREUNIT = 'MICU'
and id.SAPSI_FIRST > 20;
--HCO3 first value
select distinct id.SUBJECT_ID, first_value(ce.VALUE1NUM) over (partition by id.SUBJECT_ID order by ce.CHARTTIME asc) as HCO3, ci.LABEL
from MIMIC2V26.ICUSTAY_DETAIL id, MIMIC2V26.ICD9 ic, MIMIC2V26.CHARTEVENTS ce, MIMIC2V26.D_CHARTITEMS ci
where id.SUBJECT_ID = ic.SUBJECT_ID
and ce.ITEMID = ci.ITEMID
and id.HOSPITAL_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_CAREUNIT = 'MICU'
and id.SAPSI_FIRST > 20
and ce.ITEMID = '3810'; --this is the correct HCO3
--Elixhauser scores
select id.SUBJECT_ID, cs.CONGESTIVE_HEART_FAILURE, cs.CARDIAC_ARRHYTHMIAS, cs.VALVULAR_DISEASE, cs.PULMONARY_CIRCULATION, cs.PERIPHERAL_VASCULAR, cs.HYPERTENSION, cs.PARALYSIS, cs.OTHER_NEUROLOGICAL, cs.DIABETES_COMPLICATED, cs.DIABETES_UNCOMPLICATED, cs.HYPOTHYROIDISM, cs.RENAL_FAILURE, cs.LIVER_DISEASE, cs.PEPTIC_ULCER, cs.AIDS, cs.LYMPHOMA, cs.METASTATIC_CANCER, cs.SOLID_TUMOR, cs.RHEUMATOID_ARTHRITIS, cs.COAGULOPATHY, cs.OBESITY, cs.WEIGHT_LOSS, cs.FLUID_ELECTROLYTE, cs.BLOOD_LOSS_ANEMIA, cs.DEFICIENCY_ANEMIAS, cs.ALCOHOL_ABUSE, cs.DRUG_ABUSE, cs.PSYCHOSES, cs.DEPRESSION
from MIMIC2V26.COMORBIDITY_SCORES cs, MIMIC2V26.ICUSTAY_DETAIL id
where id.SUBJECT_ID = cs.SUBJECT_ID
and id.HADM_ID = cs.HADM_ID
and id.HOSPITAL_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_CAREUNIT = 'MICU'
and id.SAPSI_FIRST > 20;
--Total urine output for entire ICU stay
select distinct id.SUBJECT_ID, sum(io.VOLUME) over (partition by id.SUBJECT_ID) as TOTAL_URINE
from MIMIC2V26.ICUSTAY_DETAIL id, MIMIC2V26.IOEVENTS io
where id.ICUSTAY_ID = io.ICUSTAY_ID
and id.HOSPITAL_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_CAREUNIT = 'MICU'
and id.SAPSI_FIRST > 20
and io.itemid in (55, 56, 57, 61, 65, 69, 85, 94, 96, 288, 405,
428, 473, 651, 715, 1922, 2042, 2068, 2111, 2119, 2130, 2366, 2463,
2507, 2510, 2592, 2676, 2810, 2859, 3053, 3175, 3462, 3519, 3966, 3987,
4132, 4253, 5927);
--WBC first value
select distinct id.SUBJECT_ID, first_value(le.VALUENUM) over (partition by id.SUBJECT_ID order by le.CHARTTIME asc) as WBC
from MIMIC2V26.ICUSTAY_DETAIL id, MIMIC2V26.LABEVENTS le
where id.ICUSTAY_ID = le.ICUSTAY_ID
and id.HOSPITAL_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_CAREUNIT = 'MICU'
and id.SAPSI_FIRST > 20
and le.ITEMID in (50316, 50468);
--Celsius temperature first value
select distinct id.SUBJECT_ID, first_value(ce.VALUE1NUM) over (partition by id.SUBJECT_ID order by ce.CHARTTIME asc) as TEMPERATURE
from MIMIC2V26.ICUSTAY_DETAIL id, MIMIC2V26.CHARTEVENTS ce
where id.ICUSTAY_ID = ce.ICUSTAY_ID
and id.HOSPITAL_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_CAREUNIT = 'MICU'
and id.SAPSI_FIRST > 20
and ce.ITEMID in (676, 677);
--Fahrenheit temperature first value
select distinct id.SUBJECT_ID, (first_value(ce.VALUE1NUM) over (partition by id.SUBJECT_ID order by ce.CHARTTIME asc) - 32) * 5/9 as TEMPERATURE
from MIMIC2V26.ICUSTAY_DETAIL id, MIMIC2V26.CHARTEVENTS ce
where id.ICUSTAY_ID = ce.ICUSTAY_ID
and id.HOSPITAL_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_FLG = 'Y'
and id.ICUSTAY_FIRST_CAREUNIT = 'MICU'
and id.SAPSI_FIRST > 20
and ce.ITEMID in (678, 679); |
-- View: vw_qry_tareas_distribuidos
-- DROP VIEW vw_qry_tareas_distribuidos;
CREATE OR REPLACE VIEW vw_qry_tareas_distribuidos AS
SELECT
bei.att_value_1 as Asunto,
bei.att_value_2 as Carpeta,
mt.pro_ele_inst_date_end as Finalizado,
bei.att_value_num_1 as dtb,
bei.att_value_num_2 as dtb_anx,
bei.att_value_4 as titulo,
mt.tsk_title as Tarea,
bei.att_value_8 as grupo,
mt.pro_ele_inst_user_acquired as usuario,
mt.pro_ele_inst_index, mt.mon_for, mt.env_id, mt.pro_id, mt.pro_inst_id, mt.pro_ele_inst_id, mt.pro_ele_inst_status, mt.pro_ele_inst_date_ready, mt.bus_ent_inst_id, mt.bus_ent_id, mt.pro_ele_id, mt.tsk_name, mt.tsk_title, mt.tsk_max_duration, mt.tsk_alert_duration, mt.img_path, mt.pro_name, mt.pro_title, mt.pro_ver_id, mt.pro_max_duration, mt.pro_inst_name_pre, mt.pro_inst_name_num, mt.pro_inst_name_pos, mt.pro_inst_create_user, mt.pro_inst_create_date, mt.pro_inst_end_date, mt.pro_inst_status, mt.hty_date, mt.hty_event, mt.usr_login, mt.pro_inst_ele_id_father, mt.pro_inst_warn_date, mt.pro_inst_overdue_date, mt.pro_priority
FROM vw_consults_monitor_tasks mt
JOIN bus_ent_instance bei ON mt.bus_ent_id = bei.bus_ent_id AND mt.bus_ent_inst_id = bei.bus_ent_inst_id_auto
WHERE bei.bus_ent_id= 1051 AND mt.env_id = 1 AND bei.reg_status = 0 AND mt.mon_for = 'T'::text
AND mt.pro_ele_inst_status IS NOT NULL
ORDER BY mt.pro_ele_inst_date_ready;
ALTER TABLE vw_qry_tareas_distribuidos
OWNER TO postgres;
GRANT ALL ON TABLE vw_qry_tareas_distribuidos TO postgres;
GRANT ALL ON TABLE vw_qry_tareas_distribuidos TO apia3; |
CREATE TABLE standup (
id SERIAL primary key,
user_id INT REFERENCES users(id),
data TEXT NOT NULL,
created_at TIMESTAMP DEFAULT now(),
archived_at TIMESTAMP
); |
alter table Attachment drop constraint FK1C93543D937BFB5;
alter table Attachment drop constraint FK1C9354333CA892A;
alter table BooleanExpression drop constraint FKE3D208C06C97C90E;
alter table CorrelationPropertyInfo drop constraint FK761452A5D87156ED;
alter table Deadline drop constraint FK21DF3E78A9FE0EF4;
alter table Deadline drop constraint FK21DF3E78695E4DDB;
alter table Delegation_delegates drop constraint FK47485D5772B3A123;
alter table Delegation_delegates drop constraint FK47485D57786553A5;
alter table ErrorInfo drop constraint FK8B1186B6724A467;
alter table Escalation drop constraint FK67B2C6B5D1E5CC1;
alter table EventTypes drop constraint FKB0E5621F7665489A;
alter table I18NText drop constraint FK2349686BF4ACCD69;
alter table I18NText drop constraint FK2349686B424B187C;
alter table I18NText drop constraint FK2349686BAB648139;
alter table I18NText drop constraint FK2349686BB340A2AA;
alter table I18NText drop constraint FK2349686BF0CDED35;
alter table I18NText drop constraint FK2349686BCC03ED3C;
alter table I18NText drop constraint FK2349686B77C1C08A;
alter table I18NText drop constraint FK2349686B18DDFE05;
alter table I18NText drop constraint FK2349686B78AF072A;
alter table Notification drop constraint FK2D45DD0BC0C0F29C;
alter table Notification_BAs drop constraint FK2DD68EE072B3A123;
alter table Notification_BAs drop constraint FK2DD68EE093F2090B;
alter table Notification_email_header drop constraint FKF30FE3448BED1339;
alter table Notification_email_header drop constraint FKF30FE3443E3E97EB;
alter table Notification_Recipients drop constraint FK98FD214E72B3A123;
alter table Notification_Recipients drop constraint FK98FD214E93F2090B;
alter table PeopleAssignments_BAs drop constraint FK9D8CF4EC72B3A123;
alter table PeopleAssignments_BAs drop constraint FK9D8CF4EC786553A5;
alter table PeopleAssignments_ExclOwners drop constraint FKC77B97E472B3A123;
alter table PeopleAssignments_ExclOwners drop constraint FKC77B97E4786553A5;
alter table PeopleAssignments_PotOwners drop constraint FK1EE418D72B3A123;
alter table PeopleAssignments_PotOwners drop constraint FK1EE418D786553A5;
alter table PeopleAssignments_Recipients drop constraint FKC6F615C272B3A123;
alter table PeopleAssignments_Recipients drop constraint FKC6F615C2786553A5;
alter table PeopleAssignments_Stakeholders drop constraint FK482F79D572B3A123;
alter table PeopleAssignments_Stakeholders drop constraint FK482F79D5786553A5;
alter table Reassignment drop constraint FK724D056062A1E871;
alter table Reassignment_potentialOwners drop constraint FK90B59CFF72B3A123;
alter table Reassignment_potentialOwners drop constraint FK90B59CFF35D2FEE0;
alter table Task drop constraint FK27A9A53C55C806;
alter table Task drop constraint FK27A9A5B723BE8B;
alter table Task drop constraint FK27A9A55427E8F1;
alter table task_comment drop constraint FK61F475A57A3215D9;
alter table task_comment drop constraint FK61F475A5F510CB46;
drop table Attachment;
drop table AuditTaskImpl;
drop table BAMTaskSummary;
drop table BooleanExpression;
drop table CaseFileDataLog;
drop table CaseIdInfo;
drop table CaseRoleAssignmentLog;
drop table Content;
drop table ContextMappingInfo;
drop table CorrelationKeyInfo;
drop table CorrelationPropertyInfo;
drop table Deadline;
drop table Delegation_delegates;
drop table DeploymentStore;
drop table email_header;
drop table ErrorInfo;
drop table Escalation;
drop table EventTypes;
drop table ExecutionErrorInfo;
drop table I18NText;
drop table NodeInstanceLog;
drop table Notification;
drop table Notification_BAs;
drop table Notification_email_header;
drop table Notification_Recipients;
drop table OrganizationalEntity;
drop table PeopleAssignments_BAs;
drop table PeopleAssignments_ExclOwners;
drop table PeopleAssignments_PotOwners;
drop table PeopleAssignments_Recipients;
drop table PeopleAssignments_Stakeholders;
drop table ProcessInstanceInfo;
drop table ProcessInstanceLog;
drop table QueryDefinitionStore;
drop table Reassignment;
drop table Reassignment_potentialOwners;
drop table RequestInfo;
drop table SessionInfo;
drop table Task;
drop table task_comment;
drop table TaskDef;
drop table TaskEvent;
drop table TaskVariableImpl;
drop table VariableInstanceLog;
drop table WorkItemInfo;
|
set names utf8;
drop database if exists yc;
create database yc charset=utf8;
use yc;
create table dept(
did smallint primary key auto_increment,
dname varchar(8) not null
);
create table emp(
eid int primary key auto_increment,
ename varchar(8),
sex bool,
salary decimal(7,2),
deptid smallint,
foreign key(deptid) references dept(did)
); |
[문제62] 1500 부서 위치에 근무하는 사원들중에 2007년도에 입사한 사원들의 근무 도시, 부서 이름, 사원번호, 입사일을 출력하세요.
select l.city, d.department_name, e.employee_id, e.hire_date
from employees e, departments d, locations l
where e.department_id = d.department_id
and d.location_id = l.location_id
and (e.hire_date >= to_date('20070101','yyyymmdd') and e.hire_date < to_date('20080101','yyyymmdd'))
and l.location_id = 1500;
-- inline view 굳이 하지 않아도 이 경우에는 괜찮음(오라클이 크게 보고 해결한다는...??)
/*
select (select city
from locations
where , department_name, employee_id, hire_date
from
with
l_1500 as (select city, department_name, employee_id, hire_date
from
h_2007 as (select hire_date from employees where hire_date >= to_date('20070101','yyyymmdd') and hire_date < to_date('20080101','yyyymmdd'))
select city, department_name, employee_id, hire_date
from l_1500
where h_2007
*/
[문제63] job_history 테이블은 job_id를 한번이라도 바꾼사원들의 정보가 저장되어 있습니다.
사원테이블에서 두번이상 job_id를 바꾼 사원정보를 출력하세요.(correlated subquery)
select employee_id
from job_history
group by employee_id
having count(*) >1;
-- 선생님 풀이
select e.*
from employees e
where 2 <= (select count(*)
from job_history
where employee_id = e.employee_id);
-- 문제될수 있는 부분(건수로 비교해야 되면 조인으로)
select * from user_ind_columns; /*index 확인*/
[문제64] job_history 테이블은 job_id를 한번이라도 바꾼사원들의 정보가 저장되어 있습니다.
사원테이블에서 두번이상 job_id를 바꾼 사원정보를 출력하세요.(조인&inline view)
select e.*
from employees e,
(select employee_id, count(*)
from job_history
group by employee_id
having count(*) > 1) h
where e.employee_id = h.employee_id;
[문제65] 사원테이블에서 각 부서마다 인원수를 출력주세요.
<화면결과>
10부서 20부서 30부서 40부서 50부서 60부서
---------- ---------- ---------- ---------- ---------- ----------
1 2 6 1 45 5
select department_id, count(*)
from employees
where department_id between 10 and 60
group by department_id;
select max(decode(dep_id, 10, cnt)) "10부서",
max(decode(dep_id, 20, cnt)) "20부서",
max(decode(dep_id, 30, cnt)) "30부서",
max(decode(dep_id, 40, cnt)) "40부서",
max(decode(dep_id, 50, cnt)) "50부서",
max(decode(dep_id, 60, cnt)) "60부서"
from (select department_id dep_id, count(*) cnt
from employees
where department_id between 10 and 60
group by department_id);
================================================================================
-- 11g부터 지원 pivot : row의 data를 column으로 변경하는 함수
ex.
dept_id cn
10 1
20 2
30 10
10 20 30
-- -- --
1 2 10
/* 부서별 사원수 */
select *
from (select department_id from employees) --inline view로 열이 표현되어야 함
pivot(count(*) for department_id in (10 "10부서",20 "20부서",30 "30부서",40 "40부서",50 "50부서",60 "60부서")); --pivot으로 옆으로 표시
/* 부서별 급여총합 */
select *
from (select department_id, salary from employees) --inline view로 열이 표현되어야 함
pivot(sum(salary) for department_id in (10 "10부서",20 "20부서",30 "30부서",40 "40부서",50 "50부서",60 "60부서"));
/* 부서별 급여평균 */
select *
from (select department_id, salary from employees) --inline view로 열이 표현되어야 함
pivot(avg(salary) for department_id in (10 "10부서",20 "20부서",30 "30부서",40 "40부서",50 "50부서",60 "60부서"));
/* 부서별 급여표준편차 */
select *
from (select department_id, salary from employees) --inline view로 열이 표현되어야 함
pivot(stddev(salary) for department_id in (10 "10부서",20 "20부서",30 "30부서",40 "40부서",50 "50부서",60 "60부서"));
/* 부서별 급여분산 */
select *
from (select department_id, salary from employees) --inline view로 열이 표현되어야 함
pivot(variance(salary) for department_id in (10 "10부서",20 "20부서",30 "30부서",40 "40부서",50 "50부서",60 "60부서"));
-- unpivot 함수 : pivot함수의 반대개념으로 column을 rowdata로 변경하는 함수
select *
from (
select *
from (select department_id from employees)
pivot(count(*) for department_id in(10,20,30,40,50,60))
)
unpivot(cnt for dept_id in("10","20","30","40","50","60")); -- 다시변형
select *
from (
select *
from (select department_id from employees)
pivot(count(*) for department_id in(10 "10부서",20 "20부서",30 "30부서",40 "40부서",50 "50부서",60 "60부서"))
)
unpivot(cnt for dept_id in("10부서","20부서","30부서","40부서","50부서","60부서"));
[문제66] 사원테이블에서 요일별 입사한 인원수를 출력해주세요.
<화면결과>
일요일 월요일 화요일 수요일 목요일 금요일 토요일
--------- ---------- ---------- ---------- ---------- ---------- ----------
15 10 13 15 16 19 19
select to_char(hire_date,'dy'), count(*)
from employees
group by to_char(hire_date,'dy');
select *
from (select to_char(hire_date,'day') day from employees) -- 여기서는 그냥 각 사원별 입사한 요일 컬럼 생성
pivot(count(*) for day in('일요일','월요일','화요일','수요일','목요일','금요일','토요일'));
-- in 연산자 값에서 같은 것(형 및 이름 일치)끼리 카운트 되면서 정리가 되는듯
select *
from (
select *
from (select to_char(hire_date,'day') day from employees) -- 여기서는 그냥 각 사원별 입사한 요일 컬럼 생성
pivot(count(*) for day in('일요일' "일",'월요일' "월",'화요일' "화",'수요일' "수",'목요일' "목",'금요일' "금",'토요일' "토"))
) /* unpivot을 하려면 문자의 경우 별칭을 지정해야 되는 것 같다 */
unpivot(cnt for day in("일","월","화","수","목","금","토"));
select *
from (select to_char(hire_date,'d') day from employees)
pivot(count(*) for day in(1 "일요일",2 "월요일",3 "화요일",4 "수요일",5 "목요일", 6 "금요일", 7"토요일"));
select *
from (
select *
from (select to_char(hire_date,'d') day from employees)
pivot(count(*) for day in(1 "일요일",2 "월요일",3 "화요일",4 "수요일",5 "목요일", 6 "금요일", 7"토요일"))
)
unpivot(cnt for day in("일요일","월요일","화요일","수요일","목요일","금요일","토요일"));
================================================================================
-- 집합연산자 : 선두 후미 쿼리문의 열 및 타입 일치 필수
/* 합집합(union, union all : all을 써라) */
select employee_id, job_id
from employees
union -- 중복을 제거(소트 알고리즘)한 후 합함 : 데이터 양이 많으면 별로 좋지 않다.
select employee_id, job_id
from job_history;
select employee_id, job_id
from employees
union all -- 중복을 포함한 후 합함
select employee_id, job_id
from job_history;
/* 교집합(intersect) : 쌍비교, 'join' 이나 'exists' 써라 */
select employee_id, job_id
from employees
intersect -- 공통된 데이터만 출력 : 과거 영업팀 이었다가 총무 했다가 다시 영업팀으로 오면 나옴
select employee_id, job_id
from job_history;
/* 차집합(minus) : 'not exists' 써라 */
select employee_id, job_id
from employees
minus -- 한번도 job_id 변동 안함
select employee_id, job_id
from job_history
order by 1,2; -- 내부적으로 이렇게 된다고 함. 첫번째 쿼리의 컬럼을 기준으로 생각해야함.
-- ※ 주의사항 : 소트라는 오퍼레이터가 돌아간다. 현장에서 쓰면 부하 폭발
select employee_id, job_id, salary sal -- 첫번째 쿼리문에 별칭설정
from employees
union
select employee_id, job_id, to_number(null) -- 위의 salary 땜
from job_history
order by 1,2,3;
select employee_id, job_id, salary
from employees
union
select employee_id, job_id, to_number(0) -- 위의 salary 땜
from job_history;
select employee_id, job_id, salary
from employees
union
select employee_id, job_id, null -- 위의 salary 땜
from job_history;
select employee_id, job_id, salary
from employees
union
select employee_id, job_id, 0 -- 위의 salary 땜
from job_history;
================================================================================
[문제67] 아래와 같은 SQL문을 정렬이 수행되지 않게 튜닝하세요.
/*
select employee_id, job_id
from employees
intersect
select employee_id, job_id
from job_history;
*/
select e.employee_id, e.job_id
from employees e
where exists (select 1
from job_history
where employee_id = e.employee_id
and job_id = e.job_id);
select e.employee_id, e.job_id
from employees e, job_history h
where e.employee_id = h.employee_id
and e.job_id = h.job_id;
/* ※ intersect → exists (or join) */
[문제68] 아래와 같은 SQL문을 정렬이 수행되지 않게 튜닝하세요.
/*
select employee_id, job_id
from employees
minus
select employee_id, job_id
from job_history
*/
select e.employee_id, e.job_id
from employees e
where not exists (select 1
from job_history
where employee_id = e.employee_id
and job_id = e.job_id);
/* ※ minus → not exists */
================================================================================
[문제69] 아래와 같은 SQL문을 정렬이 수행되지 않게 튜닝하세요.(union → union all 중복성 없게)
/*
select e.employee_id, d.department_name
from employees e, departments d
where e.department_id = d.department_id(+)
union
select e.employee_id, d.department_name
from employees e, departments d
where e.department_id(+) = d.department_id;
*/
select e.employee_id, d.department_name
from employees e, departments d
where e.department_id = d.department_id(+)
union all
select null, d.department_name -- employee_id 자리를 null(핵심)
from departments d
where not exists (select 1
from employees -- 사원이 없는 부서명 뽑는 쿼리문
where department_id = d.department_id);
/* ※ union → union all + not exists */
================================================================================
sum(salary)={department_id, job_id, manager_id} -- 3개 열을 기준 급여총합
sum(salary)={department_id, job_id} -- 2개 열을 기준 급여총합
sum(salary)={department_id} -- 1개 열을 기준 급여총합
sum(salary)={} -- 전체 급여총합
select department_id, job_id, manager_id, sum(salary)
from employees
group by department_id, job_id, manager_id
union all
select department_id, job_id, null, sum(salary)
from employees
group by department_id, job_id
union all
select department_id, null, null, sum(salary)
from employees
group by department_id
union all
select null,null,null,sum(salary)
from employees;
/* 숙제 : 독서(데이터웨어하우징(하우스) : 남산도서관) */
sum(salary)={department_id, job_id, manager_id}
sum(salary)={department_id, job_id}
sum(salary)={department_id}
sum(salary)={}
/* rollup : 개별 컬럼을 오른쪽을 기준으로 해서 왼쪽으로 하나씩 지우면서 집계값 구함 */
select department_id, job_id, manager_id, sum(salary)
from employees
group by rollup(department_id, job_id, manager_id);
================================================================================
sum(salary)={department_id, job_id, manager_id}
sum(salary)={department_id, job_id}
sum(salary)={department_id, manager_id}
sum(salary)={job_id, manager_id}
sum(salary)={department_id}
sum(salary)={job_id}
sum(salary)={manager_id}
sum(salary)={}
/* cube : rollup 기능 포함하고 조합가능한 경우를 전부 집계함 */
select department_id, job_id, manager_id, sum(salary)
from employees
group by cube(department_id, job_id, manager_id);
================================================================================
-- 내가 원하는 집계값만 구하려면 어쩔까?
sum(salary)={department_id, job_id}
sum(salary)={department_id, manager_id}
select department_id, job_id, null, sum(salary)
from employees
group by department_id, job_id
union all
select department_id, null, manager_id, sum(salary)
from employees
group by department_id, manager_id;
/* grouping sets : 내가 원하는 그룹 만듬 */
select department_id, job_id, manager_id, sum(salary) -- 개별열은 그룹바이에 1번 이상 써야함
from employees
group by grouping sets((department_id, job_id), (department_id, manager_id));
sum(salary)={department_id, job_id}
sum(salary)={department_id, manager_id}
sum(salary)={}
select department_id, job_id, manager_id, sum(salary)
from employees
group by grouping sets((department_id, job_id), (department_id, manager_id), ()); -- () : 전체합
================================================================================
|
/*
SQLyog Ultimate v11.24 (32 bit)
MySQL - 5.1.30-community : Database - coursemanagement
*********************************************************************
*/
/*!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*/`coursemanagement` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `coursemanagement`;
/*Table structure for table `tb_class` */
DROP TABLE IF EXISTS `tb_class`;
CREATE TABLE `tb_class` (
`classID` int(11) NOT NULL AUTO_INCREMENT COMMENT '班级编号',
`className` varchar(20) DEFAULT NULL COMMENT '班级名称',
`totalNum` int(11) DEFAULT NULL COMMENT '班级总人数',
`beginYear` date DEFAULT NULL COMMENT '开班时间',
`classType` int(11) DEFAULT NULL COMMENT '班级类型',
PRIMARY KEY (`classID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*Data for the table `tb_class` */
insert into `tb_class`(`classID`,`className`,`totalNum`,`beginYear`,`classType`) values (1,'dt49',30,'2017-04-03',1),(2,'dt50',34,'2017-04-15',1),(3,'dt51',24,'2017-04-20',1),(4,'dt52',28,'2017-04-28',0),(5,'dt53',39,'2017-05-03',1),(6,'dt54',36,'2017-04-12',0),(7,'dt55',44,'2017-05-15',1),(8,'dt56',50,'2017-05-18',0),(9,'dt57',34,'2017-06-06',1),(10,'dt58',49,'2017-06-24',0);
/*Table structure for table `tb_classnode` */
DROP TABLE IF EXISTS `tb_classnode`;
CREATE TABLE `tb_classnode` (
`nodeID` int(11) NOT NULL AUTO_INCREMENT COMMENT '节点编号',
`nodeName` varchar(50) DEFAULT NULL COMMENT '节点名称',
`nodeType` int(11) DEFAULT NULL COMMENT '节点类型',
PRIMARY KEY (`nodeID`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
/*Data for the table `tb_classnode` */
insert into `tb_classnode`(`nodeID`,`nodeName`,`nodeType`) values (1,'预科1',1),(2,'预科2',1),(3,'预科3',1),(4,'预科4',1),(5,'开学典礼',1),(6,'Java1',1),(7,'Java2',1),(8,'Java3',1),(9,'Java4',1),(10,'Java5',1),(11,'Java6',1),(12,'Java高级',1),(13,'web前端',1),(14,'Jsp1',1),(15,'Jsp2',1),(16,'毕业典礼',1),(17,'平面UI设计',2),(18,'网页UI设计',2),(19,'移动UI设计',2),(20,'毕业设计',2);
/*Table structure for table `tb_classroom` */
DROP TABLE IF EXISTS `tb_classroom`;
CREATE TABLE `tb_classroom` (
`roomID` int(11) NOT NULL AUTO_INCREMENT COMMENT '机房编号',
`roomName` varchar(20) DEFAULT NULL COMMENT '机房名称',
`roomSize` int(11) DEFAULT NULL COMMENT '机房容纳人数',
`roomType` int(11) DEFAULT NULL COMMENT '机房类型',
PRIMARY KEY (`roomID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*Data for the table `tb_classroom` */
insert into `tb_classroom`(`roomID`,`roomName`,`roomSize`,`roomType`) values (1,'一机房',40,0),(2,'二机房',30,0),(3,'三机房',30,0),(4,'四机房',30,0),(5,'五机房',30,0),(7,'七机房',40,0),(8,'八机房',30,0),(9,'一教室',30,1),(10,'多媒体机房',52,2);
/*Table structure for table `tb_classroomtype` */
DROP TABLE IF EXISTS `tb_classroomtype`;
CREATE TABLE `tb_classroomtype` (
`roomType` int(11) DEFAULT NULL COMMENT '机房类型',
`classRoomTypeName` varchar(50) DEFAULT NULL COMMENT '机房类型名称'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `tb_classroomtype` */
insert into `tb_classroomtype`(`roomType`,`classRoomTypeName`) values (0,'机房'),(1,'教室'),(2,'多媒体');
/*Table structure for table `tb_course` */
DROP TABLE IF EXISTS `tb_course`;
CREATE TABLE `tb_course` (
`courseID` int(11) NOT NULL AUTO_INCREMENT COMMENT '课程编号',
`courseName` varchar(50) DEFAULT NULL COMMENT '课程名称',
`coursePeriod` int(11) DEFAULT NULL COMMENT '课程周期',
PRIMARY KEY (`courseID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*Data for the table `tb_course` */
insert into `tb_course`(`courseID`,`courseName`,`coursePeriod`) values (1,'JAVA',6),(2,'UI',4);
/*Table structure for table `tb_dutiesinfo` */
DROP TABLE IF EXISTS `tb_dutiesinfo`;
CREATE TABLE `tb_dutiesinfo` (
`dutiesID` int(11) NOT NULL AUTO_INCREMENT COMMENT '职务编号',
`dutiesName` varchar(20) DEFAULT NULL COMMENT '职务名称',
PRIMARY KEY (`dutiesID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*Data for the table `tb_dutiesinfo` */
insert into `tb_dutiesinfo`(`dutiesID`,`dutiesName`) values (1,'教员'),(2,'班主任'),(3,'排课老师'),(4,'校长');
/*Table structure for table `tb_duty_menu` */
DROP TABLE IF EXISTS `tb_duty_menu`;
CREATE TABLE `tb_duty_menu` (
`duty_menuID` int(11) NOT NULL,
`dutyID` int(11) DEFAULT NULL,
`menuID` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`duty_menuID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `tb_duty_menu` */
/*Table structure for table `tb_menu` */
DROP TABLE IF EXISTS `tb_menu`;
CREATE TABLE `tb_menu` (
`menuID` int(11) NOT NULL AUTO_INCREMENT,
`menuName` varchar(50) DEFAULT NULL,
`menuParentId` int(11) DEFAULT NULL,
`menuUrl` varchar(500) DEFAULT NULL,
PRIMARY KEY (`menuID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*Data for the table `tb_menu` */
insert into `tb_menu`(`menuID`,`menuName`,`menuParentId`,`menuUrl`) values (1,'课程模块',0,NULL),(2,'教员模块',0,NULL),(3,'班级模块',0,NULL),(4,'教室模块',0,NULL),(5,'消息模块',0,NULL);
/*Table structure for table `tb_suggestion` */
DROP TABLE IF EXISTS `tb_suggestion`;
CREATE TABLE `tb_suggestion` (
`suggestionID` int(11) NOT NULL AUTO_INCREMENT COMMENT '意见编号',
`suggestionTitle` varchar(50) DEFAULT NULL COMMENT '意见标题',
`suggestionContent` varchar(200) DEFAULT NULL COMMENT '意见内容',
`releaseTime` date DEFAULT NULL COMMENT '发布时间',
`teacherID` int(11) DEFAULT NULL COMMENT '教员编号',
PRIMARY KEY (`suggestionID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*Data for the table `tb_suggestion` */
insert into `tb_suggestion`(`suggestionID`,`suggestionTitle`,`suggestionContent`,`releaseTime`,`teacherID`) values (1,'添课','需要明天上午给dt49加一节指导就业课','2018-01-18',1),(2,'换教室','需要明天上午上的java课换到二机房','2018-01-18',4),(3,'请假','需要明天下午给dt55上的课调到星期天上午','2018-01-18',5);
/*Table structure for table `tb_teacharinfo` */
DROP TABLE IF EXISTS `tb_teacharinfo`;
CREATE TABLE `tb_teacharinfo` (
`teacherJobNumber` int(11) DEFAULT NULL COMMENT '教员工号',
`teacherPhone` varchar(20) DEFAULT NULL COMMENT '教员电话',
`teacherAge` int(11) DEFAULT NULL COMMENT '教员年龄',
`teacherSex` int(11) DEFAULT NULL COMMENT '教员性别',
`teacherPic` varchar(50) DEFAULT NULL COMMENT '教员头像'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `tb_teacharinfo` */
insert into `tb_teacharinfo`(`teacherJobNumber`,`teacherPhone`,`teacherAge`,`teacherSex`,`teacherPic`) values (1001,'15415156561',21,0,NULL),(1002,'15855858556',21,1,NULL),(1003,'18008018200',21,1,NULL),(1004,'17816218890',23,1,NULL),(1005,'17926325699',23,0,NULL),(1006,'14663565699',23,1,NULL),(1007,'18665448662',26,0,NULL),(1008,'17265652335',21,1,NULL),(1009,'16664156226',23,1,NULL),(1010,'13231546647',21,1,NULL),(1011,'13555992665',28,0,NULL),(1012,'16666589555',29,0,NULL),(1013,'18955566423',21,0,NULL);
/*Table structure for table `tb_teacher` */
DROP TABLE IF EXISTS `tb_teacher`;
CREATE TABLE `tb_teacher` (
`teacherID` int(11) NOT NULL AUTO_INCREMENT COMMENT '教员编号',
`teacherJobNumber` int(11) DEFAULT NULL COMMENT '教员工号',
`teacherName` varchar(20) DEFAULT NULL COMMENT '教员名称',
`teacherPwd` varchar(20) DEFAULT NULL COMMENT '教员密码',
`teacherInTime` datetime DEFAULT NULL COMMENT '入职时间',
`dutiesID` int(11) DEFAULT NULL COMMENT '职务',
`teacherState` int(11) DEFAULT NULL COMMENT '教员状态',
PRIMARY KEY (`teacherID`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
/*Data for the table `tb_teacher` */
insert into `tb_teacher`(`teacherID`,`teacherJobNumber`,`teacherName`,`teacherPwd`,`teacherInTime`,`dutiesID`,`teacherState`) values (1,1001,'文雯','123','2010-07-03 00:00:00',1,1),(2,1002,'徐士甲','123','2010-06-03 00:00:00',0,1),(3,1003,'吴志超','123','2010-08-03 00:00:00',0,1),(4,1004,'罗纯','123','2010-01-03 00:00:00',1,1),(5,1005,'丁鹏','123','2009-11-03 00:00:00',0,1),(6,1006,'阮柳','123','2011-07-03 00:00:00',1,1),(7,1007,'孙子荃','123','2006-05-03 00:00:00',0,1),(8,1008,'朱大玲','123','2009-06-03 00:00:00',1,1),(9,1009,'王建兵','123','2009-07-26 00:00:00',0,1),(10,1010,'包俊文','123','2004-03-03 00:00:00',0,1),(11,1011,'叶倩','123','2009-05-26 00:00:00',2,1),(12,1012,'郑玮玮','123','2000-03-03 00:00:00',1,1),(13,1010,'王芙蓉','123','2008-04-03 00:00:00',3,1);
/*Table structure for table `tb_teacher_lessons` */
DROP TABLE IF EXISTS `tb_teacher_lessons`;
CREATE TABLE `tb_teacher_lessons` (
`teacher_lessons_ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '教员授课ID',
`classID` int(11) DEFAULT NULL COMMENT '班级编号',
`teacherID` int(11) DEFAULT NULL COMMENT '教员编号',
PRIMARY KEY (`teacher_lessons_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
/*Data for the table `tb_teacher_lessons` */
insert into `tb_teacher_lessons`(`teacher_lessons_ID`,`classID`,`teacherID`) values (1,1,1),(2,1,2),(3,2,3),(4,2,4),(5,3,3),(6,3,6),(7,4,5),(8,4,8),(9,5,9),(10,5,4),(11,6,10),(12,6,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 */;
|
ALTER TABLE `groups_users`
MODIFY `group_id` int(10) unsigned NOT NULL,
MODIFY `user_id` int(11) NOT NULL,
DROP KEY `user_id`,
DROP FOREIGN KEY `groups_users_ibfk_4`, /* (`user_id`) REFERENCES `users` (`id`)*/
DROP FOREIGN KEY `groups_users_ibfk_3`, /* (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE,*/
ADD KEY `groups_users_user_id_97bd0715_fk_users_id` (`user_id`),
ADD CONSTRAINT `groups_users_user_id_97bd0715_fk_users_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
ADD KEY `groups_users_group_id_9b6cc385_fk_groups_id` (`group_id`),
ADD CONSTRAINT `groups_users_group_id_9b6cc385_fk_groups_id` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`);
|
with
context as (select ST_MakePoint(64.68375, 24.47645) as reference_point)
select
places.id as place_id,
places.name as place_name,
deals.id as deal_id,
deals.title as deal_title,
ST_Distance(coords::geometry(Point), (select reference_point from context)) as distance
from
places
join
deals on deals.place_id = places.id
where
ST_DWithin (coords::geometry(Point), (select reference_point from context), 1000)
order by
distance desc |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 21, 2017 at 03:16 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+05:30";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `test`
--
-- --------------------------------------------------------
--
-- Table structure for table `customer`
--
CREATE TABLE IF NOT EXISTS `MQTTDataExpanded` (
`TimeStamp` TIMESTAMP NOT NULL ,
`ClientID` varchar(255) NOT NULL,
`ACActivePower` DECIMAL(6,2),
`ACReactivePower` DECIMAL(6,2),
`DCPower` DECIMAL(6,2),
`ACVR` DECIMAL(5,2),
`ACVY` DECIMAL(5,2),
`ACVB` DECIMAL(5,2),
`ACIR` DECIMAL(5,2),
`ACIY` DECIMAL(5,2),
`ACIB` DECIMAL(5,2),
`DCV` DECIMAL(5,2),
`DCI` DECIMAL(5,2),
`LoadStatus` BIT(20),
`Load1P` DECIMAL(5,2),
`Load2P` DECIMAL(5,2),
`Load3P` DECIMAL(5,2),
`Load4P` DECIMAL(5,2),
`Load5P` DECIMAL(5,2),
`Load6P` DECIMAL(5,2),
`Load7P` DECIMAL(5,2),
`Load8P` DECIMAL(5,2),
`Load9P` DECIMAL(5,2),
`Load10P` DECIMAL(5,2),
`Load11P` DECIMAL(5,2),
`Load12P` DECIMAL(5,2),
`Load13P` DECIMAL(5,2),
`Load14P` DECIMAL(5,2),
`Load15P` DECIMAL(5,2),
`Load16P` DECIMAL(5,2),
`Load17P` DECIMAL(5,2),
`Load18P` DECIMAL(5,2),
`Load19P` DECIMAL(5,2),
`Load20P` DECIMAL(5,2),
PRIMARY KEY (`TimeStamp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `MQTTData` (
`TimeStamp` TIMESTAMP NOT NULL ,
`ClientID` varchar(255) NOT NULL,
`Data` TEXT NOT NULL,
PRIMARY KEY (`TimeStamp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `MQTTClientData` (
`ClientID` varchar(255) NOT NULL,
`ClientName` varchar(255) NOT NULL,
`ClientPassword` varchar(255) NOT NULL,
`ClientMobile` varchar(20) NOT NULL,
`Load1Name` varchar(255) NOT NULL,
`Load2Name` varchar(255) NOT NULL,
`Load3Name` varchar(255) NOT NULL,
`Load4Name` varchar(255) NOT NULL,
`Load5Name` varchar(255) NOT NULL,
`Load6Name` varchar(255) NOT NULL,
`Load7Name` varchar(255) NOT NULL,
`Load8Name` varchar(255) NOT NULL,
`Load9Name` varchar(255) NOT NULL,
`Load10Name` varchar(255) NOT NULL,
`Load11Name` varchar(255) NOT NULL,
`Load12Name` varchar(255) NOT NULL,
`Load13Name` varchar(255) NOT NULL,
`Load14Name` varchar(255) NOT NULL,
`Load15Name` varchar(255) NOT NULL,
`Load16Name` varchar(255) NOT NULL,
`Load17Name` varchar(255) NOT NULL,
`Load18Name` varchar(255) NOT NULL,
`Load19Name` varchar(255) NOT NULL,
`Load20Name` varchar(255) NOT NULL,
`Load1Priority` TINYINT,
`Load2Priority` TINYINT,
`Load3Priority` TINYINT,
`Load4Priority` TINYINT,
`Load5Priority` TINYINT,
`Load6Priority` TINYINT,
`Load7Priority` TINYINT,
`Load8Priority` TINYINT,
`Load9Priority` TINYINT,
`Load10Priority` TINYINT,
`Load11Priority` TINYINT,
`Load12Priority` TINYINT,
`Load13Priority` TINYINT,
`Load14Priority` TINYINT,
`Load15Priority` TINYINT,
`Load16Priority` TINYINT,
`Load17Priority` TINYINT,
`Load18Priority` TINYINT,
`Load19Priority` TINYINT,
`Load20Priority` TINYINT,
PRIMARY KEY (`ClientID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
/*!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 */;
|
/* No. 1*/
CREATE TABLE `students` (
`no` int,
`nim` int NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`city` text NOT NULL,
`age` int NOT NULL,
`ipk` float(2,1) NOT NULL,
`department` text,
Primary Key (nim)
);
ALTER TABLE students AUTO_INCREMENT = 12345;
INSERT INTO `students` VALUES
(NULL, NULL, 'Adi', 'Jakarta', '17', '2.5', 'Math'),
(NULL, NULL, 'Ani', 'Yogyakarta', '20', '2.1', 'Math'),
(NULL, NULL, 'Ari', 'Surabaya', '18', '2.5', 'Computer'),
(NULL, NULL, 'Ali', 'Banjarmasin', '20', '3.5', 'Computer'),
(NULL, NULL, 'Abi', 'Medan', '17', '3.7', 'Computer'),
(NULL, NULL, 'Budi', 'Jakarta', '19', '3.8', 'Computer'),
(NULL, NULL, 'Boni', 'Yogyakarta', '20', '3.2', 'Computer'),
(NULL, NULL, 'Bobi', 'Surabaya', '17', '2.7', 'Computer'),
(NULL, NULL, 'Beni', 'Banjarmasin', '18', '2.3', 'Computer'),
(NULL, NULL, 'Cepi', 'Jakarta', '20', '2.2', NULL),
(NULL, NULL, 'Coni', 'Yogyakarta', '22', '2.6', NULL),
(NULL, NULL, 'Ceki', 'Surabaya', '21', '2.5', 'Math'),
(NULL, NULL, 'Dodi', 'Jakarta', '20', '3.1', 'Math'),
(NULL, NULL, 'Didi', 'Yogyakarta', '19', '3.2', 'Physics'),
(NULL, NULL, 'Deri', 'Surabaya', '19', '3.3', 'Physics'),
(NULL, NULL, 'Eli', 'Jakarta', '20', '2.9', 'Physics'),
(NULL, NULL, 'Endah', 'Yogyakarta', '18', '2.8', 'Physics'),
(NULL, NULL, 'Feni', 'Jakarta', '17', '2.7', NULL),
(NULL, NULL, 'Farah', 'Yogyakarta', '18', '3.5', NULL),
(NULL, NULL, 'Fandi', 'Surabaya', '19', '3.4', NULL);
update `students` set `no` = (nim-12344);
/*No. 2*/
SELECT DISTINCT
city
FROM
students;
/*No. 3*/
SELECT
name
FROM
students
WHERE
department ='Computer';
/*No. 4*/
SELECT
nim, name, age, city
FROM
students
ORDER BY
age DESC;
/*No. 5*/
SELECT
name, age
FROM
students
WHERE
city = 'Jakarta'
ORDER BY
age asc
LIMIT 3;
/*No. 6*/
SELECT
name, ipk
FROM
students
WHERE
city = 'Jakarta' AND ipk < '2.5';
/*No. 7*/
SELECT
name, city
FROM
students
WHERE
not(city = 'Yogyakarta') AND not (city = 'Jakarta');
/*No. 8*/
SELECT
name, age, ipk
FROM
students
WHERE
ipk > '2.5' AND ipk<'3.5';
/*No. 9*/
SELECT
name
FROM
students
WHERE
name like '%a%';
/*No. 10*/
SELECT
nim
FROM
students
WHERE
department is null;
|
CREATE PROC [ERP].[Usp_Upd_Servicio_Desactivar]
@IdProducto INT,
@UsuarioElimino VARCHAR(250)
AS
BEGIN
UPDATE [ERP].[Producto] SET Flag = 0, FechaEliminado = DATEADD(HOUR, 3, GETDATE()),UsuarioElimino=@UsuarioElimino WHERE ID = @IdProducto AND IdTipoProducto=2
END
|
SELECT ROUND(lat::numeric,2) as lat,
ROUND(lng::numeric,2) AS lng,
state
FROM modeanalytics.fastfood_locations_2007
WHERE restaurant = 'c' |
CREATE DATABASE estados;
USE estados;
CREATE TABLE estados (
codigo INTEGER AUTO_INCREMENT PRIMARY KEY,
nome varchar(30),
sigla varchar(2) unique
);
insert into estados(nome, sigla) values
('Santa Catarina', 'SC'),
('Paraná','PR'),
('Rio Grande do Sul','RS'),
('São Paulo','SP'),
('Rio de Janeiro','RJ'),
('Bahia','BH'),
('Mato Grosso do Sul','MS');
select * from estados; |
use hackerrank;
select concat(name, '(', substring(name, 1, 1), ')') t
from occupations
order by name
;
select concat('There are a total of ', count(*), ' ', lower(occupation), 's.') t
from occupations
group by occupation
order by count(*), occupation
;
|
---
--- Регистр объектов домена
---
CREATE TABLE IF NOT EXISTS `domain_registry` (
`domain_name` varchar(20) NOT NULL,
`next_id` bigint(11) NOT NULL DEFAULT '1',
`class_api` varchar(50) NOT NULL,
`class_impl` varchar(50) NOT NULL,
UNIQUE KEY `domain_name` (`domain_name`)
);
---
--- ACL-значения
---
CREATE TABLE IF NOT EXISTS `domain_acl` (
`acl_id` varchar(20) NOT NULL,
`acl_name` varchar(20) NOT NULL,
`acl_type` tinyint NOT NULL,
`permit` tinyint NOT NULL,
UNIQUE KEY `acl_id` (`acl_id`)
);
---
--- Список ACL
---
CREATE TABLE IF NOT EXISTS `domain_acl_group` (
`parent_id` varchar(20) NOT NULL,
`parent_type` tinyint NOT NULL,
`child_id` varchar(20) NOT NULL,
);
---
--- Параметры
---
CREATE TABLE IF NOT EXISTS `domain_property` (
`property_id` int NOT NULL AUTO_INCREMENT,
`param_name` varchar(100) NOT NULL,
`param_value` varchar(100) NOT NULL,
PRIMARY KEY (`property_id`)
);
---
--- Инициализация по умолчанию
---
---пользователи
INSERT INTO `domain_acl` (`acl_id`, `acl_name`, `acl_type`, `permit`) VALUES
('1', 'admin', 1, 4);
---параметры
INSERT INTO `domain_property` (`param_name`, `param_value`) VALUES
('acl_next_id', '2'); |
INSERT INTO `qb_module` (`id`, `type`, `name`, `pre`, `dirname`, `domain`, `admindir`, `config`, `list`, `admingroup`, `adminmember`, `ifclose`) VALUES (17, 2, '考试模块', 'exam_', 'exam', '', '', 'a:7:{s:12:"list_PhpName";s:18:"list.php?&fid=$fid";s:12:"show_PhpName";s:29:"bencandy.php?&fid=$fid&id=$id";s:8:"MakeHtml";N;s:14:"list_HtmlName1";N;s:14:"show_HtmlName1";N;s:14:"list_HtmlName2";N;s:14:"show_HtmlName2";N;}', 0, '', '', 0);
# --------------------------------------------------------
#
# 表的结构 `qb_exam_cache`
#
DROP TABLE IF EXISTS `qb_exam_cache`;
CREATE TABLE `qb_exam_cache` (
`uid` mediumint(7) NOT NULL default '0',
`form_id` int(7) NOT NULL default '0',
`jointime` int(10) NOT NULL default '0',
KEY `uid` (`uid`),
KEY `form_id` (`form_id`)
) TYPE=HEAP;
#
# 导出表中的数据 `qb_exam_cache`
#
# --------------------------------------------------------
#
# 表的结构 `qb_exam_config`
#
DROP TABLE IF EXISTS `qb_exam_config`;
CREATE TABLE `qb_exam_config` (
`c_key` varchar(50) NOT NULL default '',
`c_value` text NOT NULL,
`c_descrip` text NOT NULL,
PRIMARY KEY (`c_key`)
) TYPE=MyISAM;
#
# 导出表中的数据 `qb_exam_config`
#
INSERT INTO `qb_exam_config` VALUES ('Info_delpaper', '0', '');
INSERT INTO `qb_exam_config` VALUES ('module_close', '0', '');
INSERT INTO `qb_exam_config` VALUES ('Info_webname', '考试模块', '');
INSERT INTO `qb_exam_config` VALUES ('Info_webOpen', '1', '');
INSERT INTO `qb_exam_config` VALUES ('module_pre', 'exam_', '');
INSERT INTO `qb_exam_config` VALUES ('module_id', '17', '');
# --------------------------------------------------------
#
# 表的结构 `qb_exam_form`
#
DROP TABLE IF EXISTS `qb_exam_form`;
CREATE TABLE `qb_exam_form` (
`id` mediumint(7) NOT NULL auto_increment,
`type` tinyint(1) NOT NULL default '0',
`fid` mediumint(6) NOT NULL default '0',
`name` varchar(150) NOT NULL default '',
`config` text NOT NULL,
`uid` mediumint(7) NOT NULL default '0',
`username` varchar(30) NOT NULL default '',
`ifshare` tinyint(1) NOT NULL default '0',
`ifclose` tinyint(1) NOT NULL default '0',
`creattime` int(10) NOT NULL default '0',
`list` int(10) NOT NULL default '0',
`recommend` tinyint(1) NOT NULL default '0',
`levelstime` int(10) NOT NULL default '0',
`yz` tinyint(1) NOT NULL default '0',
`joins` mediumint(7) NOT NULL default '0',
`money` smallint(4) NOT NULL default '0',
`iftruename` tinyint(1) NOT NULL default '1',
`ifclass` tinyint(1) NOT NULL default '1',
`ifnumber` tinyint(1) NOT NULL default '1',
`totaltime` mediumint(3) NOT NULL default '0',
`allowjoin` varchar(255) NOT NULL default '',
`begintime` int(10) NOT NULL default '0',
`endtime` int(10) NOT NULL default '0',
`hidefen` tinyint(1) NOT NULL default '0',
`content` text NOT NULL,
`hits` mediumint(7) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `joins` (`joins`),
KEY `recommend` (`recommend`),
KEY `money` (`money`),
KEY `fid` (`fid`),
KEY `uid` (`uid`)
) TYPE=MyISAM AUTO_INCREMENT=30 ;
#
# 导出表中的数据 `qb_exam_form`
#
INSERT INTO `qb_exam_form` VALUES (18, 0, 3, '一年级期中考试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1283154319, 0, 0, 0, 0, 0, 0, 1, 1, 1, 30, '', 0, 0, 1, '', 0);
INSERT INTO `qb_exam_form` VALUES (19, 0, 30, '北京市2009年度人力资源联考试题', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289193980, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 0);
INSERT INTO `qb_exam_form` VALUES (20, 0, 29, '广东省2003年度教师资格水平测试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289193992, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 0);
INSERT INTO `qb_exam_form` VALUES (21, 0, 26, '2000年全国报关员考试水平测试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289193999, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 0);
INSERT INTO `qb_exam_form` VALUES (22, 0, 23, '二零零五年度初级会计职称水平测试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289194006, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 2);
INSERT INTO `qb_exam_form` VALUES (23, 0, 3, '2008年政法干警司法考试第一卷', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289194013, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 3);
INSERT INTO `qb_exam_form` VALUES (24, 0, 17, '2009年度上半年英语四级全国联考', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289194021, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 1);
INSERT INTO `qb_exam_form` VALUES (25, 0, 15, '2010年度微软认证水平测试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289194028, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '3,4,8,9,10', 0, 0, 0, '', 0);
INSERT INTO `qb_exam_form` VALUES (26, 0, 13, '全国联考计算机二级入门水平测试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289194035, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 1);
INSERT INTO `qb_exam_form` VALUES (27, 0, 11, '初一语文第一学期期中考试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289194043, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 0);
INSERT INTO `qb_exam_form` VALUES (28, 0, 10, 'SEO推广水平测试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289194050, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 4);
INSERT INTO `qb_exam_form` VALUES (29, 0, 5, '初级站长了解互联网的入门知识考试', 'a:1:{s:5:"fendb";a:9:{i:1;s:2:"30";i:2;s:2:"10";i:3;s:2:"10";i:4;s:2:"10";i:5;s:2:"10";i:6;s:2:"10";i:7;s:2:"10";i:8;s:2:"10";i:9;s:2:"10";}}', 1, 'admin', 0, 0, 1289201702, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, '', 0, 0, 0, '', 33);
# --------------------------------------------------------
#
# 表的结构 `qb_exam_form_element`
#
DROP TABLE IF EXISTS `qb_exam_form_element`;
CREATE TABLE `qb_exam_form_element` (
`element_id` int(7) NOT NULL auto_increment,
`form_id` mediumint(7) NOT NULL default '0',
`title_id` mediumint(7) NOT NULL default '0',
`list` int(10) NOT NULL default '0',
PRIMARY KEY (`element_id`),
KEY `form_id` (`form_id`),
KEY `title_id` (`title_id`),
KEY `list` (`list`)
) TYPE=MyISAM AUTO_INCREMENT=121 ;
#
# 导出表中的数据 `qb_exam_form_element`
#
INSERT INTO `qb_exam_form_element` VALUES (1, 18, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (2, 18, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (3, 18, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (4, 18, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (5, 18, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (6, 18, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (7, 18, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (8, 18, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (9, 18, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (10, 18, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (11, 19, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (12, 19, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (13, 19, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (14, 19, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (15, 19, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (16, 19, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (17, 19, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (18, 19, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (19, 19, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (20, 19, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (21, 20, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (22, 20, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (23, 20, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (24, 20, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (25, 20, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (26, 20, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (27, 20, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (28, 20, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (29, 20, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (30, 20, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (31, 21, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (32, 21, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (33, 21, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (34, 21, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (35, 21, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (36, 21, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (37, 21, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (38, 21, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (39, 21, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (40, 21, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (41, 22, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (42, 22, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (43, 22, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (44, 22, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (45, 22, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (46, 22, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (47, 22, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (48, 22, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (49, 22, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (50, 22, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (51, 23, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (52, 23, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (53, 23, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (54, 23, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (55, 23, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (56, 23, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (57, 23, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (58, 23, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (59, 23, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (60, 23, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (61, 24, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (62, 24, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (63, 24, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (64, 24, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (65, 24, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (66, 24, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (67, 24, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (68, 24, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (69, 24, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (70, 24, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (71, 25, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (72, 25, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (73, 25, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (74, 25, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (75, 25, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (76, 25, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (77, 25, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (78, 25, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (79, 25, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (80, 25, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (81, 26, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (82, 26, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (83, 26, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (84, 26, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (85, 26, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (86, 26, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (87, 26, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (88, 26, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (89, 26, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (90, 26, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (91, 27, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (92, 27, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (93, 27, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (94, 27, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (95, 27, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (96, 27, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (97, 27, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (98, 27, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (99, 27, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (100, 27, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (101, 28, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (102, 28, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (103, 28, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (104, 28, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (105, 28, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (106, 28, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (107, 28, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (108, 28, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (109, 28, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (110, 28, 22, 0);
INSERT INTO `qb_exam_form_element` VALUES (111, 29, 15, 0);
INSERT INTO `qb_exam_form_element` VALUES (112, 29, 6, 0);
INSERT INTO `qb_exam_form_element` VALUES (113, 29, 23, 0);
INSERT INTO `qb_exam_form_element` VALUES (114, 29, 8, 0);
INSERT INTO `qb_exam_form_element` VALUES (115, 29, 9, 0);
INSERT INTO `qb_exam_form_element` VALUES (116, 29, 19, 0);
INSERT INTO `qb_exam_form_element` VALUES (117, 29, 20, 0);
INSERT INTO `qb_exam_form_element` VALUES (118, 29, 12, 0);
INSERT INTO `qb_exam_form_element` VALUES (119, 29, 13, 0);
INSERT INTO `qb_exam_form_element` VALUES (120, 29, 22, 0);
# --------------------------------------------------------
#
# 表的结构 `qb_exam_sort`
#
DROP TABLE IF EXISTS `qb_exam_sort`;
CREATE TABLE `qb_exam_sort` (
`fid` mediumint(7) unsigned NOT NULL auto_increment,
`fup` mediumint(7) unsigned NOT NULL default '0',
`name` varchar(200) NOT NULL default '',
`class` smallint(4) NOT NULL default '0',
`sons` smallint(4) NOT NULL default '0',
`type` tinyint(1) NOT NULL default '0',
`admin` varchar(100) NOT NULL default '',
`list` int(10) NOT NULL default '0',
`listorder` tinyint(2) NOT NULL default '0',
`passwd` varchar(32) NOT NULL default '',
`logo` varchar(150) NOT NULL default '',
`descrip` text NOT NULL,
`style` varchar(50) NOT NULL default '',
`template` text NOT NULL,
`jumpurl` varchar(150) NOT NULL default '',
`maxperpage` tinyint(3) NOT NULL default '0',
`metakeywords` varchar(255) NOT NULL default '',
`metadescription` varchar(255) NOT NULL default '',
`allowcomment` tinyint(1) NOT NULL default '0',
`allowpost` varchar(150) NOT NULL default '',
`allowviewtitle` varchar(150) NOT NULL default '',
`allowviewcontent` varchar(150) NOT NULL default '',
`allowdownload` varchar(150) NOT NULL default '',
`forbidshow` tinyint(1) NOT NULL default '0',
`config` text NOT NULL,
`list_html` varchar(255) NOT NULL default '',
`bencandy_html` varchar(255) NOT NULL default '',
PRIMARY KEY (`fid`),
KEY `fup` (`fup`)
) TYPE=MyISAM AUTO_INCREMENT=31 ;
#
# 导出表中的数据 `qb_exam_sort`
#
INSERT INTO `qb_exam_sort` VALUES (1, 0, '初中生试卷', 1, 2, 1, '', 0, 0, '', '', '', '', '', '', 0, '', '', 0, '', '', '', '', 0, 'a:4:{s:11:"sonTitleRow";N;s:12:"sonTitleLeng";N;s:9:"cachetime";N;s:12:"sonListorder";N;}', '', '');
INSERT INTO `qb_exam_sort` VALUES (12, 0, '计算机等级考试', 1, 3, 1, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (13, 12, '计算机二级', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (3, 1, '初一数学试卷', 2, 0, 0, '', 0, 0, '', '', '', '', 'N;', '', 0, '', '', 0, '', '', '', '', 0, 'a:4:{s:11:"sonTitleRow";N;s:12:"sonTitleLeng";N;s:9:"cachetime";N;s:12:"sonListorder";N;}', '', '');
INSERT INTO `qb_exam_sort` VALUES (4, 0, '互联网', 1, 2, 1, '', 10, 0, '', '', '', '', '', '', 0, '', '', 0, '', '', '', '', 0, 'b:0;', '', '');
INSERT INTO `qb_exam_sort` VALUES (5, 4, '互联网入门', 2, 0, 0, '', 10, 0, '', '', '', '', '', '', 0, '', '', 0, '', '', '', '', 0, 'b:0;', '', '');
INSERT INTO `qb_exam_sort` VALUES (11, 1, '初一语文', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 0, '', '', '', '', 0, 'b:0;', '', '');
INSERT INTO `qb_exam_sort` VALUES (10, 4, 'SEO推广', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 0, '', '', '', '', 0, 'b:0;', '', '');
INSERT INTO `qb_exam_sort` VALUES (14, 12, '计算机一级', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (15, 12, '微软认证', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (16, 0, '外语考试', 1, 2, 1, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (17, 16, '英语四级', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (18, 16, '托福考试', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (19, 0, '公务员考试', 1, 2, 1, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (20, 19, '政法干警', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (21, 19, '事业单位', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (22, 0, '财务类', 1, 2, 1, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (23, 22, '初级会计职称', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (24, 22, '注册会计师', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (25, 0, '外贸类', 1, 2, 1, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (26, 25, '报关员考试', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (27, 25, '物流师考', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (28, 0, '职业资格考试', 1, 2, 1, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (29, 28, '教师资格', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
INSERT INTO `qb_exam_sort` VALUES (30, 28, '人力资源', 2, 0, 0, '', 0, 0, '', '', '', '', '', '', 0, '', '', 1, '', '', '', '', 0, '', '', '');
# --------------------------------------------------------
#
# 表的结构 `qb_exam_student`
#
DROP TABLE IF EXISTS `qb_exam_student`;
CREATE TABLE `qb_exam_student` (
`student_id` int(7) NOT NULL auto_increment,
`student_uid` mediumint(7) NOT NULL default '0',
`student_name` varchar(30) NOT NULL default '',
`student_truename` varchar(30) NOT NULL default '',
`aclass` varchar(30) NOT NULL default '',
`number` varchar(30) NOT NULL default '',
`form_id` mediumint(7) NOT NULL default '0',
`total_fen` smallint(4) NOT NULL default '0',
`posttime` int(10) NOT NULL default '0',
`yz` tinyint(1) NOT NULL default '0',
`totaltime` mediumint(7) NOT NULL default '0',
PRIMARY KEY (`student_id`),
KEY `form_id` (`form_id`),
KEY `student_uid` (`student_uid`,`yz`),
KEY `total_fen` (`total_fen`,`totaltime`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;
#
# 导出表中的数据 `qb_exam_student`
#
INSERT INTO `qb_exam_student` VALUES (1, 1, 'admin', '', '', '', 28, 46, 1289268119, 0, 0);
INSERT INTO `qb_exam_student` VALUES (2, 1, 'admin', '', '', '', 20, 46, 1289268462, 1, 0);
INSERT INTO `qb_exam_student` VALUES (3, 1, 'admin', '', '', '', 29, 0, 1289367714, 0, 1);
INSERT INTO `qb_exam_student` VALUES (4, 2, '张生', '', '', '', 29, 90, 1289268462, 0, 0);
# --------------------------------------------------------
#
# 表的结构 `qb_exam_student_title`
#
DROP TABLE IF EXISTS `qb_exam_student_title`;
CREATE TABLE `qb_exam_student_title` (
`st_id` int(7) NOT NULL auto_increment,
`title_id` mediumint(7) NOT NULL default '0',
`student_id` mediumint(7) NOT NULL default '0',
`form_id` mediumint(7) NOT NULL default '0',
`answer` text NOT NULL,
`fen` smallint(3) NOT NULL default '0',
`comment` text NOT NULL,
PRIMARY KEY (`st_id`)
) TYPE=MyISAM AUTO_INCREMENT=20 ;
#
# 导出表中的数据 `qb_exam_student_title`
#
INSERT INTO `qb_exam_student_title` VALUES (1, 15, 1, 28, 'a', 0, '');
INSERT INTO `qb_exam_student_title` VALUES (2, 6, 1, 28, 'c', 15, '');
INSERT INTO `qb_exam_student_title` VALUES (3, 23, 1, 28, 'a\nb', 5, '');
INSERT INTO `qb_exam_student_title` VALUES (4, 8, 1, 28, 'b', 10, '');
INSERT INTO `qb_exam_student_title` VALUES (5, 9, 1, 28, '7\n12\n', 6, '');
INSERT INTO `qb_exam_student_title` VALUES (6, 19, 1, 28, '1', 0, '');
INSERT INTO `qb_exam_student_title` VALUES (7, 20, 1, 28, '2', 10, '');
INSERT INTO `qb_exam_student_title` VALUES (8, 13, 1, 28, '12\r\n011', 0, '');
INSERT INTO `qb_exam_student_title` VALUES (9, 22, 1, 28, '21\r\n10', 0, '');
INSERT INTO `qb_exam_student_title` VALUES (10, 15, 2, 20, 'd', 0, '');
INSERT INTO `qb_exam_student_title` VALUES (11, 6, 2, 20, 'c', 15, '');
INSERT INTO `qb_exam_student_title` VALUES (12, 23, 2, 20, 'a\nb', 5, '');
INSERT INTO `qb_exam_student_title` VALUES (13, 8, 2, 20, 'b', 10, '');
INSERT INTO `qb_exam_student_title` VALUES (14, 9, 2, 20, '7\n12\n', 6, '');
INSERT INTO `qb_exam_student_title` VALUES (15, 19, 2, 20, 'abc', 0, '');
INSERT INTO `qb_exam_student_title` VALUES (16, 20, 2, 20, '2', 10, '');
INSERT INTO `qb_exam_student_title` VALUES (17, 13, 2, 20, 'fd\r\nwf', 0, '');
INSERT INTO `qb_exam_student_title` VALUES (18, 22, 2, 20, 'wfds\r\nwfds', 0, '');
INSERT INTO `qb_exam_student_title` VALUES (19, 9, 3, 29, '\n\n', 0, '');
# --------------------------------------------------------
#
# 表的结构 `qb_exam_title`
#
DROP TABLE IF EXISTS `qb_exam_title`;
CREATE TABLE `qb_exam_title` (
`id` mediumint(7) NOT NULL auto_increment,
`fid` smallint(4) NOT NULL default '0',
`type` tinyint(2) NOT NULL default '0',
`question` text NOT NULL,
`config` text NOT NULL,
`answer` text NOT NULL,
`uid` mediumint(7) NOT NULL default '0',
`username` varchar(30) NOT NULL default '',
`ifshare` tinyint(1) NOT NULL default '1',
`yz` tinyint(1) NOT NULL default '0',
`difficult` tinyint(1) NOT NULL default '0',
`star` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `type` (`type`),
KEY `fid` (`fid`),
KEY `yz` (`yz`),
KEY `difficult` (`difficult`),
KEY `star` (`star`)
) TYPE=MyISAM AUTO_INCREMENT=24 ;
#
# 导出表中的数据 `qb_exam_title`
#
INSERT INTO `qb_exam_title` VALUES (6, 3, 1, '3+3=? ', '4\r\n5\r\n6\r\n7', 'c', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (4, 3, 1, '2+3=? ', '2\r\n3\r\n4\r\n5', 'd', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (7, 3, 2, '下面哪个是整数 ', '2\r\n3\r\n4.5\r\n2.3', 'a,b', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (8, 3, 3, '1+1=3是正确的吗? ', '正确\r\n错误', 'b', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (9, 3, 4, '3+4=( ),3+9=( ),5+9=( )这三个等式都是加法运算。 ', '', '7\r\n12\r\n14', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (10, 3, 5, '请把以下数字由大到小排序', '12\r\n23\r\n56\r\n3\r\n7', 'cbaed', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (11, 3, 6, '1+2+3+4=?', '', '10', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (12, 3, 7, '请例出小于10能被2整除的数? ', '', '2,4,6,8', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (13, 3, 8, '齐博软件与齐博CMS是同一个概念吗?齐博软件包含哪些产品?', '', '', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (14, 3, 9, '请列出齐博软件曾经开发过的模块系统?', '', '', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (15, 5, 1, '齐博软件的公司地址在哪里?', '广州\r\n上海\r\n北京\r\n杭州', 'a', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (16, 5, 2, '齐博CMS曾经使用过的品牌名称有哪些?', '菁菁整站\r\nphp168\r\n齐博CMS\r\n龙城CMS', 'a,b,c', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (17, 5, 3, '齐博软件包含OA系统吗?', '正确\r\n错误', 'b', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (18, 5, 4, '齐博CMS的创始人是谁(),他的真实姓名是叫什么()?', '', '龙城\r\n李芳俊', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (19, 5, 5, '请把以下网站的创建日期从早到晚的顺序排一下?----直接填字母如abcdef: ', '新浪网\r\n开心网\r\n齐博网', 'acb', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (20, 5, 6, '1+1=', '', '2', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (21, 5, 7, '请你列出齐博软件有哪些主打产品?', '', '', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (22, 5, 9, '齐博软件如何能够更快的帮助广大站长营利?请你列出一些可行性的方案', '', '', 1, 'admin', 1, 0, 0, 0);
INSERT INTO `qb_exam_title` VALUES (23, 5, 2, '齐博软件包含哪些系统?', 'CMS整站系统\r\n分类信息系统\r\n地方门户系统\r\nB2B电子商务系统', 'a,b,c,d', 1, 'admin', 1, 0, 0, 0);
|
-- --------------------------------------------------------
--
-- Estrutura da tabela `tb_imovel_financeiro`
--
CREATE TABLE `tb_imovel_financeiro` (
`imovel` int(11) NOT NULL,
`valor` double DEFAULT NULL,
`mcmv` int(11) DEFAULT NULL,
`financia` varchar(5) DEFAULT NULL,
`entrada` double DEFAULT NULL,
`permuta` varchar(5) DEFAULT NULL,
`carro` varchar(5) DEFAULT NULL,
`fgts` varchar(5) DEFAULT NULL,
`condominio` varchar(45) DEFAULT NULL,
`captador` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
#
# Table structure for table 'tx_a21glossary_main'
#
CREATE TABLE tx_a21glossary_main (
uid int(11) DEFAULT '0' NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_id int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_label varchar(30) DEFAULT '' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l18n_parent int(11) DEFAULT '0' NOT NULL,
l18n_diffsource mediumblob NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
fe_group int(11) DEFAULT '0' NOT NULL,
short tinytext NOT NULL,
shortcut tinytext NOT NULL,
longversion tinytext NOT NULL,
shorttype tinytext NOT NULL,
language char(2) DEFAULT '' NOT NULL,
description text NOT NULL,
link tinytext NOT NULL,
exclude tinyint(3) DEFAULT '0' NOT NULL,
force_linking int(11) DEFAULT '0' NOT NULL,
force_case int(11) DEFAULT '0' NOT NULL,
force_preservecase int(11) DEFAULT '0' NOT NULL,
force_regexp int(11) DEFAULT '0' NOT NULL,
force_global int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
KEY parent (pid)
); |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: 07 Mai 2018 la 12:43
-- Versiune server: 10.1.28-MariaDB
-- PHP Version: 7.1.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `CompanyDB`
--
-- --------------------------------------------------------
--
-- Structura de tabel pentru tabelul `Employees`
--
CREATE TABLE `Employees` (
`ID` int(11) NOT NULL,
`FirstName` varchar(50) NOT NULL,
`LastName` varchar(50) NOT NULL,
`Email` varchar(100) NOT NULL,
`Password` varchar(256) NOT NULL,
`Age` int(11) NOT NULL,
`Role` varchar(50) NOT NULL,
`Profile` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Salvarea datelor din tabel `Employees`
--
INSERT INTO `Employees` (`ID`, `FirstName`, `LastName`, `Email`, `Password`, `Age`, `Role`, `Profile`) VALUES
(6, 'Bogdan', 'Maier', 'bogdanmaier49@gmail.com', '12345', 20, 'Admin', 0),
(7, 'Tudor', 'Trif', 'tudor@gmail.com', '123456', 21, 'Admin', 0),
(8, 'Tudor', 'Muresan', 'tudormuresan@gmail.com', '123456', 20, 'Dev', 0),
(9, 'Andrei', 'Pop', 'adnreipop@gmail.com', '123456', 26, 'Dev', 0),
(10, 'Dragos', 'Pop', 'dragospop@gmail.com', '123456', 33, 'Dev', 0),
(15, 'Bogdan', 'Maier', 'bogdanmaier492@gmail.com', '123456', 20, 'Dev', 0),
(19, 'Bogdan', 'Maier', 'bogdanmaier493@gmail.com', '123456', 20, 'Dev', 0);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `Employees`
--
ALTER TABLE `Employees`
ADD PRIMARY KEY (`ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `Employees`
--
ALTER TABLE `Employees`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
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 PROC [ERP].[Usp_Sel_Vendedor_Borrador_Pagination]
@IdEmpresa INT
AS
BEGIN
SELECT
V.ID,
EN.Nombre,
V.FechaRegistro,
V.FechaEliminado,
ETD.NumeroDocumento
FROM ERP.Vendedor V
INNER JOIN ERP.Trabajador T
ON T.ID = V.IdTrabajador
INNER JOIN ERP.Entidad EN
ON EN.ID = T.IdEntidad
INNER JOIN ERP.EntidadTipoDocumento ETD
ON ETD.IdEntidad = EN.ID
WHERE IdEmpresa = @IdEmpresa AND V.FlagBorrador = 1
END
|
/*LAB 3
PHILIP BURGGRAF
*/
--1.
SELECT CUSTOMER_LAST_NAME, CUSTOMER_FIRST_NAME
FROM OM.CUSTOMERS
ORDER BY CUSTOMER_LAST_NAME;
--2.
SELECT CUSTOMER_LAST_NAME, CUSTOMER_FIRST_NAME
FROM OM.CUSTOMERS
ORDER BY CUSTOMER_LAST_NAME DESC;
--3.
SELECT CUSTOMER_LAST_NAME, CUSTOMER_FIRST_NAME
FROM OM.CUSTOMERS
ORDER BY CUSTOMER_LAST_NAME, CUSTOMER_FIRST_NAME DESC;
--4.
SELECT CUSTOMER_LAST_NAME, CUSTOMER_FIRST_NAME
FROM OM.CUSTOMERS
ORDER BY 1 DESC;
--5.
SELECT CUSTOMER_FIRST_NAME AS FIRSTNAME, CUSTOMER_LAST_NAME AS "Last Name", CUSTOMER_CITY AS "'City'",
CUSTOMER_STATE AS "*Cust-State*"
FROM OM.CUSTOMERS;
--6.
SELECT DISTINCT CUSTOMER_STATE
FROM OM.CUSTOMERS
ORDER BY CUSTOMER_STATE;
--7.
SELECT DISTINCT CUSTOMER_FAX
FROM OM.CUSTOMERS
ORDER BY CUSTOMER_FAX DESC;
--8.
SELECT *
FROM OM.CUSTOMERS
WHERE ROWNUM <= 4;
--9.
SELECT TITLE
FROM OM.ITEMS
WHERE TITLE LIKE '%Road%';
--10.
SELECT TITLE, UNIT_PRICE
FROM OM.ITEMS
WHERE UNIT_PRICE LIKE '%.%';
--11.
SELECT TITLE, UNIT_PRICE
FROM OM.ITEMS
WHERE UNIT_PRICE NOT LIKE '%.%';
--12.
SELECT ORDER_ID, ORDER_QTY
FROM OM.ORDER_DETAILS
WHERE ORDER_QTY >= 2;
--13.
SELECT ORDER_ID
FROM OM.ORDER_DETAILS
WHERE MOD(ORDER_ID, 13) = 0;
--14.
SELECT ORDER_ID, SHIPPED_DATE
FROM OM.ORDERS
WHERE SHIPPED_DATE IS NULL;
--15.
SELECT ORDER_ID, SHIPPED_DATE - ORDER_DATE AS "Number of days to ship"
FROM OM.ORDERS
WHERE SHIPPED_DATE - ORDER_DATE > 25
ORDER BY SHIPPED_DATE - ORDER_DATE DESC;
|
-- phpMyAdmin SQL Dump
-- version 4.2.7.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Dec 03, 2014 at 09:22 AM
-- Server version: 5.6.20
-- PHP Version: 5.5.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `dreamteam`
--
-- --------------------------------------------------------
--
-- Table structure for table `listinginfo`
--
CREATE TABLE IF NOT EXISTS `listinginfo` (
`listingID` int(11) NOT NULL,
`username` varchar(20) DEFAULT NULL,
`racquetID` int(11) DEFAULT NULL,
`price` double NOT NULL,
`neworUsed` enum('New','Used') NOT NULL DEFAULT 'Used',
`dateListed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`description` varchar(1024) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
--
-- Dumping data for table `listinginfo`
--
INSERT INTO `listinginfo` (`listingID`, `username`, `racquetID`, `price`, `neworUsed`, `dateListed`, `description`) VALUES
(1, 'srkanth', 1, 79.99, 'Used', '2014-11-30 23:26:09', 'Solid offering in good condition. Minor cosmetic damage near throat.'),
(2, 'ironman', 2, 799.99, 'Used', '2014-12-01 18:42:23', 'Exquisite offering! Rafael Nadal''s racquet of choice, signed by Rafa himself at the 2011 French Open!'),
(3, 'jayp', 3, 159.99, 'Used', '2014-12-01 18:44:30', 'Novak Djokovic''s racquet of choice. I used for just one tournament.'),
(4, 'jsu', 4, 89.99, 'Used', '2014-12-01 18:45:09', 'Andy Murray''s racquet. Bumper guard needs to be replaced. Other than that, great condition!'),
(5, 'shub', 5, 59.99, 'New', '2014-12-01 18:46:47', 'Clearance sale!'),
(6, 'etam', 6, 179.99, 'New', '2014-12-01 18:50:50', 'The perfect blend of stability and maneuverability!'),
(7, 'etam', 7, 69.99, 'Used', '2014-12-01 18:52:58', 'Underrated racquet. Minimal cosmetic damage.'),
(8, 'srkanth', 8, 94.99, 'New', '2014-12-04 23:33:16', 'Exclusive offer! Save big bucks on a silky smooth stick! For a limited time, free custom stringjob!'),
(9, 'shub', 9, 249.99, 'New', '2014-12-01 18:57:09', 'Limited offer! Strung with the Lendl pattern for enhanced control. Scalpel-like stability and precision on groundstrokes and volleys alike.'),
(10, 'jayp', 10, 39.99, 'Used', '2014-12-01 19:00:15', 'Great racquet, but the string broke and I don''t want to deal with it.');
-- --------------------------------------------------------
--
-- Table structure for table `racquetinfo`
--
CREATE TABLE IF NOT EXISTS `racquetinfo` (
`racquetID` int(11) NOT NULL,
`modelName` varchar(20) DEFAULT NULL,
`brand` varchar(10) DEFAULT NULL,
`mass` double DEFAULT NULL,
`length` double DEFAULT NULL,
`swingweight` double DEFAULT NULL,
`balancePoint` double DEFAULT NULL,
`qualityIndex` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
--
-- Dumping data for table `racquetinfo`
--
INSERT INTO `racquetinfo` (`racquetID`, `modelName`, `brand`, `mass`, `length`, `swingweight`, `balancePoint`, `qualityIndex`) VALUES
(1, 'Pure Drive', 'Babolat', 11.1, 27, 308, -4, 1.116),
(2, 'AeroPro Drive', 'Babolat', 11.3, 27, 316, -4, 1.108),
(3, 'Graphene Speed MP', 'Head', 11, 27, 320, -3, 1.085),
(4, 'Graphene Radical Pro', 'Head', 11.5, 27, 326, -6, 1.051),
(5, 'Microgel Radical MP', 'Head', 11, 27, 315, -2, 1.124),
(6, 'EX03 Tour 100 16x18', 'Prince', 11.6, 27, 323, -7, 1.049),
(7, 'Organix 9', 'Volkl', 11.4, 27, 313, -5, 1.107),
(8, 'Blade 93', 'Wilson', 12, 27, 333, -6, 1.074),
(9, 'VCore Tour 89', 'Yonex', 12.1, 27, 335, -8, 1.034),
(10, 'Ezone Xi 98', 'Yonex', 11.5, 27, 324, -6, 1.058);
-- --------------------------------------------------------
--
-- Table structure for table `userinfo`
--
CREATE TABLE IF NOT EXISTS `userinfo` (
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`firstName` varchar(20) NOT NULL,
`lastName` varchar(20) NOT NULL,
`email` varchar(50) NOT NULL,
`phoneNumber` varchar(20) NOT NULL,
`city` varchar(20) NOT NULL,
`state` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `userinfo`
--
INSERT INTO `userinfo` (`username`, `password`, `firstName`, `lastName`, `email`, `phoneNumber`, `city`, `state`) VALUES
('etam', '123456', 'Eric', 'Tam', 'etam@ghoo.com', '415-999-8876', 'San Jose', 'California'),
('ironman', 'iamironman', 'Tony', 'Stark', 'info@stark.com', '415-999-8872', 'San Jose', 'California'),
('jayp', 'mypassword', 'Jay', 'Patel', 'jay@hostname.com', '415-666-8877', 'Santa Clara', 'California'),
('jsu', 'dreamteam', 'Jeffrey', 'Su', 'su@life.com', '415-999-8177', 'San Jose', 'California'),
('lantan', 'liketocode', 'Lauren', 'Tanner', 'ltanner@yahoo.com', '123-456-3423', 'San Jose', 'California'),
('marlee', 'asmr3322', 'Maria', 'Lee', 'marialee@hotmail.com', '123-456-3457', 'San Jose', 'California'),
('shub', '65pass56', 'Shubha', 'Ranganathan', 'shub@email.com', '415-999-8879', 'San Jose', 'California'),
('srkanth', 'kommjetzt', 'Srikanth', 'Narahari', 'sri@sjsu.com', '408-123-1234', 'San Jose', 'California'),
('tbran', 'brant', 'Brandon', 'Thomas', 'tbran@gmail.com', '123-456-3421', 'San Jose', 'California'),
('tennislover', 'ilovetennis', 'Mark', 'Wheeler', 'mark.wheeler@gmail.com', '123-456-3429', 'San Jose', 'California');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `listinginfo`
--
ALTER TABLE `listinginfo`
ADD PRIMARY KEY (`listingID`), ADD KEY `username` (`username`), ADD KEY `racquetID` (`racquetID`);
--
-- Indexes for table `racquetinfo`
--
ALTER TABLE `racquetinfo`
ADD PRIMARY KEY (`racquetID`);
--
-- Indexes for table `userinfo`
--
ALTER TABLE `userinfo`
ADD PRIMARY KEY (`username`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `listinginfo`
--
ALTER TABLE `listinginfo`
MODIFY `listingID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `racquetinfo`
--
ALTER TABLE `racquetinfo`
MODIFY `racquetID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `listinginfo`
--
ALTER TABLE `listinginfo`
ADD CONSTRAINT `listinginfo_ibfk_1` FOREIGN KEY (`username`) REFERENCES `userinfo` (`username`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `listinginfo_ibfk_2` FOREIGN KEY (`racquetID`) REFERENCES `racquetinfo` (`racquetID`) ON DELETE NO ACTION ON UPDATE NO ACTION;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
SELECT TOP(CONVERT(INT, /*topRow*/))
--1 回収事由
A.WITHDRAW_CASUS,
--2 契約番号
A.CONTRACT_NO,
--3 回数
A.COUPON,
--4 回数連番
A.COUPON_SEQ,
--5 回収予定日
A.WITHDRAW_SCHEDULE_DATE,
--6 延滞開始日
A.DELAYED_START_DATE,
--7 延滞結算日
A.DELAYED_ACCOUNT_DATE,
--8延滞日数
A.DELAYED_DAYS,
--9 回収予定額
A.WITHDRAW_SCHEDULE_AMOUNT,
--10 回収実績額
A.WITHDRAW_RESULT_AMOUNT,
--10今回引落金額
A.REQUEST_AMOUNT,
--11 リース料の回収予定日
A.LEASE_WITHDRAW_SCHEDULE_DATE,
--12売主コード
A.AGENCY_CUST_CODE,
--13 売主名
A.AGENCY_NAME,
--14 顧客コード
A.CUSTOMER_CODE,
--15 顧客名
A.CUSTOMER_NAME,
--16 顧客_口座番号
A.CUSTOMER_ACCOUNT_NO,
--17 予定自社入金口座番号
A.SCHEDULE_WITHDRAW_ACCOUNT_NO,
--18顧客銀行区分
A.CUSTOMER_BANK_DIV,
--19 銀行名
A.BANK_NAME,
--20 対象外理由
CASE WHEN
A.WITHDRAW_STATUS = CAST(/*dto.withdrawStatus3*/ AS CHAR(1)) --引落情報VIEW.回収ステータス = 依頼中
THEN
/*dto.transferNoDataReason1*/ --既に引落依頼中
WHEN
A.WITHDRAW_STATUS = CAST(/*dto.withdrawStatus1*/ AS CHAR(1)) --引落情報VIEW.回収ステータス = 回収済
THEN
/*dto.transferNoDataReason2*/ --既に入金済
WHEN
A.ENFORCE_END_AGREEMENT_SCHEDULED_FLG = CAST(/*dto.enforceOn*/ AS CHAR(1)) --引落情報VIEW.強制解約フラグ=ON
THEN
/*dto.transferNoDataReason3*/ --強制解約予定中
WHEN
A.SCHEDULE_WITHDRAW_ACCOUNT_NO IS NULL --引落情報VIEW.自社入金口座番号=NULL
THEN
/*dto.transferNoDataReason4*/ --予定自社入金口座番号がなし
WHEN
A.CUSTOMER_ACCOUNT_NO IS NULL --引落情報VIEW.顧客_口座番号=NULL
THEN
/*dto.transferNoDataReason5*/ --顧客引落口座番号がなし
WHEN
A.CUSTOMER_BANK_DIV <> A.ACCOUNT_BANK_DIV --引落情報VIEW.自社銀行区分<>引落情報VIEW.顧客銀行区分
THEN
/*dto.transferNoDataReason6*/ --顧客引落銀行と自社入金銀行が不一致
WHEN
--引落情報VIEW.自社銀行区分<>工商銀行 and 引落情報VIEW.自社銀行区分<>農業銀行
A.ACCOUNT_BANK_DIV <> /*dto.customerBankDivGonghang*/
AND
A.ACCOUNT_BANK_DIV <> /*dto.customerBankDivNongYe*/
THEN
/*dto.transferNoDataReason7*/ --自社入金銀行は工商銀行と農業銀行ではない
ELSE
/*dto.transferNoDataReason8*/ --該当リース料の延滞利息が不要
END AS TRANSFER_NO_DATA_REASON
--zlw 2013/12/16 add start
,A.COMPANY_NAME
--zlw 2013/12/16 add end
--引落情報VIEW
FROM VIEW_WITHDRAW_DIVISION_INFO A
WHERE
--引落情報VIEW.案件番号 = 引数.案件番号
/*IF (dto.caseNo != null)*/
A.CASE_NO = CAST(/*dto.caseNo*/ AS CHAR(4)) AND
/*END*/
--引落情報VIEW.回収予定額 - 引落情報VIEW.回収実績額 > 0
(
(A.WITHDRAW_RESULT_AMOUNT IS NOT NULL AND (A.WITHDRAW_SCHEDULE_AMOUNT - A.WITHDRAW_RESULT_AMOUNT) > 0)
OR
A.WITHDRAW_RESULT_AMOUNT IS NULL
)
--IF 引数.回収予定日From <> NULL の場合
/*IF (dto.withdrawDateFromSearch != null)*/
--引落情報VIEW.回収予定日 >= 引数.回収予定日FROM
AND A.WITHDRAW_SCHEDULE_DATE >= /*dto.withdrawDateFromSearch*/
/*END*/
--IF 引数.回収予定日TO <> NULL の場合
/*IF (dto.withdrawDateToSearch != null)*/
--引落情報VIEW.回収予定日 <= 引数.回収予定日TO
AND A.WITHDRAW_SCHEDULE_DATE <= /*dto.withdrawDateToSearch*/
/*END*/
AND
(
--引落情報VIEW.回収ステータス = 依頼中
A.WITHDRAW_STATUS = CAST(/*dto.withdrawStatus3*/ AS CHAR(1))
--引落情報VIEW.回収ステータス = 回収済
OR A.WITHDRAW_STATUS = CAST(/*dto.withdrawStatus1*/ AS CHAR(1))
--引落情報VIEW.強制解約フラグ=ON
OR A.ENFORCE_END_AGREEMENT_SCHEDULED_FLG = /*dto.enforceOn*/
--引落情報VIEW.自社入金口座番号=NULL
OR A.SCHEDULE_WITHDRAW_ACCOUNT_NO IS NULL
--引落情報VIEW.顧客_口座番号=NULL
OR A.CUSTOMER_ACCOUNT_NO IS NULL
--引落情報VIEW.自社銀行区分<>引落情報VIEW.顧客銀行区分
OR A.CUSTOMER_BANK_DIV <> A.ACCOUNT_BANK_DIV
--引落情報VIEW.自社銀行区分<>工商銀行 and 引落情報VIEW.自社銀行区分<>農業銀行
OR (
A.ACCOUNT_BANK_DIV <> /*dto.customerBankDivGonghang*/
AND
A.ACCOUNT_BANK_DIV <> /*dto.customerBankDivNongYe*/
)
OR (
--引落情報VIEW.延滞利息要否 <> NULL
A.DELAYED_INTEREST_FLG IS NOT NULL AND
--引落情報VIEW.延滞利息要否 = 否
A.DELAYED_INTEREST_FLG = CAST(/*dto.delayInterestFlg*/ AS CHAR(1))
)
)
--zlw 2013/12/16 add start
/*IF (dto.branch != null)*/
AND A.CHARGE_AGENCY = CAST(/*dto.branch*/'' AS CHAR(8))
/*END*/
--zlw 2013/12/16 add end
ORDER BY
A.CUSTOMER_BANK_DIV ASC,
A.WITHDRAW_CASUS DESC,
A.WITHDRAW_SCHEDULE_DATE ASC,
A.CONTRACT_NO ASC,
A.COUPON ASC,
A.COUPON_SEQ ASC |
/* ***************************************/
/*SESSION 1 -> SESSION 2*/
/* ***************************************/
DELETE FROM `video` WHERE `session` = 2;
INSERT INTO `video` (`commentaire`,`fichier`,`id_programme`,`session`)
SELECT `commentaire`
, `fichier`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 2) as `id_programme`
, 2 as `session`
FROM `video`
WHERE SESSION = 1;
DELETE FROM `sono` WHERE `session` = 2;
INSERT INTO `sono` (`commentaire`,`fichier`,`id_programme`,`session`)
SELECT `commentaire`
, `fichier`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 2) as `id_programme`
, 2 as `session`
FROM `sono`
WHERE SESSION = 1;
DELETE FROM `estrade` WHERE `session` = 2;
INSERT INTO `estrade` (`commentaire`, `qui`, `quoi`, `quand`, `ou`,`id_programme`,`session`)
SELECT `commentaire`, `qui`, `quoi`, `quand`, `ou`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 2) as `id_programme`
, 2 as `session`
FROM `estrade`
WHERE SESSION = 1;
/* ***************************************/
/*SESSION 1 -> SESSION 3*/
/* ***************************************/
DELETE FROM `video` WHERE `session` = 3;
INSERT INTO `video` (`commentaire`,`fichier`,`id_programme`,`session`)
SELECT `commentaire`
, `fichier`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 3) as `id_programme`
, 3 as `session`
FROM `video`
WHERE SESSION = 1;
DELETE FROM `sono` WHERE `session` = 3;
INSERT INTO `sono` (`commentaire`,`fichier`,`id_programme`,`session`)
SELECT `commentaire`
, `fichier`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 3) as `id_programme`
, 3 as `session`
FROM `sono`
WHERE SESSION = 1;
DELETE FROM `estrade` WHERE `session` = 3;
INSERT INTO `estrade` (`commentaire`, `qui`, `quoi`, `quand`, `ou`,`id_programme`,`session`)
SELECT `commentaire`, `qui`, `quoi`, `quand`, `ou`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 3) as `id_programme`
, 3 as `session`
FROM `estrade`
WHERE SESSION = 1;
/* ***************************************/
/*SESSION 1 -> SESSION 5*/
/* ***************************************/
DELETE FROM `video` WHERE `session` = 5;
INSERT INTO `video` (`commentaire`,`fichier`,`id_programme`,`session`)
SELECT `commentaire`
, `fichier`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 5) as `id_programme`
, 5 as `session`
FROM `video`
WHERE SESSION = 1;
DELETE FROM `sono` WHERE `session` = 5;
INSERT INTO `sono` (`commentaire`,`fichier`,`id_programme`,`session`)
SELECT `commentaire`
, `fichier`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 5) as `id_programme`
, 5 as `session`
FROM `sono`
WHERE SESSION = 1;
DELETE FROM `estrade` WHERE `session` = 5;
INSERT INTO `estrade` (`commentaire`, `qui`, `quoi`, `quand`, `ou`,`id_programme`,`session`)
SELECT `commentaire`, `qui`, `quoi`, `quand`, `ou`
, (select cible_id_programme from v_lien_session where source_id_programme = `id_programme` and session = 5) as `id_programme`
, 5 as `session`
FROM `estrade`
WHERE SESSION = 1; |
ALTER TABLE authors ADD numericColumn NUMBER
ALTER TABLE authors MODIFY numericColumn DEFAULT 100000000 |
--ПОЛНОТЕКСТОВЫЙ ПОИСК
select * from LOTS where match (name, description) against('Gipsy');
--ПОИСК ЛОТОВ ФАБРИКИ ЛФЗ
SELECT *
FROM LOTS L
WHERE UPPER(L.DESCRIPTION) LIKE '% ЛФЗ %';
--ПОИСК СТАТУСА ПО UUID
SELECT *
FROM STATUSES
WHERE ID = 'FE0B8703C7174365B7E57C86777AFFFC';
--ПРОСМОТР СТАТУСОВ ЛОТОВ
SELECT S.NAME, L.*
FROM LOTS L LEFT JOIN STATUSES S ON L.LOT_STATUS_ID = S.ID;
--ПРОСМОТР ЛОТОВ В СТАТУСЕ READY_FOR_TRADE
SELECT L.*
FROM LOTS L LEFT JOIN STATUSES S ON L.LOT_STATUS_ID = S.ID
WHERE S.NAME = 'READY_FOR_TRADE';
--ПРОСМОТР СОБЫТИЙ В СТАТУСЕ TRADING И СВЯЗАННЫХ ЛОТОВ
SELECT E.DESCRIPTION, L.DESCRIPTION
FROM EVENTS E
JOIN LOT_TO_EVENT LE ON LE.EVENT_ID = E.ID
JOIN LOTS L ON L.ID = LE.LOT_ID
JOIN STATUSES S ON S.ID = E.EVENT_STATUS_ID
WHERE S.NAME = 'TRADING';
--самая дорогая/дешевая заявка + кол-во всего заявок на покупку лотов = где все макс цена выше 1000
select EVENT_ID, max(price) max_price , min(price) min_price, count(*) orders_qty
from ORDERS
GROUP BY EVENT_ID
HAVING max_price > 1000
;
|
/*!40101 SET NAMES binary*/;
/*!40014 SET FOREIGN_KEY_CHECKS=0*/;
CREATE TABLE `Ruta` (
`idViaPublica` int(11) NOT NULL,
`KMs` varchar(45) DEFAULT NULL,
`Territorio` varchar(45) DEFAULT NULL COMMENT 'Nacional o Provincial',
`NroRuta` int(11) DEFAULT NULL,
PRIMARY KEY (`idViaPublica`),
CONSTRAINT `FK_RutaViaPublica` FOREIGN KEY (`idViaPublica`) REFERENCES `ViaPublica` (`idViaPublica`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
-- CREATE DATABASE 5c_MulteComune;
USE 5c_MulteComune;
-- Creazione tabella Infrazione
CREATE TABLE IF NOT EXISTS Infrazione (
CodInfrazione VARCHAR(10) NOT NULL,
Data VARCHAR(30) NULL,
Importo FLOAT NULL,
CodAgente VARCHAR(10) NOT NULL,
Targa VARCHAR(10) NOT NULL,
CodAutomobilista VARCHAR(10) NOT NULL,
CodTipo VARCHAR(10) NOT NULL,
PRIMARY KEY (CodInfrazione)
);
-- Creazione tabella Automobilista
CREATE TABLE IF NOT EXISTS Automobilista (
CodAutomobilista VARCHAR(10) NOT NULL,
Nome VARCHAR(10) NULL,
Cognome VARCHAR(10) NULL,
CodiceFiscale VARCHAR(10) NULL,
Città VARCHAR(10) NULL,
PRIMARY KEY (CodAutomobilista)
);
-- Creazione tabella Agente
CREATE TABLE IF NOT EXISTS Agente (
CodAgente VARCHAR(10) NOT NULL,
Nome VARCHAR(10) NULL,
Cognome VARCHAR(10) NULL,
PRIMARY KEY (CodAgente)
);
-- Creazione tabella Tipo
CREATE TABLE IF NOT EXISTS Tipo (
CodTipo VARCHAR(10) NOT NULL,
Descrizione VARCHAR(30) NULL,
PRIMARY KEY (CodTipo)
);
-- Creazione tabella Veicolo
CREATE TABLE IF NOT EXISTS Veicolo (
Targa VARCHAR(10) NOT NULL,
Marca VARCHAR(30) NULL,
Modello VARCHAR(30) NULL,
Proprietario VARCHAR(30) NULL,
PRIMARY KEY (Targa)
);
ALTER TABLE Infrazione ADD FOREIGN KEY (CodAgente) REFERENCES Agente(CodAgente);
ALTER TABLE Infrazione ADD FOREIGN KEY (Targa) REFERENCES Veicolo(Targa);
ALTER TABLE Infrazione ADD FOREIGN KEY (CodTipo) REFERENCES Tipo(CodTipo);
ALTER TABLE Infrazione ADD FOREIGN KEY (CodAutomobilista) REFERENCES Automobilista(CodAutomobilista);
|
create table `pessoas` (
`id` int NOT NULL AUTO_INCREMENT,
`nome` varchar(30) NOT NULL,
`nascimento` date, sexo enum('M','F'),
`peso` decimal(5,2), altura decimal(3,2),
`nacionalidade` varchar(20) DEFAULT 'Brasil',
PRIMARY KEY (id)
) DEFAULT CHARSET = utf8;
|
CREATE INDEX idx_da_patient_1 ON public.da_patient USING btree (dw_last_updated_dt, dw_facility_cd);
CREATE UNIQUE INDEX uk_da_patient ON public.da_patient USING btree (dw_row_id, dw_facility_cd);
CREATE UNIQUE INDEX uk_da_patient_2 ON public.da_patient USING btree (umr_no, dw_facility_cd); |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Ven 26 Mai 2017 à 05:50
-- Version du serveur : 10.1.13-MariaDB
-- Version de PHP : 5.6.23
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `bd_tic_2017`
--
-- --------------------------------------------------------
--
-- Structure de la table `article`
--
CREATE TABLE `article` (
`code` int(11) NOT NULL,
`libelle` varchar(30) NOT NULL,
`prixbase` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `article`
--
INSERT INTO `article` (`code`, `libelle`, `prixbase`) VALUES
(36, 'Luth du Hedi Jouini', 525),
(45, 'Manuscrit d''AboulKacem Echebbi', 8520),
(120, 'Les gants du gardien Attouga', 453),
(212, 'Voiture 202 Bh', 25470);
-- --------------------------------------------------------
--
-- Structure de la table `client`
--
CREATE TABLE `client` (
`cin` varchar(8) NOT NULL,
`nom` varchar(30) NOT NULL,
`prenom` varchar(30) NOT NULL,
`tel` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `client`
--
INSERT INTO `client` (`cin`, `nom`, `prenom`, `tel`) VALUES
('07619475', 'Mani', 'Mohamed Anis', '22333444'),
('11907824', 'Ben Ahmed', 'Slim', '12345678');
-- --------------------------------------------------------
--
-- Structure de la table `offre`
--
CREATE TABLE `offre` (
`cin` varchar(8) NOT NULL,
`code` int(11) NOT NULL,
`prixpropose` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `offre`
--
INSERT INTO `offre` (`cin`, `code`, `prixpropose`) VALUES
('07619475', 36, 530),
('07619475', 120, 600),
('11907824', 36, 530);
--
-- Index pour les tables exportées
--
--
-- Index pour la table `article`
--
ALTER TABLE `article`
ADD PRIMARY KEY (`code`);
--
-- Index pour la table `client`
--
ALTER TABLE `client`
ADD PRIMARY KEY (`cin`);
--
-- Index pour la table `offre`
--
ALTER TABLE `offre`
ADD PRIMARY KEY (`cin`,`code`);
/*!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.2.11
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 27, 2015 at 07:55 AM
-- Server version: 5.6.21
-- PHP Version: 5.6.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `rpg`
--
-- --------------------------------------------------------
--
-- Table structure for table `items`
--
CREATE TABLE IF NOT EXISTS `items` (
`Name` varchar(35) NOT NULL,
`Owner` int(25) NOT NULL DEFAULT '0',
`Strength` int(15) NOT NULL DEFAULT '0',
`Constitution` int(15) NOT NULL DEFAULT '0',
`Intelligence` int(15) NOT NULL DEFAULT '0',
`ID` bigint(21) unsigned NOT NULL,
`ItemClass` varchar(45) NOT NULL DEFAULT '',
`Dexterity` int(15) unsigned NOT NULL,
`Worth` bigint(15) NOT NULL DEFAULT '0',
`Equipped` varchar(5) NOT NULL DEFAULT 'no',
`Amount` int(5) NOT NULL DEFAULT '0'
) ENGINE=MyISAM AUTO_INCREMENT=244 DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `monsters`
--
CREATE TABLE IF NOT EXISTS `monsters` (
`ID` bigint(21) NOT NULL,
`Level` bigint(15) NOT NULL DEFAULT '0',
`Name` varchar(20) NOT NULL DEFAULT '',
`Type` tinyint(2) NOT NULL DEFAULT '0',
`Spell` tinyint(2) NOT NULL DEFAULT '0'
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 PACK_KEYS=0;
--
-- Dumping data for table `monsters`
--
INSERT INTO `monsters` (`ID`, `Level`, `Name`, `Type`, `Spell`) VALUES
(1, 1, 'Bandits', 0, 0),
(2, 2, 'Mage', 1, 1),
(3, 3, 'Hiruyoki', 0, 0),
(4, 4, 'Troll', 0, 0),
(5, 5, 'Harpie', 1, 2),
(6, 6, 'Shinigami', 2, 3);
-- --------------------------------------------------------
--
-- Table structure for table `spells`
--
CREATE TABLE IF NOT EXISTS `spells` (
`Name` varchar(20) NOT NULL DEFAULT '',
`ID` tinyint(10) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=128 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `spells`
--
INSERT INTO `spells` (`Name`, `ID`) VALUES
('Water Terrain', 1),
('Wind Slasher', 2),
('Inferno Edge', 3);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`ID` bigint(21) NOT NULL,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`HP` int(15) NOT NULL,
`MaxHP` int(15) NOT NULL,
`MP` int(15) NOT NULL,
`MaxMP` int(15) NOT NULL,
`Strength` int(15) NOT NULL,
`Constitution` int(15) NOT NULL,
`Dexterity` int(15) NOT NULL,
`Intelligence` int(15) NOT NULL,
`Gold` bigint(25) NOT NULL,
`Items` tinyint(5) NOT NULL,
`Fighting` tinyint(1) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 PACK_KEYS=0;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`ID`, `firstname`, `lastname`, `email`, `username`, `password`, `HP`, `MaxHP`, `MP`, `MaxMP`, `Strength`, `Constitution`, `Dexterity`, `Intelligence`, `Gold`, `Items`, `Fighting`) VALUES
(1, 'jk', 'asentista', 'jk@gmail.com', 'jk', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', 100, 100, 70, 100, 102, 108, 106, 102, 4721, 2, 0);
-- --------------------------------------------------------
--
-- Table structure for table `userspells`
--
CREATE TABLE IF NOT EXISTS `userspells` (
`ID` int(20) NOT NULL,
`Owner` int(5) NOT NULL DEFAULT '0',
`Name` varchar(45) NOT NULL DEFAULT '',
`ManaCost` bigint(20) NOT NULL,
`Power` int(20) NOT NULL DEFAULT '0'
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `items`
--
ALTER TABLE `items`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `monsters`
--
ALTER TABLE `monsters`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `spells`
--
ALTER TABLE `spells`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `userspells`
--
ALTER TABLE `userspells`
ADD PRIMARY KEY (`ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
MODIFY `ID` bigint(21) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=244;
--
-- AUTO_INCREMENT for table `monsters`
--
ALTER TABLE `monsters`
MODIFY `ID` bigint(21) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `spells`
--
ALTER TABLE `spells`
MODIFY `ID` tinyint(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=128;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `ID` bigint(21) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `userspells`
--
ALTER TABLE `userspells`
MODIFY `ID` int(20) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=13;
/*!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 */;
|
--
-- QUAIS AS TABELAS QUE NÃO CONTEM NENHUM INDICE
--
SELECT * FROM (SELECT A.TABLE_NAME,
NVL((SELECT COUNT(*)
FROM DBA_INDEXES X WHERE X.OWNER='NETFORCE' AND A.OWNER = X.OWNER AND A.TABLE_NAME = X.TABLE_NAME
GROUP BY X.TABLE_NAME),0) QTDIND
FROM DBA_TABLES A WHERE A.OWNER='NETFORCE') WHERE QTDIND =0 ORDER BY TABLE_NAME
--
-- QUAIS AS FKS DE RERENCIA QUE EXISTE NO SISTEMA
--
SELECT a.TABLE_NAME, B.COLUMN_NAME, B.POSITION FROM DBA_CONSTRAINTS a, DBA_CONS_COLUMNS b
WHERE a.OWNER ='NETFORCE' AND a.CONSTRAINT_TYPE ='R' AND
b.owner ='NETFORCE' AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
--
-- VERIFICA QUAIS FK QUE NAO CONTEM UM INDICE PARA A REFERENCIA DA CONSULTA
--
SELECT a.TABLE_NAME, B.COLUMN_NAME, B.POSITION FROM DBA_CONSTRAINTS a, DBA_CONS_COLUMNS b
WHERE a.OWNER ='NETFORCE' AND a.CONSTRAINT_TYPE ='R' AND
b.owner ='NETFORCE' AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME AND
(SELECT COUNT(*) FROM DUAL WHERE EXISTS
(SELECT NULL FROM DBA_INDEXES X, DBA_IND_COLUMNS Y
WHERE X.OWNER='NETFORCE' AND X.TABLE_NAME =A.TABLE_NAME AND
Y.INDEX_OWNER='NETFORCE' AND Y.TABLE_NAME = X.TABLE_NAME )) = 0 |
DROP view if EXISTS public.vw_pers_staff;
DROP VIEW if EXISTS public.vw_orgeh_pers_staff;
DROP MATERIALIZED VIEW if EXISTS public.mv_staff_by_orgeh;
DROP MATERIALIZED VIEW if EXISTS public.mv_pers_by_staff;
DROP MATERIALIZED VIEW if EXISTS public.mv_orgeh_baselevel;
DROP VIEW if EXISTS public.vw_type_staff;
--drop VIEW public.vw_type_staff;
CREATE OR REPLACE VIEW public.vw_type_staff
AS SELECT '50175446'::text AS type_staff_code,
'Директор Кластера'::text AS type_staff_name,
'Директор Кластера'::text AS role_staff_name,
'DC'::text AS role_staff_abbr
UNION ALL
SELECT '52036679'::text AS type_staff_code,
'Директор Кластера'::text AS type_staff_name,
'Директор Кластера'::text AS role_staff_name,
'DC'::text AS role_staff_abbr
UNION ALL
SELECT '52036730'::text AS type_staff_code,
'РМП'::text AS type_staff_name,
'Региональный менеджер по подбору'::text AS role_staff_name,
'RMP'::text AS role_staff_abbr
UNION ALL
SELECT '51671102'::text AS type_staff_code,
'РМП РЦ'::text AS type_staff_name,
'Региональный менеджер по подбору'::text AS role_staff_name,
'RMP'::text AS role_staff_abbr
UNION ALL
SELECT '50000741'::text AS type_staff_code,
'СПВ'::text AS type_staff_name,
'Супервайзер'::text AS role_staff_name,
'SPV'::text AS role_staff_abbr
UNION ALL
SELECT '51180462'::text AS type_staff_code,
'НОО'::text AS type_staff_name,
'НОО'::text AS role_staff_name,
'NOO'::text AS role_staff_abbr
UNION ALL
SELECT '52036725'::text AS type_staff_code,
'НОО'::text AS type_staff_name,
'НОО'::text AS role_staff_name,
'NOO'::text AS role_staff_abbr
/*UNION ALL
SELECT '52036725'::text AS type_staff_code,
'НОП'::text AS type_staff_name,
'НОП'::text AS role_staff_name,
'NOP'::text AS role_staff_abbr */
UNION ALL
SELECT '50027881'::text AS type_staff_code,
'НОП'::text AS type_staff_name,
'НОП'::text AS role_staff_name,
'NOP'::text AS role_staff_abbr
UNION all
SELECT '50000583'::text AS type_staff_code,
'Заместитель директора магазина'::text AS type_staff_name,
'Директор магазина'::text AS role_staff_name,
'DSH'::text AS role_staff_abbr
UNION ALL
SELECT '50000566'::text AS type_staff_code,
' Директор Магазина'::text AS type_staff_name,
'Директор магазина'::text AS role_staff_name,
'DSH'::text AS role_staff_abbr
UNION ALL
SELECT '50000535'::text AS type_staff_code,
'Администратор'::text AS type_staff_name,
'Директор магазина'::text AS role_staff_name,
'DSH'::text AS role_staff_abbr
UNION ALL
SELECT '50616757'::text AS type_staff_code,
'Старший продавец-кассир'::text AS type_staff_name,
'Прочее'::text AS role_staff_name,
'Other'::text AS role_staff_abbr
UNION ALL
SELECT '50000682'::text AS type_staff_code,
'Продавец-кассир'::text AS type_staff_name,
'Прочее'::text AS role_staff_name,
'Other'::text AS role_staff_abbr
UNION ALL
SELECT '50000665'::text AS type_staff_code,
'Пекарь'::text AS type_staff_name,
'Прочее'::text AS role_staff_name,
'Other'::text AS role_staff_abbr
UNION ALL
SELECT '50612455'::text AS type_staff_code,
'Тренинг-менеджер на РЦ'::text AS type_staff_name,
'Прочее'::text AS role_staff_name,
'Other'::text AS role_staff_abbr;
CREATE MATERIALIZED VIEW public.mv_orgeh_baselevel
TABLESPACE pg_default
AS WITH RECURSIVE q AS (
SELECT h.id AS root_id,
1 AS lev,
h.id,
h.parentid,
h.stext,
h.typeoe,
h.addr,
CASE
WHEN CURRENT_DATE < to_date(h.begda::text, 'YYYYMMDD'::text) THEN 'BeforeRange'::text
WHEN CURRENT_DATE > to_date(h.endda::text, 'YYYYMMDD'::text) THEN 'AfterRange'::text
ELSE 'IntoRange'::text
END AS rageperiod
FROM orgeh h
WHERE (h.id::text IN ( SELECT h_1.id
FROM orgeh h_1
WHERE 1 = 1 AND h_1.typeoe::text = 'Подразделение'::text AND h_1.cfo IS NOT NULL))
UNION ALL
SELECT q.root_id,
q.lev + 1 AS lev,
hi.id,
hi.parentid,
hi.stext,
hi.typeoe,
hi.addr,
CASE
WHEN CURRENT_DATE < to_date(hi.begda::text, 'YYYYMMDD'::text) THEN 'BeforeRange'::text
WHEN CURRENT_DATE > to_date(hi.endda::text, 'YYYYMMDD'::text) THEN 'AfterRange'::text
ELSE 'IntoRange'::text
END AS rageperiod
FROM q
JOIN orgeh hi ON hi.id::text = q.parentid::text
), q_pivot AS (
SELECT q.root_id,
max(
CASE q.typeoe
WHEN 'Торговая сеть'::text THEN q.id
ELSE NULL::character varying
END::text) AS ts_id,
max(
CASE q.typeoe
WHEN 'Дивизион'::text THEN q.id
ELSE NULL::character varying
END::text) AS division_id,
max(
CASE q.typeoe
WHEN 'Дивизион'::text THEN q.rageperiod
ELSE NULL::text
END) AS division_range,
max(
CASE q.typeoe
WHEN 'МакроРегион'::text THEN q.id
ELSE NULL::character varying
END::text) AS makro_id,
max(
CASE q.typeoe
WHEN 'МакроРегион'::text THEN q.rageperiod
ELSE NULL::text
END) AS makro_range,
max(
CASE q.typeoe
WHEN 'МакроРегион'::text THEN q.stext
ELSE NULL::character varying
END::text) AS makro_name,
max(
CASE q.typeoe
WHEN 'Кластер/Регион'::text THEN q.id
ELSE NULL::character varying
END::text) AS cluster_id,
max(
CASE q.typeoe
WHEN 'Кластер/Регион'::text THEN q.rageperiod
ELSE NULL::text
END) AS cluster_range,
max(
CASE q.typeoe
WHEN 'Кластер/Регион'::text THEN q.addr
ELSE NULL::text
END) AS cluster_addr,
max(
CASE q.typeoe
WHEN 'Кластер/Регион'::text THEN q.stext::text
ELSE NULL::text
END) AS cluster_name,
max(
CASE q.typeoe
WHEN 'Подразделение'::text THEN q.id
ELSE NULL::character varying
END::text) AS dep_id,
max(
CASE q.typeoe
WHEN 'Подразделение'::text THEN q.rageperiod
ELSE NULL::text
END) AS dep_range
FROM q
WHERE q.typeoe::text = ANY (ARRAY['Торговая сеть'::character varying::text, 'Дивизион'::character varying::text, 'МакроРегион'::character varying::text, 'Кластер/Регион'::character varying::text, 'Подразделение'::character varying::text])
GROUP BY q.root_id
), q_info AS (
SELECT t1.root_id,
t1.ts_id,
t1.makro_id,
t1.makro_range,
t1.makro_name,
t1.cluster_id,
t1.cluster_range,
t1.cluster_name,
t1.cluster_addr,
t1.division_id,
t1.division_range,
t1.dep_id,
t1.dep_range,
t2.stext AS dep_name,
t2.parentid,
t2.begda,
t2.endda,
t2.typeoe,
t2.cfo,
t2.mvz,
t2.email,
t2.addr,
t2.is_archive,
t2.redun
FROM q_pivot t1,
orgeh t2
WHERE t1.dep_id = t2.id::text
)
SELECT q_info.root_id,
q_info.ts_id,
q_info.makro_id,
q_info.makro_range,
q_info.makro_name,
q_info.cluster_id,
q_info.cluster_range,
q_info.cluster_name,
q_info.cluster_addr,
q_info.dep_id,
q_info.dep_range,
q_info.dep_name,
q_info.begda,
q_info.endda,
q_info.cfo,
q_info.mvz,
q_info.email,
q_info.addr,
q_info.is_archive,
q_info.redun
FROM q_info
WITH DATA;
--drop MATERIALIZED VIEW public.mv_staff_by_orgeh
CREATE MATERIALIZED VIEW public.mv_staff_by_orgeh
TABLESPACE pg_default
AS WITH RECURSIVE staff as (select ps.type_staff_code,ps.role_staff_abbr,pl.id AS staff_id,pl.stext as staff_name,
pl.parentid AS staff_oe_id
from plans pl left join vw_type_staff ps ON ps.type_staff_code = pl.stell::text
where CURRENT_DATE >= to_date(pl.begda::text, 'YYYYMMDD'::text) AND CURRENT_DATE <= to_date(pl.endda::text, 'YYYYMMDD'::text)
and ps.role_staff_abbr in ('DC','RMP','SPV','DSH','NOO') and type_staff_code not in ('50000535')),
rmp_DrillUp(type_staff_code,role_staff_abbr,staff_id,staff_name,staff_oe_id,id,pid,typeoe) as
(select sf.type_staff_code,sf.role_staff_abbr,sf.staff_id,sf.staff_name,sf.staff_oe_id,rg.id,rg.parentid as pid,rg.typeoe
from staff sf inner join orgeh rg on (sf.staff_oe_id=rg.id and sf.role_staff_abbr in ('RMP','NOO'))
union all
select cls.type_staff_code,cls.role_staff_abbr,cls.staff_id,cls.staff_name,cls.staff_oe_id,rg.id,rg.parentid as pid,rg.typeoe
from rmp_DrillUp cls,orgeh rg
where cls.pid = rg.id),
staff_by_dep as (select type_staff_code,role_staff_abbr,staff_id,staff_name,staff_oe_id,staff_oe_id as start_oe_id
from staff
where role_staff_abbr in ('DC','DSH')
union
select type_staff_code,role_staff_abbr,staff_id,staff_name,staff_oe_id,id as start_oe_id
from rmp_DrillUp
where typeoe='Кластер/Регион'
union
select (select type_staff_code from vw_type_staff where role_staff_abbr='SPV') as type_staff_code,
(select role_staff_abbr from vw_type_staff where role_staff_abbr='SPV') as role_staff_abbr,
pr."plans" as staff_id,
(select type_staff_name from vw_type_staff where role_staff_abbr='SPV') as staff_name,
rg.id as start_oe_id,rg.id as staff_oe_id
from (select cfo,pers_id,staff_type,row_number() over (partition by cfo order by staff_type,pers_id desc) as rn_staff
from (select cfo,id as pers_id,type as staff_type--,row_number() over (partition by cfo order by type,id desc) as rn_staff
from spv
where 1=1
and CURRENT_DATE >= to_date(begda::text, 'YYYYMMDD'::text) AND CURRENT_DATE <= to_date(endda::text, 'YYYYMMDD'::text)
and is_archive = false) t1
) st left join orgeh rg on (st.cfo = rg.cfo)
left join pernr pr on (st.pers_id=pr.id)
where st.rn_staff =1
),
t_common(type_staff_code,role_staff_abbr,staff_id,staff_name,staff_oe_id, oe_id, oe_pid, oe_type, gen, deprageperiod) AS
(select stf.type_staff_code,stf.role_staff_abbr,stf.staff_id,stf.staff_name,stf.staff_oe_id,
org.id AS oe_id,org.parentid AS oe_pid,org.typeoe AS oe_type,1 AS gen,
case when CURRENT_DATE < to_date(org.begda::text, 'YYYYMMDD'::text) THEN 'BeforeRange'::text
when CURRENT_DATE > to_date(org.endda::text, 'YYYYMMDD'::text) THEN 'AfterRange'::text
else 'IntoRange'::text
end as deprageperiod
from staff_by_dep stf left join orgeh org ON stf.start_oe_id::text = org.id::text
union all
select pr.type_staff_code,pr.role_staff_abbr,pr.staff_id,pr.staff_name,pr.staff_oe_id,
hi.id AS oe_id,
hi.parentid AS oe_pid,
hi.typeoe AS oe_type,
pr.gen + 1 AS gen,
case when CURRENT_DATE < to_date(hi.begda::text, 'YYYYMMDD'::text) THEN 'BeforeRange'::text
when CURRENT_DATE > to_date(hi.endda::text, 'YYYYMMDD'::text) THEN 'AfterRange'::text
else 'IntoRange'::text
end as deprageperiod
FROM t_common pr, orgeh hi
WHERE pr.oe_id::text = hi.parentid::text)
SELECT type_staff_code,role_staff_abbr,staff_id,staff_name,staff_oe_id,oe_id as dep_oe_id,deprageperiod
FROM t_common
WHERE t_common.oe_type::text = 'Подразделение'::text;
CREATE MATERIALIZED VIEW public.mv_pers_by_staff
TABLESPACE pg_default
AS WITH staff AS (select ps.type_staff_code,ps.role_staff_abbr,ps.role_staff_name,
pl.id AS staff_id,pl.stext as staff_name,
pl.parentid AS staff_oe_id,rg.email as email_oe
FROM plans pl left join vw_type_staff ps ON ps.type_staff_code = pl.stell::text
left join orgeh rg on (pl.parentid = rg.id )
WHERE CURRENT_DATE >= to_date(pl.begda::text, 'YYYYMMDD'::text) AND CURRENT_DATE <= to_date(pl.endda::text, 'YYYYMMDD'::text)
AND ps.role_staff_abbr in ('DC','RMP','SPV','DSH','NOO')
and pl.is_archive = false and trim(pl.redun) = ''),
pers AS (SELECT staff_id,pers_id,fio,usrid,email_ps,cell,gbdat,rn_pers
FROM ( SELECT pr1.plans as staff_id, pr1.id as pers_id, pr2.fio, pr2.usrid, pr2.email as email_ps, pr2.cell, pr2.gbdat,
row_number() over (partition by pr1.plans order by pr1.id desc) as rn_pers,
count(1) OVER (PARTITION BY pr2.usrid) AS dbl_usrid
FROM pernr pr1 inner join pernr pr2 on (pr1.hpern=pr2.id)
WHERE pr2.usrid is not null and (pr1.is_archive and pr2.is_archive)=false) t
WHERE t.dbl_usrid = 1 and rn_pers=1),
pers_by_staff AS (SELECT st.type_staff_code,st.role_staff_abbr,st.role_staff_name,st.staff_id,st.staff_name,st.staff_oe_id,
ps.pers_id,ps.fio,ps.usrid,ps.cell,ps.gbdat,ps.rn_pers,
case when st.role_staff_abbr='DSH' then st.email_oe else ps.email_ps end as email
FROM pers ps,staff st
WHERE ps.staff_id::text = st.staff_id::text)
select type_staff_code,role_staff_abbr,role_staff_name,staff_id,staff_name,staff_oe_id,
pers_id,fio,usrid,email,cell,gbdat,rn_pers
FROM pers_by_staff
WITH DATA;
CREATE OR REPLACE VIEW public.vw_orgeh_pers_staff
as select mob.cfo AS id,
'Розница' as type_dep,
mob.dep_name AS "Name",
mob.addr AS address,
mob.makro_name,
mob.cluster_name,
mob.cluster_addr,
'' as division_name,
rmp.fio as rmp_fio,
rmp.cell as rmp_phone,
rmp.email as rmp_email,
dc.fio as clusterdirectorfio,
dc.cell as clusterdirectorphone,
dc.email as clusterdirectoremail,
dsh.fio as dshop_fio,
dsh.cell as dshop_phone,
dsh.email as dshop_email,
noo.email as noo_email,
spv.fio as spv_fio,
spv.cell as spv_phone,
spv.email as spv_email,
mob.dep_id as sapid,
mob.cfo as cfoid,
mob.begda AS openingdate,
mob.is_archive AS isarchived
FROM mv_orgeh_baselevel mob
LEFT JOIN (SELECT so.dep_oe_id AS dep_id,mp_1.fio,mp_1.cell,mp_1.email
FROM mv_staff_by_orgeh so,mv_pers_by_staff mp_1
WHERE so.staff_id::text = mp_1.staff_id::text
AND so.role_staff_abbr::text = 'RMP'
AND mp_1.rn_pers = 1) rmp ON (mob.dep_id = rmp.dep_id::text)
LEFT JOIN (SELECT so.dep_oe_id AS dep_id,mp_1.fio,mp_1.cell,mp_1.email
FROM mv_staff_by_orgeh so,mv_pers_by_staff mp_1
WHERE so.staff_id::text = mp_1.staff_id::text
AND so.role_staff_abbr::text = 'DSH' and so.type_staff_code = '50000566'
AND mp_1.rn_pers = 1) dsh ON (mob.dep_id = dsh.dep_id::text)
LEFT JOIN (SELECT so.dep_oe_id AS dep_id,mp_1.fio,mp_1.cell,mp_1.email
FROM mv_staff_by_orgeh so,mv_pers_by_staff mp_1
WHERE so.staff_id::text = mp_1.staff_id::text
AND so.role_staff_abbr::text = 'NOO'
AND mp_1.rn_pers = 1) noo ON (mob.dep_id = noo.dep_id::text)
LEFT JOIN (SELECT so.dep_oe_id AS dep_id,mp_1.fio,mp_1.cell,mp_1.email
FROM mv_staff_by_orgeh so,mv_pers_by_staff mp_1
WHERE so.staff_id::text = mp_1.staff_id::text
AND so.role_staff_abbr::text = 'SPV'
AND mp_1.rn_pers = 1) spv ON (mob.dep_id = spv.dep_id::text)
LEFT JOIN (SELECT so.dep_oe_id AS dep_id,mp_1.fio,mp_1.cell,mp_1.email
FROM mv_staff_by_orgeh so,mv_pers_by_staff mp_1
WHERE so.staff_id::text = mp_1.staff_id::text
AND so.role_staff_abbr::text = 'DC'
AND mp_1.rn_pers = 1) dc ON (mob.dep_id = dc.dep_id::text)
WHERE btrim(mob.redun::text) = ''::text
-- and mob.cfo in ('E1031899', 'E1029273', 'E1012029', 'E1012102', 'E1025998')
;
CREATE OR REPLACE VIEW public.vw_pers_staff
AS SELECT t3.usrid AS login,
(regexp_split_to_array(t3.fio::text, '\s+'::text))[2] AS FirstName,
(regexp_split_to_array(t3.fio::text, '\s+'::text))[1] AS MiddleName,
(regexp_split_to_array(t3.fio::text, '\s+'::text))[3] AS LastName,
t3.email,
t3.cell,
t3.staff_name,
0 AS vers,
false AS isarchived,
t3.role_staff_name,
t3.role_staff_abbr
FROM mv_pers_by_staff t3
WHERE 1=1
--and t3.role_staff_abbr::text = 'DC'::text
and staff_id in (select staff_id
from mv_staff_by_orgeh msbo
where dep_oe_id in (select dep_id
from mv_orgeh_baselevel mob
where cluster_id in ('52903424','52905250','52905351','52905525','52905674','52905767','52906101','52903295','52903526','52903665')))
;
refresh MATERIALIZED VIEW mv_orgeh_baselevel;
refresh MATERIALIZED VIEW mv_pers_by_staff;
refresh MATERIALIZED VIEW mv_staff_by_orgeh;
select cfoid as id, "Name", rmp_fio as "ResponsibleId", rmp_phone as "Contacts", address as "Address",
address as "ExtraData.InterviewAddress",
dshop_fio as "ExtraData.DMFio",
dshop_email as "ExtraData.DMEmail",
dshop_phone as "ExtraData.DMPhone",
rmp_email as "ExtraData.RMPEmail",
noo_email as "ExtraData.NOOEmail",
type_dep as "ExtraData.OrgUnitType",
cluster_addr as "ExtraData.RegionalOffice",
makro_name as "ExtraData.Macroregion",
null as "ExtraData.Division",
cluster_name as "ExtraData.Cluster",
sapid as "ExtraData.SAPId",
cfoid as "ExtraData.CFOId",
to_date(openingdate,'YYYYMMDD') as "ExtraData.OpeningDate",
false as "IsArchived",
spv_fio as "ExtraData.SupervisorFio",
spv_email as "ExtraData.SupervisorEmail",
clusterdirectorfio as "ExtraData.ClusterDirectorFio",
clusterdirectorphone as "ExtraData.ClusterDirectorPhone",
clusterdirectoremail as "ExtraData.ClusterDirectorEmail"
from vw_orgeh_pers_staff vops
where cfoid in ('E1031899', 'E1029273', 'E1012029', 'E1012102', 'E1025998','E1011888')
order by "Name";
select login as "Login",
firstname as "FirstName",
middlename as "MiddleName",
lastname as "LastName",
email as "Email",
cell as "PhoneNumber",
staff_name as "Position",
vers as "Version",
isarchived as "IsArchived",
role_staff_name as "Role"
from vw_pers_staff;
|
# Write your MySQL query statement below
# Find the account_id of the accounts that should be banned from Leetflex. An account should be banned if it was logged in at some moment from two different IP addresses.
## Use self join to find pairs where second login is before first logout and the ip_address are different
SELECT DISTINCT L1.account_id
FROM LogInfo L1
JOIN LogInfo L2 ON L1.account_id = L2.account_id AND L1.ip_address != L2.ip_address AND L1.logout >= L2.login AND L1.login <= L2.login
|
CREATE TABLE [cpr].[criterios_corte_planeacion_ruta] (
[id_criterio_corte_planeacion_ruta] INT IDENTITY (1, 1) NOT NULL,
[activo] BIT NOT NULL,
[fecha_actualizacion] DATETIME2 (0) NOT NULL,
[nombre] VARCHAR (100) NOT NULL,
[usuario_actualizacion] VARCHAR (50) NOT NULL,
[id_centro_planeacion_ruta] INT NOT NULL,
CONSTRAINT [PK_criterios_corte_planeacion_ruta] PRIMARY KEY CLUSTERED ([id_criterio_corte_planeacion_ruta] ASC) WITH (FILLFACTOR = 80),
CONSTRAINT [FK_criterios_corte_planeacion_ruta_01] FOREIGN KEY ([id_centro_planeacion_ruta]) REFERENCES [cpr].[centros_planeacion_ruta] ([id_centro_planeacion_ruta]),
CONSTRAINT [UK_criterios_corte_planeacion_ruta_01] UNIQUE NONCLUSTERED ([id_centro_planeacion_ruta] ASC) WITH (FILLFACTOR = 80),
CONSTRAINT [UK_criterios_corte_planeacion_ruta_02] UNIQUE NONCLUSTERED ([nombre] ASC) WITH (FILLFACTOR = 80)
);
|
ALTER TABLE `mine coal site production` DROP COLUMN `CURR_MINE_NM`;
ALTER TABLE `mine coal site production` DROP COLUMN `STATE`;
ALTER TABLE `mine coal site production` DROP COLUMN `SUBUNIT_CD`;
ALTER TABLE `mine coal site production` DROP COLUMN `CAL_QTR`;
ALTER TABLE `mine coal site production` DROP COLUMN `FISCAL_YR`;
ALTER TABLE `mine coal site production` DROP COLUMN `FISCAL_QTR`;
ALTER TABLE `mine coal site production` DROP COLUMN `COAL_METAL_IND`;
ALTER TABLE `mine injury illness` DROP COLUMN `Mine Name`;
ALTER TABLE `mine injury illness` DROP COLUMN `Operator Name (Violations)`;
ALTER TABLE `mine injury illness` DROP COLUMN `Controller Name @ Violations`;
ALTER TABLE `mine injury illness` DROP COLUMN `Contractor Name`;
ALTER TABLE `mine injury illness` DROP COLUMN `State Abbreviation`;
ALTER TABLE `mine injury illness` DROP COLUMN `Termination Date`;
ALTER TABLE `mine location` DROP COLUMN `MINE_NAME`;
ALTER TABLE `mine location` DROP COLUMN `STATE_ABBR`;
ALTER TABLE `mine location` DROP COLUMN `FIPS_STATE_CD`;
ALTER TABLE `mine location` DROP COLUMN `ZIP_CD`;
ALTER TABLE `mine location` DROP COLUMN `PROVINCE`;
ALTER TABLE `mine location` DROP COLUMN `POSTAL_CD`;
ALTER TABLE `mine location` DROP COLUMN `MINE_TYPE_CD`;
ALTER TABLE `mine location` DROP COLUMN `PRIMARY_SIC_CD`;
ALTER TABLE `mine location` DROP COLUMN `COAL_METAL_IND`;
ALTER TABLE `mine operator` DROP COLUMN `COAL_METAL_IND`;
ALTER TABLE `mine operator` DROP COLUMN `CONTROLLER_NAME`;
ALTER TABLE `mine operator` DROP COLUMN `MINE_NAME`;
ALTER TABLE `mine operator` DROP COLUMN `OPERATOR_ID`;
ALTER TABLE `mine operator` DROP COLUMN `OPERATOR_NAME`;
ALTER TABLE `mine site` DROP COLUMN `FIPS_CNTY_CD`;
ALTER TABLE `mine site` DROP COLUMN `MINE_GAS_CATEGORY_CD`;
ALTER TABLE `mine site` DROP COLUMN `NEAREST_TOWN`;
ALTER TABLE `mine site` DROP COLUMN `OFFICE_CD`;
ALTER TABLE `mine site` DROP COLUMN `PRIMARY_CANVASS_CD`;
ALTER TABLE `mine site` DROP COLUMN `PRIMARY_SIC_CD`;
ALTER TABLE `mine site` DROP COLUMN `PRIMARY_SIC_CD_1`;
ALTER TABLE `mine site` DROP COLUMN `PRIMARY_SIC_CD_SFX`;
ALTER TABLE `mine site` DROP COLUMN `SECONDARY_CANVASS`;
ALTER TABLE `mine site` DROP COLUMN `SECONDARY_CANVASS_CD`;
ALTER TABLE `mine site` DROP COLUMN `SECONDARY_SIC`;
ALTER TABLE `mine site` DROP COLUMN `SECONDARY_SIC_CD`;
ALTER TABLE `mine site` DROP COLUMN `SECONDARY_SIC_CD_1`;
ALTER TABLE `mine site` DROP COLUMN `SECONDARY_SIC_CD_SFX`;
|
CREATE DATABASE IF NOT EXISTS `library` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `library`;
-- MySQL dump 10.13 Distrib 8.0.21, for Win64 (x86_64)
--
-- Host: localhost Database: library
-- ------------------------------------------------------
-- Server version 8.0.21
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `tbl_allfloor_misplacedbookdata_slsms`
--
DROP TABLE IF EXISTS `tbl_allfloor_misplacedbookdata_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_allfloor_misplacedbookdata_slsms` (
`Sr_no` int NOT NULL AUTO_INCREMENT,
`floorid` tinyint NOT NULL,
`shelf_id` varchar(4) NOT NULL,
`shelf_tier_id` varchar(6) NOT NULL,
`bookid` varchar(4) NOT NULL,
`Timestamp` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`Sr_no`,`floorid`,`shelf_tier_id`,`bookid`,`shelf_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_allfloor_misplacedbookdata_slsms`
--
LOCK TABLES `tbl_allfloor_misplacedbookdata_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_allfloor_misplacedbookdata_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_allfloor_misplacedbookdata_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_bookconfigration_slsms`
--
DROP TABLE IF EXISTS `tbl_bookconfigration_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_bookconfigration_slsms` (
`book_lib_id` varchar(4) NOT NULL,
`Book_id` varchar(5) NOT NULL,
PRIMARY KEY (`book_lib_id`,`Book_id`),
CONSTRAINT `fk_bookinfo_bookconfiguration` FOREIGN KEY (`book_lib_id`) REFERENCES `tbl_bookinfo_master_slsms` (`Book_lib_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_bookconfigration_slsms`
--
LOCK TABLES `tbl_bookconfigration_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_bookconfigration_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_bookconfigration_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_bookinfo_master_slsms`
--
DROP TABLE IF EXISTS `tbl_bookinfo_master_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_bookinfo_master_slsms` (
`Book_lib_id` varchar(4) NOT NULL,
`book_sub_section_id` tinyint NOT NULL,
`book_title` varchar(256) DEFAULT NULL,
`book_author` varchar(256) DEFAULT NULL,
`book_publication` varchar(256) DEFAULT NULL,
`book_ISBN_13` char(17) NOT NULL,
`book_language` varchar(20) DEFAULT NULL,
`book_paperback` smallint DEFAULT NULL,
`book_dimension` varchar(25) DEFAULT NULL,
`TimeStamp` datetime DEFAULT NULL,
`userinfo` varchar(256) DEFAULT NULL,
PRIMARY KEY (`Book_lib_id`,`book_sub_section_id`),
UNIQUE KEY `book_ISBN_13_UNIQUE` (`book_ISBN_13`),
KEY `fk_shelfsubsection_bookinfo_slsms_idx` (`book_sub_section_id`),
CONSTRAINT `fk_shelfsubsection_bookinfo_slsms` FOREIGN KEY (`book_sub_section_id`) REFERENCES `tbl_shelfsubsection_slsms` (`sub_section_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_bookinfo_master_slsms`
--
LOCK TABLES `tbl_bookinfo_master_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_bookinfo_master_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_bookinfo_master_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_categorywise_arrngement_onfloor_slsms`
--
DROP TABLE IF EXISTS `tbl_categorywise_arrngement_onfloor_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_categorywise_arrngement_onfloor_slsms` (
`floor_id` tinyint NOT NULL,
`sub_section_id` tinyint NOT NULL,
`No_of_allowed_shelves` tinyint DEFAULT NULL,
PRIMARY KEY (`floor_id`,`sub_section_id`),
KEY `tbl_categorywise_arrngement_onfloor_slsms_ibfk_2` (`sub_section_id`),
CONSTRAINT `tbl_categorywise_arrngement_onfloor_slsms_ibfk_1` FOREIGN KEY (`floor_id`) REFERENCES `tbl_floorinfo_master_slsms` (`floor_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `tbl_categorywise_arrngement_onfloor_slsms_ibfk_2` FOREIGN KEY (`sub_section_id`) REFERENCES `tbl_shelfsubsection_slsms` (`sub_section_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_categorywise_arrngement_onfloor_slsms`
--
LOCK TABLES `tbl_categorywise_arrngement_onfloor_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_categorywise_arrngement_onfloor_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_categorywise_arrngement_onfloor_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_configuredbookreport_slsms`
--
DROP TABLE IF EXISTS `tbl_configuredbookreport_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_configuredbookreport_slsms` (
`Bookid` varchar(4) NOT NULL,
`Timestamp` datetime NOT NULL,
`flag` tinyint DEFAULT NULL,
PRIMARY KEY (`Bookid`),
CONSTRAINT `fk_tbl_bookinfo_tbl_configuredbookreport` FOREIGN KEY (`Bookid`) REFERENCES `tbl_bookinfo_master_slsms` (`Book_lib_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_configuredbookreport_slsms`
--
LOCK TABLES `tbl_configuredbookreport_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_configuredbookreport_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_configuredbookreport_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_coursedetails_slsms`
--
DROP TABLE IF EXISTS `tbl_coursedetails_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_coursedetails_slsms` (
`course_id` varchar(256) NOT NULL,
`institute_id` varchar(256) DEFAULT NULL,
`course_name` varchar(256) DEFAULT NULL,
PRIMARY KEY (`course_id`),
KEY `tbl_coursedetails_slsms_ibfk_1` (`institute_id`),
CONSTRAINT `tbl_coursedetails_slsms_ibfk_1` FOREIGN KEY (`institute_id`) REFERENCES `tbl_instituteinfo_master_slsms` (`institute_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_coursedetails_slsms`
--
LOCK TABLES `tbl_coursedetails_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_coursedetails_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_coursedetails_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_extraallbookslots_slsms`
--
DROP TABLE IF EXISTS `tbl_extraallbookslots_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_extraallbookslots_slsms` (
`Book_lib_id` varchar(4) NOT NULL,
`book_quantity` smallint DEFAULT NULL,
`start_bookid_range` varchar(5) DEFAULT NULL,
`end_bookid_range` varchar(5) DEFAULT NULL,
PRIMARY KEY (`Book_lib_id`),
CONSTRAINT `fk_bookconfiguration_extrabookslots` FOREIGN KEY (`Book_lib_id`) REFERENCES `tbl_bookconfigration_slsms` (`book_lib_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_extraallbookslots_slsms`
--
LOCK TABLES `tbl_extraallbookslots_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_extraallbookslots_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_extraallbookslots_slsms` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `tbl_extraallbookslots_slsms_AFTER_UPDATE` AFTER UPDATE ON `tbl_extraallbookslots_slsms` FOR EACH ROW BEGIN
if(!NEW.book_quantity <> OLD.book_quantity) then
insert into tbl_configuredbookreport_slsms values(OLD.Book_lib_id,now(),2) on duplicate key update Timestamp=now(),flag=2;
end if;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `tbl_facultyinfo_master_slsms`
--
DROP TABLE IF EXISTS `tbl_facultyinfo_master_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_facultyinfo_master_slsms` (
`enrollment_no` varchar(256) NOT NULL,
`course_id` varchar(256) DEFAULT NULL,
`faculty_name` varchar(256) DEFAULT NULL,
`faculty_birthdate` date DEFAULT NULL,
`faculty_password` varchar(256) DEFAULT NULL,
PRIMARY KEY (`enrollment_no`),
KEY `tbl_facultyinfo_master_slsms_ibfk_1` (`course_id`),
CONSTRAINT `tbl_facultyinfo_master_slsms_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `tbl_coursedetails_slsms` (`course_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_facultyinfo_master_slsms`
--
LOCK TABLES `tbl_facultyinfo_master_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_facultyinfo_master_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_facultyinfo_master_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_facultyregistered_slsms`
--
DROP TABLE IF EXISTS `tbl_facultyregistered_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_facultyregistered_slsms` (
`enrollment_no` varchar(256) NOT NULL,
`faculty_email` varchar(256) DEFAULT NULL,
`faculty_phone_number` char(14) DEFAULT NULL,
PRIMARY KEY (`enrollment_no`),
CONSTRAINT `tbl_facultyregistered_slsms_ibfk_1` FOREIGN KEY (`enrollment_no`) REFERENCES `tbl_facultyinfo_master_slsms` (`enrollment_no`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_facultyregistered_slsms`
--
LOCK TABLES `tbl_facultyregistered_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_facultyregistered_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_facultyregistered_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_floorinfo_master_slsms`
--
DROP TABLE IF EXISTS `tbl_floorinfo_master_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_floorinfo_master_slsms` (
`floor_id` tinyint NOT NULL AUTO_INCREMENT,
`max_allowed_shelve` tinyint NOT NULL,
`main_section_id` tinyint NOT NULL,
PRIMARY KEY (`floor_id`,`main_section_id`),
KEY `fk_shelfmainsection_floorinfo_idx` (`main_section_id`),
CONSTRAINT `tbl_floorinfo_master_slsms_ibfk_1` FOREIGN KEY (`main_section_id`) REFERENCES `tbl_shelfmainsection_master_slsms` (`main_section_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_floorinfo_master_slsms`
--
LOCK TABLES `tbl_floorinfo_master_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_floorinfo_master_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_floorinfo_master_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_instituteinfo_master_slsms`
--
DROP TABLE IF EXISTS `tbl_instituteinfo_master_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_instituteinfo_master_slsms` (
`institute_id` varchar(256) NOT NULL,
`institute_name` varchar(256) DEFAULT NULL,
PRIMARY KEY (`institute_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_instituteinfo_master_slsms`
--
LOCK TABLES `tbl_instituteinfo_master_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_instituteinfo_master_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_instituteinfo_master_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_nativeuserinfo_master_slsms`
--
DROP TABLE IF EXISTS `tbl_nativeuserinfo_master_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_nativeuserinfo_master_slsms` (
`name` varchar(50) CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL,
`username` varchar(256) NOT NULL,
`pass` text CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
`u_role` varchar(13) NOT NULL,
`email_id` varchar(256) CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL,
`last_login` timestamp NULL DEFAULT NULL,
`last_logout` timestamp NULL DEFAULT NULL,
`status` bit(1) DEFAULT NULL,
PRIMARY KEY (`username`),
UNIQUE KEY `email_id_UNIQUE` (`email_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_nativeuserinfo_master_slsms`
--
LOCK TABLES `tbl_nativeuserinfo_master_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_nativeuserinfo_master_slsms` DISABLE KEYS */;
INSERT INTO `tbl_nativeuserinfo_master_slsms` VALUES ('Admin','Admin','Admin','Administrator',NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `tbl_nativeuserinfo_master_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_notassignedbookslots_slsms`
--
DROP TABLE IF EXISTS `tbl_notassignedbookslots_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_notassignedbookslots_slsms` (
`Book_lib_id` varchar(4) NOT NULL,
`book_quantity` smallint DEFAULT NULL,
`start_bookid_range` varchar(5) DEFAULT NULL,
`end_bookid_range` varchar(5) DEFAULT NULL,
PRIMARY KEY (`Book_lib_id`),
CONSTRAINT `fk_bookconfig_notassignedbook_slsms` FOREIGN KEY (`Book_lib_id`) REFERENCES `tbl_bookconfigration_slsms` (`book_lib_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_notassignedbookslots_slsms`
--
LOCK TABLES `tbl_notassignedbookslots_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_notassignedbookslots_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_notassignedbookslots_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_rfid_reader_configuration_slsms`
--
DROP TABLE IF EXISTS `tbl_rfid_reader_configuration_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_rfid_reader_configuration_slsms` (
`rfid_reader_uid` varchar(10) NOT NULL,
`universal_product_code` bigint NOT NULL,
PRIMARY KEY (`rfid_reader_uid`),
UNIQUE KEY `universal_product_code_UNIQUE` (`universal_product_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_rfid_reader_configuration_slsms`
--
LOCK TABLES `tbl_rfid_reader_configuration_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_rfid_reader_configuration_slsms` DISABLE KEYS */;
INSERT INTO `tbl_rfid_reader_configuration_slsms` VALUES ('Reader_1',123456789012);
/*!40000 ALTER TABLE `tbl_rfid_reader_configuration_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_shelfinfo_slsms`
--
DROP TABLE IF EXISTS `tbl_shelfinfo_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_shelfinfo_slsms` (
`shelf_id` char(4) NOT NULL,
`no_of_tiers` tinyint DEFAULT NULL,
`floor_id` tinyint NOT NULL,
`sub_section_id` tinyint NOT NULL,
PRIMARY KEY (`shelf_id`,`floor_id`,`sub_section_id`),
KEY `tbl_shelfinfo_slsms_ibfk_1` (`floor_id`),
KEY `tbl_shelfinfo_slsms_ibfk_2` (`sub_section_id`),
CONSTRAINT `tbl_shelfinfo_slsms_ibfk_1` FOREIGN KEY (`floor_id`) REFERENCES `tbl_floorinfo_master_slsms` (`floor_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `tbl_shelfinfo_slsms_ibfk_2` FOREIGN KEY (`sub_section_id`) REFERENCES `tbl_shelfsubsection_slsms` (`sub_section_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_shelfinfo_slsms`
--
LOCK TABLES `tbl_shelfinfo_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_shelfinfo_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_shelfinfo_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_shelfmainsection_master_slsms`
--
DROP TABLE IF EXISTS `tbl_shelfmainsection_master_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_shelfmainsection_master_slsms` (
`main_section_id` tinyint NOT NULL AUTO_INCREMENT,
`main_section_type` varchar(256) DEFAULT NULL,
PRIMARY KEY (`main_section_id`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_shelfmainsection_master_slsms`
--
LOCK TABLES `tbl_shelfmainsection_master_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_shelfmainsection_master_slsms` DISABLE KEYS */;
INSERT INTO `tbl_shelfmainsection_master_slsms` VALUES (1,'Fiction'),(2,'Non-Fiction');
/*!40000 ALTER TABLE `tbl_shelfmainsection_master_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_shelfsubsection_slsms`
--
DROP TABLE IF EXISTS `tbl_shelfsubsection_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_shelfsubsection_slsms` (
`sub_section_id` tinyint NOT NULL,
`main_section_id` tinyint NOT NULL,
`sub_section_type` varchar(256) DEFAULT NULL,
PRIMARY KEY (`sub_section_id`,`main_section_id`),
KEY `tbl_shelfsubsection_slsms_ibfk_1` (`main_section_id`),
CONSTRAINT `tbl_shelfsubsection_slsms_ibfk_1` FOREIGN KEY (`main_section_id`) REFERENCES `tbl_shelfmainsection_master_slsms` (`main_section_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_shelfsubsection_slsms`
--
LOCK TABLES `tbl_shelfsubsection_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_shelfsubsection_slsms` DISABLE KEYS */;
INSERT INTO `tbl_shelfsubsection_slsms` VALUES (101,1,'Action and adventure'),(102,1,'Alternate history '),(103,1,'Anthology '),(104,1,'Chick lit '),(105,1,'Children\'s '),(106,1,'Comic book '),(107,1,'Coming-of-age '),(108,1,'Crime '),(109,1,'Drama '),(110,1,'Fairytale '),(111,2,'Programming Language'),(112,2,'Autobiography '),(113,2,'Biography '),(114,2,'Book review '),(115,2,'Cookbook '),(116,2,'Encyclopedia '),(117,2,'Textbook '),(118,2,'Travel '),(119,2,'Science '),(120,2,'History ');
/*!40000 ALTER TABLE `tbl_shelfsubsection_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_shelftierconfiguration_slsms`
--
DROP TABLE IF EXISTS `tbl_shelftierconfiguration_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_shelftierconfiguration_slsms` (
`shelf_id` char(4) NOT NULL,
`shelf_tier_id` varchar(6) NOT NULL,
`book_lib_id` varchar(4) DEFAULT NULL,
`max_allowed_book` tinyint DEFAULT NULL,
`present_book` tinyint DEFAULT NULL,
`start_bookid_range` varchar(5) DEFAULT NULL,
`end_bookid_range` varchar(5) DEFAULT NULL,
`rfid_reader_Uid` varchar(10) DEFAULT NULL,
PRIMARY KEY (`shelf_id`,`shelf_tier_id`),
KEY `fk_reader_idx` (`rfid_reader_Uid`),
CONSTRAINT `fk_reader` FOREIGN KEY (`rfid_reader_Uid`) REFERENCES `tbl_rfid_reader_configuration_slsms` (`rfid_reader_uid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_shelfinfo_shelftierconfiguration` FOREIGN KEY (`shelf_id`) REFERENCES `tbl_shelfinfo_slsms` (`shelf_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_shelftierconfiguration_slsms`
--
LOCK TABLES `tbl_shelftierconfiguration_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_shelftierconfiguration_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_shelftierconfiguration_slsms` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `tbl_shelftierconfiguration_slsms_AFTER_UPDATE` AFTER UPDATE ON `tbl_shelftierconfiguration_slsms` FOR EACH ROW BEGIN
if(!NEW.book_lib_id <> OLD.book_lib_id) then
insert into tbl_configuredbookreport_slsms values(OLD.book_lib_id,now(),1) on duplicate key update Timestamp=now(),flag=1;
end if;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `tbl_studentinfo_master_slsms`
--
DROP TABLE IF EXISTS `tbl_studentinfo_master_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_studentinfo_master_slsms` (
`enrollment_no` char(15) NOT NULL,
`course_id` varchar(256) DEFAULT NULL,
`student_name` varchar(256) DEFAULT NULL,
`student_birthdate` date DEFAULT NULL,
`student_password` varchar(256) DEFAULT NULL,
PRIMARY KEY (`enrollment_no`),
KEY `tbl_studentinfo_master_slsms_ibfk_1` (`course_id`),
CONSTRAINT `tbl_studentinfo_master_slsms_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `tbl_coursedetails_slsms` (`course_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_studentinfo_master_slsms`
--
LOCK TABLES `tbl_studentinfo_master_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_studentinfo_master_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_studentinfo_master_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tbl_studentregistered_slsms`
--
DROP TABLE IF EXISTS `tbl_studentregistered_slsms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbl_studentregistered_slsms` (
`enrollment_no` char(15) NOT NULL,
`student_email` varchar(256) DEFAULT NULL,
`student_phone_number` char(14) DEFAULT NULL,
PRIMARY KEY (`enrollment_no`),
CONSTRAINT `tbl_studentregistered_slsms_ibfk_1` FOREIGN KEY (`enrollment_no`) REFERENCES `tbl_studentinfo_master_slsms` (`enrollment_no`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_studentregistered_slsms`
--
LOCK TABLES `tbl_studentregistered_slsms` WRITE;
/*!40000 ALTER TABLE `tbl_studentregistered_slsms` DISABLE KEYS */;
/*!40000 ALTER TABLE `tbl_studentregistered_slsms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping events for database 'library'
--
--
-- Dumping routines for database 'library'
--
/*!50003 DROP PROCEDURE IF EXISTS `pro_addLibrarian_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_addLibrarian_slsms`(lib_name varchar(256),emailid varchar(256),pass varchar(10),username varchar(256))
BEGIN
insert into tbl_nativeuserinfo_master_slsms(name,username,pass,u_role,email_id,status) values (lib_name,username,sha2(pass,512),"Librarian",emailid,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 `pro_addrfidreader_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_addrfidreader_slsms`(upc bigint)
BEGIN
declare shelftierid varchar(6) default null;
declare booklibid varchar(4) default null;
declare startbookidrange varchar(5) default null;
declare endbookidrange varchar(5) default null;
declare floorid tinyint default 0;
declare shelfid varchar(4) default 0;
declare lastreaderuid varchar(10);
/*generate uid for reader*/
select rfid_reader_uid into lastreaderuid from tbl_rfid_reader_configuration_slsms order by rfid_reader_uid desc limit 1;
if lastreaderuid is not null then
set lastreaderuid=concat("Reader_",(substr(lastreaderuid,8)+1));
else
set lastreaderuid="Reader_1";
end if;
/* inserting data into reader table*/
insert into tbl_rfid_reader_configuration_slsms values(lastreaderuid,upc);
/*check inserted sucessfull if yes then assigend reader uid on tier of shelf */
if row_count() > 0 then
select tbl_shelftierconfiguration_slsms.shelf_id,shelf_tier_id,floor_id,book_lib_id,start_bookid_range,end_bookid_range into shelfid,shelftierid,floorid,booklibid,startbookidrange,endbookidrange from tbl_shelftierconfiguration_slsms,tbl_shelfinfo_slsms where tbl_shelfinfo_slsms.shelf_id=tbl_shelftierconfiguration_slsms.shelf_id and rfid_reader_Uid is null and book_lib_id is not null and present_book is not null limit 1;
if shelftierid is not null then
update tbl_shelftierconfiguration_slsms set rfid_reader_Uid=lastreaderuid where shelf_tier_id=shelftierid;
select floorid,shelfid,shelftierid,booklibid,(substr(endbookidrange,2)-substr(startbookidrange,2))+1 as TotalNoofBooks,lastreaderuid ;
else
select "0";
end if;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_admin_dashboard_report_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_admin_dashboard_report_slsms`(flag tinyint)
BEGIN
if flag=1 then
select count(floor_id) from tbl_floorinfo_master_slsms;
elseif flag=2 then
select count(shelf_id) from tbl_shelfinfo_slsms;
elseif flag=3 then
select count(rfid_reader_uid) from tbl_rfid_reader_configuration_slsms;
elseif flag=4 then
select count(Book_id) from tbl_bookconfigration_slsms;
elseif flag=5 then
select count(institute_id) from tbl_instituteinfo_master_slsms;
elseif flag=6 then
select count(course_id) from tbl_coursedetails_slsms;
elseif flag=7 then
select count(username) from tbl_nativeuserinfo_master_slsms where u_role="Librarian";
elseif flag=8 then
SELECT library.tbl_floorinfo_master_slsms.floor_id,main_section_type,max_allowed_shelve FROM library.tbl_shelfmainsection_master_slsms,library.tbl_floorinfo_master_slsms where library.tbl_shelfmainsection_master_slsms.main_section_id=library.tbl_floorinfo_master_slsms.main_section_id;
elseif flag=9 then
select rfid_reader_uid,universal_product_code from tbl_rfid_reader_configuration_slsms;
elseif flag=10 then
select tbl_rfid_reader_configuration_slsms.rfid_reader_uid,universal_product_code,shelf_id,shelf_tier_id from tbl_shelftierconfiguration_slsms,tbl_rfid_reader_configuration_slsms where tbl_rfid_reader_configuration_slsms.rfid_reader_uid = tbl_shelftierconfiguration_slsms.rfid_reader_Uid;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_assignedReaderToShelf_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_assignedReaderToShelf_slsms`()
BEGIN
declare done int default 0;
declare readerid varchar(10);
declare shelftierid varchar(6);
declare cursor1 cursor for select tbl_rfid_reader_configuration_slsms.rfid_reader_uid from tbl_rfid_reader_configuration_slsms where rfid_reader_uid not in(select rfid_reader_Uid from tbl_shelftierconfiguration_slsms where rfid_reader_Uid is not null) order by rfid_reader_uid;
declare cursor2 cursor for select shelf_tier_id from tbl_shelftierconfiguration_slsms where present_book is not null and rfid_reader_Uid is null;
declare continue handler for not found set done=1;
open cursor1;
open cursor2;
label1:loop
fetch cursor1 into readerid;
fetch cursor2 into shelftierid;
if done =1 then
leave label1;
end if;
update tbl_shelftierconfiguration_slsms set rfid_reader_Uid=readerid where shelf_tier_id=shelftierid;
end loop label1;
close cursor1;
close cursor2;
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 `pro_bookconfigurationonshelf_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_bookconfigurationonshelf_slsms`(booklibid varchar(4),maxallowedbook int,subsectionid tinyint,bookquantity smallint,flag varchar(10))
BEGIN
declare shelftierid tinyint;
declare readercount tinyint;
declare exist tinyint;
if flag="insert" then
call pro_newbookconfiguration_slsms(booklibid,maxallowedbook,subsectionid,bookquantity);
elseif flag="update" then
call pro_updatebookconfiguration_slsms(booklibid,bookquantity);
end if;
select count(tbl_rfid_reader_configuration_slsms.rfid_reader_uid) into readercount from tbl_rfid_reader_configuration_slsms where rfid_reader_uid not in(select rfid_reader_Uid from tbl_shelftierconfiguration_slsms where rfid_reader_Uid is not null);
select count(shelf_tier_id) into shelftierid from tbl_shelftierconfiguration_slsms where present_book is not null and rfid_reader_Uid is null;
if readercount > 0 and shelftierid > 0 then
call pro_assignedReaderToShelf_slsms();
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_bookdetailReport_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_bookdetailReport_slsms`(bookid varchar(4),flag tinyint)
BEGIN
declare flagextra int;
declare flagnotassigned int;
declare flagtierinfo int;
select book_title,sub_section_type,main_section_type from tbl_shelfmainsection_master_slsms,tbl_shelfsubsection_slsms,tbl_bookinfo_master_slsms where tbl_shelfmainsection_master_slsms.main_section_id=tbl_shelfsubsection_slsms.main_section_id and tbl_shelfsubsection_slsms.sub_section_id= tbl_bookinfo_master_slsms.book_sub_section_id and Book_lib_id=bookid;
select exists(select book_lib_id from tbl_shelftierconfiguration_slsms where book_lib_id=bookid) into flagtierinfo;
select exists(select * from tbl_extraallbookslots_slsms where Book_lib_id=bookid) into flagextra;
select exists(select * from tbl_notassignedbookslots_slsms where Book_lib_id=bookid) into flagnotassigned;
if flag=1 then
if flagtierinfo = 1 then
select tbl_shelftierconfiguration_slsms.*,floor_id from tbl_shelfinfo_slsms,tbl_shelftierconfiguration_slsms where tbl_shelfinfo_slsms.shelf_id=tbl_shelftierconfiguration_slsms.shelf_id and book_lib_id=bookid;
end if;
end if;
if flagextra = 1 then
select "Extra Book details",book_quantity,start_bookid_range,end_bookid_range from tbl_extraallbookslots_slsms where Book_lib_id=bookid;
elseif flagnotassigned = 1 then
select "Un-Allocated Book Details",book_quantity,start_bookid_range,end_bookid_range from tbl_notassignedbookslots_slsms where Book_lib_id=bookid;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_change_password_librarian` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_change_password_librarian`(uname varchar(256),pass varchar(256))
BEGIN
update tbl_nativeuserinfo_master_slsms set pass=sha2(pass,512) where username=uname;
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 `pro_checkexisitngshelves_emptyshelves_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_checkexisitngshelves_emptyshelves_slsms`(floorid tinyint)
BEGIN
declare done int default 0;
declare subsectionid int;
declare subsectiontype varchar(256);
declare noofallowedshelves tinyint;
declare noofemptyshelves tinyint;
declare configuration tinyint;
declare exisiting_empty_shelvesdata text default "";
declare cursor1 cursor for select tbl_shelfsubsection_slsms.sub_section_id,sub_section_type,No_of_allowed_shelves from tbl_categorywise_arrngement_onfloor_slsms,tbl_shelfsubsection_slsms where tbl_shelfsubsection_slsms.sub_section_id=tbl_categorywise_arrngement_onfloor_slsms.sub_section_id and floor_id=floorid;
declare continue handler for not found set done=1;
open cursor1;
label1:loop
fetch cursor1 into subsectionid,subsectiontype,noofallowedshelves;
if done=1 then
leave label1;
end if;
select count(shelf_id) into configuration from tbl_shelfinfo_slsms where no_of_tiers is null and sub_section_id=subsectionid and floor_id=floorid;
if(configuration > 0) then
select concat_ws(",",exisiting_empty_shelvesdata,subsectionid,subsectiontype,noofallowedshelves,configuration) into exisiting_empty_shelvesdata;
else
select count(distinct tbl_shelfinfo_slsms.shelf_id) into noofemptyshelves from tbl_shelftierconfiguration_slsms,tbl_shelfinfo_slsms where tbl_shelfinfo_slsms.shelf_id=tbl_shelftierconfiguration_slsms.shelf_id and book_lib_id is null and sub_section_id=subsectionid and floor_id=floorid;
select concat_ws(",",exisiting_empty_shelvesdata,subsectionid,subsectiontype,noofallowedshelves,noofemptyshelves) into exisiting_empty_shelvesdata;
end if;
end loop label1;
select substr(exisiting_empty_shelvesdata,2);
close cursor1;
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 `pro_checkfloorhasbooks` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_checkfloorhasbooks`(floorid tinyint)
BEGIN
declare bookcount int;
select count(book_lib_id) into bookcount from tbl_shelfinfo_slsms,tbl_shelftierconfiguration_slsms where tbl_shelfinfo_slsms.shelf_id =tbl_shelftierconfiguration_slsms.shelf_id and floor_id=7;
if(bookcount > 0) then
select true;
else
select false;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_checkmaxallowedshelvesonfloor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_checkmaxallowedshelvesonfloor_slsms`(floorid tinyint)
BEGIN
select max_allowed_shelve from tbl_floorinfo_master_slsms where floor_id=floorid;
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 `pro_checkmissplacedbook_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_checkmissplacedbook_slsms`(floorid tinyint)
BEGIN
select rfid_reader_Uid ,book_lib_id,tbl_shelftierconfiguration_slsms.shelf_id,shelf_tier_id,present_book from tbl_shelftierconfiguration_slsms,tbl_shelfinfo_slsms where tbl_shelfinfo_slsms.shelf_id = tbl_shelftierconfiguration_slsms.shelf_id and floor_id=floorid and rfid_reader_Uid Is not null;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_check_facultycredential_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_check_facultycredential_slsms`(IN Enrollment varchar(256),In Password varchar(256),OUT checkcredential boolean,OUT registerdfaculty boolean)
begin
declare credential varchar(256);
declare registerd varchar(256);
select enrollment_no INTO credential from tbl_facultyinfo_master_slsms where enrollment_no=Enrollment and faculty_password=Password;
select credential;
IF credential!="NULL" THEN
set checkcredential=true;
select enrollment_no INTO registerd from tbl_facultyregistered_slsms where enrollment_no=credential;
IF registerd!="NULL" THEN
set registerdfaculty=true;
ELSE
set registerdfaculty=false;
END IF;
ELSE
set checkcredential=false;
END IF;
end ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_check_floorhasbooks_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_check_floorhasbooks_slsms`(floorid tinyint)
BEGIN
declare bookcount int;
select count(book_lib_id) into bookcount from tbl_shelfinfo_slsms,tbl_shelftierconfiguration_slsms where tbl_shelfinfo_slsms.shelf_id =tbl_shelftierconfiguration_slsms.shelf_id and floor_id=floorid;
if(bookcount > 0) then
select true;
else
select false;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_check_institutename_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_check_institutename_slsms`(institutename varchar(256))
BEGIN
declare db_institutename varchar(256);
select institute_name into db_institutename from tbl_instituteinfo_master_slsms where institute_name=institutename;
select row_count();
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 `pro_check_nativeuserinfo_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_check_nativeuserinfo_slsms`(uname varchar(256),pass_word text)
BEGIN
select u_role,username,last_login,tbl_nativeuserinfo_master_slsms.status from tbl_nativeuserinfo_master_slsms where username=uname and pass=sha2(pass_word,512);
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 `pro_check_studentcredential_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_check_studentcredential_slsms`(IN Enrollment char(15),IN Password varchar(256),OUT checkcredential boolean,OUT registerdStudent boolean)
begin
declare credential char(15);
declare registerd char(15);
select enrollment_no INTO credential from tbl_studentinfo_master_slsms where enrollment_no=Enrollment and student_password=Password;
select credential;
IF credential!="NULL" THEN
set checkcredential=true;
select enrollment_no INTO registerd from tbl_studentregistered_slsms where enrollment_no=credential;
IF registerd!="NULL" THEN
set registerdStudent=true;
ELSE
set registerdStudent=false;
END IF;
ELSE
set checkcredential=false;
END IF;
end ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_dashboard_googlechartreports_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_dashboard_googlechartreports_slsms`()
BEGIN
select tbl_shelfsubsection_slsms.sub_section_type,count(Book_id) from tbl_shelfsubsection_slsms,tbl_bookinfo_master_slsms,tbl_bookconfigration_slsms where tbl_shelfsubsection_slsms.sub_section_id=tbl_bookinfo_master_slsms.book_sub_section_id and tbl_bookinfo_master_slsms.Book_lib_id=tbl_bookconfigration_slsms.book_lib_id group by sub_section_type order by count(book_id) desc limit 5;
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 `pro_deleteconfiguredbookreport_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_deleteconfiguredbookreport_slsms`(bookid varchar(4))
BEGIN
delete from tbl_configuredbookreport_slsms where Bookid=bookid;
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 `pro_Deletefloor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_Deletefloor_slsms`(l_floor_id int)
BEGIN
declare count int;
Delete from tbl_floorinfo_master_slsms where floor_id=l_floor_id;
select exists(select * from tbl_floorinfo_master_slsms) into count;
if count = 0 then
alter table tbl_floorinfo_master_slsms auto_increment=0;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_deleteshelfconfiguration_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_deleteshelfconfiguration_slsms`(l_shelfid CHAR(4))
BEGIN
delete from tbl_shelfconfiguration_slsms where shelf_id=l_shelfid;
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 `pro_deleteshelf_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_deleteshelf_slsms`(l_shelfid CHAR(4))
BEGIN
delete from tbl_shelfinfo_master_slsms where shelf_id=l_shelfid;
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 `pro_displayallbookreports_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_displayallbookreports_slsms`()
BEGIN
declare bookid char(4);
declare bookname varchar(255);
declare floor tinyint;
declare shelfid char(4);
declare totalnoofbook int;
declare subsectiontype varchar(100);
declare nooftier tinyint;
declare flag int;
declare done int default 0;
declare cursor1 cursor for select Book_lib_id from tbl_bookinfo_master_slsms;
declare continue handler for not found set done=1;
open cursor1;
label1:loop
fetch cursor1 into bookid;
if(done=1)then
leave label1;
end if;
select count(book_id),book_title,sub_section_type into totalnoofbook,bookname,subsectiontype from tbl_bookinfo_master_slsms,tbl_bookconfigration_slsms,tbl_shelfsubsection_slsms where tbl_shelfsubsection_slsms.sub_section_id=tbl_bookinfo_master_slsms.book_sub_section_id and tbl_bookinfo_master_slsms.Book_lib_id=tbl_bookconfigration_slsms.book_lib_id and tbl_bookinfo_master_slsms.Book_lib_id=bookid;
select exists(select book_lib_id from tbl_shelftierconfiguration_slsms where book_lib_id=bookid) into flag;
if(flag=1) then
select distinct(tbl_shelfinfo_slsms.shelf_id),floor_id,no_of_tiers into shelfid,floor,nooftier from tbl_shelfinfo_slsms,tbl_shelftierconfiguration_slsms where tbl_shelfinfo_slsms.shelf_id=tbl_shelftierconfiguration_slsms.shelf_id and book_lib_id=bookid;
else
set shelfid="-";
set floor=0;
set nooftier=0;
end if;
if (floor=0) then
select bookid,bookname,"-",shelfid,"-",subsectiontype,totalnoofbook;
else
select bookid,bookname,floor,shelfid,nooftier,subsectiontype,totalnoofbook;
end if;
end loop label1;
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 `pro_extrabookslot_reports_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_extrabookslot_reports_slsms`()
BEGIN
select tbl_extraallbookslots_slsms.Book_lib_id,book_title,book_quantity from tbl_bookinfo_master_slsms,tbl_extraallbookslots_slsms where tbl_bookinfo_master_slsms.Book_lib_id=tbl_extraallbookslots_slsms.Book_lib_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 `pro_facultyregistration_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_facultyregistration_slsms`(IN Enrollment varchar(256),IN Email varchar(256),IN Contect_No Char(14))
begin
insert into tbl_facultyregistered_slsms values(Enrollment,Email,Contect_No);
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 `pro_generate_librarian_username_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_generate_librarian_username_slsms`()
BEGIN
declare uname varchar(256);
declare counter int;
select username into uname from tbl_nativeuserinfo_master_slsms where u_role="Librarian" order by username desc limit 1;
select count(username) into counter from tbl_nativeuserinfo_master_slsms where u_role="Librarian";
if uname is null then
select "librarian_lib1@utu.ac.in";
else
set counter=counter+1;
set uname=concat("librarian_lib",counter,"@utu.ac.in");
select uname;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_genrate_insertid_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_genrate_insertid_slsms`( lib_id varchar(4), quantity int)
BEGIN
declare counter int default 0;
declare new_bookid varchar(5);
loop1:loop
if counter=quantity then
leave loop1;
end if;
set counter =counter+1;
set new_bookid=concat(lib_id,LPAD(counter,3,0));
insert into tbl_bookconfigration_slsms value(lib_id,new_bookid);
end loop loop1;
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 `pro_getallfloors_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getallfloors_slsms`()
BEGIN
SELECT floor_id from tbl_floorinfo_master_slsms;
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 `pro_getallshelf_floor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getallshelf_floor_slsms`(floorid int)
BEGIN
select max_allowed_shelve from tbl_floorinfo_master_slsms where floor_id=floorid;
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 `pro_getfloorofshelf_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getfloorofshelf_slsms`(l_shelfid CHAR(4))
BEGIN
select Floor_id from tbl_shelfconfiguration_slsms where shelf_id=l_shelfid;
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 `pro_getfloor_data_catergorywise_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getfloor_data_catergorywise_slsms`(floorid tinyint)
BEGIN
select sub_section_type,No_of_allowed_shelves from tbl_shelfsubsection_slsms,tbl_categorywise_arrngement_onfloor_slsms where tbl_shelfsubsection_slsms.sub_section_id=tbl_categorywise_arrngement_onfloor_slsms.sub_section_id and floor_id=floorid;
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 `pro_getfloor_data_except_categorywise_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getfloor_data_except_categorywise_slsms`(floorid tinyint)
BEGIN
declare mainsectionid tinyint;
select main_section_id into mainsectionid from tbl_floorinfo_master_slsms where floor_id=floorid;
select sub_section_id,sub_section_type from tbl_shelfsubsection_slsms where main_section_id=mainsectionid and sub_section_id Not In(select sub_section_id from tbl_categorywise_arrngement_onfloor_slsms where floor_id=floorid);
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 `pro_getlastfloor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getlastfloor_slsms`()
BEGIN
declare f_id tinyint;
SELECT floor_id into f_id FROM tbl_floorinfo_master_slsms ORDER BY floor_id desc LIMIT 1;
if f_id is null then
set f_id=0;
select f_id;
else
select f_id;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_getnoofshelfinfloor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getnoofshelfinfloor_slsms`(floorid tinyint)
BEGIN
select count(distinct shelf_id) from tbl_shelftierconfiguration_slsms where rfid_reader_Uid is not null and shelf_id IN (select shelf_id from tbl_shelfinfo_slsms where floor_id=floorid and no_of_tiers is not null);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_getnooftiersofshelf_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getnooftiersofshelf_slsms`(l_shelfid CHAR(4))
BEGIN
select no_of_tiers from tbl_shelfinfo_master_slsms where shelf_id=l_shelfid;
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 `pro_getselectedfloor_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_getselectedfloor_slsms`(l_floor_id int)
BEGIN
select max_allowed_shelve from tbl_floorinfo_master_slsms where floor_id=l_floor_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 `pro_gettierinshelf_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_gettierinshelf_slsms`(floorid CHAR(4))
BEGIN
declare done int default 0;
declare shelfid char(4);
declare count int;
declare cursor1 cursor for select shelf_id from tbl_shelfinfo_slsms where floor_id=floorid and no_of_tiers is not null;
declare continue handler for not found set done=1;
open cursor1;
label1:loop
fetch cursor1 into shelfid;
if done =1 then
leave label1;
end if;
select count(shelf_id) into count from tbl_shelftierconfiguration_slsms where shelf_id=shelfid and book_lib_id is not null and rfid_reader_Uid is not null;
if(count > 0)then
select count;
end if;
end loop label1;
close cursor1;
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 `pro_insertcategorywisearrngementonfloor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insertcategorywisearrngementonfloor_slsms`(floorid int,sub_section_id int,no_of_allowed_shelves int)
BEGIN
insert into tbl_categorywise_arrngement_onfloor_slsms values(floorid,sub_section_id,no_of_allowed_shelves);
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 `pro_insertCourse_details_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insertCourse_details_slsms`(instituename varchar(256),coursename varchar(256))
BEGIN
declare old_courseid char(4);
declare new_courseid char(4);
declare pro_institue_id char(4);
select course_id into old_courseid from tbl_coursedetails_slsms order by course_id desc limit 1;
if old_courseid is null then
set new_courseid="C101";
else
set new_courseid=concat("C",substr(old_courseid,2)+1);
end if;
select institute_id into pro_institue_id from tbl_instituteinfo_master_slsms where institute_name=instituename;
insert into tbl_coursedetails_slsms values (new_courseid,pro_institue_id,coursename);
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 `pro_insertdata_allfloor_misplacedbookdata_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insertdata_allfloor_misplacedbookdata_slsms`(floor_id tinyint,shelfid varchar(4),shelftierid varchar(6),book_id varchar(4))
BEGIN
insert into tbl_allfloor_misplacedbookdata_slsms (floorid,shelf_id,shelf_tier_id,bookid,Timestamp) values (floor_id,shelfid,shelftierid,book_id,now());
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 `pro_insertfloor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insertfloor_slsms`(max_allowed_shelves int,mainsectiontype varchar(256),OUT floorid int)
BEGIN
declare mainsectionid int;
select main_section_id into mainsectionid from tbl_shelfmainsection_master_slsms where main_section_type=mainsectiontype;
INSERT INTO tbl_floorinfo_master_slsms (max_allowed_shelve,main_section_id) values(max_allowed_shelves,mainsectionid);
set floorid=last_insert_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 `pro_insertInstitute_details_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insertInstitute_details_slsms`(institue_name varchar(256))
BEGIN
declare old_institueid char(4);
declare new_instituteid char(4);
select institute_id into old_institueid from tbl_instituteinfo_master_slsms order by institute_id desc limit 1;
if old_institueid is null then
set new_instituteid="I101";
else
set new_instituteid=concat("I",substr(old_institueid,2)+1);
end if;
insert into tbl_instituteinfo_master_slsms values(new_instituteid,institue_name);
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 `pro_insertshelf_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insertshelf_slsms`(sub_section_id int,floorid int)
BEGIN
declare old_shelfid char(4);
declare new_shelfid char(4);
select shelf_id into old_shelfid from tbl_shelfinfo_slsms where floor_id=floorid order by shelf_id desc limit 1;
if old_shelfid is null then
set new_shelfid=concat("S",floorid,"01");
else
set new_shelfid=concat("S",substr(old_shelfid,2)+1);
end if;
INSERT INTO tbl_shelfinfo_slsms values (new_shelfid,null,floorid,sub_section_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 `pro_insert_bookdata_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insert_bookdata_slsms`(booktitle varchar(256),subsectionid int,bookauthor varchar(256),bookpublication varchar(256),bookISBN char(17),booklanguage varchar(256),bookpaperback int,bookquanitity smallint,bookdimension varchar(45),userinfo varchar(256))
BEGIN
declare old_lib_id varchar(4);
declare new_lib_id varchar(4);
select book_lib_id into old_lib_id from tbl_bookinfo_master_slsms order by book_lib_id desc limit 1;
if old_lib_id is null then
set new_lib_id ="B1";
else
set new_lib_id = concat("B",substr(old_lib_id,2)+1);
end if;
insert into tbl_bookinfo_master_slsms values (new_lib_id,subsectionid,booktitle,bookauthor,bookpublication,bookISBN,booklanguage,bookpaperback,bookdimension,now(),userinfo);
call pro_genrate_insertid_slsms(new_lib_id,bookquanitity);
select new_lib_id,"insert";
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 `pro_insert_update_bookdata_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_insert_update_bookdata_slsms`(booktitle varchar(256),subsectionid int,bookauthor varchar(256),bookpublication varchar(256),bookISBN char(17),booklanguage varchar(256),bookpaperback int,bookquantity smallint,bookdimension varchar(45),userinfo varchar(256))
BEGIN
declare lib_id varchar(4);
select Book_lib_id into lib_id from tbl_bookinfo_master_slsms where book_title=booktitle;
if lib_id is null then
call pro_insert_bookdata_slsms(booktitle,subsectionid,bookauthor,bookpublication,bookISBN,booklanguage,bookpaperback,bookquantity,bookdimension,userinfo);
else
call pro_update_bookdata_slsms(lib_id,bookquantity,userinfo);
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_librarian_changeemailpass_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_librarian_changeemailpass_slsms`(uname varchar(256),emailid varchar(256),pass text)
BEGIN
if emailid is not null then
update tbl_nativeuserinfo_master_slsms set email_id=emailid where username=uname;
elseif pass is not null then
update tbl_nativeuserinfo_master_slsms set pass=sha2(pass,512),last_logout=null,last_login=null where username=uname;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_librarian_dashboard_report_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_librarian_dashboard_report_slsms`(flag tinyint)
BEGIN
if flag=1 then
select distinct count(Bookid) from tbl_configuredbookreport_slsms;
elseif flag=2 then
select count(book_id) from tbl_bookconfigration_slsms;
elseif flag=3 then
select count(enrollment_no) from tbl_studentregistered_slsms;
elseif flag=4 then
select count(enrollment_no) from tbl_facultyinfo_master_slsms;
elseif flag=5 then
select count(sub_section_id) from tbl_shelfsubsection_slsms;
elseif flag=6 then
select sum(book_quantity) from tbl_notassignedbookslots_slsms;
elseif flag=7 then
select count(Book_lib_id) from tbl_extraallbookslots_slsms;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_librarian_enabledisable_remove_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_librarian_enabledisable_remove_slsms`(uname varchar(256),state varchar(20),del varchar(20))
BEGIN
if state is not null then
if state="1" then
update tbl_nativeuserinfo_master_slsms set status=1 where username=uname;
else
update tbl_nativeuserinfo_master_slsms set status=0 where username=uname;
end if;
elseif del is not null then
delete from tbl_nativeuserinfo_master_slsms where username=uname;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_librarian_list_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_librarian_list_slsms`()
BEGIN
select name,username,status from tbl_nativeuserinfo_master_slsms where u_role="Librarian";
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 `pro_locationofbook_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_locationofbook_slsms`(bookid varchar(20))
BEGIN
select floor_id,tbl_shelftierconfiguration_slsms.shelf_id,shelf_tier_id from tbl_shelfinfo_slsms,tbl_shelftierconfiguration_slsms where book_lib_id=bookid limit 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 `pro_login_logout_status` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_login_logout_status`(uname varchar(256),loginflag boolean,logoutflag boolean)
BEGIN
if loginflag=true then
update tbl_nativeuserinfo_master_slsms set last_login=now() where username=uname;
elseif logoutflag=true then
update tbl_nativeuserinfo_master_slsms set last_logout=now() where username=uname;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_manage_exisiting_shelves_delete_shelves` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_manage_exisiting_shelves_delete_shelves`(floorid tinyint,subsectionid int,noofdelete tinyint,maxallowedshelves tinyint)
BEGIN
declare rowaffected int;
update tbl_floorinfo_master_slsms set max_allowed_shelve=max_allowed_shelve-noofdelete where floor_id=floorid;
if(noofdelete = maxallowedshelves) then
delete from tbl_categorywise_arrngement_onfloor_slsms where floor_id=floorid and sub_section_id=subsectionid;
else
update tbl_categorywise_arrngement_onfloor_slsms set No_of_allowed_shelves=No_of_allowed_shelves-noofdelete where floor_id=floorid and sub_section_id=subsectionid;
end if;
delete from tbl_shelfinfo_slsms where sub_section_id=subsectionid and floor_id=floorid order by shelf_id desc limit noofdelete;
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 `pro_manage_exisiting_shelves_swap_shelves` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_manage_exisiting_shelves_swap_shelves`(floorid tinyint,subsectionid1 int,subsectionid2 int,noofshelves tinyint)
BEGIN
declare noofbooklimit tinyint;
update tbl_categorywise_arrngement_onfloor_slsms set No_of_allowed_shelves=No_of_allowed_shelves-noofshelves where floor_id=floorid and sub_section_id=subsectionid1;
update tbl_categorywise_arrngement_onfloor_slsms set No_of_allowed_shelves=No_of_allowed_shelves+noofshelves where floor_id=floorid and sub_section_id=subsectionid2;
select sum(no_of_tiers) into noofbooklimit from (select no_of_tiers from tbl_shelfinfo_slsms where floor_id=2 and sub_section_id=102 order by shelf_id desc limit 2) t;
update tbl_shelfinfo_slsms set sub_section_id=subsectionid2 where floor_id=floorid and sub_section_id=subsectionid1 order by shelf_id desc limit noofshelves;
set noofbooklimit=noofbooklimit/2;
call pro_notassignedbookToassignedbook_slsms(noofbooklimit);
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 `pro_newbookconfiguration_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_newbookconfiguration_slsms`(booklibid varchar(4),maxallowedbook tinyint,subsectionid tinyint,bookquantity smallint)
BEGIN
declare done int default 0;
declare shelfid varchar(4);
declare shelftierid varchar(8);
declare total int;
declare firstcounter int default 0;
declare secondcounter int default 0;
declare bookconfigonshelf_data CURSOR for SELECT tbl_shelftierconfiguration_slsms.shelf_id,shelf_tier_id from tbl_shelftierconfiguration_slsms,tbl_shelfinfo_slsms where tbl_shelfinfo_slsms.shelf_id=tbl_shelftierconfiguration_slsms.shelf_id and sub_section_id=subsectionid and book_lib_id is null limit 2;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
open bookconfigonshelf_data;
set total=bookquantity;
label1:loop
fetch bookconfigonshelf_data into shelfid,shelftierid;
if done =1 then
leave label1;
end if;
update tbl_shelftierconfiguration_slsms set book_lib_id=booklibid,max_allowed_book=maxallowedbook where shelf_id=shelfid and shelf_tier_id=shelftierid;
if maxallowedbook >= bookquantity then
if firstcounter =0 then
update tbl_shelftierconfiguration_slsms set present_book=bookquantity,start_bookid_range=concat(booklibid,LPAD(1,3,0)),end_bookid_range=concat(booklibid,LPAD(bookquantity,3,0)) where shelf_id=shelfid and shelf_tier_id=shelftierid;
set firstcounter=firstcounter+1;
set total=0;
end if;
else
if secondcounter=0 then
update tbl_shelftierconfiguration_slsms set present_book=maxallowedbook,start_bookid_range=concat(booklibid,LPAD(1,3,0)),end_bookid_range=concat(booklibid,LPAD(maxallowedbook,3,0)) where shelf_id=shelfid and shelf_tier_id=shelftierid;
set secondcounter=secondcounter+1;
set total=total-maxallowedbook;
else
if total >=maxallowedbook then
update tbl_shelftierconfiguration_slsms set present_book=maxallowedbook,start_bookid_range=concat(booklibid,LPAD(maxallowedbook+1,3,0)),end_bookid_range=concat(booklibid,LPAD(maxallowedbook*2,3,0)) where shelf_id=shelfid and shelf_tier_id=shelftierid;
set total=total-maxallowedbook;
else
update tbl_shelftierconfiguration_slsms set present_book=total,start_bookid_range=concat(booklibid,LPAD(maxallowedbook+1,3,0)),end_bookid_range=concat(booklibid,LPAD(maxallowedbook+1+total,3,0)) where shelf_id=shelfid and shelf_tier_id=shelftierid;
set total=total-maxallowedbook;
end if;
end if;
end if;
end loop label1;
close bookconfigonshelf_data;
if total > 0 and total != bookquantity then
insert into tbl_extraallbookslots_slsms values(booklibid,total,concat(booklibid,LPAD(bookquantity-total+1,3,0)),concat(booklibid,LPAD(bookquantity,3,0)));
select "extraslots";
elseif total=bookquantity then
insert into tbl_notassignedbookslots_slsms values(booklibid,total,concat(booklibid,LPAD(1,3,0)),concat(booklibid,LPAD(total,3,0)));
select "notassigned";
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_newlyconfiguredbookreport_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_newlyconfiguredbookreport_slsms`()
BEGIN
select tbl_configuredbookreport_slsms.Bookid,tbl_bookinfo_master_slsms.book_title,tbl_configuredbookreport_slsms.Timestamp,flag from tbl_bookinfo_master_slsms,tbl_configuredbookreport_slsms where tbl_bookinfo_master_slsms.Book_lib_id=tbl_configuredbookreport_slsms.Bookid;
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 `pro_notassignedbookToassignedbook_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_notassignedbookToassignedbook_slsms`(noofbooklimit int)
BEGIN
declare done int default 0;
declare booklibid varchar(10);
declare dimension decimal(4,2);
declare subsectionid int;
declare bookquentity int;
declare maxallowedbookontier int;
declare cursor1 cursor for select tbl_notassignedbookslots_slsms.Book_lib_id,cast(substring_index(substring_index(book_dimension,"*",2),"*",-1) as decimal(4,2)) as dimension,tbl_bookinfo_master_slsms.book_sub_section_id,book_quantity from tbl_bookinfo_master_slsms,tbl_notassignedbookslots_slsms where tbl_bookinfo_master_slsms.Book_lib_id=tbl_notassignedbookslots_slsms.Book_lib_id limit noofbooklimit;
declare continue handler for not found set done=1;
open cursor1;
label1:loop
fetch cursor1 into booklibid,dimension,subsectionid,bookquentity;
if done=1 then
leave label1;
end if;
set maxallowedbookontier=floor(80/dimension)-2;
call pro_bookconfigurationonshelf_slsms(booklibid,maxallowedbookontier,subsectionid,bookquentity,"insert");
delete from tbl_notassignedbookslots_slsms where Book_lib_id=booklibid;
end loop label1;
close cursor1;
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 `pro_retrieveallallowedfloor_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrieveallallowedfloor_slsms`()
BEGIN
declare done INT DEFAULT 0;
declare l_floor_id VARCHAR(256);
declare l_max_allowed_shelf INT;
declare countshelf INT;
declare cur1 CURSOR for select * from tbl_floorinfo_master_slsms;
declare CONTINUE HANDLER FOR NOT FOUND set done=1;
open cur1;
loop1: loop
fetch cur1 into l_floor_id,l_max_allowed_shelf;
if done=1 then
leave loop1;
END IF;
select count(Floor_id) into countshelf from tbl_shelfconfiguration_slsms where Floor_id=l_floor_id;
IF countshelf<=l_max_allowed_shelf THEN
select l_floor_id as "all floors" ;
END IF;
END loop loop1;
CLOSE cur1;
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 `pro_retrieveallsubsectiontype_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrieveallsubsectiontype_slsms`()
BEGIN
select sub_section_id,sub_section_type from tbl_shelfsubsection_slsms;
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 `pro_retrievebookinfomation_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrievebookinfomation_slsms`(title varchar(256))
BEGIN
select sub_section_type,book_author,book_publication,book_ISBN_13,book_language,book_paperback,book_dimension,book_sub_section_id from tbl_bookinfo_master_slsms,tbl_shelfsubsection_slsms where tbl_shelfsubsection_slsms.sub_section_id=tbl_bookinfo_master_slsms.book_sub_section_id and book_title=title;
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 `pro_retrievelastshelf_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrievelastshelf_slsms`()
BEGIN
DECLARE getid CHAR(4);
DECLARE lastid CHAR(4);
set getid = SUBSTR((SELECT shelf_id FROM tbl_shelfinfo_master_slsms ORDER BY shelf_id DESC LIMIT 1), 2, 3)+1;
IF getid IS NULL THEN
set lastid=CONCAT("S","101");
ELSE
set lastid=CONCAT("S",getid);
END IF;
SELECT lastid as "ShelfId";
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 `pro_retrievemainsectiontype` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrievemainsectiontype`()
BEGIN
select main_section_type from tbl_shelfmainsection_master_slsms;
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 `pro_retriveSubsectionBasedOnMainSection` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retriveSubsectionBasedOnMainSection`(mainsectiontype varchar(20))
BEGIN
declare mainsectionid TINYINT;
select main_section_id into mainsectionid from tbl_shelfmainsection_master_slsms where main_section_type=mainsectiontype;
select sub_section_type,sub_section_id from tbl_shelfsubsection_slsms where main_section_id=mainsectionid;
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 `pro_retrivesubsectiondetails_fromfloor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrivesubsectiondetails_fromfloor_slsms`(floorid int)
BEGIN
select distinct tbl_shelfinfo_slsms.sub_section_id,sub_section_type from tbl_shelfsubsection_slsms,tbl_shelfinfo_slsms where tbl_shelfsubsection_slsms.sub_section_id=tbl_shelfinfo_slsms.sub_section_id and floor_id=floorid and no_of_tiers is null;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_retrive_facultyinfo_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrive_facultyinfo_slsms`(IN Enrollment varchar(256))
begin
select tbl_facultyinfo_master_slsms.enrollment_no,tbl_facultyinfo_master_slsms.faculty_name,tbl_coursedetails_slsms.course_name,tbl_facultyinfo_master_slsms.faculty_birthdate from tbl_facultyinfo_master_slsms,tbl_coursedetails_slsms where tbl_coursedetails_slsms.course_id=tbl_facultyinfo_master_slsms.course_id and tbl_facultyinfo_master_slsms.enrollment_no=Enrollment;
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 `pro_retrive_lastshelfid` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrive_lastshelfid`()
BEGIN
select shelf_id from tbl_shelfinfo_slsms order by shelf_id desc limit 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 `pro_retrive_librarianmail_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrive_librarianmail_slsms`(uname varchar(256))
BEGIN
select email_id from tbl_nativeuserinfo_master_slsms where username=uname;
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 `pro_retrive_noofshelves_basedon_subsection` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrive_noofshelves_basedon_subsection`(subsectionid int,floorid int)
BEGIN
select count(shelf_id) from tbl_shelfinfo_slsms where no_of_tiers is null and sub_section_id=subsectionid and floor_id=floorid;
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 `pro_retrive_searchbook_name_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrive_searchbook_name_slsms`( searchdata varchar(40),searchtype varchar(40))
BEGIN
declare l_searchdata varchar(40);
set l_searchdata=concat('%',searchdata,'%');
if searchtype="title" then
select book_title from tbl_bookinfo_master_slsms where book_title like l_searchdata limit 10;
elseif searchtype="author" then
select book_author from tbl_bookinfo_master_slsms where book_author like l_searchdata limit 10;
elseif searchtype="isbn" then
select book_ISBN_13 from tbl_bookinfo_master_slsms where book_ISBN_13 like l_searchdata limit 10;
elseif searchtype="publication" then
select book_publication from tbl_bookinfo_master_slsms where book_publication like l_searchdata limit 10;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_retrive_studentinfo_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_retrive_studentinfo_slsms`(IN Enrollment varchar(256))
begin
select tbl_studentinfo_master_slsms.enrollment_no,tbl_studentinfo_master_slsms.student_name,tbl_coursedetails_slsms.course_name,tbl_studentinfo_master_slsms.student_birthdate from tbl_studentinfo_master_slsms,tbl_coursedetails_slsms where tbl_coursedetails_slsms.course_id=tbl_studentinfo_master_slsms.course_id and tbl_studentinfo_master_slsms.enrollment_no=Enrollment;
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 `pro_searchbook_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_searchbook_slsms`(searchdata varchar(256),searchtype varchar(40))
BEGIN
declare bookid varchar(256);
if searchtype="title" then
select Book_lib_id into bookid from tbl_bookinfo_master_slsms where book_title = searchdata ;
elseif searchtype="author" then
select Book_lib_id into bookid from tbl_bookinfo_master_slsms where book_author =searchdata;
elseif searchtype="isbn" then
select Book_lib_id into bookid from tbl_bookinfo_master_slsms where book_ISBN_13 =searchdata;
elseif searchtype="publication" then
select Book_lib_id into bookid from tbl_bookinfo_master_slsms where book_publication =searchdata ;
end if;
select floor_id,tbl_shelftierconfiguration_slsms.shelf_id,tbl_shelftierconfiguration_slsms.shelf_tier_id ,no_of_tiers from tbl_shelfinfo_slsms,tbl_shelftierconfiguration_slsms where tbl_shelfinfo_slsms.shelf_id= tbl_shelftierconfiguration_slsms.shelf_id and book_lib_id=bookid limit 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 `pro_shelfconfigure_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_shelfconfigure_slsms`(l_shelfid CHAR(4),l_floor_id TINYINT)
BEGIN
INSERT INTO tbl_shelfconfiguration_slsms values(l_shelfid,l_floor_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 `pro_shelf_tierconfiguration_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_shelf_tierconfiguration_slsms`(nooftier int,floorid int,subsectionid int )
BEGIN
declare shelfid char(4);
declare count int default 0;
declare shelf_tier_id char(6);
SELECT shelf_id into shelfid FROM library.tbl_shelfinfo_slsms where floor_id=floorid and sub_section_id=subsectionid and no_of_tiers is NULL limit 1;
update tbl_shelfinfo_slsms set no_of_tiers=nooftier where shelf_id=shelfid;
if row_count()>0 then
label1:loop
if count=nooftier then
leave label1;
end if;
set count=count+1;
set shelf_tier_id=concat(shelfid,"_",count);
insert into tbl_shelftierconfiguration_slsms(shelf_id,shelf_tier_id) values(shelfid,shelf_tier_id);
end loop;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_studentregistration_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_studentregistration_slsms`(IN Enrollment char(15),IN Email varchar(256),IN Contect_No Char(14))
begin
insert into tbl_studentregistered_slsms values(Enrollment,Email,Contect_No);
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 `pro_updatebookconfiguration_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_updatebookconfiguration_slsms`(booklibid varchar(4),bookquantity smallint)
BEGIN
declare check_book_lib_id varchar(4);
declare shelftierid varchar(6);
declare maxallowedbook tinyint;
declare presentbook tinyint;
declare endbookidrange varchar(5);
declare b_quantity smallint;
declare total int;
declare extrabooktotal tinyint default 0;
declare done int default 0;
declare bookconfigonshelf_data CURSOR for select shelf_tier_id,max_allowed_book,present_book,end_bookid_range from tbl_shelftierconfiguration_slsms where (max_allowed_book > present_book or present_book is null) and book_lib_id=booklibid;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
select Book_lib_id into check_book_lib_id from tbl_notassignedbookslots_slsms where Book_lib_id=booklibid;
if(check_book_lib_id is not null) then
update tbl_notassignedbookslots_slsms set book_quantity=book_quantity+bookquantity,end_bookid_range=concat("B",substr(end_bookid_range,2)+bookquantity) where Book_lib_id=check_book_lib_id;
else
set b_quantity=bookquantity;
open bookconfigonshelf_data;
label1:loop
fetch bookconfigonshelf_data into shelftierid,maxallowedbook,presentbook,endbookidrange;
if done =1 then
leave label1;
end if;
if presentbook is not null then
set total =maxallowedbook-presentbook;
set bookquantity=bookquantity-total;
if bookquantity > 0 then
update tbl_shelftierconfiguration_slsms set present_book=present_book+total,end_bookid_range=concat(booklibid,LPAD(substr(end_bookid_range,3)+total,3,0)) where shelf_tier_id=shelftierid;
set extrabooktotal=bookquantity;
else
update tbl_shelftierconfiguration_slsms set present_book=present_book+b_quantity,end_bookid_range=concat(booklibid,LPAD((substr(end_bookid_range,3)+b_quantity),3,0)) where shelf_tier_id=shelftierid;
leave label1;
end if;
else
if maxallowedbook >= bookquantity then
update tbl_shelftierconfiguration_slsms set present_book=bookquantity,start_bookid_range=concat(booklibid,LPAD(maxallowedbook+1,3,0)),end_bookid_range=concat(booklibid,LPAD(maxallowedbook+bookquantity,3,0)) where shelf_tier_id=shelftierid;
else
set extrabooktotal=bookquantity-maxallowedbook;
update tbl_shelftierconfiguration_slsms set present_book=maxallowedbook,start_bookid_range=concat(booklibid,LPAD(maxallowedbook+1,3,0)),end_bookid_range=concat(booklibid,LPAD(maxallowedbook*2,3,0)) where shelf_tier_id=shelftierid;
end if;
end if;
end loop label1;
close bookconfigonshelf_data;
select Book_lib_id into check_book_lib_id from tbl_extraallbookslots_slsms where Book_lib_id=booklibid;
if check_book_lib_id is not null then
update tbl_extraallbookslots_slsms set book_quantity=book_quantity+bookquantity,end_bookid_range=concat(booklibid,(substr(end_bookid_range,3)+bookquantity)) where Book_lib_id=check_book_lib_id;
end if;
if extrabooktotal > 0 then
insert into tbl_extraallbookslots_slsms values(booklibid,extrabooktotal,concat(booklibid,LPAD(maxallowedbook*2+1,3,0)),concat(booklibid,LPAD((maxallowedbook*2)+extrabooktotal,3,0)));
end if;
end if;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pro_updatecategorywisearrangementonfloor_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_updatecategorywisearrangementonfloor_slsms`(floorid tinyint,subsectiontype varchar(256),noofshelves tinyint)
BEGIN
declare subsectionid tinyint;
select sub_section_id into subsectionid from tbl_shelfsubsection_slsms where sub_section_type=subsectiontype;
update tbl_categorywise_arrngement_onfloor_slsms set No_of_allowed_shelves=No_of_allowed_shelves+noofshelves where sub_section_id=subsectionid and floor_id=floorid;
select subsectionid;
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 `pro_updatefloorofshelf_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_updatefloorofshelf_slsms`(l_shelfid CHAR(4),l_floor_id INT)
BEGIN
Update tbl_shelfconfiguration_slsms set Floor_id=l_floor_id where shelf_id=l_shelfid;
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 `pro_Updatefloor_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_Updatefloor_slsms`(l_floor_id int,max_allowed_shelves int)
BEGIN
Update tbl_floorinfo_master_slsms set max_allowed_shelve=max_allowed_shelves where floor_id=l_floor_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 `pro_updateshelf_slsms` */;
/*!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 = cp850 */ ;
/*!50003 SET character_set_results = cp850 */ ;
/*!50003 SET collation_connection = cp850_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_updateshelf_slsms`(l_shelfid CHAR(4),l_no_of_tiers INT)
BEGIN
Update tbl_shelfinfo_master_slsms set no_of_tiers=l_no_of_tiers where shelf_id=l_shelfid;
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 `pro_update_bookdata_slsms` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_update_bookdata_slsms`(lib_id varchar(4),quantity smallint,userinfo varchar(256))
BEGIN
declare counter int default 0;
declare old_bookid char(5);
declare new_bookid char(5);
update tbl_bookinfo_master_slsms set TimeStamp=now(), userinfo=userinfo where Book_lib_id=lib_id;
select Book_id into old_bookid from tbl_bookconfigration_slsms where book_lib_id=lib_id order by Book_id desc limit 1;
loop1:loop
if counter =quantity then
leave loop1;
end if;
set counter=counter+1;
set new_bookid=concat("B",substr(old_bookid,2)+counter);
insert into tbl_bookconfigration_slsms values(lib_id,new_bookid);
end loop loop1;
select lib_id,"update";
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-10-16 17:19:28
|
SELECT count(*) AS 'Count'
FROM
(SELECT category_id
FROM film JOIN film_category
ON (film.film_id = film_category.film_id)
GROUP BY category_id
HAVING AVG(replacement_cost-rental_rate) > 17)
as x;
|
drop sequence BURI_DATA_SEQ;
|
use mysqdatabase;
# 修改数据库 字符集
# alter database mysqdatabase charset gbk;
# 删除数据库
# drop database mysqdatabase |
DROP DATABASE IF EXISTS tweetmap;
CREATE DATABASE tweetmap;
USE tweetmap;
DROP TABLE IF EXISTS Twitter_User;
CREATE TABLE Twitter_User (
user_id VARCHAR(512) NOT NULL PRIMARY KEY,
user_screen_name VARCHAR(256) NOT NULL,
user_name VARCHAR(256) NOT NULL,
verified BOOLEAN NOT NULL,
location VARCHAR(256) NOT NULL,
followers_count INT
);
DROP TABLE IF EXISTS Politician;
CREATE TABLE Politician (
user_id VARCHAR(512) NOT NULL PRIMARY KEY,
color VARCHAR(256) NOT NULL,
FOREIGN KEY (user_id) REFERENCES Twitter_User (user_id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
DROP TABLE IF EXISTS tweet;
CREATE TABLE tweet (
id VARCHAR(256) NOT NULL PRIMARY KEY,
created_at VARCHAR(256) NOT NULL,
user_screen_name VARCHAR(256) NOT NULL,
user_name VARCHAR(256) NOT NULL,
text VARCHAR(512) NOT NULL,
retweet_count VARCHAR(256) NOT NULL,
lon VARCHAR(256) ,
lat VARCHAR(256) ,
city VARCHAR(256) ,
politician VARCHAR(256) ,
FOREIGN KEY (politician) REFERENCES twitter_user (user_id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
DROP TABLE IF EXISTS Tweet_To_Hashtag;
CREATE TABLE Tweet_To_Hashtag (
tweet VARCHAR(256) NOT NULL,
hashtag VARCHAR(512) NOT NULL,
PRIMARY KEY(tweet, hashtag),
FOREIGN KEY (tweet) REFERENCES tweet (id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
DROP PROCEDURE IF EXISTS delete_twitter_user;
DELIMITER $$
CREATE PROCEDURE delete_twitter_user(IN twitter_user_id VARCHAR(256))
BEGIN
DELETE FROM Twitter_User WHERE user_id = twitter_user_id;
commit;
END;
$$ DELIMITER ;
DROP PROCEDURE IF EXISTS delete_politician;
DELIMITER $$
CREATE PROCEDURE delete_politician(IN politician_user_id VARCHAR(256))
BEGIN
DELETE FROM Politician WHERE user_id = politician_user_id;
END;
$$ DELIMITER ;
DROP PROCEDURE IF EXISTS add_twitter_user;
DELIMITER $$
CREATE PROCEDURE add_twitter_user(IN user_id VARCHAR(256), IN user_screen_name VARCHAR(256),
IN user_name VARCHAR(256), IN verified BOOLEAN, IN location VARCHAR(256),
IN followers_count VARCHAR(256))
BEGIN
if not user_id in (select tu.user_id from twitter_user tu) then
INSERT INTO Twitter_User VALUES (user_id, user_screen_name, user_name, verified, location, followers_count);
end if;
END;
$$ DELIMITER ;
DROP PROCEDURE IF EXISTS add_politician;
DELIMITER $$
CREATE PROCEDURE add_politician(IN user_id VARCHAR(256), IN color VARCHAR(256))
BEGIN
if not user_id in (select pol.user_id from politician pol) then
INSERT INTO Politician VALUES (user_id, color);
end if;
END;
$$ DELIMITER ;
DROP PROCEDURE IF EXISTS get_all_twitter_politicians;
DELIMITER $$
CREATE PROCEDURE get_all_twitter_politicians()
BEGIN
SELECT * FROM Twitter_User JOIN Politician ON Twitter_User.user_id = Politician.user_id;
END;
$$ DELIMITER ;
|
-- Lists all records with a score >= 10 of the
-- table second_table of the current database.
-- Result should display both the score and the name, ordered by score.
SELECT `score`, `name` FROM `second_table` WHERE `score` >= 10 ORDER BY `score` DESC;
|
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
--
-- Data for Name: vida_core_country; Type: TABLE DATA; Schema: public; Owner: -
--
SET SESSION AUTHORIZATION DEFAULT;
ALTER TABLE vida_core_country DISABLE TRIGGER ALL;
COPY vida_core_country (iso_code, name) FROM stdin;
US United States of America
\.
ALTER TABLE vida_core_country ENABLE TRIGGER ALL;
--
-- Data for Name: vida_core_address; Type: TABLE DATA; Schema: public; Owner: -
--
ALTER TABLE vida_core_address DISABLE TRIGGER ALL;
COPY vida_core_address (id, address_line1, address_line2, city, state_province, postal_code, country_id, geom) FROM stdin;
8 PO Box 154 Newkirk OK 74647-0154 US \N
100226 Zuni Independent Fire District # 8 \N \N \N 13010 43121 43121 505-782-7191 505-782-7224 Mostly Volunteer Local (includes career combination and volunteer) 2015-03-07 19:49:11.779002+00 2015-03-07 19:49:11.779022+00 NM
\.
ALTER TABLE firestation_firedepartment ENABLE TRIGGER ALL;
--
-- Name: firestation_firedepartment_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('firestation_firedepartment_id_seq', 100226, true);
--
-- PostgreSQL database dump complete
--
|
DROP TABLE IF EXISTS film_user;
CREATE TABLE film_user
(
uuid INT PRIMARY KEY AUTO_INCREMENT COMMENT '主键编号',
user_name VARCHAR(50) COMMENT '用户账号',
user_password VARCHAR(50) COMMENT '用户密码',
nick_name VARCHAR(50) COMMENT '用户昵称',
sex INT COMMENT '用户性别 0-男,1-女',
birthday VARCHAR(50) COMMENT '出生日期',
email VARCHAR(50) COMMENT '用户邮箱',
phone VARCHAR(50) COMMENT '用户手机号',
address VARCHAR(50) COMMENT '用户住址',
head_address VARCHAR(50) COMMENT '头像URL',
biography VARCHAR(200) COMMENT '个人介绍',
life_state INT COMMENT '生活状态 0-单身,1-热恋中,2-已婚,3-为人父母',
begin_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间'
) COMMENT '用户表' ENGINE = INNODB
AUTO_INCREMENT = 2
CHARACTER SET = utf8
COLLATE = utf8_general_ci
ROW_FORMAT = DYNAMIC;
insert into film_user(user_name, user_password, nick_name, sex, birthday, email, phone, address, head_address,
life_state, biography)
values ('admin', '0192023a7bbd73250516f069df18b500', '隔壁泰山', 0, '2018-07-31', 'admin@next.com', '13888888888',
'北京市海淀区朝阳北路中南海国宾馆', 'films/img/head-img.jpg', 0, '没有合适的伞,我宁可淋着雨');
insert into film_user(user_name, user_password, nick_name, sex, birthday, email, phone, address, head_address,
life_state, biography)
values ('jiangzh', '5e2de6bd1c9b50f6e27d4e55da43b917', '阿里郎', 0, '2018-08-20', 'jiangzh@next.com', '13866666666',
'北京市朝阳区大望路万达广场', 'films/img/head-img.jpg', 1, '我喜欢隔壁泰山'); |
-- 자유게시판 : 테이블2개 (메인글저장, 댓글저장)
create table freeboard(
idx int not null auto_increment,
name varchar(30) not null, -- 작성자
password varchar(10) not null, -- 글비밀번호(필요할때만 사용)
subject varchar(40) not null, -- 글제목
content varchar(2000) not null, -- 내용
readCount int default 0, -- 조회수
wdate datetime default current_timestamp, -- 서버의 현재날짜/시간
ip varchar(15) default '127.0.0.1', -- 접속자 ip
commentCount smallint default 0, -- 댓글 개수
primary key(idx)
);
ALTER TABLE freeboard MODIFY COLUMN wdate timestamp
DEFAULT current_timestamp; -- timezone에 따라 설정
insert into freeboard (name,password,subject,content,ip)
values ('honey','1111','웰컴 ~~','하이 반가워','192.168.17.3');
insert into freeboard (name,password,subject,content,ip)
values ('사나','1111','welcome my home ~~','하이 반가워 어서와','192.168.22.3');
insert into freeboard (name,password,subject,content,ip)
values ('나나','1111','굿바이 ~~','잘가 또봐','192.168.23.3');
insert into freeboard (name,password,subject,content,ip)
values ('nayeon','1111','웰컴 ~~','하이 반가워2','192.168.24.3');
insert into freeboard (name,password,subject,content,ip)
values ('박찬호','1111','헬로우~~','운동좀 하자','192.168.25.3');
insert into freeboard (name,password,subject,content,ip)
values ('세리박','1111','하이 ~~','운동하러 가야지','192.168.26.3');
select * from freeboard;
-- mysql 에는 limit 키워드 : limit 번호,개수
-- mysql,oracle select 결과에 대해 각행에 순서대로 번호를 부여하는 컬럼(row num)
-- 이 만들어진다. limit 의 번호는 row num 이다.(mysql 은 0부터 시작)
select * from freeboard f order by idx desc;
select * from freeboard f order by idx desc limit 0,15; -- 1페이지 목록
select * from freeboard f order by idx desc limit 15,15; -- 2페이지 목록
select * from freeboard f order by idx desc limit 30,15; -- 3페이지 목록
-- 계산식 : n=10페이지 글은? (n-1)*15
select * from freeboard f order by idx desc limit 135,15; -- 10페이지 목록
commit;
-- 글 수정 : subject, content 수정. idx 컬럼을 조건으로 한다.
update freeboard set subject ='굿나잇~', content ='잘자고 내일보자'
where idx=154;
-- 조회수 변경 : 읽을 때마다(url 요청 발생) 카운트 +1
update freeboard set readCount = readCount +1 where idx=154;
-- 글 삭제 : 글 비밀번호 1)있을때 2)없을때
delete from freeboard where idx=151 and password ='1111';
delete from freeboard where idx=151;
select * from freeboard order by idx desc limit 0,15;
-- 글 비밀번호 체크(로그인 기능에도 참고)
select * from freeboard f where idx=151 and password ='1212'; -- 잘못된 비밀번호 : 쿼리결과 null
select * from freeboard f where idx=151 and password ='1111'; -- 옳바른 비밀번호 : 쿼리결과 1개 행 조회
-- 댓글 테이블 : board_comment
create table board_comment(
idx int not null auto_increment,
mref int not null, -- 메인글(부모글)의 idx값
name varchar(30) not null, -- 작성자
password varchar(10) not null, -- 글비밀번호(필요할때만 사용)
content varchar(2000) not null, -- 내용
wdate timestamp default current_timestamp, -- 서버의 현재날짜/시간
ip varchar(15) default '127.0.0.1', -- 접속자 ip
primary key(idx),
foreign key(mref) references freeboard(idx)
);
insert into board_comment(mref,name,password,content,ip)
values(154,'다현','1234','오늘 하루도 무사히','192.168.11.11');
insert into board_comment(mref,name,password,content,ip)
values(154,'다현','1234','오늘 하루도 무사히','192.168.11.11');
insert into board_comment(mref,name,password,content,ip)
values(154,'다현','1234','오늘 하루도 무사히','192.168.11.11');
insert into board_comment(mref,name,password,content,ip)
values(147,'다현','1234','오늘 하루도 무사히','192.168.11.11');
-- 1)
insert into board_comment(mref,name,password,content,ip)
values(147,'다현','1234','오늘 하루도 무사히','192.168.11.11');
-- 댓글 개수(글목록에서 필요)
select count(*) from board_comment where mref= 154; -- 154번글의 댓글 갯수
select count(*) from board_comment where mref= 147; -- 172번글의 댓글 갯수
select count(*) from board_comment where mref= 100; -- 100번글의 댓글 갯수(없는것)
-- 2) 댓글 리스트
select * from board_comment where mref = 154;
select * from board_comment where mref = 147;
select * from board_comment where mref = 100;
-- 3) 글목록 실행하는 dao.getList() 보다 앞에서 댓글개수를 update
update freeboard set commentCount=(
select count(*) from board_comment where mref=154) where idx=154;
update freeboard set commentCount=(
select count(*) from board_comment where mref=147) where idx=147;
-- 4) 글상세보기에서 댓글 입력 후 저장할 때
update freeboard set commentCount=commentCount+1 where idx=0; |
/**
* delete BY_KAISHA_ADDRESS_CNG_TGT
* @author HUNGND5
* @version $Id: AddressChangeTargetCreateService_deleteKaishaAddressChangeByDate_Del_01.sql 12995 2014-07-10 07:07:28Z p_guen_fun $
*/
DELETE
BY_KAISHA_ADDRESS_CNG_TGT
WHERE
CHANGE_TARGET_CREATE_DATE =/*changeTargetCreateDate*/'20141202' |
# 4@(#) tExtentData.sql 4.1@(#) 07/09/07 12:22:41
rem This script should be run as system or some other DBA account.
rem
rem This script takes as parameters a database identifier string and
rem a date-time string used to build the filename of the spool file. If
rem you want to have the current date and time you can add
rem `date "+%m%d%y_03/28/06M%S"`
rem as the last parameter on the command line.
rem For Example:
rem sqlplus username/password @full_ext.sql ICRP30 `date "+%m%d%y_03/28/06M%S"`
rem This would give a spool file name of alarm_ICRP30_080895_090500.lst
rem if today's date is 8/8/95 at 9:05am.
rem You should check this file to see the output of this script.
rem Most of the queries in this script are against the dynamic status
rem views and you will need to run this script several times during
rem a working day to get an accurate picture of what is going on in your
rem in your database.
column owner format a12 heading "Owner"
column segment_type format a12 heading "Object|Type"
column tablespace_name format a12 heading "Tablespace"
column segment_name format a20 heading "Object Name"
column sizbytes Heading "Size|(Bytes)"
column sizemegs Heading "Size|(Megs)"
column blks Heading "Blocks"
column extno Heading "No. of|Extents"
set linesize 105
set pagesize 35
clear breaks;
clear computes;
break on segment_type skip 2
compute sum of sizbytes sizemegs blks extno on segment_type;
PROMPT
define cursid = &1
define curdate = &2;
spool ext_&&cursid._&&curdate..lst
select segment_type,tablespace_name,segment_name, count(*) extno,sum(blocks) blks,sum(bytes) sizbytes, sum(bytes) / 1048576 sizemegs
from dba_extents
where owner not in ( 'SYS','SYSTEM')
group by segment_type, tablespace_name,segment_name
order by segment_type, tablespace_name,sizbytes desc;
spool off;
|
# --- !Ups
ALTER TABLE payments ALTER COLUMN source TYPE VARCHAR(256);
ALTER TABLE payments ALTER COLUMN destination TYPE VARCHAR(256);
ALTER TABLE payments ALTER COLUMN status TYPE VARCHAR(10);
ALTER TABLE payments ADD COLUMN source_resolved CHAR(56);
ALTER TABLE payments ADD COLUMN destination_resolved CHAR(56);
ALTER TABLE payments DROP CONSTRAINT payments_status_check;
ALTER TABLE payments ADD CONSTRAINT payments_status_check CHECK (status IN ('pending', 'validating', 'valid', 'invalid', 'submitted', 'failed', 'succeeded'));
# --- !Downs
ALTER TABLE payments ALTER COLUMN source TYPE CHAR(56);
ALTER TABLE payments ALTER COLUMN destination TYPE CHAR(56);
ALTER TABLE payments ALTER COLUMN status TYPE VARCHAR(9);
ALTER TABLE payments DROP COLUMN source_resolved;
ALTER TABLE payments DROP COLUMN destination_resolved;
ALTER TABLE payments DROP CONSTRAINT payments_status_check;
ALTER TABLE payments ADD CONSTRAINT payments_status_check CHECK (status IN ('pending', 'submitted', 'failed', 'succeeded'));
|
INSERT INTO TIMEZONE VALUES ('EST', 0);
INSERT INTO TIMEZONE VALUES ('PST', 3);
INSERT INTO TIMEZONE VALUES ('CST', 1);
INSERT INTO TIMEZONE VALUES ('MST', 2);
INSERT INTO TIMEZONE VALUES ('HAT', 4);
|
-- this is a single line comment
/* This is a multi-
line comment!
*/
DROP DATABASE IF EXISTS animals_db;
CREATE DATABASE IF NOT EXISTS animals_db; |
------------------------------------------------------------
-- 产品类型
-- S_BL_PRDCDE
------------------------------------------------------------
DROP TABLE S_BL_PRDCDE;
-- 创建补录表单
CREATE TABLE S_BL_PRDCDE
(
PRDCDE VARCHAR2(12) NOT NULL ,
DESCRIPTION VARCHAR2(30) NULL
);
-- 删除注册信息
DELETE FROM CD_FDW_STRUCTURE WHERE TABLE_NAME IN ('S_BL_PRDCDE') AND OBJECT_TYPE = 'TABLE';
DELETE FROM CD_FDW_STRUCTURE WHERE TABLE_NAME = 'PK_S_BL_PRDCDE' AND OBJECT_TYPE = 'INDEX';
-- 创建成普通表
EXEC PACK_FERMAT.CREATE_TABLE('S_BL_PRDCDE','ADMIN','F','');
-- 标识成客制化表
UPDATE CD_FDW_STRUCTURE SET STANDARD_CUSTOM='C' WHERE TABLE_NAME IN ('S_BL_PRDCDE');
-- 更新DMM
EXEC PACK_DB_OBJECT.INITIALIZE_TABLE_COLUMNS('S_BL_PRDCDE');
-- 重建表为分区表
EXEC PACK_DDL.CHANGE_TABLE_TYPE('S_BL_PRDCDE','DATA');
-- 定义Policy
EXEC PACK_INSTALL.PARTITION_DEFINE_POLICIES('S_BL_PRDCDE');
EXEC PACK_DDL.RECREATE_TABLE('S_BL_PRDCDE');
-- 定义主键与建立索引
INSERT INTO CD_FDW_STRUCTURE (TABLE_NAME,TABLE_TYPE,HIST_TABLE_NAME,OBJECT_TYPE, STANDARD_CUSTOM, INIT_MODE, PARAMETER)
VALUES ('PK_S_BL_PRDCDE', 'PRIMARY', 'S_BL_PRDCDE', 'INDEX', 'C', 'L', 'PARTITION_KEY,PRDCDE');
CALL PACK_DDL.REBUILD_INDEX('S_BL_PRDCDE','PK_S_BL_PRDCDE');
-- 更新DMM
EXEC PACK_DB_OBJECT.INITIALIZE_TABLE_COLUMNS('S_BL_PRDCDE');
COMMIT;
|
-- MySQL dump 10.13 Distrib 8.0.16, for Win64 (x86_64)
--
-- Host: localhost Database: mydb
-- ------------------------------------------------------
-- Server version 8.0.16
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
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 `assigned`
--
DROP TABLE IF EXISTS `assigned`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `assigned` (
`project_id` int(11) NOT NULL,
`user_account_id` int(11) NOT NULL,
`sub_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `assigned`
--
LOCK TABLES `assigned` WRITE;
/*!40000 ALTER TABLE `assigned` DISABLE KEYS */;
/*!40000 ALTER TABLE `assigned` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `project`
--
DROP TABLE IF EXISTS `project`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `project` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`project_description` varchar(333) NOT NULL,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`status` varchar(45) NOT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_USR` (`user_id`),
CONSTRAINT `FK_USR` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `project`
--
LOCK TABLES `project` WRITE;
/*!40000 ALTER TABLE `project` DISABLE KEYS */;
INSERT INTO `project` VALUES (8,'project management','this is my first project','2019-08-09','2020-01-23','Pending',66),(10,'fitness tracker','fitness tracker','2019-08-15','2020-01-30','Pending',65);
/*!40000 ALTER TABLE `project` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `role`
--
DROP TABLE IF EXISTS `role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `role_name` (`role_name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!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,'admin'),(5,'developer'),(2,'manager'),(4,'team leader');
/*!40000 ALTER TABLE `role` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sub_task`
--
DROP TABLE IF EXISTS `sub_task`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `sub_task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`description` varchar(45) NOT NULL,
`priority` int(11) NOT NULL,
`status` varchar(45) NOT NULL,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`task_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_TASK_USERID` (`user_id`),
KEY `FK_TASKID` (`task_id`),
CONSTRAINT `FK_TASKID` FOREIGN KEY (`task_id`) REFERENCES `task` (`id`),
CONSTRAINT `FK_TASK_ID` FOREIGN KEY (`user_id`) REFERENCES `task` (`id`),
CONSTRAINT `FK_TASK_USER` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `FK_TASK_USERID` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sub_task`
--
LOCK TABLES `sub_task` WRITE;
/*!40000 ALTER TABLE `sub_task` DISABLE KEYS */;
/*!40000 ALTER TABLE `sub_task` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `task`
--
DROP TABLE IF EXISTS `task`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(333) NOT NULL,
`description` varchar(45) DEFAULT NULL,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`status` varchar(45) NOT NULL,
`project_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_projectId` (`project_id`),
KEY `FK_USERID` (`user_id`),
CONSTRAINT `FK_USERID` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `FK_projectId` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `task`
--
LOCK TABLES `task` WRITE;
/*!40000 ALTER TABLE `task` DISABLE KEYS */;
INSERT INTO `task` VALUES (6,'login page','login page and api integration.','2019-08-06','2020-01-22','Pending',8,71),(16,'register page','this is registartion page','2019-08-06','2020-01-22','Pending',8,72);
/*!40000 ALTER TABLE `task` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `user` (
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`contact` varchar(255) DEFAULT NULL,
`email` varchar(100) NOT NULL,
`address` varchar(300) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`date_of_birth` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES ('jay','Patel','8349443847','jay@gmail.com','indore',62,NULL),('sonali','gupta','1234567890','sonali@gmail.com','pune',65,NULL),('hemlata','Patel','1234567890','hems@gmail.com','Indore',66,NULL),('bhupendra','janghel','9988776655','bhupi@gmail.com','Indore',67,NULL),('rohit','patel','1234567890','rohit@gmail.com','Indore',71,NULL),('kiran','kiran','6874664566','kiran@gmail.com','bangalore',72,NULL),('arindam','banerjee','5986955660','arindam@gmail.com','kolkata',73,NULL),('neha','joshi','1234567890','neha@gmail.com','Indore',74,NULL);
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_account`
--
DROP TABLE IF EXISTS `user_account`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `user_account` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(45) NOT NULL,
`password` varchar(100) NOT NULL,
`user_id` int(11) NOT NULL,
`role_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username_UNIQUE` (`username`),
KEY `FK_USERID1` (`user_id`),
KEY `role_id` (`role_id`),
CONSTRAINT `FK_USERID1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `user_account_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_account`
--
LOCK TABLES `user_account` WRITE;
/*!40000 ALTER TABLE `user_account` DISABLE KEYS */;
INSERT INTO `user_account` VALUES (4,'jay@gmail.com','$2a$10$E306FhjMkGhuJPIS9EO5LeI8MA8CgpVtQm885DBW6OonpaIzG66XC',62,1),(7,'sonali@gmail.com','$2a$10$LZAYPLSJ/82zwwXI/j3hT.N81UBqR4.wLjM6qNNs9Mj1rchTAd1WK',65,2),(8,'hems@gmail.com','$2a$10$XKUaWEr6AYhwbKr3YOwBSezjPRhAA09RA5RKblm3YmD/lSuJLPKu6',66,2),(9,'bhupi@gmail.com','$2a$10$5I3gGzv3LY5jM0cX/GPu0.7t4eARyBo.dw6pRtwQpy1HBxQuItYL2',67,2),(13,'rohit@gmail.com','$2a$10$XgxiHDjz3eNp0kSGYcOb0O0iE4LMmmA8lfRwJ36eUPGs1qWJhqQPC',71,4),(14,'kiran@gmail.com','$2a$10$DOrWoFQr4FJo0C4QM5xp1OiaxvsGKY8wYQaXtJIjC90SUY0fwEBgq',72,4),(15,'arindam@gmail.com','$2a$10$FtOw/xMMg1DbMvJLGKQuOOGXKOfIA29BbdeN8E8PlEAOf5SS6ikvC',73,4),(16,'neha@gmail.com','$2a$10$xQKpUf2PjlepRwjsh/jHoOM00ryAzxWLvnZNcIA1kdLSsUJ2TujJa',74,5);
/*!40000 ALTER TABLE `user_account` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-08-05 15:08:48
|
use vk;
ALTER TABLE users ADD created_at varchar(50) AFTER phone;
ALTER TABLE users ADD updated_at varchar(50) AFTER created_at;
-- задача 1: заполнение колонок created_at и updated_at данными
UPDATE users SET created_at = now();
UPDATE users SET updated_at = now();
-- задача 2: изменение типа данных с varchar на datetime
-- задача 2:способ 1: с промежуточными колонками
ALTER TABLE users ADD created_at_date datetime ;
ALTER TABLE users ADD updated_at_date datetime ;
-- 2020-04-02 15:39:13
UPDATE users SET created_at_date = str_to_date(created_at, '%Y-%m-%d %H:%i:%s');
UPDATE users SET updated_at_date = str_to_date(updated_at, '%Y-%m-%d %H:%i:%s');
ALTER TABLE users MODIFY created_at datetime ;
ALTER TABLE users MODIFY updated_at datetime ;
UPDATE users SET created_at = created_at_date;
UPDATE users SET updated_at = updated_at_date;
ALTER TABLE users DROP COLUMN created_at_date;
ALTER TABLE users DROP COLUMN updated_at_date;
-- задача 2:способ 2: сразу поменять тип данных - но нет уверенности, что будет работать всегда как надо.
ALTER TABLE users MODIFY created_at datetime ;
ALTER TABLE users MODIFY updated_at datetime ; |
--procedure
@@p_reCreateIOT.prc
@@p_ImpData2IOT.prc
--
exec p_reCreateIOT;
@@IOT_Tables.sql
exec p_ImpData2IOT;
@@CreateTrigger.sql
|
-- First create a database titled 'habit-breaker'
--CREATE DATA TABLES
CREATE TABLE "users" (
"id" SERIAL PRIMARY KEY,
"username" VARCHAR (80) UNIQUE NOT NULL,
"password" VARCHAR (1000) NOT NULL
);
CREATE TABLE "user_profiles" (
"id" SERIAL PRIMARY KEY,
"user_id" INT REFERENCES users ON DELETE CASCADE,
"email" VARCHAR (120),
"zip_code" INT,
"phone_number" INT,
"profile_pic" VARCHAR (1000)
);
CREATE TABLE "categories" (
"id" SERIAL PRIMARY KEY,
"user_id" INT REFERENCES users ON DELETE CASCADE,
"category" VARCHAR (120) NOT NULL
);
CREATE TABLE "habits" (
"id" SERIAL PRIMARY KEY,
"user_id" INT REFERENCES users ON DELETE CASCADE,
"habit" VARCHAR (1000) NOT NULL,
"category_id" INT REFERENCES categories ON DELETE CASCADE,
"mute_status" BOOLEAN DEFAULT false
);
CREATE TABLE "habit_occurrences" (
"id" SERIAL PRIMARY KEY,
"habit_id" INT REFERENCES habits ON DELETE CASCADE,
"date" DATE,
"time" TIME
);
-- CREATE DEFAULT CATEGORIES
INSERT INTO "categories" ("user_id", "category")
VALUES (null, 'Swear Word');
INSERT INTO "categories" ("user_id", "category")
VALUES (null, 'Speech Filler');
INSERT INTO "categories" ("user_id", "category")
VALUES (null, 'Political Correctness');
INSERT INTO "categories" ("user_id", "category")
VALUES (null, 'Other');
-- TESTS
SELECT habits.id, category.categories FROM "habits"
JOIN "categories" ON "categories"."id"="habits"."category_id";
SELECT "habits".*, "categories"."category" FROM "habits"
JOIN "categories" ON "habits"."category_id" = "categories"."id"
WHERE "habits"."user_id" = 1;
INSERT INTO "habit_occurrences" ("habit_id", "date", "time")
VALUES (5, '2018-10-24', '05:30');
SELECT "habit_occurrences".* FROM "habit_occurrences"
WHERE (date BETWEEN '2013-01-03' AND '2019-01-09')
AND habit_id = 5;
SELECT "habit_occurrences".*, "habits"."habit" FROM "habit_occurrences"
JOIN "habits" ON "habit_occurrences"."habit_id" = "habits"."id"
WHERE (date BETWEEN '2013-01-03' AND '2019-01-09')
AND habit_id = 3;
SELECT "habits".*, "categories"."category" FROM "habits"
JOIN "categories" ON "habits"."category_id" = "categories"."id"
WHERE "habits"."user_id" = 1;
DELETE FROM habits WHERE id=6;
-- SAMPLE DATA
|
If(db_id(N'aspnet_learning') IS NULL)
BEGIN
CREATE DATABASE aspnet_learning;
END; |
------------------- load place ----------------------------------
select * from seatbooking
// select vs điều kiện chuyến vs ngày đi xem nào
select place_id,place_name,place_pv_id from place
------------------- tìm kiếm chuyến xe theo địa điểm đến, địa điểm đi, thời gian đi, ngày đi--------------------
select a.acc_name, t.trip_id ,p.place_name,p1.place_name,t.trip_start_time, t.trip_start_date from trip t
inner join place p on p.place_id=t.trip_start_place and t.trip_start_date='2019/10/29' and t.trip_start_time='17:30'
inner join place p1 on p1.place_id=t.trip_end_place
inner join province d on p.place_pv_id= d.province_id and p.place_name like N'%Hà Nội%'
inner join province d1 on p1.place_pv_id=d1.province_id and p1.place_name like N'%Đà Nẵng%'
inner join bus b on b.bus_id=t.trip_bus_id
inner join business bs on b.bus_bs_id=bs.bs_id
inner join account a on bs.bs_acc_mail=a.acc_mail
------------------- end tìm kiếm chuyến xe theo địa điểm đến, địa điểm đi, thời gian đi, ngày đi--------------------
select * from Place
select t.trip_id, t.trip_bus_id,bs.bs_id, a.acc_name,p.place_name,p1.place_name, t.trip_start_time,t.trip_end_time, t.trip_price,t.trip_status from trip t
inner join place p on p.place_id=t.trip_start_place and p.place_name like N'%Đắk Lắk%'
inner join place p1 on p1.place_id=t.trip_end_place and p1.place_name like N'%Đà Nẵng%' and t.trip_start_time='17:30'
inner join bus b on b.bus_id=t.trip_bus_id
inner join business bs on b.bus_bs_id=bs.bs_id
inner join account a on bs.bs_acc_mail=a.acc_mail
------------------- end tìm kiếm chuyến xe theo địa điểm đến, địa điểm đi--------------------
select * from Place
select bs.bs_id,a.acc_name, p.place_name,p1.place_name, COUNT(acc_name) from trip t
inner join place p on p.place_id=t.trip_start_place
inner join place p1 on p1.place_id=t.trip_end_place
inner join bus b on b.bus_id=t.trip_bus_id
inner join business bs on b.bus_bs_id=bs.bs_id
inner join account a on bs.bs_acc_mail=a.acc_mail
where p1.place_name not in(N'Đà Nẵng')
group by p1.place_name,p.place_name, acc_name, bs.bs_id
order by p1.place_name asc
-----------------------------------
select * from trip t
select * from bus
select * from business
inner join place p1 on p1.place_id=t.trip_end_place
where p1.place_name not in(N'Đà Nẵng')
group by p1.place_name
--------------- check login------------------
select acc_mail,acc_password from account where acc_mail like 'admin@gmail.com.vn' and acc_password like '123456';
select * from province
select * from trip
select * from business
-------------load seat -------------------------
select * from account
select seatb_id,seatb_trip_id,seatb_user_mail,seatb_name,seatb_date from seatbooking where seatb_trip_id=1
select seatb_trip_id,seatb_start_date,seatb_user_mail,seatb_name,seatb_date from seatbooking
truncate table seatbooking
--------------------- insert account ----------------------
insert into account (acc_mail, acc_password, acc_phone, acc_name, acc_role_id) values('','','',N'',3)
---------------------- check duplicate -----------------
select * from account where acc_mail like N'admin@gmail.com.vn'
------------------------- inssert thong tin khach hang.--------------------=N'
select acc_name, acc_mail, acc_phone, acc_password from account where acc_name=N'Administrator'
update account set acc_name=N'', acc_phone='', acc_address=N'' where
------------------ get list trip by id business and startdate
select t.trip_id, t.trip_bus_id, a.acc_name,p.place_name,p1.place_name,t.trip_start_date, t.trip_start_time, t.trip_end_time, t.trip_price from trip t
inner join place p on p.place_id=t.trip_start_place
inner join place p1 on p1.place_id=t.trip_end_place
inner join province d on p.place_pv_id= d.province_id
inner join province d1 on p1.place_pv_id=d1.province_id
inner join bus b on b.bus_id=t.trip_bus_id
inner join business bs on b.bus_bs_id=bs.bs_id and bs.bs_id=5 and trip_start_date='2019-11-16'
inner join account a on bs.bs_acc_mail=a.acc_mail
---------------------------
select acc_mail,acc_password,acc_name,acc_role_id from account where acc_mail= and acc_password=
select * from account
select * from business
select seatb_trip_id,seatb_start_date,seatb_user_mail, count(*)as total
from seatbooking where seatb_user_mail='fastbuscompany@gmail.com'
group by seatb_trip_id,seatb_start_date,seatb_user_mail order by seatb_start_date desc
select * from seatbooking
select * from seatbooking where seatb_user_mail='fastbuscompany@gmail.com' and seatb_start_date='2019-12-03' and seatb_trip_id=105 order by seatb_name asc
select acc_name,acc_mail,acc_role_id,b.bs_id from account a
inner join business b on a.acc_mail=b.bs_acc_mail
select * from trip where trip_id=105
select * from bus where bus_id=18
select * from business where bs_id=7
select * from seatbooking
select seatb_id, seatb_trip_id,a.acc_name,p.place_name,p1.place_name, seatb_name, seatb_date, seatb_start_date,t.trip_price from seatbooking s
inner join trip t on t.trip_id=s.seatb_trip_id and seatb_trip_id=105 and seatb_status=0
inner join place p on t.trip_start_place=p.place_id and seatb_start_date='2019-12-20'
inner join place p1 on t.trip_end_place=p1.place_id
inner join account a on s.seatb_user_mail = a.acc_mail and seatb_user_mail='fastbuscompany@gmail.com'
order by seatb_name asc
where seatb_user_mail=? and seatb_start_date=? and seatb_trip_id=? order by seatb_name asc
select seatb_trip_id,s.seatb_start_date,s.seatb_user_mail,count(*) from seatbooking s
inner join trip t on t.trip_id=s.seatb_trip_id and s.seatb_status=0
inner join bus b on t.trip_bus_id=b.bus_id
inner join business bs on b.bus_bs_id= bs.bs_id and bs.bs_acc_mail='mailinh@gmail.com.vn'
inner join account a on s.seatb_user_mail=a.acc_mail
group by seatb_trip_id,seatb_user_mail,s.seatb_start_date
order by s.seatb_start_date desc
select seatb_id,seatb_trip_id,seatb_user_mail,seatb_name,seatb_date,seatb_start_date from seatbooking where seatb_trip_id= 105 and seatb_start_date= '2019-12-03'
select * from account
select seatb_trip_id,seatb_start_date,seatb_user_mail, count(*) as 'total'
from seatbooking where seatb_user_mail= 'fastbuscompany@gmail.com'
group by seatb_trip_id,seatb_start_date,seatb_user_mail order by seatb_start_date desc
select seatb_trip_id,seatb_start_date,seatb_user_mail, count(*) as 'total' from seatbooking s
inner join trip t on t.trip_id=s.seatb_trip_id and t.trip_start_time ='17:00:00' and seatb_start_date='2019-12-3'
group by seatb_user_mail,seatb_start_date,seatb_trip_id
-----------------------------------------------
select b.bus_id,b.bus_license from bus b inner join business bs on bs.bs_id=b.bus_bs_id and bs.bs_acc_mail='mailinh@gmail.com.vn'
select trip_start_place,trip_end_place,trip_bus_id,trip_price,trip_start_time,trip_end_time,trip_status from trip
--------------------------------------------------------
select t.trip_id, t.trip_bus_id,bs.bs_id, a.acc_name,p.place_name,p1.place_name, t.trip_start_time,t.trip_end_time, t.trip_price,t.trip_status from trip t
inner join place p on p.place_id=t.trip_start_place and p.place_name like N'%Đắk Lắk%'
inner join place p1 on p1.place_id=t.trip_end_place and p1.place_name like N'%Đà Nẵng%' and t.trip_start_time <> '17:30:00'
inner join bus b on b.bus_id=t.trip_bus_id
inner join business bs on b.bus_bs_id=bs.bs_id
inner join account a on bs.bs_acc_mail=a.acc_mail
select * from trip
delete from trip where trip_id=120
update trip set trip_status=1 where trip_id=105
select trip_id, trip_bus_id,trip_status from where trip_start_place in(select place_id from place where place_name in (N'Đà Nẵng', N'Đắk Lắk') )
and trip_end_place in (select place_id from place where place_name in (N'Đà Nẵng', N'Đắk Lắk') ) and trip_start_time='17:00:00'
place
select seatb_id,seatb_name,seatb_status from seatbooking where seatb_trip_id=105 and seatb_name in ('A6','A5') and seatb_start_date='2019-12-03'
update trip set trip_price=10000 where trip_id=105
select * from business
select t.trip_id,(COUNT(*)*t.trip_price) from seatbooking s
inner join trip t on s.seatb_trip_id =t.trip_id and s.seatb_start_date>=getdate()
inner join bus b on t.trip_bus_id=b.bus_id and s.seatb_status=1
inner join business bs on bs.bs_id =b.bus_bs_id and bs.bs_acc_mail='mailinh@gmail.com.vn'
group by t.trip_id, t.trip_price
select COUNT(*) from seatbooking s
inner join trip t on s.seatb_trip_id =t.trip_id and s.seatb_start_date='2019-12-03'
inner join bus b on t.trip_bus_id=b.bus_id and s.seatb_status=1
inner join business bs on bs.bs_id =b.bus_bs_id and bs.bs_acc_mail='mailinh@gmail.com.vn'
select COUNT(*) as 'total' from bus b
inner join business bs on bs.bs_id =b.bus_bs_id and bs.bs_acc_mail='mailinh@gmail.com.vn'
select COUNT(*) as 'total' from seatbooking s
inner join trip t on s.seatb_trip_id =t.trip_id and s.seatb_start_date<=getdate()
inner join bus b on t.trip_bus_id=b.bus_id and s.seatb_status=0
inner join business bs on bs.bs_id =b.bus_bs_id and bs.bs_acc_mail='mailinh@gmail.com.vn'
select b.bs_id,b.bs_acc_mail,a.acc_name,a.acc_phone,b.bs_address,b.bs_pv_id,b.bs_dt_id,b.bs_ward_id,b.bs_description from business b
inner join account a on b.bs_acc_mail=a.acc_mail
and b.bs_acc_mail='mailinh@gmail.com.vn'
select * from images
update business set bs_address='', bs_pv_id='',bs_dt_id='', bs_ward_id='', bs_description='' where bs_acc_mail=''
select * from images
insert into images (img_name,img_bs_id) values('sdfdsfsdf',9)
select * from seatbooking
select MONTH(s.seatb_start_date),(COUNT(*)*t.trip_price) from seatbooking s
inner join trip t on s.seatb_trip_id =t.trip_id and s.seatb_start_date>=getdate()
inner join bus b on t.trip_bus_id=b.bus_id and s.seatb_status=1
inner join business bs on bs.bs_id =b.bus_bs_id and bs.bs_acc_mail='mailinh@gmail.com.vn'
group by MONTH(s.seatb_start_date), t.trip_price
select bus_id,bus_license,bus_color,bus_menu,b from bus where bus_bs_id=7
select * from pickup_place
insert into bus(bus_license,bus_bt_id,bus_bs_id,bus_color,bus_menu) values('47k8-2019',3,7,'xanh','huynhdai')
select p.place_id ,p.place_name,pp.place_name from pickup_place p
inner join place pp on pplace_id =pp.place_id and business_id=7
select acc_mail,acc_password,acc_name, acc_role_id from account |
select s.sid, s.firstname, s.lastname, ca.clubid, ca.name, fa.name
From Student s, Course c, Faculty fa, Register rg, teach t, clubadviser ca
where s.sid=rg.sid and rg.cid=c.cid and c.cid=t.cid and t.fid=fa.fid and fa.fid=ca.fid;
|
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 27, 2018 at 06:50 PM
-- Server version: 10.1.26-MariaDB
-- PHP Version: 7.1.8
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: `paymate`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`type` varchar(50) NOT NULL,
`creation_date` datetime NOT NULL,
`updation_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `name`, `email`, `password`, `type`, `creation_date`, `updation_date`) VALUES
(16, 'Rahul', 'rahul.kumar@gmail.com', 'Gaurav1', '', '0000-00-00 00:00:00', '2018-04-27 09:57:37'),
(17, 'asfasdfadsf', 'asdf@adsfl.com', '123456', '', '0000-00-00 00:00:00', '2018-04-27 09:57:37'),
(18, 'Gaurav', 'rahul.kumar1@gmail.com', '123456', '', '0000-00-00 00:00:00', '2018-04-27 09:57:37'),
(19, 'rohit', 'rohit@gmail.com', '123456', '', '0000-00-00 00:00:00', '2018-04-27 09:57:37'),
(20, 'gaurav', 'gaurav@gmail.com', 'gaurav1', 'normal', '2018-04-27 05:11:21', '2018-04-27 10:41:21'),
(21, 'gaurav', 'gaurav1@gmail.com', 'gaurav1', 'normal', '2018-04-27 05:12:23', '2018-04-27 10:42:23'),
(22, 'asdfl', 'adf@dgmail.com', 'gaurav', 'normal', '2018-04-27 05:13:31', '2018-04-27 10:43:31'),
(23, 'test', 'test@gmail.com', 'testing1', 'normal', '2018-04-27 05:20:01', '2018-04-27 10:50:01'),
(24, 'alsdjf', 'gab@gmail.com', '123456', '', '0000-00-00 00:00:00', '2018-04-27 11:06:47'),
(25, 'gaurav', 'kapill@gmail.com', '123456', '', '0000-00-00 00:00:00', '2018-04-27 11:08:31'),
(26, 'gaurav', 'gaurav22@gmail.com', '123456', '', '0000-00-00 00:00:00', '2018-04-27 11:14:55'),
(27, 'Gaurav', 'adf121212@dgmail.com', '123456', '', '0000-00-00 00:00:00', '2018-04-27 21:41:58');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;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 PROC [ERP].[Usp_Sel_ListaPrecio_By_Empresa]
@IdEmpresa INT
AS
BEGIN
SELECT
ID,
Nombre
FROM ERP.ListaPrecio
WHERE FlagBorrador = 0 AND Flag = 1 AND IdEmpresa = @IdEmpresa
END |
select user_id
from (
select distinct user_id
from core_action
left join core_unsubscribeaction
on core_unsubscribeaction.action_ptr_id = core_action.id
where year(core_action.created_at) = 2021
and month(core_action.created_at) = 1
) as now_users
where user_id in (
select distinct user_id
from core_action
left join core_unsubscribeaction
on core_unsubscribeaction.action_ptr_id = core_action.id
where year(core_action.created_at) = 2020
and month(core_action.created_at) = 12
) # 3932 count
# 692018
# 704201
# 2862
# 2346
# 5252
# 686834
# 630995
# 7212 |
select last_name, salary, trunc(salary * 1.1)
from employees
where commission_pct is null
fetch first 5 percent rows only;
|
-- phpMyAdmin SQL Dump
-- version 4.2.12deb2
-- http://www.phpmyadmin.net
--
-- Хост: localhost
-- Час створення: Сер 02 2015 р., 14:05
-- Версія сервера: 5.6.25-0ubuntu0.15.04.1
-- Версія PHP: 5.6.4-4ubuntu6.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- База даних: `zvit`
--
-- --------------------------------------------------------
--
-- Структура таблиці `blanks`
--
CREATE TABLE IF NOT EXISTS `blanks` (
`id` int(3) NOT NULL,
`code` varchar(8) NOT NULL,
`name` varchar(250) NOT NULL,
`face` int(1) NOT NULL,
`period` int(1) DEFAULT NULL,
`start_date` date DEFAULT NULL,
`end_date` date DEFAULT NULL,
`parent` int(3) NOT NULL,
`category` int(2) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `blanks`
--
INSERT INTO `blanks` (`id`, `code`, `name`, `face`, `period`, `start_date`, `end_date`, `parent`, `category`) VALUES
(1, 'F0103304', 'Податкова декларація платника єдиного податку - Фізичної особи-підприємця', 1, NULL, NULL, NULL, 0, 2),
(2, 'F0500105', 'Форма № 1 ДФ Податковий розрахунок сум доходу, нарахованого (сплаченого) на користь платників податку, і сум утриманого з них податку', 1, NULL, NULL, NULL, 0, 7),
(3, 'J0500105', 'Форма № 1 ДФ Податковий розрахунок сум доходу, нарахованого (сплаченого) на користь платників податку, і сум утриманого з них податку', 2, NULL, NULL, NULL, 0, 7),
(4, 'E04T00I', 'Додаток 4 до Порядку формування та подання страхувальниками звіту щодо сум нарахованого єдиного внеску на загальнообов''язкове державне соціальне страхування', 3, NULL, NULL, NULL, 0, 5),
(5, 'E04T01I', 'Таблиця 1. Нарахування єдиного внеску', 3, NULL, NULL, NULL, 4, 5),
(6, 'E04T06I', 'Таблиця 6. Відомості про нарахування заробітної плати (доходу) застрахованим особам', 3, NULL, NULL, NULL, 4, 5);
--
-- Індекси збережених таблиць
--
--
-- Індекси таблиці `blanks`
--
ALTER TABLE `blanks`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для збережених таблиць
--
--
-- AUTO_INCREMENT для таблиці `blanks`
--
ALTER TABLE `blanks`
MODIFY `id` int(3) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
/*!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 */;
|
### Schema
USE al5izr8ypgniv3n3;
CREATE TABLE burgers(
id int NOT NULL AUTO_INCREMENT,
burger_name VARCHAR (255) NOT NULL,
devoured BOOL default false,
date TIMESTAMP,
PRIMARY KEY(id)
);
|
-- ---------------------------------------------------
-- Part 3: Validation
-- ---------------------------------------------------
use twitter;
-- Q1. For each user, count the number of followers. Don’t include followers with a hidden
-- profile. Rank in descending order by the number of followers.
select name, Followers
from
(
select followee_id, count(follower_id) as 'Followers'
from follows inner join users on (follower_id = users.user_id)
where users.is_hidden = 0
group by followee_id
) as t1 inner join users on (users.user_id = Followee_id)
order by Followers desc, name;
-- Q2. For one user, list the five most recent tweets by any other user that your chosen user
-- follows. (This is known as the user’s “home timeline.”)
select post as 'Tweets', handle
from
(
select followee_id
from follows
where follower_id = 1
) as t1 join tweets on (tweets.user_id = t1.followee_id) join users on (users.user_id = tweets.user_id)
order by tweets.timestamp desc, name
limit 5;
-- Q3. What are the most popular “trending” hashtags by organizations over the last 30 days?
select name as 'Top_10_Trending_Hashtags_of_the_month'
from
(
select hash_id, count(tweets.tweet_id) as 'Uses'
from hashtags_in_tweets join tweets on (tweets.tweet_id = hashtags_in_tweets.tweet_id)
join users on (tweets.user_id = users.user_id)
where tweets.timestamp between date_sub(now(), interval 30 day) and now()
and users.is_person = 0
group by hash_id
limit 10
) as t1, hashtag
where t1.hash_id = hashtag.hash_id
order by Uses desc,Top_10_Trending_Hashtags_of_the_month;
-- Q4. If I was trying to find recommendations of users that I should follow I might ask Twitter
-- to find me the following: Show me users that post tweets containing hashtags that
-- match my interests. Rank candidate users by the number of tweets they have posted
-- containing one or more of my interests
select name
from
(
select hashtags_in_tweets.tweet_id as 'T_id'
from
(
select hash_id
from `interests`
where user_id = 2
) as t1, hashtags_in_tweets
where t1.hash_id = hashtags_in_tweets.hash_id
) as t2, users, tweets
where tweets.tweet_id = T_id and tweets.user_id = users.user_id
group by tweets.user_id
order by count(tweets.tweet_id) desc, name;
-- Q5. Pick a user. Find all the people / organizations followed by that user. (We call these the
-- followees of that user – not to be confused with the followers of that user – the
-- followers of the user all have the user as a followee!) So if Ann follows Bob, Ann is Bob’s
-- follower and Bob is Ann’s followee. NOW that we have all the followees of a user, find
-- all of the people / organizations that the followees follow – i.e., the followees of the
-- followees. For full credit, count the number of times that each followee appears in the
-- list.
select name as 'Followers_of_Followers', count(*) as 'Occourences'
from
(
select followee_id as 'Followees'
from follows
where follower_id = 1
)as t1, follows, users
where follows.Follower_id = Followees and Followee_id = users.user_id
group by Followers_of_Followers;
|
CREATE TABLE [Register].[Workshops] (
[IdWorkshop] UNIQUEIDENTIFIER CONSTRAINT [DEF_RegisterWorkshopsIdWorkshop] DEFAULT (newsequentialid()) ROWGUIDCOL NOT NULL,
[IdPerson] UNIQUEIDENTIFIER NOT NULL,
[Description] VARCHAR (MAX) NULL,
CONSTRAINT [PK_RegisterWorkshops] PRIMARY KEY CLUSTERED ([IdWorkshop] ASC),
CONSTRAINT [FK_RegisterPeopleIdPersonRegisterWorkshopsIdPerson] FOREIGN KEY ([IdPerson]) REFERENCES [Register].[People] ([IdPerson]),
CONSTRAINT [UNQ_RegisterWorkshopsIdPerson] UNIQUE NONCLUSTERED ([IdPerson] ASC)
);
|
select
org.id,
coalesce(org.edrpou,'') as edrpou,
coalesce(org.inn,'') as inn,
coalesce(org.caption,'') as caption,
coalesce(ooi."name", '') as "name"
from org_organization as org
join org_organization_info ooi
on ooi.organization_id = org.id
and ooi.is_actual_info = true
and ooi.type = 'PRL'
where org.record_state <> 4 |
SELECT *
FROM achievements; |
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/01-Mapfre_Seguros.png'),
'Mapfre Seguros'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/02-Banesco_Seguros.jpg'),
'Banesco Seguros'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/03-Mercantil_Seguros.jpg'),
'Mercantil Seguros'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/04-Seguros_La_Previsora.png'),
'Seguros La Previsora'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/05-Seguros_Caracas_de_Liberty_Mutual.jpg'),
'Seguros Caracas de Liberty Mutual'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/06-Seguros_Horizonte.jpg'),
'Seguros Horizonte'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/07-Seguros_Universitas.png'),
'Seguros Universitas'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/08-Seguros_Qualitas.png'),
'Seguros Qualitas'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/09-Seguros_La_Occidental.jpg'),
'Seguros La Occidental'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/10-Seguros_Piramide.png'),
'Seguros Pirámide'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/11-Seguros_Altamira.png'),
'Seguros Altamira'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/12-Multinacional_de_Seguros.jpg'),
'Multinacional de Seguros'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/13-Seguros_Constitucion.png'),
'Seguros Constitución'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/14-Zurich_Insurance_Group.jpg'),
'Zurich Insurance Group'
);
INSERT INTO Aseguradora (
id,logo,nombre)
VALUES (
DEFAULT,
BFILENAME('DIR_IMG_PROYECTO','aseguradora/15-MetLife.png'),
'MetLife'
); |
CREATE TABLE name_table (StudentID VARCHAR(5), Name VARCHAR(10));
CREATE TABLE mark_table (StudentID VARCHAR(5), Mark INT(3));
INSERT INTO name_table (StudentID, Name) VALUES ('V001', 'Abe');
INSERT INTO name_table (StudentID, Name) VALUES ('V002', 'Abay');
INSERT INTO name_table (StudentID, Name) VALUES ('V003', 'Acelin');
INSERT INTO name_table (StudentID, Name) VALUES ('V004', 'Adelphos');
INSERT INTO mark_table (StudentID, Mark) VALUES ('V001', 95);
INSERT INTO mark_table (StudentID, Mark) VALUES ('V002', 80);
INSERT INTO mark_table (StudentID, Mark) VALUES ('V003', 74);
INSERT INTO mark_table (StudentID, Mark) VALUES ('V004', 81);
select name_table.StudentID, name_table.Name
from name_table
INNER JOIN mark_table on mark_table.StudentID=name_table.StudentID
WHERE mark_table.Mark > (select (Mark) from mark_table where StudentID = 'V002'); |
--patterns view_name_view
--exe 01
CREATE OR REPLACE VIEW view_pedido
AS SELECT num_pedido, cod_cliente, prazo_entrega
FROM pedido
--exe 02
CREATE OR REPLACE VIEW view_produto
AS SELECT *
FROM produto
WHERE unidade = 'kg'
--exe 03
CREATE OR REPLACE VIEW view_valor
AS SELECT *
FROM produto
WHERE valor_unitario < ( SELECT AVG(valor_unitario) FROM produto)
--exe 04
CREATE OR REPLACE VIEW view_valor
AS SELECT v.cod_vendedor, v.nome_vendedor, COUNT(p.cod_vendedor) as Qtde_Vendas
FROM vendedor v
INNER JOIN pedido p
ON p.cod_vendedor = v.cod_vendedor
GROUP BY v.cod_vendedor, v.nome_vendedor;
|
DROP TABLE IF EXISTS stock_histories CASCADE;
CREATE TABLE stock_histories (
id serial PRIMARY KEY NOT NULL,
stock_id integer NOT NULL UNIQUE REFERENCES stocks (id) ON DELETE CASCADE,
TIME_SERIES_INTRADAY jsonb,
TIME_SERIES_DAILY jsonb,
TIME_SERIES_WEEKLY jsonb
); |
PRAGMA foreign_key = ON;
drop trigger trigger5; |
SELECT To_Situation, Transition_Count, Transition_Probability
FROM Transitions
WHERE From_Situation = @FromSituation; |
-- Inserts a new row in the table
-- Using INSERT to insert a new table
INSERT INTO `first_table` (`id`,`name`) VALUES ("89", "Holberton School");
|
CREATE TABLE user_user(
id BIGINT AUTO_INCREMENT NOT NULL
, user_1_id BIGINT NOT NULL
, user_2_id BIGINT NOT NULL
, relationship VARCHAR(30) NOT NULL
, CONSTRAINT PK_user_user PRIMARY KEY (id)
, FOREIGN KEY FK_user_1_id (user_1_id) REFERENCES user_info(id)
, FOREIGN KEY FK_user_2_id (user_2_id) REFERENCES user_info(id)
);
|
UPDATE
DEPOSIT_INFO
SET
DEPOSIT_AMT = /*dto.depositAmt*/
,TOTAL_AMT = /*dto.totalAmt*/
,USED_AMT = /*dto.usedAmt*/
--更新者
,MODIFY_USER=/*dto.modifyUser*/
--更新日時
,MODIFY_DATE=/*dto.modifyDate*/
WHERE
BRANCH_CODE = /*dto.branchCode*/
AND
CUSTOM_CODE = /*dto.customCode*/
AND
ACCOUNT_NO =/*dto.accountNo*/
/*IF (depositFlg == "1")*/
AND CONTRACT_NO = /*dto.contractNo*/
/*END*/
|
select distinct t.code, t.reg_num_cleared, t.reg_num, t.reg_data,t.doc_type,
t.amount_with_vat, t.amount_wo_vat,
t.prepaid_id, t."sum", t.prepaid_date,
t.na_document, t.empty_sum, t.zero_sum
from ( select t1.code, t3.reg_num_cleared, t3.reg_num, t3.reg_data,
t3.amount_with_vat, t3.amount_wo_vat,
t1.prepaid_id, t1.sum,
to_timestamp_from_excel(CAST(t1.prepaid_data as integer)) as prepaid_date,
t3.na_document, t3.empty_sum, t3.zero_sum, t3.doc_type
from agent as t1
full join agent2 as t2 on t1.code = t2.code
full join esed_all as t3 on t2.contract_name_cleared = t3.reg_num_cleared
where t1.code is not null and t1.code = '425036-3'
and (contract_group is null or contract_group in (
'ВГР. Агентский договор (заключение договоров)',
'ВГР. Договор "содействия" (агентские/возмездные услуги)',
'ВГР. Прочие договоры',
'ДВЗ.Прочие договоры',
'Дог. на оказание консультационных услуг',
'Договор на оказание услуг по обучению',
'Договор на оказание услуг технического обслуживания',
'Договор на приобретение программного обеспечения',
'Договора гражданско-правового характера',
'Дополнительное соглашение',
'НИ.Агентский договор',
'НИ.Договор возмездного оказания услуг',
'Прочие агентские договоры',
'Прочие договоры',
'Прочие договоры возмездного оказания услуг',
'Прочие договоры подряда',
'агентирование',
'гражданско-правового характера',
'подряд'
))
) as t
order by t.code, t.prepaid_date asc, t.reg_num_cleared desc
|
set echo on
connect system/amakal
--You may change the password 'amakal' according to your computer's oracle password.
drop user petshop cascade;
create user petshop identified by kankaloo;
grant connect, resource to petshop;
alter user petshop default tablespace users temporary tablespace temp account unlock;
connect petshop/kankaloo;
create table admin (
admin_username varchar2(40) primary key,
admin_password varchar2(50)
);
create table customer (
cust_id number primary key,
cust_user varchar2(40) not null,
cust_pass varchar2(20) not null,
cust_email varchar2(50) not null,
cust_lname varchar2(50) not null,
cust_fname varchar2(50) not null,
cust_mi varchar2(3),
cust_contact varchar2(20),
cust_contact2 varchar2(20),
cust_bdate varchar(10),
cust_gender varchar(6),
cust_region varchar(30),
cust_city varchar(30),
cust_zip varchar(10),
cust_image varchar(200)
);
create table pets (
pet_id number primary key,
pet_title varchar2(150) not null,
pet_desc varchar2(400),
pet_image varchar(200),
pet_stockqty number(5,0),
pet_price number(10,2)
);
create table cart_item (
citem_id number primary key,
citem_totalcost number(10,2),
citem_qty number(5,0)
);
create table cart (
cart_id number primary key,
cart_totalcost number(10,2)
);
create table payment (
payment_id number primary key,
payment_totalamount number(10,2),
payment_shipfee number(10,2)
); |
spool ./TCS####_bd_report.txt;
SET LINESIZE ###;
SET PAGESIZE #####;
/*
col id_vals format a##
col persons format a##
COL DEMOS FORMAT A##
select distinct
(bd.pool_type_id || '?' || bd.value) id_val,
-- to_char(substr(freedom.implode_nl_large(distinct bd.pool_type_id || '?' || bd.value),#,####)) ID_VALS,
to_char(substr(freedom.implode_nl_large(distinct bd.person_id || '?'|| bd.p_dob),#,####)) persons,
to_char(substr(freedom.implode_nl_large(distinct bd.hospital_id || '?'|| bd.d_dob),#,####)) DEMOS
from appsupport.TCS####_bad_client_data bd
group by
bd.method,
bd.hash,
bd.pool_type_id,
bd.value
HAVING count(distinct bd.person_id) > #
-- ) or (COUNT(DISTINCT bd.d_fname) > # or COUNT(DISTINCT bd.d_lname) > #) AND COUNT(DISTINCT bd.d_dob) > # )
;
*/
-- superpersons
col person_id format a##;
col hashed format a##;
col id_val format a##
col person format a##
COL DEMO FORMAT A##
select distinct
person_id,
person,
id_val,
to_char(substr(freedom.implode_nl_large(distinct demo),#,####)) DEMOS
FROM
(
select
to_char(bd.person_id) person_id,
(BD.METHOD || '?'|| BD.HASH) HASHED,
(bd.pool_type_id || '?' || bd.value) id_val,
(bd.p_fname || '?'|| bd.p_dob) person,
(bd.d_fname || '?'|| bd.d_dob) DEMO
from appsupport.TCS####_bad_client_data bd
)
GROUP BY
hashed,
person_id,
person,
id_val
HAVING COUNT(DISTINCT demo) > #
ORDER BY
PERSON_ID,
id_val
;
spool off;
|
CREATE TABLE employee (
id INT NOT NULL AUTO_INCREMENT
, first_name VARCHAR(255) NOT NULL
, last_name VARCHAR(255) NOT NULL
, date_of_birth DATE NOT NULL
, PRIMARY KEY (id)); |
INSERT INTO
MULTILANGUAGE_NAME_MST
SELECT
/*seqNo*/,
COUNTRY_KBN,
ITEM_CODE,
ITEM_NAME,
SCORING_CARD_CODE,
SCORING_CARD_NAME,
SCORING_CARD_GROUP,
SCORING_CARD_TYPE,
MODIFY_USER,
/*modifyDate*/
FROM SCORING_CARD_NAME_TEMP
WHERE SEQ_NO=/*sessionId*/ |
/* Formatted on 21/07/2014 18:30:21 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.QZV_ST_FLL_RM
(
COD_SRC,
ID_DPER,
COD_STATO_RISCHIO,
COD_ABI,
COD_NDG,
COD_SNDG,
COD_GRUPPO_ECONOMICO,
COD_FILIALE,
COD_PRESIDIO,
COD_GESTIONE,
COD_AREA_BUSINESS,
COD_STATO_GIURIDICO
)
AS
SELECT COD_SRC,
SUBSTR (SYS_CONTEXT ('userenv', 'client_info'), 1, 6) id_dper,
COD_STATO_RISCHIO,
'#' COD_ABI,
'#' COD_NDG,
'#' COD_SNDG,
'#' COD_GRUPPO_ECONOMICO,
'#' COD_FILIALE,
'#' COD_PRESIDIO,
'#' COD_GESTIONE,
COD_AREA_BUSINESS,
'#' COD_STATO_GIURIDICO
FROM (SELECT 'RM' COD_SRC FROM DUAL) src,
(SELECT 'I' COD_STATO_RISCHIO FROM DUAL
UNION ALL
SELECT 'S' COD_STATO_RISCHIO FROM DUAL
ORDER BY 1) str,
( SELECT cod_area_business
FROM mcre_own.QZV_ST_MIS_ABS
ORDER BY 1) ABS;
|
DROP DATABASE IF EXISTS call_on_me;
CREATE DATABASE call_on_me;
use call_on_me;
CREATE TABLE IF NOT EXISTS instructors (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
instructor_name VARCHAR(50) NOT NULL,
email VARCHAR(50) NOT NULL,
password VARCHAR(255) NOT NULL
);
CREATE TABLE IF NOT EXISTS courses (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
class_name VARCHAR(50) NOT NULL,
);
CREATE TABLE IF NOT EXISTS students (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
preferred_name VARCHAR(50) NOT NULL,
times_called INT
); |
-- Table definitions for the tournament project.
--
-- Put your SQL 'create table' statements in this file; also 'create view'
-- statements if you choose to use it.
--
-- You can write comments in this file by starting them with two dashes, like
-- these lines here.
-- creating a table for the swiss tournament
-- row1 - player id - type = serial, unique key
-- row2 - player name - type = text
-- row3 - player no. of wins - type = integer
-- row4 - player no. of draws - type = integer
-- row5 - player tiebreaker stats - type = integer, adds no. of wins of each person he beats
create table players (
id serial primary key,
name text,
score integer,
totalmatches integer
);
create table matches (
matchid serial primary key,
idwinner serial references players (id),
idloser serial references players (id),
); |
-- phpMyAdmin SQL Dump
-- version 4.7.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Nov 21, 2017 at 09:37 AM
-- Server version: 5.6.36-82.1-log
-- PHP Version: 5.6.30
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: `nichol29_application`
--
-- --------------------------------------------------------
--
-- Table structure for table `Degrees`
--
CREATE TABLE `Degrees` (
`DegreeID` int(11) NOT NULL,
`DegreeTitle` varchar(5) DEFAULT NULL,
`DegreeName` varchar(255) DEFAULT NULL,
`DegreeConcentration` varchar(255) DEFAULT NULL,
`DegreeSchool` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `Degrees`
--
INSERT INTO `Degrees` (`DegreeID`, `DegreeTitle`, `DegreeName`, `DegreeConcentration`, `DegreeSchool`) VALUES
(1, 'MA', 'Animation', 'Animator', 'Cinematic Arts'),
(2, 'MS', 'Applied Technology', '', 'Computing'),
(3, 'MS', 'Business Information Technology', '', 'Computing'),
(4, 'MS', 'Computational Finance', '', 'Computing'),
(5, 'MS', 'Computer Science', '', 'Computing'),
(6, 'MS', 'Cybersecurity', 'Computer Security', 'Computing'),
(7, 'MA', 'Digital Communication and Media Arts', '', 'Design'),
(8, 'MS', 'E-Commerce Technology', '', 'Computing'),
(9, 'MA', 'Experience Design', '', 'Design'),
(10, 'MS', 'Film and Television', 'Cinematography', 'Cinematic Arts'),
(11, 'MS', 'Game Programming', '', 'Computing'),
(12, 'MS', 'Health Informatics', '', 'Computing'),
(13, 'MS', 'Human-Computer Interaction', '', 'Computing'),
(14, 'MS', 'Information Systems', 'Standard', 'Computing'),
(15, 'MS', 'IT Project Management', '', 'Computing'),
(16, 'MS', 'Network Engineering and Security', '', 'Computing'),
(17, 'MS', 'Predictive Analytics', 'Computational Methods', 'Computing'),
(18, 'MS', 'Software Engineering', 'Software Development', 'Computing'),
(19, 'MS', 'Computer Science Technology', '', 'Computing');
-- --------------------------------------------------------
--
-- Table structure for table `Jobs`
--
CREATE TABLE `Jobs` (
`JobID` int(11) NOT NULL,
`JobTitle` varchar(255) DEFAULT NULL,
`TechSkill1` varchar(255) DEFAULT NULL,
`TechSkill2` varchar(255) DEFAULT NULL,
`TechSkill3` varchar(255) DEFAULT NULL,
`TechSkill4` varchar(255) DEFAULT NULL,
`TechSkill5` varchar(255) DEFAULT NULL,
`SoftSkill1` varchar(255) DEFAULT NULL,
`SoftSkill2` varchar(255) DEFAULT NULL,
`SoftSkill3` varchar(255) DEFAULT NULL,
`SoftSkill4` varchar(255) DEFAULT NULL,
`SoftSkill5` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `Jobs`
--
INSERT INTO `Jobs` (`JobID`, `JobTitle`, `TechSkill1`, `TechSkill2`, `TechSkill3`, `TechSkill4`, `TechSkill5`, `SoftSkill1`, `SoftSkill2`, `SoftSkill3`, `SoftSkill4`, `SoftSkill5`) VALUES
(1, 'Computer Systems Analyst', 'Java', 'Oracle', 'C++', 'Software Engineering', '', 'Organization', 'Teamwork', 'Analyze', 'Communication', 'Independent'),
(2, 'Data Scientist', 'Python', 'Java', 'Software Engineering', 'C#', 'C++', 'Teamwork', 'Organization', 'Communication', 'Analyze', 'Problem Solving'),
(3, 'Database Administrator', 'Oracle', 'Database Administration', 'MongoDB', 'MySQL', 'Python', 'Organization', 'Teamwork', 'Communication', 'Independent', 'Analyze'),
(4, 'IT Security Specialist', 'C#', 'Oracle', '', '', '', 'Teamwork', 'Organization', 'Communication', 'Independent', 'Analyze'),
(5, 'Mobile Application Developer', 'Java', 'C#', 'Software Engineering', 'Objective-C', 'C++', 'Teamwork', 'Communication', 'Analyze', 'Independent', 'Organization'),
(6, 'Quality Assurance', '', '', '', '', '', 'Teamwork', 'Communication', 'Organization', 'Analyze', 'Independent'),
(7, 'Software Developer', 'Java', 'MySQL', 'C#', 'Oracle', 'Software Engineering', 'Teamwork', 'Organization', 'Writing', 'Communication', 'Independent'),
(8, 'Software Engineer', 'Java', 'Software Engineering', 'C#', 'Database Administration', 'MongoDB', 'Teamwork', 'Organization', 'Communication', 'Independent', 'Writing'),
(9, 'User Experience', 'Java', 'Python', '', '', '', 'Teamwork', 'Communication', 'Independent', 'Organization', 'Analyze'),
(10, 'Web Developer', 'Java', 'C#', 'Software Engineering', 'Python', 'Microsoft SQL Server', 'Teamwork', 'Communication', 'Independent', 'Analyze', 'Writing');
-- --------------------------------------------------------
--
-- Table structure for table `Results`
--
CREATE TABLE `Results` (
`UserID` int(10) NOT NULL,
`Job1` varchar(255) DEFAULT NULL,
`JobResult1` decimal(9,2) DEFAULT NULL,
`Job2` varchar(255) DEFAULT NULL,
`JobResult2` decimal(9,2) DEFAULT NULL,
`Job3` varchar(255) DEFAULT NULL,
`JobResult3` decimal(9,2) DEFAULT NULL,
`Job4` varchar(255) DEFAULT NULL,
`JobResult4` decimal(9,2) DEFAULT NULL,
`Job5` varchar(255) DEFAULT NULL,
`JobResult5` decimal(9,2) DEFAULT NULL,
`Degree1` varchar(255) DEFAULT NULL,
`DegreeResult1` decimal(9,2) DEFAULT NULL,
`Degree2` varchar(255) DEFAULT NULL,
`DegreeResult2` decimal(9,2) DEFAULT NULL,
`Degree3` varchar(255) DEFAULT NULL,
`DegreeResult3` decimal(9,2) DEFAULT NULL,
`Degree4` varchar(255) DEFAULT NULL,
`DegreeResult4` decimal(9,2) DEFAULT NULL,
`Degree5` varchar(255) DEFAULT NULL,
`DegreeResult5` decimal(9,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `Results`
--
INSERT INTO `Results` (`UserID`, `Job1`, `JobResult1`, `Job2`, `JobResult2`, `Job3`, `JobResult3`, `Job4`, `JobResult4`, `Job5`, `JobResult5`, `Degree1`, `DegreeResult1`, `Degree2`, `DegreeResult2`, `Degree3`, `DegreeResult3`, `Degree4`, `DegreeResult4`, `Degree5`, `DegreeResult5`) VALUES
(1, 'Animator', '0.14', 'Database_Administrator', '0.64', 'IT_Security', '0.00', 'Mobile_App_Developer', '0.06', 'Animator', '0.01', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, 'Data_Scientist', '0.11', 'Database_Administrator', '0.06', 'IT_Security', '0.09', 'Mobile_App_Developer', '0.06', 'Animator', '0.31', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(541, 'Software_Developer', '0.50', 'Database_Administrator', '0.29', 'Computer_Systems_Analyst', '0.07', 'Mobile_App_Developer', '0.06', 'Network_Specialist', '0.05', 'Computer_Science', '0.73', 'Applied_Technology', '0.23', 'Experience_Design', '0.03', 'Business_Information_Technology', '0.02', 'Computational_Finance', '0.02'),
(544, 'Computer_Systems_Analyst', '0.13', 'Database_Administrator', '0.06', 'Data_Scientist', '0.05', 'Mobile_App_Developer', '0.01', 'IT_Security', '0.00', 'Computer_Science', '0.85', 'Applied_Technology', '0.03', 'E_Commerce_Technology', '0.02', 'Computational_Finance', '0.02', 'Digital_Communication_and_Media_Arts', '0.01'),
(546, 'Computer_Systems_Analyst', '0.14', 'Database_Administrator', '0.11', 'Data_Scientist', '0.06', 'Mobile_App_Developer', '0.02', 'IT_Security', '0.00', 'Computer_Science', '0.92', 'Applied_Technology', '0.05', 'E_Commerce_Technology', '0.05', 'Experience_Design', '0.03', 'Animation', '0.02');
-- --------------------------------------------------------
--
-- Table structure for table `SoftSkills`
--
CREATE TABLE `SoftSkills` (
`SoftSkillID` int(11) NOT NULL,
`SoftSkillName` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `SoftSkills`
--
INSERT INTO `SoftSkills` (`SoftSkillID`, `SoftSkillName`) VALUES
(1, 'Analytical'),
(2, 'Communication'),
(3, 'Independence'),
(4, 'Multi-Tasking'),
(5, 'Organization'),
(6, 'Problem Solving'),
(7, 'Speaking'),
(8, 'Teamwork'),
(9, 'Writing'),
(10, 'Leadership'),
(11, 'Creativity'),
(12, 'Time Management'),
(13, 'Motivation'),
(14, 'Adaptability'),
(15, 'Research'),
(16, 'Confidence'),
(17, 'Enthusiasm'),
(18, 'Persistence'),
(19, 'Patience'),
(20, 'Negotiation');
-- --------------------------------------------------------
--
-- Table structure for table `TechSkills`
--
CREATE TABLE `TechSkills` (
`TechSkillID` int(11) NOT NULL,
`TechSkillName` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `TechSkills`
--
INSERT INTO `TechSkills` (`TechSkillID`, `TechSkillName`) VALUES
(1, 'C#'),
(2, 'C++'),
(3, 'Database Administration'),
(4, 'DB2'),
(5, 'Java'),
(6, 'Microsoft SQL Server'),
(7, 'MongoDB'),
(8, 'MySQL'),
(9, 'Objective-C'),
(10, 'Oracle'),
(11, 'Python'),
(12, 'Software Engineering'),
(13, 'NONE'),
(14, 'Design'),
(15, 'Mathematics'),
(16, 'Protocols'),
(17, 'TCP/IP'),
(18, 'LAN'),
(19, 'FTP'),
(20, 'SMTP'),
(21, 'Linux'),
(22, 'Windows'),
(23, 'Unix'),
(24, 'R'),
(25, 'Mitigation'),
(26, 'Pen Testing'),
(27, 'Excel');
-- --------------------------------------------------------
--
-- Table structure for table `Users`
--
CREATE TABLE `Users` (
`UserID` char(10) NOT NULL DEFAULT '',
`FirstName` varchar(255) DEFAULT NULL,
`LastName` varchar(255) DEFAULT NULL,
`Age` varchar(3) DEFAULT NULL,
`Location` varchar(20) DEFAULT NULL,
`Degree` varchar(20) DEFAULT NULL,
`TechSkill1` varchar(255) DEFAULT NULL,
`TechSkill1Weight` int(2) DEFAULT NULL,
`TechSkill2` varchar(255) DEFAULT NULL,
`TechSkill2Weight` int(2) DEFAULT NULL,
`TechSkill3` varchar(255) DEFAULT NULL,
`TechSkill3Weight` int(2) DEFAULT NULL,
`TechSkill4` varchar(255) DEFAULT NULL,
`TechSkill4Weight` int(2) DEFAULT NULL,
`TechSkill5` varchar(255) DEFAULT NULL,
`TechSkill5Weight` int(2) DEFAULT NULL,
`SoftSkill1` varchar(255) DEFAULT NULL,
`SoftSkill1Weight` int(2) DEFAULT NULL,
`SoftSkill2` varchar(255) DEFAULT NULL,
`SoftSkill2Weight` int(2) DEFAULT NULL,
`SoftSkill3` varchar(255) DEFAULT NULL,
`SoftSkill3Weight` int(2) DEFAULT NULL,
`SoftSkill4` varchar(255) DEFAULT NULL,
`SoftSkill4Weight` int(2) DEFAULT NULL,
`SoftSkill5` varchar(255) DEFAULT NULL,
`SoftSkill5Weight` int(2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `Users`
--
INSERT INTO `Users` (`UserID`, `FirstName`, `LastName`, `Age`, `Location`, `Degree`, `TechSkill1`, `TechSkill1Weight`, `TechSkill2`, `TechSkill2Weight`, `TechSkill3`, `TechSkill3Weight`, `TechSkill4`, `TechSkill4Weight`, `TechSkill5`, `TechSkill5Weight`, `SoftSkill1`, `SoftSkill1Weight`, `SoftSkill2`, `SoftSkill2Weight`, `SoftSkill3`, `SoftSkill3Weight`, `SoftSkill4`, `SoftSkill4Weight`, `SoftSkill5`, `SoftSkill5Weight`) VALUES
('541', 'Nick', 'Holyk', '28', 'Itasca', 'Computer Science', 'C++', 5, 'Java', 6, 'MySQL', 10, 'Python', 8, 'R', 3, 'Problem Solving', 6, 'Persistence', 7, 'Patience', 7, 'Adaptability', 8, 'Organization', 7),
('544', 'Ryan', 'Macwan', '24', 'Naperville', 'Animation', 'Java', 8, 'Python', 6, 'MySQL', 4, 'C++', 5, '', 0, 'Problem Solving', 9, 'Analyze', 8, 'Public Speaking', 8, 'Independent', 7, 'Communication', 6),
('546', 'Glenn', 'Hintze', '99', 'Chicago', 'Business Information', 'Java', 9, 'Python', 8, 'MySQL', 4, 'C++', 4, 'Database Administration', 1, 'Communication', 10, 'Problem Solving', 9, 'Writing', 9, 'Organization', 7, 'Multitasking', 6);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `Degrees`
--
ALTER TABLE `Degrees`
ADD UNIQUE KEY `DegreeID` (`DegreeID`);
--
-- Indexes for table `Jobs`
--
ALTER TABLE `Jobs`
ADD PRIMARY KEY (`JobID`);
--
-- Indexes for table `Results`
--
ALTER TABLE `Results`
ADD PRIMARY KEY (`UserID`);
--
-- Indexes for table `SoftSkills`
--
ALTER TABLE `SoftSkills`
ADD PRIMARY KEY (`SoftSkillID`);
--
-- Indexes for table `TechSkills`
--
ALTER TABLE `TechSkills`
ADD PRIMARY KEY (`TechSkillID`);
--
-- Indexes for table `Users`
--
ALTER TABLE `Users`
ADD PRIMARY KEY (`UserID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `Degrees`
--
ALTER TABLE `Degrees`
MODIFY `DegreeID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT for table `SoftSkills`
--
ALTER TABLE `SoftSkills`
MODIFY `SoftSkillID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT for table `TechSkills`
--
ALTER TABLE `TechSkills`
MODIFY `TechSkillID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;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 */;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.