text stringlengths 6 9.38M |
|---|
ALTER TABLE `sys_user` MODIFY `password` TEXT NULL;
|
# MySQL dump 8.14
#
# Host: localhost Database: dmerce_gt_shop
#--------------------------------------------------------
# Server version 3.23.39
#
# Table structure for table 'AdditionalFields'
#
CREATE TABLE AdditionalFields (
ID int(11) NOT NULL default '0',
CreatedDateTime double(16,6) NOT NULL default '0.000000',
ChangedDateTime double(16,6) NOT NULL default '0.000000',
CreatedBy int(11) NOT NULL default '0',
ChangedBy int(11) NOT NULL default '0',
active int(11) NOT NULL default '1',
Name varchar(255) NOT NULL default '',
PRIMARY KEY (ID)
) TYPE=ISAM PACK_KEYS=1;
#
# Dumping data for table 'AdditionalFields'
#
#
# Table structure for table 'Agent'
#
CREATE TABLE Agent (
ID int(11) NOT NULL default '0',
CreateDateTime double(16,4) NOT NULL default '0.0000',
CreatedBy int(11) NOT NULL default '0',
ChangedDateTime double(16,4) default NULL,
ChangedBy int(11) NOT NULL default '0',
active int(1) NOT NULL default '1',
LastName varchar(255) NOT NULL default '',
FirstName varchar(255) NOT NULL default '',
Email varchar(255) NOT NULL default '',
Login varchar(255) NOT NULL default '',
passwd varchar(10) NOT NULL default '',
LoginDisabled int(1) NOT NULL default '0',
KEY ID (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'Agent'
#
#
# Table structure for table 'Article'
#
CREATE TABLE Article (
ID int(11) NOT NULL default '0',
CreatedDateTime double(16,6) NOT NULL default '0.000000',
ChangedDateTime double(16,6) NOT NULL default '0.000000',
CreatedBy int(11) NOT NULL default '0',
ChangedBy int(11) NOT NULL default '0',
active int(11) NOT NULL default '1',
HeadNavID int(11) NOT NULL default '0',
SubNavID int(11) NOT NULL default '0',
ArtNo varchar(200) NOT NULL default '',
Name text NOT NULL,
ShortDescription text NOT NULL,
DetailDescription text NOT NULL,
PriceNet float(10,2) NOT NULL default '0.00',
TaxRate float(10,2) NOT NULL default '0.00',
PriceGross float(10,2) NOT NULL default '0.00',
ClassOfGoodsID int(11) NOT NULL default '0',
Highlight int(1) NOT NULL default '0',
New int(1) NOT NULL default '0',
SpecialOffer int(1) NOT NULL default '0',
SpecialOfferFrom double(16,6) NOT NULL default '0.000000',
SpecialOfferTill double(16,6) NOT NULL default '0.000000',
SpecialOfferPercent float(10,2) NOT NULL default '0.00',
Picture varchar(255) NOT NULL default '',
Width float(10,2) NOT NULL default '0.00',
Height float(10,2) NOT NULL default '0.00',
Depth float(10,2) NOT NULL default '0.00',
Weight varchar(11) NOT NULL default '0.000',
Producer varchar(255) NOT NULL default '',
AddFieldsName1 varchar(255) NOT NULL default '',
AddFieldsVal1 varchar(255) NOT NULL default '',
AddFieldsName2 varchar(255) NOT NULL default '',
AddFieldsVal2 varchar(255) NOT NULL default '',
AddFieldsName3 varchar(255) NOT NULL default '',
AddFieldsVal3 varchar(255) NOT NULL default '',
AddFieldsName4 varchar(255) NOT NULL default '',
AddFieldsVal4 varchar(255) NOT NULL default '',
AddFieldsName5 varchar(255) NOT NULL default '',
AddFieldsVal5 varchar(255) NOT NULL default '',
PRIMARY KEY (ID)
) TYPE=ISAM PACK_KEYS=1;
#
# Dumping data for table 'Article'
#
#
# Table structure for table 'ArticlePicture'
#
CREATE TABLE ArticlePicture (
ID int(11) NOT NULL default '0',
CreatedDateTime double(16,6) NOT NULL default '0.000000',
CreatedBy int(11) NOT NULL default '0',
ChangedDateTime double(16,6) NOT NULL default '0.000000',
ChangedBy int(11) NOT NULL default '0',
active int(1) NOT NULL default '1',
Name varchar(255) NOT NULL default '',
Picture varchar(255) NOT NULL default '',
ArticleID int(11) NOT NULL default '0',
Description text NOT NULL
) TYPE=MyISAM;
#
# Dumping data for table 'ArticlePicture'
#
#
# Table structure for table 'BasketContents'
#
CREATE TABLE BasketContents (
ID int(11) NOT NULL default '0',
CreatedDateTime double(16,6) NOT NULL default '0.000000',
CreatedBy int(11) NOT NULL default '0',
ChangedDateTime double(16,6) NOT NULL default '0.000000',
ChangedBy int(11) NOT NULL default '0',
active int(1) NOT NULL default '0',
SessionId varchar(200) NOT NULL default '',
ArtID int(11) NOT NULL default '0',
Qty float(10,2) NOT NULL default '0.00',
PriceNet float(10,2) NOT NULL default '0.00',
TaxRate float(10,2) NOT NULL default '0.00',
PriceGross float(10,2) NOT NULL default '0.00',
SpecialOffer int(1) NOT NULL default '0',
SpecialOfferPercent float(10,2) NOT NULL default '0.00'
) TYPE=MyISAM;
#
# Dumping data for table 'BasketContents'
#
#
# Table structure for table 'ClassOfGoods'
#
CREATE TABLE ClassOfGoods (
ID int(11) NOT NULL default '0',
CreatedDateTime double(16,6) NOT NULL default '0.000000',
ChangedDateTime double(16,6) NOT NULL default '0.000000',
CreatedBy int(11) NOT NULL default '0',
ChangedBy int(11) NOT NULL default '0',
active int(11) NOT NULL default '1',
Name varchar(255) NOT NULL default '',
PRIMARY KEY (ID)
) TYPE=ISAM PACK_KEYS=1;
#
# Dumping data for table 'ClassOfGoods'
#
#
# Table structure for table 'Contact'
#
CREATE TABLE Contact (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
FirstName int(1) NOT NULL default '0',
Street int(1) NOT NULL default '0',
ZipCode int(1) NOT NULL default '0',
Phone int(1) NOT NULL default '0',
Fax int(1) NOT NULL default '0',
Wish int(1) NOT NULL default '0',
Offer int(1) NOT NULL default '0',
Other int(1) NOT NULL default '0',
Picture varchar(255) NOT NULL default '',
Email varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'Contact'
#
#
# Table structure for table 'Contactwish'
#
CREATE TABLE Contactwish (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
Name varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'Contactwish'
#
#
# Table structure for table 'HeadNav'
#
CREATE TABLE HeadNav (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
WordlistID int(11) NOT NULL default '0',
TextID int(11) NOT NULL default '0',
NameDE varchar(255) NOT NULL default '',
Name_en varchar(255) NOT NULL default '',
Name_es varchar(255) NOT NULL default '',
Name_fr varchar(255) NOT NULL default '',
Name_it varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'HeadNav'
#
#
# Table structure for table 'Imprintfields'
#
CREATE TABLE Imprintfields (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
Name varchar(255) NOT NULL default '',
Value varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'Imprintfields'
#
#
# Table structure for table 'Layout'
#
CREATE TABLE Layout (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
ShortDescription varchar(255) NOT NULL default '',
Description longtext NOT NULL,
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'Layout'
#
#
# Table structure for table 'Navigation'
#
CREATE TABLE Navigation (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
WordlistID int(11) NOT NULL default '0',
TextarticleID int(11) NOT NULL default '0',
NameDE varchar(255) NOT NULL default '',
Name_en varchar(255) NOT NULL default '',
Name_fr varchar(255) NOT NULL default '',
Name_es varchar(255) NOT NULL default '',
Name_it varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'Navigation'
#
#
# Table structure for table 'Operator'
#
CREATE TABLE Operator (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
Company varchar(255) NOT NULL default '',
ShowCompany int(1) NOT NULL default '0',
LastName varchar(255) NOT NULL default '',
ShowLastName int(1) NOT NULL default '0',
FirstName varchar(255) NOT NULL default '',
ShowFirstName int(1) NOT NULL default '0',
Street varchar(255) NOT NULL default '',
ShowStreet int(1) NOT NULL default '0',
ZipCode varchar(255) NOT NULL default '',
ShowZipCode int(1) NOT NULL default '0',
City varchar(255) NOT NULL default '',
ShowCity int(1) NOT NULL default '0',
Country varchar(255) NOT NULL default '',
ShowCountry int(1) NOT NULL default '0',
Phone varchar(255) NOT NULL default '',
ShowPhone int(1) NOT NULL default '0',
Fax varchar(255) NOT NULL default '',
ShowFax int(1) NOT NULL default '0',
Mobile varchar(255) NOT NULL default '',
ShowMobile int(1) NOT NULL default '0',
Email varchar(255) NOT NULL default '',
ShowEmail int(1) NOT NULL default '0',
Url varchar(255) NOT NULL default '',
ShowUrl int(1) NOT NULL default '0',
Textfield longtext NOT NULL,
ShowTextfield int(1) NOT NULL default '0',
Picture varchar(255) NOT NULL default '',
Head varchar(255) NOT NULL default '',
LayoutID int(11) NOT NULL default '0',
Logo varchar(255) NOT NULL default '',
Headtext varchar(255) NOT NULL default '',
HeadFontface varchar(255) NOT NULL default '',
HeadFontsize varchar(255) NOT NULL default '',
UnderConstruction int(1) NOT NULL default '0',
UndConstText text NOT NULL,
UndConstPic varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY ID_2 (ID),
FULLTEXT KEY Mobile (Mobile)
) TYPE=MyISAM;
#
# Dumping data for table 'Operator'
#
#
# Table structure for table 'OrderInfo'
#
CREATE TABLE OrderInfo (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,6) NOT NULL default '0.000000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,6) NOT NULL default '0.000000',
active int(1) NOT NULL default '0',
FirstName varchar(255) NOT NULL default '',
LastName varchar(255) NOT NULL default '',
Street varchar(100) NOT NULL default '',
ZipCode varchar(10) NOT NULL default '',
City varchar(255) NOT NULL default '',
Phone varchar(255) NOT NULL default '',
Telefax varchar(255) NOT NULL default '',
Mobile varchar(255) NOT NULL default '',
Email varchar(255) NOT NULL default '',
TermsOfPayment varchar(255) NOT NULL default '',
SessionId varchar(255) NOT NULL default '',
BasketSum float(16,2) NOT NULL default '0.00',
Comment text NOT NULL,
URL varchar(255) NOT NULL default '',
PRIMARY KEY (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'OrderInfo'
#
#
# Table structure for table 'SubNav'
#
CREATE TABLE SubNav (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
HeadNavID int(11) NOT NULL default '0',
NameDE varchar(255) NOT NULL default '',
Name_en varchar(255) NOT NULL default '',
Name_fr varchar(255) NOT NULL default '',
Name_es varchar(255) NOT NULL default '0',
Name_it varchar(255) NOT NULL default '',
TextID int(11) NOT NULL default '0',
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'SubNav'
#
#
# Table structure for table 'Subnavigation'
#
CREATE TABLE Subnavigation (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
NavigationID int(11) NOT NULL default '0',
TextarticleID int(11) NOT NULL default '0',
RelatedTextarticleID int(11) NOT NULL default '0',
NameDE varchar(255) NOT NULL default '',
Name_en varchar(255) NOT NULL default '',
Name_fr varchar(255) NOT NULL default '',
Name_es varchar(255) NOT NULL default '',
Name_it varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'Subnavigation'
#
#
# Table structure for table 'TermsOfPayment'
#
CREATE TABLE TermsOfPayment (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime double(16,6) NOT NULL default '0.000000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime double(16,6) NOT NULL default '0.000000',
active int(1) NOT NULL default '1',
Name varchar(255) NOT NULL default ''
) TYPE=MyISAM;
#
# Dumping data for table 'TermsOfPayment'
#
#
# Table structure for table 'Textarticle'
#
CREATE TABLE Textarticle (
ID int(11) NOT NULL auto_increment,
ChangedDateTime double(16,6) NOT NULL default '0.000000',
CreatedDateTime double(16,6) NOT NULL default '0.000000',
CreatedBy int(11) NOT NULL default '1',
ChangedBy int(11) NOT NULL default '1',
NavigationID int(11) NOT NULL default '0',
SubnavID int(11) NOT NULL default '0',
TextarticleGroup int(11) NOT NULL default '0',
Head varchar(255) NOT NULL default '',
Subhead varchar(255) NOT NULL default '',
Excerpt text,
Text longtext,
active int(1) NOT NULL default '1',
Date float(16,4) NOT NULL default '0.0000',
Picture varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY active (active)
) TYPE=MyISAM;
#
# Dumping data for table 'Textarticle'
#
#
# Table structure for table 'Wordlist'
#
CREATE TABLE Wordlist (
ID int(11) NOT NULL default '0',
CreatedBy int(11) NOT NULL default '0',
CreatedDateTime float(16,4) NOT NULL default '0.0000',
ChangedBy int(11) NOT NULL default '0',
ChangedDateTime float(16,4) NOT NULL default '0.0000',
active int(1) NOT NULL default '0',
NameDE varchar(255) NOT NULL default '',
Name_en varchar(255) NOT NULL default '',
Name_fr varchar(255) NOT NULL default '',
Name_es varchar(255) NOT NULL default '',
Name_it varchar(255) NOT NULL default '',
PRIMARY KEY (ID),
KEY ID_2 (ID)
) TYPE=MyISAM;
#
# Dumping data for table 'Wordlist'
#
|
/*SELECT c.* FROM Clientes c
JOIN Pedidos p
ON p.ID_Cliente = c.ID;
SELECT p.* FROM Clientes c
JOIN Pedidos p
ON p.ID_Cliente = c.ID;
SELECT * FROM Clientes c
JOIN Pedidos p
ON p.ID_Cliente = c.ID;*/
SELECT c.nome, COUNT(p.ID) FROM Clientes c
JOIN Pedidos p
ON p.ID_Cliente = c.ID
WHERE c.NOME = 'Biga Bigode'
GROUP BY p.ID_Cliente;
|
Sybase字符串函数
2006-08-18 17:25
cast(c_userid as varchar)
cast(slje as float)
datalength(char_expr)
在char_expr中返回字符的长度值,忽略尾空
substring(expression,start,length)
返回部分字符串
right(char_expr,int_expr)
返回char_expr右边的int_expr字符
基本字符串运算
upper(char_expr)
把char_expr转换成大写形式
lower(char_expr)
把char_expr转换成小写形式
space(int_expr)
生成有int_expr个空格的字符串
replicate(char_expr,int_expr)
重复char_expr,int_expr次
stuff(expr1,start,length,expr2)
用expr2代替epxr1中start起始长为length的字符串
reverse(char_expr)
反写char_expr中的文本
ltrim(char_expr)
删除头空
rtrim(char_expr)
删除尾空
格式转换
ascii(char_expr)
返回char_expr中第一个字符的ASCII值
char(int_expr)
把ASCII码转换为字符
str(float_expr[,length[,decimal]])
进行数值型到字符型转换
soundex(char_expr)
返回char_expr的soundex值
difference(char_expr1,char_expr2)
返回表达式soundex值之差
串内搜索
charindex(char_expr,expression)
返回指定char_expr的开始位置,否则为0
patindex("%pattern%",expression)
返回指定样式的开始位置,否则为0
datalength用于确定可变字符串的长度
soundex用于确定字符串是否发音相似
difference返回0-4之间的值,0表示最不相似,4表示最相似
通配符
% 匹配任何数量的字符或无字符
_ 匹配任何单个字符(空间占位符)
[] 规定有效范围,或某个"OR"条件
[ABG] A,B,G
[A-C] A,B,C
[A-CE-G] A,B,C,E,F,G
[^ABG] 除了A,B,G
[^A-C] 除了A,B,C
escape子句
用某个转义字符可在搜索字符串时将通配符作为文字来包含。
ANSI-89 SQL 标准定义了escape子句指定某个转义字符
缺省情况下,[]来转义某个通配符,例:
select * from test_tab
where description like "%20[%]%"
语法:
like char_expression escape escape_character
例
select * from test_tab
where description like "%20#%%" escape "#"
+ 可用于串接字符
select au_laname+","+au_fname from authors
数学函数
abs(numeric_expr)
返回指定值的绝对值
ceiling(numeric_expr)
返回大于或等于指定值的最小整数
exp(float_expr)
给出指定值的指数值
floor(numeric_expr)
返回小于或等于指定值的最大整数
pi()
返回常数3.1415926
power(numeric_expr,power)
返回numeric_expr的值给power的幂
rand([int_expr])
返回0-1之间的随机浮点数,可指定基值
round(numeric_expr,int_expr)
把数值表达式圆整到int_expr指定的精度
sign(int_expr)
返回正+1,零0或负-1
sqrt(float_expr)
返回指定值的平方根
SQL SERVER 支持所有标准的三角函数和其他有用的函数
日期函数
getdate()
返回当前的系统日期和时间
datename(datepart,date_expr)
以字符串形式返回date_expr指定部分的值,转换成合适的名字
datepart(datepart,date_expr)
作为整数返回date_expr值的指定部分
datediff(datepart,date_expr1,date_expr2)
返回date_expr2-date_expr1,通过指定的datepart度量
dateadd(datepart,number,date_expr)
返回日期,通过在date_expr上增加指定number的日期部件而产生的
datepart
日期部件 缩写 值范围
年 yy 1753-9999
季度 qq 1-4
月 mm 1-12
每年中的天 dy 1-366
天 dd 1-31
星期 wk 1-54
星期天 dw 1-7(1=sunday)
小时 hh 0-23
分钟 mi 0-59
秒 ss 0-59
毫秒 ms 0-999
例:
select invoice_no,
datediff(dd,date_shipped,getdate())
from invoices
where balance_due>0
转换函数convert
此函数把值从一种类型改变成另一种类型
convert(datetype [(length)],expression)
select "Advance="+convert(char(12),advance)
from titles
日期转换
convert(datetype[(length)],expression,format)
format指定将日期转换为什么格式,有以下值:
没有世纪 有世纪 转换字符串中日期格式
0 or 100 mon dd yyy hh:miAM(or PM)
1 101 mm/dd/yy
2 102 yy.mm.dd
3 103 dd/mm/yy
4 104 dd.mm.yy
5 105 dd-mm-yy
6 106 dd mon yy
7 107 mon dd,yy
8 108 hh:mm:ss
9 or 109 mon dd,yyyy hh:mi:ss:mmmAM(or PM)
10 110 mm-dd-yy
11 111 yy/mm/dd
12 112 yymmdd
系统函数
函数 定义
访问和安全性信息
host_id() 客户进程的当前主机进程ID号
host_name() 客户进程的当前主计算机名
suser_id(["login_name"]) 用户的SQL Server ID号
suser_name([server_user_id]) 用户的SQL Server登录名
user_id(["name_in_db"]) 用户在数据库 中的ID号
user_name([user_id]) 用户在数据库中的名字
user 用户在数据库中的名字
show_role() 用户的当前活动角色
数据库和对象信息
db_id(["db_name"]) 数据库ID号
db_name([db_id]) 数据库名
object_id("objname") 数据库对象ID号
object_name(obj_id]) 数据库对象号
col_name(obj_id,col_id) 对象的栏名
col_length("objname","colname") 栏的长度
index_col("objname",index_id,key#) 已索引的栏名
valid_name(char_expr) 若char_expr不是有效标识符,则返回0
数据函数
datalength(expression) 按字节返回expression的长度
tsequal(timestamp1,timestamp2) 比较时戳值,若时戳值不匹配,则返回出错消息
isnull()
isnull函数用指定的值代替查询栏或合计中的空值
例:
select avg(isnull(total_order,$0))
from invoices |
INSERT INTO gapi_configurations (id, config_key, config_value)
VALUES ('5ce8297c18549b0001c370c6', 'GAPI_REQUEST_LOGS_ERRORS_DURATION_DAYS', '90') |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 29, 2020 at 03:11 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `limon_eshikhon`
--
-- --------------------------------------------------------
--
-- Table structure for table `blog_post`
--
CREATE TABLE `blog_post` (
`id` int(11) NOT NULL,
`title` varchar(222) NOT NULL,
`description` text NOT NULL,
`image` text NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`status` varchar(10) NOT NULL,
`user_id` int(11) NOT NULL,
`menu_id` int(11) DEFAULT NULL,
`submenu_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `blog_post`
--
INSERT INTO `blog_post` (`id`, `title`, `description`, `image`, `created_at`, `status`, `user_id`, `menu_id`, `submenu_id`) VALUES
(1, '‘ভুল করে’ টেন্ডুলকারকে আউট দিয়েছিলেন তিনি', 'এক–দুই বছর নয়, টানা ২০ বছর আন্তর্জাতিক ক্রিকেট আম্পায়ারিং করেছেন স্টিভ বাকনর। ওয়েস্ট ইন্ডিয়ান ভদ্রলোক বছরের পর বছর ধরে সুনামের সঙ্গেই ম্যাচ পরিচালনা করেছেন। তা করতে গিয়ে যে কিছু ভুল করেননি এমন নয়। বাকনর তা স্বীকারও করেন। এই যেমন স্বীকার করলেন অন্তত দুবার ভারতীয় মহাতারকা শচীন টেন্ডুলকারকে আউট ঘোষণা করেছিলেন। ক্রিকেট ইতিহাসের অন্যতম সেরা আম্পায়ার বাকনর বললেন তিনিও মানুষ, আর মানুষ মাত্রই ভুল করে।', '../images/5.jpg', '2020-07-29 07:18:45', 'Cancel', 2, 1, 1),
(3, 'আজকের ‘আগুনে আংটি’ ৫০ বছর আগের পেলে-টোস্টাওদের জন্য', '১৯৭০ বিশ্বকাপের ব্রাজিল দল ইতিহাসের অন্যতম সেরা। কথাটা দ্ব্যর্থহীন কণ্ঠে বলার কারণ, কোনো বিবেচনাতেই পেলে-টোস্টাও-জেয়ারজিনহোদের সেই দল এর নিচে নামেনি। বরং মারিও জাগালোর সেই দল অনেকের বিচারেই বিশ্বকাপ ইতিহাসের সেরা। তাই প্রকৃতি মোটেই বেরসিক নয়। সময়ের কাজটা সময়েই করতে জানে। কীভাবে? সে কথাই বলছি।', '../images/3.jpg', '2020-07-29 07:18:49', 'Accept', 3, 1, 2),
(4, 'এভারটনে আটকে গেল লিভারপুল', 'রোববার এভারটনকে হারালেও লিভারপুলের লিগ শিরোপা জয়ের স্বপ্ন পূরণ হতো না। আরও একটি ম্যাচ জিততে হতো। কিন্তু তাই বলে ইংলিশ প্রিমিয়ার লিগের পয়েন্ট তালিকার ১২তম এভারটনকে হারাতে পারবে না ইয়ূর্গেন ক্লপের দল! ম্যাচটি গোলশূন্য ড্র করে পরিস্থিতি কিছুটা জটিলই করে তুলেছে তারা। পরের ম্যাচে ক্রিস্টাল প্যালেসের বিপক্ষে জিতলেও খুব একটা স্বস্তিতে থাকবে না লিভারপুল। ২ জুলাই যে তাদের প্রতিপক্ষ ম্যানচেস্টার সিটি। তবে সিটি তাদের পরের ম্যাচে বার্নলিকে হারাতে না পারলে ক্রিস্টাল প্যালেসের বিপক্ষে জয়ই ৩০ বছর পর লিভারপুলকে লিগ শিরোপা এনে দেবে।', '../images/6.jpg', '2020-07-29 07:19:13', 'Accept', 2, 3, 5);
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE `comments` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`user_name` varchar(20) NOT NULL,
`blog_id` int(11) NOT NULL,
`comments` varchar(1000) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `comments`
--
INSERT INTO `comments` (`id`, `user_id`, `user_name`, `blog_id`, `comments`) VALUES
(1, 2, 'Mahbubul Alam', 4, 'Hello 1'),
(2, 2, 'Mahbubul Alam', 3, 'Hello 2'),
(3, 2, 'Mahbubul Alam', 1, 'Hello 2'),
(5, 3, 'Limon Alam', 4, 'Hello 4'),
(6, 3, 'Limon Alam', 3, 'Hello 5'),
(7, 3, 'Limon Alam', 1, 'Hello 6'),
(8, 3, 'Limon Alam', 4, 'Hello World'),
(9, 2, 'Mahbubul Alam', 1, 'Hello World');
-- --------------------------------------------------------
--
-- Table structure for table `menu`
--
CREATE TABLE `menu` (
`id` int(11) NOT NULL,
`menu` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `menu`
--
INSERT INTO `menu` (`id`, `menu`) VALUES
(1, 'Crime'),
(2, 'Sports'),
(3, 'Entertainment'),
(4, 'International');
-- --------------------------------------------------------
--
-- Table structure for table `sub_menu`
--
CREATE TABLE `sub_menu` (
`id` int(11) NOT NULL,
`sub_menu` varchar(100) NOT NULL,
`menu_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `sub_menu`
--
INSERT INTO `sub_menu` (`id`, `sub_menu`, `menu_id`) VALUES
(1, 'BD Crime', 1),
(2, 'USA Crime', 1),
(3, 'BD Sports', 2),
(4, 'USA Sports', 2),
(5, 'BD Ent', 3),
(6, 'USA Ent', 3),
(7, 'BD', 4);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(4) NOT NULL,
`name` varchar(200) NOT NULL,
`email` varchar(100) NOT NULL,
`phone` varchar(20) NOT NULL,
`password` varchar(100) NOT NULL,
`reTypePassword` varchar(100) NOT NULL,
`role_id` tinyint(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `phone`, `password`, `reTypePassword`, `role_id`) VALUES
(1, 'Super Admin', 'admin@admin.com', '01918845404', 'e10adc3949ba59abbe56e057f20f883e', 'e10adc3949ba59abbe56e057f20f883e', 2),
(2, 'Mahbubul Alam', 'mahbub@gmail.com', '01945325673', '827ccb0eea8a706c4c34a16891f84e7b', '827ccb0eea8a706c4c34a16891f84e7b', 1),
(3, 'Limon Alam', 'limoninfoo@gmail.com', '01946326545', '827ccb0eea8a706c4c34a16891f84e7b', '827ccb0eea8a706c4c34a16891f84e7b', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `blog_post`
--
ALTER TABLE `blog_post`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `menu`
--
ALTER TABLE `menu`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sub_menu`
--
ALTER TABLE `sub_menu`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `blog_post`
--
ALTER TABLE `blog_post`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `menu`
--
ALTER TABLE `menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `sub_menu`
--
ALTER TABLE `sub_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
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 */;
|
insert into users (username,password,enabled) values ('user1@example.com','$2a$10$eRxVvyR3GMOZOcQSLoK3Q.IF4ukbPxx5FTYuUwzK7qzwXlb0Ugwne',1);
insert into users (username,password,enabled) values ('admin1@example.com','$2a$10$anAv1cEuUN7W4sFMgkIna.7W7B54Nhj/cwj/oVVl2JxGxJnIM8XAy',1);
insert into users (username,password,enabled) values ('user2@example.com','$2a$10$r6Fd6eh5lRY7q010A1ZuOOmU123Jdiyx86oux1HlF6oBzU6rfmKQ.',1);
insert into users (username,password,enabled) values ('disabled1@example.com','$2a$10$83Y6wszmZTrKWiSlRk5nNuB16IzlLSFaF0f9dHDV6olIrka31MTfG',0);
insert into users (username,password,enabled) values ('admin','$2a$10$ZJhTJg.84c9Psh.EZD7bE.LdYB6Sp8yM54QawnImHflPctE3NV102',1);
|
-- MySQL dump 10.13 Distrib 5.7.32, for Linux (x86_64)
--
-- Host: localhost Database: assetmis
-- ------------------------------------------------------
-- Server version 5.7.32
/*!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 `administrators`
--
DROP TABLE IF EXISTS `administrators`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `administrators` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(200) DEFAULT NULL,
`lastname` varchar(200) DEFAULT NULL,
`email` varchar(200) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`registered_on` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `administrators`
--
LOCK TABLES `administrators` WRITE;
/*!40000 ALTER TABLE `administrators` DISABLE KEYS */;
INSERT INTO `administrators` VALUES (1,'Gad','Ishimwe','gad@gmail.com','0726183050','MTIzNDU=','2021-03-10 23:47:38');
/*!40000 ALTER TABLE `administrators` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `asset_movement`
--
DROP TABLE IF EXISTS `asset_movement`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `asset_movement` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_id` int(11) DEFAULT NULL,
`employee_id` int(11) DEFAULT NULL,
`asset_id` int(11) DEFAULT NULL,
`booked_on` datetime DEFAULT NULL,
`given_on` datetime DEFAULT NULL,
`submitted_on` datetime DEFAULT NULL,
`location` varchar(40) DEFAULT NULL,
`status` varchar(30) DEFAULT NULL,
`quantity` int(11) DEFAULT '1',
`registered_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `asset_fk` (`asset_id`),
CONSTRAINT `asset_fk` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `asset_movement`
--
LOCK TABLES `asset_movement` WRITE;
/*!40000 ALTER TABLE `asset_movement` DISABLE KEYS */;
INSERT INTO `asset_movement` VALUES (1,0,17,7,'2021-03-14 00:00:00',NULL,NULL,'IPRC TUmba',NULL,12,'2021-03-14 23:06:49');
/*!40000 ALTER TABLE `asset_movement` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `assets`
--
DROP TABLE IF EXISTS `assets`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `assets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`names` varchar(140) NOT NULL,
`state` varchar(140) NOT NULL,
`description` varchar(255) NOT NULL,
`code` varchar(70) NOT NULL,
`serial_number` varchar(70) NOT NULL,
`type` varchar(70) NOT NULL,
`dept_id` int(11) DEFAULT NULL,
`registered_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `dpt_fk` (`dept_id`),
CONSTRAINT `dpt_fk` FOREIGN KEY (`dept_id`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `assets`
--
LOCK TABLES `assets` WRITE;
/*!40000 ALTER TABLE `assets` DISABLE KEYS */;
INSERT INTO `assets` VALUES (1,' VGA',' ssd',' double VGA used tosddsfsfs','5YIT-2000',' 2YMATE',' COMPUTER ACCESSORY',1,'2021-01-29 19:29:57'),(5,'Power cable','In use','For Desktop','TCT-PWC-012','PWC-0121','Cable',1,'2021-03-07 11:36:25'),(6,'printer','In use','for printing','p24535673','pr66547','printer',1,'2021-03-07 11:38:07'),(7,'Projector','In use','HD','PR001','PR-012','Projector',1,'2021-03-14 22:45:32');
/*!40000 ALTER TABLE `assets` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `classes`
--
DROP TABLE IF EXISTS `classes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `classes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`department` int(11) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`academic_year` varchar(20) DEFAULT NULL,
`registered_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `classdepartment` (`department`),
CONSTRAINT `classdepartment` FOREIGN KEY (`department`) REFERENCES `department` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `classes`
--
LOCK TABLES `classes` WRITE;
/*!40000 ALTER TABLE `classes` DISABLE KEYS */;
INSERT INTO `classes` VALUES (1,1,'Year II IS','2019-2020','2021-01-29 18:24:38'),(7,1,'3 ITB','2019-2020','2021-02-04 22:56:56'),(18,15,'3 A','2020-2021','2021-03-07 10:18:05'),(19,16,'1','2018-2019','2021-03-07 10:19:13'),(20,15,'2 D','2019-2020','2021-03-07 10:20:19'),(21,1,'3 x','2020-2021','2021-03-07 10:20:49');
/*!40000 ALTER TABLE `classes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `department`
--
DROP TABLE IF EXISTS `department`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `department` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`acronym` varchar(100) DEFAULT NULL,
`names` varchar(255) DEFAULT NULL,
`registered_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `department`
--
LOCK TABLES `department` WRITE;
/*!40000 ALTER TABLE `department` DISABLE KEYS */;
INSERT INTO `department` VALUES (1,'IT','Information Technology','2021-01-29 18:44:52'),(15,'RE','Renewable Energy','2021-02-05 00:39:30'),(16,'ETT','Electronic Telecommunication','2021-02-05 00:40:14');
/*!40000 ALTER TABLE `department` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `employee`
--
DROP TABLE IF EXISTS `employee`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `employee` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(200) DEFAULT NULL,
`lastname` varchar(200) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`role` varchar(50) NOT NULL,
`password` varchar(255) DEFAULT NULL,
`dept_id` int(11) DEFAULT NULL,
`registered_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `dept_fk` (`dept_id`),
CONSTRAINT `dept_fk` FOREIGN KEY (`dept_id`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `employee`
--
LOCK TABLES `employee` WRITE;
/*!40000 ALTER TABLE `employee` DISABLE KEYS */;
INSERT INTO `employee` VALUES (9,'Gad','Ishimwe','gad@gmail.com','0726183050','Admin','MTIzNDU=',1,'2021-02-04 22:01:02'),(10,'Kabatesi','Benitha','kba@gmail.com','0783555555','Admin','MTIz',16,'2021-03-07 10:39:30'),(11,'M','Olivier','mol@gmail.com','0782951455','Admin','MTIz',1,'2021-03-07 10:40:56'),(16,'Murerwa','Pucu','pucu@murerwa.info','0789123909','Teacher','MTIzNDU=',15,'2021-03-11 00:00:20'),(17,'Muvandimwe','Anastase','anastacurie@gmail.com','0788234323','Teacher','MTIzNDU=',1,'2021-03-14 22:32:13');
/*!40000 ALTER TABLE `employee` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lab_technician`
--
DROP TABLE IF EXISTS `lab_technician`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lab_technician` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(200) DEFAULT NULL,
`lastname` varchar(200) DEFAULT NULL,
`email` varchar(200) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`dept_id` int(11) DEFAULT NULL,
`registered_on` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `dept_id` (`dept_id`),
CONSTRAINT `lab_technician_ibfk_1` FOREIGN KEY (`dept_id`) REFERENCES `department` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lab_technician`
--
LOCK TABLES `lab_technician` WRITE;
/*!40000 ALTER TABLE `lab_technician` DISABLE KEYS */;
INSERT INTO `lab_technician` VALUES (1,'Munezero','James','mun@gmail.com','0789123412','MTIzNDU=',15,'2021-03-10 23:57:35'),(2,'Ishimwe ','Grace','grace@ishimwe.rw','0789123321','MTIzNDU=',15,'2021-03-14 22:20:50');
/*!40000 ALTER TABLE `lab_technician` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `stock_manager`
--
DROP TABLE IF EXISTS `stock_manager`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stock_manager` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(200) DEFAULT NULL,
`lastname` varchar(200) DEFAULT NULL,
`email` varchar(200) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`registered_on` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `stock_manager`
--
LOCK TABLES `stock_manager` WRITE;
/*!40000 ALTER TABLE `stock_manager` DISABLE KEYS */;
INSERT INTO `stock_manager` VALUES (1,'Muneza','James','muneza@yahoo.fr','0789123897','MTIzNDU=','2021-03-14 22:13:25');
/*!40000 ALTER TABLE `stock_manager` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `student`
--
DROP TABLE IF EXISTS `student`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(250) DEFAULT NULL,
`lastname` varchar(250) DEFAULT NULL,
`reg_number` varchar(150) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`phone` varchar(15) DEFAULT '',
`password` varchar(150) DEFAULT NULL,
`dept_id` int(11) DEFAULT NULL,
`class_id` int(11) DEFAULT NULL,
`registered_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `fk2` (`dept_id`),
KEY `class_dk` (`class_id`),
CONSTRAINT `class_dk` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk2` FOREIGN KEY (`dept_id`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `student`
--
LOCK TABLES `student` WRITE;
/*!40000 ALTER TABLE `student` DISABLE KEYS */;
INSERT INTO `student` VALUES (1,'Maniragenda','Olivier','17RP00001','olly@gmail.com','0789000123','MTIzNDU=',1,7,'2021-03-14 22:43:32');
/*!40000 ALTER TABLE `student` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-03-14 23:23:24
|
create or replace PROCEDURE InsertCourse(
sCourseName IN VARCHAR2,
nCourseUnit IN NUMBER,
sProfessorId IN VARCHAR2,
sCourseId IN VARCHAR2,
nCourseIdNo IN NUMBER,
sCourseRoom IN VARCHAR2,
nDay IN NUMBER,
nStime IN NUMBER,
nEtime IN NUMBER,
nMax IN NUMBER,
result OUT VARCHAR2)
IS
duplicate_time_professor EXCEPTION;
duplicate_loc_professor EXCEPTION;
overlap NUMBER;
overlap2 NUMBER;
nYear NUMBER;
nSemester NUMBER;
CURSOR duplicate_time_cursor IS
SELECT *
FROM TEACH
WHERE p_id = sProfessorId;
CURSOR duplicate_loc_cursor IS
SELECT *
FROM TEACH
WHERE c_room = sCourseRoom;
BEGIN
result := '';
DBMS_OUTPUT.put_line(sProfessorId || '님이 과목번호 ' || sCourseId || ', 분반 ' || TO_CHAR(nCourseIdNo) || '등록을 요청했습니다.');
/* 년도, 학기 알아내기 */
nYear := Date2EnrollYear(SYSDATE);
nSemester := Date2EnrollSemester(SYSDATE);
/* 에러처리 1 : 요일 및 시간에 중복 수업 있는 경우*/
overlap := 0;
FOR teach_list IN duplicate_time_cursor LOOP
overlap := compareTime2(nDay, nStime,nEtime, teach_list.c_id, teach_list.c_id_no);
IF (overlap > 0)
THEN
RAISE duplicate_time_professor;
END IF;
END LOOP;
/*에러처리 2 : 중복시간 및 중복 강의실인 경우*/
overlap2 := 0;
FOR loc_list IN duplicate_loc_cursor LOOP
overlap2 := compareTime2(nDay, nStime, nEtime, loc_list.c_id, loc_list.c_id_no);
IF(overlap2 > 0) THEN
RAISE duplicate_loc_professor;
END IF;
END LOOP;
/* teach와 course 테이블에 수업 추가 */
INSERT INTO COURSE(c_id,c_id_no,c_name,c_unit)
VALUES(sCourseId, nCourseIdNo, sCourseName, nCourseUnit);
INSERT INTO TEACH(t_year,t_semester,t_max,c_id,c_id_no, c_day, c_stime,c_etime,c_room,p_id)
VALUES(nYear,nSemester, nMax, sCourseId, nCourseIdNo, nDay, nStime,nEtime,SCourseRoom,sProfessorId);
COMMIT;
result := '수업을 추가하였습니다.';
EXCEPTION
WHEN duplicate_time_professor THEN
result := '등록된 과목 중 중복되는 강의가 존재합니다.';
WHEN duplicate_loc_professor THEN
result := '등록하려는 강의실에 이미 강의가 있습니다';
WHEN OTHERS THEN
ROLLBACK;
result := SQLCODE;
END;
/ |
SELECT students.name, AVG(duration)
FROM assignment_submissions join students on student_id = students.id
WHERE end_date IS NULL
GROUP BY students.name
ORDER BY AVG(duration) desc |
INSERT INTO series (id, title, author_id, subgenre_id)
VALUES (1, "Harry Potter", 1, 2), (2, "Scientology", 2, 1);
INSERT INTO subgenres (id, name) VALUES (1, "alien"), (2, "magic");
INSERT INTO authors (id, name) VALUES (1, "JK Rowling"), (2, "L Ron Hubbard");
INSERT INTO books (id, title, year, series_id)
VALUES (1, "Harry Potter 1", 2005, 1),
(2, "Harry Potter 2", 2007, 1),
(3, "Harry Potter 3", 2008, 1),
(4, "Scientology 1", 1965, 2),
(5, "Scientology 2", 1968, 2),
(6, "Scientology 3", 1972, 2);
INSERT INTO characters (id, name, motto, species, author_id, series_id)
VALUES (1, "Harry", "WINNING", "Human", 1, 1),
(2, "Ron", "I love Wizard Chess", "Human", 1, 1),
(3, "Hermione", "I'm smart", "Human", 1, 1),
(4, "Hagrid", "SOMETHING", "Giant", 1, 1),
(5, "Alien 1", "I live in humans", "Klingon", 2, 2),
(6, "Alien 2", "I eat humans", "Random", 2, 2),
(7, "Alien 3", "LIVING", "Unknown", 2, 2),
(8, "Alien 4", "WHAT THE HECK", "Something", 2, 2);
INSERT INTO character_books (id, character_id, book_id)
VALUES (1, 1, 1),
(2, 1, 2),
(3, 1, 3),
(4, 2, 1),
(5, 2, 2),
(6, 2, 3),
(7, 3, 1),
(8, 3, 2),
(9, 7, 6),
(10, 4, 1),
(11, 4, 2),
(12, 8, 6),
(13, 5, 4),
(14, 5, 5),
(15, 5, 6),
(16, 6, 4);
|
CREATE TABLE `sub_category` (
`subCategoryId` int(11) NOT NULL AUTO_INCREMENT,
`categoryId` int(11) NOT NULL,
`subCategoryName` varchar(50) NOT NULL,
PRIMARY KEY (`subCategoryId`),
KEY `FK_SUB_CATEGORY_categoryId` (`categoryId`),
CONSTRAINT `FK_SUB_CATEGORY_categoryId` FOREIGN KEY (`categoryId`) REFERENCES `category` (`categoryId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
CREATE TABLE func_index (
id INT NOT NULL AUTO_INCREMENT,
ipaddr4 INT UNSIGNED /* 4 bytes */,
PRIMARY KEY (id),
UNIQUE INDEX id_UNIQUE (id ASC) VISIBLE,
INDEX func_idx ((INET_NTOA(ipaddr4)))
);
INSERT INTO func_index (ipaddr4) VALUES (INET_ATON('192.168.1.1'));
SELECT * FROM func_index WHERE ipaddr4 = INET_ATON('192.168.1.1'); /* Full Table Scan */
SELECT * FROM func_index WHERE INET_NTOA(ipaddr4) = '192.168.1.1'; /* Non-Unique Key Lookup func_idx */
|
SELECT DISTINCT T1.title
FROM (Movies Join Rating USING (mID)) AS T1, (Movies Join Rating USING (mID)) AS T2
WHERE T1.mID = T2.mID AND T1.rID <> T2.rID
|
-- TITLE1:
-- TITLE2:Displaying Performance Statistics for Propagations that Send Buffered Messages
-- DESC: The query in this section displays the amount of time that a propagation sending buffered messages spends performing various tasks. Each propagation sends messages from the source queue to the destination queue.
COLUMN PROPAGATION_NAME HEADING 'Propagation' FORMAT A15
COLUMN QUEUE_NAME HEADING 'Queue|Name' FORMAT A13
COLUMN DBLINK HEADING 'Database|Link' FORMAT A9
COLUMN ELAPSED_DEQUEUE_TIME HEADING 'Dequeue|Time' FORMAT 99999999.99
COLUMN ELAPSED_PICKLE_TIME HEADING 'Pickle|Time' FORMAT 99999999.99
COLUMN ELAPSED_PROPAGATION_TIME HEADING 'Propagation|Time' FORMAT 99999999.99
SELECT p.PROPAGATION_NAME,
s.QUEUE_NAME,
s.DBLINK,
(s.ELAPSED_DEQUEUE_TIME / 100) ELAPSED_DEQUEUE_TIME,
(s.ELAPSED_PICKLE_TIME / 100) ELAPSED_PICKLE_TIME,
(s.ELAPSED_PROPAGATION_TIME / 100) ELAPSED_PROPAGATION_TIME
FROM DBA_PROPAGATION p, V$PROPAGATION_SENDER s
WHERE p.SOURCE_QUEUE_OWNER = s.QUEUE_SCHEMA AND
p.SOURCE_QUEUE_NAME = s.QUEUE_NAME AND
p.DESTINATION_QUEUE_OWNER = s.DST_QUEUE_SCHEMA AND
p.DESTINATION_QUEUE_NAME = s.DST_QUEUE_NAME;
|
■問題
ユーザーテーブル(usr)から東京都、千葉県、神奈川県に住んでいる人のリストを姓(カナ)、名(カナ)について昇順で取り出してみましょう。
取り出す列はl_name, f_name, prefecture列であるものとします。
SELECT
l_name,
f_name,
prefecture
FROM
usr
WHERE
[①空欄]
ORDER BY
[②空欄]
f_name_kana ASC
;
■実行文
# l_name, f_name, prefecture列を取得
SELECT
l_name,
f_name,
prefecture
# ユーザーテーブルから取得
FROM
usr
# 東京都、千葉県、神奈川県に住んでいるという条件に当てはまる場合のみ取得
WHERE
prefecture IN ('東京都', '千葉県', '神奈川県')
# 取得結果を姓(カナ)、名(カナ)について昇順に並べる
ORDER BY
l_name_kana ASC,
f_name_kana ASC
;
■返却値
mysql> # l_name, f_name, prefecture列を取得
mysql> SELECT
-> l_name,
-> f_name,
-> prefecture
-> # ユーザーテーブルから取得
-> FROM
-> usr
-> # 東京都、千葉県、神奈川県に住んでいるという条件に当てはまる場合のみ取得
-> WHERE
-> prefecture IN ('東京都', '千葉県', '神奈川県')
-> # 取得結果を姓(カナ)、名(カナ)について昇順に並べる
-> ORDER BY
-> l_name_kana ASC,
-> f_name_kana ASC
-> ;
+--------+--------+------------+
| l_name | f_name | prefecture |
+--------+--------+------------+
| 有木 | 茉莉 | 神奈川県 |
| 井上 | 一郎 | 千葉県 |
| 上原 | 幸一 | 神奈川県 |
| 小野 | 雄二 | 東京都 |
| 河合 | 泰治 | 神奈川県 |
| 久保田 | 守 | 千葉県 |
| 松本 | 博美 | 神奈川県 |
| 村井 | 佐知子 | 千葉県 |
| 矢口 | 亜由美 | 千葉県 |
| 山田 | 太郎 | 東京都 |
| 和田 | 修子 | 東京都 |
+--------+--------+------------+
11 rows in set (0.00 sec) |
/* Создание процедуры получения третьего раунда */
CREATE OR ALTER PROCEDURE GET_THIRD_ROUND
(
TIRAGE_ID VARCHAR(32)
)
RETURNS
(
TICKET_COUNT INTEGER
)
AS
BEGIN
TICKET_COUNT=0;
EXECUTE PROCEDURE CALCULATE_THIRD_ROUND(:TIRAGE_ID);
SELECT COUNT(*)
FROM WINNINGS
WHERE LOTTERY_ID IN (SELECT LOTTERY_ID
FROM LOTTERY
WHERE TIRAGE_ID=:TIRAGE_ID
AND ROUND_NUM=3
AND SUBROUND_ID IS NULL)
INTO :TICKET_COUNT;
END
--
/* Фиксация изменений */
COMMIT |
-- MySQL dump 10.13 Distrib 5.7.9, for Win32 (AMD64)
--
-- Host: 127.0.0.1 Database: academia
-- ------------------------------------------------------
-- Server version 5.5.5-10.1.13-MariaDB
/*!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 `alunos`
--
DROP TABLE IF EXISTS `alunos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `alunos` (
`nome` varchar(200) NOT NULL,
`telefone` varchar(20) NOT NULL,
`endereco` varchar(500) NOT NULL,
`cpf` varchar(20) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`saldoDevedor` double NOT NULL,
`dataCadastro` varchar(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `cpf_UNIQUE` (`cpf`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `alunos`
--
LOCK TABLES `alunos` WRITE;
/*!40000 ALTER TABLE `alunos` DISABLE KEYS */;
INSERT INTO `alunos` VALUES ('João Paulo Godê Liberal','00000000000','BB','10731087402',9,45504,''),('Junior','44444444444','aa','77777777777',10,80,''),('renata','11111111111','aaa','22222221111',11,0,''),('pedrosss2','45454545457','asas','78754454545',13,0,''),('kk','55555555555','kk','55552252525',14,0,''),('a','11111111111','a','55854546565',15,0,''),('bv','00000054545','asa','45784545454',16,0,''),('jkjk','45454545454','jjkjkj','44545454545',17,0,''),('asas','45454545454','asas','85858585858',18,0,''),('jkjk','45454545454','sasas','45454545454',19,0,''),('Cicero Liberal','87988654523','Iguaraci','68861478468',20,15,''),('testedata','11111111111','ads','12155455454',21,0,'00000000'),('testador','00000000000','assss','66666666666',22,0,'12121212'),('aluno mensalidade','11111111111','kkkk','99999999900',23,0,'33333333'),('João teste Cadastro','45455545454','nsmans','45744455454',24,0,'26062016');
/*!40000 ALTER TABLE `alunos` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-07-02 15:26:52
|
/*
Navicat MySQL Data Transfer
Source Server : 本机连接
Source Server Version : 50548
Source Host : 127.0.0.1:3306
Source Database : demo
Target Server Type : MYSQL
Target Server Version : 50548
File Encoding : 65001
Date: 2018-01-27 00:08:31
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `t_user`
-- ----------------------------
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(50) DEFAULT NULL,
`user_tel` varchar(20) DEFAULT NULL,
`user_password` varchar(50) DEFAULT NULL,
`user_pic` varchar(255) DEFAULT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_user
-- ----------------------------
INSERT INTO `t_user` VALUES ('10', 'lisi', '123', '123', '69303f90-e85d-47c8-9dc6-cf32bbbff4da.JPG');
INSERT INTO `t_user` VALUES ('11', 'zhangsan', '123', '123', 'e8aae686-4a67-4a93-babe-82d604eb7559.JPG');
INSERT INTO `t_user` VALUES ('12', 'wangwu', '123', '123', 'c07099c2-0a37-4fdf-b491-a1d12a9cc9f2.JPG');
|
-- MySQL dump 10.13 Distrib 5.7.11, for Win64 (x86_64)
--
-- Host: localhost Database: javaee
-- ------------------------------------------------------
-- Server version 5.7.11-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `candidature`
--
DROP TABLE IF EXISTS `candidature`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `candidature` (
`id_candidature` int(4) NOT NULL AUTO_INCREMENT,
`id_offre` int(4) NOT NULL,
`nomFichier` varchar(255) NOT NULL,
`position` varchar(30) NOT NULL,
PRIMARY KEY (`id_candidature`),
KEY `id_offre` (`id_offre`),
CONSTRAINT `candidature_ibfk_1` FOREIGN KEY (`id_offre`) REFERENCES `offre_emploi` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `candidature`
--
LOCK TABLES `candidature` WRITE;
/*!40000 ALTER TABLE `candidature` DISABLE KEYS */;
INSERT INTO `candidature` VALUES (21,18,'cv.pdf','C++ Developper'),(22,18,'Aymen\'s Résumé (5).pdf','C++ Developper');
/*!40000 ALTER TABLE `candidature` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `conges`
--
DROP TABLE IF EXISTS `conges`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `conges` (
`matricule` varchar(255) NOT NULL,
`datedeb` date NOT NULL,
`jours_demande` int(4) NOT NULL,
`type_conge` varchar(255) NOT NULL,
`reponse` varchar(30) NOT NULL DEFAULT 'Unseen',
PRIMARY KEY (`matricule`,`datedeb`,`jours_demande`),
CONSTRAINT `conges_ibfk_1` FOREIGN KEY (`matricule`) REFERENCES `noms` (`matricule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `conges`
--
LOCK TABLES `conges` WRITE;
/*!40000 ALTER TABLE `conges` DISABLE KEYS */;
INSERT INTO `conges` VALUES ('1001','2016-07-20',15,'Illness','Unseen'),('1004','2016-06-01',5,'Annuel','accepted');
/*!40000 ALTER TABLE `conges` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `execution`
--
DROP TABLE IF EXISTS `execution`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `execution` (
`matricule` varchar(255) NOT NULL,
`id_mission` int(4) NOT NULL,
PRIMARY KEY (`matricule`,`id_mission`),
KEY `id_mission` (`id_mission`),
CONSTRAINT `execution_ibfk_1` FOREIGN KEY (`matricule`) REFERENCES `noms` (`matricule`),
CONSTRAINT `execution_ibfk_2` FOREIGN KEY (`id_mission`) REFERENCES `mission` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `execution`
--
LOCK TABLES `execution` WRITE;
/*!40000 ALTER TABLE `execution` DISABLE KEYS */;
/*!40000 ALTER TABLE `execution` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `formation`
--
DROP TABLE IF EXISTS `formation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `formation` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`service` varchar(30) NOT NULL,
`theme` varchar(255) NOT NULL,
`priorite` int(2) NOT NULL,
`dure_moy` int(4) NOT NULL,
`budget` float DEFAULT NULL,
`date_debut` date DEFAULT NULL,
`date_fin` date DEFAULT NULL,
`etat` varchar(30) DEFAULT 'demande',
`lieu` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `formation`
--
LOCK TABLES `formation` WRITE;
/*!40000 ALTER TABLE `formation` DISABLE KEYS */;
INSERT INTO `formation` VALUES (3,'Software development','Datawarhouse',3,15,1000,'2016-04-20','2016-05-04','Archive','Tunisia'),(4,'Finance','aaaaaaaaaaa',10,20,1000,'2016-05-05','2016-05-20','canceled','Sfax'),(5,'Finance','blabalaa',5,15,1000,'2016-05-05','2016-05-20','Archive','Sfax'),(6,'Finance','blabalaa',5,15,1000,'2016-05-05','2016-05-20','canceled','Sfax'),(7,'Finance','blabalaa',5,15,1000,'2016-05-05','2016-05-20','Archive','Sfax'),(8,'Finance','blabalaa',5,15,1000,'2016-05-05','2016-05-20','requested','Sfax'),(9,'Finance','blabalaa',5,15,1000,'2016-05-18','2016-05-20','canceled','Sfax'),(10,'Finance','blabalaa',5,15,1000,'2016-05-20','2016-06-12','refused','Sfax');
/*!40000 ALTER TABLE `formation` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `message`
--
DROP TABLE IF EXISTS `message`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `message` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`source` varchar(255) NOT NULL,
`destination` varchar(255) NOT NULL,
`objet` text NOT NULL,
`contenu` text NOT NULL,
`date` date NOT NULL,
`etat` varchar(30) DEFAULT 'Non vu',
PRIMARY KEY (`id`),
KEY `source` (`source`),
KEY `destination` (`destination`),
CONSTRAINT `message_ibfk_1` FOREIGN KEY (`source`) REFERENCES `noms` (`matricule`),
CONSTRAINT `message_ibfk_2` FOREIGN KEY (`destination`) REFERENCES `noms` (`matricule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `message`
--
LOCK TABLES `message` WRITE;
/*!40000 ALTER TABLE `message` DISABLE KEYS */;
/*!40000 ALTER TABLE `message` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `mission`
--
DROP TABLE IF EXISTS `mission`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mission` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`service` varchar(30) NOT NULL,
`objet` varchar(255) NOT NULL,
`description` text NOT NULL,
`date_debut` date NOT NULL,
`dure` int(4) NOT NULL,
`lieu` varchar(255) NOT NULL,
`etat` varchar(30) DEFAULT 'Non vu',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `mission`
--
LOCK TABLES `mission` WRITE;
/*!40000 ALTER TABLE `mission` DISABLE KEYS */;
INSERT INTO `mission` VALUES (1,'Marketing','kkkkkkkkkkkk','pffffffffff','2016-05-17',15,'Sfax','Validé');
/*!40000 ALTER TABLE `mission` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `noms`
--
DROP TABLE IF EXISTS `noms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `noms` (
`matricule` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`nom` varchar(255) NOT NULL,
`prenom` varchar(255) NOT NULL,
`position` varchar(255) NOT NULL,
`deb_contrat` date NOT NULL,
`fin_contrat` date NOT NULL,
`email` varchar(255) NOT NULL,
`phone` varchar(255) NOT NULL,
`service` varchar(255) NOT NULL,
`login` varchar(255) NOT NULL,
`adresse` varchar(255) NOT NULL,
`ville` varchar(30) NOT NULL,
`pays` varchar(30) NOT NULL,
`paie_heure` float NOT NULL,
`pex_heure` float NOT NULL,
PRIMARY KEY (`matricule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `noms`
--
LOCK TABLES `noms` WRITE;
/*!40000 ALTER TABLE `noms` DISABLE KEYS */;
INSERT INTO `noms` VALUES ('1000','admin','John','Doe','HR Director','2016-01-01','2019-01-01','john.doe@gmail.com','+216 55465213','HR','admin','Manouba - Tunis','Manouba','Tunisia',20,30),('1001','bruno123','Bruno','Nash','Chef Executif','2016-02-01','2018-02-01','bruno.nash@gmail.com','+216 55465214 ','Software Development','bruno','Manouba - Tunis','Manouba','Tunisia',18,25),('1004','bradley123','Bradley','Greer','C++ Developper','2016-02-06','2017-02-06','bradley.greer@gmail.com','+216 55478213','Software Development','brafley1','Manouba - Tunis','Manouba','Tunisia',15,20);
/*!40000 ALTER TABLE `noms` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `offre_emploi`
--
DROP TABLE IF EXISTS `offre_emploi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `offre_emploi` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`position` varchar(30) NOT NULL,
`competences` varchar(255) NOT NULL,
`experience` int(4) NOT NULL,
`description` text NOT NULL,
`date_limite` date NOT NULL,
`date_pub` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `offre_emploi`
--
LOCK TABLES `offre_emploi` WRITE;
/*!40000 ALTER TABLE `offre_emploi` DISABLE KEYS */;
INSERT INTO `offre_emploi` VALUES (18,'C++ Developper','C++ / Code Blocks / English',2,'medium experienced C ++ developer','2016-08-06','2016-05-23');
/*!40000 ALTER TABLE `offre_emploi` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `participants`
--
DROP TABLE IF EXISTS `participants`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `participants` (
`matricule` varchar(255) NOT NULL,
`id_formation` int(4) NOT NULL,
PRIMARY KEY (`matricule`,`id_formation`),
KEY `id_formation` (`id_formation`),
CONSTRAINT `participants_ibfk_1` FOREIGN KEY (`matricule`) REFERENCES `noms` (`matricule`),
CONSTRAINT `participants_ibfk_2` FOREIGN KEY (`id_formation`) REFERENCES `formation` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `participants`
--
LOCK TABLES `participants` WRITE;
/*!40000 ALTER TABLE `participants` DISABLE KEYS */;
/*!40000 ALTER TABLE `participants` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pointage`
--
DROP TABLE IF EXISTS `pointage`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pointage` (
`matricule` varchar(255) NOT NULL,
`date` datetime NOT NULL,
`type` varchar(30) NOT NULL,
PRIMARY KEY (`matricule`,`date`),
CONSTRAINT `pointage_ibfk_1` FOREIGN KEY (`matricule`) REFERENCES `noms` (`matricule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pointage`
--
LOCK TABLES `pointage` WRITE;
/*!40000 ALTER TABLE `pointage` DISABLE KEYS */;
INSERT INTO `pointage` VALUES ('1001','2016-03-02 08:00:00','enter'),('1001','2016-03-02 20:00:00','out'),('1001','2016-03-03 08:00:00','enter'),('1001','2016-03-03 20:00:00','out'),('1001','2016-04-01 08:00:00','enter'),('1001','2016-04-01 20:00:00','out');
/*!40000 ALTER TABLE `pointage` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `recrutement`
--
DROP TABLE IF EXISTS `recrutement`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `recrutement` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`service` varchar(30) NOT NULL,
`position` varchar(30) NOT NULL,
`competences` varchar(255) NOT NULL,
`experience` int(4) NOT NULL,
`etat` varchar(20) NOT NULL DEFAULT 'requested',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `recrutement`
--
LOCK TABLES `recrutement` WRITE;
/*!40000 ALTER TABLE `recrutement` DISABLE KEYS */;
INSERT INTO `recrutement` VALUES (14,'Software Development','C++ Developper','C++ / Code Blocks / English',2,'published');
/*!40000 ALTER TABLE `recrutement` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `salaire`
--
DROP TABLE IF EXISTS `salaire`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `salaire` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`matricule` varchar(255) NOT NULL,
`nb_heures` float NOT NULL,
`nb_extra` float NOT NULL,
`prime` float NOT NULL,
`impots` float NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`id`),
KEY `matricule` (`matricule`),
CONSTRAINT `salaire_ibfk_1` FOREIGN KEY (`matricule`) REFERENCES `noms` (`matricule`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `salaire`
--
LOCK TABLES `salaire` WRITE;
/*!40000 ALTER TABLE `salaire` DISABLE KEYS */;
INSERT INTO `salaire` VALUES (60,'1000',140,30,30,10,'2016-01-31'),(61,'1000',115,30,30,10,'2016-02-29'),(62,'1000',130,15,30,10,'2016-03-31'),(63,'1000',150,20,50,50,'2016-04-30'),(64,'1001',12,0,10,5,'2016-05-01'),(65,'1001',12,0,20,5,'2016-05-01'),(66,'1001',12,0,20,5,'2016-05-01'),(67,'1001',12,0,10,5,'2016-05-01');
/*!40000 ALTER TABLE `salaire` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-10-14 14:25:07
|
DROP INDEX NOMBRE_INDICE ON EJEMPLO;
DROP UNIQUE INDEX NOMBRE_INDICE ON EJEMPLO;
DROP UNIQUE INDEX MIINDICE
ON EJEMPLO(NOMBRE,APELLIDO);
ALTER TABLE EJEMPLO DROP PRIMARY kEY;
|
CREATE database carRepository;
USE carRepository
CREATE TABLE cars (
id INT unsigned NOT NULL auto_increment PRIMARY KEY,
producer CHAR(20) NOT NULL,
model CHAR(30) NOT NULL,
capacity DOUBLE NOT NULL)
engine = innodb
DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
DROP database prepJPA1;
CREATE database prepJPA1; |
INSERT INTO movies VALUES('tt0421974','Sky Fighters',2005,'Gérard Pirès');
INSERT INTO movies VALUES('tt0378947','Melinda and Melinda',2004,'Woody Allen');
INSERT INTO movies VALUES('tt0278823','Hollywood Ending',2002,'Woody Allen');
INSERT INTO movies VALUES('tt0416320','Match Point',2005,'Woody Allen');
INSERT INTO movies VALUES('tt0218323','Hard Luck',2001,'Jack Rubio');
INSERT INTO movies VALUES('tt0480269','Interview',2007,'Steve Buscemi');
INSERT INTO movies VALUES('tt0228333','Ghosts of Mars',2001,'John Carpenter');
INSERT INTO movies VALUES('tt0216982','Prison Song',2001,'Darnell Martin');
INSERT INTO movies VALUES('tt0218107','Circuit',2001,'Dirk Shafer');
INSERT INTO movies VALUES('tt0217031','Second to Die',2002,'Brad Marlowe');
INSERT INTO movies VALUES('tt0214520','Ties and Ropes',2001,'Herman Van Eyken');
INSERT INTO movies VALUES('tt0216994','Random Acts',2001,'Angela Garcia Combs');
INSERT INTO movies VALUES('tt0214289','Would I Lie to You? 2',2001,'Thomas Gilou');
INSERT INTO movies VALUES('tt0217135','Vortex',2001,'Michael Pohl');
INSERT INTO movies VALUES('tt0257516','Cursed',2005,'Wes Craven');
INSERT INTO movies VALUES('tt0216290','To Protect and Serve',2001,'Joseph Perez');
INSERT INTO movies VALUES('tt0214723','The Penny Promise',2001,'T.C. Christensen');
INSERT INTO movies VALUES('tt0218400','Life Sentence',2004,'Andy Graydon');
INSERT INTO movies VALUES('tt0213985','Partition',2007,'Vic Sarin');
INSERT INTO movies VALUES('tt0216731','Edgeplay',2004,'Victory Tischler-Blue');
INSERT INTO movies VALUES('tt0217100','Toutes les nuits',2001,'Eugène Green');
INSERT INTO movies VALUES('tt0214275','Venus on the Halfshell',2005,'Niels Nielsen');
INSERT INTO movies VALUES('tt0214265','Vajont - La diga del disonore',2001,'Renzo Martinelli');
INSERT INTO movies VALUES('tt0217084','Exam',2003,'Titus Muntean');
INSERT INTO movies VALUES('tt0498380','Letters from Iwo Jima',2006,'Clint Eastwood');
INSERT INTO movies VALUES('tt0327056','Mystic River',2003,'Clint Eastwood');
INSERT INTO movies VALUES('tt0335345','The Passion of the Christ',2004,'Mel Gibson');
INSERT INTO movies VALUES('tt0499469','Emilio',2008,'Kim Jorgensen');
INSERT INTO movies VALUES('tt0496319','The Hottest State',2006,'Ethan Hawke');
INSERT INTO movies VALUES('tt0218390','The Last Place on Earth',2002,'James Slocum');
INSERT INTO movies VALUES('tt0213802','Legion of the Dead',2001,'Olaf Ittenbach');
INSERT INTO movies VALUES('tt0218140','Death and Taxis',2007,'Kevin Mukherji');
INSERT INTO stars (id, name) VALUES('nm0635742','Chris Norr');
INSERT INTO stars (id, name, birthYear) VALUES('nm0520288','Santo Loquasto',1944);
INSERT INTO stars (id, name, birthYear) VALUES('nm0383603','Freddie Highmore',1992);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000114','Steve Buscemi',1957);
INSERT INTO stars (id, name) VALUES('nm0798769','Paula Silver');
INSERT INTO stars (id, name, birthYear) VALUES('nm0000449','Natasha Henstridge',1974);
INSERT INTO stars (id, name, birthYear) VALUES('nm0450974','Andre Khabbazi',1975);
INSERT INTO stars (id, name) VALUES('nm0520749','Robert Lorenz');
INSERT INTO stars (id, name) VALUES('nm0135287','Jennifer Capo');
INSERT INTO stars (id, name) VALUES('nm1157817','Tess Nielsen');
INSERT INTO stars (id, name) VALUES('nm0505518','Lara Levicki-Lavi');
INSERT INTO stars (id, name, birthYear) VALUES('nm0424060','Scarlett Johansson',1984);
INSERT INTO stars (id, name) VALUES('nm0503429','Alisa Lepselter');
INSERT INTO stars (id, name) VALUES('nm0249056','Scott Edelstein');
INSERT INTO stars (id, name) VALUES('nm0385987','Gregory Hinton');
INSERT INTO stars (id, name, birthYear) VALUES('nm0625791','Timothy J. Nelson',1958);
INSERT INTO stars (id, name, birthYear) VALUES('nm0813219','Bruno Solo',1964);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000576','Sean Penn',1960);
INSERT INTO stars (id, name, birthYear) VALUES('nm0027223','Mitchell Anderson',1961);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000091','Gérard Pirès',1942);
INSERT INTO stars (id, name, birthYear) VALUES('nm0858153','Jani Thiltges',1962);
INSERT INTO stars (id, name) VALUES('nm0003410','Howard Heard');
INSERT INTO stars (id, name, birthYear) VALUES('nm0000095','Woody Allen',1935);
INSERT INTO stars (id, name, birthYear) VALUES('nm0500505','Harald Leipnitz',1926);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000001','Fred Astaire',1899);
INSERT INTO stars (id, name, birthYear) VALUES('nm0001937','Marco Beltrami',1966);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000809','Daniel Auteuil',1950);
INSERT INTO stars (id, name) VALUES('nm0233646','Bob Dorian');
INSERT INTO stars (id, name) VALUES('nm0202704','Bruce Davey');
INSERT INTO stars (id, name, birthYear) VALUES('nm0000008','Marlon Brando',1924);
INSERT INTO stars (id, name) VALUES('nm0520870','Alexis Loret');
INSERT INTO stars (id, name, birthYear) VALUES('nm0000017','Marlene Dietrich',1901);
INSERT INTO stars (id, name, birthYear) VALUES('nm0201626','James Darren',1936);
INSERT INTO stars (id, name, birthYear) VALUES('nm0745139','Andrew Rothenberg',1969);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000018','Kirk Douglas',1916);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000032','Charlton Heston',1923);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000035','James Horner',1953);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000041','Akira Kurosawa',1910);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000056','Paul Newman',1925);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000062','Elvis Presley',1935);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000063','Anthony Quinn',1915);
INSERT INTO stars (id, name) VALUES('nm0655184','Vince Pace');
INSERT INTO stars (id, name) VALUES('nm1219075','Kari Krome');
INSERT INTO stars (id, name) VALUES('nm0003003','Ron Gilbert');
INSERT INTO stars (id, name) VALUES('nm0000083','Alan Miller');
INSERT INTO stars (id, name, birthYear) VALUES('nm0000084','Li Gong',1965);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000090','Armin Mueller-Stahl',1930);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000091','Gérard Pirès',1942);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000092','John Cleese',1939);
INSERT INTO stars (id, name, birthYear) VALUES('nm0160621','Scott Christopher',1967);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000093','Brad Pitt',1963);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000095','Woody Allen',1935);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000097','Pamela Anderson',1967);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000098','Jennifer Aniston',1969);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000099','Patricia Arquette',1968);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000100','Rowan Atkinson',1955);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000101','Dan Aykroyd',1952);
INSERT INTO stars (id, name, birthYear) VALUES('nm0000102','Kevin Bacon',1958);
INSERT INTO stars (id, name, birthYear) VALUES('nm0468008','Penka Kouneva',1967);
INSERT INTO stars (id, name) VALUES('nm0973443','Ann Luly');
INSERT INTO stars (id, name) VALUES('nm0320663','Guy Girard');
INSERT INTO stars (id, name) VALUES('nm1598088','Annick Breuil');
INSERT INTO stars (id, name, birthYear) VALUES('nm0702580','Q-Tip',1970);
INSERT INTO stars (id, name, birthYear) VALUES('nm0813285','Alexandru Solomon',1966);
INSERT INTO stars (id, name, birthYear) VALUES('nm0691048','Temistocle Popa',1921);
INSERT INTO stars (id, name, birthYear) VALUES('nm0613305','Titus Muntean',1965);
INSERT INTO stars (id, name) VALUES('nm0135287','Jennifer Capo');
INSERT INTO stars (id, name) VALUES('nm1603520','Kim Roberts');
INSERT INTO stars (id, name, birthYear) VALUES('nm0899786','Gheorghe Visu',1951);
INSERT INTO stars (id, name, birthYear) VALUES('nm2113203','Chris Cooley',1983);
INSERT INTO stars (id, name) VALUES('nm3372985','Jason Thomas');
INSERT INTO stars (id, name) VALUES('nm0430370','Kim Jorgensen');
INSERT INTO stars (id, name) VALUES('nm3372985','Jason Thomas');
INSERT INTO stars (id, name, birthYear) VALUES('nm0942922','Wendell Wright',1948);
INSERT INTO stars (id, name) VALUES('nm0712527','Philippe Ravoet');
INSERT INTO stars (id, name) VALUES('nm0665620','Alejandro Patiño');
INSERT INTO stars (id, name) VALUES('nm0006780','Denis Maloney');
INSERT INTO stars (id, name, birthYear) VALUES('nm0310329','Yvan Gauthier',1969);
INSERT INTO stars_in_movies VALUES('nm0813285','tt0217084');
INSERT INTO stars_in_movies VALUES('nm0691048','tt0217084');
INSERT INTO stars_in_movies VALUES('nm0613305','tt0217084');
INSERT INTO stars_in_movies VALUES('nm0702297','tt0329953');
INSERT INTO stars_in_movies VALUES('nm0899786','tt0217084');
INSERT INTO stars_in_movies VALUES('nm2113203','tt0499469');
INSERT INTO stars_in_movies VALUES('nm3372985','tt0499469');
INSERT INTO stars_in_movies VALUES('nm0430370','tt0499469');
INSERT INTO stars_in_movies VALUES('nm0942922','tt0499469');
INSERT INTO stars_in_movies VALUES('nm0665620','tt0499469');
INSERT INTO stars_in_movies VALUES('nm0660676','tt0217084');
INSERT INTO stars_in_movies VALUES('nm0364963','tt0218323');
INSERT INTO stars_in_movies VALUES('nm0401945','tt0218323');
INSERT INTO stars_in_movies VALUES('nm0003003','tt0218323');
INSERT INTO stars_in_movies VALUES('nm3963441','tt0218323');
INSERT INTO stars_in_movies VALUES('nm3952647','tt0218323');
INSERT INTO stars_in_movies VALUES('nm0748339','tt0218323');
INSERT INTO stars_in_movies VALUES('nm2070737','tt0218323');
INSERT INTO stars_in_movies VALUES('nm0649258','tt0217084');
INSERT INTO stars_in_movies VALUES('nm0603118','tt0217084');
INSERT INTO stars_in_movies VALUES('nm0822130','tt0217084');
INSERT INTO stars_in_movies VALUES('nm0227708','tt0217084');
INSERT INTO stars_in_movies VALUES('nm0900760','tt0217084');
INSERT INTO stars_in_movies VALUES('nm1182556','tt0218140');
INSERT INTO stars_in_movies VALUES('nm0471036','tt0213985');
INSERT INTO stars_in_movies VALUES('nm1603520','tt0213985');
INSERT INTO stars_in_movies VALUES('nm0000117','tt0213985');
INSERT INTO stars_in_movies VALUES('nm0002764','tt0213985');
INSERT INTO stars_in_movies VALUES('nm0363094','tt0213985');
INSERT INTO stars_in_movies VALUES('nm1182556','tt0218140');
INSERT INTO stars_in_movies VALUES('nm0468008','tt0218140');
INSERT INTO stars_in_movies VALUES('nm0002976','tt0218140');
INSERT INTO stars_in_movies VALUES('nm1183035','tt0218140');
INSERT INTO stars_in_movies VALUES('nm1792530','tt0218140');
INSERT INTO stars_in_movies VALUES('nm0700430','tt0218140');
INSERT INTO stars_in_movies VALUES('nm0464620','tt0218140');
INSERT INTO stars_in_movies VALUES('nm0016013','tt0100275');
INSERT INTO stars_in_movies VALUES('nm0702296','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0004947','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0000008','tt0145937');
INSERT INTO stars_in_movies VALUES('nm2282741','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0041263','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0285753','tt0216731');
INSERT INTO stars_in_movies VALUES('nm1088720','tt0216731');
INSERT INTO stars_in_movies VALUES('nm0385987','tt0218107');
INSERT INTO stars_in_movies VALUES('nm0668440','tt0216731');
INSERT INTO stars_in_movies VALUES('nm1219075','tt0216731');
INSERT INTO stars_in_movies VALUES('nm0712527','tt0214520');
INSERT INTO stars_in_movies VALUES('nm0703001','tt0216731');
INSERT INTO stars_in_movies VALUES('nm1653627','tt0216731');
INSERT INTO stars_in_movies VALUES('nm0288831','tt0216731');
INSERT INTO stars_in_movies VALUES('nm0380731','tt0216731');
INSERT INTO stars_in_movies VALUES('nm0089548','tt0216731');
INSERT INTO stars_in_movies VALUES('nm0307833','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0305060','tt0216994');
INSERT INTO stars_in_movies VALUES('nm0000143','tt0217031');
INSERT INTO stars_in_movies VALUES('nm0003957','tt0217031');
INSERT INTO stars_in_movies VALUES('nm0746557','tt0217031');
INSERT INTO stars_in_movies VALUES('nm0131974','tt0217031');
INSERT INTO stars_in_movies VALUES('nm0233162','tt0217031');
INSERT INTO stars_in_movies VALUES('nm1133702','tt0217031');
INSERT INTO stars_in_movies VALUES('nm0798769','tt0217031');
INSERT INTO stars_in_movies VALUES('nm1425267','tt0216994');
INSERT INTO stars_in_movies VALUES('nm0209735','tt0216994');
INSERT INTO stars_in_movies VALUES('nm0542027','tt0216994');
INSERT INTO stars_in_movies VALUES('nm0289439','tt0216994');
INSERT INTO stars_in_movies VALUES('nm0514131','tt0218400');
INSERT INTO stars_in_movies VALUES('nm0003283','tt0218400');
INSERT INTO stars_in_movies VALUES('nm0909928','tt0218400');
INSERT INTO stars_in_movies VALUES('nm0483990','tt0218400');
INSERT INTO stars_in_movies VALUES('nm0249056','tt0218400');
INSERT INTO stars_in_movies VALUES('nm0084193','tt0216994');
INSERT INTO stars_in_movies VALUES('nm0135287','tt0214723');
INSERT INTO stars_in_movies VALUES('nm0201626','tt0216994');
INSERT INTO stars_in_movies VALUES('nm0291054','tt0216982');
INSERT INTO stars_in_movies VALUES('nm0344738','tt0216982');
INSERT INTO stars_in_movies VALUES('nm0613349','tt0214289');
INSERT INTO stars_in_movies VALUES('nm0813219','tt0214289');
INSERT INTO stars_in_movies VALUES('nm0081551','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0027223','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0213752','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0651614','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0000796','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0132896','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0911979','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0841790','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0806121','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0583550','tt0218390');
INSERT INTO stars_in_movies VALUES('nm0229062','tt0214289');
INSERT INTO stars_in_movies VALUES('nm0305296','tt0214289');
INSERT INTO stars_in_movies VALUES('nm0387773','tt0216982');
INSERT INTO stars_in_movies VALUES('nm0004845','tt0216982');
INSERT INTO stars_in_movies VALUES('nm0702580','tt0216982');
INSERT INTO stars_in_movies VALUES('nm1101985','tt0216982');
INSERT INTO stars_in_movies VALUES('nm0552140','tt0216982');
INSERT INTO stars_in_movies VALUES('nm0000134','tt0216982');
INSERT INTO stars_in_movies VALUES('nm0258431','tt0216982');
INSERT INTO stars_in_movies VALUES('nm0742772','tt0216982');
INSERT INTO stars_in_movies VALUES('nm1157817','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0003669','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0553379','tt0214265');
INSERT INTO stars_in_movies VALUES('nm1077854','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0702760','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0005721','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0000809','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0295698','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0603090','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0785664','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0129571','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0675751','tt0214265');
INSERT INTO stars_in_movies VALUES('nm0179182','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0327545','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0542568','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0151637','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0003410','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0956752','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0049134','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0140880','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0030515','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0673531','tt0216290');
INSERT INTO stars_in_movies VALUES('nm0688354','tt0217135');
INSERT INTO stars_in_movies VALUES('nm0773348','tt0217135');
INSERT INTO stars_in_movies VALUES('nm0500505','tt0217135');
INSERT INTO stars_in_movies VALUES('nm0477858','tt0217135');
INSERT INTO stars_in_movies VALUES('nm0774377','tt0217135');
INSERT INTO stars_in_movies VALUES('nm0098680','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0578812','tt0214275');
INSERT INTO stars_in_movies VALUES('nm0630938','tt0214275');
INSERT INTO stars_in_movies VALUES('nm1415193','tt0100275');
INSERT INTO stars_in_movies VALUES('nm0005948','tt0100275');
INSERT INTO stars_in_movies VALUES('nm0765384','tt0100275');
INSERT INTO stars_in_movies VALUES('nm6883878','tt0112502');
INSERT INTO stars_in_movies VALUES('nm0373872','tt0112502');
INSERT INTO stars_in_movies VALUES('nm0227234','tt0112502');
INSERT INTO stars_in_movies VALUES('nm0061662','tt0217100');
INSERT INTO stars_in_movies VALUES('nm0584757','tt0217100');
INSERT INTO stars_in_movies VALUES('nm0337833','tt0217100');
INSERT INTO stars_in_movies VALUES('nm0698821','tt0217100');
INSERT INTO stars_in_movies VALUES('nm0081383','tt0217100');
INSERT INTO stars_in_movies VALUES('nm0520870','tt0217100');
INSERT INTO stars_in_movies VALUES('nm0069188','tt0217100');
INSERT INTO stars_in_movies VALUES('nm0639943','tt0217100');
INSERT INTO stars_in_movies VALUES('nm0281306','tt0217100');
INSERT INTO stars_in_movies VALUES('nm6327047','tt0217100');
INSERT INTO stars_in_movies VALUES('nm1594509','tt0112912');
INSERT INTO stars_in_movies VALUES('nm1646109','tt0112912');
INSERT INTO stars_in_movies VALUES('nm1618640','tt0112912');
INSERT INTO stars_in_movies VALUES('nm1598084','tt0112912');
INSERT INTO stars_in_movies VALUES('nm0501755','tt0112912');
INSERT INTO stars_in_movies VALUES('nm1645893','tt0112912');
INSERT INTO stars_in_movies VALUES('nm0373655','tt0112912');
INSERT INTO stars_in_movies VALUES('nm1594494','tt0112912');
INSERT INTO stars_in_movies VALUES('nm0521523','tt0112912');
INSERT INTO stars_in_movies VALUES('nm0432636','tt0112912');
INSERT INTO stars_in_movies VALUES('nm0002996','tt0113506');
INSERT INTO stars_in_movies VALUES('nm1297149','tt0113506');
INSERT INTO stars_in_movies VALUES('nm0321320','tt0113506');
INSERT INTO stars_in_movies VALUES('nm0821033','tt0113506');
INSERT INTO stars_in_movies VALUES('nm0698235','tt0114447');
INSERT INTO genres VALUES(1,'Action');
INSERT INTO genres VALUES(2,'Adult');
INSERT INTO genres VALUES(3,'Adventure');
INSERT INTO genres VALUES(4,'Animation');
INSERT INTO genres VALUES(5,'Biography');
INSERT INTO genres VALUES(6,'Comedy');
INSERT INTO genres VALUES(7,'Crime');
INSERT INTO genres VALUES(8,'Documentary');
INSERT INTO genres VALUES(9,'Drama');
INSERT INTO genres VALUES(10,'Family');
INSERT INTO genres VALUES(11,'Fantasy');
INSERT INTO genres VALUES(12,'History');
INSERT INTO genres VALUES(13,'Horror');
INSERT INTO genres VALUES(14,'Music');
INSERT INTO genres VALUES(15,'Musical');
INSERT INTO genres VALUES(16,'Mystery');
INSERT INTO genres VALUES(17,'Reality-TV');
INSERT INTO genres VALUES(18,'Romance');
INSERT INTO genres VALUES(19,'Sci-Fi');
INSERT INTO genres VALUES(20,'Sport');
INSERT INTO genres VALUES(21,'Thriller');
INSERT INTO genres VALUES(22,'War');
INSERT INTO genres VALUES(23,'Western');
INSERT INTO genres_in_movies VALUES(9,'tt0499469');
INSERT INTO genres_in_movies VALUES(16,'tt0499469');
INSERT INTO genres_in_movies VALUES(3,'tt0499469');
INSERT INTO genres_in_movies VALUES(9,'tt0217100');
INSERT INTO genres_in_movies VALUES(9,'tt0217084');
INSERT INTO genres_in_movies VALUES(9,'tt0213985');
INSERT INTO genres_in_movies VALUES(6,'tt0214723');
INSERT INTO genres_in_movies VALUES(14,'tt0274407');
INSERT INTO genres_in_movies VALUES(6,'tt0214289');
INSERT INTO genres_in_movies VALUES(6,'tt0274419');
INSERT INTO genres_in_movies VALUES(9,'tt0274424');
INSERT INTO genres_in_movies VALUES(18,'tt0274424');
INSERT INTO genres_in_movies VALUES(9,'tt0214520');
INSERT INTO genres_in_movies VALUES(18,'tt0274428');
INSERT INTO genres_in_movies VALUES(9,'tt0274428');
INSERT INTO genres_in_movies VALUES(8,'tt0216731');
INSERT INTO genres_in_movies VALUES(9,'tt0216994');
INSERT INTO genres_in_movies VALUES(9,'tt0216982');
INSERT INTO genres_in_movies VALUES(14,'tt0216731');
INSERT INTO genres_in_movies VALUES(6,'tt0274428');
INSERT INTO genres_in_movies VALUES(9,'tt0218400');
INSERT INTO genres_in_movies VALUES(9,'tt0218140');
INSERT INTO genres_in_movies VALUES(19,'tt0217135');
INSERT INTO genres_in_movies VALUES(18,'tt0274430');
INSERT INTO genres_in_movies VALUES(6,'tt0274430');
INSERT INTO genres_in_movies VALUES(9,'tt0274430');
INSERT INTO genres_in_movies VALUES(9,'tt0218323');
INSERT INTO genres_in_movies VALUES(6,'tt0274432');
INSERT INTO genres_in_movies VALUES(7,'tt0274457');
INSERT INTO genres_in_movies VALUES(16,'tt0274457');
INSERT INTO genres_in_movies VALUES(9,'tt0274460');
INSERT INTO genres_in_movies VALUES(9,'tt0218390');
INSERT INTO genres_in_movies VALUES(6,'tt0218390');
INSERT INTO genres_in_movies VALUES(21,'tt0217031');
INSERT INTO genres_in_movies VALUES(18,'tt0274626');
INSERT INTO genres_in_movies VALUES(11,'tt0274626');
INSERT INTO genres_in_movies VALUES(9,'tt0274757');
INSERT INTO genres_in_movies VALUES(18,'tt0214275');
INSERT INTO genres_in_movies VALUES(7,'tt0274757');
INSERT INTO genres_in_movies VALUES(19,'tt0274796');
INSERT INTO genres_in_movies VALUES(9,'tt0214265');
INSERT INTO genres_in_movies VALUES(3,'tt0274796');
INSERT INTO genres_in_movies VALUES(9,'tt0218107');
INSERT INTO genres_in_movies VALUES(6,'tt0274812');
INSERT INTO genres_in_movies VALUES(6,'tt0216290');
INSERT INTO genres_in_movies VALUES(18,'tt0274812');
INSERT INTO creditcards VALUES('1354895123485674896', 'Robert', 'Tange', '2006/08/18');
INSERT INTO creditcards VALUES('1351566345587445856', 'Shane', 'Stewart', '2004/04/28');
INSERT INTO creditcards VALUES('1359846518947563489', 'Martha', 'Matthews', '2005/09/27');
INSERT INTO creditcards VALUES('1351594897535684893', 'Joey', 'Larson', '2005/04/24');
INSERT INTO creditcards VALUES('1351597784565853325', 'Fred', 'Terrance', '2005/08/19');
INSERT INTO creditcards VALUES('671301', 'Ryan', 'Kholer', '2006/02/28');
INSERT INTO creditcards VALUES('671302', 'David', 'James', '2005/06/03');
INSERT INTO creditcards VALUES('671303', 'Andy', 'Tsai', '2007/09/11');
INSERT INTO creditcards VALUES('671304', 'Liem', 'Tran', '2005/12/12');
INSERT INTO creditcards VALUES('671305', 'Abraham', 'Lincoln', '2008/11/30');
INSERT INTO creditcards VALUES('671306', 'Pete', 'Rose', '2005/07/04');
INSERT INTO creditcards VALUES('671307', 'Stan', 'Marsh', '2009/08/15');
INSERT INTO creditcards VALUES('671308', 'George', 'Clinton', '2008/04/01');
INSERT INTO creditcards VALUES('671309', 'Al', 'Bundy', '2007/10/10');
INSERT INTO creditcards VALUES('671310', 'Peggy', 'Bundy', '2006/08/19');
INSERT INTO creditcards VALUES('671311', 'Marcy', 'Darcy', '2007/08/13');
INSERT INTO creditcards VALUES('671312', 'Jefferson', 'Darcy', '2006/09/09');
INSERT INTO creditcards VALUES('671313', 'Carole', 'Carlson', '2007/01/13');
INSERT INTO creditcards VALUES('671314', 'Carl', 'Carlson', '2008/03/24');
INSERT INTO creditcards VALUES('671315', 'Kevin', 'Sorbo', '2007/05/21');
INSERT INTO creditcards VALUES('671316', 'Richard', 'Gomez', '2008/06/30');
INSERT INTO customers VALUES(490001, 'James', 'Brown', '490001', '530 White Ave., Los Angeles, CA 91701', 'jbrown@ics185.edu', 'keyboard');
INSERT INTO customers VALUES(490002, 'John', 'Black', '490002', '531 Green Ave., Anaheim, CA 92456', 'jblack@ics185.edu', 'paper');
INSERT INTO customers VALUES(490003, 'Keith', 'White', '490003', '532 Yale Ave., Irvine, CA 92617', 'kwhite@ics185.edu', 'book');
INSERT INTO customers VALUES(490004, 'Kathy', 'Smith', '490004', '533 Alton Ave., Irvine, CA 92654', 'ksmith@ics185.edu', 'light');
INSERT INTO customers VALUES(490005, 'Jane', 'Harris', '490005', '534 Culver Ave., Orange, CA 92156', 'jharris@ics185.edu', 'honey');
INSERT INTO customers VALUES(490006, 'Bonnie', 'Clark', '490006', '535 Barranca Ave., Irvine, CA 92653', 'bclark@ics185.edu', 'funny');
INSERT INTO customers VALUES(490007, 'Jack', 'Garcia', '490007', '536 Campus Ave., Los Angeles, CA 91720', 'jgarcia@ics185.edu', 'window');
INSERT INTO customers VALUES(490008, 'Connie', 'Taylor', '490008', '537 Orange Ave., Orange, CA 92156', 'ctaylor@ics185.edu', 'pencil');
INSERT INTO customers VALUES(490009, 'Mike', 'Davis', '490009', '538 creek Ave., Tustin, CA 92710', 'mdavis@ics185.edu', 'material');
INSERT INTO customers VALUES(490010, 'Jess', 'Jackson', '490010', '539 Main St., Costa Mesa, CA 92711', 'jjackson@ics185.edu', 'cup');
INSERT INTO customers VALUES(490011, 'Cindy', 'Hall', '490011', '540 Creek Ave., Irvine, CA 92704', 'chall@ics185.edu', 'juice');
INSERT INTO customers VALUES(490012, 'Catherine', 'Lee', '490012', '541 McGaw St., Laguna Beach, CA 92720', 'clee@ics185.edu', 'glass');
INSERT INTO customers VALUES(490013, 'Jane', 'Johnson', '490013', '542 Harvard St., Irvine CA 92711', 'jjohnson@ics185.edu', 'tape');
INSERT INTO customers VALUES(490014, 'Fay', 'Berry', '490014', '543 Santa Monica Blvd., Santa Monica, CA 90231', 'fberry@ics185.edu', 'shoes');
INSERT INTO customers VALUES(490015, 'Joyce', 'Stuart', '490015', '544 Cherry Ave., Seal Beach, CA 92615', 'jstuart@ics185.edu', 'bowl');
INSERT INTO customers VALUES(490016, 'David', 'Rice', '490016', '545 El Toro Ave., Laguna Hills, CA 92652', 'drice@ics185.edu', 'board');
INSERT INTO customers VALUES(490017, 'Kyle', 'Shaw', '490017', '546 Fairview Dr., Costa Mesa, CA 92701', 'kshaw@ics185.edu', 'tissue');
INSERT INTO customers VALUES(490018, 'Kate', 'Burman', '490018', '547 Murphy St., Laguna Woods, CA 92811', 'kburman@ics185.edu', 'drink');
INSERT INTO customers VALUES(490019, 'Sherry', 'Milton', '490019', '548 Jamboree St., Irvine, CA 92626', 'smilton@ics185.edu', 'food');
INSERT INTO customers VALUES(490020, 'Bill', 'Brady', '490020', '549 Bryan St., Tustin Ranch, CA 927616', 'bbrady@ics185.edu', 'fruit');
INSERT INTO customers VALUES(755001, 'Amy', 'Adams', '755001', '101 Anteater Ave, Irvine, CA, 92626 ', 'aa@aol.com', 'asdf');
INSERT INTO sales VALUES(13,755003,'tt0439292', '2005/01/20');
INSERT INTO sales VALUES(14,755006,'tt0491015', '2005/01/20');
INSERT INTO sales VALUES(15,755007,'tt0483977', '2005/01/20');
INSERT INTO sales VALUES(16,755008,'tt0417281', '2005/01/20');
INSERT INTO sales VALUES(17,961,'tt0164961', '2005/01/20');
INSERT INTO sales VALUES(18,965,'tt0322365', '2005/01/20');
INSERT INTO sales VALUES(19,967,'tt0318068', '2005/01/20');
INSERT INTO sales VALUES(20,968,'tt0358303', '2005/01/20');
INSERT INTO sales VALUES(21,970,'tt0397550', '2005/01/20');
INSERT INTO sales VALUES(22,971,'tt0427426', '2005/01/20');
INSERT INTO sales VALUES(23,975,'tt0284182', '2005/01/20');
INSERT INTO sales VALUES(24,976,'tt0399144', '2005/01/20');
INSERT INTO sales VALUES(25,977,'tt0479725', '2005/01/20');
INSERT INTO sales VALUES(26,978,'tt0373293', '2005/01/20');
INSERT INTO sales VALUES(27,979,'tt0446687', '2005/01/20');
INSERT INTO sales VALUES(28,135001,'tt0339890', '2001/06/25');
INSERT INTO sales VALUES(29,135001,'tt0431124', '2001/07/25');
INSERT INTO sales VALUES(30,135001,'tt0213149', '2003/08/14');
INSERT INTO sales VALUES(31,135004,'tt0286917', '2002/12/12');
INSERT INTO sales VALUES(32,135005,'tt0455297', '2004/04/28');
INSERT INTO sales VALUES(33,135006,'tt0476456', '2001/06/25');
INSERT INTO ratings VALUES('tt0213802',3,1661);
INSERT INTO ratings VALUES('tt0213985',7,2309);
INSERT INTO ratings VALUES('tt0214265',6.4,830);
INSERT INTO ratings VALUES('tt0214275',7.8,33);
INSERT INTO ratings VALUES('tt0214289',6.3,2724);
INSERT INTO ratings VALUES('tt0214503',3.9,51);
INSERT INTO ratings VALUES('tt0214520',5.7,77);
INSERT INTO ratings VALUES('tt0214723',5.8,62);
INSERT INTO ratings VALUES('tt0215244',3,5);
INSERT INTO ratings VALUES('tt0216290',6.9,30);
INSERT INTO ratings VALUES('tt0216731',7,443);
INSERT INTO ratings VALUES('tt0216982',6.7,451);
INSERT INTO ratings VALUES('tt0216994',6.4,9);
INSERT INTO ratings VALUES('tt0217031',5.9,272);
INSERT INTO ratings VALUES('tt0217084',7.9,443);
INSERT INTO ratings VALUES('tt0499469',7.1,179);
INSERT INTO ratings VALUES('tt0217085',4.8,60);
INSERT INTO ratings VALUES('tt0217100',7,228);
INSERT INTO ratings VALUES('tt0217135',6.2,301);
INSERT INTO ratings VALUES('tt0217716',4.6,41);
INSERT INTO ratings VALUES('tt0218107',5.2,1004);
INSERT INTO ratings VALUES('tt0218126',3.4,364);
INSERT INTO ratings VALUES('tt0218140',8.6,27);
INSERT INTO ratings VALUES('tt0218323',6,171);
INSERT INTO ratings VALUES('tt0218390',6.3,157);
INSERT INTO ratings VALUES('tt0218400',6.3,14);
INSERT INTO users (username, password) VALUES('iamusername', 'iampassword'); |
use HOUSEDB
Select * from CONTRACTS
Select * from CUSTOMERS
Select * from EMPLOYEES
Select * from HOUSES
--Q1--Cho biết thông tin các căn hộ cho thuê có giá từ 600 đến 800. Sắp xếp giảm dần theo diện tích.
Select * from HOUSES where price>=600 and price<=800 order by Area_m2 DESC
--Q2--
Select CUSTOMERS.*, ContractNo from CONTRACTS inner join CUSTOMERS on CONTRACTS.CustomerID=CUSTOMERS.CustomerID where ContractNo='CT001'
--Q3--
Select HOUSES.HouseID, startDate from HOUSES inner join CONTRACTS on CONTRACTS.HouseID=HOUSES.HouseID
where year(startDate)!=2018 or (year(startDate)=2018 and month(startDate)<10 )
--Q4--
Select BedRoom, count(*) as numberOfBedroom from HOUSES group by BedRoom
--Q5--
Select Ename, CONTRACTs.EmpID, count(CONTRACTs.EmpID) as numberOfContracts from EMPLOYEES inner join CONTRACTS on EMPLOYEES.EmpID=CONTRACTS.EmpID where year(StartDate)=2018
group by CONTRACTS.EmpID, Ename having count(CONTRACTs.EmpID)>=1
--Q6--
Select Cname, CUSTOMERS.Gender, HOUSES.HouseID, Area_m2, startDate, endDate, Duration, ContractValue, Ename from CONTRACTS inner join HOUSES on CONTRACTS.houseID=HOUSES.houseID
inner join EMPLOYEES on CONTRACTS.empID=EMPLOYEES.empID inner join CUSTOMERS on CONTRACTS.CustomerID=CUSTOMERS.CustomerID
where year(endDate)=2018 and month(endDate)=6
--Q7--
Select BedRoom, count(*) as numberOfHouses from HOUSES inner join CONTRACTs on HOUSES.houseID=CONTRACTS.houseID
where year(StartDate)=2018 and month(StartDate)<10 and month(StartDate)>6 group by BedRoom
--Q8--
Select HouseID, count(*) as numberOfRented, sum(Duration) sumDuration, sum(ContractValue) from CONTRACTS
where year(StartDate)=2018 group by HouseID
--Q9--
Select top 1* from CONTRACTS where year(StartDate)=2018 order by Duration DESC
--Q10--
Select * from HOUSES where BedRoom=3 and Price<500 |
create view PesquisaPorFilme as
SELECT Nome,linkTrailler FROM filmes WHERE Nome = "% Onde sera colocado a pesquisa do usuario %";
|
select * from nonexistent_relation;
|
select * from mydb.photo_post order by createdAt asc; |
/*
Name: TestQ without State
Data source: 4
Created By: Admin
Last Update At: 2016-03-23T19:31:11.668277+00:00
*/
SELECT MG_LA.street_address AS Street_Address,
MG_LA.city AS City,
MG_LA.zip_code AS Zip_code,
MG_LA.country AS Country,
v.page_url AS URL,
MG_HL.agent_name AS Agent,
count(*) AS Clicks,
FROM
(SELECT page_url,
FIRST(SPLIT(LAST(SPLIT(post_prop5, '/')), '-')) AS Listing,
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")'))
WHERE post_prop10= 'berkshire_hathaway_widget'
AND post_prop72 = ''
AND post_page_event='0'
AND DATE(date_time) >= DATE('{{startdate}}')
AND DATE('{{startdate}}') >= DATE('2016-02-01')
AND DATE(date_time) <= DATE('{{enddate}}'))v
LEFT JOIN [djomniture:devspark.MG_Hierarchy_Listing] AS MG_HL ON v.Listing = MG_HL.listing_id
LEFT JOIN [djomniture:devspark.MG_Listing_Address] AS MG_LA ON v.Listing = MG_LA.id
GROUP BY URL,
Agent,
Street_Address,
City,
Zip_code,
Country
ORDER BY Clicks DESC
|
CREATE TABLE `product_isbn` (
`product_id` int(10) unsigned NOT NULL,
`isbn` char(10) NOT NULL,
PRIMARY KEY (`product_id`, `isbn`),
CONSTRAINT `product_product_isbn` FOREIGN KEY `product_id` (`product_id`)
REFERENCES `product` (`product_id`)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
-- 2019.11.25
-- CROSS JOIN : 테이블을 단순히 붙여준다.
-- JOIN -> 테이블을 집합으로 보고 집합의 곱 연산의 결과이다. -> N x M (결과 행이다)
select *
from emp, dept;
-- EQUI JOIN
select *
from emp, dept
where emp.deptno=dept.deptno;
-- 이름이 'SCOTT' 인 사원의 소속부서의 이름을 이름과 함께 출력하자.
select ename, dname -- emp.ename dept.dname
from emp, dept
where emp.deptno=dept.deptno
and ename='SCOTT';
select ename, dname
from emp e, dept d -- 별칭 사용
where e.deptno=d.deptno
and ename='SCOTT';
-- NON-EQUI JOIN
select e.sal, s.losal, s.hisal, e.ename, s.grade
from emp e, salgrade s
where sal between s.losal and s.hisal
order by s.grade;
-- SELF JOIN
select mgr
from emp
where ename='SMITH';
select ename
from emp
where empno='7902';
select e1.ename, e2.ename, d.dname
from emp e1, emp e2, dept d
where e1.mgr=e2.empno and e1.deptno=d.deptno
order by e1.mgr;
-- OUTER JOIN
select e.ename, m.ename
from emp e, emp m
where e.mgr=m.empno(+);
-- ANSI JOIN
-- CROSS JOIN
select * from emp, dept;
select * from emp cross join dept; -- mysql, ms-sql, oracle
-- INNER JOIN
select * from emp e, dept d where e.deptno=d.deptno;
select * from emp e inner join dept d on e.deptno=d.deptno;
select * from emp inner join dept on emp.deptno=dept.deptno;
-- USING
select * from emp inner join dept using(deptno);
-- NATURAL
select * from emp natural join dept;
-- left|right|full OUTER JOIN
select * from emp e, emp m where e.mgr=m.empno(+);
select * from emp e inner join emp m on e.mgr=m.empno; --null값으로 king 출력 안됨
select * from emp e left outer join emp m on e.mgr=m.empno;
select * from emp m right outer join emp e on e.mgr=m.empno;
-- 부속질의 : 쿼리 안에 쿼리 작성
-- select (부속질의) from (부속질의) where 컬럼 조건식 (부속질의)
-- emp 테이블에서 평균 급여보다 급여를 더 많이 받는 사원의 리스트를 출력
-- sal > 평균급여 <- 부속질의
select avg(sal) from emp; -- 2073.2142
select ename, sal from emp where sal>2073.2142;
select * from emp where sal > ( select avg(sal) from emp );
-- 다중행 조건
-- 3000 이상 받는 사원이 소속된 부서(10번, 20번)와 동일한 부서에서 근무하는 사원출력
-- 3000 이상 받는 사원이 소속된 부서 : 부속질의
-- 동일한 부서에서 근무하는 사원출력
select ename, deptno
from emp
where deptno in ( select distinct deptno from emp where sal>=3000 );
-- 30번 소속 사원들 중에서 급여를 가장 많이 받는 사원보다 더 많은 급여를 받는 사원의 이름, 급여를 출력
-- 30번 소속 사원들 중에서 급여를 가장 많이 받는 사원 : 조건
select ename, sal from emp where deptno=30;
select ename, sal from emp where sal > all ( select sal from emp where deptno=30 );
select ename, sal from emp where sal > ( select max(sal) from emp where deptno=30 );
-- 부서번호가 30번인 사원들의 급여 중 가장 작은 값(950)보다 많은 급여를 받는 사원의 이름, 급여를 출력
-- 부서번호가 30번인 사원들의 급여 중 가장 작은 값(950)보다 : 부속질의
select ename, sal from emp where deptno=30;
select ename, sal from emp where sal > any ( select sal from emp where deptno=30 );
select ename, sal from emp where sal > ( select min(sal) from emp where deptno=30 );
-- ROWNUM
select ename, rownum from emp;
-- 스칼라 부속질의 : select 뒤에 위치하는 부속질의
-- 마당서점의 고객별 판매액을 보이시오(결과는 고객이름과 고객별 판매액을 출력).
select custid from orders order by custid;
select o.custid, (select name from customer c where c.custid=o.custid) name, sum(o.saleprice), trunc(avg(o.saleprice)), count(*)
from orders o
group by o.custid;
-- 주문 정보를 출력해보자(주문번호, 고객 이름, 주문 금액)
select orderid, (select name from customer where orders.custid=customer.custid), saleprice from orders;
-- join
select o.orderid, c.name, o.saleprice from orders o, customer c where o.custid=c.custid;
-- 인라인 뷰 : from 절 뒤에 오는 부속질의 가상의 테이블로 사용
-- 고객 이름별 구매 금액의 합
select c.name, sum(o.saleprice)
from (select custid, name from customer where custid<=2)c, orders o
where c.custid=o.custid
group by c.name;
select * from (select custid, name from customer where custid<=2)c order by name;
-- ROWNUM
select ename, rownum from emp;
select ename, rownum from emp order by ename;
select ename, rownum from (select * from emp order by ename);
-- DDL
-- CREATE TABLE : 테이블 생성
-- 사원번호, 사원이름, 급여 3개의 칼럼으로 구성된 EMP01 테이블을 생성
create table emp01(
empno number(4), --사원 번호
ename varchar2(20), --사원 이름
sal number(7, 2) --급여
);
drop table emp01;
desc emp01;
-- 기존 테이블의 스키마 복사(제약조건 제외)해서 테이블 생성
create table emp02
as
select * from emp;
desc emp;
desc emp02;
create table emp03
as
select ename, empno from emp;
desc emp03;
select * from emp03;
create table emp04
as
select * from emp where deptno=10;
select * from emp04;
create table emp06
as
select * from emp where 1=0;
select * from emp06;
-- 테이블의 수정 : 컬럼의 추가, 컬럼의 수정, 컬럼의 삭제
-- 컬럼의 추가
desc emp01;
alter table emp01
add (job varchar2(9));
-- 컬럼의 수정
alter table emp01
modify (job varchar2(30));
-- 컬럼의 삭제
alter table emp01
drop column job;
create table emp07
as
select * from emp;
select * from emp07;
drop table emp07;
select * from emp02;
truncate table emp02;
-- 테이블의 이름 변경
rename emp02 to test;
rename test to emp02;
-- 제약 조건
insert into dept /*(deptno, dname, loc)*/ values (10, 'test', 'seoul'); -- 생략 가능
desc dept;
-- NOT NULL 제약 조건
drop table emp01;
create table emp01(
empno number(4) not null,
ename varchar2(20) not null,
job varchar2(10),
deptno number(2)
);
insert into emp01 values (1001, 'son', 'manager', 10);
insert into emp01 values (1001, 'lee', 'manager', 20);
select * from emp01;
drop table emp03;
select * from emp03;
create table emp03(
empno number(4) unique,
ename varchar2(20) not null,
job varchar2(10),
deptno number(2)
);
insert into emp03 values (1001, 'son', 'manager', 10);
insert into emp03 values (1002, 'king', 'manager', 30);
drop table emp04;
create table emp04(
empno number(4) constraint emp04_empno_uk unique,
ename varchar2(20) constraint emp04_ename_nn not null,
job varchar2(10),
deptno number(2)
);
insert into emp04 values (1001, 'son', 'manager', 10);
insert into emp04 values (1002, 'lee', 'manager', 30);
drop table emp05;
create table emp05(
empno number(4) constraint emp05_empno_pk primary key,
ename varchar2(20) constraint emp05_ename_nn not null,
job varchar2(10),
deptno number(2)
);
insert into emp05 values (1001, 'son', 'manager', 10);
insert into emp05 values (1001, 'lee', 'manager', 30);
drop table emp06;
create table emp06(
empno number(4) constraint emp06_empno_pk primary key,
ename varchar2(20) constraint emp06_ename_nn not null,
job varchar2(10),
deptno number(2) constraint emp06_deptno_fk references dept(deptno)
);
insert into emp06 values (1001, 'son', 'manager', null);
insert into emp06 values (1002, 'lee', 'manager', 40);
select * from emp06;
|
create or replace procedure proc_wp_extra_kpi_data_sum(p_date date)
as
v_date date;
s_error varchar2(4000);
begin
--if null then v_date = sysdate-3 (3hours before) else v_date = p_date
select trunc(decode(p_date,null,trunc(sysdate - 1,'dd'),p_date),'dd') into v_date from dual;
---------------------------region
merge into wp_extra_kpi_data wp
using(
with temp1 as
(select
int_id,
ne_type,
a.scan_start_time,
a_port_traffic
from wp_extra_kpi_data a
where a.scan_start_time between v_date and v_date+23/24 and a.sum_level=0 and a.ne_type=10003),
temp2 as
(select
temp1.int_id int_id,
temp1.ne_type ne_type,
max(a_port_traffic) a_port_traffic
from temp1
group by temp1.int_id,temp1.ne_type),
temp3 as
(select temp1.int_id int_id,temp1.ne_type ne_type,
max(scan_start_time) busy_time
from temp1,temp2
where temp2.int_id=temp1.int_id and temp2.ne_type=temp1.ne_type and temp2.a_port_traffic=temp1.a_port_traffic
group by temp1.int_id,temp1.ne_type),
temp4 as
(select r.region_id int_id,a.scan_start_time scan_start_time,a.ne_type ne_type,a.sum_level sum_level,
case when TCHLoadRate>0.7 then 1 else 0 end TCHLoadRate_busy_num ,
case when TCHLoadRate<0.1 then 1 else 0 end TCHLoadRate_nb_num ,
case when LoseCallingNum>=3 then 1 else 0 end LoseCallingNum_num ,
case when cs_CallPageSuccRate<0.8 then 1 else 0 end cs_CallPageSuccRate_num,
case when LoseCallingRate>0.05 then 1 else 0 end LoseCallingRate_num,
case when CallBlockFailNum>3 then 1 else 0 end CallBlockFailNum_num,
case when CallBlockFailRate>0.05 then 1 else 0 end CallBlockFailRate_num,
case when cs_HandoffSuccRate<0.9 then 1 else 0 end cs_HandoffSuccRate_num,
case when FwdChMaxUseRate>0.7 then 1 else 0 end FwdChMaxUseRate_num,
case when FwdChRxRate>0.05 then 1 else 0 end FwdChRxRate_num,
case when RevChRxRate>0.05 then 1 else 0 end RevChRxRate_num
from c_perf_1X_sum_cell a ,c_cell c,c_region_city r
where a.int_id=r.region_id and c.city_id=r.city_id and a.scan_start_time between v_date and v_date+23/24 and a.sum_level=0 and a.ne_type=10003)
select temp4.int_id int_id,temp4.scan_start_time busy_time,
sum(TCHLoadRate_busy_num) TCHLoadRate_busy_num,
sum(TCHLoadRate_nb_num) TCHLoadRate_nb_num,
sum(LoseCallingNum_num) LoseCallingNum_num,
sum(cs_CallPageSuccRate_num) cs_CallPageSuccRate_num,
sum(LoseCallingRate_num) LoseCallingRate_num,
sum(CallBlockFailNum_num) CallBlockFailNum_num,
sum(CallBlockFailRate_num) CallBlockFailRate_num,
sum(cs_HandoffSuccRate_num) cs_HandoffSuccRate_num,
sum(FwdChMaxUseRate_num) FwdChMaxUseRate_num,
sum(FwdChRxRate_num) FwdChRxRate_num,
sum(RevChRxRate_num) RevChRxRate_num
from temp3,temp4
where temp4.int_id=temp3.int_id and temp4.scan_start_time=temp3.busy_time and temp4.sum_level=0 and temp4.ne_type=10003
group by temp4.int_id,temp4.scan_start_time) t
on(wp.int_id = t.int_id and wp.scan_start_time = v_date and wp.ne_type=10003 and wp.sum_level=1)
when matched then update set
busy_time =t.busy_time,
TCHLoadRate_busy_num =t.TCHLoadRate_busy_num,
TCHLoadRate_nb_num =t.TCHLoadRate_nb_num ,
LoseCallingNum_num =t.LoseCallingNum_num ,
cs_CallPageSuccRate_num =t.cs_CallPageSuccRate_num ,
LoseCallingRate_num =t.LoseCallingRate_num ,
CallBlockFailNum_num =t.CallBlockFailNum_num ,
CallBlockFailRate_num =t.CallBlockFailRate_num ,
cs_HandoffSuccRate_num =t.cs_HandoffSuccRate_num ,
FwdChMaxUseRate_num =t.FwdChMaxUseRate_num ,
FwdChRxRate_num =t.FwdChRxRate_num ,
RevChRxRate_num =t.RevChRxRate_num
when not matched then insert (
wp.int_id,
wp.scan_start_time,
wp.ne_type,
wp.sum_level,
wp.busy_time,
wp.TCHLoadRate_busy_num,
wp.TCHLoadRate_nb_num ,
wp.LoseCallingNum_num ,
wp.cs_CallPageSuccRate_num ,
wp.LoseCallingRate_num ,
wp.CallBlockFailNum_num ,
wp.CallBlockFailRate_num ,
wp.cs_HandoffSuccRate_num ,
wp.FwdChMaxUseRate_num,
wp.FwdChRxRate_num ,
wp.RevChRxRate_num)
values(
t.int_id,
v_date,
10003,
1,
t.busy_time,
t.TCHLoadRate_busy_num,
t.TCHLoadRate_nb_num ,
t.LoseCallingNum_num ,
t.cs_CallPageSuccRate_num ,
t.LoseCallingRate_num ,
t.CallBlockFailNum_num ,
t.CallBlockFailRate_num ,
t.cs_HandoffSuccRate_num ,
t.FwdChMaxUseRate_num ,
t.FwdChRxRate_num ,
t.RevChRxRate_num
);
commit;
merge into wp_extra_kpi_data wp
using(
with temp1 as
(select
int_id,
ne_type,
a.scan_start_time,
a_port_traffic
from wp_extra_kpi_data a
where a.scan_start_time between v_date and v_date+23/24 and a.sum_level=0 and a.ne_type=10003),
temp2 as
(select
temp1.int_id int_id,
temp1.ne_type ne_type,
max(a_port_traffic) a_port_traffic
from temp1
group by temp1.int_id,temp1.ne_type),
temp3 as
(select temp1.int_id int_id,temp1.ne_type ne_type,
max(scan_start_time) busy_time
from temp1,temp2
where temp2.int_id=temp1.int_id and temp2.ne_type=temp1.ne_type and temp2.a_port_traffic=temp1.a_port_traffic
group by temp1.int_id,temp1.ne_type),
temp4 as
(select r.region_id int_id,a.scan_start_time scan_start_time,a.ne_type ne_type,a.sum_level sum_level,
case when WireConnectSuccRate<0.8 then 1 else 0 end WireConnectSuccRate_num ,
case when WireRadioFRate>0.05 then 1 else 0 end WireRadioFRate_num ,
case when FwdRLPRxRate>0.05 then 1 else 0 end FwdRLPRxRate_num ,
case when RevRLPRxRate>0.05 then 1 else 0 end RevRLPRxRate_num
from c_perf_DO_sum_cell a ,c_cell c,c_region_city r
where a.int_id=r.region_id and c.city_id=r.city_id and a.scan_start_time between v_date and v_date+23/24 and a.sum_level=0 and a.ne_type=10003)
select temp4.int_id int_id,temp4.scan_start_time busy_time,
sum(WireConnectSuccRate_num) WireConnectSuccRate_num,
sum(WireRadioFRate_num) WireRadioFRate_num,
sum(FwdRLPRxRate_num) FwdRLPRxRate_num,
sum(RevRLPRxRate_num) RevRLPRxRate_num
from temp3,temp4
where temp4.int_id=temp3.int_id and temp4.scan_start_time=temp3.busy_time and temp4.sum_level=0 and temp4.ne_type=10003
group by temp4.int_id,temp4.scan_start_time) t
on(wp.int_id = t.int_id and wp.scan_start_time = v_date and wp.ne_type=10003 and wp.sum_level=1)
when matched then update set
busy_time =t.busy_time,
WireConnectSuccRate_num =t.WireConnectSuccRate_num,
WireRadioFRate_num =t.WireRadioFRate_num ,
FwdRLPRxRate_num =t.FwdRLPRxRate_num ,
RevRLPRxRate_num =t.RevRLPRxRate_num
when not matched then insert (
int_id,
scan_start_time,
ne_type,
sum_level,
busy_time,
WireConnectSuccRate_num,
WireRadioFRate_num ,
FwdRLPRxRate_num ,
RevRLPRxRate_num )
values(
t.int_id,
v_date,
10003,
1,
t.busy_time,
t.WireConnectSuccRate_num,
t.WireRadioFRate_num ,
t.FwdRLPRxRate_num ,
t.RevRLPRxRate_num
);
commit;
merge into wp_extra_kpi_data wp
using(
with temp1 as
(select
int_id,
ne_type,
a.scan_start_time,
a_port_traffic
from wp_extra_kpi_data a
where a.scan_start_time between v_date and v_date+23/24 and a.sum_level=0 and a.ne_type=10003),
temp2 as
(select
temp1.int_id int_id,
temp1.ne_type ne_type,
max(a_port_traffic) a_port_traffic
from temp1
group by temp1.int_id,temp1.ne_type),
temp3 as
(select temp1.int_id int_id,temp1.ne_type ne_type,
max(scan_start_time) busy_time
from temp1,temp2
where temp2.int_id=temp1.int_id and temp2.ne_type=temp1.ne_type and temp2.a_port_traffic=temp1.a_port_traffic
group by temp1.int_id,temp1.ne_type),
temp4 as
(select r.region_id int_id,a.scan_start_time scan_start_time,a.ne_type ne_type,a.sum_level sum_level,
case when trafficExcludeHoCs=0 then 1 else 0 end tch_traffic_nho_num
from c_tpa_sts_cell a ,c_cell c,c_region_city r
where a.int_id=r.region_id and c.city_id=r.city_id and a.scan_start_time between v_date and v_date+23/24 and a.sum_level=0 and a.ne_type=10003)
select temp4.int_id int_id,temp4.scan_start_time busy_time,
sum(tch_traffic_nho_num) tch_traffic_nho_num
from temp3,temp4
where temp4.int_id=temp3.int_id and temp4.scan_start_time=temp3.busy_time and temp4.sum_level=0 and temp4.ne_type=10003
group by temp4.int_id,temp4.scan_start_time) t
on(wp.int_id = t.int_id and wp.scan_start_time = v_date and wp.ne_type=10003 and wp.sum_level=1)
when matched then update set
tch_traffic_nho_num =t.tch_traffic_nho_num
when not matched then insert (
int_id,
scan_start_time,
ne_type,
sum_level,
tch_traffic_nho_num)
values(
t.int_id,
v_date,
10003,
1,
t.tch_traffic_nho_num
);
commit;
exception when others then
s_error := sqlerrm;
rollback;
insert into job_log values(sysdate,'wp_extra_kpi_data',s_error);
commit;
end;
|
--表
SELECT * FROM AppBusinessTable i WHERE i.AliasName = '<%tableAlias%>'
--字段表
SELECT * FROM AppBusinessTableColumn i WHERE i.BusinessTableId = (SELECT TOP 1 i.Id FROM AppBusinessTable i WHERE i.AliasName = '<%tableAlias%>')
--字段变更记录
SELECT * FROM AppBusinessTableColumnChangeHistory i WHERE i.BusinessTableId = (SELECT TOP 1 i.Id FROM AppBusinessTable i WHERE i.AliasName = '<%tableAlias%>')
--表多语言
SELECT * FROM AppLanguage i WHERE i.[Key] In (SELECT LangName FROM AppBusinessTable WHERE AliasName = '<%tableAlias%>')
--表字段多语言
SELECT * FROM AppLanguage i WHERE i.[Key] In (SELECT langName FROM AppBusinessTableColumn a WHERE a.BusinessTableId = (SELECT TOP 1 b.Id FROM AppBusinessTable b WHERE b.AliasName = '<%tableAlias%>')) |
CREATE PROCEDURE sp_list_Claims_StockDestruction(@VENDORID NVARCHAR(15), @FROMDATE DATETIME,
@TODATE DATETIME)
AS
SELECT ClaimID, ClaimDate, ClaimsNote.VendorID, Vendors.Vendor_Name, DocumentID, Status,
Balance, ClaimValue
FROM ClaimsNote, Vendors
WHERE ClaimsNote.VendorID LIKE @VENDORID
AND ClaimsNote.VendorID = Vendors.VendorID
AND ClaimDate BETWEEN @FROMDATE AND @TODATE
AND Isnull(Status, 0) & 129 = 0
AND ClaimType in (1)
ORDER BY ClaimsNote.VendorID, ClaimsNote.ClaimDate
|
REM This script shows the wati events of the given session.
REM pxl@xxx.com @2015-01-19
set echo off
set feedback off
set verify off
set timing off
set sqlblanklines on
set pagesize 20
set newpage 1
set heading on
set linesize 250
accept v_sessionId -
prompt 'Enter session sid: '
COL sid FORMAT 9999999990
COL event FORMAT A30
COL blocking_session FORMAT A16
COL sql_text FORMAT A50
PRO == Wait events =============================================================================
SELECT a.sid AS SID
, a.event AS EVENT
, a.blocking_session AS BLOCKING_SESSION
, b.sql_text AS SQL_TEXT
FROM v$session a
LEFT JOIN v$sqlarea b
ON b.hash_value = a.sql_hash_value
WHERE a.sid = &&v_sessionId
;
PRO == Mutex usage =============================================================================
SELECT mt.mutex_type AS MUTEX_TYPE
, mt.location AS THE_LOCATION
, mt.sleeps AS SLEEPS
, mt.wait_time AS WAIT_TIME
FROM v$mutex_sleep mt
WHERE mt.mutex_type = 'Cursor Pin'
;
undef v_sessionId
|
INSERT INTO core_crm_customer_health(mykatastima,
fkcustomer)
(select mykatastima,id from core_crm_customer);
|
/*
SQLyog Ultimate v10.00 Beta1
MySQL - 5.6.39-log
说明:在字典表sys_dict和机构表sys_office中添加代理商相关信息.
@author rhx
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
insert into `sys_dict` (`id`, `value`, `label`, `type`, `description`, `sort`, `parent_id`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`) values('3dc4fc26b7d14078b48e8562e876e2f3','7','代理商','sys_user_type','用户类型','70','0','1','2018-07-19 12:33:46','1','2018-07-19 12:33:46','','0');
insert into `sys_dict` (`id`, `value`, `label`, `type`, `description`, `sort`, `parent_id`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`) values('4c254eed1eb248829075f2fe74b7ca9e','6','省级代理','sys_office_type','权构类型','120','0','1','2018-07-17 18:53:12','1','2018-07-18 17:04:24','','0');
insert into `sys_dict` (`id`, `value`, `label`, `type`, `description`, `sort`, `parent_id`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`) values('72ebd74eeb384f7589e4b6b4909afe68','7','市级代理','sys_office_type','权构类型','130','0','1','2018-07-17 18:54:26','1','2018-07-18 17:04:34','','0');
insert into `sys_office` (`id`, `oid`, `parent_id`, `parent_ids`, `name`, `sort`, `area_id`, `code`, `type`, `grade`, `relat_level`, `address`, `zip_code`, `master`, `phone`, `fax`, `email`, `USEABLE`, `PRIMARY_PERSON`, `DEPUTY_PERSON`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`) values('228a27be58d6469f8f581bd106276f31','11138','1','0,1,','代理商','30','1','','9','1',NULL,'','','','','','','1',NULL,NULL,'1','2018-07-19 18:49:54','1','2018-07-19 18:49:54','','0');
|
CREATE Procedure sp_acc_fixedaccounts
As
Select AccountID,AccountName,AccountsMaster.GroupID,GroupName from
Accountsmaster,AccountGroup where AccountsMaster.GroupID=AccountGroup.GroupID and AccountsMaster.Fixed=1
order by AccountID
|
-- create portion
set hive.execution.engine=spark;
use dws;
drop table if exists dws.tmp_dws_order_process_node_num;
create table if not exists dws.tmp_dws_order_process_node_num (
apply_no string COMMENT '订单号' ,
branch_name_1_level string COMMENT '分公司_一级',
org_name string COMMENT '市场部门',
org_leader string COMMENT '团队长',
sales_user_name string COMMENT '渠道经理',
product_name string COMMENT '产品名称',
interview_save_time string COMMENT '面签保存时间',
interview_time string COMMENT '面签时间',
max_approval_time string COMMENT '最终审批时间',
max_approval_status string COMMENT '最终审批结果',
loan_time_xg string COMMENT '放款时间_销管',
financial_archive_event_time string COMMENT '财务归档时间',
apply_status_name string COMMENT '订单状态',
loan_num_xg string COMMENT '放款笔数_销管',
interview_num_xg string COMMENT '面签笔数_销管',
release_amount_xg string COMMENT '放款金额',
max_payment_time string COMMENT '回款时间',
product_type string COMMENT '产品类型',
etl_update_time string COMMENT 'etl时间'
) stored as parquet;
-- with portion
with tmp_org as (
select
org_code,
org_name_, -- 所属团队
concat_ws(',',collect_set(case when user_post like "%市场%主管%" then fullname_ end)) org_leader -- 团队长_市场主管
from ods.ods_bpms_sys_org_user_common where org_name_ like '%市场%'
group by org_code,org_name_
),
tmp_opinion_desc as(
select
tmp.PROC_INST_ID_
,min(case when tmp.TASK_KEY_ = 'UserTask4' then tmp.STATUS_ end ) UserTask4_STATUS_
,min(case when tmp.TASK_KEY_ = 'UserTask3' then tmp.STATUS_ end ) UserTask3_STATUS_
,min(case when tmp.TASK_KEY_ = 'ManCheck' then tmp.STATUS_ end ) ManCheck_STATUS_
,min(case when tmp.TASK_KEY_ = 'Investigate' then tmp.STATUS_ end ) Investigate_STATUS_
,min(case when tmp.TASK_KEY_ = 'Interview' then tmp.COMPLETE_TIME_ end ) interview_time -- 面签时间
,min(case when tmp.TASK_KEY_ = 'UserTask2' and TASK_NAME_ = "面签" then tmp.COMPLETE_TIME_ end ) interview_time_v1 -- 面签时间
,min(case when tmp.TASK_KEY_ = 'DownHouseSurvey' then tmp.COMPLETE_TIME_ end ) DownHouseSurvey_time -- 下户时间
,min(case when tmp.TASK_KEY_ = 'DownHouseSurvey' then tmp.AUDITOR_NAME_ end ) DownHouseSurvey_user -- 下户经办人
,min(case when tmp.TASK_KEY_ = 'UserTask5' then tmp.COMPLETE_TIME_ end ) send_loan_command_time_v1 -- 发送放款指令时间
,min(case when tmp.TASK_KEY_ = 'SendLoanCommand' then tmp.COMPLETE_TIME_ end ) send_loan_command_time -- 发送放款指令时间
,min(case when tmp.TASK_KEY_ = 'AgreeLoanMark' then tmp.COMPLETE_TIME_ end ) agreeloanmark_time -- 同贷信息登记时间
,min(case when tmp.TASK_KEY_ = 'CostConfirm' then tmp.COMPLETE_TIME_ end ) costconfirm_time -- 缴费确认时间
,min(case when tmp.TASK_KEY_ = 'UserTask4' then tmp.COMPLETE_TIME_ end ) investigate_time_tfb --审查时间 郑州提放保 "NSL-TFB371", "SL-TFB371"
,min(case when tmp.TASK_KEY_ = 'ManCheck' then tmp.COMPLETE_TIME_ end ) investigate_time_v2 --审查时间
,min(case when tmp.TASK_KEY_ = 'Investigate' then tmp.COMPLETE_TIME_ end ) investigate_time_v25 -- 审查时间
,min(case when tmp.TASK_KEY_ = 'UserTask3' then tmp.COMPLETE_TIME_ end ) investigate_time_v1 -- 审查时间
,min(case when tmp.TASK_KEY_ = 'RandomMark' then tmp.COMPLETE_TIME_ end ) random_mark_time -- 赎楼登记时间
,min(case when tmp.TASK_KEY_ = 'CancleMortgage' then tmp.COMPLETE_TIME_ end ) cancle_mortage_time -- 注销抵押时间
,min(case when tmp.TASK_KEY_ = 'TransferIn' then tmp.COMPLETE_TIME_ end ) transfer_in_time -- 过户递件时间
,min(case when tmp.TASK_KEY_ = 'TransferOut' then tmp.COMPLETE_TIME_ end ) transfer_out_time -- 过户出件
,min(case when tmp.TASK_KEY_ = 'MortgagePass' then tmp.COMPLETE_TIME_ end ) mortgage_pass_time -- 抵押递件时间
,min(case when tmp.TASK_KEY_ = 'MortgageOut' then tmp.COMPLETE_TIME_ end ) mortgage_out_time -- 抵押出件时间
,min(case when tmp.TASK_KEY_ = 'OverInsurance' then tmp.COMPLETE_TIME_ end ) over_insurance_time -- 解保时间
,min(case when tmp.TASK_KEY_ = 'financialArchiveEvent' then tmp.COMPLETE_TIME_ end ) financial_archive_event_time -- 财务归档时间
from (
select
b.*, row_number() over(partition by b.PROC_INST_ID_, b.TASK_KEY_ order by b.COMPLETE_TIME_ desc ) rank
from ods.ods_bpms_bpm_check_opinion_common_ex b
) tmp
where rank = 1
group by tmp.PROC_INST_ID_
),
tmp_bco as (
select apply_no,
concat_ws(',',collect_set(OPINION_))OPINION_
from ods.ods_bpms_bpm_check_opinion_common_ex
where `STATUS_`='manual_end'
group by apply_no
),
tmp_trade_cc01 as (
select obcct.apply_no, max(obcct.trans_day) max_cc01_time, sum(obcct.trans_money) total_cc01_money
from ods.ods_bpms_c_cost_trade obcct
where obcct.trans_type = "CC01"
group by obcct.apply_no
),
tmp_obbh as (
select bh.house_no, count(*) fcsl
from ods.ods_bpms_biz_house bh
where bh.house_type not in ("qt", "cw") and bh.house_no is not null and bh.house_no <> ""
group by bh.house_no
),
tmp_brf as (
select * from ods.ods_bpms_biz_ransom_floor_common where rn=1
)
-- insert portion
insert overwrite table dws.tmp_dws_order_process_node_num
SELECT
bao.apply_no -- 订单号
, dc.company_name_2_level branch_name_1_level -- 1级分公司
, sys.org_name_ org_name -- 市场部门
, sys.org_leader -- 团队长
, bao.sales_user_name -- 渠道经理
, bao.product_name -- 产品名称
, bim.interview_save_time -- 面签保存时间
, t666.interview_time_min interview_time -- 面签时间
, nvl(
case when bao.product_id in ("NSL-TFB371", "SL-TFB371") then opid.investigate_time_tfb -- 郑州提放保
when bao.product_version in ('v1.5', 'v1.0') then opid.investigate_time_tfb
when bao.product_version = 'v2.0' then opid.investigate_time_v2
when bao.product_version = 'v2.5' then nvl(opid.investigate_time_v2, opid.investigate_time_v25)
end -- 审批时间
,case when bao.product_id in ("NSL-TFB371", "SL-TFB371") then opid.investigate_time_tfb -- 郑州提放保
when bao.product_version in ('v1.5', 'v1.0') then opid.investigate_time_v1
when bao.product_version = 'v2.0' then opid.investigate_time_v2
when bao.product_version = 'v2.5' then opid.investigate_time_v25
end -- 审查时间
) max_approval_time -- 最终审批时间
, nvl(case when bao.product_id in ("NSL-TFB371", "SL-TFB371") then opid.UserTask4_STATUS_ -- 郑州提放保
when bao.product_version in ('v1.5', 'v1.0') then opid.UserTask4_STATUS_
when bao.product_version = 'v2.0' then opid.ManCheck_STATUS_
when bao.product_version = 'v2.5' then nvl(opid.ManCheck_STATUS_, opid.Investigate_STATUS_)
end -- 审批结果
,case when bao.product_id in ("NSL-TFB371", "SL-TFB371") then opid.UserTask4_STATUS_ -- 郑州提放保
when bao.product_version in ('v1.5', 'v1.0') then opid.UserTask3_STATUS_
when bao.product_version = 'v2.0' then opid.ManCheck_STATUS_
when bao.product_version = 'v2.5' then opid.Investigate_STATUS_
end -- 审查结果
) max_approval_status -- 最终审批结果
,oofc.loan_time_xg -- 放款时间_销管
,opid.financial_archive_event_time -- 财务归档时间
,bao.apply_status_name -- 订单状态
,(case when oofc.loan_time_xg is null then 0
else
(case
when bao.product_name='保险服务'
or (bao.apply_status_name='已终止' and (bco.OPINION_ like'人工操作失误%' or bco.OPINION_ like'变更产品%'))
or (bao.product_type='现金类产品' and (bao.relate_type_name in('标的拆分','到期更换平台') or nvl(sd_pt.NAME_, bfs.price_tag) in ('保险垫资','限时贷垫资')))
then 0
when bao.product_type in ('保险类产品','现金类产品') and obbh.fcsl>=1 then obbh.fcsl
when bao.product_name in ('限时贷','大道房抵贷') or (bao.product_type in ('保险类产品','现金类产品') and obbh.fcsl=0)
then 1 -- 和放款笔数折算不同
when bao.product_name in ('大道易贷(贷款服务)','大道快贷(贷款服务)','及时贷(贷款服务)','大道按揭')
then 0.5
else 0
end )
end ) loan_num_xg -- 放款笔数销管
,(case when t666.interview_time_min is null then 0
else
(case
when bao.product_name='保险服务'
or (bao.apply_status_name='已终止' and (bco.OPINION_ like'人工操作失误%' or bco.OPINION_ like'变更产品%'))
or (bao.product_type='现金类产品' and (bao.relate_type_name in('标的拆分','到期更换平台') or nvl(sd_pt.NAME_, bfs.price_tag) in ('保险垫资','限时贷垫资')))
then 0
when bao.product_type in ('保险类产品','现金类产品') and obbh.fcsl>=1 then obbh.fcsl
when bao.product_name in ('限时贷','大道房抵贷') or (bao.product_type in ('保险类产品','现金类产品') and nvl(obbh.fcsl, 0)=0)
then 1 -- 和放款笔数折算不同
when bao.product_name in ('大道易贷(贷款服务)','大道快贷(贷款服务)','及时贷(贷款服务)','大道按揭')
then 0.5
else 0
end )
end ) interview_num_xg -- 面签笔数 销管口径
,(case
when bao.product_type='现金类产品' then cfm.con_funds_cost
when bao.product_name like'买付保%' then bfs.guarantee_amount
else nvl(bnl.biz_loan_amount, 0)
end) release_amount_xg -- 放款金额(名字加了销管而已,并不是销管的计算方式)
,trade_cc01.max_cc01_time max_payment_time -- 最后一次回款时间
,bao.product_type -- 产品类型
,from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss') etl_update_time
from ods.ods_bpms_biz_apply_order_common bao
left join dim.dim_sys_org dso on dso.branch_id = bao.branch_id
left join tmp_org sys on sys.org_code=bao.sales_branch_id
left join ods.ods_bpms_biz_isr_mixed_common bim on bim.apply_no=bao.apply_no
left join ods.ods_bpms_biz_fee_summary bfs on bfs.apply_no=bao.apply_no
left join ods.ods_bpms_sys_dic sd_pt on bfs.`price_tag`=sd_pt.KEY_ and sd_pt.`TYPE_ID_`='10000042640043'
left join tmp_brf brf on brf.apply_no=bao.apply_no
left join ods.ods_bpms_c_fund_module_common cfm on cfm.apply_no=bao.apply_no
left join tmp_obbh obbh on obbh.house_no = bao.house_no
LEFT JOIN (select * from ods.ods_bpms_biz_new_loan_common where rn = 1) bnl on bnl.apply_no=bao.apply_no
left join tmp_trade_cc01 trade_cc01 on trade_cc01.apply_no = bao.apply_no
left join tmp_opinion_desc opid on opid.PROC_INST_ID_ = bao.flow_instance_id
left join tmp_bco bco on bco.apply_no=bao.apply_no
left join ods.ods_bpms_bpm_check_opinion_common_ex_wx t666 on t666.apply_no=bao.apply_no
left join ods.ods_orders_finance_common oofc on oofc.apply_no = bao.apply_no
left join dim.dim_company dc on bao.branch_id = dc.company_id_3_level |
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"portfolioId" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Portfolio" (
"id" SERIAL NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Investment" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"shortName" TEXT NOT NULL,
"unitPrice" DOUBLE PRECISION NOT NULL,
"amount" DOUBLE PRECISION NOT NULL,
"value" DOUBLE PRECISION NOT NULL,
"portfolioId" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_portfolioId_unique" ON "User"("portfolioId");
-- AddForeignKey
ALTER TABLE "User" ADD FOREIGN KEY ("portfolioId") REFERENCES "Portfolio"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Investment" ADD FOREIGN KEY ("portfolioId") REFERENCES "Portfolio"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
CREATE VIEW [TimeManagement].[VI_TimeRegistration]
AS SELECT [TimeRegistration].[PK_Id]
,[FK_UserId]
,[FK_ProjectId]
,[FK_OrderId]
,[FK_TaskId]
,[Time]
,[Date]
,[DateEntry]
,[Comment]
,[TaskType].[Name] as [TaskTypeName]
,[Projects].[Name] as [ProjectName]
,[Users].[NK_Name] as [UserName]
,[OrderNumber].[Number] as [OrderName]
FROM [TimeManagement].[TimeRegistration]
JOIN
[TimeManagement].[Users] ON [TimeRegistration].[FK_UserId] = [Users].[PK_Id]
JOIN
[TimeManagement].[Projects] ON [TimeRegistration].[FK_ProjectId] = [Projects].[PK_Id]
JOIN
[TimeManagement].[TaskType] ON [TimeRegistration].[FK_TaskId] = [TaskType].[PK_Id]
JOIN
[TimeManagement].[OrderNumber] ON [TimeRegistration].[FK_OrderId] = [OrderNumber].[PK_Id]
|
select * from sc_opr.tbl_crt where cd_crt = 62015539907844
select * from sc_opr.tbl_ocr where cd_crt = 62015539907844 and dt_inc_usr >= '2019-10-05';
--lista de faturas de cartões inativos selecionadas para geração de boleto
select emp.nm_emp as empresa,
crt.cd_crt as cartao,
cun.nm_cun as nome,
--'select sc_cbr.gerar_boleto(1, 2, ' || fcr.cd_fcr || ');' as comando_geracao_boleto,
--'update sc_fcr.tbl_fcr set dt_vnc_fcr = ''2019-11-10'' where cd_fcr = ' || fcr.cd_fcr || ';' as comando_alterar_vencimento,
--'curl --header Cookie: JSESSIONID=8E2450CC030F6C377FE3EB675D8372C7 --header Connection: keep-alive http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=' || fcr.cd_fcr || ' --output ' || replace(cun.nm_cun, ' ', '_') || '.pdf' as comando_imprimir_boleto,
(case when crt.fg_ind_crt = 'S' then current_date - crt.dt_ini_atr_crt else 0 end) dias_atraso,
cun.nr_cpf_cnpj_cun as cpf,
fcr.vl_sld_dvd_fcr as saldo_devedor
from sc_opr.tbl_crt crt
inner join sc_cad.tbl_fnc fnc on crt.cd_fnc = fnc.cd_fnc
inner join sc_cad.tbl_emp emp on fnc.cd_emp = emp.cd_emp
inner join sc_cad.tbl_cun cun on fnc.cd_cun = cun.cd_cun
inner join sc_fcr.tbl_fcr fcr on fcr.cd_fcr = crt.cd_fcr
where emp.cd_gem = 249
and crt.fg_atv_crt = 'N'
and fcr.st_fcr = 1
and fcr.dt_ems_fcr >= '2019-08-01'
and fcr.dt_vnc_fcr = '2019-11-10'
and exists (select 1 from sc_opr.tbl_ocr ocr where ocr.cd_crt = crt.cd_crt and ocr.cd_toc = 6 and ocr.dt_inc_usr >= '2019-10-01')
order by empresa, nome;
--lista de faturas de cartões ativos selecionadas para geração de boleto
select emp.nm_emp as empresa,
crt.cd_crt as cartao,
cun.nm_cun as nome,
--'select sc_cbr.gerar_boleto(1, 2, ' || fcr.cd_fcr || ');' as comando_geracao_boleto,
--'update sc_fcr.tbl_fcr set dt_vnc_fcr = ''2019-11-10'' where cd_fcr = ' || fcr.cd_fcr || ';' as comando_alterar_vencimento,
--'curl --header Cookie: JSESSIONID=8E2450CC030F6C377FE3EB675D8372C7 --header Connection: keep-alive http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=' || fcr.cd_fcr || ' --output ' || replace(cun.nm_cun, ' ', '_') || '.pdf' as comando_imprimir_boleto,
(case when crt.fg_ind_crt = 'S' then current_date - crt.dt_ini_atr_crt else 0 end) dias_atraso,
cun.nr_cpf_cnpj_cun as cpf,
fcr.vl_sld_dvd_fcr as saldo_devedor
from sc_opr.tbl_crt crt
inner join sc_cad.tbl_fnc fnc on crt.cd_fnc = fnc.cd_fnc
inner join sc_cad.tbl_emp emp on fnc.cd_emp = emp.cd_emp
inner join sc_cad.tbl_cun cun on fnc.cd_cun = cun.cd_cun
inner join sc_fcr.tbl_fcr fcr on fcr.cd_fcr = crt.cd_fcr
where emp.cd_gem = 249
and crt.fg_atv_crt = 'S'
and fcr.st_fcr = 1
and fcr.dt_ems_fcr >= '2019-08-01'
order by empresa, nome;
--obtendo o paramento que indica o cedente de geração padrão dos boletos
select * from sc_cad.tbl_prm where nm_prm = 'CODIGO_CONTRATO_COBRANCA_PADRAO';
--comandos para a alteração da data de vencimento da fatura
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3712433;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3714817;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3712449;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3714994;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3711922;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725370;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720430;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718871;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719054;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3721626;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718786;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715427;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3599330;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3714409;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718940;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715430;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717014;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720913;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718931;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725576;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717264;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715437;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725337;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719026;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3721093;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720967;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719061;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725667;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3711849;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3711848;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718939;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3712461;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719666;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718145;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725151;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3711752;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3721382;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718872;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718869;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725639;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3711698;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724881;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3726553;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719018;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3599346;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718236;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715402;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715100;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720381;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718267;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724380;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3713870;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720012;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3722377;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718385;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3716512;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717501;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3712313;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718709;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719142;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720081;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724381;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724374;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718271;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717611;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719093;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715026;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725095;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720824;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725817;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717888;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715342;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3605723;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720815;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717862;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719498;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3714722;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725376;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717718;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718438;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717865;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3721900;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718833;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719494;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715890;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719846;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3711506;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720102;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720850;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3716909;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717885;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717884;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3718373;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3608294;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719465;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717883;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719497;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719499;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715698;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715348;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3725089;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719730;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724210;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724201;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720817;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715825;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724668;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724670;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719063;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3720010;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3715439;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717480;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724006;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3716770;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3716700;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3717787;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3719305;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3716906;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724196;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724195;
update sc_fcr.tbl_fcr set dt_vnc_fcr = '2019-11-10' where cd_fcr = 3724207;
--comandos para geração dos boletos
select sc_cbr.gerar_boleto(1, 2, 3712433);
select sc_cbr.gerar_boleto(1, 2, 3714817);
select sc_cbr.gerar_boleto(1, 2, 3712449);
select sc_cbr.gerar_boleto(1, 2, 3714994);
select sc_cbr.gerar_boleto(1, 2, 3711922);
select sc_cbr.gerar_boleto(1, 2, 3725370);
select sc_cbr.gerar_boleto(1, 2, 3720430);
select sc_cbr.gerar_boleto(1, 2, 3718871);
select sc_cbr.gerar_boleto(1, 2, 3719054);
select sc_cbr.gerar_boleto(1, 2, 3721626);
select sc_cbr.gerar_boleto(1, 2, 3718786);
select sc_cbr.gerar_boleto(1, 2, 3715427);
select sc_cbr.gerar_boleto(1, 2, 3599330);
select sc_cbr.gerar_boleto(1, 2, 3714409);
select sc_cbr.gerar_boleto(1, 2, 3718940);
select sc_cbr.gerar_boleto(1, 2, 3715430);
select sc_cbr.gerar_boleto(1, 2, 3717014);
select sc_cbr.gerar_boleto(1, 2, 3720913);
select sc_cbr.gerar_boleto(1, 2, 3718931);
select sc_cbr.gerar_boleto(1, 2, 3725576);
select sc_cbr.gerar_boleto(1, 2, 3717264);
select sc_cbr.gerar_boleto(1, 2, 3715437);
select sc_cbr.gerar_boleto(1, 2, 3725337);
select sc_cbr.gerar_boleto(1, 2, 3719026);
select sc_cbr.gerar_boleto(1, 2, 3721093);
select sc_cbr.gerar_boleto(1, 2, 3720967);
select sc_cbr.gerar_boleto(1, 2, 3719061);
select sc_cbr.gerar_boleto(1, 2, 3725667);
select sc_cbr.gerar_boleto(1, 2, 3711849);
select sc_cbr.gerar_boleto(1, 2, 3711848);
select sc_cbr.gerar_boleto(1, 2, 3718939);
select sc_cbr.gerar_boleto(1, 2, 3712461);
select sc_cbr.gerar_boleto(1, 2, 3719666);
select sc_cbr.gerar_boleto(1, 2, 3718145);
select sc_cbr.gerar_boleto(1, 2, 3725151);
select sc_cbr.gerar_boleto(1, 2, 3711752);
select sc_cbr.gerar_boleto(1, 2, 3721382);
select sc_cbr.gerar_boleto(1, 2, 3718872);
select sc_cbr.gerar_boleto(1, 2, 3718869);
select sc_cbr.gerar_boleto(1, 2, 3725639);
select sc_cbr.gerar_boleto(1, 2, 3711698);
select sc_cbr.gerar_boleto(1, 2, 3724881);
select sc_cbr.gerar_boleto(1, 2, 3726553);
select sc_cbr.gerar_boleto(1, 2, 3719018);
select sc_cbr.gerar_boleto(1, 2, 3599346);
select sc_cbr.gerar_boleto(1, 2, 3718236);
select sc_cbr.gerar_boleto(1, 2, 3715402);
select sc_cbr.gerar_boleto(1, 2, 3715100);
select sc_cbr.gerar_boleto(1, 2, 3720381);
select sc_cbr.gerar_boleto(1, 2, 3718267);
select sc_cbr.gerar_boleto(1, 2, 3724380);
select sc_cbr.gerar_boleto(1, 2, 3713870);
select sc_cbr.gerar_boleto(1, 2, 3720012);
select sc_cbr.gerar_boleto(1, 2, 3722377);
select sc_cbr.gerar_boleto(1, 2, 3718385);
select sc_cbr.gerar_boleto(1, 2, 3716512);
select sc_cbr.gerar_boleto(1, 2, 3717501);
select sc_cbr.gerar_boleto(1, 2, 3712313);
select sc_cbr.gerar_boleto(1, 2, 3718709);
select sc_cbr.gerar_boleto(1, 2, 3719142);
select sc_cbr.gerar_boleto(1, 2, 3720081);
select sc_cbr.gerar_boleto(1, 2, 3724381);
select sc_cbr.gerar_boleto(1, 2, 3724374);
select sc_cbr.gerar_boleto(1, 2, 3718271);
select sc_cbr.gerar_boleto(1, 2, 3717611);
select sc_cbr.gerar_boleto(1, 2, 3719093);
select sc_cbr.gerar_boleto(1, 2, 3715026);
select sc_cbr.gerar_boleto(1, 2, 3725095);
select sc_cbr.gerar_boleto(1, 2, 3720824);
select sc_cbr.gerar_boleto(1, 2, 3725817);
select sc_cbr.gerar_boleto(1, 2, 3717888);
select sc_cbr.gerar_boleto(1, 2, 3715342);
select sc_cbr.gerar_boleto(1, 2, 3605723);
select sc_cbr.gerar_boleto(1, 2, 3720815);
select sc_cbr.gerar_boleto(1, 2, 3717862);
select sc_cbr.gerar_boleto(1, 2, 3719498);
select sc_cbr.gerar_boleto(1, 2, 3714722);
select sc_cbr.gerar_boleto(1, 2, 3725376);
select sc_cbr.gerar_boleto(1, 2, 3717718);
select sc_cbr.gerar_boleto(1, 2, 3718438);
select sc_cbr.gerar_boleto(1, 2, 3717865);
select sc_cbr.gerar_boleto(1, 2, 3721900);
select sc_cbr.gerar_boleto(1, 2, 3718833);
select sc_cbr.gerar_boleto(1, 2, 3719494);
select sc_cbr.gerar_boleto(1, 2, 3715890);
select sc_cbr.gerar_boleto(1, 2, 3719846);
select sc_cbr.gerar_boleto(1, 2, 3711506);
select sc_cbr.gerar_boleto(1, 2, 3720102);
select sc_cbr.gerar_boleto(1, 2, 3720850);
select sc_cbr.gerar_boleto(1, 2, 3716909);
select sc_cbr.gerar_boleto(1, 2, 3717885);
select sc_cbr.gerar_boleto(1, 2, 3717884);
select sc_cbr.gerar_boleto(1, 2, 3718373);
select sc_cbr.gerar_boleto(1, 2, 3608294);
select sc_cbr.gerar_boleto(1, 2, 3719465);
select sc_cbr.gerar_boleto(1, 2, 3717883);
select sc_cbr.gerar_boleto(1, 2, 3719497);
select sc_cbr.gerar_boleto(1, 2, 3719499);
select sc_cbr.gerar_boleto(1, 2, 3715698);
select sc_cbr.gerar_boleto(1, 2, 3715348);
select sc_cbr.gerar_boleto(1, 2, 3725089);
select sc_cbr.gerar_boleto(1, 2, 3719730);
select sc_cbr.gerar_boleto(1, 2, 3724210);
select sc_cbr.gerar_boleto(1, 2, 3724201);
select sc_cbr.gerar_boleto(1, 2, 3720817);
select sc_cbr.gerar_boleto(1, 2, 3715825);
select sc_cbr.gerar_boleto(1, 2, 3724668);
select sc_cbr.gerar_boleto(1, 2, 3724670);
select sc_cbr.gerar_boleto(1, 2, 3719063);
select sc_cbr.gerar_boleto(1, 2, 3720010);
select sc_cbr.gerar_boleto(1, 2, 3715439);
select sc_cbr.gerar_boleto(1, 2, 3717480);
select sc_cbr.gerar_boleto(1, 2, 3724006);
select sc_cbr.gerar_boleto(1, 2, 3716770);
select sc_cbr.gerar_boleto(1, 2, 3716700);
select sc_cbr.gerar_boleto(1, 2, 3717787);
select sc_cbr.gerar_boleto(1, 2, 3719305);
select sc_cbr.gerar_boleto(1, 2, 3716906);
select sc_cbr.gerar_boleto(1, 2, 3724196);
select sc_cbr.gerar_boleto(1, 2, 3724195);
select sc_cbr.gerar_boleto(1, 2, 3724207);
--comando para a impressão dos boletos
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3712433
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3714817
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3712449
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3714994
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3711922
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725370
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720430
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718871
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719054
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3721626
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718786
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715427
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3599330
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3714409
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718940
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715430
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717014
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720913
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718931
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725576
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717264
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715437
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725337
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719026
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3721093
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720967
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719061
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725667
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3711849
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3711848
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718939
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3712461
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719666
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718145
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725151
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3711752
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3721382
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718872
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718869
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725639
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3711698
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3724881
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3726553
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719018
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3599346
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718236
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715402
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715100
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720381
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718267
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3724380
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3713870
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720012
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3722377
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718385
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3716512
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717501
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3712313
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718709
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719142
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720081
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3724381
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3724374
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718271
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717611
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719093
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715026
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725095
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720824
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725817
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717888
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715342
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3605723
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720815
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717862
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719498
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3714722
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725376
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717718
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718438
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717865
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3721900
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718833
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719494
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715890
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719846
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3711506
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720102
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720850
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3716909
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717885
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717884
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3718373
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3608294
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719465
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3717883
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719497
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719499
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715698
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3715348
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3725089
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3719730
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3724210
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3724201
http://192.168.1.6:8080/scan/pages/fatura_relatorio?objetoAtualiza.codigo=3720817
select * from sc_sgr.tbl_rol where nm_rol like '%fatura_relatorio%' |
■問題
書籍情報テーブル(books)で、出版社ごとの書籍価格の平均値を求めてみましょう。
平均値が小数点になった場合、小数点以下を切り捨てます。
■実行文
# 出版社とその書籍価格の平均値を小数点以下を切り捨てた形で取得
SELECT
publish,
FLOOR(AVG(price)) AS 平均値
# 書籍情報テーブルから取得
from
books
# 出版社ごとに値を算出
GROUP BY
publish
;
■返却値
mysql> SELECT
-> publish,
-> FLOOR(AVG(price)) AS 平均値
-> from
-> books
-> GROUP BY
-> publish
-> ;
+--------------+--------+
| publish | 平均値 |
+--------------+--------+
| 山田出版 | 2157 |
| 秀和システム | 2400 |
| 翔泳社 | 3150 |
| 日経BP | 2433 |
+--------------+--------+
4 rows in set (0.01 sec)
|
CREATE TABLE user_category (
id SERIAL PRIMARY KEY NOT NULL,
user_id int NOT NULL,
category_id int NOT NULL,
active boolean NOT NULL,
created_time timestamp NOT NULL,
updated_time timestamp NOT NULL
); |
alter table hakijaryhmat add column valintatapajono_oid character varying;
alter table hakijaryhmat add constraint hakijaryhmat_valintatapajonot
foreign key (valintatapajono_oid, sijoitteluajo_id, hakukohde_oid) references valintatapajonot(oid, sijoitteluajo_id, hakukohde_oid);
alter table hakijaryhmat add column hakijaryhmatyyppikoodi_uri character varying; |
SET FOREIGN_KEY_CHECKS=0;
delete from VesselRecord;
delete from OperationalBase;
delete from Fleet;
SET FOREIGN_KEY_CHECKS=1;
insert into VesselRecord
(ID, vesselID, vesselName, VRN)
values
(1, 1, 'Yorktown' ,'CV-5' ),
(2, 2, 'Enterprise' ,'CV-6' ),
(3, 3, 'Hornet' ,'CV-8' ),
(4, 4, 'Yamato' ,'BBY-01' ),
(5, 5, 'Musashi' ,'BBY-02' ),
(6, 6, 'Takao' ,'CA-01' ),
(7, 7, 'Atago' ,'CA-02' ),
(8, 8, 'Chokai' ,'CA-03' ),
(9, 9, 'Maya' ,'CA-04' ),
(10, 10,'Sheffield' ,'CL-01' ),
(11, 11,'Belfast' ,'CL-02' ),
(12, 12,'Edinburgh' ,'CL-03' ),
(13, 13,'Z-23' ,'DD-01' ),
(14, 14,'Z-24' ,'DD-02' ),
(15, 15,'Z-25' ,'DD-02' ),
(16, 16,'Z-26' ,'DD-03' ),
(17, 17,'Z-27' ,'DD-04' ),
(18, 18,'Z-28' ,'DD-05' ),
(19, 19,'Z-29' ,'DD-06' ),
(20, 20,'Z-30' ,'DD-07' );
insert into OperationalBase
(ID, name)
values
(1,'HMNB Portsmouth'),
(2,'Yokosuka Naval Arsenal');
select * from OperationalBase;
insert into Fleet
(ID, GPSLocation, enduarance, flagCommanderID, flagshipID, name, operationalRange, base_ID)
values
(1, '50.8198° N, 1.0880° W', 150, 90129, 4, 'Royal Navy Home Fleet', 7000 ,1),
(2, '35.2815° N, 139.6722° E', 90, 12901, 2, 'USS Enterprise Battlefleet', 12000 ,2),
(3, '15.4881° N, 114.4048° E', 50, 23521, 3, 'Attack Fleet', 5000 ,2);
UPDATE VesselRecord
SET fleet_ID = (case when ID = 1 then 1
when ID = 2 then 2
when ID = 3 then 3
when ID = 4 then 1
when ID = 5 then 2
when ID = 6 then 1
when ID = 7 then 1
when ID = 8 then 2
when ID = 9 then 3
when ID = 10 then 2
when ID = 11 then 3
when ID = 12 then 3
when ID = 13 then 1
when ID = 14 then 1
when ID = 15 then 2
when ID = 16 then 2
when ID = 17 then 3
when ID = 18 then 3
when ID = 19 then 3
when ID = 20 then 3
end);
select * from VesselRecord; |
INSERT INTO persona (id, nombre,cedula, celular, email, direccion)
VALUES (10, 'Adrian Ramirez','1045044025', 3106078278,'adrian@gmail.com','cll 50 51-62');
INSERT INTO persona (id, nombre,cedula, celular, email, direccion)
VALUES (20, 'Aurelio el lobo','1045044024', 3106078279,'adrian47@gmail.com','cll 50 51-63');
INSERT INTO persona (id, nombre,cedula, celular, email, direccion)
VALUES (30, 'Michael Martinez','48796504', 3106078896,'adria@gmail.com','cll 50 51-64');
INSERT INTO mesa(id,capacidad,numero_mesa, precio)
VALUES (10,5,10,20000);
INSERT INTO mesa(id,capacidad,numero_mesa, precio)
VALUES (20,10,20,40000);
INSERT INTO mesa(id,capacidad,numero_mesa, precio)
VALUES (30,12,30,60000);
INSERT INTO mesa(id,capacidad,numero_mesa, precio)
VALUES (40,6,40,38000);
INSERT INTO reserva(id,fecha,hora_inicial,hora_final,valor_pagar,estado,id_persona,id_mesa)
VALUES (10,'2100-12-31','10:40:00','12:40:00',50000,true,10,10);
INSERT INTO reserva(id,fecha,hora_inicial,hora_final,valor_pagar,estado,id_persona,id_mesa)
VALUES (20,'2100-12-31','18:01:00','20:01:00',60000,true,10,10);
INSERT INTO reserva(id,fecha,hora_inicial,hora_final,valor_pagar,estado,id_persona,id_mesa)
VALUES (30,'2100-01-01','18:01:00','20:01:00',70000,true,20,20); |
create procedure sp_acc_loadmasterdenominations
as
select * from Denominations
|
/*
Name: Login errors by Category (Chart)
Data source: 4
Created By: Admin
Last Update At: 2016-08-11T14:34:24.901385+00:00
*/
SELECT Category_error,REGEXP_REPLACE(Category_error, r'\s+', '_') as Category_parameter,
count(*) as Logins
FROM(
select v.post_prop28 as post_prop28,v.Message_Error as Message_Error, nvl(LEO.Category,v.Message_Error) AS Category_error,v.date_time as date_time, v.Error_code as Error_code
from
(SELECT post_prop28,
date_time,
nvl(REGEXP_EXTRACT(post_prop28,r'^.*\|(.*)$'),'Error Not Defined') AS Message_Error,
nvl(upper(REGEXP_EXTRACT(post_prop28,r'(.*)\|')),'Error Not Define') AS Error_code,
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")'))
WHERE (post_prop23 = 'User Login Failed')
AND DATE(date_time) >= DATE('{{startdate}}')
AND DATE(date_time) <= DATE('{{enddate}}')
AND DATE(date_time) >= DATE('2016-07-26')
AND post_page_event = "100") AS v
LEFT JOIN each [djomniture:devspark.MG_ACS_Errors] AS LEO ON LEO.Message = v.Message_Error
WHERE DATE(v.date_time) < DATE('2016-09-01') ),
(SELECT F.post_prop28 as post_prop28,F.Error_code as Error_code,
F.Message_Error as Message_Error,
nvl(LEN.Category,F.Message_Error) AS Category_error,
F.date_time as date_time
FROM(
SELECT post_prop28,
date_time,
nvl(upper(REGEXP_EXTRACT(post_prop28,r'(.*)\|')),'Error Not Define') AS Error_code,
nvl(REGEXP_EXTRACT(post_prop28,r'^.*\|(.*)$'),'Error Not Defined') AS Message_Error,
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")'))
WHERE (post_prop23 = 'User Login Failed')
AND DATE(date_time) >= DATE('{{startdate}}')
AND DATE(date_time) <= DATE('{{enddate}}')
AND DATE(date_time) >= DATE('2016-07-26')
and REGEXP_EXTRACT(post_prop28,r'(.*)\|') !='FE'
AND post_page_event = "100") AS F
LEFT JOIN each (select upper(Error_code) as Error_code, Message, Category FROM [djomniture:devspark.MG_ACS_Errors])
AS LEN ON LEN.Error_code = F.Error_code
WHERE DATE(F.date_time) >= DATE('2016-09-01'))
group by Category_error,Category_parameter
order by Logins desc
|
use rine;
insert into user (id,name,password,key_n,key_e) values
(
1,
"testUser01",
"123123",
"3233",
"17"
);
insert into user (id,name,password,key_n,key_e) values
(
2,
"testUser02",
"123123",
"3233",
"17"
); |
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 01, 2020 at 10:02 AM
-- Server version: 10.1.34-MariaDB
-- PHP Version: 7.2.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `auction1`
--
-- --------------------------------------------------------
--
-- Table structure for table `bidder`
--
CREATE TABLE `bidder` (
`ID` int(10) NOT NULL,
`userID` int(10) NOT NULL,
`vehicleID` int(10) NOT NULL,
`biddingTime` datetime NOT NULL,
`price` int(10) NOT NULL,
`confirmbid` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `bidder`
--
INSERT INTO `bidder` (`ID`, `userID`, `vehicleID`, `biddingTime`, `price`, `confirmbid`) VALUES
(1, 9, 6, '2020-01-01 14:28:39', 344, 0),
(2, 10, 6, '2020-01-01 14:45:15', 345, 0),
(3, 10, 1, '2020-01-01 14:50:50', 4200, 0);
-- --------------------------------------------------------
--
-- Table structure for table `catagory`
--
CREATE TABLE `catagory` (
`ID` int(10) NOT NULL,
`name` varchar(500) NOT NULL,
`type` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `catagory`
--
INSERT INTO `catagory` (`ID`, `name`, `type`) VALUES
(2, 'Leafy Green- lettuce, spinach, silverbeet etc', 'Vegetable'),
(3, 'Berries- strawberries, raspberries, blueberries, kiwifruit and passionfruit etc', 'Fruit'),
(4, 'Cruciferous- cabbage, cauliflower, Brussels sprouts, broccoli etc', 'Vegetable'),
(5, 'Marrow- pumpkin, cucumber, zucchini etc', 'Vegetable'),
(6, 'Stone fruit- nectarines, apricots, peaches and plums', 'Fruit'),
(7, 'Tropical and exotic- bananas and mangoes', 'Fruit'),
(9, 'Apples and pears', 'Fruit'),
(10, 'Root- potato, sweet potato, yam etc', 'Vegetable'),
(11, 'Edible plant stem- celery, asparagus etc', 'Vegetable'),
(12, 'Citrus- oranges, grapefruits, mandarins and limes etc', 'Fruit'),
(13, 'Allium- onion, garlic, shallot etc', 'Vegetable'),
(14, 'Melons- watermelons, rockmelons and honeydew melons', 'Fruit'),
(15, 'Tomatoes and avocados etc', 'Fruit');
-- --------------------------------------------------------
--
-- Table structure for table `confirmbid`
--
CREATE TABLE `confirmbid` (
`ID` int(10) NOT NULL,
`vehicleID` int(10) NOT NULL,
`date` date NOT NULL,
`userID` int(5) NOT NULL,
`type` varchar(50) NOT NULL,
`price` int(10) NOT NULL,
`role` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `deposit`
--
CREATE TABLE `deposit` (
`ID` int(10) NOT NULL,
`userID` int(10) NOT NULL,
`paymentFrom` varchar(50) NOT NULL,
`account` varchar(50) NOT NULL,
`amount` int(15) NOT NULL,
`role` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `deposit`
--
INSERT INTO `deposit` (`ID`, `userID`, `paymentFrom`, `account`, `amount`, `role`) VALUES
(1, 4, 'NexusPay', '2551057696', 8753, 0),
(2, 4, 'DBBL online banking', '255553211', 9332, 1),
(3, 8, 'DBBL', '987654', 0, 0),
(4, 8, 'DBBL', '987654321', 6327, 1),
(5, 8, 'DBBL', '123456', 84332, 1),
(6, 6, 'NexusPay', '9631547', 3215698, 0),
(7, 4, 'DBBL', '698741365', 3541, 1),
(8, 9, 'DBBL online banking', '789456123', 21539, 1),
(9, 10, 'NexusPay', '9871213', 87961, 1);
-- --------------------------------------------------------
--
-- Table structure for table `farmer`
--
CREATE TABLE `farmer` (
`ID` int(10) NOT NULL,
`name` varchar(50) CHARACTER SET utf8 NOT NULL,
`email` varchar(50) CHARACTER SET utf8 NOT NULL,
`password` varchar(50) CHARACTER SET utf8 NOT NULL,
`phone` int(15) NOT NULL,
`address` varchar(150) CHARACTER SET utf8 NOT NULL,
`state` varchar(30) CHARACTER SET utf8 NOT NULL,
`pincode` int(10) NOT NULL,
`admin` int(5) NOT NULL DEFAULT '0',
`active` int(5) NOT NULL DEFAULT '0',
`image` varchar(300) CHARACTER SET utf8 NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `farmer`
--
INSERT INTO `farmer` (`ID`, `name`, `email`, `password`, `phone`, `address`, `state`, `pincode`, `admin`, `active`, `image`) VALUES
(1, 'akash', 'ak@gmail.com', '94754d0abb89e4cf0a7f1c494dbb9d2c', 156548965, 'dafisar', 'maharanstha', 4000068, 0, 0, ''),
(2, 'kartik', 'kar@gmail.com', 'c8d39cdb56a46ad807969ee04c4e660b', 2147483647, 'dafisar', 'UP', 454565, 0, 0, '');
-- --------------------------------------------------------
--
-- Table structure for table `notification`
--
CREATE TABLE `notification` (
`ID` int(10) NOT NULL,
`vehicleID` int(10) NOT NULL,
`userID` int(10) NOT NULL,
`role` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `notification`
--
INSERT INTO `notification` (`ID`, `vehicleID`, `userID`, `role`) VALUES
(1, 6, 9, 1),
(2, 6, 10, 0),
(3, 1, 10, 0);
-- --------------------------------------------------------
--
-- Table structure for table `review`
--
CREATE TABLE `review` (
`ID` int(10) NOT NULL,
`userID` int(10) NOT NULL,
`vehicleID` int(10) NOT NULL,
`comment` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `review`
--
INSERT INTO `review` (`ID`, `userID`, `vehicleID`, `comment`) VALUES
(1, 8, 1, 'good seller!!');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`ID` int(10) NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`phone` varchar(15) NOT NULL,
`address` varchar(150) NOT NULL,
`admin` int(5) DEFAULT '0',
`active` int(5) NOT NULL DEFAULT '0',
`image` varchar(300) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`ID`, `name`, `email`, `password`, `phone`, `address`, `admin`, `active`, `image`) VALUES
(8, 'Siddharth Sinha', 'sid3345@gmail.com', '4187910319ceba6c2b0526e7985e62ce', '987456321', 'Mira Road, Thane', 1, 0, '20191212102245_IMG_20191208_163030.jpg'),
(9, 'test user', 'test@test.in', 'b60eb83bf533eecf1bde65940925a981', '987456321', 'new york', 0, 0, ''),
(10, 'honey singh', 'honey@singh.in', 'd41d8cd98f00b204e9800998ecf8427e', '789456123', 'Mira Road, Thane', 0, 0, '20200101095112_20191228103521_20190915215344_prsis12.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `vehicle`
--
CREATE TABLE `vehicle` (
`ID` int(10) NOT NULL,
`name` varchar(50) NOT NULL,
`type` varchar(50) NOT NULL,
`catagory` int(50) NOT NULL,
`startDate` varchar(15) NOT NULL,
`EndDate` date NOT NULL,
`image` varchar(300) NOT NULL,
`price` int(10) NOT NULL,
`status` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `vehicle`
--
INSERT INTO `vehicle` (`ID`, `name`, `type`, `catagory`, `startDate`, `EndDate`, `image`, `price`, `status`) VALUES
(1, 'Cauliflower', 'Vegetable', 4, '2019-12-28', '2020-01-05', '20191228092550_20190706221603_aqua11.jpg', 123, 1),
(2, 'Banana', 'Fruit', 7, '2020-01-03', '2019-12-28', '20191228075726_20190910213732_banana(1).jpg', 41, 1),
(3, 'Apple', 'Fruit', 9, '2020-01-05', '2019-12-28', '20191228084258_20190706221603_aqua11.jpg', 82, 1),
(4, 'Pomegranate', 'Fruit', 14, '2020-01-02', '2020-01-05', '20191228085452_20191227230920_20190706221152_gixxer.jpg', 63, 1),
(6, 'Ladyfinger', 'Vegetable', 4, '2020-01-01', '2020-01-01', '20200101092538_20190706221819_gixxer2.jpg', 216, 1);
-- --------------------------------------------------------
--
-- Table structure for table `vehicledetails`
--
CREATE TABLE `vehicledetails` (
`ID` int(10) NOT NULL,
`vehicleID` int(10) NOT NULL,
`description` text NOT NULL,
`name` varchar(100) NOT NULL,
`type` varchar(50) NOT NULL,
`region` text NOT NULL,
`harvest_date` date NOT NULL,
`Season` text NOT NULL,
`State` text NOT NULL,
`soil_type` varchar(50) NOT NULL,
`temperature` varchar(20) NOT NULL,
`updateStatus` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `vehicledetails`
--
INSERT INTO `vehicledetails` (`ID`, `vehicleID`, `description`, `name`, `type`, `region`, `harvest_date`, `Season`, `State`, `soil_type`, `temperature`, `updateStatus`) VALUES
(1, 1, 'test', ' Cabbage', 'big green', 'North', '2019-12-14', 'Kharif', 'Goa', 'Clay', '15- 20 degree C', 1),
(2, 2, 'test1', ' Banana', ' Elaichi', 'North', '2019-12-20', 'Kharif', 'Daman and Diu', 'Clay', '15- 20 degree C', 1),
(3, 3, 'testing names', ' Orange', ' Small', 'South', '2019-12-26', 'Rabi', 'Himachal Pradesh', 'Clay', '20- 25 degree C', 1),
(4, 4, 'testing', ' Pomegranate', 'red small', 'East', '2019-12-13', 'Other', 'Gujarat', 'Silty', '20- 25 degree C', 1),
(5, 6, 'test', ' Ladyfinger', 'small green', 'West', '2019-12-30', 'Zaid', 'Dadra and Nagar Haveli', 'Peaty', '20- 25 degree C', 1);
-- --------------------------------------------------------
--
-- Table structure for table `vehicleimage`
--
CREATE TABLE `vehicleimage` (
`ID` int(10) NOT NULL,
`vehicleID` int(10) NOT NULL,
`name` varchar(300) NOT NULL,
`name2` varchar(300) NOT NULL,
`name3` varchar(300) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `vehicleimage`
--
INSERT INTO `vehicleimage` (`ID`, `vehicleID`, `name`, `name2`, `name3`) VALUES
(1, 1, '20191227230920_20190706221152_gixxer.jpg', '20191227230920_20190706221326_prsis1.jpg', '20191227230920_20191227225427_20190719120030_gixxer.jpg'),
(2, 2, '20191228080018_20191212173146_20190706221603_aqua1.jpg', '20191228080018_20190910213732_banana(1).jpg', '20191228080018_20190706221240_pajaro.jpg'),
(3, 3, '20191228085149_20190915215344_prsis.jpg', '20191228085149_20190706221152_gixxer.jpg', '20191228085149_20190706221152_gixxer.jpg'),
(4, 4, '20191228103521_20191228092506_20190706221603_aqua11.jpg', '20191228103521_20190915215344_prsis12.jpg', '20191228103521_20190706221240_pajaro.jpg'),
(5, 6, '20200101092659_20190706221326_prsis1.jpg', '20200101092659_20190719112057_gixxer1.jpg', '20200101092659_20190910213706_gixxer2(1).jpg');
-- --------------------------------------------------------
--
-- Table structure for table `watchlist`
--
CREATE TABLE `watchlist` (
`ID` int(10) NOT NULL,
`vehicleID` int(10) NOT NULL,
`userID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `watchlist`
--
INSERT INTO `watchlist` (`ID`, `vehicleID`, `userID`) VALUES
(1, 6, 9);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `bidder`
--
ALTER TABLE `bidder`
ADD PRIMARY KEY (`ID`),
ADD KEY `userID` (`userID`),
ADD KEY `vehicleID` (`vehicleID`);
--
-- Indexes for table `catagory`
--
ALTER TABLE `catagory`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `confirmbid`
--
ALTER TABLE `confirmbid`
ADD PRIMARY KEY (`ID`),
ADD KEY `userID` (`userID`),
ADD KEY `vehicleID` (`vehicleID`);
--
-- Indexes for table `deposit`
--
ALTER TABLE `deposit`
ADD PRIMARY KEY (`ID`),
ADD KEY `userID` (`userID`);
--
-- Indexes for table `farmer`
--
ALTER TABLE `farmer`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `notification`
--
ALTER TABLE `notification`
ADD PRIMARY KEY (`ID`),
ADD KEY `vehicleID` (`vehicleID`),
ADD KEY `userID` (`userID`);
--
-- Indexes for table `review`
--
ALTER TABLE `review`
ADD PRIMARY KEY (`ID`),
ADD KEY `userID` (`userID`),
ADD KEY `vehicleID` (`vehicleID`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `vehicle`
--
ALTER TABLE `vehicle`
ADD PRIMARY KEY (`ID`),
ADD KEY `catagory` (`catagory`);
--
-- Indexes for table `vehicledetails`
--
ALTER TABLE `vehicledetails`
ADD PRIMARY KEY (`ID`),
ADD KEY `vehicleID` (`vehicleID`);
--
-- Indexes for table `vehicleimage`
--
ALTER TABLE `vehicleimage`
ADD PRIMARY KEY (`ID`),
ADD KEY `vehicleID` (`vehicleID`);
--
-- Indexes for table `watchlist`
--
ALTER TABLE `watchlist`
ADD PRIMARY KEY (`ID`),
ADD KEY `userID` (`userID`),
ADD KEY `vehicleID` (`vehicleID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `bidder`
--
ALTER TABLE `bidder`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `catagory`
--
ALTER TABLE `catagory`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `confirmbid`
--
ALTER TABLE `confirmbid`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `deposit`
--
ALTER TABLE `deposit`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `farmer`
--
ALTER TABLE `farmer`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `notification`
--
ALTER TABLE `notification`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `review`
--
ALTER TABLE `review`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `vehicle`
--
ALTER TABLE `vehicle`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `vehicledetails`
--
ALTER TABLE `vehicledetails`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `vehicleimage`
--
ALTER TABLE `vehicleimage`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `watchlist`
--
ALTER TABLE `watchlist`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `bidder`
--
ALTER TABLE `bidder`
ADD CONSTRAINT `bidder_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `user` (`ID`),
ADD CONSTRAINT `bidder_ibfk_2` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`ID`);
--
-- Constraints for table `confirmbid`
--
ALTER TABLE `confirmbid`
ADD CONSTRAINT `confirmbid_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `user` (`ID`),
ADD CONSTRAINT `confirmbid_ibfk_2` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`ID`);
--
-- Constraints for table `deposit`
--
ALTER TABLE `deposit`
ADD CONSTRAINT `deposit_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `user` (`ID`);
--
-- Constraints for table `notification`
--
ALTER TABLE `notification`
ADD CONSTRAINT `notification_ibfk_1` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`ID`),
ADD CONSTRAINT `notification_ibfk_2` FOREIGN KEY (`userID`) REFERENCES `user` (`ID`);
--
-- Constraints for table `review`
--
ALTER TABLE `review`
ADD CONSTRAINT `review_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `user` (`ID`),
ADD CONSTRAINT `review_ibfk_2` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`ID`);
--
-- Constraints for table `vehicle`
--
ALTER TABLE `vehicle`
ADD CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`catagory`) REFERENCES `catagory` (`ID`);
--
-- Constraints for table `vehicledetails`
--
ALTER TABLE `vehicledetails`
ADD CONSTRAINT `vehicledetails_ibfk_1` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`ID`);
--
-- Constraints for table `vehicleimage`
--
ALTER TABLE `vehicleimage`
ADD CONSTRAINT `vehicleimage_ibfk_1` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`ID`);
--
-- Constraints for table `watchlist`
--
ALTER TABLE `watchlist`
ADD CONSTRAINT `watchlist_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `user` (`ID`),
ADD CONSTRAINT `watchlist_ibfk_2` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`ID`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
Create Procedure sp_get_splCategoryItemCategory
(@Special_Cat_Code INT)
As
Select items.product_Code from Items where items.CategoryID in (Select categoryID from Special_Cat_Product where Special_Cat_Code=@Special_Cat_Code)
|
-- Create a database to store our tables:
CREATE DATABASE IF NOT EXISTS Databricks
-- Select the database to start performing operations
USE Databricks
-- Create a table based on the file provided as a mount
DROP TABLE IF EXISTS fireCalls;
CREATE TABLE IF NOT EXISTS fireCalls
USING csv
OPTIONS (
header "true",
path "/mnt/davis/fire-calls/fire-calls-truncated-comma.csv",
inferSchema "true"
)
-- First data visualization query
SELECT * FROM fireCalls LIMIT 10
-- Most firecall neighborhoods
SELECT `Neighborhooods - Analysis Boundaries` as neighborhood,
COUNT(`Neighborhooods - Analysis Boundaries`) as count
FROM FireCalls
GROUP BY `Neighborhooods - Analysis Boundaries`
ORDER BY count DESC
|
/*
'WAITING' - sessions waiting to connect
'ACTIVE' - sessions that are connected
Possible states;
NONE
CONNECTING
ACTIVE
WAITING
IDLE
CLOSING
If any are waiting for more than N seconds, issue an alert
Might there be an alternative to increase the max count?
*/
select distinct connection_status drcp_connection_status
, count(connection_status) over (partition by connection_status) drcp_count
from GV$CPOOL_CONN_INFO
order by 1
/
|
/*
Navicat Premium Data Transfer
Source Server : 本地数据库-mysql5.7
Source Server Type : MySQL
Source Server Version : 50724
Source Host : localhost:3306
Source Schema : mybatisplus
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
Date: 02/05/2019 11:00:02
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
`age` int(11) NULL DEFAULT NULL COMMENT '年龄',
`email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (1, 'Jone', 18, 'test1@baomidou.com');
INSERT INTO `user` VALUES (2, 'Jack', 20, 'test2@baomidou.com');
INSERT INTO `user` VALUES (3, 'Tom', 28, 'test3@baomidou.com');
INSERT INTO `user` VALUES (4, 'Sandy', 21, 'test4@baomidou.com');
INSERT INTO `user` VALUES (5, 'gaojun', 24, 'gaojun56@163.com');
SET FOREIGN_KEY_CHECKS = 1;
|
-- receive_channels
--
-- Receive_channels map a receive channel ID to a label representing that
-- channel.
CREATE TABLE receive_channels (
id NUMBER NOT NULL PRIMARY KEY, -- Primary Key
name VARCHAR2(20) NOT NULL -- Receive Channel Name
);
|
CREATE SCHEMA IF NOT EXISTS jianzheng default character set utf8mb4 collate utf8mb4_general_ci;
use
jianzheng;
set names utf8mb4;
/*****************************基础模块************************************/
/* 系统用户表 */
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`
(
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id',
`mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '手机号',
`password` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '密码,管理员使用',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '姓名',
`nickname` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '微信昵称',
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '头像',
`last_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录时间',
`last_ip` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后登录ip',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`data_status` tinyint(2) NOT NULL DEFAULT 2 COMMENT '通用状态,2正常,3删除,4停用',
`characters` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '角色',
`motto` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注',
`username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '用户名',
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_sys_role` (`characters`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 14
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '用户表'
ROW_FORMAT = Dynamic;
/* 系统角色表 */
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role`
(
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id',
`role_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '角色名称',
`remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '备注',
`permissions` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '权限id,多个以逗号分隔',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`data_status` tinyint(2) NOT NULL DEFAULT 2 COMMENT '通用状态,2正常,3删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 15
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_croatian_ci COMMENT = '角色'
ROW_FORMAT = Dynamic;
/* 系统权限表 */
DROP TABLE IF EXISTS `sys_permission`;
CREATE TABLE `sys_permission`
(
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id',
`parent_id` int(10) NOT NULL DEFAULT 0 COMMENT '父权限ID,一级菜单为0',
`permission_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '权限名称',
`key_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '标识名',
`component` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '组件名',
`permission_type` tinyint(2) NOT NULL DEFAULT 1 COMMENT '类别,1目录,2菜单,3权限',
`permits` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '授权(多个用逗号分隔,如:user:list,user:create)',
`url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '权限URL,菜单用',
`icon` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL DEFAULT '' COMMENT '权限图标,菜单用',
`sort` smallint(4) NOT NULL DEFAULT 0 COMMENT '排序权重',
`hidden` tinyint(2) NOT NULL DEFAULT 1 COMMENT '是否隐藏,1显示,2隐藏',
`data_status` tinyint(2) NOT NULL DEFAULT 2 COMMENT '通用状态,2正常,3删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 33
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_croatian_ci COMMENT = '权限'
ROW_FORMAT = Dynamic;
/* 系统客户表 */
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer`
(
`id` int NOT NULL AUTO_INCREMENT COMMENT '自增id',
`customer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户公司',
`director` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '负责人',
`add_time` timestamp NOT NULL COMMENT '添加时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
`last_operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后操作人',
`exist` int NOT NULL COMMENT '该条是否存在,1存在,2已删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `customer` (`customer`) USING BTREE,
INDEX `last_operator_customer` (`last_operator`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 19
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC;
/* 系统订单表 */
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order`
(
`id` int NOT NULL AUTO_INCREMENT,
`customer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`start_time` timestamp NOT NULL,
`estimated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`complete_time` timestamp NULL DEFAULT NULL,
`cost` double NOT NULL,
`status` int NOT NULL,
`producer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_operator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`exist` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `customer` (`customer`) USING BTREE,
INDEX `last_operator_order` (`last_operator`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 3
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC;
INSERT INTO `sys_permission`
VALUES (1, 0, '用户管理', 'system:user', 'user', 2, 'user:list,user:add,user:update,user:delete', 'user ', '', 0, 1, 2);
INSERT INTO `sys_permission`
VALUES (2, 0, '角色管理', 'system:sysRole', 'sysRole', 2, 'sysRole:list,sysRole:add,sysRole:update,sysRole:delete',
'sysRole', '', 0, 1, 2);
INSERT INTO `sys_permission`
VALUES (3, 0, '客户管理', 'system:customere', 'customer', 2, 'customer:list,customer:add,customer:update,customer:delete',
'customer', '', 0, 1, 2);
INSERT INTO `sys_permission`
VALUES (4, 0, '订单管理', 'system:order', 'order', 2, 'order:list,order:add,order:update,order:delete', 'order', '', 0, 1,
2);
INSERT INTO `sys_permission`
VALUES (5, 1, '用户添加', 'system:user:add', 'user:add', 3, '', '/user/add', '', 1, 1, 2);
INSERT INTO `sys_permission`
VALUES (6, 1, '用户删除', 'system:user:delete', 'user:delete', 3, '', '/user/delete', '', 2, 1, 2);
INSERT INTO `sys_permission`
VALUES (7, 1, '用户修改', 'system:user:update', 'user:update', 3, '', '/user/update', '', 3, 1, 2);
INSERT INTO `sys_permission`
VALUES (8, 1, '用户列表', 'system:user:list', 'user:list', 3, '', '/user/list', '', 4, 1, 2);
INSERT INTO `sys_permission`
VALUES (9, 2, '角色添加', 'system:sysRole:add', 'sysRole:add', 3, '', '/sysRole/add', '', 1, 1, 2);
INSERT INTO `sys_permission`
VALUES (10, 2, '角色删除', 'system:sysRole:delete', 'sysRole:delete', 3, '', '/sysRole/delete', '', 2, 1, 2);
INSERT INTO `sys_permission`
VALUES (11, 2, '角色修改', 'system:sysRole:update', 'sysRole:update', 3, '', '/sysRole/update', '', 3, 1, 2);
INSERT INTO `sys_permission`
VALUES (12, 2, '角色列表', 'system:sysRole:list', 'sysRole:list', 3, '', '/sysRole/list', '', 4, 1, 2);
INSERT INTO `sys_permission`
VALUES (13, 3, '客户添加', 'system:customer:add', 'customer:add', 3, '', '/customer/add', '', 1, 1, 2);
INSERT INTO `sys_permission`
VALUES (14, 3, '客户删除', 'system:customer:delete', 'customer:delete', 3, '', '/customer/delete', '', 2, 1, 2);
INSERT INTO `sys_permission`
VALUES (15, 3, '客户修改', 'system:customer:update', 'customer:update', 3, '', '/customer/update', '', 3, 1, 2);
INSERT INTO `sys_permission`
VALUES (17, 3, '客户列表', 'system:customer:list', 'customer:list', 3, '', '/customer/list', '', 4, 1, 2);
INSERT INTO `sys_permission`
VALUES (18, 1, '修改用户密码', 'system:user:updatePwd', 'user:updatePwd', 3, '', '/user/updatePwd', '', 5, 1, 2);
INSERT INTO `sys_permission`
VALUES (19, 0, '权限管理', 'system:permission', 'permission', 2,
'permission:list,permission:add,permission:update,permission:delete', 'permission', '', 0, 1, 2);
INSERT INTO `sys_permission`
VALUES (21, 19, '权限添加', 'system:permission:add', 'permission:add', 3, '', '/permission/add', '', 1, 1, 2);
INSERT INTO `sys_permission`
VALUES (22, 19, '权限删除', 'system:permission:delete', 'permission:delete', 3, '', '/permission/delete', '', 2, 1, 2);
INSERT INTO `sys_permission`
VALUES (23, 19, '权限修改', 'system:permission:update', 'permission:update', 3, '', '/permission/update', '', 3, 1, 2);
INSERT INTO `sys_permission`
VALUES (24, 19, '权限列表', 'system:permission:list', 'permission:list', 3, '', '/permission/list', '', 4, 1, 2);
INSERT INTO `sys_permission`
VALUES (25, 4, '订单添加', 'system:order:add', 'order:add', 3, '', '/order/add', '', 1, 1, 2);
INSERT INTO `sys_permission`
VALUES (26, 4, '订单删除', 'system:order:delete', 'order:delete', 3, '', '/order/delete', '', 2, 1, 2);
INSERT INTO `sys_permission`
VALUES (27, 4, '订单修改', 'system:order:update', 'order:update', 3, '', '/order/update', '', 3, 1, 2);
INSERT INTO `sys_permission`
VALUES (28, 4, '订单列表', 'system:order:list', 'order:list', 3, '', '/order/list', '', 4, 1, 2);
INSERT INTO `sys_permission`
VALUES (29, 0, '我的资料', 'system:myData', 'myData', 2, 'myData:list,myData:update', 'myData', '', 0, 1, 2);
INSERT INTO `sys_permission`
VALUES (30, 29, '资料修改', 'system:myData:update', 'myData:update', 3, '', '/myData/update', '', 3, 1, 2);
INSERT INTO `sys_permission`
VALUES (31, 29, '资料列表', 'system:myData:list', 'myData:list', 3, '', '/myData/list', '', 4, 1, 2);
INSERT INTO `sys_permission`
VALUES (32, 1, '用户停用', 'system.user.stop', 'user:stop', 3, '', '/user/stop', '', 6, 1, 2);
INSERT INTO `sys_role`
VALUES (1, '管理员', '管理员管理员', '1,5,6,7,8,18,2,9,10,11,12,3,13,14,15,17,4,25,26,27,28,19,21,22,23,24,29,30,31',
'2021-06-29 14:51:49', 2);
INSERT INTO `sys_role`
VALUES (2, '老板', '老板老板', '28,31,17', '2021-07-01 11:08:54', 2);
INSERT INTO `sys_role`
VALUES (3, '商务', '商务商务', '28,31,17', '2021-07-01 11:09:17', 2);
INSERT INTO `sys_role`
VALUES (4, '财务', '财务财务', '28,31,17', '2021-07-01 11:09:28', 2);
INSERT INTO `sys_role`
VALUES (5, '制作', '制作制作', '28,31', '2021-07-01 15:23:41', 2);
INSERT INTO `sys_role`
VALUES (9, '超级管理员', '超级管理员超级管理员', '1,5,6,7,8,18,2,9,10,11,12,3,13,14,15,17,4,25,26,27,28,19,21,22,23,24,29,30,31,32',
'2021-07-07 11:01:44', 2);
INSERT INTO `user`
VALUES (1, '13801380238', 'e10adc3949ba59abbe56e057f20f883e', '简正', 'jianzhengwx', '', '2021-06-29 15:25:20', '',
'2021-06-29 15:25:20', 2, '超级管理员', '简正简正', 'jianzheng');
INSERT INTO `user`
VALUES (2, '13032382138', 'e10adc3949ba59abbe56e057f20f883e', '李四', 'lisiwx', '', '2021-06-29 17:25:50', '',
'2021-06-29 17:25:50', 2, '管理员', '李四李四', 'lisi');
INSERT INTO `user`
VALUES (3, '13032380138', 'e10adc3949ba59abbe56e057f20f883e', '王五', 'wangwuwx', '', '2021-06-29 17:37:18', '',
'2021-06-29 17:37:19', 2, '管理员', '王五王五', 'wangwu');
INSERT INTO `user`
VALUES (4, '15801380238', 'e10adc3949ba59abbe56e057f20f883e', '张三', 'zhangsanwx', '', '2021-06-29 17:49:50', '',
'2021-06-29 17:49:50', 2, '老板', '张三张三', 'zhangsan');
INSERT INTO `user`
VALUES (5, '13801380438', 'e10adc3949ba59abbe56e057f20f883e', '杜牧', 'dumuwx', '', '2021-06-30 10:37:45', '',
'2021-06-30 10:37:45', 2, '制作', '杜牧杜牧', 'dumu');
INSERT INTO `user`
VALUES (6, '13807380238', 'e10adc3949ba59abbe56e057f20f883e', '朱穆', 'zhumuwx', '', '2021-06-30 10:40:51', '',
'2021-06-30 10:40:51', 3, '商务', '朱穆朱穆', 'zhumu');
INSERT INTO `user`
VALUES (7, '13801380938', 'fcea920f7412b5da7be0cf42b8c93759', '王勃', 'wangbowx', '', '2021-06-30 11:24:49', '',
'2021-06-30 11:24:49', 3, '财务', '王勃王勃', 'wangbo');
INSERT INTO `customer`
VALUES (3, '京东', '刘东强', '2021-06-29 17:35:28', '2021-07-09 09:28:32', '13032380138', 1);
INSERT INTO `customer`
VALUES (4, '恒大集团', '许家印', '2021-06-30 12:54:26', '2021-07-09 15:36:35', '13032380138', 1);
INSERT INTO `customer`
VALUES (5, '简正科技', '肖裕', '2021-06-30 13:09:24', '2021-06-30 17:20:10', '13801380238', 1);
INSERT INTO `customer`
VALUES (6, '万科企业股份有限公司', '郁亮', '2021-06-30 13:19:35', '2021-07-09 15:37:48', '13032380138', 1);
INSERT INTO `customer`
VALUES (11, '新浪', '王志东', '2021-06-30 13:59:22', '2021-07-02 15:19:18', '13801380238', 1);
INSERT INTO `customer`
VALUES (12, '搜狐', '张朝阳', '2021-06-30 13:59:36', '2021-07-02 15:19:18', '13801380238', 1);
INSERT INTO `customer`
VALUES (13, '携程', '梁建章', '2021-06-30 13:59:47', '2021-07-02 15:19:18', '13801380238', 1);
INSERT INTO `customer`
VALUES (14, '腾讯', '马化腾', '2021-06-30 14:00:07', '2021-07-02 15:19:18', '13801380238', 1);
INSERT INTO `customer`
VALUES (15, '百度', '李彦宏', '2021-06-30 14:00:25', '2021-07-02 15:19:18', '13801380238', 1);
INSERT INTO `customer`
VALUES (19, '碧桂园', '杨国强', '2021-07-09 09:29:18', '2021-07-09 09:29:18', '13032380138', 1);
INSERT INTO `customer`
VALUES (20, '苏宁易购集团股份有限公司', '张近东', '2021-07-09 15:42:13', '2021-07-09 15:42:13', '13032380138', 1);
INSERT INTO `order`
VALUES (1, '京东', '2020-07-01 00:00:00', '2021-07-31 00:00:00', '2021-07-01 00:00:00', 450000, 1, '小王',
'2021-07-09 15:03:56', '13032380138', 0);
INSERT INTO `order`
VALUES (2, '简正科技', '2021-06-30 00:00:01', '2021-07-09 00:00:00', '2021-07-02 00:00:00', 900000, 1, '小涛',
'2021-07-09 15:42:57', '13032380138', 0);
INSERT INTO `order`
VALUES (5, '万科企业股份有限公司', '2021-07-01 00:00:00', '2021-07-02 00:00:00', '2021-07-03 00:00:00', 1700000, 1, '小郑',
'2021-07-09 15:43:44', '13032380138', 0);
INSERT INTO `order`
VALUES (6, '简正科技', '2021-07-01 00:00:00', '2021-07-08 00:00:00', NULL, 500000, 0, '小贾', '2021-07-09 15:04:02',
'13032380138', 0);
|
CREATE TABLE Kulinar.RecommendedRecipes
(
Id BIGINT IDENTITY (1, 1) NOT NULL
,RecommendedListId BIGINT NOT NULL
,RecipeId BIGINT NOT NULL
,Position INT NOT NULL
,CreatedDateUtc DATETIME NOT NULL
,CONSTRAINT PK_RecommendedRecipes PRIMARY KEY CLUSTERED (Id ASC)
,CONSTRAINT FK_RecommendedRecipes_RecipeId FOREIGN KEY (RecipeId) REFERENCES Kulinar.Recipes (ItemId)
,CONSTRAINT FK_RecommendedRecipes_RecommendedListId FOREIGN KEY (RecommendedListId) REFERENCES Kulinar.RecommendedLists (Id)
);
|
if OBJECT_ID('criticos') is not null
drop table criticos;
create table criticos(
id_critico int primary key,
id_producto int,
id_tipo_critico int
);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(1,19,1);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(2,1,1);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(3,20,1);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(4,2,1);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(5,15,1);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(6,24,1);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(7,28,1);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(8,29,2);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(9,56,2);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(10,57,2);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(11,58,2);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(12,34,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(13,35,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(14,36,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(15,37,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(16,38,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(17,39,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(18,40,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(19,41,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(20,42,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(21,43,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(22,44,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(23,45,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(24,46,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(25,47,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(26,48,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(27,49,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(28,50,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(29,51,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(30,52,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(31,53,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(32,54,3);
insert into criticos(id_critico,id_producto,id_tipo_critico) values(33,55,3);
|
/* TAREA 1 */
SET SERVEROUTPUT ON; -- Sentencia para poder imprimir por consola
DECLARE -- Sentencia para declarar variables
TYPE notasArray IS varray(4) of number; -- Declaramos el array de 4 posiciones de tipo numerico
notas notasArray := notasArray(95, 60, 75, 85); -- inicializamos el array en una variable notas
promedio number(5,2) := 0; -- Declaramos la variable promedio de tipo numerico que almacena cinco reales y dos coma flotantes
BEGIN -- Sentencia PL para ejecutar la logica del programa
<< ciclo_promedio >> -- Marcador del bucle
FOR i IN 1..4 LOOP -- Inicializamos un ciclo de corra 4 veces
promedio := promedio + notas(i); -- Sumamos cada uno de los posiciones del array
END LOOP ciclo_promedio; -- Terminamos el ciclo despues de 4 repeticiones
promedio := promedio / 4; -- Sacamos el promedio de las 4 notas
dbms_output.put_line('El promedio es: ' || promedio ); -- Imprimimos por consola el resultado
END; -- Final de la sentencia -- Logica del programa
/ |
create or replace view dm_TransactionScenario as select
_sys_transform_id,
TenantId,
TransactionDistributionId || '#' || ScenarioId AS TransactionScenarioId,
TransactionDistributionId,
ScenarioId,
FiscalPeriodId,
AccountId
from out_TransactionScenario
where _sys_transform_id = (select max(id) from _sys_transform_id where ts_end is not null and entity = 'dm_TransactionScenario');
|
-- 工程申请表
DROP TABLE IF EXISTS `tb_project`;
CREATE TABLE `tb_project` (
`project_id` BIGINT(11) NOT NULL AUTO_INCREMENT COMMENT '自增长主键',
`group_id` BIGINT(11) NOT NULL COMMENT '小组 编号',
`project_name` BIGINT(11) NOT NULL COMMENT '分项工程名称',
`construction_date` TIMESTAMP DEFAULT NULL COMMENT '施工时间',
`construction` varchar(100) DEFAULT NULL COMMENT '施工 单位',
`supervision` varchar(100) DEFAULT NULL COMMENT '监理 单位',
`status` SMALLINT(1) DEFAULT '0' COMMENT '状态 0 启动中 1 结项 ' ,
`created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`project_id`),
INDEX `idx_group_id` (`group_id`)
)
COLLATE='utf8_unicode_ci'
ENGINE=INNODB
ROW_FORMAT=DEFAULT
DEFAULT CHARSET=utf8
COMMENT='检查工程 申请表'
AUTO_INCREMENT=1
;
-- 工程 与 检查项 关联表
DROP TABLE IF EXISTS `tb_project_item`;
CREATE TABLE `tb_project_item` (
`id` BIGINT(11) NOT NULL AUTO_INCREMENT COMMENT '关联ID',
`project_id` BIGINT(11) NOT NULL COMMENT '工程 ID',
`item_id` BIGINT(11) NOT NULL COMMENT '检查项 ID',
`status` SMALLINT(1) DEFAULT '0' COMMENT '状态 0 正常 1 失效 ' ,
`created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`id`),
INDEX `idx_project_id` (`project_id`),
INDEX `idx_item_id` (`item_id`)
)
COLLATE='utf8_unicode_ci'
ENGINE=INNODB
ROW_FORMAT=DEFAULT
DEFAULT CHARSET=utf8
COMMENT='工程 与 检查项 关联表'
AUTO_INCREMENT=1
;
-- 钢筋检查项 数据记录表
DROP TABLE IF EXISTS `tb_fixture_record`
-- 钢筋检查项 数据 详细 记录表
|
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 08 okt 2012 om 22:47
-- Serverversie: 5.5.16
-- PHP-versie: 5.3.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Databank: `iqc`
--
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`pk` bigint(20) NOT NULL AUTO_INCREMENT,
`firstname` varchar(50) NOT NULL DEFAULT '',
`lastname` varchar(50) NOT NULL DEFAULT '',
`initials` varchar(10) NOT NULL DEFAULT '',
`phone` varchar(12) NOT NULL,
`email` varchar(100) NOT NULL,
`login_level_1` varchar(5) NOT NULL DEFAULT '',
`login_level_2` varchar(5) NOT NULL DEFAULT '',
`login_level_3` varchar(5) NOT NULL DEFAULT '',
`login_level_4` varchar(5) NOT NULL DEFAULT '',
`login_level_5` varchar(5) NOT NULL DEFAULT '',
`login` varchar(20) NOT NULL DEFAULT '',
`password` varchar(32) NOT NULL DEFAULT '',
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Gegevens worden uitgevoerd voor tabel `users`
--
INSERT INTO `users` (`pk`, `firstname`, `lastname`, `initials`, `phone`, `email`, `login_level_1`, `login_level_2`, `login_level_3`, `login_level_4`, `login_level_5`, `login`, `password`) VALUES
(3, 'Voor', '8er Naam', '', '', '', 'on', '', '', '', '', 'root', '7df288e512aa7090138f14012e6d3a3a');
|
/*
SQLyog Ultimate v11.5 (64 bit)
MySQL - 5.6.17 : Database - cecintranet
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`cecintranet` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `cecintranet`;
/*Table structure for table `alumno_curso` */
DROP TABLE IF EXISTS `alumno_curso`;
CREATE TABLE `alumno_curso` (
`id_alumno_curso` int(11) NOT NULL AUTO_INCREMENT,
`id_curso_ofertar` int(11) NOT NULL,
`id_persona` int(11) NOT NULL,
`costo` float DEFAULT NULL,
`pagado` float NOT NULL DEFAULT '0',
`referencia` varchar(10) DEFAULT NULL,
`id_status` int(11) NOT NULL DEFAULT '1',
`id_user` int(11) NOT NULL,
`requiere_factura` int(1) DEFAULT NULL,
`contacto_factura` text,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_alumno_curso`),
KEY `fk_alumno_curso_curso_ofertar1_idx` (`id_curso_ofertar`),
KEY `fk_alumno_curso_personas1_idx` (`id_persona`),
CONSTRAINT `fk_alumno_curso_curso_ofertar1` FOREIGN KEY (`id_curso_ofertar`) REFERENCES `curso_ofertar` (`id_curso_ofertar`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `fk_alumno_curso_personas1` FOREIGN KEY (`id_persona`) REFERENCES `personas` (`id_persona`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3297 DEFAULT CHARSET=latin1;
/*Table structure for table `api_keys` */
DROP TABLE IF EXISTS `api_keys`;
CREATE TABLE `api_keys` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`key` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`level` smallint(6) NOT NULL,
`ignore_limits` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `api_keys_key_unique` (`key`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*Table structure for table `api_logs` */
DROP TABLE IF EXISTS `api_logs`;
CREATE TABLE `api_logs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`api_key_id` int(10) unsigned NOT NULL,
`route` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`method` varchar(6) COLLATE utf8_unicode_ci NOT NULL,
`params` text COLLATE utf8_unicode_ci NOT NULL,
`ip_address` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `api_logs_route_index` (`route`),
KEY `api_logs_method_index` (`method`),
KEY `api_logs_api_key_id_foreign` (`api_key_id`),
CONSTRAINT `api_logs_api_key_id_foreign` FOREIGN KEY (`api_key_id`) REFERENCES `api_keys` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*Table structure for table `api_users` */
DROP TABLE IF EXISTS `api_users`;
CREATE TABLE `api_users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `api_users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*Table structure for table `aplicaciones` */
DROP TABLE IF EXISTS `aplicaciones`;
CREATE TABLE `aplicaciones` (
`id_aplicacion` int(11) NOT NULL AUTO_INCREMENT,
`Nombre` varchar(100) NOT NULL,
`Descripción` text NOT NULL,
`controlador` varchar(100) NOT NULL,
`metodo` varchar(100) NOT NULL,
`lectura` int(1) NOT NULL DEFAULT '1' COMMENT '0 para publico, 1 para usuarios, 2 para buscar en tabla privilegios aplicaciones',
`escritura` int(1) NOT NULL DEFAULT '2' COMMENT '0 para publico, 1 para usuarios, 2 para buscar en tabla privilegios aplicaciones',
`modificacion` int(1) NOT NULL DEFAULT '2' COMMENT '0 para publico, 1 para usuarios, 2 para buscar en tabla privilegios aplicaciones',
`eliminar` int(1) NOT NULL DEFAULT '2' COMMENT '0 para publico, 1 para usuarios, 2 para buscar en tabla privilegios aplicaciones',
`icono` varchar(255) DEFAULT 'fa-folder',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_aplicacion`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COMMENT='Aquí se capturaran las aplicaciones que existen';
/*Table structure for table `archivos_instructores` */
DROP TABLE IF EXISTS `archivos_instructores`;
CREATE TABLE `archivos_instructores` (
`id_archivo_instructor` int(11) NOT NULL AUTO_INCREMENT,
`id_instructor` int(11) NOT NULL,
`descripcion` varchar(100) NOT NULL COMMENT 'Aquí se indicará que tipo de archivo se sube',
`url` varchar(200) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_archivo_instructor`),
KEY `fk_archivos_instructores_instructores1` (`id_instructor`),
CONSTRAINT `fk_archivos_instructores_instructores1` FOREIGN KEY (`id_instructor`) REFERENCES `instructores` (`id_instructor`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=668 DEFAULT CHARSET=latin1;
/*Table structure for table `aulas` */
DROP TABLE IF EXISTS `aulas`;
CREATE TABLE `aulas` (
`id_aula` int(11) NOT NULL AUTO_INCREMENT,
`aula` varchar(45) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_aula`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*Table structure for table `cedes` */
DROP TABLE IF EXISTS `cedes`;
CREATE TABLE `cedes` (
`id_cede` int(11) NOT NULL AUTO_INCREMENT,
`cede` char(250) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_cede`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
/*Table structure for table `ci_sessions` */
DROP TABLE IF EXISTS `ci_sessions`;
CREATE TABLE `ci_sessions` (
`session_id` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '0',
`ip_address` varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '0',
`user_agent` varchar(150) COLLATE utf8_bin NOT NULL,
`last_activity` int(10) unsigned NOT NULL DEFAULT '0',
`user_data` text COLLATE utf8_bin NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*Table structure for table `curso_ofertar` */
DROP TABLE IF EXISTS `curso_ofertar`;
CREATE TABLE `curso_ofertar` (
`id_curso_ofertar` int(11) NOT NULL AUTO_INCREMENT,
`id_curso` int(11) NOT NULL,
`instructores_id_instructor` int(11) NOT NULL,
`capacidad_alumnos` int(11) DEFAULT NULL,
`fechainicial` varchar(10) DEFAULT NULL,
`fechafinal` varchar(10) DEFAULT NULL,
`id_aula` int(11) NOT NULL,
`id_status_cursos` int(11) NOT NULL,
`id_sabatino_normal` int(11) NOT NULL DEFAULT '1',
`costo_general` float DEFAULT NULL,
`costo_empleado` float DEFAULT NULL,
`costo_politecnico` float DEFAULT NULL,
`costo_becado` float DEFAULT NULL,
`referencias_dadas` int(3) NOT NULL DEFAULT '0',
`referencias_pagadas` int(3) NOT NULL DEFAULT '0',
`no_ano` int(1) DEFAULT '1' COMMENT 'Aqui se pondra cuantas veces se ha dado en el ano',
`id_user` int(11) NOT NULL,
`dias_clase` text,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_curso_ofertar`),
KEY `fk_curso_ofertar_cursos1_idx` (`id_curso`),
KEY `fk_curso_ofertar_instructores1_idx` (`instructores_id_instructor`),
KEY `fk_curso_ofertar_aulas1_idx` (`id_aula`),
KEY `fk_curso_ofertar_status_cursos1_idx` (`id_status_cursos`),
KEY `fk_curso_ofertar_sabatino_normal1_idx` (`id_sabatino_normal`),
CONSTRAINT `curso_ofertar_ibfk_5` FOREIGN KEY (`id_aula`) REFERENCES `aulas` (`id_aula`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `curso_ofertar_ibfk_6` FOREIGN KEY (`id_status_cursos`) REFERENCES `status_cursos` (`id_status_cursos`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `curso_ofertar_ibfk_7` FOREIGN KEY (`id_sabatino_normal`) REFERENCES `sabatino_normal` (`id_sabatino_normal`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `fk_curso_ofertar_cursos1` FOREIGN KEY (`id_curso`) REFERENCES `cursos` (`id_curso`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_curso_ofertar_instructores1` FOREIGN KEY (`instructores_id_instructor`) REFERENCES `instructores` (`id_instructor`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=317 DEFAULT CHARSET=latin1;
/*Table structure for table `cursos` */
DROP TABLE IF EXISTS `cursos`;
CREATE TABLE `cursos` (
`id_curso` int(11) NOT NULL AUTO_INCREMENT,
`nombre_curso` varchar(255) DEFAULT NULL,
`id_web` int(11) DEFAULT NULL,
`letra_referencia` varchar(2) DEFAULT NULL,
`id_tipos_cursos` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_curso`),
KEY `fk_cursos_tipos_cursos1_idx` (`id_tipos_cursos`),
CONSTRAINT `fk_cursos_tipos_cursos1` FOREIGN KEY (`id_tipos_cursos`) REFERENCES `tipos_cursos` (`id_tipos_cursos`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1;
/*Table structure for table `departamentos` */
DROP TABLE IF EXISTS `departamentos`;
CREATE TABLE `departamentos` (
`id_departamento` int(11) NOT NULL AUTO_INCREMENT,
`departamento` varchar(100) NOT NULL,
`abreviatura` varchar(10) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_departamento`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
/*Table structure for table `discapacidades` */
DROP TABLE IF EXISTS `discapacidades`;
CREATE TABLE `discapacidades` (
`id_discapacidad` int(11) NOT NULL AUTO_INCREMENT,
`discapacidad` varchar(100) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_discapacidad`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*Table structure for table `equivalencia_referencias` */
DROP TABLE IF EXISTS `equivalencia_referencias`;
CREATE TABLE `equivalencia_referencias` (
`id_equivalencia_referencia` int(11) NOT NULL AUTO_INCREMENT,
`movimientos_id_movimiento` int(11) NOT NULL,
`alumno_curso_id_alumno_curso` int(11) NOT NULL,
`status_movimientos_id_status_movimiento` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_equivalencia_referencia`),
KEY `fk_equivalencia_referencias_movimientos1_idx` (`movimientos_id_movimiento`),
KEY `fk_equivalencia_referencias_alumno_curso1_idx` (`alumno_curso_id_alumno_curso`),
CONSTRAINT `fk_equivalencia_referencias_alumno_curso1` FOREIGN KEY (`alumno_curso_id_alumno_curso`) REFERENCES `alumno_curso` (`id_alumno_curso`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `fk_equivalencia_referencias_movimientos1` FOREIGN KEY (`movimientos_id_movimiento`) REFERENCES `movimientos` (`id_movimiento`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2478 DEFAULT CHARSET=latin1;
/*Table structure for table `folios_ipn` */
DROP TABLE IF EXISTS `folios_ipn`;
CREATE TABLE `folios_ipn` (
`id_folio_ipn` int(11) NOT NULL AUTO_INCREMENT,
`folio_ipn` varchar(100) COLLATE utf8_spanish_ci DEFAULT NULL,
`fecha_folio_ipn` varchar(10) COLLATE utf8_spanish_ci DEFAULT NULL,
`id_equivalencia_referencia` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_folio_ipn`)
) ENGINE=InnoDB AUTO_INCREMENT=1785 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
/*Table structure for table `grados_estudio` */
DROP TABLE IF EXISTS `grados_estudio`;
CREATE TABLE `grados_estudio` (
`id_grado` int(11) NOT NULL AUTO_INCREMENT,
`grado` varchar(45) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_grado`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*Table structure for table `instructor_prefesion_academica` */
DROP TABLE IF EXISTS `instructor_prefesion_academica`;
CREATE TABLE `instructor_prefesion_academica` (
`id_instructor_prefesion_academica` int(11) NOT NULL AUTO_INCREMENT,
`id_instructor` int(11) NOT NULL,
`lugar` varchar(100) DEFAULT NULL,
`curso` varchar(100) DEFAULT NULL,
`fecha_inicio` varchar(10) DEFAULT NULL,
`fecha_fin` varchar(10) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_instructor_prefesion_academica`),
KEY `fk_instructor_prefesion_academica_instructores1_idx` (`id_instructor`),
CONSTRAINT `fk_instructor_prefesion_academica_instructores1` FOREIGN KEY (`id_instructor`) REFERENCES `instructores` (`id_instructor`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=622 DEFAULT CHARSET=latin1;
/*Table structure for table `instructor_profesional` */
DROP TABLE IF EXISTS `instructor_profesional`;
CREATE TABLE `instructor_profesional` (
`id_instructor_profesional` int(11) NOT NULL AUTO_INCREMENT,
`id_instructor` int(11) NOT NULL,
`puesto` varchar(100) DEFAULT NULL,
`lugar` varchar(100) DEFAULT NULL,
`fecha_inicio` varchar(20) DEFAULT NULL,
`fecha_fin` varchar(20) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_instructor_profesional`),
KEY `fk_instructor_profesional_instructores1_idx` (`id_instructor`),
CONSTRAINT `fk_instructor_profesional_instructores1` FOREIGN KEY (`id_instructor`) REFERENCES `instructores` (`id_instructor`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=852 DEFAULT CHARSET=latin1;
/*Table structure for table `instructores` */
DROP TABLE IF EXISTS `instructores`;
CREATE TABLE `instructores` (
`id_instructor` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(200) NOT NULL,
`direccion` varchar(500) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`email2` varchar(50) DEFAULT NULL,
`celular` varchar(20) DEFAULT NULL,
`telefono` varchar(20) DEFAULT NULL,
`RFC` varchar(16) DEFAULT NULL,
`CURP` varchar(45) DEFAULT NULL,
`cursos` text NOT NULL,
`activo` int(1) NOT NULL DEFAULT '1' COMMENT 'campo para saber si el instructor esta disponible',
`id_cede` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_instructor`),
KEY `fk_instructor_cede1` (`id_cede`),
CONSTRAINT `fk_instructor_cede1` FOREIGN KEY (`id_cede`) REFERENCES `cedes` (`id_cede`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=633 DEFAULT CHARSET=latin1;
/*Table structure for table `instructores_academicos` */
DROP TABLE IF EXISTS `instructores_academicos`;
CREATE TABLE `instructores_academicos` (
`id_instructores_academicos` int(11) NOT NULL AUTO_INCREMENT,
`id_instructor` int(11) NOT NULL,
`id_tipo_estudio` int(11) NOT NULL,
`nombre` varchar(150) DEFAULT NULL,
`lugar` char(100) DEFAULT NULL,
`fecha` char(15) DEFAULT NULL,
`cedula` varchar(200) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_instructores_academicos`),
KEY `fk_instructores_academicos_instructores1_idx` (`id_instructor`),
KEY `fk_instructores_academicos_tipos_estudios1_idx` (`id_tipo_estudio`),
CONSTRAINT `fk_instructores_academicos_instructores1` FOREIGN KEY (`id_instructor`) REFERENCES `instructores` (`id_instructor`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_instructores_academicos_instructores2` FOREIGN KEY (`id_instructor`) REFERENCES `instructores` (`id_instructor`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `fk_instructores_academicos_tipos_estudios1` FOREIGN KEY (`id_tipo_estudio`) REFERENCES `tipos_estudios` (`id_tipo_estudio`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=850 DEFAULT CHARSET=latin1;
/*Table structure for table `login_attempts` */
DROP TABLE IF EXISTS `login_attempts`;
CREATE TABLE `login_attempts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip_address` varchar(40) COLLATE utf8_bin NOT NULL,
`login` varchar(50) COLLATE utf8_bin NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*Table structure for table `mensajes_chat` */
DROP TABLE IF EXISTS `mensajes_chat`;
CREATE TABLE `mensajes_chat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`users_id` int(11) NOT NULL,
`fecha` varchar(10) DEFAULT NULL,
`hora` tinytext,
`mensaje` text,
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `mensajes_usuarios` (`users_id`),
CONSTRAINT `mensajes_usuarios` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=latin1;
/*Table structure for table `meses` */
DROP TABLE IF EXISTS `meses`;
CREATE TABLE `meses` (
`number` varchar(2) DEFAULT NULL,
`mes` varchar(12) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Table structure for table `migrations` */
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*Table structure for table `movimientos` */
DROP TABLE IF EXISTS `movimientos`;
CREATE TABLE `movimientos` (
`id_movimiento` int(11) NOT NULL AUTO_INCREMENT,
`tipos_movimientos_id_tipo_movimiento` int(11) NOT NULL,
`fecha` varchar(10) DEFAULT NULL,
`num_movimiento` varchar(10) NOT NULL,
`referencia` text,
`abono` float DEFAULT NULL,
`cuenta` varchar(15) NOT NULL COMMENT 'Para pagos de cuenta de tercero',
`status_movimiento` int(11) NOT NULL DEFAULT '1' COMMENT '1: no enlazado 2:enlazado 3:problema 4:sobrante',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_movimiento`),
UNIQUE KEY `num_movimiento` (`num_movimiento`),
KEY `fk_movimientos_tipos_movimientos1_idx` (`tipos_movimientos_id_tipo_movimiento`),
CONSTRAINT `fk_movimientos_tipos_movimientos1` FOREIGN KEY (`tipos_movimientos_id_tipo_movimiento`) REFERENCES `tipos_movimientos` (`id_tipo_movimiento`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2186 DEFAULT CHARSET=latin1;
/*Table structure for table `password_resets` */
DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
KEY `password_resets_email_index` (`email`),
KEY `password_resets_token_index` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*Table structure for table `personal` */
DROP TABLE IF EXISTS `personal`;
CREATE TABLE `personal` (
`id_personal` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(100) DEFAULT NULL,
`apellido_p` varchar(50) DEFAULT NULL,
`apellido_m` varchar(50) DEFAULT NULL,
`correo` varchar(45) DEFAULT NULL,
`extension` int(5) DEFAULT NULL,
`id_departamento` int(11) NOT NULL,
`espersona` int(1) DEFAULT '1' COMMENT '1 para personas 0 para servidores',
`ip` varchar(15) DEFAULT NULL,
`tags` varchar(100) NOT NULL COMMENT 'para busquedas',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_personal`),
KEY `fk_personal_departamentos_idx` (`id_departamento`),
CONSTRAINT `fk_personal_departamentos` FOREIGN KEY (`id_departamento`) REFERENCES `departamentos` (`id_departamento`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=latin1;
/*Table structure for table `personas` */
DROP TABLE IF EXISTS `personas`;
CREATE TABLE `personas` (
`id_persona` int(11) NOT NULL AUTO_INCREMENT,
`nombres` varchar(100) DEFAULT NULL,
`apellido_paterno` varchar(50) DEFAULT NULL,
`apellido_materno` varchar(50) DEFAULT NULL,
`id_sexo` int(11) NOT NULL,
`fecha_nacimiento` varchar(10) DEFAULT NULL,
`RFC` varchar(13) DEFAULT NULL,
`telefono` varchar(20) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`escuela_procedencia` varchar(100) DEFAULT NULL,
`ano_egreso` int(4) DEFAULT NULL,
`grados_estudio_id_grado` int(11) NOT NULL,
`discapacidades_id_discapacidad` int(11) NOT NULL,
`id_tipo_alumno` int(11) NOT NULL DEFAULT '1',
`file_url` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_persona`),
KEY `fk_personas_sexos1_idx` (`id_sexo`),
KEY `fk_personas_grados_estudio1_idx` (`grados_estudio_id_grado`),
KEY `fk_personas_discapacidades1_idx` (`discapacidades_id_discapacidad`),
CONSTRAINT `fk_personas_discapacidades1` FOREIGN KEY (`discapacidades_id_discapacidad`) REFERENCES `discapacidades` (`id_discapacidad`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_personas_grados_estudio1` FOREIGN KEY (`grados_estudio_id_grado`) REFERENCES `grados_estudio` (`id_grado`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_personas_sexos1` FOREIGN KEY (`id_sexo`) REFERENCES `sexos` (`id_sexo`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1510 DEFAULT CHARSET=latin1;
/*Table structure for table `precios_cursos` */
DROP TABLE IF EXISTS `precios_cursos`;
CREATE TABLE `precios_cursos` (
`clave` int(5) NOT NULL,
`id_tipo_curso` int(11) NOT NULL,
`descripcion` text,
`precio` float DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`clave`),
KEY `id_tipo_curso` (`id_tipo_curso`),
CONSTRAINT `precios_cursos_ibfk_1` FOREIGN KEY (`id_tipo_curso`) REFERENCES `tipos_cursos` (`id_tipos_cursos`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Table structure for table `privilegio_aplicaciones` */
DROP TABLE IF EXISTS `privilegio_aplicaciones`;
CREATE TABLE `privilegio_aplicaciones` (
`id_privilegio_aplicaciones` int(11) NOT NULL AUTO_INCREMENT,
`aplicaciones_id_aplicacion` int(11) NOT NULL,
`users_id` int(11) NOT NULL,
`tipo_privilegios_id_tipo_privilegio` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_privilegio_aplicaciones`),
KEY `fk_privilegio_aplicaciones_aplicaciones1_idx` (`aplicaciones_id_aplicacion`),
KEY `fk_privilegio_aplicaciones_users1_idx` (`users_id`),
KEY `fk_privilegio_aplicaciones_tipo_privilegios1_idx` (`tipo_privilegios_id_tipo_privilegio`),
CONSTRAINT `fk_privilegio_aplicaciones_aplicaciones1` FOREIGN KEY (`aplicaciones_id_aplicacion`) REFERENCES `aplicaciones` (`id_aplicacion`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `fk_privilegio_aplicaciones_tipo_privilegios1` FOREIGN KEY (`tipo_privilegios_id_tipo_privilegio`) REFERENCES `tipo_privilegios` (`id_tipo_privilegio`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_privilegio_aplicaciones_users1` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=309 DEFAULT CHARSET=latin1;
/*Table structure for table `roles` */
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role` varchar(255) NOT NULL,
`default` tinyint(2) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*Table structure for table `sabatino_normal` */
DROP TABLE IF EXISTS `sabatino_normal`;
CREATE TABLE `sabatino_normal` (
`id_sabatino_normal` int(11) NOT NULL AUTO_INCREMENT,
`sabatino_normal` varchar(45) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_sabatino_normal`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*Table structure for table `servicios_categorias` */
DROP TABLE IF EXISTS `servicios_categorias`;
CREATE TABLE `servicios_categorias` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`categoria` varchar(200) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*Table structure for table `servicios_disponibles` */
DROP TABLE IF EXISTS `servicios_disponibles`;
CREATE TABLE `servicios_disponibles` (
`servicio_id` int(11) NOT NULL AUTO_INCREMENT,
`sub_categoria` int(11) DEFAULT NULL,
`servicio` varchar(255) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`servicio_id`),
KEY `sub_categoria` (`sub_categoria`),
CONSTRAINT `servicios_disponibles_ibfk_1` FOREIGN KEY (`sub_categoria`) REFERENCES `servicios_sub_categorias` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
/*Table structure for table `servicios_sub_categorias` */
DROP TABLE IF EXISTS `servicios_sub_categorias`;
CREATE TABLE `servicios_sub_categorias` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`categoria_id` int(11) NOT NULL,
`sub_categoria` varchar(200) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `categoria_id` (`categoria_id`),
CONSTRAINT `servicios_sub_categorias_ibfk_1` FOREIGN KEY (`categoria_id`) REFERENCES `servicios_categorias` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*Table structure for table `sexos` */
DROP TABLE IF EXISTS `sexos`;
CREATE TABLE `sexos` (
`id_sexo` int(11) NOT NULL AUTO_INCREMENT,
`sexo` varchar(10) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_sexo`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*Table structure for table `solicitud_servicio` */
DROP TABLE IF EXISTS `solicitud_servicio`;
CREATE TABLE `solicitud_servicio` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_user` int(11) DEFAULT NULL,
`descripcion` text,
`id_user_assigned` int(11) DEFAULT NULL,
`status` int(1) DEFAULT '1' COMMENT '1:pendiente,2:asignado,3:atendiendo,4:atendido,6:cancelado',
`fecha` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`servicios_disponible_id` int(11) DEFAULT NULL,
`observaciones` text,
`comentarios` text,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `id_user` (`id_user`),
KEY `id_user_assigned` (`id_user_assigned`),
KEY `servicios_disponible_id` (`servicios_disponible_id`),
CONSTRAINT `solicitud_servicio_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `solicitud_servicio_ibfk_2` FOREIGN KEY (`id_user_assigned`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `solicitud_servicio_ibfk_3` FOREIGN KEY (`servicios_disponible_id`) REFERENCES `servicios_disponibles` (`servicio_id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*Table structure for table `status_cursos` */
DROP TABLE IF EXISTS `status_cursos`;
CREATE TABLE `status_cursos` (
`id_status_cursos` int(11) NOT NULL AUTO_INCREMENT,
`status` varchar(100) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_status_cursos`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*Table structure for table `status_movimientos` */
DROP TABLE IF EXISTS `status_movimientos`;
CREATE TABLE `status_movimientos` (
`id_status_movimiento` int(11) NOT NULL AUTO_INCREMENT,
`status_movimiento` varchar(45) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_status_movimiento`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_status` */
DROP TABLE IF EXISTS `tbl_status`;
CREATE TABLE `tbl_status` (
`id_status` int(11) NOT NULL AUTO_INCREMENT,
`estatus` char(45) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_status`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
/*Table structure for table `tipo_privilegios` */
DROP TABLE IF EXISTS `tipo_privilegios`;
CREATE TABLE `tipo_privilegios` (
`id_tipo_privilegio` int(11) NOT NULL AUTO_INCREMENT,
`tipo` varchar(45) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_tipo_privilegio`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
/*Table structure for table `tipos_alumnos` */
DROP TABLE IF EXISTS `tipos_alumnos`;
CREATE TABLE `tipos_alumnos` (
`id_tipo_alumno` int(11) NOT NULL AUTO_INCREMENT,
`tipo_alumno` varchar(100) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_tipo_alumno`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*Table structure for table `tipos_cursos` */
DROP TABLE IF EXISTS `tipos_cursos`;
CREATE TABLE `tipos_cursos` (
`id_tipos_cursos` int(11) NOT NULL AUTO_INCREMENT,
`tipo_curso` text,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_tipos_cursos`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
/*Table structure for table `tipos_estudios` */
DROP TABLE IF EXISTS `tipos_estudios`;
CREATE TABLE `tipos_estudios` (
`id_tipo_estudio` int(11) NOT NULL AUTO_INCREMENT,
`tipo_estudio` varchar(50) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_tipo_estudio`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
/*Table structure for table `tipos_movimientos` */
DROP TABLE IF EXISTS `tipos_movimientos`;
CREATE TABLE `tipos_movimientos` (
`id_tipo_movimiento` int(11) NOT NULL AUTO_INCREMENT,
`tipo_movimiento` varchar(45) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_tipo_movimiento`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*Table structure for table `user_autologin` */
DROP TABLE IF EXISTS `user_autologin`;
CREATE TABLE `user_autologin` (
`key_id` char(32) COLLATE utf8_bin NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`user_agent` varchar(150) COLLATE utf8_bin NOT NULL,
`last_ip` varchar(40) COLLATE utf8_bin NOT NULL,
`last_login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`key_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*Table structure for table `user_profiles` */
DROP TABLE IF EXISTS `user_profiles`;
CREATE TABLE `user_profiles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`country` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`website` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`nombre` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*Table structure for table `users` */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) COLLATE utf8_bin NOT NULL,
`password` varchar(255) COLLATE utf8_bin NOT NULL,
`email` varchar(100) COLLATE utf8_bin NOT NULL,
`role_id` int(11) NOT NULL,
`activated` tinyint(1) NOT NULL DEFAULT '1',
`banned` tinyint(1) NOT NULL DEFAULT '0',
`ban_reason` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`new_password_key` varchar(50) COLLATE utf8_bin DEFAULT NULL,
`new_password_requested` datetime DEFAULT NULL,
`new_email` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`new_email_key` varchar(50) COLLATE utf8_bin DEFAULT NULL,
`last_ip` varchar(40) COLLATE utf8_bin NOT NULL,
`last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`id_cede` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_cede_usuer1` (`id_cede`),
CONSTRAINT `fk_cede_usuer1` FOREIGN KEY (`id_cede`) REFERENCES `cedes` (`id_cede`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
select
items.ServerItem,
sum(Diffstats.Added) as A,
sum(DiffStats.Modified) as M,
sum(DiffStats.Deleted) as D,
count(*) as ChangeCount
into U#
from
Items
-- join LatestVersions on LatestVersions.Item_Id = Items.ID
join ItemVersions on ItemVersions.Item_Id = Items.id --and ItemVersions.Version = latestversions.Version
join Changes on Changes.ItemVersion_Id = ItemVersions.Id
join DiffStats on Changes.DiffStats_Id = DiffStats.Id
group by items.ServerItem
select
-- sum(FinalLineCount)
*
from
T#
where
ServerItem like '%.cs'
and ServerItem not like '%tools%'
and ServerItem like '%Roche-CSSP/src/Roche.PIOS/%'
and ServerItem not like '%Test%'
and ServerItem not like '%ODataService%'
and ServerItem not like '%Reference%'
and ServerItem not like '%Assembly%'
--order by Finallinecount desc
--order by serveritem
drop table T#
select
ServerItem,
len(Stream)-len(replace(Stream, char(13), '')) as linecount--,
-- *
into T#
from LatestVersions
inner join Items on Items.Id = LatestVersions.Item_Id
inner join ItemVersions on ItemVersions.Item_Id = latestversions.Item_id and ItemVersions.Version = LatestVersions.Version
where Encoding = 65001
and ServerItem like '%.cs'
and ServerItem not like '%tools%'
and ServerItem like '%Roche-CSSP/src/Roche.PIOS/%'
and ServerItem not like '%Test%'
and ServerItem not like '%ODataService%'
and ServerItem not like '%Reference%'
and ServerItem not like '%Assembly%'
select * from ItemVersions
select * from T# order by linecount desc
select T#.ServerItem, T#.LineCount, U#.A, U#.D, U#.M, U#.ChangeCount from U# inner join T# on U#.ServerItem = T#.ServerItem
select * from T# |
/* Functions or expressions as default values as of MySQL 8.0.13 */
CREATE TABLE def_expr (
id INT NOT NULL AUTO_INCREMENT,
uuid_def BINARY(16) DEFAULT (UUID_TO_BIN(UUID())),
geo_def POINT DEFAULT (Point(0,0)),
geo_def2 GEOMETRY DEFAULT (ST_PointFromText('POINT(42.69751 23.32415)', 4326)),
json_def JSON DEFAULT (JSON_ARRAY()),
json_def2 JSON DEFAULT ('[]') /* this works too */,
tomorrow DATE DEFAULT (CURDATE() + INTERVAL 1 DAY),
radius INT DEFAULT (FLOOR(1 + (RAND() * 10))),
area DECIMAL(10,3) DEFAULT (ROUND(PI() * POW(radius, 2), 3)),
PRIMARY KEY (id),
UNIQUE INDEX id_UNIQUE (id ASC) VISIBLE
);
INSERT INTO def_expr VALUES ();
SELECT id,
BIN_TO_UUID(uuid_def) uuid_def,
ST_AsText(geo_def) geo_def,
ST_AsText(geo_def2) geo_def2,
json_def, json_def2,
tomorrow, radius, area
FROM def_expr; |
SELECT h.hacker_id, h.name
FROM Submissions s
JOIN Challenges c
ON s.challenge_id = c.challenge_id
JOIN Difficulty d
ON c.difficulty_level = d.difficulty_level
JOIN Hackers h
ON s.hacker_id = h.hacker_id
WHERE d.score = s.score AND d.difficulty_level = c.difficulty_level
GROUP BY h.hacker_id, h.name
HAVING COUNT(s.hacker_id) > 1
ORDER BY COUNT(s.hacker_id) DESC, s.hacker_id; |
-- MySQL dump 10.13 Distrib 5.5.52, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: simulations
-- ------------------------------------------------------
-- Server version 5.5.52-0ubuntu0.14.04.1
/*!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 `configurations`
--
DROP TABLE IF EXISTS `configurations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `configurations` (
`id` int(11) NOT NULL DEFAULT '0',
`id_experiment` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`id_experiment`),
KEY `id_experiment` (`id_experiment`),
CONSTRAINT `configurations_ibfk_1` FOREIGN KEY (`id_experiment`) REFERENCES `experiments` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `configurations`
--
LOCK TABLES `configurations` WRITE;
/*!40000 ALTER TABLE `configurations` DISABLE KEYS */;
/*!40000 ALTER TABLE `configurations` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cycles`
--
DROP TABLE IF EXISTS `cycles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cycles` (
`id` int(11) NOT NULL DEFAULT '0',
`id_experiment` int(11) NOT NULL DEFAULT '0',
`id_configuration` int(11) NOT NULL DEFAULT '0',
`id_simulation` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`id_experiment`,`id_configuration`,`id_simulation`),
KEY `id_simulation` (`id_simulation`),
KEY `id_configuration` (`id_configuration`),
KEY `id_experiment` (`id_experiment`),
CONSTRAINT `cycles_ibfk_1` FOREIGN KEY (`id_simulation`) REFERENCES `simulations` (`id`),
CONSTRAINT `cycles_ibfk_2` FOREIGN KEY (`id_configuration`) REFERENCES `simulations` (`id_configuration`),
CONSTRAINT `cycles_ibfk_3` FOREIGN KEY (`id_experiment`) REFERENCES `experiments` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cycles`
--
LOCK TABLES `cycles` WRITE;
/*!40000 ALTER TABLE `cycles` DISABLE KEYS */;
/*!40000 ALTER TABLE `cycles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `experiments`
--
DROP TABLE IF EXISTS `experiments`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `experiments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `experiments`
--
LOCK TABLES `experiments` WRITE;
/*!40000 ALTER TABLE `experiments` DISABLE KEYS */;
/*!40000 ALTER TABLE `experiments` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `labels`
--
DROP TABLE IF EXISTS `labels`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `labels` (
`name` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `labels`
--
LOCK TABLES `labels` WRITE;
/*!40000 ALTER TABLE `labels` DISABLE KEYS */;
/*!40000 ALTER TABLE `labels` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `results`
--
DROP TABLE IF EXISTS `results`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `results` (
`name` varchar(255) NOT NULL DEFAULT '',
`id_experiment` int(11) NOT NULL DEFAULT '0',
`id_cycle` int(11) NOT NULL DEFAULT '0',
`id_configuration` int(11) NOT NULL DEFAULT '0',
`id_simulation` int(11) NOT NULL DEFAULT '0',
`value` varchar(255) DEFAULT NULL,
PRIMARY KEY (`name`,`id_experiment`,`id_configuration`,`id_simulation`,`id_cycle`),
KEY `id_configuration` (`id_configuration`),
KEY `id_experiment` (`id_experiment`),
CONSTRAINT `results_ibfk_1` FOREIGN KEY (`id_configuration`) REFERENCES `configurations` (`id`),
CONSTRAINT `results_ibfk_2` FOREIGN KEY (`name`) REFERENCES `labels` (`name`),
CONSTRAINT `results_ibfk_3` FOREIGN KEY (`id_experiment`) REFERENCES `experiments` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `results`
--
LOCK TABLES `results` WRITE;
/*!40000 ALTER TABLE `results` DISABLE KEYS */;
/*!40000 ALTER TABLE `results` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `simulations`
--
DROP TABLE IF EXISTS `simulations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `simulations` (
`id` int(11) NOT NULL DEFAULT '0',
`id_experiment` int(11) NOT NULL DEFAULT '0',
`id_configuration` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`id_experiment`,`id_configuration`),
KEY `id_configuration` (`id_configuration`),
KEY `id_experiment` (`id_experiment`),
CONSTRAINT `simulations_ibfk_1` FOREIGN KEY (`id_configuration`) REFERENCES `configurations` (`id`),
CONSTRAINT `simulations_ibfk_2` FOREIGN KEY (`id_experiment`) REFERENCES `experiments` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `simulations`
--
LOCK TABLES `simulations` WRITE;
/*!40000 ALTER TABLE `simulations` DISABLE KEYS */;
/*!40000 ALTER TABLE `simulations` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-10-23 0:12:39
|
-- phpMyAdmin SQL Dump
-- version 4.8.0
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 19-07-2018 a las 18:59:58
-- Versión del servidor: 10.1.31-MariaDB
-- Versión de PHP: 7.2.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `plantilla2`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `admins`
--
CREATE TABLE `admins` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`rol` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `admins`
--
INSERT INTO `admins` (`id`, `name`, `email`, `rol`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'administrador', 'administrador@test.com', 'administrador', '$2y$10$krFGcgFS22x2IBm1jBCL7ePMT2guY2QhVwplqEeDX05RYH3GCrUyi', 'GeYBm4xtgpFN9DRxQVHVTBFxFW23jINIUOTW5ZYGqBhymI7rYa1YyiE6li1F', '2018-07-11 05:01:59', '2018-07-13 19:04:32');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(17, '2014_10_12_000000_create_users_table', 1),
(18, '2014_10_12_100000_create_password_resets_table', 1),
(19, '2016_06_01_000001_create_oauth_auth_codes_table', 1),
(20, '2016_06_01_000002_create_oauth_access_tokens_table', 1),
(21, '2016_06_01_000003_create_oauth_refresh_tokens_table', 1),
(22, '2016_06_01_000004_create_oauth_clients_table', 1),
(23, '2016_06_01_000005_create_oauth_personal_access_clients_table', 1),
(24, '2018_07_13_124035_create_admins_table', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `oauth_access_tokens`
--
CREATE TABLE `oauth_access_tokens` (
`id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(11) DEFAULT NULL,
`client_id` int(11) NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`scopes` text COLLATE utf8mb4_unicode_ci,
`revoked` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `oauth_auth_codes`
--
CREATE TABLE `oauth_auth_codes` (
`id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(11) NOT NULL,
`client_id` int(11) NOT NULL,
`scopes` text COLLATE utf8mb4_unicode_ci,
`revoked` tinyint(1) NOT NULL,
`expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `oauth_clients`
--
CREATE TABLE `oauth_clients` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(11) DEFAULT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`secret` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`redirect` text COLLATE utf8mb4_unicode_ci NOT NULL,
`personal_access_client` tinyint(1) NOT NULL,
`password_client` tinyint(1) NOT NULL,
`revoked` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `oauth_clients`
--
INSERT INTO `oauth_clients` (`id`, `user_id`, `name`, `secret`, `redirect`, `personal_access_client`, `password_client`, `revoked`, `created_at`, `updated_at`) VALUES
(1, NULL, 'Laravel Personal Access Client', 'qtCJG9OF5KcRNAom2SMdbZ6w3UChfUnsobeZGYuL', 'http://localhost', 1, 0, 0, '2018-07-17 05:32:02', '2018-07-17 05:32:02'),
(2, NULL, 'Laravel Password Grant Client', 'vDLQV6a3MTtRTWexVCBBns5n7JU8f38YznGVP1TC', 'http://localhost', 0, 1, 0, '2018-07-17 05:32:02', '2018-07-17 05:32:02');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `oauth_personal_access_clients`
--
CREATE TABLE `oauth_personal_access_clients` (
`id` int(10) UNSIGNED NOT NULL,
`client_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `oauth_personal_access_clients`
--
INSERT INTO `oauth_personal_access_clients` (`id`, `client_id`, `created_at`, `updated_at`) VALUES
(1, 1, '2018-07-17 05:32:02', '2018-07-17 05:32:02');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `oauth_refresh_tokens`
--
CREATE TABLE `oauth_refresh_tokens` (
`id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`access_token_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`revoked` tinyint(1) NOT NULL,
`expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `password_resets`
--
INSERT INTO `password_resets` (`email`, `token`, `created_at`) VALUES
('usuario@test.com', '$2y$10$6fhxBQ.3yjBsZe4y5VtK1.6C3xKPSA60wNrL0N7E5f75L/rfwUNmK', '2018-07-17 22:19:55'),
('administrador@test.com', '$2y$10$r5biqnxfzXAAhNhvb7Xc6eTP8Bx0wTftHysS86ND2c5lcOkVqtOfe', '2018-07-17 22:47:38');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'usuario', 'usuario@test.com', '$2y$10$5pE77xsPQvOYYif/rEqetu5y5YOx/PMLoe7jZa5PMeppkZVDwzDWC', 'P25GUQE0AlvueXbJdPdvlAc1L7lTUxfWOh3Q90tiTkGgrjeCOgml5COY8Ken', '2018-07-13 18:00:31', '2018-07-13 18:00:31');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `admins`
--
ALTER TABLE `admins`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `admins_email_unique` (`email`);
--
-- Indices de la tabla `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `oauth_access_tokens`
--
ALTER TABLE `oauth_access_tokens`
ADD PRIMARY KEY (`id`),
ADD KEY `oauth_access_tokens_user_id_index` (`user_id`);
--
-- Indices de la tabla `oauth_auth_codes`
--
ALTER TABLE `oauth_auth_codes`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `oauth_clients`
--
ALTER TABLE `oauth_clients`
ADD PRIMARY KEY (`id`),
ADD KEY `oauth_clients_user_id_index` (`user_id`);
--
-- Indices de la tabla `oauth_personal_access_clients`
--
ALTER TABLE `oauth_personal_access_clients`
ADD PRIMARY KEY (`id`),
ADD KEY `oauth_personal_access_clients_client_id_index` (`client_id`);
--
-- Indices de la tabla `oauth_refresh_tokens`
--
ALTER TABLE `oauth_refresh_tokens`
ADD PRIMARY KEY (`id`),
ADD KEY `oauth_refresh_tokens_access_token_id_index` (`access_token_id`);
--
-- Indices de la tabla `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `admins`
--
ALTER TABLE `admins`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT de la tabla `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT de la tabla `oauth_clients`
--
ALTER TABLE `oauth_clients`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `oauth_personal_access_clients`
--
ALTER TABLE `oauth_personal_access_clients`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE ROLE [PASResearches] |
CREATE TABLE users_wallet (
id serial NOT NULL,
wallet integer,
users integer,
PRIMARY KEY (id),
FOREIGN KEY(users) REFERENCES users(id),
FOREIGN KEY(wallet) REFERENCES wallet(id)
); |
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM SELECT on dba_*
REM ------------------------------------------------------------------------
REM PURPOSE:
REM Show count of object by type
REM ------------------------------------------------------------------------
set linesize 96
set pagesize 999
set feedback off
set verify off
col object_type for a20 trunc head Type
col owner for a20 head Owner
break on object_type on owner
SELECT object_type, owner, count(object_type) Count
FROM dba_objects
WHERE object_type like upper ('&1')
GROUP BY object_type, owner
;
prompt
exit
|
Create proc sp_get_ItemRate
(@BILLID INT,
@ITEMCODE NVARCHAR (15))
AS
Select Quantity,PurchasePrice from billDetail where billDetail.billID=@billID and BillDetail.Product_Code=@ITEMCODE
|
--修改人:胡双
--修改日期:2012-08-02
--修改内容1:新增“票据锁定/解锁”菜单项
--修改内容2:表AB_RECEIVE新增“IS_LOCK”字段
--修改原因:PJ-JD03-017(库存票据业务新增“票据是否锁定”,需控制票据的锁定及解锁)
--新增“票据锁定/解锁”菜单项
INSERT INTO BT_SYS_RES
(RES_CODE,RES_NAME,SYS_CODE,FATHER_CODE,RES_URL,FUNC_FLAG,RES_TYPE,LINK_TARGET,STATUS,RES_ORDER,RES_LEVEL)
VALUES
((SELECT MAX(RES_CODE) + 1 FROM BT_SYS_RES),
'票据锁定/解锁','ads',164,'/AB/lockUnlock.do?method=toList','0','1','0','0','14','2');
--添加是否锁定字段
--IS_LOCK为NULL或0都代表解锁状态,1代表锁定状态
ALTER TABLE AB_RECEIVE ADD IS_LOCK CHAR(1);
|
alter table cab add rating int;
create table rating (
`id` int NOT NULL auto_increment,
`cab_id` int NOT NULL,
`rating` int NOT NULL,
`email` varchar(400) NOT NULL,
`comment` varchar(400),
PRIMARY KEY (`id`)
);
|
-- phpMyAdmin SQL Dump
-- version 4.4.13.1
-- http://www.phpmyadmin.net
--
-- Хост: localhost
-- Время создания: Дек 06 2016 г., 12:39
-- Версия сервера: 5.6.26
-- Версия PHP: 5.5.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- База данных: `areg`
--
-- --------------------------------------------------------
--
-- Структура таблицы `chat`
--
CREATE TABLE IF NOT EXISTS `chat` (
`id` int(100) unsigned NOT NULL,
`nick` varchar(30) NOT NULL,
`text` varchar(255) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`nickname` varchar(100) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `chat`
--
INSERT INTO `chat` (`id`, `nick`, `text`, `time`, `nickname`) VALUES
(1, 'ggggg', 'dfgdgfdg', '2016-12-06 12:11:22', 'ggggg'),
(2, 'ggggg', 'Ggggggggggggggg', '2016-12-06 12:11:49', 'ggggg'),
(3, 'ggggg', 'ttttt', '2016-12-06 12:12:57', 'ggggg'),
(4, 'ggggg', 'ooooooooooo', '2016-12-06 12:23:03', 'ggggg'),
(5, 'ggggg', 'ttttttttttttttttttttt', '2016-12-06 12:23:19', 'ggggg'),
(6, 'ggggg', 'ppppppppppppppppppppppppp', '2016-12-06 12:23:49', 'ggggg'),
(7, 'mmmmmmmmmmmmmmmmmmmmmmmmmmm', 'qqqqqqqqqq', '2016-12-06 12:25:42', 'mmmmmmmmmmmmmmmmmmmmmmmmmmm');
-- --------------------------------------------------------
--
-- Структура таблицы `nametable`
--
CREATE TABLE IF NOT EXISTS `nametable` (
`id` int(20) NOT NULL,
`nameTable` varchar(30) NOT NULL,
`nameUser` varchar(30) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `nametable`
--
INSERT INTO `nametable` (`id`, `nameTable`, `nameUser`) VALUES
(40, 'dsffds', 'sadsa');
-- --------------------------------------------------------
--
-- Структура таблицы `reg_chat`
--
CREATE TABLE IF NOT EXISTS `reg_chat` (
`id` int(100) unsigned NOT NULL,
`id_room` int(11) NOT NULL DEFAULT '0',
`nick` varchar(30) NOT NULL,
`text` varchar(255) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`nickname` varchar(100) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `reg_chat`
--
INSERT INTO `reg_chat` (`id`, `id_room`, `nick`, `text`, `time`, `nickname`) VALUES
(1, 40, 'ggggg', 'wwwwwwww', '2016-12-06 12:22:25', 'ggggg'),
(2, 40, 'ggggg', 'wwwwwwww', '2016-12-06 12:23:12', 'ggggg');
-- --------------------------------------------------------
--
-- Структура таблицы `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(100) unsigned NOT NULL,
`name` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`Nickname` varchar(30) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `users`
--
INSERT INTO `users` (`id`, `name`, `password`, `time`, `Nickname`) VALUES
(153, 'Poxos', 'martiros', '2016-12-06 11:49:42', 'Petros'),
(154, 'Poxos', 'martiros', '2016-12-06 11:50:50', 'Petros'),
(155, 'sadsad', 'dddd', '2016-12-06 11:51:20', 'sadsa'),
(156, 'sadsad', 'dddd', '2016-12-06 11:51:44', 'sadsa'),
(157, 'sadsad', 'dddd', '2016-12-06 11:52:27', 'sadsa'),
(158, 'sdffsd', 'ffff', '2016-12-06 12:00:40', 'sdfdsf'),
(159, 'sdffsd', 'ffff', '2016-12-06 12:01:02', 'sdfdsf'),
(160, 'gggg', 'gggg', '2016-12-06 12:10:35', 'ggggg'),
(161, 'gggg', 'gggg', '2016-12-06 12:11:00', 'ggggg'),
(162, 'mmmmmmmmmmm', 'mmmmmmmmmmmmmmmmmmmm', '2016-12-06 12:25:31', 'mmmmmmmmmmmmmmmmmmmmmmmmmmm'),
(163, 'qqqqqqqq', 'qqqqqqqqqqq', '2016-12-06 12:27:52', 'qqqqqqqqqqqqq');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `chat`
--
ALTER TABLE `chat`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `nametable`
--
ALTER TABLE `nametable`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `reg_chat`
--
ALTER TABLE `reg_chat`
ADD KEY `id` (`id`);
--
-- Индексы таблицы `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `chat`
--
ALTER TABLE `chat`
MODIFY `id` int(100) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT для таблицы `nametable`
--
ALTER TABLE `nametable`
MODIFY `id` int(20) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=41;
--
-- AUTO_INCREMENT для таблицы `reg_chat`
--
ALTER TABLE `reg_chat`
MODIFY `id` int(100) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT для таблицы `users`
--
ALTER TABLE `users`
MODIFY `id` int(100) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=164;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE PROCEDURE MOSTRAR_BUSQUEDA_LIBRO
AS
BEGIN
SELECT L.COD_LIBRO AS CODIGO,L.TITULO AS NOMBRE FROM LIBRO L
ORDER BY TITULO
END |
--------------------- RANK () ---------------------------
-- we use Rank() when we want to know the relative oder of particular rows relative to other rows. (such as 1, 2, 3, etc.)
-- the ranking 1, 2, 3 will restart when it reaches to another unique group.
-- works same as Row_Number Function
SELECT dept_id, server_id, cpu_utilization,
RANK() OVER (PARTITION BY dept_id ORDER BY cpu_utilization DESC)
FROM time_series.vw_utilization
WHERE event_time BETWEEN '2019-03-05' AND '2019-03-06';
--------------------- PERCENT_RANK () ---------------------------
-- it is the rank divided by total numbers of rows (example: 0.0002, etc)
SELECT dept_id, server_id, cpu_utilization,
PERCENT_RANK() OVER (PARTITION BY dept_id ORDER BY cpu_utilization DESC)
FROM time_series.vw_utilization
WHERE event_time BETWEEN '2019-03-05' AND '2019-03-06';
|
CREATE TABLE contexts (
context_id SERIAL,
PRIMARY KEY (context_id)
); |
-- sql-read-write-size-sql.sql
-- get write sizes per sql_id
-- use for estimating which SQL statements generate the most redo - shows SQL statement
-- Jared Still - jkstill@gmail.com
-- 2023
set echo off term on verify off pause off
set feed on head on
col force_matching_signature format 999999999999999999999999
col exact_matching_signature format 999999999999999999999999
col physical_write_bytes format 999,999,999,999,999
col physical_read_bytes format 999,999,999,999,999
col sql_id format a13
col sql_text format a100 wrap
set pagesize 100
set linesize 200 trimspool on
-- use force_matching_signature if cursor_sharing = FORCE
-- use exact_matching_signature if cursor_sharing != FORCE
col v_signature_match_column new_value v_signature_match_column noprint
select case upper(value)
when 'FORCE' then 'force_matching_signature'
else 'exact_matching_signature'
end v_signature_match_column
from v$parameter
where name like 'cursor_sharing';
with sql_info as (
select &v_signature_match_column
from v$sqlstats
where &v_signature_match_column != 0
group by &v_signature_match_column
order by count(*)
),
sql_metrics as (
select
&v_signature_match_column
, sum(physical_write_bytes) physical_write_bytes
, sum(physical_read_bytes) physical_read_bytes
from v$sqlstats
where &v_signature_match_column != 0
group by &v_signature_match_column
having sum(physical_write_bytes) > 0
)
select
i.&v_signature_match_column
, m.physical_write_bytes
, m.physical_read_bytes
, s.sql_id
, s.sql_text
--, s.sql_fulltext
from sql_info i
join sql_metrics m on m.&v_signature_match_column = i.&v_signature_match_column
join v$sqlstats s on s.&v_signature_match_column = i.&v_signature_match_column
left outer join v$sqltext t on t.sql_id = s.sql_id
and t.piece = 1
and t.command_type not in (3,47) -- SELECT and PL/SQL Execute
order by m.physical_write_bytes
/
|
DROP DATABASE IF EXISTS homevalue;
CREATE DATABASE IF NOT EXISTS homevalue;
USE homevalue;
CREATE TABLE homes (
id INT,
address VARCHAR,
zipCode INT,
onMarket BOOLEAN,
sqft INT,
bedCount INT,
bathCount INT,
listingValue INT,
pictureUrl VARCHAR,
PRIMARY KEY (id)
);
COPY homes (id, address, zipCode, onMarket, sqft, bedCount, bathCount, listingValue, pictureUrl)
FROM '/local/homes6.csv' DELIMITER',' CSV HEADER;
COPY homes (id, address, zipCode, onMarket, sqft, bedCount, bathCount, listingValue, pictureUrl)
FROM '/local/homes7.csv' DELIMITER',' CSV HEADER;
-- COPY homes (id, address, zipCode, onMarket, sqft, bedCount, bathCount, listingValue, pictureUrl)
-- FROM '/Users/alexcai/Desktop/SEC/abode-homevalue-pricetax/fakeData/homes5.csv' DELIMITER',' CSV HEADER; |
SELECT
fdfolders.id
, fdfolders.flname
, fdfolders.d_cr
, fdfolders.user
FROM
fdvtranzit
LEFT JOIN fdfolders on fdvtranzit.folder = fdfolders.id
WHERE
(fdvtranzit.user = ?
OR fdvtranzit.user = 0)
AND fdvtranzit.view = ?
ORDER BY
fdvtranzit.id
|
select `i_item_id`, avg(`cs_quantity`) as `agg1`, avg(`cs_list_price`) as `agg2`, avg(`cs_coupon_amt`) as `agg3`, avg(`cs_sales_price`) as `agg4`
from `catalog_sales`
where `cs_sold_date_sk` = `d_date_sk` and `cs_item_sk` = `i_item_sk` and `cs_bill_cdemo_sk` = `cd_demo_sk` and `cs_promo_sk` = `p_promo_sk` and `cd_gender` = 'm' and `cd_marital_status` = 's' and `cd_education_status` = 'college' and (`p_channel_email` = 'n' or `p_channel_event` = 'n') and `d_year` = 2000
group by `i_item_id`
order by `i_item_id`
fetch next 100 rows only |
SET MODE PostgreSQL;
CREATE TABLE IF NOT EXISTS heroes (
id int PRIMARY KEY auto_increment,
name VARCHAR,
age INT,
strength VARCHAR,
weakness VARCHAR
); |
DROP procedure eaadmin.delete_history@
DROP TYPE eaadmin.BINTLIST@
CREATE TYPE eaadmin.BINTLIST AS BIGINT ARRAY[]@
CREATE PROCEDURE eaadmin.delete_history(IN p_customerId varchar(30), IN p_age varchar(5), OUT o_total BIGINT, OUT v_line INTEGER)
LANGUAGE SQL
SPECIFIC EAADMIN.DELETE_HISTORY
BEGIN
DECLARE v_tem_total INTEGER DEFAULT 0;
DECLARE v_tem_sf_total INTEGER DEFAULT 0;
DECLARE v_delete_total INTEGER DEFAULT 0;
DECLARE v_round INTEGER DEFAULT 0;
DECLARE INSTIDLISTONE EAADMIN.BINTLIST;
DECLARE INSTIDLISTTWO EAADMIN.BINTLIST;
DECLARE INSTIDLISTTHR EAADMIN.BINTLIST;
DECLARE INSTIDLISTFOR EAADMIN.BINTLIST;
DECLARE v_empty_h_used_license_o INTEGER DEFAULT 0;
DECLARE v_empty_h_used_license_t INTEGER DEFAULT 0;
DECLARE v_empty_h_used_license_r INTEGER DEFAULT 0;
DECLARE v_empty_h_used_license_f INTEGER DEFAULT 0;
DECLARE v_empty_h_reconcile_used_license_o INTEGER DEFAULT 0;
DECLARE v_empty_h_reconcile_used_license_t INTEGER DEFAULT 0;
DECLARE v_empty_h_reconcile_used_license_r INTEGER DEFAULT 0;
DECLARE v_empty_h_reconcile_used_license_f INTEGER DEFAULT 0;
DECLARE v_empty_reconcile_h_o INTEGER DEFAULT 0;
DECLARE v_empty_reconcile_h_t INTEGER DEFAULT 0;
DECLARE v_empty_reconcile_h_r INTEGER DEFAULT 0;
DECLARE v_empty_reconcile_h_f INTEGER DEFAULT 0;
DECLARE v_sql_count_affect_inst_sw VARCHAR(1900);
DECLARE v_sql_delete_h_used_license VARCHAR(640);
DECLARE v_sql_delete_h_reconcile_used_license VARCHAR(640);
DECLARE v_sql_delete_reconcile_h VARCHAR(640);
DECLARE o_res INTEGER;
DECLARE v_sys_result BIGINT;
DECLARE v_account_number VARCHAR(20);
DECLARE v_start_time VARCHAR(14);
DECLARE v_end_time VARCHAR(14);
DECLARE SQLCODE INTEGER DEFAULT 0;
DECLARE v_stmt_delete_hulic STATEMENT;
DECLARE v_stmt_delete_hrulic STATEMENT;
DECLARE v_stmt_delete_rch STATEMENT;
DECLARE ct CURSOR WITH HOLD WITH RETURN FOR s1;
DECLARE CONTINUE HANDLER FOR NOT found SET o_res = SQLCODE;--Empty record
DECLARE EXIT handler FOR SQLexception
BEGIN
SET o_res = SQLCODE;
ROLLBACK;
SET v_end_time = REPLACE(LTRIM(RTRIM(CHAR(current_date,ISO))),'-','')||REPLACE(LTRIM(RTRIM(CHAR(current_time,ISO))),'.','');
UPDATE EAADMIN.SYSTEM_SCHEDULE_STATUS
SET end_time = v_end_time,STATUS = CAST(o_res as CHAR(10)),comments='DB_PROCEDURE DELETE History Record STOP WITH ERROR'
WHERE name = 'DELETE HISTORY '||v_account_number
AND start_time = v_start_time;
COMMIT;
END;
set v_line= 0;
SET v_account_number = NULL;
SELECT cast(b.account_number as CHAR(20)) INTO v_account_number from EAADMIN.CUSTOMER b WHERE b.customer_id = CAST(p_customerId AS BIGINT) ;
SET v_sys_result = NULL;
SET v_start_time = REPLACE(LTRIM(RTRIM(CHAR(current_date,ISO))),'-','')||REPLACE(LTRIM(RTRIM(CHAR(current_time,ISO))),'.','');
SELECT a.id INTO v_sys_result from EAADMIN.SYSTEM_SCHEDULE_STATUS a WHERE a.name = 'DELETE HISTORY '||v_account_number ;
if(v_sys_result is not null) then
UPDATE EAADMIN.SYSTEM_SCHEDULE_STATUS SET start_time = v_start_time,end_time = null,comments='DB_PROCEDURE DELETE History Record START',status='0' where id = v_sys_result ;
else
INSERT INTO EAADMIN.SYSTEM_SCHEDULE_STATUS(id,name,comments,start_time,end_time,remote_user,status)
VALUES(DEFAULT,'DELETE HISTORY '||v_account_number,'DB_PROCEDURE DELETE History Record START',v_start_time,NULL,'DB_PROCEDURE','0');
end if;
COMMIT;
SET v_sql_count_affect_inst_sw = 'select sum(T.count) from (
select count(is.id) as count from eaadmin.installed_software is
join eaadmin.software_lpar sl on sl.id = is.software_lpar_id
join eaadmin.reconcile rc on rc.installed_software_id = is.id
join eaadmin.reconcile_type rt on rc.reconcile_type_id = rt.id
where
rt.is_manual = 0
and sl.customer_id = '||p_customerId||'
and (current timestamp - '||p_age||' DAYS > rc.record_time)
and exists (select 1 from eaadmin.reconcile_h rh where rh.installed_software_id = rc.installed_software_id)
union all
select count(is.id) as count
from eaadmin.installed_software is
join eaadmin.software_lpar sl on sl.id = is.software_lpar_id
join eaadmin.reconcile_h rch on rch.installed_software_id = is.id
join eaadmin.reconcile_type rt on rch.reconcile_type_id=rt.id
where rt.is_manual = 1
and rch.MANUAL_BREAK = 1
and sl.customer_id = '||p_customerId||' and (current timestamp - '||p_age||' DAYS > rch.record_time)
union all
select count(is.id) as count
from eaadmin.installed_software is
join eaadmin.software_lpar sl on sl.id = is.software_lpar_id
join eaadmin.alert_unlicensed_sw aus on aus.installed_software_id = is.id and aus.open = 1
join eaadmin.reconcile_h rch on rch.installed_software_id = is.id
join eaadmin.reconcile_type rt on rch.reconcile_type_id=rt.id
where rt.is_manual = 1
and sl.customer_id = '||p_customerId||'
and (current timestamp - '||p_age||' DAYS > aus.creation_time)
union all
select count(is.id) as count
from eaadmin.installed_software is
join eaadmin.software_lpar sl on sl.id = is.software_lpar_id
join eaadmin.reconcile rc on rc.installed_software_id = is.id
join eaadmin.reconcile_h rch on rch.installed_software_id = is.id
join eaadmin.reconcile_type rt on rch.reconcile_type_id = rt.id
where rt.is_manual = 1
and rc.reconcile_type_id <> rch.reconcile_type_id
and sl.customer_id = '||p_customerId||'
) as T with ur ';
SET v_sql_delete_h_used_license = 'delete from (select 1 from eaadmin.h_used_license o where exists (select count(h_used_license_id) from eaadmin.h_reconcile_used_license hrula where hrula.h_used_license_id=o.id group by h_used_license_id having count(h_used_license_id) =1 ) and exists (select 1 from eaadmin.h_reconcile_used_license hrul join eaadmin.reconcile_h rch on hrul.h_reconcile_id=rch.id where o.id = hrul.h_used_license_id and rch.installed_software_id in (SELECT X.ids FROM UNNEST(cast(? as eaadmin.BINTLIST)) AS X(ids)) ))';
SET v_sql_delete_h_reconcile_used_license = 'delete from (select 1 from eaadmin.h_reconcile_used_license p where exists (select 1 from eaadmin.reconcile_h rch where p.H_RECONCILE_ID = rch.id and rch.installed_software_id in (SELECT X.ids FROM UNNEST(cast(? as eaadmin.BINTLIST)) AS X(ids))))';
SET v_sql_delete_reconcile_h = 'delete from (select 1 from eaadmin.reconcile_h q where q.installed_software_id in (SELECT X.ids FROM UNNEST(cast(? as eaadmin.BINTLIST)) AS X(ids)))';
PREPARE s1 FROM v_sql_count_affect_inst_sw;
OPEN ct;
FETCH ct into v_tem_total;
IF SQLCODE <> 0 THEN
set v_line= 1;
END IF;
CLOSE ct;
COMMIT;
LOOPD:LOOP
SET v_round = v_round + 1;
IF v_tem_total <= 0 THEN
LEAVE LOOPD;
END IF;
set INSTIDLISTONE = ( select ARRAY_AGG(T.id) from (select is.id from eaadmin.installed_software is join eaadmin.software_lpar sl on sl.id = is.software_lpar_id join eaadmin.reconcile rc on rc.installed_software_id = is.id join eaadmin.reconcile_type rt on rc.reconcile_type_id = rt.id where rt.is_manual = 0 and sl.customer_id = CAST(p_customerId AS BIGINT) and (current timestamp - CAST(p_age AS integer) DAYS > rc.record_time) and exists (select 1 from eaadmin.reconcile_h rh where rh.installed_software_id = rc.installed_software_id) fetch first 100 row only) as T );
set INSTIDLISTTWO = ( select ARRAY_AGG(T.id) from (select is.id from eaadmin.installed_software is join eaadmin.software_lpar sl on sl.id = is.software_lpar_id join eaadmin.reconcile_h rch on rch.installed_software_id = is.id join eaadmin.reconcile_type rt on rch.reconcile_type_id=rt.id where rt.is_manual = 1 and rch.MANUAL_BREAK = 1 and sl.customer_id = CAST(p_customerId AS BIGINT) and (current timestamp - CAST(p_age AS integer) DAYS > rch.record_time) fetch first 100 row only) as T );
set INSTIDLISTTHR = ( select ARRAY_AGG(T.id) from (select is.id from eaadmin.installed_software is join eaadmin.software_lpar sl on sl.id = is.software_lpar_id join eaadmin.alert_unlicensed_sw aus on aus.installed_software_id = is.id and aus.open = 1 join eaadmin.reconcile_h rch on rch.installed_software_id = is.id join eaadmin.reconcile_type rt on rch.reconcile_type_id=rt.id where rt.is_manual = 1 and sl.customer_id = CAST(p_customerId AS BIGINT) and (current timestamp - CAST(p_age AS integer) DAYS > aus.creation_time) fetch first 100 row only) as T );
set INSTIDLISTFOR = ( select ARRAY_AGG(T.id) from (select is.id from eaadmin.installed_software is join eaadmin.software_lpar sl on sl.id = is.software_lpar_id join eaadmin.reconcile rc on rc.installed_software_id = is.id join eaadmin.reconcile_h rch on rch.installed_software_id = is.id join eaadmin.reconcile_type rt on rch.reconcile_type_id = rt.id where rt.is_manual = 1 and rc.reconcile_type_id <> rch.reconcile_type_id and sl.customer_id = CAST(p_customerId AS BIGINT) fetch first 100 row only) as T );
set v_line = 2;
PREPARE v_stmt_delete_hulic FROM v_sql_delete_h_used_license;
PREPARE v_stmt_delete_hrulic FROM v_sql_delete_h_reconcile_used_license;
PREPARE v_stmt_delete_rch FROM v_sql_delete_reconcile_h;
IF v_empty_h_used_license_o = 0 THEN
EXECUTE v_stmt_delete_hulic USING INSTIDLISTONE;
IF SQLCODE < 0 THEN
set v_line= 3;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_h_used_license_o = 1;
END IF;
END IF;
COMMIT;
IF v_empty_h_used_license_t = 0 THEN
EXECUTE v_stmt_delete_hulic USING INSTIDLISTTWO;
IF SQLCODE < 0 THEN
set v_line= 4;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_h_used_license_t = 1;
END IF;
END IF;
COMMIT;
IF v_empty_h_used_license_r = 0 THEN
EXECUTE v_stmt_delete_hulic USING INSTIDLISTTHR;
IF SQLCODE < 0 THEN
set v_line= 5;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_h_used_license_r = 1;
END IF;
END IF;
COMMIT;
IF v_empty_h_used_license_f = 0 THEN
EXECUTE v_stmt_delete_hulic USING INSTIDLISTFOR;
IF SQLCODE < 0 THEN
set v_line= 6;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_h_used_license_f = 1;
END IF;
END IF;
COMMIT;
IF v_empty_h_reconcile_used_license_o = 0 THEN
EXECUTE v_stmt_delete_hrulic USING INSTIDLISTONE;
IF SQLCODE < 0 THEN
set v_line= 7;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_h_reconcile_used_license_o = 1;
END IF;
END IF;
COMMIT;
IF v_empty_h_reconcile_used_license_t = 0 THEN
EXECUTE v_stmt_delete_hrulic USING INSTIDLISTTWO;
IF SQLCODE < 0 THEN
set v_line= 8;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_h_reconcile_used_license_t = 1;
END IF;
END IF;
COMMIT;
IF v_empty_h_reconcile_used_license_r = 0 THEN
EXECUTE v_stmt_delete_hrulic USING INSTIDLISTTHR;
IF SQLCODE < 0 THEN
set v_line= 9;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_h_reconcile_used_license_r = 1;
END IF;
END IF;
COMMIT;
IF v_empty_h_reconcile_used_license_f = 0 THEN
EXECUTE v_stmt_delete_hrulic USING INSTIDLISTFOR;
IF SQLCODE < 0 THEN
set v_line= 10;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_h_reconcile_used_license_f = 1;
END IF;
END IF;
COMMIT;
IF v_empty_reconcile_h_o = 0 THEN
EXECUTE v_stmt_delete_rch USING INSTIDLISTONE;
IF SQLCODE < 0 THEN
set v_line= 11;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_reconcile_h_o = 1;
END IF;
END IF;
COMMIT;
IF v_empty_reconcile_h_t = 0 THEN
EXECUTE v_stmt_delete_rch USING INSTIDLISTTWO;
IF SQLCODE < 0 THEN
set v_line= 12;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_reconcile_h_t = 1;
END IF;
END IF;
COMMIT;
IF v_empty_reconcile_h_r = 0 THEN
EXECUTE v_stmt_delete_rch USING INSTIDLISTTHR;
IF SQLCODE < 0 THEN
set v_line= 13;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_reconcile_h_r = 1;
END IF;
END IF;
COMMIT;
IF v_empty_reconcile_h_f = 0 THEN
EXECUTE v_stmt_delete_rch USING INSTIDLISTFOR;
IF SQLCODE < 0 THEN
set v_line= 14;
LEAVE LOOPD;
ELSEIF SQLCODE = 100 THEN
set v_empty_reconcile_h_f = 1;
END IF;
END IF;
COMMIT;
IF 0 < v_tem_total and v_tem_total <= 100 THEN
SET v_delete_total = v_delete_total + v_tem_total;
set v_line= v_round * 1000 + v_line;
ELSEIF v_tem_total > 100 THEN
SET v_delete_total = v_delete_total + 100;
END IF;
set v_tem_total = v_tem_total - 100;
END LOOP LOOPD;
COMMIT;
SET o_total = v_delete_total;
SET v_end_time = REPLACE(LTRIM(RTRIM(CHAR(current_date,ISO))),'-','')||REPLACE(LTRIM(RTRIM(CHAR(current_time,ISO))),'.','');
UPDATE EAADMIN.SYSTEM_SCHEDULE_STATUS
SET end_time = v_end_time,status = '1',comments='DB_PROCEDURE DELETE History Record STOP'
WHERE name = 'DELETE HISTORY '||v_account_number
AND start_time = v_start_time;
COMMIT;
END@
GRANT EXECUTE ON PROCEDURE eaadmin.delete_history TO EAADMIN@ |
CREATE DATABASE catalogo_pokemons;
CREATE TABLE IF NOT EXISTS usuarios(
id serial PRIMARY KEY,
nome varchar(50) NOT NULL,
email varchar(100) UNIQUE NOT NULL,
senha text NOT NULL
);
CREATE TABLE IF NOT EXISTS pokemons(
id serial PRIMARY KEY,
usuario_id int NOT NULL,
nome varchar(50) NOT NULL,
habilidades text NOT NULL,
imagem text,
apelido varchar(50),
FOREIGN KEY (usuario_id) REFERENCES usuarios(id)
); |
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- product_additional_information
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `product_additional_information`;
CREATE TABLE `product_additional_information`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`object_id` INTEGER NOT NULL,
PRIMARY KEY (`id`),
INDEX `FI_product_additional_information_product_id` (`object_id`),
CONSTRAINT `fk_product_additional_information_product_id`
FOREIGN KEY (`object_id`)
REFERENCES `product` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- folder_additional_information
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `folder_additional_information`;
CREATE TABLE `folder_additional_information`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`object_id` INTEGER NOT NULL,
PRIMARY KEY (`id`),
INDEX `FI_folder_additional_information_folder_id` (`object_id`),
CONSTRAINT `fk_folder_additional_information_folder_id`
FOREIGN KEY (`object_id`)
REFERENCES `folder` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- category_additional_information
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `category_additional_information`;
CREATE TABLE `category_additional_information`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`object_id` INTEGER NOT NULL,
PRIMARY KEY (`id`),
INDEX `FI_category_additional_information_category_id` (`object_id`),
CONSTRAINT `fk_category_additional_information_category_id`
FOREIGN KEY (`object_id`)
REFERENCES `category` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- content_additional_information
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `content_additional_information`;
CREATE TABLE `content_additional_information`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`object_id` INTEGER NOT NULL,
PRIMARY KEY (`id`),
INDEX `FI_content_additional_information_content_id` (`object_id`),
CONSTRAINT `fk_content_additional_information_content_id`
FOREIGN KEY (`object_id`)
REFERENCES `content` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- product_additional_information_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `product_additional_information_i18n`;
CREATE TABLE `product_additional_information_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`information` LONGTEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `product_additional_information_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `product_additional_information` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- folder_additional_information_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `folder_additional_information_i18n`;
CREATE TABLE `folder_additional_information_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`information` LONGTEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `folder_additional_information_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `folder_additional_information` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- category_additional_information_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `category_additional_information_i18n`;
CREATE TABLE `category_additional_information_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`information` LONGTEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `category_additional_information_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `category_additional_information` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- content_additional_information_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `content_additional_information_i18n`;
CREATE TABLE `content_additional_information_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`information` LONGTEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `content_additional_information_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `content_additional_information` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
|
DROP TABLE guestbook;
|
create table EMPLOYEE (
CODE int not null,
NAME varchar(100) not null,
CITY varchar(100) not null
); |
create database Practica;
use Practica;
create table Prospectos(
nombre varchar(20),
apPaterno varchar(20),
apMaterno varchar(20),
calle varchar(30),
numero varchar(20),
colonia varchar(20),
telefono varchar(15),
codigo_postal varchar(10),
rfc varchar(20) primary key,
estatus varchar(10),
observaciones varchar(140)
);
select nombre,apPaterno,apMaterno,estatus from Prospectos;
select *from Prospectos;
delete from Prospectos Where nombre = 'Miguel';
--drop table Prospectos;
insert into Prospectos values ('Miguel','Valdez','Osuna','Miguel Hidalgo','77','Bamoa','6871234567','81140','rfcprueba','Enviada','');
create table documentos(
Id int identity(1,1) primary key,
nombre varchar(100)not null,
realName varchar (100) not null,
doc varbinary (max)not null,
rfcProspectos varchar(20),
Foreign Key (rfcProspectos) References Prospectos (rfc)
);
select *from documentos;
--drop table documentos;
--truncate table documentos; |
CREATE TABLE workflow_monitoring (
id SERIAL NOT NULL,
duration INTEGER,
end_time TIMESTAMP WITH TIME ZONE,
message VARCHAR(1023),
start_time TIMESTAMP WITH TIME ZONE NOT NULL,
status VARCHAR(50) NOT NULL,
step_name VARCHAR(50) NOT NULL,
step_rank INTEGER NOT NULL,
workflow_name VARCHAR(50) NOT NULL,
PRIMARY KEY (id)
); |
-- MySQL dump 10.13 Distrib 5.6.24, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: ordering
-- ------------------------------------------------------
-- Server version 5.6.24
/*!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 `images`
--
DROP TABLE IF EXISTS `images`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `images` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`URL` varchar(100) NOT NULL DEFAULT '',
`LISTIMAGE` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `images`
--
LOCK TABLES `images` WRITE;
/*!40000 ALTER TABLE `images` DISABLE KEYS */;
INSERT INTO `images` VALUES (1,'/ordering/image/sbj.jpg',1),(2,'/ordering/image/sbjBig1.jpg',0),(3,'/ordering/image/sbjBig2.jpg',0),(4,'/ordering/image/hsr.jpg',1),(5,'/ordering/image/hsrBig1.jpg',0),(6,'/ordering/image/hsrBig2.jpg',0),(7,'/ordering/image/gljr.jpg',1),(8,'/ordering/image/gljrBig1.jpg',0),(9,'/ordering/image/gljrBig2.jpg',0),(10,'/ordering/image/mckr.jpg',1),(11,'/ordering/image/mckrBig1.jpg',0),(12,'/ordering/image/mckrBig2.jpg',0),(13,'/ordering/image/rmsdj.jpg',1),(14,'/ordering/image/rmsdjBig1.jpg',0),(15,'/ordering/image/rmsdjBig2.jpg',0),(16,'/ordering/image/yxrs.jpg',1),(17,'/ordering/image/yxrsBig1.jpg',0),(18,'/ordering/image/yxrsBig2.jpg',0),(19,'/ordering/image/xgjt.jpg',1),(20,'/ordering/image/xgjtBig1.jpg',0),(21,'/ordering/image/xgjtBig2.jpg',0);
/*!40000 ALTER TABLE `images` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-06-04 21:15:18
|
ALTER TABLE `clientes` ADD `otraaplicacion` VARCHAR( 150 ) NOT NULL
ALTER TABLE `clientes` CHANGE `teléfono` `telefono` VARCHAR( 9 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL
ALTER TABLE `clientes` ADD `fecha` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ALTER TABLE `clientes` ADD `idversion` INT NOT NULL |
DROP TABLE CENTROS CASCADE CONSTRAINTS;
CREATE TABLE CENTROS(
COD_CE NUMBER(2) PRIMARY KEY,
DIRECTOR_CE NUMBER(6),
NOMB_CE VARCHAR2(30) NOT NULL,
DIRECC_CE VARCHAR2(50) NOT NULL,
POBLAC_CE VARCHAR2(15) NOT NULL
);
DROP TABLE DEPARTAMENTOS CASCADE CONSTRAINTS;
CREATE TABLE DEPARTAMENTOS(
COD_DE NUMBER(3) PRIMARY KEY,
DIRECTOR_DE NUMBER(6),
DEPTJEFE_DE NUMBER(3),
CENTRO_DE NUMBER(2) NOT NULL,
NOMB_DE VARCHAR2(40) NOT NULL,
PRESUP_DE NUMBER(11) NOT NULL,
TIPODIR_DE CHAR(1) NOT NULL
);
DROP TABLE EMPLEADOS CASCADE CONSTRAINTS;
CREATE TABLE EMPLEADOS(
COD_EM NUMBER(6) PRIMARY KEY,
DEPT_EM NUMBER(3),
EXTTEL_EM CHAR(9),
FECINC_EM DATE,
FECNAC_EM DATE,
DNI_EM VARCHAR2(9) UNIQUE,
NOMB_EM VARCHAR2(40) NOT NULL,
NUMHIJ_EM NUMBER(2) NOT NULL,
SALARIO_EM NUMBER(9) NOT NULL
);
DROP TABLE HIJOS CASCADE CONSTRAINTS;
CREATE TABLE HIJOS(
PADRE_HI NUMBER(6),
NUMHIJ_HI NUMBER(2),
FECNAC_HI DATE,
NOMB_HI VARCHAR2(40),
PRIMARY KEY (PADRE_HI, NUMHIJ_HI)
);
REM *************** INSERCIÓN DE DATOS EN LAS TABLAS*************
ALTER SESSION SET NLS_DATE_FORMAT='DD/MM/YYYY';
SET LINESIZE 130
SET PAGESIZE 40
REM ********** TABLA CENTROS: *************
INSERT INTO CENTROS VALUES (10, 1, 'Direccion General', 'Av. Constitucion 88', 'Murcia');
INSERT INTO CENTROS VALUES (20, 6, 'Fabrica Zona Sur' , 'Pol. Ind. Don Manue', 'Sevilla');
INSERT INTO CENTROS VALUES (30, 5, 'Oficinas Zona Sur', 'Jabugo 2' , 'Sevilla');
COMMIT;
REM ********** TABLA DEPARTAMENTOS: *************
INSERT INTO DEPARTAMENTOS VALUES (100, 5, NULL , 30, 'Administracion Zona Sur' , 14000000, 'P');
INSERT INTO DEPARTAMENTOS VALUES (200, 1, NULL , 10, 'Direccion General' , 26000000, 'P');
INSERT INTO DEPARTAMENTOS VALUES (300, 2, 200, 10, 'Investigacion y Diseño' , 25000000, 'P');
INSERT INTO DEPARTAMENTOS VALUES (400, 6, NULL , 20, 'Jefatura Fabrica Zona Sur', 6200000, 'F');
INSERT INTO DEPARTAMENTOS VALUES (500, 9, 400, 20, 'Produccion Zona Sur' , 108000000, 'P');
INSERT INTO DEPARTAMENTOS VALUES (600, 3, 100, 30, 'Ventas Zona Sur' , 13500000, 'F');
COMMIT;
REM ********** TABLA EMPLEADOS: *************
INSERT INTO EMPLEADOS VALUES ( 5,100, 1239, SYSDATE,'15/11/1986','55645991T','Arias Grillo, Jairo ', 1, 6200000);
INSERT INTO EMPLEADOS VALUES ( 7,500, NULL, SYSDATE,'05/08/1995','54652636D','Arnaldos Valle, Javier ', 0, 1600000);
INSERT INTO EMPLEADOS VALUES ( 6,400, 23838, SYSDATE,'12/04/1997','71106202D','Avila Ferrete, Raquel Maria ', 0, 5000000);
INSERT INTO EMPLEADOS VALUES ( 9,500, 12124, SYSDATE,'10/12/1996','56646516D','Cabrera Alava, Kilian ', 2, 3100000);
INSERT INTO EMPLEADOS VALUES ( 2,300, 2233, SYSDATE,'11/01/1996','51506642K','Calderon Diaz, Daniel ', 0, 4500000);
INSERT INTO EMPLEADOS VALUES ( 8,500, NULL, SYSDATE,'31/10/1995','55980648H','Calvo Jimenez, Alberto ', 1, 1600000);
INSERT INTO EMPLEADOS VALUES ( 3,600, 2133, SYSDATE,'06/12/1995','64555339D','Camacho Lindsey, Daniel ', 1, 5200000);
INSERT INTO EMPLEADOS VALUES (10,500, NULL, SYSDATE,'09/05/1987','37839343D','Conde Alvarez, Jose Antonio ', 0, 1300000);
INSERT INTO EMPLEADOS VALUES ( 1,200, 1111, SYSDATE,'26/08/1987','76138301V','Del Junco Suarez, Malvina ', 1, 7200000);
INSERT INTO EMPLEADOS VALUES ( 4,600, 3838, SYSDATE,'12/02/1979','67918627L','Fernandez Benito, Javier ', 0, 3200000);
INSERT INTO EMPLEADOS VALUES (15,100, 1239, SYSDATE,'22/04/1993','63453550T','Gallego Carvajal, Juan ', 0, 6200000);
INSERT INTO EMPLEADOS VALUES (17,500, NULL, SYSDATE,'10/02/1997','90676183D','Garcia Vazquez, Jose Manuel ', 0, 1600000);
INSERT INTO EMPLEADOS VALUES (16,400, 23838, SYSDATE,'19/05/1997','22563618D','Gata Masero, Carlos ', 0, 5000000);
INSERT INTO EMPLEADOS VALUES (19,500, 12124, SYSDATE,'29/06/1997','48443585D','Gil Campos, David ', 0, 3100000);
INSERT INTO EMPLEADOS VALUES (12,300, 2233, SYSDATE,'04/11/1997','47141695K','Gomez Alba, Gonzalo ', 0, 4500000);
INSERT INTO EMPLEADOS VALUES (18,500, NULL, SYSDATE,'18/01/1988','76723706H','Jimenez Campos, Alejandro ', 0, 1600000);
INSERT INTO EMPLEADOS VALUES (13,600, 2133, SYSDATE,'01/01/1997','22599031D','Jimenez Garcia, Jose Manuel ', 0, 5200000);
INSERT INTO EMPLEADOS VALUES (20,500, NULL, SYSDATE,'06/05/1989','76186874D','Leon Vazquez, Rafael ', 0, 1300000);
INSERT INTO EMPLEADOS VALUES (11,200, 1111, SYSDATE,'27/09/1997','76647678V','Marquez Funes, Marcos ', 0, 7200000);
INSERT INTO EMPLEADOS VALUES (14,600, 3838, SYSDATE,'09/01/1989','92369400L','Matito Lozano, Carmen ', 0, 3200000);
INSERT INTO EMPLEADOS VALUES (25,100, 1239, SYSDATE,'16/12/1992','54523162T','Menacho Cabo, Pedro Jose ', 0, 6200000);
INSERT INTO EMPLEADOS VALUES (27,500, NULL, SYSDATE,'04/12/1996','34287936D','Mendizabal Romero, Luis ', 0, 1600000);
INSERT INTO EMPLEADOS VALUES (26,400, 23838, SYSDATE,'24/01/1979','54015399D','Montane Rodriguez, Francisco Javier', 0, 5000000);
INSERT INTO EMPLEADOS VALUES (29,500, 12124, SYSDATE,'06/03/1993','85750368D','Montes Rodriguez, Victor ', 0, 3100000);
INSERT INTO EMPLEADOS VALUES (22,300, 2233, SYSDATE,'30/03/1991','46167848K','Perez Alvarez, Javier ', 0, 4500000);
INSERT INTO EMPLEADOS VALUES (28,500, NULL, SYSDATE,'24/09/1996','53036510H','Pineda Santos, Jose Manuel ', 0, 1600000);
INSERT INTO EMPLEADOS VALUES (23,600, 2133, SYSDATE,'07/04/1995','65408034D','Pires Barranco, Amador Claudio ', 0, 5200000);
INSERT INTO EMPLEADOS VALUES (30,500, NULL, SYSDATE,'06/08/1998','27892539D','Pozo Martin, Ismael ', 0, 1300000);
INSERT INTO EMPLEADOS VALUES (21,200, 1111, SYSDATE,'25/12/1994','59126147V','Punta Perez, Gonzalo ', 0, 7200000);
INSERT INTO EMPLEADOS VALUES (24,600, 3838, SYSDATE,'30/05/1992','52426286L','Reina Ramirez, Joaquin Javier ', 0, 3200000);
INSERT INTO EMPLEADOS VALUES (35,100, 1239, SYSDATE,'29/03/1994','27962126T','Rivas Barba, Miguel ', 0, 6200000);
INSERT INTO EMPLEADOS VALUES (31,500, NULL, SYSDATE,'13/09/1993','22481393D','Rolo Vera, Luis Miguel ', 0, 1600000);
INSERT INTO EMPLEADOS VALUES (32,400, 23838, SYSDATE,'31/03/1995','56373194D','Rufo Rodriguez, Alejandro ', 0, 5000000);
INSERT INTO EMPLEADOS VALUES (33,500, 12124, SYSDATE,'29/12/1997','36090320D','Toscano Fernandez, Juan ', 0, 3100000);
INSERT INTO EMPLEADOS VALUES (34,300, 2233, SYSDATE,'23/07/1997','93739487K','Valverde Gallego, Enrique ', 0, 4500000);
UPDATE EMPLEADOS SET FECINC_EM = ADD_MONTHS(FECINC_EM,-TO_CHAR(FECNAC_EM,'DD'));
COMMIT;
REM ********** TABLA HIJOS: *************
INSERT INTO HIJOS VALUES (8, 1, '14/03/2015','Calvo Rey, Ana');
INSERT INTO HIJOS VALUES (9, 1, '28/07/2016','Cabrera Santos, Elvira');
INSERT INTO HIJOS VALUES (9, 2, '28/07/2016','Cabrera Santos, Kilian');
INSERT INTO HIJOS VALUES (3, 1, '12/09/2015','Camacho Rey, Jesus');
INSERT INTO HIJOS VALUES (5, 1, '06/03/2014','Arias Calvo, Mateo');
INSERT INTO HIJOS VALUES (1, 1, '12/12/2005','Ruiz Del Junco, Juan');
COMMIT;
REM ********** CLAVES AJENAS *************************
ALTER TABLE EMPLEADOS ADD CONSTRAINT FK_DEPART FOREIGN KEY (DEPT_EM ) REFERENCES DEPARTAMENTOS ON DELETE CASCADE;
ALTER TABLE CENTROS ADD CONSTRAINT FK_DIR FOREIGN KEY (DIRECTOR_CE) REFERENCES EMPLEADOS ON DELETE CASCADE;
ALTER TABLE DEPARTAMENTOS ADD CONSTRAINT FK_DIRER FOREIGN KEY (DIRECTOR_DE) REFERENCES EMPLEADOS ON DELETE CASCADE;
ALTER TABLE DEPARTAMENTOS ADD CONSTRAINT FK_DEPT FOREIGN KEY (DEPTJEFE_DE) REFERENCES DEPARTAMENTOS ON DELETE CASCADE;
ALTER TABLE DEPARTAMENTOS ADD CONSTRAINT FK_CENTRO FOREIGN KEY (CENTRO_DE) REFERENCES CENTROS ON DELETE CASCADE;
ALTER TABLE HIJOS ADD CONSTRAINT FK_PADRE FOREIGN KEY (PADRE_HI) REFERENCES EMPLEADOS ON DELETE CASCADE;
COMMIT;
REM ********** FIN *************************
|
CREATE TABLE `books` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`price` varchar(16) DEFAULT NULL,
`typeId` bigint(20) DEFAULT NULL,
`author` varchar(255) DEFAULT NULL,
`press` varchar(255) DEFAULT NULL,
`number` int DEFAULT NULL,
`orderId` bigint(20),
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
CONSTRAINT `FK_book_type_id` FOREIGN KEY (`typeId`) REFERENCES `book_type` (`id`),
CONSTRAINT `FK_book_order_id` FOREIGN KEY (`orderId`) REFERENCES `order` (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8; |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
CREATE TABLE `vy_address` (
`address_id` bigint(20) NOT NULL,
`address` varchar(2000) DEFAULT NULL,
`city` varchar(100) DEFAULT NULL,
`postal_code` varchar(11) DEFAULT NULL,
`country` varchar(100) DEFAULT NULL,
`state` varchar(100) DEFAULT NULL,
`landmark` varchar(2000) DEFAULT NULL,
`alternate_address` varchar(2000) DEFAULT NULL,
`alternate_city` varchar(100) DEFAULT NULL,
`alternate_postal_code` varchar(11) DEFAULT NULL,
`alternate_country` varchar(100) DEFAULT NULL,
`alternate_state` varchar(100) DEFAULT NULL,
`alternate_landmark` varchar(2000) DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Table structure for table `vy_akshay_patra`
--
CREATE TABLE `vy_akshay_patra` (
`akshay_patra_id` bigint(20) NOT NULL,
`akshay_patra_num` varchar(60) NOT NULL,
`patra_allocation_date` date NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`trash` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `vy_designation`
--
CREATE TABLE `vy_designation` (
`designation_id` bigint(20) NOT NULL,
`designation_name` varchar(100) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Table structure for table `vy_email`
--
CREATE TABLE `vy_email` (
`email_id` bigint(20) NOT NULL,
`email_address_1` varchar(100) DEFAULT NULL,
`email_address_2` varchar(100) DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Table structure for table `vy_member`
--
CREATE TABLE `vy_member` (
`member_id` bigint(20) NOT NULL,
`first_name` varchar(60) DEFAULT NULL,
`middle_name` varchar(60) DEFAULT NULL,
`last_name` varchar(60) DEFAULT NULL,
`dob` date DEFAULT NULL,
`gender` varchar(1) DEFAULT NULL,
`mother_name` varchar(120) DEFAULT NULL,
`father_name` varchar(120) DEFAULT NULL,
`phone_no` varchar(20) DEFAULT NULL,
`alternate_phone_no` varchar(20) DEFAULT NULL,
`address_id` bigint(20) DEFAULT NULL,
`email_id` bigint(20) DEFAULT NULL,
`akshay_patra_id` bigint(20) DEFAULT NULL,
`government_id` varchar(20) DEFAULT NULL,
`government_id_type` varchar(60) DEFAULT NULL,
`nationality` varchar(60) DEFAULT NULL,
`member_photo_path` varchar(500) DEFAULT NULL,
`govt_id_photo_path` varchar(500) DEFAULT NULL,
`associated_since` date DEFAULT NULL,
`profession` varchar(60) DEFAULT NULL,
`practice_level` int(11) DEFAULT NULL,
`send_email` tinyint(1) NOT NULL DEFAULT '0',
`call_flag` tinyint(1) NOT NULL DEFAULT '0',
`sms` tinyint(1) NOT NULL DEFAULT '0',
`patrika_subscribed` tinyint(1) NOT NULL DEFAULT '0',
`has_swarved` tinyint(1) NOT NULL DEFAULT '0',
`updeshta_member_id` bigint(20) DEFAULT NULL,
`updeshta_name` varchar(240) DEFAULT NULL,
`updesh_venue` varchar(120) DEFAULT NULL,
`member_photo_id` bigint(20) DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`create_source` varchar(60) DEFAULT NULL,
`update_source` varchar(60) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Table structure for table `vy_member_designation`
--
CREATE TABLE `vy_member_designation` (
`member_id` bigint(20) NOT NULL,
`designation_id` bigint(20) NOT NULL,
`honour_date` date DEFAULT NULL,
`is_global` tinyint(1) DEFAULT '0',
`dismiss_date` date DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`trash` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `vy_member_photo`
--
CREATE TABLE `vy_member_photo` (
`member_photo_id` bigint(20) NOT NULL,
`type` varchar(60) DEFAULT NULL,
`photo_byte` longblob NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `vy_permission`
--
CREATE TABLE `vy_permission` (
`permission_id` bigint(20) NOT NULL,
`permission_name` varchar(100) DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Table structure for table `vy_role`
--
CREATE TABLE `vy_role` (
`role_id` bigint(20) NOT NULL,
`role_name` varchar(100) DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Table structure for table `vy_role_permission`
--
CREATE TABLE `vy_role_permission` (
`role_permission_id` bigint(20) NOT NULL,
`role_id` bigint(20) NOT NULL,
`permission_id` bigint(20) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Table structure for table `vy_user`
--
CREATE TABLE `vy_user` (
`user_id` bigint(20) NOT NULL,
`member_id` bigint(20) NOT NULL,
`username` varchar(100) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Table structure for table `vy_user_role`
--
CREATE TABLE `vy_user_role` (
`user_role_id` bigint(20) NOT NULL,
`role_id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`trash` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for table `vy_address`
--
ALTER TABLE `vy_address`
ADD PRIMARY KEY (`address_id`);
--
-- Indexes for table `vy_akshay_patra`
--
ALTER TABLE `vy_akshay_patra`
ADD PRIMARY KEY (`akshay_patra_id`),
ADD UNIQUE KEY `akshay_patra_num` (`akshay_patra_num`),
ADD UNIQUE KEY `UK_3qnjfrjcowclukehb5nt7ncp2` (`akshay_patra_num`);
--
-- Indexes for table `vy_designation`
--
ALTER TABLE `vy_designation`
ADD PRIMARY KEY (`designation_id`),
ADD UNIQUE KEY `designation_name` (`designation_name`),
ADD UNIQUE KEY `UK_mkxtyoe9ws5d8x1qryuhp8p5i` (`designation_name`);
--
-- Indexes for table `vy_email`
--
ALTER TABLE `vy_email`
ADD PRIMARY KEY (`email_id`);
--
-- Indexes for table `vy_member`
--
ALTER TABLE `vy_member`
ADD PRIMARY KEY (`member_id`),
ADD KEY `updeshta_member_id` (`updeshta_member_id`),
ADD KEY `FKnggg233mehlvk5mbk5ncwcyya` (`address_id`),
ADD KEY `FKs3y73i6oyfa8tu025swucdpwp` (`akshay_patra_id`),
ADD KEY `FKqyh7krb5uecjwdn3w9urmdw8h` (`email_id`),
ADD KEY `FKn1qn2eh79deg214e1ec2oagqs` (`member_photo_id`);
--
-- Indexes for table `vy_member_designation`
--
ALTER TABLE `vy_member_designation`
ADD PRIMARY KEY (`member_id`,`designation_id`),
ADD KEY `member_id` (`member_id`),
ADD KEY `FK8ngf42kpw7s3e4pd26gdgvejt` (`designation_id`);
--
-- Indexes for table `vy_member_photo`
--
ALTER TABLE `vy_member_photo`
ADD PRIMARY KEY (`member_photo_id`);
--
-- Indexes for table `vy_permission`
--
ALTER TABLE `vy_permission`
ADD PRIMARY KEY (`permission_id`),
ADD UNIQUE KEY `permission_name` (`permission_name`),
ADD UNIQUE KEY `UK_bwh0ta0pbj33uc9nw9qeouebo` (`permission_name`);
--
-- Indexes for table `vy_role`
--
ALTER TABLE `vy_role`
ADD PRIMARY KEY (`role_id`),
ADD UNIQUE KEY `role_name` (`role_name`),
ADD UNIQUE KEY `UK_pdpi8ky24tjri51rl6jcgbast` (`role_name`);
--
-- Indexes for table `vy_role_permission`
--
ALTER TABLE `vy_role_permission`
ADD PRIMARY KEY (`role_permission_id`),
ADD KEY `role_id` (`role_id`),
ADD KEY `permission_id` (`permission_id`),
ADD UNIQUE( `role_id`, `permission_id`);
--
-- Indexes for table `vy_user`
--
ALTER TABLE `vy_user`
ADD PRIMARY KEY (`user_id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `UK_b3ki6csij0wp22l46ffuwkqc7` (`username`),
ADD KEY `member_id` (`member_id`);
--
-- Indexes for table `vy_user_role`
--
ALTER TABLE `vy_user_role`
ADD PRIMARY KEY (`user_role_id`),
ADD KEY `FKo8ssu336b709s3mx728w3b3h0` (`role_id`),
ADD KEY `FKnxrkfie7g0p2gd5j0t0ej4t9i` (`user_id`);
--
-- AUTO_INCREMENT for table `vy_address`
--
ALTER TABLE `vy_address`
MODIFY `address_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_akshay_patra`
--
ALTER TABLE `vy_akshay_patra`
MODIFY `akshay_patra_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_designation`
--
ALTER TABLE `vy_designation`
MODIFY `designation_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_email`
--
ALTER TABLE `vy_email`
MODIFY `email_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_member`
--
ALTER TABLE `vy_member`
MODIFY `member_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1002;
--
-- AUTO_INCREMENT for table `vy_member_photo`
--
ALTER TABLE `vy_member_photo`
MODIFY `member_photo_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_permission`
--
ALTER TABLE `vy_permission`
MODIFY `permission_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_role`
--
ALTER TABLE `vy_role`
MODIFY `role_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_role_permission`
--
ALTER TABLE `vy_role_permission`
MODIFY `role_permission_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_user`
--
ALTER TABLE `vy_user`
MODIFY `user_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `vy_user_role`
--
ALTER TABLE `vy_user_role`
MODIFY `user_role_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- Constraints for table `vy_member`
--
ALTER TABLE `vy_member`
ADD CONSTRAINT `FKn1qn2eh79deg214e1ec2oagqs` FOREIGN KEY (`member_photo_id`) REFERENCES `vy_member_photo` (`member_photo_id`),
ADD CONSTRAINT `FKnggg233mehlvk5mbk5ncwcyya` FOREIGN KEY (`address_id`) REFERENCES `vy_address` (`address_id`),
ADD CONSTRAINT `FKqyh7krb5uecjwdn3w9urmdw8h` FOREIGN KEY (`email_id`) REFERENCES `vy_email` (`email_id`),
ADD CONSTRAINT `FKs3y73i6oyfa8tu025swucdpwp` FOREIGN KEY (`akshay_patra_id`) REFERENCES `vy_akshay_patra` (`akshay_patra_id`),
ADD CONSTRAINT `vy_member_ibfk_1` FOREIGN KEY (`address_id`) REFERENCES `vy_address` (`address_id`),
ADD CONSTRAINT `vy_member_ibfk_2` FOREIGN KEY (`akshay_patra_id`) REFERENCES `vy_akshay_patra` (`akshay_patra_id`),
ADD CONSTRAINT `vy_member_ibfk_3` FOREIGN KEY (`email_id`) REFERENCES `vy_email` (`email_id`),
ADD CONSTRAINT `vy_member_ibfk_4` FOREIGN KEY (`member_photo_id`) REFERENCES `vy_member_photo` (`member_photo_id`);
--
-- Constraints for table `vy_member_designation`
--
ALTER TABLE `vy_member_designation`
ADD CONSTRAINT `FK8ngf42kpw7s3e4pd26gdgvejt` FOREIGN KEY (`designation_id`) REFERENCES `vy_designation` (`designation_id`),
ADD CONSTRAINT `FKlilnbrrs8gc00hais1rn7s2pd` FOREIGN KEY (`member_id`) REFERENCES `vy_member` (`member_id`),
ADD CONSTRAINT `vy_member_designation_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `vy_member` (`member_id`),
ADD CONSTRAINT `vy_member_designation_ibfk_2` FOREIGN KEY (`designation_id`) REFERENCES `vy_designation` (`designation_id`);
--
-- Constraints for table `vy_role_permission`
--
ALTER TABLE `vy_role_permission`
ADD CONSTRAINT `FK3e6b6s2xj2fupjnhbh7p4g20t` FOREIGN KEY (`role_id`) REFERENCES `vy_role` (`role_id`),
ADD CONSTRAINT `FKhodgirvf6yevvf2ajt5ckm2p1` FOREIGN KEY (`permission_id`) REFERENCES `vy_permission` (`permission_id`),
ADD CONSTRAINT `vy_role_permission_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `vy_role` (`role_id`),
ADD CONSTRAINT `vy_role_permission_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `vy_permission` (`permission_id`);
--
-- Constraints for table `vy_user`
--
ALTER TABLE `vy_user`
ADD CONSTRAINT `FKj8ilfjrdai89et5x1qsjqeq5m` FOREIGN KEY (`member_id`) REFERENCES `vy_member` (`member_id`),
ADD CONSTRAINT `vy_user_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `vy_member` (`member_id`);
--
-- Constraints for table `vy_user_role`
--
ALTER TABLE `vy_user_role`
ADD CONSTRAINT `FKnxrkfie7g0p2gd5j0t0ej4t9i` FOREIGN KEY (`user_id`) REFERENCES `vy_user` (`user_id`),
ADD CONSTRAINT `FKo8ssu336b709s3mx728w3b3h0` FOREIGN KEY (`role_id`) REFERENCES `vy_role` (`role_id`),
ADD CONSTRAINT `vy_user_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `vy_user` (`user_id`),
ADD CONSTRAINT `vy_user_role_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `vy_role` (`role_id`);
COMMIT; |
INSERT INTO deals(id, user_id, status_id, title, description)
VALUES (1, 1, 1, 'deal1', 'deal1_desc'),
(2, 1, 1, 'deal2', 'deal2_desc'),
(3, 1, 1, 'deal3', 'deal3_desc'),
(4, 2, 1, 'deal4', 'deal4_desc'),
(5, 2, 1, 'deal5', 'deal5_desc'),
(6, 2, 1, 'deal6', 'deal6_desc'),
(7, 3, 1, 'deal7', 'deal7_desc'),
(8, 3, 1, 'deal8', 'deal8_desc'); |
SELECT
piskunova_day.name, COUNT(*)
FROM piskunova_course
INNER JOIN piskunova_graduate ON piskunova_graduate.course_id = piskunova_course.course_id
INNER JOIN piskunova_graduate_time ON piskunova_graduate_time.graduate_id= piskunova_graduate.graduate_id
INNER JOIN piskunova_day ON piskunova_graduate_time.day_id=piskunova_day.day_id
GROUP BY piskunova_day.day_id
|
SELECT [Analyst], [Client Name], [Examiner Login Id/Name], [Examiner E-Mail], COUNT([Examiner Login Id/Name]) FROM OSHA.dbo.OCE WHERE
[Examiner E-Mail] IN ('michelle.hernandez@sedgwick.com')
--[Examiner Login Id/Name] IN ('MHERNAN0')
GROUP BY [Analyst], [Client Name], [Examiner Login Id/Name],[Examiner E-Mail]
ORDER BY [Examiner Login Id/Name] ASC |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 20-Abr-2016 às 14:40
-- Versão do servidor: 5.6.17
-- PHP Version: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `inventario`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `categoria`
--
CREATE TABLE IF NOT EXISTS `categoria` (
`idCategoria` bigint(20) NOT NULL AUTO_INCREMENT,
`cd_categoria` int(11) NOT NULL,
`nome` varchar(50) NOT NULL,
PRIMARY KEY (`idCategoria`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `usuario`
--
CREATE TABLE IF NOT EXISTS `usuario` (
`id_usuario` bigint(20) NOT NULL DEFAULT '0',
`email` varchar(120) NOT NULL,
`senha` varchar(20) DEFAULT NULL,
`data_login` datetime DEFAULT NULL,
PRIMARY KEY (`id_usuario`),
UNIQUE KEY `UK_5171l57faosmj8myawaucatdw` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `usuario`
--
INSERT INTO `usuario` (`id_usuario`, `email`, `senha`, `data_login`) VALUES
(1, 'developer@test.com', 'welcome1', '2016-04-19 18:03:50');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.