blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 5
133
| path
stringlengths 3
276
| src_encoding
stringclasses 33
values | length_bytes
int64 23
9.61M
| score
float64 2.52
5.28
| int_score
int64 3
5
| detected_licenses
listlengths 0
44
| license_type
stringclasses 2
values | text
stringlengths 23
9.43M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
6e70c34d7e4438bf943d5441898ff839a531dba9
|
SQL
|
nikola5rovic/backendApp
|
/sql/backend_app.sql
|
UTF-8
| 2,258
| 3.03125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Feb 22, 2021 at 07:37 PM
-- Server version: 5.7.26
-- PHP Version: 7.2.18
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: `backend_app`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
DROP TABLE IF EXISTS `admin`;
CREATE TABLE IF NOT EXISTS `admin` (
`admin_id` int(11) NOT NULL AUTO_INCREMENT,
`admin_picture` varchar(255) NOT NULL,
`admin_email` varchar(255) NOT NULL,
`admin_password` varchar(255) NOT NULL,
`admin_name` varchar(255) NOT NULL,
PRIMARY KEY (`admin_id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`admin_id`, `admin_picture`, `admin_email`, `admin_password`, `admin_name`) VALUES
(1, 'np.jpg', 'nikola.eon@gmail.com', 'e1448992d4a105af890ea14e8d44fa52', 'Nikola Petrovic'),
(2, 'rg.jpg', 'rajan.gosling@gmail.com', '7f2e6164b7bf818afca56d6db5a5bfcd', 'Rajan Gosling');
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
DROP TABLE IF EXISTS `products`;
CREATE TABLE IF NOT EXISTS `products` (
`pro_id` int(11) NOT NULL AUTO_INCREMENT,
`pro_img` varchar(255) NOT NULL,
`pro_title` varchar(255) NOT NULL,
`pro_price` int(10) NOT NULL,
`pro_stock` int(10) NOT NULL,
PRIMARY KEY (`pro_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`pro_id`, `pro_img`, `pro_title`, `pro_price`, `pro_stock`) VALUES
(3, 'philips-headphones.png', 'Philips Headphones', 39, 15),
(4, 'ps5.jpg', 'PS5', 149, 5),
(5, 'robo-vaccum.jpg', 'Vacuum Cleaner', 799, 7),
(6, 'tv.jpg', 'TV Samsung', 599, 6);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
af2e81559f312ddc85cf7240946a6b8b23df63e3
|
SQL
|
perrym75/access-analysis-ws
|
/src/main/resources/sql/mssql/access_right/selectResourceAccessViaUserAccount.sql
|
UTF-8
| 603
| 3.734375
| 4
|
[] |
no_license
|
SELECT
DISTINCT
ar.ACCESS_RIGHT_ID,
ar.DISPLAY_NAME
FROM
[RESOURCE] res
INNER JOIN
ACCESS_ENTRY ae
ON
ae.RESOURCE_ID = res.RESOURCE_ID
INNER JOIN
ACCESS_RIGHT ar
ON
ae.ACCESS_RIGHT_ID = ar.ACCESS_RIGHT_ID
INNER JOIN
T_SP tsp
ON
ae.SECURITY_PRINCIPAL_ID = tsp.PARENT_ID
INNER JOIN
USER_ACCOUNT ua
ON
ua.SECURITY_PRINCIPAL_ID = tsp.UA_SP_ID
INNER JOIN
PERSONAGE pers
ON
pers.PERSONAGE_ID = ua.PERSONAGE_ID
WHERE
pers.PERSONAGE_ID = ?
AND res.RESOURCE_ID = ?
AND ua.SECURITY_PRINCIPAL_ID = ?
ORDER BY
ar.ACCESS_RIGHT_ID
| true
|
bae00a39d221df254ac73e02be18116073d560fc
|
SQL
|
MZqk/boco
|
/SQL/mod/1111.sql
|
UTF-8
| 652
| 3.015625
| 3
|
[] |
no_license
|
select a.scan_start_time,c.region_name,b.name ,b.cgi,NbrMeanEstab_1,NbrPktUl_1,NbrPktDl_1,NbrPktLossUl_1,NbrPktLossDl_1
from tpa_eutrancell_ne a,tcc_eutrancell b,region_city c
where a.scan_start_time >=to_date('2017-06-24 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
and a.scan_start_time <=to_date('2017-06-24 23:00:00', 'yyyy-mm-dd hh24:mi:ss')
and b.scan_start_time =to_date('2017-06-24 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
and a.int_id=b.int_id
and a.ne_type=8105
and a.sum_level=0
and b.city_id=c.city_id
and nvl(NbrMeanEstab_1,0)<>0
and nvl(NbrPktUl_1,0)=0
and nvl(NbrPktDl_1,0)=0
and nvl(NbrPktLossUl_1,0)=0
and nvl(NbrPktLossDl_1,0)=0
| true
|
f40d09cb07da2e8f3f53a6b8aa7715c0afcf8255
|
SQL
|
joseedgardo2000/hackerrank
|
/SQL/BasicJoin/query02.sql
|
UTF-8
| 120
| 3.375
| 3
|
[] |
no_license
|
SELECT city.name
FROM country
INNER JOIN city
ON country.code = city.countrycode
WHERE continent = 'Africa';
| true
|
30345a6aba434280f1974cca46671e8952aa3040
|
SQL
|
Bonsen/2015-2016-Infomation-Security
|
/2016/simple(no spark)/sql.sql
|
UTF-8
| 18,773
| 2.625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.4.10
-- http://www.phpmyadmin.net
--
-- Host: localhost:8889
-- Generation Time: Aug 10, 2016 at 02:30 PM
-- Server version: 5.5.42
-- PHP Version: 5.6.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `simple`
--
-- --------------------------------------------------------
--
-- Table structure for table `people`
--
CREATE TABLE `people` (
`id` int(64) NOT NULL,
`pic` varchar(128) COLLATE utf8_bin NOT NULL,
`containerid` varchar(128) COLLATE utf8_bin NOT NULL,
`uid` int(64) NOT NULL,
`text` varchar(1024) COLLATE utf8_bin NOT NULL,
`dianzan` int(64) NOT NULL,
`pinglun` int(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `ppeople`
--
CREATE TABLE `ppeople` (
`id` int(64) NOT NULL,
`pic` varchar(128) COLLATE utf8_bin NOT NULL,
`containerid` varchar(128) COLLATE utf8_bin NOT NULL,
`uid` int(64) NOT NULL,
`text` varchar(1024) COLLATE utf8_bin NOT NULL,
`dianzan` int(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `qianzai`
--
CREATE TABLE `qianzai` (
`id` int(64) NOT NULL,
`uid` int(255) NOT NULL,
`containerid` varchar(128) COLLATE utf8_bin NOT NULL,
`pname` varchar(64) COLLATE utf8_bin NOT NULL,
`rate` int(64) NOT NULL,
`pic` varchar(128) COLLATE utf8_bin NOT NULL,
`dianzan` int(64) NOT NULL,
`pinglun` int(64) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `qianzai`
--
INSERT INTO `qianzai` (`id`, `uid`, `containerid`, `pname`, `rate`, `pic`, `dianzan`, `pinglun`) VALUES
(1, 310159522, '100808a17e580841b3fac5f0cd1c9d4682a425', '郭俊辰综艺谈吻戏', 15, 'http://tva1.sinaimg.cn/crop.0.0.640.640.180/b8de9659jw8erkpq68ad3j20hs0htt9h.jpg', 341, 67),
(2, 534216066, '100808a17e580841b3fac5f0cd1c9d4682a425', '殷大大兮', 21, 'http://tva4.sinaimg.cn/crop.0.0.996.996.180/005Pxa1Hjw8f14xofzsi6j30ro0rojt3.jpg', 3, 12),
(3, 393389638, '100808a17e580841b3fac5f0cd1c9d4682a425', '我的宝辰', 2, 'http://tva2.sinaimg.cn/crop.272.5.1066.1066.180/ea7a7ebejw8esitm0tdg6j21hc0u07hn.jpg', 534, 41),
(4, 250744210, '100808a17e580841b3fac5f0cd1c9d4682a425', 'Princess_323', 4, 'http://tva1.sinaimg.cn/crop.0.0.179.179.180/957487b5gw1f686ia5xalj2050050weg.jpg', 335, 22),
(5, 544244223, '100808a17e580841b3fac5f0cd1c9d4682a425', '鱼骨头Teen', 16, 'http://tva4.sinaimg.cn/crop.0.1.510.510.180/005WjVQojw8f19p77cflnj30e60e8gm5.jpg', 67, 4),
(6, 513021354, '100808a17e580841b3fac5f0cd1c9d4682a425', '我有一个小丸子213', 32, 'http://tva2.sinaimg.cn/crop.0.0.750.750.180/005BbQTHjw8f2g7ykvxwlj30ku0ku0ts.jpg', 744, 32),
(7, 285419801, '100808a17e580841b3fac5f0cd1c9d4682a425', '杨泽宇VAE', 42, 'http://tva3.sinaimg.cn/crop.0.0.640.640.180/7d32e293jw8e8vqyw2vtrj20hs0hswfn.jpg', 343, 12),
(8, 315900228, '100808c150492e76e9e27de806902c4993b565', '人走茶凉VEB', 32, 'http://tva1.sinaimg.cn/crop.0.0.640.640.180/bc4a8ca8jw8f688g691kxj20hs0hsaav.jpg', 2132, 412),
(9, 254109163, '100808c150492e76e9e27de806902c4993b565', '哎呦喂呦d', 9, 'http://tva4.sinaimg.cn/crop.0.0.100.100.180/9775fb33jw8f687p757ufj202s02sdfn.jpg', 312, 31),
(10, 245489582, '100808c150492e76e9e27de806902c4993b565', '译淇b', 2, 'http://tva1.sinaimg.cn/crop.0.0.864.864.180/9252bcd1jw8f687neljsgj20o00o00ve.jpg', 123, 12),
(11, 267651043, '100808c150492e76e9e27de806902c4993b565', '郭明红421633f', 13, 'http://tva3.sinaimg.cn/crop.0.0.2048.2048.180/9f884ee5jw8f687mjqwwrj21kw1kwn24.jpg', 58, 76),
(12, 330810621, '100808c150492e76e9e27de806902c4993b565', '雪妮_W', 5, 'http://tva3.sinaimg.cn/crop.0.0.750.750.180/c52db1e9jw8f687knmvuij20ku0kuq3y.jpg', 80, 67),
(13, 244178304, '100808c150492e76e9e27de806902c4993b565', '傅威咏傅2_5z2', 4, 'http://tva4.sinaimg.cn/crop.0.0.180.180.180/918aa703jw8f687oyw2axj20500503yn.jpg', 73, 1),
(14, 193888633, '100808c150492e76e9e27de806902c4993b565', '我有兔子牙k', 12, 'http://tva4.sinaimg.cn/crop.0.0.524.524.180/73910ebbjw8f687pdq1hsj20ek0el0t2.jpg', 567, 31),
(15, 562045234, '100808f1f691b58296230c33ff48acf388c384', '虞书欣Esther', 78, 'http://tva2.sinaimg.cn/crop.0.0.751.751.180/0068mQp7jw8f3vk6884k0j30kv0kvmy6.jpg', 268, 21),
(16, 170207308, '100808f1f691b58296230c33ff48acf388c384', '王族亲卫队队长团总裁', 8, 'http://tva1.sinaimg.cn/crop.0.0.540.540.180/657392ffjw8eus3tivyv2j20f00f0gma.jpg', 74, 9),
(17, 128713651, '100808f1f691b58296230c33ff48acf388c384', '于青斌', 7, 'http://tva4.sinaimg.cn/crop.1.0.510.510.180/4cb82502jw8f5zewivtb2j20e80e6aaj.jpg', 21, 1),
(18, 200569005, '100808f1f691b58296230c33ff48acf388c384', '认清灬人事1985', 4, 'http://tva2.sinaimg.cn/crop.0.0.864.864.180/778c66c9jw8f687q7w594j20o00o0acd.jpg', 5, 1),
(19, 354703983, '100808f1f691b58296230c33ff48acf388c384', '1点半技能全开清漪19944_PWK', 5, 'http://tva2.sinaimg.cn/crop.0.0.960.960.180/d36b885djw8f687pr7r2uj20qo0qpq47.jpg', 221, 24),
(20, 275205309, '100808f1f691b58296230c33ff48acf388c384', '法栋艳法弹买角光q_3', 2, 'http://tva2.sinaimg.cn/crop.0.0.640.640.180/a408ff69jw8f687uzr9jsj20hs0hsgm7.jpg', 7, 1),
(21, 194767181, '100808f1f691b58296230c33ff48acf388c384', '怪兽yoosd4', 31, 'http://tva1.sinaimg.cn/crop.0.0.864.864.180/74171d09jw8f687pb679wj20o00o0gmj.jpg', 12, 5),
(22, 325000675, '1008082fc168ea5436aee16f4b3ad1d502285b', '欣喜羞花取舍整v_1966', 24, 'http://tva1.sinaimg.cn/crop.0.0.852.852.180/c1b72adfjw8f6844ggcxyj20no0npwfk.jpg', 14, 21),
(23, 204573655, '1008082fc168ea5436aee16f4b3ad1d502285b', '大大大大大大花花gmq_1967', 34, 'http://tva4.sinaimg.cn/crop.0.0.576.576.180/79ef766bjw8f688gnt4rnj20g00g00t1.jpg', 94, 31),
(24, 597046964, '1008082fc168ea5436aee16f4b3ad1d502285b', 'Aoop小丫头', 62, 'http://tva1.sinaimg.cn/crop.0.0.1536.1536.180/006w3tTtjw8f57zbhq2u3j316o16oagd.jpg', 12, 3),
(25, 567946830, '1008082fc168ea5436aee16f4b3ad1d502285b', '涵曦瘦身神器LATOJA', 31, 'http://tva4.sinaimg.cn/crop.0.0.664.664.180/006cmt9zjw8eze887smf2j30ig0igwfb.jpg', 421, 23),
(26, 566232766, '1008082fc168ea5436aee16f4b3ad1d502285b', '我是黄家驹的粉丝', 5, 'http://tva2.sinaimg.cn/crop.0.0.664.664.180/006bcy5wjw8f58ico1fwij30ig0igmy8.jpg', 31, 2),
(27, 559648391, '1008082fc168ea5436aee16f4b3ad1d502285b', '蕾爷很帅', 26, 'http://tva2.sinaimg.cn/crop.0.0.740.740.180/0066Kh7Fjw8f5tjm0et76j30kk0kl751.jpg', 214, 34),
(28, 541217728, '1008082fc168ea5436aee16f4b3ad1d502285b', '苏晨ivae', 34, 'http://tva3.sinaimg.cn/crop.0.0.996.996.180/005UgWxWjw8f5ubo30vtej30ro0rp0ui.jpg', 51, 235),
(29, 162563621, '1008084a4559d4e8c7eaea677e8141e730a3f0', '刘志摩-', 21, 'http://tva3.sinaimg.cn/crop.1.0.509.509.180/60e53d77jw8f5iv5s4cnlj20e80e5mxk.jpg', 77, 236),
(30, 262112184, '1008084a4559d4e8c7eaea677e8141e730a3f0', '不愿意透露姓名的英国绅士', 5, 'http://tva2.sinaimg.cn/crop.0.0.664.664.180/9c3b2531jw8f4or9n60ndj20ig0ig3zx.jpg', 312, 251),
(31, 188272243, '1008084a4559d4e8c7eaea677e8141e730a3f0', '爱包子的美兰', 4, 'http://tva4.sinaimg.cn/crop.0.0.180.180.180/70381081jw1e8qgp5bmzyj2050050aa8.jpg', 4, 3),
(32, 273863624, '1008084a4559d4e8c7eaea677e8141e730a3f0', '倔强的执着LJ', 17, 'http://tva3.sinaimg.cn/crop.0.0.511.511.180/a33c45d0jw8eyouf4v0kbj20e70e8aap.jpg', 6, 1),
(33, 550955789, '1008084a4559d4e8c7eaea677e8141e730a3f0', '黄毛89807', 17, 'http://tva2.sinaimg.cn/crop.0.0.132.132.180/0060RxH2jw8eqjimkdl07j303o03o742.jpg', 56, 12),
(34, 515862189, '1008084a4559d4e8c7eaea677e8141e730a3f0', '睿家小娃儿', 17, 'http://tva1.sinaimg.cn/crop.0.0.480.480.180/005D73cYjw8egvb93aayqj30dc0dcq4g.jpg', 43, 3),
(35, 393648647, '1008084a4559d4e8c7eaea677e8141e730a3f0', '巍董LMW', 77, 'http://tva4.sinaimg.cn/crop.0.0.1328.1328.180/eaa2044djw8ezle4ey6xgj210w10wjx5.jpg', 126, 78),
(36, 531041141, '10080890eb9bdfb470c6291da3d979186c56b9', 'Airman_s', 5, 'http://tva2.sinaimg.cn/crop.0.12.750.750.180/005NnWAZjw8f689rn97qkj30ku0liaaf.jpg', 21, 3),
(37, 163411844, '10080890eb9bdfb470c6291da3d979186c56b9', '南京新浪乐居', 2, 'http://tva1.sinaimg.cn/crop.0.0.180.180.180/6166ab2djw1e8qgp5bmzyj2050050aa8.jpg', 5, 9),
(38, 560191887, '10080890eb9bdfb470c6291da3d979186c56b9', '庄子衣', 16, 'http://tva3.sinaimg.cn/crop.0.0.664.664.180/0067750ejw8f4z82710zjj30ig0igq42.jpg', 23, 1),
(39, 125163066, '10080890eb9bdfb470c6291da3d979186c56b9', '森淼淼v', 17, 'http://tva4.sinaimg.cn/crop.0.0.180.180.180/4a9a5e45jw1e8qgp5bmzyj2050050aa8.jpg', 41, 21),
(40, 597045338, '10080890eb9bdfb470c6291da3d979186c56b9', '邢雨薇vivy', 11, 'http://tva1.sinaimg.cn/crop.0.0.996.996.180/006w3pFijw8f5x7f4cx45j30ro0ro40e.jpg', 23, 5),
(41, 502781517, '10080890eb9bdfb470c6291da3d979186c56b9', '木兰公馆阳阳', 42, 'http://tva4.sinaimg.cn/crop.0.0.996.996.180/005ugcp6jw8f5ib0iuzqwj30ro0rpdj5.jpg', 3, 1),
(42, 594019862, '10080890eb9bdfb470c6291da3d979186c56b9', '这里是个迷妹', 19, 'http://tva4.sinaimg.cn/crop.0.0.1006.1006.180/006u0t1ijw8f4bc4eh2hsj30ry0rztb3.jpg', 8, 5),
(43, 539459277, '100808943c0bed581e5ed9b31f8c92fea6a6f6', '娱乐扒掌柜', 63, 'http://tva4.sinaimg.cn/crop.0.0.200.200.180/005T5a0Ujw8f58ngblrtrj305k05kdg1.jpg', 2141, 68),
(44, 351646726, '100808943c0bed581e5ed9b31f8c92fea6a6f6', '爱是马毓', 11, 'http://tva3.sinaimg.cn/crop.0.0.996.996.180/d199083djw8f5zmhinem6j20ro0rpgom.jpg', 23, 1),
(45, 179683499, '100808943c0bed581e5ed9b31f8c92fea6a6f6', '吃饭睡觉打二谦-', 3, 'http://tva1.sinaimg.cn/crop.0.1.509.509.180/6b1986aejw8f5yfmsk8tuj20e50e83z4.jpg', 214, 0),
(46, 568222707, '100808943c0bed581e5ed9b31f8c92fea6a6f6', '小孩的世界没有小事', 18, 'http://tva2.sinaimg.cn/crop.0.0.996.996.180/006cy2PNjw8f5xoaj7qg3j30ro0roq4l.jpg', 239, 19),
(47, 193598636, '100808943c0bed581e5ed9b31f8c92fea6a6f6', '老黄家的小媳妇', 9, 'http://tva2.sinaimg.cn/crop.0.0.480.480.180/7364cebajw8ewx0rk1606j20dc0dcmxt.jpg', 98, 2),
(48, 553970678, '100808943c0bed581e5ed9b31f8c92fea6a6f6', 'NNNAZAKAT-', 21, 'http://tva2.sinaimg.cn/crop.0.0.1242.1242.180/0062U2Nojw8f4361kgs95j30yi0yidka.jpg', 257, 16),
(49, 399445710, '100808943c0bed581e5ed9b31f8c92fea6a6f6', '饼饼瘦到100斤就去见薛之谦', 21, 'http://tva2.sinaimg.cn/crop.3.0.1236.1236.180/ee169410jw8f63tvv0b9pj20yi0yctan.jpg', 248, 75),
(50, 291739250, '10080874902d46ec681d4996ba76144d30e88c', '栋哥哥u', 12, 'http://tva3.sinaimg.cn/crop.0.0.864.864.180/ade3e075jw8f687o9xcwdj20o00o00um.jpg', 13, 4),
(51, 306090403, '10080874902d46ec681d4996ba76144d30e88c', 'Inke521725511998', 2, 'http://tva1.sinaimg.cn/crop.0.0.864.864.180/b671b061jw8f687nsviufj20o00o0abh.jpg', 14, 2),
(52, 281360130, '10080874902d46ec681d4996ba76144d30e88c', '遗忘不了的美丽j1978', 2, 'http://tva2.sinaimg.cn/crop.0.0.180.180.180/a7b42617jw8f687p94gwtj2050050dfq.jpg', 41, 1),
(53, 249540620, '10080874902d46ec681d4996ba76144d30e88c', 'elf赤那1N2_XQY', 14, 'http://tva1.sinaimg.cn/crop.0.0.720.720.180/94bce07fjw8f687pfjforj20k00k0dgd.jpg', 31, 2),
(54, 247793906, '10080874902d46ec681d4996ba76144d30e88c', 'love虫虫宝贝z9', 4, 'http://tva3.sinaimg.cn/crop.0.0.640.640.180/93b25975jw8f687peqx2sj20hs0hs0tr.jpg', 19, 8),
(55, 259669667, '10080874902d46ec681d4996ba76144d30e88c', '笔峰181mt', 17, 'http://tva3.sinaimg.cn/crop.0.0.2048.2048.180/9ac67261jw8f687pg4n9cj21kw1kwq86.jpg', 6, 8),
(56, 179251177, '10080874902d46ec681d4996ba76144d30e88c', '嘟嘟儿1962', 21, 'http://tva4.sinaimg.cn/crop.0.0.576.576.180/6ad78f1bjw8f687pw3y16j20g00g0q3p.jpg', 6, 8),
(57, 565544722, '10080866304631c217adbe8d3705158a5977ae', 'aaGaodOng', 42, 'http://tva1.sinaimg.cn/crop.0.0.664.664.180/006aJGaIjw8f5yak5yx2jj30ig0igq41.jpg', 720, 111),
(58, 508936670, '10080866304631c217adbe8d3705158a5977ae', '我们爱听陈奕迅', 68, 'http://tva4.sinaimg.cn/crop.0.0.1242.1242.180/005yqsLLjw8f0huu791m1j30yi0yi75n.jpg', 6888, 784),
(59, 519134624, '10080866304631c217adbe8d3705158a5977ae', 'Amigas_', 30, 'http://tva3.sinaimg.cn/crop.0.0.664.664.180/005Fkmj2jw8f1pdlzex6ej30ig0igwfh.jpg', 621, 27),
(60, 229162542, '10080866304631c217adbe8d3705158a5977ae', '赵迪迪楚楚', 12, 'http://tva2.sinaimg.cn/crop.1.0.747.747.180/88976dccjw8f3gvhpy3qaj20ku0kr74i.jpg', 1818, 58),
(61, 210015067, '10080866304631c217adbe8d3705158a5977ae', 'Eason张琪', 23, 'http://tva3.sinaimg.cn/crop.0.8.496.496.180/7d2dc18fjw8f4u1tf5x65j20ds0e8mxs.jpg', 1578, 71),
(62, 206816846, '10080866304631c217adbe8d3705158a5977ae', '吹神博士', 11, 'http://tva4.sinaimg.cn/crop.0.0.640.640.180/7b45bf0fjw8f5313ysk29j20hs0hswev.jpg', 854, 25),
(63, 195597128, '10080866304631c217adbe8d3705158a5977ae', 'Vampire_pakho', 29, 'http://tva4.sinaimg.cn/crop.0.0.750.750.180/7495c0d1jw8f380eo2mzcj20ku0kudhq.jpg', 3090, 215);
-- --------------------------------------------------------
--
-- Table structure for table `topic`
--
CREATE TABLE `topic` (
`id` int(64) NOT NULL,
`tname` varchar(64) COLLATE utf8_bin NOT NULL,
`pic` varchar(128) COLLATE utf8_bin NOT NULL,
`containerid` varchar(128) COLLATE utf8_bin NOT NULL,
`text` varchar(1024) COLLATE utf8_bin NOT NULL,
`dianzan` int(64) NOT NULL,
`pinglun` int(64) NOT NULL,
`qianzai` int(64) NOT NULL,
`mingan` int(64) NOT NULL,
`dianzanrate` int(64) NOT NULL,
`pinglunrate` int(64) NOT NULL,
`qianzairate` int(64) NOT NULL,
`minganrate` int(64) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `topic`
--
INSERT INTO `topic` (`id`, `tname`, `pic`, `containerid`, `text`, `dianzan`, `pinglun`, `qianzai`, `mingan`, `dianzanrate`, `pinglunrate`, `qianzairate`, `minganrate`) VALUES
(1, '新边城浪子', 'http://ww3.sinaimg.cn/thumb180/005I6gWsgw1eveuk0lte3j30500500sq.jpg', '100808f1f691b58296230c33ff48acf388c384', '由东方飞云出品,改编自古龙的经典同名武侠小说,香港著名导演黄祖权执导、朱一龙、张馨予、于青斌、柴碧云、张峻宁、贡米、王艺曈、杨净如、焦恩俊、邱心志等主演的武侠巨作《#新边城浪子#》将于7月18日登陆北京卫视周播剧场。', 12, 9, 2, 5, 13, 14, 2, 6),
(2, '陈奕迅727生日粗卡', 'http://ww1.sinaimg.cn/thumb180/914137f4jw1f4y3y5mrkwj20go0l6taj.jpg', '10080866304631c217adbe8d3705158a5977ae', '陈奕迅,谢谢你,谢谢你温暖的那些岁月,陈奕迅生日快乐,感谢上帝赐予我这么一个你,陈奕迅,谢谢你,岁月不止,生命不息,流年已逝,青春渐远,谢谢你一直唱着最美的时光……', 2623, 122, 12, 19, 23, 45, 12, 5),
(3, '皮卡丘真正的脑洞', 'http://ww2.sinaimg.cn/thumb180/d562324ajw1f675m7akp6j2050050aa9.jpg', '100808c150492e76e9e27de806902c4993b565', '皮卡丘的城府也变深了,你怎么看? \n ', 23, 1, 24, 12, 1, 2, 2, 12),
(4, '没想到你是这样的张开', 'http://ww1.sinaimg.cn/thumb180/9fb33b0bgw1f67k7vj4hbj2050050wey.jpg', '10080874902d46ec681d4996ba76144d30e88c', '承诺说变就变,爱情的巨轮说沉就沉,宁愿相信前世有鬼,也不能相信董春辉的这张厚嘴。', 23, 2, 3, 2, 23, 34, 31, 14),
(5, '寻找生活咖', 'http://ww3.sinaimg.cn/thumb180/5ba3e275jw1f689u8uv9zj205005074g.jpg', '10080890eb9bdfb470c6291da3d979186c56b9', '如果关掉所有社交软件可能会生活得更棒点。想朋友了就去找她聊聊天,喝喝下午茶,然后找一个觉得相处不累的人陪着,无论以后有何改变,都不要影响自己。好好的生活。', 245, 23, 32, 3, 36, 56, 24, 3),
(6, '明星人气排行榜', 'http://ww4.sinaimg.cn/thumb180/8dc6020fgw1f66gnuamkrj2050050dg2.jpg', '1008082fc168ea5436aee16f4b3ad1d502285b', '明星人气排行榜,快来为你的偶像投票,参与话题。', 27364, 10362, 744, 39, 5, 24, 52, 21),
(7, '郭俊辰综艺谈吻戏', 'http://ww3.sinaimg.cn/thumb180/e5cb8076jw1f683uhh6iyj2050050jro.jpg', '100808a17e580841b3fac5f0cd1c9d4682a425', '95后高智商小鲜肉郭俊辰现身脱口秀节目《奶奶说》,不拒犀利提问,大胆回应“吻戏”问题。', 2314, 1222, 232, 3, 4, 3, 2, 4),
(8, '薛之谦被亲', 'http://ww2.sinaimg.cn/thumb180/74f67c55jw9f65yf7q20aj2050050t95.jpg', '100808943c0bed581e5ed9b31f8c92fea6a6f6', '薛之谦被亲,薛之谦被亲是在火星情报局的发布会上被亲的,各位谦友们是不是又喜又恼呢?', 232133, 137421, 3453, 45, 34, 56, 22, 34),
(9, '审讯室内戴头盔死亡', 'http://ww1.sinaimg.cn/thumb180/005vnhZYgw1f685zoghfhj3050050jrh.jpg', '1008084a4559d4e8c7eaea677e8141e730a3f0', '3月3日,彭明镜独自从武汉前往大理旅游,18日死亡。其父母称,遗体有多处伤。大理政法委、检察院、公安局相关工作人员称,彭因砸别人的车、电脑被警方抓获,在派出所审讯时死亡,监控显示他“头戴摩托车头盔”。', 123, 31, 254, 76, 12, 11, 2, 4);
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(64) NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`pswd` varchar(64) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `username`, `pswd`) VALUES
(1, 'Bonsen', '123456');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `people`
--
ALTER TABLE `people`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ppeople`
--
ALTER TABLE `ppeople`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `qianzai`
--
ALTER TABLE `qianzai`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `topic`
--
ALTER TABLE `topic`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `people`
--
ALTER TABLE `people`
MODIFY `id` int(64) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `ppeople`
--
ALTER TABLE `ppeople`
MODIFY `id` int(64) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `qianzai`
--
ALTER TABLE `qianzai`
MODIFY `id` int(64) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=64;
--
-- AUTO_INCREMENT for table `topic`
--
ALTER TABLE `topic`
MODIFY `id` int(64) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(64) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
| true
|
0bd89e30fb43c654373ce76778439dd4bcd2a7b3
|
SQL
|
1241545483/terrace-cloud
|
/sql/20181224-counts-ddl.sql
|
UTF-8
| 598
| 3.296875
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS media_counts;
CREATE TABLE media_counts
(
rec_id VARCHAR(30) NOT NULL COMMENT '主键',
media_id VARCHAR(30) NOT NULL COMMENT '被播放ID',
media_type VARCHAR(30) NOT NULL COMMENT '播放类型',
clicked VARCHAR(10) COMMENT '点击音频,未播放完成',
finished VARCHAR(10) COMMENT '音频播放完成',
create_time VARCHAR(30) COMMENT '创建时间',
PRIMARY KEY (rec_id )
);
alter table media_counts comment '统计播放量';
alter table audio add column finish_num bigint(11) DEFAULT 0 comment '播放完成总数' after play_num;
| true
|
aafeeccd31e3c9c6ac0893bb1a27743817879eab
|
SQL
|
rlawjdgnsdle/GMS_MODEL2
|
/src/pool/gms.sql
|
UTF-8
| 412
| 3.09375
| 3
|
[] |
no_license
|
select * from member;
UPDATE MEMBER
SET
TEAM_ID = 'BTEAM',
ROLL = 'leader' ,
AGE = '26' ,
password = '1'
WHERE MEM_NAME like '지은';
,'지은','준','재경','단아'
select * from Project_TEAM;
UPDATE PROJECT_TEAM SET TEAM_ID = 'DTEAM'
WHERE TEAM_NAME LIKE '어벤저스';
UPDATE MEMBER SET TEAM_ID = 'ATEAM', ROLL = 'leader'
WHERE MEM_ID LIKE '가오갤1' AND PASSWORD LIKE '1';
| true
|
8e50edad97151cf9ee1f239f09d5531b11d6e9bd
|
SQL
|
adegbola/SuperHero
|
/Superheros.sql
|
UTF-8
| 4,407
| 3.4375
| 3
|
[] |
no_license
|
-- MySQL Script generated by MySQL Workbench
-- Wed Jul 19 20:06:59 2017
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `SuperHero` ;
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `SuperHero` DEFAULT CHARACTER SET utf8 ;
USE `SuperHero` ;
-- -----------------------------------------------------
-- Table `mydb`.`SuperHero`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `SuperHero`.`SuperHero` ;
CREATE TABLE IF NOT EXISTS `SuperHero`.`SuperHero` (
`SuperHeroID` INT NOT NULL AUTO_INCREMENT,
`FirstName` VARCHAR(45) NOT NULL,
`LastName` VARCHAR(45) NOT NULL,
`Description` VARCHAR(150) NOT NULL,
`SuperPower` VARCHAR(150) NULL,
`SuperHerocol` VARCHAR(150) NULL,
PRIMARY KEY (`SuperHeroID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Location`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `SuperHero`.`Location` ;
CREATE TABLE IF NOT EXISTS `SuperHero`.`Location` (
`LocationID` INT NOT NULL AUTO_INCREMENT,
`LocationName` VARCHAR(45) NOT NULL,
`LocationDescription` VARCHAR(200) NOT NULL,
`LocationAddress` VARCHAR(200) NOT NULL,
`Longitude` varchar(10) NOT NULL,
`Latitude` varchar(10) NOT NULL,
PRIMARY KEY (`LocationID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Organization`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `SuperHero`.`Organization` ;
CREATE TABLE IF NOT EXISTS `SuperHero`.`Organization` (
`OrganizationID` INT NOT NULL AUTO_INCREMENT,
`OrganizationName` VARCHAR(45) NOT NULL,
`OrganizationDescription` VARCHAR(200) NOT NULL,
`Phone` VARCHAR(45) NOT NULL,
`Email` VARCHAR(45) NOT NULL,
`LocationID` INT NULL,
PRIMARY KEY (`OrganizationID`),
INDEX `LocationID_idx` (`LocationID` ASC),
CONSTRAINT `LocationID`
FOREIGN KEY (`LocationID`)
REFERENCES `SuperHero`.`Location` (`LocationID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`SuperHeroOrganization`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `SuperHero`.`SuperHeroOrganization` ;
CREATE TABLE IF NOT EXISTS `SuperHero`.`SuperHeroOrganization` (
`SuperHeroID` INT NOT NULL,
`OrganizationID` INT NOT NULL,
PRIMARY KEY (`SuperHeroID`, `OrganizationID`),
INDEX `fk_SuperHero_has_Organization_Organization1_idx` (`OrganizationID` ASC),
INDEX `fk_SuperHero_has_Organization_SuperHero_idx` (`SuperHeroID` ASC),
CONSTRAINT `SuperHeroID`
FOREIGN KEY (`SuperHeroID`)
REFERENCES `SuperHero`.`SuperHero` (`SuperHeroID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `OrganizationID`
FOREIGN KEY (`OrganizationID`)
REFERENCES `SuperHero`.`Organization` (`OrganizationID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Sighting`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `SuperHero`.`Sighting` ;
CREATE TABLE IF NOT EXISTS `SuperHerohashtag`.`Sighting` (
`SightingID` INT NOT NULL AUTO_INCREMENT,
`DateDateTime` datetime NOT NULL,
`SuperHeroID` INT NULL,
`LocationID` INT NULL,
PRIMARY KEY (`SightingID`),
INDEX `SuperHeroID_idx` (`SuperHeroID` ASC),
INDEX `LocationID_idx` (`LocationID` ASC),
CONSTRAINT `Sighting_SuperHeroID`
FOREIGN KEY (`SuperHeroID`)
REFERENCES `SuperHero`.`SuperHero` (`SuperHeroID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Sighting_LocationID`
FOREIGN KEY (`LocationID`)
REFERENCES `SuperHero`.`Location` (`LocationID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true
|
8e1eecdb78bca63f68cd5e66fba289bffdc1c1bb
|
SQL
|
existentialcoder/narrated-diffs
|
/server/migrations/002_add_users.sql
|
UTF-8
| 214
| 2.78125
| 3
|
[] |
no_license
|
create table users
(
id bigserial primary key,
github_id bigint not null,
github_username varchar(39) not null,
github_token varchar(100) not null,
constraint unq_github_id unique (github_id)
)
| true
|
d8f3f9e283316d033d6abeea8a50d76d0174a70c
|
SQL
|
GersanCabo/bae_gersan
|
/Tema 6/6.9.sql
|
UTF-8
| 3,217
| 4.21875
| 4
|
[] |
no_license
|
DROP DATABASE IF EXISTS empresa;
CREATE DATABASE IF NOT EXISTS empresa;
USE empresa;
/*
1. Borramos las tablas si existen y procedemos a crearlas.
*/
DROP TABLE IF EXISTS clientes, provincias;
CREATE TABLE clientes (
codigo INT UNSIGNED NOT NULL AUTO_INCREMENT,
nombre VARCHAR(30) NOT NULL,
domicilio VARCHAR(30),
ciudad VARCHAR(20),
codigoprovincia TINYINT UNSIGNED,
telefono VARCHAR(11),
PRIMARY KEY (codigo)
);
CREATE TABLE provincias (
codigo TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
nombre VARCHAR(20),
PRIMARY KEY (codigo)
);
/*
2. Cargamos una serie de registros en las tablas.
*/
INSERT INTO clientes VALUES (1,"Lopez Marcos","Colon 111","Cordoba",1,null);
INSERT INTO clientes VALUES (2,"Perez Ana","San Martin 222","Cruz del Eje",1,4578585);
INSERT INTO clientes VALUES (3,"Garcia Juan","Rivadavia 333","Villa Maria",1,4578445);
INSERT INTO clientes VALUES (4,"Perez Luis","Sarmiento 444","Rosario",2,NULL);
INSERT INTO clientes VALUES (5,"Pereyra Lucas","San Martin 555","Cruz del Eje",1,4253685);
INSERT INTO clientes VALUES (6,"Gomez Ines","San Martin 666","Santa Fe",2,0345252525);
INSERT INTO clientes VALUES (7,"Torres Fabiola","Alem 777","Villa del Rosario",1,4554455);
INSERT INTO clientes VALUES (8,"Lopez Carlos","Irigoyen 888","Cruz del Eje",1,NULL);
INSERT INTO clientes VALUES (9,"Ramos Betina ","San Martin 999","Cordoba",1,4223366);
INSERT INTO clientes VALUES (10,"Lopez Lucas","San Martin 1010","Posadas",4,0457858745);
INSERT INTO provincias VALUES (1,"Cordoba");
INSERT INTO provincias VALUES (2,"Santa Fe");
INSERT INTO provincias VALUES (3,"Corrientes");
INSERT INTO provincias VALUES (4,"Misiones");
INSERT INTO provincias VALUES (5,"Salta");
INSERT INTO provincias VALUES (6,"Buenos Aires");
INSERT INTO provincias VALUES (7,"Neuquen");
/*
3. Crear un procedimiento almacenado que le enviemos como parámetro los nombres de dos provincias y genere como resultado el nombre de la provincia
que tiene más clientes y su cantidad, en caso de tener la misma cantidad mostrar las dos provincias y la cantidad. Dentro del procedimiento almacenado
definimos dos variables locales llamadas 'canti1' y 'canti2' que almacenan en forma temporal la cantidad de clientes que hay en cada una de las dos
provincias consultadas.
*/
DROP PROCEDURE IF EXISTS cantidad_clientes_comparar;
DELIMITER //
CREATE PROCEDURE cantidad_clientes_comparar (
in provincia1 VARCHAR(20),
in provincia2 VARCHAR(20),
out canti1 INT,
out canti2 INT
)
BEGIN
declare canti1, canti2, suma int;
SELECT COUNT(clientes.codigo) FROM clientes JOIN provincias ON clientes.codigoprovincia = provincias.codigo WHERE provincias.nombre = provincia1 into canti1;
SELECT COUNT(clientes.codigo) FROM clientes JOIN provincias ON clientes.codigoprovincia = provincias.codigo WHERE provincias.nombre = provincia2 into canti2;
CASE
WHEN canti1 > canti2 THEN
SELECT canti1;
WHEN canti1 < canti2 THEN
SELECT canti2;
ELSE
SELECT canti1;
SELECT canti2;
END CASE;
END //
DELIMITER ;
--4. Llama al procedimiento almacenado pasando dos provincias y muestra el resultado.
CALL cantidad_clientes_comparar("Cordoba","Santa Fe",@canti1,@canti2);
| true
|
08a972cf5b2293169cde0bb56d288f933c3cf4ca
|
SQL
|
vijaydairyf/TimelyFish
|
/SolomonApp/dbo/Views/dbo.vCFPigSaleDetailUNION.sql
|
UTF-8
| 2,066
| 2.75
| 3
|
[] |
no_license
|
--*************************************************************
-- Purpose:Pig Sale Account Detail
--
-- Author: Charity Anderson
-- Date: 7/18/2005
-- Usage: EssBase vCFPigSaleEssbase
-- Parms: None
--*************************************************************
CREATE VIEW vCFPigSaleDetailUNION
AS
Select RefNbr, 'AmtCheck' as Account, AmtCheck as Value
FROM cftPigSale
where PigGroupID>'' and AmtCheck<>0
UNION ALL
Select RefNbr, 'AmtBaseSale' as Account, AmtBaseSale
FROM cftPigSale
where PigGroupID>'' and AmtBaseSale<>0
UNION ALL
Select RefNbr, 'AmtGradePrem' as Account, AmtGradePrem
FROM cftPigSale
where PigGroupID>'' and AmtGradePrem<>0
UNION ALL
Select RefNbr, 'AmtInsect' as Account, AmtInsect
FROM cftPigSale
where PigGroupID>'' and AmtInsect<>0
UNION ALL
Select RefNbr, 'AmtNPPC' as Account, AmtNPPC
FROM cftPigSale
where PigGroupID>'' and AmtNPPC<>0
UNION ALL
Select RefNbr, 'AmtOther' as Account, AmtOther
FROM cftPigSale
where PigGroupID>'' and AmtOther<>0
UNION ALL
Select RefNbr, 'AmtScale' as Account, AmtScale
FROM cftPigSale
where PigGroupID>'' and AmtScale<>0
UNION ALL
Select RefNbr, 'AmtSortLoss' as Account, AmtSortLoss
FROM cftPigSale
where PigGroupID>'' and AmtSortLoss<>0
UNION ALL
Select RefNbr, 'AmtTruck' as Account, AmtTruck
FROM cftPigSale
where PigGroupID>'' and AmtTruck<>0
UNION ALL
Select RefNbr, 'DelvCarcWgt' as Account, DelvCarcWgt
FROM cftPigSale
where PigGroupID>''
UNION ALL
Select RefNbr, 'DelvLiveWgt' as Account, DelvLiveWgt
FROM cftPigSale
where PigGroupID>''
UNION ALL
Select RefNbr, 'AmtInsur' as Account, AmtInsur
FROM cftPigSale
where PigGroupID>'' and AmtInsur<>0
UNION ALL
Select RefNbr,
'LW_' + DetailTypeID
Account,WgtLive as Value
FROM cftPSDetail
where WgtLive<>0
UNION ALL
Select RefNbr,
'CW_' + DetailTypeID
Account,WgtCarc as Value
FROM cftPSDetail
UNION ALL
Select RefNbr,'HC_' + DetailTypeID as Account,
Qty
FROM cftPSDetail
UNION ALL
Select RefNbr,'EstWgt' as Account,
cast(pm.EstimatedWgt as smallint) as Value
FROM cftPigSale ps
JOIN cftPM pm on ps.PMLoadID=pm.PMID
where pm.EstimatedWgt>0
| true
|
528fe102392ccd28d4bdf963b99dde84c40bad08
|
SQL
|
markarsanious/Schools_Website
|
/Databases/update.sql
|
UTF-8
| 2,354
| 3.984375
| 4
|
[] |
no_license
|
use School_Network;
Drop PROCEDURE acceptOrReject;
delimiter //
CREATE PROCEDURE acceptOrReject(school_nameProc VARCHAR(50),child_ssnProc VARCHAR(50),
verdict TINYINT)
BEGIN
UPDATE Parents_apply_for_Schools P SET P.accepted=verdict
WHERE P.school_name=school_nameProc and P.child_ssn=child_ssnProc;
END//
DROP PROCEDURE IF EXISTS School_Network.View_Students_Enrolled_To_My_School;
CREATE PROCEDURE View_Students_Enrolled_To_My_School(adminSSN VARCHAR(50))
BEGIN
Select st.* from Students st WHERE st.enrolled_school_name=(SELECT school_name FROM Employees E
WHERE E.ssn=adminSSN) and st.username is NULL ;
END//
DROP PROCEDURE IF EXISTS School_Network.View_Teachers_Applied_for_My_School;
CREATE PROCEDURE View_Teachers_Applied_for_My_School(adminSSN VARCHAR(50))
BEGIN
Select * from Employees e1
WHERE e1.school_name=(SELECT school_name from Employees e2 WHERE e2.ssn=adminSSN)
AND e1.ssn IN (SELECT ssn FROM Teachers ) AND e1.username is NULL ;
END//
DROP PROCEDURE IF EXISTS School_Network.verifyStudents;
CREATE PROCEDURE verifyStudents(adminSSN VARCHAR(50),studentSSN VARCHAR(50),usernameProc VARCHAR(50),passwordProc VARCHAR(50))
BEGIN
if(SELECT exists(SELECT * FROM Students S1 WHERE S1.student_ssn=studentSSN and
S1.enrolled_school_name in(SELECT E1.school_name
FROM Employees E1
WHERE E1.ssn=adminSSN))) THEN
UPDATE Students S SET S.username=usernameProc,S.password=passwordProc
where S.student_ssn = studentSSN;
ELSE
SELECT 'Student not found in students you have access to';
END IF;
END //
DROP PROCEDURE IF EXISTS School_Network.viewChildrenApplications;
CREATE PROCEDURE viewChildrenApplications(adminSSN VARCHAR(50))
BEGIN
SELECT * FROM Parents_apply_for_Schools P WHERE
P.school_name=(SELECT Employees.school_name FROM Employees WHERE adminSSN=Employees.ssn);
END //
DELIMITER ;
DROP TABLE Parents_apply_for_Schools;
CREATE TABLE `Parents_apply_for_Schools` (
`school_name` varchar(50) NOT NULL,
`child_ssn` varchar(50) NOT NULL,
`accepted` tinyint(4) DEFAULT '0',
`grade` int(11) NOT NULL,
`parent_username` varchar(50) DEFAULT NULL,
PRIMARY KEY (`school_name`,`child_ssn`)
)
| true
|
5f451ccc77506bfdebdcaf90eef4adbda91d2e14
|
SQL
|
shadowfox/caldav-tool
|
/schema_sqlite3.sql
|
UTF-8
| 221
| 2.609375
| 3
|
[] |
no_license
|
CREATE TABLE account (
id TEXT PRIMARY KEY,
server_uri TEXT NOT NULL,
username TEXT,
password TEXT
);
CREATE TABLE calendar (
id TEXT PRIMARY KEY,
account_id TEXT NOT NULL,
name TEXT NOT NULL,
uri TEXT NOT NULL
)
| true
|
17a885a4997d226ec97ed72f7912b5327e1aa9c0
|
SQL
|
likhithakishore/edX_Data_Science
|
/Querying with Transact SQL/Lab1.sql
|
UTF-8
| 953
| 3.78125
| 4
|
[] |
no_license
|
--challenge 1
SELECT *
FROM SalesLT.Customer;
SELECT Title, FirstName,MiddleName, Lastname, Suffix
FROM SalesLT.Customer;
SELECT Salesperson, Title + ' ' + LastName AS CustomerName, Phone
FROM SalesLT.Customer;
--challenge 2
SELECT CAST(CustomerID AS varchar) + ': ' + CompanyName AS CustomerCompany
FROM SalesLT.Customer;
SELECT CAST(SalesOrderNumber AS varchar(5)) + ' ' + '(' + CAST(RevisionNumber AS varchar(2)) + ')' AS SalesOrderID,
CONVERT(nvarchar(30),OrderDate, 102) AS ANSIFormatDate
FROM SalesLT.SalesOrderHeader;
--challenge 3
SELECT FirstName + ' ' + ISNULL(MiddleName,'') + ' ' + Lastname + ISNULL(Suffix,'') AS CustomerContactName
FROM SalesLT.Customer;
SELECT CustomerID, COALESCE(EmailAddress, Phone) AS PrimaryContact
FROM SalesLT.Customer;
SELECT SalesOrderID, OrderDate,
CASE WHEN ShipDate IS NULL
THEN 'Awaiting Shipment'
ELSE 'Shipped'
END AS ShippingStatus
FROM SalesLT.SalesOrderHeader;
| true
|
07f92979d613ea016f48846c620345c85e265145
|
SQL
|
danieldiamond/gitlab-analytics
|
/transform/snowflake-dbt/models/bamboohr/xf/employee_directory.sql
|
UTF-8
| 2,897
| 4.0625
| 4
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
WITH bamboohr_directory AS (
SELECT *
FROM {{ ref ('bamboohr_directory') }}
), department_info as (
SELECT employee_id,
last_value(job_title) RESPECT NULLS
OVER ( PARTITION BY employee_id ORDER BY job_id ) AS last_job_title,
last_value(reports_to) RESPECT NULLS
OVER ( PARTITION BY employee_id ORDER BY job_id ) AS last_supervisor,
last_value(department) RESPECT NULLS
OVER ( PARTITION BY employee_id ORDER BY job_id ) AS last_department,
last_value(division) RESPECT NULLS
OVER ( PARTITION BY employee_id ORDER BY job_id ) AS last_division
FROM {{ ref ('bamboohr_job_info') }}
), cost_center AS (
SELECT
employee_id,
last_value(cost_center) RESPECT NULLS
OVER ( PARTITION BY employee_id ORDER BY effective_date) AS last_cost_center
FROM {{ ref ('bamboohr_job_role') }}
), mapping as (
SELECT *
FROM {{ref('bamboohr_id_employee_number_mapping')}}
), location_factor as (
SELECT distinct bamboo_employee_number,
FIRST_VALUE(location_factor) OVER ( PARTITION BY bamboo_employee_number ORDER BY valid_from) AS hire_location_factor
FROM {{ ref('employee_location_factor_snapshots') }}
), initial_hire AS (
SELECT
employee_id,
effective_date as hire_date
FROM {{ref('bamboohr_employment_status')}}
WHERE employment_status != 'Terminated'
QUALIFY ROW_NUMBER() OVER (PARTITION BY employee_id ORDER BY effective_date) = 1
), rehire AS (
Select
employee_id,
is_rehire,
valid_from_date as rehire_date
FROM {{ref('bamboohr_employment_status_xf')}}
WHERE is_rehire='True'
)
SELECT distinct
mapping.employee_id,
mapping.employee_number,
mapping.first_name,
mapping.last_name,
bamboohr_directory.work_email,
iff(rehire.is_rehire = 'True', initial_hire.hire_date, mapping.hire_date) AS hire_date,
rehire.rehire_date,
mapping.termination_date,
department_info.last_job_title,
department_info.last_supervisor,
department_info.last_department,
department_info.last_division,
cost_center.last_cost_center,
location_factor.hire_location_factor
FROM mapping
LEFT JOIN bamboohr_directory
ON bamboohr_directory.employee_id = mapping.employee_id
LEFT JOIN department_info
ON mapping.employee_id = department_info.employee_id
LEFT JOIN location_factor
ON location_factor.bamboo_employee_number = mapping.employee_number
LEFT JOIN initial_hire
ON initial_hire.employee_id = mapping.employee_id
LEFT JOIN rehire
ON rehire.employee_id = mapping.employee_id
LEFT JOIN cost_center
ON cost_center.employee_id = mapping.employee_id
WHERE mapping.hire_date < date_trunc('week', dateadd(week, 3, CURRENT_DATE))
| true
|
36434d4681fafb98a4edaa01c6b28117cf57d702
|
SQL
|
greut/cs322
|
/queries/basic_k.sql
|
UTF-8
| 471
| 4.375
| 4
|
[] |
no_license
|
-- List the last and first name of the players who played for a Chicago team
-- and Houston team.
SELECT DISTINCT
p.id, firstname, lastname
FROM
player_seasons ps
JOIN teams t ON
ps.team_id = t.id AND
t.city LIKE 'Houston'
JOIN player_seasons ps2 ON ps2.person_id = ps.person_id
JOIN teams t2 ON
ps2.team_id = t2.id AND
t2.city LIKE 'Chicago'
JOIN people p ON p.id = ps.person_id
ORDER BY
lastname, firstname;
| true
|
2271c09227cc44409c028dc86711bc9007047981
|
SQL
|
joaoAndradeJr/MySql-One-For-All
|
/desafio3.sql
|
UTF-8
| 272
| 3.3125
| 3
|
[] |
no_license
|
CREATE VIEW historico_reproducao_usuarios AS
SELECT u.`name` AS usuario, s.`name` AS nome FROM SpotifyClone.user AS u
INNER JOIN SpotifyClone.listened_song AS ls
ON u.user_id = ls.user_id
INNER JOIN SpotifyClone.song AS s
ON ls.song_id = s.song_id
ORDER BY usuario, nome;
| true
|
4b1f52f4409a5a6cfeafe9fb7b6dba585c167602
|
SQL
|
vijayshekh04/Bookstore
|
/database/bookstores.sql
|
UTF-8
| 10,425
| 3.015625
| 3
|
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 16, 2020 at 09:01 AM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `bookstores`
--
-- --------------------------------------------------------
--
-- Table structure for table `books`
--
CREATE TABLE `books` (
`id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) UNSIGNED NOT NULL,
`sub_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`std` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`sell_date` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `books`
--
INSERT INTO `books` (`id`, `user_id`, `sub_name`, `std`, `book_price`, `sell_date`, `book_image`, `created_at`, `updated_at`) VALUES
(1, 1, 'Gujarati', '10', '100', '2020-03-16 04:36:39', 'uploads/bookimage/185393443_gujrati.jpg', '2020-03-16 11:36:39', '2020-03-16 11:36:39'),
(2, 1, 'Social Science', '10', '200', '2020-03-16 04:37:09', 'uploads/bookimage/792411196_social.jpg', '2020-03-16 11:37:09', '2020-03-16 11:37:09'),
(3, 1, 'Science Technology', '10', '300', '2020-03-16 04:37:30', 'uploads/bookimage/1773069398_science.jpg', '2020-03-16 11:37:30', '2020-03-16 11:37:30'),
(4, 1, 'Mathematics', '10', '100', '2020-03-16 04:37:58', 'uploads/bookimage/1747892696_match.jpeg', '2020-03-16 11:37:58', '2020-03-16 11:37:58'),
(5, 1, 'English', '10', '100', '2020-03-16 04:41:08', 'uploads/bookimage/289141902_English.jpg', '2020-03-16 11:41:08', '2020-03-16 11:41:08'),
(6, 1, 'Sanskrit', '10', '100', '2020-03-16 04:41:51', 'uploads/bookimage/774670877_sankrut.jpg', '2020-03-16 11:41:51', '2020-03-16 11:41:51');
-- --------------------------------------------------------
--
-- Table structure for table `buy_books`
--
CREATE TABLE `buy_books` (
`id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) UNSIGNED NOT NULL,
`sub_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`std` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`buy_date` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `carts`
--
CREATE TABLE `carts` (
`id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) UNSIGNED NOT NULL,
`sellid` bigint(20) UNSIGNED NOT NULL,
`sub_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`std` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cart_date` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `carts`
--
INSERT INTO `carts` (`id`, `user_id`, `sellid`, `sub_name`, `std`, `book_price`, `cart_date`, `book_image`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 'Gujarati', '10', '100', '2020-03-16 04:42:20', 'uploads/bookimage/185393443_gujrati.jpg', '2020-03-16 11:42:20', '2020-03-16 11:42:20'),
(2, 1, 2, 'Social Science', '10', '200', '2020-03-16 04:42:28', 'uploads/bookimage/792411196_social.jpg', '2020-03-16 11:42:28', '2020-03-16 11:42:28'),
(3, 2, 3, 'Science Technology', '10', '300', '2020-03-16 04:46:40', 'uploads/bookimage/1773069398_science.jpg', '2020-03-16 11:46:40', '2020-03-16 11:46:40'),
(4, 2, 5, 'English', '10', '100', '2020-03-16 04:51:42', 'uploads/bookimage/289141902_English.jpg', '2020-03-16 11:51:42', '2020-03-16 11:51:42');
-- --------------------------------------------------------
--
-- Table structure for table `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2020_02_14_100356_create_books_table', 1),
(5, '2020_02_20_162742_create_buy_books_table', 1),
(6, '2020_02_28_093428_create_carts_table', 1),
(7, '2020_03_09_070502_create_orders_table', 1);
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE `orders` (
`id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) UNSIGNED NOT NULL,
`cart_id` bigint(20) UNSIGNED NOT NULL,
`order_date` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `orders`
--
INSERT INTO `orders` (`id`, `user_id`, `cart_id`, `order_date`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '2020-03-16 04:42:53', '2020-03-16 11:42:53', '2020-03-16 11:42:53'),
(2, 2, 3, '2020-03-16 04:46:47', '2020-03-16 11:46:47', '2020-03-16 11:46:47'),
(3, 2, 4, '2020-03-16 04:51:46', '2020-03-16 11:51:46', '2020-03-16 11:51:46');
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`mobile` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`school` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `address`, `mobile`, `school`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'vijay', 'rajkot', '9998319620', 'atmiya', 'vijay@gmail.com', NULL, '$2y$10$9HIJqDzJ9kc1A/dW4oKrvufR5BXhgcPBYx6FJoKNq.M6QkBMYkKMC', NULL, '2020-03-16 11:36:03', '2020-03-16 11:36:03'),
(2, 'heet', 'RAJKOT gujarat india', '9664520856', 'gangotri school gondal', 'heet!@gmail.com', NULL, '$2y$10$C1ob3lVx.ecsNO6mLivS0eh6L6qoHPoKgCb7yne3KQLMONkNHXd4m', NULL, '2020-03-16 11:46:28', '2020-03-16 11:46:28');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `books`
--
ALTER TABLE `books`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `buy_books`
--
ALTER TABLE `buy_books`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `carts`
--
ALTER TABLE `carts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `books`
--
ALTER TABLE `books`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `buy_books`
--
ALTER TABLE `buy_books`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `carts`
--
ALTER TABLE `carts`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
2d9e61937d37f53a385cc329d7940e953594eb88
|
SQL
|
CSharp-Databases-MS-SQL-Server/03.Table-Relations
|
/02. One-To-Many Relationship.sql
|
UTF-8
| 819
| 3.71875
| 4
|
[] |
no_license
|
--02. One-To-Many Relationship
CREATE TABLE Manufacturers
(
ManufacturerID INT IDENTITY PRIMARY KEY,
[Name] VARCHAR(30) NOT NULL,
EstablishedOn DATETIME NOT NULL
)
SET IDENTITY_INSERT Manufacturers ON
INSERT INTO Manufacturers(ManufacturerID, Name, EstablishedOn) VALUES
(1, 'BMW', '07/03/1916'),
(2, 'Tesla', '01/01/2003'),
(3, 'Lada', '01/05/1966')
CREATE TABLE Models
(
ModelID INT PRIMARY KEY IDENTITY(101,1),
[Name] VARCHAR(30) NOT NULL,
ManufacturerID INT FOREIGN KEY REFERENCES Manufacturers(ManufacturerID)
)
SET IDENTITY_INSERT Manufacturers OFF
SET IDENTITY_INSERT Models ON
INSERT INTO Models(Name, ManufacturerID) VALUES
('X1', 1),
('i6', 1),
('Model S', 2),
('Model X', 2),
('Model 3', 2),
('Nova', 3)
SET IDENTITY_INSERT Models OFF
| true
|
fa65f992c3a5c6a0a9295e639ba475d7a99ac05c
|
SQL
|
iamfarghali/CRUD-System-Using-OOP
|
/database/products.sql
|
UTF-8
| 354
| 3.015625
| 3
|
[
"MIT"
] |
permissive
|
-- Table Structure for table `products`
CREATE TABLE IF NOT EXISTS `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(40) NOT NULL,
`description` text NOT NULL,
`price` decimal(7,2) NOT NULL,
`category_id` int(11) NOT NULL,
`created` datetime NOT NULL,
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(`id`)
);
| true
|
ec88cdf1f6a8e8d22dc137ef0c83f0215169c39f
|
SQL
|
BamindaGeek/API_REST_CAMP
|
/.idea/dataSources/5445b7b6-fc7d-4528-be7e-2fefcd9dda55/storage_v2/_staging_/schema/campagne_bd.w_EoeQ/routine/ps_AffectationMission.juZwoQ.sql
|
UTF-8
| 1,875
| 3.390625
| 3
|
[] |
no_license
|
create
definer = root@localhost procedure ps_AffectationMission(IN _affectationMissionId varchar(36),
IN _missionId varchar(36), IN _membreId varchar(36),
IN _createdBy varchar(36), IN _action varchar(100))
BEGIN
#Routine body goes here...
IF (_action='Insert') THEN
INSERT INTO affectationMission (affectationMissionId, missionId,membreId,createdBy)
VALUES (_affectationMissionId, _missionId,_membreId,_createdBy);
END IF;
IF (_action='UpdateById') THEN
UPDATE affectationMission
SET
missionId = _missionId,
membreId=_membreId
WHERE affectationMissionId=_affectationMissionId;
END IF;
IF (_action='DeleteById') THEN
UPDATE affectationMission
SET
status=0
WHERE affectationMissionId =_affectationMissionId ;
END IF;
IF (_action='SelectAll') THEN
SELECT affectationMission.*,mission.libelle AS Aff_lib,membre.nom AS AffM_Membre
FROM affectationMission
INNER JOIN mission ON mission.missionId = affectationMission.missionId
INNER JOIN membre ON membre.membreId = affectationMission.membreId
where affectationMission.status=1;
END IF;
IF (_Action='SelectById') THEN
SELECT affectationMission.*,mission.libelle AS Aff_lib,membre.nom AS AffM_Membre
FROM affectationMission
INNER JOIN mission ON mission.missionId = affectationMission.missionId
INNER JOIN membre ON membre.membreId = affectationMission.membreId
WHERE affectationMission.affectationMissionId = _affectationMissionId and affectationMission.status=1;
END IF;
END;
| true
|
a46c299bf5f94f52c30722a0ac7423a407458624
|
SQL
|
zhuzio/sugeAicao
|
/aicao.sql
|
UTF-8
| 8,993
| 2.90625
| 3
|
[] |
no_license
|
/*
Navicat MySQL Data Transfer
Source Server : yuyulu
Source Server Version : 50718
Source Host : localhost:3306
Source Database : aicao
Target Server Type : MYSQL
Target Server Version : 50718
File Encoding : 65001
Date: 2017-10-16 11:44:20
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for ai_admin
-- ----------------------------
DROP TABLE IF EXISTS `ai_admin`;
CREATE TABLE `ai_admin` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '管理员id',
`name` varchar(16) NOT NULL COMMENT '管理员名称',
`sex` tinyint(1) DEFAULT NULL COMMENT '性别 0为男 1为女',
`phone` varchar(15) DEFAULT NULL COMMENT '电话',
`email` varchar(32) DEFAULT NULL COMMENT '邮箱',
`pass` varchar(32) NOT NULL COMMENT '密码',
`state` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 1为启用 0为禁用',
`addtime` int(11) DEFAULT NULL COMMENT '注册时间',
`root` tinyint(4) DEFAULT '1' COMMENT '权限',
`logintimes` int(11) DEFAULT '0' COMMENT '登陆时间',
`logintime` int(11) DEFAULT NULL COMMENT '登陆时间',
`loginip` varchar(15) DEFAULT NULL COMMENT '登录ip',
`role_id` int(11) NOT NULL COMMENT '所属角色',
`beizhu` varchar(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ai_admin
-- ----------------------------
INSERT INTO `ai_admin` VALUES ('1', 'admin', '1', '13193835328', '1065673465@qq.com', '000000', '1', '1493608027', '0', '4', '1493608032', '127.0.0.1', '2', null);
INSERT INTO `ai_admin` VALUES ('7', 'test1', '1', '13193835329', '123456@qq.com', '000000', '1', '1507950400', '1', '2', null, null, '4', '000');
-- ----------------------------
-- Table structure for ai_auth
-- ----------------------------
DROP TABLE IF EXISTS `ai_auth`;
CREATE TABLE `ai_auth` (
`auth_id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
`auth_name` varchar(20) NOT NULL COMMENT '名称',
`auth_pid` smallint(6) unsigned NOT NULL COMMENT '父id',
`auth_c` varchar(32) NOT NULL DEFAULT '' COMMENT '控制器',
`auth_a` varchar(32) NOT NULL DEFAULT '' COMMENT '操作方法',
`auth_path` varchar(32) DEFAULT NULL COMMENT '全路径',
`auth_level` tinyint(4) NOT NULL DEFAULT '0' COMMENT '级别',
PRIMARY KEY (`auth_id`)
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ai_auth
-- ----------------------------
INSERT INTO `ai_auth` VALUES ('1', '公告管理', '0', '', '', '0-1', '0');
INSERT INTO `ai_auth` VALUES ('2', '公告列表', '1', 'Article', 'articleList', '1-2', '0');
INSERT INTO `ai_auth` VALUES ('3', '管理员管理', '0', '', '', '0-3', '0');
INSERT INTO `ai_auth` VALUES ('4', '角色管理', '3', 'Admin', 'adminRole', '3-4', '0');
INSERT INTO `ai_auth` VALUES ('5', '权限管理', '3', 'Admin', 'adminPermission', '3-5', '0');
INSERT INTO `ai_auth` VALUES ('6', '管理员列表', '3', 'Admin', 'adminList', '3-6', '0');
INSERT INTO `ai_auth` VALUES ('7', '代理商管理', '0', '', '', '0-7', '0');
INSERT INTO `ai_auth` VALUES ('83', '联创列表', '7', 'Member', 'member1List', '7-83', '0');
INSERT INTO `ai_auth` VALUES ('84', '总代列表', '7', 'Member', 'member2List', '7-84', '0');
INSERT INTO `ai_auth` VALUES ('86', '添加总代', '7', 'Member', 'member2Add', '7-86', '0');
INSERT INTO `ai_auth` VALUES ('87', '分成比例', '0', '', '', '0-87', '0');
INSERT INTO `ai_auth` VALUES ('88', '比例设置', '87', 'Divided', 'dividedSet', '87-88', '0');
INSERT INTO `ai_auth` VALUES ('89', '提货申请', '7', 'Member', 'purchaseApplication', '7-89', '0');
INSERT INTO `ai_auth` VALUES ('90', '添加公告', '1', 'Article', 'articleAdd', '1-90', '0');
INSERT INTO `ai_auth` VALUES ('91', '添加联创', '7', 'Member', 'member1Add', '7-91', '0');
-- ----------------------------
-- Table structure for ai_fhjl
-- ----------------------------
DROP TABLE IF EXISTS `ai_fhjl`;
CREATE TABLE `ai_fhjl` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '分红记录',
`account` varchar(64) NOT NULL COMMENT '账号',
`desc` varchar(64) DEFAULT NULL COMMENT '分红说明',
`total` decimal(9,2) DEFAULT NULL COMMENT '账户总额',
`plus` varchar(9) DEFAULT NULL COMMENT '本次分红',
`balance` decimal(9,2) DEFAULT NULL COMMENT '加分红后账户余额',
`create_time` int(11) DEFAULT NULL COMMENT '生成记录时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ai_fhjl
-- ----------------------------
-- ----------------------------
-- Table structure for ai_member
-- ----------------------------
DROP TABLE IF EXISTS `ai_member`;
CREATE TABLE `ai_member` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '代理商ID',
`account` varchar(64) NOT NULL COMMENT '帐号',
`pass` varchar(32) NOT NULL COMMENT '密码',
`name` varchar(32) DEFAULT NULL COMMENT '姓名',
`m_phone` varchar(11) DEFAULT NULL COMMENT '电话号码',
`recommend_id` int(11) NOT NULL COMMENT '推荐人id',
`recommend_account` varchar(64) DEFAULT NULL COMMENT '推荐人帐号',
`recommend_lc` varchar(64) DEFAULT NULL COMMENT '所属联合创始人帐号',
`balance` double(10,2) DEFAULT NULL COMMENT '账户余额',
`reg_ip` varchar(15) DEFAULT NULL COMMENT '注册ip',
`is_lc` tinyint(1) DEFAULT '0' COMMENT '是否联创 0否 1是',
`is_zd` tinyint(1) DEFAULT '1' COMMENT '是否总代 0否 1是',
`status` tinyint(1) DEFAULT NULL COMMENT '状态是否开启 0否 1是',
`check_time` int(11) DEFAULT '0' COMMENT '审核时间',
`level` tinyint(1) DEFAULT '0' COMMENT '总代或联创等级 默认为0 1为有一代 2为有二代',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ai_member
-- ----------------------------
INSERT INTO `ai_member` VALUES ('1', 'wodewode', 'ff92a240d11b05ebd392348c35f781b2', '张三', '13193835329', '0', '0', '0', '1.32', '127.0.0.1', '0', '1', '1', '1508035574', '0');
-- ----------------------------
-- Table structure for ai_news
-- ----------------------------
DROP TABLE IF EXISTS `ai_news`;
CREATE TABLE `ai_news` (
`id` int(5) NOT NULL COMMENT '公告ID',
`title` varchar(64) DEFAULT NULL COMMENT '公告标题',
`content` varchar(255) DEFAULT NULL COMMENT '公告内容',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ai_news
-- ----------------------------
INSERT INTO `ai_news` VALUES ('1', 'wode', 'wodewode123');
-- ----------------------------
-- Table structure for ai_notice
-- ----------------------------
DROP TABLE IF EXISTS `ai_notice`;
CREATE TABLE `ai_notice` (
`id` int(11) NOT NULL,
`title` varchar(100) DEFAULT NULL,
`content` text,
`status` tinyint(4) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of ai_notice
-- ----------------------------
INSERT INTO `ai_notice` VALUES ('1', '免责声明', null, '1');
-- ----------------------------
-- Table structure for ai_role
-- ----------------------------
DROP TABLE IF EXISTS `ai_role`;
CREATE TABLE `ai_role` (
`role_id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
`role_name` varchar(20) NOT NULL COMMENT '角色名称',
`role_auth_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '权限ids,1,2,5',
`role_auth_ac` text COMMENT '模块-操作',
`desc` varchar(2550) DEFAULT NULL,
PRIMARY KEY (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ai_role
-- ----------------------------
INSERT INTO `ai_role` VALUES ('2', '超级管理员', '1,2,90,3,4,5,6,7,83,84,86,89,91,87,88,', 'welcome,loginOut,,articleList,articleAdd,,adminRole,adminPermission,adminList,,member1List,member2List,member2Add,purchaseApplication,member1Add,,dividedSet,', '你有公告管理,公告列表,添加公告,管理员管理,角色管理,权限管理,管理员列表,代理商管理,联创列表,总代列表,添加总代,提货申请,添加联创,分成比例,比例设置,的权利');
INSERT INTO `ai_role` VALUES ('4', 'shishi', '7,83,84,', 'welcome,loginOut,,member1List,member2List,', '你有代理商管理,总代列表,二级代理商列表,的权利');
-- ----------------------------
-- Table structure for ai_thsq
-- ----------------------------
DROP TABLE IF EXISTS `ai_thsq`;
CREATE TABLE `ai_thsq` (
`id` int(11) NOT NULL COMMENT '提货申请 id',
`t_account` varchar(64) DEFAULT NULL COMMENT '提货人帐号',
`t_recommend` varchar(64) DEFAULT NULL COMMENT '提货人的推荐人',
`t_amount` int(7) DEFAULT NULL COMMENT '提货数量',
`t_time` int(11) DEFAULT '0' COMMENT '提货时间',
`check_time` int(11) DEFAULT '0' COMMENT '发货确认',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ai_thsq
-- ----------------------------
| true
|
2ff5d8e183031a822a61cd0043e4d514cbf99c04
|
SQL
|
thangduong3010/PL-SQL
|
/EODA/scripts/ch15/demo05.sql
|
UTF-8
| 1,415
| 3.59375
| 4
|
[] |
no_license
|
-- Reading and Filtering Compressed Files in a Directory Tree, search_dir.bsh
host mkdir /tmp/base
host mkdir /tmp/base/base2a
host mkdir /tmp/base/base2b
host echo 'base col1,base col2' | gzip > /tmp/base/filebase.csv.gz
host echo 'base2a col1,base2a col2' | gzip > /tmp/base/base2a/filebase2a.csv.gz
host echo 'base2b col1,base2b col2' | gzip > /tmp/base/base2b/filebase2b.csv.gz
create or replace directory exec_dir as '/orahome/oracle/bin';
create or replace directory data_dir as '/tmp';
drop table csv;
create table csv
( col1 varchar2(20)
)
organization external
(
type oracle_loader
default directory data_dir
access parameters
(
records delimited by newline
preprocessor exec_dir:'search_dir.bsh'
fields terminated by ',' ldrtrim
)
location
(
data_dir:'base'
)
)
/
select * from csv;
create or replace directory data_dir as '/tmp/base';
alter table csv location( 'base2a' );
select * from csv;
-- Finding largest files
create or replace directory exec_dir as '/orahome/oracle/bin';
create or replace directory data_dir as '/';
create table flf (fname varchar2(200), bytes number)
organization external (
type oracle_loader
default directory exec_dir
access parameters
( records delimited by newline
preprocessor exec_dir:'flf.bsh'
fields terminated by whitespace ldrtrim)
location (data_dir:'u01'));
| true
|
662976d6f919627db42977efa19d7ab0d8b4c1e0
|
SQL
|
Fly-Rock/spring-clean-oaup
|
/document/product.sql
|
UTF-8
| 16,567
| 3.484375
| 3
|
[] |
no_license
|
# CREATE DATABASE IF NOT EXISTS oaup_db DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
DROP TABLE IF EXISTS `product_category`;
CREATE TABLE `product_category` (
`category_id` INT(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键、自增',
`category_name` varchar(50) NOT NULL DEFAULT '' COMMENT '商品分类名称',
`category_alias` varchar(50) NOT NULL DEFAULT '' COMMENT '别名',
`sort` INT(11) NOT NULL DEFAULT '0' COMMENT '排序',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '父节点id',
`status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '1 可用 0 不可用 -1 删除',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品类型配置表';
# 一级分类
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('保洁服务','BJFW',0,0,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('企业保洁','QYBJ',0,0,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('保姆月嫂','BMYS',0,0,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('租赁服务','ZLFW',0,0,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('零售商品','LSSP',0,0,1,NOW(),NOW());
# 二级分类
SELECT category_id from `product_category` where `status` = 1 limit 1 into @BJFWID;
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('日常保洁','RCBJ',0,@BJFWID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('新居开荒','XJKH',0,@BJFWID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('地板打蜡','DBDL',0,@BJFWID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('卫生间保养','WSJBY',0,@BJFWID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('厨房保养','CFBY',0,@BJFWID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('擦玻璃','CBL',0,@BJFWID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('深度除螨','SDCM',0,@BJFWID,1,NOW(),NOW());
##二级分类 企业保洁
SELECT category_id from `product_category` where `status` = 1 and `category_alias`='QYBJ' limit 1 into @QYBJID;
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('企业开荒保洁','QYKHBJ',0,@QYBJID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('企业长期服务','QYCQFW',0,@QYBJID,1,NOW(),NOW());
## 二级分类 保姆月嫂
SELECT category_id from `product_category` where `status` = 1 and `category_alias`='BMYS' limit 1 into @BMYSID;
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('月嫂','YS',0,@BMYSID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('育儿嫂','YES',0,@BMYSID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('保姆','BM',0,@BMYSID,1,NOW(),NOW());
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('老人陪护','LRPH',0,@BMYSID,1,NOW(),NOW());
## 二级分类 租赁服务
SELECT category_id from `product_category` where `status` = 1 and `category_alias`='ZLFW' limit 1 into @ZLFWID;
INSERT INTO `product_category`
(`category_name`,`category_alias`,`sort`,`parent_id`,`status`,`update_time`,`create_time`)
VALUES ('绿植租摆','LZZB',0,@ZLFWID,1,NOW(),NOW());
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`product_id` INT(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键、自增',
`category_id` INT(11) NOT NULL COMMENT '商品分类',
`product_alias` varchar(50) NOT NULL DEFAULT '' COMMENT '商品别名',
`product_name` varchar(100) NOT NULL DEFAULT '' COMMENT '商品名称',
`product_image` varchar(200) NOT NULL DEFAULT '' COMMENT '商品图片',
`min_pay_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品单价',
`seller_id` int(11) NOT NULL DEFAULT '0' COMMENT '商户机构ID',
`status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '1 上架可用 0 下架 -1 删除',
`create_user_id` bigint(20) NOT NULL COMMENT '创建用户ID',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品表';
DROP TABLE IF EXISTS `product_description`;
CREATE TABLE `product_description` (
`product_description_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键、自增',
`product_id` INT(11) NOT NULL COMMENT '商品id',
`content` varchar(8000) NOT NULL DEFAULT '' COMMENT '商品名称',
`content_style` varchar(20) NOT NULL DEFAULT '' COMMENT '内容模式类型',
`sort` int(20) NOT NULL DEFAULT '0' COMMENT '排序',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`product_description_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品描述表';
DROP TABLE IF EXISTS `product_price`;
CREATE TABLE `product_price` (
`product_price_id` INT(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键、自增',
`product_id` INT(11) NOT NULL COMMENT '商品ID',
`pay_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品单价',
`market_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '市场价格',
`cost_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '进货价格',
`unit_price_id` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '价格单位ID',
`status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '1 可用 0 删除',
`create_user_id` bigint(20) NOT NULL COMMENT '创建用户ID',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`product_price_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品价格表';
DROP TABLE IF EXISTS `product_unit_price`;
CREATE TABLE `product_unit_price` (
`unit_price_id` INT(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键、自增',
`unit_name` varchar(20) NOT NULL COMMENT '价格单位名称',
`status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '1 可用 0 删除',
`create_user_id` bigint(20) NOT NULL COMMENT '创建用户ID',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`unit_price_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品价格单位表';
INSERT INTO `product_unit_price`
(unit_name,`status`,`create_user_id`,`update_time`,`create_time`)
VALUES('平米','1',10000,NOW(),NOW());
INSERT INTO `product_unit_price`
(unit_name,`status`,`create_user_id`,`update_time`,`create_time`)
VALUES('小时','1',10000,NOW(),NOW());
INSERT INTO `product_unit_price`
(unit_name,`status`,`create_user_id`,`update_time`,`create_time`)
VALUES('盆','1',10000,NOW(),NOW());
INSERT INTO `product_unit_price`
(unit_name,`status`,`create_user_id`,`update_time`,`create_time`)
VALUES('颗','1',10000,NOW(),NOW());
INSERT INTO `product_unit_price`
(unit_name,`status`,`create_user_id`,`update_time`,`create_time`)
VALUES('株','1',10000,NOW(),NOW());
INSERT INTO `product_unit_price`
(unit_name,`status`,`create_user_id`,`update_time`,`create_time`)
VALUES('件','1',10000,NOW(),NOW());
INSERT INTO `product_unit_price`
(unit_name,`status`,`create_user_id`,`update_time`,`create_time`)
VALUES('桶','1',10000,NOW(),NOW());
INSERT INTO `product_unit_price`
(unit_name,`status`,`create_user_id`,`update_time`,`create_time`)
VALUES('月','1',10000,NOW(),NOW());
INSERT INTO product_description (product_id,`content_style`,`sort`, content, update_time, create_time)
VALUES (10000, 'detail_table',0,'{
"style": "detail_table",
"table_style": "a",
"contentListRowTable": [
{
"tableRow": [
{
"title": "项目名称",
"routerData": ""
},
{
"title": "非会员价格",
"routerData": ""
},
{
"title": "会员价格",
"routerData": ""
}
]
},
{
"tableRow": [
{
"title": "单人床",
"routerData": ""
},
{
"title": "138元/张",
"routerData": ""
},
{
"title": "127元/张",
"routerData": ""
}
]
}
]
}',NOW(),NOW());
INSERT INTO product_description (product_id,`content_style`,`sort`, content, update_time, create_time)
VALUES (10000,'detail_zonghe',0,' {
"style": "detail_zonghe",
"contentListBlocks": [
{
"style": "detail_reminder",
"title": "温馨提示:",
"contentList": [
{
"title": "1.单人床与双人床上除螨仅包含一套床上四件套;"
},
{
"title": "2.1.2米及以下为单人床,其他规格为双人床;"
}
]
}
],
"title": "",
"subtitle": ""
}',NOW(),NOW());
INSERT INTO product_description (product_id,`content_style`,`sort`, content, update_time, create_time)
VALUES (10000, 'detail_zonghe',0,'{
"style": "detail_zonghe",
"contentListBlocks": [
{
"style": "detail_image",
"bannerList": [
{
"image": "https://ayipic.ayibang.com/cms__a6ebc9c72d21de090d8cfbd49259e1c2_1495787073.jpg",
"pictureName": "XQY深度除螨_服务场景"
}
]
}
],
"title": "服务场景",
"subtitle": "多方位舒适体验"
}',NOW(),NOW());
INSERT INTO product_description (product_id,`content_style`,`sort`, content, update_time, create_time)
VALUES (10000, 'detail_zonghe',0,' {
"style": "detail_zonghe",
"contentListBlocks": [
{
"style": "detail_content",
"title": "螨虫存在于居室的阴暗角落、地毯、床垫、枕头、沙发、空调、凉席等处,是过敏性皮炎、鼻炎和呼吸道疾病的重要元凶!"
},
{
"style": "detail_image",
"bannerList": [
{
"image": "https://ayipic.ayibang.com/cms__76020f3b04b0b2d73be2fb0d09f2a659_1495787172.jpg",
"pictureName": "XQY深度除螨_业务介绍"
}
]
},
{
"style": "detail_reminder",
"title": "温馨提示:",
"contentList": [
{
"title": "即使室内环境非常干净的家庭,平均每张床上也有200万只螨虫。"
},
{
"title": "阳光暴晒6小时的螨虫杀灭率仅为3.8%。"
},
{
"title": "84.3%的皮肤过敏为螨虫过敏,儿童更高达91.6%"
}
]
}
],
"title": "业务介绍",
"subtitle": "选择我们,选择放心"
}',NOW(),NOW());
INSERT INTO product_description (product_id,`content_style`,`sort`, content, update_time, create_time)
VALUES (10000, 'detail_zonghe',0,' {
"style": "detail_zonghe",
"contentListBlocks": [
{
"style": "detail_image",
"bannerList": [
{
"image": "https://ayipic.ayibang.com/cms__834e20d273ff93476b021d0f47ab4deb_1495787088.jpg",
"pictureName": "XQY深度除螨_服务流程"
}
]
}
],
"title": "服务流程",
"subtitle": "多个流程,精细化服务"
}',NOW(),NOW());
INSERT INTO product_description (product_id,`content_style`,`sort`, content, update_time, create_time)
VALUES (10000, 'detail_zonghe',0,' {
"style": "detail_zonghe",
"contentListBlocks": [
{
"style": "detail_image",
"bannerList": [
{
"image": "https://ayipic.ayibang.com/cms__63a43df4defc4963ec43329dfa146aaa_1495787138.jpg",
"pictureName": "XQY深度除螨_工具装备"
}
]
}
],
"title": "工具装备",
"subtitle": "专业装备、安全放心"
}',NOW(),NOW());
INSERT INTO product_description (product_id,`content_style`,`sort`, content, update_time, create_time)
VALUES (10000, 'detail_zonghe',0,'{
"style": "detail_zonghe",
"contentListBlocks": [
{
"style": "detail_image",
"bannerList": [
{
"image": "https://ayipic.ayibang.com/cms__1b4f5649867500dc63ce8b45f64c293d_1495787105.jpg",
"pictureName": "XQY深度除螨_服务特色"
}
]
},
{
"style": "detail_content",
"title": "水过滤除螨避免污染"
},
{
"style": "detail_content",
"title": "云佳洁深度除螨使用的除螨仪依靠高频拍打和强大动力吸除螨虫,并通过水过滤系统收集螨虫,避免吸入机器中的螨虫弥散到空气中,造成螨虫在居室中的二次污染。"
},
{
"style": "detail_image",
"bannerList": [
{
"image": "https://ayipic.ayibang.com/cms__a2f8968dc6c5715881b374b8d1a72560_1495787123.jpg",
"pictureName": "XQY深度除螨_服务特色2"
}
]
},
{
"style": "detail_content",
"title": "标准化流程全面除螨"
},
{
"style": "detail_content",
"title": "“灭-除-止”三步综合作用,消灭螨虫、吸除螨虫、喷洒除螨剂抑制螨虫,阿姨帮深度除螨从根源着手,兼顾长期效果。"
}
],
"title": "服务特色",
"subtitle": "安全、彻底、放心"
}',NOW(),NOW());
| true
|
f675eecd76bd250144c34c8ce09c30143e08deac
|
SQL
|
sbmorvant/EPBI414
|
/EPBI414/Week 6/sql_e414_f2016_A6_P1.sql
|
UTF-8
| 2,750
| 4.34375
| 4
|
[] |
no_license
|
-- +--------------------------------+
-- | |
-- | EPBI414 HW6 pt1 SQL |
-- | sql_e414_f2016_A6_P1.sql |
-- | |
-- | Author: Stephen Morvant II |
-- | swm38@case.edu |
-- | |
-- +--------------------------------+
-- This query grabs the 30 highest paid male and 30 highest paid female employees
-- who are currently still working at the company and started in1985 or 1986
-- ################# NOTES ################# --
-- Current employees have 9999-01-01 in to_date of salaries
-- I want current employees with hire date between 1985-01-01 and 1986-12-31
-- Only top 30 slaries of such are needed
-- --At what level do I need to order these and limit them????
-- -- -- I assume that there are at least two correct answers but one is more resource intensive
-- -- -- Since it does not say to be in order, I guess just grabbing top 30 at deepest is best
-- Establishing which data is being used
USE epbi414_employee_data;
-- Selecting employees with all of...
-- a) gender is male (gender = 'M')
-- b) hire_date in 1985 or 1986 (BETWEEN 1985-01-01 AND 1986-12-31)
-- c) currently employed (s.to_date = '9999-01-01')
-- d) in the top 30 of such employees (ORDER BY s.salary DESC) and (LIMIT 30)
-- Need to use INNER JOIN to put all relevant info together based on emp_no
SELECT e.emp_no,
e.hire_date,
e.gender,
s.salary
FROM employees AS e
INNER JOIN
(
SELECT emp_no,
salary
FROM salaries
WHERE to_date = '9999-01-01'
ORDER BY salary DESC
) AS s
ON e.emp_no = s.emp_no
WHERE gender = 'F'
AND hire_date BETWEEN '1985-01-01' AND '1986-12-31'
LIMIT 30;
-- Selecting employees with all of...
-- a) hire_date in 1985 or 1986 (BETWEEN 1985-01-01 AND 1986-12-31)
-- b) gender is male (gender = 'M')
-- c) currently employed (s.to_date = '9999-01-01')
-- d) in the top 30 of such employees (ORDER BY s.salary DESC) and LIMIT 30
-- Need to use INNER JOIN to put all relevant info together based on emp_no
SELECT e.emp_no,
e.hire_date,
e.gender,
s.salary
FROM employees AS e
INNER JOIN
(
SELECT emp_no,
salary
FROM salaries
WHERE to_date = '9999-01-01'
ORDER BY salary DESC
) AS s
ON e.emp_no = s.emp_no
WHERE gender = 'M'
AND hire_date BETWEEN '1985-01-01' AND '1986-12-31'
LIMIT 30;
| true
|
c80d6498d16b7199312ffca225cc5be4147ac0ac
|
SQL
|
juxtamor/fiestaloca
|
/fiestaloca.sql
|
UTF-8
| 5,073
| 3.28125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Client: localhost
-- Généré le: Lun 27 Février 2017 à 09:58
-- Version du serveur: 5.5.53-0ubuntu0.14.04.1
-- Version de PHP: 5.5.9-1ubuntu4.20
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 */;
--
-- Base de données: `fiestaloca`
--
-- --------------------------------------------------------
--
-- Structure de la table `categorie`
--
CREATE TABLE IF NOT EXISTS `categorie` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cat_name` varchar(31) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`cat_desc` varchar(4095) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `command`
--
CREATE TABLE IF NOT EXISTS `command` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`status` varchar(127) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`id_user` int(10) unsigned NOT NULL,
`total_price` float NOT NULL,
PRIMARY KEY (`id`),
KEY `id_user` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `comments`
--
CREATE TABLE IF NOT EXISTS `comments` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`content` varchar(4095) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`id_author` int(10) unsigned NOT NULL,
`id_prod` int(10) unsigned NOT NULL,
`note` smallint(6) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `id_author` (`id_author`),
KEY `id_prod` (`id_prod`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `link_command_products`
--
CREATE TABLE IF NOT EXISTS `link_command_products` (
`id_command` int(10) unsigned NOT NULL,
`id_products` int(10) unsigned NOT NULL,
KEY `id_command` (`id_command`),
KEY `id_products` (`id_products`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `products`
--
CREATE TABLE IF NOT EXISTS `products` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`prod_name` varchar(31) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`prod_desc` varchar(4095) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`price` float NOT NULL,
`image` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`stock` int(11) NOT NULL,
`id_category` int(10) unsigned NOT NULL,
`prod_cover` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
KEY `id_category` (`id_category`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`login` varchar(31) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`password` varchar(63) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`email` varchar(63) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`adress` varchar(511) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`birthdate` date NOT NULL,
`admin` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `login` (`login`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `command`
--
ALTER TABLE `command`
ADD CONSTRAINT `command_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `comments`
--
ALTER TABLE `comments`
ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`id_author`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`id_prod`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `link_command_products`
--
ALTER TABLE `link_command_products`
ADD CONSTRAINT `link_command_products_ibfk_2` FOREIGN KEY (`id_products`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `link_command_products_ibfk_1` FOREIGN KEY (`id_command`) REFERENCES `command` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `products`
--
ALTER TABLE `products`
ADD CONSTRAINT `products_ibfk_1` FOREIGN KEY (`id_category`) REFERENCES `categorie` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
1bcb3fa8522d0bb8ae20fbe10bbaaa93c8fa4f05
|
SQL
|
joshspringer/RecipePlanner
|
/sql/recipe_count_by_ingredient.sql
|
UTF-8
| 222
| 3.859375
| 4
|
[] |
no_license
|
SELECT
i.name,
count(ri.recipe_id) as recipe_count
from
ingredients i JOIN recipe_ingredients ri ON i.id = ri.ingredient_id JOIN recipes r ON ri.recipe_id = r.id
where i.name like ('%lamb%')
GROUP BY 1
ORDER BY 2 DESC
| true
|
4f48f48559a4699e8120e2b8886ecb531d96e2b1
|
SQL
|
AndrewDrought/petClinic
|
/src/main/resources/db/mysql/data.sql
|
UTF-8
| 1,271
| 2.5625
| 3
|
[] |
no_license
|
INSERT IGNORE INTO vets VALUES (1, 'Alex', 'Yevchenko');
INSERT IGNORE INTO vets VALUES (2, 'Helen', 'Boyko');
INSERT IGNORE INTO vets VALUES (3, 'Victoria', 'Boyko');
INSERT IGNORE INTO vets VALUES (4, 'Roman', 'Kondrash');
INSERT IGNORE INTO vets VALUES (5, 'Andrew', 'Fok');
INSERT IGNORE INTO vets VALUES (6, 'Alexander', 'Ohorodniy');
INSERT IGNORE INTO specialties VALUES (1, 'radiology');
INSERT IGNORE INTO specialties VALUES (2, 'surgery');
INSERT IGNORE INTO specialties VALUES (3, 'dentistry');
INSERT IGNORE INTO vet_specialties VALUES (2, 1);
INSERT IGNORE INTO vet_specialties VALUES (3, 3);
INSERT IGNORE INTO vet_specialties VALUES (4, 2);
INSERT IGNORE INTO vet_specialties VALUES (5, 1);
INSERT IGNORE INTO types VALUES (1, 'cat');
INSERT IGNORE INTO types VALUES (2, 'dog');
INSERT IGNORE INTO types VALUES (3, 'snake');
INSERT IGNORE INTO types VALUES (4, 'bird');
INSERT IGNORE INTO types VALUES (5, 'hamster');
INSERT IGNORE INTO owners VALUES (1, 'Pavel', 'Savenko', '18 Grinchenko St.', 'Kyiv', '0506879452');
INSERT IGNORE INTO owners VALUES (2, 'Eliz', 'Abysova', '248 Hrushevskogo St.', 'Kyiv', '0675289478');
INSERT IGNORE INTO pets VALUES (1, 'Leo', '2015-09-07', 1, 1);
INSERT IGNORE INTO pets VALUES (2, 'Basil', '2012-08-06', 3, 2);
| true
|
82f35f3f392583b63d5219774304012eda939d6a
|
SQL
|
kazimuth/locale-list
|
/data/az/locales.mysql.sql
|
UTF-8
| 42,071
| 2.65625
| 3
|
[
"MIT"
] |
permissive
|
CREATE TABLE list (id VARCHAR(2) NOT NULL, value VARCHAR(64) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
INSERT INTO `list` (`id`, `value`) VALUES ('af', 'afrikaans');
INSERT INTO `list` (`id`, `value`) VALUES ('af_ZA', 'afrikaans (Cənub Afrika)');
INSERT INTO `list` (`id`, `value`) VALUES ('af_NA', 'afrikaans (Namibiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ak', 'akanca');
INSERT INTO `list` (`id`, `value`) VALUES ('ak_GH', 'akanca (Qana)');
INSERT INTO `list` (`id`, `value`) VALUES ('sq', 'alban');
INSERT INTO `list` (`id`, `value`) VALUES ('sq_AL', 'alban (Albaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('sq_XK', 'alban (Kosovo)');
INSERT INTO `list` (`id`, `value`) VALUES ('sq_MK', 'alban (Makedoniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('de', 'alman');
INSERT INTO `list` (`id`, `value`) VALUES ('de_DE', 'alman (Almaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('de_AT', 'alman (Avstriya)');
INSERT INTO `list` (`id`, `value`) VALUES ('de_BE', 'alman (Belçika)');
INSERT INTO `list` (`id`, `value`) VALUES ('de_CH', 'alman (İsveçrə)');
INSERT INTO `list` (`id`, `value`) VALUES ('de_LI', 'alman (Lixtenşteyn)');
INSERT INTO `list` (`id`, `value`) VALUES ('de_LU', 'alman (Lüksemburq)');
INSERT INTO `list` (`id`, `value`) VALUES ('am', 'amhar');
INSERT INTO `list` (`id`, `value`) VALUES ('am_ET', 'amhar (Efiopiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('as', 'assam');
INSERT INTO `list` (`id`, `value`) VALUES ('as_IN', 'assam (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('az', 'azərbaycan');
INSERT INTO `list` (`id`, `value`) VALUES ('az_AZ', 'azərbaycan (Azərbaycan)');
INSERT INTO `list` (`id`, `value`) VALUES ('az_Cyrl_AZ', 'azərbaycan (kiril, Azərbaycan)');
INSERT INTO `list` (`id`, `value`) VALUES ('az_Cyrl', 'azərbaycan (kiril)');
INSERT INTO `list` (`id`, `value`) VALUES ('az_Latn_AZ', 'azərbaycan (latın, Azərbaycan)');
INSERT INTO `list` (`id`, `value`) VALUES ('az_Latn', 'azərbaycan (latın)');
INSERT INTO `list` (`id`, `value`) VALUES ('bm', 'bambara');
INSERT INTO `list` (`id`, `value`) VALUES ('bm_Latn_ML', 'bambara (latın, Mali)');
INSERT INTO `list` (`id`, `value`) VALUES ('bm_Latn', 'bambara (latın)');
INSERT INTO `list` (`id`, `value`) VALUES ('eu', 'bask');
INSERT INTO `list` (`id`, `value`) VALUES ('eu_ES', 'bask (İspaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('be', 'belarus');
INSERT INTO `list` (`id`, `value`) VALUES ('be_BY', 'belarus (Belarus)');
INSERT INTO `list` (`id`, `value`) VALUES ('bn', 'benqal');
INSERT INTO `list` (`id`, `value`) VALUES ('bn_BD', 'benqal (Banqladeş)');
INSERT INTO `list` (`id`, `value`) VALUES ('bn_IN', 'benqal (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('my', 'birma');
INSERT INTO `list` (`id`, `value`) VALUES ('my_MM', 'birma (Myanma)');
INSERT INTO `list` (`id`, `value`) VALUES ('nb', 'bokmal norveç');
INSERT INTO `list` (`id`, `value`) VALUES ('nb_NO', 'bokmal norveç (Norveç)');
INSERT INTO `list` (`id`, `value`) VALUES ('nb_SJ', 'bokmal norveç (Svalbard və Yan Mayen)');
INSERT INTO `list` (`id`, `value`) VALUES ('bg', 'bolqar');
INSERT INTO `list` (`id`, `value`) VALUES ('bg_BG', 'bolqar (Bolqariya)');
INSERT INTO `list` (`id`, `value`) VALUES ('bs', 'bosniak');
INSERT INTO `list` (`id`, `value`) VALUES ('bs_BA', 'bosniak (Bosniya və Hersoqovina)');
INSERT INTO `list` (`id`, `value`) VALUES ('bs_Cyrl_BA', 'bosniak (kiril, Bosniya və Hersoqovina)');
INSERT INTO `list` (`id`, `value`) VALUES ('bs_Cyrl', 'bosniak (kiril)');
INSERT INTO `list` (`id`, `value`) VALUES ('bs_Latn_BA', 'bosniak (latın, Bosniya və Hersoqovina)');
INSERT INTO `list` (`id`, `value`) VALUES ('bs_Latn', 'bosniak (latın)');
INSERT INTO `list` (`id`, `value`) VALUES ('br', 'Bretonca');
INSERT INTO `list` (`id`, `value`) VALUES ('br_FR', 'Bretonca (Fransa)');
INSERT INTO `list` (`id`, `value`) VALUES ('cs', 'çex');
INSERT INTO `list` (`id`, `value`) VALUES ('cs_CZ', 'çex (Çexiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh', 'çin');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_CN', 'çin (Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hant_HK', 'çin (ənənəvi han, Honq Konq Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hant_MO', 'çin (ənənəvi han, Makao Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hant_TW', 'çin (ənənəvi han, Tayvan)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hant', 'çin (ənənəvi han)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_HK', 'çin (Honq Konq Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_MO', 'çin (Makao Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hans_CN', 'çin (sadələşmiş han, Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hans_HK', 'çin (sadələşmiş han, Honq Konq Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hans_MO', 'çin (sadələşmiş han, Makao Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hans_SG', 'çin (sadələşmiş han, Sinqapur)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_Hans', 'çin (sadələşmiş han)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_SG', 'çin (Sinqapur)');
INSERT INTO `list` (`id`, `value`) VALUES ('zh_TW', 'çin (Tayvan)');
INSERT INTO `list` (`id`, `value`) VALUES ('da', 'danimarka');
INSERT INTO `list` (`id`, `value`) VALUES ('da_DK', 'danimarka (Danimarka)');
INSERT INTO `list` (`id`, `value`) VALUES ('da_GL', 'danimarka (Qrenlandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('dz', 'dzonqa');
INSERT INTO `list` (`id`, `value`) VALUES ('dz_BT', 'dzonqa (Butan)');
INSERT INTO `list` (`id`, `value`) VALUES ('hy', 'erməni');
INSERT INTO `list` (`id`, `value`) VALUES ('hy_AM', 'erməni (Ermənistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('eo', 'esperanto');
INSERT INTO `list` (`id`, `value`) VALUES ('et', 'eston');
INSERT INTO `list` (`id`, `value`) VALUES ('et_EE', 'eston (Estoniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ee', 'eve');
INSERT INTO `list` (`id`, `value`) VALUES ('ee_GH', 'eve (Qana)');
INSERT INTO `list` (`id`, `value`) VALUES ('ee_TG', 'eve (Toqo)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar', 'ərəb');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_BH', 'ərəb (Bəhreyn)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_AE', 'ərəb (Birləşmiş Ərəb Əmirlikləri)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_SS', 'ərəb (Cənubi Sudan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_DJ', 'ərəb (Cibuti)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_TD', 'ərəb (Çad)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_ER', 'ərəb (Eritreya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_DZ', 'ərəb (Əlcəzair)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_PS', 'ərəb (Fələstin Əraziləri)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_JO', 'ərəb (İordaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_IQ', 'ərəb (İraq)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_IL', 'ərəb (İsrail)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_KM', 'ərəb (Komor Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_KW', 'ərəb (Küveyt)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_QA', 'ərəb (Qatar)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_EH', 'ərəb (Qərbi Sahara)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_LB', 'ərəb (Livan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_LY', 'ərəb (Liviya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_MR', 'ərəb (Mavritaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_MA', 'ərəb (Mərakeş)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_EG', 'ərəb (Misir)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_OM', 'ərəb (Oman)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_SA', 'ərəb (Səudiyyə Ərəbistanı)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_SO', 'ərəb (Somali)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_SD', 'ərəb (Sudan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_SY', 'ərəb (Suriya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_TN', 'ərəb (Tunis)');
INSERT INTO `list` (`id`, `value`) VALUES ('ar_YE', 'ərəb (Yəmən)');
INSERT INTO `list` (`id`, `value`) VALUES ('fo', 'farer');
INSERT INTO `list` (`id`, `value`) VALUES ('fo_FO', 'farer (Farer Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('fa', 'fars');
INSERT INTO `list` (`id`, `value`) VALUES ('fa_AF', 'fars (Əfqanıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('fa_IR', 'fars (İran)');
INSERT INTO `list` (`id`, `value`) VALUES ('fi', 'fin');
INSERT INTO `list` (`id`, `value`) VALUES ('fi_FI', 'fin (Finlandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr', 'fransız');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_BE', 'fransız (Belçika)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_BJ', 'fransız (Benin)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_BF', 'fransız (Burkina Faso)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_BI', 'fransız (Burundi)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_DJ', 'fransız (Cibuti)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_TD', 'fransız (Çad)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_GQ', 'fransız (Ekvatorial Qvineya)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_DZ', 'fransız (Əlcəzair)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_CI', 'fransız (Fil Dişi Sahili)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_FR', 'fransız (Fransa)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_GF', 'fransız (Fransız Qviyanası)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_PF', 'fransız (Fransız Polineziyası)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_HT', 'fransız (Haiti)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_CH', 'fransız (İsveçrə)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_CM', 'fransız (Kamerun)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_CA', 'fransız (Kanada)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_KM', 'fransız (Komor Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_CG', 'fransız (Konqo - Brazzavil)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_CD', 'fransız (Konqo - Kinşasa)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_GA', 'fransız (Qabon)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_GP', 'fransız (Qvadelupa)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_GN', 'fransız (Qvineya)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_LU', 'fransız (Lüksemburq)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_MG', 'fransız (Madaqaskar)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_ML', 'fransız (Mali)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_MQ', 'fransız (Martinik)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_MU', 'fransız (Mavriki)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_MR', 'fransız (Mavritaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_YT', 'fransız (Mayot)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_MA', 'fransız (Mərakeş)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_CF', 'fransız (Mərkəzi Afrika Respublikası)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_MC', 'fransız (Monako)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_NE', 'fransız (Niger)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_RE', 'fransız (Reunion)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_RW', 'fransız (Ruanda)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_BL', 'fransız (San Bartolomey)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_MF', 'fransız (San Martin)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_PM', 'fransız (San Pier və Mikelon)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_SN', 'fransız (Seneqal)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_SC', 'fransız (Seyşel Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_SY', 'fransız (Suriya)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_TG', 'fransız (Toqo)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_TN', 'fransız (Tunis)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_WF', 'fransız (Uolis və Futuna)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_VU', 'fransız (Vanuatu)');
INSERT INTO `list` (`id`, `value`) VALUES ('fr_NC', 'fransız (Yeni Kaledoniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ff', 'fula dili');
INSERT INTO `list` (`id`, `value`) VALUES ('ff_CM', 'fula dili (Kamerun)');
INSERT INTO `list` (`id`, `value`) VALUES ('ff_GN', 'fula dili (Qvineya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ff_MR', 'fula dili (Mavritaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ff_SN', 'fula dili (Seneqal)');
INSERT INTO `list` (`id`, `value`) VALUES ('ka', 'gürcü');
INSERT INTO `list` (`id`, `value`) VALUES ('ka_GE', 'gürcü (Gürcüstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ha', 'hausa');
INSERT INTO `list` (`id`, `value`) VALUES ('ha_GH', 'hausa (Qana)');
INSERT INTO `list` (`id`, `value`) VALUES ('ha_Latn_GH', 'hausa (latın, Qana)');
INSERT INTO `list` (`id`, `value`) VALUES ('ha_Latn_NE', 'hausa (latın, Niger)');
INSERT INTO `list` (`id`, `value`) VALUES ('ha_Latn_NG', 'hausa (latın, Nigeriya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ha_Latn', 'hausa (latın)');
INSERT INTO `list` (`id`, `value`) VALUES ('ha_NE', 'hausa (Niger)');
INSERT INTO `list` (`id`, `value`) VALUES ('ha_NG', 'hausa (Nigeriya)');
INSERT INTO `list` (`id`, `value`) VALUES ('hi', 'hindi');
INSERT INTO `list` (`id`, `value`) VALUES ('hi_IN', 'hindi (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('nl', 'holland');
INSERT INTO `list` (`id`, `value`) VALUES ('nl_AW', 'holland (Aruba)');
INSERT INTO `list` (`id`, `value`) VALUES ('nl_BE', 'holland (Belçika)');
INSERT INTO `list` (`id`, `value`) VALUES ('nl_BQ', 'holland (Karib Niderlandı)');
INSERT INTO `list` (`id`, `value`) VALUES ('nl_CW', 'holland (Kurasao)');
INSERT INTO `list` (`id`, `value`) VALUES ('nl_NL', 'holland (Niderland)');
INSERT INTO `list` (`id`, `value`) VALUES ('nl_SX', 'holland (Sint Maarten)');
INSERT INTO `list` (`id`, `value`) VALUES ('nl_SR', 'holland (Surinam)');
INSERT INTO `list` (`id`, `value`) VALUES ('hr', 'xorvat');
INSERT INTO `list` (`id`, `value`) VALUES ('hr_BA', 'xorvat (Bosniya və Hersoqovina)');
INSERT INTO `list` (`id`, `value`) VALUES ('hr_HR', 'xorvat (Xorvatiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ig', 'iqbo');
INSERT INTO `list` (`id`, `value`) VALUES ('ig_NG', 'iqbo (Nigeriya)');
INSERT INTO `list` (`id`, `value`) VALUES ('id', 'indonez');
INSERT INTO `list` (`id`, `value`) VALUES ('id_ID', 'indonez (İndoneziya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en', 'ingilis');
INSERT INTO `list` (`id`, `value`) VALUES ('en_VI', 'ingilis (ABŞ Vircin Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_US', 'ingilis (Amerika Birləşmiş Ştatları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_AS', 'ingilis (Amerika Samoası)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_AI', 'ingilis (Angila)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_AG', 'ingilis (Antiqua və Barbuda)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_AU', 'ingilis (Avstraliya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_BS', 'ingilis (Baham Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_BB', 'ingilis (Barbados)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_BE', 'ingilis (Belçika)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_BZ', 'ingilis (Beliz)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_BM', 'ingilis (Bermuda)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_GB', 'ingilis (Birləşmiş Krallıq)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_UM', 'ingilis (Birləşmiş Ştatlar Uzaq Adalar)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_BW', 'ingilis (Botsvana)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_IO', 'ingilis (Britaniya Hind Okeanı Ərazisi)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_VG', 'ingilis (Britaniya Vircin Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_JE', 'ingilis (Cersi)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_ZA', 'ingilis (Cənub Afrika)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SS', 'ingilis (Cənubi Sudan)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_DG', 'ingilis (Dieqo Qarsiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_DM', 'ingilis (Dominika)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_ER', 'ingilis (Eritreya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_FJ', 'ingilis (Fici)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_PH', 'ingilis (Filippin)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_FK', 'ingilis (Folklend Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_GG', 'ingilis (Gernsey)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_GI', 'ingilis (Gibraltar)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_IN', 'ingilis (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_HK', 'ingilis (Honq Konq Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_IE', 'ingilis (İrlandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_CM', 'ingilis (Kamerun)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_CA', 'ingilis (Kanada)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_KY', 'ingilis (Kayman Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_KE', 'ingilis (Keniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_KI', 'ingilis (Kiribati)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_CC', 'ingilis (Kokos Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_CK', 'ingilis (Kuk Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_GM', 'ingilis (Qambiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_GH', 'ingilis (Qana)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_GD', 'ingilis (Qrenada)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_GU', 'ingilis (Quam)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_GY', 'ingilis (Qviyana)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_LS', 'ingilis (Lesoto)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_LR', 'ingilis (Liberiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MG', 'ingilis (Madaqaskar)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MO', 'ingilis (Makao Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MW', 'ingilis (Malavi)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MY', 'ingilis (Malayziya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MT', 'ingilis (Malta)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MH', 'ingilis (Marşal Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MU', 'ingilis (Mavriki)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_IM', 'ingilis (Men Adası)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_FM', 'ingilis (Mikroneziya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_CX', 'ingilis (Milad Adası)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MS', 'ingilis (Monserat)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SH', 'ingilis (Müqəddəs Yelena)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_NA', 'ingilis (Namibiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_NR', 'ingilis (Nauru)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_NG', 'ingilis (Nigeriya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_NU', 'ingilis (Niue)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_NF', 'ingilis (Norfolk Adası)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_PK', 'ingilis (Pakistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_PW', 'ingilis (Palau)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_PG', 'ingilis (Papua Yeni Qvineya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_PN', 'ingilis (Pitkern Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_PR', 'ingilis (Puerto Riko)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_RW', 'ingilis (Ruanda)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_WS', 'ingilis (Samoa)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_KN', 'ingilis (San Kits və Nevis)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_LC', 'ingilis (San Lüsiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_VC', 'ingilis (San Vinsent və Qrenada)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SC', 'ingilis (Seyşel Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SL', 'ingilis (Siera Leon)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SG', 'ingilis (Sinqapur)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SX', 'ingilis (Sint Maarten)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SB', 'ingilis (Solomon Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SD', 'ingilis (Sudan)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_SZ', 'ingilis (Svazilend)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_MP', 'ingilis (Şimali Mariana Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_TZ', 'ingilis (Tanzaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_TK', 'ingilis (Tokelau)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_TO', 'ingilis (Tonqa)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_TT', 'ingilis (Trinidad və Tobaqo)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_TC', 'ingilis (Turks və Kaikos Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_TV', 'ingilis (Tuvalu)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_UG', 'ingilis (Uqanda)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_VU', 'ingilis (Vanuatu)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_JM', 'ingilis (Yamayka)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_NZ', 'ingilis (Yeni Zelandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_ZM', 'ingilis (Zambiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('en_ZW', 'ingilis (Zimbabve)');
INSERT INTO `list` (`id`, `value`) VALUES ('ga', 'irland');
INSERT INTO `list` (`id`, `value`) VALUES ('ga_IE', 'irland (İrlandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('is', 'island');
INSERT INTO `list` (`id`, `value`) VALUES ('is_IS', 'island (İslandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('es', 'ispan');
INSERT INTO `list` (`id`, `value`) VALUES ('es_US', 'ispan (Amerika Birləşmiş Ştatları)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_AR', 'ispan (Argentina)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_BO', 'ispan (Boliviya)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_CL', 'ispan (Çili)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_DO', 'ispan (Dominikan Respublikası)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_EC', 'ispan (Ekvador)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_GQ', 'ispan (Ekvatorial Qvineya)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_PH', 'ispan (Filippin)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_HN', 'ispan (Honduras)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_ES', 'ispan (İspaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_IC', 'ispan (Kanar Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_CO', 'ispan (Kolumbiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_CR', 'ispan (Kosta Rika)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_CU', 'ispan (Kuba)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_GT', 'ispan (Qvatemala)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_MX', 'ispan (Meksika)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_NI', 'ispan (Nikaraqua)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_PA', 'ispan (Panama)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_PY', 'ispan (Paraqvay)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_PE', 'ispan (Peru)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_PR', 'ispan (Puerto Riko)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_SV', 'ispan (Salvador)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_EA', 'ispan (Seuta və Melilya)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_UY', 'ispan (Uruqvay)');
INSERT INTO `list` (`id`, `value`) VALUES ('es_VE', 'ispan (Venesuela)');
INSERT INTO `list` (`id`, `value`) VALUES ('sv', 'isveç');
INSERT INTO `list` (`id`, `value`) VALUES ('sv_AX', 'isveç (Aland Adaları)');
INSERT INTO `list` (`id`, `value`) VALUES ('sv_FI', 'isveç (Finlandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('sv_SE', 'isveç (İsveç)');
INSERT INTO `list` (`id`, `value`) VALUES ('it', 'italyan');
INSERT INTO `list` (`id`, `value`) VALUES ('it_CH', 'italyan (İsveçrə)');
INSERT INTO `list` (`id`, `value`) VALUES ('it_IT', 'italyan (İtaliya)');
INSERT INTO `list` (`id`, `value`) VALUES ('it_SM', 'italyan (San Marino)');
INSERT INTO `list` (`id`, `value`) VALUES ('he', 'ivrit');
INSERT INTO `list` (`id`, `value`) VALUES ('he_IL', 'ivrit (İsrail)');
INSERT INTO `list` (`id`, `value`) VALUES ('kl', 'kalaallisut');
INSERT INTO `list` (`id`, `value`) VALUES ('kl_GL', 'kalaallisut (Qrenlandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('kn', 'kannada');
INSERT INTO `list` (`id`, `value`) VALUES ('kn_IN', 'kannada (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ks', 'kaşmir');
INSERT INTO `list` (`id`, `value`) VALUES ('ks_Arab_IN', 'kaşmir (ərəb, Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ks_Arab', 'kaşmir (ərəb)');
INSERT INTO `list` (`id`, `value`) VALUES ('ks_IN', 'kaşmir (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ca', 'katalan');
INSERT INTO `list` (`id`, `value`) VALUES ('ca_AD', 'katalan (Andorra)');
INSERT INTO `list` (`id`, `value`) VALUES ('ca_FR', 'katalan (Fransa)');
INSERT INTO `list` (`id`, `value`) VALUES ('ca_ES', 'katalan (İspaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ca_IT', 'katalan (İtaliya)');
INSERT INTO `list` (`id`, `value`) VALUES ('qu', 'keçua');
INSERT INTO `list` (`id`, `value`) VALUES ('qu_BO', 'keçua (Boliviya)');
INSERT INTO `list` (`id`, `value`) VALUES ('qu_EC', 'keçua (Ekvador)');
INSERT INTO `list` (`id`, `value`) VALUES ('qu_PE', 'keçua (Peru)');
INSERT INTO `list` (`id`, `value`) VALUES ('km', 'kxmer');
INSERT INTO `list` (`id`, `value`) VALUES ('km_KH', 'kxmer (Kamboca)');
INSERT INTO `list` (`id`, `value`) VALUES ('ki', 'kikuyu');
INSERT INTO `list` (`id`, `value`) VALUES ('ki_KE', 'kikuyu (Keniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('rw', 'kinyarvanda');
INSERT INTO `list` (`id`, `value`) VALUES ('rw_RW', 'kinyarvanda (Ruanda)');
INSERT INTO `list` (`id`, `value`) VALUES ('ko', 'koreya');
INSERT INTO `list` (`id`, `value`) VALUES ('ko_KR', 'koreya (Cənubi Koreya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ko_KP', 'koreya (Şimali Koreya)');
INSERT INTO `list` (`id`, `value`) VALUES ('kw', 'korn');
INSERT INTO `list` (`id`, `value`) VALUES ('kw_GB', 'korn (Birləşmiş Krallıq)');
INSERT INTO `list` (`id`, `value`) VALUES ('gl', 'qalisian');
INSERT INTO `list` (`id`, `value`) VALUES ('gl_ES', 'qalisian (İspaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('lg', 'qanda');
INSERT INTO `list` (`id`, `value`) VALUES ('lg_UG', 'qanda (Uqanda)');
INSERT INTO `list` (`id`, `value`) VALUES ('kk', 'qazax');
INSERT INTO `list` (`id`, `value`) VALUES ('kk_Cyrl_KZ', 'qazax (kiril, Qazaxıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('kk_Cyrl', 'qazax (kiril)');
INSERT INTO `list` (`id`, `value`) VALUES ('kk_KZ', 'qazax (Qazaxıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('fy', 'qərbi friz');
INSERT INTO `list` (`id`, `value`) VALUES ('fy_NL', 'qərbi friz (Niderland)');
INSERT INTO `list` (`id`, `value`) VALUES ('ky', 'qırğız');
INSERT INTO `list` (`id`, `value`) VALUES ('ky_Cyrl_KG', 'qırğız (kiril, Qırğızıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ky_Cyrl', 'qırğız (kiril)');
INSERT INTO `list` (`id`, `value`) VALUES ('ky_KG', 'qırğız (Qırğızıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('gu', 'qucarat');
INSERT INTO `list` (`id`, `value`) VALUES ('gu_IN', 'qucarat (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('lo', 'laos');
INSERT INTO `list` (`id`, `value`) VALUES ('lo_LA', 'laos (Laos)');
INSERT INTO `list` (`id`, `value`) VALUES ('lv', 'latış');
INSERT INTO `list` (`id`, `value`) VALUES ('lv_LV', 'latış (Latviya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ln', 'linqala');
INSERT INTO `list` (`id`, `value`) VALUES ('ln_AO', 'linqala (Anqola)');
INSERT INTO `list` (`id`, `value`) VALUES ('ln_CG', 'linqala (Konqo - Brazzavil)');
INSERT INTO `list` (`id`, `value`) VALUES ('ln_CD', 'linqala (Konqo - Kinşasa)');
INSERT INTO `list` (`id`, `value`) VALUES ('ln_CF', 'linqala (Mərkəzi Afrika Respublikası)');
INSERT INTO `list` (`id`, `value`) VALUES ('lt', 'litva');
INSERT INTO `list` (`id`, `value`) VALUES ('lt_LT', 'litva (Litva)');
INSERT INTO `list` (`id`, `value`) VALUES ('lu', 'luba-katanqa');
INSERT INTO `list` (`id`, `value`) VALUES ('lu_CD', 'luba-katanqa (Konqo - Kinşasa)');
INSERT INTO `list` (`id`, `value`) VALUES ('lb', 'lüksemburq');
INSERT INTO `list` (`id`, `value`) VALUES ('lb_LU', 'lüksemburq (Lüksemburq)');
INSERT INTO `list` (`id`, `value`) VALUES ('hu', 'macar');
INSERT INTO `list` (`id`, `value`) VALUES ('hu_HU', 'macar (Macarıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('mk', 'makedon');
INSERT INTO `list` (`id`, `value`) VALUES ('mk_MK', 'makedon (Makedoniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('mg', 'malaqas');
INSERT INTO `list` (`id`, `value`) VALUES ('mg_MG', 'malaqas (Madaqaskar)');
INSERT INTO `list` (`id`, `value`) VALUES ('ms', 'malay');
INSERT INTO `list` (`id`, `value`) VALUES ('ms_BN', 'malay (Bruney)');
INSERT INTO `list` (`id`, `value`) VALUES ('ms_Latn_BN', 'malay (latın, Bruney)');
INSERT INTO `list` (`id`, `value`) VALUES ('ms_Latn_MY', 'malay (latın, Malayziya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ms_Latn_SG', 'malay (latın, Sinqapur)');
INSERT INTO `list` (`id`, `value`) VALUES ('ms_Latn', 'malay (latın)');
INSERT INTO `list` (`id`, `value`) VALUES ('ms_MY', 'malay (Malayziya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ms_SG', 'malay (Sinqapur)');
INSERT INTO `list` (`id`, `value`) VALUES ('ml', 'malayalam');
INSERT INTO `list` (`id`, `value`) VALUES ('ml_IN', 'malayalam (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('mt', 'malta');
INSERT INTO `list` (`id`, `value`) VALUES ('mt_MT', 'malta (Malta)');
INSERT INTO `list` (`id`, `value`) VALUES ('gv', 'manks');
INSERT INTO `list` (`id`, `value`) VALUES ('gv_IM', 'manks (Men Adası)');
INSERT INTO `list` (`id`, `value`) VALUES ('mr', 'marati');
INSERT INTO `list` (`id`, `value`) VALUES ('mr_IN', 'marati (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('mn', 'monqol');
INSERT INTO `list` (`id`, `value`) VALUES ('mn_Cyrl_MN', 'monqol (kiril, Monqoliya)');
INSERT INTO `list` (`id`, `value`) VALUES ('mn_Cyrl', 'monqol (kiril)');
INSERT INTO `list` (`id`, `value`) VALUES ('mn_MN', 'monqol (Monqoliya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ne', 'nepal');
INSERT INTO `list` (`id`, `value`) VALUES ('ne_IN', 'nepal (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ne_NP', 'nepal (Nepal)');
INSERT INTO `list` (`id`, `value`) VALUES ('no', 'norveç dili');
INSERT INTO `list` (`id`, `value`) VALUES ('no_NO', 'norveç dili (Norveç)');
INSERT INTO `list` (`id`, `value`) VALUES ('nn', 'nünorsk norveç');
INSERT INTO `list` (`id`, `value`) VALUES ('nn_NO', 'nünorsk norveç (Norveç)');
INSERT INTO `list` (`id`, `value`) VALUES ('or', 'oriya');
INSERT INTO `list` (`id`, `value`) VALUES ('or_IN', 'oriya (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('om', 'oromo');
INSERT INTO `list` (`id`, `value`) VALUES ('om_ET', 'oromo (Efiopiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('om_KE', 'oromo (Keniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('os', 'osetik dili');
INSERT INTO `list` (`id`, `value`) VALUES ('os_GE', 'osetik dili (Gürcüstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('os_RU', 'osetik dili (Rusiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('uz', 'özbək');
INSERT INTO `list` (`id`, `value`) VALUES ('uz_AF', 'özbək (Əfqanıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('uz_Arab_AF', 'özbək (ərəb, Əfqanıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('uz_Arab', 'özbək (ərəb)');
INSERT INTO `list` (`id`, `value`) VALUES ('uz_Cyrl_UZ', 'özbək (kiril, Özbəkistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('uz_Cyrl', 'özbək (kiril)');
INSERT INTO `list` (`id`, `value`) VALUES ('uz_Latn_UZ', 'özbək (latın, Özbəkistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('uz_Latn', 'özbək (latın)');
INSERT INTO `list` (`id`, `value`) VALUES ('uz_UZ', 'özbək (Özbəkistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('pa', 'pəncab');
INSERT INTO `list` (`id`, `value`) VALUES ('pa_Arab_PK', 'pəncab (ərəb, Pakistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('pa_Arab', 'pəncab (ərəb)');
INSERT INTO `list` (`id`, `value`) VALUES ('pa_IN', 'pəncab (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('pa_Guru_IN', 'pəncab (qurmuxi, Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('pa_Guru', 'pəncab (qurmuxi)');
INSERT INTO `list` (`id`, `value`) VALUES ('pa_PK', 'pəncab (Pakistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('pl', 'polyak');
INSERT INTO `list` (`id`, `value`) VALUES ('pl_PL', 'polyak (Polşa)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt', 'portuqal');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_AO', 'portuqal (Anqola)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_BR', 'portuqal (Braziliya)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_CV', 'portuqal (Kape Verde)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_GW', 'portuqal (Qvineya-Bisau)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_MO', 'portuqal (Makao Xüsusi İnzibati Ərazi Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_MZ', 'portuqal (Mozambik)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_PT', 'portuqal (Portuqal)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_ST', 'portuqal (Sao Tome və Prinsip)');
INSERT INTO `list` (`id`, `value`) VALUES ('pt_TL', 'portuqal (Şərqi Timor)');
INSERT INTO `list` (`id`, `value`) VALUES ('ps', 'puştu');
INSERT INTO `list` (`id`, `value`) VALUES ('ps_AF', 'puştu (Əfqanıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('rm', 'retoroman');
INSERT INTO `list` (`id`, `value`) VALUES ('rm_CH', 'retoroman (İsveçrə)');
INSERT INTO `list` (`id`, `value`) VALUES ('ro', 'rumın');
INSERT INTO `list` (`id`, `value`) VALUES ('ro_MD', 'rumın (Moldova)');
INSERT INTO `list` (`id`, `value`) VALUES ('ro_RO', 'rumın (Rumıniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('rn', 'rundi');
INSERT INTO `list` (`id`, `value`) VALUES ('rn_BI', 'rundi (Burundi)');
INSERT INTO `list` (`id`, `value`) VALUES ('ru', 'rus');
INSERT INTO `list` (`id`, `value`) VALUES ('ru_BY', 'rus (Belarus)');
INSERT INTO `list` (`id`, `value`) VALUES ('ru_KZ', 'rus (Qazaxıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ru_KG', 'rus (Qırğızıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ru_MD', 'rus (Moldova)');
INSERT INTO `list` (`id`, `value`) VALUES ('ru_RU', 'rus (Rusiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ru_UA', 'rus (Ukrayna)');
INSERT INTO `list` (`id`, `value`) VALUES ('sg', 'sanqo');
INSERT INTO `list` (`id`, `value`) VALUES ('sg_CF', 'sanqo (Mərkəzi Afrika Respublikası)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr', 'serb');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_BA', 'serb (Bosniya və Hersoqovina)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Cyrl_BA', 'serb (kiril, Bosniya və Hersoqovina)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Cyrl_XK', 'serb (kiril, Kosovo)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Cyrl_ME', 'serb (kiril, Monteneqro)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Cyrl_RS', 'serb (kiril, Serbiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Cyrl', 'serb (kiril)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_XK', 'serb (Kosovo)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Latn_BA', 'serb (latın, Bosniya və Hersoqovina)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Latn_XK', 'serb (latın, Kosovo)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Latn_ME', 'serb (latın, Monteneqro)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Latn_RS', 'serb (latın, Serbiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_Latn', 'serb (latın)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_ME', 'serb (Monteneqro)');
INSERT INTO `list` (`id`, `value`) VALUES ('sr_RS', 'serb (Serbiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('sh', 'serb-xorvatca');
INSERT INTO `list` (`id`, `value`) VALUES ('sh_BA', 'serb-xorvatca (Bosniya və Hersoqovina)');
INSERT INTO `list` (`id`, `value`) VALUES ('ii', 'siçuan yi');
INSERT INTO `list` (`id`, `value`) VALUES ('ii_CN', 'siçuan yi (Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('si', 'sinhal');
INSERT INTO `list` (`id`, `value`) VALUES ('si_LK', 'sinhal (Şri Lanka)');
INSERT INTO `list` (`id`, `value`) VALUES ('gd', 'skot gaelik dili');
INSERT INTO `list` (`id`, `value`) VALUES ('gd_GB', 'skot gaelik dili (Birləşmiş Krallıq)');
INSERT INTO `list` (`id`, `value`) VALUES ('sk', 'slovak');
INSERT INTO `list` (`id`, `value`) VALUES ('sk_SK', 'slovak (Slovakiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('sl', 'sloven');
INSERT INTO `list` (`id`, `value`) VALUES ('sl_SI', 'sloven (Sloveniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('so', 'somali');
INSERT INTO `list` (`id`, `value`) VALUES ('so_DJ', 'somali (Cibuti)');
INSERT INTO `list` (`id`, `value`) VALUES ('so_ET', 'somali (Efiopiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('so_KE', 'somali (Keniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('so_SO', 'somali (Somali)');
INSERT INTO `list` (`id`, `value`) VALUES ('sw', 'suahili');
INSERT INTO `list` (`id`, `value`) VALUES ('sw_KE', 'suahili (Keniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('sw_TZ', 'suahili (Tanzaniya)');
INSERT INTO `list` (`id`, `value`) VALUES ('sw_UG', 'suahili (Uqanda)');
INSERT INTO `list` (`id`, `value`) VALUES ('nd', 'şimali ndebele');
INSERT INTO `list` (`id`, `value`) VALUES ('nd_ZW', 'şimali ndebele (Zimbabve)');
INSERT INTO `list` (`id`, `value`) VALUES ('se', 'şimali sami');
INSERT INTO `list` (`id`, `value`) VALUES ('se_FI', 'şimali sami (Finlandiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('se_SE', 'şimali sami (İsveç)');
INSERT INTO `list` (`id`, `value`) VALUES ('se_NO', 'şimali sami (Norveç)');
INSERT INTO `list` (`id`, `value`) VALUES ('sn', 'şona');
INSERT INTO `list` (`id`, `value`) VALUES ('sn_ZW', 'şona (Zimbabve)');
INSERT INTO `list` (`id`, `value`) VALUES ('tl', 'taqaloq dili');
INSERT INTO `list` (`id`, `value`) VALUES ('tl_PH', 'taqaloq dili (Filippin)');
INSERT INTO `list` (`id`, `value`) VALUES ('ta', 'tamil');
INSERT INTO `list` (`id`, `value`) VALUES ('ta_IN', 'tamil (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ta_MY', 'tamil (Malayziya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ta_SG', 'tamil (Sinqapur)');
INSERT INTO `list` (`id`, `value`) VALUES ('ta_LK', 'tamil (Şri Lanka)');
INSERT INTO `list` (`id`, `value`) VALUES ('th', 'tay');
INSERT INTO `list` (`id`, `value`) VALUES ('th_TH', 'tay (Tayland)');
INSERT INTO `list` (`id`, `value`) VALUES ('te', 'teluqu');
INSERT INTO `list` (`id`, `value`) VALUES ('te_IN', 'teluqu (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('bo', 'tibet');
INSERT INTO `list` (`id`, `value`) VALUES ('bo_CN', 'tibet (Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('bo_IN', 'tibet (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ti', 'tiqrin');
INSERT INTO `list` (`id`, `value`) VALUES ('ti_ET', 'tiqrin (Efiopiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('ti_ER', 'tiqrin (Eritreya)');
INSERT INTO `list` (`id`, `value`) VALUES ('to', 'tonqa');
INSERT INTO `list` (`id`, `value`) VALUES ('to_TO', 'tonqa (Tonqa)');
INSERT INTO `list` (`id`, `value`) VALUES ('tr', 'türk');
INSERT INTO `list` (`id`, `value`) VALUES ('tr_CY', 'türk (Kipr)');
INSERT INTO `list` (`id`, `value`) VALUES ('tr_TR', 'türk (Türkiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('cy', 'uels');
INSERT INTO `list` (`id`, `value`) VALUES ('cy_GB', 'uels (Birləşmiş Krallıq)');
INSERT INTO `list` (`id`, `value`) VALUES ('uk', 'ukrayna');
INSERT INTO `list` (`id`, `value`) VALUES ('uk_UA', 'ukrayna (Ukrayna)');
INSERT INTO `list` (`id`, `value`) VALUES ('ur', 'urdu');
INSERT INTO `list` (`id`, `value`) VALUES ('ur_IN', 'urdu (Hindistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ur_PK', 'urdu (Pakistan)');
INSERT INTO `list` (`id`, `value`) VALUES ('ug', 'uyğur');
INSERT INTO `list` (`id`, `value`) VALUES ('ug_CN', 'uyğur (Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('ug_Arab_CN', 'uyğur (ərəb, Çin)');
INSERT INTO `list` (`id`, `value`) VALUES ('ug_Arab', 'uyğur (ərəb)');
INSERT INTO `list` (`id`, `value`) VALUES ('vi', 'vyetnam');
INSERT INTO `list` (`id`, `value`) VALUES ('vi_VN', 'vyetnam (Vyetnam)');
INSERT INTO `list` (`id`, `value`) VALUES ('yi', 'Yahudi dili');
INSERT INTO `list` (`id`, `value`) VALUES ('ja', 'yapon');
INSERT INTO `list` (`id`, `value`) VALUES ('ja_JP', 'yapon (Yaponiya)');
INSERT INTO `list` (`id`, `value`) VALUES ('yo', 'yoruba');
INSERT INTO `list` (`id`, `value`) VALUES ('yo_BJ', 'yoruba (Benin)');
INSERT INTO `list` (`id`, `value`) VALUES ('yo_NG', 'yoruba (Nigeriya)');
INSERT INTO `list` (`id`, `value`) VALUES ('el', 'yunan');
INSERT INTO `list` (`id`, `value`) VALUES ('el_CY', 'yunan (Kipr)');
INSERT INTO `list` (`id`, `value`) VALUES ('el_GR', 'yunan (Yunanıstan)');
INSERT INTO `list` (`id`, `value`) VALUES ('zu', 'zulu');
INSERT INTO `list` (`id`, `value`) VALUES ('zu_ZA', 'zulu (Cənub Afrika)');
| true
|
2204c05ec759317a6ca2cd80887f06db95ccd9b8
|
SQL
|
satriyoadhy/rekam-medis-web
|
/application/helpers/rekam-medis.mysql.withusr.sql
|
UTF-8
| 2,989
| 3.03125
| 3
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Aug 19, 2019 at 01:34 AM
-- Server version: 10.1.41-MariaDB-0ubuntu0.18.04.1
-- PHP Version: 7.2.19-0ubuntu0.18.04.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 utf8mb4 */;
--
-- Database: `rekam-medis`
--
-- --------------------------------------------------------
--
-- Table structure for table `AuthKey`
--
CREATE TABLE `AuthKey` (
`ID` int(11) NOT NULL,
`owner` int(11) NOT NULL,
`keyss` varchar(64) NOT NULL,
`datecreated` date DEFAULT NULL,
`dateexpired` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `RekamMedis`
--
CREATE TABLE `RekamMedis` (
`ID` int(11) NOT NULL,
`userID` int(11) NOT NULL,
`Nama` varchar(50) DEFAULT NULL,
`Tegangan` double DEFAULT NULL,
`mAs` double DEFAULT NULL,
`mGy` double DEFAULT NULL,
`OutputRadiasi` double DEFAULT NULL,
`Esak` double DEFAULT NULL,
`DAP` double DEFAULT NULL,
`imageName` varchar(70) DEFAULT 'none.jpg',
`datecreated` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `User`
--
CREATE TABLE `User` (
`ID` int(11) NOT NULL,
`NIK` bigint(16) NOT NULL,
`password` varchar(100) NOT NULL,
`Role` int(3) NOT NULL DEFAULT 0,
`Nama` varchar(50) DEFAULT NULL,
`Umur` int(3) DEFAULT NULL,
`JK` tinyint(1) DEFAULT NULL,
`Alamat` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `AuthKey`
--
ALTER TABLE `AuthKey`
ADD PRIMARY KEY (`ID`),
ADD KEY `keys` (`keyss`);
--
-- Indexes for table `RekamMedis`
--
ALTER TABLE `RekamMedis`
ADD PRIMARY KEY (`ID`),
ADD KEY `userID` (`userID`);
--
-- Indexes for table `User`
--
ALTER TABLE `User`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `NIK` (`NIK`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `AuthKey`
--
ALTER TABLE `AuthKey`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `RekamMedis`
--
ALTER TABLE `RekamMedis`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `User`
--
ALTER TABLE `User`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- insert admin user
INSERT INTO `User` VALUES (1,1000000000000000,'$2y$10$nqV9t9D7.0vhieN4B1FD.uBO8O.H7.3S2.IRxhJAGAtDt6Xr8vj3W',1,'Administrator',0,0,'Rekam Medis');
| true
|
4dedadab53e0f0169e9165bf916a9dcdf8abb9fb
|
SQL
|
presian/HomeWorks
|
/Databases/5.AdvancedSQL/problem17.sql
|
UTF-8
| 262
| 3.578125
| 4
|
[] |
no_license
|
--Problem 17. Write a SQL statement to create a table Groups.
--Groups should have unique name (use unique constraint).
--Define primary key and identity column.
CREATE TABLE Groups(
GroupID int IDENTITY PRIMARY KEY,
Name nvarchar(50) UNIQUE NOT NULL)
| true
|
1257d8ec367709e1ad72a4fc932eca9871459484
|
SQL
|
ChristopherBass/KInspector
|
/KInspector.Modules/Scripts/ScreenshotterModule-v9.sql
|
UTF-8
| 301
| 2.9375
| 3
|
[
"MIT"
] |
permissive
|
SELECT NodeGUID
FROM View_CMS_Tree_Joined
WHERE
ClassName != 'cms.file'
AND ClassName != 'cms.folder'
AND DocumentCanBePublished = 1
AND (DocumentPublishFrom IS NULL OR DocumentPublishFrom <= GETDATE())
AND (DocumentPublishTo IS NULL OR "DocumentPublishTo" >= GETDATE())
ORDER BY DocumentNamePath
| true
|
45b25748fda88a0b7decb1347c2cd9e22735bf89
|
SQL
|
sanei-dengyo-jyoho/SQL-Server
|
/内線管理/請求売上一覧_Qリスト.sql
|
UTF-8
| 1,134
| 3.484375
| 3
|
[] |
no_license
|
with
v0 as
(
select
a0.*
from
入金回収_Qリスト as a0
union all
select
b0.*
from
請求売上_Q未請求リスト as b0
)
select
*
,
CONCAT(
dbo.FuncMakeConstructOrdered(
CONCAT(工事種別名,N'#'),
取引先略称
),
CASE
WHEN ISNULL([JV出資比率],N'') < >N''
THEN CONCAT(SPACE(2),[JV出資比率])
ELSE N''
END
)
as [発注先JVグループ]
,
dbo.FuncMakeConstructSubject(
CONCAT(N'工事件名',N'#'),
工事番号,
工事件名,
ISNULL(受注金額,0),
DEFAULT
)
as 工事件名グループ
,
CONCAT(
dbo.FuncMakeConstructOrdered(
DEFAULT,
取引先略称
),
CASE
WHEN ISNULL([JV出資比率],N'') <> N''
THEN CONCAT(SPACE(2),[JV出資比率])
ELSE N''
END
)
as [発注先JV出力]
,
dbo.FuncMakeConstructSubject(
DEFAULT,
工事番号,
工事件名,
ISNULL(受注金額,0),
DEFAULT
)
as 工事件名出力
,
dbo.FuncMakeMoneyFormat(ISNULL(受注金額,0))
as 税別受注金額文字列
,
dbo.FuncMakeMoneyFormat(ISNULL(受注金額,0)+ISNULL(消費税額,0))
as 税込受注金額文字列
from
v0 as v000
| true
|
864b9f793304186851037741d25d63f17f79968f
|
SQL
|
JustinVEspinoza/Tienda
|
/BD_Tienda.sql
|
UTF-8
| 3,148
| 2.6875
| 3
|
[] |
no_license
|
Create database Tienda;
use Tienda;
insert into Products values(null,'Pantalla LCD','Es un buen producto','100000',20,0,'http://localhost/Tienda/Image/Products/default.png',2);
insert into Products values(null,'Pantalla HP','Es un buen producto','100000',20,0,'http://localhost/Tienda/Image/Products/default.png',1);
insert into Products values(null,'Celular Huawei J5','Es un buen producto','150000',20,0,'http://localhost/Tienda/Image/Products/default.png',1);
insert into Products values(null,'Teclado RJ45','Es un buen producto','10000',20,0,'http://localhost/Tienda/Image/Products/default.png',1);
insert into Products values(null,'Mouse led','Es un buen producto','4000',20,0,'http://localhost/Tienda/Image/Products/default.png',1);
insert into Products values(null,'Silla Gamer','Es un buen producto','200000',20,0,'http://localhost/Tienda/Image/Products/default.png',1);
insert into Products values(null,'Mesa Gamer','Es un buen producto','100000',20,0,'http://localhost/Tienda/Image/Products/default.png',1);
insert into Products values(null,'Abanico','Es un buen producto','30000',20,0,'http://localhost/Tienda/Image/Products/default.png',2);
insert into Products values(null,'CPU g-force Envidia','Es un buen producto','150000',20,0,'http://localhost/Tienda/Image/Products/default.png',1);
insert into Products values(null,'GTA5','Es un buen producto','40000',20,0,'http://localhost/Tienda/Image/Products/default.png',3);
insert into Products values(null,'Red dead Redemption','Es un buen producto','40000',20,0,'http://localhost/Tienda/Image/Products/default.png',3);
insert into Products values(null,'Minecraft','Es un buen producto','40000',20,0,'http://localhost/Tienda/Image/Products/default.png',3);
insert into Products values(null,'Naruto','Es un buen producto','40000',20,0,'http://localhost/Tienda/Image/Products/default.png',3);
update Products set QuantitySold=7 where idProducts=7;
call pa_getNewProducts();
call pa_getTopProducts();
call pa_getProducts();
call pa_getProductById(8);
call pa_getProductByRange(30000,150000);
call pa_getProductByCategory(3);
call pa_getSlide();
call pa_getinfoBussiness();
call pa_getCategory();
call pa_getProductsByMin(30000);
call pa_getProductsByMax(150000);
call pa_getProductsByMinAndCategory(30000,4);
call pa_getProductsByMinAndMaxAndCategory(30000,150000,4);
call pa_getProductsByMaxAndCategory(150000,4);
CALL `tienda`.`pa_getUserbyId`("justinvillaespinoza68@gmail.com","JvE199911"); -- p
call pa_newUser("Jose","Maria","Gutierrez","J@gmail.com","1234");
-- Falta procedimiento para insertar, eliminar, modificar productos
-- Falta procedimiento para modificar datos de la empresa
-- Procedimiento de listar, eliminar, y insertar carritos de compra
Select * from Slide;
select * from user;
Select * from bussiness;
select * from Products where Price Between 10000 and 100000;
select * from Category;
insert into NivAdmin values(null,"User");
insert into User values(null,"Justin","Villalobos","Espinoza","justinvillaespinoza68@gmail.com","JvE199911",1);
ALTER TABLE user
ADD CONSTRAINT fk_UserAdmin
FOREIGN KEY (NivAdmin) REFERENCES NivAdmin(idNivAdmin)
ON DELETE CASCADE ;
ALTER TABLE user
DROP FOREIGN KEY fk_UserAdmin;
| true
|
047829681d07409057ed2f1471be084334e013d7
|
SQL
|
Saltfarmer/Simple-Employee-Database-Interface
|
/database/pulepayung.sql
|
UTF-8
| 1,978
| 2.90625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 18, 2018 at 04:36 AM
-- Server version: 10.1.31-MariaDB
-- PHP Version: 5.6.35
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: `pulepayung`
--
-- --------------------------------------------------------
--
-- Table structure for table `pegawai`
--
CREATE TABLE `pegawai` (
`nik` int(10) NOT NULL,
`nama` varchar(30) NOT NULL,
`tempat_lahir` varchar(15) NOT NULL,
`tanggal_lahir` date NOT NULL,
`alamat` varchar(50) NOT NULL,
`pendidikan` varchar(5) NOT NULL,
`jenis_kelamin` varchar(10) NOT NULL,
`agama` varchar(10) NOT NULL,
`no_telepon` varchar(15) NOT NULL,
`no_rekening` varchar(15) NOT NULL,
`tanggal_masuk_kerja` date NOT NULL,
`bagian_kerja` varchar(15) NOT NULL,
`status_karyawan` varchar(10) NOT NULL,
`catatan` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pegawai`
--
INSERT INTO `pegawai` (`nik`, `nama`, `tempat_lahir`, `tanggal_lahir`, `alamat`, `pendidikan`, `jenis_kelamin`, `agama`, `no_telepon`, `no_rekening`, `tanggal_masuk_kerja`, `bagian_kerja`, `status_karyawan`, `catatan`) VALUES
(123456, 'alex', 'solo', '2018-07-10', 'ngarep omah', 'sd', 'perempuan', 'islam', '08888232133', '327389212', '2018-07-01', 'ngarep', 'aktif', '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `pegawai`
--
ALTER TABLE `pegawai`
ADD PRIMARY KEY (`nik`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
c0f8d74c90b9815f3f0582192d3a23d2d2a4cb77
|
SQL
|
andytanoko/4.2.x_integration
|
/PDIPBaseServices/Worklist/sqlscripts/create-tables.sql
|
UTF-8
| 922
| 2.9375
| 3
|
[] |
no_license
|
USE userdb;
#
# Table structure for table 'worklistvalue'
#
DROP TABLE IF EXISTS worklistvalue;
CREATE TABLE `worklistvalue` (
`UID` bigint(11) NOT NULL default '0',
`wi_description` varchar(50) default NULL,
`wi_comments` varchar(50) default NULL,
`wi_status` char(2) default NULL,
`wi_cdate` date default NULL,
`user_id` varchar(80) default NULL,
`unassigned` char(2) default NULL,
`processDefKey` varchar(255) default NULL,
`activityId` varchar(255) default NULL,
`performer` varchar(150) default NULL,
`rtActivityUId` bigint(11) NOT NULL,
`contextUId` bigint(11) NOT NULL,
PRIMARY KEY (`UID`)
) TYPE=MyISAM;
#
# Table structure for table 'worklistuser'
#
DROP TABLE IF EXISTS worklistuser;
CREATE TABLE `worklistuser` (
`UID` bigint(20) NOT NULL default '0',
`workitem_id` bigint(11) NOT NULL default '0',
`user_id` varchar(80) default NULL,
PRIMARY KEY (`UID`)
) TYPE=MyISAM;
| true
|
dc895f30dff434dabb007161a57a5af12feb836c
|
SQL
|
dardan0118/MYSQL-BASIC
|
/2-Select/taak04/antwoorden.sql
|
UTF-8
| 1,121
| 3.359375
| 3
|
[] |
no_license
|
-- Opdracht 1
SELECT max(wage) AS hoogste_loon_speler_fc_utrecht FROM `players` WHERE `club` = 'fc utrecht'
-- Opdracht 2
SELECT `name`, AVG(wage) AS gemiddeldeloon, ROUND(AVG(wage)) FROM `players` WHERE `club` = 'fc utrecht'
-- Opdracht 3
SELECT sum(wage) as alle_lonen FROM `players` WHERE `club`= 'fc groningen'
-- Opdracht 4
SELECT COUNT(*) as totaal_spelers FROM `players` WHERE (`club`='Manchester City' OR `club` = 'manchester united')
-- Opdracht 5
SELECT AVG(wage) as gemiddelde_loon_nederlanders FROM `players` WHERE `nationality`='netherlands'
-- Opdracht 6
SELECT avg(wage) as gemiddelde_loon_onder_20jaar FROM `players` WHERE `age` < 20
-- Opdracht 7
SELECT avg(wage) as gemiddelde_loon_boven_20jaar FROM `players` WHERE `age` > 20
-- Opdracht 8
SELECT avg(wage) as gemiddelde_loon_chelsea FROM `players` WHERE `club` = 'chelsea'
-- Opdracht 9
SELECT AVG(age) as gemiddelde_leeftijd , round(24.1959 ,0) as gemiddelde_afgeronde_leeftijd FROM `players` WHERE 1
-- Opdracht 10
SELECT `club`, avg(wage) as gemiddelde_loon, round(107181, 0) as gemiddelde_afgeronde_loon FROM `players` WHERE `club` ="chelsea"
| true
|
2755e376dc6a827dc120d15ede60cc5ef209ed62
|
SQL
|
nishacodes/assessment2_sinatra
|
/mysql/wizards.sql
|
UTF-8
| 3,651
| 4.75
| 5
|
[] |
no_license
|
-- Create a database called wizards. The rest of the assesment all will take place in the wizards db.
-- Create a table called wizards with the following columns (name, age).
CREATE TABLE wizards(
id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
name text,
age integer);
-- Write a statement to count the number of rows in the wizards table. How many wizards are there?
SELECT id, count("id") as "number_of_times"
FROM wizards;
-- There are 0 wizards
-- Insert a wizard into the database.
INSERT INTO wizards (name, age)
value ("nisha",28);
-- Write a statement to count the number of rows in the wizards table. How many wizards are there now?
SELECT id, count("id") as "number_of_times"
FROM wizards;
-- There is 1 wizard
-- Insert another wizard into the database.
INSERT INTO wizards (name, age)
value ("derek",27);
-- Write a statement to change the second wizards age to 21.
UPDATE wizards
SET age= 21
WHERE id=2;
-- Write a statement to change all wizards ages to 40.
UPDATE wizards
SET age= 21;
-- Write a statement to delete the last wizard.
DELETE FROM wizards
ORDER BY id DESC limit 1;
-- Write a statement to delete the wizards table.
DROP TABLE wizards;
-- Create two data models for wizards. The wizards are going to have a name, an age and two powers each. Let's pretend we're in a world where wizards have many powers, but powers belong to one wizard (two wizards cant have the same power) Each power is going to have a name and a damage amount. Write out the sql to create the two schemas and some sample records. What are the costs/benefits of the two approaches? If you only see one way of doing this that's ok. Please explain any potential problems with your approach. What questions can this schema answer easily? What questions can this schema not answer easily?
DATA MODELS
----------------
wizards table:
columns:
- name
- age
powers table:
columns:
- name
- damage_amount
- wizard_id
wizard model:
has_many :powers
power model:
belongs_to :wizard
validates_uniqueness_of :wizard_name
SQL COMMANDS
----------------
CREATE TABLE wizards(
id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
name text,
age integer);
CREATE TABLE powers(
id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
name text,
damage_amount integer,
wizard_id integer);
INSERT INTO wizards (name, age)
value ("nisha",28);
INSERT INTO powers (name, damage_amount, wizard_id)
value ("invisibility",500,1);
SELECT *
FROM wizards
JOIN powers on powers.wizard_id = wizards.id;
-- Retrieve all the wizards with powers that have the letter "l" in them.
SELECT *
FROM wizards
JOIN powers on powers.wizard_id = wizards.id
WHERE powers.name = "%l%";
-- Retrieve all the wizards who have a combined damage of 10 or more.
-- Retrieve all the wizards sorted by their total damage. Your returned data should look like so.. wizard_name, total_damage.
-- Create a wizard that has no powers.
-- Retrieve all wizards that have no powers.
-- Create a data model for wizards for a world where wizards have many powers and multiple wizards can have the same power. Create some sample records.
-- Retrieve the first wizard and any powers he/she has with damage greater than 5.
-- What's the difference between an outer and inner join?
An inner join returns a table with only the rows that have a match in the join column. An outer join will return all the rows in both joined tables, even if some of them have no relation to the other table
-- If I just write JOIN, is that an inner or outer join?
inner join
-- When would I want to use an outer join?
When you want to see which rows don't have a relation to the other table and which do.
| true
|
468cb83fc90330052e0f2537b7017a33ff09ae18
|
SQL
|
kellya/pygmy
|
/pygmy/sql/create_apppermission_table.sql
|
UTF-8
| 296
| 2.984375
| 3
|
[] |
no_license
|
-- :name create_apppermission_table
CREATE TABLE "appPermission" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"owner" INTEGER,
"permission" INTEGER,
FOREIGN KEY(owner) REFERENCES owner(id),
FOREIGN KEY(permission) REFERENCES permission(id)
);
| true
|
5cc98cf8032d8dda58a3e9b96e3d005b9dcc6a1a
|
SQL
|
vikasjena/SQL
|
/paydb/scoring_model_stat_by_sessions.sql
|
UTF-8
| 1,234
| 3.78125
| 4
|
[] |
no_license
|
SET @Date = '2014-10-27 19:00:00';
select
FROM_UNIXTIME(cs.date_start),
cs.result,
cs.shop_id,
scoring_model_log.flag_blocked,
scoring_model_log.model_out,
users.quality,
cs.credit_id,
cs.phone,
DATEDIFF(FROM_UNIXTIME(cs.date_start), (select _VAL from (SELECT
paydb.extra_score_values.credit_session_id as _ID,
-- paydb.extra_score_vars.shop_id as _ID_SHOP,
CASE WHEN paydb.extra_score_vars.shop_id IN (10075, 10052, 10079)
THEN FROM_UNIXTIME(paydb.extra_score_values.`value`)
ELSE paydb.extra_score_values.`value`
END as _VAL
from
paydb.extra_score_values
LEFT OUTER JOIN extra_score_vars on extra_score_vars.id = extra_score_values.var_id
WHERE extra_score_vars.`name` = 'subid_register_date'
) as temptable1
WHERE _ID = cs.id)) AS days_since_reg,
cs.is_new_user,
cs.is_new_profile,
cs.sns_id,
scoring_model_log.*
from
scoring_model_log
INNER JOIN credit_sessions as cs on cs.id = scoring_model_log.session_id
INNER JOIN users on scoring_model_log.user_id = users.id
where
FROM_UNIXTIME(cs.date_start) > @Date
AND scoring_model_log.flag_blocked = 1
-- and cs.result = 'credit confirmed'
ORDER BY
scoring_model_log.id desc
| true
|
9bebf7c2395cec91662aeeafa689162282d1c29d
|
SQL
|
madhavsuresh/KloakDB
|
/sql/table_defs.sql
|
UTF-8
| 3,634
| 3.125
| 3
|
[] |
no_license
|
-- experimental config
CREATE TABLE demographics (
patient_id integer,
birth_year integer,
gender integer,
race integer,
ethnicity integer,
insurance integer,
zip integer);
CREATE TABLE diagnoses (
patient_id integer NOT NULL,
site integer NOT NULL,
year integer NOT NULL,
month integer NOT NULL,
visit_no integer NOT NULL,
type_ integer NOT NULL,
encounter_id integer NOT NULL,
diag_src character varying NOT NULL,
icd9 character varying NOT NULL,
primary_ integer NOT NULL,
timestamp_ timestamp without time zone,
clean_icd9 character varying,
major_icd9 integer
);
DROP TABLE IF EXISTS cdiff_cohort;
CREATE TABLE cdiff_cohort AS (
SELECT DISTINCT patient_id FROM diagnoses WHERE icd9 = '008.45');
DROP TABLE IF EXISTS mi_cohort;
CREATE TABLE mi_cohort AS (
SELECT DISTINCT patient_id FROM diagnoses WHERE icd9 LIKE '410%');
-- data used in test to simulate patient registry
DROP TABLE IF EXISTS cdiff_cohort_diagnoses;
CREATE TABLE cdiff_cohort_diagnoses AS SELECT * FROM diagnoses WHERE patient_id IN (SELECT * FROM cdiff_cohort);
DROP TABLE IF EXISTS mi_cohort_diagnoses;
CREATE TABLE mi_cohort_diagnoses AS SELECT * FROM diagnoses WHERE patient_id IN (SELECT * FROM mi_cohort);
--
CREATE TABLE vitals (
patient_id integer,
height_timestamp timestamp,
height_visit_no integer,
height real,
height_units character varying,
weight_timestamp timestamp,
weight_visit_no integer,
weight real,
weight_units character varying,
bmi_timestamp timestamp,
bmi_visit_no integer,
bmi real,
bmi_units character varying,
pulse integer,
systolic integer,
diastolic integer ,
bp_method character varying);
CREATE TABLE medications (
patient_id integer NOT NULL,
site integer NOT NULL,
year integer NOT NULL,
month integer NOT NULL,
medication character varying NOT NULL,
dosage character varying NOT NULL,
route character varying,
timestamp_ timestamp without time zone
);
CREATE TABLE oblivious_partitioning_100 (
a INT,
b INT
);
CREATE TABLE oblivious_partitioning_1000 (
a INT,
b INT
);
CREATE TABLE oblivious_partitioning_10000 (
a INT,
b INT
);
CREATE TABLE oblivious_partitioning_100000 (
a INT,
b INT
);
CREATE TABLE oblivious_partitioning_1000000 (
a INT,
b INT
);
CREATE TABLE oblivious_partitioning_10000000 (
a INT,
b INT
);
CREATE TABLE left_deep_joins_512 (
a INT,
b INT
);
CREATE TABLE left_deep_joins_1024 (
a INT,
b INT
);
CREATE TABLE gen_test_a_h1_c (
a VARCHAR,
b VARCHAR
);
CREATE TABLE gen_test_a_h2_c (
a VARCHAR,
b VARCHAR
);
CREATE TABLE gen_test_a_h3_c (
a VARCHAR,
b VARCHAR
);
CREATE TABLE gen_test_a_h4_c (
a VARCHAR,
b VARCHAR
);
CREATE TABLE gen_test_a_h1 (
a INT,
b INT
);
CREATE TABLE gen_test_a_h2 (
a INT,
b INT
);
CREATE TABLE gen_test_a_h3 (
a INT,
b INT
);
CREATE TABLE gen_test_a_h4 (
a INT,
b INT
);
CREATE TABLE gen_test_b_h1 (
a INT,
b INT
);
CREATE TABLE gen_test_b_h2 (
a INT,
b INT
);
CREATE TABLE gen_test_b_h3 (
a INT,
b INT
);
CREATE TABLE gen_test_b_h4 (
a INT,
b INT
);
CREATE TABLE gen_test_c_h1 (
a INT,
b INT
);
CREATE TABLE gen_test_c_h2 (
a INT,
b INT
);
CREATE TABLE gen_test_c_h3 (
a INT,
b INT
);
CREATE TABLE gen_test_c_h4 (
a INT,
b INT
);
CREATE TABLE gen_test_d_h1 (
a INT,
b INT
);
CREATE TABLE gen_test_d_h2 (
a INT,
b INT
);
CREATE TABLE gen_test_d_h3 (
a INT,
b INT
);
CREATE TABLE gen_test_d_h4 (
a INT,
b INT
);
CREATE TABLE left_deep_joins_4096 (
a INT,
b INT
);
CREATE TABLE left_deep_joins_25200 (
a INT,
b INT
);
| true
|
df4fe09e7779c04648882de2edd68f3e4e02145b
|
SQL
|
kltang96/CSIT337-DrinksOnUs.lol
|
/group_project337.sql
|
UTF-8
| 11,972
| 2.984375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 17, 2018 at 05:35 AM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 7.2.10
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: `group_project337`
--
-- --------------------------------------------------------
--
-- Table structure for table `admins`
--
CREATE TABLE `admins` (
`user_id` int(10) NOT NULL,
`user_email` varchar(255) NOT NULL,
`user_pass` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admins`
--
INSERT INTO `admins` (`user_id`, `user_email`, `user_pass`) VALUES
(1, 'admin', '$2y$10$ptplUJxZ/16NP3rEGqaJuuLBqoaZ2yJg6UwoyvT4zu5/bdOHgMZJq');
-- --------------------------------------------------------
--
-- Table structure for table `brands`
--
CREATE TABLE `brands` (
`brand_id` int(100) NOT NULL,
`brand_title` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `brands`
--
INSERT INTO `brands` (`brand_id`, `brand_title`) VALUES
(1, 'Soda'),
(2, 'Coffee'),
(3, 'Sports drinks'),
(4, 'juice drinks'),
(5, 'Enegry drinks');
-- --------------------------------------------------------
--
-- Table structure for table `cart`
--
CREATE TABLE `cart` (
`p_id` int(10) NOT NULL,
`ip_add` varchar(255) NOT NULL,
`qty` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cart`
--
INSERT INTO `cart` (`p_id`, `ip_add`, `qty`) VALUES
(0, '10.17.201.60', 1),
(0, '10.17.201.60', 1),
(0, '71.172.70.234', 1),
(0, '71.172.70.234', 1),
(0, '24.228.66.23', 1),
(15, 'something', 1),
(12, 'something', 1),
(14, 'something', 1),
(16, 'something', 1),
(10, 'something', 1),
(39, 'train', 11),
(42, '123', 1);
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`cat_id` int(100) NOT NULL,
`cat_title` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`cat_id`, `cat_title`) VALUES
(1, 'Soda'),
(2, 'Coffee'),
(3, 'Juice'),
(4, 'Sports'),
(5, 'Enegry');
-- --------------------------------------------------------
--
-- Table structure for table `customers`
--
CREATE TABLE `customers` (
`customer_id` int(10) NOT NULL,
`customer_ip` varchar(255) NOT NULL,
`customer_name` text NOT NULL,
`customer_email` varchar(100) NOT NULL,
`customer_pass` varchar(100) NOT NULL,
`customer_country` text NOT NULL,
`customer_city` text NOT NULL,
`customer_contact` varchar(255) NOT NULL,
`customer_address` text NOT NULL,
`customer_image` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `customers`
--
INSERT INTO `customers` (`customer_id`, `customer_ip`, `customer_name`, `customer_email`, `customer_pass`, `customer_country`, `customer_city`, `customer_contact`, `customer_address`, `customer_image`) VALUES
(2, '24.228.66.23', 'user1', 'user', '$2y$10$30Q13UYvwgF/vi/IKP1BFOeL8gdGIuXrSdXkDEupmw6uE3fR8jm7y', 'Select a Country', '', '', '', ''),
(3, '173.70.82.144', 'hi', 'something', '$2y$10$N57n6GrwVQswQA/1TRnQ2OHPC4fv1RBSDvaV3Nj4nuRsOs3TaHkJS', 'United Kingdom', 'guiohjoih', 'yiohoih', 'who cares', ''),
(4, '::1', 'train', 'train ', '$2y$10$Ha151mm4XjASFo1r2xxVs.VcXg21vU5rKldwDdF0Sezz1HzTdVBTi', 'Select a Country', '', '', '', ''),
(8, '127.0.0.1', 'test', 'test', '$2y$10$sQA4GUGEb.yiFsmt0wDc1OoUynqrGesC0nTk39IBo741GI9OG3Vhi', '', '', '', '', '');
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE `orders` (
`orderID` int(11) NOT NULL,
`customerID` varchar(10) NOT NULL,
`cost` float DEFAULT NULL,
`status` enum('pending','fulfilled','special') DEFAULT NULL,
`orderdate` date DEFAULT NULL,
`fulfilldate` date DEFAULT NULL,
`request` varchar(300) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `orders`
--
INSERT INTO `orders` (`orderID`, `customerID`, `cost`, `status`, `orderdate`, `fulfilldate`, `request`) VALUES
(1, '2', 32.5, 'pending', '2018-12-17', NULL, ''),
(2, '2', 21, 'pending', '2018-12-17', NULL, '');
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
CREATE TABLE `products` (
`product_id` int(100) NOT NULL,
`product_cat` int(100) NOT NULL,
`product_brand` int(100) NOT NULL,
`product_title` varchar(255) NOT NULL,
`product_price` float NOT NULL,
`product_desc` text NOT NULL,
`product_image` blob NOT NULL,
`product_keywords` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`product_id`, `product_cat`, `product_brand`, `product_title`, `product_price`, `product_desc`, `product_image`, `product_keywords`) VALUES
(18, 2, 0, 'tide', 7, '<p>clean ur guts</p>', 0x2e2e2f70726f647563745f696d616765732f2e6a666966, 'tide'),
(19, 0, 0, 'Monster ', 500, '<p>Monster Energy Original 24oz</p>', '', 'monster,original,24oz'),
(22, 1, 0, 'Fanta Orange', 2, '<p>Fanta Original Orange Flavor</p>', 0x2e2e2f70726f647563745f696d616765732f31323935333531382e6a666966, 'Fanta,Orange,2liter'),
(23, 1, 0, 'Inca Kola', 2, '<p>Inca Kola 2 liter</p>', 0x2e2e2f70726f647563745f696d616765732f383336313335362e6a7067, 'inca kola, 2liter,inca'),
(24, 2, 0, 'Iced Mocha - Dunkin Donuts ', 3.5, '<p>Dunkin Donuts Iced Mocha</p>', 0x2e2e2f70726f647563745f696d616765732f35323130343433382e6a666966, 'iced mocha, mocha, dunkin,dunkin donuts,'),
(25, 2, 0, 'Iced Original - Dunkin Donuts ', 3.5, '<p>Dunkin Donuts Iced Original 13.7oz</p>', 0x2e2e2f70726f647563745f696d616765732f696365642d636f666665652d626f74746c65642d64756e6b696e2e6a7067, 'Iced original, dunkin, dunkin donuts, 13.7, 13.7oz, coffee, iced'),
(26, 2, 0, 'Coffee Frappuccino - Starbucks', 3.5, '<p>Starbucks Coffee Frappuccino 9.5 oz</p>', 0x2e2e2f70726f647563745f696d616765732f34343238383031376439373834646136613262393866343335663865356361332e6a7067, 'starbucks,coffe,frappuccino, 9.5oz'),
(27, 2, 0, 'Vanilla Frappuccino - Starbucks', 3.5, '<p>Starbucks Vanilla Frappuccino 9.5 oz</p>', 0x2e2e2f70726f647563745f696d616765732f35373062646534333638363034323865616330663238663031366165613439312e6a7067, 'starbucks, vanilla,frappuccino, 9.5oz,'),
(28, 2, 0, 'Mocha Frappuccino - Starbucks ', 3.5, '<p>Starbucks Mocha Frappuccino 9.5 oz</p>', 0x2e2e2f70726f647563745f696d616765732f65326634323635346563663734633562396461306637643833383535616430322e6a7067, 'starbucks, mocha,frappuccino, 9.5oz,'),
(29, 3, 0, 'Orange', 2, '<p>Tropicana Orange Juice 10z</p>', 0x2e2e2f70726f647563745f696d616765732f696d616765536572766963652e6a666966, 'tropicana,orange,10oz,juice,'),
(30, 3, 0, 'Apple ', 2, '<p>Tropicana Apple Juice 10oz</p>', 0x2e2e2f70726f647563745f696d616765732f313438393433363239313936362e6a7067, 'tropicana,apple,10oz,juice,'),
(31, 3, 0, 'Grape ', 2, '<p>Welch\'s Grape Juice 10oz</p>', 0x2e2e2f70726f647563745f696d616765732f4f726967696e616c5f3135323930352e6a7067, 'welch,welch\'s,grape,10oz,juice,'),
(32, 4, 0, 'Gatorade Lime 20z', 3, '<p>Gatorade Lime 20 oz</p>', 0x2e2e2f70726f647563745f696d616765732f6c656d6f6e5f6c696d655f32306f7a2e6a7067, 'gatorade, lime, 20z, sport'),
(33, 4, 0, 'Gatorade Lime 32oz', 4, '<p>Gatorade Lime 32 oz</p>', 0x2e2e2f70726f647563745f696d616765732f31333637343131392e6a666966, 'gatorade, lime, 32oz, sport'),
(34, 4, 0, 'Gatorade Orange 20z', 4, '<p>Gatorade Orange 20 oz</p>', 0x2e2e2f70726f647563745f696d616765732f31643861643862372d633136662d343166312d616137382d3830663737386532616635635f312e36386234373236343866323863636434363265313439313135656539636435622e6a666966, 'gatorade, orange, 20z, sport'),
(35, 4, 0, 'Gatorade Orange 32oz', 4, '<p>Gatorade Orange 32 oz</p>', 0x2e2e2f70726f647563745f696d616765732f31333637343039362e6a666966, 'gatorade, orange, 32oz, sport'),
(36, 4, 0, 'Gatorade Cool Blue 20z', 3, '<p>Gatorade Cool Blue 20 oz</p>', 0x2e2e2f70726f647563745f696d616765732f3930302e6a7067, 'gatorade, blue,blue, 20z, sport'),
(37, 4, 0, 'Gatorade Cool Blue 32oz', 3, '<p>Gatorade Cool Blue 32 oz</p>', 0x2e2e2f70726f647563745f696d616765732f70726f645f65635f313536353839313930322e6a666966, 'gatorade, cool,blue, 32oz, sport'),
(38, 4, 0, 'Powerade Grape 20oz', 3, '<p>Powerade Grape 20 oz</p>', 0x2e2e2f70726f647563745f696d616765732f706f7765617264652d67726170652d32306f7a2e6a7067, 'Powerade, grape,20oz,sport'),
(39, 4, 0, 'Powerade Grape 32oz', 4, '<p>Powerade Grape 32 oz</p>', 0x2e2e2f70726f647563745f696d616765732f38396666373663362d306465622d343065662d393662302d6439346631656532333936665f312e36646239366562616535333233336430373861373066643939346439623634622e6a666966, 'Powerade, grape,32oz,sport'),
(40, 4, 0, 'Powerade Fruit Punch 20oz', 3, '<p>Powerade Fruit Punch 20 oz</p>', 0x2e2e2f70726f647563745f696d616765732f32306f7a2d46727569742d50756e63682e6a7067, 'Powerade, fuit,punch,20oz,sport'),
(41, 4, 0, 'Powerade Fruit Punch 32oz', 4, '<p>Powerade Fruit Punch 32 oz</p>', 0x2e2e2f70726f647563745f696d616765732f354a4c314c2e6a70672e6a7067, 'Powerade, fuit,punch,32oz,sport'),
(42, 1, 0, 'Sprite ', 2, '<p>Sprite Lime 2 liter</p>', 0x2e2e2f70726f647563745f696d616765732f3431394e3272454957354c2e6a7067, 'sprite,lime,2liter'),
(43, 5, 0, 'Monster Ultra Red', 2.5, '<p>Monster Energy Ultra Red 8 oz</p>', 0x2e2e2f70726f647563745f696d616765732f6d6f6e737465722d756c7472612d7265642d702e6a7067, 'monster,red,ultra,8oz'),
(44, 5, 0, 'Monster Pipeline Punch', 2.5, '<p>Monster Energy Pipeline Punch 8oz</p>', 0x2e2e2f70726f647563745f696d616765732f3430363736343031315f305f363430783634302e6a7067, 'monster,pipeline,punch,8oz'),
(45, 1, 0, 'Coca Cola ', 2, '<p>Coca Cola Original 2 liter</p>', 0x2e2e2f70726f647563745f696d616765732f436f63615f436f6c615f312e32355f4c745f31303338315f312e6a7067, 'coke,coca,cola,original,2liter'),
(46, 3, 0, 'corn juice ', 1, '<p>corn juice 10 oz</p>', 0x2e2e2f70726f647563745f696d616765732f, 'corn,juice,10oz');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
ADD PRIMARY KEY (`user_id`);
--
-- Indexes for table `brands`
--
ALTER TABLE `brands`
ADD PRIMARY KEY (`brand_id`);
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`cat_id`);
--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
ADD PRIMARY KEY (`customer_id`),
ADD UNIQUE KEY `customer_email` (`customer_email`);
--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`orderID`);
--
-- Indexes for table `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`product_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
MODIFY `user_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `brands`
--
ALTER TABLE `brands`
MODIFY `brand_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `cat_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
MODIFY `customer_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `orderID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
MODIFY `product_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=48;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
bd6106f112faaa42ac3d10dba2c3d36b4f5f7e63
|
SQL
|
adavis2010/sql-scripts
|
/Sub query example 99.sql
|
UTF-8
| 65
| 2.703125
| 3
|
[] |
no_license
|
Select * from Student
Where GPA > (select avg(GPA) from Student);
| true
|
25834cae294ad24cb4231b7654d4f72a3e48b33a
|
SQL
|
naynadya/sqlplsqlpracticalsrepo
|
/Payroll.sql
|
UTF-8
| 12,307
| 3.703125
| 4
|
[] |
no_license
|
create table Associate(
associateId number ,
firstName varchar2(50) not null,
lastName varchar2(50) not null,
yearlyInvestmentUnder80C number,
department varchar2(50) not null,
designation varchar2(50)not null,
pancard varchar2(50)not null,
emailId varchar2(50) not null
)
--------------------------------------------------------------------------------------------------------------------------
drop table Associate
--------------------------------------------------------------------------------------------------------------------------
alter table Associate
add constraint PK_AssociateID
primary key(associateId)
--------------------------------------------------------------------------------------------------------------------------
alter table Associate
add constraint UK_EmailId
unique(emailId)
--------------------------------------------------------------------------------------------------------------------------
CREATE TABLE SALARY(
BASICSALARY NUMBER,
HRA NUMBER,
CONVEYENCEALLOWANCE NUMBER,
OTHERALLOWANCE NUMBER,
PERSONALALLOWANCE NUMBER,
MONTHLYTAX NUMBER,
EPF NUMBER,
COMPANYPF NUMBER,
GROSSSALARY NUMBER,
NETSALARY NUMBER
)
--------------------------------------------------------------------------------------------------------------------------
alter table Salary
add associateId number
select * from Salary
--------------------------------------------------------------------------------------------------------------------------
alter table Salary
add constraint FK_AssociateID
foreign key (associateId) REFERENCES Associate(associateId)
--------------------------------------------------------------------------------------------------------------------------
create table BankDetails(
associateId number constraint FK_AssociateID REFERENCES Associate(associateId),,
accountNumber number,
bankName varchar2(50),
ifcsCode varchar2(50)
)
drop table bankdetails
--------------------------------------------------------------------------------------------------------------------------
select *
from Associate
where firstName like '%s_'
--------------------------------------------------------------------------------------------------------------------------
select *
from Associate
where yearlyinvestmentunder80c <90000 and yearlyinvestmentunder80c >20000
--------------------------------------------------------------------------------------------------------------------------
select *
from Associate
where yearlyinvestmentunder80c between 20000 and 90000
--------------------------------------------------------------------------------------------------------------------------
select *
from Associate
where yearlyinvestmentunder80c IN (10000,20000,75000)
--------------------------------------------------------------------------------------------------------------------------
select count(*) "Total No Of Associate"
from Associate
--------------------------------------------------------------------------------------------------------------------------
select count(*) "Total No Of Associate"
from Associate
--------------------------------------------------------------------------------------------------------------------------
select department, count(department)
from Associate
group by department
order by department
----------------------------------------------------------------------------------------------------------------------------
select abs(-15)
from dual
----------------------------------------------------------------------------------------------------------------------------
select round(17.171,1)
from dual
----------------------------------------------------------------------------------------------------------------------------
select a.associateId,a.firstName,a.lastName,s.basicSalary,s.netSalary,b.bankName
from Associate a , Salary s,BankDetails b
----------------------------------------------------------------------------------------------------------------------------
select a.associateId,a.firstName,a.lastName,s.basicSalary,s.netSalary,b.bankName
from Associate a, Salary s,BankDetails b
where a.associateId(+)=s.associateId
----------------------------------------------------------------------------------------------------------------------------
select *
from Associate ,Salary,BankDetails
where Associate.yearlyinvestmentunder80c <50000
----------------------------------------------------------------------------------------------------------------------------
select *
from Associate ,Salary,BankDetails
where Associate.associateId(+)=Salary.associateId
----------------------------------------------------------------------------------------------------------------------------
select *
from Associate ,Salary,BankDetails
where Associate.associateId=Salary.associateId
and Associate.associateId=Bankdetails.associateId
----------------------------------------------------------------------------------------------------------------------------
select *
from Associate where
--------------------------------------------------------------------------------------------------------------------------
create or replace view Associate_Salary_Details
As
select a.associateId,a.firstName,a.lastName,s.basicSalary,s.netSalary,b.bankName
from Associate a, Salary s,BankDetails b
where a.associateId(+)=s.associateId
--------------------------------------------------------------------------------------------------------------------------
SET SERVEROUTPUT ON
begin
DBMS_OUTPUT.PUT_LINE('Welcome');
END;
----------------------------------------------------------------------------------------------------------------------
DECLARE
vcName VARCHAR2(20) NOT NULL :='Satish';
id NUMBER;
BEGIN
vcName:='Satish';
DBMS_OUTPUT.PUT_LINE(vcName||' '||id);
END;
------------------------------------------------------------------------------------------------------------------------
DECLARE
aId number;
fName varchar(50);
lName varchar(50);
begin
select associateId,firstName,lastName INTO aId,fName,lName
from Associate
where associateId=&aId;
DBMS_OUTPUT.PUT_LINE(aId||' '||fName||' '||lName);
end;
------------------------------------------------------------------------------------------------------------------------
DECLARE
aId ASSOCIATE.ASSOCIATEID%TYPE;
fName ASSOCIATE.FIRSTNAME%TYPE;
lName ASSOCIATE.LASTNAME%tyPE;
begin
select associateId,firstName,lastName INTO aId,fName,lName
from Associate
where associateId=&aId;
DBMS_OUTPUT.PUT_LINE(aId||' '||fName||' '||lName);
end;
------------------------------------------------------------------------------------------------------------------------
DECLARE
associateRow ASSOCIATE%ROWTYPE;
begin
select * INTO associateRow
from Associate
where associateId=&aId;
DBMS_OUTPUT.PUT_LINE(associateRow.ASSOCIATEID);
end;
------------------------------------------------------------------------------------------------------------------------
DECLARE
CURSOR associateCursor is select * from Associate;
associateRow ASSOCIATE%ROWTYPE;
begin
OPEN associateCursor;
LOOP
FETCH associateCursor INTO associateRow;
DBMS_OUTPUT.PUT_LINE(associateRow.ASSOCIATEID||' '||associateRow.firstName||' '||associateRow.lastName);
EXIT WHEN associateCursor%NOTFOUND;
END LOOP;
CLOSE associateCursor;
end;
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE
aId number;
fName varchar(50);
lName varchar(50);
begin
select associateId,firstName,lastName INTO aId,fName,lName
from Associate
where associateId=&aId;
DBMS_OUTPUT.PUT_LINE(aId||' '||fName||' '||lName);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No employees exits');
WHEN TOO_MANY_ROWS THEN
DBMS_OUTPUT.PUT_LINE('Too many raecords foundf');
end;
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE
CURSOR associateCursor is select *
from Associate
where YEARLYINVESTMENTUNDER80C>=&YEARLYINVESTMENTUNDER80C;
associateRow ASSOCIATE%ROWTYPE;
NO_Records_Found EXCEPTION ;
begin
OPEN associateCursor;
FETCH associateCursor INTO associateRow;
IF associateCursor%ROWCOUNT>0
THEN
LOOP
FETCH associateCursor INTO associateRow;
DBMS_OUTPUT.PUT_LINE(associateRow.ASSOCIATEID||' '||associateRow.firstName||' '||associateRow.lastName);
EXIT WHEN associateCursor%NOTFOUND;
END LOOP;
ELSE
RAISE NO_Records_Found;
END IF;
CLOSE associateCursor;
EXCEPTION
WHEN NO_Records_Found THEN
DBMS_OUTPUT.PUT_LINE('NO details found');
end;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------f
create or replace PROCEDURE sp_FindAssociateDetails
AS CURSOR associateCursor is select *
from Associate
where YEARLYINVESTMENTUNDER80C>=10000;
associateRow ASSOCIATE%ROWTYPE;
NO_Records_Found EXCEPTION ;
begin
OPEN associateCursor;
FETCH associateCursor INTO associateRow;
IF associateCursor%ROWCOUNT>0
THEN
LOOP
FETCH associateCursor INTO associateRow;
DBMS_OUTPUT.PUT_LINE(associateRow.ASSOCIATEID||' '||associateRow.firstName||' '||associateRow.lastName);
EXIT WHEN associateCursor%NOTFOUND;
END LOOP;
ELSE
RAISE NO_Records_Found;
END IF;
CLOSE associateCursor;
EXCEPTION
WHEN NO_Records_Found THEN
DBMS_OUTPUT.PUT_LINE('NO details found');
end sp_FindAssociateDetails;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
create or replace PROCEDURE SP_INSERTASSOCIATEDATA
( aId IN NUMBER
, fName IN VARCHAR2
, lName IN VARCHAR2
, investment IN NUMBER
, dep IN VARCHAR2
, desg IN VARCHAR2
, pCard IN VARCHAR2
, eMail IN VARCHAR2
, param1 out number
,param2 out number
) AS
BEGIN
insert into Associate values(aId,fName,lName,investment,dep,desg,pCard,eMail);
END SP_INSERTASSOCIATEDATA;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
execute SP_INSERTASSOCIATEDATA(106,'ABC','PQR',48000,'ADC','Con','JDSJF8737','ZDJ@gmail.com');
execute sp_FindAssociateDetails;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
create or replace function addNums(n1 number,n2 number)
return number
AS
begin
return n1+n2;
end addNums;
declare
ans number;
begin
ans:=addNums(10,20);
DBMS_OUTPUT.PUT_LINE('ans ' ||ans);
end;
---------------------------------------------------------------------------------------------------------------------------------------------------------------
create table insertCatlog(
tableName varchar(50),
insertTimeStamp TimeStamp
)
create or replace Trigger insertAssociateRecordTrigger
After insert on Associate
FOR EACH ROW
BEGIN
insert into insertCatlog values('Associate' ,sysdate);
END;
| true
|
4aa166b5042b2afed180b567e39a8e1f615cf195
|
SQL
|
keakaka/sql-practice
|
/mysql/practice 01.sql
|
UTF-8
| 945
| 3.796875
| 4
|
[] |
no_license
|
-- 1
select concat(first_name, ' ', last_name) name from employees where emp_no = 10944;
-- 2
select concat(first_name, ' ', last_name) 이름, gender 성별, hire_date 입사일 from employees order by 2;
-- 3
select
distinct (select count(*) from employees where gender = 'F') 여직원,
(select count(*) from employees where gender = 'M') 남직원
from employees;
-- 4
select count(emp_no) from salaries where to_date = '9999-01-01';
-- 5
select count(*) from departments;
-- 6
select count(dept_no) from dept_manager where to_date = '9999-01-01';
-- 7
select dept_name from departments order by length(dept_name) desc;
-- 8
select count(*) from salaries where salary > 120000 and to_date = '9999-01-01';
-- 9
select distinct title from titles order by length(title) desc;
-- 10
select count(emp_no) from titles where title = 'Engineer' and to_date = '9999-01-01';
-- 11
select * from titles where emp_no = 13250 order by to_date;
| true
|
84f2031c9513a232affa1bf453b4c31cc4bfbe52
|
SQL
|
infosys-hpcc/ECLBuilder
|
/src/main/resources/scripts.sql
|
UTF-8
| 1,034
| 2.65625
| 3
|
[
"Apache-2.0"
] |
permissive
|
CREATE DATABASE IF NOT EXISTS hpccbuilder;
USE hpccbuilder;
DROP TABLE IF EXISTS eclbuilderuser;
CREATE TABLE eclbuilderuser (
userIndex int(11) NOT NULL DEFAULT '0',
userid varchar(45) DEFAULT NULL,
password varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS eclbuilder;
CREATE TABLE eclbuilder (
author varchar(45) NOT NULL,
name varchar(45) NOT NULL,
logicalFiles varchar(2000) DEFAULT NULL,
lastmodifieddate TIMESTAMP,
eclbuildercode varchar DEFAULT '',
hpccConnId varchar(45) DEFAULT NULL,
wuid varchar(45) DEFAULT NULL,
datasetFields varchar DEFAULT '',
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO eclbuilderuser VALUES(0,'raja', 'raja');
INSERT INTO eclbuilderuser VALUES(1,'ashoka', 'ashoka');
INSERT INTO eclbuilderuser VALUES(2,'narasimha', 'narasimha');
INSERT INTO eclbuilderuser VALUES(3,'bhuvi', 'bhuvi');
INSERT INTO eclbuilderuser VALUES(3,'arjuna', 'arjuna');
INSERT INTO eclbuilderuser VALUES(3,'user1', 'user1pw');
| true
|
59f3564d46518d9f8299bc099e771c4947c21c41
|
SQL
|
felipe-8847/generation
|
/mysql/atividade2.sql
|
UTF-8
| 990
| 3.234375
| 3
|
[] |
no_license
|
create database ecommerce;
use ecommerce;
create table tb_produto(
id bigint auto_increment,
nome varchar(60) not null,
preco double not null,
descricao varchar(200) not null,
ativo boolean not null,
quantidade int not null,
primary key (id)
)
insert into tb_produto(nome, preco, descricao, ativo,quantidade) values ("celular",3000,"smartfone",true,40);
insert into tb_produto(nome, preco, descricao, ativo,quantidade) values ("tv",4000,"televisão",true,75);
insert into tb_produto(nome, preco, descricao, ativo,quantidade) values ("som",2000,"caixa de som",true,100);
insert into tb_produto(nome, preco, descricao, ativo,quantidade) values ("geladeira",4500,"geladeira master ",false,0);
insert into tb_produto(nome, preco, descricao, ativo,quantidade) values ("bateria",200,"bateria para moto ou carro",true,400);
select * from tb_produto where preco > 3000;
select * from tb_produto where preco < 3000;
update tb_produto set preco = 9000 where id= 3;
| true
|
ac9e5e2f75b16278dac61895c4e9a1f6d5a71a5d
|
SQL
|
davidlambourdiere/tp-architecture-web
|
/src/main/resources/db/migration/V1.0.3__add_room.sql
|
UTF-8
| 868
| 3.015625
| 3
|
[] |
no_license
|
CREATE TABLE lifetech.room (
id SERIAL PRIMARY KEY,
optlock TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
num VARCHAR(255)
);
ALTER TABLE lifetech.light ADD COLUMN room_id BIGINT UNSIGNED NOT NULL;
ALTER TABLE lifetech.light
ADD CONSTRAINT FK_light_room_id FOREIGN KEY (room_id) REFERENCES lifetech.room(id);
ALTER TABLE lifetech.shutter ADD COLUMN room_id BIGINT UNSIGNED NOT NULL;
ALTER TABLE lifetech.shutter
ADD CONSTRAINT FK_shutter_room_id FOREIGN KEY (room_id) REFERENCES lifetech.room(id);
ALTER TABLE lifetech.heater ADD COLUMN room_id BIGINT UNSIGNED NOT NULL;
ALTER TABLE lifetech.heater
ADD CONSTRAINT FK_heater_room_id FOREIGN KEY (room_id) REFERENCES room(id);
ALTER TABLE lifetech.clock ADD COLUMN room_id BIGINT UNSIGNED NOT NULL;
ALTER TABLE lifetech.clock
ADD CONSTRAINT FK_clock_room_id FOREIGN KEY (room_id) REFERENCES room(id);
| true
|
b8da1153131b92b275245cf036a882b49a30dc25
|
SQL
|
nss-day-cohort-46/chinook-sllittrell
|
/exercises/18-23/sales_agent_customer_count.sql
|
UTF-8
| 162
| 3.5625
| 4
|
[] |
no_license
|
SELECT e.FirstName || e.LastName Employee , Count(c. CustomerId) Customers FROM Customer c
JOIN Employee e ON e.EmployeeId = c.SupportRepId
GROUP BY e.EmployeeId
| true
|
a34acb241e4a7a3b6d2ca88b7990ee6543a9edbf
|
SQL
|
crispab/signup
|
/conf/evolutions/default/13.sql
|
UTF-8
| 463
| 2.65625
| 3
|
[
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] |
permissive
|
# --- First database schema
# --- For heroku deployment - use PostgreSQL - see http://www.postgresql.org/
# --- Must also work with H2 - test locally
# ---
# --- Password is 'admin'
# --- !Ups
INSERT INTO users (id, first_name, last_name, comment, email, phone, permission, pwd)
VALUES (- 6, 'Admin', 'Istratör', 'Administratör för SignUp4 ', 'admin@crisp.se', '08-55695015', 'Administrator', '21232f297a57a5a743894a0e4a801fc3');
# --- !Downs
DELETE FROM users
WHERE id = -6;
| true
|
9bb59f2a1ae0030c2535de1d6d4c2493923c8fd4
|
SQL
|
IonutParaschiv/booking
|
/sql/bachelor.sql
|
UTF-8
| 6,543
| 2.890625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 02, 2015 at 06:29 PM
-- Server version: 5.6.16
-- PHP Version: 5.5.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: `bachelor`
--
-- --------------------------------------------------------
--
-- Table structure for table `account`
--
CREATE TABLE IF NOT EXISTS `account` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
`surname` varchar(32) NOT NULL,
`email` varchar(32) NOT NULL,
`password` varchar(64) NOT NULL,
`join_date` datetime NOT NULL,
`salt` varchar(32) NOT NULL,
`token` varchar(32) NOT NULL,
`apiKey` varchar(32) NOT NULL,
`parent` int(16) NOT NULL,
`master` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `account`
--
INSERT INTO `account` (`id`, `name`, `surname`, `email`, `password`, `join_date`, `salt`, `token`, `apiKey`, `parent`, `master`) VALUES
(1, 'Ionut', 'Paraschiv', 'ionut@htd.ro', 'de6d7af3ebb5c6cc2585d000a909994921f459f44b53461bf679af7f2f46e233', '2015-05-12 14:31:49', 'kXOtHe9LRGnDuzQp', '86e6ba8473b08ff258b23de7eac29ccb', '86e6ba8473b08ff258b23de7eac29ccb', 1, 0),
(2, 'Jax', 'Seymour', 'me@mynewcompany.com', '838aa9387e7208d8eb54d07dbeb8eff4bcb282e4ac772c306d8f88dc7882e6c0', '2015-05-13 13:08:04', 'DbYWJOUq6zvmhJ2K', '4afa43a7c605ba02361fe214fdd63782', '4afa43a7c605ba02361fe214fdd63782', 1, 0);
-- --------------------------------------------------------
--
-- Table structure for table `booking`
--
CREATE TABLE IF NOT EXISTS `booking` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`company_id` int(16) NOT NULL,
`staff_id` int(16) NOT NULL,
`service_id` int(16) NOT NULL,
`start` datetime NOT NULL,
`end` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `booking`
--
INSERT INTO `booking` (`id`, `company_id`, `staff_id`, `service_id`, `start`, `end`) VALUES
(1, 1, 2, 2, '2015-03-24 18:31:22', '2015-03-24 20:31:22'),
(2, 1, 2, 2, '2015-03-24 18:31:22', '2015-03-24 20:31:22'),
(3, 1, 2, 2, '2015-03-24 18:31:22', '2015-03-24 20:31:22');
-- --------------------------------------------------------
--
-- Table structure for table `company`
--
CREATE TABLE IF NOT EXISTS `company` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`account_id` int(16) NOT NULL,
`name` varchar(32) NOT NULL,
`email` varchar(32) NOT NULL,
`address` text NOT NULL,
`opening_h` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
--
-- Dumping data for table `company`
--
INSERT INTO `company` (`id`, `account_id`, `name`, `email`, `address`, `opening_h`) VALUES
(20, 1, 'Company #1', 'company@dummy.com', 'Dummy street nr 10', 'mo-fry : 09:00 - 18:00');
-- --------------------------------------------------------
--
-- Table structure for table `master_account`
--
CREATE TABLE IF NOT EXISTS `master_account` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
`surname` varchar(32) NOT NULL,
`email` varchar(32) NOT NULL,
`password` varchar(64) NOT NULL,
`join_date` datetime NOT NULL,
`salt` varchar(32) NOT NULL,
`token` varchar(32) NOT NULL,
`apiKey` varchar(32) NOT NULL,
`parent` int(16) DEFAULT NULL,
`master` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;
--
-- Dumping data for table `master_account`
--
INSERT INTO `master_account` (`id`, `name`, `surname`, `email`, `password`, `join_date`, `salt`, `token`, `apiKey`, `parent`, `master`) VALUES
(25, 'Master', 'master', 'master@api.com', '6b8f017287f6d7e3471def8b696ed397a4c7b18415485d5b16c4f1774f59b4b2', '2015-05-12 12:52:18', '77d2KEoe63QEsdSW', 'ec75c64b295ed40a799c924e663a807b', 'ec75c64b295ed40a799c924e663a807b', NULL, 0),
(30, 'second', 'master', 'second@api.com', '70e60bf3afa611e07335dff16b2abd4a8fb2e47ccf8ce56a540f4744f8d37c4d', '2015-05-12 14:19:09', 'TvfVN376LvUmpVKF', '86b2050f735ac0e7bad0d7b78e17f569', '86b2050f735ac0e7bad0d7b78e17f569', 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `service`
--
CREATE TABLE IF NOT EXISTS `service` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`company_id` int(16) NOT NULL,
`name` varchar(32) NOT NULL,
`price` int(32) NOT NULL,
`description` text NOT NULL,
`duration` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `service`
--
INSERT INTO `service` (`id`, `company_id`, `name`, `price`, `description`, `duration`) VALUES
(1, 20, 'Service #1', 20, 'This is an awesome service', 120),
(2, 20, 'Service #2', 40, 'This is an awesome service number 2', 120),
(3, 20, 'Service #1', 20, 'This is an awesome service', 120);
-- --------------------------------------------------------
--
-- Table structure for table `staff`
--
CREATE TABLE IF NOT EXISTS `staff` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`company_id` int(16) NOT NULL,
`name` varchar(32) NOT NULL,
`surname` varchar(32) NOT NULL,
`email` varchar(32) NOT NULL,
`services` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `staff`
--
INSERT INTO `staff` (`id`, `company_id`, `name`, `surname`, `email`, `services`) VALUES
(1, 20, 'Jax', 'Seymour', 'jax@seymour.com', '[[{"id":"2","company_id":"20","name":"Service #2","price":"40","description":"This is an awesome service number 2","duration":"120"}],[{"id":"3","company_id":"20","name":"Service #1","price":"20","description":"This is an awesome service","duration":"120"}]]'),
(2, 20, 'Jax', 'Seymour', 'jax@seymour.com', '[[{"id":"2","company_id":"20","name":"Service #2","price":"40","description":"This is an awesome service number 2","duration":"120"}],[{"id":"3","company_id":"20","name":"Service #1","price":"20","description":"This is an awesome service","duration":"120"}]]');
-- --------------------------------------------------------
--
-- Table structure for table `staffService`
--
CREATE TABLE IF NOT EXISTS `staffService` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`staff_id` int(16) NOT NULL,
`service_id` int(16) NOT NULL,
PRIMARY KEY (`id`)
) 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 */;
| true
|
a989b576c8ee0139bee2c89ad6f8ee1d3f806180
|
SQL
|
peipei1109/P_07_leetcode
|
/mysql/sqls.sql
|
UTF-8
| 1,270
| 4.125
| 4
|
[] |
no_license
|
--
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
RETURN (
# Write your MySQL query statement below.
SELECT e1.Salary
FROM (SELECT DISTINCT Salary FROM Employee) e1
WHERE (SELECT COUNT(*) FROM (SELECT DISTINCT Salary FROM Employee) e2 WHERE e2.Salary > e1.Salary) = N - 1
LIMIT 1
);
END
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
set N=N-1;
RETURN (
# Write your MySQL query statement below.
select( select distinct Salary from Employee order by Salary Desc limit 1 offset N )as nthHightestSalary
);
END
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
set N=N-1;
RETURN (
# Write your MySQL query statement below.
select( select distinct Salary from Employee order by Salary Desc limit N, 1 )as nthHightestSalary
);
END
--Status <> 'completed' OR NULL 中的 OR NULL 是必须的~~,because any none null value(include false and 0) will be counted
SELECT Request_at AS Day
, ROUND(COUNT(Status <> 'completed' OR NULL) / COUNT(*), 2) AS `Cancellation Rate`
FROM Trips
JOIN Users
ON Users_Id = Client_Id AND Banned = 'No' AND Request_at BETWEEN '2013-10-01' AND '2013-10-03'
GROUP BY Request_at;
| true
|
e21bc0186bccd3b544a8b1e01beb86c29f990ab3
|
SQL
|
Mahitha-Maddi/Retail-Store-Database-Management
|
/Views.sql
|
UTF-8
| 2,733
| 4.5
| 4
|
[] |
no_license
|
CREATE VIEW [Stores With Highest Sales] AS
SELECT TOP 5 s.StoreID, s.StoreName, sum(i.BillingAmount) as [Total Sales]
FROM Stores s inner join Invoice i on s.StoreID=i.StoreID
Where i.PaymentDate between '2020-11-01' AND '2020-11-30'
Group by s.StoreID, s.StoreName
Order by [Total Sales] DESC;
DROP VIEW [Stores With Highest Sales];
-------------------------------------------------------------------------------------------------------------------------------
CREATE VIEW [Stores With today's Offer] AS
SELECT s.StoreID, s.StoreName, p.PromotionName as [Offer], p.DiscountPercentage
FROM Stores s inner join PromotionStores ps on s.StoreID=ps.StoreID inner join Promotion p on ps.PromotionID = p.PromotionID
Where CURRENT_TIMESTAMP between p.StartDate AND p.ExpiryDate
DROP VIEW [Stores With today's Offer];
-------------------------------------------------------------------------------------------------------------------------------
CREATE VIEW [Total Orders per Date] AS
SELECT CAST(OrderedDate AS DATE) AS [Order Date], COUNT(DISTINCT OrderedDate) AS [Total Orders Per Date] FROM Orders ord
GROUP BY CAST(OrderedDate AS DATE);
-------------------------------------------------------------------------------------------------------------------------------
CREATE VIEW [Total Quantity of Each Product Sold] AS
SELECT DISTINCT oi.ProductID AS [Product ID], p.ProductName AS [Name of the Product] ,
SUM(oi.Quantity) AS [Total Quantity of Each Product Sold] FROM OrderItems oi INNER JOIN
Orders o ON oi.OrderID = o.OrderID INNER JOIN Product p ON oi.ProductID = p.ProductID
GROUP BY oi.ProductID, p.ProductName;
-------------------------------------------------------------------------------------------------------------------------------
CREATE VIEW [Total Orders Placed By a Customer] AS
SELECT RANK() OVER(ORDER BY COUNT(o.OrderID) DESC) AS [CustomerRank],
o.CustomerID, c.FirstName, c.LastName, COUNT(o.OrderID) AS [Total Orders of Customer],
SUM(inv.BillingAmount) AS [Total Billing Amt of each Customer]
FROM Orders o INNER JOIN Customer c ON
o.CustomerID = c.CustomerID INNER JOIN Invoice inv ON o.OrderID = inv.OrderID
GROUP BY o.CustomerID, c.FirstName, c.LastName;
-------------------------------------------------------------------------------------------------------------------------------
SELECT * FROM [Total Quantity of Each Product Sold];
SELECT * FROM [Total Orders per Date];
SELECT * FROM [Stores With Highest Sales];
SELECT * FROM [Stores With today's Offer];
SELECT * FROM [Total Orders Placed By a Customer];
-------------------------------------------------------------------------------------------------------------------------------
| true
|
0854822e4688c933d1d08a9a9db134e9b213993d
|
SQL
|
nss-evening-cohort-3/learning-sql-individual-assignment-guthb
|
/SQL_Learing_Thru_Doing_Question_10.sql
|
UTF-8
| 208
| 3.140625
| 3
|
[] |
no_license
|
--Looking at the InvoiceLine table, provide a query that COUNTs the number of line items for Invoice ID 37.
use Chinook;
SELECT COUNT(InvoiceId) AS 'Line Item Tally' FROM InvoiceLine WHERE InvoiceID = 37;
| true
|
3e6491d95a85a09e5514f43f0084cdcbbfbb2ea9
|
SQL
|
kamyu104/LeetCode-Solutions
|
/MySQL/leetcodify-friends-recommendations.sql
|
UTF-8
| 720
| 4.15625
| 4
|
[
"MIT"
] |
permissive
|
# Time: O(n^2)
# Space: O(n^2)
WITH recommend_cte
AS (SELECT DISTINCT a.user_id user_id,
b.user_id recommended_id
FROM listens a
INNER JOIN listens b ON a.user_id != b.user_id AND a.day = b.day AND a.song_id = b.song_id
GROUP BY a.user_id,
b.user_id,
a.day
HAVING Count(DISTINCT a.song_id) >= 3
ORDER BY NULL)
SELECT user_id,
recommended_id
FROM recommend_cte a
WHERE NOT EXISTS
(SELECT 1
FROM friendship b
WHERE (a.user_id = b.user1_id AND a.recommended_id = b.user2_id)
OR
(a.user_id = b.user2_id AND a.recommended_id = b.user1_id));
| true
|
0066c127ac066e5bdb844f56a261c28d25172e24
|
SQL
|
wanghaisheng/fhirbase
|
/test/fhirbase_jsonbext_spec.sql
|
UTF-8
| 1,626
| 2.5625
| 3
|
[
"MIT"
] |
permissive
|
-- #import ../src/tests.sql
-- #import ../src/fhirbase_json.sql
fhirbase_json._is_array('[1,2]'::jsonb) => true
fhirbase_json._is_array('"a"'::jsonb) => false
fhirbase_json.json_get_in('{"a": 1}'::jsonb, ARRAY['a', 'b']) => ARRAY[]::jsonb[]
fhirbase_json._is_array('[{"a":"b"}]'::jsonb) => true
fhirbase_json._is_array('{"a":"b"}'::jsonb) => false
fhirbase_json._is_object('[{"a":"b"}]'::jsonb) => false
fhirbase_json._is_object('{"a":"b"}'::jsonb) => true
expect
fhirbase_json.json_get_in('{"a":[{"b": [{"c":"c1"},{"c":"c2"}]}, {"b":[{"c":{"obj":"obj"}}]}]}'::jsonb, ARRAY['a','b','c'])
=> ARRAY['"c1"'::jsonb, '"c2"'::jsonb, '{"obj":"obj"}'::jsonb]
fhirbase_json.json_get_in('{"a": 1}'::jsonb, ARRAY['a']) => ARRAY['1'::jsonb]
expect
fhirbase_json.json_array_to_str_array(ARRAY['1','2']::jsonb[])
=> '{1,2}'::text[]
expect
fhirbase_json.json_array_to_str_array(ARRAY['"a"'::jsonb,'"b"'::jsonb])
=> '{a,b}'::text[]
fhirbase_json.jsonb_primitive_to_text('1'::jsonb) => '1'::text
fhirbase_json.jsonb_primitive_to_text('"str"'::jsonb) => 'str'::text
fhirbase_json.jsonb_primitive_to_text('"str"'::jsonb) => 'str'::text
fhirbase_json.jsonb_primitive_to_text('null'::jsonb) => NULL::text
fhirbase_json.assoc('{}'::jsonb, 'a', '1'::jsonb) => '{"a":1}'
fhirbase_json.assoc('{"a":42}'::jsonb, 'a', '1'::jsonb) => '{"a":1}'
fhirbase_json.assoc('{"a":1}'::jsonb, 'a', '42'::jsonb) => '{"a":42}'
expect 'merge'
fhirbase_json.merge('{"a":1, "b":2, "c":3}'::jsonb, '{"d":4,"e":5}'::jsonb)
=> '{"a": 1, "b": 2, "c": 3, "d": 4, "e": 5}'::jsonb
fhirbase_json.dissoc('{"a":1, "b":2}'::jsonb, 'b') => '{"a":1}'
| true
|
6f3b195e6376cb61b23e52d16e2925f452a58776
|
SQL
|
penicillin0/SQL-from-zero
|
/sqledi2_Sample/Sample/Ch09/9_3/List9_5.sql
|
SHIFT_JIS
| 1,445
| 3.5
| 4
|
[] |
no_license
|
/* List9-5 Shohine[u쐬SQL */
--f[^x[Xshop̍쐬
CREATE DATABASE shop;
--u\qvpsqlOAEgAēxR}hvvgshopf[^x[XڑBpostgres̃pX[h̓CXg[Ɏw肵
C:\PostgreSQL\9.5\bin\psql.exe -U postgres -d shop
--Shohine[u̍쐬
CREATE TABLE Shohin
(shohin_id CHAR(4) NOT NULL,
shohin_mei VARCHAR(100) NOT NULL,
shohin_bunrui VARCHAR(32) NOT NULL,
hanbai_tanka INTEGER ,
shiire_tanka INTEGER ,
torokubi DATE ,
PRIMARY KEY (shohin_id));
--if[^̓o^
BEGIN TRANSACTION;
INSERT INTO Shohin VALUES ('0001', 'TVc', 'ߕ', 1000, 500, '2009-09-20');
INSERT INTO Shohin VALUES ('0002', 'p`', 'pi', 500, 320, '2009-09-11');
INSERT INTO Shohin VALUES ('0003', 'Jb^[Vc', 'ߕ', 4000, 2800, NULL);
INSERT INTO Shohin VALUES ('0004', '', 'Lb`pi', 3000, 2800, '2009-09-20');
INSERT INTO Shohin VALUES ('0005', '͓', 'Lb`pi', 6800, 5000, '2009-01-15');
INSERT INTO Shohin VALUES ('0006', 'tH[N', 'Lb`pi', 500, NULL, '2009-09-20');
INSERT INTO Shohin VALUES ('0007', '낵', 'Lb`pi', 880, 790, '2008-04-28');
INSERT INTO Shohin VALUES ('0008', '{[y', 'pi', 100, NULL, '2009-11-11');
COMMIT;
| true
|
eb228bb07ae7f5830054762e8f515fb2d35471de
|
SQL
|
LaserPewPew10/Employee-Tracker
|
/db/seed.sql
|
UTF-8
| 670
| 3.515625
| 4
|
[] |
no_license
|
INSERT INTO department (name)
VALUES ('Sales'), ('Engineering'),('HR');
INSERT INTO roles (title, salary, department_id)
VALUES ('Sales Lead', 110000, 1), ('Sales Person', 70000, 1), ('Senior Engineer', 160000, 2), ('Software Engineer', 100000,2), ('Senior HR', 90000, 3), ('HR Correspondent', 80000, 3 );
INSERT INTO employee (first_name, last_name, roles_id, manager_id)
VALUES ('Han', 'Solo', 1, null), ('Leia','Skywalker', 2, null), ('Luke', 'Skywalker', 1, 1), ('Rey', 'Palpatine', 2, 1), ('Kylo','Ren', 2, null), ('Obi-Wan', 'Kenobi', 3,3);
SELECT * FROM department;
SELECT * FROM roles;
SELECT * FROM employee
INNER JOIN roles
ON roles.id = employee.roles_id;
| true
|
d4e52e7188f3bffe425af5a9d1caa20e4126aa1f
|
SQL
|
dennyalfath/letex-garmindo
|
/letex-garmindo.sql
|
UTF-8
| 9,339
| 3.09375
| 3
|
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 10, 2020 at 03:31 AM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.3.9
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: `letex-garmindo`
--
-- --------------------------------------------------------
--
-- Table structure for table `tb_category`
--
CREATE TABLE `tb_category` (
`cat_id` int(11) NOT NULL,
`cat_name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_category`
--
INSERT INTO `tb_category` (`cat_id`, `cat_name`) VALUES
(1, 'Baju');
-- --------------------------------------------------------
--
-- Table structure for table `tb_client`
--
CREATE TABLE `tb_client` (
`client_id` int(11) NOT NULL,
`client_name` varchar(125) NOT NULL,
`client_contact` varchar(15) NOT NULL,
`client_date_register` date NOT NULL DEFAULT current_timestamp(),
`company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_client`
--
INSERT INTO `tb_client` (`client_id`, `client_name`, `client_contact`, `client_date_register`, `company_id`) VALUES
(1, 'Heri', '8888', '2020-05-10', 1),
(2, 'Reee', '666', '2020-05-10', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tb_company`
--
CREATE TABLE `tb_company` (
`company_id` int(11) NOT NULL,
`company_name` varchar(255) NOT NULL,
`company_code` char(3) NOT NULL,
`company_contact` varchar(255) NOT NULL,
`company_address` varchar(255) NOT NULL,
`so_number` int(11) NOT NULL,
`company_status` enum('Active','Inactive') NOT NULL,
`company_logo` varchar(255) DEFAULT NULL,
`invoice_number` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_company`
--
INSERT INTO `tb_company` (`company_id`, `company_name`, `company_code`, `company_contact`, `company_address`, `so_number`, `company_status`, `company_logo`, `invoice_number`) VALUES
(1, 'PT Letex', 'LTX', '123456', 'Batam', 4, 'Active', '', NULL),
(2, '4444', '242', '32323', '232323', 0, 'Active', '', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tb_fabric`
--
CREATE TABLE `tb_fabric` (
`fab_id` int(11) NOT NULL,
`fab_code` int(11) NOT NULL,
`fab_description` varchar(255) DEFAULT NULL,
`fab_stock` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_invoice`
--
CREATE TABLE `tb_invoice` (
`invoice_id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
`date_issued` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_invoice_detail`
--
CREATE TABLE `tb_invoice_detail` (
`invd_id` int(11) NOT NULL,
`invd_invoice_id` int(11) NOT NULL,
`so_detail_id` int(11) NOT NULL,
`invd_total` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tb_product`
--
CREATE TABLE `tb_product` (
`pr_id` int(11) NOT NULL,
`client_id` int(11) NOT NULL,
`cat_id` int(11) NOT NULL,
`pr_name` varchar(100) NOT NULL,
`style` varchar(100) DEFAULT NULL,
`sell_price` int(11) NOT NULL,
`pr_description` varchar(255) DEFAULT NULL,
`pr_picture` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_product`
--
INSERT INTO `tb_product` (`pr_id`, `client_id`, `cat_id`, `pr_name`, `style`, `sell_price`, `pr_description`, `pr_picture`) VALUES
(1, 1, 1, 'Baju Batik', '-', 3500, 'blabla', NULL),
(2, 1, 1, 'Kemeja', 'wwww', 5666, 'zzz', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tb_sales_order`
--
CREATE TABLE `tb_sales_order` (
`so_id` int(11) NOT NULL,
`so_number` varchar(11) NOT NULL,
`client_id` int(11) NOT NULL,
`so_description` varchar(255) DEFAULT NULL,
`so_date_order` date NOT NULL DEFAULT current_timestamp(),
`so_total_amount` int(11) DEFAULT NULL,
`so_status` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_sales_order`
--
INSERT INTO `tb_sales_order` (`so_id`, `so_number`, `client_id`, `so_description`, `so_date_order`, `so_total_amount`, `so_status`) VALUES
(1, 'LTX-002', 1, 'sss', '2020-05-10', NULL, 'sew'),
(2, 'LTX-003', 1, '4444', '2020-05-10', 8500000, 'cut'),
(3, 'LTX-004', 1, 's', '2020-05-10', NULL, '');
-- --------------------------------------------------------
--
-- Table structure for table `tb_sales_order_detail`
--
CREATE TABLE `tb_sales_order_detail` (
`sod_id` int(11) NOT NULL,
`pr_id` int(11) NOT NULL,
`so_number` varchar(11) NOT NULL,
`user_id` int(11) NOT NULL,
`qty` int(11) NOT NULL,
`price` int(11) NOT NULL,
`remark_size` varchar(100) NOT NULL,
`sod_description` varchar(255) DEFAULT NULL,
`sod_status` varchar(50) NOT NULL,
`last_updated` date NOT NULL DEFAULT current_timestamp(),
`invoice_qty` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_sales_order_detail`
--
INSERT INTO `tb_sales_order_detail` (`sod_id`, `pr_id`, `so_number`, `user_id`, `qty`, `price`, `remark_size`, `sod_description`, `sod_status`, `last_updated`, `invoice_qty`) VALUES
(18, 1, 'LTX-003', 1, 30, 150000, 'S', '', 'cancelled', '2020-05-10', NULL),
(19, 2, 'LTX-003', 1, 50, 170000, 'L', '', 'cut', '2020-05-10', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tb_user`
--
CREATE TABLE `tb_user` (
`user_id` int(11) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`role` varchar(100) DEFAULT NULL,
`block` enum('Y','N') NOT NULL DEFAULT 'Y'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_user`
--
INSERT INTO `tb_user` (`user_id`, `username`, `password`, `role`, `block`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'superadmin', 'N'),
(2, 'denny', '34814f45c5b89ee4ea7e77662747a0e6', 'drafter', 'N'),
(9, 'heri', 'af25458116a2464f9401870dff1e11f5', 'admin', 'N'),
(10, 'manager', '0795151defba7a4b5dfa89170de46277', 'manager', 'N');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tb_category`
--
ALTER TABLE `tb_category`
ADD PRIMARY KEY (`cat_id`);
--
-- Indexes for table `tb_client`
--
ALTER TABLE `tb_client`
ADD PRIMARY KEY (`client_id`);
--
-- Indexes for table `tb_company`
--
ALTER TABLE `tb_company`
ADD PRIMARY KEY (`company_id`);
--
-- Indexes for table `tb_fabric`
--
ALTER TABLE `tb_fabric`
ADD PRIMARY KEY (`fab_id`);
--
-- Indexes for table `tb_invoice`
--
ALTER TABLE `tb_invoice`
ADD PRIMARY KEY (`invoice_id`);
--
-- Indexes for table `tb_invoice_detail`
--
ALTER TABLE `tb_invoice_detail`
ADD PRIMARY KEY (`invd_id`);
--
-- Indexes for table `tb_product`
--
ALTER TABLE `tb_product`
ADD PRIMARY KEY (`pr_id`);
--
-- Indexes for table `tb_sales_order`
--
ALTER TABLE `tb_sales_order`
ADD PRIMARY KEY (`so_id`);
--
-- Indexes for table `tb_sales_order_detail`
--
ALTER TABLE `tb_sales_order_detail`
ADD PRIMARY KEY (`sod_id`);
--
-- Indexes for table `tb_user`
--
ALTER TABLE `tb_user`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tb_category`
--
ALTER TABLE `tb_category`
MODIFY `cat_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tb_client`
--
ALTER TABLE `tb_client`
MODIFY `client_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tb_company`
--
ALTER TABLE `tb_company`
MODIFY `company_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tb_fabric`
--
ALTER TABLE `tb_fabric`
MODIFY `fab_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tb_invoice`
--
ALTER TABLE `tb_invoice`
MODIFY `invoice_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tb_invoice_detail`
--
ALTER TABLE `tb_invoice_detail`
MODIFY `invd_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tb_product`
--
ALTER TABLE `tb_product`
MODIFY `pr_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tb_sales_order`
--
ALTER TABLE `tb_sales_order`
MODIFY `so_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tb_sales_order_detail`
--
ALTER TABLE `tb_sales_order_detail`
MODIFY `sod_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT for table `tb_user`
--
ALTER TABLE `tb_user`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
33378d7e1e549fb62a0c5f28f8e79a88eac33c85
|
SQL
|
vbogudskyi/warehouse
|
/docs/vbohudskyi/script/patch_3.sql
|
UTF-8
| 553
| 2.9375
| 3
|
[] |
no_license
|
ALTER TABLE SignIn
ALTER COLUMN COOKIE varchar(15) NOT NULL;
ALTER TABLE SignIn
ADD CONSTRAINT uq_cookie UNIQUE(COOKIE); --Msg 2714, Level 16, State 5, Line 1
--There is already an object named 'uq_cookie' in the database.
EXEC sp_helpconstraint SignIn;
ALTER TABLE SignIn
DROP CONSTRAINT DF__SignIn__COOKIE__36B12243; --Nicolae, please enter your name of cookie default constraint here
ALTER TABLE SignIn
ADD CONSTRAINT df_cookie DEFAULT('USRCOOK:'+SUBSTRING(CAST(NEWID() AS VARCHAR(50)), 1, 6))
FOR COOKIE;
EXEC sp_helpconstraint SignIn;
| true
|
da4597951dfd5f4018fd3b0e53d5198e669b680d
|
SQL
|
rbosco/controle-estoque-php-react
|
/sql/estoque.sql
|
UTF-8
| 4,870
| 3.40625
| 3
|
[
"MIT"
] |
permissive
|
-- --------------------------------------------------------
-- Servidor: localhost
-- Versão do servidor: 5.7.24 - MySQL Community Server (GPL)
-- OS do Servidor: Win64
-- HeidiSQL Versão: 9.5.0.5332
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Copiando estrutura do banco de dados para estoque
CREATE DATABASE IF NOT EXISTS `estoque` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `estoque`;
-- Copiando estrutura para tabela estoque.category
CREATE TABLE IF NOT EXISTS `category` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Copiando dados para a tabela estoque.category: ~1 rows (aproximadamente)
/*!40000 ALTER TABLE `category` DISABLE KEYS */;
INSERT INTO `category` (`id`, `description`, `created_at`, `updated_at`) VALUES
(1, 'limpeza', '2019-05-28 12:16:37', '2019-05-28 12:16:37');
/*!40000 ALTER TABLE `category` ENABLE KEYS */;
-- Copiando estrutura para tabela estoque.migrations
CREATE TABLE IF NOT EXISTS `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Copiando dados para a tabela estoque.migrations: ~4 rows (aproximadamente)
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_05_28_025358_categorias', 1),
(4, '2019_05_28_025359_produtos', 1);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
-- Copiando estrutura para tabela estoque.password_resets
CREATE TABLE IF NOT EXISTS `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Copiando dados para a tabela estoque.password_resets: ~0 rows (aproximadamente)
/*!40000 ALTER TABLE `password_resets` DISABLE KEYS */;
/*!40000 ALTER TABLE `password_resets` ENABLE KEYS */;
-- Copiando estrutura para tabela estoque.product
CREATE TABLE IF NOT EXISTS `product` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`description` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`category_id` int(10) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `product_category_id_foreign` (`category_id`),
CONSTRAINT `product_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Copiando dados para a tabela estoque.product: ~2 rows (aproximadamente)
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` (`id`, `description`, `category_id`, `created_at`, `updated_at`) VALUES
(12, 'teste', 1, '2019-05-28 18:46:20', '2019-05-28 18:46:20'),
(14, 'asdasdasd', 1, '2019-05-28 19:58:16', '2019-05-28 19:58:16');
/*!40000 ALTER TABLE `product` ENABLE KEYS */;
-- Copiando estrutura para tabela estoque.users
CREATE TABLE IF NOT EXISTS `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Copiando dados para a tabela estoque.users: ~0 rows (aproximadamente)
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true
|
78bad92a9d287095f885d58bbd08ea1295c909af
|
SQL
|
knivit/education
|
/ebank/sql_init.sql
|
UTF-8
| 2,036
| 3.453125
| 3
|
[] |
no_license
|
-- Init script
create table Department (
DepartmentId int not null primary key,
Name varchar(64) not null
);
create table Employee (
EmployeeId int not null primary key,
DepartmentId int not null references Department(DepartmentId),
ChiefId int null references Employee(EmployeeID),
Name varchar(64),
Salary numeric(18,2)
);
insert into Department values (1, 'Dep #1');
insert into Department values (2, 'Dep #2');
insert into Department values (3, 'Dep #3');
insert into Department values (4, 'Dep #4');
insert into Department values (5, 'Dep #5');
insert into Employee values(1, 1, null, 'Chief #1 Dep #1 [10 000]', 10000);
insert into Employee values(2, 1, 1, 'Empl #1 Chief #1 Dep #1 [ 9 000]', 9000);
insert into Employee values(3, 1, 1, 'Empl #2 Chief #1 Dep #1 [11 000]', 11000);
insert into Employee values(4, 1, null, 'Chief #2 Dep #1 [ 9 000]', 9000);
insert into Employee values(5, 2, null, 'Chief #1 Dep #2 [20 000]', 20000);
insert into Employee values(6, 2, 5, 'Empl #1 Chief #1 Dep #2 [19 000]', 19000);
insert into Employee values(7, 2, 5, 'Empl #2 Chief #1 Dep #2 [12 000]', 12000);
insert into Employee values(8, 2, 5, 'Empl #3 Chief #1 Dep #2 [ 7 000]', 7000);
insert into Employee values(9, 2, 5, 'Empl #4 Chief #1 Dep #2 [ 3 000]', 3000);
insert into Employee values(10, 3, null, 'Chief #1 Dep #3 [10 000]', 10000);
insert into Employee values(11, 3, 10, 'Empl #1 Chief #1 Dep #3 [ 2 000]', 2000);
insert into Employee values(12, 3, 10, 'Empl #2 Chief #1 Dep #3 [ 6 000]', 6000);
insert into Employee values(13, 3, 10, 'Empl #3 Chief #1 Dep #3 [ 5 000]', 5000);
insert into Employee values(14, 4, null, 'Chief #1 Dep #4 [30 000]', 30000);
insert into Employee values(15, 4, 14, 'Empl #1 Chief #1 Dep #4 [32 000]', 32000);
insert into Employee values(16, 4, null, 'Chief #2 Dep #4 [ 1 000]', 1000);
insert into Employee values(17, 4, 16, 'Empl #1 Chief #2 Dep #4 [ 3 000]', 3000);
| true
|
8e7638485bd0335e791cb1f72be6ab926e536613
|
SQL
|
AJTootell/WebScript3
|
/server/init.sql
|
UTF-8
| 1,195
| 3.5625
| 4
|
[] |
no_license
|
create database if not exists template;
drop table if exists template.layoutWidget;
drop table if exists template.layout;
drop table if exists template.widget;
create table if not exists template.layout (
lay_id int not null auto_increment primary key,
lay_name varchar(30),
lay_imageBack boolean not null,
lay_imageOrHex varchar(30)
);
create table if not exists template.widget (
wid_id int not null auto_increment primary key,
wid_name varchar(15) not null,
wid_description varchar(150)
);
create table if not exists template.layoutWidget (
laywid_id int not null auto_increment primary key,
lay_id int not null,
wid_id int not null,
laywid_x int,
laywid_y int,
FOREIGN KEY fk_lay(lay_id)
REFERENCES layout(lay_id),
FOREIGN KEY fk_wid(wid_id)
REFERENCES widget(wid_id)
);
insert into widget(wid_name, wid_description) values ("weather", "Get the next weeks forecast of weather");
insert into widget(wid_name, wid_description) values ("twitter", "Latest twitter feed from uni");
insert into layout(lay_name, lay_imageBack, lay_imageOrHex) values ("Testing", false, "#aa00aa");
insert into layoutWidget(lay_id,wid_id,laywid_x,laywid_y) values (1,1,50,50);
| true
|
8e671af131c453ed842f3fbc03e04d15d8b86924
|
SQL
|
ppedvAG/SQL-Admin-Powerwoche-Mai-2021-VC
|
/SQL Admin Powerwoche/Leistungsindikatoren.sql
|
WINDOWS-1252
| 3,421
| 3.53125
| 4
|
[] |
no_license
|
Prozessor\% Prozessorzeit berwachung des CPU-Verbrauchs auf dem Server
Logischer Datentrger\Freie MB berwachung des freien Speicherplatzes auf den
Datentrgern
MSSQL$Instance:Datenbanken\Gre der
Datendateien (KB) Wachstumstrend im Laufe der Zeit
Arbeitsspeicher\Seiten/s berprfung auf Auslagerungen, ein starker Hinweis
darauf, dass die Arbeitsspeicherressourcen eventuell
nicht ausreichen
Arbeitsspeicher\Verfgbare MB Anzeige des physischen Arbeits
Prozessor\% Prozessorzeit Die berwachung des CPU-Verbrauchs ermglicht
Ihnen die Ermittlung von Engpssen auf dem Server
(erkennbar an anhaltend hoher Nutzung).
Hoher Prozentwert bei der Signalwartezeit
Die Signalwartezeit ist die Zeit, die ein Arbeits-Thread
auf CPU-Zeit warten muss, nachdem andere
Wartezeiten (fr Sperren, Latches usw.) beendet
wurden. Mssen Prozesse auf die CPU warten, deutet
das auf einen CPU-Engpass hin.
Signalwartezeiten knnen in SQL Server 2000 durch
die Ausfhrung von
DBCC SQLPERF(waitstats) und in SQL Server 2005
durch die Abfrage von sys.dm_os_wait_stats
ermittelt werden.
Physischer Datentrger\Durchschnittl.
Warteschlangenlnge der Festplatte
berprfung auf Datentrgerengpsse: Ist der
Wert grer als 2, so besteht wahrscheinlich ein
Datentrgerengpass.
MSSQL$Instance:Puffer-Manager\Lebenserwartung
von Seiten
Die Lebenserwartung einer Seite ist die Anzahl an
Sekunden, die sie im Puffer-Cache verbleibt. Ein
niedriger Wert zeigt an, dass Seiten bereits nach
kurzem Verbleib im Cache entfernt werden, was
dessen Effektivitt mindert.
MSSQL$Instance:Plan-Cache\Cache-Trefferquote Eine niedrige Cache-Trefferquote fr den PlanCache bedeutet, dass Ausfhrungsplne nicht
wiederverwendet werden.
MSSQL$Instance:Allgemeine Statistiken\Blockierte
Prozesse
Lange Blockierungen weisen auf Ressourcenkonflikt hin
Plan Cache: Trefferquote
Jede Frage bentigt einen Ausfhrungsplan. Im gnstigsten Fall liegt dieser bereits vor. Falls nicht, muss ein neuer Plan erstellt und kompiliert werden. Das kostet Prozessorzeit.
Falls also die Prozessorleistung sehr hoch ist, sollten sie diesen Wert und Transactions / sec untersuchen. Die Trefferquote sollte so hoch wie mglich sein.
GenerellStatitics: User Connections
Anzahl der Benutzerverbindungen
Puffer Manager: Page Life Expectancy
Seiten werden in den Speicher geladen, um die Requests der Clients schnell bedienen zu knnen. Die gecachten Seiten knnen aufgrund von zu wenig Platz zugunsten anderer Seiten aus dem Cache entfernt werden. Der Wert sollte nicht unter 300 liegen. Sonst haben Sie zu wenig Hauptspeicher
SQL Statistics: Kompilierungen /sec
Ausfhrungsplne bedrfen einer kompilierung und evtl auch einer Recompilierung. Diese fhrt zu einer hheren CPU Last. Sollte dieser Wert sich erhhen, knnen Sie evtl durch paramtriesierung ihrer Abfragen eine Verbesserung erreichen.
SQL Statistics: Recompilierungen /sec
Dieser Wert steigt, sobald kompilierte Plne durch verschiedene SET Einstellungen erneut kompiliert werden mssen.
SQL Benutzerdefinierbar: User Counter 1 (bis 10)
Ein Indikator der mir persnlich sehr gut gefllt. bergibt man der sp_Usercounter1 eine ganze Zahl so wird diese sofort im Systemmonitor dargestellt. SO liee sich z.B. der Tagesumsatz im Verhltnis zur CPU oder Speicher darstellen. In Worten: Ab einem bestimmten Umsatz proTag braucht man eine besser CPU.
| true
|
505ecd3fdfa69d6deac20aa1ae2d32ad7698cb1f
|
SQL
|
endeavourhealth-discovery/DiscoveryQueryLibrary
|
/Projects/LBHAdultSocialCareLinkage/Queries/populateLsoaLookup.sql
|
UTF-8
| 4,171
| 2.640625
| 3
|
[
"Apache-2.0"
] |
permissive
|
USE data_extracts;
-- ahui 3/3/2020
DROP PROCEDURE IF EXISTS populateLsoaLookup;
DELIMITER //
CREATE PROCEDURE populateLsoaLookup()
BEGIN
DROP TABLE IF EXISTS lsoa_lookup;
CREATE TABLE lsoa_lookup (
code VARCHAR(10),
location VARCHAR(100)
);
ALTER TABLE lsoa_lookup ADD INDEX lsoa_idx (code);
INSERT INTO lsoa_lookup (code, location)
VALUES
('E01000001','City of London')
,('E01000002','City of London')
,('E01032739','City of London')
,('E01032740','City of London')
,('E01001741','Hackney')
,('E01001751','Hackney')
,('E01001803','Hackney')
,('E01001829','Hackney')
,('E01001837','Hackney')
,('E01000003','City of London')
,('E01001718','Hackney')
,('E01001720','Hackney')
,('E01033711','Hackney')
,('E01001782','Hackney')
,('E01033708','Hackney')
,('E01001737','Hackney')
,('E01001738','Hackney')
,('E01001835','Hackney')
,('E01001727','Hackney')
,('E01001736','Hackney')
,('E01001739','Hackney')
,('E01001756','Hackney')
,('E01001723','Hackney')
,('E01001724','Hackney')
,('E01000005','City of London')
,('E01001717','Hackney')
,('E01001768','Hackney')
,('E01001799','Hackney')
,('E01001832','Hackney')
,('E01001814','Hackney')
,('E01033704','Hackney')
,('E01001769','Hackney')
,('E01001793','Hackney')
,('E01001825','Hackney')
,('E01001752','Hackney')
,('E01001816','Hackney')
,('E01001763','Hackney')
,('E01033706','Hackney')
,('E01001805','Hackney')
,('E01001762','Hackney')
,('E01001749','Hackney')
,('E01001809','Hackney')
,('E01001764','Hackney')
,('E01001725','Hackney')
,('E01001819','Hackney')
,('E01001779','Hackney')
,('E01001844','Hackney')
,('E01001784','Hackney')
,('E01001715','Hackney')
,('E01001804','Hackney')
,('E01001759','Hackney')
,('E01001836','Hackney')
,('E01001823','Hackney')
,('E01001808','Hackney')
,('E01001742','Hackney')
,('E01001807','Hackney')
,('E01001789','Hackney')
,('E01001774','Hackney')
,('E01001794','Hackney')
,('E01033709','Hackney')
,('E01001831','Hackney')
,('E01001834','Hackney')
,('E01001728','Hackney')
,('E01033710','Hackney')
,('E01033699','Hackney')
,('E01001806','Hackney')
,('E01001801','Hackney')
,('E01001841','Hackney')
,('E01001747','Hackney')
,('E01001733','Hackney')
,('E01001748','Hackney')
,('E01001777','Hackney')
,('E01001833','Hackney')
,('E01001795','Hackney')
,('E01001796','Hackney')
,('E01001785','Hackney')
,('E01001719','Hackney')
,('E01001826','Hackney')
,('E01001744','Hackney')
,('E01001767','Hackney')
,('E01001792','Hackney')
,('E01001731','Hackney')
,('E01001812','Hackney')
,('E01001757','Hackney')
,('E01001754','Hackney')
,('E01001722','Hackney')
,('E01033712','Hackney')
,('E01001726','Hackney')
,('E01033700','Hackney')
,('E01001843','Hackney')
,('E01001849','Hackney')
,('E01001791','Hackney')
,('E01001802','Hackney')
,('E01001750','Hackney')
,('E01001824','Hackney')
,('E01001830','Hackney')
,('E01001716','Hackney')
,('E01001746','Hackney')
,('E01001735','Hackney')
,('E01001820','Hackney')
,('E01001773','Hackney')
,('E01001734','Hackney')
,('E01001770','Hackney')
,('E01001758','Hackney')
,('E01033707','Hackney')
,('E01001745','Hackney')
,('E01033705','Hackney')
,('E01001755','Hackney')
,('E01033703','Hackney')
,('E01033713','Hackney')
,('E01001815','Hackney')
,('E01033702','Hackney')
,('E01001800','Hackney')
,('E01001780','Hackney')
,('E01001828','Hackney')
,('E01001775','Hackney')
,('E01001753','Hackney')
,('E01001827','Hackney')
,('E01001760','Hackney')
,('E01001842','Hackney')
,('E01001776','Hackney')
,('E01001783','Hackney')
,('E01033698','Hackney')
,('E01001848','Hackney')
,('E01001761','Hackney')
,('E01001839','Hackney')
,('E01001840','Hackney')
,('E01001821','Hackney')
,('E01001790','Hackney')
,('E01001798','Hackney')
,('E01001732','Hackney')
,('E01001729','Hackney')
,('E01001850','Hackney')
,('E01001822','Hackney')
,('E01001811','Hackney')
,('E01001740','Hackney')
,('E01001788','Hackney')
,('E01001772','Hackney')
,('E01001838','Hackney')
,('E01001765','Hackney')
,('E01001786','Hackney')
,('E01001813','Hackney')
,('E01001846','Hackney')
,('E01001787','Hackney')
,('E01001714','Hackney')
,('E01001781','Hackney')
,('E01033701','Hackney')
,('E01001730','Hackney')
,('E01001845','Hackney')
,('E01001847','Hackney');
END//
DELIMITER ;
| true
|
6dae8a234efb24759909331fe00ef363450c21ad
|
SQL
|
joshuaeveleth/sedmap
|
/liquibase_files/changelog2_Indexes.sql
|
UTF-8
| 2,325
| 2.828125
| 3
|
[] |
no_license
|
--liquibase formatted sql
--This is for the sedmap schema
--changeset duselman:CreateDaIndex
CREATE INDEX "SEDMAP"."SITE_REF_DA_IDX" ON "SEDMAP"."SITE_REF" ("NWISDA1");
--rollback Drop index SITE_REF_DA_IDX;
--changeset duselman:CreateStateIndex
CREATE INDEX "SEDMAP"."SITE_REF_STATE_IDX" ON "SEDMAP"."SITE_REF" ("STATE");
--rollback Drop index SITE_REF_STATE_IDX;
--changeset duselman:CreateHucIndex
CREATE INDEX "SEDMAP"."SITE_REF_HUC_IDX" ON "SEDMAP"."SITE_REF" ("HUC_8");
--rollback Drop index SITE_REF_HUC_IDX;
--changeset duselman:CreateEco3Index
CREATE INDEX "SEDMAP"."SITE_REF_ECO3_IDX" ON "SEDMAP"."SITE_REF" ("ECO_L3_CODE");
--rollback Drop index SITE_REF_ECO3_IDX;
--changeset duselman:CreateEco2Index
CREATE INDEX "SEDMAP"."SITE_REF_ECO2_IDX" ON "SEDMAP"."SITE_REF" ("ECO_L2_CODE");
--rollback Drop index SITE_REF_ECO2_IDX;
--changeset duselman:CreateUrbanIndex
CREATE INDEX "SEDMAP"."SITE_REF_URBAN_IDX" ON "SEDMAP"."SITE_REF" ("URBAN");
--rollback Drop index SITE_REF_URBAN_IDX;
--changeset duselman:CreateAgricIndex
CREATE INDEX "SEDMAP"."SITE_REF_AGRIC_IDX" ON "SEDMAP"."SITE_REF" ("AGRIC");
--rollback Drop index SITE_REF_AGRIC_IDX;
--changeset duselman:CreateForestIndex
CREATE INDEX "SEDMAP"."SITE_REF_FOREST_IDX" ON "SEDMAP"."SITE_REF" ("FOREST");
--rollback Drop index SITE_REF_FOREST_IDX;
--changeset duselman:CreateKFactIndex
CREATE INDEX "SEDMAP"."SITE_REF_KFACT_IDX" ON "SEDMAP"."SITE_REF" ("KFACT");
--rollback Drop index SITE_REF_KFACT_IDX;
--changeset duselman:CreateRFactIndex
CREATE INDEX "SEDMAP"."SITE_REF_RFACT_IDX" ON "SEDMAP"."SITE_REF" ("RFACT");
--rollback Drop index SITE_REF_RFACT_IDX;
--changeset duselman:CreateClayIndex
CREATE INDEX "SEDMAP"."SITE_REF_CLAY_IDX" ON "SEDMAP"."SITE_REF" ("CLAY");
--rollback Drop index SITE_REF_CLAY_IDX;
--changeset duselman:CreateSandIndex
CREATE INDEX "SEDMAP"."SITE_REF_SAND_IDX" ON "SEDMAP"."SITE_REF" ("SAND");
--rollback Drop index SITE_REF_SAND_IDX;
--changeset duselman:CreateSiltIndex
CREATE INDEX "SEDMAP"."SITE_REF_SILT_IDX" ON "SEDMAP"."SITE_REF" ("SILT");
--rollback Drop index SITE_REF_SILT_IDX;
--changeset duselman:CreateDiscreteYearIndex
CREATE INDEX "SEDMAP"."DISCRETE_SAMPLE_YEAR_IDX" ON "SEDMAP"."DISCRETE_SAMPLE_FACT" (EXTRACT(YEAR FROM "DATETIME"));
--rollback Drop index DISCRETE_SAMPLE_YEAR_IDX;
| true
|
ac3a5c109acdf981ccb6f2d65ac2bea3f9be7f9f
|
SQL
|
mildrock/kurui-doc
|
/sql/agent.sql
|
UTF-8
| 272
| 2.78125
| 3
|
[] |
no_license
|
select t.*, t.rowid from agent t;
select count(*) as allCount from agent t where 1=1 and t.status=1;
select t.type,count(*)/50 from agent t where t.status=1 group by t.type order by t.type
select t.type,count() from agent t where t.status=1 order by t.type
| true
|
12a8be68a9c66d7f2627cf13a1122c18abbcac23
|
SQL
|
rocket-science-inc/roqet-server
|
/src/main/resources/db/migration/V3__users.sql
|
UTF-8
| 986
| 2.703125
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` INT(10) NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(255) NOT NULL,
`last_name` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`));
INSERT INTO user ( id, first_name, last_name) VALUES ( 1, 'James', 'Smith');
INSERT INTO user ( id, first_name, last_name) VALUES ( 2, 'John', 'Brown');
INSERT INTO user ( id, first_name, last_name) VALUES ( 3, 'Mary', 'Johnson');
INSERT INTO user ( id, first_name, last_name) VALUES ( 4, 'Patricia', 'Ross');
INSERT INTO user ( id, first_name, last_name) VALUES ( 5, 'William', 'Lopez');
INSERT INTO user ( id, first_name, last_name) VALUES ( 6, 'Michael', 'Morgan');
INSERT INTO user ( id, first_name, last_name) VALUES ( 7, 'Linda', 'Coleman');
INSERT INTO user ( id, first_name, last_name) VALUES ( 8, 'Elizabeth', 'Patterson');
INSERT INTO user ( id, first_name, last_name) VALUES ( 9, 'Thomas', 'Baker');
INSERT INTO user ( id, first_name, last_name) VALUES ( 10, 'Jessica', 'Mitchell');
| true
|
0bfbb527e362e985f1e3e720a207e7b237d91daf
|
SQL
|
YauheniD/GodelDataMasteryPart1
|
/Tasks/Maksim/Task4/query09.sql
|
UTF-8
| 184
| 2.96875
| 3
|
[] |
no_license
|
--Query 9
SELECT CustomerID,
year,
TotalQty,
SUM(TotalQty) OVER (PARTITION BY CustomerID ORDER BY year) runqty
FROM Sales.vCustOrders
ORDER BY CustomerID, year;
;
| true
|
01ab3d6fb503e7f79a6f7862dab1317e40ff14f7
|
SQL
|
chuma1409/waiter_webapp
|
/tables.sql
|
UTF-8
| 1,638
| 3.453125
| 3
|
[] |
no_license
|
create table users(
id serial not null primary key,
username text
);
create table days(
id serial not null primary key,
chosen_day text not null
);
create table availability(
id serial not null primary key,
id_user int not null,
id_days int not null,
FOREIGN KEY(id_user) REFERENCES users(id),
FOREIGN KEY(id_days) REFERENCES days(id)
);
INSERT INTO days (chosen_day)
VALUES ('Sunday');
INSERT INTO days (chosen_day)
VALUES ('Monday');
INSERT INTO days (chosen_day)
VALUES ('Tuesday');
INSERT INTO days (chosen_day)
VALUES ('Wednesday');
INSERT INTO days (chosen_day)
VALUES ('Thursday');
INSERT INTO days (chosen_day)
VALUES ('Friday');
INSERT INTO days (chosen_day)
VALUES ('Saturday');
select chosen_day from availability
join days on availability.id_days = days.id
join users on availability.id_user = users.id where username='mimmo';
SELECT * FROM availability JOIN users ON availability.id_user = users.id JOIN days ON availability.id_days = days.id
-- DELETE FROM users WHERE id=1;
-- INSERT INTO users (username, user_type)
-- VALUES ('Josephine', 'waiter');
-- INSERT INTO users (username, user_type)
-- VALUES ('Nikita', 'waiter');
-- INSERT INTO users (username, user_type)
-- VALUES ('Sibo', 'waiter');
-- INSERT INTO users (username, user_type)
-- VALUES ('Thato', 'waiter');
-- INSERT INTO users (username, user_type)
-- VALUES ('Sino', 'waiter');
-- INSERT INTO users (username, user_type)
-- VALUES ('Bantu', 'waiter');
-- INSERT INTO users (username, user_type)
-- VALUES ('Mbali', 'waiter');
-- INSERT INTO users (username, user_type)
-- VALUES ('Chuma', 'admin');
| true
|
5917b01cea28c1a80d0d3228fe943f9c157c8f60
|
SQL
|
tecnificados/boot
|
/scripts/incidencia.sql
|
UTF-8
| 390
| 2.84375
| 3
|
[
"Apache-2.0"
] |
permissive
|
--
-- Estructura de tabla para la tabla `incidencia`
--
CREATE TABLE `incidencia` (
`id` int(11) NOT NULL,
`titulo` varchar(255) DEFAULT NULL,
`descripcion` varchar(2000) DEFAULT NULL,
`estado` int(20) NOT NULL,
`autor` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indices de la tabla `incidencia`
--
ALTER TABLE `incidencia`
ADD PRIMARY KEY (`id`);
| true
|
3c52aaa86cd64ac34ee854f92093a9bbf0982eda
|
SQL
|
gauniyalmohit/onlineAttendancePortal
|
/at.sql
|
UTF-8
| 16,173
| 2.578125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 10, 2017 at 06:35 AM
-- Server version: 5.1.41
-- PHP Version: 5.3.1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `at`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_5_c#`
--
CREATE TABLE IF NOT EXISTS `cs_5_c#` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`14006050015` varchar(2) NOT NULL DEFAULT 'NA',
`14006050016` varchar(2) NOT NULL DEFAULT 'NA',
`14006050017` varchar(2) NOT NULL DEFAULT 'NA',
`1400605001` varchar(2) NOT NULL DEFAULT 'NA',
`1400605002` varchar(2) NOT NULL DEFAULT 'NA',
`1400605003` varchar(2) NOT NULL DEFAULT 'NA',
`1400605005` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_5_c#`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_5_cns`
--
CREATE TABLE IF NOT EXISTS `cs_5_cns` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`14006050015` varchar(2) NOT NULL DEFAULT 'NA',
`14006050016` varchar(2) NOT NULL DEFAULT 'NA',
`14006050017` varchar(2) NOT NULL DEFAULT 'NA',
`1400605001` varchar(2) NOT NULL DEFAULT 'NA',
`1400605002` varchar(2) NOT NULL DEFAULT 'NA',
`1400605003` varchar(2) NOT NULL DEFAULT 'NA',
`1400605005` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_5_cns`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_5_cnt`
--
CREATE TABLE IF NOT EXISTS `cs_5_cnt` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`14006050015` varchar(2) NOT NULL DEFAULT 'NA',
`14006050016` varchar(2) NOT NULL DEFAULT 'NA',
`14006050017` varchar(2) NOT NULL DEFAULT 'NA',
`1400605001` varchar(2) NOT NULL DEFAULT 'NA',
`1400605002` varchar(2) NOT NULL DEFAULT 'NA',
`1400605003` varchar(2) NOT NULL DEFAULT 'NA',
`1400605005` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_5_cnt`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_5_dbp`
--
CREATE TABLE IF NOT EXISTS `cs_5_dbp` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`14006050015` varchar(2) NOT NULL DEFAULT 'NA',
`14006050016` varchar(2) NOT NULL DEFAULT 'NA',
`14006050017` varchar(2) NOT NULL DEFAULT 'NA',
`1400605001` varchar(2) NOT NULL DEFAULT 'NA',
`1400605002` varchar(2) NOT NULL DEFAULT 'NA',
`1400605003` varchar(2) NOT NULL DEFAULT 'NA',
`1400605005` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_5_dbp`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_5_mp`
--
CREATE TABLE IF NOT EXISTS `cs_5_mp` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`14006050015` varchar(2) NOT NULL DEFAULT 'NA',
`14006050016` varchar(2) NOT NULL DEFAULT 'NA',
`14006050017` varchar(2) NOT NULL DEFAULT 'NA',
`1400605001` varchar(2) NOT NULL DEFAULT 'NA',
`1400605002` varchar(2) NOT NULL DEFAULT 'NA',
`1400605003` varchar(2) NOT NULL DEFAULT 'NA',
`1400605005` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_5_mp`
--
INSERT INTO `cs_5_mp` (`date`, `day`, `day_status`, `14006050015`, `14006050016`, `14006050017`, `1400605001`, `1400605002`, `1400605003`, `1400605005`) VALUES
('2017-01-10', 'Tue', 'workday', 'p', 'p', 'a', 'a', 'p', 'a', 'a');
-- --------------------------------------------------------
--
-- Table structure for table `cs_5_ns`
--
CREATE TABLE IF NOT EXISTS `cs_5_ns` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`14006050015` varchar(2) NOT NULL DEFAULT 'NA',
`14006050016` varchar(2) NOT NULL DEFAULT 'NA',
`14006050017` varchar(2) NOT NULL DEFAULT 'NA',
`1400605001` varchar(2) NOT NULL DEFAULT 'NA',
`1400605002` varchar(2) NOT NULL DEFAULT 'NA',
`1400605003` varchar(2) NOT NULL DEFAULT 'NA',
`1400605005` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_5_ns`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_5_sqt`
--
CREATE TABLE IF NOT EXISTS `cs_5_sqt` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`14006050015` varchar(2) NOT NULL DEFAULT 'NA',
`14006050016` varchar(2) NOT NULL DEFAULT 'NA',
`14006050017` varchar(2) NOT NULL DEFAULT 'NA',
`1400605001` varchar(2) NOT NULL DEFAULT 'NA',
`1400605002` varchar(2) NOT NULL DEFAULT 'NA',
`1400605003` varchar(2) NOT NULL DEFAULT 'NA',
`1400605005` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_5_sqt`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_6_cg`
--
CREATE TABLE IF NOT EXISTS `cs_6_cg` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`1400605006` varchar(2) NOT NULL DEFAULT 'NA',
`1400605007` varchar(2) NOT NULL DEFAULT 'NA',
`1400605008` varchar(2) NOT NULL DEFAULT 'NA',
`1400605009` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_6_cg`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_6_dwm`
--
CREATE TABLE IF NOT EXISTS `cs_6_dwm` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`1400605006` varchar(2) NOT NULL DEFAULT 'NA',
`1400605007` varchar(2) NOT NULL DEFAULT 'NA',
`1400605008` varchar(2) NOT NULL DEFAULT 'NA',
`1400605009` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_6_dwm`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_6_edm`
--
CREATE TABLE IF NOT EXISTS `cs_6_edm` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`1400605006` varchar(2) NOT NULL DEFAULT 'NA',
`1400605007` varchar(2) NOT NULL DEFAULT 'NA',
`1400605008` varchar(2) NOT NULL DEFAULT 'NA',
`1400605009` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_6_edm`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_6_es`
--
CREATE TABLE IF NOT EXISTS `cs_6_es` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`1400605006` varchar(2) NOT NULL DEFAULT 'NA',
`1400605007` varchar(2) NOT NULL DEFAULT 'NA',
`1400605008` varchar(2) NOT NULL DEFAULT 'NA',
`1400605009` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_6_es`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_6_java`
--
CREATE TABLE IF NOT EXISTS `cs_6_java` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`1400605006` varchar(2) NOT NULL DEFAULT 'NA',
`1400605007` varchar(2) NOT NULL DEFAULT 'NA',
`1400605008` varchar(2) NOT NULL DEFAULT 'NA',
`1400605009` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_6_java`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_6_mc`
--
CREATE TABLE IF NOT EXISTS `cs_6_mc` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`1400605006` varchar(2) NOT NULL DEFAULT 'NA',
`1400605007` varchar(2) NOT NULL DEFAULT 'NA',
`1400605008` varchar(2) NOT NULL DEFAULT 'NA',
`1400605009` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_6_mc`
--
-- --------------------------------------------------------
--
-- Table structure for table `cs_6_ost`
--
CREATE TABLE IF NOT EXISTS `cs_6_ost` (
`date` date NOT NULL,
`day` varchar(15) NOT NULL,
`day_status` varchar(15) NOT NULL,
`1400605006` varchar(2) NOT NULL DEFAULT 'NA',
`1400605007` varchar(2) NOT NULL DEFAULT 'NA',
`1400605008` varchar(2) NOT NULL DEFAULT 'NA',
`1400605009` varchar(2) NOT NULL DEFAULT 'NA',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_6_ost`
--
INSERT INTO `cs_6_ost` (`date`, `day`, `day_status`, `1400605006`, `1400605007`, `1400605008`, `1400605009`) VALUES
('2017-01-10', 'Tue', 'workday', 'a', 'a', 'p', 'p');
-- --------------------------------------------------------
--
-- Table structure for table `holiday`
--
CREATE TABLE IF NOT EXISTS `holiday` (
`sno` int(3) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`day` varchar(20) NOT NULL,
`by` varchar(50) NOT NULL,
`for` varchar(2000) NOT NULL,
PRIMARY KEY (`sno`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=131 ;
--
-- Dumping data for table `holiday`
--
INSERT INTO `holiday` (`sno`, `date`, `day`, `by`, `for`) VALUES
(130, '2069-12-31', 'Wed', 'Anudeep gusain', 'it_5_rdbms');
-- --------------------------------------------------------
--
-- Table structure for table `login`
--
CREATE TABLE IF NOT EXISTS `login` (
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`role` varchar(10) NOT NULL,
`teacher_branch` varchar(50) NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `login`
--
INSERT INTO `login` (`username`, `password`, `role`, `teacher_branch`) VALUES
('gpdehradun', '7c4a8d09ca3762af61e59520943dc26494f8941b', 'principal', ''),
('abhitesh', '7c4a8d09ca3762af61e59520943dc26494f8941b', 'hod', 'computer_science'),
('anudeep', '7c4a8d09ca3762af61e59520943dc26494f8941b', 'teacher', 'computer_science'),
('deepak', '7c4a8d09ca3762af61e59520943dc26494f8941b', 'teacher', 'information_technology'),
('sunit', '7c4a8d09ca3762af61e59520943dc26494f8941b', 'teacher', 'information_technology'),
('meenu', '7c4a8d09ca3762af61e59520943dc26494f8941b', 'hod', 'information_technology');
-- --------------------------------------------------------
--
-- Table structure for table `student`
--
CREATE TABLE IF NOT EXISTS `student` (
`roll_number` bigint(15) NOT NULL,
`name` varchar(50) NOT NULL,
`dob` date NOT NULL,
`branch` varchar(50) NOT NULL,
`semester` int(2) NOT NULL,
PRIMARY KEY (`roll_number`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `student`
--
INSERT INTO `student` (`roll_number`, `name`, `dob`, `branch`, `semester`) VALUES
(1400605009, 'kajal', '2017-01-10', 'computer_science', 6),
(1400605001, 'charu negi', '2017-01-10', 'computer_science', 5),
(1400605002, 'smriti', '2017-01-10', 'computer_science', 5),
(1400605003, 'sunidhi', '2017-01-10', 'computer_science', 5),
(1400605005, 'vishal', '2017-01-10', 'computer_science', 5),
(1400605006, 'govind', '2017-01-10', 'computer_science', 6),
(1400605007, 'reshabh', '2017-01-10', 'computer_science', 6),
(1400605008, 'sachin', '2017-01-07', 'computer_science', 6),
(14006050015, 'mohit gauniyal ', '2017-01-10', 'computer_science', 5),
(14006050016, 'asad', '2017-01-10', 'computer_science', 5),
(14006050017, 'neeraj', '2017-01-10', 'computer_science', 5);
-- --------------------------------------------------------
--
-- Table structure for table `subject`
--
CREATE TABLE IF NOT EXISTS `subject` (
`username` varchar(50) NOT NULL,
`subject_id` varchar(50) NOT NULL,
`subject_name` varchar(100) NOT NULL,
`teacher_name` varchar(50) NOT NULL,
`photo` varchar(30) NOT NULL,
`branch` varchar(50) NOT NULL,
`semester` int(2) NOT NULL,
PRIMARY KEY (`subject_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `subject`
--
INSERT INTO `subject` (`username`, `subject_id`, `subject_name`, `teacher_name`, `photo`, `branch`, `semester`) VALUES
('gpdehradun', '', '', 'A.k.saxena', 'img_avatar3.png', '', 0),
('abhitesh', 'cs_3_oop', 'C++', 'Abhitesh mohan', 'img_avatar3.png', 'computer_science', 3),
('abhitesh', 'cs_4_ds', 'Data structure (CS)', 'Abhitesh mohan', 'img_avatar3.png', 'computer_science', 4),
('meenu', 'cs_5_sqt', 'SQT(CS)', 'Meenu bijwan', 'img_avatar3.png', 'computer_science', 5),
('sunit', 'it_4_ds', 'Data structure (IT)', 'Sunit', 'img_avatar3.png', 'information_technology', 4),
('deepak', 'it_5_java', 'java', 'Deepak negi', 'img_avatar3.png', 'information_technology', 5),
('abhitesh', 'cs_5_mp', 'Microprocessor', 'Abhitesh mohan', 'img_avatar3.png', 'computer_science', 5),
('anudeep', 'it_5_rdbms', 'RDBMS (IT)', 'Anudeep gusain', 'img_avatar3.png', 'information_technology', 5),
('sunit', 'cs_5_ns', 'Network security', 'Sunit', 'img_avatar3.png', 'computer_science', 5),
('meenu', 'it_5_sqt', 'SQT (IT)', 'Meenu bijwan', 'img_avatar3.png', 'information_technology', 5),
('anudeep', 'cs_3_pic', 'Programming in C ( CS )', 'Anudeep gusain', 'img_avatar3.png', 'computer_science', 3),
('anudeep', 'it_3_pic', 'Programming in C ( IT )', 'Anudeep gusain', 'img_avatar3.png', 'information_technology', 3),
('sunit', 'cs_3_csp', 'CSP', 'Sunit', 'img_avatar3.png', 'information_technology', 3),
('sunit', 'cs_3_ddc', 'DDC', 'Sunit', 'img_avatar3.png', 'information_technology', 3),
('abhitesh', 'cs_3_os', 'Operating Systems', 'Abhitesh mohan', 'img_avatar3.png', 'computer_science', 3),
('abhitesh', 'it_3_os', 'Operating Systems', 'Abhitesh mohan', 'img_avatar3.png', 'information_technology', 3),
('sunit', 'cs_4_wt', 'Web Technologies', 'Sunit', 'img_avatar3.png', 'computer_science', 4),
('abhitesh', 'cs_4_coa', 'CSOA', 'Abhitesh mohan', 'img_avatar3.png', 'computer_science', 4),
('anudeep', 'cs_4_dbms', 'DBMS', 'Anudeep gusain', 'img_avatar3.png', 'computer_science', 4),
('anudeep', 'cs_4_sse', 'SSE', 'Anudeep gusain', 'img_avatar3.png', 'computer_science', 4),
('sunit', 'cs_4_cn', 'Computer Networks', 'Sunit', 'img_avatar3.png', 'computer_science', 4),
('deepak', 'cs_5_dbp', 'DB programming', 'Deepak negi', 'img_avatar3.png', 'computer_science', 5),
('deepak', 'cs_5_c#', 'C#.NET', 'Deepak negi', 'img_avatar3.png', 'computer_science', 5),
('sunit', 'cs_5_cnt', 'CNT', 'Sunit', 'img_avatar3.png', 'computer_science', 5),
('sunit', 'cs_5_cns', 'CNS (CS)', 'Sunit', 'img_avatar3.png', 'computer_science', 5),
('deepak', 'cs_6_java', 'JAVA', 'Deepak negi', 'img_avatar3.png', 'computer_science', 6),
('abhitesh', 'cs_6_cg', 'Computer Graphics', 'Abhitesh mohan', 'img_avatar3.png', 'computer_science', 6),
('sunit', 'cs_6_dwm', 'DWM', 'Sunit', 'img_avatar3.png', 'computer_science', 6),
('anudeep', 'cs_6_ost', 'Open source tech.', 'Anudeep gusain', 'img_avatar3.png', 'computer_science', 6),
('sunit', 'cs_6_mc', 'Mobile computing', 'Sunit', 'img_avatar3.png', 'computer_science', 6),
('anudeep', 'cs_6_edm', 'EDM', 'Anudeep gusain', 'img_avatar3.png', 'computer_science', 6),
('sunit', 'cs_6_es', 'Employable skills', 'Sunit', 'img_avatar3.png', 'computer_science', 6),
('sunit', 'it_5_cns', 'CNS (IT)', 'Sunit', 'img_avatar3.png', 'information_technology', 5);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
04bc007e93e7c61362394cd2b3155982c499e1ff
|
SQL
|
subratcall/VJOracle
|
/Grid_Control_queries.sql
|
UTF-8
| 4,405
| 3.59375
| 4
|
[] |
no_license
|
--Grid Control Queries
--list All Database Target details monitored thru grid
select t.host_name
as host
, ip.property_value IP
, t.target_name
as name
, decode ( t.type_qualifier4
, ' '
, 'Normal'
, t.type_qualifier4 )
as type
, dbv.property_value
as version
, port.property_value port
, SID.property_value SID
, logmode.property_value
as "Log Mode"
, oh.property_value
as "Oracle Home"
from mgmt$target t
, ( select p.target_guid
, p.property_value
from mgmt$target_properties p
where p.property_name = 'DBVersion' ) dbv
, ( select p.target_guid
, p.property_value
from mgmt$target_properties p
where p.property_name = 'Port' ) port
, ( select p.target_guid
, p.property_value
from mgmt$target_properties p
where p.property_name = 'SID' ) sid
, ( select p.target_guid
, p.property_value
from mgmt$target_properties p
where p.property_name = 'log_archive_mode' ) logmode
, ( select p.target_guid
, p.property_value
from mgmt$target_properties p
where p.property_name = 'OracleHome' ) oh
, ( select tp.target_name
as host_name
, tp.property_value
from mgmt$target_properties tp
where tp.target_type = 'host'
and tp.property_name = 'IP_address' ) ip
where t.target_guid = port.target_guid
and port.target_guid = sid.target_guid
and sid.target_guid = dbv.target_guid
and dbv.target_guid = logmode.target_guid
and logmode.target_guid = oh.target_guid
and t.host_name = ip.host_name
order by 1, 3;
--If you are having performance hit on Grid database, use following SQL to locate most active segemnts.
--You can then think of archiving data in grid else moving them on speedy spindles.
select sum ( B.logical_reads_total )
, sum ( B.physical_reads_total )
, sum ( B.physical_writes_total )
, sum ( buffer_busy_waits_total )
, c.object_name
, c.owner
from DBA_HIST_SNAPSHOT A
, DBA_HIST_SEG_STAT B
, dba_objects C
where A.Snap_id = b.snap_id
and c.object_id = b.obj#
and A.BEGIN_INTERVAL_TIME >= to_Date ( '17-May-2011 08:00'
, 'DD-MON-YYYY HH24:MI' )
and A.END_INTERVAL_TIME <= to_Date ( '17-May-2011 12:00'
, 'DD-MON-YYYY HH24:MI' )
group by c.object_name
, c.owner
order by 1 desc;
Change order by
1: For most Read Segments
3: For most Writes on a segment
4: For Waits
--List RAC databases and their Attributes like ClusterName, Dataguard Status.
--Change "property_name" attribute per your need
SELECT mgmt$target.host_name
, mgmt$target.target_name
, mgmt$target.target_type
, mgmt$target_properties.property_name
, mgmt$target_properties.property_value
FROM mgmt$target
, mgmt$target_properties
WHERE ( mgmt$target.target_name = mgmt$target_properties.target_name )
AND ( mgmt$target.target_type = mgmt$target_properties.target_type )
and ( mgmt$target.target_type = 'rac_database' )
and ( mgmt$target_properties.property_name in ( 'RACOption'
, 'DBName'
, 'DBDomain'
, 'DBVersion'
, 'ClusterName'
, 'DataGuardStatus'
, 'MachineName'
, 'Role'
, 'SID' ) )
order by mgmt$target.host_name, mgmt$target.target_name,
mgmt$target_properties.property_name;
--List Machine_Names, CPU Count & Database Verion for Licensing
SELECT mgmt$target.host_name
, mgmt$target_properties.property_name
, mgmt$target_properties.property_value
FROM mgmt$target
, mgmt$target_properties
WHERE ( mgmt$target.target_name = mgmt$target_properties.target_name )
AND ( mgmt$target.target_type = mgmt$target_properties.target_type )
AND ( mgmt$target_properties.property_name in ( 'CPUCount','DBVersion' ) )
GROUP BY mgmt$target.host_name
, mgmt$target_properties.property_name
, mgmt$target_properties.property_value
order by mgmt$target.host_name;
--List Targets with TNS Listener ports configured :
SELECT mgmt$target.host_name
, mgmt$target.target_name
, mgmt$target.target_type
, mgmt$target_properties.property_name
, mgmt$target_properties.property_value
FROM mgmt$target
, mgmt$target_properties
WHERE ( mgmt$target.target_name = mgmt$target_properties.target_name )
AND ( mgmt$target.target_type = mgmt$target_properties.target_type )
and ( mgmt$target.target_type = 'oracle_listener' )
and ( mgmt$target_properties.property_name = 'Port' );
| true
|
33bd5f7fc298619ad38fc6122a0de4f551fd4fe0
|
SQL
|
maxaeon/mySqlMini
|
/query.sql
|
UTF-8
| 197
| 3.265625
| 3
|
[] |
no_license
|
-- created movies.movie_name
-- created reviews.review
SELECT movies.movie_name AS movie, reviews.review
FROM reviews
RIGHT JOIN movies
ON reviews.movie_id = movies.id
ORDER BY movies.movie_name;
| true
|
31b4d281bb08c4c915588b75d1214dd301e7621f
|
SQL
|
khiaxeng/cs2102-project-team53
|
/individual_files/schema/noel_schema.sql
|
UTF-8
| 3,386
| 4.5
| 4
|
[] |
no_license
|
DROP TABLE IF EXISTS Employees, Junior, Booker, Senior, Manager, Contacts, HealthDeclaration, Departments, MeetingRooms, Sessions, Updates, Joins CASCADE;
CREATE TABLE Departments (
did INT PRIMARY KEY,
dname VARCHAR(50)
);
-- dept_id is included in employees and set to NOT NULL to enforce total part constraints. If a separate not joins table is use, there
-- is a possibility og of works in being empty while employees and depts have values.
-- Q: How should the on delete for did be set?
CREATE TABLE Employees (
eid INT PRIMARY KEY,
did INT NOT NULL,
ename VARCHAR(50),
email VARCHAR(50) UNIQUE,
contact INT,
resigned_date DATE,
FOREIGN KEY (did) REFERENCES Departments(did)
);
CREATE TABLE Junior (
eid INT PRIMARY KEY,
FOREIGN KEY (eid) REFERENCES Employees(eid) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE Booker (
eid INT PRIMARY KEY,
FOREIGN KEY (eid) REFERENCES Employees(eid) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE Senior (
eid INT PRIMARY KEY,
FOREIGN KEY (eid) REFERENCES Booker(eid) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE Manager (
eid INT PRIMARY KEY,
FOREIGN KEY (eid) REFERENCES Booker(eid) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE Contacts (
eid INT PRIMARY KEY,
mobile_number INT,
home_number INT,
office_number INT,
FOREIGN KEY (eid) REFERENCES Employees(eid) ON DELETE CASCADE ON UPDATE CASCADE
);
-- Health decln is a weak entity set where the date is the paritial key. Many to one relationship where
-- health_declaration has total participation. If store is not used, fever is only calculated during a read
CREATE TABLE HealthDeclaration (
date DATE NOT NULL,
eid INT NOT NULL,
temp NUMERIC NOT NULL,
fever BOOLEAN GENERATED ALWAYS AS (temp > 37.5) STORED,
PRIMARY KEY (eid, date),
FOREIGN KEY (eid) REFERENCES Employees(eid),
CONSTRAINT temp_range_check CHECK ((temp >= 34 AND temp<=43))
);
-- Combined with did to replace located in and enforce total part
-- Q: How should the on delete be handled?
CREATE TABLE MeetingRooms (
room INT,
floor INT,
rname VARCHAR(50),
did INT NOT NULL,
PRIMARY KEY (room, floor),
FOREIGN KEY (did) REFERENCES Departments(did)
);
-- Combined with booker id to replace books and enforce total part
-- Combined with approver_id (id of manager)
-- Q: How should the on delete be handled?
CREATE TABLE Sessions (
time TIME,
date DATE,
room INT,
floor INT,
booker_id INT NOT NULL,
approver_id INT,
PRIMARY KEY(time, date, room, floor),
FOREIGN KEY (room, floor) REFERENCES MeetingRooms(room, floor) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (booker_id) REFERENCES Booker(eid) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (approver_id) REFERENCES Manager(eid)
);
-- Q: How to enforce total participation of meeting rooms?
CREATE TABLE Updates (
eid INT,
room INT,
floor INT,
date DATE,
new_cap INT,
PRIMARY KEY (eid, date, room, floor),
FOREIGN KEY (eid) REFERENCES Manager(eid),
FOREIGN KEY (room, floor) REFERENCES MeetingRooms(room, floor)
);
-- Q: How to enforce total participation of sessions?
CREATE TABLE Joins (
eid INT,
time TIME,
date DATE,
room INT,
floor INT,
PRIMARY KEY (eid, time, date, room, floor),
FOREIGN KEY (eid) REFERENCES Employees(eid),
FOREIGN KEY (time, date, room, floor) REFERENCES Sessions (time, date, room, floor)
);
| true
|
665fbada2769cc0bcce9ffcbc8e8d8edf1ce10a7
|
SQL
|
xpos/schema
|
/xpos.sql
|
UTF-8
| 12,559
| 2.90625
| 3
|
[] |
no_license
|
-- MySQL dump 10.11
--
-- Host: localhost Database: xpos
-- ------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `camera_brand`
--
DROP TABLE IF EXISTS `camera_brand`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `camera_brand` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`brand_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=44 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `camera_brand_model`
--
DROP TABLE IF EXISTS `camera_brand_model`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `camera_brand_model` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`brand_id` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`megapixels` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lcd_screen_size` int(5) DEFAULT NULL,
`memory_type` varchar(50) COLLATE utf8_unicode_ci DEFAULT '',
`zoom` decimal(2,2) DEFAULT NULL,
`small_image` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`large_image` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`mount_id` int(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2561 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `lens`
--
DROP TABLE IF EXISTS `lens`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `lens` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`lens_id` int(10) unsigned DEFAULT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`type` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`max_focal_length` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`min_focal_length` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`max_aperture_at_min_focal` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`max_aperture_at_max_focal` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`compatible_camera_body` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`compatible_camera_brand` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`image_url` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`crop_factor` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`mount_id` int(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1364 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `lens_mount`
--
DROP TABLE IF EXISTS `lens_mount`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `lens_mount` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `photo`
--
DROP TABLE IF EXISTS `photo`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `photo` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`photo_id` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`url` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`tags` mediumtext COLLATE utf8_unicode_ci,
`title` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `photo_url_idx` (`url`) USING HASH
) ENGINE=MyISAM AUTO_INCREMENT=10358 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `photo_has_exif`
--
DROP TABLE IF EXISTS `photo_has_exif`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `photo_has_exif` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`camera_brand_model_id` int(10) DEFAULT NULL,
`shutter_speed` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`aperture` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`focal_length` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`iso_speed` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`exposure_compensation` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`flash` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`x_resolution` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`y_resolution` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`software` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`modified_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
`exposure_program` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`sensitivity_type` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`original_date_time` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`digitized_date_time` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`max_aperture_value` decimal(2,1) DEFAULT NULL,
`metering_mode` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`light_source` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`sub_sec_time_original` tinyint(4) DEFAULT NULL,
`sub_sec_time_digitized` tinyint(4) DEFAULT NULL,
`sensing_method` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`cfa_pattern` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`custom_rendered` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`exposure_mode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`white_balance` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`digital_zoom_ratio` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`focal_length_cropped_sensor` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`scene_capture_type` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`gain_control` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`contrast` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`saturation` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`sharpness` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`subject_distance_range` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
`lens_info` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`lens_min_focal_length` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`lens_max_focal_length` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`lens_min_fl_min_aperture` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`lens_max_fl_min_aperture` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`compression` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`coded_char_set` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`xmp_toolkit` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`creator_tool` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`approx_focus_distance` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`format` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`color_transform` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`camera_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`photo_id` int(10) DEFAULT NULL,
`flickr_id` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`orientation` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`color_space` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`focal_plane_x_resolution` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`focal_plane_y_resolution` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`thumbnail_offset` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`thumbnail_length` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`keywords` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`flash_compensation` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`camera_make` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`gps_latititude` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`gps_longitude` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`gps_altitude` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`gps_altitude_ref` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`lens_id` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`camera_lens_id` int(10) unsigned DEFAULT NULL,
`norm_aperture` decimal(3,1) DEFAULT NULL,
`norm_shutter` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7559 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `theme`
--
DROP TABLE IF EXISTS `theme`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `theme` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `user` (
`username` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`id` int(10) NOT NULL AUTO_INCREMENT,
`user_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(512) COLLATE utf8_unicode_ci NOT NULL,
`oath_token` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`nickname` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`img_url` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `user_follows`
--
DROP TABLE IF EXISTS `user_follows`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `user_follows` (
`follower_id` int(11) NOT NULL,
`followee_id` int(11) NOT NULL,
KEY `follower_id` (`follower_id`),
KEY `followee_id` (`followee_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `user_gear`
--
DROP TABLE IF EXISTS `user_gear`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `user_gear` (
`user_id` int(11) NOT NULL,
`camera_brand_model_id` int(11) DEFAULT NULL,
`lens_id` int(11) DEFAULT NULL,
KEY `user_id` (`user_id`),
KEY `camera_brand_model_id` (`camera_brand_model_id`),
KEY `lens_id` (`lens_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `user_has_photo`
--
DROP TABLE IF EXISTS `user_has_photo`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `user_has_photo` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`photo_id` int(10) NOT NULL,
`user_id` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `user_theme`
--
DROP TABLE IF EXISTS `user_theme`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `user_theme` (
`user_id` int(11) DEFAULT NULL,
`theme_id` int(11) DEFAULT NULL,
KEY `user_id` (`user_id`),
KEY `theme_id` (`theme_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2014-01-11 9:24:51
| true
|
fcf58f2b9a50ec8bc969e5a7f286baec975f3d33
|
SQL
|
Blackbaud-BharatYadav/fenxt-npi-dev
|
/SQL/10_out_ProjectBalance.sql
|
UTF-8
| 616
| 2.640625
| 3
|
[] |
no_license
|
INSERT INTO _sys_transform_id (id,entity,ts_start,ts_end) VALUES (${TRANSFORM_ID['TRANSFORM_ID']},'dm_ProjectBalance',now(),null);
insert /*+ direct */ into out_ProjectBalance
select
${TRANSFORM_ID['TRANSFORM_ID']} as _sys_transform_id,
"TenantId",
"ProjectBalanceId",
"FiscalPeriodId",
"ProjectId",
"Balance",
"AddBalance",
"EncumberanceType",
"AccountId",
"PostStatus"
from stg_csv_ProjectBalance_merge
;
INSERT INTO _sys_transform_id (id,entity,ts_start,ts_end) VALUES (${TRANSFORM_ID['TRANSFORM_ID']},'dm_ProjectBalance',null,now());
select analyze_statistics('out_ProjectBalance')
;
| true
|
eafbc20bfb87dcfed42a5b44ba2e3e7aca4e083a
|
SQL
|
nicksimmons53/School
|
/cs3743/assignments/3/Script/createMovie.sql
|
UTF-8
| 369
| 2.625
| 3
|
[] |
no_license
|
-- createMovie.sql
drop table if exists Movie;
CREATE TABLE `Movie` (
`movieId` char(9) NOT NULL,
`title` varchar(31) NOT NULL,
`genre` varchar(11) DEFAULT 'UNKNOWN',
`rating` varchar(4) DEFAULT 'PG',
`minutes` int(4) DEFAULT 0,
`releaseDt` date DEFAULT NULL,
PRIMARY KEY (`movieId`)
) ;
| true
|
e5a590496e187e25252d65f42f03958db85dffeb
|
SQL
|
CloudsSea/caterecommend
|
/src/main/resources/dbscript/init/businessRelateTable.sql
|
UTF-8
| 15,429
| 3.15625
| 3
|
[] |
no_license
|
DROP TABLE
IF EXISTS `business`;
CREATE TABLE `business` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`business_id_int` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '商户id(bigint)',
`city` VARCHAR (64) DEFAULT '' COMMENT '城市',
`full_address` VARCHAR (128) DEFAULT '0' COMMENT '完整地址',
`latitude` VARCHAR (24) DEFAULT '' COMMENT '维度',
`longitude` VARCHAR (24) DEFAULT '' COMMENT '经度',
`name` VARCHAR (128) DEFAULT '' COMMENT '名称',
`open` TINYINT (1) DEFAULT '0' COMMENT '营业',
`review_count` BIGINT (20) DEFAULT '0' COMMENT '评论数量',
`stars` BIGINT (20) DEFAULT '0' COMMENT '星星',
`state` VARCHAR (12) DEFAULT '' COMMENT '状态',
`type` VARCHAR (36) DEFAULT '' COMMENT '类型',
PRIMARY KEY (`business_id_int`,`business_id`)
)COMMENT='商户表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_attribute`;
CREATE TABLE `bus_attribute` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`accepts_credit_cards` TINYINT (1) DEFAULT '0' COMMENT '支持信用卡',
`accepts_insurance` TINYINT (1) DEFAULT '0' COMMENT '支持赔偿金',
`ages_allowed` VARCHAR (32) DEFAULT '' COMMENT '年龄允许',
`alcohol` VARCHAR (32) DEFAULT '' COMMENT '提供酒',
`attire` VARCHAR (32) DEFAULT '' COMMENT '装饰',
`byob` TINYINT (1) DEFAULT '0' COMMENT '自带酒',
`byob_corkage` VARCHAR (32) DEFAULT '' COMMENT '自带酒或开瓶费',
`by_appointment_only` TINYINT (1) DEFAULT '0' COMMENT '只支持预约',
`caters` TINYINT (1) DEFAULT '0' COMMENT '承办宴席',
`coat_check` TINYINT (1) DEFAULT '0' COMMENT '衣着检查',
`corkage` TINYINT (1) DEFAULT '0' COMMENT '开瓶费',
`delivery` TINYINT (1) DEFAULT '0' COMMENT '递送',
`dogs_allowed` TINYINT (1) DEFAULT '0' COMMENT '宠物',
`drive_thru` TINYINT (1) DEFAULT '0' COMMENT '乘车路过',
`good_for_dancing` TINYINT (1) DEFAULT '0' COMMENT '适合跳舞',
`good_for_groups` TINYINT (1) DEFAULT '0' COMMENT '适合集会',
`good_for_kids` TINYINT (1) DEFAULT '0' COMMENT '适合孩子',
`happy_hour` TINYINT (1) DEFAULT '0' COMMENT '优惠时段',
`has_tv` TINYINT (1) DEFAULT '0' COMMENT '电视',
`noise_level` VARCHAR (32) DEFAULT '' COMMENT '吵闹',
`open_24_hours` TINYINT (1) DEFAULT '0' COMMENT '24h营业',
`order_at_counter` TINYINT (1) DEFAULT '0' COMMENT '柜台订单',
`outdoor_seating` TINYINT (1) DEFAULT '0' COMMENT '户外座位',
`price_range` TINYINT (1) DEFAULT '0' COMMENT '价格波动',
`smoking` VARCHAR (32) DEFAULT '' COMMENT '吸烟',
`take_out` TINYINT (1) DEFAULT '0' COMMENT '打包',
`takes_reservations` TINYINT (1) DEFAULT '0' COMMENT '订座',
`waiter_service` TINYINT (1) DEFAULT '0' COMMENT '服务员',
`wheelchair_accessible` TINYINT (1) DEFAULT '0' COMMENT '轮椅',
`wi_fi` VARCHAR(12) DEFAULT '' COMMENT 'wi_fi',
PRIMARY KEY (`business_id`)
)COMMENT='商户属性表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_ambience`;
CREATE TABLE `bus_ambience` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`casual` TINYINT (1) DEFAULT '0' COMMENT '休闲',
`classy` TINYINT (1) DEFAULT '0' COMMENT '漂亮',
`divey` TINYINT (1) DEFAULT '0' COMMENT '一般',
`hipster` TINYINT (1) DEFAULT '0' COMMENT '低级',
`intimate` TINYINT (1) DEFAULT '0' COMMENT '亲密',
`romantic` TINYINT (1) DEFAULT '0' COMMENT '浪漫',
`touristy` TINYINT (1) DEFAULT '0' COMMENT '适合游览',
`trendy` TINYINT (1) DEFAULT '0' COMMENT '时髦',
`upscale` TINYINT (1) DEFAULT '0' COMMENT '高级',
PRIMARY KEY (`business_id`)
) COMMENT='商户氛围表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_dietary_restrictions`;
CREATE TABLE `bus_dietary_restrictions` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`dairy_free` TINYINT (1) DEFAULT '0' COMMENT '不含乳制品',
`gluten_free` TINYINT (1) DEFAULT '0' COMMENT '无谷蛋白',
`halal` TINYINT (1) DEFAULT '0' COMMENT '伊斯兰',
`kosher` TINYINT (1) DEFAULT '0' COMMENT '犹太教',
`soy_free` TINYINT (1) DEFAULT '0' COMMENT '不含大豆',
`vegan` TINYINT (1) DEFAULT '0' COMMENT '素食主义',
`vegetarian` TINYINT (1) DEFAULT '0' COMMENT '素食',
PRIMARY KEY (`business_id`)
)COMMENT='商户显著特点表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_good_for`;
CREATE TABLE `bus_good_for` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`breakfast` TINYINT (1) DEFAULT '0' COMMENT '早餐',
`brunch` TINYINT (1) DEFAULT '0' COMMENT '早午餐',
`dessert` TINYINT (1) DEFAULT '0' COMMENT '甜点',
`dinner` TINYINT (1) DEFAULT '0' COMMENT '晚餐',
`latenight` TINYINT (1) DEFAULT '0' COMMENT '深夜',
`lunch` TINYINT (1) DEFAULT '0' COMMENT '午餐',
PRIMARY KEY (`business_id`)
)COMMENT='商户优势餐表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_hair_types_specialized_in`;
CREATE TABLE `bus_hair_types_specialized_in` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`africanamerican` TINYINT (1) DEFAULT '0' COMMENT '非裔美籍',
`asian` TINYINT (1) DEFAULT '0' COMMENT '亚洲',
`coloring` TINYINT (1) DEFAULT '0' COMMENT '外貌',
`curly` TINYINT (1) DEFAULT '0' COMMENT '卷毛',
`extensions` TINYINT (1) DEFAULT '0' COMMENT '假发',
`kids` TINYINT (1) DEFAULT '0' COMMENT '孩子',
`perms` TINYINT (1) DEFAULT '0' COMMENT '烫发',
`straightperms` TINYINT (1) DEFAULT '0' COMMENT '直烫发',
PRIMARY KEY (`business_id`)
)COMMENT='商户美发表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_music`;
CREATE TABLE `bus_music` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`background_music` TINYINT (1) DEFAULT '0' COMMENT '背景音乐',
`dj` TINYINT (1) DEFAULT '0' COMMENT 'DJ',
`jukebox` TINYINT (1) DEFAULT '0' COMMENT '自动唱机',
`karaoke` TINYINT (1) DEFAULT '0' COMMENT '卡拉OK',
`live` TINYINT (1) DEFAULT '0' COMMENT '唱片',
`video` TINYINT (1) DEFAULT '0' COMMENT '视频',
PRIMARY KEY (`business_id`)
)COMMENT='商户音乐特点表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_parking`;
CREATE TABLE `bus_parking` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`garage` TINYINT (1) DEFAULT '0' COMMENT '车库',
`lot` TINYINT (1) DEFAULT '0' COMMENT '大量车位',
`street` TINYINT (1) DEFAULT '0' COMMENT '街边停车',
`valet` TINYINT (1) DEFAULT '0' COMMENT '停车客服',
`validated` TINYINT (1) DEFAULT '0' COMMENT '已确认',
PRIMARY KEY (`business_id`)
)COMMENT='商户停车特点表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_hours`;
CREATE TABLE `bus_hours` (
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`monday_open` VARCHAR (24) DEFAULT '' COMMENT '周一开店时间',
`monday_close` VARCHAR (24) DEFAULT '' COMMENT '周一打烊时间',
`thursday_open` VARCHAR (24) DEFAULT '' COMMENT '周二开店时间',
`thursday_close` VARCHAR (24) DEFAULT '' COMMENT '周二打烊时间',
`wednesday_open` VARCHAR (24) DEFAULT '' COMMENT '周三开店时间',
`wednesday_close` VARCHAR (24) DEFAULT '' COMMENT '周三打烊时间',
`saturday_open` VARCHAR (24) DEFAULT '' COMMENT '周四开店时间',
`saturday_close` VARCHAR (24) DEFAULT '' COMMENT '周四打烊时间',
`friday_open` VARCHAR (24) DEFAULT '' COMMENT '周五开店时间',
`friday_close` VARCHAR (24) DEFAULT '' COMMENT '周五打烊时间',
`tuesday_open` VARCHAR (24) DEFAULT '' COMMENT '周六开店时间',
`tuesday_close` VARCHAR (24) DEFAULT '' COMMENT '周六打烊时间',
`sunday_open` VARCHAR (24) DEFAULT '' COMMENT '周天开店时间',
`sunday_close` VARCHAR (24) DEFAULT '' COMMENT '周天打烊时间',
PRIMARY KEY (`business_id`)
)COMMENT='商户营业时间表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_category`;
CREATE TABLE `bus_category` (
`id` VARCHAR (22) NOT NULL COMMENT 'id',
`p_id` VARCHAR (22) DEFAULT '' COMMENT '父级id',
`name` VARCHAR (256) DEFAULT '' COMMENT '分类名称',
PRIMARY KEY (`id`)
)COMMENT='商户分类表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_mid_category`;
CREATE TABLE `bus_mid_category` (
`id` VARCHAR (22) NOT NULL COMMENT 'id',
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`category_id` VARCHAR (22) NOT NULL COMMENT '分类表',
`name` VARCHAR (256) DEFAULT '' COMMENT '分类名称',
PRIMARY KEY (`id`)
)COMMENT='商户与商户分类中间表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `bus_neighborhood`;
CREATE TABLE `bus_neighborhood` (
`id` VARCHAR (22) NOT NULL COMMENT 'id',
`business_id` VARCHAR (22) NOT NULL COMMENT '商户id',
`neighborhood_id` VARCHAR (22) DEFAULT '' COMMENT '邻居id',
`name` VARCHAR (64) DEFAULT '' COMMENT '邻居名字',
PRIMARY KEY (`id`)
)COMMENT='商户邻居表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`user_id` varchar(22) NOT NULL COMMENT '用户id',
`user_id_int` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户id(bigint)',
`average_stars` double DEFAULT '0' COMMENT '平均评分',
`compliments_cool` int(10) unsigned DEFAULT '0' COMMENT '酷赞美',
`compliments_cute` int(10) unsigned DEFAULT '0' COMMENT '可爱赞',
`compliments_funny` int(10) unsigned DEFAULT '0' COMMENT '有趣赞',
`compliments_hot` int(10) unsigned DEFAULT '0' COMMENT '热点赞',
`compliments_list` int(10) unsigned DEFAULT '0' COMMENT '列表赞',
`compliments_more` int(10) unsigned DEFAULT '0' COMMENT '更多赞',
`compliments_note` int(10) unsigned DEFAULT '0' COMMENT '笔记赞',
`compliments_photos` int(10) unsigned DEFAULT '0' COMMENT '照片赞',
`compliments_plain` int(10) unsigned DEFAULT '0' COMMENT '简单赞',
`compliments_profile` int(10) unsigned DEFAULT '0' COMMENT '描述赞',
`compliments_writer` int(10) unsigned DEFAULT '0' COMMENT '作者赞',
`fans` int(10) unsigned DEFAULT '0' COMMENT '粉丝数',
`name` varchar(128) DEFAULT '' COMMENT '用户名',
`review_count` int(10) unsigned DEFAULT '0' COMMENT '评论总数',
`type` varchar(22) DEFAULT '' COMMENT '类型(商家/用户?)',
`votes_cool` int(10) unsigned DEFAULT '0' COMMENT '酷数',
`votes_funny` int(10) unsigned DEFAULT '0' COMMENT '有趣数',
`votes_useful` int(10) unsigned DEFAULT '0' COMMENT '有用数',
`yelping_since` varchar(22) DEFAULT '' COMMENT '注册时间',
PRIMARY KEY (`user_id_int`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='用户表';
DROP TABLE
IF EXISTS `photo`;
CREATE TABLE `photo` (
`business_id` VARCHAR (22) DEFAULT '' COMMENT '商户id',
`caption` VARCHAR (512) DEFAULT '' COMMENT '标题',
`label` VARCHAR (36) DEFAULT '' COMMENT '标签',
`photo_id` VARCHAR (22) DEFAULT '' COMMENT '照片id',
PRIMARY KEY (`photo_id`)
)COMMENT='照片表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `review`;
CREATE TABLE `review` (
`business_id` VARCHAR (22) DEFAULT '' COMMENT '商户id',
`date` VARCHAR (22) DEFAULT '' COMMENT '日期',
`review_id` VARCHAR (22) DEFAULT '' COMMENT '评论id',
`stars` INTEGER UNSIGNED DEFAULT 0 COMMENT '平分',
`text` TEXT COMMENT '详情',
`type` VARCHAR (22) DEFAULT '' COMMENT '类型',
`user_id` VARCHAR (22) DEFAULT '' COMMENT '用户id',
`user_name` VARCHAR (128) DEFAULT '' COMMENT '用户名',
`cool` INTEGER UNSIGNED DEFAULT 0 COMMENT '酷',
`funny` INTEGER UNSIGNED DEFAULT 0 COMMENT '有趣',
`useful` INTEGER UNSIGNED DEFAULT 0 COMMENT '有用',
PRIMARY KEY (`review_id`)
)COMMENT='评论表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `votes`;
CREATE TABLE `votes` (
`id` VARCHAR (22) NOT NULL COMMENT 'id',
`user_id` VARCHAR (22) DEFAULT '' COMMENT '用户id',
`user_name` VARCHAR (128) DEFAULT '' COMMENT '用户名',
`be_review_id` VARCHAR (22) NOT NULL COMMENT '被评论id',
`business_id` VARCHAR (22) DEFAULT '' COMMENT '相关商户id',
`cool` TINYINT (1) DEFAULT '0' COMMENT '酷',
`funny` TINYINT (1) DEFAULT '0' COMMENT '有趣',
`useful` TINYINT (1) DEFAULT '0' COMMENT '有用',
PRIMARY KEY (`id`)
)COMMENT='投票表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `user_elite`;
CREATE TABLE `user_elite` (
`id` VARCHAR (22) NOT NULL COMMENT 'id',
`user_id` VARCHAR (22) DEFAULT '' COMMENT '用户id',
`year` VARCHAR (64) DEFAULT '' COMMENT '年',
PRIMARY KEY (`id`)
)COMMENT='年精英统计表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `user_compliments`;
CREATE TABLE `user_compliments` (
`id` VARCHAR (22) NOT NULL COMMENT 'id',
`user_id` VARCHAR (22) DEFAULT '' COMMENT '用户id',
`user_name` VARCHAR (128) DEFAULT '' COMMENT '用户名',
`be_user_id` VARCHAR (22) DEFAULT '' COMMENT '被赞赏用户id',
`type` VARCHAR (22) DEFAULT '' COMMENT '赞赏类型',
`create_time` VARCHAR (22) DEFAULT '' COMMENT '创建时间',
PRIMARY KEY (`id`)
)COMMENT='赞美表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `user_friends`;
CREATE TABLE `user_friends` (
`id` VARCHAR (22) NOT NULL COMMENT 'id',
`user_id` VARCHAR (22) DEFAULT '' COMMENT '用户id',
`user_name` VARCHAR (128) DEFAULT '' COMMENT '用户名',
`be_user_id` VARCHAR (22) DEFAULT '' COMMENT '被加好友id',
`be_user_name` VARCHAR (128) DEFAULT '' COMMENT '好友用户名',
`create_time` VARCHAR (22) DEFAULT '' COMMENT '创建时间',
PRIMARY KEY (`id`)
)COMMENT='好友表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `user_fans`;
CREATE TABLE `user_fans` (
`id` VARCHAR (22) NOT NULL COMMENT 'id',
`user_id` VARCHAR (22) DEFAULT '' COMMENT '用户id',
`user_name` VARCHAR (128) DEFAULT '' COMMENT '用户名',
`famous_user_id` VARCHAR (22) DEFAULT '' COMMENT '明星用户id',
`create_time` VARCHAR (22) DEFAULT '' COMMENT '创建时间',
PRIMARY KEY (`id`)
)COMMENT='粉丝表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `recommend_default`;
CREATE TABLE `recommend_default` (
`business_id` VARCHAR (22) DEFAULT '' COMMENT '商户id',
`business_id_int` bigint(20) COMMENT '商户id(bigint)',
`recommend_value` float COMMENT '排名',
PRIMARY KEY (`business_id`)
)COMMENT='推荐默认表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
DROP TABLE
IF EXISTS `recommend_user`;
CREATE TABLE `recommend_user` (
`business_id_int` bigint(20) NOT NULL COMMENT '商户id(bigint)',
`recommend_value` float COMMENT '排名',
`user_id_int` bigint(20) NOT NULL COMMENT '用户id(bigint)',
PRIMARY KEY (`business_id_int`,`user_id_int`)
)COMMENT='推荐用户表' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
-- DROP TABLE
-- IF EXISTS `xxx`;
-- CREATE TABLE `xxx` (
-- `id` VARCHAR (22) NOT NULL COMMENT 'id',
-- `xxx` VARCHAR (22) DEFAULT '' COMMENT 'xxx',
-- PRIMARY KEY (`id`)
-- )COMMENT='xxx' ENGINE = INNODB DEFAULT CHARSET = utf8 ROW_FORMAT = COMPACT;
| true
|
ed35c57cfb237e3778dc2e2fda1e4090e4f85288
|
SQL
|
jlmc/hibernate-tunings
|
/database-migrations/migration/V29__batching-of-write-operations.sql
|
UTF-8
| 1,380
| 3.84375
| 4
|
[
"MIT"
] |
permissive
|
create schema if not exists multimedia;
drop table if exists multimedia.review cascade;
drop table if exists multimedia.book_author cascade;
drop table if exists multimedia.author cascade;
drop table if exists multimedia.book cascade;
drop sequence if exists multimedia.author_10_seq;
drop sequence if exists multimedia.book_5_seq;
create sequence multimedia.author_10_seq increment by 10 start with 50;
create sequence multimedia.book_5_seq increment by 5 start with 50;
create table multimedia.author
(
id bigint not null primary key,
firstname varchar,
lastname varchar,
version integer,
mod_date timestamp with time zone
);
create table multimedia.book
(
id integer not null primary key,
description varchar,
title varchar,
version integer
);
create table multimedia.book_author
(
book_id int8 not null references multimedia.book (id),
author_id int8 not null references multimedia.author (id),
primary key (book_id, author_id)
);
create table multimedia.review
(
id integer not null primary key,
book_id int8 not null references multimedia.book (id),
rating integer,
comment varchar(100),
version integer
);
create table multimedia.publisher
(
id int constraint publisher_pk primary key,
mod_date timestamp with time zone,
name varchar(150)
);
| true
|
f8b607f996b6ce93f5e34ce2b5f9ebf97883c8ca
|
SQL
|
ericmess/HW10-SQL
|
/SQL_HW.sql
|
UTF-8
| 7,861
| 4.5
| 4
|
[] |
no_license
|
USE sakila;
-- 1a. Display the first and last names of all actors from the table `actor`.
SELECT first_name, last_name FROM actor;
-- 1b. Display the first and last name of each actor in a single column in upper
-- case letters. Name the column `Actor Name`.
ALTER TABLE actor ADD COLUMN `Actor Name` VARCHAR(50);
UPDATE actor SET `Actor Name` = CONCAT(first_name, ' ', last_name);
-- 2a. You need to find the ID number, first name, and last name of an actor, of whom you know only the first name,
-- "Joe." What is one query would you use to obtain this information?
SELECT * FROM actor
WHERE first_name = "Joe";
-- 2b. Find all actors whose last name contain the letters `GEN`
SELECT DISTINCT(last_name) FROM actor WHERE last_name LIKE '%GEN%';
-- 2c. Find all actors whose last names contain the letters `LI`. This time, order the rows by last name and first name, in that order:
SELECT DISTINCT(last_name) FROM actor WHERE last_name LIKE '%LI%'
ORDER BY last_name DESC, first_name DESC;
-- Ask for help on how to display first name too
-- 2d. Using `IN`, display the `country_id` and `country` columns of the following countries: Afghanistan, Bangladesh, and China:
SELECT country_id, country FROM country WHERE country IN ('Afghanistan', 'Bangladesh', 'China');
-- 3a. You want to keep a description of each actor. You don't think you will be performing queries on a description, so create a column
-- in the table `actor` named `description` and use the data type `BLOB` (Make sure to research the type `BLOB`, as the difference between it and `VARCHAR` are significant).
ALTER TABLE actor ADD COLUMN `description` BLOB;
-- 3b. Very quickly you realize that entering descriptions for each actor is too much effort. Delete the `description` column.
ALTER TABLE actor DROP COLUMN `description`;
SELECT * FROM actor;
-- 4a. List the last names of actors, as well as how many actors have that last name.
SELECT last_name, COUNT(last_name) from actor GROUP BY last_name;
-- 4b. List last names of actors and the number of actors who have that last name, but only for names that are shared by at least two actors.
SELECT last_name, COUNT(last_name) from actor GROUP BY last_name HAVING COUNT(*)>1;
-- 4c. The actor `HARPO WILLIAMS` was accidentally entered in the `actor` table as `GROUCHO WILLIAMS`. Write a query to fix the record.
UPDATE actor SET first_name = REPLACE(first_name,'GROUCHO','HARPO');
UPDATE actor SET `Actor Name` = REPLACE(`Actor Name`,'GROUCHO WILLIAMS','HARPO WILLIAMS');
-- * 4d. Perhaps we were too hasty in changing `GROUCHO` to `HARPO`. It turns out that `GROUCHO` was the correct name after all! In a
-- single query, if the first name of the actor is currently `HARPO`, change it to `GROUCHO`.
UPDATE actor SET first_name = REPLACE(first_name,'HARPO','GROUCHO');
-- 5a. You cannot locate the schema of the `address` table. Which query would you use to re-create it?
CREATE TABLE IF NOT EXISTS address;
SHOW CREATE TABLE address;
-- 6a. Use `JOIN` to display the first and last names, as well as the address, of each staff member. Use the tables `staff` and `address`:
SELECT first_name, last_name FROM staff s JOIN address a ON (s.address_id = a.address_id);
-- 6b. Use `JOIN` to display the total amount rung up by each staff member in August of 2005. Use tables `staff` and `payment`.
SELECT SUM(amount) FROM payment p JOIN staff s ON (p.staff_id = s.staff_id) WHERE payment_date BETWEEN "2005-08-01" AND "2005-09-01";
-- 6c. List each film and the number of actors who are listed for that film. Use tables `film_actor` and `film`. Use inner join.
SELECT f.title, COUNT(fa.actor_id) AS 'Actor Count'
FROM film f, film_actor fa
WHERE f.film_id = fa.film_id
GROUP BY title;
-- done
-- 6d. How many copies of the film `Hunchback Impossible` exist in the inventory system?
SELECT COUNT(*)
FROM inventory
WHERE film_id IN
(
SELECT film_id
FROM film
WHERE TITLE = "Hunchback Impossible"
);
-- done
-- 6e. Using the tables `payment` and `customer` and the `JOIN` command, list the total paid by each customer. List the customers alphabetically by last name:
SELECT p.customer_id, c.first_name, c.last_name, SUM(amount) AS 'total'
FROM payment p, customer c
WHERE p.customer_id = c.customer_id
GROUP BY last_name;
-- 7a. The music of Queen and Kris Kristofferson have seen an unlikely resurgence. As an unintended consequence, films starting with the letters `K` and `Q`
-- have also soared in popularity. Use subqueries to display the titles of movies starting with the letters `K` and `Q` whose language is English.
SELECT title
FROM film
WHERE language_id
IN (
SELECT language_id
FROM `language`
WHERE language_id = 1
)
AND title LIKE "K%" OR title LIKE "Q%";
-- done
-- 7b. Use subqueries to display all actors who appear in the film `Alone Trip`.
SELECT first_name, last_name
FROM actor
WHERE actor_id IN
(
SELECT actor_id
FROM film_actor
WHERE film_id IN
(
SELECT film_id
FROM film
WHERE title = "Alone Trip"
)
);
-- done
-- 7c. You want to run an email marketing campaign in Canada, for which you will need the names and email addresses of all Canadian customers. Use joins to retrieve this information.
SELECT email
FROM customer
WHERE address_id IN
(
SELECT address_id
FROM address
WHERE city_id IN
(
SELECT city_id
FROM city
WHERE country_id IN
(
SELECT country_id
FROM country
WHERE country_id = 20
)
)
);
-- suppose to use joins, maybe go back and redo if have time
-- 7d. Sales have been lagging among young families, and you wish to target all family movies for a promotion. Identify all movies categorized as _family_ films.
SELECT title
FROM film
WHERE film_id IN
(
SELECT film_id
FROM film_category
WHERE category_id IN
(
SELECT category_id
FROM category
WHERE category_id = 8
)
);
-- done
-- 7e. Display the most frequently rented movies in descending order.
SELECT f.title, COUNT(*) AS 'rentalCounts'
FROM rental r, inventory i, film f
WHERE r.inventory_id = i.inventory_id AND i.film_id = f.film_id
GROUP BY title
ORDER BY 'rentalCounts' DESC;
-- close to being the solution
-- ORDER BY DESC needs to be implemented
-- 7f. Write a query to display how much business, in dollars, each store brought in.
-- use payment and customer
SELECT c.store_id, SUM(amount)
FROM payment p, customer c
WHERE p.customer_id = c.customer_id
GROUP BY store_id;
-- done
-- 7g. Write a query to display for each store its store ID, city, and country.
SELECT s.store_id, ci.city, co.country
FROM store s, address a, city ci, country co
WHERE s.address_id = a.address_id AND a.city_id = ci.city_id AND ci.country_id = co.country_id;
-- done
-- 7h. List the top five genres in gross revenue in descending order. (**Hint**: you may need to use the following tables: category, film_category, inventory, payment, and rental.)
SELECT c.category_id, SUM(amount)
FROM rental r, film f, category c, payment p, inventory i
WHERE f.film_id = i.film_id AND i.inventory_id = r.inventory_id AND r.rental_id = p.rental_id
GROUP BY category_id;
-- Need help
-- 8a. In your new role as an executive, you would like to have an easy way of viewing the Top five genres by gross revenue. Use the solution from the
-- problem above to create a view. If you haven't solved 7h, you can substitute another query to create a view.
-- Substituted another query because 7h is not done
CREATE VIEW total_sales AS
SELECT s.store_id, SUM(amount) AS Gross
FROM payment p
JOIN rental r
ON (p.rental_id = r.rental_id)
JOIN inventory i
ON (i.inventory_id = r.inventory_id)
JOIN store s
ON (s.store_id = i.store_id)
GROUP BY s.store_id;
SELECT * FROM total_sales;
-- 8b. How would you display the view that you created in 8a?
-- ????
-- 8c. You find that you no longer need the view `top_five_genres`. Write a query to delete it.
| true
|
aaf99e57133e7b5ab5f71055961e3da9c48d932e
|
SQL
|
Gangadharb54/test2
|
/apartment/tables/century_notice.sql
|
UTF-8
| 1,930
| 2.96875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.2.7.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Oct 18, 2016 at 08:53 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: `apartment`
--
-- --------------------------------------------------------
--
-- Table structure for table `century_notice`
--
CREATE TABLE IF NOT EXISTS `century_notice` (
`id` int(11) NOT NULL,
`notice` text NOT NULL,
`date_added` datetime NOT NULL,
`more` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
--
-- Dumping data for table `century_notice`
--
INSERT INTO `century_notice` (`id`, `notice`, `date_added`, `more`) VALUES
(1, 'Workshop on Fashion and Beauty by Bobby Brown', '2016-10-03 16:00:00', ''),
(2, 'Workshop on Fashion and Beauty by LAKME Fashion Academy', '2016-10-03 15:00:00', ''),
(3, 'Workshop on Fashion and Beauty by LAKME Fashion Academy', '2016-10-03 13:00:00', ''),
(4, 'Workshop on Fashion and Beauty by LAKME Fashion Academy', '2016-10-03 15:00:00', ''),
(5, 'Workshop on Fashion and Beauty by LAKME Fashion Academy', '2016-10-03 18:00:00', '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `century_notice`
--
ALTER TABLE `century_notice`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `century_notice`
--
ALTER TABLE `century_notice`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
883f17b4a81b3bc1cbbc48c347c106bc315f3645
|
SQL
|
sql-boot/postgres-health-scripts
|
/sql/extension.sql
|
UTF-8
| 339
| 2.546875
| 3
|
[
"BSD-3-Clause"
] |
permissive
|
/*{
"name": "extension",
"title": "Extensions",
"description": "Extensions",
"tags": "ui"
}*/
select ae.name
, installed_version
, default_version
, case when installed_version <> default_version then 'OLD' end as is_old
from pg_extension e
join pg_available_extensions ae on extname = ae.name
order by ae.name
| true
|
42e3549914bc7fb417af4cb85ddd3cb02acbbdbf
|
SQL
|
karlarao/scripts
|
/perf_quickstart/testcase_adw.sql
|
UTF-8
| 1,718
| 3.03125
| 3
|
[] |
no_license
|
--### SECTION 1: BEGIN CLOCK TIME
select to_char(sysdate, 'YY/MM/DD HH24:MI:SS') AS "START" from dual;
col time1 new_value time1
col time2 new_value time2
select to_char(sysdate, 'SSSSS') time1 from dual;
--### SECTION 2 (OPTIONAL): INCREASE SESSION ARRAYSIZE, TERM OUTPUT OFF
-- set arraysize 5000
set termout off
set echo off verify off
--for ADW to use hints
alter session set optimizer_ignore_hints=false;
--/*+ no_result_cache */ for individual SQLs
--### SECTION 3: DEFINE THE BIND VARIABLES
-- var b0 varchar2(32)
-- var b1 varchar2(32)
-- var b3 varchar2(50)
-- Set the bind values
-- exec :b0 := '3';
-- exec :b1 := '3';
-- exec :b3 := '05/31/2018 00:00:00';
@mystat.sql
--### SECTION 4: DEFINE THE APPLICATION PARSING SCHEMA
--alter session set current_schema=infoload_prod;
set serveroutput off
--### SECTION 5: THE SQL STATEMENT
select /*+ monitor */
..
from
table_name
;
--### SECTION 6: END CLOCK TIME AND CAPTURE SQL_ID
set termout on
COL p_sqlid NEW_V p_sqlid;
select prev_sql_id p_sqlid from v$session where sid=sys_context('userenv','sid');
spool mystat-&p_sqlid..txt
@mystat.sql
spool off
select to_char(sysdate, 'YY/MM/DD HH24:MI:SS') AS "END" from dual;
select to_char(sysdate, 'SSSSS') time2 from dual;
select &&time2 - &&time1 total_time from dual;
select '''END''' END from dual;
--### SECTION 7 (OPTIONAL): GET EXECUTION PLAN INFO AND PERFORMANCE
-- @planx Y &p_sqlid
-- @rwp_sqlmonreport.sql &p_sqlid
-- @sqlhc T &p_sqlid
--### for ADW use the following to avoid hitting dba_hist_active_sess_history
@planxash.sql Y &p_sqlid
@rwp_sqlmonreport.sql &p_sqlid
@sqlhc_adb.sql T &p_sqlid
| true
|
9758c6ee8ffc56d9edf347dce693484de767cf2f
|
SQL
|
ematsushita/BootcampX
|
/4_queries/assistance_requests_data.sql
|
UTF-8
| 392
| 3.859375
| 4
|
[] |
no_license
|
SELECT teachers.name as teacher, students.name as student, assignments.name as assignment, (assistance_requests.completed_at - assistance_requests.started_at) as duration
FROM teachers
JOIN assistance_requests ON teachers.id = assistance_requests.teacher_id
JOIN students ON assistance_requests.student_id = students.id
JOIN assignments ON assignments.id = assignment_id
ORDER BY duration;
| true
|
774c9fdfb3bec1df11d66ea6a2c1c4b38ff6f5a2
|
SQL
|
nirali420/wikimap
|
/db/seeds/00_wikiseeds.sql
|
UTF-8
| 6,892
| 2.53125
| 3
|
[] |
no_license
|
--Users
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'aaronjames', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'alexwalker', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'baileywhite', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'tylerriley', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'judecook', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'brycenspence', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'tyreemoses', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'michaellaughlin', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'roccomorgan', 'password');
INSERT INTO users
(id, username, password)
VALUES
(DEFAULT, 'tristandouglas', 'password');
-- maps
INSERT INTO maps
(id, title, description, longitude, latitude, location, owner_id)
VALUES
(DEFAULT, 'Dining', 'Best Places to Eat Around Town', 51.0443, -114.0631 , point
(51.0443, -114.0631), 1);
INSERT INTO maps
(id, title, description, longitude, latitude, location, owner_id)
VALUES
(DEFAULT, 'Movie locations ', 'Locations of Movie being shot here', 51.0443, -114.0631 , point
(51.0443, -114.0631), 2);
INSERT INTO maps
(id, title, description, longitude, latitude, location, owner_id)
VALUES
(DEFAULT, 'Tourist Attractions', 'Tourist Attractions', 51.0443, -114.0631 , point
(51.0443, -114.0631), 3);
INSERT INTO maps
(id, title, description, longitude, latitude, location, owner_id)
VALUES
(DEFAULT, 'Calgary Tower', 'Its calgary trademark and visitors attraction', 51.0443, -114.0631 , point(51.0443, -114.0631), 1);
INSERT INTO maps
(id, title, description, longitude, latitude, location, owner_id)
VALUES
(DEFAULT, 'Calgary Zoo', 'Kids just adore the penguins and pandas', 51.0459, -114.0237 , point(51.0459,-114.0237), 2);
INSERT INTO maps
(id, title, description, longitude, latitude, location, owner_id)
VALUES
(DEFAULT, 'Calgary library', 'Time to get serious, read something nice', 51.046494, -114.057732 , point(51.046494, -114.057732), 3);
INSERT INTO maps
(id, title, description, longitude, latitude, location, owner_id)
VALUES
(DEFAULT, 'Calgary museum', 'Its the famous firefighter museum of calgary', 51.0186, -114.0359 , point(51.0186, -114.0359), 3);INSERT INTO maps
(id, title, description, longitude, latitude, location, owner_id)
VALUES
(DEFAULT, 'Calgary National Park', 'A place to spend time with your family', 51.0443, -114.0631 , point
(51.0443, -114.0631), 3);
-- markers
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'The Calgary Zoo', 'Kids just adore the penguins and pandas', 'http://www.google.com', 51.0459, -114.0237, point
(51.0459, -114.0237), 3, 1);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Calgary Tower', 'Its calgary trademark and visitors attraction', 'http://www.google.com', 51.0443, -114.0631 , point(51.0443, -114.0631), 3, 1);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Calgary Library', 'Time to get serious, read something nice', 'http://www.google.com', 51.046494, -114.057732 , point(51.046494, -114.057732), 2, 1);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Calgary Museum', 'Its the famous firefighter museum of calgary', 'http://www.google.com', 51.0186, -114.0359 , point(51.0186, -114.0359), 2, 1);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Calgary National Park', 'A place to spend time with your family', 'http://www.google.com', 51.0443, -114.0631 , point(51.0443, -114.0631), 2, 1);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Alloy', 'Alloy Restaurant', 'http://www.google.com', 51.136160, -113.967040, point(51.136160, -113.967040), 2, 2);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Anju', 'Anju Restaurant', 'http://www.google.com', 51.047310, -114.057970, point(51.047310, -114.057970), 2, 2);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Blink', 'Blink Restaurant & Bar', 'http://www.google.com', 50.921570, -114.089260, point(50.921570, -114.089260), 2, 2);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Canyon', 'Canyon Meadows Cinemas', 'http://www.google.com', 50.931230, -114.068370, point(50.931230, -114.068370), 2, 3);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Joyland', 'Joyland Theatre', 'http://www.google.com', 51.047310, -114.057968 , point(51.047310, -114.057968), 2, 3);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'Scotiabank Chinook', 'Scotiabank Chinook', 'http://www.google.com', 51.051790, -114.317570, point(51.051790, -114.317570), 2, 3);
INSERT INTO markers
(id, title, description, image_url, longitude, latitude, location, owner_id, map_id)
VALUES
(DEFAULT, 'SilverCity', 'SilverCity Cross Iron Mills', 'http://www.google.com', 51.202076, -113.990765 , point(51.202076, -113.990765), 2, 3);
-- Favorites
INSERT INTO favorites
(id, user_id, map_id)
VALUES
(DEFAULT, 1, 1);
INSERT INTO favorites
(id, user_id, map_id)
VALUES
(DEFAULT, 2, 2);
INSERT INTO favorites
(id, user_id, map_id)
VALUES
(DEFAULT, 3, 3);
INSERT INTO favorites
(id, user_id, map_id)
VALUES
(DEFAULT, 1, 5);
INSERT INTO favorites
(id, user_id, map_id)
VALUES
(DEFAULT, 2, 6);
INSERT INTO favorites
(id, user_id, map_id)
VALUES
(DEFAULT, 4, 3);
INSERT INTO favorites
(id, user_id, map_id)
VALUES
(DEFAULT, 4, 6);
INSERT INTO favorites
(id, user_id, map_id)
VALUES
(DEFAULT, 1, 3);
-- Collaborations
INSERT INTO collaborations
(id, user_id, map_id)
VALUES
(DEFAULT, 1, 1);
INSERT INTO collaborations
(id, user_id, map_id)
VALUES
(DEFAULT, 2, 2);
INSERT INTO collaborations
(id, user_id, map_id)
VALUES
(DEFAULT, 3, 3);
INSERT INTO collaborations
(id, user_id, map_id)
VALUES
(DEFAULT, 4, 3);
INSERT INTO collaborations
(id, user_id, map_id)
VALUES
(DEFAULT, 4, 6);
INSERT INTO collaborations
(id, user_id, map_id)
VALUES
(DEFAULT, 1, 3);
INSERT INTO collaborations
(id, user_id, map_id)
VALUES
(DEFAULT, 2, 6);
INSERT INTO collaborations
(id, user_id, map_id)
VALUES
(DEFAULT, 1, 6);
| true
|
fcf3b3526190fc8a5c87af62f0846634afa68709
|
SQL
|
briandcase/OOPproject
|
/project command/1STUFF/1Insert Into Stuff Table.sql
|
UTF-8
| 1,606
| 2.546875
| 3
|
[] |
no_license
|
---ADD STUFF TO STUFF TABLE
INSERT INTO Staff (staff_id, S_FName, S_LName, S_sex, S_Dob, S_Address, S_Contact, S_Title, S_salary)
VALUES ('S100', 'Trinity', 'Yang', 'M', '1979-11-01', '8387 West Blackburn St.
Montclair, NJ 07042','(630) 446-8851','Recpetionist', 8769);
INSERT INTO Staff (staff_id, S_FName, S_LName, S_sex, S_Dob, S_Address, S_Contact, S_Title, S_salary)
VALUES ('S101', 'Dax', 'Chung', 'M', '1986-12-12', '298 Roehampton St.
Port Chester, NY 10573','(251) 546-9442','Nurse', 10623);
INSERT INTO Staff (staff_id, S_FName, S_LName, S_sex, S_Dob, S_Address, S_Contact, S_Title, S_salary)
VALUES ('S102', 'Dorian', 'Andersen', 'M', '1987-11-1', ' 8995 North Pennsylvania St.','(949) 569-4371','Doctor',21000);
INSERT INTO Staff (staff_id, S_FName, S_LName, S_sex, S_Dob, S_Address, S_Contact, S_Title, S_salary)
VALUES ('S103', 'Katelynn', 'Ross', 'F', '1988-09-07', ' 179 Poor House Avenue','(125) 546-4478','Nurse', 25000);
INSERT INTO Staff (staff_id, S_FName, S_LName, S_sex, S_Dob, S_Address, S_Contact, S_Title, S_salary)
VALUES ('S104', 'Riya', 'Duran', 'M', '1999-02-07', ' Myrtle Beach, SC 29577',' (630) 446-8851','Doctor', 11232);
INSERT INTO Staff (staff_id, S_FName, S_LName, S_sex, S_Dob, S_Address, S_Contact, S_Title, S_salary)
VALUES ('S105', 'Josephine', 'Mooney', 'F', '2000-01-11', ' Baldwinsville, NY 13027','(226) 906-2721','Manager', 12321);
INSERT INTO Staff (staff_id, S_FName, S_LName, S_sex, S_Dob, S_Address, S_Contact, S_Title, S_salary)
VALUES ('S106', 'Brock', 'Dodson', 'M', '2001-12-01', '8387 West Blackburn St.','(671) 925-1352','Nurse', 13654);
| true
|
a150b677e4779c69f1f3c1ecc3b1be9d6ee501e8
|
SQL
|
radtek/abs3
|
/sql/mmfo/bars/View/n00_don3.sql
|
UTF-8
| 2,499
| 2.84375
| 3
|
[] |
no_license
|
PROMPT =====================================================================================
PROMPT *** Run *** ========== Scripts /Sql/BARS/View/N00_DON3.sql =========*** Run *** =====
PROMPT =====================================================================================
PROMPT *** Create view N00_DON3 ***
CREATE OR REPLACE FORCE VIEW BARS.N00_DON3 ("IDCODE", "NAME", "NLS", "I_VA", "S240", "BALS", "VSH", "DOS", "KOS", "ISH", "CUR_DATE", "VSHQ", "DOSQ", "KOSQ", "ISHQ") AS
select okpo, nmk,NLS, kv, S240, nbs, ostV,dos, kos, ostI, DAT,
ostVq,dosq, kosq, ostIq
from (SELECT c.okpo, c.nmk, a.nls, a.kv, s.s240, a.nbs,
(b.ost +b.dos -b.kos )/100 ostV,
b.dos /100 dos , b.kos /100 kos , b.ost /100 ostI,
k.CALDT_DATE DAT ,
(b.ostq+b.dosq-b.kosq)/100 ostVq,
b.dosq/100 dosq, b.kosq/100 kosq, b.ostq/100 ostIq
FROM accounts a, customer c, specparam s, ACCM_SNAP_BALANCES b,
(select CALDT_ID, CALDT_DATE
from ACCM_CALENDAR
where CALDT_DATE >= NVL(TO_DATE(pul.get_mas_ini_val('sFdat1'),
'dd.mm.yyyy'), gl.bd-1 )
and CALDT_DATE <= NVL(TO_DATE(pul.get_mas_ini_val('sFdat2'),
'dd.mm.yyyy'), gl.bd-1 )
) k
WHERE (a.nbs='3901' OR a.nbs in ('3902','3903' ) and a.ob22='04')
and a.acc = b.acc
and a.rnk = c.rnk
and k.CALDT_ID = b.CALDT_ID
and (b.dosq<>0 or b.kosq<>0 or b.ostq<>0)
and a.acc = s.acc (+) ) ;
PROMPT *** Create grants N00_DON3 ***
grant SELECT on N00_DON3 to BARS014;
grant SELECT on N00_DON3 to BARSREADER_ROLE;
grant SELECT on N00_DON3 to BARS_ACCESS_DEFROLE;
grant SELECT on N00_DON3 to SALGL;
grant SELECT on N00_DON3 to UPLD;
PROMPT =====================================================================================
PROMPT *** End *** ========== Scripts /Sql/BARS/View/N00_DON3.sql =========*** End *** =====
PROMPT =====================================================================================
| true
|
304ce8fbd50de158da9cb22ce98f8f86316abfbb
|
SQL
|
pees17/oophp-v5
|
/sql/content/setup.sql
|
UTF-8
| 3,129
| 3.75
| 4
|
[
"MIT"
] |
permissive
|
--
-- Setup for the article:
-- https://dbwebb.se/kunskap/lagra-innehall-i-databas-for-webbsidor-och-bloggposter-v2
--
--
-- Create the database with a testuser
--
-- CREATE DATABASE IF NOT EXISTS oophp;
-- GRANT ALL ON oophp.* TO user@localhost IDENTIFIED BY "pass";
-- USE oophp;
-- Ensure UTF8 as chacrter encoding within connection.
SET NAMES utf8;
--
-- Create table for Content
--
DROP TABLE IF EXISTS `content`;
CREATE TABLE `content`
(
`id` INT AUTO_INCREMENT PRIMARY KEY NOT NULL,
`path` CHAR(120) UNIQUE,
`slug` CHAR(120) UNIQUE,
`title` VARCHAR(120),
`data` TEXT,
`type` CHAR(20),
`filter` VARCHAR(80) DEFAULT NULL,
-- MySQL version 5.6 and higher
`published` DATETIME DEFAULT CURRENT_TIMESTAMP,
`created` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated` DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
-- MySQL version 5.5 and lower
-- `published` DATETIME DEFAULT NULL,
-- `created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-- `updated` DATETIME DEFAULT NULL, -- ON UPDATE CURRENT_TIMESTAMP,
`deleted` DATETIME DEFAULT NULL
) ENGINE INNODB CHARACTER SET utf8 COLLATE utf8_swedish_ci;
INSERT INTO `content` (`path`, `slug`, `type`, `title`, `data`, `filter`) VALUES
("hem", null, "page", "Hem", "Detta är min hemsida. Den är skriven i [url=http://en.wikipedia.org/wiki/BBCode]bbcode[/url] vilket innebär att man kan formattera texten till [b]bold[/b] och [i]kursiv stil[/i] samt hantera länkar.\n\nDessutom finns ett filter 'nl2br' som lägger in <br>-element istället för \\n, det är smidigt, man kan skriva texten precis som man tänker sig att den skall visas, med radbrytningar.", "bbcode,nl2br"),
("om", null, "page", "Om", "Detta är en sida om mig och min webbplats. Den är skriven i [Markdown](http://en.wikipedia.org/wiki/Markdown). Markdown innebär att du får bra kontroll över innehållet i din sida, du kan formattera och sätta rubriker, men du behöver inte bry dig om HTML.\n\nRubrik nivå 2\n-------------\n\nDu skriver enkla styrtecken för att formattera texten som **fetstil** och *kursiv*. Det finns ett speciellt sätt att länka, skapa tabeller och så vidare.\n\n###Rubrik nivå 3\n\nNär man skriver i markdown så blir det läsbart även som textfil och det är lite av tanken med markdown.", "markdown"),
("blogpost-1", "valkommen-till-min-blogg", "post", "Välkommen till min blogg!", "Detta är en bloggpost.\n\nNär det finns länkar till andra webbplatser så kommer de länkarna att bli klickbara.\n\nhttp://dbwebb.se är ett exempel på en länk som blir klickbar.", "link,nl2br"),
("blogpost-2", "nu-har-sommaren-kommit", "post", "Nu har sommaren kommit", "Detta är en bloggpost som berättar att sommaren har kommit, ett budskap som kräver en bloggpost.", "nl2br"),
("blogpost-3", "nu-har-hosten-kommit", "post", "Nu har hösten kommit", "Detta är en bloggpost som berättar att hösten har kommit, ett budskap som kräver en bloggpost", "nl2br");
SELECT `id`, `path`, `slug`, `type`, `title`, `created` FROM `content`;
--
--
--
-- ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
| true
|
cb0c55dba8b07a523d9f51b4c54a8b244e69fa22
|
SQL
|
aajjbb/luarocks-site
|
/schema.sql
|
UTF-8
| 26,929
| 3
| 3
|
[] |
no_license
|
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
--
-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: api_keys; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE api_keys (
user_id integer NOT NULL,
key character varying(255) NOT NULL,
source character varying(255),
actions integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
comment text
);
ALTER TABLE api_keys OWNER TO postgres;
--
-- Name: approved_labels; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE approved_labels (
id integer NOT NULL,
name character varying(255) NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE approved_labels OWNER TO postgres;
--
-- Name: approved_labels_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE approved_labels_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE approved_labels_id_seq OWNER TO postgres;
--
-- Name: approved_labels_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE approved_labels_id_seq OWNED BY approved_labels.id;
--
-- Name: dependencies; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE dependencies (
version_id integer NOT NULL,
dependency_name character varying(255) NOT NULL,
dependency character varying(255) NOT NULL
);
ALTER TABLE dependencies OWNER TO postgres;
--
-- Name: downloads_daily; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE downloads_daily (
version_id integer NOT NULL,
date date NOT NULL,
count integer DEFAULT 0 NOT NULL
);
ALTER TABLE downloads_daily OWNER TO postgres;
--
-- Name: exception_requests; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE exception_requests (
id integer NOT NULL,
exception_type_id integer NOT NULL,
path text NOT NULL,
method character varying(255) NOT NULL,
referer text,
ip character varying(255) NOT NULL,
data text NOT NULL,
msg text NOT NULL,
trace text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE exception_requests OWNER TO postgres;
--
-- Name: exception_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE exception_requests_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE exception_requests_id_seq OWNER TO postgres;
--
-- Name: exception_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE exception_requests_id_seq OWNED BY exception_requests.id;
--
-- Name: exception_types; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE exception_types (
id integer NOT NULL,
label text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
count integer DEFAULT 0 NOT NULL
);
ALTER TABLE exception_types OWNER TO postgres;
--
-- Name: exception_types_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE exception_types_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE exception_types_id_seq OWNER TO postgres;
--
-- Name: exception_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE exception_types_id_seq OWNED BY exception_types.id;
--
-- Name: followings; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE followings (
source_user_id integer NOT NULL,
object_type smallint NOT NULL,
object_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE followings OWNER TO postgres;
--
-- Name: github_accounts; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE github_accounts (
user_id integer NOT NULL,
github_login text NOT NULL,
github_user_id integer DEFAULT 0 NOT NULL,
access_token text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE github_accounts OWNER TO postgres;
--
-- Name: lapis_migrations; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE lapis_migrations (
name character varying(255) NOT NULL
);
ALTER TABLE lapis_migrations OWNER TO postgres;
--
-- Name: linked_modules; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE linked_modules (
module_id integer NOT NULL,
user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE linked_modules OWNER TO postgres;
--
-- Name: manifest_admins; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE manifest_admins (
user_id integer NOT NULL,
manifest_id integer NOT NULL,
is_owner boolean NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE manifest_admins OWNER TO postgres;
--
-- Name: manifest_backups; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE manifest_backups (
id integer NOT NULL,
manifest_id integer NOT NULL,
development boolean DEFAULT false,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
last_backup timestamp without time zone,
repository_url text NOT NULL
);
ALTER TABLE manifest_backups OWNER TO postgres;
--
-- Name: manifest_backups_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE manifest_backups_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE manifest_backups_id_seq OWNER TO postgres;
--
-- Name: manifest_backups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE manifest_backups_id_seq OWNED BY manifest_backups.id;
--
-- Name: manifest_modules; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE manifest_modules (
manifest_id integer NOT NULL,
module_id integer NOT NULL,
module_name character varying(255) NOT NULL
);
ALTER TABLE manifest_modules OWNER TO postgres;
--
-- Name: manifests; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE manifests (
id integer NOT NULL,
name character varying(255) NOT NULL,
is_open boolean NOT NULL,
display_name character varying(255),
description text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
modules_count integer DEFAULT 0 NOT NULL,
versions_count integer DEFAULT 0 NOT NULL
);
ALTER TABLE manifests OWNER TO postgres;
--
-- Name: manifests_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE manifests_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE manifests_id_seq OWNER TO postgres;
--
-- Name: manifests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE manifests_id_seq OWNED BY manifests.id;
--
-- Name: modules; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE modules (
id integer NOT NULL,
user_id integer NOT NULL,
name character varying(255) NOT NULL,
downloads integer DEFAULT 0 NOT NULL,
current_version_id integer NOT NULL,
summary character varying(255),
description text,
license character varying(255),
homepage character varying(255),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
display_name character varying(255),
has_dev_version boolean DEFAULT false NOT NULL,
followers_count integer DEFAULT 0 NOT NULL,
labels text[]
);
ALTER TABLE modules OWNER TO postgres;
--
-- Name: modules_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE modules_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE modules_id_seq OWNER TO postgres;
--
-- Name: modules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE modules_id_seq OWNED BY modules.id;
--
-- Name: notification_objects; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE notification_objects (
notification_id integer NOT NULL,
object_type smallint NOT NULL,
object_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE notification_objects OWNER TO postgres;
--
-- Name: notifications; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE notifications (
id integer NOT NULL,
user_id integer NOT NULL,
type integer DEFAULT 0 NOT NULL,
object_type smallint NOT NULL,
object_id integer NOT NULL,
count integer DEFAULT 0 NOT NULL,
seen boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE notifications OWNER TO postgres;
--
-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE notifications_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE notifications_id_seq OWNER TO postgres;
--
-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE notifications_id_seq OWNED BY notifications.id;
--
-- Name: rocks; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE rocks (
id integer NOT NULL,
version_id integer NOT NULL,
arch character varying(255) NOT NULL,
downloads integer DEFAULT 0 NOT NULL,
rock_key character varying(255) NOT NULL,
rock_fname character varying(255) NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
revision integer DEFAULT 1 NOT NULL
);
ALTER TABLE rocks OWNER TO postgres;
--
-- Name: rocks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE rocks_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE rocks_id_seq OWNER TO postgres;
--
-- Name: rocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE rocks_id_seq OWNED BY rocks.id;
--
-- Name: user_data; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE user_data (
user_id integer NOT NULL,
email_verified boolean DEFAULT false NOT NULL,
password_reset_token character varying(255),
twitter text,
website text,
profile text,
github text
);
ALTER TABLE user_data OWNER TO postgres;
--
-- Name: users; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE users (
id integer NOT NULL,
username character varying(255) NOT NULL,
encrypted_password character varying(255) NOT NULL,
email character varying(255) NOT NULL,
slug character varying(255) NOT NULL,
flags integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
following_count integer DEFAULT 0 NOT NULL,
modules_count integer DEFAULT 0 NOT NULL,
last_active_at timestamp without time zone
);
ALTER TABLE users OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE users_id_seq OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE users_id_seq OWNED BY users.id;
--
-- Name: versions; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE versions (
id integer NOT NULL,
module_id integer NOT NULL,
version_name character varying(255) NOT NULL,
rockspec_key character varying(255) NOT NULL,
rockspec_fname character varying(255) NOT NULL,
downloads integer DEFAULT 0 NOT NULL,
rockspec_downloads integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
display_version_name character varying(255),
lua_version character varying(255),
development boolean DEFAULT false NOT NULL,
source_url text,
revision integer DEFAULT 1 NOT NULL,
external_rockspec_url text,
archived boolean DEFAULT false NOT NULL
);
ALTER TABLE versions OWNER TO postgres;
--
-- Name: versions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE versions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE versions_id_seq OWNER TO postgres;
--
-- Name: versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE versions_id_seq OWNED BY versions.id;
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY approved_labels ALTER COLUMN id SET DEFAULT nextval('approved_labels_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY exception_requests ALTER COLUMN id SET DEFAULT nextval('exception_requests_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY exception_types ALTER COLUMN id SET DEFAULT nextval('exception_types_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY manifest_backups ALTER COLUMN id SET DEFAULT nextval('manifest_backups_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY manifests ALTER COLUMN id SET DEFAULT nextval('manifests_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY modules ALTER COLUMN id SET DEFAULT nextval('modules_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY notifications ALTER COLUMN id SET DEFAULT nextval('notifications_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY rocks ALTER COLUMN id SET DEFAULT nextval('rocks_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY versions ALTER COLUMN id SET DEFAULT nextval('versions_id_seq'::regclass);
--
-- Name: api_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY api_keys
ADD CONSTRAINT api_keys_pkey PRIMARY KEY (key);
--
-- Name: approved_labels_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY approved_labels
ADD CONSTRAINT approved_labels_pkey PRIMARY KEY (id);
--
-- Name: dependencies_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY dependencies
ADD CONSTRAINT dependencies_pkey PRIMARY KEY (version_id, dependency_name);
--
-- Name: downloads_daily_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY downloads_daily
ADD CONSTRAINT downloads_daily_pkey PRIMARY KEY (version_id, date);
--
-- Name: exception_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY exception_requests
ADD CONSTRAINT exception_requests_pkey PRIMARY KEY (id);
--
-- Name: exception_types_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY exception_types
ADD CONSTRAINT exception_types_pkey PRIMARY KEY (id);
--
-- Name: followings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY followings
ADD CONSTRAINT followings_pkey PRIMARY KEY (source_user_id, object_type, object_id);
--
-- Name: github_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY github_accounts
ADD CONSTRAINT github_accounts_pkey PRIMARY KEY (user_id, github_user_id);
--
-- Name: lapis_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY lapis_migrations
ADD CONSTRAINT lapis_migrations_pkey PRIMARY KEY (name);
--
-- Name: linked_modules_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY linked_modules
ADD CONSTRAINT linked_modules_pkey PRIMARY KEY (module_id, user_id);
--
-- Name: manifest_admins_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY manifest_admins
ADD CONSTRAINT manifest_admins_pkey PRIMARY KEY (user_id, manifest_id);
--
-- Name: manifest_backups_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY manifest_backups
ADD CONSTRAINT manifest_backups_pkey PRIMARY KEY (id);
--
-- Name: manifest_modules_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY manifest_modules
ADD CONSTRAINT manifest_modules_pkey PRIMARY KEY (manifest_id, module_id);
--
-- Name: manifests_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY manifests
ADD CONSTRAINT manifests_pkey PRIMARY KEY (id);
--
-- Name: modules_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY modules
ADD CONSTRAINT modules_pkey PRIMARY KEY (id);
--
-- Name: notification_objects_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY notification_objects
ADD CONSTRAINT notification_objects_pkey PRIMARY KEY (notification_id, object_type, object_id);
--
-- Name: notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY notifications
ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
--
-- Name: rocks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY rocks
ADD CONSTRAINT rocks_pkey PRIMARY KEY (id);
--
-- Name: user_data_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY user_data
ADD CONSTRAINT user_data_pkey PRIMARY KEY (user_id);
--
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: versions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY versions
ADD CONSTRAINT versions_pkey PRIMARY KEY (id);
--
-- Name: api_keys_user_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX api_keys_user_id_idx ON api_keys USING btree (user_id);
--
-- Name: approved_labels_name_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX approved_labels_name_idx ON approved_labels USING btree (name);
--
-- Name: dependencies_dependency_name_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX dependencies_dependency_name_idx ON dependencies USING btree (dependency_name);
--
-- Name: exception_requests_exception_type_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX exception_requests_exception_type_id_idx ON exception_requests USING btree (exception_type_id);
--
-- Name: exception_types_label_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX exception_types_label_idx ON exception_types USING btree (label);
--
-- Name: followings_object_type_object_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX followings_object_type_object_id_idx ON followings USING btree (object_type, object_id);
--
-- Name: manifest_modules_manifest_id_module_name_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX manifest_modules_manifest_id_module_name_idx ON manifest_modules USING btree (manifest_id, module_name);
--
-- Name: manifest_modules_module_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX manifest_modules_module_id_idx ON manifest_modules USING btree (module_id);
--
-- Name: manifests_name_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX manifests_name_idx ON manifests USING btree (name);
--
-- Name: module_search_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX module_search_idx ON modules USING gin (to_tsvector('english'::regconfig, (((((COALESCE(display_name, name))::text || ' '::text) || (COALESCE(summary, ''::character varying))::text) || ' '::text) || COALESCE(description, ''::text))));
--
-- Name: modules_downloads_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX modules_downloads_idx ON modules USING btree (downloads);
--
-- Name: modules_labels_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX modules_labels_idx ON modules USING gin (labels) WHERE (modules.* IS NOT NULL);
--
-- Name: modules_name_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX modules_name_idx ON modules USING btree (name);
--
-- Name: modules_name_search_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX modules_name_search_idx ON modules USING gin ((COALESCE(display_name, name)) gin_trgm_ops);
--
-- Name: modules_user_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX modules_user_id_idx ON modules USING btree (user_id);
--
-- Name: modules_user_id_name_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX modules_user_id_name_idx ON modules USING btree (user_id, name);
--
-- Name: notifications_user_id_seen_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX notifications_user_id_seen_id_idx ON notifications USING btree (user_id, seen, id);
--
-- Name: notifications_user_id_type_object_type_object_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX notifications_user_id_type_object_type_object_id_idx ON notifications USING btree (user_id, type, object_type, object_id) WHERE (NOT seen);
--
-- Name: rocks_rock_fname_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX rocks_rock_fname_idx ON rocks USING btree (rock_fname);
--
-- Name: rocks_rock_key_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX rocks_rock_key_idx ON rocks USING btree (rock_key);
--
-- Name: rocks_version_id_arch_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX rocks_version_id_arch_idx ON rocks USING btree (version_id, arch);
--
-- Name: users_flags_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX users_flags_idx ON users USING btree (flags);
--
-- Name: users_lower_email_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX users_lower_email_idx ON users USING btree (lower((email)::text));
--
-- Name: users_lower_username_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX users_lower_username_idx ON users USING btree (lower((username)::text));
--
-- Name: users_slug_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX users_slug_idx ON users USING btree (slug);
--
-- Name: users_username_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX users_username_idx ON users USING gin (username gin_trgm_ops);
--
-- Name: versions_downloads_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX versions_downloads_idx ON versions USING btree (downloads);
--
-- Name: versions_module_id_version_name_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX versions_module_id_version_name_idx ON versions USING btree (module_id, version_name);
--
-- Name: versions_rockspec_fname_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX versions_rockspec_fname_idx ON versions USING btree (rockspec_fname);
--
-- Name: versions_rockspec_key_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE UNIQUE INDEX versions_rockspec_key_idx ON versions USING btree (rockspec_key);
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
--
-- Data for Name: lapis_migrations; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY lapis_migrations (name) FROM stdin;
1370275336
1370277180
1393557726
1401338238
1401600469
1401727722
1401810343
1408086639
1413268904
1423334387
1427445542
1427448938
1427443263
1427444511
1437970205
1438259102
1438314813
1438999272
1439449229
1439949273
1443373251
1443382411
1453406400
1462567085
1475034338
1475269875
1476481149
\.
--
-- PostgreSQL database dump complete
--
| true
|
11c10b6e52725df420f3391bc8b3ce0251f46f26
|
SQL
|
avacabillan/SQL-DATA-SOURCE
|
/GROUPBY.sql
|
UTF-8
| 91
| 2.671875
| 3
|
[] |
no_license
|
SELECT SUM(list_price), product_id FROM products WHERE model_year =2018 GROUP BY brand_id;
| true
|
9272f39136447b08673cb110b0138af7e342e2b2
|
SQL
|
chuyeow/pubstorm-server
|
/apiserver/migrations/0002_create_oauth_clients.up.sql
|
UTF-8
| 931
| 3.234375
| 3
|
[] |
no_license
|
CREATE TABLE oauth_clients (
id bigserial PRIMARY KEY NOT NULL,
client_id character varying(255) DEFAULT encode(gen_random_bytes(16), 'hex') NOT NULL,
client_secret character varying(255) DEFAULT encode(gen_random_bytes(64), 'hex') NOT NULL,
email character varying(255) DEFAULT '' NOT NULL,
name character varying(255) DEFAULT '' NOT NULL,
organization character varying(255) DEFAULT '' NOT NULL,
created_at timestamp without time zone DEFAULT now() NOT NULL,
updated_at timestamp without time zone DEFAULT now() NOT NULL,
deleted_at timestamp without time zone
);
CREATE UNIQUE INDEX index_oauth_clients_on_client_id ON oauth_clients USING btree (client_id);
INSERT INTO oauth_clients (
email,
name,
organization
) VALUES (
'admin@nitrous.io',
'PubStorm CLI',
'Nitrous, Inc.'
);
INSERT INTO oauth_clients (
email,
name,
organization
) VALUES (
'admin@nitrous.io',
'PubStorm Web',
'Nitrous, Inc.'
);
| true
|
f39f52ef396390599cf8d1451cdab9cc77e7e794
|
SQL
|
alan-turing-institute/DSSG19-DNCP-PUBLIC
|
/sql/descriptive_statistics/mariaaran_EDA_complaints_amendments.sql
|
UTF-8
| 12,406
| 4.25
| 4
|
[
"MIT"
] |
permissive
|
--------------------- Descriptive statistics on Complaints and Amendments -----------------------
-- In this query you can find tables that summarise data about:
-- 1. Amendments 1: Adendas related to tender process
-- 2. Complaints
-- 3. Amendments 2: Adendas related to complaints
-- 4. Sumarizing reviewing process, PBC (tender documents), Amendments 1 and amendments 2 at tender level
------------------1. Amendments 1: Adendas related to tender process
------1.1. Reviewing
-- How many reviewing processes stages do they have?
select
final_state,
count(*)
from
raw.tender_record
group by 1;
-- Quanty of tenders vs Quantity of tenders that were reviewed
select
count(distinct tenders.id_llamado) quantity_tenders,
count(distinct review.llamado_id) quantity_tenders_reviewed
from
raw.proceso tenders
left join
raw.tender_record review
on tenders.id_llamado = review.llamado_id;
-- Are the tenders that were not reviewed still open? Why aren't they reviewed?
-- No! There are 25K tenders that were not reviewed but they are awarded.
select
tenders.etapa_licitacion,
count(*)
from
raw.proceso tenders
left join
raw.tender_record review
on tenders.id_llamado = review.llamado_id
where review.llamado_id is null
group by 1
order by 2 desc;
------- 1.2 About documents table (pbc_adenda)
-- How many tipo documento we have?
select
amendments.tipo_documento,
count(distinct tenders.id_llamado)
from raw.proceso tenders
inner join raw.pbc_adenda amendments
on tenders.id_llamado = amendments.id_llamado
group by 1;
-- Are there adendas that are before tender publication date?
-- Tested with fecha_archivo and fecha_publicacion. Same result: Most of the adendas come after tender publication date.
select
sum(case when (tenders.fecha_publicacion_convocatoria > amendments.fecha_archivo and amendments.tipo_documento = 'Adenda') then 1 else 0 end) Q_Adendas_before_publication_date,
sum(case when (tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.tipo_documento = 'Adenda') then 1 else 0 end) Q_Adendas_after_publication_date,
sum(case when (tenders.fecha_publicacion_convocatoria > amendments.fecha_publicacion and amendments.tipo_documento = 'Adenda') then 1 else 0 end) Q_Adendas_before_pubdate_publication_date,
sum(case when (tenders.fecha_publicacion_convocatoria < amendments.fecha_publicacion and amendments.tipo_documento = 'Adenda') then 1 else 0 end) Q_Adendas_after_pubdate_publication_date
from raw.proceso tenders
inner join raw.pbc_adenda amendments
on tenders.id_llamado = amendments.id_llamado;
-- Are there PBC that are after tender publication date?
-- Most of the PBC(Tender documents) are before tender publication date
select
sum(case when (tenders.fecha_publicacion_convocatoria > amendments.fecha_archivo and amendments.tipo_documento = 'Pliego de bases y Condiciones') then 1 else 0 end) Q_PBC_before_publication_date,
sum(case when (tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.tipo_documento = 'Pliego de bases y Condiciones') then 1 else 0 end) Q_PBC_after_publication_date
from raw.proceso tenders
inner join raw.pbc_adenda amendments
on tenders.id_llamado = amendments.id_llamado;
-- How many adendas you have in each part of process? Before and after tender publication date // Before and after complaints
-- You have both: Adenda before complaints and after complaints.
select
sum(case when (tenders.fecha_publicacion_convocatoria > amendments.fecha_archivo and amendments.tipo_documento = 'Adenda') then 1 else 0 end) Q_Adendas_before_publication_date,
sum(case when (tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.tipo_documento = 'Adenda') then 1 else 0 end) Q_Adendas_after_publication_date,
sum(case when (tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.tipo_documento = 'Adenda' and amendments.fecha_archivo < complaints.fecha_resolucion_proceso) then 1 else 0 end) Q_Adendas_after_publication_date_before_complaint,
sum(case when (tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.tipo_documento = 'Adenda' and amendments.fecha_archivo > complaints.fecha_resolucion_proceso) then 1 else 0 end) Q_Adendas_after_publication_date_after_complaint,
sum(case when (tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.tipo_documento = 'Adenda' and complaints.fecha_resolucion_proceso is null) then 1 else 0 end) Q_Adendas_after_publication_no_complaints
from raw.proceso tenders
inner join raw.pbc_adenda amendments
on tenders.id_llamado = amendments.id_llamado
left join raw.proceso_juridico complaints
on tenders.id_llamado = complaints.id_llamado;
------------------ 2. Complaints
-- Sanity Check: Nulls
select * from raw.proceso_juridico limit 10;
select count(*) from raw.proceso_juridico;
select count(*) from raw.proceso_juridico where id_llamado is null;
select count(*) from raw.proceso_juridico where convocatoria_slug is null;
select count(*) from raw.proceso_juridico where juez_instructor is null;
select count(*) from raw.proceso_juridico where fecha_resolucion_proceso is null;
select count(*) from raw.proceso_juridico where resultado is null;
-- Sanity Check: If all complaints could match to tender IDs: Ok! But More than 1 complain for 1 tender
select
count(*)
from
raw.proceso_juridico complaints
inner join
raw.proceso tenders
on complaints.id_llamado = tenders.id_llamado;
select
count (distinct id_llamado )
from
raw.proceso_juridico; -- More than 1 complain for the same tender.
-- Sanity check: Example of tenders with many complaints
select
id_llamado,
resultado
from
raw.proceso_juridico
group by id_llamado, resultado
having count(id_llamado) > 1
order by id_llamado;
-- Complaints results and result detail
select
_tipo_resultado,
count(distinct resultado) quantity_distinct_categories,
count(*) quantity_cases
from
raw.proceso_juridico
group by _tipo_resultado;
select
_tipo_resultado,
resultado,
count(*) quantity
from
raw.proceso_juridico
group by _tipo_resultado, resultado
order by _tipo_resultado, quantity desc;
-- Complaints in time
select
extract(year from fecha_resolucion_proceso) * 100 + extract (month from fecha_resolucion_proceso) yearmonth,
sum(case when _tipo_resultado = 'a_favor' then 1 else 0 end) favorable,
sum(case when _tipo_resultado = 'en_contra' then 1 else 0 end) not_favorable,
sum(case when _tipo_resultado is null then 1 else 0 end) result_null,
count(*) total_complaints
from
raw.proceso_juridico
group by 1
order by 1 desc;
-- Distribution of judges (11) by effective complaints vs not effective (17)
with judges_data as(
select
juez_instructor,
sum(case when _tipo_resultado = 'a_favor' then 1 else 0 end) favorable,
sum(case when _tipo_resultado = 'en_contra' then 1 else 0 end) not_favorable,
sum(case when _tipo_resultado is null then 1 else 0 end) result_null,
count(*) total_complaints,
count (distinct denunciante) distinct_complainant
from
raw.proceso_juridico
group by
juez_instructor)
select
judges_data.total_complaints,
judges_data.distinct_complainant,
round( judges_data.favorable * 1.00 / judges_data.total_complaints * 1.00 ,2) ratio_favorable,
round(judges_data.not_favorable * 1.00 / judges_data.total_complaints * 1.00,2) ratio_notfavorable,
round(judges_data.result_null * 1.00 / judges_data.total_complaints * 1.00,2) ratio_null
from
judges_data
order by total_complaints desc;
-- Are there companies that repeatedly makes complaints? (10)
with complainants as (
select
denunciante,
sum(case when _tipo_resultado = 'a_favor' then 1 else 0 end) favorable,
sum(case when _tipo_resultado = 'en_contra' then 1 else 0 end) not_favorable,
sum(case when _tipo_resultado is null then 1 else 0 end) result_null,
count(id_llamado) total_complaints,
count(distinct id_llamado) total_distinct_tenders_complaints
from
raw.proceso_juridico
group by
denunciante
order by
total_complaints desc)
select
complainants.*,
round(complainants.favorable * 1.00 / complainants.total_complaints * 1.00 ,2) ratio_favorable,
round(complainants.not_favorable * 1.00 / complainants.total_complaints * 1.00,2) ratio_notfavorable,
round(complainants.result_null * 1.00 / complainants.total_complaints * 1.00,2) ratio_null
from
complainants
order by total_complaints desc;
------------------ 3. Amendments 2: Adendas after complaints
-- How many adendas effective complaints have?
with complaints_amendments as(
select
complaints.id_llamado,
count(amendments.id) quantity_amendments
from
raw.proceso_juridico complaints
left join
raw.pbc_adenda amendments
on complaints.id_llamado = amendments.id_llamado
and amendments.fecha_archivo > complaints.fecha_resolucion_proceso
where _tipo_resultado = 'a_favor'
group by 1)
select
count(*) total_complaints,
sum(case when quantity_amendments > 1 then 1 else 0 end) complaints_with_more_than_1_amendment,
sum(case when quantity_amendments = 0 then 1 else 0 end) complaints_with_no_amendments,
avg(quantity_amendments) avg_amendments_per_complaint
from complaints_amendments;
-------------- 4. Sumarizing reviewing process, PBC (tender documents), Amendments 1 and amendments 2 at tender level
-- Adding data about complaints, reviewing process and amendments 1 (related to tender) and amendments 2 (related to complaints)
with proceso_juridico_flatten as (
select
id_llamado,
count(distinct _tipo_resultado) q_distinct_complaints_results,
sum(case when _tipo_resultado = 'a_favor' then 1 else 0 end) q_effective_complaints,
sum(case when _tipo_resultado = 'en_contra' then 1 else 0 end) q_noneffective_complaints,
min(fecha_resolucion_proceso) min_fecha_resolucion_proceso,
max(fecha_resolucion_proceso) max_fecha_resolucion_proceso
from
raw.proceso_juridico
group by
id_llamado)
, data_to_plot as (
select
tenders.id_llamado,
tenders.monto_total_adjudicado,
tenders.tipo_procedimiento,
max(review.audit_date)::date - min(review.reception_date)::date Reviewing_time_in_days,
count(distinct review.id) Reviewing_quantity,
sum(case when (amendments.tipo_documento = 'Pliego de bases y Condiciones' and tenders.fecha_publicacion_convocatoria > amendments.fecha_archivo) then 1 else 0 end) Q_PBC_before_publication_date,
sum(case when (amendments.tipo_documento = 'Adenda' and tenders.fecha_publicacion_convocatoria > amendments.fecha_archivo) then 1 else 0 end) Q_Adendas_before_publication_date,
tenders.fecha_publicacion_convocatoria,
sum(case when (amendments.tipo_documento = 'Pliego de bases y Condiciones' and tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.fecha_archivo < complaints.min_fecha_resolucion_proceso) then 1 else 0 end) Q_PBC_after_publication_date,
sum(case when (amendments.tipo_documento = 'Adenda' and tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.fecha_archivo < complaints.min_fecha_resolucion_proceso) then 1 else 0 end) Q_Adendas_after_publication_date_before_complaint,
complaints.min_fecha_resolucion_proceso,
coalesce(complaints.q_distinct_complaints_results,0) q_distinct_complaints_results,
complaints.q_effective_complaints,
complaints.q_noneffective_complaints,
sum(case when (amendments.tipo_documento = 'Pliego de bases y Condiciones' and tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.fecha_archivo > complaints.min_fecha_resolucion_proceso) then 1 else 0 end) Q_PBC_after_publication_date_after_complaint,
sum(case when (amendments.tipo_documento = 'Adenda' and tenders.fecha_publicacion_convocatoria < amendments.fecha_archivo and amendments.fecha_archivo > complaints.min_fecha_resolucion_proceso) then 1 else 0 end) Q_Adendas_after_publication_date_after_complaint
from
raw.proceso tenders
left join
raw.tender_record review
on tenders.id_llamado = review.llamado_id
left join
raw.pbc_adenda amendments
on tenders.id_llamado = amendments.id_llamado
left join
proceso_juridico_flatten complaints
on tenders.id_llamado = complaints.id_llamado
group by
tenders.id_llamado,
tenders.monto_total_adjudicado,
tenders.tipo_procedimiento,
tenders.fecha_publicacion_convocatoria,
complaints.min_fecha_resolucion_proceso,
complaints.q_distinct_complaints_results,
complaints.q_effective_complaints,
complaints.q_noneffective_complaints)
select * from data_to_plot;
| true
|
66cbeeea8ab6a35872ffca5eebc2cde0121c5513
|
SQL
|
mihirjpatel/SQLScripts
|
/MSSQL - Useful Scripts/Table - Row Count.sql
|
UTF-8
| 408
| 3.875
| 4
|
[] |
no_license
|
/******************************
Table Row Count
*******************************/
SELECT sc.name +'.'+ ta.name TableName
,SUM(pa.rows) RowCnt
FROM sys.tables ta
INNER JOIN sys.partitions pa
ON pa.OBJECT_ID = ta.OBJECT_ID
INNER JOIN sys.schemas sc
ON ta.schema_id = sc.schema_id
WHERE ta.is_ms_shipped = 0 AND pa.index_id IN (1,0)
GROUP BY sc.name,ta.name
ORDER BY SUM(pa.rows) DESC
| true
|
f8c20f9d955f105d9ab8eb6c80fda6cf6f14d1ca
|
SQL
|
134130U/Agent_tracking
|
/premier_pricing_group.sql
|
UTF-8
| 168
| 3.59375
| 4
|
[] |
no_license
|
select *
from account_pricing_groups a
where a.created_at in(select min(created_at) from account_pricing_groups group by account_slug)
order by created_at asc
limit 100
| true
|
9a496c2f43d6b2144ddf18d86e96394c374727f3
|
SQL
|
infoshareacademy/jdsz1-raczki
|
/projekt/Predykcja.sql
|
UTF-8
| 1,947
| 4.3125
| 4
|
[] |
no_license
|
with daty as (select
generate_series(
date_trunc('month', now()-interval '2 month'),
date_trunc('month', now())+interval '1 month'-interval '1 day',
'1 day')::date as wygenerowana_data
),
leady as (
select to_char(data_wysylki, 'YYYY-MM-DD')::date data_leada, count(1) liczba_leadow
from m_lead
group by 1
),
emaile as (
select to_char(data_wysylki, 'YYYY-MM-DD')::date data_emaila, count(1) liczba_emaili
from m_email
left join m_lead m2 ON m_email.lead_id = m2.id
group by 1
),
statystyki_lead as (
select to_char(data_leada, 'Day') dzien, round(avg(liczba_leadow)) przew_liczba_leadow
from leady
where data_leada <= '2018-02-17'
group by 1
order by 1
),
statystyki_emaile as (
select to_char(data_emaila, 'Day') dzien, round(avg(liczba_emaili)) przew_liczba_emaili
from emaile
where data_emaila <= '2018-02-17'
group by 1
order by 1
)
select d.wygenerowana_data, coalesce(l.liczba_leadow, 0) as liczba_leadow, coalesce(e.liczba_emaili, 0) as liczba_emaili,
case
when wygenerowana_data <= '2018-02-17' then l.liczba_leadow
else sl.przew_liczba_leadow end finalna_liczba_leadow,
case
when wygenerowana_data <= '2018-02-17' then e.liczba_emaili
else se.przew_liczba_emaili end finalna_liczba_emaili,
sum(case
when wygenerowana_data <= '2018-02-17' then l.liczba_leadow
else sl.przew_liczba_leadow end) over(order by wygenerowana_data) leady_skumulowane,
sum(case
when wygenerowana_data <= '2018-02-17' then e.liczba_emaili
else se.przew_liczba_emaili end) over(order by wygenerowana_data) emaile_skumulowane
from daty d
left join leady l on d.wygenerowana_data = l.data_leada
left join emaile e on d.wygenerowana_data = e.data_emaila
left join statystyki_lead sl on sl.dzien = to_char(d.wygenerowana_data, 'Day')
left join statystyki_emaile se on se.dzien = to_char(d.wygenerowana_data, 'Day')
| true
|
0da39784ae96d786de788123e3698c6fb151b50e
|
SQL
|
eversonsba/trabalhoFinalJava
|
/trabalho_final/banco borracharia.sql
|
UTF-8
| 1,318
| 3.78125
| 4
|
[] |
no_license
|
DROP DATABASE IF EXISTS borracharia;
CREATE DATABASE IF NOT EXISTS borracharia;
USE borracharia;
CREATE TABLE IF NOT EXISTS clientes(
cnpj VARCHAR(14),
nome varchar(255) NOT NULL,
PRIMARY KEY(cnpj)
);
CREATE TABLE IF NOT EXISTS funcionario_cliente(
id INT AUTO_INCREMENT,
nome VARCHAR(255),
cnpj_cliente VARCHAR(255),
PRIMARY KEY(id),
FOREIGN KEY(cnpj_cliente)
REFERENCES clientes(cnpj)
);
CREATE TABLE IF NOT EXISTS complementos(
id INT AUTO_INCREMENT,
descricao TEXT,
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS servico(
id INT AUTO_INCREMENT,
descricao TEXT,
valor FLOAT,
data DATE,
cnpj_cliente VARCHAR(14) NOT NULL,
id_complemento INT,
id_funcionario_cliente INT,
PRIMARY KEY (id),
FOREIGN KEY(cnpj_cliente)
REFERENCES clientes(cnpj),
FOREIGN KEY(id_complemento)
REFERENCES complementos(id),
FOREIGN KEY(id_funcionario_cliente)
REFERENCES funcionario_cliente(id)
);
CREATE TABLE IF NOT EXISTS telefones(
id INT AUTO_INCREMENT NOT NULL,
numero VARCHAR(11) NOT NULL,
cnpj_cliente VARCHAR(14),
FOREIGN KEY(cnpj_cliente)
REFERENCES clientes(cnpj),
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS enderecos(
id INT AUTO_INCREMENT,
numero INT,
rua VARCHAR(255) NOT NULL,
cidade VARCHAR(255) NOT NULL,
cnpj_cliente VARCHAR(14),
FOREIGN KEY(cnpj_cliente)
REFERENCES clientes(cnpj),
PRIMARY KEY (id)
);
| true
|
9a59ce5cbe41ed43a914306c4168f7e44009fa5d
|
SQL
|
teng-liu/myDocuments
|
/db/j_db.sql
|
UTF-8
| 73,334
| 2.84375
| 3
|
[] |
no_license
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE public.process
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT process_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.contract
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT contract_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.contractGroup
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT contractGroup_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.rel_contract_Group
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
group_uuid uuid,
contract_uuid uuid,
option jsonb,
CONSTRAINT contractMappingGroup_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.contract_template
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT contract_template_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.codetable
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT codetable_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.definition
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT definition_pkey PRIMARY KEY (uuid)
);
----role-event----
CREATE TABLE public.role
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT role_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.user
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT user_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.action
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT action_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.event
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT event_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.m_role_action
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT role_action_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.rel_role_action
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT role_rel_action_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.process_action
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT process_action_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.process_state
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT process_state_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.vendor
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
content jsonb,
CONSTRAINT vendor_pkey PRIMARY KEY (uuid)
);
-- store transitions for generating fsm
CREATE TABLE public.t_transitions
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
action_name text,
from_state text,
to_state text,
method text,
option text,
CONSTRAINT t_transitions_pkey PRIMARY KEY (uuid)
);
-- workflow actions -> non-json
CREATE TABLE public.workflow_action
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
display text,
from_state text,
to_state text,
ui_actions text,
category text,
description text,
message text,
options jsonb,
CONSTRAINT workflow_action_pkey PRIMARY KEY (uuid)
);
CREATE TABLE public.workflow
(
uuid uuid NOT NULL DEFAULT uuid_generate_v4(),
name_key text unique,
display text,
current_state text,
template_uuid uuid,
contract_uuid uuid,
description text,
options jsonb,
CONSTRAINT workflow_pkey PRIMARY KEY (uuid)
);
insert into public.workflow (name_key, display, current_state)
values
('workflow001', 'deltaware-ct.009', 'PendingL1Approval'),
('workflow002', 'iWave-ct.8374', 'New');
insert into public.vendor (name_key, content)
values
('iwave-pei', '{
"head": {
"code": "iwave-pei",
"display": "iWave",
"registered-code": "VEN72398348",
"address": "134 Kent St, Charlottetown",
"postal-code": "PE C1A"
}
}'),
('deltaware-pei', '{
"head": {
"code": "iwave-pei",
"display": "The DeltaWare Division of MAXIMUS",
"registered-code": "VEN95874000",
"address": "176 Great George St, Charlottetown",
"postal-code": "PE C1A 4K9"
}
}'),
('upei', '{
"head": {
"code": "upei",
"display": "University of PEI",
"registered-code": "EDU737322",
"address": "550 University Ave, Charlottetown",
"postal-code": "PE C1A 4P3"
}
}');
-- store all process states, dictionary-table
insert into public.process_state (name_key, content)
values
('ContractCorrectedL100Issue', '{}'),
('ContractCorrectedL1Issue', '{}'),
('ContractCorrectedL2Issue', '{}'),
('ContractCorrectedL3Issue', '{}'),
('ContractCorrectedL4Issue', '{}'),
('ContractCorrectedL4IssueWithApproval', '{}'),
('ContractCorrectedL5Issue', '{}'),
('ContractCorrectedL5IssueWithApproval', '{}'),
('ContractPendingCorrection', '{}'),
('ContractPendingCorrectionL100Issue', '{}'),
('ContractPendingCorrectionL2Issue', '{}'),
('ContractPendingCorrectionL3Issue', '{}'),
('ContractPendingCorrectionL4Issue', '{}'),
('ContractPendingCorrectionL4IssueWithApproval', '{}'),
('ContractPendingCorrectionL5Issue', '{}'),
('ContractPendingCorrectionL5IssueWithApproval', '{}'),
('ContractPrepared', '{}'),
('ContractPreparing', '{}'),
('Finalized', '{}'),
('Finalizing', '{}'),
('Finished', '{}'),
('Level1Approved', '{}'),
('Level1Declined', '{}'),
('Level2Approved', '{}'),
('Level2Declined', '{}'),
('Level3Approved', '{}'),
('Level3Declined', '{}'),
('Level4Approved', '{}'),
('Level4Declined', '{}'),
('Level5Approved', '{}'),
('Level5Declined', '{}'),
('PartASigned', '{}'),
('PartBDeclined', '{}'),
('PartBSigned', '{}'),
('PendingL1Approval', '{}'),
('PendingL2Approval', '{}'),
('PendingL3Approval', '{}'),
('PendingL4Approval', '{}'),
('PendingL5Approval', '{}'),
('PendingPartASign', '{}'),
('PendingPartBSign', '{}'),
('PendingTemplateCorrectionFromPartA', '{}'),
('PendingTemplateCorrectionFromPartB', '{}'),
('PreparingPartASign', '{}'),
('PreparingPartBSign', '{}'),
('Start', '{}'),
('TemplateCorrectedForPartA', '{}'),
('TemplateCorrectedForPartB', '{}'),
('TemplateFixed', '{}'),
('TemplatePartAApproved', '{}'),
('TemplatePartADeclined', '{}'),
('TemplatePartBApproved', '{}'),
('TemplatePartBDeclined', '{}'),
('TemplatePendingAcceptanceByVendor', '{}'),
('TemplatePendingApprovalBySupervisor', '{}'),
('TemplatePrepared', '{}'),
('TemplatePreparing', '{}');
----new actions -> workflow action, no next auto action
insert into public.workflow_action (name_key, display, from_state, to_state, ui_actions, category, message)
values
('start', 'Start', 'New', 'TemplatePreparing', 'workflow.start', 'Process.Workflow', 'Workflow started'),
('templatePrepare', 'Prepare Template', 'TemplatePreparing', 'TemplatePendingApprovalBySupervisor', 'template.cru', 'Process.Template.Prepare', 'Template was Prepared'),
('templatePartAApprove', 'Approve Template as Part A', 'TemplatePendingApprovalBySupervisor', 'TemplatePendingAcceptanceByVendor', 'template.approve', 'Process.Template.Prepare', 'Template has been Approved by PartA'),
('templatePartADecline', 'Decline Template as Part A', 'TemplatePendingApprovalBySupervisor', 'PendingTemplateCorrectionFromPartA', 'template.decline', 'Process.Template.Prepare', 'Template has been Declined by PartA, modification required'),
('templatePartBApprove', 'Approve Template as Part B', 'TemplatePendingAcceptanceByVendor', 'ContractPreparing', 'template.approve', 'Process.Template.Prepare', 'Template has been Approved by PartB and Template is Fixed'),
('templatePartBDecline', 'Decline Template as Part B', 'TemplatePendingAcceptanceByVendor', 'PendingTemplateCorrectionFromPartB', 'template.decline', 'Process.Template.Prepare', 'Template has been Declined by PartB, modification required'),
('templateCorrectionForPartA', 'Template Correction for Part A', 'PendingTemplateCorrectionFromPartA', 'TemplatePendingApprovalBySupervisor', 'template.ru', 'Process.Template.Prepare', 'Template issue was Corrected based on PartA requirement'),
('templateCorrectionForPartB', 'Template Correction for Part B', 'PendingTemplateCorrectionFromPartB', 'TemplatePendingAcceptanceByVendor', 'template.ru', 'Process.Template.Prepare', 'Template issue was Corrected based on PartB requirement'),
('contractPrepare', 'Prepare Contract', 'ContractPreparing', 'PendingL1Approval', 'contract.cru', 'Process.Contract.Prepare', 'Contract has been Prepared'),
('level1Approve', 'Approve as Level 1 staff', 'PendingL1Approval', 'PendingL2Approval', 'contract.approve', 'Process.Contract.Approval', 'Contract Level1 Approved'),
('level1Decline', 'Decline as Level 1 staff', 'PendingL1Approval', 'ContractPendingCorrectionL1Issue', 'contract.decline', 'Process.Contract.Approval', 'Contract Level1 Declined, modification required'),
('contractCorrectionL1', 'Contract Correction L1', 'ContractPendingCorrectionL1Issue', 'PendingL1Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level1 staff has been corrected'),
('level2Approve', 'Approve as Level 2 staff', 'PendingL2Approval', 'PendingL3Approval', 'contract.approve', 'Process.Contract.Approval', 'Contract Level2 Approved'),
('level2Decline', 'Decline as Level 2 staff', 'PendingL2Approval', 'ContractPendingCorrectionL2Issue', 'contract.decline', 'Process.Contract.Approval', 'Contract Level2 Declined, modification required'),
('contractCorrectionL2', 'Contract Correction L2', 'ContractPendingCorrectionL2Issue', 'PendingL1Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level2 staff has been corrected'),
('level3Approve', 'Approve as Level 3 staff', 'PendingL3Approval', 'PendingL4Approval', 'contract.approve', 'Process.Contract.Approval', 'Contract Level3 Approved'),
('level3Decline', 'Decline as Level 3 staff', 'PendingL3Approval', 'ContractPendingCorrectionL3Issue', 'contract.decline', 'Process.Contract.Approval', 'Contract Level3 Declined, modification required'),
('contractCorrectionL3', 'Contract Correction L3', 'ContractPendingCorrectionL3Issue', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level3 staff has been corrected'),
('level4Approve', 'Approve as Level 4 staff', 'PendingL4Approval', 'PendingL5Approval', 'contract.approve', 'Process.Contract.Approval', 'Contract Level4 Approved'),
('level4ApproveWithCondition', 'Conditional Approve as Level 4 staff', 'PendingL4Approval', 'ContractPendingCorrectionL4IssueWithApproval', 'contract.conditonalApprove', 'Process.Contract.Approval', 'Contract Level4 Approved, but with condition of correction'),
('level4Decline', 'Decline as Level 4 staff', 'PendingL4Approval', 'ContractPendingCorrectionL4Issue', 'contract.decline', 'Process.Contract.Approval', 'Contract Level4 Declined, modification required'),
('contractCorrectionL4', 'Contract Correction L4', 'ContractPendingCorrectionL4Issue', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level4 staff has been corrected'),
('contractCorrectionL4WithApproval', 'Contract Correction L4 Pre-Approved', 'ContractPendingCorrectionL4IssueWithApproval', 'PendingL5Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract pre-approved issue that reported from Level4 staff has been corrected'),
('level5Approve', 'Approve as Level 5 staff', 'PendingL5Approval', 'PendingPartBSign', 'contract.approve', 'Process.Contract.Approval', 'Contract Level5 Approved'),
('level5ApproveWithCondition', 'Conditional Approve as Level 5 staff', 'PendingL5Approval', 'ContractPendingCorrectionL5IssueWithApproval', 'contract.conditonalApprove', 'Process.Contract.Approval', 'Contract Level5 Approved, but with condition of correction'),
('level5Decline', 'Decline as Level 5 staff', 'PendingL5Approval', 'ContractPendingCorrectionL5Issue', 'contract.decline', 'Process.Contract.Approval', 'Contract Level5 Declined, modification required'),
('contractCorrectionL5', 'Contract Correction L5', 'ContractPendingCorrectionL5Issue', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level5 staff has been corrected'),
('contractCorrectionL5WithApproval', 'Contract Correction L5 Pre-Approved', 'ContractPendingCorrectionL5IssueWithApproval', 'PendingPartBSign', 'contract.ru', 'Process.Contract.Prepare', 'Contract pre-approved issue that reported from Level5 staff has been corrected'),
('partBSign', 'Sign Contract as Part B', 'PendingPartBSign', 'PendingPartASign', 'contract.sign', 'Process.Contract.Sign', 'PartB has been Signed'),
('partBSignDecline', 'Decline Sign Contract as Part B', 'PendingPartBSign', 'ContractPendingCorrectionL100Issue', 'contract.declineSign', 'Process.Contract.Sign', 'PartB has been Declined Sign, modification required'),
('contractCorrectionL100', 'Contract Correction for Part B', 'ContractPendingCorrectionL100Issue', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Part-B staff has been corrected'),
('partASign', 'Sign Contract as Part A', 'PendingPartASign', 'Finalizing', 'contract.sign', 'Process.Contract.Sign', 'PartA has been Signed'),
('contractCorrectionSignPartA', 'Contract Correction for Part A', 'ContractPendingCorrectionSignIssueFromPartA', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Part-A staff has been corrected'),
('partASignDecline', 'Decline Sign Contract as Part A', 'PendingPartASign', 'ContractPendingCorrectionSignIssueFromPartA', 'contract.declineSign', 'Process.Contract.Sign', 'PartA has been Declined Sign, modification required'),
('finalize', 'Finalize', 'Finalizing', 'Finished', 'contract.finalize', 'Process.Contract.Finalize', 'Finalized (backup...)');
--updated Aug.2
insert into public.workflow_action (name_key, display, from_state, to_state, ui_actions, category, message)
values
('start', 'Start', 'New', 'TemplatePreparing', 'workflow.start', 'Process.Workflow', 'Workflow started'),
('templatePrepare', 'Prepare Template', 'TemplatePreparing', 'TemplatePendingApprovalBySupervisor', 'template.cru', 'Process.Template.Prepare', 'Template was Prepared'),
('templatePartAApprove', 'Approve Template as Part A', 'TemplatePendingApprovalBySupervisor', 'TemplatePendingAcceptanceByVendor', 'template.approve.a', 'Process.Template.Prepare', 'Template has been Approved by PartA'),
('templatePartADecline', 'Decline Template as Part A', 'TemplatePendingApprovalBySupervisor', 'PendingTemplateCorrectionFromPartA', 'template.decline.a', 'Process.Template.Prepare', 'Template has been Declined by PartA, modification required'),
('templatePartBApprove', 'Approve Template as Part B', 'TemplatePendingAcceptanceByVendor', 'ContractPreparing', 'template.approve.b', 'Process.Template.Prepare', 'Template has been Approved by PartB and Template is Fixed'),
('templatePartBDecline', 'Decline Template as Part B', 'TemplatePendingAcceptanceByVendor', 'PendingTemplateCorrectionFromPartB', 'template.decline.b', 'Process.Template.Prepare', 'Template has been Declined by PartB, modification required'),
('templateCorrectionForPartA', 'Template Correction for Part A', 'PendingTemplateCorrectionFromPartA', 'TemplatePendingApprovalBySupervisor', 'template.ru', 'Process.Template.Prepare', 'Template issue was Corrected based on PartA requirement'),
('templateCorrectionForPartB', 'Template Correction for Part B', 'PendingTemplateCorrectionFromPartB', 'TemplatePendingAcceptanceByVendor', 'template.ru', 'Process.Template.Prepare', 'Template issue was Corrected based on PartB requirement'),
('contractPrepare', 'Prepare Contract', 'ContractPreparing', 'PendingL1Approval', 'contract.cru', 'Process.Contract.Prepare', 'Contract has been Prepared'),
('level1Approve', 'Approve as Level 1 staff', 'PendingL1Approval', 'PendingL2Approval', 'contract.approve.level1', 'Process.Contract.Approval', 'Contract Level1 Approved'),
('level1Decline', 'Decline as Level 1 staff', 'PendingL1Approval', 'ContractPendingCorrectionL1Issue', 'contract.decline.level1', 'Process.Contract.Approval', 'Contract Level1 Declined, modification required'),
('contractCorrectionL1', 'Contract Correction L1', 'ContractPendingCorrectionL1Issue', 'PendingL1Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level1 staff has been corrected'),
('level2Approve', 'Approve as Level 2 staff', 'PendingL2Approval', 'PendingL3Approval', 'contract.approve.level2', 'Process.Contract.Approval', 'Contract Level2 Approved'),
('level2Decline', 'Decline as Level 2 staff', 'PendingL2Approval', 'ContractPendingCorrectionL2Issue', 'contract.decline.level2', 'Process.Contract.Approval', 'Contract Level2 Declined, modification required'),
('contractCorrectionL2', 'Contract Correction L2', 'ContractPendingCorrectionL2Issue', 'PendingL1Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level2 staff has been corrected'),
('level3Approve', 'Approve as Level 3 staff', 'PendingL3Approval', 'PendingL4Approval', 'contract.approve.level3', 'Process.Contract.Approval', 'Contract Level3 Approved'),
('level3Decline', 'Decline as Level 3 staff', 'PendingL3Approval', 'ContractPendingCorrectionL3Issue', 'contract.decline.level3', 'Process.Contract.Approval', 'Contract Level3 Declined, modification required'),
('contractCorrectionL3', 'Contract Correction L3', 'ContractPendingCorrectionL3Issue', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level3 staff has been corrected'),
('level4Approve', 'Approve as Level 4 staff', 'PendingL4Approval', 'PendingL5Approval', 'contract.approve.level4', 'Process.Contract.Approval', 'Contract Level4 Approved'),
('level4ApproveWithCondition', 'Conditional Approve as Level 4 staff', 'PendingL4Approval', 'ContractPendingCorrectionL4IssueWithApproval', 'contract.conditonalApprove.level4', 'Process.Contract.Approval', 'Contract Level4 Approved, but with condition of correction'),
('level4Decline', 'Decline as Level 4 staff', 'PendingL4Approval', 'ContractPendingCorrectionL4Issue', 'contract.decline.level4', 'Process.Contract.Approval', 'Contract Level4 Declined, modification required'),
('contractCorrectionL4', 'Contract Correction L4', 'ContractPendingCorrectionL4Issue', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level4 staff has been corrected'),
('contractCorrectionL4WithApproval', 'Contract Correction L4 Pre-Approved', 'ContractPendingCorrectionL4IssueWithApproval', 'PendingL5Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract pre-approved issue that reported from Level4 staff has been corrected'),
('level5Approve', 'Approve as Level 5 staff', 'PendingL5Approval', 'PendingPartBSign', 'contract.approve.level5', 'Process.Contract.Approval', 'Contract Level5 Approved'),
('level5ApproveWithCondition', 'Conditional Approve as Level 5 staff', 'PendingL5Approval', 'ContractPendingCorrectionL5IssueWithApproval', 'contract.conditonalApprove.level5', 'Process.Contract.Approval', 'Contract Level5 Approved, but with condition of correction'),
('level5Decline', 'Decline as Level 5 staff', 'PendingL5Approval', 'ContractPendingCorrectionL5Issue', 'contract.decline.level5', 'Process.Contract.Approval', 'Contract Level5 Declined, modification required'),
('contractCorrectionL5', 'Contract Correction L5', 'ContractPendingCorrectionL5Issue', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Level5 staff has been corrected'),
('contractCorrectionL5WithApproval', 'Contract Correction L5 Pre-Approved', 'ContractPendingCorrectionL5IssueWithApproval', 'PendingPartBSign', 'contract.ru', 'Process.Contract.Prepare', 'Contract pre-approved issue that reported from Level5 staff has been corrected'),
('partBSign', 'Sign Contract as Part B', 'PendingPartBSign', 'PendingPartASign', 'contract.sign.b', 'Process.Contract.Sign', 'PartB has been Signed'),
('partBSignDecline', 'Decline Sign Contract as Part B', 'PendingPartBSign', 'ContractPendingCorrectionL100Issue', 'contract.declineSign.b', 'Process.Contract.Sign', 'PartB has been Declined Sign, modification required'),
('contractCorrectionL100', 'Contract Correction for Part B', 'ContractPendingCorrectionL100Issue', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Part-B staff has been corrected'),
('partASign', 'Sign Contract as Part A', 'PendingPartASign', 'Finalizing', 'contract.sign.a', 'Process.Contract.Sign', 'PartA has been Signed'),
('contractCorrectionSignPartA', 'Contract Correction for Part A', 'ContractPendingCorrectionSignIssueFromPartA', 'PendingL3Approval', 'contract.ru', 'Process.Contract.Prepare', 'Contract issue that reported from Part-A staff has been corrected'),
('partASignDecline', 'Decline Sign Contract as Part A', 'PendingPartASign', 'ContractPendingCorrectionSignIssueFromPartA', 'contract.declineSign.a', 'Process.Contract.Sign', 'PartA has been Declined Sign, modification required'),
('finalize', 'Finalize', 'Finalizing', 'Finished', 'contract.finalize', 'Process.Contract.Finalize', 'Finalized (backup...)');
----temp table, for transitions
insert into public.t_transitions (action_name, from_state, to_state, method)
values
('contractCorrectionL1','ContractPendingCorrection','ContractCorrectedL1Issue','onContractCorrectionL1'),
('contractCorrectionL100','ContractPendingCorrectionL100Issue','ContractCorrectedL100Issue','onContractCorrectionL100'),
('contractCorrectionL2','ContractPendingCorrectionL2Issue','ContractCorrectedL2Issue','onContractCorrectionL2'),
('contractCorrectionL3','ContractPendingCorrectionL3Issue','ContractCorrectedL3Issue','onContractCorrectionL3'),
('contractCorrectionL4','ContractPendingCorrectionL4Issue','ContractCorrectedL4Issue','onContractCorrectionL4'),
('contractCorrectionL4WithApproval','ContractPendingCorrectionL4IssueWithApproval','ContractCorrectedL4IssueWithApproval','onContractCorrectionL4WithApproval'),
('contractCorrectionL5','ContractPendingCorrectionL5Issue','ContractCorrectedL5Issue','onContractCorrectionL5'),
('contractCorrectionL5WithApproval','ContractPendingCorrectionL5IssueWithApproval','ContractCorrectedL5IssueWithApproval','onContractCorrectionL5WithApproval'),
('contractPrepare','ContractPreparing','ContractPrepared','onContractPrepare'),
('finalize','Finalizing','Finalized','onFinalize'),
('level1Approve','PendingL1Approval','Level1Approved','onLevel1Approve'),
('level1Decline','PendingL1Approval','Level1Declined','onLevel1Decline'),
('level2Approve','PendingL2Approval','Level2Approved','onLevel2Approve'),
('level2Decline','PendingL2Approval','Level2Declined','onLevel2Decline'),
('level3Approve','PendingL3Approval','Level3Approved','onLevel3Approve'),
('level3Decline','PendingL3Approval','Level3Declined','onLevel3Decline'),
('level4Approve','PendingL4Approval','Level4Approved','onLevel4Approve'),
('level4ApproveWithCondition','PendingL4Approval','ContractPendingCorrectionL4IssueWithApproval','onLevel4ApproveWithCondition'),
('level4Decline','PendingL4Approval','Level4Declined','onLevel4Decline'),
('level5Approve','PendingL5Approval','Level5Approved','onLevel5Approve'),
('level5ApproveWithCondition','PendingL5Approval','ContractPendingCorrectionL5IssueWithApproval','onLevel5ApproveWithCondition'),
('level5Decline','PendingL5Approval','Level5Declined','onLevel5Decline'),
('partASign','PendingPartASign','PartASigned','onPartASign'),
('partBSign','PendingPartBSign','PartBSigned','onPartBSign'),
('partBSignDecline','PendingPartBSign','PartBDeclined','onPartBSignDecline'),
('preparePartASign','PreparingPartASign','PendingPartASign','onPreparePartASign'),
('preparePartBSign','PreparingPartBSign','PendingPartBSign','onPreparePartBSign'),
('templateCorrectionForPartA','PendingTemplateCorrectionFromPartA','TemplateCorrectedForPartA','onTemplateCorrectionForPartA'),
('templateCorrectionForPartB','PendingTemplateCorrectionFromPartB','TemplateCorrectedForPartB','onTemplateCorrectionForPartB'),
('templatePartAApprove','TemplatePendingApprovalBySupervisor','TemplatePartAApproved','onTemplatePartAApprove'),
('templatePartADecline','TemplatePendingApprovalBySupervisor','TemplatePartADeclined','onTemplatePartADecline'),
('templatePartBApprove','TemplatePendingAcceptanceByVendor','TemplatePartBApproved','onTemplatePartBApprove'),
('templatePartBDecline','TemplatePendingAcceptanceByVendor','TemplatePartBDeclined','onTemplatePartBDecline'),
('templatePrepare','TemplatePreparing','TemplatePrepared','onTemplatePrepare'),
('next','Start','TemplatePreparing','onNext'),
('next','TemplatePrepared','TemplatePendingApprovalBySupervisor','onNext'),
('next','TemplatePartADeclined','PendingTemplateCorrectionFromPartA','onNext'),
('next','TemplateCorrectedForPartA','TemplatePendingApprovalBySupervisor','onNext'),
('next','TemplatePartAApproved','TemplatePendingAcceptanceByVendor','onNext'),
('next','TemplatePartBDeclined','PendingTemplateCorrectionFromPartB','onNext'),
('next','TemplateCorrectedForPartB','TemplatePendingAcceptanceByVendor','onNext'),
('next','TemplatePartBApproved','TemplateFixed','onNext'),
('next','TemplateFixed','ContractPreparing','onNext'),
('next','ContractPrepared','PendingL1Approval','onNext'),
('next','Level1Declined','ContractPendingCorrection','onNext'),
('next','ContractCorrectedL1Issue','PendingL1Approval','onNext'),
('next','Level1Approved','PendingL2Approval','onNext'),
('next','Level2Declined','ContractPendingCorrectionL2Issue','onNext'),
('next','ContractCorrectedL2Issue','PendingL1Approval','onNext'),
('next','Level2Approved','PendingL3Approval','onNext'),
('next','Level3Declined','ContractPendingCorrectionL3Issue','onNext'),
('next','ContractCorrectedL3Issue','PendingL3Approval','onNext'),
('next','Level3Approved','PendingL4Approval','onNext'),
('next','ContractCorrectedL4IssueWithApproval','PendingL5Approval','onNext'),
('next','Level4Declined','ContractPendingCorrectionL4Issue','onNext'),
('next','ContractCorrectedL4Issue','PendingL3Approval','onNext'),
('next','Level4Approved','PendingL5Approval','onNext'),
('next','ContractCorrectedL5IssueWithApproval','PreparingPartBSign','onNext'),
('next','Level5Declined','ContractPendingCorrectionL5Issue','onNext'),
('next','ContractCorrectedL5Issue','PendingL3Approval','onNext'),
('next','Level5Approved','PreparingPartBSign','onNext'),
('next','PartBDeclined','ContractPendingCorrectionL100Issue','onNext'),
('next','ContractCorrectedL100Issue','PendingL3Approval','onNext'),
('next','PartBSigned','PreparingPartASign','onNext'),
('next','PartASigned','Finalizing','onNext'),
('next','Finalized','Finished','onNext');
-------new--06.26.2019--
insert into public.process_action (name_key, content)
values
('contractCorrectionL1','{"head": { "code": "contractCorrectionL1", "display": "Contract Correction L1", "relations": [{ "from": "ContractPendingCorrection", "to": "ContractCorrectedL1Issue"}], "ui_actions": ["contract.ru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('contractCorrectionL100','{"head": { "code": "contractCorrectionL100", "display": "Contract Correction for Part B", "relations": [{ "from": "ContractPendingCorrectionL100Issue", "to": "ContractCorrectedL100Issue"}], "ui_actions": ["contract.ru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('contractCorrectionL2','{"head": { "code": "contractCorrectionL2", "display": "Contract Correction L2", "relations": [{ "from": "ContractPendingCorrectionL2Issue", "to": "ContractCorrectedL2Issue"}], "ui_actions": ["contract.ru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('contractCorrectionL3','{"head": { "code": "contractCorrectionL3", "display": "Contract Correction L3", "relations": [{ "from": "ContractPendingCorrectionL3Issue", "to": "ContractCorrectedL3Issue"}], "ui_actions": ["contract.ru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('contractCorrectionL4','{"head": { "code": "contractCorrectionL4", "display": "Contract Correction L4", "relations": [{ "from": "ContractPendingCorrectionL4Issue", "to": "ContractCorrectedL4Issue"}], "ui_actions": ["contract.ru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('contractCorrectionL4WithApproval','{"head": { "code": "contractCorrectionL4WithApproval", "display": "Contract Correction L4 Pre-Approved", "relations": [{ "from": "ContractPendingCorrectionL4IssueWithApproval", "to": "ContractCorrectedL4IssueWithApproval"}], "ui_actions": ["contract.ru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('contractCorrectionL5','{"head": { "code": "contractCorrectionL5", "display": "Contract Correction L5", "relations": [{ "from": "ContractPendingCorrectionL5Issue", "to": "ContractCorrectedL5Issue"}], "ui_actions": ["contract.ru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('contractCorrectionL5WithApproval','{"head": { "code": "contractCorrectionL5WithApproval", "display": "Contract Correction L5 Pre-Approved", "relations": [{ "from": "ContractPendingCorrectionL5IssueWithApproval", "to": "ContractCorrectedL5IssueWithApproval"}], "ui_actions": ["contract.ru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('contractPrepare','{"head": { "code": "contractPrepare", "display": "Prepare Contract", "relations": [{ "from": "ContractPreparing", "to": "ContractPrepared"}], "ui_actions": ["contract.cru"], "category": "Process.Contract.Prepare", "version": "1.0.0"}}'),
('finalize','{"head": { "code": "finalize", "display": "Finalize", "relations": [{ "from": "Finalizing", "to": "Finalized"}], "ui_actions": ["contract.finalize"], "category": "Process.Contract.Finalize", "version": "1.0.0"}}'),
('level1Approve','{"head": { "code": "level1Approve", "display": "Approve as Level 1 staff", "relations": [{ "from": "PendingL1Approval", "to": "Level1Approved"}], "ui_actions": ["contract.approve"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level1Decline','{"head": { "code": "level1Decline", "display": "Decline as Level 1 staff", "relations": [{ "from": "PendingL1Approval", "to": "Level1Declined"}], "ui_actions": ["contract.decline"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level2Approve','{"head": { "code": "level2Approve", "display": "Approve as Level 2 staff", "relations": [{ "from": "PendingL2Approval", "to": "Level2Approved"}], "ui_actions": ["contract.approve"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level2Decline','{"head": { "code": "level2Decline", "display": "Decline as Level 2 staff", "relations": [{ "from": "PendingL2Approval", "to": "Level2Declined"}], "ui_actions": ["contract.decline"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level3Approve','{"head": { "code": "level3Approve", "display": "Approve as Level 3 staff", "relations": [{ "from": "PendingL3Approval", "to": "Level3Approved"}], "ui_actions": ["contract.approve"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level3Decline','{"head": { "code": "level3Decline", "display": "Decline as Level 3 staff", "relations": [{ "from": "PendingL3Approval", "to": "Level3Declined"}], "ui_actions": ["contract.decline"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level4Approve','{"head": { "code": "level4Approve", "display": "Approve as Level 4 staff", "relations": [{ "from": "PendingL4Approval", "to": "Level4Approved"}], "ui_actions": ["contract.approve"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level4ApproveWithCondition','{"head": { "code": "level4ApproveWithCondition", "display": "Conditional Approve as Level 4 staff", "relations": [{ "from": "PendingL4Approval", "to": "ContractPendingCorrectionL4IssueWithApproval"}], "ui_actions": ["contract.conditonalApprove"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level4Decline','{"head": { "code": "level4Decline", "display": "Decline as Level 4 staff", "relations": [{ "from": "PendingL4Approval", "to": "Level4Declined"}], "ui_actions": ["contract.decline"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level5Approve','{"head": { "code": "level5Approve", "display": "Approve as Level 5 staff", "relations": [{ "from": "PendingL5Approval", "to": "Level5Approved"}], "ui_actions": ["contract.approve"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level5ApproveWithCondition','{"head": { "code": "level5ApproveWithCondition", "display": "Conditional Approve as Level 5 staff", "relations": [{ "from": "PendingL5Approval", "to": "ContractPendingCorrectionL5IssueWithApproval"}], "ui_actions": ["contract.conditonalApprove"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('level5Decline','{"head": { "code": "level5Decline", "display": "Decline as Level 5 staff", "relations": [{ "from": "PendingL5Approval", "to": "Level5Declined"}], "ui_actions": ["contract.decline"], "category": "Process.Contract.Approval", "version": "1.0.0"}}'),
('partASign','{"head": { "code": "partASign", "display": "Sign Contract as Part A", "relations": [{ "from": "PendingPartASign", "to": "PartASigned"}], "ui_actions": ["contract.sign"], "category": "Process.Contract.Sign", "version": "1.0.0"}}'),
('partBSign','{"head": { "code": "partBSign", "display": "Sign Contract as Part B", "relations": [{ "from": "PendingPartBSign", "to": "PartBSigned"}], "ui_actions": ["contract.sign"], "category": "Process.Contract.Sign", "version": "1.0.0"}}'),
('partBSignDecline','{"head": { "code": "partBSignDecline", "display": "Decline Sign Contract as Part B", "relations": [{ "from": "PendingPartBSign", "to": "PartBDeclined"}], "ui_actions": ["contract.declineSign"], "category": "Process.Contract.Sign", "version": "1.0.0"}}'),
('preparePartASign','{"head": { "code": "preparePartASign", "display": "Prepare Part A Sign", "relations": [{ "from": "PreparingPartASign", "to": "PendingPartASign"}], "ui_actions": ["contract.prepareSign"], "category": "Process.Contract.Sign", "version": "1.0.0"}}'),
('preparePartBSign','{"head": { "code": "preparePartBSign", "display": "Prepare Part B Sign", "relations": [{ "from": "PreparingPartBSign", "to": "PendingPartBSign"}], "ui_actions": ["contract.prepareSign"], "category": "Process.Contract.Sign", "version": "1.0.0"}}'),
('templateCorrectionForPartA','{"head": { "code": "templateCorrectionForPartA", "display": "Template Correction for Part A", "relations": [{ "from": "PendingTemplateCorrectionFromPartA", "to": "TemplateCorrectedForPartA"}], "ui_actions": ["template.ru"], "category": "Process.Template.Prepare", "version": "1.0.0"}}'),
('templateCorrectionForPartB','{"head": { "code": "templateCorrectionForPartB", "display": "Template Correction for Part B", "relations": [{ "from": "PendingTemplateCorrectionFromPartB", "to": "TemplateCorrectedForPartB"}], "ui_actions": ["template.ru"], "category": "Process.Template.Prepare", "version": "1.0.0"}}'),
('templatePartAApprove','{"head": { "code": "templatePartAApprove", "display": "Approve Template as Part A", "relations": [{ "from": "TemplatePendingApprovalBySupervisor", "to": "TemplatePartAApproved"}], "ui_actions": ["template.approve"], "category": "Process.Template.Prepare", "version": "1.0.0"}}'),
('templatePartADecline','{"head": { "code": "templatePartADecline", "display": "Decline Template as Part A", "relations": [{ "from": "TemplatePendingApprovalBySupervisor", "to": "TemplatePartADeclined"}], "ui_actions": ["template.decline"], "category": "Process.Template.Prepare", "version": "1.0.0"}}'),
('templatePartBApprove','{"head": { "code": "templatePartBApprove", "display": "Approve Template as Part B", "relations": [{ "from": "TemplatePendingAcceptanceByVendor", "to": "TemplatePartBApproved"}], "ui_actions": ["template.approve"], "category": "Process.Template.Prepare", "version": "1.0.0"}}'),
('templatePartBDecline','{"head": { "code": "templatePartBDecline", "display": "Decline Template as Part B", "relations": [{ "from": "TemplatePendingAcceptanceByVendor", "to": "TemplatePartBDeclined"}], "ui_actions": ["template.decline"], "category": "Process.Template.Prepare", "version": "1.0.0"}}'),
('templatePrepare','{"head": { "code": "templatePrepare", "display": "Prepare Template", "relations": [{ "from": "TemplatePreparing", "to": "TemplatePrepared"}], "ui_actions": ["template.cru"], "category": "Process.Template.Prepare", "version": "1.0.0"}}'),
('next', '{"head": { "code": "next", "display": "next","relations": [
{ "from": "Start", "to": "TemplatePreparing"},
{ "from": "TemplatePrepared", "to": "TemplatePendingApprovalBySupervisor"},
{ "from": "TemplatePartADeclined", "to": "PendingTemplateCorrectionFromPartA"},
{ "from": "TemplateCorrectedForPartA", "to": "TemplatePendingApprovalBySupervisor"},
{ "from": "TemplatePartAApproved", "to": "TemplatePendingAcceptanceByVendor"},
{ "from": "TemplatePartBDeclined", "to": "PendingTemplateCorrectionFromPartB"},
{ "from": "TemplateCorrectedForPartB", "to": "TemplatePendingAcceptanceByVendor"},
{ "from": "TemplatePartBApproved", "to": "TemplateFixed"},
{ "from": "TemplateFixed", "to": "ContractPreparing"},
{ "from": "ContractPrepared", "to": "PendingL1Approval"},
{ "from": "Level1Declined", "to": "ContractPendingCorrection"},
{ "from": "ContractCorrectedL1Issue", "to": "PendingL1Approval"},
{ "from": "Level1Approved", "to": "PendingL2Approval"},
{ "from": "Level2Declined", "to": "ContractPendingCorrectionL2Issue"},
{ "from": "ContractCorrectedL2Issue", "to": "PendingL1Approval"},
{ "from": "Level2Approved", "to": "PendingL3Approval"},
{ "from": "Level3Declined", "to": "ContractPendingCorrectionL3Issue"},
{ "from": "ContractCorrectedL3Issue", "to": "PendingL3Approval"},
{ "from": "Level3Approved", "to": "PendingL4Approval"},
{ "from": "ContractCorrectedL4IssueWithApproval", "to": "PendingL5Approval"},
{ "from": "Level4Declined", "to": "ContractPendingCorrectionL4Issue"},
{ "from": "ContractCorrectedL4Issue", "to": "PendingL3Approval"},
{ "from": "Level4Approved", "to": "PendingL5Approval"},
{ "from": "ContractCorrectedL5IssueWithApproval", "to": "PreparingPartBSign"},
{ "from": "Level5Declined", "to": "ContractPendingCorrectionL5Issue"},
{ "from": "ContractCorrectedL5Issue", "to": "PendingL3Approval"},
{ "from": "Level5Approved", "to": "PreparingPartBSign"},
{ "from": "PartBDeclined", "to": "ContractPendingCorrectionL100Issue"},
{ "from": "ContractCorrectedL100Issue", "to": "PendingL3Approval"},
{ "from": "PartBSigned", "to": "PreparingPartASign"},
{ "from": "PartASigned", "to": "Finalizing"},
{ "from": "Finalized", "to": "Finished"}
]}}');
--about update
--upsert
insert into public.contract (name_key, content)
values ('tami-contract-cccc', '{"head-updated":{}}')
on conflict (name_key)
do
update
set content='{"head-updated":{}}';
--update
update contract
set content = (
jsonb_set(
content,
'{data, selected}',
'1',
false))::json where uuid='c26eac14-7a02-4564-b864-40cfd28da438';
--update path-> value
update tests_summary_data
set data = (
jsonb_set(
to_jsonb(data),
'{misc,gap,pa}',
'-1',
false))::json where data->'misc'->'gap'->>'pa' = '0';
-- contract_template
-- inside json -> grammer for variables
-- grammar-I
-- {
-- "code": "contract-type",
-- "field": "CONTRACT TYPE: $[contract-type::singleselection::Professional Services,Maintenance/Service Support,Standing Offer Contract]"
-- },
-- grammar-II
-- {
-- "code": "contract-type",
-- "field": "CONTRACT TYPE: $[contract-type::singleselection::VVV:codetable:contract_type]"
-- },
--Contract---
insert into public.contract (name_key, content)
values('empty-contract-of-itss-control-approval-template','
{
"body": {
"start-date": "2019-06-18",
"totalvalue": "2000",
"vendor-name": "iWave",
"amendment-no": "Test-AMDNO-83859",
"contract-type": "Maintenance/Service Support",
"contract-title": "TestContract-0603",
"contract-summary": "this is a test contract, and this is the contract summary",
"vender-selected-by": "Competitive Process"
},
"head": {
"code": "Test creating contract-iWave",
"template-key": "itss-control-approval-template"
}
}
');
insert into public.contract (name_key, content)
values('empty-contract-of-itss-control-approval-template','
{
"head": {
"code": "",
"title":"",
"template-key": "itss-control-approval-template",
"generated-date": "",
"author": "",
"version":"1.0.0"
},
"body": {
"data": {
"contract-title": "",
"vendor-name": "",
"verified": "",
"registry-link": "",
"start-date": "",
"end-date": "",
"contract-summary": "",
"contract-type": "",
"amendment-no": "",
"totalvalue": "",
"value-per-year": {
"value-20182019":"",
"value-20192020":"",
"value-20202021":""
},
"value-history-year": {
"value-20162017":"",
"value-20172018":""
},
"associated-tb-ec": "",
"contract-notes": "",
"vender-selected-by": "",
"background-doc": "",
"ongoing-required": "",
"option-extend": "",
"budegt-section": "",
"budegt-object": "",
"budegt-program": "",
"budegt-project": "",
"budegt-contract-no": ""
}
}
}
');
---codetable---
SELECT content->'body' FROM codetable;
SELECT content->>'body' FROM codetable where name_key='contract_type';
insert into public.codetable (name_key, content)
values('contract_type',
'{
"head": {
"code": "contract_type",
"display": "Contract Type",
"expire-date": ""
},
"body": [
{
"code": "professional-services",
"display": "Professional Services",
"order": 1,
"start-date": "2016-03-03",
"end-date": "2022-03-03"
},
{
"code": "maintenance-service-support",
"display": "Maintenance/Service Support",
"order": 2,
"start-date": "2016-03-03",
"end-date": "2022-03-03"
},
{
"code": "standing-offer-contract",
"display": "Standing Offer Contract",
"order": 3,
"start-date": "2016-03-03",
"end-date": "2022-03-03"
}
]
}'
);
insert into public.codetable (name_key, content)
values('vender_selected_by',
'{
"head": {
"code": "vender_selected_by",
"display": "Vender Selected By",
"expire-date": ""
},
"body": [
{
"code": "competitive_process",
"display": "Competitive Process",
"order": 1,
"start-date": "2016-03-03",
"end-date": "2022-03-03"
},
{
"code": "sole_source",
"display": "Sole Source",
"order": 2,
"start-date": "2016-03-03",
"end-date": "2022-03-03"
},
{
"code": "three_quotes_received",
"display": "Three Quotes Received",
"order": 3,
"start-date": "2016-03-03",
"end-date": "2022-03-03"
}
]
}'
);
insert into public.codetable (name_key, content)
values('province',
'{
"head": {
"code": "province",
"display": "Province",
"expire-date": "3022-03-03"
},
"body": [
{
"code": "Prince-Edward-Island",
"display": "Prince Edward Island",
"initial": "PE",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "Nova-Scotia",
"display": "Nova Scotia",
"initial": "NS",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "New-Brunswich",
"display": "New Brunswich",
"initial": "NB",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "ontario",
"display": "Ontario",
"initial": "ON",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "Quebec",
"display": "Quebec",
"initial": "QB",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "Manitoba",
"display": "Manitoba",
"initial": "MB",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "British-Columbia",
"display": "British Columbia",
"initial": "BC",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "Saskatchewan",
"display": "Saskatchewan",
"initial": "SK",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "Alberta",
"display": "Alberta",
"initial": "AB",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
},
{
"code": "Newfoundland-and-Labrador",
"display": "Newfoundland and Labrador",
"initial": "NL",
"start-date": "2016-03-03",
"end-date": "3022-03-03"
}
]
}'
);
--insert vendor into codetable
insert into public.codetable (name_key, content)
values('vendor',
'{
"head": {
"code": "vendor",
"display": "Vender List",
"expire-date": ""
},
"body": [
{
"code": "iwave-pei",
"address": "134 Kent St, Charlottetown",
"display": "iWave",
"postal-code": "PE C1A",
"registered-code": "VEN72398348"
},
{
"code": "deltaware-pei",
"address": "176 Great George St, Charlottetown",
"display": "The DeltaWare Division of MAXIMUS",
"postal-code": "PE C1A 4K9",
"registered-code": "VEN95874000"
},
{
"code": "upei",
"address": "550 University Ave, Charlottetown",
"display": "University of PEI",
"postal-code": "PE C1A 4P3",
"registered-code": "EDU737322"
}
]
}'
);
-----defination---
insert into public.definition (name_key, content)
values ('agreement', '
{
"head": {
"code": "agreement",
"template-key": " ",
"author": "author-guy"
},
"body": "\"Agreement\" means this Memorandum of Agreement and all attached schedules, and \"Memorandum of Agreement\" means this Agreement excluding all attached schedules;"
}'),
('contractor', '
{
"head": {
"code": "contractor",
"template-key": " ",
"author": "author-guy"
},
"body": "\"Contractor\" means [INSERT CONTRACTOR’S FULL LEGAL NAME HERE];"
}'),
('fiscal_year', '
{
"head": {
"code": "fiscal_year",
"template-key": " ",
"author": "author-guy"
},
"body": "\"Fiscal Year\" means a 12 month period beginning on April 1st in a year and ending on March 31st in the following year;"
}'),
('government', '
{
"head": {
"code": "government",
"template-key": " ",
"author": "author-guy"
},
"body": "\"Government\" means Government of Prince Edward Island, as represented by the Minister of Finance;"
}'),
('parties', '
{
"head": {
"code": "parties",
"template-key": " ",
"author": "author-guy"
},
"body": "\"Parties\" means Government and the Contractor, and \"Party\" means either of them as the context requires;"
}');
----action---
insert into public.action (name_key, content)
values
('view', '{
"head": {
"code": "view",
"display": "View",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('create', '{
"head": {
"code": "create",
"display": "Create",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('modify', '{
"head": {
"code": "modify",
"display": "Modify",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('delete', '{
"head": {
"code": "delete",
"display": "Delete",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('review', '{
"head": {
"code": "review",
"display": "Review",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('approve', '{
"head": {
"code": "approve",
"display": "Approve",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('rollback', '{
"head": {
"code": "rollback",
"display": "Rollback",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('finalize', '{
"head": {
"code": "finalize",
"display": "Finalize",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('agree', '{
"head": {
"code": "agree",
"display": "Agree",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('allocate', '{
"head": {
"code": "allocate",
"display": "Allocate",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('receive', '{
"head": {
"code": "receive",
"display": "Receive",
"objects": ["template", "contract", "user"]
},
"body": {
}
}'),
('backup', '{
"head": {
"code": "backup",
"display": "Backup",
"objects": ["template", "contract", "user"]
},
"body": {
}
}');
---role---
insert into public.role (name_key, content)
values
('author', '{
"head": {
"code": "author",
"display": "Contract Author"
},
"body": {
}
}'),
('manager', '{
"head": {
"code": "manager",
"display": "Manager"
},
"body": {
}
}'),
('director', '{
"head": {
"code": "director",
"display": "Director"
},
"body": {
}
}'),
('coo', '{
"head": {
"code": "coo",
"display": "Chief Operating Officer"
},
"body": {
}
}'),
('cfo', '{
"head": {
"code": "cfo",
"display": "Chief Financial Officer"
},
"body": {
}
}'),
('scc', '{
"head": {
"code": "scc",
"display": "Supply Chain Coordinator"
},
"body": {
}
}'),
('vendor', '{
"head": {
"code": "vendor",
"display": "Vendor"
},
"body": {
}
}');
---event / process----
---task------
-----user-----
insert into public.user (name_key, content)
values
('tliu', '{"head":
{ "code":"tliu",
"version": "1.0",
"firstName": "Teng",
"lastName": "Liu",
"role": "author",
"email": "tliu@gov.pe.ca",
"phone": "902758483"}
}'),
('summerc', '{"head":
{ "code":"summerc",
"version": "1.0",
"firstName": "Summer",
"lastName": "Cake",
"role": "scc",
"email": "sck@gov.pe.ca",
"phone": "902752223"}
}'),
('winterw', '{"head":
{ "code":"winterw",
"version": "1.0",
"firstName": "Wendy",
"lastName": "Warm",
"role": "coo",
"email": "swk@gov.pe.ca",
"phone": "90275233"}
}');
insert into public.user (name_key, content)
values
('uauthor', '{"head":
{ "code":"uauthor",
"version": "1.0",
"firstName": "uauthorF",
"lastName": "uauthorL",
"passward": "123",
"role": "author",
"email": "uauthor@gov.pe.ca",
"phone": "902758483"}
}'),
('umanager', '{"head":
{ "code":"umanager",
"version": "1.0",
"firstName": "umanagerF",
"lastName": "umanagerL",
"passward": "123",
"role": "manager",
"email": "umanager@gov.pe.ca",
"phone": "902758483"}
}'),
('udirector', '{"head":
{ "code":"udirector",
"version": "1.0",
"firstName": "udirectorF",
"lastName": "udirectorL",
"passward": "123",
"role": "director",
"email": "udirector@gov.pe.ca",
"phone": "902758483"}
}'),
('uscc', '{"head":
{ "code":"uscc",
"version": "1.0",
"firstName": "usccF",
"lastName": "usccL",
"passward": "123",
"role": "scc",
"email": "uscc@gov.pe.ca",
"phone": "902758483"}
}'),
('ucoo', '{"head":
{ "code":"ucoo",
"version": "1.0",
"firstName": "ucooF",
"lastName": "ucooL",
"passward": "123",
"role": "coo",
"email": "ucoo@gov.pe.ca",
"phone": "902758483"}
}'),
('ucfo', '{"head":
{ "code":"ucfo",
"version": "1.0",
"firstName": "ucfoF",
"lastName": "ucfoL",
"passward": "123",
"role": "cfo",
"email": "ucfo@gov.pe.ca",
"phone": "902758483"}
}'),
('uvendor', '{"head":
{ "code":"uvendor",
"version": "1.0",
"firstName": "uvendorF",
"lastName": "uvendorL",
"passward": "123",
"role": "vendor",
"email": "uvendor@gov.pe.ca",
"phone": "902758483"}
}');
insert into public.process (name_key, content)
values ('prj-test-NO.1', '{
"head": {
"contract": "Contract NO.2",
"template": "",
"state": "PendingL1Approval",
"possible-actions": ["level1Approve", "level1Decline"],
"start-time": "",
"expire-time": ""
}
}');
insert into public.contract_template (name_key, content)
values ('default-contract-template-itss', '{
"head": {
"id": "default-contract-template-itss",
"code": "default-contract-template-itss",
"title": "Default ITSS Contract Template",
"version": "1.0"
},
"body": {
"header": [
{"field": "THIS AGREEMENT made this ${made-date::calander::dateformat1}"},
{"field": "BETWEEN: GOVERNMENT OF PRINCE EDWARD ISLAND, as represented by the Minister of ${minister-partA::textinput::Type here},"},
{"field": "(hereinafter referred to as \"Government\")"},
{"field": "OF THE PART A;###right####"},
{"field": "AND: ${partB-department::textinput::Type Here}"},
{"field": "of ${partB-company::textinput::Type Here}"},
{"field": "in ${partB-county::textinput::Type Here} County, Province of ${partB-province::dropdownlist::VVV:codetable:province},"},
{"field": "(hereinafter referred to as the \"Contractor\")"},
{"field": "OF THE PART B###right####"},
{"field": "WHEREAS Government wishes to engage the services of the Contractor to carry out the services described in Schedule \"A\" attached hereto;"},
{"field": "AND WHEREAS the Contractor has agreed to provide Government with these services on certain terms and conditions as more particularly set out in this Agreement;"},
{"field": "NOW THEREFORE in consideration of the mutual promises contained in this Agreement, the Parties agree that the terms and conditions of their relationship are as follows:"}
],
"definitions":
{
"title": "Definitions",
"sub_title": "In this Agreement, the following definitions apply:",
"list": "agreement;contractor;fiscal_year;government;parties"
},
"convenants-contractor": [
{
"title": "Covenants of the Contractor and Government"
},
{
"field": "The Contractor shall perform the services, assume all those responsibilities and diligently execute all those duties described in the attached Schedule \"A\" (the \"Work\"), in a manner satisfactory to Government."
},
{
"field":"(a) Subject to the termination clause contained in the Termination section of this Agreement, the term of this Agreement shall commence on ${commence-start-date::calander::dateformat1}, and end on ${commence-end-date::calander::dateformat1} (the \"Term\")."
},
{
"field":"(b) Subject to the termination clause contained in the Termination section of this Agreement and notwithstanding the date of signing of this Agreement, it is acknowledged by both Parties that the Contractor commenced the performance of the Work on ${agreenment-date::calander::dateformat1}. It is further agreed that the amount of $ ${maximum-total-amount::textinput::Type here} is the maximum amount to be paid for the Work and includes all amounts which may be owed for the Work done since ${work-start-date::calander::dateformat1}."
}
],
"payments": [
{
"title": "Payments, Records and Accounts"
},
{
"field":"Government shall make payments to the Contractor in the following manner:"
},
{
"field": "(a) Payment for the Work shall be at the rate of $ ${rate-per-hour::textinput::Type here} per hour, excluding taxes, but in no case shall the total payment exceed $ ${total-no-exceed::textinput::Type here}"
},
{
"field": "OR###center####"
},
{
"field": "(a) Payment for the Work shall be a lump sum of $ ${lump-sum::textinput::Type here} , excluding taxes, payable on the ${lump-paydate::calander::Type here}"
},
{
"field": "OR###center####"
},
{
"field": "(a) Payment for the work shall be by installments of $ ${rate-per-hour::textinput::Type here}, excluding taxes, payable as follows [ie. List dates (milestones) when payments will be made including amount to be paid on each date]"
},
{
"field": "AND, IF APPLICABLE###center####"
},
{
"field": "(b) Government shall pay all expenses of the Contractor, exclusive of all taxes, up to a maximum of $ ${expenses-maximum::textinput::Type here},based on expenses actually incurred and verified by receipt."
},
{
"field": "(c) The payments described herein shall be paid upon the basis of the submission, by the ${payday_c::calander::Type here},of a detailed statement together with all necessary receipts. Such statements shall be submitted to Government, and Government shall pay the amount owing within ${within_days_of_receipt::textinput::Type here}"
},
{
"field": "(d) All payments are subject to a hold back of an amount equal to ${percentage_bill_on_completion::textinput::Type here}% of the amount billed. The hold back shall be paid upon completion and acceptance of the Work."
},
{
"field": "OR###center####"
},
{
"field": "(d) All payments are subject to a hold back of an amount equal to ${percentage_bill_on_finalReport::textinput::Type here}% of the amount billed. The hold back shall be paid upon the submission and acceptance of the final report and completion of the work."
}
],
"conditions-of-agreement": {}
}
}');
insert into public.contract_template (name_key, content)
values
('default-contract-template-itss', '{
"body": {
"header": [
{
"field": "THIS AGREEMENT made this ${made-date::calander::dateformat1}"
},
{
"field": "BETWEEN: GOVERNMENT OF PRINCE EDWARD ISLAND, as represented by the Minister of ${minister-partA::textinput::Type here},"
},
{
"field": "(hereinafter referred to as \"Government\")"
},
{
"field": "OF THE PART A;###right####"
},
{
"field": "AND: ${partB-department::textinput::Type Here}"
},
{
"field": "of ${partB-company::dropdownlist::VVV:codetable:vendor}"
},
{
"field": "in ${partB-county::textinput::Type Here} County, Province of ${partB-province::dropdownlist::VVV:codetable:province},"
},
{
"field": "(hereinafter referred to as the \"Contractor\")"
},
{
"field": "OF THE PART B###right####"
},
{
"field": "WHEREAS Government wishes to engage the services of the Contractor to carry out the services described in Schedule \"A\" attached hereto;"
},
{
"field": "AND WHEREAS the Contractor has agreed to provide Government with these services on certain terms and conditions as more particularly set out in this Agreement;"
},
{
"field": "NOW THEREFORE in consideration of the mutual promises contained in this Agreement, the Parties agree that the terms and conditions of their relationship are as follows:"
}
],
"payments": [
{
"title": "Payments, Records and Accounts"
},
{
"field": "Government shall make payments to the Contractor in the following manner:"
},
{
"field": "(a) Payment for the Work shall be at the rate of $ ${rate-per-hour::textinput::Type here} per hour, excluding taxes, but in no case shall the total payment exceed $ ${total-no-exceed::textinput::Type here}"
},
{
"field": "OR###center####"
},
{
"field": "(a) Payment for the Work shall be a lump sum of $ ${lump-sum::textinput::Type here} , excluding taxes, payable on the ${lump-paydate::calander::Type here}"
},
{
"field": "OR###center####"
},
{
"field": "(a) Payment for the work shall be by installments of $ ${rate-per-hour::textinput::Type here}, excluding taxes, payable as follows [ie. List dates (milestones) when payments will be made including amount to be paid on each date]"
},
{
"field": "AND, IF APPLICABLE###center####"
},
{
"field": "(b) Government shall pay all expenses of the Contractor, exclusive of all taxes, up to a maximum of $ ${expenses-maximum::textinput::Type here},based on expenses actually incurred and verified by receipt."
},
{
"field": "(c) The payments described herein shall be paid upon the basis of the submission, by the ${payday_c::calander::Type here},of a detailed statement together with all necessary receipts. Such statements shall be submitted to Government, and Government shall pay the amount owing within ${within_days_of_receipt::textinput::Type here}"
},
{
"field": "(d) All payments are subject to a hold back of an amount equal to ${percentage_bill_on_completion::textinput::Type here}% of the amount billed. The hold back shall be paid upon completion and acceptance of the Work."
},
{
"field": "OR###center####"
},
{
"field": "(d) All payments are subject to a hold back of an amount equal to ${percentage_bill_on_finalReport::textinput::Type here}% of the amount billed. The hold back shall be paid upon the submission and acceptance of the final report and completion of the work."
}
],
"definitions": {
"list": "agreement;contractor;fiscal_year;government;parties",
"title": "Definitions",
"sub_title": "In this Agreement, the following definitions apply:"
},
"convenants-contractor": [
{
"title": "Covenants of the Contractor and Government"
},
{
"field": "The Contractor shall perform the services, assume all those responsibilities and diligently execute all those duties described in the attached Schedule \"A\" (the \"Work\"), in a manner satisfactory to Government."
},
{
"field": "(a) Subject to the termination clause contained in the Termination section of this Agreement, the term of this Agreement shall commence on ${commence-start-date::calander::dateformat1}, and end on ${commence-end-date::calander::dateformat1} (the \"Term\")."
},
{
"field": "(b) Subject to the termination clause contained in the Termination section of this Agreement and notwithstanding the date of signing of this Agreement, it is acknowledged by both Parties that the Contractor commenced the performance of the Work on ${agreenment-date::calander::dateformat1}. It is further agreed that the amount of $ ${maximum-total-amount::textinput::Type here} is the maximum amount to be paid for the Work and includes all amounts which may be owed for the Work done since ${work-start-date::calander::dateformat1}."
}
],
"conditions-of-agreement": {}
},
"head": {
"id": "default-contract-template-itss",
"code": "default-contract-template-itss",
"title": "Default ITSS Contract Template",
"version": "1.0"
}
}'),
('previous-process-control-sheet', '{
"body": {
"header": [
{
"code": "contract-title",
"field": "TITLE OF THE CONTRACT: ${contract-title::textinput::Type Here. Provide a descriptive title and ensure it matches the title on the contract document}"
},
{
"code": "vender-name",
"field": "VENDOR NAME: ${vendor-name::dropdownlist::VVV:codetable:vendor}",
"requirement": "${verified::checkbox}I verified that the vendor is registered to do business on PEI (Registry${registry-link::link::https://www.princeedwardisland.ca/en})"
},
{
"code": "start-end-date",
"field": "START DATE: ${start-date::calander::Type Here} END DATE: ${start-date::calander::Type Here}"
},
{
"code": "contract-summary",
"field": "CONTRACT SUMMARY: ${contract-summary::textarea::The summary is meant to be a description, in layman’s terms, of what the vendor will provide to government within this contract. It is intended to brief executive leadership about the contract. It should be summarized in 3-4 sentences.}"
},
{
"code": "contract-type",
"field": "CONTRACT TYPE: ${contract-type::dropdownlist::VVV:codetable:contract_type}"
},
{
"code": "amendment-no",
"field": "Amendment No: ${amendment-no::textinput::Type here}"
},
{
"code": "contract-value",
"field": "TOTAL CONTRACT VALUE: $ ${totalvalue::textinput::Type here}",
"requirement": "Value/Year (if multi-year, add as needed): 2018-2019: $ ${value-20182019::textinput::Type here} 2019-2020: $ ${value-20192020::textinput::Type here} 2020-2021: $ ${value-20202021::textinput::Type here}"
},
{
"code": "history-contract-value",
"field": "HISTORICAL CONTRACT VALUE",
"requirement": "Add Previous Years if same scope of work: 2016-2017: $ ${value-20162017::textinput::Type here} 2017-2018: $ ${value-20172018::textinput::Type here}"
},
{
"code": "associated-tb-ec",
"field": "List associated TB/EC decision#, if applicable ${associated-tb-ec::textinput::Type here}"
},
{
"code": "contract-notes",
"field": "CONTRACT NOTES: ${contract-notes::textarea::Type here If there are any notes to be highlighted regarding increases in costs, or other relevant notes – please add that detail here}"
},
{
"code": "vender-selected-by",
"field": "Vendor Selected by: ${vender-selected-by::dropdownlist::VVV:codetable:vender_selected_by}"
},
{
"code": "background-documentation",
"field": "Background Documentation: ${background-doc::checkbox::Used standard template with no changes, Legal Review Notes Attached, Risk Review Notes Attached, The Contract Review Checklist was completed and is included in the contract package (available on Alfresco)}"
},
{
"code": "contract-management-items",
"field": "Ongoing Follow-up Required: ${ongoing-required::textarea::Identify any conditions in the contract ie reporting dates, multiple payment dates, or credit reviews that needs to be reviewing during the life of the contract}",
"requirement": "Option to Extend: ${option-extend::textarea::Identify any option to extend the contract and provide a note on extension details}"
},
{
"code": "contract-management-items",
"field": "BUDGET SECTION CODES: ${budegt-section::textarea::Section} ${budegt-object::textarea::Object} ${budegt-program::textarea::Program} ${budegt-project::textarea::Project} ${budegt-contract-no::textarea::Contract #} ",
"notes": "Authors should confirm budget codes with Manager/Director Contract# is provided by SCC and is required to be referenced in the SOW"
}
]
},
"head": {
"id": "previous-process-control-sheet",
"code": "previous-process-control-sheet",
"title": "Previous Process Control Sheet",
"version": "1.0"
}
}');
| true
|
873725be826c1397886d8e51ac46bbc5a33a2519
|
SQL
|
cavigna/modulo_lenguaje_de_consultas_a_una_base_de_datos
|
/Clase 36 - Examen/Proceso/movies_1.1.sql
|
UTF-8
| 6,246
| 2.78125
| 3
|
[
"MIT"
] |
permissive
|
--Peliculas
INSERT INTO pelicula(nombre, año, duracion, presupuesto, recaudacion, idioma, pais)
VALUES
('The Matrix', 1999, 138, 63000000, 465000000, 'Ingles', 'USA'),
('Hero', 2002, 119, 85000000, 29980000, 'Chino', 'China'),
('Memento', 2000, 113, 90000000, 39723096, 'Ingles', 'USA'),
('Captain fantastic',2016, 118, 5000000, 22000000, 'Ingles', 'USA'),
('Inception', 2010, 148, 160000000, 825532764, 'Ingles', 'USA'),
('Snatch', 2000, 99, 10000000, 83600000, 'Ingles', 'UK'),
('Two smoking barrels', 1998, 105, 1400000, 28000000, 'Ingles', 'UK'),
('John Wick', 2014, 114, 20000000, 86013268, 'Ingles', 'USA'),
('El señor de los anillos', 2001, 178, 93000000, 870761744, 'Ingles', 'NZ'),
('9 reinas', 2000, 115, 1300000, 12413888, 'Español', 'Argentina'),
('El secreto de sus ojos', 2009, 129, 2000000, 35079650, 'Español', 'Argentina'),
('The Dark Knight', 2008, 152, 185000000, 1004558444,'Ingles','UK'),
('V for Vendetta', 2005, 132, 54000000, 425511035, 'Ingles', 'USA'),
('La casa de las dagas voladoras', 2004, 119, 30000000, 50000000, 'Chino', 'China'),
('The Wolf of Wall Street', 2013, 180, 100000000, 392000694, 'Ingles', 'USA'),
('The Curious Case of Benjamin Button', 2008, 116, 150000000, 333932083, 'Ingles','USA'),
('What We Do In The Shadows', 2014, 86, 1600000, 7253160, 'Ingles', 'NZ');
-- Director
INSERT INTO director(nombre, apellido, fecha_nacimiento, genero, pais)
VALUES
('Lana', 'Wachowski', '1965-04-21', 'f', 'USA'),
('Lily', 'Wachowski', '1967-12-29', 'f', 'USA'),
('Zhang', 'Yimou', '1951-11-14', 'm', 'China'),
('Christopher', 'Nolan', '1970-07-30', 'm', 'UK'),
('Matt', 'Ross', '1970-01-03', 'm', 'USA'),
('Guy', 'Ritchie', '1968-09-10', 'm', 'UK'),
('Chad', 'Stahelski', '1968-09-20', 'm', 'USA'),
('Peter', 'Jackson', '1961-10-31', 'm', 'NZ'),
('Fabian', 'Bielinsky', '1959-02-03','m', 'Argentina'),
('Juan José', 'Campanella', '1959-07-19', 'm', 'Argentina'),
('Martin', 'Scorsese', '1942-11-17','m', 'USA'),
('David', 'Fincher', '1962-08-28', 'm', 'USA'),
('Taika', 'Waititi', '1975-08-16', 'm', 'NZ'),
('Jemaine', 'Clement', '1974-01-10', 'm', 'NZ');
--Actor/Actriz
INSERT INTO actor(nombre, apellido, fecha_nacimiento, genero, pais)
VALUES
('Ricardo', 'Darin', '1957-01-16', 'm', 'Argentina'),
('Gastón', 'Pauls', '1972-01-17', 'm', 'Argentina'),
('Guillermo', 'Francella', '1955-02-14', 'm', 'Argentina'),
('Keanu', 'Reves', '1964-09-02', 'm', 'USA'),
('Carrie-Anne', 'Moss','1967-08-21', 'f', 'Canada'),
('Viggo', 'Mortensen', '1958-10-20', 'm','USA'),
('Jet', 'Li', '1963-04-26', 'm', 'China'),
('Guy', 'Pearce', '1967-10-05', 'm', 'UK'),
('Joe', 'Pantoliano', '1951-09-12', 'm','USA'),
('Leonardo', 'DiCaprio','1974-11-11', 'm','USA'),
('Jason', 'Statham', '1966-07-26', 'm', 'UK'),
('Micael', 'Cane', '1933-03-14', 'm', 'UK'),
('Hugo', 'Weaving','1960-04-04', 'm', 'UK'),
('Elijah', 'Wood', '1981-01-28', 'm','USA'),
('Brad', 'Pitt', '1963-12-17', 'm','USA'),
('Christian', 'Bale', '1974-01-30', 'm', 'UK'),
('Ziyi', 'Zhang', '1979-02-09', 'f', 'China'),
('Natalie', 'Portman', '1981-07-09', 'f', 'USA'),
('Cate', 'Blanchet', '1969-05-14', 'f', 'Australia'),
('Taika', 'Waititi', '1975-08-16', 'm', 'NZ'),
('Jemaine', 'Clement', '1974-01-10', 'm', 'NZ');
--Criticos
INSERT INTO critico(nombre)
VALUES
('IMDB'),
('Film Affinity'),
('Ignacio Cavallo');
--Calificación por película
INSERT INTO puntaje(idPelicula, idCritico, calificacion)
VALUES
(1, 1, 8.7), (1, 2, 7.9), (1, 3, 8.5),
(2, 1, 7.9), (2, 2, 7.3), (2, 3, 8.2),
(3, 1, 7.4), (3, 2, 7.9), (3, 3, 9.0),
(4, 1, 7.9), (4, 2, 7.5), (4, 3, 8.7),
(5, 1, 8.8), (5, 2, 8.0), (5, 3, 8.8),
(6, 1, 8.3), (6, 2, 7.9), (6, 3, 9.0),
(7, 1, 8.2), (7, 2, 7.8), (7, 3, 7.2),
(8, 1, 7.4), (8, 2, 6.3), (8, 3, 6.3),
(9, 1, 8.8), (9, 2, 8.0), (9, 3, 8.1),
(10, 1, 7.9), (10, 2, 7.8), (10, 3, 8.2),
(11, 1, 8.2), (11, 2, 8.1), (11, 3, 8.4),
(12, 1, 9.0), (12, 2, 8.1), (12, 3, 9.2),
(13, 1, 8.1), (13, 2, 7.5), (13, 3, 6.6),
(14, 1, 6.9), (14, 2, 7.0), (14, 3, 5.9),
(15, 1, 8.2), (15, 2, 7.6), (15, 3, 8.1),
(16, 1, 7.8), (16, 2, 7.2), (16, 3, 7.9),
(17, 1, 7.7), (17, 2, 6.8), (17, 3, 7.2);
--Genero
INSERT INTO genero(genero)
VALUES
('Acción'),
('Animación'),
('Ciencia Ficción'),
('Comedia'),
('Drama'),
('Documental'),
('Suspenso'),
('Terror');
-- Genero de la Pelicula
INSERT INTO genero_pelicula(idPelicula, idGenero)
VALUES
(1, 1), (1, 3),
(2, 1), (2, 5),
(3, 1), (3, 7),
(4, 1), (4, 4),
(5, 1), (5, 3),
(6, 1), (6, 4),
(7, 1), (7, 4),
(8, 1), (8, 3),
(9, 1), (9, 3),
(10, 5), (10, 7),
(11, 5), (11, 7),
(12, 1), (12, 3),
(13, 1), (13, 3),
(14, 1), (14, 5),
(15, 4), (15, 5),
(16, 3), (16, 5),
(17, 4), (17, 6);
-- Personajes
INSERT INTO personaje(idPelicula, idActor, nombre_personaje)
VALUES
(1, 4, 'Neo'), (1, 5, 'Trinity'), (1, 9, 'Cypher'), (1, 13, 'Agente Smith'),
(2, 7, 'Nameless'), (2, 17, 'Moon'),
(3, 8, 'Leonard Shelby'), (3, 5, 'Natalie'),
(3, 9, 'Teddy Gammel'),
(4, 6, 'Ben'),
(5, 10, 'Dominick Cobb'), (5, 12, 'Miles'),
(6, 11, 'Turco'), (6, 15, 'Mickey'),
(7, 11, 'Bacon'),
(8, 4, 'John Wick'),
(9, 14, 'Frodo Baggins'), (9, 6, 'Aragon'), (9, 19, 'Galadriel'), (9, 13, 'Elrond'),
(10, 1, 'Marcos'), (10, 2, 'Juan'),
(11, 1, 'Bejamín Espósito'), (11, 3, 'Pablo Sandoval'),
(12, 16, 'Batman'), (12, 12, 'Alfred'),
(13, 13, 'V'), (13, 18, 'Evey Hammond'),
(14, 17, 'Xiao Mei'),
(15, 10, 'Jordan Belfort'),
(16, 15, 'Benjamin Button'), (16, 19, 'Daisy Fuller'),
(17, 20, 'Viago'), (17, 21, 'Vladislav');
-- Dirección | pelicula dirigida por
INSERT INTO direccion(idPelicula, idDirector)
VALUES
(1, 1), (1, 2),
(2, 2),
(3, 4),
(4, 5),
(5, 4),
(6, 6),
(7, 6),
(8, 7),
(9, 8),
(10, 9),
(11, 10),
(12, 4),
(13, 1),
(14, 3),
(15, 11),
(16, 12),
(17, 13),
(17, 14);
-- 1 - Matrix
-- 2 - Hero
-- 3 - Memento
-- 4 - Captain fantastic
-- 5 - Inception
-- 6 - Snatch
-- 7 - 2 smoking barrels
-- 8 - John Wick
-- 9 - lor
-- 10 - 9 reinas
-- 11- el secreto de sus ojos
-- 12 - Batman
-- 13 - Vendetta
-- 14 - casa de dagas
-- 15 - the Wolf of Wall
-- 16 - benjamin
-- 17 - what whe do in the shados
| true
|
f3213416003896c785f66d3e546be19140d88121
|
SQL
|
KKubala/DataBases
|
/Lista3/lista3.sql
|
UTF-8
| 1,414
| 4.125
| 4
|
[] |
no_license
|
--Kamila Kubala, Pwi
--Zadanie 1
CREATE VIEW ranking
(displayname, liczba_odpowiedzi)
AS
SELECT u.displayname, COUNT(b.id)
FROM posts a
JOIN posts b ON (a.acceptedanswerid = b.id)
JOIN users u ON (u.id = b.owneruserid)
GROUP BY 1
ORDER BY 2 DESC, 1;
-- Zadanie 2
WITH user_with_enl AS
(SELECT DISTINCT userid
FROM badges
WHERE name='Enlightened')
SELECT AVG(u.upvotes)
FROM users u
JOIN user_with_enl uwe
ON (u.id = uwe.userid);
-- srednia to 171.2439024390243902
-- teraz mozemy ja wykorzystac
WITH bezodznaki AS
((SELECT id FROM users)
EXCEPT
(SELECT userid FROM badges
WHERE name='Enlightened')),
kom2020 AS
(SELECT DISTINCT u.id, COUNT(c.id) AS licz
FROM users u
JOIN comments c ON (u.id =c.userid)
WHERE c.creationdate >= '01-01-2020 00:00:00'
GROUP BY 1)
SELECT u.id, u.displayname, u.reputation
FROM bezodznaki b
JOIN users u ON (b.id = u.id)
JOIN kom2020 k ON (k.id = u.id)
WHERE k.licz>1
AND
u.upvotes > 171
GROUP BY 1,2,3, u.creationdate
ORDER BY u.creationdate;
--zadanie 3
WITH RECURSIVE recurrence AS (
SELECT u.id u_id, u.displayname, p.id
FROM users u
JOIN posts p ON (p.owneruserid = u.id)
WHERE p.body LIKE '%recurrence%'
UNION
SELECT u.id, u.displayname, p.id
FROM users u
JOIN comments c ON (u.id = c.userid)
JOIN posts p ON(c.postid = p.id)
JOIN recurrence r ON(p.owneruserid= r.u_id)
)
SELECT DISTINCT u_id, displayname FROM recurrence;
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.